1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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.
This commit is contained in:
Björn Jacke 2012-09-07 17:35:41 +02:00
parent 0c0441bd45
commit abf98e3289
2 changed files with 34 additions and 23 deletions

View File

@ -4672,6 +4672,9 @@ AC_TRY_COMPILE([
if test x"$samba_cv_HAVE_NFS_QUOTAS" = x"yes"; then if test x"$samba_cv_HAVE_NFS_QUOTAS" = x"yes"; then
AC_DEFINE(HAVE_NFS_QUOTAS,1,[NFS quota support is available]) 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 fi
################################################# #################################################

View File

@ -44,6 +44,14 @@
#endif #endif
#include <rpc/xdr.h> #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) static int my_xdr_getquota_args(XDR *xdrsp, struct getquota_args *args)
{ {
if (!xdr_string(xdrsp, &args->gqa_pathp, RQ_PATHLEN )) 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; 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")); DEBUG(6,("nfs_quotas: Block size bad or zero\n"));
return 0; 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")); DEBUG(6,("nfs_quotas: Active bad or zero\n"));
return 0; 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")); DEBUG(6,("nfs_quotas: Hardlimit bad or zero\n"));
return 0; 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")); DEBUG(6,("nfs_quotas: Softlimit bad or zero\n"));
return 0; 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")); DEBUG(6,("nfs_quotas: Currentblocks bad or zero\n"));
return 0; return 0;
} }
@ -186,17 +194,17 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
"curfiles : '%u'\n" "curfiles : '%u'\n"
"btimeleft : '%u'\n" "btimeleft : '%u'\n"
"ftimeleft : '%u'\n", "ftimeleft : '%u'\n",
gq_rslt.status, gq_rslt.GQR_STATUS,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize, gq_rslt.GQR_RQUOTA.rq_bsize,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_active?"yes":"no", gq_rslt.GQR_RQUOTA.rq_active?"yes":"no",
gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit, gq_rslt.GQR_RQUOTA.rq_bhardlimit,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit, gq_rslt.GQR_RQUOTA.rq_bsoftlimit,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks, gq_rslt.GQR_RQUOTA.rq_curblocks,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit, gq_rslt.GQR_RQUOTA.rq_fhardlimit,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit, gq_rslt.GQR_RQUOTA.rq_fsoftlimit,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles, gq_rslt.GQR_RQUOTA.rq_curfiles,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft, gq_rslt.GQR_RQUOTA.rq_btimeleft,
gq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft)); gq_rslt.GQR_RQUOTA.rq_ftimeleft));
/* /*
* gqr.status returns * 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. * 3 if no permission to get the quota.
*/ */
switch (gq_rslt.status) { switch (gq_rslt.GQR_STATUS) {
case 0: case 0:
DEBUG(3, ("sys_get_nfs_quotas: Remote Quotas Failed! " DEBUG(3, ("sys_get_nfs_quotas: Remote Quotas Failed! "
"Error '%i'\n", gq_rslt.status)); "Error '%i'\n", gq_rslt.GQR_STATUS));
ret = -1; ret = -1;
goto out; goto out;
case 1: case 1:
DEBUG(10, ("sys_get_nfs_quotas: Good quota data\n")); DEBUG(10, ("sys_get_nfs_quotas: Good quota data\n"));
dp->bsize = (uint64_t)gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize; dp->bsize = (uint64_t)gq_rslt.GQR_RQUOTA.rq_bsize;
dp->softlimit = gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit; dp->softlimit = gq_rslt.GQR_RQUOTA.rq_bsoftlimit;
dp->hardlimit = gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit; dp->hardlimit = gq_rslt.GQR_RQUOTA.rq_bhardlimit;
dp->curblocks = gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks; dp->curblocks = gq_rslt.GQR_RQUOTA.rq_curblocks;
break; break;
case 2: case 2:
@ -234,7 +242,7 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
default: default:
DEBUG(5, ("sys_get_nfs_quotas: Unknown remote quota status " 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; ret = -1;
goto out; goto out;
break; break;