#include <lib9.h> #include <styx.h> int convS2M (Fcall *f, char *ap) int convD2M (Dir *d, char *ap) int convM2S (char *ap, Fcall *f, int n) int convM2D (char *ap, Dir *d) int dirconv (va_list *arg, Fconv*) int fcallconv (va_list *arg, Fconv*) int dirmodeconv(va_list *arg, Fconv*)
typedef struct Fcall { char type; short fid; ushort tag; ushort oldtag; /* T-Flush */ Qid qid; /* R-Attach, R-Walk, R-Open, R-Create */ char uname[NAMELEN]; /* T-Attach */ char aname[NAMELEN]; /* T-Attach */ char ename[ERRLEN]; /* R-Error */ long perm; /* T-Create */ short newfid; /* T-Clone */ char name[NAMELEN]; /* T-Walk, T-Create */ char mode; /* T-Create, T-Open */ long offset; /* T-Read, T-Write */ long count; /* T-Read, T-Write, R-Read */ char *data; /* T-Write, R-Read */ char stat[DIRLEN]; /* T-Wstat, R-Stat */ } Fcall;This structure is defined in <styx.h>. See the other pages in this section of the manual for a full description of Styx messages and their encoding. For all message types, the type member of an Fcall structure holds one of Tnop, Rnop, Tattach, Rattach, etc. (defined in an enumerated type in <styx.h>). The fid member is used by most messages, and tag is used by all messages. The other fields are used selectively by the message types given in comments.
The constant MAXMSG (128) is the length of the longest message, excluding data. The constant MAXFDATA (8192) is the maximum count in a read or write message. Thus messages are guaranteed to be shorter than MAXMSG+MAXFDATA bytes long.
See Also
Limbo Modules, stat, and Inferno File Protocol, Styx Notes
The offset and directory length fields have 8 bytes in the protocol, but these routines assume they fit into a long.