fix
diff --git a/ChangeLog b/ChangeLog
index c6dfda4..c361a4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-10-28 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Add fgetattr() method, which currently will only be called after
+ a successful call to a create() method.
+
2005-10-26 Miklos Szeredi <miklos@szeredi.hu>
* Change kernel ABI version to 7.3
diff --git a/README b/README
index a37044a..4c5517a 100644
--- a/README
+++ b/README
@@ -41,6 +41,21 @@
be compiled. It is possible to override this with the
'--enable-kernel-module' configure option.
+If './configure' cannot find the kernel source or it says the kernel
+source should be prepared, you may either try
+
+ ./configure--disable-kernel-module
+
+or if your kernel does not already contain FUSE support, do the
+following:
+
+ - Extract the kernel source to some directory
+
+ - Copy the running kernel's config (usually found in
+ /boot/config-X.Y.Z) to .config at the top of the source tree
+
+ - Run 'make prepare'
+
For more details see the file 'INSTALL'
How To Use
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c
index 2f4b187..764ba91 100644
--- a/example/fusexmp_fh.c
+++ b/example/fusexmp_fh.c
@@ -33,6 +33,20 @@
return 0;
}
+static int xmp_fgetattr(const char *path, struct stat *stbuf,
+ struct fuse_file_info *fi)
+{
+ int res;
+
+ (void) path;
+
+ res = fstat(fi->fh, stbuf);
+ if(res == -1)
+ return -errno;
+
+ return 0;
+}
+
static int xmp_access(const char *path, int mask)
{
int res;
@@ -353,6 +367,7 @@
static struct fuse_operations xmp_oper = {
.getattr = xmp_getattr,
+ .fgetattr = xmp_fgetattr,
.access = xmp_access,
.readlink = xmp_readlink,
.opendir = xmp_opendir,
diff --git a/include/fuse.h b/include/fuse.h
index 6d7e54b..329fd5e 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -63,8 +63,8 @@
*
* All methods are optional, but some are essential for a useful
* filesystem (e.g. getattr). Open, flush, release, fsync, opendir,
- * releasedir, fsyncdir, access, create, ftruncate, init and destroy
- * are special purpose methods, without which a full featured
+ * releasedir, fsyncdir, access, create, ftruncate, fgetattr, init and
+ * destroy are special purpose methods, without which a full featured
* filesystem can still be implemented.
*/
struct fuse_operations {
@@ -338,6 +338,20 @@
* Introduced in version 2.5
*/
int (*ftruncate) (const char *, off_t, struct fuse_file_info *);
+
+ /**
+ * Get attributes from an open file
+ *
+ * This method is called instead of the getattr() method if the
+ * file information is available.
+ *
+ * Currently this is only called after the create() method if that
+ * is implemented (see above). Later it may be called for
+ * invocations of fstat() too.
+ *
+ * Introduced in version 2.5
+ */
+ int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *);
};
/** Extra context that may be needed by some filesystems
diff --git a/kernel/configure.ac b/kernel/configure.ac
index 41ebafc..40f0725 100644
--- a/kernel/configure.ac
+++ b/kernel/configure.ac
@@ -50,7 +50,7 @@
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([
*** Cannot determine the version of the linux kernel source. Please
-*** configure the kernel before running this script])
+*** prepare the kernel before running this script])
fi
AC_MSG_RESULT([$kernsrcver])
majver=`echo "$kernsrcver" | cut -f-2 -d.`
diff --git a/lib/fuse.c b/lib/fuse.c
index 1399dfd..9cc7028 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -501,12 +501,16 @@
}
static int lookup_path(struct fuse *f, fuse_ino_t nodeid, const char *name,
- const char *path, struct fuse_entry_param *e)
+ const char *path, struct fuse_entry_param *e,
+ struct fuse_file_info *fi)
{
int res;
memset(e, 0, sizeof(struct fuse_entry_param));
- res = f->op.getattr(path, &e->attr);
+ if (fi && f->op.fgetattr)
+ res = f->op.fgetattr(path, &e->attr, fi);
+ else
+ res = f->op.getattr(path, &e->attr);
if (res == 0) {
struct node *node;
@@ -604,7 +608,7 @@
}
err = -ENOSYS;
if (f->op.getattr)
- err = lookup_path(f, parent, name, path, &e);
+ err = lookup_path(f, parent, name, path, &e, NULL);
free(path);
}
pthread_rwlock_unlock(&f->tree_lock);
@@ -804,7 +808,7 @@
if (f->op.mknod && f->op.getattr) {
err = f->op.mknod(path, mode, rdev);
if (!err)
- err = lookup_path(f, parent, name, path, &e);
+ err = lookup_path(f, parent, name, path, &e, NULL);
}
free(path);
}
@@ -832,7 +836,7 @@
if (f->op.mkdir && f->op.getattr) {
err = f->op.mkdir(path, mode);
if (!err)
- err = lookup_path(f, parent, name, path, &e);
+ err = lookup_path(f, parent, name, path, &e, NULL);
}
free(path);
}
@@ -916,7 +920,7 @@
if (f->op.symlink && f->op.getattr) {
err = f->op.symlink(linkname, path);
if (!err)
- err = lookup_path(f, parent, name, path, &e);
+ err = lookup_path(f, parent, name, path, &e, NULL);
}
free(path);
}
@@ -985,7 +989,7 @@
if (f->op.link && f->op.getattr) {
err = f->op.link(oldpath, newpath);
if (!err)
- err = lookup_path(f, newparent, newname, newpath, &e);
+ err = lookup_path(f, newparent, newname, newpath, &e, NULL);
}
free(newpath);
}
@@ -1016,7 +1020,7 @@
path);
fflush(stdout);
}
- err = lookup_path(f, parent, name, path, &e);
+ err = lookup_path(f, parent, name, path, &e, fi);
if (err) {
if (f->op.release)
f->op.release(path, fi);