The Samba-Bugzilla – Attachment 11939 Details for
Bug 11810
Wrong filesystem size reported to client (df)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to add solaris_statvfs()
solaris_statvfs.patch.tabs (text/plain), 3.03 KB, created by
alexandre.lecuyer
on 2016-03-25 09:57:32 UTC
(
hide
)
Description:
patch to add solaris_statvfs()
Filename:
MIME Type:
Creator:
alexandre.lecuyer
Created:
2016-03-25 09:57:32 UTC
Size:
3.03 KB
patch
obsolete
>From 65e3d8de2941dae4578e3cc127ad4c188935e09d Mon Sep 17 00:00:00 2001 >From: Alexandre Lecuyer <alexandre.lecuyer@corp.ovh.com> >Date: Mon, 4 Jan 2016 11:26:03 +0000 >Subject: [PATCH] Add solaris specific statvfs function > >--- > lib/util/wscript_configure | 7 +++++++ > source3/smbd/statvfs.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 49 insertions(+) > >diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure >index e7bcbd6..d18bdcf 100644 >--- a/lib/util/wscript_configure >+++ b/lib/util/wscript_configure >@@ -67,6 +67,13 @@ conf.CHECK_CODE("""struct statfs fsd; > execute=True, > local_include=False) > >+conf.CHECK_CODE("struct statvfs buf = { .f_fstr[0] = 'a'}", >+ define='SOLARIS_STYLE_STATVFS', >+ msg='Checking for solaris style statvfs with statvfs.f_fstr', >+ execute=False, >+ local_include=False, >+ headers='sys/types.h sys/statvfs.h') >+ > conf.CHECK_CODE('struct statvfs buf; buf.f_fsid = 0', > define='HAVE_FSID_INT', > msg='Checking if f_fsid is an integer', >diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c >index d4bdf16..7660f26 100644 >--- a/source3/smbd/statvfs.c >+++ b/source3/smbd/statvfs.c >@@ -114,6 +114,46 @@ static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf) > > return ret; > } >+#elif defined(SOLARIS_STYLE_STATVFS) >+static int solaris_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_bsize; >+ statbuf->BlockSize = statvfs_buf.f_frsize; >+ 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; >+ /* Try to extrapolate some of the fs flags into the >+ * capabilities >+ */ >+ statbuf->FsCapabilities = >+ FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES; >+#ifdef ST_QUOTA >+ if (statvfs_buf.f_flag & ST_QUOTA) >+ statbuf->FsCapabilities |= FILE_VOLUME_QUOTAS; >+#endif >+ if (statvfs_buf.f_flag & ST_RDONLY) >+ statbuf->FsCapabilities |= FILE_READ_ONLY_VOLUME; >+ >+#if defined(HAVE_FALLOC_FL_PUNCH_HOLE) && defined(HAVE_LSEEK_HOLE_DATA) >+ /* >+ * Only flag sparse file support if ZERO_DATA can be used to >+ * deallocate blocks, and SEEK_HOLE / SEEK_DATA can be used >+ * to provide QUERY_ALLOCATED_RANGES information. >+ */ >+ statbuf->FsCapabilities |= FILE_SUPPORTS_SPARSE_FILES; >+#endif >+ } >+ return result; >+} > #elif defined(STAT_STATVFS) && defined(HAVE_FSID_INT) > static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf) > { >@@ -166,6 +206,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf) > { > #if defined(BSD_STYLE_STATVFS) > return bsd_statvfs(path, statbuf); >+#elif defined(SOLARIS_STYLE_STATVFS) >+ return solaris_statvfs(path, statbuf); > #elif defined(STAT_STATVFS) && defined(HAVE_FSID_INT) > return linux_statvfs(path, statbuf); > #else >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11810
: 11939