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