[PATCH] fix new quota system on irix
Stefan Metzmacher
metze at metzemix.de
Tue Jan 6 16:29:14 GMT 2004
Stefan Metzmacher wrote:
> Stefan Metzmacher wrote:
>
>> Hi *,
>>
>> here's a small fix that fixes the new quota system on irix.
>>
>> I need to reanable XFS quotas on irix for the new quota system
>> (Jerry do you want to wait for this for the release ?)
>>
>> But the old system works and is the default on irix!
>
>
> here's a new patch which renables XFS quotas with the new quota system
> on IRIX
>
> and some other little fixes...
I didn't saw abartlets commit message early enough,
so here's a patch that applies cleanly
--
metze
-------------------------------------------
Stefan (metze) Metzmacher <metze at metzemix.de>
-------------- next part --------------
? tmp.h
? mx-samba-3.configure
? quota.txt
? modules/vfs_nfs_quota.c
? smbd/quotas.c-2.2
Index: Makefile.in
===================================================================
RCS file: /cvsroot/samba/source/Makefile.in,v
retrieving revision 1.468.2.203
diff -u -r1.468.2.203 Makefile.in
--- Makefile.in 5 Jan 2004 19:36:01 -0000 1.468.2.203
+++ Makefile.in 6 Jan 2004 16:27:17 -0000
@@ -352,7 +352,7 @@
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@
Index: configure.in
===================================================================
RCS file: /cvsroot/samba/source/configure.in,v
retrieving revision 1.300.2.201
diff -u -r1.300.2.201 configure.in
--- configure.in 6 Jan 2004 15:41:32 -0000 1.300.2.201
+++ configure.in 6 Jan 2004 16:27:26 -0000
@@ -3121,8 +3121,9 @@
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 @@
# 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 <sys/quota.h> (IRIX) we should use it
AC_CACHE_CHECK([for XFS QUOTA in <sys/quota.h>],samba_cv_HAVE_SYS_QUOTA_XFS, [
AC_TRY_COMPILE([
@@ -3162,11 +3163,10 @@
],[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([
@@ -3284,6 +3284,27 @@
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
+ fi
+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
Index: lib/sysquotas_4A.c
===================================================================
RCS file: /cvsroot/samba/source/lib/Attic/sysquotas_4A.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 sysquotas_4A.c
--- lib/sysquotas_4A.c 6 Jan 2004 10:22:13 -0000 1.1.2.2
+++ lib/sysquotas_4A.c 6 Jan 2004 16:27:27 -0000
@@ -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
@@ -309,4 +309,6 @@
return ret;
}
+#else /* HAVE_QUOTACTL_4A */
+ void dummy_sysquotas_4A(void){}
#endif /* HAVE_QUOTACTL_4A */
Index: lib/sysquotas_linux.c
===================================================================
RCS file: /cvsroot/samba/source/lib/Attic/sysquotas_linux.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 sysquotas_linux.c
--- lib/sysquotas_linux.c 5 Jan 2004 21:03:12 -0000 1.1.2.1
+++ lib/sysquotas_linux.c 6 Jan 2004 16:27:28 -0000
@@ -312,9 +312,6 @@
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 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 @@
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 @@
return ret;
}
+#else /* HAVE_QUOTACTL_LINUX */
+ void dummy_sysquotas_linux(void){}
#endif /* HAVE_QUOTACTL_LINUX */
Index: lib/sysquotas_xfs.c
===================================================================
RCS file: /cvsroot/samba/source/lib/Attic/sysquotas_xfs.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 sysquotas_xfs.c
--- lib/sysquotas_xfs.c 5 Jan 2004 21:02:37 -0000 1.1.2.1
+++ lib/sysquotas_xfs.c 6 Jan 2004 16:27:28 -0000
@@ -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 @@
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 @@
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 @@
}
} 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 @@
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 @@
/* 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 @@
return ret;
}
-#endif /* HAVE_LINUX_XFS_QUOTA */
+#else /* HAVE_XFS_QUOTAS */
+ void dummy_sysquotas_xfs(void){}
+#endif /* HAVE_XFS_QUOTAS */
More information about the samba-technical
mailing list