dovecot-1.2: HP-UX: Fixed quota-fs compiling.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 12 01:35:24 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/c0ff3c147375
changeset: 7824:c0ff3c147375
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 12 00:18:23 2008 +0300
description:
HP-UX: Fixed quota-fs compiling.
diffstat:
2 files changed, 44 insertions(+), 5 deletions(-)
src/plugins/quota/quota-fs.c | 33 +++++++++++++++++++++++++++++++++
src/plugins/quota/quota-fs.h | 16 +++++++++++-----
diffs (84 lines):
diff -r b13dca205eaa -r c0ff3c147375 src/plugins/quota/quota-fs.c
--- a/src/plugins/quota/quota-fs.c Thu Jun 12 00:04:01 2008 +0300
+++ b/src/plugins/quota/quota-fs.c Thu Jun 12 00:18:23 2008 +0300
@@ -494,6 +494,35 @@ fs_quota_get_bsdaix(struct fs_quota_root
}
#endif
+#ifdef FS_QUOTA_HPUX
+static int
+fs_quota_get_hpux(struct fs_quota_root *root, bool bytes,
+ uint64_t *value_r, uint64_t *limit_r)
+{
+ struct dqblk dqblk;
+
+ if (quotactl(Q_GETQUOTA, root->mount->device_path,
+ root->uid, &dqblk) < 0) {
+ if (errno == ESRCH) {
+ root->user_disabled = TRUE;
+ return 0;
+ }
+ i_error("quotactl(Q_GETQUOTA, %s) failed: %m",
+ root->mount->device_path);
+ return -1;
+ }
+
+ if (bytes) {
+ *value_r = (uint64_t)dqblk.dqb_curblocks * DEV_BSIZE;
+ *limit_r = (uint64_t)dqblk.dqb_bsoftlimit * DEV_BSIZE;
+ } else {
+ *value_r = dqblk.dqb_curinodes;
+ *value_r = dqblk.dqb_isoftlimit;
+ }
+ return 1;
+}
+#endif
+
#ifdef FS_QUOTA_SOLARIS
static int
fs_quota_get_solaris(struct fs_quota_root *root, bool bytes,
@@ -543,7 +572,11 @@ fs_quota_get_one_resource(struct fs_quot
/* not supported */
return 0;
}
+#ifdef FS_QUOTA_HPUX
+ return fs_quota_get_hpux(root, bytes, value_r, limit_r);
+#else
return fs_quota_get_solaris(root, bytes, value_r, limit_r);
+#endif
#endif
}
diff -r b13dca205eaa -r c0ff3c147375 src/plugins/quota/quota-fs.h
--- a/src/plugins/quota/quota-fs.h Thu Jun 12 00:04:01 2008 +0300
+++ b/src/plugins/quota/quota-fs.h Thu Jun 12 00:18:23 2008 +0300
@@ -7,7 +7,7 @@
#endif
#ifdef HAVE_SYS_QUOTA_H
-# include <sys/quota.h> /* Linux */
+# include <sys/quota.h> /* Linux, HP-UX */
#elif defined(HAVE_SYS_FS_UFS_QUOTA_H)
# include <sys/fs/ufs_quota.h> /* Solaris */
#elif defined(HAVE_UFS_UFS_QUOTA_H)
@@ -18,10 +18,16 @@
# undef HAVE_FS_QUOTA
#endif
-#if defined (HAVE_QUOTACTL) && defined(HAVE_SYS_QUOTA_H)
-# define FS_QUOTA_LINUX
-#elif defined(HAVE_QUOTACTL)
-# define FS_QUOTA_BSDAIX
+#ifdef HAVE_QUOTACTL
+# ifdef HAVE_SYS_QUOTA_H
+# ifdef QCMD
+# define FS_QUOTA_LINUX
+# else
+# define FS_QUOTA_HPUX
+# endif
+# else
+# define FS_QUOTA_BSDAIX
+# endif
#elif defined (HAVE_Q_QUOTACTL)
# define FS_QUOTA_SOLARIS
#else
More information about the dovecot-cvs
mailing list