[BACK]Return to puffs_msgif.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / fs / puffs

Annotation of src/sys/fs/puffs/puffs_msgif.h, Revision 1.42.2.1

1.42.2.1! skrll       1: /*     $NetBSD: puffs_msgif.h,v 1.47 2007/07/30 09:04:58 pooka Exp $   */
1.1       pooka       2:
                      3: /*
                      4:  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
                      5:  *
                      6:  * Development of this software was supported by the
                      7:  * Google Summer of Code program and the Ulla Tuominen Foundation.
                      8:  * The Google SoC project was mentored by Bill Studenmund.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
                     20:  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
                     21:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
                     22:  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
                     23:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     25:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29:  * SUCH DAMAGE.
                     30:  */
                     31:
                     32: #ifndef _PUFFS_MSGIF_H_
                     33: #define _PUFFS_MSGIF_H_
                     34:
                     35: #include <sys/param.h>
                     36: #include <sys/time.h>
                     37: #include <sys/ioccom.h>
                     38: #include <sys/uio.h>
                     39: #include <sys/vnode.h>
                     40: #include <sys/ucred.h>
                     41: #include <sys/statvfs.h>
                     42: #include <sys/dirent.h>
                     43: #include <sys/fcntl.h>
                     44:
1.42.2.1! skrll      45: #include <uvm/uvm_prot.h>
        !            46:
1.1       pooka      47: #define PUFFSOP_VFS    1
                     48: #define PUFFSOP_VN     2
1.20      pooka      49: #define PUFFSOP_CACHE  3
1.5       pooka      50: #define PUFFSOPFLAG_FAF        0x10    /* fire-and-forget */
                     51:
                     52: #define PUFFSOP_OPCMASK                0x03
                     53: #define PUFFSOP_OPCLASS(a)     ((a) & PUFFSOP_OPCMASK)
1.6       pooka      54: #define PUFFSOP_WANTREPLY(a)   (((a) & PUFFSOPFLAG_FAF) == 0)
1.1       pooka      55:
1.9       pooka      56: /* XXX: we don't need everything */
1.1       pooka      57: enum {
                     58:        PUFFS_VFS_MOUNT,        PUFFS_VFS_START,        PUFFS_VFS_UNMOUNT,
                     59:        PUFFS_VFS_ROOT,         PUFFS_VFS_STATVFS,      PUFFS_VFS_SYNC,
                     60:        PUFFS_VFS_VGET,         PUFFS_VFS_FHTOVP,       PUFFS_VFS_VPTOFH,
                     61:        PUFFS_VFS_INIT,         PUFFS_VFS_DONE,         PUFFS_VFS_SNAPSHOT,
1.19      pooka      62:        PUFFS_VFS_EXTATTCTL,    PUFFS_VFS_SUSPEND
1.1       pooka      63: };
                     64: #define PUFFS_VFS_MAX PUFFS_VFS_EXTATTCTL
                     65:
1.9       pooka      66: /* moreXXX: we don't need everything here either */
1.1       pooka      67: enum {
                     68:        PUFFS_VN_LOOKUP,        PUFFS_VN_CREATE,        PUFFS_VN_MKNOD,
                     69:        PUFFS_VN_OPEN,          PUFFS_VN_CLOSE,         PUFFS_VN_ACCESS,
                     70:        PUFFS_VN_GETATTR,       PUFFS_VN_SETATTR,       PUFFS_VN_READ,
                     71:        PUFFS_VN_WRITE,         PUFFS_VN_IOCTL,         PUFFS_VN_FCNTL,
                     72:        PUFFS_VN_POLL,          PUFFS_VN_KQFILTER,      PUFFS_VN_REVOKE,
                     73:        PUFFS_VN_MMAP,          PUFFS_VN_FSYNC,         PUFFS_VN_SEEK,
                     74:        PUFFS_VN_REMOVE,        PUFFS_VN_LINK,          PUFFS_VN_RENAME,
                     75:        PUFFS_VN_MKDIR,         PUFFS_VN_RMDIR,         PUFFS_VN_SYMLINK,
                     76:        PUFFS_VN_READDIR,       PUFFS_VN_READLINK,      PUFFS_VN_ABORTOP,
                     77:        PUFFS_VN_INACTIVE,      PUFFS_VN_RECLAIM,       PUFFS_VN_LOCK,
                     78:        PUFFS_VN_UNLOCK,        PUFFS_VN_BMAP,          PUFFS_VN_STRATEGY,
                     79:        PUFFS_VN_PRINT,         PUFFS_VN_ISLOCKED,      PUFFS_VN_PATHCONF,
                     80:        PUFFS_VN_ADVLOCK,       PUFFS_VN_LEASE,         PUFFS_VN_WHITEOUT,
                     81:        PUFFS_VN_GETPAGES,      PUFFS_VN_PUTPAGES,      PUFFS_VN_GETEXTATTR,
                     82:        PUFFS_VN_LISTEXTATTR,   PUFFS_VN_OPENEXTATTR,   PUFFS_VN_DELETEEXTATTR,
                     83:        PUFFS_VN_SETEXTATTR
                     84: };
                     85: #define PUFFS_VN_MAX PUFFS_VN_SETEXTATTR
                     86:
