[dovecot-cvs] dovecot/src/plugins/quota quota-fs.c, 1.20, 1.21 quota-fs.h, 1.6, 1.7

cras at dovecot.org cras at dovecot.org
Thu Aug 3 01:39:53 EEST 2006


Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv22312/src/plugins/quota

Modified Files:
	quota-fs.c quota-fs.h 
Log Message:
Added --with-linux-quota configure option to specify which Linux quota
version to use. Don't bother looking into struct dqblk to see if curblocks
or curspace field exists, we can figure it out from the quota version. If
quotactl() returns EINVAL, it could have been because wrong quota version
was used, so give a friendly message suggesting to look at
--with-linux-quota.



Index: quota-fs.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-fs.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- quota-fs.c	30 Jul 2006 18:32:07 -0000	1.20
+++ quota-fs.c	2 Aug 2006 22:39:50 -0000	1.21
@@ -20,14 +20,16 @@
 #  include <linux/dqblk_xfs.h>
 #endif
 
-#ifdef HAVE_STRUCT_DQBLK_CURSPACE
-#  define dqb_curblocks dqb_curspace
-#endif
-
 #ifndef DEV_BSIZE
 #  define DEV_BSIZE 512
 #endif
 
+/* This most likely should have been defined by above headers already, but
+   in case some OS has less than perfect emulation lets try to handle it. */
+#ifndef _LINUX_QUOTA_VERSION
+#  define _LINUX_QUOTA_VERSION 2
+#endif
+
 struct fs_quota_mountpoint {
 	char *mount_path;
 	char *device_path;
@@ -222,10 +224,20 @@
 			     root->uid, (caddr_t)&dqblk) < 0) {
 			i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
 				root->mount->device_path);
+			if (errno == EINVAL) {
+				i_error("Dovecot was compiled with Linux quota "
+					"v%d support, try changing it "
+					"(--with-linux-quota configure option)",
+					_LINUX_QUOTA_VERSION);
+			}
 			return -1;
 		}
 
+#if _LINUX_QUOTA_VERSION < 2
 		*value_r = dqblk.dqb_curblocks / 1024;
+#else
+		*value_r = dqblk.dqb_curspace / 1024;
+#endif
 		*limit_r = dqblk.dqb_bsoftlimit;
 	}
 #elif defined(HAVE_QUOTACTL)

Index: quota-fs.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-fs.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- quota-fs.h	14 Apr 2006 10:27:20 -0000	1.6
+++ quota-fs.h	2 Aug 2006 22:39:50 -0000	1.7
@@ -1,10 +1,7 @@
 #ifndef __QUOTA_FS_H
 #define __QUOTA_FS_H
 
-#if defined (HAVE_STRUCT_DQBLK_CURBLOCKS) || \
-	defined (HAVE_STRUCT_DQBLK_CURSPACE)
-#  define HAVE_FS_QUOTA
-#endif
+#define HAVE_FS_QUOTA
 
 #ifdef HAVE_SYS_QUOTA_H
 #  include <sys/quota.h> /* Linux */



More information about the dovecot-cvs mailing list