mirror of
https://github.com/0intro/wmii
synced 2024-12-24 04:16:50 +03:00
proceeded
This commit is contained in:
parent
a4c81cb8f1
commit
66a3d98ab9
@ -994,7 +994,7 @@ do_pend_fcall(char *event)
|
||||
for(i = 0; (i < srv.connsz) && srv.conn[i]; i++) {
|
||||
IXPConn *c = srv.conn[i];
|
||||
/* all pending TREADs are on /event, so no qid checking necessary */
|
||||
while((fcall = ixp_server_dequeue_fcall(c, TREAD))) {
|
||||
while((fcall = ixp_server_dequeue_fcall_id(c, TREAD))) {
|
||||
IXPMap *m = ixp_server_fid2map(c, fcall->fid);
|
||||
unsigned char *p = fcall->data;
|
||||
|
||||
|
@ -765,7 +765,7 @@ do_pend_fcall(char *event)
|
||||
for(i = 0; (i < srv.connsz) && srv.conn[i]; i++) {
|
||||
IXPConn *c = srv.conn[i];
|
||||
/* all pending TREADs are on /event, so no qid checking necessary */
|
||||
while((fcall = ixp_server_dequeue_fcall(c, TREAD))) {
|
||||
while((fcall = ixp_server_dequeue_fcall_id(c, TREAD))) {
|
||||
IXPMap *m = ixp_server_fid2map(c, fcall->fid);
|
||||
unsigned char *p = fcall->data;
|
||||
|
||||
|
47
cmd/wmiifs.c
47
cmd/wmiifs.c
@ -39,6 +39,7 @@ static IXPServer srv;
|
||||
static Mount **mount = nil;
|
||||
static size_t mountsz = 0;
|
||||
static size_t nmount = 0;
|
||||
static unsigned short tag = 0;
|
||||
static unsigned char *msg[IXP_MAX_MSG];
|
||||
|
||||
static void rx_fcall(IXPConn *c);
|
||||
@ -218,7 +219,6 @@ mkqid(Qid *dir, char *wname, Qid *new, Bool iswalk)
|
||||
static char *
|
||||
xwalk(IXPConn *c, Fcall *fcall)
|
||||
{
|
||||
static unsigned short tag = 0;
|
||||
unsigned short nwqid = 0;
|
||||
Qid dir = root_qid;
|
||||
IXPMap *m;
|
||||
@ -248,6 +248,7 @@ xwalk(IXPConn *c, Fcall *fcall)
|
||||
xclose_mount(mnt->respond);
|
||||
return Enofile;
|
||||
}
|
||||
/* message will be received by mnt->respond */
|
||||
ixp_server_enqueue_fcall(mnt->respond, fcall);
|
||||
return nil;
|
||||
}
|
||||
@ -277,19 +278,51 @@ xwalk(IXPConn *c, Fcall *fcall)
|
||||
return nil;
|
||||
}
|
||||
|
||||
static Mount *
|
||||
map2mount(IXPMap *m)
|
||||
{
|
||||
unsigned short id;
|
||||
int i;
|
||||
if((id = qpath_id(m->qid.path))) { /* remote */
|
||||
i = index_of_id(id);
|
||||
if((i >= 0) && (i < nmount))
|
||||
return mount[i];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
static char *
|
||||
xopen(IXPConn *c, Fcall *fcall)
|
||||
{
|
||||
IXPMap *m = ixp_server_fid2map(c, fcall->fid);
|
||||
Mount *mnt;
|
||||
|
||||
if(!m)
|
||||
return Enofid;
|
||||
if(!(fcall->mode | IXP_OREAD) && !(fcall->mode | IXP_OWRITE))
|
||||
return Enomode;
|
||||
fcall->id = ROPEN;
|
||||
fcall->qid = m->qid;
|
||||
fcall->iounit = 2048;
|
||||
ixp_server_respond_fcall(c, fcall);
|
||||
if((mnt = map2mount(m))) { /* remote */
|
||||
unsigned int msize;
|
||||
ixp_fcall_to_msg(fcall, msg, IXP_MAX_MSG);
|
||||
ixp_msg_to_fcall(msg, IXP_MAX_MSG, &mnt->client.fcall);
|
||||
fcall->tag = mnt->client.fcall.tag = tag++;
|
||||
|
||||
msize = ixp_fcall_to_msg(&mnt->client.fcall, msg, IXP_MAX_MSG);
|
||||
mnt->client.errstr = 0;
|
||||
if(ixp_send_message(mnt->client.fd, msg, msize, &mnt->client.errstr) != msize) {
|
||||
xclose_mount(mnt->respond);
|
||||
return Enofile;
|
||||
}
|
||||
/* message will be received by mnt->respond */
|
||||
ixp_server_enqueue_fcall(mnt->respond, fcall);
|
||||
return nil;
|
||||
}
|
||||
else { /* local */
|
||||
if(!(fcall->mode | IXP_OREAD) && !(fcall->mode | IXP_OWRITE))
|
||||
return Enomode;
|
||||
fcall->id = ROPEN;
|
||||
fcall->qid = m->qid;
|
||||
fcall->iounit = 2048;
|
||||
ixp_server_respond_fcall(c, fcall);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,8 @@ void ixp_server_enqueue_fcall(IXPConn *c, Fcall *fcall);
|
||||
unsigned int ixp_server_receive_fcall(IXPConn *c, Fcall *fcall);
|
||||
int ixp_server_respond_fcall(IXPConn *c, Fcall *fcall);
|
||||
int ixp_server_respond_error(IXPConn *c, Fcall *fcall, char *errstr);
|
||||
Fcall *ixp_server_dequeue_fcall(IXPConn *c, unsigned short id);
|
||||
Fcall *ixp_server_dequeue_fcall_tag(IXPConn *c, unsigned short tag);
|
||||
Fcall *ixp_server_dequeue_fcall_id(IXPConn *c, unsigned char id);
|
||||
void ixp_server_close(IXPServer *s);
|
||||
|
||||
/* socket.c */
|
||||
|
@ -119,7 +119,22 @@ ixp_server_enqueue_fcall(IXPConn *c, Fcall *fcall)
|
||||
}
|
||||
|
||||
Fcall *
|
||||
ixp_server_dequeue_fcall(IXPConn *c, unsigned short id)
|
||||
ixp_server_dequeue_fcall_tag(IXPConn *c, unsigned short tag)
|
||||
{
|
||||
Fcall *fcall = nil;
|
||||
size_t i;
|
||||
for(i = 0; (i < c->pendsz) && c->pend[i]; i++)
|
||||
if(c->pend[i]->tag == tag) {
|
||||
fcall = c->pend[i];
|
||||
cext_array_detach((void **)c->pend, fcall, &c->pendsz);
|
||||
break;
|
||||
}
|
||||
/* free it */
|
||||
return fcall;
|
||||
}
|
||||
|
||||
Fcall *
|
||||
ixp_server_dequeue_fcall_id(IXPConn *c, unsigned char id)
|
||||
{
|
||||
Fcall *fcall = nil;
|
||||
size_t i;
|
||||
|
Loading…
Reference in New Issue
Block a user