aboutsummaryrefslogtreecommitdiff
path: root/include/fuse.h
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-04-07 15:40:21 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-04-07 15:40:21 +0000
commitab9745641373d35235b8c0d124f1c355908b575f (patch)
tree4ad92b37432ff7dcbcdd0ba57b85dfe00f89c505 /include/fuse.h
parent670c78a3134f2233b018fa931e1a7e69e4ab11fd (diff)
fix
Diffstat (limited to 'include/fuse.h')
-rw-r--r--include/fuse.h61
1 files changed, 29 insertions, 32 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 35ec49f..336e8f3 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -47,33 +47,21 @@ extern "C" {
/** Handle for a FUSE filesystem */
struct fuse;
-/** Handle for a getdir() operation */
-typedef struct fuse_dirhandle *fuse_dirh_t;
-
-/** Function to add an entry in a getdir() operation
- *
- * @param h the handle passed to the getdir() operation
- * @param name the file name of the directory entry
- * @param type the file type (0 if unknown) see <dirent.h>
- * @param ino the inode number, ignored if "use_ino" mount option is
- * not specified
- * @return 0 on success, -errno on error
- */
-typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
- ino_t ino);
-
/** Function to add an entry in a readdir() operation
*
* @param buf the buffer passed to the readdir() operation
* @param name the file name of the directory entry
- * @param type the file type (0 if unknown) see <dirent.h>
- * @param ino the inode number, ignored if "use_ino" mount option is
- * not specified
- * @param off offset of the next entry
- * @return 0 on success, 1 if buffer is full
+ * @param stat file attributes, can be NULL
+ * @param off offset of the next entry or zero
+ * @return 1 if buffer is full, zero otherwise
*/
-typedef int (*fuse_dirfil5_t) (void *buf, const char *name, int type,
- ino_t ino, off_t off);
+typedef int (*fuse_fill_dir_t) (void *buf, const char *name,
+ const struct stat *stat, off_t off);
+
+/* Used by deprecated getdir() method */
+typedef struct fuse_dirhandle *fuse_dirh_t;
+typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
+ ino_t ino);
/** Information about open files */
struct fuse_file_info {
@@ -99,7 +87,7 @@ struct fuse_file_info {
*
* All methods are optional, but some are essential for a useful
* filesystem (e.g. getattr). Flush, release, fsync, opendir,
- * readdir, releasedir, fsyncdir, init and destroy are special purpose
+ * releasedir, fsyncdir, init and destroy are special purpose
* methods, without which a full featured filesystem can still be
* implemented.
*/
@@ -122,12 +110,7 @@ struct fuse_operations {
*/
int (*readlink) (const char *, char *, size_t);
- /** Read the contents of a directory
- *
- * This operation is the opendir(), readdir(), ..., closedir()
- * sequence in one call. For each directory entry the filldir
- * function should be called.
- */
+ /* Deprecated, use readdir() instead */
int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
/** Create a file node
@@ -265,10 +248,24 @@ struct fuse_operations {
/** Read directory
*
- * This is an alternative inteface to getdir(), and if defined
- * getdir() will not be called
+ * This supersedes the old getdir() interface. New applications
+ * should use this.
+ *
+ * The filesystem may choose between two modes of operation:
+ *
+ * 1) The readdir implementation ignores the offset parameter, and
+ * passes zero to the filler function's offset. The filler
+ * function will not return '1' (unless an error happens), so the
+ * whole directory is read in a single readdir operation. This
+ * works just like the old getdir() method.
+ *
+ * 2) The readdir implementation keeps track of the offsets of the
+ * directory entries. It uses the offset parameter and always
+ * passes non-zero offset to the filler function. When the buffer
+ * is full (or an error happens) the filler function will return
+ * '1'.
*/
- int (*readdir) (const char *, void *, fuse_dirfil5_t, off_t,
+ int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,
struct fuse_file_info *);
/** Release directory */