From 24f40f3dd17052d7e2dfd31dd73d2eb22be69c89 Mon Sep 17 00:00:00 2001 From: garbeam Date: Tue, 20 Dec 2005 17:32:42 +0200 Subject: [PATCH] fixed RERROR in libixp2 --- README | 2 ++ cmd/wmiibar2.c | 2 +- libixp2/ixp.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++ libixp2/message.c | 9 ++++++--- 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/README b/README index bc49ba60..772aaa91 100644 --- a/README +++ b/README @@ -74,6 +74,8 @@ contributed especially to wmii in various ways: - Steve Hoffman - Christof Musik - Steffen Liebergeld +- Tobias Walkowiak +- Sander van Dijk References diff --git a/cmd/wmiibar2.c b/cmd/wmiibar2.c index 2b3d1210..3345a647 100644 --- a/cmd/wmiibar2.c +++ b/cmd/wmiibar2.c @@ -217,7 +217,7 @@ static int attach(IXPServer *s, IXPConn *c) for (m = maps; m && m->next; m = m->next); m->next = new; } - fprintf(stderr, "attaching %d %s %s\n", s->fcall.afid, s->fcall.uname, s->fcall.aname); + fprintf(stderr, "attaching %u %u %s %s\n", s->fcall.fid, s->fcall.afid, s->fcall.uname, s->fcall.aname); new->qid = root_qid; new->fid = s->fcall.fid; s->fcall.id = RATTACH; diff --git a/libixp2/ixp.h b/libixp2/ixp.h index 2b62af1e..af6f6b6f 100644 --- a/libixp2/ixp.h +++ b/libixp2/ixp.h @@ -26,6 +26,54 @@ #define IXP_MAX_WELEM 16 /* MAXWELEM */ #define IXP_MAX_TFUNCS 14 + +/* + size[4] Tversion tag[2] msize[4] version[s] + size[4] Rversion tag[2] msize[4] version[s] + size[4] Tauth tag[2] afid[4] uname[s] aname[s] + size[4] Rauth tag[2] aqid[13] + size[4] Rerror tag[2] ename[s] + size[4] Tflush tag[2] oldtag[2] + size[4] Rflush tag[2] + size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s] + size[4] Rattach tag[2] qid[13] + size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s]) + size[4] Rwalk tag[2] nwqid[2] nwqid*(wqid[13]) + size[4] Topen tag[2] fid[4] mode[1] + size[4] Ropen tag[2] qid[13] iounit[4] + size[4] Tcreate tag[2] fid[4] name[s] perm[4] mode[1] + size[4] Rcreate tag[2] qid[13] iounit[4] + size[4] Tread tag[2] fid[4] offset[8] count[4] + size[4] Rread tag[2] count[4] data[count] + size[4] Twrite tag[2] fid[4] offset[8] count[4] data[count] + size[4] Rwrite tag[2] count[4] + size[4] Tclunk tag[2] fid[4] + size[4] Rclunk tag[2] + size[4] Tremove tag[2] fid[4] + size[4] Rremove tag[2] + size[4] Tstat tag[2] fid[4] + size[4] Rstat tag[2] stat[n] + size[4] Twstat tag[2] fid[4] stat[n] + size[4] Rwstat tag[2] + + stat[n]: + size[2] total byte count of the following data + type[2] for kernel use + dev[4] for kernel use + qid.type[1] the type of the file (directory, etc.), + represented as a bit vector corresponding to the high 8 bits of the file's mode word. + qid.vers[4] version number for given path + qid.path[8] the file server's unique identification for the file + mode[4] permissions and flags + atime[4] last access time + mtime[4] last modification time + length[8] length of file in bytes + name[ s ] file name; must be / if the file is the root directory of the server + uid[ s ] owner name + gid[ s ] group name + muid[ s ] +*/ + /* 9P message types */ enum { TVERSION = 100, @@ -89,6 +137,7 @@ typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; + #define IXP_NOTAG (u16)~0U /* Dummy tag */ #define IXP_NOFID (u32)~0 /* No auth */ diff --git a/libixp2/message.c b/libixp2/message.c index 86cad024..44f89fdb 100644 --- a/libixp2/message.c +++ b/libixp2/message.c @@ -49,7 +49,7 @@ u32 ixp_fcall_to_msg(Fcall * fcall, void *msg, u32 msglen) sizeof_string(fcall->aname); break; case RERROR: - msize += sizeof_string(fcall->errstr) + sizeof(u32); + msize += sizeof_string(fcall->errstr); break; case RWRITE: case TCLUNK: @@ -113,6 +113,8 @@ u32 ixp_fcall_to_msg(Fcall * fcall, void *msg, u32 msglen) p = ixp_enc_string(p, fcall->aname); break; case RAUTH: + p = ixp_enc_qid(p, &fcall->aqid); + break; case RATTACH: p = ixp_enc_qid(p, &fcall->qid); break; @@ -202,8 +204,7 @@ u32 ixp_msg_to_fcall(void *msg, u32 msglen, Fcall * fcall) case TVERSION: case RVERSION: p = ixp_dec_u32(p, &fcall->maxmsg); - p = ixp_dec_string(p, fcall->version, sizeof(fcall->version), - &len); + p = ixp_dec_string(p, fcall->version, sizeof(fcall->version), &len); break; case TAUTH: p = ixp_dec_u32(p, &fcall->afid); @@ -211,6 +212,8 @@ u32 ixp_msg_to_fcall(void *msg, u32 msglen, Fcall * fcall) p = ixp_dec_string(p, fcall->aname, sizeof(fcall->aname), &len); break; case RAUTH: + p = ixp_dec_qid(p, &fcall->aqid); + break; case RATTACH: p = ixp_dec_qid(p, &fcall->qid); break;