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