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