]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
HP-UX: Fixed quota-fs compiling.
authorTimo Sirainen <tss@iki.fi>
Wed, 11 Jun 2008 21:18:23 +0000 (00:18 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 11 Jun 2008 21:18:23 +0000 (00:18 +0300)
--HG--
branch : HEAD

src/plugins/quota/quota-fs.c
src/plugins/quota/quota-fs.h

index 5944a20aab69ecbcf06f8c230a68e064c114ff1f..b27f51f209f056fe3ad942e2fc0d2b78cb45fa55 100644 (file)
@@ -494,6 +494,35 @@ fs_quota_get_bsdaix(struct fs_quota_root *root, bool group, bool bytes,
 }
 #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 @@ fs_quota_get_one_resource(struct fs_quota_root *root, bool group, bool bytes,
                /* 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
index fd19f5c43883cf76eab157eba5cb7d1d50a944ad..4974440122511910d63a0a8f3246057d59746e27 100644 (file)
@@ -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)
 #  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