changeset 7824:c0ff3c147375 HEAD

HP-UX: Fixed quota-fs compiling.
author Timo Sirainen <tss@iki.fi>
date Thu, 12 Jun 2008 00:18:23 +0300
parents b13dca205eaa
children 0307382cf011
files src/plugins/quota/quota-fs.c src/plugins/quota/quota-fs.h
diffstat 2 files changed, 44 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 }
 #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,8 +572,12 @@
 		/* 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
 }
 
 static int
--- 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