1.14      pooka      87: #define PUFFSDEVELVERS 0x80000000
1.42.2.1! skrll      88: #define PUFFSVERSION   16
1.1       pooka      89: #define PUFFSNAMESIZE  32
1.42      pooka      90:
1.42.2.1! skrll      91: #define PUFFS_TYPEPREFIX "puffs|"
        !            92:
        !            93: #define PUFFS_TYPELEN (_VFS_NAMELEN - (sizeof(PUFFS_TYPEPREFIX)+1))
        !            94: #define PUFFS_NAMELEN (_VFS_MNAMELEN-1)
1.42      pooka      95:
1.25      pooka      96: struct puffs_kargs {
1.14      pooka      97:        unsigned int    pa_vers;
1.1       pooka      98:        int             pa_fd;
1.9       pooka      99:        uint32_t        pa_flags;
1.26      pooka     100:
1.1       pooka     101:        size_t          pa_maxreqlen;
1.27      pooka     102:        int             pa_nhashbuckets;
                    103:
1.26      pooka     104:        size_t          pa_fhsize;
1.27      pooka     105:        int             pa_fhflags;
1.26      pooka     106:
1.30      pooka     107:        void            *pa_root_cookie;
                    108:        enum vtype      pa_root_vtype;
                    109:        voff_t          pa_root_vsize;
                    110:        dev_t           pa_root_rdev;
                    111:
                    112:        struct statvfs  pa_svfsb;
                    113:
1.42.2.1! skrll     114:        char            pa_typename[_VFS_NAMELEN];
1.42      pooka     115:        char            pa_mntfromname[_VFS_MNAMELEN];
                    116:
1.9       pooka     117:        uint8_t         pa_vnopmask[PUFFS_VN_MAX];
1.1       pooka     118: };
1.34      pooka     119: #define PUFFS_KFLAG_NOCACHE_NAME       0x01    /* don't use name cache     */
                    120: #define PUFFS_KFLAG_NOCACHE_PAGE       0x02    /* don't use page cache     */
1.35      pooka     121: #define PUFFS_KFLAG_NOCACHE            0x03    /* no cache whatsoever      */
1.34      pooka     122: #define PUFFS_KFLAG_ALLOPS             0x04    /* ignore pa_vnopmask       */
                    123: #define PUFFS_KFLAG_WTCACHE            0x08    /* write-through page cache */
                    124: #define PUFFS_KFLAG_IAONDEMAND         0x10    /* inactive only on demand  */
1.38      pooka     125: #define PUFFS_KFLAG_LOOKUP_FULLPNBUF   0x20    /* full pnbuf in lookup     */
1.41      pooka     126: #define PUFFS_KFLAG_MASK               0x3f
1.27      pooka     127:
                    128: #define PUFFS_FHFLAG_DYNAMIC   0x01
                    129: #define PUFFS_FHFLAG_NFSV2     0x02
                    130: #define PUFFS_FHFLAG_NFSV3     0x04
                    131: #define PUFFS_FHFLAG_PROTOMASK 0x06
                    132:
                    133: #define PUFFS_FHSIZE_MAX       1020    /* XXX: FHANDLE_SIZE_MAX - 4 */
1.1       pooka     134:
                    135: /*
                    136:  * This is the device minor number for the cloning device.  Make it
                    137:  * a high number "just in case", even though we don't want to open
                    138:  * any specific devices currently.
                    139:  */
                    140: #define PUFFS_CLONER 0x7ffff
                    141:
1.11      pooka     142: struct puffs_reqh_get {
                    143:        void    *phg_buf;       /* user buffer          */
                    144:        size_t  phg_buflen;     /* user buffer length   */
                    145:
                    146:        int     phg_nops;       /* max ops user wants / number delivered */
                    147:        int     phg_more;       /* advisory: more ops available? */
                    148: };
                    149:
                    150: struct puffs_reqh_put {
                    151:        int             php_nops;       /* ops available / ops handled */
                    152:
                    153:        /* these describe the first request */
                    154:        uint64_t        php_id;         /* request id */
                    155:        void            *php_buf;       /* user buffer address */
                    156:        size_t          php_buflen;     /* user buffer length, hdr NOT incl. */
                    157: };
                    158:
