[SCM] Samba Shared Repository - branch master updated

Björn Jacke bjacke at samba.org
Sun Sep 2 15:22:02 MDT 2012


The branch, master has been updated
       via  05f9829 waf: add new quota header checks and sysquota_4B source file
       via  9dd0e16 s3: remove some duplicate quota code
       via  af5dcaa s3: adopt the new sysquotas_4B support for BSD
      from  d392485 s3: add sysquotas_4B support

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 05f9829ab54a4c1a9c23e0283a785a29bf1fc383
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Sep 2 21:45:53 2012 +0200

    waf: add new quota header checks and sysquota_4B source file
    
    Autobuild-User(master): Björn Jacke <bj at sernet.de>
    Autobuild-Date(master): Sun Sep  2 23:21:22 CEST 2012 on sn-devel-104

commit 9dd0e1608ecc7a06873cbef6b81c951868bd0356
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Sep 2 21:44:54 2012 +0200

    s3: remove some duplicate quota code

commit af5dcaa7405b7e5f67acacece96690da03ae9e5a
Author: Björn Jacke <bj at sernet.de>
Date:   Sun Sep 2 16:08:58 2012 +0200

    s3: adopt the new sysquotas_4B support for BSD
    
    most BSD systems have ufs/ufs/quota.h and they count the quota in blocks, not
    bytes and have slightly different dqblk struct members.

-----------------------------------------------------------------------

Summary of changes:
 source3/configure.in       |    9 +++++++++
 source3/lib/sysquotas_4B.c |   22 +++++++++++++++++++---
 source3/smbd/quotas.c      |   39 ++++++++++++---------------------------
 source3/wscript            |    2 ++
 source3/wscript_build      |    2 +-
 5 files changed, 43 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index 67ccad6..e11f434 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -4646,6 +4646,10 @@ AC_CHECK_HEADERS(linux/dqblk_xfs.h)
 # For sys/quota.h and linux/quota.h
 AC_CHECK_HEADERS(sys/quota.h)
 
