bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 1 | /* |
| 2 | FUSE: Filesystem in Userspace |
| 3 | Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu> |
| 4 | |
| 5 | This program can be distributed under the terms of the GNU LGPLv2. |
| 6 | See the file COPYING.LIB. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _FUSE_H_ |
| 10 | #define _FUSE_H_ |
| 11 | |
| 12 | /** @file |
| 13 | * |
| 14 | * This file defines the library interface of FUSE |
| 15 | * |
| 16 | * IMPORTANT: you should define FUSE_USE_VERSION before including this |
| 17 | * header. To use the newest API define it to 26 (recommended for any |
| 18 | * new application), to use the old API define it to 21 (default) 22 |
| 19 | * or 25, to use the even older 1.X API define it to 11. |
| 20 | */ |
| 21 | |
| 22 | #ifndef FUSE_USE_VERSION |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 23 | #define FUSE_USE_VERSION 21 |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 24 | #endif |
| 25 | |
| 26 | #include "fuse_common.h" |
| 27 | |
| 28 | #include <fcntl.h> |
| 29 | #include <time.h> |
| 30 | #include <utime.h> |
| 31 | #include <sys/types.h> |
| 32 | #include <sys/stat.h> |
| 33 | #include <sys/statvfs.h> |
| 34 | #include <sys/uio.h> |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 35 | #include <pthread.h> |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 36 | |
| 37 | #ifdef __cplusplus |
| 38 | extern "C" { |
| 39 | #endif |
| 40 | |
| 41 | /* ----------------------------------------------------------- * |
| 42 | * Basic FUSE API * |
| 43 | * ----------------------------------------------------------- */ |
| 44 | |
| 45 | /** Handle for a FUSE filesystem */ |
| 46 | struct fuse; |
| 47 | |
| 48 | /** Structure containing a raw command */ |
| 49 | struct fuse_cmd; |
| 50 | |
| 51 | /** Function to add an entry in a readdir() operation |
| 52 | * |
| 53 | * @param buf the buffer passed to the readdir() operation |
| 54 | * @param name the file name of the directory entry |
| 55 | * @param stat file attributes, can be NULL |
| 56 | * @param off offset of the next entry or zero |
| 57 | * @return 1 if buffer is full, zero otherwise |
| 58 | */ |
| 59 | typedef int (*fuse_fill_dir_t) (void *buf, const char *name, |
| 60 | const struct stat *stbuf, off64_t off); |
| 61 | |
| 62 | /* Used by deprecated getdir() method */ |
| 63 | typedef struct fuse_dirhandle *fuse_dirh_t; |
| 64 | typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type, |
| 65 | ino_t ino); |
| 66 | |
| 67 | /** |
| 68 | * The file system operations: |
| 69 | * |
| 70 | * Most of these should work very similarly to the well known UNIX |
| 71 | * file system operations. A major exception is that instead of |
| 72 | * returning an error in 'errno', the operation should return the |
| 73 | * negated error value (-errno) directly. |
| 74 | * |
| 75 | * All methods are optional, but some are essential for a useful |
| 76 | * filesystem (e.g. getattr). Open, flush, release, fsync, opendir, |
| 77 | * releasedir, fsyncdir, access, create, ftruncate, fgetattr, lock, |
| 78 | * init and destroy are special purpose methods, without which a full |
| 79 | * featured filesystem can still be implemented. |
| 80 | * |
| 81 | * Almost all operations take a path which can be of any length. |
| 82 | * |
| 83 | * Changed in fuse 2.8.0 (regardless of API version) |
| 84 | * Previously, paths were limited to a length of PATH_MAX. |
| 85 | * |
| 86 | * See http://fuse.sourceforge.net/wiki/ for more information. There |
| 87 | * is also a snapshot of the relevant wiki pages in the doc/ folder. |
| 88 | */ |
| 89 | struct fuse_operations { |
| 90 | /** Get file attributes. |
| 91 | * |
| 92 | * Similar to stat(). The 'st_dev' and 'st_blksize' fields are |
| 93 | * ignored. The 'st_ino' field is ignored except if the 'use_ino' |
| 94 | * mount option is given. |
| 95 | */ |
| 96 | int (*getattr) (const char *, struct stat *); |
| 97 | |
| 98 | /** Read the target of a symbolic link |
| 99 | * |
| 100 | * The buffer should be filled with a null terminated string. The |
| 101 | * buffer size argument includes the space for the terminating |
| 102 | * null character. If the linkname is too long to fit in the |
| 103 | * buffer, it should be truncated. The return value should be 0 |
| 104 | * for success. |
| 105 | */ |
| 106 | int (*readlink) (const char *, char *, size_t); |
| 107 | |
| 108 | /* Deprecated, use readdir() instead */ |
| 109 | int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t); |
| 110 | |
| 111 | /** Create a file node |
| 112 | * |
| 113 | * This is called for creation of all non-directory, non-symlink |
| 114 | * nodes. If the filesystem defines a create() method, then for |
| 115 | * regular files that will be called instead. |
| 116 | */ |
| 117 | int (*mknod) (const char *, mode_t, dev_t); |
| 118 | |
| 119 | /** Create a directory |
| 120 | * |
| 121 | * Note that the mode argument may not have the type specification |
| 122 | * bits set, i.e. S_ISDIR(mode) can be false. To obtain the |
| 123 | * correct directory type bits use mode|S_IFDIR |
| 124 | * */ |
| 125 | int (*mkdir) (const char *, mode_t); |
| 126 | |
| 127 | /** Remove a file */ |
| 128 | int (*unlink) (const char *); |
| 129 | |
| 130 | /** Remove a directory */ |
| 131 | int (*rmdir) (const char *); |
| 132 | |
| 133 | /** Create a symbolic link */ |
| 134 | int (*symlink) (const char *, const char *); |
| 135 | |
| 136 | /** Rename a file */ |
| 137 | int (*rename) (const char *, const char *); |
| 138 | |
| 139 | /** Create a hard link to a file */ |
| 140 | int (*link) (const char *, const char *); |
| 141 | |
| 142 | /** Change the permission bits of a file */ |
| 143 | int (*chmod) (const char *, mode_t); |
| 144 | |
| 145 | /** Change the owner and group of a file */ |
| 146 | int (*chown) (const char *, uid_t, gid_t); |
| 147 | |
| 148 | /** Change the size of a file */ |
| 149 | int (*truncate) (const char *, off64_t); |
| 150 | |
| 151 | /** Change the access and/or modification times of a file |
| 152 | * |
| 153 | * Deprecated, use utimens() instead. |
| 154 | */ |
| 155 | int (*utime) (const char *, struct utimbuf *); |
| 156 | |
| 157 | /** File open operation |
| 158 | * |
| 159 | * No creation (O_CREAT, O_EXCL) and by default also no |
| 160 | * truncation (O_TRUNC) flags will be passed to open(). If an |
| 161 | * application specifies O_TRUNC, fuse first calls truncate() |
| 162 | * and then open(). Only if 'atomic_o_trunc' has been |
| 163 | * specified and kernel version is 2.6.24 or later, O_TRUNC is |
| 164 | * passed on to open. |
| 165 | * |
| 166 | * Unless the 'default_permissions' mount option is given, |
| 167 | * open should check if the operation is permitted for the |
| 168 | * given flags. Optionally open may also return an arbitrary |
| 169 | * filehandle in the fuse_file_info structure, which will be |
| 170 | * passed to all file operations. |
| 171 | * |
| 172 | * Changed in version 2.2 |
| 173 | */ |
| 174 | int (*open) (const char *, struct fuse_file_info *); |
| 175 | |
| 176 | /** Read data from an open file |
| 177 | * |
| 178 | * Read should return exactly the number of bytes requested except |
| 179 | * on EOF or error, otherwise the rest of the data will be |
| 180 | * substituted with zeroes. An exception to this is when the |
| 181 | * 'direct_io' mount option is specified, in which case the return |
| 182 | * value of the read system call will reflect the return value of |
| 183 | * this operation. |
| 184 | * |
| 185 | * Changed in version 2.2 |
| 186 | */ |
| 187 | int (*read) (const char *, char *, size_t, off64_t, |
| 188 | struct fuse_file_info *); |
| 189 | |
| 190 | /** Write data to an open file |
| 191 | * |
| 192 | * Write should return exactly the number of bytes requested |
| 193 | * except on error. An exception to this is when the 'direct_io' |
| 194 | * mount option is specified (see read operation). |
| 195 | * |
| 196 | * Changed in version 2.2 |
| 197 | */ |
| 198 | int (*write) (const char *, const char *, size_t, off64_t, |
| 199 | struct fuse_file_info *); |
| 200 | |
| 201 | /** Get file system statistics |
| 202 | * |
| 203 | * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored |
| 204 | * |
| 205 | * Replaced 'struct statfs' parameter with 'struct statvfs' in |
| 206 | * version 2.5 |
| 207 | */ |
| 208 | int (*statfs) (const char *, struct statvfs *); |
| 209 | |
| 210 | /** Possibly flush cached data |
| 211 | * |
| 212 | * BIG NOTE: This is not equivalent to fsync(). It's not a |
| 213 | * request to sync dirty data. |
| 214 | * |
| 215 | * Flush is called on each close() of a file descriptor. So if a |
| 216 | * filesystem wants to return write errors in close() and the file |
| 217 | * has cached dirty data, this is a good place to write back data |
| 218 | * and return any errors. Since many applications ignore close() |
| 219 | * errors this is not always useful. |
| 220 | * |
| 221 | * NOTE: The flush() method may be called more than once for each |
| 222 | * open(). This happens if more than one file descriptor refers |
| 223 | * to an opened file due to dup(), dup2() or fork() calls. It is |
| 224 | * not possible to determine if a flush is final, so each flush |
| 225 | * should be treated equally. Multiple write-flush sequences are |
| 226 | * relatively rare, so this shouldn't be a problem. |
| 227 | * |
| 228 | * Filesystems shouldn't assume that flush will always be called |
| 229 | * after some writes, or that if will be called at all. |
| 230 | * |
| 231 | * Changed in version 2.2 |
| 232 | */ |
| 233 | int (*flush) (const char *, struct fuse_file_info *); |
| 234 | |
| 235 | /** Release an open file |
| 236 | * |
| 237 | * Release is called when there are no more references to an open |
| 238 | * file: all file descriptors are closed and all memory mappings |
| 239 | * are unmapped. |
| 240 | * |
| 241 | * For every open() call there will be exactly one release() call |
| 242 | * with the same flags and file descriptor. It is possible to |
| 243 | * have a file opened more than once, in which case only the last |
| 244 | * release will mean, that no more reads/writes will happen on the |
| 245 | * file. The return value of release is ignored. |
| 246 | * |
| 247 | * Changed in version 2.2 |
| 248 | */ |
| 249 | int (*release) (const char *, struct fuse_file_info *); |
| 250 | |
| 251 | /** Synchronize file contents |
| 252 | * |
| 253 | * If the datasync parameter is non-zero, then only the user data |
| 254 | * should be flushed, not the meta data. |
| 255 | * |
| 256 | * Changed in version 2.2 |
| 257 | */ |
| 258 | int (*fsync) (const char *, int, struct fuse_file_info *); |
| 259 | |
| 260 | /** Set extended attributes */ |
| 261 | int (*setxattr) (const char *, const char *, const char *, size_t, int); |
| 262 | |
| 263 | /** Get extended attributes */ |
| 264 | int (*getxattr) (const char *, const char *, char *, size_t); |
| 265 | |
| 266 | /** List extended attributes */ |
| 267 | int (*listxattr) (const char *, char *, size_t); |
| 268 | |
| 269 | /** Remove extended attributes */ |
| 270 | int (*removexattr) (const char *, const char *); |
| 271 | |
| 272 | /** Open directory |
| 273 | * |
| 274 | * Unless the 'default_permissions' mount option is given, |
| 275 | * this method should check if opendir is permitted for this |
| 276 | * directory. Optionally opendir may also return an arbitrary |
| 277 | * filehandle in the fuse_file_info structure, which will be |
| 278 | * passed to readdir, closedir and fsyncdir. |
| 279 | * |
| 280 | * Introduced in version 2.3 |
| 281 | */ |
| 282 | int (*opendir) (const char *, struct fuse_file_info *); |
| 283 | |
| 284 | /** Read directory |
| 285 | * |
| 286 | * This supersedes the old getdir() interface. New applications |
| 287 | * should use this. |
| 288 | * |
| 289 | * The filesystem may choose between two modes of operation: |
| 290 | * |
| 291 | * 1) The readdir implementation ignores the offset parameter, and |
| 292 | * passes zero to the filler function's offset. The filler |
| 293 | * function will not return '1' (unless an error happens), so the |
| 294 | * whole directory is read in a single readdir operation. This |
| 295 | * works just like the old getdir() method. |
| 296 | * |
| 297 | * 2) The readdir implementation keeps track of the offsets of the |
| 298 | * directory entries. It uses the offset parameter and always |
| 299 | * passes non-zero offset to the filler function. When the buffer |
| 300 | * is full (or an error happens) the filler function will return |
| 301 | * '1'. |
| 302 | * |
| 303 | * Introduced in version 2.3 |
| 304 | */ |
| 305 | int (*readdir) (const char *, void *, fuse_fill_dir_t, off64_t, |
| 306 | struct fuse_file_info *); |
| 307 | |
| 308 | /** Release directory |
| 309 | * |
| 310 | * Introduced in version 2.3 |
| 311 | */ |
| 312 | int (*releasedir) (const char *, struct fuse_file_info *); |
| 313 | |
| 314 | /** Synchronize directory contents |
| 315 | * |
| 316 | * If the datasync parameter is non-zero, then only the user data |
| 317 | * should be flushed, not the meta data |
| 318 | * |
| 319 | * Introduced in version 2.3 |
| 320 | */ |
| 321 | int (*fsyncdir) (const char *, int, struct fuse_file_info *); |
| 322 | |
| 323 | /** |
| 324 | * Initialize filesystem |
| 325 | * |
| 326 | * The return value will passed in the private_data field of |
| 327 | * fuse_context to all file operations and as a parameter to the |
| 328 | * destroy() method. |
| 329 | * |
| 330 | * Introduced in version 2.3 |
| 331 | * Changed in version 2.6 |
| 332 | */ |
| 333 | void *(*init) (struct fuse_conn_info *conn); |
| 334 | |
| 335 | /** |
| 336 | * Clean up filesystem |
| 337 | * |
| 338 | * Called on filesystem exit. |
| 339 | * |
| 340 | * Introduced in version 2.3 |
| 341 | */ |
| 342 | void (*destroy) (void *); |
| 343 | |
| 344 | /** |
| 345 | * Check file access permissions |
| 346 | * |
| 347 | * This will be called for the access() system call. If the |
| 348 | * 'default_permissions' mount option is given, this method is not |
| 349 | * called. |
| 350 | * |
| 351 | * This method is not called under Linux kernel versions 2.4.x |
| 352 | * |
| 353 | * Introduced in version 2.5 |
| 354 | */ |
| 355 | int (*access) (const char *, int); |
| 356 | |
| 357 | /** |
| 358 | * Create and open a file |
| 359 | * |
| 360 | * If the file does not exist, first create it with the specified |
| 361 | * mode, and then open it. |
| 362 | * |
| 363 | * If this method is not implemented or under Linux kernel |
| 364 | * versions earlier than 2.6.15, the mknod() and open() methods |
| 365 | * will be called instead. |
| 366 | * |
| 367 | * Introduced in version 2.5 |
| 368 | */ |
| 369 | int (*create) (const char *, mode_t, struct fuse_file_info *); |
| 370 | |
| 371 | /** |
| 372 | * Change the size of an open file |
| 373 | * |
| 374 | * This method is called instead of the truncate() method if the |
| 375 | * truncation was invoked from an ftruncate() system call. |
| 376 | * |
| 377 | * If this method is not implemented or under Linux kernel |
| 378 | * versions earlier than 2.6.15, the truncate() method will be |
| 379 | * called instead. |
| 380 | * |
| 381 | * Introduced in version 2.5 |
| 382 | */ |
| 383 | int (*ftruncate) (const char *, off64_t, struct fuse_file_info *); |
| 384 | |
| 385 | /** |
| 386 | * Get attributes from an open file |
| 387 | * |
| 388 | * This method is called instead of the getattr() method if the |
| 389 | * file information is available. |
| 390 | * |
| 391 | * Currently this is only called after the create() method if that |
| 392 | * is implemented (see above). Later it may be called for |
| 393 | * invocations of fstat() too. |
| 394 | * |
| 395 | * Introduced in version 2.5 |
| 396 | */ |
| 397 | int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); |
| 398 | |
| 399 | /** |
| 400 | * Perform POSIX file locking operation |
| 401 | * |
| 402 | * The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW. |
| 403 | * |
| 404 | * For the meaning of fields in 'struct flock' see the man page |
| 405 | * for fcntl(2). The l_whence field will always be set to |
| 406 | * SEEK_SET. |
| 407 | * |
| 408 | * For checking lock ownership, the 'fuse_file_info->owner' |
| 409 | * argument must be used. |
| 410 | * |
| 411 | * For F_GETLK operation, the library will first check currently |
| 412 | * held locks, and if a conflicting lock is found it will return |
| 413 | * information without calling this method. This ensures, that |
| 414 | * for local locks the l_pid field is correctly filled in. The |
| 415 | * results may not be accurate in case of race conditions and in |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 416 | * the presence of hard links, but it's unlikely that an |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 417 | * application would rely on accurate GETLK results in these |
| 418 | * cases. If a conflicting lock is not found, this method will be |
| 419 | * called, and the filesystem may fill out l_pid by a meaningful |
| 420 | * value, or it may leave this field zero. |
| 421 | * |
| 422 | * For F_SETLK and F_SETLKW the l_pid field will be set to the pid |
| 423 | * of the process performing the locking operation. |
| 424 | * |
| 425 | * Note: if this method is not implemented, the kernel will still |
| 426 | * allow file locking to work locally. Hence it is only |
| 427 | * interesting for network filesystems and similar. |
| 428 | * |
| 429 | * Introduced in version 2.6 |
| 430 | */ |
| 431 | int (*lock) (const char *, struct fuse_file_info *, int cmd, |
| 432 | struct flock *); |
| 433 | |
| 434 | /** |
| 435 | * Change the access and modification times of a file with |
| 436 | * nanosecond resolution |
| 437 | * |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 438 | * This supersedes the old utime() interface. New applications |
| 439 | * should use this. |
| 440 | * |
| 441 | * See the utimensat(2) man page for details. |
| 442 | * |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 443 | * Introduced in version 2.6 |
| 444 | */ |
| 445 | int (*utimens) (const char *, const struct timespec tv[2]); |
| 446 | |
| 447 | /** |
| 448 | * Map block index within file to block index within device |
| 449 | * |
| 450 | * Note: This makes sense only for block device backed filesystems |
| 451 | * mounted with the 'blkdev' option |
| 452 | * |
| 453 | * Introduced in version 2.6 |
| 454 | */ |
| 455 | int (*bmap) (const char *, size_t blocksize, uint64_t *idx); |
| 456 | |
| 457 | /** |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 458 | * Flag indicating that the filesystem can accept a NULL path |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 459 | * as the first argument for the following operations: |
| 460 | * |
| 461 | * read, write, flush, release, fsync, readdir, releasedir, |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 462 | * fsyncdir, ftruncate, fgetattr, lock, ioctl and poll |
| 463 | * |
| 464 | * If this flag is set these operations continue to work on |
| 465 | * unlinked files even if "-ohard_remove" option was specified. |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 466 | */ |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 467 | unsigned int flag_nullpath_ok:1; |
| 468 | |
| 469 | /** |
| 470 | * Flag indicating that the path need not be calculated for |
| 471 | * the following operations: |
| 472 | * |
| 473 | * read, write, flush, release, fsync, readdir, releasedir, |
| 474 | * fsyncdir, ftruncate, fgetattr, lock, ioctl and poll |
| 475 | * |
| 476 | * Closely related to flag_nullpath_ok, but if this flag is |
| 477 | * set then the path will not be calculaged even if the file |
| 478 | * wasn't unlinked. However the path can still be non-NULL if |
| 479 | * it needs to be calculated for some other reason. |
| 480 | */ |
| 481 | unsigned int flag_nopath:1; |
| 482 | |
| 483 | /** |
| 484 | * Flag indicating that the filesystem accepts special |
| 485 | * UTIME_NOW and UTIME_OMIT values in its utimens operation. |
| 486 | */ |
| 487 | unsigned int flag_utime_omit_ok:1; |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 488 | |
| 489 | /** |
| 490 | * Reserved flags, don't set |
| 491 | */ |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 492 | unsigned int flag_reserved:29; |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 493 | |
| 494 | /** |
| 495 | * Ioctl |
| 496 | * |
| 497 | * flags will have FUSE_IOCTL_COMPAT set for 32bit ioctls in |
| 498 | * 64bit environment. The size and direction of data is |
| 499 | * determined by _IOC_*() decoding of cmd. For _IOC_NONE, |
| 500 | * data will be NULL, for _IOC_WRITE data is out area, for |
| 501 | * _IOC_READ in area and if both are set in/out area. In all |
| 502 | * non-NULL cases, the area is of _IOC_SIZE(cmd) bytes. |
| 503 | * |
| 504 | * Introduced in version 2.8 |
| 505 | */ |
| 506 | int (*ioctl) (const char *, int cmd, void *arg, |
| 507 | struct fuse_file_info *, unsigned int flags, void *data); |
| 508 | |
| 509 | /** |
| 510 | * Poll for IO readiness events |
| 511 | * |
| 512 | * Note: If ph is non-NULL, the client should notify |
| 513 | * when IO readiness events occur by calling |
| 514 | * fuse_notify_poll() with the specified ph. |
| 515 | * |
| 516 | * Regardless of the number of times poll with a non-NULL ph |
| 517 | * is received, single notification is enough to clear all. |
| 518 | * Notifying more times incurs overhead but doesn't harm |
| 519 | * correctness. |
| 520 | * |
| 521 | * The callee is responsible for destroying ph with |
| 522 | * fuse_pollhandle_destroy() when no longer in use. |
| 523 | * |
| 524 | * Introduced in version 2.8 |
| 525 | */ |
| 526 | int (*poll) (const char *, struct fuse_file_info *, |
| 527 | struct fuse_pollhandle *ph, unsigned *reventsp); |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 528 | |
| 529 | /** Write contents of buffer to an open file |
| 530 | * |
| 531 | * Similar to the write() method, but data is supplied in a |
| 532 | * generic buffer. Use fuse_buf_copy() to transfer data to |
| 533 | * the destination. |
| 534 | * |
| 535 | * Introduced in version 2.9 |
| 536 | */ |
| 537 | int (*write_buf) (const char *, struct fuse_bufvec *buf, off64_t off, |
| 538 | struct fuse_file_info *); |
| 539 | |
| 540 | /** Store data from an open file in a buffer |
| 541 | * |
| 542 | * Similar to the read() method, but data is stored and |
| 543 | * returned in a generic buffer. |
| 544 | * |
| 545 | * No actual copying of data has to take place, the source |
| 546 | * file descriptor may simply be stored in the buffer for |
| 547 | * later data transfer. |
| 548 | * |
| 549 | * The buffer must be allocated dynamically and stored at the |
| 550 | * location pointed to by bufp. If the buffer contains memory |
| 551 | * regions, they too must be allocated using malloc(). The |
| 552 | * allocated memory will be freed by the caller. |
| 553 | * |
| 554 | * Introduced in version 2.9 |
| 555 | */ |
| 556 | int (*read_buf) (const char *, struct fuse_bufvec **bufp, |
| 557 | size_t size, off64_t off, struct fuse_file_info *); |
| 558 | /** |
| 559 | * Perform BSD file locking operation |
| 560 | * |
| 561 | * The op argument will be either LOCK_SH, LOCK_EX or LOCK_UN |
| 562 | * |
| 563 | * Nonblocking requests will be indicated by ORing LOCK_NB to |
| 564 | * the above operations |
| 565 | * |
| 566 | * For more information see the flock(2) manual page. |
| 567 | * |
| 568 | * Additionally fi->owner will be set to a value unique to |
| 569 | * this open file. This same value will be supplied to |
| 570 | * ->release() when the file is released. |
| 571 | * |
| 572 | * Note: if this method is not implemented, the kernel will still |
| 573 | * allow file locking to work locally. Hence it is only |
| 574 | * interesting for network filesystems and similar. |
| 575 | * |
| 576 | * Introduced in version 2.9 |
| 577 | */ |
| 578 | int (*flock) (const char *, struct fuse_file_info *, int op); |
| 579 | |
| 580 | /** |
| 581 | * Allocates space for an open file |
| 582 | * |
| 583 | * This function ensures that required space is allocated for specified |
| 584 | * file. If this function returns success then any subsequent write |
| 585 | * request to specified range is guaranteed not to fail because of lack |
| 586 | * of space on the file system media. |
| 587 | * |
| 588 | * Introduced in version 2.9.1 |
| 589 | */ |
| 590 | int (*fallocate) (const char *, int, off64_t, off64_t, |
| 591 | struct fuse_file_info *); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 592 | }; |
| 593 | |
| 594 | /** Extra context that may be needed by some filesystems |
| 595 | * |
| 596 | * The uid, gid and pid fields are not filled in case of a writepage |
| 597 | * operation. |
| 598 | */ |
| 599 | struct fuse_context { |
| 600 | /** Pointer to the fuse object */ |
| 601 | struct fuse *fuse; |
| 602 | |
| 603 | /** User ID of the calling process */ |
| 604 | uid_t uid; |
| 605 | |
| 606 | /** Group ID of the calling process */ |
| 607 | gid_t gid; |
| 608 | |
| 609 | /** Thread ID of the calling process */ |
| 610 | pid_t pid; |
| 611 | |
| 612 | /** Private filesystem data */ |
| 613 | void *private_data; |
| 614 | |
| 615 | /** Umask of the calling process (introduced in version 2.8) */ |
| 616 | mode_t umask; |
| 617 | }; |
| 618 | |
| 619 | /** |
| 620 | * Main function of FUSE. |
| 621 | * |
| 622 | * This is for the lazy. This is all that has to be called from the |
| 623 | * main() function. |
| 624 | * |
| 625 | * This function does the following: |
| 626 | * - parses command line options (-d -s and -h) |
| 627 | * - passes relevant mount options to the fuse_mount() |
| 628 | * - installs signal handlers for INT, HUP, TERM and PIPE |
| 629 | * - registers an exit handler to unmount the filesystem on program exit |
| 630 | * - creates a fuse handle |
| 631 | * - registers the operations |
| 632 | * - calls either the single-threaded or the multi-threaded event loop |
| 633 | * |
| 634 | * Note: this is currently implemented as a macro. |
| 635 | * |
| 636 | * @param argc the argument counter passed to the main() function |
| 637 | * @param argv the argument vector passed to the main() function |
| 638 | * @param op the file system operation |
| 639 | * @param user_data user data supplied in the context during the init() method |
| 640 | * @return 0 on success, nonzero on failure |
| 641 | */ |
| 642 | /* |
| 643 | int fuse_main(int argc, char *argv[], const struct fuse_operations *op, |
| 644 | void *user_data); |
| 645 | */ |
| 646 | #define fuse_main(argc, argv, op, user_data) \ |
| 647 | fuse_main_real(argc, argv, op, sizeof(*(op)), user_data) |
| 648 | |
| 649 | /* ----------------------------------------------------------- * |
| 650 | * More detailed API * |
| 651 | * ----------------------------------------------------------- */ |
| 652 | |
| 653 | /** |
| 654 | * Create a new FUSE filesystem. |
| 655 | * |
| 656 | * @param ch the communication channel |
| 657 | * @param args argument vector |
| 658 | * @param op the filesystem operations |
| 659 | * @param op_size the size of the fuse_operations structure |
| 660 | * @param user_data user data supplied in the context during the init() method |
| 661 | * @return the created FUSE handle |
| 662 | */ |
| 663 | struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, |
| 664 | const struct fuse_operations *op, size_t op_size, |
| 665 | void *user_data); |
| 666 | |
| 667 | /** |
| 668 | * Destroy the FUSE handle. |
| 669 | * |
| 670 | * The communication channel attached to the handle is also destroyed. |
| 671 | * |
| 672 | * NOTE: This function does not unmount the filesystem. If this is |
| 673 | * needed, call fuse_unmount() before calling this function. |
| 674 | * |
| 675 | * @param f the FUSE handle |
| 676 | */ |
| 677 | void fuse_destroy(struct fuse *f); |
| 678 | |
| 679 | /** |
| 680 | * FUSE event loop. |
| 681 | * |
| 682 | * Requests from the kernel are processed, and the appropriate |
| 683 | * operations are called. |
| 684 | * |
| 685 | * @param f the FUSE handle |
| 686 | * @return 0 if no error occurred, -1 otherwise |
| 687 | */ |
| 688 | int fuse_loop(struct fuse *f); |
| 689 | |
| 690 | /** |
| 691 | * Exit from event loop |
| 692 | * |
| 693 | * @param f the FUSE handle |
| 694 | */ |
| 695 | void fuse_exit(struct fuse *f); |
| 696 | |
| 697 | /** |
| 698 | * FUSE event loop with multiple threads |
| 699 | * |
| 700 | * Requests from the kernel are processed, and the appropriate |
| 701 | * operations are called. Request are processed in parallel by |
| 702 | * distributing them between multiple threads. |
| 703 | * |
| 704 | * Calling this function requires the pthreads library to be linked to |
| 705 | * the application. |
| 706 | * |
| 707 | * @param f the FUSE handle |
| 708 | * @return 0 if no error occurred, -1 otherwise |
| 709 | */ |
| 710 | int fuse_loop_mt(struct fuse *f); |
| 711 | |
| 712 | /** |
| 713 | * Get the current context |
| 714 | * |
| 715 | * The context is only valid for the duration of a filesystem |
| 716 | * operation, and thus must not be stored and used later. |
| 717 | * |
| 718 | * @return the context |
| 719 | */ |
| 720 | struct fuse_context *fuse_get_context(void); |
| 721 | |
| 722 | /** |
| 723 | * Get the current supplementary group IDs for the current request |
| 724 | * |
| 725 | * Similar to the getgroups(2) system call, except the return value is |
| 726 | * always the total number of group IDs, even if it is larger than the |
| 727 | * specified size. |
| 728 | * |
| 729 | * The current fuse kernel module in linux (as of 2.6.30) doesn't pass |
| 730 | * the group list to userspace, hence this function needs to parse |
| 731 | * "/proc/$TID/task/$TID/status" to get the group IDs. |
| 732 | * |
| 733 | * This feature may not be supported on all operating systems. In |
| 734 | * such a case this function will return -ENOSYS. |
| 735 | * |
| 736 | * @param size size of given array |
| 737 | * @param list array of group IDs to be filled in |
| 738 | * @return the total number of supplementary group IDs or -errno on failure |
| 739 | */ |
| 740 | int fuse_getgroups(int size, gid_t list[]); |
| 741 | |
| 742 | /** |
| 743 | * Check if the current request has already been interrupted |
| 744 | * |
| 745 | * @return 1 if the request has been interrupted, 0 otherwise |
| 746 | */ |
| 747 | int fuse_interrupted(void); |
| 748 | |
| 749 | /** |
| 750 | * Obsolete, doesn't do anything |
| 751 | * |
| 752 | * @return -EINVAL |
| 753 | */ |
| 754 | int fuse_invalidate(struct fuse *f, const char *path); |
| 755 | |
| 756 | /* Deprecated, don't use */ |
| 757 | int fuse_is_lib_option(const char *opt); |
| 758 | |
| 759 | /** |
| 760 | * The real main function |
| 761 | * |
| 762 | * Do not call this directly, use fuse_main() |
| 763 | */ |
| 764 | int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, |
| 765 | size_t op_size, void *user_data); |
| 766 | |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 767 | /** |
| 768 | * Start the cleanup thread when using option "remember". |
| 769 | * |
| 770 | * This is done automatically by fuse_loop_mt() |
| 771 | * @param fuse struct fuse pointer for fuse instance |
| 772 | * @return 0 on success and -1 on error |
| 773 | */ |
| 774 | int fuse_start_cleanup_thread(struct fuse *fuse); |
| 775 | |
| 776 | /** |
| 777 | * Stop the cleanup thread when using option "remember". |
| 778 | * |
| 779 | * This is done automatically by fuse_loop_mt() |
| 780 | * @param fuse struct fuse pointer for fuse instance |
| 781 | */ |
| 782 | void fuse_stop_cleanup_thread(struct fuse *fuse); |
| 783 | |
| 784 | /** |
| 785 | * Iterate over cache removing stale entries |
| 786 | * use in conjunction with "-oremember" |
| 787 | * |
| 788 | * NOTE: This is already done for the standard sessions |
| 789 | * |
| 790 | * @param fuse struct fuse pointer for fuse instance |
| 791 | * @return the number of seconds until the next cleanup |
| 792 | */ |
| 793 | int fuse_clean_cache(struct fuse *fuse); |
| 794 | |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 795 | /* |
| 796 | * Stacking API |
| 797 | */ |
| 798 | |
| 799 | /** |
| 800 | * Fuse filesystem object |
| 801 | * |
| 802 | * This is opaque object represents a filesystem layer |
| 803 | */ |
| 804 | struct fuse_fs; |
| 805 | |
| 806 | /* |
| 807 | * These functions call the relevant filesystem operation, and return |
| 808 | * the result. |
| 809 | * |
| 810 | * If the operation is not defined, they return -ENOSYS, with the |
| 811 | * exception of fuse_fs_open, fuse_fs_release, fuse_fs_opendir, |
| 812 | * fuse_fs_releasedir and fuse_fs_statfs, which return 0. |
| 813 | */ |
| 814 | |
| 815 | int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf); |
| 816 | int fuse_fs_fgetattr(struct fuse_fs *fs, const char *path, struct stat *buf, |
| 817 | struct fuse_file_info *fi); |
| 818 | int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath, |
| 819 | const char *newpath); |
| 820 | int fuse_fs_unlink(struct fuse_fs *fs, const char *path); |
| 821 | int fuse_fs_rmdir(struct fuse_fs *fs, const char *path); |
| 822 | int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname, |
| 823 | const char *path); |
| 824 | int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath); |
| 825 | int fuse_fs_release(struct fuse_fs *fs, const char *path, |
| 826 | struct fuse_file_info *fi); |
| 827 | int fuse_fs_open(struct fuse_fs *fs, const char *path, |
| 828 | struct fuse_file_info *fi); |
| 829 | int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size, |
| 830 | off64_t off, struct fuse_file_info *fi); |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 831 | int fuse_fs_read_buf(struct fuse_fs *fs, const char *path, |
| 832 | struct fuse_bufvec **bufp, size_t size, off64_t off, |
| 833 | struct fuse_file_info *fi); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 834 | int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf, |
| 835 | size_t size, off64_t off, struct fuse_file_info *fi); |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 836 | int fuse_fs_write_buf(struct fuse_fs *fs, const char *path, |
| 837 | struct fuse_bufvec *buf, off64_t off, |
| 838 | struct fuse_file_info *fi); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 839 | int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync, |
| 840 | struct fuse_file_info *fi); |
| 841 | int fuse_fs_flush(struct fuse_fs *fs, const char *path, |
| 842 | struct fuse_file_info *fi); |
| 843 | int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf); |
| 844 | int fuse_fs_opendir(struct fuse_fs *fs, const char *path, |
| 845 | struct fuse_file_info *fi); |
| 846 | int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf, |
| 847 | fuse_fill_dir_t filler, off64_t off, |
| 848 | struct fuse_file_info *fi); |
| 849 | int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync, |
| 850 | struct fuse_file_info *fi); |
| 851 | int fuse_fs_releasedir(struct fuse_fs *fs, const char *path, |
| 852 | struct fuse_file_info *fi); |
| 853 | int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode, |
| 854 | struct fuse_file_info *fi); |
| 855 | int fuse_fs_lock(struct fuse_fs *fs, const char *path, |
| 856 | struct fuse_file_info *fi, int cmd, struct flock *lock); |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 857 | int fuse_fs_flock(struct fuse_fs *fs, const char *path, |
| 858 | struct fuse_file_info *fi, int op); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 859 | int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode); |
| 860 | int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid); |
| 861 | int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off64_t size); |
| 862 | int fuse_fs_ftruncate(struct fuse_fs *fs, const char *path, off64_t size, |
| 863 | struct fuse_file_info *fi); |
| 864 | int fuse_fs_utimens(struct fuse_fs *fs, const char *path, |
| 865 | const struct timespec tv[2]); |
| 866 | int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask); |
| 867 | int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf, |
| 868 | size_t len); |
| 869 | int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode, |
| 870 | dev_t rdev); |
| 871 | int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode); |
| 872 | int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name, |
| 873 | const char *value, size_t size, int flags); |
| 874 | int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name, |
| 875 | char *value, size_t size); |
| 876 | int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list, |
| 877 | size_t size); |
| 878 | int fuse_fs_removexattr(struct fuse_fs *fs, const char *path, |
| 879 | const char *name); |
| 880 | int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize, |
| 881 | uint64_t *idx); |
| 882 | int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd, void *arg, |
| 883 | struct fuse_file_info *fi, unsigned int flags, void *data); |
| 884 | int fuse_fs_poll(struct fuse_fs *fs, const char *path, |
| 885 | struct fuse_file_info *fi, struct fuse_pollhandle *ph, |
| 886 | unsigned *reventsp); |
Dees_Troy | e34c133 | 2013-02-06 19:13:00 +0000 | [diff] [blame] | 887 | int fuse_fs_fallocate(struct fuse_fs *fs, const char *path, int mode, |
| 888 | off64_t offset, off64_t length, struct fuse_file_info *fi); |
bigbiff bigbiff | 9c75405 | 2013-01-09 09:09:08 -0500 | [diff] [blame] | 889 | void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn); |
| 890 | void fuse_fs_destroy(struct fuse_fs *fs); |
| 891 | |
| 892 | int fuse_notify_poll(struct fuse_pollhandle *ph); |
| 893 | |
| 894 | /** |
| 895 | * Create a new fuse filesystem object |
| 896 | * |
| 897 | * This is usually called from the factory of a fuse module to create |
| 898 | * a new instance of a filesystem. |
| 899 | * |
| 900 | * @param op the filesystem operations |
| 901 | * @param op_size the size of the fuse_operations structure |
| 902 | * @param user_data user data supplied in the context during the init() method |
| 903 | * @return a new filesystem object |
| 904 | */ |
| 905 | struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size, |
| 906 | void *user_data); |
| 907 | |
| 908 | /** |
| 909 | * Filesystem module |
| 910 | * |
| 911 | * Filesystem modules are registered with the FUSE_REGISTER_MODULE() |
| 912 | * macro. |
| 913 | * |
| 914 | * If the "-omodules=modname:..." option is present, filesystem |
| 915 | * objects are created and pushed onto the stack with the 'factory' |
| 916 | * function. |
| 917 | */ |
| 918 | struct fuse_module { |
| 919 | /** |
| 920 | * Name of filesystem |
| 921 | */ |
| 922 | const char *name; |
| 923 | |
| 924 | /** |
| 925 | * Factory for creating filesystem objects |
| 926 | * |
| 927 | * The function may use and remove options from 'args' that belong |
| 928 | * to this module. |
| 929 | * |
| 930 | * For now the 'fs' vector always contains exactly one filesystem. |
| 931 | * This is the filesystem which will be below the newly created |
| 932 | * filesystem in the stack. |
| 933 | * |
| 934 | * @param args the command line arguments |
| 935 | * @param fs NULL terminated filesystem object vector |
| 936 | * @return the new filesystem object |
| 937 | */ |
| 938 | struct fuse_fs *(*factory)(struct fuse_args *args, |
| 939 | struct fuse_fs *fs[]); |
| 940 | |
| 941 | struct fuse_module *next; |
| 942 | struct fusemod_so *so; |
| 943 | int ctr; |
| 944 | }; |
| 945 | |
| 946 | /** |
| 947 | * Register a filesystem module |
| 948 | * |
| 949 | * This function is used by FUSE_REGISTER_MODULE and there's usually |
| 950 | * no need to call it directly |
| 951 | */ |
| 952 | void fuse_register_module(struct fuse_module *mod); |
| 953 | |
| 954 | /** |
| 955 | * Register filesystem module |
| 956 | * |
| 957 | * For the parameters, see description of the fields in 'struct |
| 958 | * fuse_module' |
| 959 | */ |
| 960 | #define FUSE_REGISTER_MODULE(name_, factory_) \ |
| 961 | static __attribute__((constructor)) void name_ ## _register(void) \ |
| 962 | { \ |
| 963 | static struct fuse_module mod = \ |
| 964 | { #name_, factory_, NULL, NULL, 0 }; \ |
| 965 | fuse_register_module(&mod); \ |
| 966 | } |
| 967 | |
| 968 | |
| 969 | /* ----------------------------------------------------------- * |
| 970 | * Advanced API for event handling, don't worry about this... * |
| 971 | * ----------------------------------------------------------- */ |
| 972 | |
| 973 | /* NOTE: the following functions are deprecated, and will be removed |
| 974 | from the 3.0 API. Use the lowlevel session functions instead */ |
| 975 | |
| 976 | /** Function type used to process commands */ |
| 977 | typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *); |
| 978 | |
| 979 | /** This is the part of fuse_main() before the event loop */ |
| 980 | struct fuse *fuse_setup(int argc, char *argv[], |
| 981 | const struct fuse_operations *op, size_t op_size, |
| 982 | char **mountpoint, int *multithreaded, |
| 983 | void *user_data); |
| 984 | |
| 985 | /** This is the part of fuse_main() after the event loop */ |
| 986 | void fuse_teardown(struct fuse *fuse, char *mountpoint); |
| 987 | |
| 988 | /** Read a single command. If none are read, return NULL */ |
| 989 | struct fuse_cmd *fuse_read_cmd(struct fuse *f); |
| 990 | |
| 991 | /** Process a single command */ |
| 992 | void fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd); |
| 993 | |
| 994 | /** Multi threaded event loop, which calls the custom command |
| 995 | processor function */ |
| 996 | int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data); |
| 997 | |
| 998 | /** Return the exited flag, which indicates if fuse_exit() has been |
| 999 | called */ |
| 1000 | int fuse_exited(struct fuse *f); |
| 1001 | |
| 1002 | /** This function is obsolete and implemented as a no-op */ |
| 1003 | void fuse_set_getcontext_func(struct fuse_context *(*func)(void)); |
| 1004 | |
| 1005 | /** Get session from fuse object */ |
| 1006 | struct fuse_session *fuse_get_session(struct fuse *f); |
| 1007 | |
| 1008 | /* ----------------------------------------------------------- * |
| 1009 | * Compatibility stuff * |
| 1010 | * ----------------------------------------------------------- */ |
| 1011 | |
| 1012 | #if FUSE_USE_VERSION < 26 |
| 1013 | # include "fuse_compat.h" |
| 1014 | # undef fuse_main |
| 1015 | # if FUSE_USE_VERSION == 25 |
| 1016 | # define fuse_main(argc, argv, op) \ |
| 1017 | fuse_main_real_compat25(argc, argv, op, sizeof(*(op))) |
| 1018 | # define fuse_new fuse_new_compat25 |
| 1019 | # define fuse_setup fuse_setup_compat25 |
| 1020 | # define fuse_teardown fuse_teardown_compat22 |
| 1021 | # define fuse_operations fuse_operations_compat25 |
| 1022 | # elif FUSE_USE_VERSION == 22 |
| 1023 | # define fuse_main(argc, argv, op) \ |
| 1024 | fuse_main_real_compat22(argc, argv, op, sizeof(*(op))) |
| 1025 | # define fuse_new fuse_new_compat22 |
| 1026 | # define fuse_setup fuse_setup_compat22 |
| 1027 | # define fuse_teardown fuse_teardown_compat22 |
| 1028 | # define fuse_operations fuse_operations_compat22 |
| 1029 | # define fuse_file_info fuse_file_info_compat |
| 1030 | # elif FUSE_USE_VERSION == 24 |
| 1031 | # error Compatibility with high-level API version 24 not supported |
| 1032 | # else |
| 1033 | # define fuse_dirfil_t fuse_dirfil_t_compat |
| 1034 | # define __fuse_read_cmd fuse_read_cmd |
| 1035 | # define __fuse_process_cmd fuse_process_cmd |
| 1036 | # define __fuse_loop_mt fuse_loop_mt_proc |
| 1037 | # if FUSE_USE_VERSION == 21 |
| 1038 | # define fuse_operations fuse_operations_compat2 |
| 1039 | # define fuse_main fuse_main_compat2 |
| 1040 | # define fuse_new fuse_new_compat2 |
| 1041 | # define __fuse_setup fuse_setup_compat2 |
| 1042 | # define __fuse_teardown fuse_teardown_compat22 |
| 1043 | # define __fuse_exited fuse_exited |
| 1044 | # define __fuse_set_getcontext_func fuse_set_getcontext_func |
| 1045 | # else |
| 1046 | # define fuse_statfs fuse_statfs_compat1 |
| 1047 | # define fuse_operations fuse_operations_compat1 |
| 1048 | # define fuse_main fuse_main_compat1 |
| 1049 | # define fuse_new fuse_new_compat1 |
| 1050 | # define FUSE_DEBUG FUSE_DEBUG_COMPAT1 |
| 1051 | # endif |
| 1052 | # endif |
| 1053 | #endif |
| 1054 | |
| 1055 | #ifdef __cplusplus |
| 1056 | } |
| 1057 | #endif |
| 1058 | |
| 1059 | #endif /* _FUSE_H_ */ |