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(sun) && defined(__svr4__)) || \ 24(defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ < 6) 25 26#include <rpc/rpc.h> 27#include <rpcsvc/rquota.h> 28 29bool_t 30xdr_getquota_args(xdrs, objp) 31 XDR *xdrs; 32 getquota_args *objp; 33{ 34 if (!xdr_string(xdrs, &objp->gqa_pathp, RQ_PATHLEN)) { 35 return (FALSE); 36 } 37 if (!xdr_int(xdrs, &objp->gqa_uid)) { 38 return (FALSE); 39 } 40 return (TRUE); 41} 42 43 44bool_t 45xdr_rquota(xdrs, objp) 46 XDR *xdrs; 47 rquota *objp; 48{ 49 if (!xdr_int(xdrs, &objp->rq_bsize)) { 50 return (FALSE); 51 } 52 if (!xdr_bool(xdrs, &objp->rq_active)) { 53 return (FALSE); 54 } 55 if (!xdr_u_int(xdrs, &objp->rq_bhardlimit)) { 56 return (FALSE); 57 } 58 if (!xdr_u_int(xdrs, &objp->rq_bsoftlimit)) { 59 return (FALSE); 60 } 61 if (!xdr_u_int(xdrs, &objp->rq_curblocks)) { 62 return (FALSE); 63 } 64 if (!xdr_u_int(xdrs, &objp->rq_fhardlimit)) { 65 return (FALSE); 66 } 67 if (!xdr_u_int(xdrs, &objp->rq_fsoftlimit)) { 68 return (FALSE); 69 } 70 if (!xdr_u_int(xdrs, &objp->rq_curfiles)) { 71 return (FALSE); 72 } 73 if (!xdr_u_int(xdrs, &objp->rq_btimeleft)) { 74 return (FALSE); 75 } 76 if (!xdr_u_int(xdrs, &objp->rq_ftimeleft)) { 77 return (FALSE); 78 } 79 return (TRUE); 80} 81 82 83 84 85bool_t 86xdr_gqr_status(xdrs, objp) 87 XDR *xdrs; 88 gqr_status *objp; 89{ 90 if (!xdr_enum(xdrs, (enum_t *)objp)) { 91 return (FALSE); 92 } 93 return (TRUE); 94} 95 96 97bool_t 98xdr_getquota_rslt(xdrs, objp) 99 XDR *xdrs; 100 getquota_rslt *objp; 101{ 102 if (!xdr_gqr_status(xdrs, &objp->status)) { 103 return (FALSE); 104 } 105 switch (objp->status) { 106 case Q_OK: 107 if (!xdr_rquota(xdrs, &objp->getquota_rslt_u.gqr_rquota)) { 108 return (FALSE); 109 } 110 break; 111 case Q_NOQUOTA: 112 break; 113 case Q_EPERM: 114 break; 115 default: 116 return (FALSE); 117 } 118 return (TRUE); 119} 120#endif 121