1.1       pooka     159: /*
1.11      pooka     160:  * The requests work as follows:
                    161:  *
                    162:  *  + GETOP: When fetching operations from the kernel, the user server
                    163:  *           supplies a flat buffer into which operations are written.
                    164:  *           The number of operations written to the buffer is
                    165:  *           MIN(prhg_nops, requests waiting, space in buffer).
                    166:  *
                    167:  *           Operations follow each other and each one is described
                    168:  *           by the puffs_req structure, which is immediately followed
                    169:  *           by the aligned request data buffer in preq_buf.  The next
                    170:  *           puffs_req can be found at preq + preq_buflen.
                    171:  *
                    172:  *           Visually, the server should expect:
                    173:  *
                    174:  *           |<-- preq_buflen -->|
                    175:  *           ---------------------------------------------------------------
                    176:  *           |hdr|  buffer |align|hdr| buffer |hdr| ....   |buffer|        |
                    177:  *           ---------------------------------------------------------------
                    178:  *           ^ start       ^ unaligned        ^ aligned    ^ always aligned
                    179:  *
                    180:  *           The server is allowed to modify the contents of the buffers.
                    181:  *           Since the headers are the same size for both get and put, it
                    182:  *           is possible to handle all operations simply by doing in-place
                    183:  *           modification.  Where more input is expected that what was put
                    184:  *           out, the kernel leaves a hole in the buffer.  This hole size
                    185:  *           is derived from the operational semantics known by the vnode
                    186:  *           layer.  The hole size is included in preq_buflen.  The
                    187:  *           amount of relevant information in the buffer is call-specific
                    188:  *           and can be deduced by the server from the call type.
                    189:  *
                    190:  *  + PUTOP: When returning the results of an operation to the kernel, the
                    191:  *           user server is allowed to input results in a scatter-gather
                    192:  *           fashion.  Each request is made up of a header and the buffer.
                    193:  *           The header describes the *NEXT* request for copyin, *NOT* the
                    194:  *           current one.  The first request is described in puffs_reqh_put
                    195:  *           and the last one is left uninterpreted.  This is to halve the
                    196:  *           amount of copyin's required.
                    197:  *
                    198:  *           Fans of my ascii art, rejoice:
                    199:  *               /-------------------->| preq_buflen     |
                    200:  *           ---^----------------------------------------------------------
                    201:  *           |hdr|buffer| empty spaces |hdr|    buffer   |                |
                    202:  *           --v-----------------------^-v---------------------------------
                    203:  *             \------- preq_buf -----/  \------- preq_buf ....
                    204:  *
                    205:  *           This scheme also allows for better in-place modification of the
                    206:  *           request buffer when handling requests.  The vision is that
                    207:  *           operations which can be immediately satisfied will be edited
                    208:  *           in-place while ones which can't will be left blank.  Also,
                    209:  *           requests from async operations which have been satisfied
                    210:  *           meanwhile can be included.
                    211:  *
                    212:  *           The total number of operations is given by the ioctl control
                    213:  *           structure puffs_reqh.  The values in the header in the final
                    214:  *           are not used.
1.1       pooka     215:  */
                    216: struct puffs_req {
1.11      pooka     217:        uint64_t        preq_id;                /* get: cur, put: next */
1.1       pooka     218:
1.11      pooka     219:        union u {
                    220:                struct {
                    221:                        uint8_t opclass;        /* cur */
                    222:                        uint8_t optype;         /* cur */
                    223:
                    224:                        /*
                    225:                         * preq_cookie is the node cookie associated with
                    226:                         * the request.  It always maps 1:1 to a vnode
                    227:                         * and could map to a userspace struct puffs_node.
                    228:                         * The cookie usually describes the first
                    229:                         * vnode argument of the VOP_POP() in question.
                    230:                         */
                    231:
                    232:                        void    *cookie;        /* cur */
                    233:                } out;
                    234:                struct {
                    235:                        int     rv;             /* cur */
1.29      pooka     236:                        int     setbacks;       /* cur */
1.11      pooka     237:                        void    *buf;           /* next */
                    238:                } in;
                    239:        } u;
1.1       pooka     240:
1.11      pooka     241:        size_t  preq_buflen;                    /* get: cur, put: next */
1.1       pooka     242:        /*
1.11      pooka     243:         * the following helper pads the struct size to md alignment
                    244:         * multiple (should size_t not cut it).  it makes sure that
                    245:         * whatever comes after this struct is aligned
1.1       pooka     246:         */
1.11      pooka     247:        uint8_t preq_buf[0] __aligned(ALIGNBYTES+1);
1.1       pooka     248: };
1.11      pooka     249: #define preq_opclass   u.out.opclass
                    250: #define preq_optype    u.out.optype
                    251: #define preq_cookie    u.out.cookie
                    252: #define preq_rv                u.in.rv
