From 917b04e6d6f1d8ca6d1be145dc47109ee09801c7 Mon Sep 17 00:00:00 2001 From: Wan Yong Date: Wed, 06 Apr 2011 10:02:15 +0000 Subject: fix get ntfs disk size issue --- diff --git a/config.h b/config.h index 5ee6935..bd1f225 100755 --- a/config.h +++ b/config.h @@ -235,7 +235,7 @@ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ -//#define HAVE_SYS_STATVFS_H 1 +#define HAVE_SYS_STATVFS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 diff --git a/include/fuse-lite/fuse.h b/include/fuse-lite/fuse.h index 1b3291a..6e7087e 100755 --- a/include/fuse-lite/fuse.h +++ b/include/fuse-lite/fuse.h @@ -26,7 +26,7 @@ #include #if HAVE_SYS_STATVFS_H -#include +#include #endif #ifdef __cplusplus @@ -192,7 +192,7 @@ struct fuse_operations { */ #if HAVE_SYS_STATVFS_H - int (*statfs) (const char *, struct statvfs *); + int (*statfs) (const char *, struct statfs *); #endif /** Possibly flush cached data @@ -581,7 +581,7 @@ int fuse_fs_flush(struct fuse_fs *fs, const char *path, struct fuse_file_info *fi); #if HAVE_SYS_STATVFS_H -int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf); +int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statfs *buf); #endif int fuse_fs_opendir(struct fuse_fs *fs, const char *path, diff --git a/include/fuse-lite/fuse_lowlevel.h b/include/fuse-lite/fuse_lowlevel.h index 5b6dc6d..e921d15 100755 --- a/include/fuse-lite/fuse_lowlevel.h +++ b/include/fuse-lite/fuse_lowlevel.h @@ -26,7 +26,7 @@ #if HAVE_SYS_STATVFS_H -#include +#include #endif #include @@ -961,7 +961,7 @@ int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count); * @return zero for success, -errno for failure to send reply */ #if HAVE_SYS_STATVFS_H -int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf); +int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf); #endif diff --git a/libfuse-lite/fuse.c b/libfuse-lite/fuse.c index 0e81738..a60717b 100755 --- a/libfuse-lite/fuse.c +++ b/libfuse-lite/fuse.c @@ -678,13 +678,13 @@ int fuse_fs_flush(struct fuse_fs *fs, const char *path, } #if HAVE_SYS_STATVFS_H -int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf) +int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statfs *buf) { fuse_get_context()->private_data = fs->user_data; if (fs->op.statfs) return fs->op.statfs(path, buf); else { - buf->f_namemax = 255; + buf->f_namelen = 255; buf->f_bsize = 512; return 0; } @@ -1976,7 +1976,7 @@ static void fuse_lib_statfs(fuse_req_t req, fuse_ino_t ino) struct fuse *f = req_fuse_prepare(req); #if HAVE_SYS_STATVFS_H - struct statvfs buf; + struct statfs buf; char *path; int err; diff --git a/libfuse-lite/fuse_lowlevel.c b/libfuse-lite/fuse_lowlevel.c index f6530c1..1457e6c 100755 --- a/libfuse-lite/fuse_lowlevel.c +++ b/libfuse-lite/fuse_lowlevel.c @@ -249,7 +249,7 @@ size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize, #if HAVE_SYS_STATVFS_H -static void convert_statfs(const struct statvfs *stbuf, +static void convert_statfs(const struct statfs *stbuf, struct fuse_kstatfs *kstatfs) { kstatfs->bsize = stbuf->f_bsize; @@ -259,7 +259,7 @@ static void convert_statfs(const struct statvfs *stbuf, kstatfs->bavail = stbuf->f_bavail; kstatfs->files = stbuf->f_files; kstatfs->ffree = stbuf->f_ffree; - kstatfs->namelen = stbuf->f_namemax; + kstatfs->namelen = stbuf->f_namelen; } #endif @@ -418,7 +418,7 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size) #if HAVE_SYS_STATVFS_H -int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf) +int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf) { struct fuse_statfs_out arg; size_t size = req->f->conn.proto_minor < 4 ? FUSE_COMPAT_STATFS_SIZE : sizeof(arg); @@ -825,8 +825,8 @@ static void do_statfs(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) req->f->op.statfs(req, nodeid); else { #if HAVE_SYS_STATVFS_H - struct statvfs buf = { - .f_namemax = 255, + struct statfs buf = { + .f_namelen = 255, .f_bsize = 512, }; fuse_reply_statfs(req, &buf); diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index b6cdafd..a943e60 100755 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -491,7 +491,7 @@ static void ntfs_fuse_statfs(fuse_req_t req, size += vol->free_mft_records; if (size < 0) size = 0; - sfs.f_ffree = sfs.f_favail = size; + sfs.f_ffree = /*sfs.f_favail =*/ size; /* Maximum length of filenames. */ sfs.f_namemax = NTFS_MAX_NAME_LEN; diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 73a66b9..23c8716 100755 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -470,7 +470,7 @@ static int ntfs_allowed_real_dir_access(struct SECURITY_CONTEXT *scx, */ #if HAVE_SYS_STATVFS_H static int ntfs_fuse_statfs(const char *path __attribute__((unused)), - struct statvfs *sfs) + struct statfs *sfs) { s64 size; int delta_bits; @@ -516,10 +516,10 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), size += vol->free_mft_records; if (size < 0) size = 0; - sfs->f_ffree = sfs->f_favail = size; + sfs->f_ffree = /*sfs->f_favail = */size; /* Maximum length of filenames. */ - sfs->f_namemax = NTFS_MAX_NAME_LEN; + sfs->f_namelen = NTFS_MAX_NAME_LEN; return 0; } #endif -- cgit