libixp

git clone git://oldgit.suckless.org/libixp/
Log | Files | Refs | LICENSE

commit 4e768deb11ddb2c1bdb9241fa8c53768e25303bb
parent b78ea87094b3184ffd43aeb3a0f7971af2295ed5
Author: Kris Maglione <jg@suckless.org>
Date:   Sun, 11 Feb 2007 20:34:17 -0500

Revert SunCC compatibility changes


Diffstat:
client.c | 56++++++++++++++++++++++++++++----------------------------
ixp.h | 24++++++++++++------------
ixpc.c | 8++++----
message.c | 142++++++++++++++++++++++++++++++++++++++++----------------------------------------
request.c | 66+++++++++++++++++++++++++++++++++---------------------------------
5 files changed, 148 insertions(+), 148 deletions(-)

diff --git a/client.c b/client.c @@ -24,7 +24,7 @@ ixp_client_do_fcall(IXPClient *c) { return -1; } if(c->ofcall.type == RERROR) { - c->errstr = c->ofcall.data.rerror.ename; + c->errstr = c->ofcall.ename; return -1; } return 0; @@ -38,33 +38,33 @@ ixp_client_dial(IXPClient *c, char *sockfile, unsigned int rootfid) { } c->ifcall.type = TVERSION; c->ifcall.tag = IXP_NOTAG; - c->ifcall.data.tversion.msize = IXP_MAX_MSG; - c->ifcall.data.tversion.version = IXP_VERSION; + c->ifcall.msize = IXP_MAX_MSG; + c->ifcall.version = IXP_VERSION; if(ixp_client_do_fcall(c) == -1) { fprintf(stderr, "error: %s\n", c->errstr); ixp_client_hangup(c); return -1; } - if(strncmp(c->ofcall.data.rversion.version, IXP_VERSION, strlen(IXP_VERSION))) { + if(strncmp(c->ofcall.version, IXP_VERSION, strlen(IXP_VERSION))) { fprintf(stderr, "error: %s\n", c->errstr); c->errstr = "9P versions differ"; ixp_client_hangup(c); return -1; /* we cannot handle this version */ } - free(c->ofcall.data.rversion.version); + free(c->ofcall.version); c->root_fid = rootfid; c->ifcall.type = TATTACH; c->ifcall.tag = IXP_NOTAG; c->ifcall.fid = c->root_fid; - c->ifcall.data.tauth.afid = IXP_NOFID; - c->ifcall.data.tauth.uname = getenv("USER"); - c->ifcall.data.tauth.aname = ""; + c->ifcall.afid = IXP_NOFID; + c->ifcall.uname = getenv("USER"); + c->ifcall.aname = ""; if(ixp_client_do_fcall(c) == -1) { fprintf(stderr, "error: %s\n", c->errstr); ixp_client_hangup(c); return -1; } - c->root_qid = c->ofcall.data.rattach.qid; + c->root_qid = c->ofcall.qid; return 0; } @@ -85,9 +85,9 @@ ixp_client_create(IXPClient *c, unsigned int dirfid, char *name, c->ifcall.type = TCREATE; c->ifcall.tag = IXP_NOTAG; c->ifcall.fid = dirfid; - c->ifcall.data.tcreate.name = name; - c->ifcall.data.tcreate.perm = perm; - c->ifcall.data.tcreate.mode = mode; + c->ifcall.name = name; + c->ifcall.perm = perm; + c->ifcall.mode = mode; return ixp_client_do_fcall(c); } @@ -98,12 +98,12 @@ ixp_client_walk(IXPClient *c, unsigned int newfid, char *filepath) { c->ifcall.type = TWALK; c->ifcall.fid = c->root_fid; - c->ifcall.data.twalk.newfid = newfid; + c->ifcall.newfid = newfid; if(filepath) { // c->ifcall.name = filepath; // tcreate overlaps with twalk !!! - c->ifcall.data.twalk.nwname = ixp_tokenize(wname, IXP_MAX_WELEM, filepath, '/'); // was "c->ifcall.name" - for(i = 0; i < c->ifcall.data.twalk.nwname; i++) - c->ifcall.data.twalk.wname[i] = wname[i]; + c->ifcall.nwname = ixp_tokenize(wname, IXP_MAX_WELEM, filepath, '/'); // was "c->ifcall.name" + for(i = 0; i < c->ifcall.nwname; i++) + c->ifcall.wname[i] = wname[i]; } return ixp_client_do_fcall(c); } @@ -123,7 +123,7 @@ ixp_client_open(IXPClient *c, unsigned int newfid, unsigned char mode) { c->ifcall.type = TOPEN; c->ifcall.tag = IXP_NOTAG; c->ifcall.fid = newfid; - c->ifcall.data.topen.mode = mode; + c->ifcall.mode = mode; return ixp_client_do_fcall(c); } @@ -140,18 +140,18 @@ int ixp_client_read(IXPClient *c, unsigned int fid, unsigned long long offset, void *result, unsigned int res_len) { - unsigned int bytes = c->ofcall.data.rattach.iounit; + unsigned int bytes = c->ofcall.iounit; c->ifcall.type = TREAD; c->ifcall.tag = IXP_NOTAG; c->ifcall.fid = fid; - c->ifcall.data.tread.offset = offset; - c->ifcall.data.tread.count = res_len < bytes ? res_len : bytes; + c->ifcall.offset = offset; + c->ifcall.count = res_len < bytes ? res_len : bytes; if(ixp_client_do_fcall(c) == -1) return -1; - memcpy(result, c->ofcall.data.rread.data, c->ofcall.data.rread.count); - free(c->ofcall.data.rread.data); - return c->ofcall.data.rread.count; + memcpy(result, c->ofcall.data, c->ofcall.count); + free(c->ofcall.data); + return c->ofcall.count; } int @@ -159,19 +159,19 @@ ixp_client_write(IXPClient *c, unsigned int fid, unsigned long long offset, unsigned int count, unsigned char *data) { - if(count > c->ofcall.data.rattach.iounit) { + if(count > c->ofcall.iounit) { c->errstr = "iounit exceeded"; return -1; } c->ifcall.type = TWRITE; c->ifcall.tag = IXP_NOTAG; c->ifcall.fid = fid; - c->ifcall.data.twrite.offset = offset; - c->ifcall.data.twrite.count = count; - c->ifcall.data.twrite.data = (void *)data; + c->ifcall.offset = offset; + c->ifcall.count = count; + c->ifcall.data = (void *)data; if(ixp_client_do_fcall(c) == -1) return -1; - return c->ofcall.data.rwrite.count; + return c->ofcall.count; } int diff --git a/ixp.h b/ixp.h @@ -163,50 +163,50 @@ typedef struct Fcall { struct { /* Tversion, Rversion */ unsigned int msize; char *version; - } tversion, rversion; + }; struct { /* Tflush */ unsigned short oldtag; - } tflush; + }; struct { /* Rerror */ char *ename; - } rerror; + }; struct { /* Ropen, Rcreate */ Qid qid; /* +Rattach */ unsigned int iounit; - } ropen, rcreate, rattach; + }; struct { /* Rauth */ Qid aqid; - } rauth; + }; struct { /* Tauth, Tattach */ unsigned int afid; char *uname; char *aname; - } tauth, tattach; + }; struct { /* Tcreate */ unsigned int perm; char *name; unsigned char mode; /* +Topen */ - } tcreate, topen; + }; struct { /* Twalk */ unsigned int newfid; unsigned short nwname; char *wname[IXP_MAX_WELEM]; - } twalk; + }; struct { /* Rwalk */ unsigned short nwqid; Qid wqid[IXP_MAX_WELEM]; - } rwalk; + }; struct { /* Twrite */ unsigned long long offset; /* +Tread */ /* +Rread */ unsigned int count; /* +Tread */ char *data; - } twrite, tread, rread, rwrite; + }; struct { /* Twstat, Rstat */ unsigned short nstat; unsigned char *stat; - } twstat, rstat; - } data; + }; + }; } Fcall; typedef struct IXPServer IXPServer; diff --git a/ixpc.c b/ixpc.c @@ -13,11 +13,11 @@ static IXPClient c = { 0 }; static void write_data(unsigned int fid) { - void *data = ixp_emallocz(c.ofcall.data.ropen.iounit); + void *data = ixp_emallocz(c.ofcall.iounit); unsigned long long offset = 0; unsigned int len = 0; - while((len = read(0, data, c.ofcall.data.ropen.iounit)) > 0) { + while((len = read(0, data, c.ofcall.iounit)) > 0) { if(ixp_client_write(&c, fid, offset, len, data) != len) { fprintf(stderr, "ixpc: cannot write file: %s\n", c.errstr); break; @@ -49,7 +49,7 @@ xcreate(char *file) { fprintf(stderr, "ixpc: cannot create file '%s': %s\n", p, c.errstr); return -1; } - if(!(c.ofcall.data.rcreate.qid.type&P9DMDIR)) + if(!(c.ofcall.qid.type&P9DMDIR)) write_data(fid); return ixp_client_close(&c, fid); } @@ -168,7 +168,7 @@ xdir(char *file, int details) { fprintf(stderr, "ixpc: cannot stat file '%s': %s\n", file, c.errstr); return -1; } - buf = c.ofcall.data.rstat.stat; + buf = c.ofcall.stat; ixp_unpack_stat(&buf, NULL, s); if(!(s->mode & IXP_DMDIR)) { print_stat(s, details); diff --git a/message.c b/message.c @@ -36,76 +36,76 @@ ixp_fcall2msg(void *msg, Fcall *fcall, unsigned int msglen) { switch (fcall->type) { case TVERSION: case RVERSION: - ixp_pack_u32(&p, &msize, fcall->data.rversion.msize); - ixp_pack_string(&p, &msize, fcall->data.rversion.version); + ixp_pack_u32(&p, &msize, fcall->msize); + ixp_pack_string(&p, &msize, fcall->version); break; case TAUTH: - ixp_pack_u32(&p, &msize, fcall->data.tauth.afid); - ixp_pack_string(&p, &msize, fcall->data.tauth.uname); - ixp_pack_string(&p, &msize, fcall->data.tauth.aname); + ixp_pack_u32(&p, &msize, fcall->afid); + ixp_pack_string(&p, &msize, fcall->uname); + ixp_pack_string(&p, &msize, fcall->aname); break; case RAUTH: - ixp_pack_qid(&p, &msize, &fcall->data.rauth.aqid); + ixp_pack_qid(&p, &msize, &fcall->aqid); break; case RATTACH: - ixp_pack_qid(&p, &msize, &fcall->data.rattach.qid); + ixp_pack_qid(&p, &msize, &fcall->qid); break; case TATTACH: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_u32(&p, &msize, fcall->data.tattach.afid); - ixp_pack_string(&p, &msize, fcall->data.tattach.uname); - ixp_pack_string(&p, &msize, fcall->data.tattach.aname); + ixp_pack_u32(&p, &msize, fcall->afid); + ixp_pack_string(&p, &msize, fcall->uname); + ixp_pack_string(&p, &msize, fcall->aname); break; case RERROR: - ixp_pack_string(&p, &msize, fcall->data.rerror.ename); + ixp_pack_string(&p, &msize, fcall->ename); break; case TFLUSH: - ixp_pack_u16(&p, &msize, fcall->data.tflush.oldtag); + ixp_pack_u16(&p, &msize, fcall->oldtag); break; case TWALK: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_u32(&p, &msize, fcall->data.twalk.newfid); - ixp_pack_u16(&p, &msize, fcall->data.twalk.nwname); - for(i = 0; i < fcall->data.twalk.nwname; i++) - ixp_pack_string(&p, &msize, fcall->data.twalk.wname[i]); + ixp_pack_u32(&p, &msize, fcall->newfid); + ixp_pack_u16(&p, &msize, fcall->nwname); + for(i = 0; i < fcall->nwname; i++) + ixp_pack_string(&p, &msize, fcall->wname[i]); break; case RWALK: - ixp_pack_u16(&p, &msize, fcall->data.rwalk.nwqid); - for(i = 0; i < fcall->data.rwalk.nwqid; i++) - ixp_pack_qid(&p, &msize, &fcall->data.rwalk.wqid[i]); + ixp_pack_u16(&p, &msize, fcall->nwqid); + for(i = 0; i < fcall->nwqid; i++) + ixp_pack_qid(&p, &msize, &fcall->wqid[i]); break; case TOPEN: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_u8(&p, &msize, fcall->data.topen.mode); + ixp_pack_u8(&p, &msize, fcall->mode); break; case ROPEN: case RCREATE: - ixp_pack_qid(&p, &msize, &fcall->data.rcreate.qid); - ixp_pack_u32(&p, &msize, fcall->data.rcreate.iounit); + ixp_pack_qid(&p, &msize, &fcall->qid); + ixp_pack_u32(&p, &msize, fcall->iounit); break; case TCREATE: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_string(&p, &msize, fcall->data.tcreate.name); - ixp_pack_u32(&p, &msize, fcall->data.tcreate.perm); - ixp_pack_u8(&p, &msize, fcall->data.tcreate.mode); + ixp_pack_string(&p, &msize, fcall->name); + ixp_pack_u32(&p, &msize, fcall->perm); + ixp_pack_u8(&p, &msize, fcall->mode); break; case TREAD: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_u64(&p, &msize, fcall->data.tread.offset); - ixp_pack_u32(&p, &msize, fcall->data.tread.count); + ixp_pack_u64(&p, &msize, fcall->offset); + ixp_pack_u32(&p, &msize, fcall->count); break; case RREAD: - ixp_pack_u32(&p, &msize, fcall->data.rread.count); - ixp_pack_data(&p, &msize, (unsigned char *)fcall->data.rread.data, fcall->data.rread.count); + ixp_pack_u32(&p, &msize, fcall->count); + ixp_pack_data(&p, &msize, (unsigned char *)fcall->data, fcall->count); break; case TWRITE: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_u64(&p, &msize, fcall->data.twrite.offset); - ixp_pack_u32(&p, &msize, fcall->data.twrite.count); - ixp_pack_data(&p, &msize, (unsigned char *)fcall->data.twrite.data, fcall->data.twrite.count); + ixp_pack_u64(&p, &msize, fcall->offset); + ixp_pack_u32(&p, &msize, fcall->count); + ixp_pack_data(&p, &msize, (unsigned char *)fcall->data, fcall->count); break; case RWRITE: - ixp_pack_u32(&p, &msize, fcall->data.rwrite.count); + ixp_pack_u32(&p, &msize, fcall->count); break; case TCLUNK: case TREMOVE: @@ -113,13 +113,13 @@ ixp_fcall2msg(void *msg, Fcall *fcall, unsigned int msglen) { ixp_pack_u32(&p, &msize, fcall->fid); break; case RSTAT: - ixp_pack_u16(&p, &msize, fcall->data.rstat.nstat); - ixp_pack_data(&p, &msize, fcall->data.rstat.stat, fcall->data.rstat.nstat); + ixp_pack_u16(&p, &msize, fcall->nstat); + ixp_pack_data(&p, &msize, fcall->stat, fcall->nstat); break; case TWSTAT: ixp_pack_u32(&p, &msize, fcall->fid); - ixp_pack_u16(&p, &msize, fcall->data.twstat.nstat); - ixp_pack_data(&p, &msize, fcall->data.twstat.stat, fcall->data.twstat.nstat); + ixp_pack_u16(&p, &msize, fcall->nstat); + ixp_pack_data(&p, &msize, fcall->stat, fcall->nstat); break; } if(msize < 0) @@ -143,75 +143,75 @@ ixp_msg2fcall(Fcall *fcall, void *msg, unsigned int msglen) { switch (fcall->type) { case TVERSION: case RVERSION: - ixp_unpack_u32(&p, &msize, &fcall->data.rversion.msize); - ixp_unpack_string(&p, &msize, &fcall->data.rversion.version, &len); + ixp_unpack_u32(&p, &msize, &fcall->msize); + ixp_unpack_string(&p, &msize, &fcall->version, &len); break; case TAUTH: - ixp_unpack_u32(&p, &msize, &fcall->data.tauth.afid); - ixp_unpack_string(&p, &msize, &fcall->data.tauth.uname, &len); - ixp_unpack_string(&p, &msize, &fcall->data.tauth.aname, &len); + ixp_unpack_u32(&p, &msize, &fcall->afid); + ixp_unpack_string(&p, &msize, &fcall->uname, &len); + ixp_unpack_string(&p, &msize, &fcall->aname, &len); break; case RAUTH: - ixp_unpack_qid(&p, &msize, &fcall->data.rauth.aqid); + ixp_unpack_qid(&p, &msize, &fcall->aqid); break; case RATTACH: - ixp_unpack_qid(&p, &msize, &fcall->data.rattach.qid); + ixp_unpack_qid(&p, &msize, &fcall->qid); break; case TATTACH: ixp_unpack_u32(&p, &msize, &fcall->fid); - ixp_unpack_u32(&p, &msize, &fcall->data.tattach.afid); - ixp_unpack_string(&p, &msize, &fcall->data.tattach.uname, &len); - ixp_unpack_string(&p, &msize, &fcall->data.tattach.aname, &len); + ixp_unpack_u32(&p, &msize, &fcall->afid); + ixp_unpack_string(&p, &msize, &fcall->uname, &len); + ixp_unpack_string(&p, &msize, &fcall->aname, &len); break; case RERROR: - ixp_unpack_string(&p, &msize, &fcall->data.rerror.ename, &len); + ixp_unpack_string(&p, &msize, &fcall->ename, &len); break; case TFLUSH: - ixp_unpack_u16(&p, &msize, &fcall->data.tflush.oldtag); + ixp_unpack_u16(&p, &msize, &fcall->oldtag); break; case TWALK: ixp_unpack_u32(&p, &msize, &fcall->fid); - ixp_unpack_u32(&p, &msize, &fcall->data.twalk.newfid); - ixp_unpack_u16(&p, &msize, &fcall->data.twalk.nwname); - ixp_unpack_strings(&p, &msize, fcall->data.twalk.nwname, fcall->data.twalk.wname); + ixp_unpack_u32(&p, &msize, &fcall->newfid); + ixp_unpack_u16(&p, &msize, &fcall->nwname); + ixp_unpack_strings(&p, &msize, fcall->nwname, fcall->wname); break; case RWALK: - ixp_unpack_u16(&p, &msize, &fcall->data.rwalk.nwqid); - for(i = 0; i < fcall->data.rwalk.nwqid; i++) - ixp_unpack_qid(&p, &msize, &fcall->data.rwalk.wqid[i]); + ixp_unpack_u16(&p, &msize, &fcall->nwqid); + for(i = 0; i < fcall->nwqid; i++) + ixp_unpack_qid(&p, &msize, &fcall->wqid[i]); break; case TOPEN: ixp_unpack_u32(&p, &msize, &fcall->fid); - ixp_unpack_u8(&p, &msize, &fcall->data.topen.mode); + ixp_unpack_u8(&p, &msize, &fcall->mode); break; case ROPEN: case RCREATE: - ixp_unpack_qid(&p, &msize, &fcall->data.rcreate.qid); - ixp_unpack_u32(&p, &msize, &fcall->data.rcreate.iounit); + ixp_unpack_qid(&p, &msize, &fcall->qid); + ixp_unpack_u32(&p, &msize, &fcall->iounit); break; case TCREATE: ixp_unpack_u32(&p, &msize, &fcall->fid); - ixp_unpack_string(&p, &msize, &fcall->data.tcreate.name, &len); - ixp_unpack_u32(&p, &msize, &fcall->data.tcreate.perm); - ixp_unpack_u8(&p, &msize, &fcall->data.tcreate.mode); + ixp_unpack_string(&p, &msize, &fcall->name, &len); + ixp_unpack_u32(&p, &msize, &fcall->perm); + ixp_unpack_u8(&p, &msize, &fcall->mode); break; case TREAD: ixp_unpack_u32(&p, &msize, &fcall->fid); - ixp_unpack_u64(&p, &msize, &fcall->data.tread.offset); - ixp_unpack_u32(&p, &msize, &fcall->data.tread.count); + ixp_unpack_u64(&p, &msize, &fcall->offset); + ixp_unpack_u32(&p, &msize, &fcall->count); break; case RREAD: - ixp_unpack_u32(&p, &msize, &fcall->data.rread.count); - ixp_unpack_data(&p, &msize, (void *)&fcall->data.rread.data, fcall->data.rread.count); + ixp_unpack_u32(&p, &msize, &fcall->count); + ixp_unpack_data(&p, &msize, (void *)&fcall->data, fcall->count); break; case TWRITE: ixp_unpack_u32(&p, &msize, &fcall->fid); - ixp_unpack_u64(&p, &msize, &fcall->data.twrite.offset); - ixp_unpack_u32(&p, &msize, &fcall->data.twrite.count); - ixp_unpack_data(&p, &msize, (void *)&fcall->data.twrite.data, fcall->data.twrite.count); + ixp_unpack_u64(&p, &msize, &fcall->offset); + ixp_unpack_u32(&p, &msize, &fcall->count); + ixp_unpack_data(&p, &msize, (void *)&fcall->data, fcall->count); break; case RWRITE: - ixp_unpack_u32(&p, &msize, &fcall->data.rwrite.count); + ixp_unpack_u32(&p, &msize, &fcall->count); break; case TCLUNK: case TREMOVE: @@ -220,12 +220,12 @@ ixp_msg2fcall(Fcall *fcall, void *msg, unsigned int msglen) { break; case RSTAT: ixp_unpack_u16(&p, &msize, &len); - ixp_unpack_data(&p, &msize, &fcall->data.rstat.stat, len); + ixp_unpack_data(&p, &msize, &fcall->stat, len); break; case TWSTAT: ixp_unpack_u32(&p, &msize, &fcall->fid); ixp_unpack_u16(&p, &msize, &len); - ixp_unpack_data(&p, &msize, &fcall->data.twstat.stat, len); + ixp_unpack_data(&p, &msize, &fcall->stat, len); break; } if(msize > 0) diff --git a/request.c b/request.c @@ -106,15 +106,15 @@ ixp_handle_req(P9Req *r) { respond(r, Enofunc); break; case TVERSION: - if(!strncmp(r->ifcall.data.tversion.version, "9P", 3)) { - r->ofcall.data.rversion.version = "9P"; + if(!strncmp(r->ifcall.version, "9P", 3)) { + r->ofcall.version = "9P"; }else - if(!strncmp(r->ifcall.data.tversion.version, "9P2000", 7)) { - r->ofcall.data.rversion.version = "9P2000"; + if(!strncmp(r->ifcall.version, "9P2000", 7)) { + r->ofcall.version = "9P2000"; }else{ - r->ofcall.data.rversion.version = "unknown"; + r->ofcall.version = "unknown"; } - r->ofcall.data.rversion.msize = r->ifcall.data.tversion.msize; + r->ofcall.msize = r->ifcall.msize; respond(r, NULL); break; case TATTACH: @@ -137,7 +137,7 @@ ixp_handle_req(P9Req *r) { srv->clunk(r); break; case TFLUSH: - if(!(r->oldreq = lookupkey(&pc->tagmap, r->ifcall.data.tflush.oldtag))) { + if(!(r->oldreq = lookupkey(&pc->tagmap, r->ifcall.oldtag))) { respond(r, Enotag); return; } @@ -171,11 +171,11 @@ ixp_handle_req(P9Req *r) { respond(r, Enofid); return; } - if((r->fid->qid.type&P9QTDIR) && (r->ifcall.data.topen.mode|P9ORCLOSE) != (P9OREAD|P9ORCLOSE)) { + if((r->fid->qid.type&P9QTDIR) && (r->ifcall.mode|P9ORCLOSE) != (P9OREAD|P9ORCLOSE)) { respond(r, Eisdir); return; } - r->ofcall.data.ropen.qid = r->fid->qid; + r->ofcall.qid = r->fid->qid; if(!pc->srv->open) { respond(r, Enofunc); return; @@ -228,12 +228,12 @@ ixp_handle_req(P9Req *r) { respond(r, "cannot walk from an open fid"); return; } - if(r->ifcall.data.twalk.nwname && !(r->fid->qid.type&P9QTDIR)) { + if(r->ifcall.nwname && !(r->fid->qid.type&P9QTDIR)) { respond(r, Enotdir); return; } - if((r->ifcall.fid != r->ifcall.data.twalk.newfid)) { - if(!(r->newfid = createfid(&pc->fidmap, r->ifcall.data.twalk.newfid, pc))) { + if((r->ifcall.fid != r->ifcall.newfid)) { + if(!(r->newfid = createfid(&pc->fidmap, r->ifcall.newfid, pc))) { respond(r, Edupfid); return; } @@ -274,42 +274,42 @@ respond(P9Req *r, char *error) { break; case TVERSION: assert(!error); - free(r->ifcall.data.tversion.version); - pc->msize = (r->ofcall.data.rversion.msize < IXP_MAX_MSG) ? r->ofcall.data.rversion.msize : IXP_MAX_MSG; + free(r->ifcall.version); + pc->msize = (r->ofcall.msize < IXP_MAX_MSG) ? r->ofcall.msize : IXP_MAX_MSG; free(pc->buf); - pc->buf = ixp_emallocz(r->ofcall.data.rversion.msize); + pc->buf = ixp_emallocz(r->ofcall.msize); break; case TATTACH: if(error) destroyfid(pc, r->fid->fid); - free(r->ifcall.data.tattach.uname); - free(r->ifcall.data.tattach.aname); + free(r->ifcall.uname); + free(r->ifcall.aname); break; case TOPEN: case TCREATE: if(!error) { - r->fid->omode = r->ifcall.data.topen.mode; - r->fid->qid = r->ofcall.data.ropen.qid; + r->fid->omode = r->ifcall.mode; + r->fid->qid = r->ofcall.qid; } - free(r->ifcall.data.topen.name); - r->ofcall.data.ropen.iounit = pc->msize - sizeof(unsigned long); + free(r->ifcall.name); + r->ofcall.iounit = pc->msize - sizeof(unsigned long); break; case TWALK: - if(error || r->ofcall.data.rwalk.nwqid < r->ifcall.data.twalk.nwname) { - if(r->ifcall.fid != r->ifcall.data.twalk.newfid && r->newfid) + if(error || r->ofcall.nwqid < r->ifcall.nwname) { + if(r->ifcall.fid != r->ifcall.newfid && r->newfid) destroyfid(pc, r->newfid->fid); - if(!error && r->ofcall.data.rwalk.nwqid == 0) + if(!error && r->ofcall.nwqid == 0) error = Enofile; }else{ - if(r->ofcall.data.rwalk.nwqid == 0) + if(r->ofcall.nwqid == 0) r->newfid->qid = r->fid->qid; else - r->newfid->qid = r->ofcall.data.rwalk.wqid[r->ofcall.data.rwalk.nwqid-1]; + r->newfid->qid = r->ofcall.wqid[r->ofcall.nwqid-1]; } - free(*r->ifcall.data.twalk.wname); + free(*r->ifcall.wname); break; case TWRITE: - free(r->ifcall.data.twrite.data); + free(r->ifcall.data); break; case TREMOVE: if(r->fid) @@ -322,7 +322,7 @@ respond(P9Req *r, char *error) { pc->ref--; break; case TFLUSH: - if((r->oldreq = lookupkey(&pc->tagmap, r->ifcall.data.tflush.oldtag))) + if((r->oldreq = lookupkey(&pc->tagmap, r->ifcall.oldtag))) respond(r->oldreq, Einterrupted); if(!pc->conn && r->ifcall.tag == IXP_NOTAG) pc->ref--; @@ -337,16 +337,16 @@ respond(P9Req *r, char *error) { r->ofcall.type = r->ifcall.type + 1; else { r->ofcall.type = RERROR; - r->ofcall.data.rerror.ename = error; + r->ofcall.ename = error; } if(pc->conn) ixp_server_respond_fcall(pc->conn, &r->ofcall); switch(r->ofcall.type) { case RSTAT: - free(r->ofcall.data.rstat.stat); + free(r->ofcall.stat); break; case RREAD: - free(r->ofcall.data.rread.data); + free(r->ofcall.data); break; } deletekey(&pc->tagmap, r->ifcall.tag);; @@ -367,7 +367,7 @@ ixp_void_request(void *t) { tr->conn = pc; tr->ifcall.type = TFLUSH; tr->ifcall.tag = IXP_NOTAG; - tr->ifcall.data.tflush.oldtag = r->ifcall.tag; + tr->ifcall.oldtag = r->ifcall.tag; ixp_handle_req(tr); }