void ixp_pstat_dotu(IxpMsg *msg, Stat *stat) { ushort size; if(msg->mode == MsgPack) size = ixp_sizeof_stat_dotu(stat) - 2; ixp_pu16(msg, &size); ixp_pu16(msg, &stat->type); ixp_pu32(msg, &stat->dev); ixp_pqid(msg, &stat->qid); ixp_pu32(msg, &stat->mode); ixp_pu32(msg, &stat->atime); ixp_pu32(msg, &stat->mtime); ixp_pu64(msg, &stat->length); ixp_pstring(msg, &stat->name); ixp_pstring(msg, &stat->uid); ixp_pstring(msg, &stat->gid); ixp_pstring(msg, &stat->muid); ixp_pstring(msg, &stat->extension); ixp_pu32(msg, &stat->n_uid); ixp_pu32(msg, &stat->n_gid); ixp_pu32(msg, &stat->n_muid); }
void ixp_pqids(IxpMsg *msg, ushort *num, Qid qid[]) { int i; ixp_pu16(msg, num); if(*num > IXP_MAX_WELEM) { msg->pos = msg->end+1; return; } for(i = 0; i < *num; i++) ixp_pqid(msg, &qid[i]); }
void ixp_pfcall(IxpMsg *msg, IxpFcall *fcall) { ixp_pu8(msg, &fcall->hdr.type); ixp_pu16(msg, &fcall->hdr.tag); switch (fcall->hdr.type) { case TVersion: case RVersion: ixp_pu32(msg, &fcall->version.msize); ixp_pstring(msg, &fcall->version.version); break; case TAuth: ixp_pu32(msg, &fcall->tauth.afid); ixp_pstring(msg, &fcall->tauth.uname); ixp_pstring(msg, &fcall->tauth.aname); break; case RAuth: ixp_pqid(msg, &fcall->rauth.aqid); break; case RAttach: ixp_pqid(msg, &fcall->rattach.qid); break; case TAttach: ixp_pu32(msg, &fcall->hdr.fid); ixp_pu32(msg, &fcall->tattach.afid); ixp_pstring(msg, &fcall->tattach.uname); ixp_pstring(msg, &fcall->tattach.aname); break; case RError: ixp_pstring(msg, &fcall->error.ename); break; case TFlush: ixp_pu16(msg, &fcall->tflush.oldtag); break; case TWalk: ixp_pu32(msg, &fcall->hdr.fid); ixp_pu32(msg, &fcall->twalk.newfid); ixp_pstrings(msg, &fcall->twalk.nwname, fcall->twalk.wname, nelem(fcall->twalk.wname)); break; case RWalk: ixp_pqids(msg, &fcall->rwalk.nwqid, fcall->rwalk.wqid, nelem(fcall->rwalk.wqid)); break; case TOpen: ixp_pu32(msg, &fcall->hdr.fid); ixp_pu8(msg, &fcall->topen.mode); break; case ROpen: case RCreate: ixp_pqid(msg, &fcall->ropen.qid); ixp_pu32(msg, &fcall->ropen.iounit); break; case TCreate: ixp_pu32(msg, &fcall->hdr.fid); ixp_pstring(msg, &fcall->tcreate.name); ixp_pu32(msg, &fcall->tcreate.perm); ixp_pu8(msg, &fcall->tcreate.mode); break; case TRead: ixp_pu32(msg, &fcall->hdr.fid); ixp_pu64(msg, &fcall->tread.offset); ixp_pu32(msg, &fcall->tread.count); break; case RRead: ixp_pu32(msg, &fcall->rread.count); ixp_pdata(msg, &fcall->rread.data, fcall->rread.count); break; case TWrite: ixp_pu32(msg, &fcall->hdr.fid); ixp_pu64(msg, &fcall->twrite.offset); ixp_pu32(msg, &fcall->twrite.count); ixp_pdata(msg, &fcall->twrite.data, fcall->twrite.count); break; case RWrite: ixp_pu32(msg, &fcall->rwrite.count); break; case TClunk: case TRemove: case TStat: ixp_pu32(msg, &fcall->hdr.fid); break; case RStat: ixp_pu16(msg, &fcall->rstat.nstat); ixp_pdata(msg, (char**)&fcall->rstat.stat, fcall->rstat.nstat); break; case TWStat: { uint16_t size; ixp_pu32(msg, &fcall->hdr.fid); ixp_pu16(msg, &size); ixp_pstat(msg, &fcall->twstat.stat); break; } } }