1.29      pooka     253: #define preq_setbacks  u.in.setbacks
1.11      pooka     254: #define preq_nextbuf   u.in.buf
1.1       pooka     255:
1.29      pooka     256: #define PUFFS_SETBACK_INACT_N1 0x01    /* set VOP_INACTIVE for node 1 */
                    257: #define PUFFS_SETBACK_INACT_N2 0x02    /* set VOP_INACTIVE for node 2 */
1.32      pooka     258: #define PUFFS_SETBACK_NOREF_N1 0x04    /* set pn PN_NOREFS for node 1 */
                    259: #define PUFFS_SETBACK_NOREF_N2 0x08    /* set pn PN_NOREFS for node 2 */
                    260: #define PUFFS_SETBACK_MASK     0x0f
1.29      pooka     261:
1.1       pooka     262: /*
                    263:  * Some operations have unknown size requirements.  So as the first
                    264:  * stab at handling it, do an extra bounce between the kernel and
                    265:  * userspace.
                    266:  */
                    267: struct puffs_sizeop {
                    268:        uint64_t        pso_reqid;
                    269:
                    270:        uint8_t         *pso_userbuf;
                    271:        size_t          pso_bufsize;
                    272: };
                    273:
                    274: /*
1.16      pooka     275:  * Flush operation.  This can be used to invalidate:
                    276:  * 1) name cache for one node
                    277:  * 2) name cache for all children
                    278:  * 3) name cache for the entire mount
                    279:  * 4) page cache for a set of ranges in one node
                    280:  * 5) page cache for one entire node
                    281:  *
                    282:  * It can be used to flush:
                    283:  * 1) page cache for a set of ranges in one node
                    284:  * 2) page cache for one entire node
                    285:  */
                    286:
1.20      pooka     287: /* XXX: needs restructuring */
1.16      pooka     288: struct puffs_flush {
                    289:        void            *pf_cookie;
                    290:
                    291:        int             pf_op;
1.20      pooka     292:        off_t           pf_start;
                    293:        off_t           pf_end;
1.16      pooka     294: };
                    295: #define PUFFS_INVAL_NAMECACHE_NODE             0
                    296: #define PUFFS_INVAL_NAMECACHE_DIR              1
                    297: #define PUFFS_INVAL_NAMECACHE_ALL              2
                    298: #define PUFFS_INVAL_PAGECACHE_NODE_RANGE       3
1.23      pooka     299: #define PUFFS_FLUSH_PAGECACHE_NODE_RANGE       4
1.16      pooka     300:
                    301:
                    302: /*
                    303:  * Available ioctl operations
                    304:  */
1.30      pooka     305: #define PUFFSGETOP             _IOWR('p', 1, struct puffs_reqh_get)
                    306: #define PUFFSPUTOP             _IOWR('p', 2, struct puffs_reqh_put)
                    307: #define PUFFSSIZEOP            _IOWR('p', 3, struct puffs_sizeop)
                    308: #define PUFFSFLUSHOP           _IOW ('p', 4, struct puffs_flush)
1.17      pooka     309: #if 0
1.30      pooka     310: #define PUFFSFLUSHMULTIOP      _IOW ('p', 5, struct puffs_flushmulti)
1.17      pooka     311: #endif
1.30      pooka     312: #define PUFFSSUSPENDOP         _IO  ('p', 6)
1.42.2.1! skrll     313: #define PUFFSREQSIZEOP         _IOR ('p', 7, size_t)
1.16      pooka     314:
                    315:
                    316: /*
1.1       pooka     317:  * Credentials for an operation.  Can be either struct uucred for
                    318:  * ops called from a credential context or NOCRED/FSCRED for ops
                    319:  * called from within the kernel.  It is up to the implementation
                    320:  * if it makes a difference between these two and the super-user.
                    321:  */
1.36      pooka     322: struct puffs_kcred {
                    323:        struct uucred   pkcr_uuc;
                    324:        uint8_t         pkcr_type;
                    325:        uint8_t         pkcr_internal;
1.1       pooka     326: };
                    327: #define PUFFCRED_TYPE_UUC      1
                    328: #define PUFFCRED_TYPE_INTERNAL 2
                    329: #define PUFFCRED_CRED_NOCRED   1
                    330: #define PUFFCRED_CRED_FSCRED   2
                    331:
                    332: /*
1.22      pooka     333:  * 2*MAXPHYS is the max size the system will attempt to copy,
1.1       pooka     334:  * else treated as garbage
                    335:  */
1.22      pooka     336: #define PUFFS_REQ_MAXSIZE      2*MAXPHYS
1.2       pooka     337: #define PUFFS_REQSTRUCT_MAX    4096 /* XXX: approxkludge */
1.1       pooka     338:
                    339: #define PUFFS_TOMOVE(a,b) (MIN((a), b->pmp_req_maxsize - PUFFS_REQSTRUCT_MAX))
                    340:
