# HG changeset patch # User Timo Sirainen # Date 1213219103 -10800 # Node ID c0ff3c147375e1aecaebd9bd3865b75a6282dc72 # Parent b13dca205eaa177c92bc5e211406c0ad6acd1b4d HP-UX: Fixed quota-fs compiling. 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 @@ } #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 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 /* 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