You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

769 lines
24 KiB

  1. /*
  2. FUSE: Filesystem in Userspace
  3. Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
  4. This program can be distributed under the terms of the GNU LGPLv2.
  5. See the file COPYING.LIB.
  6. */
  7. #ifndef _FUSE_H_
  8. #define _FUSE_H_
  9. #include "extern_c.h"
  10. #include "fuse_common.h"
  11. #include <fcntl.h>
  12. #include <time.h>
  13. #include <utime.h>
  14. #include <sys/types.h>
  15. #include <sys/stat.h>
  16. #include <sys/statvfs.h>
  17. #include <sys/uio.h>
  18. EXTERN_C_BEGIN
  19. /* ----------------------------------------------------------- *
  20. * Basic FUSE API *
  21. * ----------------------------------------------------------- */
  22. /** Handle for a FUSE filesystem */
  23. struct fuse;
  24. /** Structure containing a raw command */
  25. struct fuse_cmd;
  26. struct fuse_dirents_t;
  27. typedef struct fuse_dirents_t fuse_dirents_t;
  28. /**
  29. * The file system operations:
  30. *
  31. * Most of these should work very similarly to the well known UNIX
  32. * file system operations. A major exception is that instead of
  33. * returning an error in 'errno', the operation should return the
  34. * negated error value (-errno) directly.
  35. *
  36. * All methods are optional, but some are essential for a useful
  37. * filesystem (e.g. getattr). Open, flush, release, fsync, opendir,
  38. * releasedir, fsyncdir, access, create, ftruncate, fgetattr, lock,
  39. * init and destroy are special purpose methods, without which a full
  40. * featured filesystem can still be implemented.
  41. *
  42. * Almost all operations take a path which can be of any length.
  43. *
  44. * Changed in fuse 2.8.0 (regardless of API version)
  45. * Previously, paths were limited to a length of PATH_MAX.
  46. *
  47. * See http://fuse.sourceforge.net/wiki/ for more information. There
  48. * is also a snapshot of the relevant wiki pages in the doc/ folder.
  49. */
  50. struct fuse_operations
  51. {
  52. /** Get file attributes.
  53. *
  54. * Similar to stat(). The 'st_dev' and 'st_blksize' fields are
  55. * ignored. The 'st_ino' field is ignored except if the 'use_ino'
  56. * mount option is given.
  57. */
  58. int (*getattr) (const char *, struct stat *, fuse_timeouts_t *);
  59. /** Read the target of a symbolic link
  60. *
  61. * The buffer should be filled with a null terminated string. The
  62. * buffer size argument includes the space for the terminating
  63. * null character. If the linkname is too long to fit in the
  64. * buffer, it should be truncated. The return value should be 0
  65. * for success.
  66. */
  67. int (*readlink) (const char *, char *, size_t);
  68. /** Create a file node
  69. *
  70. * This is called for creation of all non-directory, non-symlink
  71. * nodes. If the filesystem defines a create() method, then for
  72. * regular files that will be called instead.
  73. */
  74. int (*mknod) (const char *, mode_t, dev_t);
  75. /** Create a directory
  76. *
  77. * Note that the mode argument may not have the type specification
  78. * bits set, i.e. S_ISDIR(mode) can be false. To obtain the
  79. * correct directory type bits use mode|S_IFDIR
  80. * */
  81. int (*mkdir) (const char *, mode_t);
  82. /** Hide files unlinked / renamed over
  83. *
  84. * Allows storing of a file handle when a file is unlinked
  85. * while open. Helps manage the fact the kernel usually does
  86. * not send fh with getattr requests.
  87. */
  88. int (*prepare_hide)(const char *name_, uint64_t *fh_);
  89. int (*free_hide)(const uint64_t fh_);
  90. /** Remove a file */
  91. int (*unlink) (const char *);
  92. /** Remove a directory */
  93. int (*rmdir) (const char *);
  94. /** Create a symbolic link */
  95. int (*symlink) (const char *, const char *, struct stat *, fuse_timeouts_t *);
  96. /** Rename a file */
  97. int (*rename) (const char *, const char *);
  98. /** Create a hard link to a file */
  99. int (*link) (const char *, const char *, struct stat *, fuse_timeouts_t *);
  100. /** Change the permission bits of a file */
  101. int (*chmod) (const char *, mode_t);
  102. int (*fchmod)(const fuse_file_info_t *, const mode_t);
  103. /** Change the owner and group of a file */
  104. int (*chown) (const char *, uid_t, gid_t);
  105. int (*fchown)(const fuse_file_info_t *, const uid_t, const gid_t);
  106. /** Change the size of a file */
  107. int (*truncate) (const char *, off_t);
  108. /** File open operation
  109. *
  110. * No creation (O_CREAT, O_EXCL) and by default also no
  111. * truncation (O_TRUNC) flags will be passed to open(). If an
  112. * application specifies O_TRUNC, fuse first calls truncate()
  113. * and then open(). Only if 'atomic_o_trunc' has been
  114. * specified and kernel version is 2.6.24 or later, O_TRUNC is
  115. * passed on to open.
  116. *
  117. * Unless the 'default_permissions' mount option is given,
  118. * open should check if the operation is permitted for the
  119. * given flags. Optionally open may also return an arbitrary
  120. * filehandle in the fuse_file_info structure, which will be
  121. * passed to all file operations.
  122. *
  123. * Changed in version 2.2
  124. */
  125. int (*open) (const char *, fuse_file_info_t *);
  126. /** Get file system statistics
  127. *
  128. * The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
  129. *
  130. * Replaced 'struct statfs' parameter with 'struct statvfs' in
  131. * version 2.5
  132. */
  133. int (*statfs) (const char *, struct statvfs *);
  134. /** Possibly flush cached data
  135. *
  136. * BIG NOTE: This is not equivalent to fsync(). It's not a
  137. * request to sync dirty data.
  138. *
  139. * Flush is called on each close() of a file descriptor. So if a
  140. * filesystem wants to return write errors in close() and the file
  141. * has cached dirty data, this is a good place to write back data
  142. * and return any errors. Since many applications ignore close()
  143. * errors this is not always useful.
  144. *
  145. * NOTE: The flush() method may be called more than once for each
  146. * open(). This happens if more than one file descriptor refers
  147. * to an opened file due to dup(), dup2() or fork() calls. It is
  148. * not possible to determine if a flush is final, so each flush
  149. * should be treated equally. Multiple write-flush sequences are
  150. * relatively rare, so this shouldn't be a problem.
  151. *
  152. * Filesystems shouldn't assume that flush will always be called
  153. * after some writes, or that if will be called at all.
  154. *
  155. * Changed in version 2.2
  156. */
  157. int (*flush) (const fuse_file_info_t *);
  158. /** Release an open file
  159. *
  160. * Release is called when there are no more references to an open
  161. * file: all file descriptors are closed and all memory mappings
  162. * are unmapped.
  163. *
  164. * For every open() call there will be exactly one release() call
  165. * with the same flags and file descriptor. It is possible to
  166. * have a file opened more than once, in which case only the last
  167. * release will mean, that no more reads/writes will happen on the
  168. * file. The return value of release is ignored.
  169. *
  170. * Changed in version 2.2
  171. */
  172. int (*release) (const fuse_file_info_t *);
  173. /** Synchronize file contents
  174. *
  175. * If the datasync parameter is non-zero, then only the user data
  176. * should be flushed, not the meta data.
  177. *
  178. * Changed in version 2.2
  179. */
  180. int (*fsync) (const fuse_file_info_t *, int);
  181. /** Set extended attributes */
  182. int (*setxattr) (const char *, const char *, const char *, size_t, int);
  183. /** Get extended attributes */
  184. int (*getxattr) (const char *, const char *, char *, size_t);
  185. /** List extended attributes */
  186. int (*listxattr) (const char *, char *, size_t);
  187. /** Remove extended attributes */
  188. int (*removexattr) (const char *, const char *);
  189. /** Open directory
  190. *
  191. * Unless the 'default_permissions' mount option is given,
  192. * this method should check if opendir is permitted for this
  193. * directory. Optionally opendir may also return an arbitrary
  194. * filehandle in the fuse_file_info structure, which will be
  195. * passed to readdir, closedir and fsyncdir.
  196. *
  197. * Introduced in version 2.3
  198. */
  199. int (*opendir) (const char *,
  200. fuse_file_info_t *);
  201. /** Read directory
  202. *
  203. * This supersedes the old getdir() interface. New applications
  204. * should use this.
  205. *
  206. * The filesystem may choose between two modes of operation:
  207. *
  208. * 1) The readdir implementation ignores the offset parameter, and
  209. * passes zero to the filler function's offset. The filler
  210. * function will not return '1' (unless an error happens), so the
  211. * whole directory is read in a single readdir operation. This
  212. * works just like the old getdir() method.
  213. *
  214. * 2) The readdir implementation keeps track of the offsets of the
  215. * directory entries. It uses the offset parameter and always
  216. * passes non-zero offset to the filler function. When the buffer
  217. * is full (or an error happens) the filler function will return
  218. * '1'.
  219. *
  220. * Introduced in version 2.3
  221. */
  222. int (*readdir)(const fuse_file_info_t *,
  223. fuse_dirents_t *);
  224. int (*readdir_plus)(const fuse_file_info_t *,
  225. fuse_dirents_t *);
  226. /** Release directory
  227. *
  228. * Introduced in version 2.3
  229. */
  230. int (*releasedir) (const fuse_file_info_t *);
  231. /** Synchronize directory contents
  232. *
  233. * If the datasync parameter is non-zero, then only the user data
  234. * should be flushed, not the meta data
  235. *
  236. * Introduced in version 2.3
  237. */
  238. int (*fsyncdir) (const fuse_file_info_t *, int);
  239. /**
  240. * Initialize filesystem
  241. *
  242. * The return value will passed in the private_data field of
  243. * fuse_context to all file operations and as a parameter to the
  244. * destroy() method.
  245. *
  246. * Introduced in version 2.3
  247. * Changed in version 2.6
  248. */
  249. void *(*init) (struct fuse_conn_info *conn);
  250. /**
  251. * Clean up filesystem
  252. *
  253. * Called on filesystem exit.
  254. *
  255. * Introduced in version 2.3
  256. */
  257. void (*destroy) (void);
  258. /**
  259. * Check file access permissions
  260. *
  261. * This will be called for the access() system call. If the
  262. * 'default_permissions' mount option is given, this method is not
  263. * called.
  264. *
  265. * This method is not called under Linux kernel versions 2.4.x
  266. *
  267. * Introduced in version 2.5
  268. */
  269. int (*access) (const char *, int);
  270. /**
  271. * Create and open a file
  272. *
  273. * If the file does not exist, first create it with the specified
  274. * mode, and then open it.
  275. *
  276. * If this method is not implemented or under Linux kernel
  277. * versions earlier than 2.6.15, the mknod() and open() methods
  278. * will be called instead.
  279. *
  280. * Introduced in version 2.5
  281. */
  282. int (*create) (const char *, mode_t, fuse_file_info_t *);
  283. /**
  284. * Change the size of an open file
  285. *
  286. * This method is called instead of the truncate() method if the
  287. * truncation was invoked from an ftruncate() system call.
  288. *
  289. * If this method is not implemented or under Linux kernel
  290. * versions earlier than 2.6.15, the truncate() method will be
  291. * called instead.
  292. *
  293. * Introduced in version 2.5
  294. */
  295. int (*ftruncate) (const fuse_file_info_t *, off_t);
  296. /**
  297. * Get attributes from an open file
  298. *
  299. * This method is called instead of the getattr() method if the
  300. * file information is available.
  301. *
  302. * Currently this is only called after the create() method if that
  303. * is implemented (see above). Later it may be called for
  304. * invocations of fstat() too.
  305. *
  306. * Introduced in version 2.5
  307. */
  308. int (*fgetattr) (const fuse_file_info_t *, struct stat *, fuse_timeouts_t *);
  309. /**
  310. * Perform POSIX file locking operation
  311. *
  312. * The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW.
  313. *
  314. * For the meaning of fields in 'struct flock' see the man page
  315. * for fcntl(2). The l_whence field will always be set to
  316. * SEEK_SET.
  317. *
  318. * For checking lock ownership, the 'fuse_file_info->owner'
  319. * argument must be used.
  320. *
  321. * For F_GETLK operation, the library will first check currently
  322. * held locks, and if a conflicting lock is found it will return
  323. * information without calling this method. This ensures, that
  324. * for local locks the l_pid field is correctly filled in. The
  325. * results may not be accurate in case of race conditions and in
  326. * the presence of hard links, but it's unlikely that an
  327. * application would rely on accurate GETLK results in these
  328. * cases. If a conflicting lock is not found, this method will be
  329. * called, and the filesystem may fill out l_pid by a meaningful
  330. * value, or it may leave this field zero.
  331. *
  332. * For F_SETLK and F_SETLKW the l_pid field will be set to the pid
  333. * of the process performing the locking operation.
  334. *
  335. * Note: if this method is not implemented, the kernel will still
  336. * allow file locking to work locally. Hence it is only
  337. * interesting for network filesystems and similar.
  338. *
  339. * Introduced in version 2.6
  340. */
  341. int (*lock) (const fuse_file_info_t *,
  342. int cmd,
  343. struct flock *);
  344. /**
  345. * Change the access and modification times of a file with
  346. * nanosecond resolution
  347. *
  348. * This supersedes the old utime() interface. New applications
  349. * should use this.
  350. *
  351. * See the utimensat(2) man page for details.
  352. *
  353. * Introduced in version 2.6
  354. */
  355. int (*utimens)(const char *, const struct timespec tv[2]);
  356. int (*futimens)(const fuse_file_info_t *ffi_, const struct timespec tv_[2]);
  357. /**
  358. * Map block index within file to block index within device
  359. *
  360. * Note: This makes sense only for block device backed filesystems
  361. * mounted with the 'blkdev' option
  362. *
  363. * Introduced in version 2.6
  364. */
  365. int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
  366. /**
  367. * Ioctl
  368. *
  369. * flags will have FUSE_IOCTL_COMPAT set for 32bit ioctls in
  370. * 64bit environment. The size and direction of data is
  371. * determined by _IOC_*() decoding of cmd. For _IOC_NONE,
  372. * data will be NULL, for _IOC_WRITE data is out area, for
  373. * _IOC_READ in area and if both are set in/out area. In all
  374. * non-NULL cases, the area is of _IOC_SIZE(cmd) bytes.
  375. *
  376. * If flags has FUSE_IOCTL_DIR then the fuse_file_info refers to a
  377. * directory file handle.
  378. *
  379. * Introduced in version 2.8
  380. */
  381. int (*ioctl) (const fuse_file_info_t *ffi,
  382. unsigned long cmd,
  383. void *arg,
  384. unsigned int flags,
  385. void *data,
  386. uint32_t *out_bufsz);
  387. /**
  388. * Poll for IO readiness events
  389. *
  390. * Note: If ph is non-NULL, the client should notify
  391. * when IO readiness events occur by calling
  392. * fuse_notify_poll() with the specified ph.
  393. *
  394. * Regardless of the number of times poll with a non-NULL ph
  395. * is received, single notification is enough to clear all.
  396. * Notifying more times incurs overhead but doesn't harm
  397. * correctness.
  398. *
  399. * The callee is responsible for destroying ph with
  400. * fuse_pollhandle_destroy() when no longer in use.
  401. *
  402. * Introduced in version 2.8
  403. */
  404. int (*poll) (const fuse_file_info_t *ffi,
  405. fuse_pollhandle_t *ph,
  406. unsigned *reventsp);
  407. /** Write contents of buffer to an open file
  408. *
  409. * Similar to the write() method, but data is supplied in a
  410. * generic buffer. Use fuse_buf_copy() to transfer data to
  411. * the destination.
  412. *
  413. * Introduced in version 2.9
  414. */
  415. int (*write) (const fuse_file_info_t *ffi,
  416. const char *data,
  417. size_t size,
  418. off_t off);
  419. /** Store data from an open file in a buffer
  420. *
  421. * Similar to the read() method, but data is stored and
  422. * returned in a generic buffer.
  423. *
  424. * No actual copying of data has to take place, the source
  425. * file descriptor may simply be stored in the buffer for
  426. * later data transfer.
  427. *
  428. * The buffer must be allocated dynamically and stored at the
  429. * location pointed to by bufp. If the buffer contains memory
  430. * regions, they too must be allocated using malloc(). The
  431. * allocated memory will be freed by the caller.
  432. *
  433. * Introduced in version 2.9
  434. */
  435. int (*read)(const fuse_file_info_t *ffi,
  436. char *buf,
  437. size_t size,
  438. off_t off);
  439. /**
  440. * Perform BSD file locking operation
  441. *
  442. * The op argument will be either LOCK_SH, LOCK_EX or LOCK_UN
  443. *
  444. * Nonblocking requests will be indicated by ORing LOCK_NB to
  445. * the above operations
  446. *
  447. * For more information see the flock(2) manual page.
  448. *
  449. * Additionally fi->owner will be set to a value unique to
  450. * this open file. This same value will be supplied to
  451. * ->release() when the file is released.
  452. *
  453. * Note: if this method is not implemented, the kernel will still
  454. * allow file locking to work locally. Hence it is only
  455. * interesting for network filesystems and similar.
  456. *
  457. * Introduced in version 2.9
  458. */
  459. int (*flock) (const fuse_file_info_t *, int op);
  460. /**
  461. * Allocates space for an open file
  462. *
  463. * This function ensures that required space is allocated for specified
  464. * file. If this function returns success then any subsequent write
  465. * request to specified range is guaranteed not to fail because of lack
  466. * of space on the file system media.
  467. *
  468. * Introduced in version 2.9.1
  469. */
  470. int (*fallocate) (const fuse_file_info_t *, int, off_t, off_t);
  471. /**
  472. * Copy a range of data from one file to another
  473. *
  474. * Performs an optimized copy between two file descriptors without
  475. * the additional cost of transferring data through the FUSE kernel
  476. * module to user space (glibc) and then back into the FUSE filesystem
  477. * again.
  478. *
  479. * In case this method is not implemented, glibc falls back to
  480. * reading data from the source and writing to the
  481. * destination. Effectively doing an inefficient copy of the
  482. * data.
  483. */
  484. ssize_t (*copy_file_range)(const fuse_file_info_t *fi_in,
  485. off_t offset_in,
  486. const fuse_file_info_t *fi_out,
  487. off_t offset_out,
  488. size_t size,
  489. int flags);
  490. };
  491. /** Extra context that may be needed by some filesystems
  492. *
  493. * The uid, gid and pid fields are not filled in case of a writepage
  494. * operation.
  495. */
  496. struct fuse_context
  497. {
  498. /** Pointer to the fuse object */
  499. struct fuse *fuse;
  500. /** User ID of the calling process */
  501. uid_t uid;
  502. /** Group ID of the calling process */
  503. gid_t gid;
  504. /** Thread ID of the calling process */
  505. pid_t pid;
  506. /** Umask of the calling process (introduced in version 2.8) */
  507. mode_t umask;
  508. };
  509. /**
  510. * Main function of FUSE.
  511. *
  512. * This is for the lazy. This is all that has to be called from the
  513. * main() function.
  514. *
  515. * This function does the following:
  516. * - parses command line options (-d -s and -h)
  517. * - passes relevant mount options to the fuse_mount()
  518. * - installs signal handlers for INT, HUP, TERM and PIPE
  519. * - registers an exit handler to unmount the filesystem on program exit
  520. * - creates a fuse handle
  521. * - registers the operations
  522. * - calls either the single-threaded or the multi-threaded event loop
  523. *
  524. * Note: this is currently implemented as a macro.
  525. *
  526. * @param argc the argument counter passed to the main() function
  527. * @param argv the argument vector passed to the main() function
  528. * @param op the file system operation
  529. * @return 0 on success, nonzero on failure
  530. */
  531. /*
  532. int fuse_main(int argc, char *argv[], const struct fuse_operations *op);
  533. */
  534. #define fuse_main(argc, argv, op) \
  535. fuse_main_real(argc, argv, op, sizeof(*(op)))
  536. /* ----------------------------------------------------------- *
  537. * More detailed API *
  538. * ----------------------------------------------------------- */
  539. /**
  540. * Create a new FUSE filesystem.
  541. *
  542. * @param ch the communication channel
  543. * @param args argument vector
  544. * @param op the filesystem operations
  545. * @param op_size the size of the fuse_operations structure
  546. * @return the created FUSE handle
  547. */
  548. struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
  549. const struct fuse_operations *op, size_t op_size);
  550. /**
  551. * Destroy the FUSE handle.
  552. *
  553. * The communication channel attached to the handle is also destroyed.
  554. *
  555. * NOTE: This function does not unmount the filesystem. If this is
  556. * needed, call fuse_unmount() before calling this function.
  557. *
  558. * @param f the FUSE handle
  559. */
  560. void fuse_destroy(struct fuse *f);
  561. /**
  562. * Exit from event loop
  563. *
  564. * @param f the FUSE handle
  565. */
  566. void fuse_exit(struct fuse *f);
  567. int fuse_config_read_thread_count(const struct fuse *f);
  568. int fuse_config_process_thread_count(const struct fuse *f);
  569. const char* fuse_config_pin_threads(const struct fuse *f);
  570. /**
  571. * FUSE event loop with multiple threads
  572. *
  573. * Requests from the kernel are processed, and the appropriate
  574. * operations are called. Request are processed in parallel by
  575. * distributing them between multiple threads.
  576. *
  577. * Calling this function requires the pthreads library to be linked to
  578. * the application.
  579. *
  580. * @param f the FUSE handle
  581. * @return 0 if no error occurred, -1 otherwise
  582. */
  583. int fuse_loop_mt(struct fuse *f);
  584. /**
  585. * Get the current context
  586. *
  587. * The context is only valid for the duration of a filesystem
  588. * operation, and thus must not be stored and used later.
  589. *
  590. * @return the context
  591. */
  592. struct fuse_context *fuse_get_context(void);
  593. /**
  594. * Check if the current request has already been interrupted
  595. *
  596. * @return 1 if the request has been interrupted, 0 otherwise
  597. */
  598. int fuse_interrupted(void);
  599. /**
  600. * Obsolete, doesn't do anything
  601. *
  602. * @return -EINVAL
  603. */
  604. int fuse_invalidate(struct fuse *f, const char *path);
  605. /* Deprecated, don't use */
  606. int fuse_is_lib_option(const char *opt);
  607. /**
  608. * The real main function
  609. *
  610. * Do not call this directly, use fuse_main()
  611. */
  612. int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, size_t op_size);
  613. int fuse_start_maintenance_thread(struct fuse *fuse);
  614. void fuse_stop_maintenance_thread(struct fuse *fuse);
  615. int fuse_log_metrics_get(void);
  616. void fuse_log_metrics_set(int enabled);
  617. /**
  618. * Iterate over cache removing stale entries
  619. * use in conjunction with "-oremember"
  620. *
  621. * NOTE: This is already done for the standard sessions
  622. *
  623. * @param fuse struct fuse pointer for fuse instance
  624. * @return the number of seconds until the next cleanup
  625. */
  626. int fuse_clean_cache(struct fuse *fuse);
  627. /*
  628. * Stacking API
  629. */
  630. /**
  631. * Fuse filesystem object
  632. *
  633. * This is opaque object represents a filesystem layer
  634. */
  635. struct fuse_fs;
  636. /*
  637. * These functions call the relevant filesystem operation, and return
  638. * the result.
  639. *
  640. * If the operation is not defined, they return -ENOSYS, with the
  641. * exception of fuse_fs_open, fuse_fs_release, fuse_fs_opendir,
  642. * fuse_fs_releasedir and fuse_fs_statfs, which return 0.
  643. */
  644. int fuse_notify_poll(fuse_pollhandle_t *ph);
  645. /**
  646. * Create a new fuse filesystem object
  647. *
  648. * This is usually called from the factory of a fuse module to create
  649. * a new instance of a filesystem.
  650. *
  651. * @param op the filesystem operations
  652. * @param op_size the size of the fuse_operations structure
  653. * @return a new filesystem object
  654. */
  655. struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size);
  656. /* ----------------------------------------------------------- *
  657. * Advanced API for event handling, don't worry about this... *
  658. * ----------------------------------------------------------- */
  659. /* NOTE: the following functions are deprecated, and will be removed
  660. from the 3.0 API. Use the lowlevel session functions instead */
  661. /** Function type used to process commands */
  662. typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
  663. /** This is the part of fuse_main() before the event loop */
  664. struct fuse *fuse_setup(int argc, char *argv[],
  665. const struct fuse_operations *op, size_t op_size,
  666. char **mountpoint);
  667. /** This is the part of fuse_main() after the event loop */
  668. void fuse_teardown(struct fuse *fuse, char *mountpoint);
  669. /** Multi threaded event loop, which calls the custom command
  670. processor function */
  671. int fuse_loop_mt_proc(struct fuse *f, fuse_processor_t proc, void *data);
  672. /** Return the exited flag, which indicates if fuse_exit() has been
  673. called */
  674. int fuse_exited(struct fuse *f);
  675. /** This function is obsolete and implemented as a no-op */
  676. void fuse_set_getcontext_func(struct fuse_context *(*func)(void));
  677. /** Get session from fuse object */
  678. struct fuse_session *fuse_get_session(struct fuse *f);
  679. EXTERN_C_END
  680. #endif /* _FUSE_H_ */