aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fuse_common.h49
-rw-r--r--include/fuse_lowlevel.h101
2 files changed, 150 insertions, 0 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h
new file mode 100644
index 0000000..cd19435
--- /dev/null
+++ b/include/fuse_common.h
@@ -0,0 +1,49 @@
+/*
+ FUSE: Filesystem in Userspace
+ Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+
+ This program can be distributed under the terms of the GNU LGPL.
+ See the file COPYING.LIB.
+*/
+
+#if !defined(_FUSE_H_) && !defined(_FUSE_LOWLEVEL_H_)
+#error "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h instead."
+#endif
+
+/** Information about open files */
+struct fuse_file_info {
+ /** Open flags. Available in open() and release() */
+ int flags;
+
+ /** File handle. May be filled in by filesystem in open().
+ Available in all other file operations */
+ unsigned long fh;
+
+ /** In case of a write operation indicates if this was caused by a
+ writepage */
+ int writepage;
+};
+
+/** Extra context that may be needed by some filesystems
+ *
+ * The uid, gid and pid fields are not filled in case of a writepage
+ * operation.
+ */
+struct fuse_context {
+ /** Pointer to the fuse object */
+ struct fuse *fuse;
+
+ /** User ID of the calling process */
+ uid_t uid;
+
+ /** Group ID of the calling process */
+ gid_t gid;
+
+ /** Thread ID of the calling process */
+ pid_t pid;
+
+ /** Private filesystem data */
+ void *private_data;
+};
+
+
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
new file mode 100644
index 0000000..e90cb84
--- /dev/null
+++ b/include/fuse_lowlevel.h
@@ -0,0 +1,101 @@
+/*
+ FUSE: Filesystem in Userspace
+ Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+
+ This program can be distributed under the terms of the GNU LGPL.
+ See the file COPYING.LIB.
+*/
+
+/* ----------------------------------------------------------- *
+ * Low level API *
+ * ----------------------------------------------------------- */
+
+typedef unsigned long fuse_ino_t;
+typedef struct fuse_req *fuse_req_t;
+
+/* 'to_set' flags in setattr */
+#define FUSE_SET_ATTR_MODE (1 << 0)
+#define FUSE_SET_ATTR_UID (1 << 1)
+#define FUSE_SET_ATTR_GID (1 << 2)
+#define FUSE_SET_ATTR_SIZE (1 << 3)
+#define FUSE_SET_ATTR_ATIME (1 << 4)
+#define FUSE_SET_ATTR_MTIME (1 << 5)
+#define FUSE_SET_ATTR_CTIME (1 << 6)
+
+struct fuse_lowlevel_operations {
+ void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);
+ void (*forget) (fuse_req_t req, fuse_ino_t ino);
+ void (*getattr) (fuse_req_t req, fuse_ino_t ino);
+ void (*readlink)(fuse_req_t req, fuse_ino_t ino);
+ void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,
+ mode_t mode, dev_t rdev);
+ void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,
+ mode_t mode);
+ void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);
+ void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);
+ void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,
+ const char *name);
+ void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,
+ fuse_ino_t newparent, const char *newname);
+ void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
+ const char *newname);
+ void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,
+ int to_set);
+ void (*open) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *f);
+ void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
+ struct fuse_file_info *f);
+ void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
+ size_t size, off_t off, struct fuse_file_info *f);
+ void (*flush) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *f);
+ void (*release) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *f);
+ void (*fsync) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *f);
+ void (*opendir) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *f);
+ void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
+ struct fuse_file_info *f);
+ void (*releasedir) (fuse_req_t req, fuse_ino_t ino,
+ struct fuse_file_info *f);
+ void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *f);
+ void (*statfs) (fuse_req_t req, fuse_ino_t ino);
+ void (*setxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
+ const char *value, size_t size, int flags);
+ void (*getxattr)(fuse_req_t req, fuse_ino_t ino, const char *name,
+ size_t size);
+ void (*listxattr)(fuse_req_t req, fuse_ino_t ino, size_t size);
+ void (*removexattr)(fuse_req_t req, fuse_ino_t ino, const char *name);
+};
+
+/* all except release and forget */
+int fuse_reply_err(fuse_req_t req, int err);
+
+/* forget, unlink, rmdir, rename, setxattr, removexattr, release, releasedir */
+int fuse_reply_ok(fuse_req_t req);
+
+/* lookup, mknod, mkdir, symlink, link */
+int fuse_reply_entry(fuse_req_t req, fuse_ino_t ino, unsigned long generation,
+ const struct stat *attr, double attr_timeout,
+ double entry_timeout);
+
+/* getattr, setattr */
+int fuse_reply_attr(fuse_req_t req, int struct stat *attr, double attr_timeout);
+/* readlink */
+int fuse_reply_readlink(fuse_req_t req, const char *link);
+
+/* open, write, flush, fsync, opendir, fsyncdir */
+int fuse_reply_file_info(fuse_req_t req, const struct fuse_file_info *f);
+
+/* read, readdir */
+int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size,
+ const struct fuse_file_info *f);
+
+/* statfs */
+int fuse_reply_statfs(fuse_req_t req, const struct statfs *statfs);
+
+/* getxattr, listxattr */
+int fuse_reply_xattr(fuse_req_t req, const char *buf, size_t size);
+
+/* return the size of a directory entry */
+size_t fuse_dirent_size(size_t namelen);
+
+/* add a directory entry to the buffer */
+int fuse_add_dirent(char *buf, const char *name, const struct stat *stat,
+ off_t off);