summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-07-05 11:06:09 +1000
committerNeil Brown <neilb@suse.de>2006-07-05 11:06:09 +1000
commit66f9d8251c92124e46a209c47e5c0f7d3a0c4e6e (patch)
tree8c8563a241fa116863fc4257a4db96efd83fe36c
parent9f5b40b7a68fe0a2648565ecbd4b08bf60287130 (diff)
downloadnfs-utils-66f9d8251c92124e46a209c47e5c0f7d3a0c4e6e.tar.gz
nfs-utils-66f9d8251c92124e46a209c47e5c0f7d3a0c4e6e.tar.xz
nfs-utils-66f9d8251c92124e46a209c47e5c0f7d3a0c4e6e.zip
Generate rquota_xdr.c and rquota.h from rquota.x
rquota_svc.c is still by-hand as it contains alot of extras. These should really be moved to rquota_server.c
-rw-r--r--utils/rquotad/Makefile.am19
-rw-r--r--utils/rquotad/rquota.h64
-rw-r--r--utils/rquotad/rquota_server.c8
-rw-r--r--utils/rquotad/rquota_svc.c17
-rw-r--r--utils/rquotad/rquota_xdr.c125
5 files changed, 27 insertions, 206 deletions
diff --git a/utils/rquotad/Makefile.am b/utils/rquotad/Makefile.am
index 8e3e634..0883793 100644
--- a/utils/rquotad/Makefile.am
+++ b/utils/rquotad/Makefile.am
@@ -1,5 +1,11 @@
## Process this file with automake to produce Makefile.in
+RPCGEN = $(top_builddir)/tools/rpcgen/rpcgen
+
+GENFILES_XDR = rquota_xdr.c
+GENFILES_H = rquota.h
+
+GENFILES = $(GENFILES_XDR) $(GENFILES_H)
man8_MANS = rquotad.man
RPCPREFIX = rpc.
@@ -19,6 +25,19 @@ rquotad_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \
MAINTAINERCLEANFILES = Makefile.in
+
+$(RPCGEN):
+ make -C $(top_srcdir)/tools/rpcgen all
+
+$(GENFILES_XDR): %_xdr.c: %.x $(RPCGEN)
+ test -f $@ && rm -rf $@ || true
+ $(RPCGEN) -c -o $@ $<
+
+
+$(GENFILES_H): %.h: %.x $(RPCGEN)
+ test -f $@ && rm -rf $@ || true
+ $(RPCGEN) -h -o $@ $<
+
#######################################################################
# The following allows the current practice of having
# daemons renamed during the install to include RPCPREFIX
diff --git a/utils/rquotad/rquota.h b/utils/rquotad/rquota.h
deleted file mode 100644
index f81e732..0000000
--- a/utils/rquotad/rquota.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#define RQ_PATHLEN 1024
-
-struct getquota_args {
- char *gqa_pathp;
- int gqa_uid;
-};
-typedef struct getquota_args getquota_args;
-bool_t xdr_getquota_args();
-
-
-struct ext_getquota_args {
- char *gqa_pathp;
- int gqa_type;
- int gqa_id;
-};
-typedef struct ext_getquota_args ext_getquota_args;
-bool_t xdr_ext_getquota_args();
-
-
-struct rquota {
- int rq_bsize;
- bool_t rq_active;
- u_int rq_bhardlimit;
- u_int rq_bsoftlimit;
- u_int rq_curblocks;
- u_int rq_fhardlimit;
- u_int rq_fsoftlimit;
- u_int rq_curfiles;
- u_int rq_btimeleft;
- u_int rq_ftimeleft;
-};
-typedef struct rquota rquota;
-bool_t xdr_rquota();
-
-
-enum gqr_status {
- Q_OK = 1,
- Q_NOQUOTA = 2,
- Q_EPERM = 3,
-};
-typedef enum gqr_status gqr_status;
-bool_t xdr_gqr_status();
-
-
-struct getquota_rslt {
- gqr_status status;
- union {
- rquota gqr_rquota;
- } getquota_rslt_u;
-};
-typedef struct getquota_rslt getquota_rslt;
-bool_t xdr_getquota_rslt();
-
-
-#define RQUOTAPROG ((u_long)100011)
-#define RQUOTAVERS ((u_long)1)
-#define RQUOTAPROC_GETQUOTA ((u_long)1)
-extern getquota_rslt *rquotaproc_getquota_1();
-#define RQUOTAPROC_GETACTIVEQUOTA ((u_long)2)
-extern getquota_rslt *rquotaproc_getactivequota_1();
-#define EXT_RQUOTAVERS ((u_long)2)
-extern getquota_rslt *rquotaproc_getquota_2();
-extern getquota_rslt *rquotaproc_getactivequota_2();
-
diff --git a/utils/rquotad/rquota_server.c b/utils/rquotad/rquota_server.c
index e3715bd..f8bd8f1 100644
--- a/utils/rquotad/rquota_server.c
+++ b/utils/rquotad/rquota_server.c
@@ -262,22 +262,22 @@ getquota_rslt *getquotainfo(int flags, caddr_t *argp, struct svc_req *rqstp)
return(&result);
}
-getquota_rslt *rquotaproc_getquota_1(getquota_args *argp, struct svc_req *rqstp)
+getquota_rslt *rquotaproc_getquota_1_svc(getquota_args *argp, struct svc_req *rqstp)
{
return(getquotainfo(0, (caddr_t *)argp, rqstp));
}
-getquota_rslt *rquotaproc_getactivequota_1(getquota_args *argp, struct svc_req *rqstp)
+getquota_rslt *rquotaproc_getactivequota_1_svc(getquota_args *argp, struct svc_req *rqstp)
{
return(getquotainfo(ACTIVE, (caddr_t *)argp, rqstp));
}
-getquota_rslt *rquotaproc_getquota_2(ext_getquota_args *argp, struct svc_req *rqstp)
+getquota_rslt *rquotaproc_getquota_2_svc(ext_getquota_args *argp, struct svc_req *rqstp)
{
return(getquotainfo(TYPE_EXTENDED, (caddr_t *)argp, rqstp));
}
-getquota_rslt *rquotaproc_getactivequota_2(ext_getquota_args *argp, struct svc_req *rqstp)
+getquota_rslt *rquotaproc_getactivequota_2_svc(ext_getquota_args *argp, struct svc_req *rqstp)
{
return(getquotainfo(TYPE_EXTENDED | ACTIVE, (caddr_t *)argp, rqstp));
}
diff --git a/utils/rquotad/rquota_svc.c b/utils/rquotad/rquota_svc.c
index 0785551..bd2038f 100644
--- a/utils/rquotad/rquota_svc.c
+++ b/utils/rquotad/rquota_svc.c
@@ -47,15 +47,6 @@
#define SIG_PF void(*)(int)
#endif
-extern getquota_rslt *rquotaproc_getquota_1(getquota_args *argp,
- struct svc_req *rqstp);
-extern getquota_rslt *rquotaproc_getactivequota_1(getquota_args *argp,
- struct svc_req *rqstp);
-extern getquota_rslt *rquotaproc_getquota_2(ext_getquota_args *argp,
- struct svc_req *rqstp);
-extern getquota_rslt *rquotaproc_getactivequota_2(ext_getquota_args *argp,
- struct svc_req *rqstp);
-
static struct option longopts[] =
{
{ "help", 0, 0, 'h' },
@@ -113,13 +104,13 @@ static void rquotaprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
case RQUOTAPROC_GETQUOTA:
xdr_argument = (xdrproc_t) xdr_getquota_args;
xdr_result = (xdrproc_t) xdr_getquota_rslt;
- local = (char *(*)(char *, struct svc_req *)) rquotaproc_getquota_1;
+ local = (char *(*)(char *, struct svc_req *)) rquotaproc_getquota_1_svc;
break;
case RQUOTAPROC_GETACTIVEQUOTA:
xdr_argument = (xdrproc_t) xdr_getquota_args;
xdr_result = (xdrproc_t) xdr_getquota_rslt;
- local = (char *(*)(char *, struct svc_req *)) rquotaproc_getactivequota_1;
+ local = (char *(*)(char *, struct svc_req *)) rquotaproc_getactivequota_1_svc;
break;
default:
@@ -188,13 +179,13 @@ static void rquotaprog_2(struct svc_req *rqstp, register SVCXPRT *transp)
case RQUOTAPROC_GETQUOTA:
xdr_argument = (xdrproc_t) xdr_ext_getquota_args;
xdr_result = (xdrproc_t) xdr_getquota_rslt;
- local = (char *(*)(char *, struct svc_req *)) rquotaproc_getquota_2;
+ local = (char *(*)(char *, struct svc_req *)) rquotaproc_getquota_2_svc;
break;
case RQUOTAPROC_GETACTIVEQUOTA:
xdr_argument = (xdrproc_t) xdr_ext_getquota_args;
xdr_result = (xdrproc_t) xdr_getquota_rslt;
- local = (char *(*)(char *, struct svc_req *)) rquotaproc_getactivequota_2;
+ local = (char *(*)(char *, struct svc_req *)) rquotaproc_getactivequota_2_svc;
break;
default:
diff --git a/utils/rquotad/rquota_xdr.c b/utils/rquotad/rquota_xdr.c
deleted file mode 100644
index 46eb1e1..0000000
--- a/utils/rquotad/rquota_xdr.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <rpc/rpc.h>
-#include "rquota.h"
-
-
-bool_t
-xdr_getquota_args(xdrs, objp)
- XDR *xdrs;
- getquota_args *objp;
-{
- if (!xdr_string(xdrs, &objp->gqa_pathp, RQ_PATHLEN)) {
- return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->gqa_uid)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_ext_getquota_args(xdrs, objp)
- XDR *xdrs;
- ext_getquota_args *objp;
-{
- if (!xdr_string(xdrs, &objp->gqa_pathp, RQ_PATHLEN)) {
- return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->gqa_type)) {
- return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->gqa_id)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_rquota(xdrs, objp)
- XDR *xdrs;
- rquota *objp;
-{
- if (!xdr_int(xdrs, &objp->rq_bsize)) {
- return (FALSE);
- }
- if (!xdr_bool(xdrs, &objp->rq_active)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_bhardlimit)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_bsoftlimit)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_curblocks)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_fhardlimit)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_fsoftlimit)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_curfiles)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_btimeleft)) {
- return (FALSE);
- }
- if (!xdr_u_int(xdrs, &objp->rq_ftimeleft)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_gqr_status(xdrs, objp)
- XDR *xdrs;
- gqr_status *objp;
-{
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_getquota_rslt(xdrs, objp)
- XDR *xdrs;
- getquota_rslt *objp;
-{
- if (!xdr_gqr_status(xdrs, &objp->status)) {
- return (FALSE);
- }
- switch (objp->status) {
- case Q_OK:
- if (!xdr_rquota(xdrs, &objp->getquota_rslt_u.gqr_rquota)) {
- return (FALSE);
- }
- break;
- case Q_NOQUOTA:
- break;
- case Q_EPERM:
- break;
- default:
- return (FALSE);
- }
- return (TRUE);
-}
-
-