[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Fri Mar 2 04:05:03 MST 2012
The branch, master has been updated
via 6c1c092 s3: Test for statfs before statfs64
via 8bdc289 s3: Further fix for bug 8777
via dcb1cd2 s3: Enable statvfs usage on NetBSD
from a35da79 s4-rpc: dnsserver: Fix the typo in comparing two DNS records
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 6c1c092f079492d359437c76eb5319a0bf20f013
Author: Volker Lendecke <vl at samba.org>
Date: Fri Mar 2 02:10:52 2012 +0100
s3: Test for statfs before statfs64
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Fri Mar 2 12:04:35 CET 2012 on sn-devel-104
commit 8bdc2890999c850519913be0e829e9ced979ac2f
Author: Brad Smith <brad at comstyle.com>
Date: Fri Mar 2 01:34:16 2012 +0100
s3: Further fix for bug 8777
commit dcb1cd293364b5269aaf3b0ac0e475aeb18e9bab
Author: Volker Lendecke <vl at samba.org>
Date: Fri Mar 2 00:45:51 2012 +0100
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).
-----------------------------------------------------------------------
Summary of changes:
source3/configure.in | 81 ++++++++++++++++++++++++++---------------
source3/modules/vfs_default.c | 2 +-
source3/smbd/statvfs.c | 64 ++++++++++++++++----------------
3 files changed, 85 insertions(+), 62 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/configure.in b/source3/configure.in
index 6c7c3b0..937867d 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -5240,6 +5240,26 @@ fi
AC_CHECKING(how to get filesystem space usage)
space=no
+# Perform only the link test since it seems there are no variants of the
+# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
+# because that got a false positive on SCO OSR5. Adding the declaration
+# of a `struct statvfs' causes this test to fail (as it should) on such
+# systems. That system is reported to work fine with STAT_STATFS4 which
+# is what it gets when this test fails.
+if test $space = no; then
+ # SVR4
+ AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
+ [AC_TRY_LINK([#include <sys/types.h>
+#include <sys/statvfs.h>],
+ [struct statvfs fsd; statvfs (0, &fsd);],
+ fu_cv_sys_stat_statvfs=yes,
+ fu_cv_sys_stat_statvfs=no)])
+ if test $fu_cv_sys_stat_statvfs = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
+ fi
+fi
+
# Test for statvfs64.
if test $space = no; then
# SVR4
@@ -5264,26 +5284,6 @@ if test $space = no; then
fi
fi
-# Perform only the link test since it seems there are no variants of the
-# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
-# because that got a false positive on SCO OSR5. Adding the declaration
-# of a `struct statvfs' causes this test to fail (as it should) on such
-# systems. That system is reported to work fine with STAT_STATFS4 which
-# is what it gets when this test fails.
-if test $space = no; then
- # SVR4
- AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
- [AC_TRY_LINK([#include <sys/types.h>
-#include <sys/statvfs.h>],
- [struct statvfs fsd; statvfs (0, &fsd);],
- fu_cv_sys_stat_statvfs=yes,
- fu_cv_sys_stat_statvfs=no)])
- if test $fu_cv_sys_stat_statvfs = yes; then
- space=yes
- AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
- fi
-fi
-
# smbd/statvfs.c assumes that statvfs.f_fsid is an integer.
# This is not the case on ancient Linux systems.
@@ -6834,25 +6834,48 @@ fi
CFLAGS=$CFLAGS_SAVE
-# Checks for the vfs_fileid module
+# Checks for *BSD bsd_statvfs() function
# Start
-AC_CHECK_FUNC(getmntent)
-
-AC_CHECK_HEADERS(sys/param.h sys/statfs.h sys/mount.h)
+AC_CHECK_HEADERS(sys/param.h sys/mount.h)
-AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid)])
-AC_CACHE_VAL(vfsfileid_cv_statfs,[
+AC_MSG_CHECKING([bsd_statvfs: checking for statfs() and struct statfs.bsize])
+AC_CACHE_VAL(bsdstatvfs_cv_statfs,[
AC_TRY_RUN([
- #include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
- #ifdef HAVE_SYS_STATFS_H
+ int main (void)
+ {
+ struct statfs fsd;
+ fsd.f_bsize = 0;
+ exit (statfs (".", &fsd));
+ }],
+ bsdstatvfs_cv_statfs=yes,
+ bsdstatvfs_cv_statfs=no,
+ bsdstatvfs_cv_statfs=no)])
+AC_MSG_RESULT($bsdstatvfs_cv_statfs)
+
+if test $bsdstatvfs_cv_statfs = yes; then
+ AC_DEFINE(BSD_STATVFS_BSIZE,1,[Whether statfs exists and struct statfs has bsize property])
+fi
+
+# End
+# Checks for *BSD sys_statvfs() function
+
+# Checks for the vfs_fileid module
+# Start
+AC_CHECK_FUNC(getmntent)
+
+AC_CHECK_HEADERS(sys/statfs.h)
+
+AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid])
+AC_CACHE_VAL(vfsfileid_cv_statfs,[
+ AC_TRY_RUN([
+ #include <sys/types.h>
#include <sys/statfs.h>
- #endif
int main(void)
{
struct statfs fsd;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index d81adad..fd0ff0a 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -111,7 +111,7 @@ static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle,
NTSTATUS status;
int ret = -1;
-#if defined(DARWINOS) || (defined(BSD) && defined(MNT_RDONLY))
+#if defined(DARWINOS) || (defined(BSD) && defined(BSD_STATVFS_BSIZE))
struct vfs_statvfs_struct statbuf;
ZERO_STRUCT(statbuf);
sys_statvfs(conn->connectpath, &statbuf);
diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c
index e6e1572..1e72a8e 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>
@@ -123,7 +97,7 @@ static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf)
return 0;
}
-#elif defined(BSD) && defined(MNT_RDONLY)
+#elif defined(BSD) && defined(BSD_STATVFS_BSIZE)
static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf)
{
struct statfs statfs_buf;
@@ -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)
+#elif defined(BSD) && defined(BSD_STATVFS_BSIZE)
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
--
Samba Shared Repository
More information about the samba-cvs
mailing list