From a9750b20061ed0862754459120043f341a1b8f50 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 30 Nov 2001 21:50:02 +0000 Subject: XFS quota patch for Linux. Jeremy. (This used to be commit ce099faf6ce07e14bd9610960bd09f56c5bee864) --- source3/smbd/quotas.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c index 96670a985d..73391e6c0d 100644 --- a/source3/smbd/quotas.c +++ b/source3/smbd/quotas.c @@ -55,6 +55,9 @@ BOOL disk_quotas_vxfs(const pstring name, char *path, SMB_BIG_UINT *bsize, SMB_B */ #include +#ifdef HAVE_LINUX_XQM_H +#include +#endif #include #include @@ -72,11 +75,36 @@ typedef struct _LINUX_SMB_DISK_QUOTA { SMB_BIG_UINT curinodes; /* Current used inodes. */ } LINUX_SMB_DISK_QUOTA; +/**************************************************************************** + Abstract out the XFS Quota Manager quota get call. +****************************************************************************/ + +static int get_smb_linux_xfs_quota(char *path, uid_t euser_id, LINUX_SMB_DISK_QUOTA *dp) +{ + int ret = -1; +#ifdef HAVE_LINUX_XQM_H + struct fs_disk_quota D; + ZERO_STRUCT(D); + + if ((ret = quotactl(QCMD(Q_XGETQUOTA,USRQUOTA), path, euser_id, (caddr_t)&D))) + return ret; + + dp->bsize = (SMB_BIG_UINT)512; + dp->softlimit = (SMB_BIG_UINT)D.d_blk_softlimit; + dp->hardlimit = (SMB_BIG_UINT)D.d_blk_hardlimit; + dp->ihardlimit = (SMB_BIG_UINT)D.d_ino_hardlimit; + dp->isoftlimit = (SMB_BIG_UINT)D.d_ino_softlimit; + dp->curinodes = (SMB_BIG_UINT)D.d_icount; + dp->curblocks = (SMB_BIG_UINT)D.d_bcount; +#endif + return ret; +} + /**************************************************************************** Abstract out the old and new Linux quota get calls. ****************************************************************************/ -static int get_smb_linux_quota(char *path, uid_t euser_id, LINUX_SMB_DISK_QUOTA *dp) +static int get_smb_linux_vfs_quota(char *path, uid_t euser_id, LINUX_SMB_DISK_QUOTA *dp) { int ret; #ifdef LINUX_QUOTAS_1 @@ -154,7 +182,10 @@ BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB save_re_uid(); set_effective_uid(0); - r=get_smb_linux_quota(mnt->mnt_fsname, euser_id, &D); + if (strcmp(mnt->mnt_type, "xfs") == 0) + r=get_smb_linux_xfs_quota(mnt->mnt_fsname, euser_id, &D); + else + r=get_smb_linux_vfs_quota(mnt->mnt_fsname, euser_id, &D); restore_re_uid(); /* Use softlimit to determine disk space, except when it has been exceeded */ -- cgit