xref: /freebsd/sys/fs/fuse/fuse_kernel.h (revision 9c62bc7045f1022c51e371ce8ca0990131159f1d)
151369649SPedro F. Giffuni /*--
25fe58019SAttilio Rao  * This file defines the kernel interface of FUSE
3*9c62bc70SAlan 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
51*9c62bc70SAlan Somers  *
52*9c62bc70SAlan Somers  *  7.11
53*9c62bc70SAlan Somers  *  - add IOCTL message
54*9c62bc70SAlan Somers  *  - add unsolicited notification support
5516bd2d47SAlan Somers  */
5616bd2d47SAlan Somers 
5716bd2d47SAlan Somers #ifndef _FUSE_FUSE_KERNEL_H
5816bd2d47SAlan Somers #define _FUSE_FUSE_KERNEL_H
5916bd2d47SAlan Somers 
605fe58019SAttilio Rao #ifndef linux
615fe58019SAttilio Rao #include <sys/types.h>
625fe58019SAttilio Rao #define __u64 uint64_t
635fe58019SAttilio Rao #define __u32 uint32_t
645fe58019SAttilio Rao #define __s32 int32_t
655fe58019SAttilio Rao #else
66*9c62bc70SAlan Somers #include <linux/types.h>
675fe58019SAttilio Rao #endif
685fe58019SAttilio Rao 
695fe58019SAttilio Rao /** Version number of this interface */
705fe58019SAttilio Rao #define FUSE_KERNEL_VERSION 7
715fe58019SAttilio Rao 
725fe58019SAttilio Rao /** Minor version number of this interface */
73*9c62bc70SAlan Somers #define FUSE_KERNEL_MINOR_VERSION 11
745fe58019SAttilio Rao 
755fe58019SAttilio Rao /** The node ID of the root inode */
765fe58019SAttilio Rao #define FUSE_ROOT_ID 1
775fe58019SAttilio Rao 
785fe58019SAttilio Rao /* Make sure all structures are padded to 64bit boundary, so 32bit
795fe58019SAttilio Rao    userspace works under 64bit kernels */
805fe58019SAttilio Rao 
815fe58019SAttilio Rao struct fuse_attr {
825fe58019SAttilio Rao 	__u64	ino;
835fe58019SAttilio Rao 	__u64	size;
845fe58019SAttilio Rao 	__u64	blocks;
855fe58019SAttilio Rao 	__u64	atime;
865fe58019SAttilio Rao 	__u64	mtime;
875fe58019SAttilio Rao 	__u64	ctime;
885fe58019SAttilio Rao 	__u32	atimensec;
895fe58019SAttilio Rao 	__u32	mtimensec;
905fe58019SAttilio Rao 	__u32	ctimensec;
915fe58019SAttilio Rao 	__u32	mode;
925fe58019SAttilio Rao 	__u32	nlink;
935fe58019SAttilio Rao 	__u32	uid;
945fe58019SAttilio Rao 	__u32	gid;
955fe58019SAttilio Rao 	__u32	rdev;
9616bd2d47SAlan Somers 	__u32	blksize;
9716bd2d47SAlan Somers 	__u32	padding;
985fe58019SAttilio Rao };
995fe58019SAttilio Rao 
1005fe58019SAttilio Rao struct fuse_kstatfs {
1015fe58019SAttilio Rao 	__u64	blocks;
1025fe58019SAttilio Rao 	__u64	bfree;
1035fe58019SAttilio Rao 	__u64	bavail;
1045fe58019SAttilio Rao 	__u64	files;
1055fe58019SAttilio Rao 	__u64	ffree;
1065fe58019SAttilio Rao 	__u32	bsize;
1075fe58019SAttilio Rao 	__u32	namelen;
1085fe58019SAttilio Rao 	__u32	frsize;
1095fe58019SAttilio Rao 	__u32	padding;
1105fe58019SAttilio Rao 	__u32	spare[6];
1115fe58019SAttilio Rao };
1125fe58019SAttilio Rao 
1135fe58019SAttilio Rao struct fuse_file_lock {
1145fe58019SAttilio Rao 	__u64	start;
1155fe58019SAttilio Rao 	__u64	end;
1165fe58019SAttilio Rao 	__u32	type;
1175fe58019SAttilio Rao 	__u32	pid; /* tgid */
1185fe58019SAttilio Rao };
1195fe58019SAttilio Rao 
1205fe58019SAttilio Rao /**
1215fe58019SAttilio Rao  * Bitmasks for fuse_setattr_in.valid
1225fe58019SAttilio Rao  */
1235fe58019SAttilio Rao #define FATTR_MODE	(1 << 0)
1245fe58019SAttilio Rao #define FATTR_UID	(1 << 1)
1255fe58019SAttilio Rao #define FATTR_GID	(1 << 2)
1265fe58019SAttilio Rao #define FATTR_SIZE	(1 << 3)
1275fe58019SAttilio Rao #define FATTR_ATIME	(1 << 4)
1285fe58019SAttilio Rao #define FATTR_MTIME	(1 << 5)
1295fe58019SAttilio Rao #define FATTR_FH	(1 << 6)
13016bd2d47SAlan Somers #define FATTR_ATIME_NOW	(1 << 7)
13116bd2d47SAlan Somers #define FATTR_MTIME_NOW	(1 << 8)
13216bd2d47SAlan Somers #define FATTR_LOCKOWNER	(1 << 9)
1335fe58019SAttilio Rao 
1345fe58019SAttilio Rao /**
1355fe58019SAttilio Rao  * Flags returned by the OPEN request
1365fe58019SAttilio Rao  *
1375fe58019SAttilio Rao  * FOPEN_DIRECT_IO: bypass page cache for this open file
1385fe58019SAttilio Rao  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
1393f105d16SAlan Somers  * FOPEN_NONSEEKABLE: the file is not seekable
1405fe58019SAttilio Rao  */
1415fe58019SAttilio Rao #define FOPEN_DIRECT_IO		(1 << 0)
1425fe58019SAttilio Rao #define FOPEN_KEEP_CACHE	(1 << 1)
1433f105d16SAlan Somers #define FOPEN_NONSEEKABLE	(1 << 2)
1445fe58019SAttilio Rao 
1455fe58019SAttilio Rao /**
1465fe58019SAttilio Rao  * INIT request/reply flags
14716bd2d47SAlan Somers  *
14816bd2d47SAlan Somers  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
1495fe58019SAttilio Rao  */
1505fe58019SAttilio Rao #define FUSE_ASYNC_READ		(1 << 0)
1515fe58019SAttilio Rao #define FUSE_POSIX_LOCKS	(1 << 1)
15216bd2d47SAlan Somers #define FUSE_FILE_OPS		(1 << 2)
15316bd2d47SAlan Somers #define FUSE_ATOMIC_O_TRUNC	(1 << 3)
15416bd2d47SAlan Somers #define FUSE_EXPORT_SUPPORT	(1 << 4)
15516bd2d47SAlan Somers #define FUSE_BIG_WRITES		(1 << 5)
1565fe58019SAttilio Rao 
157*9c62bc70SAlan Somers #ifdef linux
158*9c62bc70SAlan Somers /**
159*9c62bc70SAlan Somers  * CUSE INIT request/reply flags
160*9c62bc70SAlan Somers  *
161*9c62bc70SAlan Somers  * CUSE_UNRESTRICTED_IOCTL:  use unrestricted ioctl
162*9c62bc70SAlan Somers  */
163*9c62bc70SAlan Somers #define CUSE_UNRESTRICTED_IOCTL	(1 << 0)
164*9c62bc70SAlan Somers #endif /* linux */
165*9c62bc70SAlan Somers 
1665fe58019SAttilio Rao /**
1675fe58019SAttilio Rao  * Release flags
1685fe58019SAttilio Rao  */
1695fe58019SAttilio Rao #define FUSE_RELEASE_FLUSH	(1 << 0)
1705fe58019SAttilio Rao 
17116bd2d47SAlan Somers /**
17216bd2d47SAlan Somers  * Getattr flags
17316bd2d47SAlan Somers  */
17416bd2d47SAlan Somers #define FUSE_GETATTR_FH		(1 << 0)
17516bd2d47SAlan Somers 
17616bd2d47SAlan Somers /**
17716bd2d47SAlan Somers  * Lock flags
17816bd2d47SAlan Somers  */
17916bd2d47SAlan Somers #define FUSE_LK_FLOCK		(1 << 0)
18016bd2d47SAlan Somers 
18116bd2d47SAlan Somers /**
18216bd2d47SAlan Somers  * WRITE flags
18316bd2d47SAlan Somers  *
18416bd2d47SAlan Somers  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
18516bd2d47SAlan Somers  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
18616bd2d47SAlan Somers  */
18716bd2d47SAlan Somers #define FUSE_WRITE_CACHE	(1 << 0)
18816bd2d47SAlan Somers #define FUSE_WRITE_LOCKOWNER	(1 << 1)
18916bd2d47SAlan Somers 
19016bd2d47SAlan Somers /**
19116bd2d47SAlan Somers  * Read flags
19216bd2d47SAlan Somers  */
19316bd2d47SAlan Somers #define FUSE_READ_LOCKOWNER	(1 << 1)
19416bd2d47SAlan Somers 
195*9c62bc70SAlan Somers /**
196*9c62bc70SAlan Somers  * Ioctl flags
197*9c62bc70SAlan Somers  *
198*9c62bc70SAlan Somers  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
199*9c62bc70SAlan Somers  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
200*9c62bc70SAlan Somers  * FUSE_IOCTL_RETRY: retry with new iovecs
201*9c62bc70SAlan Somers  *
202*9c62bc70SAlan Somers  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
203*9c62bc70SAlan Somers  */
204*9c62bc70SAlan Somers #define FUSE_IOCTL_COMPAT	(1 << 0)
205*9c62bc70SAlan Somers #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
206*9c62bc70SAlan Somers #define FUSE_IOCTL_RETRY	(1 << 2)
207*9c62bc70SAlan Somers 
208*9c62bc70SAlan Somers #define FUSE_IOCTL_MAX_IOV	256
209*9c62bc70SAlan Somers 
210*9c62bc70SAlan Somers /**
211*9c62bc70SAlan Somers  * Poll flags
212*9c62bc70SAlan Somers  *
213*9c62bc70SAlan Somers  * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
214*9c62bc70SAlan Somers  */
215*9c62bc70SAlan Somers #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
216*9c62bc70SAlan Somers 
2175fe58019SAttilio Rao enum fuse_opcode {
2185fe58019SAttilio Rao 	FUSE_LOOKUP	   = 1,
2195fe58019SAttilio Rao 	FUSE_FORGET	   = 2,  /* no reply */
2205fe58019SAttilio Rao 	FUSE_GETATTR	   = 3,
2215fe58019SAttilio Rao 	FUSE_SETATTR	   = 4,
2225fe58019SAttilio Rao 	FUSE_READLINK	   = 5,
2235fe58019SAttilio Rao 	FUSE_SYMLINK	   = 6,
2245fe58019SAttilio Rao 	FUSE_MKNOD	   = 8,
2255fe58019SAttilio Rao 	FUSE_MKDIR	   = 9,
2265fe58019SAttilio Rao 	FUSE_UNLINK	   = 10,
2275fe58019SAttilio Rao 	FUSE_RMDIR	   = 11,
2285fe58019SAttilio Rao 	FUSE_RENAME	   = 12,
2295fe58019SAttilio Rao 	FUSE_LINK	   = 13,
2305fe58019SAttilio Rao 	FUSE_OPEN	   = 14,
2315fe58019SAttilio Rao 	FUSE_READ	   = 15,
2325fe58019SAttilio Rao 	FUSE_WRITE	   = 16,
2335fe58019SAttilio Rao 	FUSE_STATFS	   = 17,
2345fe58019SAttilio Rao 	FUSE_RELEASE       = 18,
2355fe58019SAttilio Rao 	FUSE_FSYNC         = 20,
2365fe58019SAttilio Rao 	FUSE_SETXATTR      = 21,
2375fe58019SAttilio Rao 	FUSE_GETXATTR      = 22,
2385fe58019SAttilio Rao 	FUSE_LISTXATTR     = 23,
2395fe58019SAttilio Rao 	FUSE_REMOVEXATTR   = 24,
2405fe58019SAttilio Rao 	FUSE_FLUSH         = 25,
2415fe58019SAttilio Rao 	FUSE_INIT          = 26,
2425fe58019SAttilio Rao 	FUSE_OPENDIR       = 27,
2435fe58019SAttilio Rao 	FUSE_READDIR       = 28,
2445fe58019SAttilio Rao 	FUSE_RELEASEDIR    = 29,
2455fe58019SAttilio Rao 	FUSE_FSYNCDIR      = 30,
2465fe58019SAttilio Rao 	FUSE_GETLK         = 31,
2475fe58019SAttilio Rao 	FUSE_SETLK         = 32,
2485fe58019SAttilio Rao 	FUSE_SETLKW        = 33,
2495fe58019SAttilio Rao 	FUSE_ACCESS        = 34,
2505fe58019SAttilio Rao 	FUSE_CREATE        = 35,
2515fe58019SAttilio Rao 	FUSE_INTERRUPT     = 36,
2525fe58019SAttilio Rao 	FUSE_BMAP          = 37,
2535fe58019SAttilio Rao 	FUSE_DESTROY       = 38,
254*9c62bc70SAlan Somers 	FUSE_IOCTL         = 39,
255*9c62bc70SAlan Somers 	FUSE_POLL          = 40,
256*9c62bc70SAlan Somers 
257*9c62bc70SAlan Somers #ifdef linux
258*9c62bc70SAlan Somers 	/* CUSE specific operations */
259*9c62bc70SAlan Somers 	CUSE_INIT          = 4096,
260*9c62bc70SAlan Somers #endif /* linux */
261*9c62bc70SAlan Somers };
262*9c62bc70SAlan Somers 
263*9c62bc70SAlan Somers enum fuse_notify_code {
264*9c62bc70SAlan Somers 	FUSE_NOTIFY_POLL   = 1,
265*9c62bc70SAlan Somers 	FUSE_NOTIFY_CODE_MAX,
2665fe58019SAttilio Rao };
2675fe58019SAttilio Rao 
2685fe58019SAttilio Rao /* The read buffer is required to be at least 8k, but may be much larger */
2695fe58019SAttilio Rao #define FUSE_MIN_READ_BUFFER 8192
2705fe58019SAttilio Rao 
27116bd2d47SAlan Somers #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
27216bd2d47SAlan Somers 
2735fe58019SAttilio Rao struct fuse_entry_out {
2745fe58019SAttilio Rao 	__u64	nodeid;		/* Inode ID */
2755fe58019SAttilio Rao 	__u64	generation;	/* Inode generation: nodeid:gen must
2765fe58019SAttilio Rao 				   be unique for the fs's lifetime */
2775fe58019SAttilio Rao 	__u64	entry_valid;	/* Cache timeout for the name */
2785fe58019SAttilio Rao 	__u64	attr_valid;	/* Cache timeout for the attributes */
2795fe58019SAttilio Rao 	__u32	entry_valid_nsec;
2805fe58019SAttilio Rao 	__u32	attr_valid_nsec;
2815fe58019SAttilio Rao 	struct fuse_attr attr;
2825fe58019SAttilio Rao };
2835fe58019SAttilio Rao 
2845fe58019SAttilio Rao struct fuse_forget_in {
2855fe58019SAttilio Rao 	__u64	nlookup;
2865fe58019SAttilio Rao };
2875fe58019SAttilio Rao 
28816bd2d47SAlan Somers struct fuse_getattr_in {
28916bd2d47SAlan Somers 	__u32	getattr_flags;
29016bd2d47SAlan Somers 	__u32	dummy;
29116bd2d47SAlan Somers 	__u64	fh;
29216bd2d47SAlan Somers };
29316bd2d47SAlan Somers 
29416bd2d47SAlan Somers #define FUSE_COMPAT_ATTR_OUT_SIZE 96
29516bd2d47SAlan Somers 
2965fe58019SAttilio Rao struct fuse_attr_out {
2975fe58019SAttilio Rao 	__u64	attr_valid;	/* Cache timeout for the attributes */
2985fe58019SAttilio Rao 	__u32	attr_valid_nsec;
2995fe58019SAttilio Rao 	__u32	dummy;
3005fe58019SAttilio Rao 	struct fuse_attr attr;
3015fe58019SAttilio Rao };
3025fe58019SAttilio Rao 
3034cbb4f88SAlan Somers struct fuse_mknod_in {
3044cbb4f88SAlan Somers 	__u32	mode;
3054cbb4f88SAlan Somers 	__u32	rdev;
3064cbb4f88SAlan Somers };
3074cbb4f88SAlan Somers 
3085fe58019SAttilio Rao struct fuse_mkdir_in {
3095fe58019SAttilio Rao 	__u32	mode;
3105fe58019SAttilio Rao 	__u32	padding;
3115fe58019SAttilio Rao };
3125fe58019SAttilio Rao 
3135fe58019SAttilio Rao struct fuse_rename_in {
3145fe58019SAttilio Rao 	__u64	newdir;
3155fe58019SAttilio Rao };
3165fe58019SAttilio Rao 
3175fe58019SAttilio Rao struct fuse_link_in {
3185fe58019SAttilio Rao 	__u64	oldnodeid;
3195fe58019SAttilio Rao };
3205fe58019SAttilio Rao 
3215fe58019SAttilio Rao struct fuse_setattr_in {
3225fe58019SAttilio Rao 	__u32	valid;
3235fe58019SAttilio Rao 	__u32	padding;
3245fe58019SAttilio Rao 	__u64	fh;
3255fe58019SAttilio Rao 	__u64	size;
32616bd2d47SAlan Somers 	__u64	lock_owner;
3275fe58019SAttilio Rao 	__u64	atime;
3285fe58019SAttilio Rao 	__u64	mtime;
3295fe58019SAttilio Rao 	__u64	unused2;
3305fe58019SAttilio Rao 	__u32	atimensec;
3315fe58019SAttilio Rao 	__u32	mtimensec;
3325fe58019SAttilio Rao 	__u32	unused3;
3335fe58019SAttilio Rao 	__u32	mode;
3345fe58019SAttilio Rao 	__u32	unused4;
3355fe58019SAttilio Rao 	__u32	uid;
3365fe58019SAttilio Rao 	__u32	gid;
3375fe58019SAttilio Rao 	__u32	unused5;
3385fe58019SAttilio Rao };
3395fe58019SAttilio Rao 
3405fe58019SAttilio Rao struct fuse_open_in {
3415fe58019SAttilio Rao 	__u32	flags;
3425fe58019SAttilio Rao 	__u32	mode;
3435fe58019SAttilio Rao };
3445fe58019SAttilio Rao 
3455fe58019SAttilio Rao struct fuse_open_out {
3465fe58019SAttilio Rao 	__u64	fh;
3475fe58019SAttilio Rao 	__u32	open_flags;
3485fe58019SAttilio Rao 	__u32	padding;
3495fe58019SAttilio Rao };
3505fe58019SAttilio Rao 
3515fe58019SAttilio Rao struct fuse_release_in {
3525fe58019SAttilio Rao 	__u64	fh;
3535fe58019SAttilio Rao 	__u32	flags;
3545fe58019SAttilio Rao 	__u32	release_flags;
3555fe58019SAttilio Rao 	__u64	lock_owner;
3565fe58019SAttilio Rao };
3575fe58019SAttilio Rao 
3585fe58019SAttilio Rao struct fuse_flush_in {
3595fe58019SAttilio Rao 	__u64	fh;
3605fe58019SAttilio Rao 	__u32	unused;
3615fe58019SAttilio Rao 	__u32	padding;
3625fe58019SAttilio Rao 	__u64	lock_owner;
3635fe58019SAttilio Rao };
3645fe58019SAttilio Rao 
3655fe58019SAttilio Rao struct fuse_read_in {
3665fe58019SAttilio Rao 	__u64	fh;
3675fe58019SAttilio Rao 	__u64	offset;
3685fe58019SAttilio Rao 	__u32	size;
36916bd2d47SAlan Somers 	__u32	read_flags;
37016bd2d47SAlan Somers 	__u64	lock_owner;
37116bd2d47SAlan Somers 	__u32	flags;
3725fe58019SAttilio Rao 	__u32	padding;
3735fe58019SAttilio Rao };
3745fe58019SAttilio Rao 
37516bd2d47SAlan Somers #define FUSE_COMPAT_WRITE_IN_SIZE 24
37616bd2d47SAlan Somers 
3775fe58019SAttilio Rao struct fuse_write_in {
3785fe58019SAttilio Rao 	__u64	fh;
3795fe58019SAttilio Rao 	__u64	offset;
3805fe58019SAttilio Rao 	__u32	size;
3815fe58019SAttilio Rao 	__u32	write_flags;
38216bd2d47SAlan Somers 	__u64	lock_owner;
38316bd2d47SAlan Somers 	__u32	flags;
38416bd2d47SAlan Somers 	__u32	padding;
3855fe58019SAttilio Rao };
3865fe58019SAttilio Rao 
3875fe58019SAttilio Rao struct fuse_write_out {
3885fe58019SAttilio Rao 	__u32	size;
3895fe58019SAttilio Rao 	__u32	padding;
3905fe58019SAttilio Rao };
3915fe58019SAttilio Rao 
3925fe58019SAttilio Rao #define FUSE_COMPAT_STATFS_SIZE 48
3935fe58019SAttilio Rao 
3945fe58019SAttilio Rao struct fuse_statfs_out {
3955fe58019SAttilio Rao 	struct fuse_kstatfs st;
3965fe58019SAttilio Rao };
3975fe58019SAttilio Rao 
3985fe58019SAttilio Rao struct fuse_fsync_in {
3995fe58019SAttilio Rao 	__u64	fh;
4005fe58019SAttilio Rao 	__u32	fsync_flags;
4015fe58019SAttilio Rao 	__u32	padding;
4025fe58019SAttilio Rao };
4035fe58019SAttilio Rao 
40496192dfcSAlan Somers struct fuse_setxattr_in {
405493b4a8cSFedor Uporov 	__u32	size;
406493b4a8cSFedor Uporov 	__u32	flags;
407493b4a8cSFedor Uporov };
408493b4a8cSFedor Uporov 
40996192dfcSAlan Somers struct fuse_listxattr_in {
41096192dfcSAlan Somers 	__u32	size;
41196192dfcSAlan Somers 	__u32	padding;
41296192dfcSAlan Somers };
41396192dfcSAlan Somers 
414493b4a8cSFedor Uporov struct fuse_listxattr_out {
4155fe58019SAttilio Rao 	__u32	size;
41696192dfcSAlan Somers 	__u32	padding;
4175fe58019SAttilio Rao };
4185fe58019SAttilio Rao 
4195fe58019SAttilio Rao struct fuse_getxattr_in {
4205fe58019SAttilio Rao 	__u32	size;
4215fe58019SAttilio Rao 	__u32	padding;
4225fe58019SAttilio Rao };
4235fe58019SAttilio Rao 
4245fe58019SAttilio Rao struct fuse_getxattr_out {
4255fe58019SAttilio Rao 	__u32	size;
4265fe58019SAttilio Rao 	__u32	padding;
4275fe58019SAttilio Rao };
4285fe58019SAttilio Rao 
4295fe58019SAttilio Rao struct fuse_lk_in {
4305fe58019SAttilio Rao 	__u64	fh;
4315fe58019SAttilio Rao 	__u64	owner;
4325fe58019SAttilio Rao 	struct fuse_file_lock lk;
43316bd2d47SAlan Somers 	__u32	lk_flags;
43416bd2d47SAlan Somers 	__u32	padding;
4355fe58019SAttilio Rao };
4365fe58019SAttilio Rao 
4375fe58019SAttilio Rao struct fuse_lk_out {
4385fe58019SAttilio Rao 	struct fuse_file_lock lk;
4395fe58019SAttilio Rao };
4405fe58019SAttilio Rao 
4415fe58019SAttilio Rao struct fuse_access_in {
4425fe58019SAttilio Rao 	__u32	mask;
4435fe58019SAttilio Rao 	__u32	padding;
4445fe58019SAttilio Rao };
4455fe58019SAttilio Rao 
4465fe58019SAttilio Rao struct fuse_init_in {
4475fe58019SAttilio Rao 	__u32	major;
4485fe58019SAttilio Rao 	__u32	minor;
4495fe58019SAttilio Rao 	__u32	max_readahead;
4505fe58019SAttilio Rao 	__u32	flags;
4515fe58019SAttilio Rao };
4525fe58019SAttilio Rao 
4535fe58019SAttilio Rao struct fuse_init_out {
4545fe58019SAttilio Rao 	__u32	major;
4555fe58019SAttilio Rao 	__u32	minor;
4565fe58019SAttilio Rao 	__u32	max_readahead;
4575fe58019SAttilio Rao 	__u32	flags;
4585fe58019SAttilio Rao 	__u32	unused;
4595fe58019SAttilio Rao 	__u32	max_write;
4605fe58019SAttilio Rao };
4615fe58019SAttilio Rao 
462*9c62bc70SAlan Somers #ifdef linux
463*9c62bc70SAlan Somers #define CUSE_INIT_INFO_MAX 4096
464*9c62bc70SAlan Somers 
465*9c62bc70SAlan Somers struct cuse_init_in {
466*9c62bc70SAlan Somers 	__u32	major;
467*9c62bc70SAlan Somers 	__u32	minor;
468*9c62bc70SAlan Somers 	__u32	unused;
469*9c62bc70SAlan Somers 	__u32	flags;
470*9c62bc70SAlan Somers };
471*9c62bc70SAlan Somers 
472*9c62bc70SAlan Somers struct cuse_init_out {
473*9c62bc70SAlan Somers 	__u32	major;
474*9c62bc70SAlan Somers 	__u32	minor;
475*9c62bc70SAlan Somers 	__u32	unused;
476*9c62bc70SAlan Somers 	__u32	flags;
477*9c62bc70SAlan Somers 	__u32	max_read;
478*9c62bc70SAlan Somers 	__u32	max_write;
479*9c62bc70SAlan Somers 	__u32	dev_major;		/* chardev major */
480*9c62bc70SAlan Somers 	__u32	dev_minor;		/* chardev minor */
481*9c62bc70SAlan Somers 	__u32	spare[10];
482*9c62bc70SAlan Somers };
483*9c62bc70SAlan Somers #endif /* linux */
484*9c62bc70SAlan Somers 
4855fe58019SAttilio Rao struct fuse_interrupt_in {
4865fe58019SAttilio Rao 	__u64	unique;
4875fe58019SAttilio Rao };
4885fe58019SAttilio Rao 
4895fe58019SAttilio Rao struct fuse_bmap_in {
4905fe58019SAttilio Rao 	__u64	block;
4915fe58019SAttilio Rao 	__u32	blocksize;
4925fe58019SAttilio Rao 	__u32	padding;
4935fe58019SAttilio Rao };
4945fe58019SAttilio Rao 
4955fe58019SAttilio Rao struct fuse_bmap_out {
4965fe58019SAttilio Rao 	__u64	block;
4975fe58019SAttilio Rao };
4985fe58019SAttilio Rao 
499*9c62bc70SAlan Somers struct fuse_ioctl_in {
500*9c62bc70SAlan Somers 	__u64	fh;
501*9c62bc70SAlan Somers 	__u32	flags;
502*9c62bc70SAlan Somers 	__u32	cmd;
503*9c62bc70SAlan Somers 	__u64	arg;
504*9c62bc70SAlan Somers 	__u32	in_size;
505*9c62bc70SAlan Somers 	__u32	out_size;
506*9c62bc70SAlan Somers };
507*9c62bc70SAlan Somers 
508*9c62bc70SAlan Somers struct fuse_ioctl_out {
509*9c62bc70SAlan Somers 	__s32	result;
510*9c62bc70SAlan Somers 	__u32	flags;
511*9c62bc70SAlan Somers 	__u32	in_iovs;
512*9c62bc70SAlan Somers 	__u32	out_iovs;
513*9c62bc70SAlan Somers };
514*9c62bc70SAlan Somers 
515*9c62bc70SAlan Somers struct fuse_poll_in {
516*9c62bc70SAlan Somers 	__u64	fh;
517*9c62bc70SAlan Somers 	__u64	kh;
518*9c62bc70SAlan Somers 	__u32	flags;
519*9c62bc70SAlan Somers 	__u32   padding;
520*9c62bc70SAlan Somers };
521*9c62bc70SAlan Somers 
522*9c62bc70SAlan Somers struct fuse_poll_out {
523*9c62bc70SAlan Somers 	__u32	revents;
524*9c62bc70SAlan Somers 	__u32	padding;
525*9c62bc70SAlan Somers };
526*9c62bc70SAlan Somers 
527*9c62bc70SAlan Somers struct fuse_notify_poll_wakeup_out {
528*9c62bc70SAlan Somers 	__u64	kh;
529*9c62bc70SAlan Somers };
530*9c62bc70SAlan Somers 
5315fe58019SAttilio Rao struct fuse_in_header {
5325fe58019SAttilio Rao 	__u32	len;
5335fe58019SAttilio Rao 	__u32	opcode;
5345fe58019SAttilio Rao 	__u64	unique;
5355fe58019SAttilio Rao 	__u64	nodeid;
5365fe58019SAttilio Rao 	__u32	uid;
5375fe58019SAttilio Rao 	__u32	gid;
5385fe58019SAttilio Rao 	__u32	pid;
5395fe58019SAttilio Rao 	__u32	padding;
5405fe58019SAttilio Rao };
5415fe58019SAttilio Rao 
5425fe58019SAttilio Rao struct fuse_out_header {
5435fe58019SAttilio Rao 	__u32	len;
5445fe58019SAttilio Rao 	__s32	error;
5455fe58019SAttilio Rao 	__u64	unique;
5465fe58019SAttilio Rao };
5475fe58019SAttilio Rao 
5485fe58019SAttilio Rao struct fuse_dirent {
5495fe58019SAttilio Rao 	__u64	ino;
5505fe58019SAttilio Rao 	__u64	off;
5515fe58019SAttilio Rao 	__u32	namelen;
5525fe58019SAttilio Rao 	__u32	type;
5537d20a270SPedro F. Giffuni 	char name[0];
5545fe58019SAttilio Rao };
5555fe58019SAttilio Rao 
5565fe58019SAttilio Rao #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
5575fe58019SAttilio Rao #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
5585fe58019SAttilio Rao #define FUSE_DIRENT_SIZE(d) \
5595fe58019SAttilio Rao 	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
56016bd2d47SAlan Somers 
56116bd2d47SAlan Somers #endif /* _FUSE_FUSE_KERNEL_H */
562