Module Name: src Committed By: dholland Date: Fri Nov 25 16:55:06 UTC 2011
Modified Files: src/common/include/quota: quota.h src/lib/libquota: getfsquota.c getnfsquota.c getufsquota.c src/libexec/rpc.rquotad: rquotad.c src/sys/compat/common: vfs_syscalls_50.c src/sys/sys: quota.h src/sys/ufs/ufs: quota1.h quota1_subr.c ufs_quota1.c src/usr.bin/quota: getvfsquota.c getvfsquota.h quota.c src/usr.sbin/edquota: edquota.c src/usr.sbin/repquota: repquota.c Log Message: Rename struct ufs_quota_entry -> struct quotaval. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/include/quota/quota.h cvs rdiff -u -r1.2 -r1.3 src/lib/libquota/getfsquota.c cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/getnfsquota.c \ src/lib/libquota/getufsquota.c cvs rdiff -u -r1.30 -r1.31 src/libexec/rpc.rquotad/rquotad.c cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/vfs_syscalls_50.c cvs rdiff -u -r1.5 -r1.6 src/sys/sys/quota.h cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/ufs/quota1.h cvs rdiff -u -r1.5 -r1.6 src/sys/ufs/ufs/quota1_subr.c \ src/sys/ufs/ufs/ufs_quota1.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/quota/getvfsquota.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/quota/getvfsquota.h cvs rdiff -u -r1.37 -r1.38 src/usr.bin/quota/quota.c cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/edquota/edquota.c cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/include/quota/quota.h diff -u src/common/include/quota/quota.h:1.3 src/common/include/quota/quota.h:1.4 --- src/common/include/quota/quota.h:1.3 Sun Nov 20 21:43:34 2011 +++ src/common/include/quota/quota.h Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.h,v 1.3 2011/11/20 21:43:34 dholland Exp $ */ +/* $NetBSD: quota.h,v 1.4 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -50,15 +50,15 @@ int quota_check_limit(uint64_t, uint64_t /* * retrieve quotas with ufs semantics from vfs, for the given id and class. - * second argument points to a struct ufs_quota_entry array of QUOTA_NLIMITS + * second argument points to a struct quotaval array of QUOTA_NLIMITS * elements. */ -int getufsquota(const char *, struct ufs_quota_entry *, uid_t, const char *); +int getufsquota(const char *, struct quotaval *, uid_t, const char *); /* same as above, but for NFS */ -int getnfsquota(const char *, struct ufs_quota_entry *, uid_t, const char *); +int getnfsquota(const char *, struct quotaval *, uid_t, const char *); /* call one of the above, if appropriate, after a statvfs(2) */ -int getfsquota(const char *, struct ufs_quota_entry *, uid_t, const char *); +int getfsquota(const char *, struct quotaval *, uid_t, const char *); #endif /* _QUOTA_QUOTA_H_ */ Index: src/lib/libquota/getfsquota.c diff -u src/lib/libquota/getfsquota.c:1.2 src/lib/libquota/getfsquota.c:1.3 --- src/lib/libquota/getfsquota.c:1.2 Tue Jun 7 14:56:12 2011 +++ src/lib/libquota/getfsquota.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getfsquota.c,v 1.2 2011/06/07 14:56:12 bouyer Exp $ */ +/* $NetBSD: getfsquota.c,v 1.3 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2011 Manuel Bouyer @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: getfsquota.c,v 1.2 2011/06/07 14:56:12 bouyer Exp $"); +__RCSID("$NetBSD: getfsquota.c,v 1.3 2011/11/25 16:55:05 dholland Exp $"); #include <stdio.h> #include <stdlib.h> @@ -43,7 +43,7 @@ __RCSID("$NetBSD: getfsquota.c,v 1.2 201 /* retrieve quotas with ufs semantics from vfs, for the given user id */ int -getfsquota(const char *path, struct ufs_quota_entry *qv, uid_t id, +getfsquota(const char *path, struct quotaval *qv, uid_t id, const char *class) { struct statvfs v; Index: src/lib/libquota/getnfsquota.c diff -u src/lib/libquota/getnfsquota.c:1.3 src/lib/libquota/getnfsquota.c:1.4 --- src/lib/libquota/getnfsquota.c:1.3 Sun Nov 20 21:43:35 2011 +++ src/lib/libquota/getnfsquota.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getnfsquota.c,v 1.3 2011/11/20 21:43:35 dholland Exp $ */ +/* $NetBSD: getnfsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)quota.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: getnfsquota.c,v 1.3 2011/11/20 21:43:35 dholland Exp $"); +__RCSID("$NetBSD: getnfsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $"); #endif #endif /* not lint */ @@ -114,7 +114,7 @@ callaurpc(const char *host, rpcprog_t pr } int -getnfsquota(const char *mp, struct ufs_quota_entry *qv, +getnfsquota(const char *mp, struct quotaval *qv, uint32_t id, const char *class) { struct getquota_args gq_args; @@ -178,29 +178,30 @@ getnfsquota(const char *mp, struct ufs_q gettimeofday(&tv, NULL); /* blocks*/ - qv[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit = rqlim2qlim( + qv[QUOTA_LIMIT_BLOCK].qv_hardlimit = rqlim2qlim( gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit * (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE)); - qv[QUOTA_LIMIT_BLOCK].ufsqe_softlimit = rqlim2qlim( + qv[QUOTA_LIMIT_BLOCK].qv_softlimit = rqlim2qlim( gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit * (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE)); - qv[QUOTA_LIMIT_BLOCK].ufsqe_cur = + qv[QUOTA_LIMIT_BLOCK].qv_usage = gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks * (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE); - qv[QUOTA_LIMIT_BLOCK].ufsqe_time = (tv.tv_sec + + qv[QUOTA_LIMIT_BLOCK].qv_expiretime = (tv.tv_sec + gq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft); /* inodes */ - qv[QUOTA_LIMIT_FILE].ufsqe_hardlimit = rqlim2qlim( + qv[QUOTA_LIMIT_FILE].qv_hardlimit = rqlim2qlim( gq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit); - qv[QUOTA_LIMIT_FILE].ufsqe_softlimit = rqlim2qlim( + qv[QUOTA_LIMIT_FILE].qv_softlimit = rqlim2qlim( gq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit); - qv[QUOTA_LIMIT_FILE].ufsqe_cur = + qv[QUOTA_LIMIT_FILE].qv_usage = gq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles; - qv[QUOTA_LIMIT_FILE].ufsqe_time = (int)(tv.tv_sec + + qv[QUOTA_LIMIT_FILE].qv_expiretime = (int)(tv.tv_sec + gq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft); - qv[QUOTA_LIMIT_BLOCK].ufsqe_grace = - qv[QUOTA_LIMIT_FILE].ufsqe_grace = 0; + + qv[QUOTA_LIMIT_BLOCK].qv_grace = + qv[QUOTA_LIMIT_FILE].qv_grace = 0; return 1; default: /* XXX sert errno and return -1 ? */ Index: src/lib/libquota/getufsquota.c diff -u src/lib/libquota/getufsquota.c:1.3 src/lib/libquota/getufsquota.c:1.4 --- src/lib/libquota/getufsquota.c:1.3 Fri Sep 30 22:08:19 2011 +++ src/lib/libquota/getufsquota.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getufsquota.c,v 1.3 2011/09/30 22:08:19 jym Exp $ */ +/* $NetBSD: getufsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2011 Manuel Bouyer @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: getufsquota.c,v 1.3 2011/09/30 22:08:19 jym Exp $"); +__RCSID("$NetBSD: getufsquota.c,v 1.4 2011/11/25 16:55:05 dholland Exp $"); #include <stdio.h> #include <stdlib.h> @@ -42,7 +42,7 @@ __RCSID("$NetBSD: getufsquota.c,v 1.3 20 /* retrieve quotas with ufs semantics from vfs, for the given user id */ int -getufsquota(const char *mp, struct ufs_quota_entry *qv, uid_t id, +getufsquota(const char *mp, struct quotaval *qv, uid_t id, const char *class) { prop_dictionary_t dict, data, cmd; @@ -151,9 +151,9 @@ getufsquota(const char *mp, struct ufs_q goto end_dict; } values[QUOTA_LIMIT_BLOCK] = - &qv[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; + &qv[QUOTA_LIMIT_BLOCK].qv_hardlimit; values[QUOTA_LIMIT_FILE] = - &qv[QUOTA_LIMIT_FILE].ufsqe_hardlimit; + &qv[QUOTA_LIMIT_FILE].qv_hardlimit; errno = proptoquota64(data, values, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, ufs_quota_limit_names, QUOTA_NLIMITS); Index: src/libexec/rpc.rquotad/rquotad.c diff -u src/libexec/rpc.rquotad/rquotad.c:1.30 src/libexec/rpc.rquotad/rquotad.c:1.31 --- src/libexec/rpc.rquotad/rquotad.c:1.30 Fri Sep 16 16:13:17 2011 +++ src/libexec/rpc.rquotad/rquotad.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rquotad.c,v 1.30 2011/09/16 16:13:17 plunky Exp $ */ +/* $NetBSD: rquotad.c,v 1.31 2011/11/25 16:55:05 dholland Exp $ */ /* * by Manuel Bouyer (bou...@ensta.fr). Public domain. @@ -6,7 +6,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: rquotad.c,v 1.30 2011/09/16 16:13:17 plunky Exp $"); +__RCSID("$NetBSD: rquotad.c,v 1.31 2011/11/25 16:55:05 dholland Exp $"); #endif #include <sys/param.h> @@ -170,7 +170,7 @@ sendquota(struct svc_req *request, int v struct getquota_args getq_args; struct ext_getquota_args ext_getq_args; struct getquota_rslt getq_rslt; - struct ufs_quota_entry qe[QUOTA_NLIMITS]; + struct quotaval qv[QUOTA_NLIMITS]; const char *class; struct timeval timev; @@ -209,7 +209,7 @@ sendquota(struct svc_req *request, int v if (request->rq_cred.oa_flavor != AUTH_UNIX) { /* bad auth */ getq_rslt.status = Q_EPERM; - } else if (!getufsquota(ext_getq_args.gqa_pathp, qe, + } else if (!getufsquota(ext_getq_args.gqa_pathp, qv, ext_getq_args.gqa_id, class)) { /* failed, return noquota */ getq_rslt.status = Q_NOQUOTA; @@ -219,21 +219,21 @@ sendquota(struct svc_req *request, int v getq_rslt.getquota_rslt_u.gqr_rquota.rq_active = TRUE; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize = DEV_BSIZE; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit = - qlim2rqlim(qe[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit); + qlim2rqlim(qv[QUOTA_LIMIT_BLOCK].qv_hardlimit); getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit = - qlim2rqlim(qe[QUOTA_LIMIT_BLOCK].ufsqe_softlimit); + qlim2rqlim(qv[QUOTA_LIMIT_BLOCK].qv_softlimit); getq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks = - qe[QUOTA_LIMIT_BLOCK].ufsqe_cur; + qv[QUOTA_LIMIT_BLOCK].qv_usage; getq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit = - qlim2rqlim(qe[QUOTA_LIMIT_FILE].ufsqe_hardlimit); + qlim2rqlim(qv[QUOTA_LIMIT_FILE].qv_hardlimit); getq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit = - qlim2rqlim(qe[QUOTA_LIMIT_FILE].ufsqe_softlimit); + qlim2rqlim(qv[QUOTA_LIMIT_FILE].qv_softlimit); getq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles = - qe[QUOTA_LIMIT_FILE].ufsqe_cur; + qv[QUOTA_LIMIT_FILE].qv_usage; getq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft = - qe[QUOTA_LIMIT_BLOCK].ufsqe_time - timev.tv_sec; + qv[QUOTA_LIMIT_BLOCK].qv_expiretime - timev.tv_sec; getq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft = - qe[QUOTA_LIMIT_FILE].ufsqe_time - timev.tv_sec; + qv[QUOTA_LIMIT_FILE].qv_expiretime - timev.tv_sec; } out: if (!svc_sendreply(transp, (xdrproc_t)xdr_getquota_rslt, (char *)&getq_rslt)) Index: src/sys/compat/common/vfs_syscalls_50.c diff -u src/sys/compat/common/vfs_syscalls_50.c:1.9 src/sys/compat/common/vfs_syscalls_50.c:1.10 --- src/sys/compat/common/vfs_syscalls_50.c:1.9 Sun Nov 20 21:43:35 2011 +++ src/sys/compat/common/vfs_syscalls_50.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_50.c,v 1.9 2011/11/20 21:43:35 dholland Exp $ */ +/* $NetBSD: vfs_syscalls_50.c,v 1.10 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.9 2011/11/20 21:43:35 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.10 2011/11/25 16:55:05 dholland Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -336,11 +336,11 @@ compat_50_sys_quotactl(struct lwp *l, co prop_array_t cmds, datas; char *bufpath; struct dqblk dqblk; - struct ufs_quota_entry qe[QUOTA_NLIMITS]; + struct quotaval qv[QUOTA_NLIMITS]; uint64_t *values[QUOTA_NLIMITS]; - values[QUOTA_LIMIT_BLOCK] = &qe[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; - values[QUOTA_LIMIT_FILE] = &qe[QUOTA_LIMIT_FILE].ufsqe_hardlimit; + values[QUOTA_LIMIT_BLOCK] = &qv[QUOTA_LIMIT_BLOCK].qv_hardlimit; + values[QUOTA_LIMIT_FILE] = &qv[QUOTA_LIMIT_FILE].qv_hardlimit; error = namei_simple_user(SCARG(uap, path), NSM_FOLLOW_TRYEMULROOT, &vp); @@ -452,7 +452,7 @@ do_quotaonoff: ufs_quota_limit_names, QUOTA_NLIMITS); if (error) goto out_dict; - ufsqe2dqblk(qe, &dqblk); + quotaval_to_dqblk(qv, &dqblk); error = copyout(&dqblk, SCARG(uap, arg), sizeof(dqblk)); goto out_dict; @@ -460,7 +460,7 @@ do_quotaonoff: error = copyin(SCARG(uap, arg), &dqblk, sizeof(dqblk)); if (error) goto out_datas; - dqblk2ufsqe(&dqblk, qe); + dqblk_to_quotaval(&dqblk, qv); error = ENOMEM; data = quota64toprop(SCARG(uap, uid), 0, values, Index: src/sys/sys/quota.h diff -u src/sys/sys/quota.h:1.5 src/sys/sys/quota.h:1.6 --- src/sys/sys/quota.h:1.5 Sun Nov 20 21:43:34 2011 +++ src/sys/sys/quota.h Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.h,v 1.5 2011/11/20 21:43:34 dholland Exp $ */ +/* $NetBSD: quota.h,v 1.6 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,13 +28,15 @@ #ifndef _SYS_QUOTA_H_ #define _SYS_QUOTA_H_ -/* structure used to describe a UFS-like quota entry */ -struct ufs_quota_entry { - uint64_t ufsqe_hardlimit; /* absolute limit */ - uint64_t ufsqe_softlimit; /* overflowable limit */ - uint64_t ufsqe_cur; /* current usage */ - int64_t ufsqe_time; /* grace expiration date for softlimit overflow */ - int64_t ufsqe_grace; /* allowed time for softlimit overflow */ +/* + * Structure used to describe the value part of a quota record. + */ +struct quotaval { + uint64_t qv_hardlimit; /* absolute limit */ + uint64_t qv_softlimit; /* overflowable limit */ + uint64_t qv_usage; /* current usage */ + time_t qv_expiretime; /* time when softlimit grace expires */ + time_t qv_grace; /* allowed time for overflowing soft limit */ }; #endif /* _SYS_QUOTA_H_ */ Index: src/sys/ufs/ufs/quota1.h diff -u src/sys/ufs/ufs/quota1.h:1.4 src/sys/ufs/ufs/quota1.h:1.5 --- src/sys/ufs/ufs/quota1.h:1.4 Sun Nov 20 21:43:35 2011 +++ src/sys/ufs/ufs/quota1.h Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota1.h,v 1.4 2011/11/20 21:43:35 dholland Exp $ */ +/* $NetBSD: quota1.h,v 1.5 2011/11/25 16:55:05 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -105,6 +105,7 @@ struct dqblk { /* quota1_subr.c */ struct quota2_entry; -void dqblk2ufsqe(const struct dqblk *, struct ufs_quota_entry *); -void ufsqe2dqblk(const struct ufs_quota_entry *, struct dqblk *); +void dqblk_to_quotaval(const struct dqblk *, struct quotaval *); +void quotaval_to_dqblk(const struct quotaval *, struct dqblk *); + #endif /* !_UFS_UFS_QUOTA1_H_ */ Index: src/sys/ufs/ufs/quota1_subr.c diff -u src/sys/ufs/ufs/quota1_subr.c:1.5 src/sys/ufs/ufs/quota1_subr.c:1.6 --- src/sys/ufs/ufs/quota1_subr.c:1.5 Sun Nov 20 21:43:35 2011 +++ src/sys/ufs/ufs/quota1_subr.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota1_subr.c,v 1.5 2011/11/20 21:43:35 dholland Exp $ */ +/* $NetBSD: quota1_subr.c,v 1.6 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: quota1_subr.c,v 1.5 2011/11/20 21:43:35 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: quota1_subr.c,v 1.6 2011/11/25 16:55:05 dholland Exp $"); #include <sys/types.h> #include <machine/limits.h> @@ -54,38 +54,42 @@ q2e2dqblk_limit(uint64_t lim) } void -dqblk2ufsqe(const struct dqblk *dqblk, struct ufs_quota_entry *qe) +dqblk_to_quotaval(const struct dqblk *dqblk, struct quotaval *qv) { - qe[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit = + /* XXX is qv_grace getting handled correctly? */ + + qv[QUOTA_LIMIT_BLOCK].qv_hardlimit = dqblk2q2e_limit(dqblk->dqb_bhardlimit); - qe[QUOTA_LIMIT_BLOCK].ufsqe_softlimit = + qv[QUOTA_LIMIT_BLOCK].qv_softlimit = dqblk2q2e_limit(dqblk->dqb_bsoftlimit); - qe[QUOTA_LIMIT_BLOCK].ufsqe_cur = dqblk->dqb_curblocks; - qe[QUOTA_LIMIT_BLOCK].ufsqe_time = dqblk->dqb_btime; + qv[QUOTA_LIMIT_BLOCK].qv_usage = dqblk->dqb_curblocks; + qv[QUOTA_LIMIT_BLOCK].qv_expiretime = dqblk->dqb_btime; - qe[QUOTA_LIMIT_FILE].ufsqe_hardlimit = + qv[QUOTA_LIMIT_FILE].qv_hardlimit = dqblk2q2e_limit(dqblk->dqb_ihardlimit); - qe[QUOTA_LIMIT_FILE].ufsqe_softlimit = + qv[QUOTA_LIMIT_FILE].qv_softlimit = dqblk2q2e_limit(dqblk->dqb_isoftlimit); - qe[QUOTA_LIMIT_FILE].ufsqe_cur = dqblk->dqb_curinodes; - qe[QUOTA_LIMIT_FILE].ufsqe_time = dqblk->dqb_itime; + qv[QUOTA_LIMIT_FILE].qv_usage = dqblk->dqb_curinodes; + qv[QUOTA_LIMIT_FILE].qv_expiretime = dqblk->dqb_itime; } void -ufsqe2dqblk(const struct ufs_quota_entry *qe, struct dqblk *dqblk) +quotaval_to_dqblk(const struct quotaval *qv, struct dqblk *dqblk) { + /* XXX is qv_grace getting handled correctly? */ + dqblk->dqb_bhardlimit = - q2e2dqblk_limit(qe[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit); + q2e2dqblk_limit(qv[QUOTA_LIMIT_BLOCK].qv_hardlimit); dqblk->dqb_bsoftlimit = - q2e2dqblk_limit(qe[QUOTA_LIMIT_BLOCK].ufsqe_softlimit); - dqblk->dqb_curblocks = qe[QUOTA_LIMIT_BLOCK].ufsqe_cur; - dqblk->dqb_btime = qe[QUOTA_LIMIT_BLOCK].ufsqe_time; + q2e2dqblk_limit(qv[QUOTA_LIMIT_BLOCK].qv_softlimit); + dqblk->dqb_curblocks = qv[QUOTA_LIMIT_BLOCK].qv_usage; + dqblk->dqb_btime = qv[QUOTA_LIMIT_BLOCK].qv_expiretime; dqblk->dqb_ihardlimit = - q2e2dqblk_limit(qe[QUOTA_LIMIT_FILE].ufsqe_hardlimit); + q2e2dqblk_limit(qv[QUOTA_LIMIT_FILE].qv_hardlimit); dqblk->dqb_isoftlimit = - q2e2dqblk_limit(qe[QUOTA_LIMIT_FILE].ufsqe_softlimit); - dqblk->dqb_curinodes = qe[QUOTA_LIMIT_FILE].ufsqe_cur; - dqblk->dqb_itime = qe[QUOTA_LIMIT_FILE].ufsqe_time; + q2e2dqblk_limit(qv[QUOTA_LIMIT_FILE].qv_softlimit); + dqblk->dqb_curinodes = qv[QUOTA_LIMIT_FILE].qv_usage; + dqblk->dqb_itime = qv[QUOTA_LIMIT_FILE].qv_expiretime; } Index: src/sys/ufs/ufs/ufs_quota1.c diff -u src/sys/ufs/ufs/ufs_quota1.c:1.5 src/sys/ufs/ufs/ufs_quota1.c:1.6 --- src/sys/ufs/ufs/ufs_quota1.c:1.5 Fri Oct 7 09:35:07 2011 +++ src/sys/ufs/ufs/ufs_quota1.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota1.c,v 1.5 2011/10/07 09:35:07 hannken Exp $ */ +/* $NetBSD: ufs_quota1.c,v 1.6 2011/11/25 16:55:05 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.5 2011/10/07 09:35:07 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.6 2011/11/25 16:55:05 dholland Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -497,12 +497,12 @@ quota1_handle_cmd_get(struct ufsmount *u int defaultq, prop_array_t replies) { struct dquot *dq; - struct ufs_quota_entry qe[QUOTA_NLIMITS]; + struct quotaval qv[QUOTA_NLIMITS]; prop_dictionary_t dict; int error; uint64_t *valuesp[QUOTA_NLIMITS]; - valuesp[QUOTA_LIMIT_BLOCK] = &qe[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; - valuesp[QUOTA_LIMIT_FILE] = &qe[QUOTA_LIMIT_FILE].ufsqe_hardlimit; + valuesp[QUOTA_LIMIT_BLOCK] = &qv[QUOTA_LIMIT_BLOCK].qv_hardlimit; + valuesp[QUOTA_LIMIT_FILE] = &qv[QUOTA_LIMIT_FILE].qv_hardlimit; if (ump->um_quotas[type] == NULLVP) @@ -516,19 +516,19 @@ quota1_handle_cmd_get(struct ufsmount *u if ((error = dqget(NULLVP, id, ump, type, &dq)) != 0) return error; } - dqblk2ufsqe(&dq->dq_un.dq1_dqb, qe); + dqblk_to_quotaval(&dq->dq_un.dq1_dqb, qv); dqrele(NULLVP, dq); if (defaultq) { - if (qe[QUOTA_LIMIT_BLOCK].ufsqe_time > 0) - qe[QUOTA_LIMIT_BLOCK].ufsqe_grace = - qe[QUOTA_LIMIT_BLOCK].ufsqe_time; + if (qv[QUOTA_LIMIT_BLOCK].qv_expiretime > 0) + qv[QUOTA_LIMIT_BLOCK].qv_grace = + qv[QUOTA_LIMIT_BLOCK].qv_expiretime; else - qe[QUOTA_LIMIT_BLOCK].ufsqe_grace = MAX_DQ_TIME; - if (qe[QUOTA_LIMIT_FILE].ufsqe_time > 0) - qe[QUOTA_LIMIT_FILE].ufsqe_grace = - qe[QUOTA_LIMIT_FILE].ufsqe_time; + qv[QUOTA_LIMIT_BLOCK].qv_grace = MAX_DQ_TIME; + if (qv[QUOTA_LIMIT_FILE].qv_expiretime > 0) + qv[QUOTA_LIMIT_FILE].qv_grace = + qv[QUOTA_LIMIT_FILE].qv_expiretime; else - qe[QUOTA_LIMIT_FILE].ufsqe_grace = MAX_DQ_TIME; + qv[QUOTA_LIMIT_FILE].qv_grace = MAX_DQ_TIME; } dict = quota64toprop(id, defaultq, valuesp, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, Index: src/usr.bin/quota/getvfsquota.c diff -u src/usr.bin/quota/getvfsquota.c:1.8 src/usr.bin/quota/getvfsquota.c:1.9 --- src/usr.bin/quota/getvfsquota.c:1.8 Fri Sep 30 22:08:19 2011 +++ src/usr.bin/quota/getvfsquota.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getvfsquota.c,v 1.8 2011/09/30 22:08:19 jym Exp $ */ +/* $NetBSD: getvfsquota.c,v 1.9 2011/11/25 16:55:05 dholland Exp $ */ /*- * Copyright (c) 2011 Manuel Bouyer @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: getvfsquota.c,v 1.8 2011/09/30 22:08:19 jym Exp $"); +__RCSID("$NetBSD: getvfsquota.c,v 1.9 2011/11/25 16:55:05 dholland Exp $"); #include <stdio.h> #include <stdlib.h> @@ -44,7 +44,7 @@ __RCSID("$NetBSD: getvfsquota.c,v 1.8 20 /* private version of getufsquota() */ int -getvfsquota(const char *mp, struct ufs_quota_entry *qv, int8_t *versp, +getvfsquota(const char *mp, struct quotaval *qv, int8_t *versp, uint32_t id, int type, int defaultq, int debug) { prop_dictionary_t dict, data, cmd; @@ -149,9 +149,9 @@ getvfsquota(const char *mp, struct ufs_q err(1, "prop_array_get(data)"); values[QUOTA_LIMIT_BLOCK] = - &qv[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; + &qv[QUOTA_LIMIT_BLOCK].qv_hardlimit; values[QUOTA_LIMIT_FILE] = - &qv[QUOTA_LIMIT_FILE].ufsqe_hardlimit; + &qv[QUOTA_LIMIT_FILE].qv_hardlimit; errno = proptoquota64(data, values, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, Index: src/usr.bin/quota/getvfsquota.h diff -u src/usr.bin/quota/getvfsquota.h:1.4 src/usr.bin/quota/getvfsquota.h:1.5 --- src/usr.bin/quota/getvfsquota.h:1.4 Thu Mar 24 17:05:46 2011 +++ src/usr.bin/quota/getvfsquota.h Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getvfsquota.h,v 1.4 2011/03/24 17:05:46 bouyer Exp $ */ +/* $NetBSD: getvfsquota.h,v 1.5 2011/11/25 16:55:05 dholland Exp $ */ -int getvfsquota(const char *, struct ufs_quota_entry *, int8_t *, +int getvfsquota(const char *, struct quotaval *, int8_t *, uint32_t, int, int, int); Index: src/usr.bin/quota/quota.c diff -u src/usr.bin/quota/quota.c:1.37 src/usr.bin/quota/quota.c:1.38 --- src/usr.bin/quota/quota.c:1.37 Thu Mar 24 17:05:46 2011 +++ src/usr.bin/quota/quota.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.c,v 1.37 2011/03/24 17:05:46 bouyer Exp $ */ +/* $NetBSD: quota.c,v 1.38 2011/11/25 16:55:05 dholland Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)quota.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: quota.c,v 1.37 2011/03/24 17:05:46 bouyer Exp $"); +__RCSID("$NetBSD: quota.c,v 1.38 2011/11/25 16:55:05 dholland Exp $"); #endif #endif /* not lint */ @@ -79,7 +79,7 @@ struct quotause { struct quotause *next; long flags; uid_t id; - struct ufs_quota_entry qe[QUOTA_NLIMITS]; + struct quotaval qv[QUOTA_NLIMITS]; char fsname[MAXPATHLEN + 1]; }; #define FOUND 0x01 @@ -328,17 +328,17 @@ showquotas(int type, uint32_t id, const quplist = getprivs(id, type); for (qup = quplist; qup; qup = qup->next) { int ql_stat; - struct ufs_quota_entry *q = qup->qe; + struct quotaval *q = qup->qv; if (!vflag && - q[QUOTA_LIMIT_BLOCK].ufsqe_softlimit == UQUAD_MAX && - q[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit == UQUAD_MAX && - q[QUOTA_LIMIT_FILE].ufsqe_softlimit == UQUAD_MAX && - q[QUOTA_LIMIT_FILE].ufsqe_hardlimit == UQUAD_MAX) + q[QUOTA_LIMIT_BLOCK].qv_softlimit == UQUAD_MAX && + q[QUOTA_LIMIT_BLOCK].qv_hardlimit == UQUAD_MAX && + q[QUOTA_LIMIT_FILE].qv_softlimit == UQUAD_MAX && + q[QUOTA_LIMIT_FILE].qv_hardlimit == UQUAD_MAX) continue; - ql_stat = quota_check_limit(q[QUOTA_LIMIT_FILE].ufsqe_cur, 1, - q[QUOTA_LIMIT_FILE].ufsqe_softlimit, - q[QUOTA_LIMIT_FILE].ufsqe_hardlimit, - q[QUOTA_LIMIT_FILE].ufsqe_time, now); + ql_stat = quota_check_limit(q[QUOTA_LIMIT_FILE].qv_usage, 1, + q[QUOTA_LIMIT_FILE].qv_softlimit, + q[QUOTA_LIMIT_FILE].qv_hardlimit, + q[QUOTA_LIMIT_FILE].qv_expiretime, now); switch(QL_STATUS(ql_stat)) { case QL_S_DENY_HARD: msgi = "File limit reached on"; @@ -352,10 +352,10 @@ showquotas(int type, uint32_t id, const default: msgi = NULL; } - ql_stat = quota_check_limit(q[QUOTA_LIMIT_BLOCK].ufsqe_cur, 1, - q[QUOTA_LIMIT_BLOCK].ufsqe_softlimit, - q[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit, - q[QUOTA_LIMIT_BLOCK].ufsqe_time, now); + ql_stat = quota_check_limit(q[QUOTA_LIMIT_BLOCK].qv_usage, 1, + q[QUOTA_LIMIT_BLOCK].qv_softlimit, + q[QUOTA_LIMIT_BLOCK].qv_hardlimit, + q[QUOTA_LIMIT_BLOCK].qv_expiretime, now); switch(QL_STATUS(ql_stat)) { case QL_S_DENY_HARD: msgb = "Block limit reached on"; @@ -380,8 +380,8 @@ showquotas(int type, uint32_t id, const continue; } if (vflag || dflag || msgi || msgb || - q[QUOTA_LIMIT_BLOCK].ufsqe_cur || - q[QUOTA_LIMIT_FILE].ufsqe_cur) { + q[QUOTA_LIMIT_BLOCK].qv_usage || + q[QUOTA_LIMIT_FILE].qv_usage) { if (lines++ == 0) heading(type, id, name, ""); nam = qup->fsname; @@ -391,40 +391,40 @@ showquotas(int type, uint32_t id, const } if (msgb) timemsg = timeprt(b0, 9, now, - q[QUOTA_LIMIT_BLOCK].ufsqe_time); + q[QUOTA_LIMIT_BLOCK].qv_expiretime); else if ((qup->flags & QUOTA2) != 0 && vflag) timemsg = timeprt(b0, 9, 0, - q[QUOTA_LIMIT_BLOCK].ufsqe_grace); + q[QUOTA_LIMIT_BLOCK].qv_grace); else timemsg = ""; printf("%12s%9s%c%8s%9s%8s", nam, - intprt(b1, 9, q[QUOTA_LIMIT_BLOCK].ufsqe_cur, + intprt(b1, 9, q[QUOTA_LIMIT_BLOCK].qv_usage, HN_B, hflag), (msgb == NULL) ? ' ' : '*', - intprt(b2, 9, q[QUOTA_LIMIT_BLOCK].ufsqe_softlimit, + intprt(b2, 9, q[QUOTA_LIMIT_BLOCK].qv_softlimit, HN_B, hflag), - intprt(b3, 9, q[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit, + intprt(b3, 9, q[QUOTA_LIMIT_BLOCK].qv_hardlimit, HN_B, hflag), timemsg); if (msgi) timemsg = timeprt(b0, 9, now, - q[QUOTA_LIMIT_FILE].ufsqe_time); + q[QUOTA_LIMIT_FILE].qv_expiretime); else if ((qup->flags & QUOTA2) != 0 && vflag) timemsg = timeprt(b0, 9, 0, - q[QUOTA_LIMIT_FILE].ufsqe_grace); + q[QUOTA_LIMIT_FILE].qv_grace); else timemsg = ""; printf("%8s%c%7s%8s%8s\n", - intprt(b1, 8, q[QUOTA_LIMIT_FILE].ufsqe_cur, 0, + intprt(b1, 8, q[QUOTA_LIMIT_FILE].qv_usage, 0, hflag), (msgi == NULL) ? ' ' : '*', - intprt(b2, 8, q[QUOTA_LIMIT_FILE].ufsqe_softlimit, + intprt(b2, 8, q[QUOTA_LIMIT_FILE].qv_softlimit, 0, hflag), - intprt(b3, 8, q[QUOTA_LIMIT_FILE].ufsqe_hardlimit, + intprt(b3, 8, q[QUOTA_LIMIT_FILE].qv_hardlimit, 0, hflag), timemsg); continue; @@ -486,10 +486,10 @@ getprivs(uint32_t id, int quotatype) sizeof(fst[i].f_fstypename)) == 0) { version = 0; if (getnfsquota(fst[i].f_mntfromname, - qup->qe, id, ufs_quota_class_names[quotatype]) != 1) + qup->qv, id, ufs_quota_class_names[quotatype]) != 1) continue; } else if ((fst[i].f_flag & ST_QUOTA) != 0) { - if (getvfsquota(fst[i].f_mntonname, qup->qe, &version, + if (getvfsquota(fst[i].f_mntonname, qup->qv, &version, id, quotatype, dflag, Dflag) != 1) continue; } else Index: src/usr.sbin/edquota/edquota.c diff -u src/usr.sbin/edquota/edquota.c:1.38 src/usr.sbin/edquota/edquota.c:1.39 --- src/usr.sbin/edquota/edquota.c:1.38 Sun Nov 13 15:42:35 2011 +++ src/usr.sbin/edquota/edquota.c Fri Nov 25 16:55:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: edquota.c,v 1.38 2011/11/13 15:42:35 dholland Exp $ */ +/* $NetBSD: edquota.c,v 1.39 2011/11/25 16:55:05 dholland Exp $ */ /* * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95"; #else -__RCSID("$NetBSD: edquota.c,v 1.38 2011/11/13 15:42:35 dholland Exp $"); +__RCSID("$NetBSD: edquota.c,v 1.39 2011/11/25 16:55:05 dholland Exp $"); #endif #endif /* not lint */ @@ -93,7 +93,7 @@ static const char *quotagroup = QUOTAGRO struct quotause { struct quotause *next; long flags; - struct ufs_quota_entry qe[QUOTA_NLIMITS]; + struct quotaval qv[QUOTA_NLIMITS]; char fsname[MAXPATHLEN + 1]; char *qfname; }; @@ -165,7 +165,7 @@ quotause_create(void) qup->next = NULL; qup->flags = 0; - memset(qup->qe, 0, sizeof(qup->qe)); + memset(qup->qv, 0, sizeof(qup->qv)); qup->fsname[0] = '\0'; qup->qfname = NULL; @@ -248,7 +248,7 @@ putprivs1(uint32_t id, int quotaclass, s struct dqblk dqblk; int fd; - ufsqe2dqblk(qup->qe, &dqblk); + quotaval_to_dqblk(qup->qv, &dqblk); assert((qup->flags & DEFAULT) == 0); if ((fd = open(qup->qfname, O_WRONLY)) < 0) { @@ -326,7 +326,7 @@ getprivs1(long id, int quotaclass, const close(fd); qup->qfname = qfpathname; endfsent(); - dqblk2ufsqe(&dqblk, qup->qe); + dqblk_to_quotaval(&dqblk, qup->qv); return qup; } @@ -343,10 +343,10 @@ getprivs2(long id, int quotaclass, const strcpy(qup->fsname, filesys); if (defaultq) qup->flags |= DEFAULT; - if (!getvfsquota(filesys, qup->qe, &version, + if (!getvfsquota(filesys, qup->qv, &version, id, quotaclass, defaultq, Dflag)) { /* no entry, get default entry */ - if (!getvfsquota(filesys, qup->qe, &version, + if (!getvfsquota(filesys, qup->qv, &version, id, quotaclass, 1, Dflag)) { free(qup); return NULL; @@ -368,9 +368,9 @@ putprivs2(uint32_t id, int quotaclass, s uint64_t *valuesp[QUOTA_NLIMITS]; valuesp[QL_BLK] = - &qup->qe[QL_BLK].ufsqe_hardlimit; + &qup->qv[QL_BLK].qv_hardlimit; valuesp[QL_FL] = - &qup->qe[QL_FL].ufsqe_hardlimit; + &qup->qv[QL_FL].qv_hardlimit; data = quota64toprop(id, (qup->flags & DEFAULT) ? 1 : 0, valuesp, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, @@ -689,17 +689,17 @@ writeprivs(struct quotalist *qlist, int ufs_quota_class_names[quotaclass], name); } for (qup = qlist->head; qup; qup = qup->next) { - struct ufs_quota_entry *q = qup->qe; + struct quotaval *q = qup->qv; fprintf(fd, "%s (version %d):\n", qup->fsname, (qup->flags & QUOTA2) ? 2 : 1); if ((qup->flags & DEFAULT) == 0 || (qup->flags & QUOTA2) != 0) { fprintf(fd, "\tblocks in use: %s, " "limits (soft = %s, hard = %s", - intprt(b1, 21, q[QL_BLK].ufsqe_cur, + intprt(b1, 21, q[QL_BLK].qv_usage, HN_NOSPACE | HN_B, Hflag), - intprt(b2, 21, q[QL_BLK].ufsqe_softlimit, + intprt(b2, 21, q[QL_BLK].qv_softlimit, HN_NOSPACE | HN_B, Hflag), - intprt(b3, 21, q[QL_BLK].ufsqe_hardlimit, + intprt(b3, 21, q[QL_BLK].qv_hardlimit, HN_NOSPACE | HN_B, Hflag)); if (qup->flags & QUOTA2) fprintf(fd, ", "); @@ -708,17 +708,17 @@ writeprivs(struct quotalist *qlist, int if (qup->flags & (QUOTA2|DEFAULT)) { fprintf(fd, "grace = %s", - timepprt(b0, 21, q[QL_BLK].ufsqe_grace, Hflag)); + timepprt(b0, 21, q[QL_BLK].qv_grace, Hflag)); } fprintf(fd, ")\n"); if ((qup->flags & DEFAULT) == 0 || (qup->flags & QUOTA2) != 0) { fprintf(fd, "\tinodes in use: %s, " "limits (soft = %s, hard = %s", - intprt(b1, 21, q[QL_FL].ufsqe_cur, + intprt(b1, 21, q[QL_FL].qv_usage, HN_NOSPACE, Hflag), - intprt(b2, 21, q[QL_FL].ufsqe_softlimit, + intprt(b2, 21, q[QL_FL].qv_softlimit, HN_NOSPACE, Hflag), - intprt(b3, 21, q[QL_FL].ufsqe_hardlimit, + intprt(b3, 21, q[QL_FL].qv_hardlimit, HN_NOSPACE, Hflag)); if (qup->flags & QUOTA2) fprintf(fd, ", "); @@ -727,7 +727,7 @@ writeprivs(struct quotalist *qlist, int if (qup->flags & (QUOTA2|DEFAULT)) { fprintf(fd, "grace = %s", - timepprt(b0, 21, q[QL_FL].ufsqe_grace, Hflag)); + timepprt(b0, 21, q[QL_FL].qv_grace, Hflag)); } fprintf(fd, ")\n"); } @@ -907,21 +907,21 @@ readprivs(struct quotalist *qlist, int i } } for (qup = qlist->head; qup; qup = qup->next) { - struct ufs_quota_entry *q = qup->qe; + struct quotaval *q = qup->qv; char b1[32], b2[32]; if (strcmp(fsp, qup->fsname)) continue; if (version == 1 && dflag) { - q[QL_BLK].ufsqe_grace = graceb; - q[QL_FL].ufsqe_grace = gracei; + q[QL_BLK].qv_grace = graceb; + q[QL_FL].qv_grace = gracei; qup->flags |= FOUND; continue; } - if (strcmp(intprt(b1, 21, q[QL_BLK].ufsqe_cur, + if (strcmp(intprt(b1, 21, q[QL_BLK].qv_usage, HN_NOSPACE | HN_B, Hflag), scurb) != 0 || - strcmp(intprt(b2, 21, q[QL_FL].ufsqe_cur, + strcmp(intprt(b2, 21, q[QL_FL].qv_usage, HN_NOSPACE, Hflag), scuri) != 0) { warnx("%s: cannot change current allocation", @@ -934,24 +934,24 @@ readprivs(struct quotalist *qlist, int i * or were under it, but now have a soft limit * and are over it. */ - if (q[QL_BLK].ufsqe_cur && - q[QL_BLK].ufsqe_cur >= softb && - (q[QL_BLK].ufsqe_softlimit == 0 || - q[QL_BLK].ufsqe_cur < q[QL_BLK].ufsqe_softlimit)) - q[QL_BLK].ufsqe_time = 0; - if (q[QL_FL].ufsqe_cur && - q[QL_FL].ufsqe_cur >= softi && - (q[QL_FL].ufsqe_softlimit == 0 || - q[QL_FL].ufsqe_cur < q[QL_FL].ufsqe_softlimit)) - q[QL_FL].ufsqe_time = 0; - q[QL_BLK].ufsqe_softlimit = softb; - q[QL_BLK].ufsqe_hardlimit = hardb; + if (q[QL_BLK].qv_usage && + q[QL_BLK].qv_usage >= softb && + (q[QL_BLK].qv_softlimit == 0 || + q[QL_BLK].qv_usage < q[QL_BLK].qv_softlimit)) + q[QL_BLK].qv_expiretime = 0; + if (q[QL_FL].qv_usage && + q[QL_FL].qv_usage >= softi && + (q[QL_FL].qv_softlimit == 0 || + q[QL_FL].qv_usage < q[QL_FL].qv_softlimit)) + q[QL_FL].qv_expiretime = 0; + q[QL_BLK].qv_softlimit = softb; + q[QL_BLK].qv_hardlimit = hardb; if (version == 2) - q[QL_BLK].ufsqe_grace = graceb; - q[QL_FL].ufsqe_softlimit = softi; - q[QL_FL].ufsqe_hardlimit = hardi; + q[QL_BLK].qv_grace = graceb; + q[QL_FL].qv_softlimit = softi; + q[QL_FL].qv_hardlimit = hardi; if (version == 2) - q[QL_FL].ufsqe_grace = gracei; + q[QL_FL].qv_grace = gracei; qup->flags |= FOUND; } } @@ -961,17 +961,17 @@ out: * Disable quotas for any filesystems that have not been found. */ for (qup = qlist->head; qup; qup = qup->next) { - struct ufs_quota_entry *q = qup->qe; + struct quotaval *q = qup->qv; if (qup->flags & FOUND) { qup->flags &= ~FOUND; continue; } - q[QL_BLK].ufsqe_softlimit = UQUAD_MAX; - q[QL_BLK].ufsqe_hardlimit = UQUAD_MAX; - q[QL_BLK].ufsqe_grace = 0; - q[QL_FL].ufsqe_softlimit = UQUAD_MAX; - q[QL_FL].ufsqe_hardlimit = UQUAD_MAX; - q[QL_FL].ufsqe_grace = 0; + q[QL_BLK].qv_softlimit = UQUAD_MAX; + q[QL_BLK].qv_hardlimit = UQUAD_MAX; + q[QL_BLK].qv_grace = 0; + q[QL_FL].qv_softlimit = UQUAD_MAX; + q[QL_FL].qv_hardlimit = UQUAD_MAX; + q[QL_FL].qv_grace = 0; } return 1; } @@ -992,8 +992,8 @@ replicate(const char *fs, int quotaclass exit(1); protoprivs = getprivs(protoid, 0, quotaclass, fs); for (qup = protoprivs->head; qup; qup = qup->next) { - qup->qe[QL_BLK].ufsqe_time = 0; - qup->qe[QL_FL].ufsqe_time = 0; + qup->qv[QL_BLK].qv_expiretime = 0; + qup->qv[QL_FL].qv_expiretime = 0; } for (i=0; i<numnames; i++) { id = getidbyname(names[i], quotaclass); @@ -1062,30 +1062,30 @@ assign(const char *fs, int quotaclass, curprivs = getprivs(id, dflag, quotaclass, fs); for (lqup = curprivs->head; lqup; lqup = lqup->next) { - struct ufs_quota_entry *q = lqup->qe; + struct quotaval *q = lqup->qv; if (soft) { if (!dflag && softb && - q[QL_BLK].ufsqe_cur >= softb && - (q[QL_BLK].ufsqe_softlimit == 0 || - q[QL_BLK].ufsqe_cur < - q[QL_BLK].ufsqe_softlimit)) - q[QL_BLK].ufsqe_time = 0; + q[QL_BLK].qv_usage >= softb && + (q[QL_BLK].qv_softlimit == 0 || + q[QL_BLK].qv_usage < + q[QL_BLK].qv_softlimit)) + q[QL_BLK].qv_expiretime = 0; if (!dflag && softi && - q[QL_FL].ufsqe_cur >= softb && - (q[QL_FL].ufsqe_softlimit == 0 || - q[QL_FL].ufsqe_cur < - q[QL_FL].ufsqe_softlimit)) - q[QL_FL].ufsqe_time = 0; - q[QL_BLK].ufsqe_softlimit = softb; - q[QL_FL].ufsqe_softlimit = softi; + q[QL_FL].qv_usage >= softb && + (q[QL_FL].qv_softlimit == 0 || + q[QL_FL].qv_usage < + q[QL_FL].qv_softlimit)) + q[QL_FL].qv_expiretime = 0; + q[QL_BLK].qv_softlimit = softb; + q[QL_FL].qv_softlimit = softi; } if (hard) { - q[QL_BLK].ufsqe_hardlimit = hardb; - q[QL_FL].ufsqe_hardlimit = hardi; + q[QL_BLK].qv_hardlimit = hardb; + q[QL_FL].qv_hardlimit = hardi; } if (grace) { - q[QL_BLK].ufsqe_grace = graceb; - q[QL_FL].ufsqe_grace = gracei; + q[QL_BLK].qv_grace = graceb; + q[QL_FL].qv_grace = gracei; } } putprivs(id, quotaclass, curprivs); Index: src/usr.sbin/repquota/repquota.c diff -u src/usr.sbin/repquota/repquota.c:1.32 src/usr.sbin/repquota/repquota.c:1.33 --- src/usr.sbin/repquota/repquota.c:1.32 Fri Sep 30 22:08:20 2011 +++ src/usr.sbin/repquota/repquota.c Fri Nov 25 16:55:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: repquota.c,v 1.32 2011/09/30 22:08:20 jym Exp $ */ +/* $NetBSD: repquota.c,v 1.33 2011/11/25 16:55:06 dholland Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)repquota.c 8.2 (Berkeley) 11/22/94"; #else -__RCSID("$NetBSD: repquota.c,v 1.32 2011/09/30 22:08:20 jym Exp $"); +__RCSID("$NetBSD: repquota.c,v 1.33 2011/11/25 16:55:06 dholland Exp $"); #endif #endif /* not lint */ @@ -74,7 +74,7 @@ __RCSID("$NetBSD: repquota.c,v 1.32 2011 struct fileusage { struct fileusage *fu_next; - struct ufs_quota_entry fu_qe[QUOTA_NLIMITS]; + struct quotaval fu_qv[QUOTA_NLIMITS]; uint32_t fu_id; char fu_name[1]; /* actually bigger */ @@ -83,7 +83,7 @@ struct fileusage { static struct fileusage *fuhead[QUOTA_NCLASS][FUHASH]; static uint32_t highid[QUOTA_NCLASS]; /* highest addid()'ed identifier per class */ int valid[QUOTA_NCLASS]; -static struct ufs_quota_entry defaultqe[QUOTA_NCLASS][QUOTA_NLIMITS]; +static struct quotaval defaultqv[QUOTA_NCLASS][QUOTA_NLIMITS]; static int vflag = 0; /* verbose */ static int aflag = 0; /* all file systems */ @@ -206,7 +206,7 @@ repquota2(const struct statvfs *vfs, int struct plistref pref; int8_t error8, version = 0; prop_object_iterator_t cmditer, dataiter; - struct ufs_quota_entry *qep; + struct quotaval *qvp; struct fileusage *fup; const char *strid; uint32_t id; @@ -297,16 +297,16 @@ repquota2(const struct statvfs *vfs, int "wrong id string %s in quota entry", strid); } - qep = defaultqe[class]; + qvp = defaultqv[class]; } else { if ((fup = lookup(id, class)) == 0) fup = addid(id, class, (char *)0); - qep = fup->fu_qe; + qvp = fup->fu_qv; } values[QUOTA_LIMIT_BLOCK] = - &qep[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; + &qvp[QUOTA_LIMIT_BLOCK].qv_hardlimit; values[QUOTA_LIMIT_FILE] = - &qep[QUOTA_LIMIT_FILE].ufsqe_hardlimit; + &qvp[QUOTA_LIMIT_FILE].qv_hardlimit; errno = proptoquota64(data, values, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, @@ -369,16 +369,16 @@ repquota1(const struct statvfs *vfs, int continue; if ((fup = lookup(id, class)) == 0) fup = addid(id, class, (char *)0); - dqblk2ufsqe(&dqbuf, fup->fu_qe); - fup->fu_qe[QUOTA_LIMIT_BLOCK].ufsqe_grace = bgrace; - fup->fu_qe[QUOTA_LIMIT_FILE].ufsqe_grace = igrace; - } - defaultqe[class][QUOTA_LIMIT_BLOCK].ufsqe_grace = bgrace; - defaultqe[class][QUOTA_LIMIT_FILE].ufsqe_grace = igrace; - defaultqe[class][QUOTA_LIMIT_BLOCK].ufsqe_softlimit = - defaultqe[class][QUOTA_LIMIT_BLOCK].ufsqe_hardlimit = - defaultqe[class][QUOTA_LIMIT_FILE].ufsqe_softlimit = - defaultqe[class][QUOTA_LIMIT_FILE].ufsqe_hardlimit = UQUAD_MAX; + dqblk_to_quotaval(&dqbuf, fup->fu_qv); + fup->fu_qv[QUOTA_LIMIT_BLOCK].qv_grace = bgrace; + fup->fu_qv[QUOTA_LIMIT_FILE].qv_grace = igrace; + } + defaultqv[class][QUOTA_LIMIT_BLOCK].qv_grace = bgrace; + defaultqv[class][QUOTA_LIMIT_FILE].qv_grace = igrace; + defaultqv[class][QUOTA_LIMIT_BLOCK].qv_softlimit = + defaultqv[class][QUOTA_LIMIT_BLOCK].qv_hardlimit = + defaultqv[class][QUOTA_LIMIT_FILE].qv_softlimit = + defaultqv[class][QUOTA_LIMIT_FILE].qv_hardlimit = UQUAD_MAX; fclose(qf); valid[class] = 1; if (xflag == 0) @@ -393,7 +393,7 @@ printquotas(int class, const struct stat uint32_t id; int i; struct fileusage *fup; - struct ufs_quota_entry *q; + struct quotaval *q; const char *timemsg[QUOTA_NLIMITS]; char overchar[QUOTA_NLIMITS]; time_t now; @@ -437,30 +437,30 @@ printquotas(int class, const struct stat "soft hard grace\n"); for (id = 0; id <= highid[class]; id++) { fup = qremove(id, class); - q = fup->fu_qe; + q = fup->fu_qv; if (fup == 0) continue; for (i = 0; i < QUOTA_NLIMITS; i++) { - switch (QL_STATUS(quota_check_limit(q[i].ufsqe_cur, 1, - q[i].ufsqe_softlimit, q[i].ufsqe_hardlimit, - q[i].ufsqe_time, now))) { + switch (QL_STATUS(quota_check_limit(q[i].qv_usage, 1, + q[i].qv_softlimit, q[i].qv_hardlimit, + q[i].qv_expiretime, now))) { case QL_S_DENY_HARD: case QL_S_DENY_GRACE: case QL_S_ALLOW_SOFT: timemsg[i] = timeprt(b0[i], 8, now, - q[i].ufsqe_time); + q[i].qv_expiretime); overchar[i] = '+'; break; default: timemsg[i] = (vflag && version == 2) ? - timeprt(b0[i], 8, 0, q[i].ufsqe_grace) : ""; + timeprt(b0[i], 8, 0, q[i].qv_grace) : ""; overchar[i] = '-'; break; } } - if (q[QUOTA_LIMIT_BLOCK].ufsqe_cur == 0 && - q[QUOTA_LIMIT_FILE].ufsqe_cur == 0 && vflag == 0 && + if (q[QUOTA_LIMIT_BLOCK].qv_usage == 0 && + q[QUOTA_LIMIT_FILE].qv_usage == 0 && vflag == 0 && overchar[QUOTA_LIMIT_BLOCK] == '-' && overchar[QUOTA_LIMIT_FILE] == '-') continue; @@ -470,18 +470,18 @@ printquotas(int class, const struct stat printf("%-10s", fup->fu_name); printf("%c%c%9s%9s%9s%7s", overchar[QUOTA_LIMIT_BLOCK], overchar[QUOTA_LIMIT_FILE], - intprt(b1, 10, q[QUOTA_LIMIT_BLOCK].ufsqe_cur, + intprt(b1, 10, q[QUOTA_LIMIT_BLOCK].qv_usage, HN_B, hflag), - intprt(b2, 10, q[QUOTA_LIMIT_BLOCK].ufsqe_softlimit, + intprt(b2, 10, q[QUOTA_LIMIT_BLOCK].qv_softlimit, HN_B, hflag), - intprt(b3, 10, q[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit, + intprt(b3, 10, q[QUOTA_LIMIT_BLOCK].qv_hardlimit, HN_B, hflag), timemsg[QUOTA_LIMIT_BLOCK]); printf(" %8s%8s%8s%7s\n", - intprt(b1, 9, q[QUOTA_LIMIT_FILE].ufsqe_cur, 0, hflag), - intprt(b2, 9, q[QUOTA_LIMIT_FILE].ufsqe_softlimit, + intprt(b1, 9, q[QUOTA_LIMIT_FILE].qv_usage, 0, hflag), + intprt(b2, 9, q[QUOTA_LIMIT_FILE].qv_softlimit, 0, hflag), - intprt(b3, 9, q[QUOTA_LIMIT_FILE].ufsqe_hardlimit, + intprt(b3, 9, q[QUOTA_LIMIT_FILE].qv_hardlimit, 0, hflag), timemsg[QUOTA_LIMIT_FILE]); free(fup); @@ -513,9 +513,9 @@ exportquotas(void) if (datas == NULL) errx(1, "can't allocate proplist"); valuesp[QUOTA_LIMIT_BLOCK] = - &defaultqe[class][QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; + &defaultqv[class][QUOTA_LIMIT_BLOCK].qv_hardlimit; valuesp[QUOTA_LIMIT_FILE] = - &defaultqe[class][QUOTA_LIMIT_FILE].ufsqe_hardlimit; + &defaultqv[class][QUOTA_LIMIT_FILE].qv_hardlimit; data = quota64toprop(0, 1, valuesp, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, ufs_quota_limit_names, QUOTA_NLIMITS); @@ -529,9 +529,9 @@ exportquotas(void) if (fup == 0) continue; valuesp[QUOTA_LIMIT_BLOCK] = - &fup->fu_qe[QUOTA_LIMIT_BLOCK].ufsqe_hardlimit; + &fup->fu_qv[QUOTA_LIMIT_BLOCK].qv_hardlimit; valuesp[QUOTA_LIMIT_FILE] = - &fup->fu_qe[QUOTA_LIMIT_FILE].ufsqe_hardlimit; + &fup->fu_qv[QUOTA_LIMIT_FILE].qv_hardlimit; data = quota64toprop(id, 0, valuesp, ufs_quota_entry_names, UFS_QUOTA_NENTRIES, ufs_quota_limit_names, QUOTA_NLIMITS); @@ -637,7 +637,7 @@ addid(uint32_t id, int class, const char } else { snprintf(fup->fu_name, len + 1, "%u", id); } - fup->fu_qe[QUOTA_LIMIT_BLOCK] = defaultqe[class][QUOTA_LIMIT_BLOCK]; - fup->fu_qe[QUOTA_LIMIT_FILE] = defaultqe[class][QUOTA_LIMIT_FILE]; + fup->fu_qv[QUOTA_LIMIT_BLOCK] = defaultqv[class][QUOTA_LIMIT_BLOCK]; + fup->fu_qv[QUOTA_LIMIT_FILE] = defaultqv[class][QUOTA_LIMIT_FILE]; return fup; }