]> arthur.barton.de Git - netatalk.git/blob - libatalk/compat/rquota_xdr.c
NetBSD: Fix afpd startup script, from patch-bk,v 1.1
[netatalk.git] / libatalk / compat / rquota_xdr.c
1 /*
2  * $Id: rquota_xdr.c,v 1.4 2003-02-17 01:51:08 srittau Exp $
3  *
4  * taken from the quota-1.55 used on linux. here's the bsd copyright:
5  *
6  * Copyright (c) 1980, 1990 Regents of the University of California. All
7  * rights reserved.
8  *
9  * This code is derived from software contributed to Berkeley by Robert Elz at
10  * The University of Melbourne.
11  */
12
13 #ifdef HAVE_CONFIG_H
14 #include "config.h"
15 #endif /* HAVE_CONFIG_H */
16
17 #include <stdio.h> /* to get __GNU_LIBRARY__ */
18
19 /* list of machines that don't have these functions:
20         solaris
21         linux libc5
22 */
23 #if defined(NEED_RQUOTA) || defined(SOLARIS) || (defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ < 6)
24
25 #include <rpc/rpc.h>
26 #include <rpcsvc/rquota.h>
27
28 bool_t
29 xdr_getquota_args(xdrs, objp)
30         XDR *xdrs;
31         getquota_args *objp;
32 {
33         if (!xdr_string(xdrs, &objp->gqa_pathp, RQ_PATHLEN)) {
34                 return (FALSE);
35         }
36         if (!xdr_int(xdrs, &objp->gqa_uid)) {
37                 return (FALSE);
38         }
39         return (TRUE);
40 }
41
42
43 bool_t
44 xdr_rquota(xdrs, objp)
45         XDR *xdrs;
46         rquota *objp;
47 {
48         if (!xdr_int(xdrs, &objp->rq_bsize)) {
49                 return (FALSE);
50         }
51         if (!xdr_bool(xdrs, &objp->rq_active)) {
52                 return (FALSE);
53         }
54         if (!xdr_u_int(xdrs, &objp->rq_bhardlimit)) {
55                 return (FALSE);
56         }
57         if (!xdr_u_int(xdrs, &objp->rq_bsoftlimit)) {
58                 return (FALSE);
59         }
60         if (!xdr_u_int(xdrs, &objp->rq_curblocks)) {
61                 return (FALSE);
62         }
63         if (!xdr_u_int(xdrs, &objp->rq_fhardlimit)) {
64                 return (FALSE);
65         }
66         if (!xdr_u_int(xdrs, &objp->rq_fsoftlimit)) {
67                 return (FALSE);
68         }
69         if (!xdr_u_int(xdrs, &objp->rq_curfiles)) {
70                 return (FALSE);
71         }
72         if (!xdr_u_int(xdrs, &objp->rq_btimeleft)) {
73                 return (FALSE);
74         }
75         if (!xdr_u_int(xdrs, &objp->rq_ftimeleft)) {
76                 return (FALSE);
77         }
78         return (TRUE);
79 }
80
81
82
83
84 bool_t
85 xdr_gqr_status(xdrs, objp)
86         XDR *xdrs;
87         gqr_status *objp;
88 {
89         if (!xdr_enum(xdrs, (enum_t *)objp)) {
90                 return (FALSE);
91         }
92         return (TRUE);
93 }
94
95
96 bool_t
97 xdr_getquota_rslt(xdrs, objp)
98         XDR *xdrs;
99         getquota_rslt *objp;
100 {
101         if (!xdr_gqr_status(xdrs, &objp->status)) {
102                 return (FALSE);
103         }
104         switch (objp->status) {
105         case Q_OK:
106                 if (!xdr_rquota(xdrs, &objp->getquota_rslt_u.gqr_rquota)) {
107                         return (FALSE);
108                 }
109                 break;
110         case Q_NOQUOTA:
111                 break;
112         case Q_EPERM:
113                 break;
114         default:
115                 return (FALSE);
116         }
117         return (TRUE);
118 }
119 #endif