diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-03-25 11:17:52 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-03-25 11:17:52 +0000 |
commit | 77f39949dc5174bc42be9ecf2dda6119e1dd506b (patch) | |
tree | 8a4ee5b0dfbf9e67c02a3a8bea0d9a4bd7bcc2e4 | |
parent | 4df9cf273fcda4483641af1b1ed4b7d9dc99bee6 (diff) | |
download | libfuse-77f39949dc5174bc42be9ecf2dda6119e1dd506b.tar.gz |
default statfs
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/fuse.c | 21 | ||||
-rw-r--r-- | lufis/lufis.c | 9 |
3 files changed, 27 insertions, 8 deletions
@@ -1,3 +1,8 @@ +2004-03-25 Miklos Szeredi <mszeredi@inf.bme.hu> + + * If filesystem doesn't define a statfs operation, then an + all-zero default statfs is returned instead of ENOSYS + 2004-03-24 Miklos Szeredi <mszeredi@inf.bme.hu> * Add FS_BINARY_MOUNTDATA filesystem flag for kernels > 2.6.4 @@ -914,6 +914,13 @@ static void do_write(struct fuse *f, struct fuse_in_header *in, send_reply(f, in, res, NULL, 0); } +static int default_statfs(struct statfs *buf) +{ + buf->f_namelen = 255; + buf->f_bsize = 512; + return 0; +} + static void convert_statfs(struct statfs *statfs, struct fuse_kstatfs *kstatfs) { kstatfs->bsize = statfs->f_bsize; @@ -931,14 +938,14 @@ static void do_statfs(struct fuse *f, struct fuse_in_header *in) struct fuse_statfs_out arg; struct statfs buf; - res = -ENOSYS; - if(f->op.statfs) { + memset(&buf, 0, sizeof(struct statfs)); + if(f->op.statfs) res = f->op.statfs("/", &buf); - if(res == 0) { - memset(&arg, 0, sizeof(struct fuse_statfs_out)); - convert_statfs(&buf, &arg.st); - } - } + else + res = default_statfs(&buf); + + if(res == 0) + convert_statfs(&buf, &arg.st); send_reply(f, in, res, &arg, sizeof(arg)); } diff --git a/lufis/lufis.c b/lufis/lufis.c index 38bc60a..f91c1e0 100644 --- a/lufis/lufis.c +++ b/lufis/lufis.c @@ -551,6 +551,13 @@ static int lu_release(const char *path, int flags) return 0; } +static int lu_default_statfs(struct statfs *buf) +{ + buf->f_namelen = 255; + buf->f_bsize = 512; + return 0; +} + #if FUSE_MAJOR_VERSION < 2 static int lu_statfs(struct fuse_statfs *stbuf) #else @@ -560,7 +567,7 @@ static int lu_statfs(const char *path, struct statfs *stbuf) struct lufs_sbattr_ sbattr; if(!lu_fops.statfs) - return -ENOSYS; + return lu_default_statfs(stbuf); memset(&sbattr, 0, sizeof(sbattr)); if(lu_fops.statfs(lu_context, &sbattr) < 0) |