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