Add "nopath" to help.
[fuse.git] / include / fuse_lowlevel.h
blob2036717f36cb4aa375b6f960cf09aeea4ca26bff
1 /*
2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
5 This program can be distributed under the terms of the GNU LGPLv2.
6 See the file COPYING.LIB.
7 */
9 #ifndef _FUSE_LOWLEVEL_H_
10 #define _FUSE_LOWLEVEL_H_
12 /** @file
14 * Low level API
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 24 (default) or
19 * 25
22 #ifndef FUSE_USE_VERSION
23 #define FUSE_USE_VERSION 24
24 #endif
26 #include "fuse_common.h"
28 #include <utime.h>
29 #include <fcntl.h>
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <sys/statvfs.h>
33 #include <sys/uio.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 /* ----------------------------------------------------------- *
40 * Miscellaneous definitions *
41 * ----------------------------------------------------------- */
43 /** The node ID of the root inode */
44 #define FUSE_ROOT_ID 1
46 /** Inode number type */
47 typedef unsigned long fuse_ino_t;
49 /** Request pointer type */
50 typedef struct fuse_req *fuse_req_t;
52 /**
53 * Session
55 * This provides hooks for processing requests, and exiting
57 struct fuse_session;
59 /**
60 * Channel
62 * A communication channel, providing hooks for sending and receiving
63 * messages
65 struct fuse_chan;
67 /** Directory entry parameters supplied to fuse_reply_entry() */
68 struct fuse_entry_param {
69 /** Unique inode number
71 * In lookup, zero means negative entry (from version 2.5)
72 * Returning ENOENT also means negative entry, but by setting zero
73 * ino the kernel may cache negative entries for entry_timeout
74 * seconds.
76 fuse_ino_t ino;
78 /** Generation number for this entry.
80 * If the file system will be exported over NFS, the
81 * ino/generation pairs need to be unique over the file
82 * system's lifetime (rather than just the mount time). So if
83 * the file system reuses an inode after it has been deleted,
84 * it must assign a new, previously unused generation number
85 * to the inode at the same time.
87 * The generation must be non-zero, otherwise FUSE will treat
88 * it as an error.
91 unsigned long generation;
93 /** Inode attributes.
95 * Even if attr_timeout == 0, attr must be correct. For example,
96 * for open(), FUSE uses attr.st_size from lookup() to determine
97 * how many bytes to request. If this value is not correct,
98 * incorrect data will be returned.
100 struct stat attr;
102 /** Validity timeout (in seconds) for the attributes */
103 double attr_timeout;
105 /** Validity timeout (in seconds) for the name */
106 double entry_timeout;
109 /** Additional context associated with requests */
110 struct fuse_ctx {
111 /** User ID of the calling process */
112 uid_t uid;
114 /** Group ID of the calling process */
115 gid_t gid;
117 /** Thread ID of the calling process */
118 pid_t pid;
120 /** Umask of the calling process (introduced in version 2.8) */
121 mode_t umask;
124 struct fuse_forget_data {
125 uint64_t ino;
126 uint64_t nlookup;
129 /* 'to_set' flags in setattr */
130 #define FUSE_SET_ATTR_MODE (1 << 0)
131 #define FUSE_SET_ATTR_UID (1 << 1)
132 #define FUSE_SET_ATTR_GID (1 << 2)
133 #define FUSE_SET_ATTR_SIZE (1 << 3)
134 #define FUSE_SET_ATTR_ATIME (1 << 4)
135 #define FUSE_SET_ATTR_MTIME (1 << 5)
136 #define FUSE_SET_ATTR_ATIME_NOW (1 << 7)
137 #define FUSE_SET_ATTR_MTIME_NOW (1 << 8)
139 /* ----------------------------------------------------------- *
140 * Request methods and replies *
141 * ----------------------------------------------------------- */
144 * Low level filesystem operations
146 * Most of the methods (with the exception of init and destroy)
147 * receive a request handle (fuse_req_t) as their first argument.
148 * This handle must be passed to one of the specified reply functions.
150 * This may be done inside the method invocation, or after the call
151 * has returned. The request handle is valid until one of the reply
152 * functions is called.
154 * Other pointer arguments (name, fuse_file_info, etc) are not valid
155 * after the call has returned, so if they are needed later, their
156 * contents have to be copied.
158 * The filesystem sometimes needs to handle a return value of -ENOENT
159 * from the reply function, which means, that the request was
160 * interrupted, and the reply discarded. For example if
161 * fuse_reply_open() return -ENOENT means, that the release method for
162 * this file will not be called.
164 struct fuse_lowlevel_ops {
166 * Initialize filesystem
168 * Called before any other filesystem method
170 * There's no reply to this function
172 * @param userdata the user data passed to fuse_lowlevel_new()
174 void (*init) (void *userdata, struct fuse_conn_info *conn);
177 * Clean up filesystem
179 * Called on filesystem exit
181 * There's no reply to this function
183 * @param userdata the user data passed to fuse_lowlevel_new()
185 void (*destroy) (void *userdata);
188 * Look up a directory entry by name and get its attributes.
190 * Valid replies:
191 * fuse_reply_entry
192 * fuse_reply_err
194 * @param req request handle
195 * @param parent inode number of the parent directory
196 * @param name the name to look up
198 void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
201 * Forget about an inode
203 * This function is called when the kernel removes an inode
204 * from its internal caches.
206 * The inode's lookup count increases by one for every call to
207 * fuse_reply_entry and fuse_reply_create. The nlookup parameter
208 * indicates by how much the lookup count should be decreased.
210 * Inodes with a non-zero lookup count may receive request from
211 * the kernel even after calls to unlink, rmdir or (when
212 * overwriting an existing file) rename. Filesystems must handle
213 * such requests properly and it is recommended to defer removal
214 * of the inode until the lookup count reaches zero. Calls to
215 * unlink, remdir or rename will be followed closely by forget
216 * unless the file or directory is open, in which case the
217 * kernel issues forget only after the release or releasedir
218 * calls.
220 * Note that if a file system will be exported over NFS the
221 * inodes lifetime must extend even beyond forget. See the
222 * generation field in struct fuse_entry_param above.
224 * On unmount the lookup count for all inodes implicitly drops
225 * to zero. It is not guaranteed that the file system will
226 * receive corresponding forget messages for the affected
227 * inodes.
229 * Valid replies:
230 * fuse_reply_none
232 * @param req request handle
233 * @param ino the inode number
234 * @param nlookup the number of lookups to forget
236 void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
239 * Get file attributes
241 * Valid replies:
242 * fuse_reply_attr
243 * fuse_reply_err
245 * @param req request handle
246 * @param ino the inode number
247 * @param fi for future use, currently always NULL
249 void (*getattr) (fuse_req_t req, fuse_ino_t ino,
250 struct fuse_file_info *fi);
253 * Set file attributes
255 * In the 'attr' argument only members indicated by the 'to_set'
256 * bitmask contain valid values. Other members contain undefined
257 * values.
259 * If the setattr was invoked from the ftruncate() system call
260 * under Linux kernel versions 2.6.15 or later, the fi->fh will
261 * contain the value set by the open method or will be undefined
262 * if the open method didn't set any value. Otherwise (not
263 * ftruncate call, or kernel version earlier than 2.6.15) the fi
264 * parameter will be NULL.
266 * Valid replies:
267 * fuse_reply_attr
268 * fuse_reply_err
270 * @param req request handle
271 * @param ino the inode number
272 * @param attr the attributes
273 * @param to_set bit mask of attributes which should be set
274 * @param fi file information, or NULL
276 * Changed in version 2.5:
277 * file information filled in for ftruncate
279 void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
280 int to_set, struct fuse_file_info *fi);
283 * Read symbolic link
285 * Valid replies:
286 * fuse_reply_readlink
287 * fuse_reply_err
289 * @param req request handle
290 * @param ino the inode number
292 void (*readlink) (fuse_req_t req, fuse_ino_t ino);
295 * Create file node
297 * Create a regular file, character device, block device, fifo or
298 * socket node.
300 * Valid replies:
301 * fuse_reply_entry
302 * fuse_reply_err
304 * @param req request handle
305 * @param parent inode number of the parent directory
306 * @param name to create
307 * @param mode file type and mode with which to create the new file
308 * @param rdev the device number (only valid if created file is a device)
310 void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
311 mode_t mode, dev_t rdev);
314 * Create a directory
316 * Valid replies:
317 * fuse_reply_entry
318 * fuse_reply_err
320 * @param req request handle
321 * @param parent inode number of the parent directory
322 * @param name to create
323 * @param mode with which to create the new file
325 void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
326 mode_t mode);
329 * Remove a file
331 * If the file's inode's lookup count is non-zero, the file
332 * system is expected to postpone any removal of the inode
333 * until the lookup count reaches zero (see description of the
334 * forget function).
336 * Valid replies:
337 * fuse_reply_err
339 * @param req request handle
340 * @param parent inode number of the parent directory
341 * @param name to remove
343 void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
346 * Remove a directory
348 * If the directory's inode's lookup count is non-zero, the
349 * file system is expected to postpone any removal of the
350 * inode until the lookup count reaches zero (see description
351 * of the forget function).
353 * Valid replies:
354 * fuse_reply_err
356 * @param req request handle
357 * @param parent inode number of the parent directory
358 * @param name to remove
360 void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
363 * Create a symbolic link
365 * Valid replies:
366 * fuse_reply_entry
367 * fuse_reply_err
369 * @param req request handle
370 * @param link the contents of the symbolic link
371 * @param parent inode number of the parent directory
372 * @param name to create
374 void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
375 const char *name);
377 /** Rename a file
379 * If the target exists it should be atomically replaced. If
380 * the target's inode's lookup count is non-zero, the file
381 * system is expected to postpone any removal of the inode
382 * until the lookup count reaches zero (see description of the
383 * forget function).
385 * Valid replies:
386 * fuse_reply_err
388 * @param req request handle
389 * @param parent inode number of the old parent directory
390 * @param name old name
391 * @param newparent inode number of the new parent directory
392 * @param newname new name
394 void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
395 fuse_ino_t newparent, const char *newname);
398 * Create a hard link
400 * Valid replies:
401 * fuse_reply_entry
402 * fuse_reply_err
404 * @param req request handle
405 * @param ino the old inode number
406 * @param newparent inode number of the new parent directory
407 * @param newname new name to create
409 void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
410 const char *newname);
413 * Open a file
415 * Open flags (with the exception of O_CREAT, O_EXCL, O_NOCTTY and
416 * O_TRUNC) are available in fi->flags.
418 * Filesystem may store an arbitrary file handle (pointer, index,
419 * etc) in fi->fh, and use this in other all other file operations
420 * (read, write, flush, release, fsync).
422 * Filesystem may also implement stateless file I/O and not store
423 * anything in fi->fh.
425 * There are also some flags (direct_io, keep_cache) which the
426 * filesystem may set in fi, to change the way the file is opened.
427 * See fuse_file_info structure in <fuse_common.h> for more details.
429 * Valid replies:
430 * fuse_reply_open
431 * fuse_reply_err
433 * @param req request handle
434 * @param ino the inode number
435 * @param fi file information
437 void (*open) (fuse_req_t req, fuse_ino_t ino,
438 struct fuse_file_info *fi);
441 * Read data
443 * Read should send exactly the number of bytes requested except
444 * on EOF or error, otherwise the rest of the data will be
445 * substituted with zeroes. An exception to this is when the file
446 * has been opened in 'direct_io' mode, in which case the return
447 * value of the read system call will reflect the return value of
448 * this operation.
450 * fi->fh will contain the value set by the open method, or will
451 * be undefined if the open method didn't set any value.
453 * Valid replies:
454 * fuse_reply_buf
455 * fuse_reply_iov
456 * fuse_reply_data
457 * fuse_reply_err
459 * @param req request handle
460 * @param ino the inode number
461 * @param size number of bytes to read
462 * @param off offset to read from
463 * @param fi file information
465 void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
466 struct fuse_file_info *fi);
469 * Write data
471 * Write should return exactly the number of bytes requested
472 * except on error. An exception to this is when the file has
473 * been opened in 'direct_io' mode, in which case the return value
474 * of the write system call will reflect the return value of this
475 * operation.
477 * fi->fh will contain the value set by the open method, or will
478 * be undefined if the open method didn't set any value.
480 * Valid replies:
481 * fuse_reply_write
482 * fuse_reply_err
484 * @param req request handle
485 * @param ino the inode number
486 * @param buf data to write
487 * @param size number of bytes to write
488 * @param off offset to write to
489 * @param fi file information
491 void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
492 size_t size, off_t off, struct fuse_file_info *fi);
495 * Flush method
497 * This is called on each close() of the opened file.
499 * Since file descriptors can be duplicated (dup, dup2, fork), for
500 * one open call there may be many flush calls.
502 * Filesystems shouldn't assume that flush will always be called
503 * after some writes, or that if will be called at all.
505 * fi->fh will contain the value set by the open method, or will
506 * be undefined if the open method didn't set any value.
508 * NOTE: the name of the method is misleading, since (unlike
509 * fsync) the filesystem is not forced to flush pending writes.
510 * One reason to flush data, is if the filesystem wants to return
511 * write errors.
513 * If the filesystem supports file locking operations (setlk,
514 * getlk) it should remove all locks belonging to 'fi->owner'.
516 * Valid replies:
517 * fuse_reply_err
519 * @param req request handle
520 * @param ino the inode number
521 * @param fi file information
523 void (*flush) (fuse_req_t req, fuse_ino_t ino,
524 struct fuse_file_info *fi);
527 * Release an open file
529 * Release is called when there are no more references to an open
530 * file: all file descriptors are closed and all memory mappings
531 * are unmapped.
533 * For every open call there will be exactly one release call.
535 * The filesystem may reply with an error, but error values are
536 * not returned to close() or munmap() which triggered the
537 * release.
539 * fi->fh will contain the value set by the open method, or will
540 * be undefined if the open method didn't set any value.
541 * fi->flags will contain the same flags as for open.
543 * Valid replies:
544 * fuse_reply_err
546 * @param req request handle
547 * @param ino the inode number
548 * @param fi file information
550 void (*release) (fuse_req_t req, fuse_ino_t ino,
551 struct fuse_file_info *fi);
554 * Synchronize file contents
556 * If the datasync parameter is non-zero, then only the user data
557 * should be flushed, not the meta data.
559 * Valid replies:
560 * fuse_reply_err
562 * @param req request handle
563 * @param ino the inode number
564 * @param datasync flag indicating if only data should be flushed
565 * @param fi file information
567 void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,
568 struct fuse_file_info *fi);
571 * Open a directory
573 * Filesystem may store an arbitrary file handle (pointer, index,
574 * etc) in fi->fh, and use this in other all other directory
575 * stream operations (readdir, releasedir, fsyncdir).
577 * Filesystem may also implement stateless directory I/O and not
578 * store anything in fi->fh, though that makes it impossible to
579 * implement standard conforming directory stream operations in
580 * case the contents of the directory can change between opendir
581 * and releasedir.
583 * Valid replies:
584 * fuse_reply_open
585 * fuse_reply_err
587 * @param req request handle
588 * @param ino the inode number
589 * @param fi file information
591 void (*opendir) (fuse_req_t req, fuse_ino_t ino,
592 struct fuse_file_info *fi);
595 * Read directory
597 * Send a buffer filled using fuse_add_direntry(), with size not
598 * exceeding the requested size. Send an empty buffer on end of
599 * stream.
601 * fi->fh will contain the value set by the opendir method, or
602 * will be undefined if the opendir method didn't set any value.
604 * Valid replies:
605 * fuse_reply_buf
606 * fuse_reply_data
607 * fuse_reply_err
609 * @param req request handle
610 * @param ino the inode number
611 * @param size maximum number of bytes to send
612 * @param off offset to continue reading the directory stream
613 * @param fi file information
615 void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
616 struct fuse_file_info *fi);
619 * Release an open directory
621 * For every opendir call there will be exactly one releasedir
622 * call.
624 * fi->fh will contain the value set by the opendir method, or
625 * will be undefined if the opendir method didn't set any value.
627 * Valid replies:
628 * fuse_reply_err
630 * @param req request handle
631 * @param ino the inode number
632 * @param fi file information
634 void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
635 struct fuse_file_info *fi);
638 * Synchronize directory contents
640 * If the datasync parameter is non-zero, then only the directory
641 * contents should be flushed, not the meta data.
643 * fi->fh will contain the value set by the opendir method, or
644 * will be undefined if the opendir method didn't set any value.
646 * Valid replies:
647 * fuse_reply_err
649 * @param req request handle
650 * @param ino the inode number
651 * @param datasync flag indicating if only data should be flushed
652 * @param fi file information
654 void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,
655 struct fuse_file_info *fi);
658 * Get file system statistics
660 * Valid replies:
661 * fuse_reply_statfs
662 * fuse_reply_err
664 * @param req request handle
665 * @param ino the inode number, zero means "undefined"
667 void (*statfs) (fuse_req_t req, fuse_ino_t ino);
670 * Set an extended attribute
672 * Valid replies:
673 * fuse_reply_err
675 void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
676 const char *value, size_t size, int flags);
679 * Get an extended attribute
681 * If size is zero, the size of the value should be sent with
682 * fuse_reply_xattr.
684 * If the size is non-zero, and the value fits in the buffer, the
685 * value should be sent with fuse_reply_buf.
687 * If the size is too small for the value, the ERANGE error should
688 * be sent.
690 * Valid replies:
691 * fuse_reply_buf
692 * fuse_reply_data
693 * fuse_reply_xattr
694 * fuse_reply_err
696 * @param req request handle
697 * @param ino the inode number
698 * @param name of the extended attribute
699 * @param size maximum size of the value to send
701 void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,
702 size_t size);
705 * List extended attribute names
707 * If size is zero, the total size of the attribute list should be
708 * sent with fuse_reply_xattr.
710 * If the size is non-zero, and the null character separated
711 * attribute list fits in the buffer, the list should be sent with
712 * fuse_reply_buf.
714 * If the size is too small for the list, the ERANGE error should
715 * be sent.
717 * Valid replies:
718 * fuse_reply_buf
719 * fuse_reply_data
720 * fuse_reply_xattr
721 * fuse_reply_err
723 * @param req request handle
724 * @param ino the inode number
725 * @param size maximum size of the list to send
727 void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);
730 * Remove an extended attribute
732 * Valid replies:
733 * fuse_reply_err
735 * @param req request handle
736 * @param ino the inode number
737 * @param name of the extended attribute
739 void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);
742 * Check file access permissions
744 * This will be called for the access() system call. If the
745 * 'default_permissions' mount option is given, this method is not
746 * called.
748 * This method is not called under Linux kernel versions 2.4.x
750 * Introduced in version 2.5
752 * Valid replies:
753 * fuse_reply_err
755 * @param req request handle
756 * @param ino the inode number
757 * @param mask requested access mode
759 void (*access) (fuse_req_t req, fuse_ino_t ino, int mask);
762 * Create and open a file
764 * If the file does not exist, first create it with the specified
765 * mode, and then open it.
767 * Open flags (with the exception of O_NOCTTY) are available in
768 * fi->flags.
770 * Filesystem may store an arbitrary file handle (pointer, index,
771 * etc) in fi->fh, and use this in other all other file operations
772 * (read, write, flush, release, fsync).
774 * There are also some flags (direct_io, keep_cache) which the
775 * filesystem may set in fi, to change the way the file is opened.
776 * See fuse_file_info structure in <fuse_common.h> for more details.
778 * If this method is not implemented or under Linux kernel
779 * versions earlier than 2.6.15, the mknod() and open() methods
780 * will be called instead.
782 * Introduced in version 2.5
784 * Valid replies:
785 * fuse_reply_create
786 * fuse_reply_err
788 * @param req request handle
789 * @param parent inode number of the parent directory
790 * @param name to create
791 * @param mode file type and mode with which to create the new file
792 * @param fi file information
794 void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name,
795 mode_t mode, struct fuse_file_info *fi);
798 * Test for a POSIX file lock
800 * Introduced in version 2.6
802 * Valid replies:
803 * fuse_reply_lock
804 * fuse_reply_err
806 * @param req request handle
807 * @param ino the inode number
808 * @param fi file information
809 * @param lock the region/type to test
811 void (*getlk) (fuse_req_t req, fuse_ino_t ino,
812 struct fuse_file_info *fi, struct flock *lock);
815 * Acquire, modify or release a POSIX file lock
817 * For POSIX threads (NPTL) there's a 1-1 relation between pid and
818 * owner, but otherwise this is not always the case. For checking
819 * lock ownership, 'fi->owner' must be used. The l_pid field in
820 * 'struct flock' should only be used to fill in this field in
821 * getlk().
823 * Note: if the locking methods are not implemented, the kernel
824 * will still allow file locking to work locally. Hence these are
825 * only interesting for network filesystems and similar.
827 * Introduced in version 2.6
829 * Valid replies:
830 * fuse_reply_err
832 * @param req request handle
833 * @param ino the inode number
834 * @param fi file information
835 * @param lock the region/type to set
836 * @param sleep locking operation may sleep
838 void (*setlk) (fuse_req_t req, fuse_ino_t ino,
839 struct fuse_file_info *fi,
840 struct flock *lock, int sleep);
843 * Map block index within file to block index within device
845 * Note: This makes sense only for block device backed filesystems
846 * mounted with the 'blkdev' option
848 * Introduced in version 2.6
850 * Valid replies:
851 * fuse_reply_bmap
852 * fuse_reply_err
854 * @param req request handle
855 * @param ino the inode number
856 * @param blocksize unit of block index
857 * @param idx block index within file
859 void (*bmap) (fuse_req_t req, fuse_ino_t ino, size_t blocksize,
860 uint64_t idx);
863 * Ioctl
865 * Note: For unrestricted ioctls (not allowed for FUSE
866 * servers), data in and out areas can be discovered by giving
867 * iovs and setting FUSE_IOCTL_RETRY in @flags. For
868 * restricted ioctls, kernel prepares in/out data area
869 * according to the information encoded in cmd.
871 * Introduced in version 2.8
873 * Valid replies:
874 * fuse_reply_ioctl_retry
875 * fuse_reply_ioctl
876 * fuse_reply_ioctl_iov
877 * fuse_reply_err
879 * @param req request handle
880 * @param ino the inode number
881 * @param cmd ioctl command
882 * @param arg ioctl argument
883 * @param fi file information
884 * @param flags for FUSE_IOCTL_* flags
885 * @param in_buf data fetched from the caller
886 * @param in_bufsz number of fetched bytes
887 * @param out_bufsz maximum size of output data
889 void (*ioctl) (fuse_req_t req, fuse_ino_t ino, int cmd, void *arg,
890 struct fuse_file_info *fi, unsigned flags,
891 const void *in_buf, size_t in_bufsz, size_t out_bufsz);
894 * Poll for IO readiness
896 * Introduced in version 2.8
898 * Note: If ph is non-NULL, the client should notify
899 * when IO readiness events occur by calling
900 * fuse_lowelevel_notify_poll() with the specified ph.
902 * Regardless of the number of times poll with a non-NULL ph
903 * is received, single notification is enough to clear all.
904 * Notifying more times incurs overhead but doesn't harm
905 * correctness.
907 * The callee is responsible for destroying ph with
908 * fuse_pollhandle_destroy() when no longer in use.
910 * Valid replies:
911 * fuse_reply_poll
912 * fuse_reply_err
914 * @param req request handle
915 * @param ino the inode number
916 * @param fi file information
917 * @param ph poll handle to be used for notification
919 void (*poll) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
920 struct fuse_pollhandle *ph);
923 * Write data made available in a buffer
925 * This is a more generic version of the ->write() method. If
926 * FUSE_CAP_SPLICE_READ is set in fuse_conn_info.want and the
927 * kernel supports splicing from the fuse device, then the
928 * data will be made available in pipe for supporting zero
929 * copy data transfer.
931 * Introduced in version 2.9
933 * Valid replies:
934 * fuse_reply_write
935 * fuse_reply_err
937 * @param req request handle
938 * @param ino the inode number
939 * @param bufv buffer containing the data
940 * @param off offset to write to
941 * @param fi file information
943 void (*write_buf) (fuse_req_t req, fuse_ino_t ino,
944 struct fuse_bufvec *bufv, off_t off,
945 struct fuse_file_info *fi);
948 * Callback function for the retrieve request
950 * Introduced in version 2.9
952 * Valid replies:
953 * fuse_reply_none
955 * @param req request handle
956 * @param cookie user data supplied to fuse_lowlevel_notify_retrieve()
957 * @param ino the inode number supplied to fuse_lowlevel_notify_retrieve()
958 * @param offset the offset supplied to fuse_lowlevel_notify_retrieve()
959 * @param bufv the buffer containing the returned data
961 void (*retrieve_reply) (fuse_req_t req, void *cookie, fuse_ino_t ino,
962 off_t offset, struct fuse_bufvec *bufv);
965 * Forget about multiple inodes
967 * See description of the forget function for more
968 * information.
970 * Introduced in version 2.9
972 * Valid replies:
973 * fuse_reply_none
975 * @param req request handle
977 void (*forget_multi) (fuse_req_t req, size_t count,
978 struct fuse_forget_data *forgets);
981 * Acquire, modify or release a BSD file lock
983 * Note: if the locking methods are not implemented, the kernel
984 * will still allow file locking to work locally. Hence these are
985 * only interesting for network filesystems and similar.
987 * Introduced in version 2.9
989 * Valid replies:
990 * fuse_reply_err
992 * @param req request handle
993 * @param ino the inode number
994 * @param fi file information
995 * @param op the locking operation, see flock(2)
997 void (*flock) (fuse_req_t req, fuse_ino_t ino,
998 struct fuse_file_info *fi, int op);
1001 * Allocate requested space. If this function returns success then
1002 * subsequent writes to the specified range shall not fail due to the lack
1003 * of free space on the file system storage media.
1005 * Introduced in version 2.9
1007 * Valid replies:
1008 * fuse_reply_err
1010 * @param req request handle
1011 * @param ino the inode number
1012 * @param offset starting point for allocated region
1013 * @param length size of allocated region
1014 * @param mode determines the operation to be performed on the given range,
1015 * see fallocate(2)
1017 void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode,
1018 off_t offset, off_t length, struct fuse_file_info *fi);
1022 * Reply with an error code or success
1024 * Possible requests:
1025 * all except forget
1027 * unlink, rmdir, rename, flush, release, fsync, fsyncdir, setxattr,
1028 * removexattr and setlk may send a zero code
1030 * @param req request handle
1031 * @param err the positive error value, or zero for success
1032 * @return zero for success, -errno for failure to send reply
1034 int fuse_reply_err(fuse_req_t req, int err);
1037 * Don't send reply
1039 * Possible requests:
1040 * forget
1042 * @param req request handle
1044 void fuse_reply_none(fuse_req_t req);
1047 * Reply with a directory entry
1049 * Possible requests:
1050 * lookup, mknod, mkdir, symlink, link
1052 * Side effects:
1053 * increments the lookup count on success
1055 * @param req request handle
1056 * @param e the entry parameters
1057 * @return zero for success, -errno for failure to send reply
1059 int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e);
1062 * Reply with a directory entry and open parameters
1064 * currently the following members of 'fi' are used:
1065 * fh, direct_io, keep_cache
1067 * Possible requests:
1068 * create
1070 * Side effects:
1071 * increments the lookup count on success
1073 * @param req request handle
1074 * @param e the entry parameters
1075 * @param fi file information
1076 * @return zero for success, -errno for failure to send reply
1078 int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e,
1079 const struct fuse_file_info *fi);
1082 * Reply with attributes
1084 * Possible requests:
1085 * getattr, setattr
1087 * @param req request handle
1088 * @param attr the attributes
1089 * @param attr_timeout validity timeout (in seconds) for the attributes
1090 * @return zero for success, -errno for failure to send reply
1092 int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
1093 double attr_timeout);
1096 * Reply with the contents of a symbolic link
1098 * Possible requests:
1099 * readlink
1101 * @param req request handle
1102 * @param link symbolic link contents
1103 * @return zero for success, -errno for failure to send reply
1105 int fuse_reply_readlink(fuse_req_t req, const char *link);
1108 * Reply with open parameters
1110 * currently the following members of 'fi' are used:
1111 * fh, direct_io, keep_cache
1113 * Possible requests:
1114 * open, opendir
1116 * @param req request handle
1117 * @param fi file information
1118 * @return zero for success, -errno for failure to send reply
1120 int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *fi);
1123 * Reply with number of bytes written
1125 * Possible requests:
1126 * write
1128 * @param req request handle
1129 * @param count the number of bytes written
1130 * @return zero for success, -errno for failure to send reply
1132 int fuse_reply_write(fuse_req_t req, size_t count);
1135 * Reply with data
1137 * Possible requests:
1138 * read, readdir, getxattr, listxattr
1140 * @param req request handle
1141 * @param buf buffer containing data
1142 * @param size the size of data in bytes
1143 * @return zero for success, -errno for failure to send reply
1145 int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
1148 * Reply with data copied/moved from buffer(s)
1150 * Possible requests:
1151 * read, readdir, getxattr, listxattr
1153 * @param req request handle
1154 * @param bufv buffer vector
1155 * @param flags flags controlling the copy
1156 * @return zero for success, -errno for failure to send reply
1158 int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
1159 enum fuse_buf_copy_flags flags);
1162 * Reply with data vector
1164 * Possible requests:
1165 * read, readdir, getxattr, listxattr
1167 * @param req request handle
1168 * @param iov the vector containing the data
1169 * @param count the size of vector
1170 * @return zero for success, -errno for failure to send reply
1172 int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
1175 * Reply with filesystem statistics
1177 * Possible requests:
1178 * statfs
1180 * @param req request handle
1181 * @param stbuf filesystem statistics
1182 * @return zero for success, -errno for failure to send reply
1184 int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf);
1187 * Reply with needed buffer size
1189 * Possible requests:
1190 * getxattr, listxattr
1192 * @param req request handle
1193 * @param count the buffer size needed in bytes
1194 * @return zero for success, -errno for failure to send reply
1196 int fuse_reply_xattr(fuse_req_t req, size_t count);
1199 * Reply with file lock information
1201 * Possible requests:
1202 * getlk
1204 * @param req request handle
1205 * @param lock the lock information
1206 * @return zero for success, -errno for failure to send reply
1208 int fuse_reply_lock(fuse_req_t req, const struct flock *lock);
1211 * Reply with block index
1213 * Possible requests:
1214 * bmap
1216 * @param req request handle
1217 * @param idx block index within device
1218 * @return zero for success, -errno for failure to send reply
1220 int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
1222 /* ----------------------------------------------------------- *
1223 * Filling a buffer in readdir *
1224 * ----------------------------------------------------------- */
1227 * Add a directory entry to the buffer
1229 * Buffer needs to be large enough to hold the entry. If it's not,
1230 * then the entry is not filled in but the size of the entry is still
1231 * returned. The caller can check this by comparing the bufsize
1232 * parameter with the returned entry size. If the entry size is
1233 * larger than the buffer size, the operation failed.
1235 * From the 'stbuf' argument the st_ino field and bits 12-15 of the
1236 * st_mode field are used. The other fields are ignored.
1238 * Note: offsets do not necessarily represent physical offsets, and
1239 * could be any marker, that enables the implementation to find a
1240 * specific point in the directory stream.
1242 * @param req request handle
1243 * @param buf the point where the new entry will be added to the buffer
1244 * @param bufsize remaining size of the buffer
1245 * @param name the name of the entry
1246 * @param stbuf the file attributes
1247 * @param off the offset of the next entry
1248 * @return the space needed for the entry
1250 size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
1251 const char *name, const struct stat *stbuf,
1252 off_t off);
1255 * Reply to ask for data fetch and output buffer preparation. ioctl
1256 * will be retried with the specified input data fetched and output
1257 * buffer prepared.
1259 * Possible requests:
1260 * ioctl
1262 * @param req request handle
1263 * @param in_iov iovec specifying data to fetch from the caller
1264 * @param in_count number of entries in in_iov
1265 * @param out_iov iovec specifying addresses to write output to
1266 * @param out_count number of entries in out_iov
1267 * @return zero for success, -errno for failure to send reply
1269 int fuse_reply_ioctl_retry(fuse_req_t req,
1270 const struct iovec *in_iov, size_t in_count,
1271 const struct iovec *out_iov, size_t out_count);
1274 * Reply to finish ioctl
1276 * Possible requests:
1277 * ioctl
1279 * @param req request handle
1280 * @param result result to be passed to the caller
1281 * @param buf buffer containing output data
1282 * @param size length of output data
1284 int fuse_reply_ioctl(fuse_req_t req, int result, const void *buf, size_t size);
1287 * Reply to finish ioctl with iov buffer
1289 * Possible requests:
1290 * ioctl
1292 * @param req request handle
1293 * @param result result to be passed to the caller
1294 * @param iov the vector containing the data
1295 * @param count the size of vector
1297 int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov,
1298 int count);
1301 * Reply with poll result event mask
1303 * @param req request handle
1304 * @param revents poll result event mask
1306 int fuse_reply_poll(fuse_req_t req, unsigned revents);
1308 /* ----------------------------------------------------------- *
1309 * Notification *
1310 * ----------------------------------------------------------- */
1313 * Notify IO readiness event
1315 * For more information, please read comment for poll operation.
1317 * @param ph poll handle to notify IO readiness event for
1319 int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
1322 * Notify to invalidate cache for an inode
1324 * @param ch the channel through which to send the invalidation
1325 * @param ino the inode number
1326 * @param off the offset in the inode where to start invalidating
1327 * or negative to invalidate attributes only
1328 * @param len the amount of cache to invalidate or 0 for all
1329 * @return zero for success, -errno for failure
1331 int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
1332 off_t off, off_t len);
1335 * Notify to invalidate parent attributes and the dentry matching
1336 * parent/name
1338 * @param ch the channel through which to send the invalidation
1339 * @param parent inode number
1340 * @param name file name
1341 * @param namelen strlen() of file name
1342 * @return zero for success, -errno for failure
1344 int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
1345 const char *name, size_t namelen);
1348 * Notify to invalidate parent attributes and delete the dentry matching
1349 * parent/name if the dentry's inode number matches child (otherwise it
1350 * will invalidate the matching dentry).
1352 * @param ch the channel through which to send the notification
1353 * @param parent inode number
1354 * @param child inode number
1355 * @param name file name
1356 * @param namelen strlen() of file name
1357 * @return zero for success, -errno for failure
1359 int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
1360 fuse_ino_t parent, fuse_ino_t child,
1361 const char *name, size_t namelen);
1364 * Store data to the kernel buffers
1366 * Synchronously store data in the kernel buffers belonging to the
1367 * given inode. The stored data is marked up-to-date (no read will be
1368 * performed against it, unless it's invalidated or evicted from the
1369 * cache).
1371 * If the stored data overflows the current file size, then the size
1372 * is extended, similarly to a write(2) on the filesystem.
1374 * If this function returns an error, then the store wasn't fully
1375 * completed, but it may have been partially completed.
1377 * @param ch the channel through which to send the invalidation
1378 * @param ino the inode number
1379 * @param offset the starting offset into the file to store to
1380 * @param bufv buffer vector
1381 * @param flags flags controlling the copy
1382 * @return zero for success, -errno for failure
1384 int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
1385 off_t offset, struct fuse_bufvec *bufv,
1386 enum fuse_buf_copy_flags flags);
1388 * Retrieve data from the kernel buffers
1390 * Retrieve data in the kernel buffers belonging to the given inode.
1391 * If successful then the retrieve_reply() method will be called with
1392 * the returned data.
1394 * Only present pages are returned in the retrieve reply. Retrieving
1395 * stops when it finds a non-present page and only data prior to that is
1396 * returned.
1398 * If this function returns an error, then the retrieve will not be
1399 * completed and no reply will be sent.
1401 * This function doesn't change the dirty state of pages in the kernel
1402 * buffer. For dirty pages the write() method will be called
1403 * regardless of having been retrieved previously.
1405 * @param ch the channel through which to send the invalidation
1406 * @param ino the inode number
1407 * @param size the number of bytes to retrieve
1408 * @param offset the starting offset into the file to retrieve from
1409 * @param cookie user data to supply to the reply callback
1410 * @return zero for success, -errno for failure
1412 int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
1413 size_t size, off_t offset, void *cookie);
1416 /* ----------------------------------------------------------- *
1417 * Utility functions *
1418 * ----------------------------------------------------------- */
1421 * Get the userdata from the request
1423 * @param req request handle
1424 * @return the user data passed to fuse_lowlevel_new()
1426 void *fuse_req_userdata(fuse_req_t req);
1429 * Get the context from the request
1431 * The pointer returned by this function will only be valid for the
1432 * request's lifetime
1434 * @param req request handle
1435 * @return the context structure
1437 const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);
1440 * Get the current supplementary group IDs for the specified request
1442 * Similar to the getgroups(2) system call, except the return value is
1443 * always the total number of group IDs, even if it is larger than the
1444 * specified size.
1446 * The current fuse kernel module in linux (as of 2.6.30) doesn't pass
1447 * the group list to userspace, hence this function needs to parse
1448 * "/proc/$TID/task/$TID/status" to get the group IDs.
1450 * This feature may not be supported on all operating systems. In
1451 * such a case this function will return -ENOSYS.
1453 * @param req request handle
1454 * @param size size of given array
1455 * @param list array of group IDs to be filled in
1456 * @return the total number of supplementary group IDs or -errno on failure
1458 int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]);
1461 * Callback function for an interrupt
1463 * @param req interrupted request
1464 * @param data user data
1466 typedef void (*fuse_interrupt_func_t)(fuse_req_t req, void *data);
1469 * Register/unregister callback for an interrupt
1471 * If an interrupt has already happened, then the callback function is
1472 * called from within this function, hence it's not possible for
1473 * interrupts to be lost.
1475 * @param req request handle
1476 * @param func the callback function or NULL for unregister
1477 * @param data user data passed to the callback function
1479 void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func,
1480 void *data);
1483 * Check if a request has already been interrupted
1485 * @param req request handle
1486 * @return 1 if the request has been interrupted, 0 otherwise
1488 int fuse_req_interrupted(fuse_req_t req);
1490 /* ----------------------------------------------------------- *
1491 * Filesystem setup *
1492 * ----------------------------------------------------------- */
1494 /* Deprecated, don't use */
1495 int fuse_lowlevel_is_lib_option(const char *opt);
1498 * Create a low level session
1500 * @param args argument vector
1501 * @param op the low level filesystem operations
1502 * @param op_size sizeof(struct fuse_lowlevel_ops)
1503 * @param userdata user data
1504 * @return the created session object, or NULL on failure
1506 struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
1507 const struct fuse_lowlevel_ops *op,
1508 size_t op_size, void *userdata);
1510 /* ----------------------------------------------------------- *
1511 * Session interface *
1512 * ----------------------------------------------------------- */
1515 * Session operations
1517 * This is used in session creation
1519 struct fuse_session_ops {
1521 * Hook to process a request (mandatory)
1523 * @param data user data passed to fuse_session_new()
1524 * @param buf buffer containing the raw request
1525 * @param len request length
1526 * @param ch channel on which the request was received
1528 void (*process) (void *data, const char *buf, size_t len,
1529 struct fuse_chan *ch);
1532 * Hook for session exit and reset (optional)
1534 * @param data user data passed to fuse_session_new()
1535 * @param val exited status (1 - exited, 0 - not exited)
1537 void (*exit) (void *data, int val);
1540 * Hook for querying the current exited status (optional)
1542 * @param data user data passed to fuse_session_new()
1543 * @return 1 if exited, 0 if not exited
1545 int (*exited) (void *data);
1548 * Hook for cleaning up the channel on destroy (optional)
1550 * @param data user data passed to fuse_session_new()
1552 void (*destroy) (void *data);
1556 * Create a new session
1558 * @param op session operations
1559 * @param data user data
1560 * @return new session object, or NULL on failure
1562 struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data);
1565 * Assign a channel to a session
1567 * Note: currently only a single channel may be assigned. This may
1568 * change in the future
1570 * If a session is destroyed, the assigned channel is also destroyed
1572 * @param se the session
1573 * @param ch the channel
1575 void fuse_session_add_chan(struct fuse_session *se, struct fuse_chan *ch);
1578 * Remove a channel from a session
1580 * If the channel is not assigned to a session, then this is a no-op
1582 * @param ch the channel to remove
1584 void fuse_session_remove_chan(struct fuse_chan *ch);
1587 * Iterate over the channels assigned to a session
1589 * The iterating function needs to start with a NULL channel, and
1590 * after that needs to pass the previously returned channel to the
1591 * function.
1593 * @param se the session
1594 * @param ch the previous channel, or NULL
1595 * @return the next channel, or NULL if no more channels exist
1597 struct fuse_chan *fuse_session_next_chan(struct fuse_session *se,
1598 struct fuse_chan *ch);
1601 * Process a raw request
1603 * @param se the session
1604 * @param buf buffer containing the raw request
1605 * @param len request length
1606 * @param ch channel on which the request was received
1608 void fuse_session_process(struct fuse_session *se, const char *buf, size_t len,
1609 struct fuse_chan *ch);
1612 * Process a raw request supplied in a generic buffer
1614 * This is a more generic version of fuse_session_process(). The
1615 * fuse_buf may contain a memory buffer or a pipe file descriptor.
1617 * @param se the session
1618 * @param buf the fuse_buf containing the request
1619 * @param ch channel on which the request was received
1621 void fuse_session_process_buf(struct fuse_session *se,
1622 const struct fuse_buf *buf, struct fuse_chan *ch);
1625 * Receive a raw request supplied in a generic buffer
1627 * This is a more generic version of fuse_chan_recv(). The fuse_buf
1628 * supplied to this function contains a suitably allocated memory
1629 * buffer. This may be overwritten with a file descriptor buffer.
1631 * @param se the session
1632 * @param buf the fuse_buf to store the request in
1633 * @param chp pointer to the channel
1634 * @return the actual size of the raw request, or -errno on error
1636 int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf,
1637 struct fuse_chan **chp);
1640 * Destroy a session
1642 * @param se the session
1644 void fuse_session_destroy(struct fuse_session *se);
1647 * Exit a session
1649 * @param se the session
1651 void fuse_session_exit(struct fuse_session *se);
1654 * Reset the exited status of a session
1656 * @param se the session
1658 void fuse_session_reset(struct fuse_session *se);
1661 * Query the exited status of a session
1663 * @param se the session
1664 * @return 1 if exited, 0 if not exited
1666 int fuse_session_exited(struct fuse_session *se);
1669 * Get the user data provided to the session
1671 * @param se the session
1672 * @return the user data
1674 void *fuse_session_data(struct fuse_session *se);
1677 * Enter a single threaded event loop
1679 * @param se the session
1680 * @return 0 on success, -1 on error
1682 int fuse_session_loop(struct fuse_session *se);
1685 * Enter a multi-threaded event loop
1687 * @param se the session
1688 * @return 0 on success, -1 on error
1690 int fuse_session_loop_mt(struct fuse_session *se);
1692 /* ----------------------------------------------------------- *
1693 * Channel interface *
1694 * ----------------------------------------------------------- */
1697 * Channel operations
1699 * This is used in channel creation
1701 struct fuse_chan_ops {
1703 * Hook for receiving a raw request
1705 * @param ch pointer to the channel
1706 * @param buf the buffer to store the request in
1707 * @param size the size of the buffer
1708 * @return the actual size of the raw request, or -1 on error
1710 int (*receive)(struct fuse_chan **chp, char *buf, size_t size);
1713 * Hook for sending a raw reply
1715 * A return value of -ENOENT means, that the request was
1716 * interrupted, and the reply was discarded
1718 * @param ch the channel
1719 * @param iov vector of blocks
1720 * @param count the number of blocks in vector
1721 * @return zero on success, -errno on failure
1723 int (*send)(struct fuse_chan *ch, const struct iovec iov[],
1724 size_t count);
1727 * Destroy the channel
1729 * @param ch the channel
1731 void (*destroy)(struct fuse_chan *ch);
1735 * Create a new channel
1737 * @param op channel operations
1738 * @param fd file descriptor of the channel
1739 * @param bufsize the minimal receive buffer size
1740 * @param data user data
1741 * @return the new channel object, or NULL on failure
1743 struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd,
1744 size_t bufsize, void *data);
1747 * Query the file descriptor of the channel
1749 * @param ch the channel
1750 * @return the file descriptor passed to fuse_chan_new()
1752 int fuse_chan_fd(struct fuse_chan *ch);
1755 * Query the minimal receive buffer size
1757 * @param ch the channel
1758 * @return the buffer size passed to fuse_chan_new()
1760 size_t fuse_chan_bufsize(struct fuse_chan *ch);
1763 * Query the user data
1765 * @param ch the channel
1766 * @return the user data passed to fuse_chan_new()
1768 void *fuse_chan_data(struct fuse_chan *ch);
1771 * Query the session to which this channel is assigned
1773 * @param ch the channel
1774 * @return the session, or NULL if the channel is not assigned
1776 struct fuse_session *fuse_chan_session(struct fuse_chan *ch);
1779 * Receive a raw request
1781 * A return value of -ENODEV means, that the filesystem was unmounted
1783 * @param ch pointer to the channel
1784 * @param buf the buffer to store the request in
1785 * @param size the size of the buffer
1786 * @return the actual size of the raw request, or -errno on error
1788 int fuse_chan_recv(struct fuse_chan **ch, char *buf, size_t size);
1791 * Send a raw reply
1793 * A return value of -ENOENT means, that the request was
1794 * interrupted, and the reply was discarded
1796 * @param ch the channel
1797 * @param iov vector of blocks
1798 * @param count the number of blocks in vector
1799 * @return zero on success, -errno on failure
1801 int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[],
1802 size_t count);
1805 * Destroy a channel
1807 * @param ch the channel
1809 void fuse_chan_destroy(struct fuse_chan *ch);
1811 /* ----------------------------------------------------------- *
1812 * Compatibility stuff *
1813 * ----------------------------------------------------------- */
1815 #if FUSE_USE_VERSION < 26
1816 # include "fuse_lowlevel_compat.h"
1817 # define fuse_chan_ops fuse_chan_ops_compat24
1818 # define fuse_chan_new fuse_chan_new_compat24
1819 # if FUSE_USE_VERSION == 25
1820 # define fuse_lowlevel_ops fuse_lowlevel_ops_compat25
1821 # define fuse_lowlevel_new fuse_lowlevel_new_compat25
1822 # elif FUSE_USE_VERSION == 24
1823 # define fuse_lowlevel_ops fuse_lowlevel_ops_compat
1824 # define fuse_lowlevel_new fuse_lowlevel_new_compat
1825 # define fuse_file_info fuse_file_info_compat
1826 # define fuse_reply_statfs fuse_reply_statfs_compat
1827 # define fuse_reply_open fuse_reply_open_compat
1828 # else
1829 # error Compatibility with low-level API version < 24 not supported
1830 # endif
1831 #endif
1833 #ifdef __cplusplus
1835 #endif
1837 #endif /* _FUSE_LOWLEVEL_H_ */