"Fossies" - the Fresh Open Source Software Archive

Member "fuse-3.4.1/doc/html/fuse_8h_source.html" (22 Dec 2018, 99060 Bytes) of package /linux/misc/fuse-3.4.1.tar.xz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the FUSE project site itself.

libfuse
fuse.h
Go to the documentation of this file.
1 /*
2  FUSE: Filesystem in Userspace
3  Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
4 
5  This program can be distributed under the terms of the GNU LGPLv2.
6  See the file COPYING.LIB.
7 */
8 
9 #ifndef FUSE_H_
10 #define FUSE_H_
11 
19 #include "fuse_common.h"
20 
21 #include <fcntl.h>
22 #include <time.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <sys/statvfs.h>
26 #include <sys/uio.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /* ----------------------------------------------------------- *
33  * Basic FUSE API *
34  * ----------------------------------------------------------- */
35 
37 struct fuse;
38 
51  FUSE_READDIR_PLUS = (1 << 0),
52 };
53 
64  FUSE_FILL_DIR_PLUS = (1 << 1),
65 };
66 
82 typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
83  const struct stat *stbuf, off_t off,
84  enum fuse_fill_dir_flags flags);
93 struct fuse_config {
98  int set_gid;
99  unsigned int gid;
100 
105  int set_uid;
106  unsigned int uid;
107 
112  int set_mode;
113  unsigned int umask;
114 
120 
130 
135  double attr_timeout;
136 
140  int intr;
141 
148 
159  int remember;
160 
178 
190  int use_ino;
191 
200 
219 
238 
246 
253  double ac_attr_timeout;
254 
266 
272  char *modules;
273  int debug;
274 };
275 
276 
311  int (*getattr) (const char *, struct stat *, struct fuse_file_info *fi);
312 
321  int (*readlink) (const char *, char *, size_t);
322 
329  int (*mknod) (const char *, mode_t, dev_t);
330 
337  int (*mkdir) (const char *, mode_t);
338 
340  int (*unlink) (const char *);
341 
343  int (*rmdir) (const char *);
344 
346  int (*symlink) (const char *, const char *);
347 
357  int (*rename) (const char *, const char *, unsigned int flags);
358 
360  int (*link) (const char *, const char *);
361 
367  int (*chmod) (const char *, mode_t, struct fuse_file_info *fi);
368 
377  int (*chown) (const char *, uid_t, gid_t, struct fuse_file_info *fi);
378 
387  int (*truncate) (const char *, off_t, struct fuse_file_info *fi);
388 
437  int (*open) (const char *, struct fuse_file_info *);
438 
448  int (*read) (const char *, char *, size_t, off_t,
449  struct fuse_file_info *);
450 
460  int (*write) (const char *, const char *, size_t, off_t,
461  struct fuse_file_info *);
462 
467  int (*statfs) (const char *, struct statvfs *);
468 
490  int (*flush) (const char *, struct fuse_file_info *);
491 
504  int (*release) (const char *, struct fuse_file_info *);
505 
511  int (*fsync) (const char *, int, struct fuse_file_info *);
512 
514  int (*setxattr) (const char *, const char *, const char *, size_t, int);
515 
517  int (*getxattr) (const char *, const char *, char *, size_t);
518 
520  int (*listxattr) (const char *, char *, size_t);
521 
523  int (*removexattr) (const char *, const char *);
524 
533  int (*opendir) (const char *, struct fuse_file_info *);
534 
550  int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
551  struct fuse_file_info *, enum fuse_readdir_flags);
552 
555  int (*releasedir) (const char *, struct fuse_file_info *);
556 
562  int (*fsyncdir) (const char *, int, struct fuse_file_info *);
563 
572  void *(*init) (struct fuse_conn_info *conn,
573  struct fuse_config *cfg);
574 
580  void (*destroy) (void *private_data);
581 
591  int (*access) (const char *, int);
592 
603  int (*create) (const char *, mode_t, struct fuse_file_info *);
604 
635  int (*lock) (const char *, struct fuse_file_info *, int cmd,
636  struct flock *);
637 
650  int (*utimens) (const char *, const struct timespec tv[2],
651  struct fuse_file_info *fi);
652 
659  int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
660 
674  int (*ioctl) (const char *, int cmd, void *arg,
675  struct fuse_file_info *, unsigned int flags, void *data);
676 
692  int (*poll) (const char *, struct fuse_file_info *,
693  struct fuse_pollhandle *ph, unsigned *reventsp);
694 
704  int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off,
705  struct fuse_file_info *);
706 
721  int (*read_buf) (const char *, struct fuse_bufvec **bufp,
722  size_t size, off_t off, struct fuse_file_info *);
741  int (*flock) (const char *, struct fuse_file_info *, int op);
742 
751  int (*fallocate) (const char *, int, off_t, off_t,
752  struct fuse_file_info *);
753 
765  ssize_t (*copy_file_range) (const char *path_in,
766  struct fuse_file_info *fi_in,
767  off_t offset_in, const char *path_out,
768  struct fuse_file_info *fi_out,
769  off_t offset_out, size_t size, int flags);
770 };
771 
777 struct fuse_context {
779  struct fuse *fuse;
780 
782  uid_t uid;
783 
785  gid_t gid;
786 
788  pid_t pid;
789 
792 
794  mode_t umask;
795 };
796 
851 /*
852  int fuse_main(int argc, char *argv[], const struct fuse_operations *op,
853  void *private_data);
854 */
855 #define fuse_main(argc, argv, op, private_data) \
856  fuse_main_real(argc, argv, op, sizeof(*(op)), private_data)
857 
858 /* ----------------------------------------------------------- *
859  * More detailed API *
860  * ----------------------------------------------------------- */
861 
873 void fuse_lib_help(struct fuse_args *args);
874 
902 #if FUSE_USE_VERSION == 30
903 struct fuse *fuse_new_30(struct fuse_args *args, const struct fuse_operations *op,
904  size_t op_size, void *private_data);
905 #define fuse_new(args, op, size, data) fuse_new_30(args, op, size, data)
906 #else
907 struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op,
908  size_t op_size, void *private_data);
909 #endif
910 
919 int fuse_mount(struct fuse *f, const char *mountpoint);
920 
928 void fuse_unmount(struct fuse *f);
929 
938 void fuse_destroy(struct fuse *f);
939 
955 int fuse_loop(struct fuse *f);
956 
965 void fuse_exit(struct fuse *f);
966 
998 #if FUSE_USE_VERSION < 32
999 int fuse_loop_mt_31(struct fuse *f, int clone_fd);
1000 #define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
1001 #else
1002 int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config);
1003 #endif
1004 
1013 struct fuse_context *fuse_get_context(void);
1014 
1033 int fuse_getgroups(int size, gid_t list[]);
1034 
1040 int fuse_interrupted(void);
1041 
1053 int fuse_invalidate_path(struct fuse *f, const char *path);
1054 
1060 int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
1061  size_t op_size, void *private_data);
1062 
1070 int fuse_start_cleanup_thread(struct fuse *fuse);
1071 
1078 void fuse_stop_cleanup_thread(struct fuse *fuse);
1079 
1089 int fuse_clean_cache(struct fuse *fuse);
1090 
1091 /*
1092  * Stacking API
1093  */
1094 
1100 struct fuse_fs;
1101 
1102 /*
1103  * These functions call the relevant filesystem operation, and return
1104  * the result.
1105  *
1106  * If the operation is not defined, they return -ENOSYS, with the
1107  * exception of fuse_fs_open, fuse_fs_release, fuse_fs_opendir,
1108  * fuse_fs_releasedir and fuse_fs_statfs, which return 0.
1109  */
1110 
1111 int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf,
1112  struct fuse_file_info *fi);
1113 int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
1114  const char *newpath, unsigned int flags);
1115 int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
1116 int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
1117 int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
1118  const char *path);
1119 int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
1120 int fuse_fs_release(struct fuse_fs *fs, const char *path,
1121  struct fuse_file_info *fi);
1122 int fuse_fs_open(struct fuse_fs *fs, const char *path,
1123  struct fuse_file_info *fi);
1124 int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size,
1125  off_t off, struct fuse_file_info *fi);
1126 int fuse_fs_read_buf(struct fuse_fs *fs, const char *path,
1127  struct fuse_bufvec **bufp, size_t size, off_t off,
1128  struct fuse_file_info *fi);
1129 int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf,
1130  size_t size, off_t off, struct fuse_file_info *fi);
1131 int fuse_fs_write_buf(struct fuse_fs *fs, const char *path,
1132  struct fuse_bufvec *buf, off_t off,
1133  struct fuse_file_info *fi);
1134 int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync,
1135  struct fuse_file_info *fi);
1136 int fuse_fs_flush(struct fuse_fs *fs, const char *path,
1137  struct fuse_file_info *fi);
1138 int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
1139 int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
1140  struct fuse_file_info *fi);
1141 int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf,
1142  fuse_fill_dir_t filler, off_t off,
1143  struct fuse_file_info *fi, enum fuse_readdir_flags flags);
1144 int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync,
1145  struct fuse_file_info *fi);
1146 int fuse_fs_releasedir(struct fuse_fs *fs, const char *path,
1147  struct fuse_file_info *fi);
1148 int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode,
1149  struct fuse_file_info *fi);
1150 int fuse_fs_lock(struct fuse_fs *fs, const char *path,
1151  struct fuse_file_info *fi, int cmd, struct flock *lock);
1152 int fuse_fs_flock(struct fuse_fs *fs, const char *path,
1153  struct fuse_file_info *fi, int op);
1154 int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode,
1155  struct fuse_file_info *fi);
1156 int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid,
1157  struct fuse_file_info *fi);
1158 int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size,
1159  struct fuse_file_info *fi);
1160 int fuse_fs_utimens(struct fuse_fs *fs, const char *path,
1161  const struct timespec tv[2], struct fuse_file_info *fi);
1162 int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
1163 int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
1164  size_t len);
1165 int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode,
1166  dev_t rdev);
1167 int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode);
1168 int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
1169  const char *value, size_t size, int flags);
1170 int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
1171  char *value, size_t size);
1172 int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
1173  size_t size);
1174 int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
1175  const char *name);
1176 int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
1177  uint64_t *idx);
1178 int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, int cmd, void *arg,
1179  struct fuse_file_info *fi, unsigned int flags, void *data);
1180 int fuse_fs_poll(struct fuse_fs *fs, const char *path,
1181  struct fuse_file_info *fi, struct fuse_pollhandle *ph,
1182  unsigned *reventsp);
1183 int fuse_fs_fallocate(struct fuse_fs *fs, const char *path, int mode,
1184  off_t offset, off_t length, struct fuse_file_info *fi);
1185 ssize_t fuse_fs_copy_file_range(struct fuse_fs *fs, const char *path_in,
1186  struct fuse_file_info *fi_in, off_t off_in,
1187  const char *path_out,
1188  struct fuse_file_info *fi_out, off_t off_out,
1189  size_t len, int flags);
1190 void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn,
1191  struct fuse_config *cfg);
1192 void fuse_fs_destroy(struct fuse_fs *fs);
1193 
1194 int fuse_notify_poll(struct fuse_pollhandle *ph);
1195 
1209 struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
1210  void *private_data);
1211 
1226 typedef struct fuse_fs *(*fuse_module_factory_t)(struct fuse_args *args,
1227  struct fuse_fs *fs[]);
1238 #define FUSE_REGISTER_MODULE(name_, factory_) \
1239  fuse_module_factory_t fuse_module_ ## name_ ## _factory = factory_
1240 
1242 struct fuse_session *fuse_get_session(struct fuse *f);
1243 
1252 int fuse_open_channel(const char *mountpoint, const char *options);
1253 
1254 #ifdef __cplusplus
1255 }
1256 #endif
1257 
1258 #endif /* FUSE_H_ */
size_t off
Definition: fuse_common.h:679
int auto_cache
Definition: fuse.h:245
void fuse_stop_cleanup_thread(struct fuse *fuse)
Definition: fuse.c:4816
int set_gid
Definition: fuse.h:98
int fuse_loop(struct fuse *f)
Definition: fuse.c:4516
struct fuse * fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *private_data)
fuse_fill_dir_flags
Definition: fuse.h:54
int readdir_ino
Definition: fuse.h:199
int intr
Definition: fuse.h:140
int set_mode
Definition: fuse.h:112
fuse_readdir_flags
Definition: fuse.h:42
int nullpath_ok
Definition: fuse.h:265
double negative_timeout
Definition: fuse.h:129
pid_t pid
Definition: fuse.h:788
int fuse_clean_cache(struct fuse *fuse)
Definition: fuse.c:4373
void fuse_destroy(struct fuse *f)
Definition: fuse.c:5007
int set_uid
Definition: fuse.h:105
int remember
Definition: fuse.h:159
int use_ino
Definition: fuse.h:190
int fuse_open_channel(const char *mountpoint, const char *options)
Definition: helper.c:424
gid_t gid
Definition: fuse.h:785
struct fuse_session * fuse_get_session(struct fuse *f)
Definition: fuse.c:4459
mode_t umask
Definition: fuse.h:794
void * private_data
Definition: fuse.h:791
int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, size_t op_size, void *private_data)
Definition: helper.c:279
int fuse_invalidate_path(struct fuse *f, const char *path)
Definition: fuse.c:4586
double attr_timeout
Definition: fuse.h:135
struct fuse_fs * fuse_fs_new(const struct fuse_operations *op, size_t op_size, void *private_data)
Definition: fuse.c:4760
int direct_io
Definition: fuse.h:218
int fuse_start_cleanup_thread(struct fuse *fuse)
Definition: fuse.c:4808
void fuse_lib_help(struct fuse_args *args)
Definition: fuse.c:4650
int fuse_interrupted(void)
Definition: fuse.c:4576
int(* fuse_fill_dir_t)(void *buf, const char *name, const struct stat *stbuf, off_t off, enum fuse_fill_dir_flags flags)
Definition: fuse.h:82
int show_help
Definition: fuse.h:271
int fuse_getgroups(int size, gid_t list[])
Definition: fuse.c:4567
int fuse_mount(struct fuse *f, const char *mountpoint)
Definition: fuse.c:5057
uid_t uid
Definition: fuse.h:782
struct fuse * fuse
Definition: fuse.h:779
struct fuse_buf buf[1]
Definition: fuse_common.h:684
int ac_attr_timeout_set
Definition: fuse.h:252
void fuse_unmount(struct fuse *f)
Definition: fuse.c:5062
int fuse_loop_mt_31(struct fuse *f, int clone_fd)
Definition: fuse.c:4544
struct fuse_context * fuse_get_context(void)
Definition: fuse.c:4557
double entry_timeout
Definition: fuse.h:119
int kernel_cache
Definition: fuse.h:237
int intr_signal
Definition: fuse.h:147
int hard_remove
Definition: fuse.h:177
void fuse_exit(struct fuse *f)
Definition: fuse.c:4552