]> git.proxmox.com Git - mirror_qemu.git/blob - tools/virtiofsd/fuse_common.h
virtiofsd: Remove unused enum fuse_buf_copy_flags
[mirror_qemu.git] / tools / virtiofsd / fuse_common.h
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 /** @file */
10
11 #if !defined(FUSE_H_) && !defined(FUSE_LOWLEVEL_H_)
12 #error \
13 "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."
14 #endif
15
16 #ifndef FUSE_COMMON_H_
17 #define FUSE_COMMON_H_
18
19 #include "fuse_log.h"
20 #include "fuse_opt.h"
21 #include <stdint.h>
22 #include <sys/types.h>
23
24 /** Major version of FUSE library interface */
25 #define FUSE_MAJOR_VERSION 3
26
27 /** Minor version of FUSE library interface */
28 #define FUSE_MINOR_VERSION 2
29
30 #define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
31 #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
32
33 /**
34 * Information about an open file.
35 *
36 * File Handles are created by the open, opendir, and create methods and closed
37 * by the release and releasedir methods. Multiple file handles may be
38 * concurrently open for the same file. Generally, a client will create one
39 * file handle per file descriptor, though in some cases multiple file
40 * descriptors can share a single file handle.
41 */
42 struct fuse_file_info {
43 /** Open flags. Available in open() and release() */
44 int flags;
45
46 /*
47 * In case of a write operation indicates if this was caused
48 * by a delayed write from the page cache. If so, then the
49 * context's pid, uid, and gid fields will not be valid, and
50 * the *fh* value may not match the *fh* value that would
51 * have been sent with the corresponding individual write
52 * requests if write caching had been disabled.
53 */
54 unsigned int writepage:1;
55
56 /** Can be filled in by open, to use direct I/O on this file. */
57 unsigned int direct_io:1;
58
59 /*
60 * Can be filled in by open. It signals the kernel that any
61 * currently cached file data (ie., data that the filesystem
62 * provided the last time the file was open) need not be
63 * invalidated. Has no effect when set in other contexts (in
64 * particular it does nothing when set by opendir()).
65 */
66 unsigned int keep_cache:1;
67
68 /*
69 * Indicates a flush operation. Set in flush operation, also
70 * maybe set in highlevel lock operation and lowlevel release
71 * operation.
72 */
73 unsigned int flush:1;
74
75 /*
76 * Can be filled in by open, to indicate that the file is not
77 * seekable.
78 */
79 unsigned int nonseekable:1;
80
81 /*
82 * Indicates that flock locks for this file should be
83 * released. If set, lock_owner shall contain a valid value.
84 * May only be set in ->release().
85 */
86 unsigned int flock_release:1;
87
88 /*
89 * Can be filled in by opendir. It signals the kernel to
90 * enable caching of entries returned by readdir(). Has no
91 * effect when set in other contexts (in particular it does
92 * nothing when set by open()).
93 */
94 unsigned int cache_readdir:1;
95
96 /** Padding. Reserved for future use*/
97 unsigned int padding:25;
98 unsigned int padding2:32;
99
100 /*
101 * File handle id. May be filled in by filesystem in create,
102 * open, and opendir(). Available in most other file operations on the
103 * same file handle.
104 */
105 uint64_t fh;
106
107 /** Lock owner id. Available in locking operations and flush */
108 uint64_t lock_owner;
109
110 /*
111 * Requested poll events. Available in ->poll. Only set on kernels
112 * which support it. If unsupported, this field is set to zero.
113 */
114 uint32_t poll_events;
115 };
116
117 /*
118 * Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want'
119 */
120
121 /**
122 * Indicates that the filesystem supports asynchronous read requests.
123 *
124 * If this capability is not requested/available, the kernel will
125 * ensure that there is at most one pending read request per
126 * file-handle at any time, and will attempt to order read requests by
127 * increasing offset.
128 *
129 * This feature is enabled by default when supported by the kernel.
130 */
131 #define FUSE_CAP_ASYNC_READ (1 << 0)
132
133 /**
134 * Indicates that the filesystem supports "remote" locking.
135 *
136 * This feature is enabled by default when supported by the kernel,
137 * and if getlk() and setlk() handlers are implemented.
138 */
139 #define FUSE_CAP_POSIX_LOCKS (1 << 1)
140
141 /**
142 * Indicates that the filesystem supports the O_TRUNC open flag. If
143 * disabled, and an application specifies O_TRUNC, fuse first calls
144 * truncate() and then open() with O_TRUNC filtered out.
145 *
146 * This feature is enabled by default when supported by the kernel.
147 */
148 #define FUSE_CAP_ATOMIC_O_TRUNC (1 << 3)
149
150 /**
151 * Indicates that the filesystem supports lookups of "." and "..".
152 *
153 * This feature is disabled by default.
154 */
155 #define FUSE_CAP_EXPORT_SUPPORT (1 << 4)
156
157 /**
158 * Indicates that the kernel should not apply the umask to the
159 * file mode on create operations.
160 *
161 * This feature is disabled by default.
162 */
163 #define FUSE_CAP_DONT_MASK (1 << 6)
164
165 /**
166 * Indicates that libfuse should try to use splice() when writing to
167 * the fuse device. This may improve performance.
168 *
169 * This feature is disabled by default.
170 */
171 #define FUSE_CAP_SPLICE_WRITE (1 << 7)
172
173 /**
174 * Indicates that libfuse should try to move pages instead of copying when
175 * writing to / reading from the fuse device. This may improve performance.
176 *
177 * This feature is disabled by default.
178 */
179 #define FUSE_CAP_SPLICE_MOVE (1 << 8)
180
181 /**
182 * Indicates that libfuse should try to use splice() when reading from
183 * the fuse device. This may improve performance.
184 *
185 * This feature is enabled by default when supported by the kernel and
186 * if the filesystem implements a write_buf() handler.
187 */
188 #define FUSE_CAP_SPLICE_READ (1 << 9)
189
190 /**
191 * If set, the calls to flock(2) will be emulated using POSIX locks and must
192 * then be handled by the filesystem's setlock() handler.
193 *
194 * If not set, flock(2) calls will be handled by the FUSE kernel module
195 * internally (so any access that does not go through the kernel cannot be taken
196 * into account).
197 *
198 * This feature is enabled by default when supported by the kernel and
199 * if the filesystem implements a flock() handler.
200 */
201 #define FUSE_CAP_FLOCK_LOCKS (1 << 10)
202
203 /**
204 * Indicates that the filesystem supports ioctl's on directories.
205 *
206 * This feature is enabled by default when supported by the kernel.
207 */
208 #define FUSE_CAP_IOCTL_DIR (1 << 11)
209
210 /**
211 * Traditionally, while a file is open the FUSE kernel module only
212 * asks the filesystem for an update of the file's attributes when a
213 * client attempts to read beyond EOF. This is unsuitable for
214 * e.g. network filesystems, where the file contents may change
215 * without the kernel knowing about it.
216 *
217 * If this flag is set, FUSE will check the validity of the attributes
218 * on every read. If the attributes are no longer valid (i.e., if the
219 * *attr_timeout* passed to fuse_reply_attr() or set in `struct
220 * fuse_entry_param` has passed), it will first issue a `getattr`
221 * request. If the new mtime differs from the previous value, any
222 * cached file *contents* will be invalidated as well.
223 *
224 * This flag should always be set when available. If all file changes
225 * go through the kernel, *attr_timeout* should be set to a very large
226 * number to avoid unnecessary getattr() calls.
227 *
228 * This feature is enabled by default when supported by the kernel.
229 */
230 #define FUSE_CAP_AUTO_INVAL_DATA (1 << 12)
231
232 /**
233 * Indicates that the filesystem supports readdirplus.
234 *
235 * This feature is enabled by default when supported by the kernel and if the
236 * filesystem implements a readdirplus() handler.
237 */
238 #define FUSE_CAP_READDIRPLUS (1 << 13)
239
240 /**
241 * Indicates that the filesystem supports adaptive readdirplus.
242 *
243 * If FUSE_CAP_READDIRPLUS is not set, this flag has no effect.
244 *
245 * If FUSE_CAP_READDIRPLUS is set and this flag is not set, the kernel
246 * will always issue readdirplus() requests to retrieve directory
247 * contents.
248 *
249 * If FUSE_CAP_READDIRPLUS is set and this flag is set, the kernel
250 * will issue both readdir() and readdirplus() requests, depending on
251 * how much information is expected to be required.
252 *
253 * As of Linux 4.20, the algorithm is as follows: when userspace
254 * starts to read directory entries, issue a READDIRPLUS request to
255 * the filesystem. If any entry attributes have been looked up by the
256 * time userspace requests the next batch of entries continue with
257 * READDIRPLUS, otherwise switch to plain READDIR. This will reasult
258 * in eg plain "ls" triggering READDIRPLUS first then READDIR after
259 * that because it doesn't do lookups. "ls -l" should result in all
260 * READDIRPLUS, except if dentries are already cached.
261 *
262 * This feature is enabled by default when supported by the kernel and
263 * if the filesystem implements both a readdirplus() and a readdir()
264 * handler.
265 */
266 #define FUSE_CAP_READDIRPLUS_AUTO (1 << 14)
267
268 /**
269 * Indicates that the filesystem supports asynchronous direct I/O submission.
270 *
271 * If this capability is not requested/available, the kernel will ensure that
272 * there is at most one pending read and one pending write request per direct
273 * I/O file-handle at any time.
274 *
275 * This feature is enabled by default when supported by the kernel.
276 */
277 #define FUSE_CAP_ASYNC_DIO (1 << 15)
278
279 /**
280 * Indicates that writeback caching should be enabled. This means that
281 * individual write request may be buffered and merged in the kernel
282 * before they are send to the filesystem.
283 *
284 * This feature is disabled by default.
285 */
286 #define FUSE_CAP_WRITEBACK_CACHE (1 << 16)
287
288 /**
289 * Indicates support for zero-message opens. If this flag is set in
290 * the `capable` field of the `fuse_conn_info` structure, then the
291 * filesystem may return `ENOSYS` from the open() handler to indicate
292 * success. Further attempts to open files will be handled in the
293 * kernel. (If this flag is not set, returning ENOSYS will be treated
294 * as an error and signaled to the caller).
295 *
296 * Setting (or unsetting) this flag in the `want` field has *no
297 * effect*.
298 */
299 #define FUSE_CAP_NO_OPEN_SUPPORT (1 << 17)
300
301 /**
302 * Indicates support for parallel directory operations. If this flag
303 * is unset, the FUSE kernel module will ensure that lookup() and
304 * readdir() requests are never issued concurrently for the same
305 * directory.
306 *
307 * This feature is enabled by default when supported by the kernel.
308 */
309 #define FUSE_CAP_PARALLEL_DIROPS (1 << 18)
310
311 /**
312 * Indicates support for POSIX ACLs.
313 *
314 * If this feature is enabled, the kernel will cache and have
315 * responsibility for enforcing ACLs. ACL will be stored as xattrs and
316 * passed to userspace, which is responsible for updating the ACLs in
317 * the filesystem, keeping the file mode in sync with the ACL, and
318 * ensuring inheritance of default ACLs when new filesystem nodes are
319 * created. Note that this requires that the file system is able to
320 * parse and interpret the xattr representation of ACLs.
321 *
322 * Enabling this feature implicitly turns on the
323 * ``default_permissions`` mount option (even if it was not passed to
324 * mount(2)).
325 *
326 * This feature is disabled by default.
327 */
328 #define FUSE_CAP_POSIX_ACL (1 << 19)
329
330 /**
331 * Indicates that the filesystem is responsible for unsetting
332 * setuid and setgid bits when a file is written, truncated, or
333 * its owner is changed.
334 *
335 * This feature is enabled by default when supported by the kernel.
336 */
337 #define FUSE_CAP_HANDLE_KILLPRIV (1 << 20)
338
339 /**
340 * Indicates support for zero-message opendirs. If this flag is set in
341 * the `capable` field of the `fuse_conn_info` structure, then the filesystem
342 * may return `ENOSYS` from the opendir() handler to indicate success. Further
343 * opendir and releasedir messages will be handled in the kernel. (If this
344 * flag is not set, returning ENOSYS will be treated as an error and signalled
345 * to the caller.)
346 *
347 * Setting (or unsetting) this flag in the `want` field has *no effect*.
348 */
349 #define FUSE_CAP_NO_OPENDIR_SUPPORT (1 << 24)
350
351 /**
352 * Ioctl flags
353 *
354 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
355 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
356 * FUSE_IOCTL_RETRY: retry with new iovecs
357 * FUSE_IOCTL_DIR: is a directory
358 *
359 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
360 */
361 #define FUSE_IOCTL_COMPAT (1 << 0)
362 #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
363 #define FUSE_IOCTL_RETRY (1 << 2)
364 #define FUSE_IOCTL_DIR (1 << 4)
365
366 #define FUSE_IOCTL_MAX_IOV 256
367
368 /**
369 * Connection information, passed to the ->init() method
370 *
371 * Some of the elements are read-write, these can be changed to
372 * indicate the value requested by the filesystem. The requested
373 * value must usually be smaller than the indicated value.
374 */
375 struct fuse_conn_info {
376 /**
377 * Major version of the protocol (read-only)
378 */
379 unsigned proto_major;
380
381 /**
382 * Minor version of the protocol (read-only)
383 */
384 unsigned proto_minor;
385
386 /**
387 * Maximum size of the write buffer
388 */
389 unsigned max_write;
390
391 /**
392 * Maximum size of read requests. A value of zero indicates no
393 * limit. However, even if the filesystem does not specify a
394 * limit, the maximum size of read requests will still be
395 * limited by the kernel.
396 *
397 * NOTE: For the time being, the maximum size of read requests
398 * must be set both here *and* passed to fuse_session_new()
399 * using the ``-o max_read=<n>`` mount option. At some point
400 * in the future, specifying the mount option will no longer
401 * be necessary.
402 */
403 unsigned max_read;
404
405 /**
406 * Maximum readahead
407 */
408 unsigned max_readahead;
409
410 /**
411 * Capability flags that the kernel supports (read-only)
412 */
413 unsigned capable;
414
415 /**
416 * Capability flags that the filesystem wants to enable.
417 *
418 * libfuse attempts to initialize this field with
419 * reasonable default values before calling the init() handler.
420 */
421 unsigned want;
422
423 /**
424 * Maximum number of pending "background" requests. A
425 * background request is any type of request for which the
426 * total number is not limited by other means. As of kernel
427 * 4.8, only two types of requests fall into this category:
428 *
429 * 1. Read-ahead requests
430 * 2. Asynchronous direct I/O requests
431 *
432 * Read-ahead requests are generated (if max_readahead is
433 * non-zero) by the kernel to preemptively fill its caches
434 * when it anticipates that userspace will soon read more
435 * data.
436 *
437 * Asynchronous direct I/O requests are generated if
438 * FUSE_CAP_ASYNC_DIO is enabled and userspace submits a large
439 * direct I/O request. In this case the kernel will internally
440 * split it up into multiple smaller requests and submit them
441 * to the filesystem concurrently.
442 *
443 * Note that the following requests are *not* background
444 * requests: writeback requests (limited by the kernel's
445 * flusher algorithm), regular (i.e., synchronous and
446 * buffered) userspace read/write requests (limited to one per
447 * thread), asynchronous read requests (Linux's io_submit(2)
448 * call actually blocks, so these are also limited to one per
449 * thread).
450 */
451 unsigned max_background;
452
453 /**
454 * Kernel congestion threshold parameter. If the number of pending
455 * background requests exceeds this number, the FUSE kernel module will
456 * mark the filesystem as "congested". This instructs the kernel to
457 * expect that queued requests will take some time to complete, and to
458 * adjust its algorithms accordingly (e.g. by putting a waiting thread
459 * to sleep instead of using a busy-loop).
460 */
461 unsigned congestion_threshold;
462
463 /**
464 * When FUSE_CAP_WRITEBACK_CACHE is enabled, the kernel is responsible
465 * for updating mtime and ctime when write requests are received. The
466 * updated values are passed to the filesystem with setattr() requests.
467 * However, if the filesystem does not support the full resolution of
468 * the kernel timestamps (nanoseconds), the mtime and ctime values used
469 * by kernel and filesystem will differ (and result in an apparent
470 * change of times after a cache flush).
471 *
472 * To prevent this problem, this variable can be used to inform the
473 * kernel about the timestamp granularity supported by the file-system.
474 * The value should be power of 10. The default is 1, i.e. full
475 * nano-second resolution. Filesystems supporting only second resolution
476 * should set this to 1000000000.
477 */
478 unsigned time_gran;
479
480 /**
481 * For future use.
482 */
483 unsigned reserved[22];
484 };
485
486 struct fuse_session;
487 struct fuse_pollhandle;
488 struct fuse_conn_info_opts;
489
490 /**
491 * This function parses several command-line options that can be used
492 * to override elements of struct fuse_conn_info. The pointer returned
493 * by this function should be passed to the
494 * fuse_apply_conn_info_opts() method by the file system's init()
495 * handler.
496 *
497 * Before using this function, think twice if you really want these
498 * parameters to be adjustable from the command line. In most cases,
499 * they should be determined by the file system internally.
500 *
501 * The following options are recognized:
502 *
503 * -o max_write=N sets conn->max_write
504 * -o max_readahead=N sets conn->max_readahead
505 * -o max_background=N sets conn->max_background
506 * -o congestion_threshold=N sets conn->congestion_threshold
507 * -o async_read sets FUSE_CAP_ASYNC_READ in conn->want
508 * -o sync_read unsets FUSE_CAP_ASYNC_READ in conn->want
509 * -o atomic_o_trunc sets FUSE_CAP_ATOMIC_O_TRUNC in conn->want
510 * -o no_remote_lock Equivalent to -o
511 *no_remote_flock,no_remote_posix_lock -o no_remote_flock Unsets
512 *FUSE_CAP_FLOCK_LOCKS in conn->want -o no_remote_posix_lock Unsets
513 *FUSE_CAP_POSIX_LOCKS in conn->want -o [no_]splice_write (un-)sets
514 *FUSE_CAP_SPLICE_WRITE in conn->want -o [no_]splice_move (un-)sets
515 *FUSE_CAP_SPLICE_MOVE in conn->want -o [no_]splice_read (un-)sets
516 *FUSE_CAP_SPLICE_READ in conn->want -o [no_]auto_inval_data (un-)sets
517 *FUSE_CAP_AUTO_INVAL_DATA in conn->want -o readdirplus=no unsets
518 *FUSE_CAP_READDIRPLUS in conn->want -o readdirplus=yes sets
519 *FUSE_CAP_READDIRPLUS and unsets FUSE_CAP_READDIRPLUS_AUTO in conn->want -o
520 *readdirplus=auto sets FUSE_CAP_READDIRPLUS and FUSE_CAP_READDIRPLUS_AUTO
521 *in conn->want -o [no_]async_dio (un-)sets FUSE_CAP_ASYNC_DIO in
522 *conn->want -o [no_]writeback_cache (un-)sets FUSE_CAP_WRITEBACK_CACHE in
523 *conn->want -o time_gran=N sets conn->time_gran
524 *
525 * Known options will be removed from *args*, unknown options will be
526 * passed through unchanged.
527 *
528 * @param args argument vector (input+output)
529 * @return parsed options
530 **/
531 struct fuse_conn_info_opts *fuse_parse_conn_info_opts(struct fuse_args *args);
532
533 /**
534 * This function applies the (parsed) parameters in *opts* to the
535 * *conn* pointer. It may modify the following fields: wants,
536 * max_write, max_readahead, congestion_threshold, max_background,
537 * time_gran. A field is only set (or unset) if the corresponding
538 * option has been explicitly set.
539 */
540 void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
541 struct fuse_conn_info *conn);
542
543 /**
544 * Go into the background
545 *
546 * @param foreground if true, stay in the foreground
547 * @return 0 on success, -1 on failure
548 */
549 int fuse_daemonize(int foreground);
550
551 /**
552 * Get the version of the library
553 *
554 * @return the version
555 */
556 int fuse_version(void);
557
558 /**
559 * Get the full package version string of the library
560 *
561 * @return the package version
562 */
563 const char *fuse_pkgversion(void);
564
565 /**
566 * Destroy poll handle
567 *
568 * @param ph the poll handle
569 */
570 void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
571
572 /*
573 * Data buffer
574 */
575
576 /**
577 * Buffer flags
578 */
579 enum fuse_buf_flags {
580 /**
581 * Buffer contains a file descriptor
582 *
583 * If this flag is set, the .fd field is valid, otherwise the
584 * .mem fields is valid.
585 */
586 FUSE_BUF_IS_FD = (1 << 1),
587
588 /**
589 * Seek on the file descriptor
590 *
591 * If this flag is set then the .pos field is valid and is
592 * used to seek to the given offset before performing
593 * operation on file descriptor.
594 */
595 FUSE_BUF_FD_SEEK = (1 << 2),
596
597 /**
598 * Retry operation on file descriptor
599 *
600 * If this flag is set then retry operation on file descriptor
601 * until .size bytes have been copied or an error or EOF is
602 * detected.
603 */
604 FUSE_BUF_FD_RETRY = (1 << 3),
605 };
606
607 /**
608 * Single data buffer
609 *
610 * Generic data buffer for I/O, extended attributes, etc... Data may
611 * be supplied as a memory pointer or as a file descriptor
612 */
613 struct fuse_buf {
614 /**
615 * Size of data in bytes
616 */
617 size_t size;
618
619 /**
620 * Buffer flags
621 */
622 enum fuse_buf_flags flags;
623
624 /**
625 * Memory pointer
626 *
627 * Used unless FUSE_BUF_IS_FD flag is set.
628 */
629 void *mem;
630
631 /**
632 * File descriptor
633 *
634 * Used if FUSE_BUF_IS_FD flag is set.
635 */
636 int fd;
637
638 /**
639 * File position
640 *
641 * Used if FUSE_BUF_FD_SEEK flag is set.
642 */
643 off_t pos;
644 };
645
646 /**
647 * Data buffer vector
648 *
649 * An array of data buffers, each containing a memory pointer or a
650 * file descriptor.
651 *
652 * Allocate dynamically to add more than one buffer.
653 */
654 struct fuse_bufvec {
655 /**
656 * Number of buffers in the array
657 */
658 size_t count;
659
660 /**
661 * Index of current buffer within the array
662 */
663 size_t idx;
664
665 /**
666 * Current offset within the current buffer
667 */
668 size_t off;
669
670 /**
671 * Array of buffers
672 */
673 struct fuse_buf buf[1];
674 };
675
676 /* Initialize bufvec with a single buffer of given size */
677 #define FUSE_BUFVEC_INIT(size__) \
678 ((struct fuse_bufvec){ /* .count= */ 1, \
679 /* .idx = */ 0, \
680 /* .off = */ 0, /* .buf = */ \
681 { /* [0] = */ { \
682 /* .size = */ (size__), \
683 /* .flags = */ (enum fuse_buf_flags)0, \
684 /* .mem = */ NULL, \
685 /* .fd = */ -1, \
686 /* .pos = */ 0, \
687 } } })
688
689 /**
690 * Get total size of data in a fuse buffer vector
691 *
692 * @param bufv buffer vector
693 * @return size of data
694 */
695 size_t fuse_buf_size(const struct fuse_bufvec *bufv);
696
697 /**
698 * Copy data from one buffer vector to another
699 *
700 * @param dst destination buffer vector
701 * @param src source buffer vector
702 * @return actual number of bytes copied or -errno on error
703 */
704 ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src);
705
706 /*
707 * Signal handling
708 */
709
710 /**
711 * Exit session on HUP, TERM and INT signals and ignore PIPE signal
712 *
713 * Stores session in a global variable. May only be called once per
714 * process until fuse_remove_signal_handlers() is called.
715 *
716 * Once either of the POSIX signals arrives, the signal handler calls
717 * fuse_session_exit().
718 *
719 * @param se the session to exit
720 * @return 0 on success, -1 on failure
721 *
722 * See also:
723 * fuse_remove_signal_handlers()
724 */
725 int fuse_set_signal_handlers(struct fuse_session *se);
726
727 /**
728 * Restore default signal handlers
729 *
730 * Resets global session. After this fuse_set_signal_handlers() may
731 * be called again.
732 *
733 * @param se the same session as given in fuse_set_signal_handlers()
734 *
735 * See also:
736 * fuse_set_signal_handlers()
737 */
738 void fuse_remove_signal_handlers(struct fuse_session *se);
739
740 /*
741 * Compatibility stuff
742 */
743
744 #if !defined(FUSE_USE_VERSION) || FUSE_USE_VERSION < 30
745 #error only API version 30 or greater is supported
746 #endif
747
748
749 /*
750 * This interface uses 64 bit off_t.
751 *
752 * On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags!
753 */
754
755 #if defined(__GNUC__) && \
756 (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && \
757 !defined __cplusplus
758 _Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit");
759 #else
760 struct _fuse_off_t_must_be_64bit_dummy_struct {
761 unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1);
762 };
763 #endif
764
765 #endif /* FUSE_COMMON_H_ */