xref: /freebsd/sys/fs/fuse/fuse_kernel.h (revision a4856c96d0e0c6a41d48c3fd43c139c8ab0857c1)
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
55*a4856c96SAlan Somers  *
56*a4856c96SAlan Somers  *  7.12
57*a4856c96SAlan Somers  *  - add umask flag to input argument of open, mknod and mkdir
58*a4856c96SAlan Somers  *  - add notification messages for invalidation of inodes and
59*a4856c96SAlan Somers  *    directory entries
6016bd2d47SAlan Somers  */
6116bd2d47SAlan Somers 
6216bd2d47SAlan Somers #ifndef _FUSE_FUSE_KERNEL_H
6316bd2d47SAlan Somers #define _FUSE_FUSE_KERNEL_H
6416bd2d47SAlan Somers 
655fe58019SAttilio Rao #ifndef linux
665fe58019SAttilio Rao #include <sys/types.h>
675fe58019SAttilio Rao #define __u64 uint64_t
68*a4856c96SAlan Somers #define __s64 int64_t
695fe58019SAttilio Rao #define __u32 uint32_t
705fe58019SAttilio Rao #define __s32 int32_t
715fe58019SAttilio Rao #else
729c62bc70SAlan Somers #include <linux/types.h>
735fe58019SAttilio Rao #endif
745fe58019SAttilio Rao 
755fe58019SAttilio Rao /** Version number of this interface */
765fe58019SAttilio Rao #define FUSE_KERNEL_VERSION 7
775fe58019SAttilio Rao 
785fe58019SAttilio Rao /** Minor version number of this interface */
79*a4856c96SAlan Somers #define FUSE_KERNEL_MINOR_VERSION 12
805fe58019SAttilio Rao 
815fe58019SAttilio Rao /** The node ID of the root inode */
825fe58019SAttilio Rao #define FUSE_ROOT_ID 1
835fe58019SAttilio Rao 
845fe58019SAttilio Rao /* Make sure all structures are padded to 64bit boundary, so 32bit
855fe58019SAttilio Rao    userspace works under 64bit kernels */
865fe58019SAttilio Rao 
875fe58019SAttilio Rao struct fuse_attr {
885fe58019SAttilio Rao 	__u64	ino;
895fe58019SAttilio Rao 	__u64	size;
905fe58019SAttilio Rao 	__u64	blocks;
915fe58019SAttilio Rao 	__u64	atime;
925fe58019SAttilio Rao 	__u64	mtime;
935fe58019SAttilio Rao 	__u64	ctime;
945fe58019SAttilio Rao 	__u32	atimensec;
955fe58019SAttilio Rao 	__u32	mtimensec;
965fe58019SAttilio Rao 	__u32	ctimensec;
975fe58019SAttilio Rao 	__u32	mode;
985fe58019SAttilio Rao 	__u32	nlink;
995fe58019SAttilio Rao 	__u32	uid;
1005fe58019SAttilio Rao 	__u32	gid;
1015fe58019SAttilio Rao 	__u32	rdev;
10216bd2d47SAlan Somers 	__u32	blksize;
10316bd2d47SAlan Somers 	__u32	padding;
1045fe58019SAttilio Rao };
1055fe58019SAttilio Rao 
1065fe58019SAttilio Rao struct fuse_kstatfs {
1075fe58019SAttilio Rao 	__u64	blocks;
1085fe58019SAttilio Rao 	__u64	bfree;
1095fe58019SAttilio Rao 	__u64	bavail;
1105fe58019SAttilio Rao 	__u64	files;
1115fe58019SAttilio Rao 	__u64	ffree;
1125fe58019SAttilio Rao 	__u32	bsize;
1135fe58019SAttilio Rao 	__u32	namelen;
1145fe58019SAttilio Rao 	__u32	frsize;
1155fe58019SAttilio Rao 	__u32	padding;
1165fe58019SAttilio Rao 	__u32	spare[6];
1175fe58019SAttilio Rao };
1185fe58019SAttilio Rao 
1195fe58019SAttilio Rao struct fuse_file_lock {
1205fe58019SAttilio Rao 	__u64	start;
1215fe58019SAttilio Rao 	__u64	end;
1225fe58019SAttilio Rao 	__u32	type;
1235fe58019SAttilio Rao 	__u32	pid; /* tgid */
1245fe58019SAttilio Rao };
1255fe58019SAttilio Rao 
1265fe58019SAttilio Rao /**
1275fe58019SAttilio Rao  * Bitmasks for fuse_setattr_in.valid
1285fe58019SAttilio Rao  */
1295fe58019SAttilio Rao #define FATTR_MODE	(1 << 0)
1305fe58019SAttilio Rao #define FATTR_UID	(1 << 1)
1315fe58019SAttilio Rao #define FATTR_GID	(1 << 2)
1325fe58019SAttilio Rao #define FATTR_SIZE	(1 << 3)
1335fe58019SAttilio Rao #define FATTR_ATIME	(1 << 4)
1345fe58019SAttilio Rao #define FATTR_MTIME	(1 << 5)
1355fe58019SAttilio Rao #define FATTR_FH	(1 << 6)
13616bd2d47SAlan Somers #define FATTR_ATIME_NOW	(1 << 7)
13716bd2d47SAlan Somers #define FATTR_MTIME_NOW	(1 << 8)
13816bd2d47SAlan Somers #define FATTR_LOCKOWNER	(1 << 9)
1395fe58019SAttilio Rao 
1405fe58019SAttilio Rao /**
1415fe58019SAttilio Rao  * Flags returned by the OPEN request
1425fe58019SAttilio Rao  *
1435fe58019SAttilio Rao  * FOPEN_DIRECT_IO: bypass page cache for this open file
1445fe58019SAttilio Rao  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
1453f105d16SAlan Somers  * FOPEN_NONSEEKABLE: the file is not seekable
1465fe58019SAttilio Rao  */
1475fe58019SAttilio Rao #define FOPEN_DIRECT_IO		(1 << 0)
1485fe58019SAttilio Rao #define FOPEN_KEEP_CACHE	(1 << 1)
1493f105d16SAlan Somers #define FOPEN_NONSEEKABLE	(1 << 2)
1505fe58019SAttilio Rao 
1515fe58019SAttilio Rao /**
1525fe58019SAttilio Rao  * INIT request/reply flags
15316bd2d47SAlan Somers  *
15416bd2d47SAlan Somers  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
155*a4856c96SAlan Somers  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
1565fe58019SAttilio Rao  */
1575fe58019SAttilio Rao #define FUSE_ASYNC_READ		(1 << 0)
1585fe58019SAttilio Rao #define FUSE_POSIX_LOCKS	(1 << 1)
15916bd2d47SAlan Somers #define FUSE_FILE_OPS		(1 << 2)
16016bd2d47SAlan Somers #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
16116bd2d47SAlan Somers #define FUSE_EXPORT_SUPPORT	(1 << 4)
16216bd2d47SAlan Somers #define FUSE_BIG_WRITES		(1 << 5)
163*a4856c96SAlan Somers #define FUSE_DONT_MASK		(1 << 6)
1645fe58019SAttilio Rao 
1659c62bc70SAlan Somers #ifdef linux
1669c62bc70SAlan Somers /**
1679c62bc70SAlan Somers  * CUSE INIT request/reply flags
1689c62bc70SAlan Somers  *
1699c62bc70SAlan Somers  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
1709c62bc70SAlan Somers  */
1719c62bc70SAlan Somers #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
1729c62bc70SAlan Somers #endif /* linux */
1739c62bc70SAlan Somers 
1745fe58019SAttilio Rao /**
1755fe58019SAttilio Rao  * Release flags
1765fe58019SAttilio Rao  */
1775fe58019SAttilio Rao #define FUSE_RELEASE_FLUSH	(1 << 0)
1785fe58019SAttilio Rao 
17916bd2d47SAlan Somers /**
18016bd2d47SAlan Somers  * Getattr flags
18116bd2d47SAlan Somers  */
18216bd2d47SAlan Somers #define FUSE_GETATTR_FH		(1 << 0)
18316bd2d47SAlan Somers 
18416bd2d47SAlan Somers /**
18516bd2d47SAlan Somers  * Lock flags
18616bd2d47SAlan Somers  */
18716bd2d47SAlan Somers #define FUSE_LK_FLOCK		(1 << 0)
18816bd2d47SAlan Somers 
18916bd2d47SAlan Somers /**
19016bd2d47SAlan Somers  * WRITE flags
19116bd2d47SAlan Somers  *
19216bd2d47SAlan Somers  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
19316bd2d47SAlan Somers  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
19416bd2d47SAlan Somers  */
19516bd2d47SAlan Somers #define FUSE_WRITE_CACHE	(1 << 0)
19616bd2d47SAlan Somers #define FUSE_WRITE_LOCKOWNER	(1 << 1)
19716bd2d47SAlan Somers 
19816bd2d47SAlan Somers /**
19916bd2d47SAlan Somers  * Read flags
20016bd2d47SAlan Somers  */
20116bd2d47SAlan Somers #define FUSE_READ_LOCKOWNER	(1 << 1)
20216bd2d47SAlan Somers 
2039c62bc70SAlan Somers /**
2049c62bc70SAlan Somers  * Ioctl flags
2059c62bc70SAlan Somers  *
2069c62bc70SAlan Somers  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
2079c62bc70SAlan Somers  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
2089c62bc70SAlan Somers  * FUSE_IOCTL_RETRY: retry with new iovecs
2099c62bc70SAlan Somers  *
2109c62bc70SAlan Somers  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
2119c62bc70SAlan Somers  */
2129c62bc70SAlan Somers #define FUSE_IOCTL_COMPAT	(1 << 0)
2139c62bc70SAlan Somers #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
2149c62bc70SAlan Somers #define FUSE_IOCTL_RETRY	(1 << 2)
2159c62bc70SAlan Somers 
2169c62bc70SAlan Somers #define FUSE_IOCTL_MAX_IOV	256
2179c62bc70SAlan Somers 
2189c62bc70SAlan Somers /**
2199c62bc70SAlan Somers  * Poll flags
2209c62bc70SAlan Somers  *
2219c62bc70SAlan Somers  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
2229c62bc70SAlan Somers  */
2239c62bc70SAlan Somers #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
2249c62bc70SAlan Somers 
2255fe58019SAttilio Rao enum fuse_opcode {
2265fe58019SAttilio Rao 	FUSE_LOOKUP	   = 1,
2275fe58019SAttilio Rao 	FUSE_FORGET	   = 2,  /* no reply */
2285fe58019SAttilio Rao 	FUSE_GETATTR	   = 3,
2295fe58019SAttilio Rao 	FUSE_SETATTR	   = 4,
2305fe58019SAttilio Rao 	FUSE_READLINK	   = 5,
2315fe58019SAttilio Rao 	FUSE_SYMLINK	   = 6,
2325fe58019SAttilio Rao 	FUSE_MKNOD	   = 8,
2335fe58019SAttilio Rao 	FUSE_MKDIR	   = 9,
2345fe58019SAttilio Rao 	FUSE_UNLINK	   = 10,
2355fe58019SAttilio Rao 	FUSE_RMDIR	   = 11,
2365fe58019SAttilio Rao 	FUSE_RENAME	   = 12,
2375fe58019SAttilio Rao 	FUSE_LINK	   = 13,
2385fe58019SAttilio Rao 	FUSE_OPEN	   = 14,
2395fe58019SAttilio Rao 	FUSE_READ	   = 15,
2405fe58019SAttilio Rao 	FUSE_WRITE	   = 16,
2415fe58019SAttilio Rao 	FUSE_STATFS	   = 17,
2425fe58019SAttilio Rao 	FUSE_RELEASE       = 18,
2435fe58019SAttilio Rao 	FUSE_FSYNC         = 20,
2445fe58019SAttilio Rao 	FUSE_SETXATTR      = 21,
2455fe58019SAttilio Rao 	FUSE_GETXATTR      = 22,
2465fe58019SAttilio Rao 	FUSE_LISTXATTR     = 23,
2475fe58019SAttilio Rao 	FUSE_REMOVEXATTR   = 24,
2485fe58019SAttilio Rao 	FUSE_FLUSH         = 25,
2495fe58019SAttilio Rao 	FUSE_INIT          = 26,
2505fe58019SAttilio Rao 	FUSE_OPENDIR       = 27,
2515fe58019SAttilio Rao 	FUSE_READDIR       = 28,
2525fe58019SAttilio Rao 	FUSE_RELEASEDIR    = 29,
2535fe58019SAttilio Rao 	FUSE_FSYNCDIR      = 30,
2545fe58019SAttilio Rao 	FUSE_GETLK         = 31,
2555fe58019SAttilio Rao 	FUSE_SETLK         = 32,
2565fe58019SAttilio Rao 	FUSE_SETLKW        = 33,
2575fe58019SAttilio Rao 	FUSE_ACCESS        = 34,
2585fe58019SAttilio Rao 	FUSE_CREATE        = 35,
2595fe58019SAttilio Rao 	FUSE_INTERRUPT     = 36,
2605fe58019SAttilio Rao 	FUSE_BMAP          = 37,
2615fe58019SAttilio Rao 	FUSE_DESTROY       = 38,
2629c62bc70SAlan Somers 	FUSE_IOCTL         = 39,
2639c62bc70SAlan Somers 	FUSE_POLL          = 40,
2649c62bc70SAlan Somers 
2659c62bc70SAlan Somers #ifdef linux
2669c62bc70SAlan Somers 	/* CUSE specific operations */
2679c62bc70SAlan Somers 	CUSE_INIT          = 4096,
2689c62bc70SAlan Somers #endif /* linux */
2699c62bc70SAlan Somers };
2709c62bc70SAlan Somers 
2719c62bc70SAlan Somers enum fuse_notify_code {
2729c62bc70SAlan Somers 	FUSE_NOTIFY_POLL   = 1,
273*a4856c96SAlan Somers 	FUSE_NOTIFY_INVAL_INODE = 2,
274*a4856c96SAlan Somers 	FUSE_NOTIFY_INVAL_ENTRY = 3,
2759c62bc70SAlan Somers 	FUSE_NOTIFY_CODE_MAX,
2765fe58019SAttilio Rao };
2775fe58019SAttilio Rao 
2785fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */
2795fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192
2805fe58019SAttilio Rao 
28116bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
28216bd2d47SAlan Somers 
2835fe58019SAttilio Rao struct fuse_entry_out {
2845fe58019SAttilio Rao 	__u64	nodeid;		/* Inode ID */
2855fe58019SAttilio Rao 	__u64	generation;	/* Inode generation: nodeid:gen must
2865fe58019SAttilio Rao 				   be unique for the fs's lifetime */
2875fe58019SAttilio Rao 	__u64	entry_valid;	/* Cache timeout for the name */
2885fe58019SAttilio Rao 	__u64	attr_valid;	/* Cache timeout for the attributes */
2895fe58019SAttilio Rao 	__u32	entry_valid_nsec;
2905fe58019SAttilio Rao 	__u32	attr_valid_nsec;
2915fe58019SAttilio Rao 	struct fuse_attr attr;
2925fe58019SAttilio Rao };
2935fe58019SAttilio Rao 
2945fe58019SAttilio Rao struct fuse_forget_in {
2955fe58019SAttilio Rao 	__u64	nlookup;
2965fe58019SAttilio Rao };
2975fe58019SAttilio Rao 
29816bd2d47SAlan Somers struct fuse_getattr_in {
29916bd2d47SAlan Somers 	__u32	getattr_flags;
30016bd2d47SAlan Somers 	__u32	dummy;
30116bd2d47SAlan Somers 	__u64	fh;
30216bd2d47SAlan Somers };
30316bd2d47SAlan Somers 
30416bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96
30516bd2d47SAlan Somers 
3065fe58019SAttilio Rao struct fuse_attr_out {
3075fe58019SAttilio Rao 	__u64	attr_valid;	/* Cache timeout for the attributes */
3085fe58019SAttilio Rao 	__u32	attr_valid_nsec;
3095fe58019SAttilio Rao 	__u32	dummy;
3105fe58019SAttilio Rao 	struct fuse_attr attr;
3115fe58019SAttilio Rao };
3125fe58019SAttilio Rao 
313*a4856c96SAlan Somers #define FUSE_COMPAT_MKNOD_IN_SIZE 8
314*a4856c96SAlan Somers 
3154cbb4f88SAlan Somers struct fuse_mknod_in {
3164cbb4f88SAlan Somers 	__u32	mode;
3174cbb4f88SAlan Somers 	__u32	rdev;
318*a4856c96SAlan Somers 	__u32	umask;
319*a4856c96SAlan Somers 	__u32	padding;
3204cbb4f88SAlan Somers };
3214cbb4f88SAlan Somers 
3225fe58019SAttilio Rao struct fuse_mkdir_in {
3235fe58019SAttilio Rao 	__u32	mode;
324*a4856c96SAlan Somers 	__u32	umask;
3255fe58019SAttilio Rao };
3265fe58019SAttilio Rao 
3275fe58019SAttilio Rao struct fuse_rename_in {
3285fe58019SAttilio Rao 	__u64	newdir;
3295fe58019SAttilio Rao };
3305fe58019SAttilio Rao 
3315fe58019SAttilio Rao struct fuse_link_in {
3325fe58019SAttilio Rao 	__u64	oldnodeid;
3335fe58019SAttilio Rao };
3345fe58019SAttilio Rao 
3355fe58019SAttilio Rao struct fuse_setattr_in {
3365fe58019SAttilio Rao 	__u32	valid;
3375fe58019SAttilio Rao 	__u32	padding;
3385fe58019SAttilio Rao 	__u64	fh;
3395fe58019SAttilio Rao 	__u64	size;
34016bd2d47SAlan Somers 	__u64	lock_owner;
3415fe58019SAttilio Rao 	__u64	atime;
3425fe58019SAttilio Rao 	__u64	mtime;
3435fe58019SAttilio Rao 	__u64	unused2;
3445fe58019SAttilio Rao 	__u32	atimensec;
3455fe58019SAttilio Rao 	__u32	mtimensec;
3465fe58019SAttilio Rao 	__u32	unused3;
3475fe58019SAttilio Rao 	__u32	mode;
3485fe58019SAttilio Rao 	__u32	unused4;
3495fe58019SAttilio Rao 	__u32	uid;
3505fe58019SAttilio Rao 	__u32	gid;
3515fe58019SAttilio Rao 	__u32	unused5;
3525fe58019SAttilio Rao };
3535fe58019SAttilio Rao 
3545fe58019SAttilio Rao struct fuse_open_in {
3555fe58019SAttilio Rao 	__u32	flags;
356*a4856c96SAlan Somers 	__u32	unused;
357*a4856c96SAlan Somers };
358*a4856c96SAlan Somers 
359*a4856c96SAlan Somers struct fuse_create_in {
360*a4856c96SAlan Somers 	__u32	flags;
3615fe58019SAttilio Rao 	__u32	mode;
362*a4856c96SAlan Somers 	__u32	umask;
363*a4856c96SAlan Somers 	__u32	padding;
3645fe58019SAttilio Rao };
3655fe58019SAttilio Rao 
3665fe58019SAttilio Rao struct fuse_open_out {
3675fe58019SAttilio Rao 	__u64	fh;
3685fe58019SAttilio Rao 	__u32	open_flags;
3695fe58019SAttilio Rao 	__u32	padding;
3705fe58019SAttilio Rao };
3715fe58019SAttilio Rao 
3725fe58019SAttilio Rao struct fuse_release_in {
3735fe58019SAttilio Rao 	__u64	fh;
3745fe58019SAttilio Rao 	__u32	flags;
3755fe58019SAttilio Rao 	__u32	release_flags;
3765fe58019SAttilio Rao 	__u64	lock_owner;
3775fe58019SAttilio Rao };
3785fe58019SAttilio Rao 
3795fe58019SAttilio Rao struct fuse_flush_in {
3805fe58019SAttilio Rao 	__u64	fh;
3815fe58019SAttilio Rao 	__u32	unused;
3825fe58019SAttilio Rao 	__u32	padding;
3835fe58019SAttilio Rao 	__u64	lock_owner;
3845fe58019SAttilio Rao };
3855fe58019SAttilio Rao 
3865fe58019SAttilio Rao struct fuse_read_in {
3875fe58019SAttilio Rao 	__u64	fh;
3885fe58019SAttilio Rao 	__u64	offset;
3895fe58019SAttilio Rao 	__u32	size;
39016bd2d47SAlan Somers 	__u32	read_flags;
39116bd2d47SAlan Somers 	__u64	lock_owner;
39216bd2d47SAlan Somers 	__u32	flags;
3935fe58019SAttilio Rao 	__u32	padding;
3945fe58019SAttilio Rao };
3955fe58019SAttilio Rao 
39616bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24
39716bd2d47SAlan Somers 
3985fe58019SAttilio Rao struct fuse_write_in {
3995fe58019SAttilio Rao 	__u64	fh;
4005fe58019SAttilio Rao 	__u64	offset;
4015fe58019SAttilio Rao 	__u32	size;
4025fe58019SAttilio Rao 	__u32	write_flags;
40316bd2d47SAlan Somers 	__u64	lock_owner;
40416bd2d47SAlan Somers 	__u32	flags;
40516bd2d47SAlan Somers 	__u32	padding;
4065fe58019SAttilio Rao };
4075fe58019SAttilio Rao 
4085fe58019SAttilio Rao struct fuse_write_out {
4095fe58019SAttilio Rao 	__u32	size;
4105fe58019SAttilio Rao 	__u32	padding;
4115fe58019SAttilio Rao };
4125fe58019SAttilio Rao 
4135fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48
4145fe58019SAttilio Rao 
4155fe58019SAttilio Rao struct fuse_statfs_out {
4165fe58019SAttilio Rao 	struct fuse_kstatfs st;
4175fe58019SAttilio Rao };
4185fe58019SAttilio Rao 
4195fe58019SAttilio Rao struct fuse_fsync_in {
4205fe58019SAttilio Rao 	__u64	fh;
4215fe58019SAttilio Rao 	__u32	fsync_flags;
4225fe58019SAttilio Rao 	__u32	padding;
4235fe58019SAttilio Rao };
4245fe58019SAttilio Rao 
42596192dfcSAlan Somers struct fuse_setxattr_in {
426493b4a8cSFedor Uporov 	__u32	size;
427493b4a8cSFedor Uporov 	__u32	flags;
428493b4a8cSFedor Uporov };
429493b4a8cSFedor Uporov 
43096192dfcSAlan Somers struct fuse_listxattr_in {
43196192dfcSAlan Somers 	__u32	size;
43296192dfcSAlan Somers 	__u32	padding;
43396192dfcSAlan Somers };
43496192dfcSAlan Somers 
435493b4a8cSFedor Uporov struct fuse_listxattr_out {
4365fe58019SAttilio Rao 	__u32	size;
43796192dfcSAlan Somers 	__u32	padding;
4385fe58019SAttilio Rao };
4395fe58019SAttilio Rao 
4405fe58019SAttilio Rao struct fuse_getxattr_in {
4415fe58019SAttilio Rao 	__u32	size;
4425fe58019SAttilio Rao 	__u32	padding;
4435fe58019SAttilio Rao };
4445fe58019SAttilio Rao 
4455fe58019SAttilio Rao struct fuse_getxattr_out {
4465fe58019SAttilio Rao 	__u32	size;
4475fe58019SAttilio Rao 	__u32	padding;
4485fe58019SAttilio Rao };
4495fe58019SAttilio Rao 
4505fe58019SAttilio Rao struct fuse_lk_in {
4515fe58019SAttilio Rao 	__u64	fh;
4525fe58019SAttilio Rao 	__u64	owner;
4535fe58019SAttilio Rao 	struct fuse_file_lock lk;
45416bd2d47SAlan Somers 	__u32	lk_flags;
45516bd2d47SAlan Somers 	__u32	padding;
4565fe58019SAttilio Rao };
4575fe58019SAttilio Rao 
4585fe58019SAttilio Rao struct fuse_lk_out {
4595fe58019SAttilio Rao 	struct fuse_file_lock lk;
4605fe58019SAttilio Rao };
4615fe58019SAttilio Rao 
4625fe58019SAttilio Rao struct fuse_access_in {
4635fe58019SAttilio Rao 	__u32	mask;
4645fe58019SAttilio Rao 	__u32	padding;
4655fe58019SAttilio Rao };
4665fe58019SAttilio Rao 
4675fe58019SAttilio Rao struct fuse_init_in {
4685fe58019SAttilio Rao 	__u32	major;
4695fe58019SAttilio Rao 	__u32	minor;
4705fe58019SAttilio Rao 	__u32	max_readahead;
4715fe58019SAttilio Rao 	__u32	flags;
4725fe58019SAttilio Rao };
4735fe58019SAttilio Rao 
4745fe58019SAttilio Rao struct fuse_init_out {
4755fe58019SAttilio Rao 	__u32	major;
4765fe58019SAttilio Rao 	__u32	minor;
4775fe58019SAttilio Rao 	__u32	max_readahead;
4785fe58019SAttilio Rao 	__u32	flags;
4795fe58019SAttilio Rao 	__u32	unused;
4805fe58019SAttilio Rao 	__u32	max_write;
4815fe58019SAttilio Rao };
4825fe58019SAttilio Rao 
4839c62bc70SAlan Somers #ifdef linux
4849c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096
4859c62bc70SAlan Somers 
4869c62bc70SAlan Somers struct cuse_init_in {
4879c62bc70SAlan Somers 	__u32	major;
4889c62bc70SAlan Somers 	__u32	minor;
4899c62bc70SAlan Somers 	__u32	unused;
4909c62bc70SAlan Somers 	__u32	flags;
4919c62bc70SAlan Somers };
4929c62bc70SAlan Somers 
4939c62bc70SAlan Somers struct cuse_init_out {
4949c62bc70SAlan Somers 	__u32	major;
4959c62bc70SAlan Somers 	__u32	minor;
4969c62bc70SAlan Somers 	__u32	unused;
4979c62bc70SAlan Somers 	__u32	flags;
4989c62bc70SAlan Somers 	__u32	max_read;
4999c62bc70SAlan Somers 	__u32	max_write;
5009c62bc70SAlan Somers 	__u32	dev_major;		/* chardev major */
5019c62bc70SAlan Somers 	__u32	dev_minor;		/* chardev minor */
5029c62bc70SAlan Somers 	__u32	spare[10];
5039c62bc70SAlan Somers };
5049c62bc70SAlan Somers #endif /* linux */
5059c62bc70SAlan Somers 
5065fe58019SAttilio Rao struct fuse_interrupt_in {
5075fe58019SAttilio Rao 	__u64	unique;
5085fe58019SAttilio Rao };
5095fe58019SAttilio Rao 
5105fe58019SAttilio Rao struct fuse_bmap_in {
5115fe58019SAttilio Rao 	__u64	block;
5125fe58019SAttilio Rao 	__u32	blocksize;
5135fe58019SAttilio Rao 	__u32	padding;
5145fe58019SAttilio Rao };
5155fe58019SAttilio Rao 
5165fe58019SAttilio Rao struct fuse_bmap_out {
5175fe58019SAttilio Rao 	__u64	block;
5185fe58019SAttilio Rao };
5195fe58019SAttilio Rao 
5209c62bc70SAlan Somers struct fuse_ioctl_in {
5219c62bc70SAlan Somers 	__u64	fh;
5229c62bc70SAlan Somers 	__u32	flags;
5239c62bc70SAlan Somers 	__u32	cmd;
5249c62bc70SAlan Somers 	__u64	arg;
5259c62bc70SAlan Somers 	__u32	in_size;
5269c62bc70SAlan Somers 	__u32	out_size;
5279c62bc70SAlan Somers };
5289c62bc70SAlan Somers 
5299c62bc70SAlan Somers struct fuse_ioctl_out {
5309c62bc70SAlan Somers 	__s32	result;
5319c62bc70SAlan Somers 	__u32	flags;
5329c62bc70SAlan Somers 	__u32	in_iovs;
5339c62bc70SAlan Somers 	__u32	out_iovs;
5349c62bc70SAlan Somers };
5359c62bc70SAlan Somers 
5369c62bc70SAlan Somers struct fuse_poll_in {
5379c62bc70SAlan Somers 	__u64	fh;
5389c62bc70SAlan Somers 	__u64	kh;
5399c62bc70SAlan Somers 	__u32	flags;
5409c62bc70SAlan Somers 	__u32   padding;
5419c62bc70SAlan Somers };
5429c62bc70SAlan Somers 
5439c62bc70SAlan Somers struct fuse_poll_out {
5449c62bc70SAlan Somers 	__u32	revents;
5459c62bc70SAlan Somers 	__u32	padding;
5469c62bc70SAlan Somers };
5479c62bc70SAlan Somers 
5489c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out {
5499c62bc70SAlan Somers 	__u64	kh;
5509c62bc70SAlan Somers };
5519c62bc70SAlan Somers 
5525fe58019SAttilio Rao struct fuse_in_header {
5535fe58019SAttilio Rao 	__u32	len;
5545fe58019SAttilio Rao 	__u32	opcode;
5555fe58019SAttilio Rao 	__u64	unique;
5565fe58019SAttilio Rao 	__u64	nodeid;
5575fe58019SAttilio Rao 	__u32	uid;
5585fe58019SAttilio Rao 	__u32	gid;
5595fe58019SAttilio Rao 	__u32	pid;
5605fe58019SAttilio Rao 	__u32	padding;
5615fe58019SAttilio Rao };
5625fe58019SAttilio Rao 
5635fe58019SAttilio Rao struct fuse_out_header {
5645fe58019SAttilio Rao 	__u32	len;
5655fe58019SAttilio Rao 	__s32	error;
5665fe58019SAttilio Rao 	__u64	unique;
5675fe58019SAttilio Rao };
5685fe58019SAttilio Rao 
5695fe58019SAttilio Rao struct fuse_dirent {
5705fe58019SAttilio Rao 	__u64	ino;
5715fe58019SAttilio Rao 	__u64	off;
5725fe58019SAttilio Rao 	__u32	namelen;
5735fe58019SAttilio Rao 	__u32	type;
5747d20a270SPedro F. Giffuni 	char name[0];
5755fe58019SAttilio Rao };
5765fe58019SAttilio Rao 
5775fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
5785fe58019SAttilio Rao #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
5795fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \
5805fe58019SAttilio Rao 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
58116bd2d47SAlan Somers 
582*a4856c96SAlan Somers struct fuse_notify_inval_inode_out {
583*a4856c96SAlan Somers 	__u64	ino;
584*a4856c96SAlan Somers 	__s64	off;
585*a4856c96SAlan Somers 	__s64	len;
586*a4856c96SAlan Somers };
587*a4856c96SAlan Somers 
588*a4856c96SAlan Somers struct fuse_notify_inval_entry_out {
589*a4856c96SAlan Somers 	__u64	parent;
590*a4856c96SAlan Somers 	__u32	namelen;
591*a4856c96SAlan Somers 	__u32	padding;
592*a4856c96SAlan Somers };
593*a4856c96SAlan Somers 
59416bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */
595