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