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