Home | History | Annotate | Download | only in linux
      1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
      2 /*
      3     This file defines the kernel interface of FUSE
      4     Copyright (C) 2001-2008  Miklos Szeredi <miklos (at) szeredi.hu>
      5 
      6     This program can be distributed under the terms of the GNU GPL.
      7     See the file COPYING.
      8 
      9     This -- and only this -- header file may also be distributed under
     10     the terms of the BSD Licence as follows:
     11 
     12     Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
     13 
     14     Redistribution and use in source and binary forms, with or without
     15     modification, are permitted provided that the following conditions
     16     are met:
     17     1. Redistributions of source code must retain the above copyright
     18        notice, this list of conditions and the following disclaimer.
     19     2. Redistributions in binary form must reproduce the above copyright
     20        notice, this list of conditions and the following disclaimer in the
     21        documentation and/or other materials provided with the distribution.
     22 
     23     THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     24     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26     ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
     27     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33     SUCH DAMAGE.
     34 */
     35 
     36 /*
     37  * This file defines the kernel interface of FUSE
     38  *
     39  * Protocol changelog:
     40  *
     41  * 7.9:
     42  *  - new fuse_getattr_in input argument of GETATTR
     43  *  - add lk_flags in fuse_lk_in
     44  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
     45  *  - add blksize field to fuse_attr
     46  *  - add file flags field to fuse_read_in and fuse_write_in
     47  *
     48  * 7.10
     49  *  - add nonseekable open flag
     50  *
     51  * 7.11
     52  *  - add IOCTL message
     53  *  - add unsolicited notification support
     54  *  - add POLL message and NOTIFY_POLL notification
     55  *
     56  * 7.12
     57  *  - add umask flag to input argument of open, mknod and mkdir
     58  *  - add notification messages for invalidation of inodes and
     59  *    directory entries
     60  *
     61  * 7.13
     62  *  - make max number of background requests and congestion threshold
     63  *    tunables
     64  *
     65  * 7.14
     66  *  - add splice support to fuse device
     67  *
     68  * 7.15
     69  *  - add store notify
     70  *  - add retrieve notify
     71  *
     72  * 7.16
     73  *  - add BATCH_FORGET request
     74  *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
     75  *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
     76  *  - add FUSE_IOCTL_32BIT flag
     77  *
     78  * 7.17
     79  *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
     80  *
     81  * 7.18
     82  *  - add FUSE_IOCTL_DIR flag
     83  *  - add FUSE_NOTIFY_DELETE
     84  *
     85  * 7.19
     86  *  - add FUSE_FALLOCATE
     87  *
     88  * 7.20
     89  *  - add FUSE_AUTO_INVAL_DATA
     90  *
     91  * 7.21
     92  *  - add FUSE_READDIRPLUS
     93  *  - send the requested events in POLL request
     94  *
     95  * 7.22
     96  *  - add FUSE_ASYNC_DIO
     97  *
     98  * 7.23
     99  *  - add FUSE_WRITEBACK_CACHE
    100  *  - add time_gran to fuse_init_out
    101  *  - add reserved space to fuse_init_out
    102  *  - add FATTR_CTIME
    103  *  - add ctime and ctimensec to fuse_setattr_in
    104  *  - add FUSE_RENAME2 request
    105  *  - add FUSE_NO_OPEN_SUPPORT flag
    106  *
    107  *  7.24
    108  *  - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
    109  *
    110  *  7.25
    111  *  - add FUSE_PARALLEL_DIROPS
    112  *
    113  *  7.26
    114  *  - add FUSE_HANDLE_KILLPRIV
    115  *  - add FUSE_POSIX_ACL
    116  */
    117 
    118 #ifndef _LINUX_FUSE_H
    119 #define _LINUX_FUSE_H
    120 
    121 #ifdef __KERNEL__
    122 #include <linux/types.h>
    123 #else
    124 #include <stdint.h>
    125 #endif
    126 
    127 /*
    128  * Version negotiation:
    129  *
    130  * Both the kernel and userspace send the version they support in the
    131  * INIT request and reply respectively.
    132  *
    133  * If the major versions match then both shall use the smallest
    134  * of the two minor versions for communication.
    135  *
    136  * If the kernel supports a larger major version, then userspace shall
    137  * reply with the major version it supports, ignore the rest of the
    138  * INIT message and expect a new INIT message from the kernel with a
    139  * matching major version.
    140  *
    141  * If the library supports a larger major version, then it shall fall
    142  * back to the major protocol version sent by the kernel for
    143  * communication and reply with that major version (and an arbitrary
    144  * supported minor version).
    145  */
    146 
    147 /** Version number of this interface */
    148 #define FUSE_KERNEL_VERSION 7
    149 
    150 /** Minor version number of this interface */
    151 #define FUSE_KERNEL_MINOR_VERSION 26
    152 
    153 /** The node ID of the root inode */
    154 #define FUSE_ROOT_ID 1
    155 
    156 /* Make sure all structures are padded to 64bit boundary, so 32bit
    157    userspace works under 64bit kernels */
    158 
    159 struct fuse_attr {
    160 	uint64_t	ino;
    161 	uint64_t	size;
    162 	uint64_t	blocks;
    163 	uint64_t	atime;
    164 	uint64_t	mtime;
    165 	uint64_t	ctime;
    166 	uint32_t	atimensec;
    167 	uint32_t	mtimensec;
    168 	uint32_t	ctimensec;
    169 	uint32_t	mode;
    170 	uint32_t	nlink;
    171 	uint32_t	uid;
    172 	uint32_t	gid;
    173 	uint32_t	rdev;
    174 	uint32_t	blksize;
    175 	uint32_t	padding;
    176 };
    177 
    178 struct fuse_kstatfs {
    179 	uint64_t	blocks;
    180 	uint64_t	bfree;
    181 	uint64_t	bavail;
    182 	uint64_t	files;
    183 	uint64_t	ffree;
    184 	uint32_t	bsize;
    185 	uint32_t	namelen;
    186 	uint32_t	frsize;
    187 	uint32_t	padding;
    188 	uint32_t	spare[6];
    189 };
    190 
    191 struct fuse_file_lock {
    192 	uint64_t	start;
    193 	uint64_t	end;
    194 	uint32_t	type;
    195 	uint32_t	pid; /* tgid */
    196 };
    197 
    198 /**
    199  * Bitmasks for fuse_setattr_in.valid
    200  */
    201 #define FATTR_MODE	(1 << 0)
    202 #define FATTR_UID	(1 << 1)
    203 #define FATTR_GID	(1 << 2)
    204 #define FATTR_SIZE	(1 << 3)
    205 #define FATTR_ATIME	(1 << 4)
    206 #define FATTR_MTIME	(1 << 5)
    207 #define FATTR_FH	(1 << 6)
    208 #define FATTR_ATIME_NOW	(1 << 7)
    209 #define FATTR_MTIME_NOW	(1 << 8)
    210 #define FATTR_LOCKOWNER	(1 << 9)
    211 #define FATTR_CTIME	(1 << 10)
    212 
    213 /**
    214  * Flags returned by the OPEN request
    215  *
    216  * FOPEN_DIRECT_IO: bypass page cache for this open file
    217  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
    218  * FOPEN_NONSEEKABLE: the file is not seekable
    219  */
    220 #define FOPEN_DIRECT_IO		(1 << 0)
    221 #define FOPEN_KEEP_CACHE	(1 << 1)
    222 #define FOPEN_NONSEEKABLE	(1 << 2)
    223 
    224 /**
    225  * INIT request/reply flags
    226  *
    227  * FUSE_ASYNC_READ: asynchronous read requests
    228  * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
    229  * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
    230  * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
    231  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
    232  * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
    233  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
    234  * FUSE_SPLICE_WRITE: kernel supports splice write on the device
    235  * FUSE_SPLICE_MOVE: kernel supports splice move on the device
    236  * FUSE_SPLICE_READ: kernel supports splice read on the device
    237  * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
    238  * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
    239  * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
    240  * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
    241  * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
    242  * FUSE_ASYNC_DIO: asynchronous direct I/O submission
    243  * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
    244  * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
    245  * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
    246  * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
    247  * FUSE_POSIX_ACL: filesystem supports posix acls
    248  */
    249 #define FUSE_ASYNC_READ		(1 << 0)
    250 #define FUSE_POSIX_LOCKS	(1 << 1)
    251 #define FUSE_FILE_OPS		(1 << 2)
    252 #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
    253 #define FUSE_EXPORT_SUPPORT	(1 << 4)
    254 #define FUSE_BIG_WRITES		(1 << 5)
    255 #define FUSE_DONT_MASK		(1 << 6)
    256 #define FUSE_SPLICE_WRITE	(1 << 7)
    257 #define FUSE_SPLICE_MOVE	(1 << 8)
    258 #define FUSE_SPLICE_READ	(1 << 9)
    259 #define FUSE_FLOCK_LOCKS	(1 << 10)
    260 #define FUSE_HAS_IOCTL_DIR	(1 << 11)
    261 #define FUSE_AUTO_INVAL_DATA	(1 << 12)
    262 #define FUSE_DO_READDIRPLUS	(1 << 13)
    263 #define FUSE_READDIRPLUS_AUTO	(1 << 14)
    264 #define FUSE_ASYNC_DIO		(1 << 15)
    265 #define FUSE_WRITEBACK_CACHE	(1 << 16)
    266 #define FUSE_NO_OPEN_SUPPORT	(1 << 17)
    267 #define FUSE_PARALLEL_DIROPS    (1 << 18)
    268 #define FUSE_HANDLE_KILLPRIV	(1 << 19)
    269 #define FUSE_POSIX_ACL		(1 << 20)
    270 
    271 /**
    272  * CUSE INIT request/reply flags
    273  *
    274  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
    275  */
    276 #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
    277 
    278 /**
    279  * Release flags
    280  */
    281 #define FUSE_RELEASE_FLUSH	(1 << 0)
    282 #define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
    283 
    284 /**
    285  * Getattr flags
    286  */
    287 #define FUSE_GETATTR_FH		(1 << 0)
    288 
    289 /**
    290  * Lock flags
    291  */
    292 #define FUSE_LK_FLOCK		(1 << 0)
    293 
    294 /**
    295  * WRITE flags
    296  *
    297  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
    298  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
    299  */
    300 #define FUSE_WRITE_CACHE	(1 << 0)
    301 #define FUSE_WRITE_LOCKOWNER	(1 << 1)
    302 
    303 /**
    304  * Read flags
    305  */
    306 #define FUSE_READ_LOCKOWNER	(1 << 1)
    307 
    308 /**
    309  * Ioctl flags
    310  *
    311  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
    312  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
    313  * FUSE_IOCTL_RETRY: retry with new iovecs
    314  * FUSE_IOCTL_32BIT: 32bit ioctl
    315  * FUSE_IOCTL_DIR: is a directory
    316  *
    317  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
    318  */
    319 #define FUSE_IOCTL_COMPAT	(1 << 0)
    320 #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
    321 #define FUSE_IOCTL_RETRY	(1 << 2)
    322 #define FUSE_IOCTL_32BIT	(1 << 3)
    323 #define FUSE_IOCTL_DIR		(1 << 4)
    324 
    325 #define FUSE_IOCTL_MAX_IOV	256
    326 
    327 /**
    328  * Poll flags
    329  *
    330  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
    331  */
    332 #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
    333 
    334 enum fuse_opcode {
    335 	FUSE_LOOKUP	   = 1,
    336 	FUSE_FORGET	   = 2,  /* no reply */
    337 	FUSE_GETATTR	   = 3,
    338 	FUSE_SETATTR	   = 4,
    339 	FUSE_READLINK	   = 5,
    340 	FUSE_SYMLINK	   = 6,
    341 	FUSE_MKNOD	   = 8,
    342 	FUSE_MKDIR	   = 9,
    343 	FUSE_UNLINK	   = 10,
    344 	FUSE_RMDIR	   = 11,
    345 	FUSE_RENAME	   = 12,
    346 	FUSE_LINK	   = 13,
    347 	FUSE_OPEN	   = 14,
    348 	FUSE_READ	   = 15,
    349 	FUSE_WRITE	   = 16,
    350 	FUSE_STATFS	   = 17,
    351 	FUSE_RELEASE       = 18,
    352 	FUSE_FSYNC         = 20,
    353 	FUSE_SETXATTR      = 21,
    354 	FUSE_GETXATTR      = 22,
    355 	FUSE_LISTXATTR     = 23,
    356 	FUSE_REMOVEXATTR   = 24,
    357 	FUSE_FLUSH         = 25,
    358 	FUSE_INIT          = 26,
    359 	FUSE_OPENDIR       = 27,
    360 	FUSE_READDIR       = 28,
    361 	FUSE_RELEASEDIR    = 29,
    362 	FUSE_FSYNCDIR      = 30,
    363 	FUSE_GETLK         = 31,
    364 	FUSE_SETLK         = 32,
    365 	FUSE_SETLKW        = 33,
    366 	FUSE_ACCESS        = 34,
    367 	FUSE_CREATE        = 35,
    368 	FUSE_INTERRUPT     = 36,
    369 	FUSE_BMAP          = 37,
    370 	FUSE_DESTROY       = 38,
    371 	FUSE_IOCTL         = 39,
    372 	FUSE_POLL          = 40,
    373 	FUSE_NOTIFY_REPLY  = 41,
    374 	FUSE_BATCH_FORGET  = 42,
    375 	FUSE_FALLOCATE     = 43,
    376 	FUSE_READDIRPLUS   = 44,
    377 	FUSE_RENAME2       = 45,
    378 	FUSE_LSEEK         = 46,
    379 
    380 	/* CUSE specific operations */
    381 	CUSE_INIT          = 4096,
    382 };
    383 
    384 enum fuse_notify_code {
    385 	FUSE_NOTIFY_POLL   = 1,
    386 	FUSE_NOTIFY_INVAL_INODE = 2,
    387 	FUSE_NOTIFY_INVAL_ENTRY = 3,
    388 	FUSE_NOTIFY_STORE = 4,
    389 	FUSE_NOTIFY_RETRIEVE = 5,
    390 	FUSE_NOTIFY_DELETE = 6,
    391 	FUSE_NOTIFY_CODE_MAX,
    392 };
    393 
    394 /* The read buffer is required to be at least 8k, but may be much larger */
    395 #define FUSE_MIN_READ_BUFFER 8192
    396 
    397 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
    398 
    399 struct fuse_entry_out {
    400 	uint64_t	nodeid;		/* Inode ID */
    401 	uint64_t	generation;	/* Inode generation: nodeid:gen must
    402 					   be unique for the fs's lifetime */
    403 	uint64_t	entry_valid;	/* Cache timeout for the name */
    404 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
    405 	uint32_t	entry_valid_nsec;
    406 	uint32_t	attr_valid_nsec;
    407 	struct fuse_attr attr;
    408 };
    409 
    410 struct fuse_forget_in {
    411 	uint64_t	nlookup;
    412 };
    413 
    414 struct fuse_forget_one {
    415 	uint64_t	nodeid;
    416 	uint64_t	nlookup;
    417 };
    418 
    419 struct fuse_batch_forget_in {
    420 	uint32_t	count;
    421 	uint32_t	dummy;
    422 };
    423 
    424 struct fuse_getattr_in {
    425 	uint32_t	getattr_flags;
    426 	uint32_t	dummy;
    427 	uint64_t	fh;
    428 };
    429 
    430 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
    431 
    432 struct fuse_attr_out {
    433 	uint64_t	attr_valid;	/* Cache timeout for the attributes */
    434 	uint32_t	attr_valid_nsec;
    435 	uint32_t	dummy;
    436 	struct fuse_attr attr;
    437 };
    438 
    439 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
    440 
    441 struct fuse_mknod_in {
    442 	uint32_t	mode;
    443 	uint32_t	rdev;
    444 	uint32_t	umask;
    445 	uint32_t	padding;
    446 };
    447 
    448 struct fuse_mkdir_in {
    449 	uint32_t	mode;
    450 	uint32_t	umask;
    451 };
    452 
    453 struct fuse_rename_in {
    454 	uint64_t	newdir;
    455 };
    456 
    457 struct fuse_rename2_in {
    458 	uint64_t	newdir;
    459 	uint32_t	flags;
    460 	uint32_t	padding;
    461 };
    462 
    463 struct fuse_link_in {
    464 	uint64_t	oldnodeid;
    465 };
    466 
    467 struct fuse_setattr_in {
    468 	uint32_t	valid;
    469 	uint32_t	padding;
    470 	uint64_t	fh;
    471 	uint64_t	size;
    472 	uint64_t	lock_owner;
    473 	uint64_t	atime;
    474 	uint64_t	mtime;
    475 	uint64_t	ctime;
    476 	uint32_t	atimensec;
    477 	uint32_t	mtimensec;
    478 	uint32_t	ctimensec;
    479 	uint32_t	mode;
    480 	uint32_t	unused4;
    481 	uint32_t	uid;
    482 	uint32_t	gid;
    483 	uint32_t	unused5;
    484 };
    485 
    486 struct fuse_open_in {
    487 	uint32_t	flags;
    488 	uint32_t	unused;
    489 };
    490 
    491 struct fuse_create_in {
    492 	uint32_t	flags;
    493 	uint32_t	mode;
    494 	uint32_t	umask;
    495 	uint32_t	padding;
    496 };
    497 
    498 struct fuse_open_out {
    499 	uint64_t	fh;
    500 	uint32_t	open_flags;
    501 	uint32_t	padding;
    502 };
    503 
    504 struct fuse_release_in {
    505 	uint64_t	fh;
    506 	uint32_t	flags;
    507 	uint32_t	release_flags;
    508 	uint64_t	lock_owner;
    509 };
    510 
    511 struct fuse_flush_in {
    512 	uint64_t	fh;
    513 	uint32_t	unused;
    514 	uint32_t	padding;
    515 	uint64_t	lock_owner;
    516 };
    517 
    518 struct fuse_read_in {
    519 	uint64_t	fh;
    520 	uint64_t	offset;
    521 	uint32_t	size;
    522 	uint32_t	read_flags;
    523 	uint64_t	lock_owner;
    524 	uint32_t	flags;
    525 	uint32_t	padding;
    526 };
    527 
    528 #define FUSE_COMPAT_WRITE_IN_SIZE 24
    529 
    530 struct fuse_write_in {
    531 	uint64_t	fh;
    532 	uint64_t	offset;
    533 	uint32_t	size;
    534 	uint32_t	write_flags;
    535 	uint64_t	lock_owner;
    536 	uint32_t	flags;
    537 	uint32_t	padding;
    538 };
    539 
    540 struct fuse_write_out {
    541 	uint32_t	size;
    542 	uint32_t	padding;
    543 };
    544 
    545 #define FUSE_COMPAT_STATFS_SIZE 48
    546 
    547 struct fuse_statfs_out {
    548 	struct fuse_kstatfs st;
    549 };
    550 
    551 struct fuse_fsync_in {
    552 	uint64_t	fh;
    553 	uint32_t	fsync_flags;
    554 	uint32_t	padding;
    555 };
    556 
    557 struct fuse_setxattr_in {
    558 	uint32_t	size;
    559 	uint32_t	flags;
    560 };
    561 
    562 struct fuse_getxattr_in {
    563 	uint32_t	size;
    564 	uint32_t	padding;
    565 };
    566 
    567 struct fuse_getxattr_out {
    568 	uint32_t	size;
    569 	uint32_t	padding;
    570 };
    571 
    572 struct fuse_lk_in {
    573 	uint64_t	fh;
    574 	uint64_t	owner;
    575 	struct fuse_file_lock lk;
    576 	uint32_t	lk_flags;
    577 	uint32_t	padding;
    578 };
    579 
    580 struct fuse_lk_out {
    581 	struct fuse_file_lock lk;
    582 };
    583 
    584 struct fuse_access_in {
    585 	uint32_t	mask;
    586 	uint32_t	padding;
    587 };
    588 
    589 struct fuse_init_in {
    590 	uint32_t	major;
    591 	uint32_t	minor;
    592 	uint32_t	max_readahead;
    593 	uint32_t	flags;
    594 };
    595 
    596 #define FUSE_COMPAT_INIT_OUT_SIZE 8
    597 #define FUSE_COMPAT_22_INIT_OUT_SIZE 24
    598 
    599 struct fuse_init_out {
    600 	uint32_t	major;
    601 	uint32_t	minor;
    602 	uint32_t	max_readahead;
    603 	uint32_t	flags;
    604 	uint16_t	max_background;
    605 	uint16_t	congestion_threshold;
    606 	uint32_t	max_write;
    607 	uint32_t	time_gran;
    608 	uint32_t	unused[9];
    609 };
    610 
    611 #define CUSE_INIT_INFO_MAX 4096
    612 
    613 struct cuse_init_in {
    614 	uint32_t	major;
    615 	uint32_t	minor;
    616 	uint32_t	unused;
    617 	uint32_t	flags;
    618 };
    619 
    620 struct cuse_init_out {
    621 	uint32_t	major;
    622 	uint32_t	minor;
    623 	uint32_t	unused;
    624 	uint32_t	flags;
    625 	uint32_t	max_read;
    626 	uint32_t	max_write;
    627 	uint32_t	dev_major;		/* chardev major */
    628 	uint32_t	dev_minor;		/* chardev minor */
    629 	uint32_t	spare[10];
    630 };
    631 
    632 struct fuse_interrupt_in {
    633 	uint64_t	unique;
    634 };
    635 
    636 struct fuse_bmap_in {
    637 	uint64_t	block;
    638 	uint32_t	blocksize;
    639 	uint32_t	padding;
    640 };
    641 
    642 struct fuse_bmap_out {
    643 	uint64_t	block;
    644 };
    645 
    646 struct fuse_ioctl_in {
    647 	uint64_t	fh;
    648 	uint32_t	flags;
    649 	uint32_t	cmd;
    650 	uint64_t	arg;
    651 	uint32_t	in_size;
    652 	uint32_t	out_size;
    653 };
    654 
    655 struct fuse_ioctl_iovec {
    656 	uint64_t	base;
    657 	uint64_t	len;
    658 };
    659 
    660 struct fuse_ioctl_out {
    661 	int32_t		result;
    662 	uint32_t	flags;
    663 	uint32_t	in_iovs;
    664 	uint32_t	out_iovs;
    665 };
    666 
    667 struct fuse_poll_in {
    668 	uint64_t	fh;
    669 	uint64_t	kh;
    670 	uint32_t	flags;
    671 	uint32_t	events;
    672 };
    673 
    674 struct fuse_poll_out {
    675 	uint32_t	revents;
    676 	uint32_t	padding;
    677 };
    678 
    679 struct fuse_notify_poll_wakeup_out {
    680 	uint64_t	kh;
    681 };
    682 
    683 struct fuse_fallocate_in {
    684 	uint64_t	fh;
    685 	uint64_t	offset;
    686 	uint64_t	length;
    687 	uint32_t	mode;
    688 	uint32_t	padding;
    689 };
    690 
    691 struct fuse_in_header {
    692 	uint32_t	len;
    693 	uint32_t	opcode;
    694 	uint64_t	unique;
    695 	uint64_t	nodeid;
    696 	uint32_t	uid;
    697 	uint32_t	gid;
    698 	uint32_t	pid;
    699 	uint32_t	padding;
    700 };
    701 
    702 struct fuse_out_header {
    703 	uint32_t	len;
    704 	int32_t		error;
    705 	uint64_t	unique;
    706 };
    707 
    708 struct fuse_dirent {
    709 	uint64_t	ino;
    710 	uint64_t	off;
    711 	uint32_t	namelen;
    712 	uint32_t	type;
    713 	char name[];
    714 };
    715 
    716 #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
    717 #define FUSE_DIRENT_ALIGN(x) \
    718 	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
    719 #define FUSE_DIRENT_SIZE(d) \
    720 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
    721 
    722 struct fuse_direntplus {
    723 	struct fuse_entry_out entry_out;
    724 	struct fuse_dirent dirent;
    725 };
    726 
    727 #define FUSE_NAME_OFFSET_DIRENTPLUS \
    728 	offsetof(struct fuse_direntplus, dirent.name)
    729 #define FUSE_DIRENTPLUS_SIZE(d) \
    730 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
    731 
    732 struct fuse_notify_inval_inode_out {
    733 	uint64_t	ino;
    734 	int64_t		off;
    735 	int64_t		len;
    736 };
    737 
    738 struct fuse_notify_inval_entry_out {
    739 	uint64_t	parent;
    740 	uint32_t	namelen;
    741 	uint32_t	padding;
    742 };
    743 
    744 struct fuse_notify_delete_out {
    745 	uint64_t	parent;
    746 	uint64_t	child;
    747 	uint32_t	namelen;
    748 	uint32_t	padding;
    749 };
    750 
    751 struct fuse_notify_store_out {
    752 	uint64_t	nodeid;
    753 	uint64_t	offset;
    754 	uint32_t	size;
    755 	uint32_t	padding;
    756 };
    757 
    758 struct fuse_notify_retrieve_out {
    759 	uint64_t	notify_unique;
    760 	uint64_t	nodeid;
    761 	uint64_t	offset;
    762 	uint32_t	size;
    763 	uint32_t	padding;
    764 };
    765 
    766 /* Matches the size of fuse_write_in */
    767 struct fuse_notify_retrieve_in {
    768 	uint64_t	dummy1;
    769 	uint64_t	offset;
    770 	uint32_t	size;
    771 	uint32_t	dummy2;
    772 	uint64_t	dummy3;
    773 	uint64_t	dummy4;
    774 };
    775 
    776 /* Device ioctls: */
    777 #define FUSE_DEV_IOC_CLONE	_IOR(229, 0, uint32_t)
    778 
    779 struct fuse_lseek_in {
    780 	uint64_t	fh;
    781 	uint64_t	offset;
    782 	uint32_t	whence;
    783 	uint32_t	padding;
    784 };
    785 
    786 struct fuse_lseek_out {
    787 	uint64_t	offset;
    788 };
    789 
    790 #endif /* _LINUX_FUSE_H */
    791