xref: /freebsd/sys/fs/fuse/fuse_kernel.h (revision 7cbb8e8a06904f6bf4a7547c2a5d40b53f0041ff)
151369649SPedro F. Giffuni /*--
25fe58019SAttilio Rao  * This file defines the kernel interface of FUSE
39c62bc70SAlan Somers  * Copyright (C) 2001-2008  Miklos Szeredi <miklos@szeredi.hu>
45fe58019SAttilio Rao  *
55fe58019SAttilio Rao  * This program can be distributed under the terms of the GNU GPL.
65fe58019SAttilio Rao  * See the file COPYING.
75fe58019SAttilio Rao  *
85fe58019SAttilio Rao  * This -- and only this -- header file may also be distributed under
95fe58019SAttilio Rao  * the terms of the BSD Licence as follows:
105fe58019SAttilio Rao  *
115fe58019SAttilio Rao  * Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
125fe58019SAttilio Rao  *
135fe58019SAttilio Rao  * Redistribution and use in source and binary forms, with or without
145fe58019SAttilio Rao  * modification, are permitted provided that the following conditions
155fe58019SAttilio Rao  * are met:
165fe58019SAttilio Rao  * 1. Redistributions of source code must retain the above copyright
175fe58019SAttilio Rao  *    notice, this list of conditions and the following disclaimer.
185fe58019SAttilio Rao  * 2. Redistributions in binary form must reproduce the above copyright
195fe58019SAttilio Rao  *    notice, this list of conditions and the following disclaimer in the
205fe58019SAttilio Rao  *    documentation and/or other materials provided with the distribution.
215fe58019SAttilio Rao  *
225fe58019SAttilio Rao  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
235fe58019SAttilio Rao  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
245fe58019SAttilio Rao  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
255fe58019SAttilio Rao  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
265fe58019SAttilio Rao  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
275fe58019SAttilio Rao  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
285fe58019SAttilio Rao  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
295fe58019SAttilio Rao  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
305fe58019SAttilio Rao  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
315fe58019SAttilio Rao  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
325fe58019SAttilio Rao  * SUCH DAMAGE.
335fe58019SAttilio Rao  *
345fe58019SAttilio Rao  * $FreeBSD$
355fe58019SAttilio Rao  */
365fe58019SAttilio Rao 
3716bd2d47SAlan Somers /*
3816bd2d47SAlan Somers  * This file defines the kernel interface of FUSE
3916bd2d47SAlan Somers  *
4016bd2d47SAlan Somers  * Protocol changelog:
4116bd2d47SAlan Somers  *
4216bd2d47SAlan Somers  * 7.9:
4316bd2d47SAlan Somers  *  - new fuse_getattr_in input argument of GETATTR
4416bd2d47SAlan Somers  *  - add lk_flags in fuse_lk_in
4516bd2d47SAlan Somers  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
4616bd2d47SAlan Somers  *  - add blksize field to fuse_attr
4716bd2d47SAlan Somers  *  - add file flags field to fuse_read_in and fuse_write_in
483f105d16SAlan Somers  *
493f105d16SAlan Somers  * 7.10
503f105d16SAlan Somers  *  - add nonseekable open flag
519c62bc70SAlan Somers  *
529c62bc70SAlan Somers  *  7.11
539c62bc70SAlan Somers  *  - add IOCTL message
549c62bc70SAlan Somers  *  - add unsolicited notification support
55a4856c96SAlan Somers  *
56a4856c96SAlan Somers  *  7.12
57a4856c96SAlan Somers  *  - add umask flag to input argument of open, mknod and mkdir
58a4856c96SAlan Somers  *  - add notification messages for invalidation of inodes and
59a4856c96SAlan Somers  *    directory entries
602ffddc5eSAlan Somers  *
612ffddc5eSAlan Somers  * 7.13
622ffddc5eSAlan Somers  *  - make max number of background requests and congestion threshold
632ffddc5eSAlan Somers  *    tunables
64bb23d439SAlan Somers  *
65bb23d439SAlan Somers  * 7.14
66bb23d439SAlan Somers  *  - add splice support to fuse device
67*7cbb8e8aSAlan Somers  *
68*7cbb8e8aSAlan Somers  * 7.15
69*7cbb8e8aSAlan Somers  *  - add store notify
70*7cbb8e8aSAlan Somers  *  - add retrieve notify
7116bd2d47SAlan Somers  */
7216bd2d47SAlan Somers 
7316bd2d47SAlan Somers #ifndef _FUSE_FUSE_KERNEL_H
7416bd2d47SAlan Somers #define _FUSE_FUSE_KERNEL_H
7516bd2d47SAlan Somers 
765fe58019SAttilio Rao #ifndef linux
775fe58019SAttilio Rao #include <sys/types.h>
785fe58019SAttilio Rao #define __u64 uint64_t
79a4856c96SAlan Somers #define __s64 int64_t
805fe58019SAttilio Rao #define __u32 uint32_t
815fe58019SAttilio Rao #define __s32 int32_t
822ffddc5eSAlan Somers #define __u16 uint16_t
835fe58019SAttilio Rao #else
849c62bc70SAlan Somers #include <linux/types.h>
855fe58019SAttilio Rao #endif
865fe58019SAttilio Rao 
875fe58019SAttilio Rao /** Version number of this interface */
885fe58019SAttilio Rao #define FUSE_KERNEL_VERSION 7
895fe58019SAttilio Rao 
905fe58019SAttilio Rao /** Minor version number of this interface */
91*7cbb8e8aSAlan Somers #define FUSE_KERNEL_MINOR_VERSION 15
925fe58019SAttilio Rao 
935fe58019SAttilio Rao /** The node ID of the root inode */
945fe58019SAttilio Rao #define FUSE_ROOT_ID 1
955fe58019SAttilio Rao 
965fe58019SAttilio Rao /* Make sure all structures are padded to 64bit boundary, so 32bit
975fe58019SAttilio Rao    userspace works under 64bit kernels */
985fe58019SAttilio Rao 
995fe58019SAttilio Rao struct fuse_attr {
1005fe58019SAttilio Rao 	__u64	ino;
1015fe58019SAttilio Rao 	__u64	size;
1025fe58019SAttilio Rao 	__u64	blocks;
1035fe58019SAttilio Rao 	__u64	atime;
1045fe58019SAttilio Rao 	__u64	mtime;
1055fe58019SAttilio Rao 	__u64	ctime;
1065fe58019SAttilio Rao 	__u32	atimensec;
1075fe58019SAttilio Rao 	__u32	mtimensec;
1085fe58019SAttilio Rao 	__u32	ctimensec;
1095fe58019SAttilio Rao 	__u32	mode;
1105fe58019SAttilio Rao 	__u32	nlink;
1115fe58019SAttilio Rao 	__u32	uid;
1125fe58019SAttilio Rao 	__u32	gid;
1135fe58019SAttilio Rao 	__u32	rdev;
11416bd2d47SAlan Somers 	__u32	blksize;
11516bd2d47SAlan Somers 	__u32	padding;
1165fe58019SAttilio Rao };
1175fe58019SAttilio Rao 
1185fe58019SAttilio Rao struct fuse_kstatfs {
1195fe58019SAttilio Rao 	__u64	blocks;
1205fe58019SAttilio Rao 	__u64	bfree;
1215fe58019SAttilio Rao 	__u64	bavail;
1225fe58019SAttilio Rao 	__u64	files;
1235fe58019SAttilio Rao 	__u64	ffree;
1245fe58019SAttilio Rao 	__u32	bsize;
1255fe58019SAttilio Rao 	__u32	namelen;
1265fe58019SAttilio Rao 	__u32	frsize;
1275fe58019SAttilio Rao 	__u32	padding;
1285fe58019SAttilio Rao 	__u32	spare[6];
1295fe58019SAttilio Rao };
1305fe58019SAttilio Rao 
1315fe58019SAttilio Rao struct fuse_file_lock {
1325fe58019SAttilio Rao 	__u64	start;
1335fe58019SAttilio Rao 	__u64	end;
1345fe58019SAttilio Rao 	__u32	type;
1355fe58019SAttilio Rao 	__u32	pid; /* tgid */
1365fe58019SAttilio Rao };
1375fe58019SAttilio Rao 
1385fe58019SAttilio Rao /**
1395fe58019SAttilio Rao  * Bitmasks for fuse_setattr_in.valid
1405fe58019SAttilio Rao  */
1415fe58019SAttilio Rao #define FATTR_MODE	(1 << 0)
1425fe58019SAttilio Rao #define FATTR_UID	(1 << 1)
1435fe58019SAttilio Rao #define FATTR_GID	(1 << 2)
1445fe58019SAttilio Rao #define FATTR_SIZE	(1 << 3)
1455fe58019SAttilio Rao #define FATTR_ATIME	(1 << 4)
1465fe58019SAttilio Rao #define FATTR_MTIME	(1 << 5)
1475fe58019SAttilio Rao #define FATTR_FH	(1 << 6)
14816bd2d47SAlan Somers #define FATTR_ATIME_NOW	(1 << 7)
14916bd2d47SAlan Somers #define FATTR_MTIME_NOW	(1 << 8)
15016bd2d47SAlan Somers #define FATTR_LOCKOWNER	(1 << 9)
1515fe58019SAttilio Rao 
1525fe58019SAttilio Rao /**
1535fe58019SAttilio Rao  * Flags returned by the OPEN request
1545fe58019SAttilio Rao  *
1555fe58019SAttilio Rao  * FOPEN_DIRECT_IO: bypass page cache for this open file
1565fe58019SAttilio Rao  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
1573f105d16SAlan Somers  * FOPEN_NONSEEKABLE: the file is not seekable
1585fe58019SAttilio Rao  */
1595fe58019SAttilio Rao #define FOPEN_DIRECT_IO		(1 << 0)
1605fe58019SAttilio Rao #define FOPEN_KEEP_CACHE	(1 << 1)
1613f105d16SAlan Somers #define FOPEN_NONSEEKABLE	(1 << 2)
1625fe58019SAttilio Rao 
1635fe58019SAttilio Rao /**
1645fe58019SAttilio Rao  * INIT request/reply flags
16516bd2d47SAlan Somers  *
16616bd2d47SAlan Somers  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
167a4856c96SAlan Somers  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
1685fe58019SAttilio Rao  */
1695fe58019SAttilio Rao #define FUSE_ASYNC_READ		(1 << 0)
1705fe58019SAttilio Rao #define FUSE_POSIX_LOCKS	(1 << 1)
17116bd2d47SAlan Somers #define FUSE_FILE_OPS		(1 << 2)
17216bd2d47SAlan Somers #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
17316bd2d47SAlan Somers #define FUSE_EXPORT_SUPPORT	(1 << 4)
17416bd2d47SAlan Somers #define FUSE_BIG_WRITES		(1 << 5)
175a4856c96SAlan Somers #define FUSE_DONT_MASK		(1 << 6)
1765fe58019SAttilio Rao 
1779c62bc70SAlan Somers #ifdef linux
1789c62bc70SAlan Somers /**
1799c62bc70SAlan Somers  * CUSE INIT request/reply flags
1809c62bc70SAlan Somers  *
1819c62bc70SAlan Somers  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
1829c62bc70SAlan Somers  */
1839c62bc70SAlan Somers #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
1849c62bc70SAlan Somers #endif /* linux */
1859c62bc70SAlan Somers 
1865fe58019SAttilio Rao /**
1875fe58019SAttilio Rao  * Release flags
1885fe58019SAttilio Rao  */
1895fe58019SAttilio Rao #define FUSE_RELEASE_FLUSH	(1 << 0)
1905fe58019SAttilio Rao 
19116bd2d47SAlan Somers /**
19216bd2d47SAlan Somers  * Getattr flags
19316bd2d47SAlan Somers  */
19416bd2d47SAlan Somers #define FUSE_GETATTR_FH		(1 << 0)
19516bd2d47SAlan Somers 
19616bd2d47SAlan Somers /**
19716bd2d47SAlan Somers  * Lock flags
19816bd2d47SAlan Somers  */
19916bd2d47SAlan Somers #define FUSE_LK_FLOCK		(1 << 0)
20016bd2d47SAlan Somers 
20116bd2d47SAlan Somers /**
20216bd2d47SAlan Somers  * WRITE flags
20316bd2d47SAlan Somers  *
20416bd2d47SAlan Somers  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
20516bd2d47SAlan Somers  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
20616bd2d47SAlan Somers  */
20716bd2d47SAlan Somers #define FUSE_WRITE_CACHE	(1 << 0)
20816bd2d47SAlan Somers #define FUSE_WRITE_LOCKOWNER	(1 << 1)
20916bd2d47SAlan Somers 
21016bd2d47SAlan Somers /**
21116bd2d47SAlan Somers  * Read flags
21216bd2d47SAlan Somers  */
21316bd2d47SAlan Somers #define FUSE_READ_LOCKOWNER	(1 << 1)
21416bd2d47SAlan Somers 
2159c62bc70SAlan Somers /**
2169c62bc70SAlan Somers  * Ioctl flags
2179c62bc70SAlan Somers  *
2189c62bc70SAlan Somers  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
2199c62bc70SAlan Somers  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
2209c62bc70SAlan Somers  * FUSE_IOCTL_RETRY: retry with new iovecs
2219c62bc70SAlan Somers  *
2229c62bc70SAlan Somers  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
2239c62bc70SAlan Somers  */
2249c62bc70SAlan Somers #define FUSE_IOCTL_COMPAT	(1 << 0)
2259c62bc70SAlan Somers #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
2269c62bc70SAlan Somers #define FUSE_IOCTL_RETRY	(1 << 2)
2279c62bc70SAlan Somers 
2289c62bc70SAlan Somers #define FUSE_IOCTL_MAX_IOV	256
2299c62bc70SAlan Somers 
2309c62bc70SAlan Somers /**
2319c62bc70SAlan Somers  * Poll flags
2329c62bc70SAlan Somers  *
2339c62bc70SAlan Somers  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
2349c62bc70SAlan Somers  */
2359c62bc70SAlan Somers #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
2369c62bc70SAlan Somers 
2375fe58019SAttilio Rao enum fuse_opcode {
2385fe58019SAttilio Rao 	FUSE_LOOKUP	   = 1,
2395fe58019SAttilio Rao 	FUSE_FORGET	   = 2,  /* no reply */
2405fe58019SAttilio Rao 	FUSE_GETATTR	   = 3,
2415fe58019SAttilio Rao 	FUSE_SETATTR	   = 4,
2425fe58019SAttilio Rao 	FUSE_READLINK	   = 5,
2435fe58019SAttilio Rao 	FUSE_SYMLINK	   = 6,
2445fe58019SAttilio Rao 	FUSE_MKNOD	   = 8,
2455fe58019SAttilio Rao 	FUSE_MKDIR	   = 9,
2465fe58019SAttilio Rao 	FUSE_UNLINK	   = 10,
2475fe58019SAttilio Rao 	FUSE_RMDIR	   = 11,
2485fe58019SAttilio Rao 	FUSE_RENAME	   = 12,
2495fe58019SAttilio Rao 	FUSE_LINK	   = 13,
2505fe58019SAttilio Rao 	FUSE_OPEN	   = 14,
2515fe58019SAttilio Rao 	FUSE_READ	   = 15,
2525fe58019SAttilio Rao 	FUSE_WRITE	   = 16,
2535fe58019SAttilio Rao 	FUSE_STATFS	   = 17,
2545fe58019SAttilio Rao 	FUSE_RELEASE       = 18,
2555fe58019SAttilio Rao 	FUSE_FSYNC         = 20,
2565fe58019SAttilio Rao 	FUSE_SETXATTR      = 21,
2575fe58019SAttilio Rao 	FUSE_GETXATTR      = 22,
2585fe58019SAttilio Rao 	FUSE_LISTXATTR     = 23,
2595fe58019SAttilio Rao 	FUSE_REMOVEXATTR   = 24,
2605fe58019SAttilio Rao 	FUSE_FLUSH         = 25,
2615fe58019SAttilio Rao 	FUSE_INIT          = 26,
2625fe58019SAttilio Rao 	FUSE_OPENDIR       = 27,
2635fe58019SAttilio Rao 	FUSE_READDIR       = 28,
2645fe58019SAttilio Rao 	FUSE_RELEASEDIR    = 29,
2655fe58019SAttilio Rao 	FUSE_FSYNCDIR      = 30,
2665fe58019SAttilio Rao 	FUSE_GETLK         = 31,
2675fe58019SAttilio Rao 	FUSE_SETLK         = 32,
2685fe58019SAttilio Rao 	FUSE_SETLKW        = 33,
2695fe58019SAttilio Rao 	FUSE_ACCESS        = 34,
2705fe58019SAttilio Rao 	FUSE_CREATE        = 35,
2715fe58019SAttilio Rao 	FUSE_INTERRUPT     = 36,
2725fe58019SAttilio Rao 	FUSE_BMAP          = 37,
2735fe58019SAttilio Rao 	FUSE_DESTROY       = 38,
2749c62bc70SAlan Somers 	FUSE_IOCTL         = 39,
2759c62bc70SAlan Somers 	FUSE_POLL          = 40,
276*7cbb8e8aSAlan Somers 	FUSE_NOTIFY_REPLY  = 41,
2779c62bc70SAlan Somers 
2789c62bc70SAlan Somers #ifdef linux
2799c62bc70SAlan Somers 	/* CUSE specific operations */
2809c62bc70SAlan Somers 	CUSE_INIT          = 4096,
2819c62bc70SAlan Somers #endif /* linux */
2829c62bc70SAlan Somers };
2839c62bc70SAlan Somers 
2849c62bc70SAlan Somers enum fuse_notify_code {
2859c62bc70SAlan Somers 	FUSE_NOTIFY_POLL   = 1,
286a4856c96SAlan Somers 	FUSE_NOTIFY_INVAL_INODE = 2,
287a4856c96SAlan Somers 	FUSE_NOTIFY_INVAL_ENTRY = 3,
288*7cbb8e8aSAlan Somers 	FUSE_NOTIFY_STORE = 4,
289*7cbb8e8aSAlan Somers 	FUSE_NOTIFY_RETRIEVE = 5,
2909c62bc70SAlan Somers 	FUSE_NOTIFY_CODE_MAX,
2915fe58019SAttilio Rao };
2925fe58019SAttilio Rao 
2935fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */
2945fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192
2955fe58019SAttilio Rao 
29616bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
29716bd2d47SAlan Somers 
2985fe58019SAttilio Rao struct fuse_entry_out {
2995fe58019SAttilio Rao 	__u64	nodeid;		/* Inode ID */
3005fe58019SAttilio Rao 	__u64	generation;	/* Inode generation: nodeid:gen must
3015fe58019SAttilio Rao 				   be unique for the fs's lifetime */
3025fe58019SAttilio Rao 	__u64	entry_valid;	/* Cache timeout for the name */
3035fe58019SAttilio Rao 	__u64	attr_valid;	/* Cache timeout for the attributes */
3045fe58019SAttilio Rao 	__u32	entry_valid_nsec;
3055fe58019SAttilio Rao 	__u32	attr_valid_nsec;
3065fe58019SAttilio Rao 	struct fuse_attr attr;
3075fe58019SAttilio Rao };
3085fe58019SAttilio Rao 
3095fe58019SAttilio Rao struct fuse_forget_in {
3105fe58019SAttilio Rao 	__u64	nlookup;
3115fe58019SAttilio Rao };
3125fe58019SAttilio Rao 
31316bd2d47SAlan Somers struct fuse_getattr_in {
31416bd2d47SAlan Somers 	__u32	getattr_flags;
31516bd2d47SAlan Somers 	__u32	dummy;
31616bd2d47SAlan Somers 	__u64	fh;
31716bd2d47SAlan Somers };
31816bd2d47SAlan Somers 
31916bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96
32016bd2d47SAlan Somers 
3215fe58019SAttilio Rao struct fuse_attr_out {
3225fe58019SAttilio Rao 	__u64	attr_valid;	/* Cache timeout for the attributes */
3235fe58019SAttilio Rao 	__u32	attr_valid_nsec;
3245fe58019SAttilio Rao 	__u32	dummy;
3255fe58019SAttilio Rao 	struct fuse_attr attr;
3265fe58019SAttilio Rao };
3275fe58019SAttilio Rao 
328a4856c96SAlan Somers #define FUSE_COMPAT_MKNOD_IN_SIZE 8
329a4856c96SAlan Somers 
3304cbb4f88SAlan Somers struct fuse_mknod_in {
3314cbb4f88SAlan Somers 	__u32	mode;
3324cbb4f88SAlan Somers 	__u32	rdev;
333a4856c96SAlan Somers 	__u32	umask;
334a4856c96SAlan Somers 	__u32	padding;
3354cbb4f88SAlan Somers };
3364cbb4f88SAlan Somers 
3375fe58019SAttilio Rao struct fuse_mkdir_in {
3385fe58019SAttilio Rao 	__u32	mode;
339a4856c96SAlan Somers 	__u32	umask;
3405fe58019SAttilio Rao };
3415fe58019SAttilio Rao 
3425fe58019SAttilio Rao struct fuse_rename_in {
3435fe58019SAttilio Rao 	__u64	newdir;
3445fe58019SAttilio Rao };
3455fe58019SAttilio Rao 
3465fe58019SAttilio Rao struct fuse_link_in {
3475fe58019SAttilio Rao 	__u64	oldnodeid;
3485fe58019SAttilio Rao };
3495fe58019SAttilio Rao 
3505fe58019SAttilio Rao struct fuse_setattr_in {
3515fe58019SAttilio Rao 	__u32	valid;
3525fe58019SAttilio Rao 	__u32	padding;
3535fe58019SAttilio Rao 	__u64	fh;
3545fe58019SAttilio Rao 	__u64	size;
35516bd2d47SAlan Somers 	__u64	lock_owner;
3565fe58019SAttilio Rao 	__u64	atime;
3575fe58019SAttilio Rao 	__u64	mtime;
3585fe58019SAttilio Rao 	__u64	unused2;
3595fe58019SAttilio Rao 	__u32	atimensec;
3605fe58019SAttilio Rao 	__u32	mtimensec;
3615fe58019SAttilio Rao 	__u32	unused3;
3625fe58019SAttilio Rao 	__u32	mode;
3635fe58019SAttilio Rao 	__u32	unused4;
3645fe58019SAttilio Rao 	__u32	uid;
3655fe58019SAttilio Rao 	__u32	gid;
3665fe58019SAttilio Rao 	__u32	unused5;
3675fe58019SAttilio Rao };
3685fe58019SAttilio Rao 
3695fe58019SAttilio Rao struct fuse_open_in {
3705fe58019SAttilio Rao 	__u32	flags;
371a4856c96SAlan Somers 	__u32	unused;
372a4856c96SAlan Somers };
373a4856c96SAlan Somers 
374a4856c96SAlan Somers struct fuse_create_in {
375a4856c96SAlan Somers 	__u32	flags;
3765fe58019SAttilio Rao 	__u32	mode;
377a4856c96SAlan Somers 	__u32	umask;
378a4856c96SAlan Somers 	__u32	padding;
3795fe58019SAttilio Rao };
3805fe58019SAttilio Rao 
3815fe58019SAttilio Rao struct fuse_open_out {
3825fe58019SAttilio Rao 	__u64	fh;
3835fe58019SAttilio Rao 	__u32	open_flags;
3845fe58019SAttilio Rao 	__u32	padding;
3855fe58019SAttilio Rao };
3865fe58019SAttilio Rao 
3875fe58019SAttilio Rao struct fuse_release_in {
3885fe58019SAttilio Rao 	__u64	fh;
3895fe58019SAttilio Rao 	__u32	flags;
3905fe58019SAttilio Rao 	__u32	release_flags;
3915fe58019SAttilio Rao 	__u64	lock_owner;
3925fe58019SAttilio Rao };
3935fe58019SAttilio Rao 
3945fe58019SAttilio Rao struct fuse_flush_in {
3955fe58019SAttilio Rao 	__u64	fh;
3965fe58019SAttilio Rao 	__u32	unused;
3975fe58019SAttilio Rao 	__u32	padding;
3985fe58019SAttilio Rao 	__u64	lock_owner;
3995fe58019SAttilio Rao };
4005fe58019SAttilio Rao 
4015fe58019SAttilio Rao struct fuse_read_in {
4025fe58019SAttilio Rao 	__u64	fh;
4035fe58019SAttilio Rao 	__u64	offset;
4045fe58019SAttilio Rao 	__u32	size;
40516bd2d47SAlan Somers 	__u32	read_flags;
40616bd2d47SAlan Somers 	__u64	lock_owner;
40716bd2d47SAlan Somers 	__u32	flags;
4085fe58019SAttilio Rao 	__u32	padding;
4095fe58019SAttilio Rao };
4105fe58019SAttilio Rao 
41116bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24
41216bd2d47SAlan Somers 
4135fe58019SAttilio Rao struct fuse_write_in {
4145fe58019SAttilio Rao 	__u64	fh;
4155fe58019SAttilio Rao 	__u64	offset;
4165fe58019SAttilio Rao 	__u32	size;
4175fe58019SAttilio Rao 	__u32	write_flags;
41816bd2d47SAlan Somers 	__u64	lock_owner;
41916bd2d47SAlan Somers 	__u32	flags;
42016bd2d47SAlan Somers 	__u32	padding;
4215fe58019SAttilio Rao };
4225fe58019SAttilio Rao 
4235fe58019SAttilio Rao struct fuse_write_out {
4245fe58019SAttilio Rao 	__u32	size;
4255fe58019SAttilio Rao 	__u32	padding;
4265fe58019SAttilio Rao };
4275fe58019SAttilio Rao 
4285fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48
4295fe58019SAttilio Rao 
4305fe58019SAttilio Rao struct fuse_statfs_out {
4315fe58019SAttilio Rao 	struct fuse_kstatfs st;
4325fe58019SAttilio Rao };
4335fe58019SAttilio Rao 
4345fe58019SAttilio Rao struct fuse_fsync_in {
4355fe58019SAttilio Rao 	__u64	fh;
4365fe58019SAttilio Rao 	__u32	fsync_flags;
4375fe58019SAttilio Rao 	__u32	padding;
4385fe58019SAttilio Rao };
4395fe58019SAttilio Rao 
44096192dfcSAlan Somers struct fuse_setxattr_in {
441493b4a8cSFedor Uporov 	__u32	size;
442493b4a8cSFedor Uporov 	__u32	flags;
443493b4a8cSFedor Uporov };
444493b4a8cSFedor Uporov 
44596192dfcSAlan Somers struct fuse_listxattr_in {
44696192dfcSAlan Somers 	__u32	size;
44796192dfcSAlan Somers 	__u32	padding;
44896192dfcSAlan Somers };
44996192dfcSAlan Somers 
450493b4a8cSFedor Uporov struct fuse_listxattr_out {
4515fe58019SAttilio Rao 	__u32	size;
45296192dfcSAlan Somers 	__u32	padding;
4535fe58019SAttilio Rao };
4545fe58019SAttilio Rao 
4555fe58019SAttilio Rao struct fuse_getxattr_in {
4565fe58019SAttilio Rao 	__u32	size;
4575fe58019SAttilio Rao 	__u32	padding;
4585fe58019SAttilio Rao };
4595fe58019SAttilio Rao 
4605fe58019SAttilio Rao struct fuse_getxattr_out {
4615fe58019SAttilio Rao 	__u32	size;
4625fe58019SAttilio Rao 	__u32	padding;
4635fe58019SAttilio Rao };
4645fe58019SAttilio Rao 
4655fe58019SAttilio Rao struct fuse_lk_in {
4665fe58019SAttilio Rao 	__u64	fh;
4675fe58019SAttilio Rao 	__u64	owner;
4685fe58019SAttilio Rao 	struct fuse_file_lock lk;
46916bd2d47SAlan Somers 	__u32	lk_flags;
47016bd2d47SAlan Somers 	__u32	padding;
4715fe58019SAttilio Rao };
4725fe58019SAttilio Rao 
4735fe58019SAttilio Rao struct fuse_lk_out {
4745fe58019SAttilio Rao 	struct fuse_file_lock lk;
4755fe58019SAttilio Rao };
4765fe58019SAttilio Rao 
4775fe58019SAttilio Rao struct fuse_access_in {
4785fe58019SAttilio Rao 	__u32	mask;
4795fe58019SAttilio Rao 	__u32	padding;
4805fe58019SAttilio Rao };
4815fe58019SAttilio Rao 
4825fe58019SAttilio Rao struct fuse_init_in {
4835fe58019SAttilio Rao 	__u32	major;
4845fe58019SAttilio Rao 	__u32	minor;
4855fe58019SAttilio Rao 	__u32	max_readahead;
4865fe58019SAttilio Rao 	__u32	flags;
4875fe58019SAttilio Rao };
4885fe58019SAttilio Rao 
4895fe58019SAttilio Rao struct fuse_init_out {
4905fe58019SAttilio Rao 	__u32	major;
4915fe58019SAttilio Rao 	__u32	minor;
4925fe58019SAttilio Rao 	__u32	max_readahead;
4935fe58019SAttilio Rao 	__u32	flags;
4942ffddc5eSAlan Somers 	__u16   max_background;
4952ffddc5eSAlan Somers 	__u16   congestion_threshold;
4965fe58019SAttilio Rao 	__u32	max_write;
4975fe58019SAttilio Rao };
4985fe58019SAttilio Rao 
4999c62bc70SAlan Somers #ifdef linux
5009c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096
5019c62bc70SAlan Somers 
5029c62bc70SAlan Somers struct cuse_init_in {
5039c62bc70SAlan Somers 	__u32	major;
5049c62bc70SAlan Somers 	__u32	minor;
5059c62bc70SAlan Somers 	__u32	unused;
5069c62bc70SAlan Somers 	__u32	flags;
5079c62bc70SAlan Somers };
5089c62bc70SAlan Somers 
5099c62bc70SAlan Somers struct cuse_init_out {
5109c62bc70SAlan Somers 	__u32	major;
5119c62bc70SAlan Somers 	__u32	minor;
5129c62bc70SAlan Somers 	__u32	unused;
5139c62bc70SAlan Somers 	__u32	flags;
5149c62bc70SAlan Somers 	__u32	max_read;
5159c62bc70SAlan Somers 	__u32	max_write;
5169c62bc70SAlan Somers 	__u32	dev_major;		/* chardev major */
5179c62bc70SAlan Somers 	__u32	dev_minor;		/* chardev minor */
5189c62bc70SAlan Somers 	__u32	spare[10];
5199c62bc70SAlan Somers };
5209c62bc70SAlan Somers #endif /* linux */
5219c62bc70SAlan Somers 
5225fe58019SAttilio Rao struct fuse_interrupt_in {
5235fe58019SAttilio Rao 	__u64	unique;
5245fe58019SAttilio Rao };
5255fe58019SAttilio Rao 
5265fe58019SAttilio Rao struct fuse_bmap_in {
5275fe58019SAttilio Rao 	__u64	block;
5285fe58019SAttilio Rao 	__u32	blocksize;
5295fe58019SAttilio Rao 	__u32	padding;
5305fe58019SAttilio Rao };
5315fe58019SAttilio Rao 
5325fe58019SAttilio Rao struct fuse_bmap_out {
5335fe58019SAttilio Rao 	__u64	block;
5345fe58019SAttilio Rao };
5355fe58019SAttilio Rao 
5369c62bc70SAlan Somers struct fuse_ioctl_in {
5379c62bc70SAlan Somers 	__u64	fh;
5389c62bc70SAlan Somers 	__u32	flags;
5399c62bc70SAlan Somers 	__u32	cmd;
5409c62bc70SAlan Somers 	__u64	arg;
5419c62bc70SAlan Somers 	__u32	in_size;
5429c62bc70SAlan Somers 	__u32	out_size;
5439c62bc70SAlan Somers };
5449c62bc70SAlan Somers 
5459c62bc70SAlan Somers struct fuse_ioctl_out {
5469c62bc70SAlan Somers 	__s32	result;
5479c62bc70SAlan Somers 	__u32	flags;
5489c62bc70SAlan Somers 	__u32	in_iovs;
5499c62bc70SAlan Somers 	__u32	out_iovs;
5509c62bc70SAlan Somers };
5519c62bc70SAlan Somers 
5529c62bc70SAlan Somers struct fuse_poll_in {
5539c62bc70SAlan Somers 	__u64	fh;
5549c62bc70SAlan Somers 	__u64	kh;
5559c62bc70SAlan Somers 	__u32	flags;
5569c62bc70SAlan Somers 	__u32   padding;
5579c62bc70SAlan Somers };
5589c62bc70SAlan Somers 
5599c62bc70SAlan Somers struct fuse_poll_out {
5609c62bc70SAlan Somers 	__u32	revents;
5619c62bc70SAlan Somers 	__u32	padding;
5629c62bc70SAlan Somers };
5639c62bc70SAlan Somers 
5649c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out {
5659c62bc70SAlan Somers 	__u64	kh;
5669c62bc70SAlan Somers };
5679c62bc70SAlan Somers 
568*7cbb8e8aSAlan Somers struct fuse_notify_store_out {
569*7cbb8e8aSAlan Somers 	__u64	nodeid;
570*7cbb8e8aSAlan Somers 	__u64	offset;
571*7cbb8e8aSAlan Somers 	__u32	size;
572*7cbb8e8aSAlan Somers 	__u32	padding;
573*7cbb8e8aSAlan Somers };
574*7cbb8e8aSAlan Somers 
575*7cbb8e8aSAlan Somers struct fuse_notify_retrieve_out {
576*7cbb8e8aSAlan Somers 	__u64	notify_unique;
577*7cbb8e8aSAlan Somers 	__u64	nodeid;
578*7cbb8e8aSAlan Somers 	__u64	offset;
579*7cbb8e8aSAlan Somers 	__u32	size;
580*7cbb8e8aSAlan Somers 	__u32	padding;
581*7cbb8e8aSAlan Somers };
582*7cbb8e8aSAlan Somers 
583*7cbb8e8aSAlan Somers /* Matches the size of fuse_write_in */
584*7cbb8e8aSAlan Somers struct fuse_notify_retrieve_in {
585*7cbb8e8aSAlan Somers 	__u64	dummy1;
586*7cbb8e8aSAlan Somers 	__u64	offset;
587*7cbb8e8aSAlan Somers 	__u32	size;
588*7cbb8e8aSAlan Somers 	__u32	dummy2;
589*7cbb8e8aSAlan Somers 	__u64	dummy3;
590*7cbb8e8aSAlan Somers 	__u64	dummy4;
591*7cbb8e8aSAlan Somers };
592*7cbb8e8aSAlan Somers 
5935fe58019SAttilio Rao struct fuse_in_header {
5945fe58019SAttilio Rao 	__u32	len;
5955fe58019SAttilio Rao 	__u32	opcode;
5965fe58019SAttilio Rao 	__u64	unique;
5975fe58019SAttilio Rao 	__u64	nodeid;
5985fe58019SAttilio Rao 	__u32	uid;
5995fe58019SAttilio Rao 	__u32	gid;
6005fe58019SAttilio Rao 	__u32	pid;
6015fe58019SAttilio Rao 	__u32	padding;
6025fe58019SAttilio Rao };
6035fe58019SAttilio Rao 
6045fe58019SAttilio Rao struct fuse_out_header {
6055fe58019SAttilio Rao 	__u32	len;
6065fe58019SAttilio Rao 	__s32	error;
6075fe58019SAttilio Rao 	__u64	unique;
6085fe58019SAttilio Rao };
6095fe58019SAttilio Rao 
6105fe58019SAttilio Rao struct fuse_dirent {
6115fe58019SAttilio Rao 	__u64	ino;
6125fe58019SAttilio Rao 	__u64	off;
6135fe58019SAttilio Rao 	__u32	namelen;
6145fe58019SAttilio Rao 	__u32	type;
6157d20a270SPedro F. Giffuni 	char name[0];
6165fe58019SAttilio Rao };
6175fe58019SAttilio Rao 
6185fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
6195fe58019SAttilio Rao #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
6205fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \
6215fe58019SAttilio Rao 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
62216bd2d47SAlan Somers 
623a4856c96SAlan Somers struct fuse_notify_inval_inode_out {
624a4856c96SAlan Somers 	__u64	ino;
625a4856c96SAlan Somers 	__s64	off;
626a4856c96SAlan Somers 	__s64	len;
627a4856c96SAlan Somers };
628a4856c96SAlan Somers 
629a4856c96SAlan Somers struct fuse_notify_inval_entry_out {
630a4856c96SAlan Somers 	__u64	parent;
631a4856c96SAlan Somers 	__u32	namelen;
632a4856c96SAlan Somers 	__u32	padding;
633a4856c96SAlan Somers };
634a4856c96SAlan Somers 
63516bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */
636