2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU LGPLv2.
6 See the file COPYING.LIB.
11 #if !defined(_FUSE_H_) && !defined(_FUSE_LOWLEVEL_H_)
12 #error "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."
15 #ifndef _FUSE_COMMON_H_
16 #define _FUSE_COMMON_H_
19 #include <stdio.h> /* temporary */
22 /** Major version of FUSE library interface */
23 #define FUSE_MAJOR_VERSION 2
25 /** Minor version of FUSE library interface */
27 #define FUSE_MINOR_VERSION 8
29 #define FUSE_MINOR_VERSION 7
32 #define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
33 #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
35 /* This interface uses 64 bit off_t */
36 #if defined(__SOLARIS__) && !defined(__x86_64__) && (_FILE_OFFSET_BITS != 64)
37 #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
46 * FUSE_CAP_DONT_MASK: don't apply umask to file mode on create operations
48 #define FUSE_CAP_DONT_MASK (1 << 6)
51 #define FUSE_CAP_BIG_WRITES (1 << 5)
54 * Information about open files
56 * Changed in version 2.5
58 struct fuse_file_info
{
59 /** Open flags. Available in open() and release() */
62 /** Old file handle, don't use */
65 /** In case of a write operation indicates if this was caused by a
69 /** Can be filled in by open, to use direct I/O on this file.
70 Introduced in version 2.4 */
71 unsigned int direct_io
: 1;
73 /** Can be filled in by open, to indicate, that cached file data
74 need not be invalidated. Introduced in version 2.4 */
75 unsigned int keep_cache
: 1;
77 /** Indicates a flush operation. Set in flush operation, also
78 maybe set in highlevel lock operation and lowlevel release
79 operation. Introduced in version 2.6 */
80 unsigned int flush
: 1;
82 /** Padding. Do not use*/
83 unsigned int padding
: 29;
85 /** File handle. May be filled in by filesystem in open().
86 Available in all other file operations */
89 /** Lock owner id. Available in locking operations and flush */
94 * Connection information, passed to the ->init() method
96 * Some of the elements are read-write, these can be changed to
97 * indicate the value requested by the filesystem. The requested
98 * value must usually be smaller than the indicated value.
100 struct fuse_conn_info
{
102 * Major version of the protocol (read-only)
104 unsigned proto_major
;
107 * Minor version of the protocol (read-only)
109 unsigned proto_minor
;
112 * Is asynchronous read supported (read-write)
117 * Maximum size of the write buffer
124 unsigned max_readahead
;
131 unsigned reserved
[25];
138 * Create a FUSE mountpoint
140 * Returns a control file descriptor suitable for passing to
143 * @param mountpoint the mount point path
144 * @param args argument vector
145 * @return the communication channel on success, NULL on failure
147 struct fuse_chan
*fuse_mount(const char *mountpoint
, struct fuse_args
*args
);
150 * Umount a FUSE mountpoint
152 * @param mountpoint the mount point path
153 * @param ch the communication channel
155 void fuse_unmount(const char *mountpoint
, struct fuse_chan
*ch
);
159 * Parse common options
161 * The following options are parsed:
164 * '-d' '-odebug' foreground, but keep the debug option
165 * '-s' single threaded
167 * '-ho' help without header
168 * '-ofsname=..' file system name, if not present, then set to the program
171 * All parameters may be NULL
173 * @param args argument vector
174 * @param mountpoint the returned mountpoint, should be freed after use
175 * @param multithreaded set to 1 unless the '-s' option is present
176 * @param foreground set to 1 if one of the relevant options is present
177 * @return 0 on success, -1 on failure
179 int fuse_parse_cmdline(struct fuse_args
*args
, char **mountpoint
,
180 int *multithreaded
, int *foreground
);
183 * Go into the background
185 * @param foreground if true, stay in the foreground
186 * @return 0 on success, -1 on failure
188 int fuse_daemonize(int foreground
);
190 #endif /* __SOLARIS__ */
193 * Get the version of the library
195 * @return the version
197 int fuse_version(void);
199 /* ----------------------------------------------------------- *
201 * ----------------------------------------------------------- */
204 * Exit session on HUP, TERM and INT signals and ignore PIPE signal
206 * Stores session in a global variable. May only be called once per
207 * process until fuse_remove_signal_handlers() is called.
209 * @param se the session to exit
210 * @return 0 on success, -1 on failure
212 int fuse_set_signal_handlers(struct fuse_session
*se
);
215 * Restore default signal handlers
217 * Resets global session. After this fuse_set_signal_handlers() may
220 * @param se the same session as given in fuse_set_signal_handlers()
222 void fuse_remove_signal_handlers(struct fuse_session
*se
);
228 #endif /* _FUSE_COMMON_H_ */