Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 1 | /* |
| 2 | FUSE: Filesystem in Userspace |
Miklos Szeredi | 149f607 | 2005-01-10 12:29:28 +0000 | [diff] [blame] | 3 | Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu> |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 4 | |
Miklos Szeredi | 8b39a9f | 2002-10-25 12:41:16 +0000 | [diff] [blame] | 5 | This program can be distributed under the terms of the GNU LGPL. |
| 6 | See the file COPYING.LIB. |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Miklos Szeredi | acd4e06 | 2001-12-08 20:29:20 +0000 | [diff] [blame] | 9 | #ifndef _FUSE_H_ |
| 10 | #define _FUSE_H_ |
| 11 | |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 12 | /* This file defines the library interface of FUSE */ |
| 13 | |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 14 | /* IMPORTANT: you should define FUSE_USE_VERSION before including this |
| 15 | header. To use the new API define it to 22 (recommended for any |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 16 | new application), to use the old API define it to 21 (this is the |
| 17 | default), to use the even older 1.X API define it to 11. */ |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 18 | |
| 19 | #ifndef FUSE_USE_VERSION |
| 20 | #define FUSE_USE_VERSION 21 |
| 21 | #endif |
| 22 | |
Miklos Szeredi | 2f3d940 | 2003-12-15 12:11:33 +0000 | [diff] [blame] | 23 | /** Major version of FUSE library interface */ |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 24 | #define FUSE_MAJOR_VERSION 2 |
Miklos Szeredi | 2f3d940 | 2003-12-15 12:11:33 +0000 | [diff] [blame] | 25 | |
| 26 | /** Minor version of FUSE library interface */ |
Miklos Szeredi | 31066bb | 2005-08-01 14:49:31 +0000 | [diff] [blame] | 27 | #define FUSE_MINOR_VERSION 4 |
Miklos Szeredi | 2f3d940 | 2003-12-15 12:11:33 +0000 | [diff] [blame] | 28 | |
Miklos Szeredi | 87f30a9 | 2004-04-13 10:49:54 +0000 | [diff] [blame] | 29 | /* This interface uses 64 bit off_t */ |
| 30 | #if _FILE_OFFSET_BITS != 64 |
| 31 | #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags! |
| 32 | #endif |
Miklos Szeredi | 5f05481 | 2002-12-03 18:45:21 +0000 | [diff] [blame] | 33 | |
Miklos Szeredi | 76c1752 | 2005-07-13 14:08:19 +0000 | [diff] [blame] | 34 | #include "fuse_common.h" |
| 35 | |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 36 | #include <sys/types.h> |
| 37 | #include <sys/stat.h> |
Miklos Szeredi | 18e75e4 | 2004-02-19 14:23:27 +0000 | [diff] [blame] | 38 | #include <sys/statfs.h> |
Miklos Szeredi | 5e18348 | 2001-10-31 14:52:35 +0000 | [diff] [blame] | 39 | #include <utime.h> |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 40 | |
Miklos Szeredi | 8fb48fe | 2004-11-08 14:48:52 +0000 | [diff] [blame] | 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
Miklos Szeredi | cc8c975 | 2001-11-21 10:03:39 +0000 | [diff] [blame] | 45 | /* ----------------------------------------------------------- * |
| 46 | * Basic FUSE API * |
| 47 | * ----------------------------------------------------------- */ |
| 48 | |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 49 | /** Handle for a FUSE filesystem */ |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 50 | struct fuse; |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 51 | |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 52 | /** Function to add an entry in a readdir() operation |
| 53 | * |
| 54 | * @param buf the buffer passed to the readdir() operation |
| 55 | * @param name the file name of the directory entry |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 56 | * @param stat file attributes, can be NULL |
| 57 | * @param off offset of the next entry or zero |
| 58 | * @return 1 if buffer is full, zero otherwise |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 59 | */ |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 60 | typedef int (*fuse_fill_dir_t) (void *buf, const char *name, |
Miklos Szeredi | f6e0ec6 | 2005-08-03 09:11:06 +0000 | [diff] [blame^] | 61 | const struct stat *stbuf, off_t off); |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 62 | |
| 63 | /* Used by deprecated getdir() method */ |
| 64 | typedef struct fuse_dirhandle *fuse_dirh_t; |
| 65 | typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type, |
| 66 | ino_t ino); |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 67 | |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 68 | /** |
| 69 | * The file system operations: |
| 70 | * |
| 71 | * Most of these should work very similarly to the well known UNIX |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 72 | * file system operations. A major exception is that instead of |
| 73 | * returning an error in 'errno', the operation should return the |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 74 | * negated error value (-errno) directly. |
Miklos Szeredi | e56818b | 2004-12-12 11:45:24 +0000 | [diff] [blame] | 75 | * |
| 76 | * All methods are optional, but some are essential for a useful |
Miklos Szeredi | 31066bb | 2005-08-01 14:49:31 +0000 | [diff] [blame] | 77 | * filesystem (e.g. getattr). Open, flush, release, fsync, opendir, |
| 78 | * releasedir, fsyncdir, init and destroy are special purpose methods, |
| 79 | * without which a full featured filesystem can still be implemented. |
Miklos Szeredi | e2e4ac2 | 2004-05-18 08:45:28 +0000 | [diff] [blame] | 80 | */ |
Miklos Szeredi | a181e61 | 2001-11-06 12:03:23 +0000 | [diff] [blame] | 81 | struct fuse_operations { |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 82 | /** Get file attributes. |
| 83 | * |
| 84 | * Similar to stat(). The 'st_dev' and 'st_blksize' fields are |
| 85 | * ignored. The 'st_ino' field is ignored except if the 'use_ino' |
| 86 | * mount option is given. |
| 87 | */ |
| 88 | int (*getattr) (const char *, struct stat *); |
| 89 | |
| 90 | /** Read the target of a symbolic link |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 91 | * |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 92 | * The buffer should be filled with a null terminated string. The |
| 93 | * buffer size argument includes the space for the terminating |
| 94 | * null character. If the linkname is too long to fit in the |
| 95 | * buffer, it should be truncated. The return value should be 0 |
| 96 | * for success. |
| 97 | */ |
| 98 | int (*readlink) (const char *, char *, size_t); |
| 99 | |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 100 | /* Deprecated, use readdir() instead */ |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 101 | int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t); |
| 102 | |
| 103 | /** Create a file node |
| 104 | * |
| 105 | * There is no create() operation, mknod() will be called for |
| 106 | * creation of all non-directory, non-symlink nodes. |
| 107 | */ |
| 108 | int (*mknod) (const char *, mode_t, dev_t); |
| 109 | |
| 110 | /** Create a directory */ |
| 111 | int (*mkdir) (const char *, mode_t); |
| 112 | |
| 113 | /** Remove a file */ |
| 114 | int (*unlink) (const char *); |
| 115 | |
| 116 | /** Remove a directory */ |
| 117 | int (*rmdir) (const char *); |
| 118 | |
| 119 | /** Create a symbolic link */ |
| 120 | int (*symlink) (const char *, const char *); |
| 121 | |
| 122 | /** Rename a file */ |
| 123 | int (*rename) (const char *, const char *); |
| 124 | |
| 125 | /** Create a hard link to a file */ |
| 126 | int (*link) (const char *, const char *); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 127 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 128 | /** Change the permission bits of a file */ |
| 129 | int (*chmod) (const char *, mode_t); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 130 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 131 | /** Change the owner and group of a file */ |
| 132 | int (*chown) (const char *, uid_t, gid_t); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 133 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 134 | /** Change the size of a file */ |
| 135 | int (*truncate) (const char *, off_t); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 136 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 137 | /** Change the access and/or modification times of a file */ |
| 138 | int (*utime) (const char *, struct utimbuf *); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 139 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 140 | /** File open operation |
| 141 | * |
| 142 | * No creation, or trunctation flags (O_CREAT, O_EXCL, O_TRUNC) |
Miklos Szeredi | 009b878 | 2005-08-01 13:36:53 +0000 | [diff] [blame] | 143 | * will be passed to open(). Optionally open may return an |
| 144 | * arbitary filehandle in the fuse_file_info structure, which will |
| 145 | * be passed to all file operations. |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 146 | * |
Miklos Szeredi | 31066bb | 2005-08-01 14:49:31 +0000 | [diff] [blame] | 147 | * Open does not need to check the permission to open the file |
| 148 | * with the given flags. In fact it cannot correctly do that |
| 149 | * since it doesn't have a way to determine if the file was just |
| 150 | * created (and hence the permission need not be checked). |
Miklos Szeredi | f6e0ec6 | 2005-08-03 09:11:06 +0000 | [diff] [blame^] | 151 | * |
Miklos Szeredi | 31066bb | 2005-08-01 14:49:31 +0000 | [diff] [blame] | 152 | * If permission needs to be checked, implement the access() |
| 153 | * method, and do the check there. |
| 154 | * |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 155 | * Changed in version 2.2 |
Miklos Szeredi | 31066bb | 2005-08-01 14:49:31 +0000 | [diff] [blame] | 156 | * Optional from version 2.4 |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 157 | */ |
| 158 | int (*open) (const char *, struct fuse_file_info *); |
| 159 | |
| 160 | /** Read data from an open file |
| 161 | * |
| 162 | * Read should return exactly the number of bytes requested except |
| 163 | * on EOF or error, otherwise the rest of the data will be |
| 164 | * substituted with zeroes. An exception to this is when the |
| 165 | * 'direct_io' mount option is specified, in which case the return |
| 166 | * value of the read system call will reflect the return value of |
| 167 | * this operation. |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 168 | * |
| 169 | * Changed in version 2.2 |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 170 | */ |
| 171 | int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *); |
| 172 | |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 173 | /** Write data to an open file |
| 174 | * |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 175 | * Write should return exactly the number of bytes requested |
| 176 | * except on error. An exception to this is when the 'direct_io' |
| 177 | * mount option is specified (see read operation). |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 178 | * |
| 179 | * Changed in version 2.2 |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 180 | */ |
| 181 | int (*write) (const char *, const char *, size_t, off_t, |
| 182 | struct fuse_file_info *); |
| 183 | |
| 184 | /** Get file system statistics |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 185 | * |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 186 | * The 'f_type' and 'f_fsid' fields are ignored |
| 187 | */ |
| 188 | int (*statfs) (const char *, struct statfs *); |
| 189 | |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 190 | /** Possibly flush cached data |
| 191 | * |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 192 | * BIG NOTE: This is not equivalent to fsync(). It's not a |
Miklos Szeredi | e56818b | 2004-12-12 11:45:24 +0000 | [diff] [blame] | 193 | * request to sync dirty data. |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 194 | * |
| 195 | * Flush is called on each close() of a file descriptor. So if a |
| 196 | * filesystem wants to return write errors in close() and the file |
| 197 | * has cached dirty data, this is a good place to write back data |
Miklos Szeredi | e56818b | 2004-12-12 11:45:24 +0000 | [diff] [blame] | 198 | * and return any errors. Since many applications ignore close() |
| 199 | * errors this is not always useful. |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 200 | * |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 201 | * NOTE: The flush() method may be called more than once for each |
| 202 | * open(). This happens if more than one file descriptor refers |
| 203 | * to an opened file due to dup(), dup2() or fork() calls. It is |
| 204 | * not possible to determine if a flush is final, so each flush |
| 205 | * should be treated equally. Multiple write-flush sequences are |
| 206 | * relatively rare, so this shouldn't be a problem. |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 207 | * |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 208 | * Changed in version 2.2 |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 209 | */ |
| 210 | int (*flush) (const char *, struct fuse_file_info *); |
| 211 | |
| 212 | /** Release an open file |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 213 | * |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 214 | * Release is called when there are no more references to an open |
| 215 | * file: all file descriptors are closed and all memory mappings |
| 216 | * are unmapped. |
| 217 | * |
| 218 | * For every open() call there will be exactly one release() call |
Miklos Szeredi | e56818b | 2004-12-12 11:45:24 +0000 | [diff] [blame] | 219 | * with the same flags and file descriptor. It is possible to |
| 220 | * have a file opened more than once, in which case only the last |
| 221 | * release will mean, that no more reads/writes will happen on the |
| 222 | * file. The return value of release is ignored. |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 223 | * |
| 224 | * Changed in version 2.2 |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 225 | */ |
| 226 | int (*release) (const char *, struct fuse_file_info *); |
| 227 | |
| 228 | /** Synchronize file contents |
| 229 | * |
| 230 | * If the datasync parameter is non-zero, then only the user data |
| 231 | * should be flushed, not the meta data. |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 232 | * |
| 233 | * Changed in version 2.2 |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 234 | */ |
| 235 | int (*fsync) (const char *, int, struct fuse_file_info *); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 236 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 237 | /** Set extended attributes */ |
| 238 | int (*setxattr) (const char *, const char *, const char *, size_t, int); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 239 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 240 | /** Get extended attributes */ |
| 241 | int (*getxattr) (const char *, const char *, char *, size_t); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 242 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 243 | /** List extended attributes */ |
| 244 | int (*listxattr) (const char *, char *, size_t); |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 245 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 246 | /** Remove extended attributes */ |
Miklos Szeredi | 3ed8423 | 2004-03-30 15:17:26 +0000 | [diff] [blame] | 247 | int (*removexattr) (const char *, const char *); |
Miklos Szeredi | f43f063 | 2005-02-28 11:46:56 +0000 | [diff] [blame] | 248 | |
Miklos Szeredi | 009b878 | 2005-08-01 13:36:53 +0000 | [diff] [blame] | 249 | /** Open directory |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 250 | * |
| 251 | * Introduced in version 2.3 |
Miklos Szeredi | f43f063 | 2005-02-28 11:46:56 +0000 | [diff] [blame] | 252 | */ |
| 253 | int (*opendir) (const char *, struct fuse_file_info *); |
Miklos Szeredi | 159bd7e | 2005-02-28 17:32:16 +0000 | [diff] [blame] | 254 | |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 255 | /** Read directory |
| 256 | * |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 257 | * This supersedes the old getdir() interface. New applications |
| 258 | * should use this. |
| 259 | * |
| 260 | * The filesystem may choose between two modes of operation: |
Miklos Szeredi | 21019c9 | 2005-05-09 11:22:41 +0000 | [diff] [blame] | 261 | * |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 262 | * 1) The readdir implementation ignores the offset parameter, and |
| 263 | * passes zero to the filler function's offset. The filler |
| 264 | * function will not return '1' (unless an error happens), so the |
| 265 | * whole directory is read in a single readdir operation. This |
| 266 | * works just like the old getdir() method. |
| 267 | * |
| 268 | * 2) The readdir implementation keeps track of the offsets of the |
| 269 | * directory entries. It uses the offset parameter and always |
| 270 | * passes non-zero offset to the filler function. When the buffer |
| 271 | * is full (or an error happens) the filler function will return |
| 272 | * '1'. |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 273 | * |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 274 | * Introduced in version 2.3 |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 275 | */ |
Miklos Szeredi | ab97456 | 2005-04-07 15:40:21 +0000 | [diff] [blame] | 276 | int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t, |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 277 | struct fuse_file_info *); |
| 278 | |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 279 | /** Release directory |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 280 | * |
| 281 | * Introduced in version 2.3 |
| 282 | */ |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 283 | int (*releasedir) (const char *, struct fuse_file_info *); |
| 284 | |
Miklos Szeredi | 4283ee7 | 2005-03-21 12:09:04 +0000 | [diff] [blame] | 285 | /** Synchronize directory contents |
| 286 | * |
| 287 | * If the datasync parameter is non-zero, then only the user data |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 288 | * should be flushed, not the meta data |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 289 | * |
| 290 | * Introduced in version 2.3 |
Miklos Szeredi | 4283ee7 | 2005-03-21 12:09:04 +0000 | [diff] [blame] | 291 | */ |
| 292 | int (*fsyncdir) (const char *, int, struct fuse_file_info *); |
| 293 | |
Miklos Szeredi | 159bd7e | 2005-02-28 17:32:16 +0000 | [diff] [blame] | 294 | /** |
| 295 | * Initialize filesystem |
| 296 | * |
| 297 | * The return value will passed in the private_data field of |
| 298 | * fuse_context to all file operations and as a parameter to the |
| 299 | * destroy() method. |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 300 | * |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 301 | * Introduced in version 2.3 |
Miklos Szeredi | 159bd7e | 2005-02-28 17:32:16 +0000 | [diff] [blame] | 302 | */ |
| 303 | void *(*init) (void); |
| 304 | |
| 305 | /** |
| 306 | * Clean up filesystem |
Miklos Szeredi | 18fce98 | 2005-04-01 21:07:35 +0000 | [diff] [blame] | 307 | * |
Miklos Szeredi | 159bd7e | 2005-02-28 17:32:16 +0000 | [diff] [blame] | 308 | * Called on filesystem exit. |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 309 | * |
Miklos Szeredi | 437d811 | 2005-07-06 09:14:20 +0000 | [diff] [blame] | 310 | * Introduced in version 2.3 |
Miklos Szeredi | 159bd7e | 2005-02-28 17:32:16 +0000 | [diff] [blame] | 311 | */ |
| 312 | void (*destroy) (void *); |
Miklos Szeredi | 7b28eae | 2005-08-01 12:48:30 +0000 | [diff] [blame] | 313 | |
| 314 | /** |
| 315 | * Check file access permissions |
Miklos Szeredi | f6e0ec6 | 2005-08-03 09:11:06 +0000 | [diff] [blame^] | 316 | * |
Miklos Szeredi | 7b28eae | 2005-08-01 12:48:30 +0000 | [diff] [blame] | 317 | * Need not be implemented. Will only be called for the access() |
Miklos Szeredi | 009b878 | 2005-08-01 13:36:53 +0000 | [diff] [blame] | 318 | * system call, and for the open() system call, unless a new file |
| 319 | * is created (file didn't exist and O_CREAT was given). If the |
| 320 | * 'default_permissions' mount option is given, this method is |
| 321 | * never called. |
Miklos Szeredi | 7b28eae | 2005-08-01 12:48:30 +0000 | [diff] [blame] | 322 | * |
| 323 | * Introduced in version 2.4 |
| 324 | */ |
| 325 | int (*access) (const char *, int); |
Miklos Szeredi | a181e61 | 2001-11-06 12:03:23 +0000 | [diff] [blame] | 326 | }; |
| 327 | |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 328 | /** Extra context that may be needed by some filesystems |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 329 | * |
| 330 | * The uid, gid and pid fields are not filled in case of a writepage |
| 331 | * operation. |
| 332 | */ |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 333 | struct fuse_context { |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 334 | /** Pointer to the fuse object */ |
Miklos Szeredi | d169f31 | 2004-09-22 08:48:26 +0000 | [diff] [blame] | 335 | struct fuse *fuse; |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 336 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 337 | /** User ID of the calling process */ |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 338 | uid_t uid; |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 339 | |
| 340 | /** Group ID of the calling process */ |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 341 | gid_t gid; |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 342 | |
| 343 | /** Thread ID of the calling process */ |
Miklos Szeredi | 1f18db5 | 2004-09-27 06:54:49 +0000 | [diff] [blame] | 344 | pid_t pid; |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 345 | |
Miklos Szeredi | 159bd7e | 2005-02-28 17:32:16 +0000 | [diff] [blame] | 346 | /** Private filesystem data */ |
Miklos Szeredi | 8fb48fe | 2004-11-08 14:48:52 +0000 | [diff] [blame] | 347 | void *private_data; |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 348 | }; |
| 349 | |
Miklos Szeredi | a4b0c77 | 2002-04-19 15:57:02 +0000 | [diff] [blame] | 350 | /* |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 351 | * Main function of FUSE. |
| 352 | * |
| 353 | * This is for the lazy. This is all that has to be called from the |
| 354 | * main() function. |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 355 | * |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 356 | * This function does the following: |
Miklos Szeredi | 307242f | 2004-01-26 11:28:44 +0000 | [diff] [blame] | 357 | * - parses command line options (-d -s and -h) |
Miklos Szeredi | bd7661b | 2004-07-23 17:16:29 +0000 | [diff] [blame] | 358 | * - passes relevant mount options to the fuse_mount() |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 359 | * - installs signal handlers for INT, HUP, TERM and PIPE |
| 360 | * - registers an exit handler to unmount the filesystem on program exit |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 361 | * - creates a fuse handle |
| 362 | * - registers the operations |
| 363 | * - calls either the single-threaded or the multi-threaded event loop |
| 364 | * |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 365 | * Note: this is currently implemented as a macro. |
| 366 | * |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 367 | * @param argc the argument counter passed to the main() function |
| 368 | * @param argv the argument vector passed to the main() function |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 369 | * @param op the file system operation |
Miklos Szeredi | 5dc8a80 | 2004-10-21 09:35:10 +0000 | [diff] [blame] | 370 | * @return 0 on success, nonzero on failure |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 371 | */ |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 372 | /* |
| 373 | int fuse_main(int argc, char *argv[], const struct fuse_operations *op); |
| 374 | */ |
| 375 | #define fuse_main(argc, argv, op) \ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 376 | fuse_main_real(argc, argv, op, sizeof(*(op))) |
Miklos Szeredi | 891b874 | 2004-07-29 09:27:49 +0000 | [diff] [blame] | 377 | |
Miklos Szeredi | 0e53508 | 2003-10-13 10:08:06 +0000 | [diff] [blame] | 378 | /* ----------------------------------------------------------- * |
| 379 | * More detailed API * |
| 380 | * ----------------------------------------------------------- */ |
| 381 | |
| 382 | /* |
Miklos Szeredi | a4b0c77 | 2002-04-19 15:57:02 +0000 | [diff] [blame] | 383 | * Create a FUSE mountpoint |
| 384 | * |
| 385 | * Returns a control file descriptor suitable for passing to |
| 386 | * fuse_new() |
| 387 | * |
| 388 | * @param mountpoint the mount point path |
Miklos Szeredi | bd7661b | 2004-07-23 17:16:29 +0000 | [diff] [blame] | 389 | * @param opts a comma separated list of mount options. Can be NULL. |
Miklos Szeredi | a4b0c77 | 2002-04-19 15:57:02 +0000 | [diff] [blame] | 390 | * @return the control file descriptor on success, -1 on failure |
| 391 | */ |
Miklos Szeredi | bd7661b | 2004-07-23 17:16:29 +0000 | [diff] [blame] | 392 | int fuse_mount(const char *mountpoint, const char *opts); |
Miklos Szeredi | a4b0c77 | 2002-04-19 15:57:02 +0000 | [diff] [blame] | 393 | |
Miklos Szeredi | 0f48a26 | 2002-12-05 14:23:01 +0000 | [diff] [blame] | 394 | /* |
| 395 | * Umount a FUSE mountpoint |
| 396 | * |
| 397 | * @param mountpoint the mount point path |
| 398 | */ |
| 399 | void fuse_unmount(const char *mountpoint); |
| 400 | |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 401 | /** |
Miklos Szeredi | 8cffdb9 | 2001-11-09 14:49:18 +0000 | [diff] [blame] | 402 | * Create a new FUSE filesystem. |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 403 | * |
Miklos Szeredi | 8cffdb9 | 2001-11-09 14:49:18 +0000 | [diff] [blame] | 404 | * @param fd the control file descriptor |
Miklos Szeredi | bd7661b | 2004-07-23 17:16:29 +0000 | [diff] [blame] | 405 | * @param opts mount options to be used by the library |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 406 | * @param op the operations |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 407 | * @param op_size the size of the fuse_operations structure |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 408 | * @return the created FUSE handle |
| 409 | */ |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 410 | struct fuse *fuse_new(int fd, const char *opts, |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 411 | const struct fuse_operations *op, size_t op_size); |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 412 | |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 413 | /** |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 414 | * Destroy the FUSE handle. |
Miklos Szeredi | 0f48a26 | 2002-12-05 14:23:01 +0000 | [diff] [blame] | 415 | * |
| 416 | * The filesystem is not unmounted. |
| 417 | * |
| 418 | * @param f the FUSE handle |
| 419 | */ |
| 420 | void fuse_destroy(struct fuse *f); |
| 421 | |
| 422 | /** |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 423 | * FUSE event loop. |
| 424 | * |
| 425 | * Requests from the kernel are processed, and the apropriate |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 426 | * operations are called. |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 427 | * |
| 428 | * @param f the FUSE handle |
Miklos Szeredi | b2cf956 | 2004-09-16 08:42:40 +0000 | [diff] [blame] | 429 | * @return 0 if no error occured, -1 otherwise |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 430 | */ |
Miklos Szeredi | b2cf956 | 2004-09-16 08:42:40 +0000 | [diff] [blame] | 431 | int fuse_loop(struct fuse *f); |
Miklos Szeredi | 85c74fc | 2001-10-28 19:44:14 +0000 | [diff] [blame] | 432 | |
Miklos Szeredi | 0f48a26 | 2002-12-05 14:23:01 +0000 | [diff] [blame] | 433 | /** |
| 434 | * Exit from event loop |
| 435 | * |
| 436 | * @param f the FUSE handle |
| 437 | */ |
| 438 | void fuse_exit(struct fuse *f); |
| 439 | |
Miklos Szeredi | 2df1c04 | 2001-11-06 15:07:17 +0000 | [diff] [blame] | 440 | /** |
Miklos Szeredi | fff56ab | 2001-11-16 10:12:59 +0000 | [diff] [blame] | 441 | * FUSE event loop with multiple threads |
| 442 | * |
| 443 | * Requests from the kernel are processed, and the apropriate |
| 444 | * operations are called. Request are processed in parallel by |
| 445 | * distributing them between multiple threads. |
| 446 | * |
| 447 | * Calling this function requires the pthreads library to be linked to |
| 448 | * the application. |
| 449 | * |
| 450 | * @param f the FUSE handle |
Miklos Szeredi | b2cf956 | 2004-09-16 08:42:40 +0000 | [diff] [blame] | 451 | * @return 0 if no error occured, -1 otherwise |
Miklos Szeredi | fff56ab | 2001-11-16 10:12:59 +0000 | [diff] [blame] | 452 | */ |
Miklos Szeredi | b2cf956 | 2004-09-16 08:42:40 +0000 | [diff] [blame] | 453 | int fuse_loop_mt(struct fuse *f); |
Miklos Szeredi | fff56ab | 2001-11-16 10:12:59 +0000 | [diff] [blame] | 454 | |
| 455 | /** |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 456 | * Get the current context |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 457 | * |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 458 | * The context is only valid for the duration of a filesystem |
| 459 | * operation, and thus must not be stored and used later. |
| 460 | * |
| 461 | * @param f the FUSE handle |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 462 | * @return the context |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 463 | */ |
Miklos Szeredi | d169f31 | 2004-09-22 08:48:26 +0000 | [diff] [blame] | 464 | struct fuse_context *fuse_get_context(void); |
Miklos Szeredi | 2e50d43 | 2001-12-20 12:17:25 +0000 | [diff] [blame] | 465 | |
Miklos Szeredi | bd7661b | 2004-07-23 17:16:29 +0000 | [diff] [blame] | 466 | /** |
Miklos Szeredi | 76c1752 | 2005-07-13 14:08:19 +0000 | [diff] [blame] | 467 | * Obsolete, doesn't do anything |
Miklos Szeredi | 9b813af | 2005-07-21 07:59:37 +0000 | [diff] [blame] | 468 | * |
Miklos Szeredi | bd10a7b | 2005-07-15 09:59:59 +0000 | [diff] [blame] | 469 | * @return -EINVAL |
Miklos Szeredi | 5dc8a80 | 2004-10-21 09:35:10 +0000 | [diff] [blame] | 470 | */ |
| 471 | int fuse_invalidate(struct fuse *f, const char *path); |
| 472 | |
| 473 | /** |
Miklos Szeredi | bd7661b | 2004-07-23 17:16:29 +0000 | [diff] [blame] | 474 | * Check whether a mount option should be passed to the kernel or the |
| 475 | * library |
| 476 | * |
| 477 | * @param opt the option to check |
| 478 | * @return 1 if it is a library option, 0 otherwise |
| 479 | */ |
| 480 | int fuse_is_lib_option(const char *opt); |
| 481 | |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 482 | /** |
| 483 | * The real main function |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 484 | * |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 485 | * Do not call this directly, use fuse_main() |
| 486 | */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 487 | int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, |
| 488 | size_t op_size); |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 489 | |
Miklos Szeredi | cc8c975 | 2001-11-21 10:03:39 +0000 | [diff] [blame] | 490 | /* ----------------------------------------------------------- * |
Miklos Szeredi | 680a69a | 2001-11-16 13:31:14 +0000 | [diff] [blame] | 491 | * Advanced API for event handling, don't worry about this... * |
| 492 | * ----------------------------------------------------------- */ |
Miklos Szeredi | fff56ab | 2001-11-16 10:12:59 +0000 | [diff] [blame] | 493 | |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 494 | /** Function type used to process commands */ |
Miklos Szeredi | f830a7f | 2001-11-16 17:46:45 +0000 | [diff] [blame] | 495 | typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 496 | |
| 497 | /** This is the part of fuse_main() before the event loop */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 498 | struct fuse *fuse_setup(int argc, char *argv[], |
| 499 | const struct fuse_operations *op, size_t op_size, |
Miklos Szeredi | 5dc8a80 | 2004-10-21 09:35:10 +0000 | [diff] [blame] | 500 | char **mountpoint, int *multithreaded, int *fd); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 501 | |
| 502 | /** This is the part of fuse_main() after the event loop */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 503 | void fuse_teardown(struct fuse *fuse, int fd, char *mountpoint); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 504 | |
| 505 | /** Read a single command. If none are read, return NULL */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 506 | struct fuse_cmd *fuse_read_cmd(struct fuse *f); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 507 | |
| 508 | /** Process a single command */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 509 | void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 510 | |
| 511 | /** Multi threaded event loop, which calls the custom command |
| 512 | processor function */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 513 | int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 514 | |
| 515 | /** Return the exited flag, which indicates if fuse_exit() has been |
| 516 | called */ |
Miklos Szeredi | e2aa2e2 | 2005-07-15 13:31:36 +0000 | [diff] [blame] | 517 | int fuse_exited(struct fuse *f); |
Miklos Szeredi | d59bb9d | 2004-12-07 10:04:24 +0000 | [diff] [blame] | 518 | |
| 519 | /** Set function which can be used to get the current context */ |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 520 | void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); |
Miklos Szeredi | f830a7f | 2001-11-16 17:46:45 +0000 | [diff] [blame] | 521 | |
Miklos Szeredi | e2aa2e2 | 2005-07-15 13:31:36 +0000 | [diff] [blame] | 522 | /** Returns the lowlevel FUSE object */ |
| 523 | struct fuse_ll *fuse_get_lowlevel(struct fuse *f); |
| 524 | |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 525 | /* ----------------------------------------------------------- * |
| 526 | * Compatibility stuff * |
| 527 | * ----------------------------------------------------------- */ |
| 528 | |
| 529 | #if FUSE_USE_VERSION == 21 || FUSE_USE_VERSION == 11 |
Miklos Szeredi | e56818b | 2004-12-12 11:45:24 +0000 | [diff] [blame] | 530 | # include "fuse_compat.h" |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 531 | # define fuse_dirfil_t fuse_dirfil_t_compat |
| 532 | # define __fuse_read_cmd fuse_read_cmd |
| 533 | # define __fuse_process_cmd fuse_process_cmd |
| 534 | # define __fuse_loop_mt fuse_loop_mt_proc |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 535 | # undef fuse_main |
| 536 | # undef FUSE_MINOR_VERSION |
| 537 | # undef FUSE_MAJOR_VERSION |
| 538 | # if FUSE_USE_VERSION == 21 |
| 539 | # define FUSE_MAJOR_VERSION 2 |
| 540 | # define FUSE_MINOR_VERSION 1 |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 541 | # define fuse_operations fuse_operations_compat2 |
| 542 | # define fuse_main fuse_main_compat2 |
| 543 | # define fuse_new fuse_new_compat2 |
| 544 | # define __fuse_setup fuse_setup_compat2 |
| 545 | # define __fuse_teardown fuse_teardown |
| 546 | # define __fuse_exited fuse_exited |
| 547 | # define __fuse_set_getcontext_func fuse_set_getcontext_func |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 548 | # else |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 549 | # define FUSE_MAJOR_VERSION 1 |
| 550 | # define FUSE_MINOR_VERSION 1 |
Miklos Szeredi | f458b8c | 2004-12-07 16:46:42 +0000 | [diff] [blame] | 551 | # define fuse_statfs fuse_statfs_compat1 |
| 552 | # define fuse_operations fuse_operations_compat1 |
| 553 | # define fuse_main fuse_main_compat1 |
| 554 | # define fuse_new fuse_new_compat1 |
| 555 | # define fuse_mount fuse_mount_compat1 |
| 556 | # define FUSE_DEBUG FUSE_DEBUG_COMPAT1 |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 557 | # endif |
Miklos Szeredi | 799993c | 2004-12-04 21:20:05 +0000 | [diff] [blame] | 558 | #elif FUSE_USE_VERSION < 22 |
| 559 | # error Compatibility with API version other than 21 and 11 not supported |
Miklos Szeredi | 0b6a0ad | 2004-12-04 00:40:50 +0000 | [diff] [blame] | 560 | #endif |
| 561 | |
Miklos Szeredi | acd4e06 | 2001-12-08 20:29:20 +0000 | [diff] [blame] | 562 | #ifdef __cplusplus |
| 563 | } |
| 564 | #endif |
| 565 | |
| 566 | #endif /* _FUSE_H_ */ |