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