diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-08-06 05:29:53 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-06 05:29:53 -0400 |
commit | d0ef9dd5ede6208f120cf4d8abc8561f459ac118 (patch) | |
tree | 6144736aa258e07a0a1840b25c816322ea13e96c | |
parent | a7ea72a03fc47a3586a14eddb515595727c05f3b (diff) | |
download | dbfs-d0ef9dd5ede6208f120cf4d8abc8561f459ac118.tar.gz |
Improve statfs op a bit, by statfs(2)'ing the underlying filesystem.
-rw-r--r-- | dbfs.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -24,6 +24,7 @@ #include <string.h> #include <errno.h> #include <unistd.h> +#include <sys/vfs.h> #include <glib.h> #include <db.h> #include "dbfs.h" @@ -529,16 +530,23 @@ static void dbfs_op_fsyncdir (fuse_req_t req, fuse_ino_t ino, fuse_reply_err(req, 0); } +#define COPY(x) f.f_##x = st.f_##x static void dbfs_op_statfs(fuse_req_t req) { struct statvfs f; + struct statfs st; + + if (statfs(gfs->home, &st) < 0) { + fuse_reply_err(req, errno); + return; + } memset(&f, 0, sizeof(f)); - f.f_bsize = 512; + COPY(bsize); f.f_frsize = 512; - f.f_blocks = 0xffffffffffff; - f.f_bfree = 0xfffffff; - f.f_bavail = 0xfffffff; + COPY(blocks); + COPY(bfree); + COPY(bavail); f.f_files = 0xfffffff; f.f_ffree = 0xffffff; f.f_favail = 0xffffff; @@ -548,6 +556,7 @@ static void dbfs_op_statfs(fuse_req_t req) fuse_reply_statfs(req, &f); } +#undef COPY static void dbfs_op_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name, const char *value, |