libfuse: build-test/foo/usr/local/include/fuse3/fuse_common.h Source File

libfuse

fuse_common.h
Go to the documentation of this file.
1 /* FUSE: Filesystem in Userspace
2 Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
3
4 This program can be distributed under the terms of the GNU LGPLv2.
5 See the file COPYING.LIB.
6 */
7
10 #if !defined(FUSE_H_) && !defined(FUSE_LOWLEVEL_H_)
11 #error "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."
12 #endif
13
14 #ifndef FUSE_COMMON_H_
15 #define FUSE_COMMON_H_
16
17 #include "fuse_opt.h"
18 #include <stdint.h>
19 #include <sys/types.h>
20
22 #define FUSE_MAJOR_VERSION 3
23
25 #define FUSE_MINOR_VERSION 2
26
27 #define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
28 #define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
37 struct fuse_file_info {
39 int flags;
40
43 unsigned int writepage : 1;
44
46 unsigned int direct_io : 1;
47
51 unsigned int keep_cache : 1;
52
56 unsigned int flush : 1;
57
60 unsigned int nonseekable : 1;
61
62 /* Indicates that flock locks for this file should be
63 released. If set, lock_owner shall contain a valid value.
64 May only be set in ->release(). */
65 unsigned int flock_release : 1;
66
68 unsigned int padding : 27;
69
72 uint64_t fh;
73
75 uint64_t lock_owner;
76
79 uint32_t poll_events;
80 };
81
86 struct fuse_loop_config {
91 int clone_fd;
92
103 unsigned int max_idle_threads;
104 };
105
106 /**************************************************************************
107 * Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want' *
108 **************************************************************************/
109
120 #define FUSE_CAP_ASYNC_READ (1 << 0)
121
128 #define FUSE_CAP_POSIX_LOCKS (1 << 1)
129
137 #define FUSE_CAP_ATOMIC_O_TRUNC (1 << 3)
138
144 #define FUSE_CAP_EXPORT_SUPPORT (1 << 4)
145
152 #define FUSE_CAP_DONT_MASK (1 << 6)
153
160 #define FUSE_CAP_SPLICE_WRITE (1 << 7)
161
168 #define FUSE_CAP_SPLICE_MOVE (1 << 8)
169
177 #define FUSE_CAP_SPLICE_READ (1 << 9)
178
190 #define FUSE_CAP_FLOCK_LOCKS (1 << 10)
191
197 #define FUSE_CAP_IOCTL_DIR (1 << 11)
198
219 #define FUSE_CAP_AUTO_INVAL_DATA (1 << 12)
220
227 #define FUSE_CAP_READDIRPLUS (1 << 13)
228
235 #define FUSE_CAP_READDIRPLUS_AUTO (1 << 14)
236
246 #define FUSE_CAP_ASYNC_DIO (1 << 15)
247
255 #define FUSE_CAP_WRITEBACK_CACHE (1 << 16)
256
268 #define FUSE_CAP_NO_OPEN_SUPPORT (1 << 17)
269
278 #define FUSE_CAP_PARALLEL_DIROPS (1 << 18)
279
297 #define FUSE_CAP_POSIX_ACL (1 << 19)
298
306 #define FUSE_CAP_HANDLE_KILLPRIV (1 << 20)
307
318 #define FUSE_IOCTL_COMPAT (1 << 0)
319 #define FUSE_IOCTL_UNRESTRICTED (1 << 1)
320 #define FUSE_IOCTL_RETRY (1 << 2)
321 #define FUSE_IOCTL_DIR (1 << 4)
322
323 #define FUSE_IOCTL_MAX_IOV 256
324
332 struct fuse_conn_info {
336 unsigned proto_major;
337
341 unsigned proto_minor;
342
346 unsigned max_write;
347
360 unsigned max_read;
361
365 unsigned max_readahead;
366
370 unsigned capable;
371
378 unsigned want;
379
408 unsigned max_background;
409
418 unsigned congestion_threshold;
419
435 unsigned time_gran;
436
440 unsigned reserved[22];
441 };
442
443 struct fuse_session;
444 struct fuse_pollhandle;
445 struct fuse_conn_info_opts;
446
489 struct fuse_conn_info_opts* fuse_parse_conn_info_opts(struct fuse_args *args);
490
498 void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
499 struct fuse_conn_info *conn);
500
507 int fuse_daemonize(int foreground);
508
514 int fuse_version(void);
515
521 const char *fuse_pkgversion(void);
522
528 void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
529
530 /* ----------------------------------------------------------- *
531 * Data buffer *
532 * ----------------------------------------------------------- */
533
537 enum fuse_buf_flags {
544 FUSE_BUF_IS_FD = (1 << 1),
545
553 FUSE_BUF_FD_SEEK = (1 << 2),
554
562 FUSE_BUF_FD_RETRY = (1 << 3),
563 };
564
568 enum fuse_buf_copy_flags {
578 FUSE_BUF_NO_SPLICE = (1 << 1),
579
586 FUSE_BUF_FORCE_SPLICE = (1 << 2),
587
595 FUSE_BUF_SPLICE_MOVE = (1 << 3),
596
604 FUSE_BUF_SPLICE_NONBLOCK= (1 << 4),
605 };
606
613 struct fuse_buf {
617 size_t size;
618
622 enum fuse_buf_flags flags;
623
629 void *mem;
630
636 int fd;
637
643 off_t pos;
644 };
645
654 struct fuse_bufvec {
658 size_t count;
659
663 size_t idx;
664
668 size_t off;
669
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) { \
679 /* .count= */ 1, \
680 /* .idx = */ 0, \
681 /* .off = */ 0, \
682 /* .buf = */ { /* [0] = */ { \
683 /* .size = */ (size__), \
684 /* .flags = */ (enum fuse_buf_flags) 0, \
685 /* .mem = */ NULL, \
686 /* .fd = */ -1, \
687 /* .pos = */ 0, \
688 } } \
689 } )
690
697 size_t fuse_buf_size(const struct fuse_bufvec *bufv);
698
707 ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
708 enum fuse_buf_copy_flags flags);
709
710 /* ----------------------------------------------------------- *
711 * Signal handling *
712 * ----------------------------------------------------------- */
713
729 int fuse_set_signal_handlers(struct fuse_session *se);
730
742 void fuse_remove_signal_handlers(struct fuse_session *se);
743
744 /* ----------------------------------------------------------- *
745 * Compatibility stuff *
746 * ----------------------------------------------------------- */
747
748 #if !defined(FUSE_USE_VERSION) || FUSE_USE_VERSION < 30
749 # error only API version 30 or greater is supported
750 #endif
751
752 #ifdef __cplusplus
753 }
754 #endif
755
756
757 /*
758 * This interface uses 64 bit off_t.
759 *
760 * On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags!
761 */
762
763 #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus
764 _Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit");
765 #else
766 struct _fuse_off_t_must_be_64bit_dummy_struct \
767 { unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1); };
768 #endif
769
770 #endif /* FUSE_COMMON_H_ */
fuse_bufvec::off
size_t off
Definition: fuse_common.h:668
fuse_conn_info::capable
unsigned capable
Definition: fuse_common.h:370
fuse_file_info::fh
uint64_t fh
Definition: fuse_common.h:72
fuse_remove_signal_handlers
void fuse_remove_signal_handlers(struct fuse_session *se)
Definition: fuse_signals.c:80
fuse_conn_info
Definition: fuse_common.h:332
fuse_file_info::writepage
unsigned int writepage
Definition: fuse_common.h:43
fuse_file_info::direct_io
unsigned int direct_io
Definition: fuse_common.h:46
fuse_file_info::poll_events
uint32_t poll_events
Definition: fuse_common.h:79
fuse_conn_info::max_write
unsigned max_write
Definition: fuse_common.h:346
fuse_conn_info::proto_minor
unsigned proto_minor
Definition: fuse_common.h:341
fuse_pkgversion
const char * fuse_pkgversion(void)
Definition: fuse.c:4923
fuse_loop_config::max_idle_threads
unsigned int max_idle_threads
Definition: fuse_common.h:103
FUSE_BUF_IS_FD
Definition: fuse_common.h:544
fuse_conn_info::max_background
unsigned max_background
Definition: fuse_common.h:408
FUSE_BUF_NO_SPLICE
Definition: fuse_common.h:578
fuse_file_info::keep_cache
unsigned int keep_cache
Definition: fuse_common.h:51
FUSE_BUF_FD_SEEK
Definition: fuse_common.h:553
fuse_daemonize
int fuse_daemonize(int foreground)
Definition: helper.c:220
fuse_file_info::lock_owner
uint64_t lock_owner
Definition: fuse_common.h:75
fuse_apply_conn_info_opts
void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts, struct fuse_conn_info *conn)
Definition: helper.c:356
fuse_buf::pos
off_t pos
Definition: fuse_common.h:643
fuse_file_info
Definition: fuse_common.h:37
FUSE_BUF_FORCE_SPLICE
Definition: fuse_common.h:586
fuse_file_info::flags
int flags
Definition: fuse_common.h:39
fuse_bufvec
Definition: fuse_common.h:654
fuse_loop_config
Definition: fuse_common.h:86
fuse_bufvec::idx
size_t idx
Definition: fuse_common.h:663
fuse_bufvec::count
size_t count
Definition: fuse_common.h:658
fuse_buf_size
size_t fuse_buf_size(const struct fuse_bufvec *bufv)
Definition: buffer.c:22
fuse_buf_copy_flags
fuse_buf_copy_flags
Definition: fuse_common.h:568
fuse_file_info::nonseekable
unsigned int nonseekable
Definition: fuse_common.h:60
fuse_conn_info::congestion_threshold
unsigned congestion_threshold
Definition: fuse_common.h:418
fuse_file_info::flush
unsigned int flush
Definition: fuse_common.h:56
fuse_version
int fuse_version(void)
Definition: fuse.c:4918
fuse_conn_info::max_read
unsigned max_read
Definition: fuse_common.h:360
fuse_parse_conn_info_opts
struct fuse_conn_info_opts * fuse_parse_conn_info_opts(struct fuse_args *args)
Definition: helper.c:403
fuse_pollhandle_destroy
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph)
Definition: fuse_lowlevel.c:1765
fuse_opt.h
FUSE_BUF_SPLICE_NONBLOCK
Definition: fuse_common.h:604
fuse_conn_info::max_readahead
unsigned max_readahead
Definition: fuse_common.h:365
fuse_conn_info::proto_major
unsigned proto_major
Definition: fuse_common.h:336
FUSE_BUF_SPLICE_MOVE
Definition: fuse_common.h:595
fuse_conn_info::want
unsigned want
Definition: fuse_common.h:378
FUSE_BUF_FD_RETRY
Definition: fuse_common.h:562
fuse_buf::mem
void * mem
Definition: fuse_common.h:629
fuse_args
Definition: fuse_opt.h:109
fuse_set_signal_handlers
int fuse_set_signal_handlers(struct fuse_session *se)
Definition: fuse_signals.c:63
fuse_buf::size
size_t size
Definition: fuse_common.h:617
fuse_buf::fd
int fd
Definition: fuse_common.h:636
fuse_loop_config::clone_fd
int clone_fd
Definition: fuse_common.h:91
fuse_file_info::padding
unsigned int padding
Definition: fuse_common.h:68
fuse_conn_info::time_gran
unsigned time_gran
Definition: fuse_common.h:435
fuse_buf
Definition: fuse_common.h:613
fuse_buf_flags
fuse_buf_flags
Definition: fuse_common.h:537
fuse_buf_copy
ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src, enum fuse_buf_copy_flags flags)
Definition: buffer.c:281