fix
authorMiklos Szeredi <miklos@szeredi.hu>
Fri, 1 Apr 2005 21:07:35 +0000 (21:07 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Fri, 1 Apr 2005 21:07:35 +0000 (21:07 +0000)
ChangeLog
NEWS
include/fuse.h
kernel/dir.c

index bf89ea54e3aad916763ef76b18a1b62dbbc709c7..debe90b3354e35245802c5142b2f0f0076b149d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2005-04-01  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Released 2.3-pre2
+
+2005-04-01  Miklos Szeredi <miklos@szeredi.hu>
+
+       * kernel: fix dirent offset handling
+
+       * lib: add readdir and releasedir methods
+
+       * lib: use fh field of fuse_file_info in opendir, readdir,
+       releasedir and fsyncdir methods
+
+       * lib: check kernel API version and bail out of it's old.  This
+       will be properly fixed in the next release
+
+2005-03-31  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Released 2.3-pre1
+
 2005-03-31  Miklos Szeredi <miklos@szeredi.hu>
 
        * kernel API: add padding to structures, so 64bit and 32bit
diff --git a/NEWS b/NEWS
index d69c41040aa0c16b2b6637ba53c47eb63491f9fe..a0e726d2195826c45b3b3c60031830f0a56f5427 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+What is new in 2.3
+
+ - Add new directory related operations: opendir(), readdir(),
+   releasedir() and fsyncdir().
+
+ - Update kernel ABI so that on dual architectures (e.g. AMD64) 32bit
+   binaries work under a 64bit kernel
+
+ - Bugfixes
+
 What is new in 2.2
 
 Userspace changes:
index 5e5cd4583defaf09e2302090d6f9082e3684dfa3..35ec49ffb7319e54425e1a42b6e8417fe2b28930 100644 (file)
@@ -62,6 +62,19 @@ typedef struct fuse_dirhandle *fuse_dirh_t;
 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
+ */
+typedef int (*fuse_dirfil5_t) (void *buf, const char *name, int type,
+                               ino_t ino, off_t off);
+
 /** Information about open files */
 struct fuse_file_info {
     /** Open flags.  Available in open() and release() */
@@ -85,9 +98,10 @@ struct fuse_file_info {
  * negated error value (-errno) directly.
  *
  * All methods are optional, but some are essential for a useful
- * filesystem (e.g. getattr).  Flush, release, fsync, init and destroy
- * are special purpose methods, without which a full featured
- * filesystem can still be implemented.
+ * filesystem (e.g. getattr).  Flush, release, fsync, opendir,
+ * readdir, releasedir, fsyncdir, init and destroy are special purpose
+ * methods, without which a full featured filesystem can still be
+ * implemented.
  */
 struct fuse_operations {
     /** Get file attributes.
@@ -243,18 +257,27 @@ struct fuse_operations {
     int (*removexattr) (const char *, const char *);
 
     /** Open direcory
-     * 
+     *
      * This method should check if the open operation is permitted for
-     * this  directory.   The  fuse_file_info parameter  is  currently
-     * unused.
+     * this  directory
      */
     int (*opendir) (const char *, struct fuse_file_info *);
 
+    /** Read directory
+     *
+     * This is an alternative inteface to getdir(), and if defined
+     * getdir() will not be called
+     */
+    int (*readdir) (const char *, void *, fuse_dirfil5_t, off_t,
+                    struct fuse_file_info *);
+
+    /** Release directory */
+    int (*releasedir) (const char *, struct fuse_file_info *);
+
     /** Synchronize directory contents
      *
      * If the datasync parameter is non-zero, then only the user data
-     * should be flushed, not the meta data.  The fuse_file_info
-     * parameter is currently unused
+     * should be flushed, not the meta data
      */
     int (*fsyncdir) (const char *, int, struct fuse_file_info *);
 
@@ -269,7 +292,7 @@ struct fuse_operations {
 
     /**
      * Clean up filesystem
-     * 
+     *
      * Called on filesystem exit.
      */
     void (*destroy) (void *);
index ecd610882938875a9ffb937681b70c26731e61d3..093bbb9fe59689d0e4052407208cff7d297778b3 100644 (file)
@@ -506,19 +506,19 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
                struct fuse_dirent *dirent = (struct fuse_dirent *) buf;
                size_t reclen = FUSE_DIRENT_SIZE(dirent);
                int over;
-               if (dirent->namelen > FUSE_NAME_MAX)
+               if (!dirent->namelen || dirent->namelen > FUSE_NAME_MAX)
                        return -EIO;
                if (reclen > nbytes)
                        break;
 
                over = filldir(dstbuf, dirent->name, dirent->namelen,
-                              dirent->off, dirent->ino, dirent->type);
+                              file->f_pos, dirent->ino, dirent->type);
                if (over)
                        break;
 
                buf += reclen;
-               file->f_pos += reclen;
                nbytes -= reclen;
+               file->f_pos = dirent->off;
        }
 
        return 0;