The branch, master has been updated via 341bd82 s3: Fix a typo via 71a6d33 s3: Fix bug 8777, sys_statvfs() wrapper support for OpenBSD/FreeBSD/DragonFly from 0fbefbc s3-auth rename vuid_serverinfo to session_info
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 341bd82fbf1f9209aae94bdbc6461805f826e39e Author: Volker Lendecke <v...@samba.org> Date: Sat Feb 25 09:40:16 2012 +0100 s3: Fix a typo Autobuild-User: Volker Lendecke <v...@samba.org> Autobuild-Date: Sat Feb 25 11:16:41 CET 2012 on sn-devel-104 commit 71a6d334321d42fd0f02646d1649405ccf197c00 Author: Brad Smith <b...@comstyle.com> Date: Sat Feb 25 09:28:43 2012 +0100 s3: Fix bug 8777, sys_statvfs() wrapper support for OpenBSD/FreeBSD/DragonFly ----------------------------------------------------------------------- Summary of changes: source3/configure.in | 10 ++++++++- source3/modules/vfs_default.c | 2 +- source3/smbd/statvfs.c | 45 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/configure.in b/source3/configure.in index 7b90c8f..dc47f13 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6838,13 +6838,21 @@ CFLAGS=$CFLAGS_SAVE # Start AC_CHECK_FUNC(getmntent) -AC_CHECK_HEADERS(sys/statfs.h) +AC_CHECK_HEADERS(sys/param.h sys/statfs.h sys/mount.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> + #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 #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 f556f1c..d81adad 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) +#if defined(DARWINOS) || (defined(BSD) && defined(MNT_RDONLY)) 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 2de015a..e6e1572 100644 --- a/source3/smbd/statvfs.c +++ b/source3/smbd/statvfs.c @@ -49,9 +49,7 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf) } return result; } -#endif - -#if defined(DARWINOS) +#elif defined(DARWINOS) #include <sys/attr.h> @@ -125,13 +123,50 @@ static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf) return 0; } +#elif defined(BSD) && defined(MNT_RDONLY) +static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf) +{ + struct statfs statfs_buf; + int result; + + result = statfs(path, &statfs_buf); + if (result != 0) { + return result; + } + + statbuf->OptimalTransferSize = statfs_buf.f_iosize; + statbuf->BlockSize = statfs_buf.f_bsize; + statbuf->TotalBlocks = statfs_buf.f_blocks; + statbuf->BlocksAvail = statfs_buf.f_bfree; + statbuf->UserBlocksAvail = statfs_buf.f_bavail; + statbuf->TotalFileNodes = statfs_buf.f_files; + statbuf->FreeFileNodes = statfs_buf.f_ffree; + statbuf->FsIdentifier = + (((uint64_t) statfs_buf.f_fsid.val[0] << 32) & 0xffffffff00000000LL) | + (uint64_t) statfs_buf.f_fsid.val[1]; + /* Try to extrapolate some of the fs flags into the + * capabilities + */ + statbuf->FsCapabilities = + FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES; +#ifdef MNT_ACLS + if (statfs_buf.f_flags & MNT_ACLS) + statbuf->FsCapabilities |= FILE_PERSISTENT_ACLS; +#endif + if (statfs_buf.f_flags & MNT_QUOTA) + statbuf->FsCapabilities |= FILE_VOLUME_QUOTAS; + if (statfs_buf.f_flags & MNT_RDONLY) + statbuf->FsCapabilities |= FILE_READ_ONLY_VOLUME; + + return 0; +} #endif /* sys_statvfs() is an abstraction layer over system-dependent statvfs()/statfs() for particular POSIX systems. Due to controversy of what is considered more important between LSB and FreeBSD/POSIX.1 (IEEE Std 1003.1-2001) we need to abstract the interface - so that particular OS would use its preffered interface. + so that particular OS would use its prefered interface. */ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf) { @@ -139,6 +174,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf) return linux_statvfs(path, statbuf); #elif defined(DARWINOS) return darwin_statvfs(path, statbuf); +#elif defined(BSD) && defined(MNT_RDONLY) + return bsd_statvfs(path, statbuf); #else /* BB change this to return invalid level */ #ifdef EOPNOTSUPP -- Samba Shared Repository