+# For quotas on BSD systems
+AC_CHECK_HEADERS(ufs/ufs/quota.h)
+
+
 if test x"$samba_cv_found_xfs_header" != x"yes"; then
 # if we have xfs quota support <sys/quota.h> (IRIX) we should use it
 AC_CACHE_CHECK([for XFS QUOTA in <sys/quota.h>],samba_cv_HAVE_SYS_QUOTA_XFS, [
@@ -4710,6 +4714,11 @@ if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then
     samba_cv_SYSQUOTA_FOUND=yes;
     AC_DEFINE(HAVE_QUOTACTL_4B,1,[Whether int quotactl(const char *path, int cmd, int id, char *addr) is available])
     samba_cv_sysquotas_file="lib/sysquotas_4B.c"
+    AC_CHECK_MEMBERS([struct dqblk.dqb_curbytes], # Darwin bytecount style
+	[ AC_DEFINE([HAVE_STRUCT_DQBLK_DQB_CURBYTES],[1],[darwin style quota bytecount])],,
+	[#include <sys/typeѕ.h>
+	#include <sys/quota.h>])
+
 fi
 fi
 
diff --git a/source3/lib/sysquotas_4B.c b/source3/lib/sysquotas_4B.c
index 9badd3b..e3adc35 100644
--- a/source3/lib/sysquotas_4B.c
+++ b/source3/lib/sysquotas_4B.c
@@ -43,8 +43,14 @@
 #include <sys/quota.h>
 #endif
 
-/* WorkARound broken HFS access checks in hfs_quotactl. */
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+
+#if defined(DARWINOS)
+/* WorkARound broken HFS access checks in hfs_quotactl. Darwin only(?) */
 #define HFS_QUOTACTL_WAR 1
+#endif
 
 static void xlate_qblk_to_smb(const struct dqblk * const qblk,
 			SMB_DISK_QUOTA *dp)
@@ -53,12 +59,17 @@ static void xlate_qblk_to_smb(const struct dqblk * const qblk,
 
 	DEBUG(10, ("unix softlimit=%u hardlimit=%u curblock=%u\n",
 	    (unsigned)qblk->dqb_bsoftlimit, (unsigned)qblk->dqb_bhardlimit,
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
 	    (unsigned)qblk->dqb_curbytes));
+#else
+	    (unsigned)qblk->dqb_curblocks));
+#endif
 
 	DEBUGADD(10, ("unix softinodes=%u hardinodes=%u curinodes=%u\n",
 	    (unsigned)qblk->dqb_isoftlimit, (unsigned)qblk->dqb_ihardlimit,
 	    (unsigned)qblk->dqb_curinodes));
 
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
 	/* On Darwin, quotas are counted in bytes. We report them
 	 * in 512b blocks because various callers have assumptions
 	 * about the block size.
@@ -70,6 +81,7 @@ static void xlate_qblk_to_smb(const struct dqblk * const qblk,
 	dp->hardlimit = XLATE_TO_BLOCKS(qblk->dqb_bhardlimit);
 	dp->curblocks = XLATE_TO_BLOCKS(qblk->dqb_curbytes);
 #undef XLATE_TO_BLOCKS
+#endif
 
 	dp->ihardlimit = qblk->dqb_ihardlimit;
 	dp->isoftlimit = qblk->dqb_isoftlimit;
@@ -92,9 +104,13 @@ static void xlate_smb_to_qblk(const SMB_DISK_QUOTA * const dp,
 {
 	ZERO_STRUCTP(qblk);
 
+	qblk->dqb_bsoftlimit = dp->softlimit;
+	qblk->dqb_bhardlimit = dp->hardlimit;
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBYTES
 	/* On Darwin, quotas are counted in bytes. */
-	qblk->dqb_bsoftlimit = dp->softlimit * dp->bsize;
-	qblk->dqb_bhardlimit = dp->hardlimit * dp->bsize;
+	qblk->dqb_bsoftlimit *= dp->bsize;
+	qblk->dqb_bhardlimit *= dp->bsize;
+#endif
 	qblk->dqb_ihardlimit = dp->ihardlimit;
 	qblk->dqb_isoftlimit = dp->isoftlimit;
 }
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index caf0244..d8bdb02 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -51,6 +51,7 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *d
 
 #endif /* VXFS_QUOTA */
 
+
 #ifdef LINUX
 
 #include <sys/types.h>
@@ -87,15 +88,6 @@ typedef struct _LINUX_SMB_DISK_QUOTA {
 #endif
 #include <rpc/xdr.h>
 
-static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
-{
-	if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
-		return(0);
-	if (!xdr_int(xdrsp, &args->gqa_uid))
-		return(0);
-	return (1);
-}
-
 static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
 {
 	int quotastat;
@@ -613,15 +605,6 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
 #include <rpc/nettype.h>
 #include <rpc/xdr.h>
 
-static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
-{
-	if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
-		return(0);
-	if (!xdr_int(xdrsp, &args->gqa_uid))
-		return(0);
-	return (1);
-}
-
 static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
 {
 	int quotastat;
@@ -1170,15 +1153,6 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
 #endif
 #include <rpc/xdr.h>
 
-static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
-{
-	if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
-		return(0);
-	if (!xdr_int(xdrsp, &args->gqa_uid))
-		return(0);
-	return (1);
-}
-
 static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
 {
 	int quotastat;
@@ -1511,6 +1485,17 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
 
 #endif
 
+#if definedr(LINUX) || defined(SUNOS) || defined (__FreeBSD__) || defined(__DragonFly__)
+static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
+{
+	if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN ))
+		return(0);
+	if (!xdr_int(xdrsp, &args->gqa_uid))
+		return(0);
+	return (1);
+}
+#endif
+
 #if defined(VXFS_QUOTA)
 
 /****************************************************************************
diff --git a/source3/wscript b/source3/wscript
index d05b21d..9869a90 100755
--- a/source3/wscript
+++ b/source3/wscript
@@ -1168,6 +1168,8 @@ main() {
         conf.CHECK_HEADERS('linux/dqblk_xfs.h')
         # For sys/quota.h and linux/quota.h
         conf.CHECK_HEADERS('sys/quota.h')
+        # For quotas on BSD systems
+        conf.CHECK_HEADERS('ufs/ufs/quota.h')
 
 
     #
diff --git a/source3/wscript_build b/source3/wscript_build
index a6cccac..66171bf 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -349,7 +349,7 @@ SMBD_SRC_SRV = '''smbd/server_reload.c smbd/files.c smbd/connection.c
                smbd/process.c smbd/service.c smbd/error.c
                printing/printspoolss.c printing/spoolssd.c
                lib/sysquotas.c lib/sysquotas_linux.c
-               lib/sysquotas_xfs.c lib/sysquotas_4A.c
+               lib/sysquotas_xfs.c lib/sysquotas_4A.c lib/sysquotas_4B.c
                lib/sysquotas_nfs.c
                lib/background.c
                smbd/fake_file.c


-- 
Samba Shared Repository


More information about the samba-cvs mailing list