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