summaryrefslogtreecommitdiff
path: root/source3/lib/sysquotas_4B.c
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2012-09-02 16:08:58 +0200
committerBjörn Jacke <bj@sernet.de>2012-09-02 20:58:58 +0200
commitaf5dcaa7405b7e5f67acacece96690da03ae9e5a (patch)
treefa07c29697f5bf1e91d15feeaa6a270f71a7f658 /source3/lib/sysquotas_4B.c
parentd3924859191ee07a7e52420aa03be3204e291b60 (diff)
downloadsamba-af5dcaa7405b7e5f67acacece96690da03ae9e5a.tar.gz
samba-af5dcaa7405b7e5f67acacece96690da03ae9e5a.tar.bz2
samba-af5dcaa7405b7e5f67acacece96690da03ae9e5a.zip
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.
Diffstat (limited to 'source3/lib/sysquotas_4B.c')
-rw-r--r--source3/lib/sysquotas_4B.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/lib/sysquotas_4B.c b/source3/lib/sysquotas_4B.c
index 9badd3b75b..e3adc35015 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;
}