示例#1
0
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;
		}
	}
}
示例#2
0
文件: convert.c 项目: eINIT/core
void
ixp_pqid(IxpMsg *msg, Qid *qid) {
	ixp_pu8(msg, &qid->type);
	ixp_pu32(msg, &qid->version);
	ixp_pu64(msg, &qid->path);
}