home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / rf_messg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  18.8 KB  |  762 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_RF_MESSG_H
  11. #define _SYS_RF_MESSG_H
  12.  
  13. #ident    "@(#)/usr/include/sys/rf_messg.h.sl 1.1 4.0 12/08/90 36429 AT&T-USL"
  14.  
  15. /*
  16.  * RFS network message definitions
  17.  *
  18.  * TO DO:  make message formats regular!
  19.  */
  20.  
  21. #define RF_MAXSNAME    20    /* machine name size in mnt_data */
  22.  
  23. /*
  24.  * maximum # of group id's per user, can only be increased with a new
  25.  * version of rf_request_t.
  26.  */
  27. #define RF_MAXGROUPS    32
  28.  
  29. /*
  30.  * A gift denotes a reference to a remote receive descriptor.  If the
  31.  * gift denotes a GENERAL receive descriptor, the receive descriptor
  32.  * is on a server, is persistent, and in turn denotes a file
  33.  * on the server.  Otherwise the receive descriptor is SPECIFIC,
  34.  * transient, and is merely one end of a communications channel.
  35.  * gift_gen tags instances of the denoted receive descriptor, is
  36.  * undefined for old clients/servers.
  37.  */
  38. typedef struct rf_gift {
  39.     long    gift_id;
  40.     long    gift_gen;
  41. } rf_gift_t;
  42.  
  43. #ifdef _KERNEL
  44.  
  45. #define DU_DATASIZE    1024    /* max data bytes in old protocol message */
  46.  
  47. /*
  48.  * RFS file attributes.
  49.  */
  50. typedef struct rf_attr {
  51.     long        rfa_mask;    /* bit-mask of attributes */
  52.     long        rfa_type;    /* vnode type (for create) */
  53.     long        rfa_mode;    /* file access mode */
  54.     long        rfa_uid;    /* owner user id */
  55.     long        rfa_gid;    /* owner group id */
  56.     long        rfa_fsid;    /* file system id (dev for now) */
  57.     long        rfa_nodeid;    /* node id */
  58.     long        rfa_nlink;    /* number of references to file */
  59.     long        rfa_size;    /* file size in bytes */
  60.     timestruc_t    rfa_atime;    /* time of last access */
  61.     timestruc_t    rfa_mtime;    /* time of last modification */
  62.     timestruc_t    rfa_ctime;    /* time file ``created'' */
  63.     long        rfa_rdev;    /* device the file represents */
  64.     long        rfa_blksize;    /* fundamental block size */
  65.     long        rfa_nblocks;    /* # of blocks allocated */
  66.     long        rfa_filler[8];
  67. } rf_attr_t;
  68.  
  69. /*
  70.  * RFS signal set.  Two longs are PLENTY until the next major protocol rev.
  71.  */
  72. typedef struct rf_sigset {
  73.     long    word[2];
  74. } rf_sigset_t;
  75.  
  76. /*
  77.  * The message structure is the header to every message.
  78.  */
  79. typedef struct rf_message {
  80.     long        filler0;    /* used as sequence w/ DEBUG */
  81.     long         m_stat;        /* see stat values below */
  82.     rf_gift_t    m_dest;        /* rcvd to which this goes */
  83.     rf_gift_t    m_gift;        /* rcvd of reference we are giving */
  84.     long         m_size;        /* size of this message    */
  85.     long        m_queue;    /* streams queue message came in on */
  86. } rf_message_t;
  87.  
  88. /*
  89.  * Point to rf_message_t in streams data block;
  90.  * argument is pointer to streams message block.
  91.  */
  92. #define RF_MSG(p)    ((rf_message_t *)(p)->b_rptr)
  93.  
  94. /* m_stat values */
  95. #define RF_GIFT        0x8        /* are address & index real? */
  96. #define RF_SIGNAL    0x10        /* set for signal messages */
  97. #define RF_VER1        0x20        /* set for NACKABLE messages */
  98.  
  99.  
  100. /*
  101.  * Well-known receive queue indices.
  102.  * SIGRDX used to be 1, but that symbol was unused.  DAEMON_RD
  103.  * remains 2 for compatibility.
  104.  */
  105. #define MOUNT_RD    0L    /* Mount request receive descriptor */
  106. #define DAEMON_RD    2L    /* Recovery receive descriptor */
  107.  
  108. /*
  109.  * In the original remote system call protocol, opcodes for remote service
  110.  * frequently correspond to system call numbers.
  111.  * The "DU" prefix is retained for operations that are always based on
  112.  * system calls, or are specific to the system call protocol.
  113.  *
  114.  * Operations shared between the system call and operation protocol, or
  115.  * specific to the latter, use the "RF" prefix, even though they may
  116.  * still use system call number for compatability.
  117.  *
  118.  * For ops protocol that does not look at u.u_syscall (except for wretched
  119.  * hook in rf_lookup preventing mounts on remote names), the sysent table
  120.  * is of no concern, and opcodes can be chosen arbitrarily.
  121.  */
  122. #define RFSETFL        0
  123. #define RFDELMAP    1
  124. #define RFADDMAP    2
  125. #define RFREAD        3
  126. #define RFWRITE        4
  127. #define RFOPEN        5
  128. #define RFCLOSE        6
  129. #define RFLOOKUP    7
  130. #define RFCREATE    8
  131. #define DULINK        9
  132. #define DUUNLINK    10
  133. #define DUEXEC        11
  134. #define DUCHDIR        12
  135. #define RFPUTPAGE    13
  136. #define DUMKNOD        14
  137. #define DUCHMOD        15
  138. #define DUCHOWN        16
  139. #define RFGETPAGE    17
  140. #define DUSTAT        18
  141. #define DUSEEK        19
  142. #define RFGETATTR    20    /* for VOP_GETATTR */
  143. #define DUMOUNT        21    /* retained for compatability;
  144.                  * mount(2), not old rmount(2)
  145.                  * must '..' back to client */
  146. #define DUUMOUNT    22    /* retained for compatability;
  147.                  * umount(2), not old rumount(2)
  148.                  * must '..' back to client */
  149. #define RFSETATTR    23    /* VOP_SETATTR */
  150. #define RFACCESS    24    /* VOP_ACCESS */
  151. #define RFPATHCONF    25    /* VOP_PATHCONF */
  152. #define RFTMO        26    /* virtual circuit timeout */
  153.  
  154. #define DUFSTAT        28
  155. #define DUUTIME        30
  156. #define DUSACCESS    33    /* access system call */
  157. #define DUSTATFS    35
  158. #define DUFSTATFS    38
  159. #define RFRENAME    40
  160. #define DUSYSACCT    51    /* unused in protocol, but needed to recognize
  161.                  * the sysacct() system call */
  162. #define RFIOCTL        54
  163. #define RFUSTAT      57
  164. #define RFFSYNC        58
  165. #define DUEXECE        59
  166. #define DUCHROOT    61
  167. #define RFFCNTL        62
  168. #define RFSPACE        63
  169. #define RFFRLOCK    64
  170. #define DURMOUNT    72    /* lookup on remote tree for mount;
  171.                  * retained for compatability */
  172. #define RFRMDIR        79
  173. #define RFMKDIR        80
  174. #define RFREADDIR    81
  175. #define DULSTAT        88    /* unused in protocol, but needed to recognize
  176.                  * the lstat() system call */
  177. #define RFSYMLINK    89
  178. #define RFREADLINK    90
  179. #define RFMOUNT        97    /* differs from sys call for compatability;
  180.                  * 3.X turned this into another op */
  181. #define RFUMOUNT    98    /* differs from sys call for compatability;
  182.                  * 3.X turned this into another op */
  183. #define DUSTATVFS    103    /* name-based */
  184. #define RFSTATVFS    104    /* vnode-based */
  185. #define RFCOPYIN    106
  186. #define RFCOPYOUT    107
  187. #define RFLINK        109
  188. #define DUCOREDUMP    111
  189. #define DUWRITEI    112
  190. #define DUREADI        113
  191. #define RFRSIGNAL    119
  192. #define RFSYNCTIME    122    /* date synchronization */
  193. #define DUXSTAT        123    /* unused in protocol, but needed to recognize
  194.                  * the xstat system call */
  195. #define DULXSTAT    124    /* unused in protocol, but needed to recognize
  196.                  * the lxstat system call */
  197. #define RFDOTDOT    124    /* server sends this back to client when
  198.                  * remote path crosses back to client */
  199. #define RFPATHREVAL    125    /* path to be re-evaluated by client, for
  200.                  * symlinks */
  201. #define DUXMKNOD    126    /* unused in protocol, but needed to recognize
  202.                  * the xmknod system call */
  203. #define RFFUMOUNT    126    /* forced unmount */
  204. #define RFSENDUMSG    127    /* send message to remote user-level */
  205. #define RFGETUMSG    128    /* get message from remote user-level */
  206. #define RFREMOVE    129
  207. #define DULCHOWN    130    /* unused in protocol, but needed to recognize
  208.                  * the lchown() system call */
  209. #define RFINACTIVE    131
  210. #define DUIUPDATE    132
  211. #define DUUPDATE    133
  212. /*
  213.  * NOTE:  This overloading works ONLY because the two messages
  214.  * have disjoint paths through RFS.  It is inevitable that something
  215.  * like this would happen by virtue of the 3.X implementation using
  216.  * existing syscall numbers and preempting future ones.
  217.  */
  218. #define DURENAME    134
  219. #define RFCACHEDIS    134    /* disable cache */
  220.  
  221. /*
  222.  * Precedes and discriminates response and request structures and
  223.  * their variants.
  224.  */
  225. typedef struct rf_common {
  226.     long    co_opcode;    /* what to do */
  227.     long    co_sysid;    /* where we came from */
  228.     long    co_type;    /* message type - request/response */
  229.     long    co_pid;        /* client pid */
  230.     long    co_uid;        /* client uid */
  231.     long    co_gid;        /* client gid */
  232.     long    co_ftype;
  233.     union {
  234.         long    nlink;    /* RFS1DOT0 only */
  235.         long    svr4pad;
  236.     } co_un;
  237.     long    co_size;
  238.     long    co_mntid;
  239. } rf_common_t;
  240.  
  241. #define co_nlink co_un.nlink
  242.  
  243. /*
  244.  * co_type values are tags for variant message types
  245.  */
  246. #define RF_REQ_MSG    1    /* request message */
  247. #define RF_RESP_MSG    2    /* response message */
  248. #define RF_NACK_MSG    3    /* RFS flow control nack message */
  249.  
  250. #define RF_COM(bp)    ((rf_common_t *)(RF_MSG(bp) + 1))
  251.  
  252. #define RF_MCSZ        (sizeof(rf_message_t) + sizeof(rf_common_t))
  253.  
  254. /* Arg structures for RFS request opcodes.
  255.  *
  256.  * The svr3pad elements are to preserve alignment assumptions in
  257.  * original protocol.  Do not depend on their continued existence.
  258.  */
  259. /* RFACCESS, DUCHMOD */
  260. struct rqmode_op {
  261.     long    svr3pad0;
  262.     long    svr3pad1;
  263.     long    svr3pad2;
  264.     long    fmode;
  265. };
  266.  
  267. struct rqchown {
  268.     long    uid;
  269.     long    gid;
  270. };
  271.  
  272. /*
  273.  * rqrele is used for RFS2DOT0 RFINACTIVE and RFUMOUNT requests
  274.  */
  275. struct rqrele {
  276.     long    vcount;        /* unused in SVR3 */
  277. };
  278.  
  279. /* unused in SVR3 */
  280. struct rqpathconf {
  281.     long    cmd;
  282. };
  283.  
  284. #define RFPROT_TO_PROT(x) ((((x) & 0x1) ? PROT_READ : 0) |\
  285.                (((x) & 0x2) ? PROT_WRITE : 0) |\
  286.                (((x) & 0x4) ? PROT_EXEC : 0))
  287.  
  288. #define PROT_TO_RFPROT(x) ((((x) & PROT_READ) ? 0x1 : 0) |\
  289.                (((x) & PROT_WRITE) ? 0x2 : 0) |\
  290.                (((x) & PROT_EXEC) ? 0x4 : 0))
  291. /*
  292.  * Used by RFADDMAP, and RFDELMAP.  The server is able to record
  293.  * current mapping because addmaps and delmaps also go remote.  Only maxprot
  294.  * is sent in all cases because prot may be manipulated above the file
  295.  * system interface.
  296.  */
  297. struct rqmap {
  298.     long    offset;
  299.     ulong    len;
  300.     ulong    maxprot;
  301. };
  302.  
  303. struct rqclose {
  304.     long    vcount;        /* used only when lastclose */
  305.     long    count;
  306.     long    foffset;
  307.     long    fmode;
  308.     long    lastclose;    /* unused in SVR3 */
  309. };
  310.  
  311. struct rqcreate {
  312.     long    svr3pad0;
  313.     long    ex;    /* unused in SVR3 */
  314.     long    cmask;    /* unused in SVR4 */
  315.     long    fmode;
  316. };
  317.  
  318. struct rqfcntl {
  319.     long    cmd;
  320.     long    fcntl;
  321.     long    offset;
  322.     long    fflag;
  323.     long    prewrite;
  324. };
  325. #define DUFRPREWRITE  0x20     /* Compatability:  redundant prewrite indicator
  326.                 * for file locks */
  327.  
  328. struct rqioctl {
  329.     long    cmd;
  330.     long    arg;
  331.     long    svr3pad2;
  332.     long    fflag;
  333. };
  334.  
  335. struct rqmknod {
  336.     long    svr3pad0;
  337.     long    dev;
  338.     long    cmask;
  339.     long    fmode;
  340. };
  341.  
  342. struct rqopen {
  343.     long    svr3pad0;
  344.     long    crtmode;
  345.     long    cmask;
  346.     long    fmode;
  347. };
  348.  
  349. struct rqseek {
  350.     long    svr3pad0;
  351.     long    whence;
  352. };
  353.  
  354. /* DUSTAT, DUFSTAT */
  355. struct rqstat_op {
  356.     long    buf;
  357. };
  358.  
  359. /* DUSTATFS, DUFSTATFS */
  360. struct rqstatfs_op {
  361.     long    buf;
  362.     long    len;
  363.     long    fstyp;
  364. };
  365.  
  366. struct rqutime {
  367.     long    buf;
  368. };
  369.  
  370. struct rqustat {
  371.     long    buf;
  372.     long    dev;
  373. };
  374.  
  375. /* RFREAD(I), RFREADDIR, RFWRITE(I), RFGETPAGE
  376.  */
  377. struct rqxfer {
  378.     long    offset;
  379.     long    count;
  380.     long    base;
  381.     long    fmode;
  382.     long    prewrite;        /* only used for RFWRITE */
  383. };
  384.  
  385. struct rqmkdir {
  386.     long    svr3pad0;
  387.     long    svr3pad1;
  388.     long    cmask;
  389.     long    fmode;
  390. };
  391.  
  392. struct rqsrmount {
  393.     long    mntflag;
  394.     long    svr3pad1;
  395.     long    synctime;
  396. };
  397.  
  398. struct rqslink {
  399.     long     tflag;
  400.     long    targetln;
  401. };
  402.  
  403. struct rqlink {
  404.     rf_gift_t    from;    /* gen meaningful only SVR4 and later */
  405. };
  406.  
  407. /*
  408.  * Client pathname should be in "normal" form before it is sent with
  409.  * a RFLOOKUP request.  Otherwise, path displacement with ".." or
  410.  * ENOENT will be unexpected.
  411.  */
  412. struct rqlookup {
  413.     long    flags;
  414. };
  415.  
  416. /*
  417.  * RFRENAME request.  We assume two canononized component names will
  418.  * be able to fit in the data portion of the request.  If not the
  419.  * call will fail gracefully.
  420.  */
  421. struct rqrename {
  422.     rf_gift_t    from;
  423.     rf_gift_t    to;
  424. };
  425.  
  426. struct rqcoredump {
  427.     long    svr3pad0;
  428.     long    svr3pad1;
  429.     long    cmask;
  430. };
  431.  
  432. struct rqsynctime {
  433.     long    svr3pad0;
  434.     long    svr3pad1;
  435.     long    time;
  436. };
  437.  
  438. struct rqcachedis {
  439.     long    fhandle;
  440.     long    vcode;        /* SVR4 and later */
  441. };
  442.  
  443. struct rqgetattr {
  444.     long    mask;
  445.     long    flags;
  446. };
  447.  
  448. struct rqsetattr {
  449.     long    flags;
  450. };
  451.  
  452. /* SVR4 and later */
  453. struct rqrmdir {
  454.     rf_gift_t    dir;
  455. };
  456.  
  457. /* RECOVERY OPCODES
  458.  *
  459.  * REC_FUMOUNT
  460.  */
  461. struct rqrec_fumount {
  462.     long    srmntid;
  463. };
  464.  
  465. /* REC_MSG */
  466. struct rqrec_msg {
  467.     long    svr3pad0;
  468.     long    count;
  469. };
  470.  
  471. union rq_arg {
  472.     struct rqmode_op    rqmode_op;
  473.     struct rqchown        rqchown;
  474.     struct rqrele        rqrele;
  475.     struct rqpathconf    rqpathconf;
  476.     struct rqmap        rqmap;
  477.     struct rqclose        rqclose;
  478.     struct rqcreate        rqcreate;
  479.     struct rqopen        rqopen;
  480.     struct rqmknod        rqmknod;
  481.     struct rqcoredump    rqcoredump;
  482.     struct rqmkdir        rqmkdir;
  483.     struct rqfcntl        rqfcntl;
  484.     struct rqioctl        rqioctl;
  485.     struct rqseek        rqseek;
  486.     struct rqslink        rqslink;
  487.     struct rqstat_op    rqstat_op;
  488.     struct rqstatfs_op    rqstatfs_op;
  489.     struct rqutime        rqutime;
  490.     struct rqustat        rqustat;
  491.     struct rqxfer        rqxfer;
  492.     struct rqsrmount    rqsrmount;
  493.     struct rqlink        rqlink;
  494.     struct rqlookup        rqlookup;
  495.     struct rqrename        rqrename;
  496.     struct rqsynctime    rqsynctime;
  497.     struct rqcachedis    rqcachedis;
  498.     struct rqrec_fumount    rqrec_fumount;
  499.     struct rqrec_msg    rqrec_msg;
  500.     struct rqgetattr    rqgetattr;
  501.     struct rqsetattr    rqsetattr;
  502.     struct rqrmdir        rqrmdir;
  503. };
  504.  
  505. /*
  506.  * Header extenstion present only in messages later than version 1.
  507.  * v2_ngroups and v2_groups extend the request message header and
  508.  * the version 2 data portion is at a different offset from the old.
  509.  */
  510. struct rqv2 {
  511.      long    rqv2_ngroups;
  512.      long    rqv2_groups[RF_MAXGROUPS];
  513.     long    rqv2_rrdir_gen;
  514.     long    pad[2];        /* with RF_MAXGROUPS at 32, takes the
  515.                  * message + request less data to 256 bytes */
  516. };
  517.  
  518. /*
  519.  * Op-specific structures that don't fit in the header go in
  520.  * the data portion of the request.
  521.  */
  522.  
  523. /*
  524.  * VOP_SYMLINK, VOP_CREATE, and VOP_MKDIR create a new directory entry
  525.  */
  526. struct rqmkdent {
  527.     rf_attr_t    attr;
  528.     char        nm[MAXNAMELEN];
  529. };
  530.  
  531. /*
  532.  * for RFSYMLINK op; target is present if it can fit into the request.
  533.  * Otherwise rqsymlink.target is undefined and the server will copy it in.
  534.  */
  535. struct rqsymlink {
  536.     struct rqmkdent    rqmkdent;    /* link name and attributes */
  537.     char        target[1];    /* begins target name string */
  538. };
  539.  
  540. /*
  541.  * SVR3 keeps write limit in blocks, SVR4 in bytes.  We continue
  542.  * the message protocol convention of communicating blocks.
  543.  */
  544. #define ULIMSHIFT 9
  545. #define R_ULIMIT        (u.u_rlimit[RLIMIT_FSIZE].rlim_cur)
  546.  
  547. typedef struct rf_request {
  548.     long            rq_rrdir_id;
  549.     daddr_t            rq_ulimit;
  550.     union rq_arg        rq_arg;
  551.     long            rq_flags;
  552.     long            rq_sec;
  553.     long            rq_nsec;
  554.      struct rqv2        rqv2;
  555. } rf_request_t;
  556.  
  557. #define rq_mode_op    rq_arg.rqmode_op
  558. #define rq_chown    rq_arg.rqchown
  559. #define rq_rele        rq_arg.rqrele
  560. #define rq_pathconf    rq_arg.rqpathconf
  561. #define rq_map        rq_arg.rqmap
  562. #define rq_close    rq_arg.rqclose
  563. #define rq_create    rq_arg.rqcreate
  564. #define rq_open        rq_arg.rqopen
  565. #define rq_mknod    rq_arg.rqmknod
  566. #define rq_coredump    rq_arg.rqcoredump
  567. #define rq_mkdir    rq_arg.rqmkdir
  568. #define rq_fcntl    rq_arg.rqfcntl
  569. #define rq_ioctl    rq_arg.rqioctl
  570. #define rq_seek        rq_arg.rqseek
  571. #define rq_slink    rq_arg.rqslink
  572. #define rq_stat_op    rq_arg.rqstat_op
  573. #define rq_statfs_op    rq_arg.rqstatfs_op
  574. #define rq_utime    rq_arg.rqutime
  575. #define rq_ustat    rq_arg.rqustat
  576. #define rq_xfer        rq_arg.rqxfer
  577. #define rq_srmount    rq_arg.rqsrmount
  578. #define rq_link        rq_arg.rqlink
  579. #define rq_lookup    rq_arg.rqlookup
  580. #define rq_rename    rq_arg.rqrename
  581. #define rq_synctime    rq_arg.rqsynctime
  582. #define rq_cachedis    rq_arg.rqcachedis
  583. #define rq_rec_fumount    rq_arg.rqrec_fumount
  584. #define rq_rec_msg    rq_arg.rqrec_msg
  585. #define rq_getattr    rq_arg.rqgetattr
  586. #define rq_setattr    rq_arg.rqsetattr
  587. #define rq_rmdir    rq_arg.rqrmdir
  588. #define rq_ngroups    rqv2.rqv2_ngroups
  589. #define rq_groups    rqv2.rqv2_groups
  590. #define rq_rrdir_gen    rqv2.rqv2_rrdir_gen
  591.  
  592. #define RF_REQ(bp)    ((rf_request_t *)(RF_COM(bp) + 1))
  593.  
  594. /*
  595.  * The size of a request message depends on the version of the circuit
  596.  * over which it is sent.
  597.  */
  598. #define RFV1_MINREQ    (sizeof(rf_request_t) + RF_MCSZ - sizeof(struct rqv2))
  599. #define RFV2_MINREQ    (sizeof(rf_request_t) + RF_MCSZ)
  600. #define RF_MIN_REQ(version) (((version) == 1) ? RFV1_MINREQ : RFV2_MINREQ)
  601.  
  602. /* request flags (rq_flags) */
  603. #define RQ_MNDLCK    0x1    /* used only by old protocol, suppresses
  604.                  * inode locking on remote op and caching
  605.                  * of mand lock-enabled files */
  606.  
  607. /* Arg structures for RFS response opcodes.
  608.  *
  609.  * The svr3pad elements are to preserve alignment assumptions in
  610.  * original protocol.  Do not depend on their continued existence.
  611.  */
  612.  
  613. /* These members are widely used, so we assume for now that all responses
  614.  * have them.
  615.  */
  616. struct rp_all {
  617.     union {
  618.         long    v1sig;
  619.         long    v2pad0;
  620.     } all_u0;
  621.     long     nodata;    /* was subyte */
  622.     union {
  623.         /*
  624.          * This union is used only be RFWRITE(I) and RFFCNTL.
  625.          * The version code ('vcode') is used for client caching.
  626.           * The 'offset' and 'cache' are overloaded by the server
  627.          * in case of opcode RFREADDIR.
  628.          */
  629.         long    vcode;
  630.         long    offset;
  631.         long    cache;
  632.     } all_u1;
  633.     long    fhandle;    /* file handle for client caching */
  634. };
  635.  
  636. /*
  637.  * For old protocol ops that return new file references.
  638.  */
  639. struct rpv1giftinfo {
  640.     long    svr3pad0;
  641.     long    mode;
  642. };
  643.  
  644. /* pathlen set by lookup, not by flakey /proc ioctl that opens a file */
  645. struct rpv2giftinfo {
  646.     long    pathlen;
  647.     long    flags;
  648. };
  649. #define RPG_NOMAP    0x01
  650. #define RPG_NOSWAP    0x02
  651.  
  652. /* RFREAD(I), RFWRITE(I) - used only by SVR4 server talking to old client */
  653. struct rprdwr {
  654.     long    isize;
  655.     long    svr3pad1;
  656. };
  657.  
  658. /* RFCOPYIN, RFREADDIR, DUFSTAT, DUFSTATFS, DUSTAT, DUSTATFS, RFUSTAT
  659.  */
  660. struct rpxfer {
  661.     long    eof;
  662.     long    buf;
  663. };
  664.  
  665. struct rpcopyout {
  666.     long    copysync;    /* vestige of static buffer allocation */
  667.     long    buf;
  668. };
  669.  
  670. struct rpfcntl {
  671.     long    isize;    /* used only by SVR4 server talking to old client */
  672.     long    buf;
  673. };
  674.  
  675. struct rpsynctime {
  676.     long    svr3pad0;
  677.     long    time;
  678. };
  679.  
  680. /*
  681.  * Header extension present only in post-version 1 messages.
  682.  */
  683. struct rpv2 {
  684.     rf_sigset_t    rpv2_sigset;
  685.     long        pad[2];    /* takes the messsage + response less data
  686.                  * to 128 bytes */
  687. };
  688.  
  689. union rp_arg {
  690.     struct rpv1giftinfo    rpv1giftinfo;
  691.     struct rpv2giftinfo    rpv2giftinfo;
  692.     struct rprdwr        rprdwr;
  693.     struct rpxfer        rpxfer;
  694.     struct rpcopyout    rpcopyout;
  695.     struct rpfcntl        rpfcntl;
  696.     struct rpsynctime    rpsynctime;
  697. };
  698.  
  699. typedef struct rf_response {
  700.     long            rp_errno;
  701.     long            rp_v2vcode;
  702.     long            rp_rval;    /* return value     */
  703.     long            rp_count;    /* not reliably set in 3.x */
  704.     union rp_arg        rp_arg;
  705.     struct rp_all        rp_all;
  706.     struct rpv2        rpv2;
  707. } rf_response_t;
  708.  
  709. #define RP_MNDLCK    0x8000    /* used only by old protocol, suppresses
  710.                  * inode locking on remote op and caching
  711.                  * of mand lock-enabled files */
  712. #define RP_CACHE_ON    0x1    /* This file's data may be cached.  When
  713.                  * this is set, rpv2_vcode is also set.
  714.                  */
  715. #define DU_CACHE_ENABLE 0x2     /* remote cacheing is enabled by 3.X server */
  716.  
  717.  
  718. #define rp_v1giftinfo    rp_arg.rpv1giftinfo
  719. #define rp_v2giftinfo    rp_arg.rpv2giftinfo
  720. #define rp_rdwr        rp_arg.rprdwr
  721. #define rp_xfer        rp_arg.rpxfer
  722. #define rp_copyout    rp_arg.rpcopyout
  723. #define rp_fcntl    rp_arg.rpfcntl
  724. #define rp_synctime    rp_arg.rpsynctime
  725. #define rp_v1sig    rp_all.all_u0.v1sig
  726. #define rp_v2sigset    rpv2.rpv2_sigset
  727. #define rp_nodata    rp_all.nodata
  728. #define rp_vcode    rp_all.all_u1.vcode
  729. #define rp_offset    rp_all.all_u1.offset
  730. #define rp_cache    rp_all.all_u1.cache
  731. #define rp_fhandle    rp_all.fhandle
  732.  
  733. #define RF_RESP(bp)    ((rf_response_t *)(RF_COM(bp) + 1))
  734.  
  735. /*
  736.  * RFLOOKUP responses ordinarily contain results of 3 VOP_ACCESS()'s and
  737.  * a VOP_GETATTR().  These are briefly cached by the client in order to avoid
  738.  * sending some messages.
  739.  */
  740. typedef struct rflkc_info {
  741.     int        rflkc_read_err;
  742.     int        rflkc_write_err;
  743.     int        rflkc_exec_err;
  744.     rf_attr_t    rflkc_attr;
  745. } rflkc_info_t;
  746.  
  747. /*
  748.  * The size of a request message depends on the version of the circuit
  749.  * over which it is sent.
  750.  */
  751. #define RFV1_MINRESP    (sizeof(rf_response_t) + RF_MCSZ - sizeof(struct rpv2))
  752. #define RFV2_MINRESP    (sizeof(rf_response_t) + RF_MCSZ)
  753. #define RF_MIN_RESP(version) (((version) == 1) ? RFV1_MINRESP : RFV2_MINRESP)
  754.  
  755. #define RF_MAXHEAD(version) \
  756.   (RF_MIN_RESP(version) >= RF_MIN_REQ(version) ? \
  757.     RF_MIN_RESP(version) : RF_MIN_REQ(version))
  758.  
  759.  
  760. #endif /* _KERNEL */
  761. #endif /* _SYS_RF_MESSG_H */
  762.