From 18e75e4cb186b5d247caea5c9aa21b69e4914c50 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 19 Feb 2004 14:23:27 +0000 Subject: statfs fixes --- lib/fuse.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lib/fuse.c') diff --git a/lib/fuse.c b/lib/fuse.c index 7aa1eca..ffb3489 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -853,15 +853,30 @@ static void do_write(struct fuse *f, struct fuse_in_header *in, send_reply(f, in, res, NULL, 0); } +static void convert_statfs(struct statfs *statfs, struct fuse_kstatfs *kstatfs) +{ + kstatfs->bsize = statfs->f_bsize; + kstatfs->blocks = statfs->f_blocks; + kstatfs->bfree = statfs->f_bfree; + kstatfs->bavail = statfs->f_bavail; + kstatfs->files = statfs->f_files; + kstatfs->ffree = statfs->f_ffree; + kstatfs->namelen = statfs->f_namelen; +} + static void do_statfs(struct fuse *f, struct fuse_in_header *in) { int res; struct fuse_statfs_out arg; + struct statfs buf; res = -ENOSYS; if(f->op.statfs) { - memset(&arg, 0, sizeof(struct fuse_statfs_out)); - res = f->op.statfs((struct fuse_statfs *) &arg.st); + res = f->op.statfs("/", &buf); + if(res == 0) { + memset(&arg, 0, sizeof(struct fuse_statfs_out)); + convert_statfs(&buf, &arg.st); + } } send_reply(f, in, res, &arg, sizeof(arg)); -- cgit v1.2.3