]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Generate rquota_xdr.c and rquota.h from rquota.x
authorNeil Brown <neilb@suse.de>
Wed, 5 Jul 2006 01:06:09 +0000 (11:06 +1000)
committerNeil Brown <neilb@suse.de>
Wed, 5 Jul 2006 01:06:09 +0000 (11:06 +1000)
rquota_svc.c is still by-hand as it contains alot of extras.
These should really be moved to rquota_server.c

utils/rquotad/Makefile.am
utils/rquotad/rquota.h [deleted file]
utils/rquotad/rquota_server.c
utils/rquotad/rquota_svc.c
utils/rquotad/rquota_xdr.c [deleted file]

index 8e3e634ab8ecb62c07a6d4a152847f295b57b2a5..08837939618cea13baa8b065155b5417dc95cf44 100644 (file)
@@ -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 (file)
index f81e732..0000000
+++ /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();
-
index e3715bd933a0769be9f7f9284c73baebe8f7641c..f8bd8f18ab956f1fe47ff3b568f75ecc0c5aeda7 100644 (file)
@@ -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));
 }
index 0785551472aa6e1f3f8109b814b321347c709e44..bd2038f2710476a605458c160f57f3f1268c60bf 100644 (file)
 #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 (file)
index 46eb1e1..0000000
+++ /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);
-}
-
-