From: Timo Sirainen Date: Wed, 11 Jun 2008 21:18:23 +0000 (+0300) Subject: HP-UX: Fixed quota-fs compiling. X-Git-Tag: 1.2.alpha1~337 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=45031ba153608eb33af22ee0d242c3e5e426486d;p=thirdparty%2Fdovecot%2Fcore.git HP-UX: Fixed quota-fs compiling. --HG-- branch : HEAD --- diff --git a/src/plugins/quota/quota-fs.c b/src/plugins/quota/quota-fs.c index 5944a20aab..b27f51f209 100644 --- a/src/plugins/quota/quota-fs.c +++ b/src/plugins/quota/quota-fs.c @@ -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 diff --git a/src/plugins/quota/quota-fs.h b/src/plugins/quota/quota-fs.h index fd19f5c438..4974440122 100644 --- a/src/plugins/quota/quota-fs.h +++ b/src/plugins/quota/quota-fs.h @@ -7,7 +7,7 @@ #endif #ifdef HAVE_SYS_QUOTA_H -# include /* Linux */ +# include /* Linux, HP-UX */ #elif defined(HAVE_SYS_FS_UFS_QUOTA_H) # include /* 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