1.37      pooka     341: /* caller id */
                    342: struct puffs_kcid {
                    343:        int     pkcid_type;
                    344:        pid_t   pkcid_pid;
                    345:        lwpid_t pkcid_lwpid;
                    346: };
                    347: #define PUFFCID_TYPE_REAL      1
                    348: #define PUFFCID_TYPE_FAKE      2
                    349:
1.13      pooka     350: /* puffs struct componentname built by kernel */
                    351: struct puffs_kcn {
1.1       pooka     352:        /* args */
1.13      pooka     353:        u_long                  pkcn_nameiop;   /* namei operation      */
                    354:        u_long                  pkcn_flags;     /* flags                */
                    355:
1.38      pooka     356:        char pkcn_name[MAXPATHLEN];     /* nulterminated path component */
                    357:        long pkcn_namelen;              /* current component length     */
                    358:        long pkcn_consume;              /* IN: extra chars server ate   */
1.1       pooka     359: };
                    360:
                    361: /*
                    362:  * XXX: figure out what to do with these, copied from namei.h for now
                    363:  */
                    364: #define        PUFFSLOOKUP_LOOKUP      0       /* perform name lookup only */
                    365: #define PUFFSLOOKUP_CREATE     1       /* setup for file creation */
                    366: #define PUFFSLOOKUP_DELETE     2       /* setup for file deletion */
                    367: #define PUFFSLOOKUP_RENAME     3       /* setup for file renaming */
                    368: #define PUFFSLOOKUP_OPMASK     3       /* mask for operation */
                    369:
1.21      pooka     370: #define PUFFSLOOKUP_FOLLOW     0x00004 /* follow final symlink */
                    371: #define PUFFSLOOKUP_NOFOLLOW   0x00008 /* don't follow final symlink */
                    372: #define PUFFSLOOKUP_ISLASTCN   0x08000 /* is last component of lookup */
1.40      pooka     373: #define PUFFSLOOKUP_REQUIREDIR 0x80000 /* must be directory */
1.1       pooka     374:
1.24      pooka     375:
1.11      pooka     376: /*
                    377:  * Next come the individual requests.  They are all subclassed from
                    378:  * puffs_req and contain request-specific fields in addition.  Note
                    379:  * that there are some requests which have to handle arbitrary-length
                    380:  * buffers.
                    381:  *
                    382:  * The division is the following: puffs_req is to be touched only
                    383:  * by generic routines while the other stuff is supposed to be
                    384:  * modified only by specific routines.
                    385:  */
1.6       pooka     386:
1.1       pooka     387: /*
                    388:  * aux structures for vfs operations.
                    389:  */
                    390: struct puffs_vfsreq_unmount {
1.11      pooka     391:        struct puffs_req        pvfsr_pr;
                    392:
1.1       pooka     393:        int                     pvfsr_flags;
1.37      pooka     394:        struct puffs_kcid       pvfsr_cid;
1.1       pooka     395: };
                    396:
                    397: struct puffs_vfsreq_statvfs {
1.11      pooka     398:        struct puffs_req        pvfsr_pr;
                    399:
1.1       pooka     400:        struct statvfs          pvfsr_sb;
1.37      pooka     401:        struct puffs_kcid       pvfsr_cid;
1.1       pooka     402: };
                    403:
                    404: struct puffs_vfsreq_sync {
1.11      pooka     405:        struct puffs_req        pvfsr_pr;
                    406:
1.36      pooka     407:        struct puffs_kcred      pvfsr_cred;
1.37      pooka     408:        struct puffs_kcid       pvfsr_cid;
1.1       pooka     409:        int                     pvfsr_waitfor;
                    410: };
                    411:
1.24      pooka     412: struct puffs_vfsreq_fhtonode {
                    413:        struct puffs_req        pvfsr_pr;
                    414:
                    415:        void                    *pvfsr_fhcookie;        /* IN   */
                    416:        enum vtype              pvfsr_vtype;            /* IN   */
                    417:        voff_t                  pvfsr_size;             /* IN   */
                    418:        dev_t                   pvfsr_rdev;             /* IN   */
                    419:
                    420:        size_t                  pvfsr_dsize;            /* OUT */
1.27      pooka     421:        uint8_t                 pvfsr_data[0]           /* OUT, XXX */
1.24      pooka     422:                                    __aligned(ALIGNBYTES+1);
                    423: };
                    424:
                    425: struct puffs_vfsreq_nodetofh {
                    426:        struct puffs_req        pvfsr_pr;
                    427:
                    428:        void                    *pvfsr_fhcookie;        /* OUT  */
                    429:
                    430:        size_t                  pvfsr_dsize;            /* OUT/IN  */
1.27      pooka     431:        uint8_t                 pvfsr_data[0]           /* IN, XXX */
1.24      pooka     432:                                    __aligned(ALIGNBYTES+1);
                    433: };
                    434:
