fix
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 @@
/** 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 @@
*
* 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 @@
*/
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 @@
/** 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 */