1 | /* $NetBSD: puffs_msgif.h,v 1.84 2015/02/15 20:21:29 manu Exp $ */ |
2 | |
3 | /* |
4 | * Copyright (c) 2005, 2006, 2007 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 <dev/putter/putter.h> |
46 | |
47 | #include <uvm/uvm_prot.h> |
48 | |
49 | #define PUFFSOP_VFS 0x01 /* kernel-> */ |
50 | #define PUFFSOP_VN 0x02 /* kernel-> */ |
51 | #define PUFFSOP_CACHE 0x03 /* only kernel-> */ |
52 | #define PUFFSOP_ERROR 0x04 /* only kernel-> */ |
53 | #define PUFFSOP_FLUSH 0x05 /* ->kernel */ |
54 | #define PUFFSOP_SUSPEND 0x06 /* ->kernel */ |
55 | #define PUFFSOP_UNMOUNT 0x07 /* ->kernel */ |
56 | |
57 | #define PUFFSOPFLAG_FAF 0x10 /* fire-and-forget */ |
58 | #define PUFFSOPFLAG_ISRESPONSE 0x20 /* req is actually a resp */ |
59 | |
60 | #define PUFFSOP_OPCMASK 0x07 |
61 | #define PUFFSOP_OPCLASS(a) ((a) & PUFFSOP_OPCMASK) |
62 | #define PUFFSOP_WANTREPLY(a) (((a) & PUFFSOPFLAG_FAF) == 0) |
63 | |
64 | enum { |
65 | PUFFS_VFS_MOUNT, PUFFS_VFS_START, PUFFS_VFS_UNMOUNT, |
66 | PUFFS_VFS_ROOT, PUFFS_VFS_QUOTACTL, PUFFS_VFS_STATVFS, |
67 | PUFFS_VFS_SYNC, PUFFS_VFS_VGET, PUFFS_VFS_FHTOVP, |
68 | PUFFS_VFS_VPTOFH, PUFFS_VFS_INIT, PUFFS_VFS_DONE, |
69 | PUFFS_VFS_SNAPSHOT, PUFFS_VFS_EXTATTRCTL, PUFFS_VFS_SUSPEND |
70 | }; |
71 | #define PUFFS_VFS_MAX PUFFS_VFS_SUSPEND |
72 | |
73 | enum { |
74 | PUFFS_VN_LOOKUP, PUFFS_VN_CREATE, PUFFS_VN_MKNOD, |
75 | PUFFS_VN_OPEN, PUFFS_VN_CLOSE, PUFFS_VN_ACCESS, |
76 | PUFFS_VN_GETATTR, PUFFS_VN_SETATTR, PUFFS_VN_READ, |
77 | PUFFS_VN_WRITE, PUFFS_VN_IOCTL, PUFFS_VN_FCNTL, |
78 | PUFFS_VN_POLL, PUFFS_VN_KQFILTER, PUFFS_VN_REVOKE, |
79 | PUFFS_VN_MMAP, PUFFS_VN_FSYNC, PUFFS_VN_SEEK, |
80 | PUFFS_VN_REMOVE, PUFFS_VN_LINK, PUFFS_VN_RENAME, |
81 | PUFFS_VN_MKDIR, PUFFS_VN_RMDIR, PUFFS_VN_SYMLINK, |
82 | PUFFS_VN_READDIR, PUFFS_VN_READLINK, PUFFS_VN_ABORTOP, |
83 | PUFFS_VN_INACTIVE, PUFFS_VN_RECLAIM, PUFFS_VN_LOCK, |
84 | PUFFS_VN_UNLOCK, PUFFS_VN_BMAP, PUFFS_VN_STRATEGY, |
85 | PUFFS_VN_PRINT, PUFFS_VN_ISLOCKED, PUFFS_VN_PATHCONF, |
86 | PUFFS_VN_ADVLOCK, PUFFS_VN_LEASE, PUFFS_VN_WHITEOUT, |
87 | PUFFS_VN_GETPAGES, PUFFS_VN_PUTPAGES, PUFFS_VN_GETEXTATTR, |
88 | PUFFS_VN_LISTEXTATTR, PUFFS_VN_OPENEXTATTR, PUFFS_VN_DELETEEXTATTR, |
89 | PUFFS_VN_SETEXTATTR, PUFFS_VN_CLOSEEXTATTR, PUFFS_VN_FALLOCATE, |
90 | PUFFS_VN_FDISCARD, |
91 | /* NOTE: If you add an op, decrement PUFFS_VN_SPARE accordingly */ |
92 | }; |
93 | #define PUFFS_VN_MAX PUFFS_VN_FDISCARD |
94 | #define PUFFS_VN_SPARE 30 |
95 | |
96 | /* |
97 | * These signal invalid parameters the file system returned. |
98 | */ |
99 | enum { |
100 | PUFFS_ERR_ERROR, |
101 | PUFFS_ERR_MAKENODE, PUFFS_ERR_LOOKUP, PUFFS_ERR_READDIR, |
102 | PUFFS_ERR_READLINK, PUFFS_ERR_READ, PUFFS_ERR_WRITE, |
103 | PUFFS_ERR_VPTOFH, PUFFS_ERR_GETEXTATTR, PUFFS_ERR_LISTEXTATTR |
104 | }; |
105 | #define PUFFS_ERR_MAX PUFFS_ERR_LISTEXTATTR |
106 | |
107 | #define PUFFSVERSION 30 |
108 | #define PUFFSNAMESIZE 32 |
109 | |
110 | #define PUFFS_TYPEPREFIX "puffs|" |
111 | |
112 | #define PUFFS_TYPELEN (_VFS_NAMELEN - (sizeof(PUFFS_TYPEPREFIX)+1)) |
113 | #define PUFFS_NAMELEN (_VFS_MNAMELEN-1) |
114 | |
115 | /* |
116 | * Just a weak typedef for code clarity. Additionally, we have a |
117 | * more appropriate vanity type for puffs: |
118 | * <uep> it should be croissant, not cookie. |
119 | */ |
120 | typedef void *puffs_cookie_t; |
121 | typedef puffs_cookie_t puffs_croissant_t; |
122 | |
123 | struct puffs_kargs { |
124 | unsigned int pa_vers; |
125 | int pa_fd; |
126 | |
127 | uint32_t pa_flags; |
128 | |
129 | size_t pa_maxmsglen; |
130 | int pa_nhashbuckets; |
131 | |
132 | size_t pa_fhsize; |
133 | int pa_fhflags; |
134 | |
135 | uint8_t pa_vnopmask[PUFFS_VN_MAX + PUFFS_VN_SPARE]; |
136 | |
137 | char pa_typename[_VFS_NAMELEN]; |
138 | char pa_mntfromname[_VFS_MNAMELEN]; |
139 | |
140 | puffs_cookie_t pa_root_cookie; |
141 | enum vtype pa_root_vtype; |
142 | voff_t pa_root_vsize; |
143 | union { |
144 | dev_t dev; |
145 | uint64_t container; |
146 | } devunion; |
147 | |
148 | struct statvfs pa_svfsb; |
149 | |
150 | uint32_t pa_time32; |
151 | |
152 | uint32_t pa_spare[127]; |
153 | }; |
154 | #define pa_root_rdev devunion.dev |
155 | |
156 | #define PUFFS_KFLAG_NOCACHE_NAME 0x001 /* don't use name cache */ |
157 | #define PUFFS_KFLAG_NOCACHE_PAGE 0x002 /* don't use page cache */ |
158 | #define PUFFS_KFLAG_NOCACHE 0x003 /* no cache whatsoever */ |
159 | #define PUFFS_KFLAG_ALLOPS 0x004 /* ignore pa_vnopmask */ |
160 | #define PUFFS_KFLAG_WTCACHE 0x008 /* write-through page cache */ |
161 | #define PUFFS_KFLAG_IAONDEMAND 0x010 /* inactive only on demand */ |
162 | #define PUFFS_KFLAG_LOOKUP_FULLPNBUF 0x020 /* full pnbuf in lookup */ |
163 | #define PUFFS_KFLAG_NOCACHE_ATTR 0x040 /* no attrib cache (unused) */ |
164 | #define PUFFS_KFLAG_CACHE_FS_TTL 0x080 /* cache use TTL from FS */ |
165 | #define PUFFS_KFLAG_CACHE_DOTDOT 0x100 /* don't send lookup for .. */ |
166 | #define PUFFS_KFLAG_NOFLUSH_META 0x200 /* don't flush metadata cache*/ |
167 | #define PUFFS_KFLAG_MASK 0x3bf |
168 | |
169 | #define PUFFS_FHFLAG_DYNAMIC 0x01 |
170 | #define PUFFS_FHFLAG_NFSV2 0x02 |
171 | #define PUFFS_FHFLAG_NFSV3 0x04 |
172 | #define PUFFS_FHFLAG_PROTOMASK 0x06 |
173 | #define PUFFS_FHFLAG_PASSTHROUGH 0x08 |
174 | #define PUFFS_FHFLAG_MASK 0x0f |
175 | |
176 | #define PUFFS_FHSIZE_MAX 1020 /* FHANDLE_SIZE_MAX - 4 */ |
177 | |
178 | struct puffs_req { |
179 | struct putter_hdr preq_pth; |
180 | |
181 | uint64_t preq_id; |
182 | puffs_cookie_t preq_cookie; |
183 | |
184 | uint16_t preq_opclass; |
185 | uint16_t preq_optype; |
186 | int preq_rv; |
187 | |
188 | uint32_t preq_setbacks; |
189 | |
190 | /* Who is making the call? Eventually host id is also needed. */ |
191 | pid_t preq_pid; |
192 | lwpid_t preq_lid; |
193 | |
194 | /* |
195 | * the following helper pads the struct size to md alignment |
196 | * multiple (should size_t not cut it). it makes sure that |
197 | * whatever comes after this struct is aligned |
198 | */ |
199 | size_t preq_buflen; |
200 | uint8_t preq_buf[0] __aligned(ALIGNBYTES+1); |
201 | }; |
202 | |
203 | #define PUFFS_SETBACK_INACT_N1 0x01 /* set VOP_INACTIVE for node 1 */ |
204 | #define PUFFS_SETBACK_INACT_N2 0x02 /* set VOP_INACTIVE for node 2 */ |
205 | #define PUFFS_SETBACK_NOREF_N1 0x04 /* set pn PN_NOREFS for node 1 */ |
206 | #define PUFFS_SETBACK_NOREF_N2 0x08 /* set pn PN_NOREFS for node 2 */ |
207 | #define PUFFS_SETBACK_MASK 0x0f |
208 | |
209 | /* |
210 | * Flush operation. This can be used to invalidate: |
211 | * 1) name cache for one node |
212 | * 2) name cache for all children |
213 | * 3) name cache for the entire mount |
214 | * 4) page cache for a set of ranges in one node |
215 | * 5) page cache for one entire node |
216 | * |
217 | * It can be used to flush: |
218 | * 1) page cache for a set of ranges in one node |
219 | * 2) page cache for one entire node |
220 | */ |
221 | |
222 | struct puffs_flush { |
223 | struct puffs_req pf_req; |
224 | |
225 | puffs_cookie_t pf_cookie; |
226 | |
227 | int pf_op; |
228 | off_t pf_start; |
229 | off_t pf_end; |
230 | }; |
231 | #define PUFFS_INVAL_NAMECACHE_NODE 0 |
232 | #define PUFFS_INVAL_NAMECACHE_DIR 1 |
233 | #define PUFFS_INVAL_NAMECACHE_ALL 2 |
234 | #define PUFFS_INVAL_PAGECACHE_NODE_RANGE 3 |
235 | #define PUFFS_FLUSH_PAGECACHE_NODE_RANGE 4 |
236 | |
237 | /* |
238 | * Credentials for an operation. Can be either struct uucred for |
239 | * ops called from a credential context or NOCRED/FSCRED for ops |
240 | * called from within the kernel. It is up to the implementation |
241 | * if it makes a difference between these two and the super-user. |
242 | */ |
243 | struct puffs_kcred { |
244 | struct uucred pkcr_uuc; |
245 | uint8_t pkcr_type; |
246 | uint8_t pkcr_internal; |
247 | }; |
248 | #define PUFFCRED_TYPE_UUC 1 |
249 | #define PUFFCRED_TYPE_INTERNAL 2 |
250 | #define PUFFCRED_CRED_NOCRED 1 |
251 | #define PUFFCRED_CRED_FSCRED 2 |
252 | |
253 | /* |
254 | * 2*MAXPHYS is the max size the system will attempt to copy, |
255 | * else treated as garbage |
256 | */ |
257 | #define PUFFS_MSG_MAXSIZE 2*MAXPHYS |
258 | #define PUFFS_MSGSTRUCT_MAX 4096 /* approximate */ |
259 | |
260 | #define PUFFS_EXTNAMELEN KERNEL_NAME_MAX /* currently same as EXTATTR_MAXNAMELEN */ |
261 | |
262 | #define PUFFS_TOMOVE(a,b) (MIN((a), b->pmp_msg_maxsize - PUFFS_MSGSTRUCT_MAX)) |
263 | |
264 | /* puffs struct componentname built by kernel */ |
265 | struct puffs_kcn { |
266 | /* args */ |
267 | uint32_t pkcn_nameiop; /* namei operation */ |
268 | uint32_t pkcn_flags; /* flags */ |
269 | |
270 | char pkcn_name[MAXPATHLEN]; /* nulterminated path component */ |
271 | size_t pkcn_namelen; /* current component length */ |
272 | size_t pkcn_consume; /* IN: extra chars server ate */ |
273 | }; |
274 | |
275 | |
276 | /* |
277 | * Next come the individual requests. They are all subclassed from |
278 | * puffs_req and contain request-specific fields in addition. Note |
279 | * that there are some requests which have to handle arbitrary-length |
280 | * buffers. |
281 | * |
282 | * The division is the following: puffs_req is to be touched only |
283 | * by generic routines while the other stuff is supposed to be |
284 | * modified only by specific routines. |
285 | */ |
286 | |
287 | /* |
288 | * aux structures for vfs operations. |
289 | */ |
290 | struct puffs_vfsmsg_unmount { |
291 | struct puffs_req pvfsr_pr; |
292 | |
293 | int pvfsr_flags; |
294 | }; |
295 | |
296 | struct puffs_vfsmsg_statvfs { |
297 | struct puffs_req pvfsr_pr; |
298 | |
299 | struct statvfs pvfsr_sb; |
300 | }; |
301 | |
302 | struct puffs_vfsmsg_sync { |
303 | struct puffs_req pvfsr_pr; |
304 | |
305 | struct puffs_kcred pvfsr_cred; |
306 | int pvfsr_waitfor; |
307 | }; |
308 | |
309 | struct puffs_vfsmsg_fhtonode { |
310 | struct puffs_req pvfsr_pr; |
311 | |
312 | void *pvfsr_fhcookie; /* IN */ |
313 | enum vtype pvfsr_vtype; /* IN */ |
314 | voff_t pvfsr_size; /* IN */ |
315 | dev_t pvfsr_rdev; /* IN */ |
316 | |
317 | size_t pvfsr_dsize; /* OUT */ |
318 | uint8_t pvfsr_data[0] /* OUT, XXX */ |
319 | __aligned(ALIGNBYTES+1); |
320 | }; |
321 | |
322 | struct puffs_vfsmsg_nodetofh { |
323 | struct puffs_req pvfsr_pr; |
324 | |
325 | void *pvfsr_fhcookie; /* OUT */ |
326 | |
327 | size_t pvfsr_dsize; /* OUT/IN */ |
328 | uint8_t pvfsr_data[0] /* IN, XXX */ |
329 | __aligned(ALIGNBYTES+1); |
330 | }; |
331 | |
332 | struct puffs_vfsmsg_suspend { |
333 | struct puffs_req pvfsr_pr; |
334 | |
335 | int pvfsr_status; |
336 | }; |
337 | #define PUFFS_SUSPEND_START 0 |
338 | #define PUFFS_SUSPEND_SUSPENDED 1 |
339 | #define PUFFS_SUSPEND_RESUME 2 |
340 | #define PUFFS_SUSPEND_ERROR 3 |
341 | |
342 | #define PUFFS_EXTATTRCTL_HASNODE 0x01 |
343 | #define PUFFS_EXTATTRCTL_HASATTRNAME 0x02 |
344 | |
345 | #define PUFFS_OPEN_IO_DIRECT 0x01 |
346 | |
347 | struct puffs_vfsmsg_extattrctl { |
348 | struct puffs_req pvfsr_pr; |
349 | |
350 | int pvfsr_cmd; /* OUT */ |
351 | int pvfsr_attrnamespace; /* OUT */ |
352 | int pvfsr_flags; /* OUT */ |
353 | char pvfsr_attrname[PUFFS_EXTNAMELEN]; /* OUT */ |
354 | }; |
355 | |
356 | /* |
357 | * aux structures for vnode operations. |
358 | */ |
359 | |
360 | struct puffs_vnmsg_lookup { |
361 | struct puffs_req pvn_pr; |
362 | |
363 | struct puffs_kcn pvnr_cn; /* OUT */ |
364 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
365 | |
366 | puffs_cookie_t pvnr_newnode; /* IN */ |
367 | enum vtype pvnr_vtype; /* IN */ |
368 | voff_t pvnr_size; /* IN */ |
369 | dev_t pvnr_rdev; /* IN */ |
370 | /* Used only if PUFFS_KFLAG_CACHE_USE_TTL */ |
371 | struct vattr pvnr_va; /* IN */ |
372 | struct timespec pvnr_va_ttl; /* IN */ |
373 | struct timespec pvnr_cn_ttl; /* IN */ |
374 | }; |
375 | |
376 | struct puffs_vnmsg_create { |
377 | struct puffs_req pvn_pr; |
378 | |
379 | struct puffs_kcn pvnr_cn; /* OUT */ |
380 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
381 | |
382 | struct vattr pvnr_va; /* OUT */ |
383 | puffs_cookie_t pvnr_newnode; /* IN */ |
384 | /* Used only if PUFFS_KFLAG_CACHE_USE_TTL */ |
385 | struct timespec pvnr_va_ttl; /* IN */ |
386 | struct timespec pvnr_cn_ttl; /* IN */ |
387 | }; |
388 | |
389 | struct puffs_vnmsg_mknod { |
390 | struct puffs_req pvn_pr; |
391 | |
392 | struct puffs_kcn pvnr_cn; /* OUT */ |
393 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
394 | |
395 | struct vattr pvnr_va; /* OUT */ |
396 | puffs_cookie_t pvnr_newnode; /* IN */ |
397 | /* Used only if PUFFS_KFLAG_CACHE_USE_TTL */ |
398 | struct timespec pvnr_va_ttl; /* IN */ |
399 | struct timespec pvnr_cn_ttl; /* IN */ |
400 | }; |
401 | |
402 | struct puffs_vnmsg_open { |
403 | struct puffs_req pvn_pr; |
404 | |
405 | struct puffs_kcred pvnr_cred; /* OUT */ |
406 | int pvnr_mode; /* OUT */ |
407 | int pvnr_oflags; /* IN */ |
408 | }; |
409 | |
410 | struct puffs_vnmsg_close { |
411 | struct puffs_req pvn_pr; |
412 | |
413 | struct puffs_kcred pvnr_cred; /* OUT */ |
414 | int pvnr_fflag; /* OUT */ |
415 | }; |
416 | |
417 | struct puffs_vnmsg_access { |
418 | struct puffs_req pvn_pr; |
419 | |
420 | struct puffs_kcred pvnr_cred; /* OUT */ |
421 | int pvnr_mode; /* OUT */ |
422 | }; |
423 | |
424 | #define puffs_vnmsg_setattr puffs_vnmsg_setgetattr |
425 | #define puffs_vnmsg_getattr puffs_vnmsg_setgetattr |
426 | struct puffs_vnmsg_setgetattr { |
427 | struct puffs_req pvn_pr; |
428 | |
429 | struct puffs_kcred pvnr_cred; /* OUT */ |
430 | struct vattr pvnr_va; /* IN/OUT (op depend) */ |
431 | /* Used only if PUFFS_KFLAG_CACHE_USE_TTL */ |
432 | struct timespec pvnr_va_ttl; /* IN */ |
433 | }; |
434 | |
435 | #define puffs_vnmsg_read puffs_vnmsg_rw |
436 | #define puffs_vnmsg_write puffs_vnmsg_rw |
437 | struct puffs_vnmsg_rw { |
438 | struct puffs_req pvn_pr; |
439 | |
440 | struct puffs_kcred pvnr_cred; /* OUT */ |
441 | off_t pvnr_offset; /* OUT */ |
442 | size_t pvnr_resid; /* IN/OUT */ |
443 | int pvnr_ioflag; /* OUT */ |
444 | |
445 | uint8_t pvnr_data[0]; /* IN/OUT (wr/rd) */ |
446 | }; |
447 | |
448 | #define puffs_vnmsg_ioctl puffs_vnreq_fcnioctl |
449 | #define puffs_vnmsg_fcntl puffs_vnreq_fcnioctl |
450 | struct puffs_vnmsg_fcnioctl { |
451 | struct puffs_req pvn_pr; |
452 | |
453 | struct puffs_kcred pvnr_cred; |
454 | u_long pvnr_command; |
455 | pid_t pvnr_pid; |
456 | int pvnr_fflag; |
457 | |
458 | void *pvnr_data; |
459 | size_t pvnr_datalen; |
460 | int pvnr_copyback; |
461 | }; |
462 | |
463 | struct puffs_vnmsg_poll { |
464 | struct puffs_req pvn_pr; |
465 | |
466 | int pvnr_events; /* IN/OUT */ |
467 | }; |
468 | |
469 | struct puffs_vnmsg_fsync { |
470 | struct puffs_req pvn_pr; |
471 | |
472 | struct puffs_kcred pvnr_cred; /* OUT */ |
473 | off_t pvnr_offlo; /* OUT */ |
474 | off_t pvnr_offhi; /* OUT */ |
475 | int pvnr_flags; /* OUT */ |
476 | }; |
477 | |
478 | struct puffs_vnmsg_seek { |
479 | struct puffs_req pvn_pr; |
480 | |
481 | struct puffs_kcred pvnr_cred; /* OUT */ |
482 | off_t pvnr_oldoff; /* OUT */ |
483 | off_t pvnr_newoff; /* OUT */ |
484 | }; |
485 | |
486 | struct puffs_vnmsg_remove { |
487 | struct puffs_req pvn_pr; |
488 | |
489 | struct puffs_kcn pvnr_cn; /* OUT */ |
490 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
491 | |
492 | puffs_cookie_t pvnr_cookie_targ; /* OUT */ |
493 | }; |
494 | |
495 | struct puffs_vnmsg_mkdir { |
496 | struct puffs_req pvn_pr; |
497 | |
498 | struct puffs_kcn pvnr_cn; /* OUT */ |
499 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
500 | |
501 | struct vattr pvnr_va; /* OUT */ |
502 | puffs_cookie_t pvnr_newnode; /* IN */ |
503 | /* Used only if PUFFS_KFLAG_CACHE_USE_TTL */ |
504 | struct timespec pvnr_va_ttl; /* IN */ |
505 | struct timespec pvnr_cn_ttl; /* IN */ |
506 | }; |
507 | |
508 | struct puffs_vnmsg_rmdir { |
509 | struct puffs_req pvn_pr; |
510 | |
511 | struct puffs_kcn pvnr_cn; /* OUT */ |
512 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
513 | |
514 | puffs_cookie_t pvnr_cookie_targ; /* OUT */ |
515 | }; |
516 | |
517 | struct puffs_vnmsg_link { |
518 | struct puffs_req pvn_pr; |
519 | |
520 | struct puffs_kcn pvnr_cn; /* OUT */ |
521 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
522 | |
523 | puffs_cookie_t pvnr_cookie_targ; /* OUT */ |
524 | }; |
525 | |
526 | struct puffs_vnmsg_rename { |
527 | struct puffs_req pvn_pr; |
528 | |
529 | struct puffs_kcn pvnr_cn_src; /* OUT */ |
530 | struct puffs_kcred pvnr_cn_src_cred; /* OUT */ |
531 | struct puffs_kcn pvnr_cn_targ; /* OUT */ |
532 | struct puffs_kcred pvnr_cn_targ_cred; /* OUT */ |
533 | |
534 | puffs_cookie_t pvnr_cookie_src; /* OUT */ |
535 | puffs_cookie_t pvnr_cookie_targ; /* OUT */ |
536 | puffs_cookie_t pvnr_cookie_targdir; /* OUT */ |
537 | }; |
538 | |
539 | struct puffs_vnmsg_symlink { |
540 | struct puffs_req pvn_pr; |
541 | |
542 | struct puffs_kcn pvnr_cn; /* OUT */ |
543 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
544 | |
545 | struct vattr pvnr_va; /* OUT */ |
546 | puffs_cookie_t pvnr_newnode; /* IN */ |
547 | char pvnr_link[MAXPATHLEN]; /* OUT */ |
548 | /* Used only if PUFFS_KFLAG_CACHE_USE_TTL */ |
549 | struct timespec pvnr_va_ttl; /* IN */ |
550 | struct timespec pvnr_cn_ttl; /* IN */ |
551 | }; |
552 | |
553 | struct puffs_vnmsg_readdir { |
554 | struct puffs_req pvn_pr; |
555 | |
556 | struct puffs_kcred pvnr_cred; /* OUT */ |
557 | off_t pvnr_offset; /* IN/OUT */ |
558 | size_t pvnr_resid; /* IN/OUT */ |
559 | size_t pvnr_ncookies; /* IN/OUT */ |
560 | int pvnr_eofflag; /* IN */ |
561 | |
562 | size_t pvnr_dentoff; /* OUT */ |
563 | uint8_t pvnr_data[0] /* IN */ |
564 | __aligned(ALIGNBYTES+1); |
565 | }; |
566 | |
567 | struct puffs_vnmsg_readlink { |
568 | struct puffs_req pvn_pr; |
569 | |
570 | struct puffs_kcred pvnr_cred; /* OUT */ |
571 | size_t pvnr_linklen; /* IN */ |
572 | char pvnr_link[MAXPATHLEN]; /* IN */ |
573 | }; |
574 | |
575 | struct puffs_vnmsg_reclaim { |
576 | struct puffs_req pvn_pr; |
577 | |
578 | int pvnr_nlookup; /* OUT */ |
579 | }; |
580 | |
581 | struct puffs_vnmsg_inactive { |
582 | struct puffs_req pvn_pr; |
583 | }; |
584 | |
585 | struct puffs_vnmsg_print { |
586 | struct puffs_req pvn_pr; |
587 | |
588 | /* empty */ |
589 | }; |
590 | |
591 | struct puffs_vnmsg_pathconf { |
592 | struct puffs_req pvn_pr; |
593 | |
594 | int pvnr_name; /* OUT */ |
595 | register_t pvnr_retval; /* IN */ |
596 | }; |
597 | |
598 | struct puffs_vnmsg_advlock { |
599 | struct puffs_req pvn_pr; |
600 | |
601 | struct flock pvnr_fl; /* OUT */ |
602 | void *pvnr_id; /* OUT */ |
603 | int pvnr_op; /* OUT */ |
604 | int pvnr_flags; /* OUT */ |
605 | }; |
606 | |
607 | struct puffs_vnmsg_mmap { |
608 | struct puffs_req pvn_pr; |
609 | |
610 | vm_prot_t pvnr_prot; /* OUT */ |
611 | struct puffs_kcred pvnr_cred; /* OUT */ |
612 | }; |
613 | |
614 | struct puffs_vnmsg_abortop { |
615 | struct puffs_req pvn_pr; |
616 | |
617 | struct puffs_kcn pvnr_cn; /* OUT */ |
618 | struct puffs_kcred pvnr_cn_cred; /* OUT */ |
619 | }; |
620 | |
621 | struct puffs_vnmsg_getextattr { |
622 | struct puffs_req pvn_pr; |
623 | |
624 | int pvnr_attrnamespace; /* OUT */ |
625 | char pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT */ |
626 | |
627 | struct puffs_kcred pvnr_cred; /* OUT */ |
628 | size_t pvnr_datasize; /* IN */ |
629 | |
630 | size_t pvnr_resid; /* IN/OUT */ |
631 | uint8_t pvnr_data[0] /* IN */ |
632 | __aligned(ALIGNBYTES+1); |
633 | }; |
634 | |
635 | struct puffs_vnmsg_setextattr { |
636 | struct puffs_req pvn_pr; |
637 | |
638 | int pvnr_attrnamespace; /* OUT */ |
639 | char pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT */ |
640 | |
641 | struct puffs_kcred pvnr_cred; /* OUT */ |
642 | |
643 | size_t pvnr_resid; /* IN/OUT */ |
644 | uint8_t pvnr_data[0] /* OUT */ |
645 | __aligned(ALIGNBYTES+1); |
646 | }; |
647 | |
648 | struct puffs_vnmsg_listextattr { |
649 | struct puffs_req pvn_pr; |
650 | |
651 | int pvnr_attrnamespace; /* OUT */ |
652 | |
653 | struct puffs_kcred pvnr_cred; /* OUT */ |
654 | size_t pvnr_datasize; /* IN */ |
655 | |
656 | size_t pvnr_resid; /* IN/OUT */ |
657 | int pvnr_flag; /* OUT */ |
658 | uint8_t pvnr_data[0] /* IN */ |
659 | __aligned(ALIGNBYTES+1); |
660 | }; |
661 | |
662 | struct puffs_vnmsg_deleteextattr { |
663 | struct puffs_req pvn_pr; |
664 | |
665 | int pvnr_attrnamespace; /* OUT */ |
666 | char pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT */ |
667 | |
668 | struct puffs_kcred pvnr_cred; /* OUT */ |
669 | }; |
670 | |
671 | #define PUFFS_HAVE_FALLOCATE 1 |
672 | struct puffs_vnmsg_fallocate { |
673 | struct puffs_req pvn_pr; |
674 | off_t pvnr_off; /* OUT */ |
675 | off_t pvnr_len; /* OUT */ |
676 | }; |
677 | |
678 | struct puffs_vnmsg_fdiscard { |
679 | struct puffs_req pvn_pr; |
680 | off_t pvnr_off; /* OUT */ |
681 | off_t pvnr_len; /* OUT */ |
682 | }; |
683 | |
684 | /* |
685 | * For cache reports. Everything is always out-out-out, no replies |
686 | */ |
687 | |
688 | struct puffs_cacherun { |
689 | off_t pcache_runstart; |
690 | off_t pcache_runend; |
691 | }; |
692 | |
693 | /* cache info. old used for write now */ |
694 | struct puffs_cacheinfo { |
695 | struct puffs_req pcache_pr; |
696 | |
697 | int pcache_type; |
698 | size_t pcache_nruns; |
699 | struct puffs_cacherun pcache_runs[0]; |
700 | }; |
701 | #define PCACHE_TYPE_READ 0 |
702 | #define PCACHE_TYPE_WRITE 1 |
703 | |
704 | /* |
705 | * Error notification. Always outgoing, no response, no remorse. |
706 | */ |
707 | struct puffs_error { |
708 | struct puffs_req perr_pr; |
709 | |
710 | int perr_error; |
711 | char perr_str[256]; |
712 | }; |
713 | |
714 | #endif /* _FS_PUFFS_PUFFS_MSGIF_H_ */ |
715 | |