X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fnfsquota.c;h=e3ad5ddc164a0c2725f4e841552cc6a03024a95d;hb=4054f4b3c85ecab060dafd46c0d3632cadbb5803;hp=2dbcb6aacd1cf58c1f1830323795bb710a39fa13;hpb=f291e1ee2d32891f4f451e946b5894a038ed8c48;p=netatalk.git diff --git a/etc/afpd/nfsquota.c b/etc/afpd/nfsquota.c index 2dbcb6aa..e3ad5ddc 100644 --- a/etc/afpd/nfsquota.c +++ b/etc/afpd/nfsquota.c @@ -1,5 +1,5 @@ /* - * $Id: nfsquota.c,v 1.8 2002-03-24 01:23:41 sibaz Exp $ + * $Id: nfsquota.c,v 1.13 2009-10-13 22:55:37 didg Exp $ * * parts of this are lifted from the bsd quota program and are * therefore under the following copyright: @@ -18,8 +18,8 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ +#ifndef NO_QUOTA_SUPPORT #include - /* STDC check */ #if STDC_HEADERS #include @@ -34,33 +34,33 @@ char *strchr (), *strrchr (); #define memmove(d,s,n) bcopy ((s), (d), (n)) #endif /* ! HAVE_MEMCPY */ #endif /* STDC_HEADERS */ - #include #include #include /* for DEV_BSIZE */ #include /* on ultrix doesn't include this */ -#include - #ifdef HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #include +#ifndef PORTMAP +#define PORTMAP 1 +#endif #include #include #include + #include +#include #include "unix.h" -#ifndef NO_QUOTA_SUPPORT /* lifted (with modifications) from the bsd quota program */ static int -callaurpc(vol, prognum, versnum, procnum, inproc, in, outproc, out) -struct vol *vol; -u_long prognum, versnum, procnum; -xdrproc_t inproc, outproc; -char *in, *out; +callaurpc(struct vol *vol, + u_long prognum, u_long versnum, u_long procnum, + xdrproc_t inproc, char *in, + xdrproc_t outproc, char *out) { enum clnt_stat clnt_stat; struct timeval tottimeout; @@ -104,7 +104,7 @@ char *in, *out; #define GQR_RQUOTA getquota_rslt_u.gqr_rquota #endif /* USE_OLD_RQUOTA */ -int getnfsquota(const struct vol *vol, const int uid, const u_int32_t bsize, +int getnfsquota(struct vol *vol, const int uid, const u_int32_t bsize, struct dqblk *dqp) { @@ -142,21 +142,22 @@ int getnfsquota(const struct vol *vol, const int uid, const u_int32_t bsize, break; case Q_EPERM: - LOG(log_error, logtype_afpd, "nfsquota: quota permission error, host: %s\n", + LOG(log_error, logtype_afpd, "nfsquota: quota permission error, host: %s", vol->v_gvs); break; case Q_OK: /* we only copy the bits that we need. */ gettimeofday(&tv, NULL); -#ifdef __svr4__ +#if defined(__svr4__) || defined(TRU64) /* why doesn't using bsize work? */ -#define NFS_BSIZE (gq_rslt.GQR_RQUOTA.rq_bsize / DEV_BSIZE) -#else /* __svr4__ */ +#define NFS_BSIZE gq_rslt.GQR_RQUOTA.rq_bsize / DEV_BSIZE +#else /* __svr4__ || TRU64 */ /* NOTE: linux' rquotad program doesn't currently report the * correct rq_bsize. */ -#define NFS_BSIZE (gq_rslt.GQR_RQUOTA.rq_bsize / bsize) -#endif /* __svr4__ */ + /* NOTE: This is integer division and can introduce rounding errors */ +#define NFS_BSIZE gq_rslt.GQR_RQUOTA.rq_bsize / bsize +#endif /* __svr4__ || TRU64 */ dqp->dqb_bhardlimit = gq_rslt.GQR_RQUOTA.rq_bhardlimit*NFS_BSIZE; @@ -177,7 +178,7 @@ int getnfsquota(const struct vol *vol, const int uid, const u_int32_t bsize, break; default: - LOG(log_info, logtype_afpd, "bad rpc result, host: %s\n", vol->v_gvs); + LOG(log_info, logtype_afpd, "bad rpc result, host: %s", vol->v_gvs); break; }