xref: /aosp_15_r20/external/libfuse/include/fuse.h (revision 9e5649576b786774a32d7b0252c9cd8c6538fa49)
1*9e564957SAndroid Build Coastguard Worker /*
2*9e564957SAndroid Build Coastguard Worker   FUSE: Filesystem in Userspace
3*9e564957SAndroid Build Coastguard Worker   Copyright (C) 2001-2007  Miklos Szeredi <[email protected]>
4*9e564957SAndroid Build Coastguard Worker 
5*9e564957SAndroid Build Coastguard Worker   This program can be distributed under the terms of the GNU LGPLv2.
6*9e564957SAndroid Build Coastguard Worker   See the file COPYING.LIB.
7*9e564957SAndroid Build Coastguard Worker */
8*9e564957SAndroid Build Coastguard Worker 
9*9e564957SAndroid Build Coastguard Worker #ifndef FUSE_H_
10*9e564957SAndroid Build Coastguard Worker #define FUSE_H_
11*9e564957SAndroid Build Coastguard Worker 
12*9e564957SAndroid Build Coastguard Worker /** @file
13*9e564957SAndroid Build Coastguard Worker  *
14*9e564957SAndroid Build Coastguard Worker  * This file defines the library interface of FUSE
15*9e564957SAndroid Build Coastguard Worker  *
16*9e564957SAndroid Build Coastguard Worker  * IMPORTANT: you should define FUSE_USE_VERSION before including this header.
17*9e564957SAndroid Build Coastguard Worker  */
18*9e564957SAndroid Build Coastguard Worker 
19*9e564957SAndroid Build Coastguard Worker #include "fuse_common.h"
20*9e564957SAndroid Build Coastguard Worker 
21*9e564957SAndroid Build Coastguard Worker #include <fcntl.h>
22*9e564957SAndroid Build Coastguard Worker #include <time.h>
23*9e564957SAndroid Build Coastguard Worker #include <sys/types.h>
24*9e564957SAndroid Build Coastguard Worker #include <sys/stat.h>
25*9e564957SAndroid Build Coastguard Worker #include <sys/statvfs.h>
26*9e564957SAndroid Build Coastguard Worker #include <sys/uio.h>
27*9e564957SAndroid Build Coastguard Worker 
28*9e564957SAndroid Build Coastguard Worker #ifdef __cplusplus
29*9e564957SAndroid Build Coastguard Worker extern "C" {
30*9e564957SAndroid Build Coastguard Worker #endif
31*9e564957SAndroid Build Coastguard Worker 
32*9e564957SAndroid Build Coastguard Worker /* ----------------------------------------------------------- *
33*9e564957SAndroid Build Coastguard Worker  * Basic FUSE API					       *
34*9e564957SAndroid Build Coastguard Worker  * ----------------------------------------------------------- */
35*9e564957SAndroid Build Coastguard Worker 
36*9e564957SAndroid Build Coastguard Worker /** Handle for a FUSE filesystem */
37*9e564957SAndroid Build Coastguard Worker struct fuse;
38*9e564957SAndroid Build Coastguard Worker 
39*9e564957SAndroid Build Coastguard Worker /**
40*9e564957SAndroid Build Coastguard Worker  * Readdir flags, passed to ->readdir()
41*9e564957SAndroid Build Coastguard Worker  */
42*9e564957SAndroid Build Coastguard Worker enum fuse_readdir_flags {
43*9e564957SAndroid Build Coastguard Worker 	/**
44*9e564957SAndroid Build Coastguard Worker 	 * "Plus" mode.
45*9e564957SAndroid Build Coastguard Worker 	 *
46*9e564957SAndroid Build Coastguard Worker 	 * The kernel wants to prefill the inode cache during readdir.  The
47*9e564957SAndroid Build Coastguard Worker 	 * filesystem may honour this by filling in the attributes and setting
48*9e564957SAndroid Build Coastguard Worker 	 * FUSE_FILL_DIR_FLAGS for the filler function.  The filesystem may also
49*9e564957SAndroid Build Coastguard Worker 	 * just ignore this flag completely.
50*9e564957SAndroid Build Coastguard Worker 	 */
51*9e564957SAndroid Build Coastguard Worker 	FUSE_READDIR_DEFAULTS = 0,
52*9e564957SAndroid Build Coastguard Worker 	FUSE_READDIR_PLUS = (1 << 0)
53*9e564957SAndroid Build Coastguard Worker };
54*9e564957SAndroid Build Coastguard Worker 
55*9e564957SAndroid Build Coastguard Worker /**
56*9e564957SAndroid Build Coastguard Worker  * Readdir flags, passed to fuse_fill_dir_t callback.
57*9e564957SAndroid Build Coastguard Worker  */
58*9e564957SAndroid Build Coastguard Worker enum fuse_fill_dir_flags {
59*9e564957SAndroid Build Coastguard Worker 	/**
60*9e564957SAndroid Build Coastguard Worker 	 * "Plus" mode: all file attributes are valid
61*9e564957SAndroid Build Coastguard Worker 	 *
62*9e564957SAndroid Build Coastguard Worker 	 * The attributes are used by the kernel to prefill the inode cache
63*9e564957SAndroid Build Coastguard Worker 	 * during a readdir.
64*9e564957SAndroid Build Coastguard Worker 	 *
65*9e564957SAndroid Build Coastguard Worker 	 * It is okay to set FUSE_FILL_DIR_PLUS if FUSE_READDIR_PLUS is not set
66*9e564957SAndroid Build Coastguard Worker 	 * and vice versa.
67*9e564957SAndroid Build Coastguard Worker 	 */
68*9e564957SAndroid Build Coastguard Worker 	FUSE_FILL_DIR_DEFAULTS = 0,
69*9e564957SAndroid Build Coastguard Worker 	FUSE_FILL_DIR_PLUS = (1 << 1)
70*9e564957SAndroid Build Coastguard Worker };
71*9e564957SAndroid Build Coastguard Worker 
72*9e564957SAndroid Build Coastguard Worker /** Function to add an entry in a readdir() operation
73*9e564957SAndroid Build Coastguard Worker  *
74*9e564957SAndroid Build Coastguard Worker  * The *off* parameter can be any non-zero value that enables the
75*9e564957SAndroid Build Coastguard Worker  * filesystem to identify the current point in the directory
76*9e564957SAndroid Build Coastguard Worker  * stream. It does not need to be the actual physical position. A
77*9e564957SAndroid Build Coastguard Worker  * value of zero is reserved to indicate that seeking in directories
78*9e564957SAndroid Build Coastguard Worker  * is not supported.
79*9e564957SAndroid Build Coastguard Worker  *
80*9e564957SAndroid Build Coastguard Worker  * @param buf the buffer passed to the readdir() operation
81*9e564957SAndroid Build Coastguard Worker  * @param name the file name of the directory entry
82*9e564957SAndroid Build Coastguard Worker  * @param stbuf file attributes, can be NULL
83*9e564957SAndroid Build Coastguard Worker  * @param off offset of the next entry or zero
84*9e564957SAndroid Build Coastguard Worker  * @param flags fill flags
85*9e564957SAndroid Build Coastguard Worker  * @return 1 if buffer is full, zero otherwise
86*9e564957SAndroid Build Coastguard Worker  */
87*9e564957SAndroid Build Coastguard Worker typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
88*9e564957SAndroid Build Coastguard Worker 				const struct stat *stbuf, off_t off,
89*9e564957SAndroid Build Coastguard Worker 				enum fuse_fill_dir_flags flags);
90*9e564957SAndroid Build Coastguard Worker /**
91*9e564957SAndroid Build Coastguard Worker  * Configuration of the high-level API
92*9e564957SAndroid Build Coastguard Worker  *
93*9e564957SAndroid Build Coastguard Worker  * This structure is initialized from the arguments passed to
94*9e564957SAndroid Build Coastguard Worker  * fuse_new(), and then passed to the file system's init() handler
95*9e564957SAndroid Build Coastguard Worker  * which should ensure that the configuration is compatible with the
96*9e564957SAndroid Build Coastguard Worker  * file system implementation.
97*9e564957SAndroid Build Coastguard Worker  */
98*9e564957SAndroid Build Coastguard Worker struct fuse_config {
99*9e564957SAndroid Build Coastguard Worker 	/**
100*9e564957SAndroid Build Coastguard Worker 	 * If `set_gid` is non-zero, the st_gid attribute of each file
101*9e564957SAndroid Build Coastguard Worker 	 * is overwritten with the value of `gid`.
102*9e564957SAndroid Build Coastguard Worker 	 */
103*9e564957SAndroid Build Coastguard Worker 	int set_gid;
104*9e564957SAndroid Build Coastguard Worker 	unsigned int gid;
105*9e564957SAndroid Build Coastguard Worker 
106*9e564957SAndroid Build Coastguard Worker 	/**
107*9e564957SAndroid Build Coastguard Worker 	 * If `set_uid` is non-zero, the st_uid attribute of each file
108*9e564957SAndroid Build Coastguard Worker 	 * is overwritten with the value of `uid`.
109*9e564957SAndroid Build Coastguard Worker 	 */
110*9e564957SAndroid Build Coastguard Worker 	int set_uid;
111*9e564957SAndroid Build Coastguard Worker 	unsigned int uid;
112*9e564957SAndroid Build Coastguard Worker 
113*9e564957SAndroid Build Coastguard Worker 	/**
114*9e564957SAndroid Build Coastguard Worker 	 * If `set_mode` is non-zero, the any permissions bits set in
115*9e564957SAndroid Build Coastguard Worker 	 * `umask` are unset in the st_mode attribute of each file.
116*9e564957SAndroid Build Coastguard Worker 	 */
117*9e564957SAndroid Build Coastguard Worker 	int set_mode;
118*9e564957SAndroid Build Coastguard Worker 	unsigned int umask;
119*9e564957SAndroid Build Coastguard Worker 
120*9e564957SAndroid Build Coastguard Worker 	/**
121*9e564957SAndroid Build Coastguard Worker 	 * The timeout in seconds for which name lookups will be
122*9e564957SAndroid Build Coastguard Worker 	 * cached.
123*9e564957SAndroid Build Coastguard Worker 	 */
124*9e564957SAndroid Build Coastguard Worker 	double entry_timeout;
125*9e564957SAndroid Build Coastguard Worker 
126*9e564957SAndroid Build Coastguard Worker 	/**
127*9e564957SAndroid Build Coastguard Worker 	 * The timeout in seconds for which a negative lookup will be
128*9e564957SAndroid Build Coastguard Worker 	 * cached. This means, that if file did not exist (lookup
129*9e564957SAndroid Build Coastguard Worker 	 * returned ENOENT), the lookup will only be redone after the
130*9e564957SAndroid Build Coastguard Worker 	 * timeout, and the file/directory will be assumed to not
131*9e564957SAndroid Build Coastguard Worker 	 * exist until then. A value of zero means that negative
132*9e564957SAndroid Build Coastguard Worker 	 * lookups are not cached.
133*9e564957SAndroid Build Coastguard Worker 	 */
134*9e564957SAndroid Build Coastguard Worker 	double negative_timeout;
135*9e564957SAndroid Build Coastguard Worker 
136*9e564957SAndroid Build Coastguard Worker 	/**
137*9e564957SAndroid Build Coastguard Worker 	 * The timeout in seconds for which file/directory attributes
138*9e564957SAndroid Build Coastguard Worker 	 * (as returned by e.g. the `getattr` handler) are cached.
139*9e564957SAndroid Build Coastguard Worker 	 */
140*9e564957SAndroid Build Coastguard Worker 	double attr_timeout;
141*9e564957SAndroid Build Coastguard Worker 
142*9e564957SAndroid Build Coastguard Worker 	/**
143*9e564957SAndroid Build Coastguard Worker 	 * Allow requests to be interrupted
144*9e564957SAndroid Build Coastguard Worker 	 */
145*9e564957SAndroid Build Coastguard Worker 	int intr;
146*9e564957SAndroid Build Coastguard Worker 
147*9e564957SAndroid Build Coastguard Worker 	/**
148*9e564957SAndroid Build Coastguard Worker 	 * Specify which signal number to send to the filesystem when
149*9e564957SAndroid Build Coastguard Worker 	 * a request is interrupted.  The default is hardcoded to
150*9e564957SAndroid Build Coastguard Worker 	 * USR1.
151*9e564957SAndroid Build Coastguard Worker 	 */
152*9e564957SAndroid Build Coastguard Worker 	int intr_signal;
153*9e564957SAndroid Build Coastguard Worker 
154*9e564957SAndroid Build Coastguard Worker 	/**
155*9e564957SAndroid Build Coastguard Worker 	 * Normally, FUSE assigns inodes to paths only for as long as
156*9e564957SAndroid Build Coastguard Worker 	 * the kernel is aware of them. With this option inodes are
157*9e564957SAndroid Build Coastguard Worker 	 * instead remembered for at least this many seconds.  This
158*9e564957SAndroid Build Coastguard Worker 	 * will require more memory, but may be necessary when using
159*9e564957SAndroid Build Coastguard Worker 	 * applications that make use of inode numbers.
160*9e564957SAndroid Build Coastguard Worker 	 *
161*9e564957SAndroid Build Coastguard Worker 	 * A number of -1 means that inodes will be remembered for the
162*9e564957SAndroid Build Coastguard Worker 	 * entire life-time of the file-system process.
163*9e564957SAndroid Build Coastguard Worker 	 */
164*9e564957SAndroid Build Coastguard Worker 	int remember;
165*9e564957SAndroid Build Coastguard Worker 
166*9e564957SAndroid Build Coastguard Worker 	/**
167*9e564957SAndroid Build Coastguard Worker 	 * The default behavior is that if an open file is deleted,
168*9e564957SAndroid Build Coastguard Worker 	 * the file is renamed to a hidden file (.fuse_hiddenXXX), and
169*9e564957SAndroid Build Coastguard Worker 	 * only removed when the file is finally released.  This
170*9e564957SAndroid Build Coastguard Worker 	 * relieves the filesystem implementation of having to deal
171*9e564957SAndroid Build Coastguard Worker 	 * with this problem. This option disables the hiding
172*9e564957SAndroid Build Coastguard Worker 	 * behavior, and files are removed immediately in an unlink
173*9e564957SAndroid Build Coastguard Worker 	 * operation (or in a rename operation which overwrites an
174*9e564957SAndroid Build Coastguard Worker 	 * existing file).
175*9e564957SAndroid Build Coastguard Worker 	 *
176*9e564957SAndroid Build Coastguard Worker 	 * It is recommended that you not use the hard_remove
177*9e564957SAndroid Build Coastguard Worker 	 * option. When hard_remove is set, the following libc
178*9e564957SAndroid Build Coastguard Worker 	 * functions fail on unlinked files (returning errno of
179*9e564957SAndroid Build Coastguard Worker 	 * ENOENT): read(2), write(2), fsync(2), close(2), f*xattr(2),
180*9e564957SAndroid Build Coastguard Worker 	 * ftruncate(2), fstat(2), fchmod(2), fchown(2)
181*9e564957SAndroid Build Coastguard Worker 	 */
182*9e564957SAndroid Build Coastguard Worker 	int hard_remove;
183*9e564957SAndroid Build Coastguard Worker 
184*9e564957SAndroid Build Coastguard Worker 	/**
185*9e564957SAndroid Build Coastguard Worker 	 * Honor the st_ino field in the functions getattr() and
186*9e564957SAndroid Build Coastguard Worker 	 * fill_dir(). This value is used to fill in the st_ino field
187*9e564957SAndroid Build Coastguard Worker 	 * in the stat(2), lstat(2), fstat(2) functions and the d_ino
188*9e564957SAndroid Build Coastguard Worker 	 * field in the readdir(2) function. The filesystem does not
189*9e564957SAndroid Build Coastguard Worker 	 * have to guarantee uniqueness, however some applications
190*9e564957SAndroid Build Coastguard Worker 	 * rely on this value being unique for the whole filesystem.
191*9e564957SAndroid Build Coastguard Worker 	 *
192*9e564957SAndroid Build Coastguard Worker 	 * Note that this does *not* affect the inode that libfuse
193*9e564957SAndroid Build Coastguard Worker 	 * and the kernel use internally (also called the "nodeid").
194*9e564957SAndroid Build Coastguard Worker 	 */
195*9e564957SAndroid Build Coastguard Worker 	int use_ino;
196*9e564957SAndroid Build Coastguard Worker 
197*9e564957SAndroid Build Coastguard Worker 	/**
198*9e564957SAndroid Build Coastguard Worker 	 * If use_ino option is not given, still try to fill in the
199*9e564957SAndroid Build Coastguard Worker 	 * d_ino field in readdir(2). If the name was previously
200*9e564957SAndroid Build Coastguard Worker 	 * looked up, and is still in the cache, the inode number
201*9e564957SAndroid Build Coastguard Worker 	 * found there will be used.  Otherwise it will be set to -1.
202*9e564957SAndroid Build Coastguard Worker 	 * If use_ino option is given, this option is ignored.
203*9e564957SAndroid Build Coastguard Worker 	 */
204*9e564957SAndroid Build Coastguard Worker 	int readdir_ino;
205*9e564957SAndroid Build Coastguard Worker 
206*9e564957SAndroid Build Coastguard Worker 	/**
207*9e564957SAndroid Build Coastguard Worker 	 * This option disables the use of page cache (file content cache)
208*9e564957SAndroid Build Coastguard Worker 	 * in the kernel for this filesystem. This has several affects:
209*9e564957SAndroid Build Coastguard Worker 	 *
210*9e564957SAndroid Build Coastguard Worker 	 * 1. Each read(2) or write(2) system call will initiate one
211*9e564957SAndroid Build Coastguard Worker 	 *    or more read or write operations, data will not be
212*9e564957SAndroid Build Coastguard Worker 	 *    cached in the kernel.
213*9e564957SAndroid Build Coastguard Worker 	 *
214*9e564957SAndroid Build Coastguard Worker 	 * 2. The return value of the read() and write() system calls
215*9e564957SAndroid Build Coastguard Worker 	 *    will correspond to the return values of the read and
216*9e564957SAndroid Build Coastguard Worker 	 *    write operations. This is useful for example if the
217*9e564957SAndroid Build Coastguard Worker 	 *    file size is not known in advance (before reading it).
218*9e564957SAndroid Build Coastguard Worker 	 *
219*9e564957SAndroid Build Coastguard Worker 	 * Internally, enabling this option causes fuse to set the
220*9e564957SAndroid Build Coastguard Worker 	 * `direct_io` field of `struct fuse_file_info` - overwriting
221*9e564957SAndroid Build Coastguard Worker 	 * any value that was put there by the file system.
222*9e564957SAndroid Build Coastguard Worker 	 */
223*9e564957SAndroid Build Coastguard Worker 	int direct_io;
224*9e564957SAndroid Build Coastguard Worker 
225*9e564957SAndroid Build Coastguard Worker 	/**
226*9e564957SAndroid Build Coastguard Worker 	 * This option disables flushing the cache of the file
227*9e564957SAndroid Build Coastguard Worker 	 * contents on every open(2).  This should only be enabled on
228*9e564957SAndroid Build Coastguard Worker 	 * filesystems where the file data is never changed
229*9e564957SAndroid Build Coastguard Worker 	 * externally (not through the mounted FUSE filesystem).  Thus
230*9e564957SAndroid Build Coastguard Worker 	 * it is not suitable for network filesystems and other
231*9e564957SAndroid Build Coastguard Worker 	 * intermediate filesystems.
232*9e564957SAndroid Build Coastguard Worker 	 *
233*9e564957SAndroid Build Coastguard Worker 	 * NOTE: if this option is not specified (and neither
234*9e564957SAndroid Build Coastguard Worker 	 * direct_io) data is still cached after the open(2), so a
235*9e564957SAndroid Build Coastguard Worker 	 * read(2) system call will not always initiate a read
236*9e564957SAndroid Build Coastguard Worker 	 * operation.
237*9e564957SAndroid Build Coastguard Worker 	 *
238*9e564957SAndroid Build Coastguard Worker 	 * Internally, enabling this option causes fuse to set the
239*9e564957SAndroid Build Coastguard Worker 	 * `keep_cache` field of `struct fuse_file_info` - overwriting
240*9e564957SAndroid Build Coastguard Worker 	 * any value that was put there by the file system.
241*9e564957SAndroid Build Coastguard Worker 	 */
242*9e564957SAndroid Build Coastguard Worker 	int kernel_cache;
243*9e564957SAndroid Build Coastguard Worker 
244*9e564957SAndroid Build Coastguard Worker 	/**
245*9e564957SAndroid Build Coastguard Worker 	 * This option is an alternative to `kernel_cache`. Instead of
246*9e564957SAndroid Build Coastguard Worker 	 * unconditionally keeping cached data, the cached data is
247*9e564957SAndroid Build Coastguard Worker 	 * invalidated on open(2) if if the modification time or the
248*9e564957SAndroid Build Coastguard Worker 	 * size of the file has changed since it was last opened.
249*9e564957SAndroid Build Coastguard Worker 	 */
250*9e564957SAndroid Build Coastguard Worker 	int auto_cache;
251*9e564957SAndroid Build Coastguard Worker 
252*9e564957SAndroid Build Coastguard Worker 	/**
253*9e564957SAndroid Build Coastguard Worker 	 * By default, fuse waits for all pending writes to complete
254*9e564957SAndroid Build Coastguard Worker 	 * and calls the FLUSH operation on close(2) of every fuse fd.
255*9e564957SAndroid Build Coastguard Worker 	 * With this option, wait and FLUSH are not done for read-only
256*9e564957SAndroid Build Coastguard Worker 	 * fuse fd, similar to the behavior of NFS/SMB clients.
257*9e564957SAndroid Build Coastguard Worker 	 */
258*9e564957SAndroid Build Coastguard Worker 	int no_rofd_flush;
259*9e564957SAndroid Build Coastguard Worker 
260*9e564957SAndroid Build Coastguard Worker 	/**
261*9e564957SAndroid Build Coastguard Worker 	 * The timeout in seconds for which file attributes are cached
262*9e564957SAndroid Build Coastguard Worker 	 * for the purpose of checking if auto_cache should flush the
263*9e564957SAndroid Build Coastguard Worker 	 * file data on open.
264*9e564957SAndroid Build Coastguard Worker 	 */
265*9e564957SAndroid Build Coastguard Worker 	int ac_attr_timeout_set;
266*9e564957SAndroid Build Coastguard Worker 	double ac_attr_timeout;
267*9e564957SAndroid Build Coastguard Worker 
268*9e564957SAndroid Build Coastguard Worker 	/**
269*9e564957SAndroid Build Coastguard Worker 	 * If this option is given the file-system handlers for the
270*9e564957SAndroid Build Coastguard Worker 	 * following operations will not receive path information:
271*9e564957SAndroid Build Coastguard Worker 	 * read, write, flush, release, fallocate, fsync, readdir,
272*9e564957SAndroid Build Coastguard Worker 	 * releasedir, fsyncdir, lock, ioctl and poll.
273*9e564957SAndroid Build Coastguard Worker 	 *
274*9e564957SAndroid Build Coastguard Worker 	 * For the truncate, getattr, chmod, chown and utimens
275*9e564957SAndroid Build Coastguard Worker 	 * operations the path will be provided only if the struct
276*9e564957SAndroid Build Coastguard Worker 	 * fuse_file_info argument is NULL.
277*9e564957SAndroid Build Coastguard Worker 	 */
278*9e564957SAndroid Build Coastguard Worker 	int nullpath_ok;
279*9e564957SAndroid Build Coastguard Worker 	/**
280*9e564957SAndroid Build Coastguard Worker 	 *  Allow parallel direct-io writes to operate on the same file.
281*9e564957SAndroid Build Coastguard Worker 	 *
282*9e564957SAndroid Build Coastguard Worker 	 *  FUSE implementations which do not handle parallel writes on
283*9e564957SAndroid Build Coastguard Worker 	 *  same file/region should NOT enable this option at all as it
284*9e564957SAndroid Build Coastguard Worker 	 *  might lead to data inconsistencies.
285*9e564957SAndroid Build Coastguard Worker 	 *
286*9e564957SAndroid Build Coastguard Worker 	 *  For the FUSE implementations which have their own mechanism
287*9e564957SAndroid Build Coastguard Worker 	 *  of cache/data integrity are beneficiaries of this setting as
288*9e564957SAndroid Build Coastguard Worker 	 *  it now open doors to parallel writes on the same file (without
289*9e564957SAndroid Build Coastguard Worker 	 *  enabling this setting, all direct writes on the same file are
290*9e564957SAndroid Build Coastguard Worker 	 *  serialized, resulting in huge data bandwidth loss).
291*9e564957SAndroid Build Coastguard Worker 	 */
292*9e564957SAndroid Build Coastguard Worker 	int parallel_direct_writes;
293*9e564957SAndroid Build Coastguard Worker 
294*9e564957SAndroid Build Coastguard Worker 	/**
295*9e564957SAndroid Build Coastguard Worker 	 * The remaining options are used by libfuse internally and
296*9e564957SAndroid Build Coastguard Worker 	 * should not be touched.
297*9e564957SAndroid Build Coastguard Worker 	 */
298*9e564957SAndroid Build Coastguard Worker 	int show_help;
299*9e564957SAndroid Build Coastguard Worker 	char *modules;
300*9e564957SAndroid Build Coastguard Worker 	int debug;
301*9e564957SAndroid Build Coastguard Worker };
302*9e564957SAndroid Build Coastguard Worker 
303*9e564957SAndroid Build Coastguard Worker 
304*9e564957SAndroid Build Coastguard Worker /**
305*9e564957SAndroid Build Coastguard Worker  * The file system operations:
306*9e564957SAndroid Build Coastguard Worker  *
307*9e564957SAndroid Build Coastguard Worker  * Most of these should work very similarly to the well known UNIX
308*9e564957SAndroid Build Coastguard Worker  * file system operations.  A major exception is that instead of
309*9e564957SAndroid Build Coastguard Worker  * returning an error in 'errno', the operation should return the
310*9e564957SAndroid Build Coastguard Worker  * negated error value (-errno) directly.
311*9e564957SAndroid Build Coastguard Worker  *
312*9e564957SAndroid Build Coastguard Worker  * All methods are optional, but some are essential for a useful
313*9e564957SAndroid Build Coastguard Worker  * filesystem (e.g. getattr).  Open, flush, release, fsync, opendir,
314*9e564957SAndroid Build Coastguard Worker  * releasedir, fsyncdir, access, create, truncate, lock, init and
315*9e564957SAndroid Build Coastguard Worker  * destroy are special purpose methods, without which a full featured
316*9e564957SAndroid Build Coastguard Worker  * filesystem can still be implemented.
317*9e564957SAndroid Build Coastguard Worker  *
318*9e564957SAndroid Build Coastguard Worker  * In general, all methods are expected to perform any necessary
319*9e564957SAndroid Build Coastguard Worker  * permission checking. However, a filesystem may delegate this task
320*9e564957SAndroid Build Coastguard Worker  * to the kernel by passing the `default_permissions` mount option to
321*9e564957SAndroid Build Coastguard Worker  * `fuse_new()`. In this case, methods will only be called if
322*9e564957SAndroid Build Coastguard Worker  * the kernel's permission check has succeeded.
323*9e564957SAndroid Build Coastguard Worker  *
324*9e564957SAndroid Build Coastguard Worker  * Almost all operations take a path which can be of any length.
325*9e564957SAndroid Build Coastguard Worker  */
326*9e564957SAndroid Build Coastguard Worker struct fuse_operations {
327*9e564957SAndroid Build Coastguard Worker 	/** Get file attributes.
328*9e564957SAndroid Build Coastguard Worker 	 *
329*9e564957SAndroid Build Coastguard Worker 	 * Similar to stat().  The 'st_dev' and 'st_blksize' fields are
330*9e564957SAndroid Build Coastguard Worker 	 * ignored. The 'st_ino' field is ignored except if the 'use_ino'
331*9e564957SAndroid Build Coastguard Worker 	 * mount option is given. In that case it is passed to userspace,
332*9e564957SAndroid Build Coastguard Worker 	 * but libfuse and the kernel will still assign a different
333*9e564957SAndroid Build Coastguard Worker 	 * inode for internal use (called the "nodeid").
334*9e564957SAndroid Build Coastguard Worker 	 *
335*9e564957SAndroid Build Coastguard Worker 	 * `fi` will always be NULL if the file is not currently open, but
336*9e564957SAndroid Build Coastguard Worker 	 * may also be NULL if the file is open.
337*9e564957SAndroid Build Coastguard Worker 	 */
338*9e564957SAndroid Build Coastguard Worker 	int (*getattr) (const char *, struct stat *, struct fuse_file_info *fi);
339*9e564957SAndroid Build Coastguard Worker 
340*9e564957SAndroid Build Coastguard Worker 	/** Read the target of a symbolic link
341*9e564957SAndroid Build Coastguard Worker 	 *
342*9e564957SAndroid Build Coastguard Worker 	 * The buffer should be filled with a null terminated string.  The
343*9e564957SAndroid Build Coastguard Worker 	 * buffer size argument includes the space for the terminating
344*9e564957SAndroid Build Coastguard Worker 	 * null character.	If the linkname is too long to fit in the
345*9e564957SAndroid Build Coastguard Worker 	 * buffer, it should be truncated.	The return value should be 0
346*9e564957SAndroid Build Coastguard Worker 	 * for success.
347*9e564957SAndroid Build Coastguard Worker 	 */
348*9e564957SAndroid Build Coastguard Worker 	int (*readlink) (const char *, char *, size_t);
349*9e564957SAndroid Build Coastguard Worker 
350*9e564957SAndroid Build Coastguard Worker 	/** Create a file node
351*9e564957SAndroid Build Coastguard Worker 	 *
352*9e564957SAndroid Build Coastguard Worker 	 * This is called for creation of all non-directory, non-symlink
353*9e564957SAndroid Build Coastguard Worker 	 * nodes.  If the filesystem defines a create() method, then for
354*9e564957SAndroid Build Coastguard Worker 	 * regular files that will be called instead.
355*9e564957SAndroid Build Coastguard Worker 	 */
356*9e564957SAndroid Build Coastguard Worker 	int (*mknod) (const char *, mode_t, dev_t);
357*9e564957SAndroid Build Coastguard Worker 
358*9e564957SAndroid Build Coastguard Worker 	/** Create a directory
359*9e564957SAndroid Build Coastguard Worker 	 *
360*9e564957SAndroid Build Coastguard Worker 	 * Note that the mode argument may not have the type specification
361*9e564957SAndroid Build Coastguard Worker 	 * bits set, i.e. S_ISDIR(mode) can be false.  To obtain the
362*9e564957SAndroid Build Coastguard Worker 	 * correct directory type bits use  mode|S_IFDIR
363*9e564957SAndroid Build Coastguard Worker 	 * */
364*9e564957SAndroid Build Coastguard Worker 	int (*mkdir) (const char *, mode_t);
365*9e564957SAndroid Build Coastguard Worker 
366*9e564957SAndroid Build Coastguard Worker 	/** Remove a file */
367*9e564957SAndroid Build Coastguard Worker 	int (*unlink) (const char *);
368*9e564957SAndroid Build Coastguard Worker 
369*9e564957SAndroid Build Coastguard Worker 	/** Remove a directory */
370*9e564957SAndroid Build Coastguard Worker 	int (*rmdir) (const char *);
371*9e564957SAndroid Build Coastguard Worker 
372*9e564957SAndroid Build Coastguard Worker 	/** Create a symbolic link */
373*9e564957SAndroid Build Coastguard Worker 	int (*symlink) (const char *, const char *);
374*9e564957SAndroid Build Coastguard Worker 
375*9e564957SAndroid Build Coastguard Worker 	/** Rename a file
376*9e564957SAndroid Build Coastguard Worker 	 *
377*9e564957SAndroid Build Coastguard Worker 	 * *flags* may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If
378*9e564957SAndroid Build Coastguard Worker 	 * RENAME_NOREPLACE is specified, the filesystem must not
379*9e564957SAndroid Build Coastguard Worker 	 * overwrite *newname* if it exists and return an error
380*9e564957SAndroid Build Coastguard Worker 	 * instead. If `RENAME_EXCHANGE` is specified, the filesystem
381*9e564957SAndroid Build Coastguard Worker 	 * must atomically exchange the two files, i.e. both must
382*9e564957SAndroid Build Coastguard Worker 	 * exist and neither may be deleted.
383*9e564957SAndroid Build Coastguard Worker 	 */
384*9e564957SAndroid Build Coastguard Worker 	int (*rename) (const char *, const char *, unsigned int flags);
385*9e564957SAndroid Build Coastguard Worker 
386*9e564957SAndroid Build Coastguard Worker 	/** Create a hard link to a file */
387*9e564957SAndroid Build Coastguard Worker 	int (*link) (const char *, const char *);
388*9e564957SAndroid Build Coastguard Worker 
389*9e564957SAndroid Build Coastguard Worker 	/** Change the permission bits of a file
390*9e564957SAndroid Build Coastguard Worker 	 *
391*9e564957SAndroid Build Coastguard Worker 	 * `fi` will always be NULL if the file is not currently open, but
392*9e564957SAndroid Build Coastguard Worker 	 * may also be NULL if the file is open.
393*9e564957SAndroid Build Coastguard Worker 	 */
394*9e564957SAndroid Build Coastguard Worker 	int (*chmod) (const char *, mode_t, struct fuse_file_info *fi);
395*9e564957SAndroid Build Coastguard Worker 
396*9e564957SAndroid Build Coastguard Worker 	/** Change the owner and group of a file
397*9e564957SAndroid Build Coastguard Worker 	 *
398*9e564957SAndroid Build Coastguard Worker 	 * `fi` will always be NULL if the file is not currently open, but
399*9e564957SAndroid Build Coastguard Worker 	 * may also be NULL if the file is open.
400*9e564957SAndroid Build Coastguard Worker 	 *
401*9e564957SAndroid Build Coastguard Worker 	 * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
402*9e564957SAndroid Build Coastguard Worker 	 * expected to reset the setuid and setgid bits.
403*9e564957SAndroid Build Coastguard Worker 	 */
404*9e564957SAndroid Build Coastguard Worker 	int (*chown) (const char *, uid_t, gid_t, struct fuse_file_info *fi);
405*9e564957SAndroid Build Coastguard Worker 
406*9e564957SAndroid Build Coastguard Worker 	/** Change the size of a file
407*9e564957SAndroid Build Coastguard Worker 	 *
408*9e564957SAndroid Build Coastguard Worker 	 * `fi` will always be NULL if the file is not currently open, but
409*9e564957SAndroid Build Coastguard Worker 	 * may also be NULL if the file is open.
410*9e564957SAndroid Build Coastguard Worker 	 *
411*9e564957SAndroid Build Coastguard Worker 	 * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
412*9e564957SAndroid Build Coastguard Worker 	 * expected to reset the setuid and setgid bits.
413*9e564957SAndroid Build Coastguard Worker 	 */
414*9e564957SAndroid Build Coastguard Worker 	int (*truncate) (const char *, off_t, struct fuse_file_info *fi);
415*9e564957SAndroid Build Coastguard Worker 
416*9e564957SAndroid Build Coastguard Worker 	/** Open a file
417*9e564957SAndroid Build Coastguard Worker 	 *
418*9e564957SAndroid Build Coastguard Worker 	 * Open flags are available in fi->flags. The following rules
419*9e564957SAndroid Build Coastguard Worker 	 * apply.
420*9e564957SAndroid Build Coastguard Worker 	 *
421*9e564957SAndroid Build Coastguard Worker 	 *  - Creation (O_CREAT, O_EXCL, O_NOCTTY) flags will be
422*9e564957SAndroid Build Coastguard Worker 	 *    filtered out / handled by the kernel.
423*9e564957SAndroid Build Coastguard Worker 	 *
424*9e564957SAndroid Build Coastguard Worker 	 *  - Access modes (O_RDONLY, O_WRONLY, O_RDWR, O_EXEC, O_SEARCH)
425*9e564957SAndroid Build Coastguard Worker 	 *    should be used by the filesystem to check if the operation is
426*9e564957SAndroid Build Coastguard Worker 	 *    permitted.  If the ``-o default_permissions`` mount option is
427*9e564957SAndroid Build Coastguard Worker 	 *    given, this check is already done by the kernel before calling
428*9e564957SAndroid Build Coastguard Worker 	 *    open() and may thus be omitted by the filesystem.
429*9e564957SAndroid Build Coastguard Worker 	 *
430*9e564957SAndroid Build Coastguard Worker 	 *  - When writeback caching is enabled, the kernel may send
431*9e564957SAndroid Build Coastguard Worker 	 *    read requests even for files opened with O_WRONLY. The
432*9e564957SAndroid Build Coastguard Worker 	 *    filesystem should be prepared to handle this.
433*9e564957SAndroid Build Coastguard Worker 	 *
434*9e564957SAndroid Build Coastguard Worker 	 *  - When writeback caching is disabled, the filesystem is
435*9e564957SAndroid Build Coastguard Worker 	 *    expected to properly handle the O_APPEND flag and ensure
436*9e564957SAndroid Build Coastguard Worker 	 *    that each write is appending to the end of the file.
437*9e564957SAndroid Build Coastguard Worker 	 *
438*9e564957SAndroid Build Coastguard Worker 	 *  - When writeback caching is enabled, the kernel will
439*9e564957SAndroid Build Coastguard Worker 	 *    handle O_APPEND. However, unless all changes to the file
440*9e564957SAndroid Build Coastguard Worker 	 *    come through the kernel this will not work reliably. The
441*9e564957SAndroid Build Coastguard Worker 	 *    filesystem should thus either ignore the O_APPEND flag
442*9e564957SAndroid Build Coastguard Worker 	 *    (and let the kernel handle it), or return an error
443*9e564957SAndroid Build Coastguard Worker 	 *    (indicating that reliably O_APPEND is not available).
444*9e564957SAndroid Build Coastguard Worker 	 *
445*9e564957SAndroid Build Coastguard Worker 	 * Filesystem may store an arbitrary file handle (pointer,
446*9e564957SAndroid Build Coastguard Worker 	 * index, etc) in fi->fh, and use this in other all other file
447*9e564957SAndroid Build Coastguard Worker 	 * operations (read, write, flush, release, fsync).
448*9e564957SAndroid Build Coastguard Worker 	 *
449*9e564957SAndroid Build Coastguard Worker 	 * Filesystem may also implement stateless file I/O and not store
450*9e564957SAndroid Build Coastguard Worker 	 * anything in fi->fh.
451*9e564957SAndroid Build Coastguard Worker 	 *
452*9e564957SAndroid Build Coastguard Worker 	 * There are also some flags (direct_io, keep_cache) which the
453*9e564957SAndroid Build Coastguard Worker 	 * filesystem may set in fi, to change the way the file is opened.
454*9e564957SAndroid Build Coastguard Worker 	 * See fuse_file_info structure in <fuse_common.h> for more details.
455*9e564957SAndroid Build Coastguard Worker 	 *
456*9e564957SAndroid Build Coastguard Worker 	 * If this request is answered with an error code of ENOSYS
457*9e564957SAndroid Build Coastguard Worker 	 * and FUSE_CAP_NO_OPEN_SUPPORT is set in
458*9e564957SAndroid Build Coastguard Worker 	 * `fuse_conn_info.capable`, this is treated as success and
459*9e564957SAndroid Build Coastguard Worker 	 * future calls to open will also succeed without being sent
460*9e564957SAndroid Build Coastguard Worker 	 * to the filesystem process.
461*9e564957SAndroid Build Coastguard Worker 	 *
462*9e564957SAndroid Build Coastguard Worker 	 */
463*9e564957SAndroid Build Coastguard Worker 	int (*open) (const char *, struct fuse_file_info *);
464*9e564957SAndroid Build Coastguard Worker 
465*9e564957SAndroid Build Coastguard Worker 	/** Read data from an open file
466*9e564957SAndroid Build Coastguard Worker 	 *
467*9e564957SAndroid Build Coastguard Worker 	 * Read should return exactly the number of bytes requested except
468*9e564957SAndroid Build Coastguard Worker 	 * on EOF or error, otherwise the rest of the data will be
469*9e564957SAndroid Build Coastguard Worker 	 * substituted with zeroes.	 An exception to this is when the
470*9e564957SAndroid Build Coastguard Worker 	 * 'direct_io' mount option is specified, in which case the return
471*9e564957SAndroid Build Coastguard Worker 	 * value of the read system call will reflect the return value of
472*9e564957SAndroid Build Coastguard Worker 	 * this operation.
473*9e564957SAndroid Build Coastguard Worker 	 */
474*9e564957SAndroid Build Coastguard Worker 	int (*read) (const char *, char *, size_t, off_t,
475*9e564957SAndroid Build Coastguard Worker 		     struct fuse_file_info *);
476*9e564957SAndroid Build Coastguard Worker 
477*9e564957SAndroid Build Coastguard Worker 	/** Write data to an open file
478*9e564957SAndroid Build Coastguard Worker 	 *
479*9e564957SAndroid Build Coastguard Worker 	 * Write should return exactly the number of bytes requested
480*9e564957SAndroid Build Coastguard Worker 	 * except on error.	 An exception to this is when the 'direct_io'
481*9e564957SAndroid Build Coastguard Worker 	 * mount option is specified (see read operation).
482*9e564957SAndroid Build Coastguard Worker 	 *
483*9e564957SAndroid Build Coastguard Worker 	 * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
484*9e564957SAndroid Build Coastguard Worker 	 * expected to reset the setuid and setgid bits.
485*9e564957SAndroid Build Coastguard Worker 	 */
486*9e564957SAndroid Build Coastguard Worker 	int (*write) (const char *, const char *, size_t, off_t,
487*9e564957SAndroid Build Coastguard Worker 		      struct fuse_file_info *);
488*9e564957SAndroid Build Coastguard Worker 
489*9e564957SAndroid Build Coastguard Worker 	/** Get file system statistics
490*9e564957SAndroid Build Coastguard Worker 	 *
491*9e564957SAndroid Build Coastguard Worker 	 * The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
492*9e564957SAndroid Build Coastguard Worker 	 */
493*9e564957SAndroid Build Coastguard Worker 	int (*statfs) (const char *, struct statvfs *);
494*9e564957SAndroid Build Coastguard Worker 
495*9e564957SAndroid Build Coastguard Worker 	/** Possibly flush cached data
496*9e564957SAndroid Build Coastguard Worker 	 *
497*9e564957SAndroid Build Coastguard Worker 	 * BIG NOTE: This is not equivalent to fsync().  It's not a
498*9e564957SAndroid Build Coastguard Worker 	 * request to sync dirty data.
499*9e564957SAndroid Build Coastguard Worker 	 *
500*9e564957SAndroid Build Coastguard Worker 	 * Flush is called on each close() of a file descriptor, as opposed to
501*9e564957SAndroid Build Coastguard Worker 	 * release which is called on the close of the last file descriptor for
502*9e564957SAndroid Build Coastguard Worker 	 * a file.  Under Linux, errors returned by flush() will be passed to
503*9e564957SAndroid Build Coastguard Worker 	 * userspace as errors from close(), so flush() is a good place to write
504*9e564957SAndroid Build Coastguard Worker 	 * back any cached dirty data. However, many applications ignore errors
505*9e564957SAndroid Build Coastguard Worker 	 * on close(), and on non-Linux systems, close() may succeed even if flush()
506*9e564957SAndroid Build Coastguard Worker 	 * returns an error. For these reasons, filesystems should not assume
507*9e564957SAndroid Build Coastguard Worker 	 * that errors returned by flush will ever be noticed or even
508*9e564957SAndroid Build Coastguard Worker 	 * delivered.
509*9e564957SAndroid Build Coastguard Worker 	 *
510*9e564957SAndroid Build Coastguard Worker 	 * NOTE: The flush() method may be called more than once for each
511*9e564957SAndroid Build Coastguard Worker 	 * open().  This happens if more than one file descriptor refers to an
512*9e564957SAndroid Build Coastguard Worker 	 * open file handle, e.g. due to dup(), dup2() or fork() calls.  It is
513*9e564957SAndroid Build Coastguard Worker 	 * not possible to determine if a flush is final, so each flush should
514*9e564957SAndroid Build Coastguard Worker 	 * be treated equally.  Multiple write-flush sequences are relatively
515*9e564957SAndroid Build Coastguard Worker 	 * rare, so this shouldn't be a problem.
516*9e564957SAndroid Build Coastguard Worker 	 *
517*9e564957SAndroid Build Coastguard Worker 	 * Filesystems shouldn't assume that flush will be called at any
518*9e564957SAndroid Build Coastguard Worker 	 * particular point.  It may be called more times than expected, or not
519*9e564957SAndroid Build Coastguard Worker 	 * at all.
520*9e564957SAndroid Build Coastguard Worker 	 *
521*9e564957SAndroid Build Coastguard Worker 	 * [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
522*9e564957SAndroid Build Coastguard Worker 	 */
523*9e564957SAndroid Build Coastguard Worker 	int (*flush) (const char *, struct fuse_file_info *);
524*9e564957SAndroid Build Coastguard Worker 
525*9e564957SAndroid Build Coastguard Worker 	/** Release an open file
526*9e564957SAndroid Build Coastguard Worker 	 *
527*9e564957SAndroid Build Coastguard Worker 	 * Release is called when there are no more references to an open
528*9e564957SAndroid Build Coastguard Worker 	 * file: all file descriptors are closed and all memory mappings
529*9e564957SAndroid Build Coastguard Worker 	 * are unmapped.
530*9e564957SAndroid Build Coastguard Worker 	 *
531*9e564957SAndroid Build Coastguard Worker 	 * For every open() call there will be exactly one release() call
532*9e564957SAndroid Build Coastguard Worker 	 * with the same flags and file handle.  It is possible to
533*9e564957SAndroid Build Coastguard Worker 	 * have a file opened more than once, in which case only the last
534*9e564957SAndroid Build Coastguard Worker 	 * release will mean, that no more reads/writes will happen on the
535*9e564957SAndroid Build Coastguard Worker 	 * file.  The return value of release is ignored.
536*9e564957SAndroid Build Coastguard Worker 	 */
537*9e564957SAndroid Build Coastguard Worker 	int (*release) (const char *, struct fuse_file_info *);
538*9e564957SAndroid Build Coastguard Worker 
539*9e564957SAndroid Build Coastguard Worker 	/** Synchronize file contents
540*9e564957SAndroid Build Coastguard Worker 	 *
541*9e564957SAndroid Build Coastguard Worker 	 * If the datasync parameter is non-zero, then only the user data
542*9e564957SAndroid Build Coastguard Worker 	 * should be flushed, not the meta data.
543*9e564957SAndroid Build Coastguard Worker 	 */
544*9e564957SAndroid Build Coastguard Worker 	int (*fsync) (const char *, int, struct fuse_file_info *);
545*9e564957SAndroid Build Coastguard Worker 
546*9e564957SAndroid Build Coastguard Worker 	/** Set extended attributes */
547*9e564957SAndroid Build Coastguard Worker 	int (*setxattr) (const char *, const char *, const char *, size_t, int);
548*9e564957SAndroid Build Coastguard Worker 
549*9e564957SAndroid Build Coastguard Worker 	/** Get extended attributes */
550*9e564957SAndroid Build Coastguard Worker 	int (*getxattr) (const char *, const char *, char *, size_t);
551*9e564957SAndroid Build Coastguard Worker 
552*9e564957SAndroid Build Coastguard Worker 	/** List extended attributes */
553*9e564957SAndroid Build Coastguard Worker 	int (*listxattr) (const char *, char *, size_t);
554*9e564957SAndroid Build Coastguard Worker 
555*9e564957SAndroid Build Coastguard Worker 	/** Remove extended attributes */
556*9e564957SAndroid Build Coastguard Worker 	int (*removexattr) (const char *, const char *);
557*9e564957SAndroid Build Coastguard Worker 
558*9e564957SAndroid Build Coastguard Worker 	/** Open directory
559*9e564957SAndroid Build Coastguard Worker 	 *
560*9e564957SAndroid Build Coastguard Worker 	 * Unless the 'default_permissions' mount option is given,
561*9e564957SAndroid Build Coastguard Worker 	 * this method should check if opendir is permitted for this
562*9e564957SAndroid Build Coastguard Worker 	 * directory. Optionally opendir may also return an arbitrary
563*9e564957SAndroid Build Coastguard Worker 	 * filehandle in the fuse_file_info structure, which will be
564*9e564957SAndroid Build Coastguard Worker 	 * passed to readdir, releasedir and fsyncdir.
565*9e564957SAndroid Build Coastguard Worker 	 */
566*9e564957SAndroid Build Coastguard Worker 	int (*opendir) (const char *, struct fuse_file_info *);
567*9e564957SAndroid Build Coastguard Worker 
568*9e564957SAndroid Build Coastguard Worker 	/** Read directory
569*9e564957SAndroid Build Coastguard Worker 	 *
570*9e564957SAndroid Build Coastguard Worker 	 * The filesystem may choose between two modes of operation:
571*9e564957SAndroid Build Coastguard Worker 	 *
572*9e564957SAndroid Build Coastguard Worker 	 * 1) The readdir implementation ignores the offset parameter, and
573*9e564957SAndroid Build Coastguard Worker 	 * passes zero to the filler function's offset.  The filler
574*9e564957SAndroid Build Coastguard Worker 	 * function will not return '1' (unless an error happens), so the
575*9e564957SAndroid Build Coastguard Worker 	 * whole directory is read in a single readdir operation.
576*9e564957SAndroid Build Coastguard Worker 	 *
577*9e564957SAndroid Build Coastguard Worker 	 * 2) The readdir implementation keeps track of the offsets of the
578*9e564957SAndroid Build Coastguard Worker 	 * directory entries.  It uses the offset parameter and always
579*9e564957SAndroid Build Coastguard Worker 	 * passes non-zero offset to the filler function.  When the buffer
580*9e564957SAndroid Build Coastguard Worker 	 * is full (or an error happens) the filler function will return
581*9e564957SAndroid Build Coastguard Worker 	 * '1'.
582*9e564957SAndroid Build Coastguard Worker 	 *
583*9e564957SAndroid Build Coastguard Worker 	 * When FUSE_READDIR_PLUS is not set, only some parameters of the
584*9e564957SAndroid Build Coastguard Worker 	 * fill function (the fuse_fill_dir_t parameter) are actually used:
585*9e564957SAndroid Build Coastguard Worker 	 * The file type (which is part of stat::st_mode) is used. And if
586*9e564957SAndroid Build Coastguard Worker 	 * fuse_config::use_ino is set, the inode (stat::st_ino) is also
587*9e564957SAndroid Build Coastguard Worker 	 * used. The other fields are ignored when FUSE_READDIR_PLUS is not
588*9e564957SAndroid Build Coastguard Worker 	 * set.
589*9e564957SAndroid Build Coastguard Worker 	 */
590*9e564957SAndroid Build Coastguard Worker 	int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
591*9e564957SAndroid Build Coastguard Worker 			struct fuse_file_info *, enum fuse_readdir_flags);
592*9e564957SAndroid Build Coastguard Worker 
593*9e564957SAndroid Build Coastguard Worker 	/** Release directory
594*9e564957SAndroid Build Coastguard Worker 	 *
595*9e564957SAndroid Build Coastguard Worker 	 * If the directory has been removed after the call to opendir, the
596*9e564957SAndroid Build Coastguard Worker 	 * path parameter will be NULL.
597*9e564957SAndroid Build Coastguard Worker 	 */
598*9e564957SAndroid Build Coastguard Worker 	int (*releasedir) (const char *, struct fuse_file_info *);
599*9e564957SAndroid Build Coastguard Worker 
600*9e564957SAndroid Build Coastguard Worker 	/** Synchronize directory contents
601*9e564957SAndroid Build Coastguard Worker 	 *
602*9e564957SAndroid Build Coastguard Worker 	 * If the directory has been removed after the call to opendir, the
603*9e564957SAndroid Build Coastguard Worker 	 * path parameter will be NULL.
604*9e564957SAndroid Build Coastguard Worker 	 *
605*9e564957SAndroid Build Coastguard Worker 	 * If the datasync parameter is non-zero, then only the user data
606*9e564957SAndroid Build Coastguard Worker 	 * should be flushed, not the meta data
607*9e564957SAndroid Build Coastguard Worker 	 */
608*9e564957SAndroid Build Coastguard Worker 	int (*fsyncdir) (const char *, int, struct fuse_file_info *);
609*9e564957SAndroid Build Coastguard Worker 
610*9e564957SAndroid Build Coastguard Worker 	/**
611*9e564957SAndroid Build Coastguard Worker 	 * Initialize filesystem
612*9e564957SAndroid Build Coastguard Worker 	 *
613*9e564957SAndroid Build Coastguard Worker 	 * The return value will passed in the `private_data` field of
614*9e564957SAndroid Build Coastguard Worker 	 * `struct fuse_context` to all file operations, and as a
615*9e564957SAndroid Build Coastguard Worker 	 * parameter to the destroy() method. It overrides the initial
616*9e564957SAndroid Build Coastguard Worker 	 * value provided to fuse_main() / fuse_new().
617*9e564957SAndroid Build Coastguard Worker 	 */
618*9e564957SAndroid Build Coastguard Worker 	void *(*init) (struct fuse_conn_info *conn,
619*9e564957SAndroid Build Coastguard Worker 		       struct fuse_config *cfg);
620*9e564957SAndroid Build Coastguard Worker 
621*9e564957SAndroid Build Coastguard Worker 	/**
622*9e564957SAndroid Build Coastguard Worker 	 * Clean up filesystem
623*9e564957SAndroid Build Coastguard Worker 	 *
624*9e564957SAndroid Build Coastguard Worker 	 * Called on filesystem exit.
625*9e564957SAndroid Build Coastguard Worker 	 */
626*9e564957SAndroid Build Coastguard Worker 	void (*destroy) (void *private_data);
627*9e564957SAndroid Build Coastguard Worker 
628*9e564957SAndroid Build Coastguard Worker 	/**
629*9e564957SAndroid Build Coastguard Worker 	 * Check file access permissions
630*9e564957SAndroid Build Coastguard Worker 	 *
631*9e564957SAndroid Build Coastguard Worker 	 * This will be called for the access() system call.  If the
632*9e564957SAndroid Build Coastguard Worker 	 * 'default_permissions' mount option is given, this method is not
633*9e564957SAndroid Build Coastguard Worker 	 * called.
634*9e564957SAndroid Build Coastguard Worker 	 *
635*9e564957SAndroid Build Coastguard Worker 	 * This method is not called under Linux kernel versions 2.4.x
636*9e564957SAndroid Build Coastguard Worker 	 */
637*9e564957SAndroid Build Coastguard Worker 	int (*access) (const char *, int);
638*9e564957SAndroid Build Coastguard Worker 
639*9e564957SAndroid Build Coastguard Worker 	/**
640*9e564957SAndroid Build Coastguard Worker 	 * Create and open a file
641*9e564957SAndroid Build Coastguard Worker 	 *
642*9e564957SAndroid Build Coastguard Worker 	 * If the file does not exist, first create it with the specified
643*9e564957SAndroid Build Coastguard Worker 	 * mode, and then open it.
644*9e564957SAndroid Build Coastguard Worker 	 *
645*9e564957SAndroid Build Coastguard Worker 	 * If this method is not implemented or under Linux kernel
646*9e564957SAndroid Build Coastguard Worker 	 * versions earlier than 2.6.15, the mknod() and open() methods
647*9e564957SAndroid Build Coastguard Worker 	 * will be called instead.
648*9e564957SAndroid Build Coastguard Worker 	 */
649*9e564957SAndroid Build Coastguard Worker 	int (*create) (const char *, mode_t, struct fuse_file_info *);
650*9e564957SAndroid Build Coastguard Worker 
651*9e564957SAndroid Build Coastguard Worker 	/**
652*9e564957SAndroid Build Coastguard Worker 	 * Perform POSIX file locking operation
653*9e564957SAndroid Build Coastguard Worker 	 *
654*9e564957SAndroid Build Coastguard Worker 	 * The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW.
655*9e564957SAndroid Build Coastguard Worker 	 *
656*9e564957SAndroid Build Coastguard Worker 	 * For the meaning of fields in 'struct flock' see the man page
657*9e564957SAndroid Build Coastguard Worker 	 * for fcntl(2).  The l_whence field will always be set to
658*9e564957SAndroid Build Coastguard Worker 	 * SEEK_SET.
659*9e564957SAndroid Build Coastguard Worker 	 *
660*9e564957SAndroid Build Coastguard Worker 	 * For checking lock ownership, the 'fuse_file_info->owner'
661*9e564957SAndroid Build Coastguard Worker 	 * argument must be used.
662*9e564957SAndroid Build Coastguard Worker 	 *
663*9e564957SAndroid Build Coastguard Worker 	 * For F_GETLK operation, the library will first check currently
664*9e564957SAndroid Build Coastguard Worker 	 * held locks, and if a conflicting lock is found it will return
665*9e564957SAndroid Build Coastguard Worker 	 * information without calling this method.	 This ensures, that
666*9e564957SAndroid Build Coastguard Worker 	 * for local locks the l_pid field is correctly filled in.	The
667*9e564957SAndroid Build Coastguard Worker 	 * results may not be accurate in case of race conditions and in
668*9e564957SAndroid Build Coastguard Worker 	 * the presence of hard links, but it's unlikely that an
669*9e564957SAndroid Build Coastguard Worker 	 * application would rely on accurate GETLK results in these
670*9e564957SAndroid Build Coastguard Worker 	 * cases.  If a conflicting lock is not found, this method will be
671*9e564957SAndroid Build Coastguard Worker 	 * called, and the filesystem may fill out l_pid by a meaningful
672*9e564957SAndroid Build Coastguard Worker 	 * value, or it may leave this field zero.
673*9e564957SAndroid Build Coastguard Worker 	 *
674*9e564957SAndroid Build Coastguard Worker 	 * For F_SETLK and F_SETLKW the l_pid field will be set to the pid
675*9e564957SAndroid Build Coastguard Worker 	 * of the process performing the locking operation.
676*9e564957SAndroid Build Coastguard Worker 	 *
677*9e564957SAndroid Build Coastguard Worker 	 * Note: if this method is not implemented, the kernel will still
678*9e564957SAndroid Build Coastguard Worker 	 * allow file locking to work locally.  Hence it is only
679*9e564957SAndroid Build Coastguard Worker 	 * interesting for network filesystems and similar.
680*9e564957SAndroid Build Coastguard Worker 	 */
681*9e564957SAndroid Build Coastguard Worker 	int (*lock) (const char *, struct fuse_file_info *, int cmd,
682*9e564957SAndroid Build Coastguard Worker 		     struct flock *);
683*9e564957SAndroid Build Coastguard Worker 
684*9e564957SAndroid Build Coastguard Worker 	/**
685*9e564957SAndroid Build Coastguard Worker 	 * Change the access and modification times of a file with
686*9e564957SAndroid Build Coastguard Worker 	 * nanosecond resolution
687*9e564957SAndroid Build Coastguard Worker 	 *
688*9e564957SAndroid Build Coastguard Worker 	 * This supersedes the old utime() interface.  New applications
689*9e564957SAndroid Build Coastguard Worker 	 * should use this.
690*9e564957SAndroid Build Coastguard Worker 	 *
691*9e564957SAndroid Build Coastguard Worker 	 * `fi` will always be NULL if the file is not currently open, but
692*9e564957SAndroid Build Coastguard Worker 	 * may also be NULL if the file is open.
693*9e564957SAndroid Build Coastguard Worker 	 *
694*9e564957SAndroid Build Coastguard Worker 	 * See the utimensat(2) man page for details.
695*9e564957SAndroid Build Coastguard Worker 	 */
696*9e564957SAndroid Build Coastguard Worker 	 int (*utimens) (const char *, const struct timespec tv[2],
697*9e564957SAndroid Build Coastguard Worker 			 struct fuse_file_info *fi);
698*9e564957SAndroid Build Coastguard Worker 
699*9e564957SAndroid Build Coastguard Worker 	/**
700*9e564957SAndroid Build Coastguard Worker 	 * Map block index within file to block index within device
701*9e564957SAndroid Build Coastguard Worker 	 *
702*9e564957SAndroid Build Coastguard Worker 	 * Note: This makes sense only for block device backed filesystems
703*9e564957SAndroid Build Coastguard Worker 	 * mounted with the 'blkdev' option
704*9e564957SAndroid Build Coastguard Worker 	 */
705*9e564957SAndroid Build Coastguard Worker 	int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
706*9e564957SAndroid Build Coastguard Worker 
707*9e564957SAndroid Build Coastguard Worker #if FUSE_USE_VERSION < 35
708*9e564957SAndroid Build Coastguard Worker 	int (*ioctl) (const char *, int cmd, void *arg,
709*9e564957SAndroid Build Coastguard Worker 		      struct fuse_file_info *, unsigned int flags, void *data);
710*9e564957SAndroid Build Coastguard Worker #else
711*9e564957SAndroid Build Coastguard Worker 	/**
712*9e564957SAndroid Build Coastguard Worker 	 * Ioctl
713*9e564957SAndroid Build Coastguard Worker 	 *
714*9e564957SAndroid Build Coastguard Worker 	 * flags will have FUSE_IOCTL_COMPAT set for 32bit ioctls in
715*9e564957SAndroid Build Coastguard Worker 	 * 64bit environment.  The size and direction of data is
716*9e564957SAndroid Build Coastguard Worker 	 * determined by _IOC_*() decoding of cmd.  For _IOC_NONE,
717*9e564957SAndroid Build Coastguard Worker 	 * data will be NULL, for _IOC_WRITE data is out area, for
718*9e564957SAndroid Build Coastguard Worker 	 * _IOC_READ in area and if both are set in/out area.  In all
719*9e564957SAndroid Build Coastguard Worker 	 * non-NULL cases, the area is of _IOC_SIZE(cmd) bytes.
720*9e564957SAndroid Build Coastguard Worker 	 *
721*9e564957SAndroid Build Coastguard Worker 	 * If flags has FUSE_IOCTL_DIR then the fuse_file_info refers to a
722*9e564957SAndroid Build Coastguard Worker 	 * directory file handle.
723*9e564957SAndroid Build Coastguard Worker 	 *
724*9e564957SAndroid Build Coastguard Worker 	 * Note : the unsigned long request submitted by the application
725*9e564957SAndroid Build Coastguard Worker 	 * is truncated to 32 bits.
726*9e564957SAndroid Build Coastguard Worker 	 */
727*9e564957SAndroid Build Coastguard Worker 	int (*ioctl) (const char *, unsigned int cmd, void *arg,
728*9e564957SAndroid Build Coastguard Worker 		      struct fuse_file_info *, unsigned int flags, void *data);
729*9e564957SAndroid Build Coastguard Worker #endif
730*9e564957SAndroid Build Coastguard Worker 
731*9e564957SAndroid Build Coastguard Worker 	/**
732*9e564957SAndroid Build Coastguard Worker 	 * Poll for IO readiness events
733*9e564957SAndroid Build Coastguard Worker 	 *
734*9e564957SAndroid Build Coastguard Worker 	 * Note: If ph is non-NULL, the client should notify
735*9e564957SAndroid Build Coastguard Worker 	 * when IO readiness events occur by calling
736*9e564957SAndroid Build Coastguard Worker 	 * fuse_notify_poll() with the specified ph.
737*9e564957SAndroid Build Coastguard Worker 	 *
738*9e564957SAndroid Build Coastguard Worker 	 * Regardless of the number of times poll with a non-NULL ph
739*9e564957SAndroid Build Coastguard Worker 	 * is received, single notification is enough to clear all.
740*9e564957SAndroid Build Coastguard Worker 	 * Notifying more times incurs overhead but doesn't harm
741*9e564957SAndroid Build Coastguard Worker 	 * correctness.
742*9e564957SAndroid Build Coastguard Worker 	 *
743*9e564957SAndroid Build Coastguard Worker 	 * The callee is responsible for destroying ph with
744*9e564957SAndroid Build Coastguard Worker 	 * fuse_pollhandle_destroy() when no longer in use.
745*9e564957SAndroid Build Coastguard Worker 	 */
746*9e564957SAndroid Build Coastguard Worker 	int (*poll) (const char *, struct fuse_file_info *,
747*9e564957SAndroid Build Coastguard Worker 		     struct fuse_pollhandle *ph, unsigned *reventsp);
748*9e564957SAndroid Build Coastguard Worker 
749*9e564957SAndroid Build Coastguard Worker 	/** Write contents of buffer to an open file
750*9e564957SAndroid Build Coastguard Worker 	 *
751*9e564957SAndroid Build Coastguard Worker 	 * Similar to the write() method, but data is supplied in a
752*9e564957SAndroid Build Coastguard Worker 	 * generic buffer.  Use fuse_buf_copy() to transfer data to
753*9e564957SAndroid Build Coastguard Worker 	 * the destination.
754*9e564957SAndroid Build Coastguard Worker 	 *
755*9e564957SAndroid Build Coastguard Worker 	 * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
756*9e564957SAndroid Build Coastguard Worker 	 * expected to reset the setuid and setgid bits.
757*9e564957SAndroid Build Coastguard Worker 	 */
758*9e564957SAndroid Build Coastguard Worker 	int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off,
759*9e564957SAndroid Build Coastguard Worker 			  struct fuse_file_info *);
760*9e564957SAndroid Build Coastguard Worker 
761*9e564957SAndroid Build Coastguard Worker 	/** Store data from an open file in a buffer
762*9e564957SAndroid Build Coastguard Worker 	 *
763*9e564957SAndroid Build Coastguard Worker 	 * Similar to the read() method, but data is stored and
764*9e564957SAndroid Build Coastguard Worker 	 * returned in a generic buffer.
765*9e564957SAndroid Build Coastguard Worker 	 *
766*9e564957SAndroid Build Coastguard Worker 	 * No actual copying of data has to take place, the source
767*9e564957SAndroid Build Coastguard Worker 	 * file descriptor may simply be stored in the buffer for
768*9e564957SAndroid Build Coastguard Worker 	 * later data transfer.
769*9e564957SAndroid Build Coastguard Worker 	 *
770*9e564957SAndroid Build Coastguard Worker 	 * The buffer must be allocated dynamically and stored at the
771*9e564957SAndroid Build Coastguard Worker 	 * location pointed to by bufp.  If the buffer contains memory
772*9e564957SAndroid Build Coastguard Worker 	 * regions, they too must be allocated using malloc().  The
773*9e564957SAndroid Build Coastguard Worker 	 * allocated memory will be freed by the caller.
774*9e564957SAndroid Build Coastguard Worker 	 */
775*9e564957SAndroid Build Coastguard Worker 	int (*read_buf) (const char *, struct fuse_bufvec **bufp,
776*9e564957SAndroid Build Coastguard Worker 			 size_t size, off_t off, struct fuse_file_info *);
777*9e564957SAndroid Build Coastguard Worker 	/**
778*9e564957SAndroid Build Coastguard Worker 	 * Perform BSD file locking operation
779*9e564957SAndroid Build Coastguard Worker 	 *
780*9e564957SAndroid Build Coastguard Worker 	 * The op argument will be either LOCK_SH, LOCK_EX or LOCK_UN
781*9e564957SAndroid Build Coastguard Worker 	 *
782*9e564957SAndroid Build Coastguard Worker 	 * Nonblocking requests will be indicated by ORing LOCK_NB to
783*9e564957SAndroid Build Coastguard Worker 	 * the above operations
784*9e564957SAndroid Build Coastguard Worker 	 *
785*9e564957SAndroid Build Coastguard Worker 	 * For more information see the flock(2) manual page.
786*9e564957SAndroid Build Coastguard Worker 	 *
787*9e564957SAndroid Build Coastguard Worker 	 * Additionally fi->owner will be set to a value unique to
788*9e564957SAndroid Build Coastguard Worker 	 * this open file.  This same value will be supplied to
789*9e564957SAndroid Build Coastguard Worker 	 * ->release() when the file is released.
790*9e564957SAndroid Build Coastguard Worker 	 *
791*9e564957SAndroid Build Coastguard Worker 	 * Note: if this method is not implemented, the kernel will still
792*9e564957SAndroid Build Coastguard Worker 	 * allow file locking to work locally.  Hence it is only
793*9e564957SAndroid Build Coastguard Worker 	 * interesting for network filesystems and similar.
794*9e564957SAndroid Build Coastguard Worker 	 */
795*9e564957SAndroid Build Coastguard Worker 	int (*flock) (const char *, struct fuse_file_info *, int op);
796*9e564957SAndroid Build Coastguard Worker 
797*9e564957SAndroid Build Coastguard Worker 	/**
798*9e564957SAndroid Build Coastguard Worker 	 * Allocates space for an open file
799*9e564957SAndroid Build Coastguard Worker 	 *
800*9e564957SAndroid Build Coastguard Worker 	 * This function ensures that required space is allocated for specified
801*9e564957SAndroid Build Coastguard Worker 	 * file.  If this function returns success then any subsequent write
802*9e564957SAndroid Build Coastguard Worker 	 * request to specified range is guaranteed not to fail because of lack
803*9e564957SAndroid Build Coastguard Worker 	 * of space on the file system media.
804*9e564957SAndroid Build Coastguard Worker 	 */
805*9e564957SAndroid Build Coastguard Worker 	int (*fallocate) (const char *, int, off_t, off_t,
806*9e564957SAndroid Build Coastguard Worker 			  struct fuse_file_info *);
807*9e564957SAndroid Build Coastguard Worker 
808*9e564957SAndroid Build Coastguard Worker 	/**
809*9e564957SAndroid Build Coastguard Worker 	 * Copy a range of data from one file to another
810*9e564957SAndroid Build Coastguard Worker 	 *
811*9e564957SAndroid Build Coastguard Worker 	 * Performs an optimized copy between two file descriptors without the
812*9e564957SAndroid Build Coastguard Worker 	 * additional cost of transferring data through the FUSE kernel module
813*9e564957SAndroid Build Coastguard Worker 	 * to user space (glibc) and then back into the FUSE filesystem again.
814*9e564957SAndroid Build Coastguard Worker 	 *
815*9e564957SAndroid Build Coastguard Worker 	 * In case this method is not implemented, applications are expected to
816*9e564957SAndroid Build Coastguard Worker 	 * fall back to a regular file copy.   (Some glibc versions did this
817*9e564957SAndroid Build Coastguard Worker 	 * emulation automatically, but the emulation has been removed from all
818*9e564957SAndroid Build Coastguard Worker 	 * glibc release branches.)
819*9e564957SAndroid Build Coastguard Worker 	 */
820*9e564957SAndroid Build Coastguard Worker 	ssize_t (*copy_file_range) (const char *path_in,
821*9e564957SAndroid Build Coastguard Worker 				    struct fuse_file_info *fi_in,
822*9e564957SAndroid Build Coastguard Worker 				    off_t offset_in, const char *path_out,
823*9e564957SAndroid Build Coastguard Worker 				    struct fuse_file_info *fi_out,
824*9e564957SAndroid Build Coastguard Worker 				    off_t offset_out, size_t size, int flags);
825*9e564957SAndroid Build Coastguard Worker 
826*9e564957SAndroid Build Coastguard Worker 	/**
827*9e564957SAndroid Build Coastguard Worker 	 * Find next data or hole after the specified offset
828*9e564957SAndroid Build Coastguard Worker 	 */
829*9e564957SAndroid Build Coastguard Worker 	off_t (*lseek) (const char *, off_t off, int whence, struct fuse_file_info *);
830*9e564957SAndroid Build Coastguard Worker };
831*9e564957SAndroid Build Coastguard Worker 
832*9e564957SAndroid Build Coastguard Worker /** Extra context that may be needed by some filesystems
833*9e564957SAndroid Build Coastguard Worker  *
834*9e564957SAndroid Build Coastguard Worker  * The uid, gid and pid fields are not filled in case of a writepage
835*9e564957SAndroid Build Coastguard Worker  * operation.
836*9e564957SAndroid Build Coastguard Worker  */
837*9e564957SAndroid Build Coastguard Worker struct fuse_context {
838*9e564957SAndroid Build Coastguard Worker 	/** Pointer to the fuse object */
839*9e564957SAndroid Build Coastguard Worker 	struct fuse *fuse;
840*9e564957SAndroid Build Coastguard Worker 
841*9e564957SAndroid Build Coastguard Worker 	/** User ID of the calling process */
842*9e564957SAndroid Build Coastguard Worker 	uid_t uid;
843*9e564957SAndroid Build Coastguard Worker 
844*9e564957SAndroid Build Coastguard Worker 	/** Group ID of the calling process */
845*9e564957SAndroid Build Coastguard Worker 	gid_t gid;
846*9e564957SAndroid Build Coastguard Worker 
847*9e564957SAndroid Build Coastguard Worker 	/** Process ID of the calling thread */
848*9e564957SAndroid Build Coastguard Worker 	pid_t pid;
849*9e564957SAndroid Build Coastguard Worker 
850*9e564957SAndroid Build Coastguard Worker 	/** Private filesystem data */
851*9e564957SAndroid Build Coastguard Worker 	void *private_data;
852*9e564957SAndroid Build Coastguard Worker 
853*9e564957SAndroid Build Coastguard Worker 	/** Umask of the calling process */
854*9e564957SAndroid Build Coastguard Worker 	mode_t umask;
855*9e564957SAndroid Build Coastguard Worker };
856*9e564957SAndroid Build Coastguard Worker 
857*9e564957SAndroid Build Coastguard Worker #if (defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS))
858*9e564957SAndroid Build Coastguard Worker /**
859*9e564957SAndroid Build Coastguard Worker  * The real main function
860*9e564957SAndroid Build Coastguard Worker  *
861*9e564957SAndroid Build Coastguard Worker  * Do not call this directly, use fuse_main()
862*9e564957SAndroid Build Coastguard Worker  */
863*9e564957SAndroid Build Coastguard Worker int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
864*9e564957SAndroid Build Coastguard Worker 		   size_t op_size, struct libfuse_version *version,
865*9e564957SAndroid Build Coastguard Worker 		   void *user_data);
866*9e564957SAndroid Build Coastguard Worker #else
867*9e564957SAndroid Build Coastguard Worker int fuse_main_real_317(int argc, char *argv[], const struct fuse_operations *op,
868*9e564957SAndroid Build Coastguard Worker 		   size_t op_size, struct libfuse_version *version, void *user_data);
869*9e564957SAndroid Build Coastguard Worker #define fuse_main_real(argc, argv, op, op_size, version, user_data) \
870*9e564957SAndroid Build Coastguard Worker 	fuse_main_real_317(argc, argv, op, op_size, version, user_data);
871*9e564957SAndroid Build Coastguard Worker #endif
872*9e564957SAndroid Build Coastguard Worker 
873*9e564957SAndroid Build Coastguard Worker /**
874*9e564957SAndroid Build Coastguard Worker  * Main function of FUSE.
875*9e564957SAndroid Build Coastguard Worker  *
876*9e564957SAndroid Build Coastguard Worker  * This is for the lazy.  This is all that has to be called from the
877*9e564957SAndroid Build Coastguard Worker  * main() function.
878*9e564957SAndroid Build Coastguard Worker  *
879*9e564957SAndroid Build Coastguard Worker  * This function does the following:
880*9e564957SAndroid Build Coastguard Worker  *   - parses command line options, and handles --help and
881*9e564957SAndroid Build Coastguard Worker  *     --version
882*9e564957SAndroid Build Coastguard Worker  *   - installs signal handlers for INT, HUP, TERM and PIPE
883*9e564957SAndroid Build Coastguard Worker  *   - registers an exit handler to unmount the filesystem on program exit
884*9e564957SAndroid Build Coastguard Worker  *   - creates a fuse handle
885*9e564957SAndroid Build Coastguard Worker  *   - registers the operations
886*9e564957SAndroid Build Coastguard Worker  *   - calls either the single-threaded or the multi-threaded event loop
887*9e564957SAndroid Build Coastguard Worker  *
888*9e564957SAndroid Build Coastguard Worker  * Most file systems will have to parse some file-system specific
889*9e564957SAndroid Build Coastguard Worker  * arguments before calling this function. It is recommended to do
890*9e564957SAndroid Build Coastguard Worker  * this with fuse_opt_parse() and a processing function that passes
891*9e564957SAndroid Build Coastguard Worker  * through any unknown options (this can also be achieved by just
892*9e564957SAndroid Build Coastguard Worker  * passing NULL as the processing function). That way, the remaining
893*9e564957SAndroid Build Coastguard Worker  * options can be passed directly to fuse_main().
894*9e564957SAndroid Build Coastguard Worker  *
895*9e564957SAndroid Build Coastguard Worker  * fuse_main() accepts all options that can be passed to
896*9e564957SAndroid Build Coastguard Worker  * fuse_parse_cmdline(), fuse_new(), or fuse_session_new().
897*9e564957SAndroid Build Coastguard Worker  *
898*9e564957SAndroid Build Coastguard Worker  * Option parsing skips argv[0], which is assumed to contain the
899*9e564957SAndroid Build Coastguard Worker  * program name. This element must always be present and is used to
900*9e564957SAndroid Build Coastguard Worker  * construct a basic ``usage: `` message for the --help
901*9e564957SAndroid Build Coastguard Worker  * output. argv[0] may also be set to the empty string. In this case
902*9e564957SAndroid Build Coastguard Worker  * the usage message is suppressed. This can be used by file systems
903*9e564957SAndroid Build Coastguard Worker  * to print their own usage line first. See hello.c for an example of
904*9e564957SAndroid Build Coastguard Worker  * how to do this.
905*9e564957SAndroid Build Coastguard Worker  *
906*9e564957SAndroid Build Coastguard Worker  * Note: this is currently implemented as a macro.
907*9e564957SAndroid Build Coastguard Worker  *
908*9e564957SAndroid Build Coastguard Worker  * The following error codes may be returned from fuse_main():
909*9e564957SAndroid Build Coastguard Worker  *   1: Invalid option arguments
910*9e564957SAndroid Build Coastguard Worker  *   2: No mount point specified
911*9e564957SAndroid Build Coastguard Worker  *   3: FUSE setup failed
912*9e564957SAndroid Build Coastguard Worker  *   4: Mounting failed
913*9e564957SAndroid Build Coastguard Worker  *   5: Failed to daemonize (detach from session)
914*9e564957SAndroid Build Coastguard Worker  *   6: Failed to set up signal handlers
915*9e564957SAndroid Build Coastguard Worker  *   7: An error occurred during the life of the file system
916*9e564957SAndroid Build Coastguard Worker  *
917*9e564957SAndroid Build Coastguard Worker  * @param argc the argument counter passed to the main() function
918*9e564957SAndroid Build Coastguard Worker  * @param argv the argument vector passed to the main() function
919*9e564957SAndroid Build Coastguard Worker  * @param op the file system operation
920*9e564957SAndroid Build Coastguard Worker  * @param private_data Initial value for the `private_data`
921*9e564957SAndroid Build Coastguard Worker  *            field of `struct fuse_context`. May be overridden by the
922*9e564957SAndroid Build Coastguard Worker  *            `struct fuse_operations.init` handler.
923*9e564957SAndroid Build Coastguard Worker  * @return 0 on success, nonzero on failure
924*9e564957SAndroid Build Coastguard Worker  *
925*9e564957SAndroid Build Coastguard Worker  * Example usage, see hello.c
926*9e564957SAndroid Build Coastguard Worker  */
927*9e564957SAndroid Build Coastguard Worker static inline int
fuse_main(int argc,char * argv[],const struct fuse_operations * op,void * user_data)928*9e564957SAndroid Build Coastguard Worker fuse_main(int argc, char *argv[], const struct fuse_operations *op,
929*9e564957SAndroid Build Coastguard Worker 	  void *user_data)
930*9e564957SAndroid Build Coastguard Worker {
931*9e564957SAndroid Build Coastguard Worker 	struct libfuse_version version = {
932*9e564957SAndroid Build Coastguard Worker 		.major  = FUSE_MAJOR_VERSION,
933*9e564957SAndroid Build Coastguard Worker 		.minor  = FUSE_MINOR_VERSION,
934*9e564957SAndroid Build Coastguard Worker 		.hotfix = FUSE_HOTFIX_VERSION,
935*9e564957SAndroid Build Coastguard Worker 		.padding = 0
936*9e564957SAndroid Build Coastguard Worker 	};
937*9e564957SAndroid Build Coastguard Worker 	return fuse_main_real(argc, argv, op, sizeof(*(op)), &version,
938*9e564957SAndroid Build Coastguard Worker 			      user_data);
939*9e564957SAndroid Build Coastguard Worker }
940*9e564957SAndroid Build Coastguard Worker 
941*9e564957SAndroid Build Coastguard Worker /* ----------------------------------------------------------- *
942*9e564957SAndroid Build Coastguard Worker  * More detailed API					       *
943*9e564957SAndroid Build Coastguard Worker  * ----------------------------------------------------------- */
944*9e564957SAndroid Build Coastguard Worker 
945*9e564957SAndroid Build Coastguard Worker /**
946*9e564957SAndroid Build Coastguard Worker  * Print available options (high- and low-level) to stdout.  This is
947*9e564957SAndroid Build Coastguard Worker  * not an exhaustive list, but includes only those options that may be
948*9e564957SAndroid Build Coastguard Worker  * of interest to an end-user of a file system.
949*9e564957SAndroid Build Coastguard Worker  *
950*9e564957SAndroid Build Coastguard Worker  * The function looks at the argument vector only to determine if
951*9e564957SAndroid Build Coastguard Worker  * there are additional modules to be loaded (module=foo option),
952*9e564957SAndroid Build Coastguard Worker  * and attempts to call their help functions as well.
953*9e564957SAndroid Build Coastguard Worker  *
954*9e564957SAndroid Build Coastguard Worker  * @param args the argument vector.
955*9e564957SAndroid Build Coastguard Worker  */
956*9e564957SAndroid Build Coastguard Worker void fuse_lib_help(struct fuse_args *args);
957*9e564957SAndroid Build Coastguard Worker 
958*9e564957SAndroid Build Coastguard Worker struct fuse *_fuse_new(struct fuse_args *args,
959*9e564957SAndroid Build Coastguard Worker 		       const struct fuse_operations *op,
960*9e564957SAndroid Build Coastguard Worker 		       size_t op_size, struct libfuse_version *version,
961*9e564957SAndroid Build Coastguard Worker 		       void *user_data);
962*9e564957SAndroid Build Coastguard Worker 
963*9e564957SAndroid Build Coastguard Worker /**
964*9e564957SAndroid Build Coastguard Worker  * Create a new FUSE filesystem.
965*9e564957SAndroid Build Coastguard Worker  *
966*9e564957SAndroid Build Coastguard Worker  * This function accepts most file-system independent mount options
967*9e564957SAndroid Build Coastguard Worker  * (like context, nodev, ro - see mount(8)), as well as the
968*9e564957SAndroid Build Coastguard Worker  * FUSE-specific mount options from mount.fuse(8).
969*9e564957SAndroid Build Coastguard Worker  *
970*9e564957SAndroid Build Coastguard Worker  * If the --help option is specified, the function writes a help text
971*9e564957SAndroid Build Coastguard Worker  * to stdout and returns NULL.
972*9e564957SAndroid Build Coastguard Worker  *
973*9e564957SAndroid Build Coastguard Worker  * Option parsing skips argv[0], which is assumed to contain the
974*9e564957SAndroid Build Coastguard Worker  * program name. This element must always be present and is used to
975*9e564957SAndroid Build Coastguard Worker  * construct a basic ``usage: `` message for the --help output. If
976*9e564957SAndroid Build Coastguard Worker  * argv[0] is set to the empty string, no usage message is included in
977*9e564957SAndroid Build Coastguard Worker  * the --help output.
978*9e564957SAndroid Build Coastguard Worker  *
979*9e564957SAndroid Build Coastguard Worker  * If an unknown option is passed in, an error message is written to
980*9e564957SAndroid Build Coastguard Worker  * stderr and the function returns NULL.
981*9e564957SAndroid Build Coastguard Worker  *
982*9e564957SAndroid Build Coastguard Worker  * @param args argument vector
983*9e564957SAndroid Build Coastguard Worker  * @param op the filesystem operations
984*9e564957SAndroid Build Coastguard Worker  * @param op_size the size of the fuse_operations structure
985*9e564957SAndroid Build Coastguard Worker  * @param private_data Initial value for the `private_data`
986*9e564957SAndroid Build Coastguard Worker  *            field of `struct fuse_context`. May be overridden by the
987*9e564957SAndroid Build Coastguard Worker  *            `struct fuse_operations.init` handler.
988*9e564957SAndroid Build Coastguard Worker  * @return the created FUSE handle
989*9e564957SAndroid Build Coastguard Worker  */
990*9e564957SAndroid Build Coastguard Worker #if FUSE_USE_VERSION == 30
991*9e564957SAndroid Build Coastguard Worker struct fuse *_fuse_new_30(struct fuse_args *args,
992*9e564957SAndroid Build Coastguard Worker 			 const struct fuse_operations *op,
993*9e564957SAndroid Build Coastguard Worker 			 size_t op_size, void *user_data);
994*9e564957SAndroid Build Coastguard Worker static inline struct fuse *
fuse_new(struct fuse_args * args,const struct fuse_operations * op,size_t op_size,void * user_data)995*9e564957SAndroid Build Coastguard Worker fuse_new(struct fuse_args *args,
996*9e564957SAndroid Build Coastguard Worker 	 const struct fuse_operations *op, size_t op_size,
997*9e564957SAndroid Build Coastguard Worker 	 void *user_data)
998*9e564957SAndroid Build Coastguard Worker {
999*9e564957SAndroid Build Coastguard Worker 	struct libfuse_version version = {
1000*9e564957SAndroid Build Coastguard Worker 		.major = FUSE_MAJOR_VERSION,
1001*9e564957SAndroid Build Coastguard Worker 		.minor = FUSE_MINOR_VERSION,
1002*9e564957SAndroid Build Coastguard Worker 		.hotfix = FUSE_HOTFIX_VERSION,
1003*9e564957SAndroid Build Coastguard Worker 		.padding = 0
1004*9e564957SAndroid Build Coastguard Worker 	};
1005*9e564957SAndroid Build Coastguard Worker 
1006*9e564957SAndroid Build Coastguard Worker 	return _fuse_new_30(args, op, op_size, &version, user_data);
1007*9e564957SAndroid Build Coastguard Worker }
1008*9e564957SAndroid Build Coastguard Worker #else
1009*9e564957SAndroid Build Coastguard Worker #if (defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS))
1010*9e564957SAndroid Build Coastguard Worker static inline struct fuse *
fuse_new(struct fuse_args * args,const struct fuse_operations * op,size_t op_size,void * user_data)1011*9e564957SAndroid Build Coastguard Worker fuse_new(struct fuse_args *args,
1012*9e564957SAndroid Build Coastguard Worker 	 const struct fuse_operations *op, size_t op_size,
1013*9e564957SAndroid Build Coastguard Worker 	 void *user_data)
1014*9e564957SAndroid Build Coastguard Worker {
1015*9e564957SAndroid Build Coastguard Worker 	struct libfuse_version version = {
1016*9e564957SAndroid Build Coastguard Worker 		.major = FUSE_MAJOR_VERSION,
1017*9e564957SAndroid Build Coastguard Worker 		.minor = FUSE_MINOR_VERSION,
1018*9e564957SAndroid Build Coastguard Worker 		.hotfix = FUSE_HOTFIX_VERSION,
1019*9e564957SAndroid Build Coastguard Worker 		.padding = 0
1020*9e564957SAndroid Build Coastguard Worker 	};
1021*9e564957SAndroid Build Coastguard Worker 
1022*9e564957SAndroid Build Coastguard Worker 	return _fuse_new(args, op, op_size, &version, user_data);
1023*9e564957SAndroid Build Coastguard Worker }
1024*9e564957SAndroid Build Coastguard Worker #else /* LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS */
1025*9e564957SAndroid Build Coastguard Worker struct fuse *_fuse_new_317(struct fuse_args *args,
1026*9e564957SAndroid Build Coastguard Worker                       const struct fuse_operations *op, size_t op_size,
1027*9e564957SAndroid Build Coastguard Worker 		      struct libfuse_version *version,
1028*9e564957SAndroid Build Coastguard Worker 		      void *private_data);
1029*9e564957SAndroid Build Coastguard Worker #define _fuse_new(args, op, size, version, data) \
1030*9e564957SAndroid Build Coastguard Worker 	_fuse_new_317(args, op, size, version, data)
1031*9e564957SAndroid Build Coastguard Worker static inline struct fuse *
fuse_new(struct fuse_args * args,const struct fuse_operations * op,size_t op_size,void * user_data)1032*9e564957SAndroid Build Coastguard Worker fuse_new(struct fuse_args *args,
1033*9e564957SAndroid Build Coastguard Worker 	 const struct fuse_operations *op, size_t op_size,
1034*9e564957SAndroid Build Coastguard Worker 	 void *user_data)
1035*9e564957SAndroid Build Coastguard Worker {
1036*9e564957SAndroid Build Coastguard Worker 	struct libfuse_version version = {
1037*9e564957SAndroid Build Coastguard Worker 		.major = FUSE_MAJOR_VERSION,
1038*9e564957SAndroid Build Coastguard Worker 		.minor = FUSE_MINOR_VERSION,
1039*9e564957SAndroid Build Coastguard Worker 		.hotfix = FUSE_HOTFIX_VERSION,
1040*9e564957SAndroid Build Coastguard Worker 		.padding = 0
1041*9e564957SAndroid Build Coastguard Worker 	};
1042*9e564957SAndroid Build Coastguard Worker 
1043*9e564957SAndroid Build Coastguard Worker 	return _fuse_new(args, op, op_size, &version, user_data);
1044*9e564957SAndroid Build Coastguard Worker }
1045*9e564957SAndroid Build Coastguard Worker #endif /* LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS */
1046*9e564957SAndroid Build Coastguard Worker #endif
1047*9e564957SAndroid Build Coastguard Worker 
1048*9e564957SAndroid Build Coastguard Worker /**
1049*9e564957SAndroid Build Coastguard Worker  * Mount a FUSE file system.
1050*9e564957SAndroid Build Coastguard Worker  *
1051*9e564957SAndroid Build Coastguard Worker  * @param mountpoint the mount point path
1052*9e564957SAndroid Build Coastguard Worker  * @param f the FUSE handle
1053*9e564957SAndroid Build Coastguard Worker  *
1054*9e564957SAndroid Build Coastguard Worker  * @return 0 on success, -1 on failure.
1055*9e564957SAndroid Build Coastguard Worker  **/
1056*9e564957SAndroid Build Coastguard Worker int fuse_mount(struct fuse *f, const char *mountpoint);
1057*9e564957SAndroid Build Coastguard Worker 
1058*9e564957SAndroid Build Coastguard Worker /**
1059*9e564957SAndroid Build Coastguard Worker  * Unmount a FUSE file system.
1060*9e564957SAndroid Build Coastguard Worker  *
1061*9e564957SAndroid Build Coastguard Worker  * See fuse_session_unmount() for additional information.
1062*9e564957SAndroid Build Coastguard Worker  *
1063*9e564957SAndroid Build Coastguard Worker  * @param f the FUSE handle
1064*9e564957SAndroid Build Coastguard Worker  **/
1065*9e564957SAndroid Build Coastguard Worker void fuse_unmount(struct fuse *f);
1066*9e564957SAndroid Build Coastguard Worker 
1067*9e564957SAndroid Build Coastguard Worker /**
1068*9e564957SAndroid Build Coastguard Worker  * Destroy the FUSE handle.
1069*9e564957SAndroid Build Coastguard Worker  *
1070*9e564957SAndroid Build Coastguard Worker  * NOTE: This function does not unmount the filesystem.	 If this is
1071*9e564957SAndroid Build Coastguard Worker  * needed, call fuse_unmount() before calling this function.
1072*9e564957SAndroid Build Coastguard Worker  *
1073*9e564957SAndroid Build Coastguard Worker  * @param f the FUSE handle
1074*9e564957SAndroid Build Coastguard Worker  */
1075*9e564957SAndroid Build Coastguard Worker void fuse_destroy(struct fuse *f);
1076*9e564957SAndroid Build Coastguard Worker 
1077*9e564957SAndroid Build Coastguard Worker /**
1078*9e564957SAndroid Build Coastguard Worker  * FUSE event loop.
1079*9e564957SAndroid Build Coastguard Worker  *
1080*9e564957SAndroid Build Coastguard Worker  * Requests from the kernel are processed, and the appropriate
1081*9e564957SAndroid Build Coastguard Worker  * operations are called.
1082*9e564957SAndroid Build Coastguard Worker  *
1083*9e564957SAndroid Build Coastguard Worker  * For a description of the return value and the conditions when the
1084*9e564957SAndroid Build Coastguard Worker  * event loop exits, refer to the documentation of
1085*9e564957SAndroid Build Coastguard Worker  * fuse_session_loop().
1086*9e564957SAndroid Build Coastguard Worker  *
1087*9e564957SAndroid Build Coastguard Worker  * @param f the FUSE handle
1088*9e564957SAndroid Build Coastguard Worker  * @return see fuse_session_loop()
1089*9e564957SAndroid Build Coastguard Worker  *
1090*9e564957SAndroid Build Coastguard Worker  * See also: fuse_loop_mt()
1091*9e564957SAndroid Build Coastguard Worker  */
1092*9e564957SAndroid Build Coastguard Worker int fuse_loop(struct fuse *f);
1093*9e564957SAndroid Build Coastguard Worker 
1094*9e564957SAndroid Build Coastguard Worker /**
1095*9e564957SAndroid Build Coastguard Worker  * Flag session as terminated
1096*9e564957SAndroid Build Coastguard Worker  *
1097*9e564957SAndroid Build Coastguard Worker  * This function will cause any running event loops to exit on
1098*9e564957SAndroid Build Coastguard Worker  * the next opportunity.
1099*9e564957SAndroid Build Coastguard Worker  *
1100*9e564957SAndroid Build Coastguard Worker  * @param f the FUSE handle
1101*9e564957SAndroid Build Coastguard Worker  */
1102*9e564957SAndroid Build Coastguard Worker void fuse_exit(struct fuse *f);
1103*9e564957SAndroid Build Coastguard Worker 
1104*9e564957SAndroid Build Coastguard Worker #if FUSE_USE_VERSION < 32
1105*9e564957SAndroid Build Coastguard Worker int fuse_loop_mt_31(struct fuse *f, int clone_fd);
1106*9e564957SAndroid Build Coastguard Worker #define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
1107*9e564957SAndroid Build Coastguard Worker #elif FUSE_USE_VERSION < FUSE_MAKE_VERSION(3, 12)
1108*9e564957SAndroid Build Coastguard Worker int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config *config);
1109*9e564957SAndroid Build Coastguard Worker #define fuse_loop_mt(f, config) fuse_loop_mt_32(f, config)
1110*9e564957SAndroid Build Coastguard Worker #else
1111*9e564957SAndroid Build Coastguard Worker /**
1112*9e564957SAndroid Build Coastguard Worker  * FUSE event loop with multiple threads
1113*9e564957SAndroid Build Coastguard Worker  *
1114*9e564957SAndroid Build Coastguard Worker  * Requests from the kernel are processed, and the appropriate
1115*9e564957SAndroid Build Coastguard Worker  * operations are called.  Request are processed in parallel by
1116*9e564957SAndroid Build Coastguard Worker  * distributing them between multiple threads.
1117*9e564957SAndroid Build Coastguard Worker  *
1118*9e564957SAndroid Build Coastguard Worker  * For a description of the return value and the conditions when the
1119*9e564957SAndroid Build Coastguard Worker  * event loop exits, refer to the documentation of
1120*9e564957SAndroid Build Coastguard Worker  * fuse_session_loop().
1121*9e564957SAndroid Build Coastguard Worker  *
1122*9e564957SAndroid Build Coastguard Worker  * Note: using fuse_loop() instead of fuse_loop_mt() means you are running in
1123*9e564957SAndroid Build Coastguard Worker  * single-threaded mode, and that you will not have to worry about reentrancy,
1124*9e564957SAndroid Build Coastguard Worker  * though you will have to worry about recursive lookups. In single-threaded
1125*9e564957SAndroid Build Coastguard Worker  * mode, FUSE will wait for one callback to return before calling another.
1126*9e564957SAndroid Build Coastguard Worker  *
1127*9e564957SAndroid Build Coastguard Worker  * Enabling multiple threads, by using fuse_loop_mt(), will cause FUSE to make
1128*9e564957SAndroid Build Coastguard Worker  * multiple simultaneous calls into the various callback functions given by your
1129*9e564957SAndroid Build Coastguard Worker  * fuse_operations record.
1130*9e564957SAndroid Build Coastguard Worker  *
1131*9e564957SAndroid Build Coastguard Worker  * If you are using multiple threads, you can enjoy all the parallel execution
1132*9e564957SAndroid Build Coastguard Worker  * and interactive response benefits of threads, and you get to enjoy all the
1133*9e564957SAndroid Build Coastguard Worker  * benefits of race conditions and locking bugs, too. Ensure that any code used
1134*9e564957SAndroid Build Coastguard Worker  * in the callback function of fuse_operations is also thread-safe.
1135*9e564957SAndroid Build Coastguard Worker  *
1136*9e564957SAndroid Build Coastguard Worker  * @param f the FUSE handle
1137*9e564957SAndroid Build Coastguard Worker  * @param config loop configuration, may be NULL and defaults will be used then
1138*9e564957SAndroid Build Coastguard Worker  * @return see fuse_session_loop()
1139*9e564957SAndroid Build Coastguard Worker  *
1140*9e564957SAndroid Build Coastguard Worker  * See also: fuse_loop()
1141*9e564957SAndroid Build Coastguard Worker  */
1142*9e564957SAndroid Build Coastguard Worker #if (defined(LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS))
1143*9e564957SAndroid Build Coastguard Worker int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config);
1144*9e564957SAndroid Build Coastguard Worker #else
1145*9e564957SAndroid Build Coastguard Worker #define fuse_loop_mt(f, config) fuse_loop_mt_312(f, config)
1146*9e564957SAndroid Build Coastguard Worker #endif /* LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS */
1147*9e564957SAndroid Build Coastguard Worker #endif
1148*9e564957SAndroid Build Coastguard Worker 
1149*9e564957SAndroid Build Coastguard Worker 
1150*9e564957SAndroid Build Coastguard Worker /**
1151*9e564957SAndroid Build Coastguard Worker  * Get the current context
1152*9e564957SAndroid Build Coastguard Worker  *
1153*9e564957SAndroid Build Coastguard Worker  * The context is only valid for the duration of a filesystem
1154*9e564957SAndroid Build Coastguard Worker  * operation, and thus must not be stored and used later.
1155*9e564957SAndroid Build Coastguard Worker  *
1156*9e564957SAndroid Build Coastguard Worker  * @return the context
1157*9e564957SAndroid Build Coastguard Worker  */
1158*9e564957SAndroid Build Coastguard Worker struct fuse_context *fuse_get_context(void);
1159*9e564957SAndroid Build Coastguard Worker 
1160*9e564957SAndroid Build Coastguard Worker /**
1161*9e564957SAndroid Build Coastguard Worker  * Get the current supplementary group IDs for the current request
1162*9e564957SAndroid Build Coastguard Worker  *
1163*9e564957SAndroid Build Coastguard Worker  * Similar to the getgroups(2) system call, except the return value is
1164*9e564957SAndroid Build Coastguard Worker  * always the total number of group IDs, even if it is larger than the
1165*9e564957SAndroid Build Coastguard Worker  * specified size.
1166*9e564957SAndroid Build Coastguard Worker  *
1167*9e564957SAndroid Build Coastguard Worker  * The current fuse kernel module in linux (as of 2.6.30) doesn't pass
1168*9e564957SAndroid Build Coastguard Worker  * the group list to userspace, hence this function needs to parse
1169*9e564957SAndroid Build Coastguard Worker  * "/proc/$TID/task/$TID/status" to get the group IDs.
1170*9e564957SAndroid Build Coastguard Worker  *
1171*9e564957SAndroid Build Coastguard Worker  * This feature may not be supported on all operating systems.  In
1172*9e564957SAndroid Build Coastguard Worker  * such a case this function will return -ENOSYS.
1173*9e564957SAndroid Build Coastguard Worker  *
1174*9e564957SAndroid Build Coastguard Worker  * @param size size of given array
1175*9e564957SAndroid Build Coastguard Worker  * @param list array of group IDs to be filled in
1176*9e564957SAndroid Build Coastguard Worker  * @return the total number of supplementary group IDs or -errno on failure
1177*9e564957SAndroid Build Coastguard Worker  */
1178*9e564957SAndroid Build Coastguard Worker int fuse_getgroups(int size, gid_t list[]);
1179*9e564957SAndroid Build Coastguard Worker 
1180*9e564957SAndroid Build Coastguard Worker /**
1181*9e564957SAndroid Build Coastguard Worker  * Check if the current request has already been interrupted
1182*9e564957SAndroid Build Coastguard Worker  *
1183*9e564957SAndroid Build Coastguard Worker  * @return 1 if the request has been interrupted, 0 otherwise
1184*9e564957SAndroid Build Coastguard Worker  */
1185*9e564957SAndroid Build Coastguard Worker int fuse_interrupted(void);
1186*9e564957SAndroid Build Coastguard Worker 
1187*9e564957SAndroid Build Coastguard Worker /**
1188*9e564957SAndroid Build Coastguard Worker  * Invalidates cache for the given path.
1189*9e564957SAndroid Build Coastguard Worker  *
1190*9e564957SAndroid Build Coastguard Worker  * This calls fuse_lowlevel_notify_inval_inode internally.
1191*9e564957SAndroid Build Coastguard Worker  *
1192*9e564957SAndroid Build Coastguard Worker  * @return 0 on successful invalidation, negative error value otherwise.
1193*9e564957SAndroid Build Coastguard Worker  *         This routine may return -ENOENT to indicate that there was
1194*9e564957SAndroid Build Coastguard Worker  *         no entry to be invalidated, e.g., because the path has not
1195*9e564957SAndroid Build Coastguard Worker  *         been seen before or has been forgotten; this should not be
1196*9e564957SAndroid Build Coastguard Worker  *         considered to be an error.
1197*9e564957SAndroid Build Coastguard Worker  */
1198*9e564957SAndroid Build Coastguard Worker int fuse_invalidate_path(struct fuse *f, const char *path);
1199*9e564957SAndroid Build Coastguard Worker 
1200*9e564957SAndroid Build Coastguard Worker /**
1201*9e564957SAndroid Build Coastguard Worker  * Start the cleanup thread when using option "remember".
1202*9e564957SAndroid Build Coastguard Worker  *
1203*9e564957SAndroid Build Coastguard Worker  * This is done automatically by fuse_loop_mt()
1204*9e564957SAndroid Build Coastguard Worker  * @param fuse struct fuse pointer for fuse instance
1205*9e564957SAndroid Build Coastguard Worker  * @return 0 on success and -1 on error
1206*9e564957SAndroid Build Coastguard Worker  */
1207*9e564957SAndroid Build Coastguard Worker int fuse_start_cleanup_thread(struct fuse *fuse);
1208*9e564957SAndroid Build Coastguard Worker 
1209*9e564957SAndroid Build Coastguard Worker /**
1210*9e564957SAndroid Build Coastguard Worker  * Stop the cleanup thread when using option "remember".
1211*9e564957SAndroid Build Coastguard Worker  *
1212*9e564957SAndroid Build Coastguard Worker  * This is done automatically by fuse_loop_mt()
1213*9e564957SAndroid Build Coastguard Worker  * @param fuse struct fuse pointer for fuse instance
1214*9e564957SAndroid Build Coastguard Worker  */
1215*9e564957SAndroid Build Coastguard Worker void fuse_stop_cleanup_thread(struct fuse *fuse);
1216*9e564957SAndroid Build Coastguard Worker 
1217*9e564957SAndroid Build Coastguard Worker /**
1218*9e564957SAndroid Build Coastguard Worker  * Iterate over cache removing stale entries
1219*9e564957SAndroid Build Coastguard Worker  * use in conjunction with "-oremember"
1220*9e564957SAndroid Build Coastguard Worker  *
1221*9e564957SAndroid Build Coastguard Worker  * NOTE: This is already done for the standard sessions
1222*9e564957SAndroid Build Coastguard Worker  *
1223*9e564957SAndroid Build Coastguard Worker  * @param fuse struct fuse pointer for fuse instance
1224*9e564957SAndroid Build Coastguard Worker  * @return the number of seconds until the next cleanup
1225*9e564957SAndroid Build Coastguard Worker  */
1226*9e564957SAndroid Build Coastguard Worker int fuse_clean_cache(struct fuse *fuse);
1227*9e564957SAndroid Build Coastguard Worker 
1228*9e564957SAndroid Build Coastguard Worker /*
1229*9e564957SAndroid Build Coastguard Worker  * Stacking API
1230*9e564957SAndroid Build Coastguard Worker  */
1231*9e564957SAndroid Build Coastguard Worker 
1232*9e564957SAndroid Build Coastguard Worker /**
1233*9e564957SAndroid Build Coastguard Worker  * Fuse filesystem object
1234*9e564957SAndroid Build Coastguard Worker  *
1235*9e564957SAndroid Build Coastguard Worker  * This is opaque object represents a filesystem layer
1236*9e564957SAndroid Build Coastguard Worker  */
1237*9e564957SAndroid Build Coastguard Worker struct fuse_fs;
1238*9e564957SAndroid Build Coastguard Worker 
1239*9e564957SAndroid Build Coastguard Worker /*
1240*9e564957SAndroid Build Coastguard Worker  * These functions call the relevant filesystem operation, and return
1241*9e564957SAndroid Build Coastguard Worker  * the result.
1242*9e564957SAndroid Build Coastguard Worker  *
1243*9e564957SAndroid Build Coastguard Worker  * If the operation is not defined, they return -ENOSYS, with the
1244*9e564957SAndroid Build Coastguard Worker  * exception of fuse_fs_open, fuse_fs_release, fuse_fs_opendir,
1245*9e564957SAndroid Build Coastguard Worker  * fuse_fs_releasedir and fuse_fs_statfs, which return 0.
1246*9e564957SAndroid Build Coastguard Worker  */
1247*9e564957SAndroid Build Coastguard Worker 
1248*9e564957SAndroid Build Coastguard Worker int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf,
1249*9e564957SAndroid Build Coastguard Worker 		    struct fuse_file_info *fi);
1250*9e564957SAndroid Build Coastguard Worker int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
1251*9e564957SAndroid Build Coastguard Worker 		   const char *newpath, unsigned int flags);
1252*9e564957SAndroid Build Coastguard Worker int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
1253*9e564957SAndroid Build Coastguard Worker int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
1254*9e564957SAndroid Build Coastguard Worker int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
1255*9e564957SAndroid Build Coastguard Worker 		    const char *path);
1256*9e564957SAndroid Build Coastguard Worker int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
1257*9e564957SAndroid Build Coastguard Worker int fuse_fs_release(struct fuse_fs *fs,	 const char *path,
1258*9e564957SAndroid Build Coastguard Worker 		    struct fuse_file_info *fi);
1259*9e564957SAndroid Build Coastguard Worker int fuse_fs_open(struct fuse_fs *fs, const char *path,
1260*9e564957SAndroid Build Coastguard Worker 		 struct fuse_file_info *fi);
1261*9e564957SAndroid Build Coastguard Worker int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size,
1262*9e564957SAndroid Build Coastguard Worker 		 off_t off, struct fuse_file_info *fi);
1263*9e564957SAndroid Build Coastguard Worker int fuse_fs_read_buf(struct fuse_fs *fs, const char *path,
1264*9e564957SAndroid Build Coastguard Worker 		     struct fuse_bufvec **bufp, size_t size, off_t off,
1265*9e564957SAndroid Build Coastguard Worker 		     struct fuse_file_info *fi);
1266*9e564957SAndroid Build Coastguard Worker int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf,
1267*9e564957SAndroid Build Coastguard Worker 		  size_t size, off_t off, struct fuse_file_info *fi);
1268*9e564957SAndroid Build Coastguard Worker int fuse_fs_write_buf(struct fuse_fs *fs, const char *path,
1269*9e564957SAndroid Build Coastguard Worker 		      struct fuse_bufvec *buf, off_t off,
1270*9e564957SAndroid Build Coastguard Worker 		      struct fuse_file_info *fi);
1271*9e564957SAndroid Build Coastguard Worker int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync,
1272*9e564957SAndroid Build Coastguard Worker 		  struct fuse_file_info *fi);
1273*9e564957SAndroid Build Coastguard Worker int fuse_fs_flush(struct fuse_fs *fs, const char *path,
1274*9e564957SAndroid Build Coastguard Worker 		  struct fuse_file_info *fi);
1275*9e564957SAndroid Build Coastguard Worker int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
1276*9e564957SAndroid Build Coastguard Worker int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
1277*9e564957SAndroid Build Coastguard Worker 		    struct fuse_file_info *fi);
1278*9e564957SAndroid Build Coastguard Worker int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf,
1279*9e564957SAndroid Build Coastguard Worker 		    fuse_fill_dir_t filler, off_t off,
1280*9e564957SAndroid Build Coastguard Worker 		    struct fuse_file_info *fi, enum fuse_readdir_flags flags);
1281*9e564957SAndroid Build Coastguard Worker int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync,
1282*9e564957SAndroid Build Coastguard Worker 		     struct fuse_file_info *fi);
1283*9e564957SAndroid Build Coastguard Worker int fuse_fs_releasedir(struct fuse_fs *fs, const char *path,
1284*9e564957SAndroid Build Coastguard Worker 		       struct fuse_file_info *fi);
1285*9e564957SAndroid Build Coastguard Worker int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode,
1286*9e564957SAndroid Build Coastguard Worker 		   struct fuse_file_info *fi);
1287*9e564957SAndroid Build Coastguard Worker int fuse_fs_lock(struct fuse_fs *fs, const char *path,
1288*9e564957SAndroid Build Coastguard Worker 		 struct fuse_file_info *fi, int cmd, struct flock *lock);
1289*9e564957SAndroid Build Coastguard Worker int fuse_fs_flock(struct fuse_fs *fs, const char *path,
1290*9e564957SAndroid Build Coastguard Worker 		  struct fuse_file_info *fi, int op);
1291*9e564957SAndroid Build Coastguard Worker int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode,
1292*9e564957SAndroid Build Coastguard Worker 		  struct fuse_file_info *fi);
1293*9e564957SAndroid Build Coastguard Worker int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid,
1294*9e564957SAndroid Build Coastguard Worker 		  struct fuse_file_info *fi);
1295*9e564957SAndroid Build Coastguard Worker int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size,
1296*9e564957SAndroid Build Coastguard Worker 		     struct fuse_file_info *fi);
1297*9e564957SAndroid Build Coastguard Worker int fuse_fs_utimens(struct fuse_fs *fs, const char *path,
1298*9e564957SAndroid Build Coastguard Worker 		    const struct timespec tv[2], struct fuse_file_info *fi);
1299*9e564957SAndroid Build Coastguard Worker int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
1300*9e564957SAndroid Build Coastguard Worker int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
1301*9e564957SAndroid Build Coastguard Worker 		     size_t len);
1302*9e564957SAndroid Build Coastguard Worker int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode,
1303*9e564957SAndroid Build Coastguard Worker 		  dev_t rdev);
1304*9e564957SAndroid Build Coastguard Worker int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode);
1305*9e564957SAndroid Build Coastguard Worker int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
1306*9e564957SAndroid Build Coastguard Worker 		     const char *value, size_t size, int flags);
1307*9e564957SAndroid Build Coastguard Worker int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
1308*9e564957SAndroid Build Coastguard Worker 		     char *value, size_t size);
1309*9e564957SAndroid Build Coastguard Worker int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
1310*9e564957SAndroid Build Coastguard Worker 		      size_t size);
1311*9e564957SAndroid Build Coastguard Worker int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
1312*9e564957SAndroid Build Coastguard Worker 			const char *name);
1313*9e564957SAndroid Build Coastguard Worker int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
1314*9e564957SAndroid Build Coastguard Worker 		 uint64_t *idx);
1315*9e564957SAndroid Build Coastguard Worker #if FUSE_USE_VERSION < 35
1316*9e564957SAndroid Build Coastguard Worker int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd,
1317*9e564957SAndroid Build Coastguard Worker 		  void *arg, struct fuse_file_info *fi, unsigned int flags,
1318*9e564957SAndroid Build Coastguard Worker 		  void *data);
1319*9e564957SAndroid Build Coastguard Worker #else
1320*9e564957SAndroid Build Coastguard Worker int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, unsigned int cmd,
1321*9e564957SAndroid Build Coastguard Worker 		  void *arg, struct fuse_file_info *fi, unsigned int flags,
1322*9e564957SAndroid Build Coastguard Worker 		  void *data);
1323*9e564957SAndroid Build Coastguard Worker #endif
1324*9e564957SAndroid Build Coastguard Worker int fuse_fs_poll(struct fuse_fs *fs, const char *path,
1325*9e564957SAndroid Build Coastguard Worker 		 struct fuse_file_info *fi, struct fuse_pollhandle *ph,
1326*9e564957SAndroid Build Coastguard Worker 		 unsigned *reventsp);
1327*9e564957SAndroid Build Coastguard Worker int fuse_fs_fallocate(struct fuse_fs *fs, const char *path, int mode,
1328*9e564957SAndroid Build Coastguard Worker 		 off_t offset, off_t length, struct fuse_file_info *fi);
1329*9e564957SAndroid Build Coastguard Worker ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs, const char *path_in,
1330*9e564957SAndroid Build Coastguard Worker 				struct fuse_file_info *fi_in, off_t off_in,
1331*9e564957SAndroid Build Coastguard Worker 				const char *path_out,
1332*9e564957SAndroid Build Coastguard Worker 				struct fuse_file_info *fi_out, off_t off_out,
1333*9e564957SAndroid Build Coastguard Worker 				size_t len, int flags);
1334*9e564957SAndroid Build Coastguard Worker off_t fuse_fs_lseek(struct fuse_fs *fs, const char *path, off_t off, int whence,
1335*9e564957SAndroid Build Coastguard Worker 		    struct fuse_file_info *fi);
1336*9e564957SAndroid Build Coastguard Worker void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn,
1337*9e564957SAndroid Build Coastguard Worker 		struct fuse_config *cfg);
1338*9e564957SAndroid Build Coastguard Worker void fuse_fs_destroy(struct fuse_fs *fs);
1339*9e564957SAndroid Build Coastguard Worker 
1340*9e564957SAndroid Build Coastguard Worker int fuse_notify_poll(struct fuse_pollhandle *ph);
1341*9e564957SAndroid Build Coastguard Worker 
1342*9e564957SAndroid Build Coastguard Worker /**
1343*9e564957SAndroid Build Coastguard Worker  * Create a new fuse filesystem object
1344*9e564957SAndroid Build Coastguard Worker  *
1345*9e564957SAndroid Build Coastguard Worker  * This is usually called from the factory of a fuse module to create
1346*9e564957SAndroid Build Coastguard Worker  * a new instance of a filesystem.
1347*9e564957SAndroid Build Coastguard Worker  *
1348*9e564957SAndroid Build Coastguard Worker  * @param op the filesystem operations
1349*9e564957SAndroid Build Coastguard Worker  * @param op_size the size of the fuse_operations structure
1350*9e564957SAndroid Build Coastguard Worker  * @param private_data Initial value for the `private_data`
1351*9e564957SAndroid Build Coastguard Worker  *            field of `struct fuse_context`. May be overridden by the
1352*9e564957SAndroid Build Coastguard Worker  *            `struct fuse_operations.init` handler.
1353*9e564957SAndroid Build Coastguard Worker  * @return a new filesystem object
1354*9e564957SAndroid Build Coastguard Worker  */
1355*9e564957SAndroid Build Coastguard Worker struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
1356*9e564957SAndroid Build Coastguard Worker 			    void *private_data);
1357*9e564957SAndroid Build Coastguard Worker 
1358*9e564957SAndroid Build Coastguard Worker /**
1359*9e564957SAndroid Build Coastguard Worker  * Factory for creating filesystem objects
1360*9e564957SAndroid Build Coastguard Worker  *
1361*9e564957SAndroid Build Coastguard Worker  * The function may use and remove options from 'args' that belong
1362*9e564957SAndroid Build Coastguard Worker  * to this module.
1363*9e564957SAndroid Build Coastguard Worker  *
1364*9e564957SAndroid Build Coastguard Worker  * For now the 'fs' vector always contains exactly one filesystem.
1365*9e564957SAndroid Build Coastguard Worker  * This is the filesystem which will be below the newly created
1366*9e564957SAndroid Build Coastguard Worker  * filesystem in the stack.
1367*9e564957SAndroid Build Coastguard Worker  *
1368*9e564957SAndroid Build Coastguard Worker  * @param args the command line arguments
1369*9e564957SAndroid Build Coastguard Worker  * @param fs NULL terminated filesystem object vector
1370*9e564957SAndroid Build Coastguard Worker  * @return the new filesystem object
1371*9e564957SAndroid Build Coastguard Worker  */
1372*9e564957SAndroid Build Coastguard Worker typedef struct fuse_fs *(*fuse_module_factory_t)(struct fuse_args *args,
1373*9e564957SAndroid Build Coastguard Worker 						 struct fuse_fs *fs[]);
1374*9e564957SAndroid Build Coastguard Worker /**
1375*9e564957SAndroid Build Coastguard Worker  * Register filesystem module
1376*9e564957SAndroid Build Coastguard Worker  *
1377*9e564957SAndroid Build Coastguard Worker  * If the "-omodules=*name*_:..." option is present, filesystem
1378*9e564957SAndroid Build Coastguard Worker  * objects are created and pushed onto the stack with the *factory_*
1379*9e564957SAndroid Build Coastguard Worker  * function.
1380*9e564957SAndroid Build Coastguard Worker  *
1381*9e564957SAndroid Build Coastguard Worker  * @param name_ the name of this filesystem module
1382*9e564957SAndroid Build Coastguard Worker  * @param factory_ the factory function for this filesystem module
1383*9e564957SAndroid Build Coastguard Worker  */
1384*9e564957SAndroid Build Coastguard Worker #define FUSE_REGISTER_MODULE(name_, factory_) \
1385*9e564957SAndroid Build Coastguard Worker 	fuse_module_factory_t fuse_module_ ## name_ ## _factory = factory_
1386*9e564957SAndroid Build Coastguard Worker 
1387*9e564957SAndroid Build Coastguard Worker /** Get session from fuse object */
1388*9e564957SAndroid Build Coastguard Worker struct fuse_session *fuse_get_session(struct fuse *f);
1389*9e564957SAndroid Build Coastguard Worker 
1390*9e564957SAndroid Build Coastguard Worker /**
1391*9e564957SAndroid Build Coastguard Worker  * Open a FUSE file descriptor and set up the mount for the given
1392*9e564957SAndroid Build Coastguard Worker  * mountpoint and flags.
1393*9e564957SAndroid Build Coastguard Worker  *
1394*9e564957SAndroid Build Coastguard Worker  * @param mountpoint reference to the mount in the file system
1395*9e564957SAndroid Build Coastguard Worker  * @param options mount options
1396*9e564957SAndroid Build Coastguard Worker  * @return the FUSE file descriptor or -1 upon error
1397*9e564957SAndroid Build Coastguard Worker  */
1398*9e564957SAndroid Build Coastguard Worker int fuse_open_channel(const char *mountpoint, const char *options);
1399*9e564957SAndroid Build Coastguard Worker 
1400*9e564957SAndroid Build Coastguard Worker #ifdef __cplusplus
1401*9e564957SAndroid Build Coastguard Worker }
1402*9e564957SAndroid Build Coastguard Worker #endif
1403*9e564957SAndroid Build Coastguard Worker 
1404*9e564957SAndroid Build Coastguard Worker #endif /* FUSE_H_ */
1405