fix
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 6 Jul 2005 10:07:52 +0000 (10:07 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Wed, 6 Jul 2005 10:07:52 +0000 (10:07 +0000)
ChangeLog
README
lib/fuse.c
lib/helper.c

index 1855359c595c0d146a0e39b5b800ba0d84d9b3c7..005f6528af7ff6f2f7082d2399a90f55233f8a66 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@
        * kernel: check if mandatory mount options ('fd', 'rootmode',
        'user_id', 'group_id') are all given
 
+       * lib: simplify 'readdir_ino' handling
+
 2005-07-03  Miklos Szeredi <miklos@szeredi.hu>
 
        * kernel: clean up 'direct_io' code
diff --git a/README b/README
index fc1675eea9af33d2ff00d0468c05223563f51a29..5006b3e7d255be4e49de2ead6073edc0d3dec7aa 100644 (file)
--- a/README
+++ b/README
@@ -193,6 +193,23 @@ fsname=NAME
 
   Sets the filesystem name.  The default is the program name.
 
+use_ino
+
+  Honor the 'st_ino' field in getattr() and fill_dir().  This value is
+  used to fill in the 'st_ino' field in the stat()/lstat()/fstat()
+  functions and the 'd_ino' field in the readdir() function.  The
+  filesystem does not have to guarantee uniqueness, however some
+  applications rely on this value being unique for the whole
+  filesystem.
+
+readdir_ino
+
+  If 'use_ino' option is not given, still try to fill in the 'd_ino'
+  field in readdir().  If the name was previously looked up, and is
+  still in the cache, the inode number found there will be used.
+  Otherwise it will be set to '-1'.  If 'use_ino' option is given,
+  this option is ignored.
+
 nonempty
 
   Allows mounts over a non-empty file or directory.  By default these
index 0bd4b86ba1d3fd0bd7b1aeee6cd0d39d724c1b3e..317b27d8450742a73c88f4820959d080054aded9 100644 (file)
@@ -80,7 +80,7 @@ struct fuse_dirhandle {
     int filled;
     unsigned long fh;
     int error;
-    struct node *node;
+    nodeid_t nodeid;
 };
 
 struct fuse_cmd {
@@ -1596,11 +1596,7 @@ static void do_opendir(struct fuse *f, struct fuse_in_header *in,
     dh->contents = NULL;
     dh->len = 0;
     dh->filled = 0;
-    if (f->flags & FUSE_READDIR_INO) {
-        pthread_mutex_lock(&f->lock);
-        dh->node = get_node(f, in->nodeid);
-        pthread_mutex_unlock(&f->lock);
-    }
+    dh->nodeid = in->nodeid;
     mutex_init(&dh->lock);
 
     memset(&outarg, 0, sizeof(outarg));
@@ -1658,7 +1654,7 @@ static int fill_dir_common(struct fuse_dirhandle *dh, const char *name,
         if (dh->fuse->flags & FUSE_READDIR_INO) {
             struct node *node;
             pthread_mutex_lock(&dh->fuse->lock);
-            node = lookup_node(dh->fuse, dh->node->nodeid, name);
+            node = lookup_node(dh->fuse, dh->nodeid, name);
             if (node)
                 ino  = (ino_t) node->nodeid;
             pthread_mutex_unlock(&dh->fuse->lock);
index af77c0f9b6c164c17f1c624965a5302275c0c9f1..460bea2d25f19a711bbaf875d7269ad2050aade0 100644 (file)
@@ -46,6 +46,7 @@ static void usage(const char *progname)
             "    fsname=NAME            set filesystem name in mtab\n"
             "    use_ino                let filesystem set inode numbers\n"
             "    readdir_ino            try to fill in d_ino in readdir\n"
+            "    nonempty               allow mounts over non-empty file/dir\n"
             );
 }