[PATCH] support quota on Solaris 10
Uri Simchoni
uri at samba.org
Sun Mar 13 05:35:28 UTC 2016
On 03/12/2016 11:19 PM, Jeremy Allison wrote:
>
> The #ifdef's in here are an utter rats nest though :-).
>
> Maybe a follow up patch could add comments before the
> #else and #endif tags so engineers can see which #ifdef
> they're referring to.
>
You mean something like this?
Yeah the #ifdefs are quite puzzling, but I wanted to maintain the
original file structure.
I did some digging to make sensible comments and it seems like we can
delete the SunOS4 and Solaris 2 parts. That would simplify things a bit,
and maybe also the AIX parts (b/c AIX 4.x and 5.x are beyond end-of
support - the latest AIX effort, backed by IBM, should implement the new
quota interface).
Thanks,
Uri.
-------------- next part --------------
>From e326e9da199cbe45fc7b5f225f7e3408fe735a46 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Sun, 13 Mar 2016 07:17:23 +0200
Subject: [PATCH] build: improve comments in tests/oldquotas.c
Add comments to #else and #endif
Signed-off-by: Uri Simchoni <uri at samba.org>
---
tests/oldquotas.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/tests/oldquotas.c b/tests/oldquotas.c
index bdb2beb..0aacf23 100644
--- a/tests/oldquotas.c
+++ b/tests/oldquotas.c
@@ -8,11 +8,11 @@
/* just a quick hack because sysquotas.h is included before linux/quota.h */
#ifdef QUOTABLOCK_SIZE
#undef QUOTABLOCK_SIZE
-#endif
+#endif /* defined(QUOTABLOCK_SIZE) */
#ifdef WITH_QUOTAS
-#if defined(VXFS_QUOTA)
+#if defined(VXFS_QUOTA) /* Veritas VxFS for Solaris 2 */
bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
uint64_t *dfree, uint64_t *dsize);
@@ -23,16 +23,16 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
#include <fcntl.h>
#include <sys/param.h>
-#if defined(SUNOS5)
+#if defined(SUNOS5) /* Solaris */
#include <sys/fs/ufs_quota.h>
#include <sys/mnttab.h>
#include <sys/mntent.h>
-#else /* defined(SUNOS4) */
+#else /* SunOS4 */
#include <ufs/quota.h>
#include <mntent.h>
-#endif
+#endif /* Solaris */
-#if defined(SUNOS5)
+#if defined(SUNOS5) /* Solaris */
/****************************************************************************
Allows querying of remote hosts for quotas on NFS mounted shares.
@@ -53,7 +53,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize,
clnt = clnt_create("host", RQUOTAPROG, RQUOTAVERS, "udp");
return true;
}
-#endif
+#endif /* Solaris */
/****************************************************************************
try to get the disk space from disk quotas (SunOS & Solaris2 version)
@@ -64,29 +64,29 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
uint64_t *dsize)
{
int ret;
-#if defined(SUNOS5)
+#if defined(SUNOS5) /* Solaris */
struct quotctl command;
#else /* SunOS4 */
struct mntent *mnt;
-#endif
-#if defined(SUNOS5)
+#endif /* Solaris */
+#if defined(SUNOS5) /* Solaris */
nfs_quotas("", 0, bsize, dfree, dsize);
command.op = Q_GETQUOTA;
command.uid = 0;
command.addr = NULL;
ret = ioctl(1, Q_QUOTACTL, &command);
-#else
+#else /* SunOS4 */
ret = quotactl(Q_GETQUOTA, "", 0, NULL);
-#endif
+#endif /* Solaris */
-#if defined(SUNOS5) && defined(VXFS_QUOTA)
+#if defined(SUNOS5) && defined(VXFS_QUOTA) /* Solaris 2 VxFS */
disk_quotas_vxfs("", path, bsize, dfree, dsize);
-#endif
+#endif /* Solaris 2 VxFS */
return true;
}
-#else
+#else /* not SunOS / Solaris */
#if AIX
/* AIX quota patch from Ole Holm Nielsen <ohnielse at fysik.dtu.dk> */
@@ -99,10 +99,10 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
#include <sys/statfs.h>
#include <sys/vmount.h>
#endif /* AIX 5.3 */
-#else /* !AIX */
+#else /* !AIX - HP-UX */
#include <sys/quota.h>
#include <devnm.h>
-#endif
+#endif /* AIX */
/****************************************************************************
try to get the disk space from disk quotas - default version
@@ -124,9 +124,9 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
return (true);
}
-#endif
+#endif /* SunOS / Solaris */
-#if defined(VXFS_QUOTA)
+#if defined(VXFS_QUOTA) /* Veritas for Solaris 2 */
#if defined(SUNOS5)
@@ -155,7 +155,7 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
return true;
}
-#endif /* SUNOS5 || ... */
+#endif /* SUNOS5 */
#endif /* VXFS_QUOTA */
--
2.5.0
More information about the samba-technical
mailing list