diff options
author | Björn Jacke <bj@sernet.de> | 2012-09-07 17:35:41 +0200 |
---|---|---|
committer | Björn Jacke <bj@sernet.de> | 2012-09-07 17:56:08 +0200 |
commit | abf98e32899194f6b8ce603e80596f39fee5cc2b (patch) | |
tree | d2ed2ec4b71964fa7a17ef85cbe1a7fcb8916daa | |
parent | 0c0441bd4550adb864baa0c36a201d273a24b75e (diff) | |
download | samba-abf98e32899194f6b8ce603e80596f39fee5cc2b.tar.gz samba-abf98e32899194f6b8ce603e80596f39fee5cc2b.tar.bz2 samba-abf98e32899194f6b8ce603e80596f39fee5cc2b.zip |
s3:sysquota_nfs: fix build on Tru64 et alii
the old Unix world put the struct rquota directly into the getquota_rslt
struct, the new Unix world puts a getquota_rslt_u union in between and they
decided to rename the status struct member.
-rw-r--r-- | source3/configure.in | 3 | ||||
-rw-r--r-- | source3/lib/sysquotas_nfs.c | 54 |
2 files changed, 34 insertions, 23 deletions
diff --git a/source3/configure.in b/source3/configure.in index 0bae24bead..8495a1f582 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -4672,6 +4672,9 @@ AC_TRY_COMPILE([ if test x"$samba_cv_HAVE_NFS_QUOTAS" = x"yes"; then AC_DEFINE(HAVE_NFS_QUOTAS,1,[NFS quota support is available]) + AC_CHECK_MEMBER(struct getquota_rslt.getquota_rslt_u, + AC_DEFINE(HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U, 1, [Defined if struct getquota_rslt has getquota_rslt_u]),, + [#include <rpcsvc/rquota.h>]) fi ################################################# diff --git a/source3/lib/sysquotas_nfs.c b/source3/lib/sysquotas_nfs.c index 043ab9f612..6f8713725d 100644 --- a/source3/lib/sysquotas_nfs.c +++ b/source3/lib/sysquotas_nfs.c @@ -44,6 +44,14 @@ #endif #include <rpc/xdr.h> +#ifdef HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U +#define GQR_RQUOTA getquota_rslt_u.gqr_rquota +#define GQR_STATUS status +#else +#define GQR_RQUOTA gqr_rquota +#define GQR_STATUS gqr_status +#endif + static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args) { if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN )) @@ -63,23 +71,23 @@ static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr) } gqr->status = quotastat; - if (!xdr_int(xdrsp, &gqr->getquota_rslt_u.gqr_rquota.rq_bsize)) { + if (!xdr_int(xdrsp, &gqr->GQR_RQUOTA.rq_bsize)) { DEBUG(6,("nfs_quotas: Block size bad or zero\n")); return 0; } - if (!xdr_bool(xdrsp, &gqr->getquota_rslt_u.gqr_rquota.rq_active)) { + if (!xdr_bool(xdrsp, &gqr->GQR_RQUOTA.rq_active)) { DEBUG(6,("nfs_quotas: Active bad or zero\n")); return 0; } - if (!xdr_int(xdrsp, (int *)&gqr->getquota_rslt_u.gqr_rquota.rq_bhardlimit)) { + if (!xdr_int(xdrsp, (int *)&gqr->GQR_RQUOTA.rq_bhardlimit)) { DEBUG(6,("nfs_quotas: Hardlimit bad or zero\n")); return 0; } - if (!xdr_int(xdrsp, (int *)&gqr->getquota_rslt_u.gqr_rquota.rq_bsoftlimit)) { + if (!xdr_int(xdrsp, (int *)&gqr->GQR_RQUOTA.rq_bsoftlimit)) { DEBUG(6,("nfs_quotas: Softlimit bad or zero\n")); return 0; } - if (!xdr_int(xdrsp, (int *)&gqr->getquota_rslt_u.gqr_rquota.rq_curblocks)) { + if (!xdr_int(xdrsp, (int *)&gqr->GQR_RQUOTA.rq_curblocks)) { DEBUG(6,("nfs_quotas: Currentblocks bad or zero\n")); return 0; } @@ -186,17 +194,17 @@ int sys_get_nfs_quota(const char *path, const char *bdev, "curfiles : '%u'\n" "btimeleft : '%u'\n" "ftimeleft : '%u'\n", - gq_rslt.status, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_active?"yes":"no", - gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft, - gq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft)); + gq_rslt.GQR_STATUS, + gq_rslt.GQR_RQUOTA.rq_bsize, + gq_rslt.GQR_RQUOTA.rq_active?"yes":"no", + gq_rslt.GQR_RQUOTA.rq_bhardlimit, + gq_rslt.GQR_RQUOTA.rq_bsoftlimit, + gq_rslt.GQR_RQUOTA.rq_curblocks, + gq_rslt.GQR_RQUOTA.rq_fhardlimit, + gq_rslt.GQR_RQUOTA.rq_fsoftlimit, + gq_rslt.GQR_RQUOTA.rq_curfiles, + gq_rslt.GQR_RQUOTA.rq_btimeleft, + gq_rslt.GQR_RQUOTA.rq_ftimeleft)); /* * gqr.status returns @@ -206,19 +214,19 @@ int sys_get_nfs_quota(const char *path, const char *bdev, * 3 if no permission to get the quota. */ - switch (gq_rslt.status) { + switch (gq_rslt.GQR_STATUS) { case 0: DEBUG(3, ("sys_get_nfs_quotas: Remote Quotas Failed! " - "Error '%i'\n", gq_rslt.status)); + "Error '%i'\n", gq_rslt.GQR_STATUS)); ret = -1; goto out; case 1: DEBUG(10, ("sys_get_nfs_quotas: Good quota data\n")); - dp->bsize = (uint64_t)gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize; - dp->softlimit = gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit; - dp->hardlimit = gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit; - dp->curblocks = gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks; + dp->bsize = (uint64_t)gq_rslt.GQR_RQUOTA.rq_bsize; + dp->softlimit = gq_rslt.GQR_RQUOTA.rq_bsoftlimit; + dp->hardlimit = gq_rslt.GQR_RQUOTA.rq_bhardlimit; + dp->curblocks = gq_rslt.GQR_RQUOTA.rq_curblocks; break; case 2: @@ -234,7 +242,7 @@ int sys_get_nfs_quota(const char *path, const char *bdev, default: DEBUG(5, ("sys_get_nfs_quotas: Unknown remote quota status " - "code '%i'\n", gq_rslt.status)); + "code '%i'\n", gq_rslt.GQR_STATUS)); ret = -1; goto out; break; |