next is event file handling in bar2

This commit is contained in:
Anselm R. Garbe 2006-01-28 22:52:02 +02:00
parent 3448ec0f36
commit 580f296f49

View File

@ -625,6 +625,25 @@ xclunk(Req *r)
return 0; return 0;
} }
static int
do9p(Req *r)
{
switch(r->fcall.id) {
case TVERSION: return xversion(r); break;
case TATTACH: return xattach(r); break;
case TWALK: return xwalk(r); break;
case TREMOVE: return xremove(r); break;
case TOPEN: return xopen(r); break;
case TREAD: return xread(r); break;
case TWRITE: return xwrite(r); break;
case TCLUNK: return xclunk(r); break;
case TSTAT: return xstat(r); break;
default:
break;
}
return -1;
}
static void static void
handle_9p_req(IXPServer *s, IXPConn *c) handle_9p_req(IXPServer *s, IXPConn *c)
{ {
@ -637,33 +656,18 @@ handle_9p_req(IXPServer *s, IXPConn *c)
return; return;
} }
/*fprintf(stderr, "msize=%d\n", msize);*/ /*fprintf(stderr, "msize=%d\n", msize);*/
if((msize = ixp_msg_to_fcall(msg, IXP_MAX_MSG, &r->fcall))) { if((msize = ixp_msg_to_fcall(msg, IXP_MAX_MSG, &r->fcall)))
switch(r->fcall.id) { ret = do9p(r);
case TVERSION: ret = xversion(r); break;
case TATTACH: ret = xattach(r); break;
case TWALK: ret = xwalk(r); break;
case TREMOVE: ret = xremove(r); break;
case TOPEN: ret = xopen(r); break;
case TREAD: ret = xread(r); break;
case TWRITE: ret = xwrite(r); break;
case TCLUNK: ret = xclunk(r); break;
case TSTAT: ret = xstat(r); break;
default:
goto error_do9p;
break;
}
}
if(ret == -1) { if(ret == -1) {
error_do9p:
/*fprintf(stderr, "function id=%d\n", s->fcall.id);*/ /*fprintf(stderr, "function id=%d\n", s->fcall.id);*/
if(!errstr) if(!errstr)
errstr = "function not supported"; errstr = "function not supported";
r->fcall.id = RERROR; r->fcall.id = RERROR;
cext_strlcpy(r->fcall.errstr, errstr, sizeof(r->fcall.errstr)); cext_strlcpy(r->fcall.errstr, errstr, sizeof(r->fcall.errstr));
} }
msize = ixp_fcall_to_msg(&r->fcall, msg, IXP_MAX_MSG); msize = ixp_fcall_to_msg(&r->fcall, msg, IXP_MAX_MSG);
if(ixp_send_message(c->fd, msg, msize, &errstr) != msize) if(ixp_send_message(c->fd, msg, msize, &errstr) != msize)
ixp_server_free_conn(s, c); ixp_server_free_conn(s, c);
} }
static void static void