1.19      pooka     435: struct puffs_vfsreq_suspend {
                    436:        struct puffs_req        pvfsr_pr;
                    437:
                    438:        int                     pvfsr_status;
                    439: };
                    440: #define PUFFS_SUSPEND_START    0
                    441: #define PUFFS_SUSPEND_SUSPENDED        1
                    442: #define PUFFS_SUSPEND_RESUME   2
                    443: #define PUFFS_SUSPEND_ERROR    3
                    444:
1.1       pooka     445: /*
                    446:  * aux structures for vnode operations.
                    447:  */
                    448:
                    449: struct puffs_vnreq_lookup {
1.11      pooka     450:        struct puffs_req        pvn_pr;
                    451:
1.13      pooka     452:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     453:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     454:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
1.36      pooka     455:
1.1       pooka     456:        void                    *pvnr_newnode;          /* IN   */
                    457:        enum vtype              pvnr_vtype;             /* IN   */
1.5       pooka     458:        voff_t                  pvnr_size;              /* IN   */
1.4       pooka     459:        dev_t                   pvnr_rdev;              /* IN   */
1.1       pooka     460: };
                    461:
                    462: struct puffs_vnreq_create {
1.11      pooka     463:        struct puffs_req        pvn_pr;
                    464:
1.13      pooka     465:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     466:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     467:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
1.36      pooka     468:
1.1       pooka     469:        struct vattr            pvnr_va;                /* OUT  */
                    470:        void                    *pvnr_newnode;          /* IN   */
                    471: };
                    472:
                    473: struct puffs_vnreq_mknod {
1.11      pooka     474:        struct puffs_req        pvn_pr;
                    475:
1.13      pooka     476:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     477:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     478:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
1.36      pooka     479:
1.1       pooka     480:        struct vattr            pvnr_va;                /* OUT  */
                    481:        void                    *pvnr_newnode;          /* IN   */
                    482: };
                    483:
                    484: struct puffs_vnreq_open {
1.11      pooka     485:        struct puffs_req        pvn_pr;
                    486:
1.36      pooka     487:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.37      pooka     488:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.1       pooka     489:        int                     pvnr_mode;              /* OUT  */
                    490: };
                    491:
                    492: struct puffs_vnreq_close {
1.11      pooka     493:        struct puffs_req        pvn_pr;
                    494:
1.36      pooka     495:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.37      pooka     496:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.1       pooka     497:        int                     pvnr_fflag;             /* OUT  */
                    498: };
                    499:
                    500: struct puffs_vnreq_access {
1.11      pooka     501:        struct puffs_req        pvn_pr;
                    502:
1.36      pooka     503:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.37      pooka     504:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.1       pooka     505:        int                     pvnr_mode;              /* OUT  */
                    506: };
                    507:
                    508: #define puffs_vnreq_setattr puffs_vnreq_setgetattr
                    509: #define puffs_vnreq_getattr puffs_vnreq_setgetattr
                    510: struct puffs_vnreq_setgetattr {
1.11      pooka     511:        struct puffs_req        pvn_pr;
                    512:
1.36      pooka     513:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.37      pooka     514:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.1       pooka     515:        struct vattr            pvnr_va;                /* IN/OUT (op depend) */
                    516: };
                    517:
                    518: #define puffs_vnreq_read puffs_vnreq_readwrite
                    519: #define puffs_vnreq_write puffs_vnreq_readwrite
                    520: struct puffs_vnreq_readwrite {
1.11      pooka     521:        struct puffs_req        pvn_pr;
                    522:
1.36      pooka     523:        struct puffs_kcred      pvnr_cred;              /* OUT    */
1.1       pooka     524:        off_t                   pvnr_offset;            /* OUT    */
                    525:        size_t                  pvnr_resid;             /* IN/OUT */
                    526:        int                     pvnr_ioflag;            /* OUT    */
                    527:
                    528:        uint8_t                 pvnr_data[0];           /* IN/OUT (wr/rd) */
                    529: };
                    530:
                    531: #define puffs_vnreq_ioctl puffs_vnreq_fcnioctl
                    532: #define puffs_vnreq_fcntl puffs_vnreq_fcnioctl
                    533: struct puffs_vnreq_fcnioctl {
1.11      pooka     534:        struct puffs_req        pvn_pr;
                    535:
1.36      pooka     536:        struct puffs_kcred      pvnr_cred;
1.1       pooka     537:        u_long                  pvnr_command;
                    538:        pid_t                   pvnr_pid;
                    539:        int                     pvnr_fflag;
                    540:
                    541:        void                    *pvnr_data;
                    542:        size_t                  pvnr_datalen;
                    543:        int                     pvnr_copyback;
                    544: };
                    545:
                    546: struct puffs_vnreq_poll {
1.11      pooka     547:        struct puffs_req        pvn_pr;
                    548:
1.31      pooka     549:        int                     pvnr_events;            /* IN/OUT */
1.37      pooka     550:        struct puffs_kcid       pvnr_cid;               /* OUT    */
1.1       pooka     551: };
                    552:
                    553: struct puffs_vnreq_fsync {
1.11      pooka     554:        struct puffs_req        pvn_pr;
                    555:
1.36      pooka     556:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.37      pooka     557:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.1       pooka     558:        off_t                   pvnr_offlo;             /* OUT  */
                    559:        off_t                   pvnr_offhi;             /* OUT  */
                    560:        int                     pvnr_flags;             /* OUT  */
                    561: };
                    562:
                    563: struct puffs_vnreq_seek {
1.11      pooka     564:        struct puffs_req        pvn_pr;
                    565:
1.36      pooka     566:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.1       pooka     567:        off_t                   pvnr_oldoff;            /* OUT  */
                    568:        off_t                   pvnr_newoff;            /* OUT  */
                    569: };
                    570:
                    571: struct puffs_vnreq_remove {
1.11      pooka     572:        struct puffs_req        pvn_pr;
                    573:
1.13      pooka     574:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     575:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     576:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
1.36      pooka     577:
1.1       pooka     578:        void                    *pvnr_cookie_targ;      /* OUT  */
                    579: };
                    580:
                    581: struct puffs_vnreq_mkdir {
1.11      pooka     582:        struct puffs_req        pvn_pr;
                    583:
1.13      pooka     584:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     585:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     586:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
1.36      pooka     587:
1.1       pooka     588:        struct vattr            pvnr_va;                /* OUT  */
                    589:        void                    *pvnr_newnode;          /* IN   */
                    590: };
                    591:
                    592: struct puffs_vnreq_rmdir {
1.11      pooka     593:        struct puffs_req        pvn_pr;
                    594:
1.13      pooka     595:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     596:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     597:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
                    598:
1.1       pooka     599:        void                    *pvnr_cookie_targ;      /* OUT  */
                    600: };
                    601:
                    602: struct puffs_vnreq_link {
1.11      pooka     603:        struct puffs_req        pvn_pr;
                    604:
1.36      pooka     605:        struct puffs_kcn        pvnr_cn;                /* OUT  */
                    606:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     607:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
                    608:
1.36      pooka     609:        void                    *pvnr_cookie_targ;      /* OUT  */
1.1       pooka     610: };
                    611:
                    612: struct puffs_vnreq_rename {
1.11      pooka     613:        struct puffs_req        pvn_pr;
                    614:
1.13      pooka     615:        struct puffs_kcn        pvnr_cn_src;            /* OUT  */
1.36      pooka     616:        struct puffs_kcred      pvnr_cn_src_cred;       /* OUT  */
1.37      pooka     617:        struct puffs_kcid       pvnr_cn_src_cid;        /* OUT  */
1.13      pooka     618:        struct puffs_kcn        pvnr_cn_targ;           /* OUT  */
1.36      pooka     619:        struct puffs_kcred      pvnr_cn_targ_cred;      /* OUT  */
1.37      pooka     620:        struct puffs_kcid       pvnr_cn_targ_cid;       /* OUT  */
1.36      pooka     621:
1.1       pooka     622:        void                    *pvnr_cookie_src;       /* OUT  */
                    623:        void                    *pvnr_cookie_targ;      /* OUT  */
                    624:        void                    *pvnr_cookie_targdir;   /* OUT  */
                    625: };
                    626:
                    627: struct puffs_vnreq_symlink {
1.11      pooka     628:        struct puffs_req        pvn_pr;
                    629:
1.13      pooka     630:        struct puffs_kcn        pvnr_cn;                /* OUT  */
1.36      pooka     631:        struct puffs_kcred      pvnr_cn_cred;           /* OUT  */
1.37      pooka     632:        struct puffs_kcid       pvnr_cn_cid;            /* OUT  */
1.36      pooka     633:
1.1       pooka     634:        struct vattr            pvnr_va;                /* OUT  */
                    635:        void                    *pvnr_newnode;          /* IN   */
                    636:        char                    pvnr_link[MAXPATHLEN];  /* OUT  */
                    637: };
                    638:
                    639: struct puffs_vnreq_readdir {
1.11      pooka     640:        struct puffs_req        pvn_pr;
                    641:
1.36      pooka     642:        struct puffs_kcred      pvnr_cred;              /* OUT    */
1.1       pooka     643:        off_t                   pvnr_offset;            /* IN/OUT */
                    644:        size_t                  pvnr_resid;             /* IN/OUT */
1.24      pooka     645:        size_t                  pvnr_ncookies;          /* IN/OUT */
                    646:        int                     pvnr_eofflag;           /* IN     */
1.1       pooka     647:
1.24      pooka     648:        size_t                  pvnr_dentoff;           /* OUT    */
                    649:        uint8_t                 pvnr_data[0]            /* IN     */
                    650:                                    __aligned(ALIGNBYTES+1);
1.1       pooka     651: };
                    652:
                    653: struct puffs_vnreq_readlink {
1.11      pooka     654:        struct puffs_req        pvn_pr;
                    655:
1.36      pooka     656:        struct puffs_kcred      pvnr_cred;              /* OUT */
1.1       pooka     657:        size_t                  pvnr_linklen;           /* IN  */
                    658:        char                    pvnr_link[MAXPATHLEN];  /* IN, XXX  */
                    659: };
                    660:
                    661: struct puffs_vnreq_reclaim {
1.11      pooka     662:        struct puffs_req        pvn_pr;
                    663:
1.37      pooka     664:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.1       pooka     665: };
                    666:
