From 67da3026a4d4681a904db09a6b713cbad047e7c7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Jan 2004 18:13:32 +0000 Subject: XFS quota patch from Stefan Metzmacher . Jeremy. (This used to be commit cae5f158e583572436a2f4c20d919816d763f93d) --- source3/Makefile.in | 2 +- source3/configure.in | 29 +++++++++++++++--- source3/lib/sysquotas_4A.c | 8 ++++- source3/lib/sysquotas_linux.c | 9 +++--- source3/lib/sysquotas_xfs.c | 68 +++++++++++++++++++++++-------------------- 5 files changed, 74 insertions(+), 42 deletions(-) (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index e27e3761f3..193a1601a7 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -352,7 +352,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \ smbd/posix_acls.o lib/sysacls.o lib/server_mutex.o \ smbd/process.o smbd/service.o smbd/error.o \ printing/printfsp.o lib/sysquotas.o lib/sysquotas_linux.o \ - lib/sysquotas_xfs.o \ + lib/sysquotas_xfs.o lib/sysquotas_4A.o \ smbd/change_trust_pw.o smbd/fake_file.o \ smbd/quotas.o smbd/ntquotas.o lib/afs.o \ $(MANGLE_OBJ) @VFS_STATIC@ diff --git a/source3/configure.in b/source3/configure.in index 4784b58dfb..154b6c3fee 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3121,8 +3121,9 @@ AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os}) samba_cv_RUN_QUOTA_TESTS=yes samba_cv_SYSQUOTA_FOUND=yes AC_DEFINE(HAVE_QUOTACTL_LINUX,1,[Whether Linux quota support is available]) - AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available]) samba_cv_sysquotas_file="lib/sysquotas_linux.c" + AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available]) + samba_cv_found_xfs_header=yes ;; *) AC_MSG_RESULT(no) @@ -3147,7 +3148,7 @@ AC_CHECK_HEADERS(sys/fs/vx_quota.h) # For sys/quota.h and linux/quota.h AC_CHECK_HEADERS(sys/quota.h) -if test x"$samba_cv_found_xfs_header" = x"no"; then +if test x"$samba_cv_found_xfs_header" != x"yes"; then # if we have xfs quota support (IRIX) we should use it AC_CACHE_CHECK([for XFS QUOTA in ],samba_cv_HAVE_SYS_QUOTA_XFS, [ AC_TRY_COMPILE([ @@ -3162,11 +3163,10 @@ AC_TRY_COMPILE([ ],[int i = Q_XGETQUOTA;], samba_cv_HAVE_SYS_QUOTA_XFS=yes,samba_cv_HAVE_SYS_QUOTA_XFS=no)]) if test "$samba_cv_HAVE_SYS_QUOTA_XFS"x = "yes"x; then - AC_DEFINE(HAVE_IRIX_XFS_QUOTAS,1,[Whether IRIX xfs quota support is available]) + samba_cv_found_xfs_header=yes fi fi - # if we have struct dqblk .dqb_fsoftlimit instead of .dqb_isoftlimit on IRIX AC_CACHE_CHECK([if struct dqblk has .dqb_fsoftlimit],samba_cv_HAVE_DQB_FSOFTLIMIT, [ AC_TRY_COMPILE([ @@ -3288,6 +3288,27 @@ AC_MSG_CHECKING(whether to use the new lib/sysquotas.c interface) fi fi +if test x"$samba_cv_SYSQUOTA_FOUND" != x"no" -a x"$samba_cv_found_xfs_header" = x"yes"; then +AC_CACHE_CHECK([whether the sys_quota interface works with XFS],samba_cv_SYSQUOTA_WORKS_XFS,[ +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I. -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper -I${srcdir-.}/nsswitch" +AC_TRY_COMPILE([ +#include "confdefs.h" +#define NO_PROTO_H 1 +#define NO_CONFIG_H 1 +#define HAVE_SYS_QUOTAS 1 +#define HAVE_XFS_QUOTAS 1 +#include "${srcdir-.}/lib/sysquotas_xfs.c" +],[],samba_cv_SYSQUOTA_WORKS_XFS=yes,samba_cv_SYSQUOTA_WORKS_XFS=no) +CPPFLAGS="$SAVE_CPPFLAGS" +]) +if test x"$samba_cv_SYSQUOTA_WORKS_XFS" = x"yes"; then + if test x"$samba_cv_WE_USE_SYS_QUOTAS" = x"yes"; then + AC_DEFINE(HAVE_XFS_QUOTAS,1,[Whether xfs quota support is available]) + fi +fi +fi + AC_CACHE_CHECK([whether the old quota support works],samba_cv_QUOTA_WORKS,[ SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I. -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper -I${srcdir-.}/nsswitch" 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 - * or - * IRIX has BBSIZE in - */ -#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 #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 + */ #ifndef BBSHIFT #define BBSHIFT 9 #endif /* BBSHIFT */ @@ -55,12 +65,6 @@ #define BBSIZE (1<