diff options
author | Jeremy Allison <jra@samba.org> | 2004-01-06 18:13:32 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-01-06 18:13:32 +0000 |
commit | 67da3026a4d4681a904db09a6b713cbad047e7c7 (patch) | |
tree | 1a7d769cfbca113507c030ea5d5c2a782f1a46b7 /source3/lib | |
parent | 65111149b532b60e515709f33e6db896d43268fa (diff) | |
download | samba-67da3026a4d4681a904db09a6b713cbad047e7c7.tar.gz samba-67da3026a4d4681a904db09a6b713cbad047e7c7.tar.bz2 samba-67da3026a4d4681a904db09a6b713cbad047e7c7.zip |
XFS quota patch from Stefan Metzmacher <metze@metzemix.de>.
Jeremy.
(This used to be commit cae5f158e583572436a2f4c20d919816d763f93d)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/sysquotas_4A.c | 8 | ||||
-rw-r--r-- | source3/lib/sysquotas_linux.c | 9 | ||||
-rw-r--r-- | source3/lib/sysquotas_xfs.c | 68 |
3 files changed, 48 insertions, 37 deletions
diff --git a/source3/lib/sysquotas_4A.c b/source3/lib/sysquotas_4A.c index fb69417104..66b367f099 100644 --- a/source3/lib/sysquotas_4A.c +++ b/source3/lib/sysquotas_4A.c @@ -1,6 +1,6 @@ /* Unix SMB/CIFS implementation. - System QUOTA function wrappers for LINUX + System QUOTA function wrappers for QUOTACTL_4A Copyright (C) Stefan (metze) Metzmacher 2003 This program is free software; you can redistribute it and/or modify @@ -45,6 +45,10 @@ #define QCMD(x,y) x #endif +#ifndef QCMD +#define QCMD(x,y) x +#endif + #ifdef GRPQUOTA #define HAVE_GROUP_QUOTA #endif @@ -309,4 +313,6 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt return ret; } +#else /* HAVE_QUOTACTL_4A */ + void dummy_sysquotas_4A(void){} #endif /* HAVE_QUOTACTL_4A */ diff --git a/source3/lib/sysquotas_linux.c b/source3/lib/sysquotas_linux.c index 09ed64638a..be42fa23f4 100644 --- a/source3/lib/sysquotas_linux.c +++ b/source3/lib/sysquotas_linux.c @@ -312,9 +312,6 @@ static int sys_set_linux_gen_quota(const char *path, const char *bdev, enum SMB_ struct if_dqblk D; SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; - if (!path||!bdev||!dp) - smb_panic("sys_set_linux_gen_quota: called with NULL pointer"); - ZERO_STRUCT(D); if (bsize == dp->bsize) { @@ -366,7 +363,7 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt int ret = -1; if (!path||!bdev||!dp) - smb_panic("sys_get_linux_quota: called with NULL pointer"); + smb_panic("sys_set_vfs_quota: called with NULL pointer"); ZERO_STRUCT(*dp); dp->qtype = qtype; @@ -429,7 +426,7 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt uint32 oldqflags = 0; if (!path||!bdev||!dp) - smb_panic("sys_set_linux_v1_quota: called with NULL pointer"); + smb_panic("sys_set_vfs_quota: called with NULL pointer"); oldqflags = dp->qflags; @@ -483,4 +480,6 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt return ret; } +#else /* HAVE_QUOTACTL_LINUX */ + void dummy_sysquotas_linux(void){} #endif /* HAVE_QUOTACTL_LINUX */ diff --git a/source3/lib/sysquotas_xfs.c b/source3/lib/sysquotas_xfs.c index c9a7c5f743..6d7d9f9e6a 100644 --- a/source3/lib/sysquotas_xfs.c +++ b/source3/lib/sysquotas_xfs.c @@ -21,19 +21,20 @@ #include "includes.h" -#ifdef HAVE_XFS_QUOTA -#include "samba_xfs_quota.h" -#define HAVE_LINUX_XFS_QUOTA +#ifndef HAVE_SYS_QUOTAS +#ifdef HAVE_XFS_QUOTAS +#undef HAVE_XFS_QUOTAS +#endif #endif -#ifdef HAVE_LINUX_XFS_QUOTA +#ifdef HAVE_XFS_QUOTAS -/* Linux has BBSIZE in <linux/xfs_fs.h> - * or <xfs/xfs_fs.h> - * IRIX has BBSIZE in <sys/param.h> - */ -#ifdef HAVE_XFS_FS_HEADER -#include HAVE_XFS_FS_HEADER +#ifdef HAVE_LINUX_XFS_QUOTAS +#include "samba_linux_quota.h" +#include "samba_xfs_quota.h" +#define HAVE_GROUP_QUOTA +#else /* IRIX */ +#include <sys/quota.h> #endif /* on IRIX */ @@ -47,7 +48,16 @@ #define Q_XGETQSTAT Q_GETQSTAT #endif /* Q_XGETQSTAT */ +/* currently doesn't support Group and Project quotas on IRIX + */ + +#ifndef QCMD +#define QCMD(x,y) x +#endif +/* + * IRIX has BBSIZE in <sys/param.h> + */ #ifndef BBSHIFT #define BBSHIFT 9 #endif /* BBSHIFT */ @@ -55,12 +65,6 @@ #define BBSIZE (1<<BBSHIFT) #endif /* BBSIZE */ -#ifdef IRIX6 -#ifndef QUOTABLOCK_SIZE -#define QUOTABLOCK_SIZE BBSIZE -#endif -#endif - /**************************************************************************** Abstract out the XFS Quota Manager quota get call. ****************************************************************************/ @@ -108,10 +112,10 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt case SMB_GROUP_FS_QUOTA_TYPE: quotactl(QCMD(Q_XGETQSTAT,XFS_GROUP_QUOTA), bdev, -1, (caddr_t)&F); - if (F.qs_flags & XFS_QUOTA_UDQ_ENFD) { + if (F.qs_flags & XFS_QUOTA_GDQ_ENFD) { qflags |= QUOTAS_DENY_DISK; } - else if (F.qs_flags & XFS_QUOTA_UDQ_ACCT) { + else if (F.qs_flags & XFS_QUOTA_GDQ_ACCT) { qflags |= QUOTAS_ENABLED; } @@ -238,10 +242,10 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt quotactl(QCMD(Q_XGETQSTAT,XFS_GROUP_QUOTA), bdev, -1, (caddr_t)&F); if (qflags & QUOTAS_DENY_DISK) { - if (!(F.qs_flags & XFS_QUOTA_UDQ_ENFD)) - q_on |= XFS_QUOTA_UDQ_ENFD; - if (!(F.qs_flags & XFS_QUOTA_UDQ_ACCT)) - q_on |= XFS_QUOTA_UDQ_ACCT; + if (!(F.qs_flags & XFS_QUOTA_GDQ_ENFD)) + q_on |= XFS_QUOTA_GDQ_ENFD; + if (!(F.qs_flags & XFS_QUOTA_GDQ_ACCT)) + q_on |= XFS_QUOTA_GDQ_ACCT; if (q_on != 0) { ret = quotactl(QCMD(Q_XQUOTAON,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_on); @@ -250,8 +254,8 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt } } else if (qflags & QUOTAS_ENABLED) { - if (F.qs_flags & XFS_QUOTA_UDQ_ENFD) - q_off |= XFS_QUOTA_UDQ_ENFD; + if (F.qs_flags & XFS_QUOTA_GDQ_ENFD) + q_off |= XFS_QUOTA_GDQ_ENFD; if (q_off != 0) { ret = quotactl(QCMD(Q_XQUOTAOFF,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_off); @@ -259,8 +263,8 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt ret = 0; } - if (!(F.qs_flags & XFS_QUOTA_UDQ_ACCT)) - q_on |= XFS_QUOTA_UDQ_ACCT; + if (!(F.qs_flags & XFS_QUOTA_GDQ_ACCT)) + q_on |= XFS_QUOTA_GDQ_ACCT; if (q_on != 0) { ret = quotactl(QCMD(Q_XQUOTAON,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_on); @@ -272,10 +276,10 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt /* Switch on XFS_QUOTA_UDQ_ACCT didn't work! * only swittching off XFS_QUOTA_UDQ_ACCT work */ - if (F.qs_flags & XFS_QUOTA_UDQ_ENFD) - q_off |= XFS_QUOTA_UDQ_ENFD; - if (F.qs_flags & XFS_QUOTA_UDQ_ACCT) - q_off |= XFS_QUOTA_UDQ_ACCT; + if (F.qs_flags & XFS_QUOTA_GDQ_ENFD) + q_off |= XFS_QUOTA_GDQ_ENFD; + if (F.qs_flags & XFS_QUOTA_GDQ_ACCT) + q_off |= XFS_QUOTA_GDQ_ACCT; if (q_off !=0) { ret = quotactl(QCMD(Q_XQUOTAOFF,XFS_GROUP_QUOTA),bdev, -1, (caddr_t)&q_off); @@ -297,4 +301,6 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt return ret; } -#endif /* HAVE_LINUX_XFS_QUOTA */ +#else /* HAVE_XFS_QUOTAS */ + void dummy_sysquotas_xfs(void){} +#endif /* HAVE_XFS_QUOTAS */ |