1.3       pooka     667: struct puffs_vnreq_inactive {
1.11      pooka     668:        struct puffs_req        pvn_pr;
                    669:
1.37      pooka     670:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.3       pooka     671: };
                    672:
1.1       pooka     673: struct puffs_vnreq_print {
1.11      pooka     674:        struct puffs_req        pvn_pr;
                    675:
1.1       pooka     676:        /* empty */
                    677: };
                    678:
                    679: struct puffs_vnreq_pathconf {
1.11      pooka     680:        struct puffs_req        pvn_pr;
                    681:
1.1       pooka     682:        int                     pvnr_name;              /* OUT  */
                    683:        int                     pvnr_retval;            /* IN   */
                    684: };
                    685:
                    686: struct puffs_vnreq_advlock {
1.11      pooka     687:        struct puffs_req        pvn_pr;
                    688:
1.1       pooka     689:        struct flock            pvnr_fl;                /* OUT  */
                    690:        void                    *pvnr_id;               /* OUT  */
                    691:        int                     pvnr_op;                /* OUT  */
                    692:        int                     pvnr_flags;             /* OUT  */
                    693: };
                    694:
1.12      pooka     695: struct puffs_vnreq_mmap {
                    696:        struct puffs_req        pvn_pr;
                    697:
1.42.2.1! skrll     698:        vm_prot_t               pvnr_prot;              /* OUT  */
1.36      pooka     699:        struct puffs_kcred      pvnr_cred;              /* OUT  */
1.37      pooka     700:        struct puffs_kcid       pvnr_cid;               /* OUT  */
1.12      pooka     701: };
                    702:
