[dovecot-cvs] dovecot/src/plugins/quota quota-fs.c,1.15,1.16
cras at dovecot.org
cras at dovecot.org
Fri Jun 16 16:28:19 EEST 2006
- Previous message: [dovecot-cvs] dovecot/src/plugins/quota quota-fs.c, 1.14.2.1,
1.14.2.2
- Next message: [dovecot-cvs] dovecot/src/master auth-process.c, 1.95,
1.96 login-process.c, 1.74, 1.75 mail-process.c, 1.98,
1.99 main.c, 1.83, 1.84 master-settings.c, 1.127, 1.128
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/plugins/quota
In directory talvi:/tmp/cvs-serv10730/src/plugins/quota
Modified Files:
quota-fs.c
Log Message:
Added support for XFS disk quotas. Patch by Pawel Jarosz
Index: quota-fs.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-fs.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- quota-fs.c 11 Jun 2006 17:39:04 -0000 1.15
+++ quota-fs.c 16 Jun 2006 13:28:17 -0000 1.16
@@ -16,6 +16,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
+#ifdef HAVE_LINUX_DQBLK_XFS_H
+# include <linux/dqblk_xfs.h>
+#endif
#ifdef HAVE_STRUCT_DQBLK_CURSPACE
# define dqb_curblocks dqb_curspace
@@ -24,6 +27,7 @@
struct fs_quota_mountpoint {
char *mount_path;
char *device_path;
+ char *type;
unsigned int blk_size;
@@ -73,6 +77,7 @@
i_free(mount->device_path);
i_free(mount->mount_path);
+ i_free(mount->type);
i_free(mount);
}
@@ -100,7 +105,7 @@
mount->blk_size = point.block_size;
mount->device_path = point.device_path;
mount->mount_path = point.mount_path;
- i_free(point.type);
+ mount->type = point.type;
return mount;
}
@@ -182,15 +187,41 @@
if (strcasecmp(name, QUOTA_NAME_STORAGE) != 0 || root->mount == NULL)
return 0;
-#ifdef HAVE_QUOTACTL
- if (quotactl(
-#ifdef HAVE_SYS_QUOTA_H
- /* Linux */
- QCMD(Q_GETQUOTA, USRQUOTA), root->mount->device_path,
-#else
- /* BSD, AIX */
- root->mount->device_path, QCMD(Q_GETQUOTA, USRQUOTA),
+#if defined (HAVE_QUOTACTL) && defined(HAVE_SYS_QUOTA_H)
+ /* Linux */
+#ifdef HAVE_LINUX_DQBLK_XFS_H
+ if (strcmp(root->mount->type, "xfs") == 0) {
+ /* XFS */
+ struct fs_disk_quota xdqblk;
+
+ if (quotactl(QCMD(Q_XGETQUOTA, USRQUOTA),
+ root->mount->device_path,
+ root->uid, (void *)&xdqblk) < 0) {
+ i_error("quotactl(Q_XGETQUOTA, %s) failed: %m",
+ root->mount->device_path);
+ quota_set_error(_root->setup->quota,
+ "Internal quota error");
+ return -1;
+ }
+ dqblk.dqb_curblocks = xdqblk.d_bcount << 9;
+ dqblk.dqb_bsoftlimit = xdqblk.d_blk_softlimit >> 1;
+ } else
#endif
+ {
+ /* ext2, ext3 */
+ if (quotactl(QCMD(Q_GETQUOTA, USRQUOTA),
+ root->mount->device_path,
+ root->uid, (void *)&dqblk) < 0) {
+ i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
+ root->mount->device_path);
+ quota_set_error(_root->setup->quota,
+ "Internal quota error");
+ return -1;
+ }
+ }
+#elif defined(HAVE_QUOTACTL)
+ /* BSD, AIX */
+ if (quotactl(root->mount->device_path, QCMD(Q_GETQUOTA, USRQUOTA),
root->uid, (void *)&dqblk) < 0) {
i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
root->mount->device_path);
- Previous message: [dovecot-cvs] dovecot/src/plugins/quota quota-fs.c, 1.14.2.1,
1.14.2.2
- Next message: [dovecot-cvs] dovecot/src/master auth-process.c, 1.95,
1.96 login-process.c, 1.74, 1.75 mail-process.c, 1.98,
1.99 main.c, 1.83, 1.84 master-settings.c, 1.127, 1.128
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list