diff --git a/ChangeLog b/ChangeLog index c560e4f..5e9acb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ ChangeLog for davfs2 -------------------- +2009-06-30 Werner Baumann (werner.baumann@onlinehome.de) + * dav_fuse.c, fuse_stat: + Correct block counts according to block size. + 2009-06-13 Werner Baumann (werner.baumann@onlinehome.de) * Released version 1.4.1. diff --git a/src/dav_fuse.c b/src/dav_fuse.c index 8a82920..462de1e 100644 --- a/src/dav_fuse.c +++ b/src/dav_fuse.c @@ -978,13 +978,21 @@ fuse_stat(void) return sizeof(struct fuse_out_header); } - out->st.blocks = st->blocks; - out->st.bfree = st->bfree; - out->st.bavail = st->bavail; + int nblocks = (buf_size - sizeof(struct fuse_in_header) + - sizeof(struct fuse_write_in) - 4095) / st->bsize; + if (nblocks > 1) { + out->st.blocks = st->blocks / nblocks; + out->st.bfree = st->bfree / nblocks; + out->st.bavail = st->bavail / nblocks; + out->st.bsize = st->bsize * nblocks; + } else { + out->st.blocks = st->blocks; + out->st.bfree = st->bfree; + out->st.bavail = st->bavail; + out->st.bsize = st->bsize; + } out->st.files = st->files; out->st.ffree = st->ffree; - out->st.bsize = (buf_size - sizeof(struct fuse_in_header) - - sizeof(struct fuse_write_in) - 4095) & ~4095; out->st.namelen = st->namelen; out->st.frsize = 0; out->st.padding = 0;