1.20      pooka     703:
                    704: /*
                    705:  * For cache reports.  Everything is always out-out-out, no replies
                    706:  */
                    707:
                    708: struct puffs_cacherun {
                    709:        off_t                   pcache_runstart;
                    710:        off_t                   pcache_runend;
                    711: };
                    712:
                    713: /* cache info.  old used for write now */
                    714: struct puffs_cacheinfo {
                    715:        struct puffs_req        pcache_pr;
                    716:
                    717:        int                     pcache_type;
                    718:        size_t                  pcache_nruns;
                    719:        struct puffs_cacherun   pcache_runs[0];
                    720: };
                    721: #define PCACHE_TYPE_READ       0
                    722: #define PCACHE_TYPE_WRITE      1
                    723:
1.1       pooka     724: /* notyet */
                    725: #if 0
                    726: struct puffs_vnreq_kqfilter { };
                    727: struct puffs_vnreq_islocked { };
                    728: #endif
                    729: struct puffs_vnreq_getextattr { };
                    730: struct puffs_vnreq_setextattr { };
                    731: struct puffs_vnreq_listextattr { };
                    732:
                    733: #ifdef _KERNEL
                    734: #define PUFFS_VFSREQ(a)                                                        \
                    735:        struct puffs_vfsreq_##a a##_arg;                                \
                    736:        memset(&a##_arg, 0, sizeof(struct puffs_vfsreq_##a))
                    737:
                    738: #define PUFFS_VNREQ(a)                                                 \
                    739:        struct puffs_vnreq_##a a##_arg;                                 \
                    740:        memset(&a##_arg, 0, sizeof(struct puffs_vnreq_##a))
                    741: #endif
                    742:
                    743: #endif /* _PUFFS_MSGIF_H_ */

CVSweb <webmaster@jp.NetBSD.org>