ns9p = @names c32le { enum { // these 9P and 9P2000.u definitions come from plan9port OREAD = 0, // open for read OWRITE = 1, // write ORDWR = 2, // read and write OEXEC = 3, // execute, == read but check execute // permission OTRUNC = 16, // or'ed in (except for exec), // truncate file first OCEXEC = 32, // or'ed in, close on exec ORCLOSE = 64, // or'ed in, remove on close ODIRECT = 128, // or'ed in, direct access ONONBLOCK = 256, // or'ed in, non-blocking call OEXCL = 0x1000, // or'ed in, exclusive use (create only) OLOCK = 0x2000, // or'ed in, lock after opening OAPPEND = 0x4000, // or'ed in, append only // bits in Qid.type QTDIR = 0x80, // type bit for directories QTAPPEND = 0x40, // type bit for append only files QTEXCL = 0x20, // type bit for exclusive use files QTMOUNT = 0x10, // type bit for mounted channel QTAUTH = 0x08, // type bit for authentication file QTTMP = 0x04, // type bit for non-backed-up file QTSYMLINK = 0x02, // type bit for symbolic link QTFILE = 0x00, // type bits for plain file // 9P mode bits DMDIR = 0x80000000, // mode bit for directories DMAPPEND = 0x40000000, // mode bit for append only files DMEXCL = 0x20000000, // mode bit for exclusive use files DMMOUNT = 0x10000000, // mode bit for mounted channel DMAUTH = 0x08000000, // mode bit for authentication file DMTMP = 0x04000000, // mode bit for non-backed-up file // 9P2000.u mode bits DMSYMLINK = 0x02000000, // mode bit for symbolic link DMDEVICE = 0x00800000, // mode bit for device file DMNAMEDPIPE = 0x00200000, // mode bit for named pipe DMSOCKET = 0x00100000, // mode bit for socket DMSETUID = 0x00080000, // mode bit for setuid DMSETGID = 0x00040000, // mode bit for setgid DMREAD = 0x4, // mode bit for read permission DMWRITE = 0x2, // mode bit for write permission DMEXEC = 0x1, // mode bit for execute permission }; enum P9Pmsg { Tversion = 100, Rversion, Tauth = 102, Rauth, Tattach = 104, Rattach, Terror = 106, /* illegal */ Rerror, Tflush = 108, Rflush, Twalk = 110, Rwalk, Topen = 112, Ropen, Tcreate = 114, Rcreate, Tread = 116, Rread, Twrite = 118, Rwrite, Tclunk = 120, Rclunk, Tremove = 122, Rremove, Tstat = 124, Rstat, Twstat = 126, Rwstat, Tmax, }; // fields are in wire format typedef struct Qid { @0x00 uint8 type; @0x01 uint32 vers; @0x05 uint64 path; @13; } Qid; // fields through length are in wire format typedef struct Dir { @0x00 uint16 type; @0x02 uint32 dev; @0x06 Qid qid; @0x13 uint32 mode; @0x17 uint32 atime; @0x1b uint32 mtime; @0x1f uint64 length; @0x27 char *name; @0x2b char *uid; @0x2f char *gid; @0x33 char *muid; @0x37; } Dir; // fields through length are in wire format typedef struct Diru { @0x00 uint16 type; @0x02 uint32 dev; @0x06 Qid qid; @0x13 uint32 mode; @0x17 uint32 atime; @0x1b uint32 mtime; @0x1f uint64 length; @0x27 uint32 nuid; @0x2b uint32 ngid; @0x2f uint32 nmuid; @0x33 char *name; @0x37 char *uid; @0x3b char *gid; @0x3f char *muid; @0x43 char *extension; @0x47; } Diru; };