summaryrefslogtreecommitdiff
path: root/source3/smbd/statvfs.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-03-02 00:45:51 +0100
committerVolker Lendecke <vl@samba.org>2012-03-02 10:30:07 +0100
commitdcb1cd293364b5269aaf3b0ac0e475aeb18e9bab (patch)
tree19a743747b4faa100460a31bb6d6150e6232209c /source3/smbd/statvfs.c
parenta35da7972e070a7d22db7d79bba70f07e14b4fcd (diff)
downloadsamba-dcb1cd293364b5269aaf3b0ac0e475aeb18e9bab.tar.gz
samba-dcb1cd293364b5269aaf3b0ac0e475aeb18e9bab.tar.bz2
samba-dcb1cd293364b5269aaf3b0ac0e475aeb18e9bab.zip
s3: Enable statvfs usage on NetBSD
linux_statvfs is pretty much what you use when you have susv4. No real code change, this moves linux_statvfs to the bottom of the (LINUX) to #ifdef (STAT_STAVFS).
Diffstat (limited to 'source3/smbd/statvfs.c')
-rw-r--r--source3/smbd/statvfs.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c
index e6e1572e02..7265ee74c6 100644
--- a/source3/smbd/statvfs.c
+++ b/source3/smbd/statvfs.c
@@ -23,33 +23,7 @@
#include "system/filesys.h"
#include "smbd/smbd.h"
-#if defined(LINUX) && defined(HAVE_FSID_INT)
-static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
-{
- struct statvfs statvfs_buf;
- int result;
-
- result = statvfs(path, &statvfs_buf);
-
- if (!result) {
- statbuf->OptimalTransferSize = statvfs_buf.f_frsize;
- statbuf->BlockSize = statvfs_buf.f_bsize;
- statbuf->TotalBlocks = statvfs_buf.f_blocks;
- statbuf->BlocksAvail = statvfs_buf.f_bfree;
- statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
- statbuf->TotalFileNodes = statvfs_buf.f_files;
- statbuf->FreeFileNodes = statvfs_buf.f_ffree;
- statbuf->FsIdentifier = statvfs_buf.f_fsid;
-
- /* Good defaults for Linux filesystems are case sensitive
- * and case preserving.
- */
- statbuf->FsCapabilities =
- FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
- }
- return result;
-}
-#elif defined(DARWINOS)
+#if defined(DARWINOS)
#include <sys/attr.h>
@@ -160,6 +134,32 @@ static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf)
return 0;
}
+#elif defined(STAT_STATVFS) && defined(HAVE_FSID_INT)
+static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
+{
+ struct statvfs statvfs_buf;
+ int result;
+
+ result = statvfs(path, &statvfs_buf);
+
+ if (!result) {
+ statbuf->OptimalTransferSize = statvfs_buf.f_frsize;
+ statbuf->BlockSize = statvfs_buf.f_bsize;
+ statbuf->TotalBlocks = statvfs_buf.f_blocks;
+ statbuf->BlocksAvail = statvfs_buf.f_bfree;
+ statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
+ statbuf->TotalFileNodes = statvfs_buf.f_files;
+ statbuf->FreeFileNodes = statvfs_buf.f_ffree;
+ statbuf->FsIdentifier = statvfs_buf.f_fsid;
+
+ /* Good defaults for Linux filesystems are case sensitive
+ * and case preserving.
+ */
+ statbuf->FsCapabilities =
+ FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+ }
+ return result;
+}
#endif
/*
@@ -170,12 +170,12 @@ static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf)
*/
int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
{
-#if defined(LINUX) && defined(HAVE_FSID_INT)
- return linux_statvfs(path, statbuf);
-#elif defined(DARWINOS)
+#if defined(DARWINOS)
return darwin_statvfs(path, statbuf);
#elif defined(BSD) && defined(MNT_RDONLY)
return bsd_statvfs(path, statbuf);
+#elif defined(STAT_STATVFS) && defined(HAVE_FSID_INT)
+ return linux_statvfs(path, statbuf);
#else
/* BB change this to return invalid level */
#ifdef EOPNOTSUPP