Add lfs_ or ulfs_ in front of extern symbols lacking them, mostly

quota-related (and particularly quota2-related) stuff.
This commit is contained in:
dholland 2013-06-06 00:49:28 +00:00
parent 49bebcb46c
commit 7c08dd6617
17 changed files with 309 additions and 309 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_balloc.c,v 1.75 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: lfs_balloc.c,v 1.76 2013/06/06 00:49:28 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.75 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.76 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -412,7 +412,7 @@ lfs_fragextend(struct vnode *vp, int osize, int nsize, daddr_t lbn, struct buf *
goto out;
}
#ifdef LFS_QUOTA
if ((error = chkdq(ip, frags, cred, 0))) {
if ((error = lfs_chkdq(ip, frags, cred, 0))) {
if (bpp)
brelse(*bpp, 0);
goto out;
@ -430,7 +430,7 @@ lfs_fragextend(struct vnode *vp, int osize, int nsize, daddr_t lbn, struct buf *
if (bpp)
brelse(*bpp, 0);
#ifdef LFS_QUOTA
chkdq(ip, -frags, cred, 0);
lfs_chkdq(ip, -frags, cred, 0);
#endif
rw_exit(&fs->lfs_fraglock);
lfs_availwait(fs, frags);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_inode.c,v 1.130 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: lfs_inode.c,v 1.131 2013/06/06 00:49:28 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.130 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.131 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -587,7 +587,7 @@ done:
oip->i_flag |= IN_CHANGE;
#ifdef LFS_QUOTA
(void) chkdq(oip, -blocksreleased, NOCRED, 0);
(void) lfs_chkdq(oip, -blocksreleased, NOCRED, 0);
#endif
lfs_reserve(fs, ovp, NULL,
-btofsb(fs, (2 * ULFS_NIADDR + 3) << fs->lfs_bshift));

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.301 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.302 2013/06/06 00:49:28 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.301 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.302 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -1191,7 +1191,7 @@ lfs_unmount(struct mount *mp, int mntflags)
mutex_exit(&lfs_lock);
#ifdef LFS_QUOTA
if ((error = quota1_umount(mp, flags)) != 0)
if ((error = lfsquota1_umount(mp, flags)) != 0)
return (error);
#endif
if ((error = vflush(mp, fs->lfs_ivnode, flags)) != 0)
@ -1329,7 +1329,7 @@ lfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
error = lfs_segwrite(mp, SEGM_CKP | (waitfor ? SEGM_SYNC : 0));
lfs_writer_leave(fs);
#ifdef LFS_QUOTA
qsync(mp);
lfs_qsync(mp);
#endif
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_extern.h,v 1.2 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_extern.h,v 1.3 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_extern.h,v 1.72 2012/05/09 00:21:18 riastradh Exp */
/*-
@ -165,23 +165,23 @@ int ulfs_gro_lock_directory(struct mount *, struct vnode *);
/* ulfs_quota.c */
/*
* Flags to chkdq() and chkiq()
* Flags to lfs_chkdq() and lfs_chkiq()
*/
#define FORCE 0x01 /* force usage changes independent of limits */
void ulfsquota_init(struct inode *);
void ulfsquota_free(struct inode *);
int chkdq(struct inode *, int64_t, kauth_cred_t, int);
int chkiq(struct inode *, int32_t, kauth_cred_t, int);
int quota_handle_cmd(struct mount *, struct lwp *,
int lfs_chkdq(struct inode *, int64_t, kauth_cred_t, int);
int lfs_chkiq(struct inode *, int32_t, kauth_cred_t, int);
int lfsquota_handle_cmd(struct mount *, struct lwp *,
struct quotactl_args *);
int qsync(struct mount *);
int lfs_qsync(struct mount *);
/* ulfs_quota1.c */
int quota1_umount(struct mount *, int);
int lfsquota1_umount(struct mount *, int);
/* ulfs_quota2.c */
int quota2_umount(struct mount *, int);
int lfsquota2_umount(struct mount *, int);
/* ulfs_vfsops.c */
void ulfs_init(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_inode.c,v 1.4 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_inode.c,v 1.5 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_inode.c,v 1.89 2013/01/22 09:39:18 dholland Exp */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_inode.c,v 1.4 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_inode.c,v 1.5 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -139,7 +139,7 @@ ulfs_inactive(void *v)
error = ULFS_TRUNCATE(vp, (off_t)0, 0, NOCRED);
}
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
(void)chkiq(ip, -1, NOCRED, 0);
(void)lfs_chkiq(ip, -1, NOCRED, 0);
#endif
DIP_ASSIGN(ip, rdev, 0);
mode = ip->i_mode;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_lookup.c,v 1.4 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_lookup.c,v 1.5 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.4 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.5 2013/06/06 00:49:28 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_lfs.h"
@ -72,9 +72,9 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.4 2013/06/06 00:48:04 dholland Exp
#include <miscfs/genfs/genfs.h>
#ifdef DIAGNOSTIC
int dirchk = 1;
int lfs_dirchk = 1;
#else
int dirchk = 0;
int lfs_dirchk = 0;
#endif
/*
@ -324,12 +324,12 @@ searchloop:
* Full validation checks are slow, so we only check
* enough to insure forward progress through the
* directory. Complete checks can be run by patching
* "dirchk" to be true.
* "lfs_dirchk" to be true.
*/
KASSERT(bp != NULL);
ep = (struct direct *)((char *)bp->b_data + entryoffsetinblock);
if (ep->d_reclen == 0 ||
(dirchk && ulfs_dirbadentry(vdp, ep, entryoffsetinblock))) {
(lfs_dirchk && ulfs_dirbadentry(vdp, ep, entryoffsetinblock))) {
int i;
ulfs_dirbad(dp, results->ulr_offset, "mangled entry");

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota.c,v 1.4 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota.c,v 1.5 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_quota.c,v 1.112 2012/09/09 04:27:49 manu Exp */
/*
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota.c,v 1.4 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota.c,v 1.5 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -58,9 +58,9 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_quota.c,v 1.4 2013/06/06 00:48:04 dholland Exp
#include <ufs/lfs/ulfs_extern.h>
#include <ufs/lfs/ulfs_quota.h>
kmutex_t dqlock;
kcondvar_t dqcv;
const char *quotatypes[ULFS_MAXQUOTAS] = INITQFNAMES;
kmutex_t lfs_dqlock;
kcondvar_t lfs_dqcv;
const char *lfs_quotatypes[ULFS_MAXQUOTAS] = INITQFNAMES;
/*
* Code pertaining to management of the in-core dquot data structures.
@ -122,7 +122,7 @@ ulfsquota_free(struct inode *ip)
int i;
for (i = 0; i < ULFS_MAXQUOTAS; i++) {
dqrele(ITOV(ip), ip->i_dquot[i]);
lfs_dqrele(ITOV(ip), ip->i_dquot[i]);
ip->i_dquot[i] = NODQUOT;
}
}
@ -131,7 +131,7 @@ ulfsquota_free(struct inode *ip)
* Update disk usage, and take corrective action.
*/
int
chkdq(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
lfs_chkdq(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
{
/* do not track snapshot usage, or we will deadlock */
if ((ip->i_flags & SF_SNAPSHOT) != 0)
@ -139,11 +139,11 @@ chkdq(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
#ifdef LFS_QUOTA
if (ip->i_ump->um_flags & ULFS_QUOTA)
return chkdq1(ip, change, cred, flags);
return lfs_chkdq1(ip, change, cred, flags);
#endif
#ifdef LFS_QUOTA2
if (ip->i_ump->um_flags & ULFS_QUOTA2)
return chkdq2(ip, change, cred, flags);
return lfs_chkdq2(ip, change, cred, flags);
#endif
return 0;
}
@ -152,24 +152,24 @@ chkdq(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
* Check the inode limit, applying corrective action.
*/
int
chkiq(struct inode *ip, int32_t change, kauth_cred_t cred, int flags)
lfs_chkiq(struct inode *ip, int32_t change, kauth_cred_t cred, int flags)
{
/* do not track snapshot usage, or we will deadlock */
if ((ip->i_flags & SF_SNAPSHOT) != 0)
return 0;
#ifdef LFS_QUOTA
if (ip->i_ump->um_flags & ULFS_QUOTA)
return chkiq1(ip, change, cred, flags);
return lfs_chkiq1(ip, change, cred, flags);
#endif
#ifdef LFS_QUOTA2
if (ip->i_ump->um_flags & ULFS_QUOTA2)
return chkiq2(ip, change, cred, flags);
return lfs_chkiq2(ip, change, cred, flags);
#endif
return 0;
}
int
quota_handle_cmd(struct mount *mp, struct lwp *l,
lfsquota_handle_cmd(struct mount *mp, struct lwp *l,
struct quotactl_args *args)
{
int error = 0;
@ -363,12 +363,12 @@ quota_handle_cmd_get(struct mount *mp, struct lwp *l,
return error;
#ifdef LFS_QUOTA
if (ump->um_flags & ULFS_QUOTA) {
error = quota1_handle_cmd_get(ump, qk, qv);
error = lfsquota1_handle_cmd_get(ump, qk, qv);
} else
#endif
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_get(ump, qk, qv);
error = lfsquota2_handle_cmd_get(ump, qk, qv);
} else
#endif
panic("quota_handle_cmd_get: no support ?");
@ -410,12 +410,12 @@ quota_handle_cmd_put(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA
if (ump->um_flags & ULFS_QUOTA)
error = quota1_handle_cmd_put(ump, qk, qv);
error = lfsquota1_handle_cmd_put(ump, qk, qv);
else
#endif
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_put(ump, qk, qv);
error = lfsquota2_handle_cmd_put(ump, qk, qv);
} else
#endif
panic("quota_handle_cmd_get: no support ?");
@ -456,7 +456,7 @@ quota_handle_cmd_delete(struct mount *mp, struct lwp *l,
goto err;
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_delete(ump, qk);
error = lfsquota2_handle_cmd_delete(ump, qk);
} else
#endif
panic("quota_handle_cmd_get: no support ?");
@ -499,7 +499,7 @@ quota_handle_cmd_cursorget(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_cursorget(ump, cursor, keys, vals,
error = lfsquota2_handle_cmd_cursorget(ump, cursor, keys, vals,
maxnum, ret);
} else
#endif
@ -528,7 +528,7 @@ quota_handle_cmd_cursoropen(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_cursoropen(ump, cursor);
error = lfsquota2_handle_cmd_cursoropen(ump, cursor);
} else
#endif
error = EOPNOTSUPP;
@ -556,7 +556,7 @@ quota_handle_cmd_cursorclose(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_cursorclose(ump, cursor);
error = lfsquota2_handle_cmd_cursorclose(ump, cursor);
} else
#endif
error = EOPNOTSUPP;
@ -581,7 +581,7 @@ quota_handle_cmd_cursorskipidtype(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_cursorskipidtype(ump, cursor, idtype);
error = lfsquota2_handle_cmd_cursorskipidtype(ump, cursor, idtype);
} else
#endif
error = EOPNOTSUPP;
@ -606,7 +606,7 @@ quota_handle_cmd_cursoratend(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_cursoratend(ump, cursor, ret);
error = lfsquota2_handle_cmd_cursoratend(ump, cursor, ret);
} else
#endif
error = EOPNOTSUPP;
@ -629,7 +629,7 @@ quota_handle_cmd_cursorrewind(struct mount *mp, struct lwp *l,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
error = quota2_handle_cmd_cursorrewind(ump, cursor);
error = lfsquota2_handle_cmd_cursorrewind(ump, cursor);
} else
#endif
error = EOPNOTSUPP;
@ -659,7 +659,7 @@ quota_handle_cmd_quotaon(struct mount *mp, struct lwp *l,
return error;
}
#ifdef LFS_QUOTA
error = quota1_handle_cmd_quotaon(l, ump, idtype, qfile);
error = lfsquota1_handle_cmd_quotaon(l, ump, idtype, qfile);
#else
error = EOPNOTSUPP;
#endif
@ -687,7 +687,7 @@ quota_handle_cmd_quotaoff(struct mount *mp, struct lwp *l,
return error;
}
#ifdef LFS_QUOTA
error = quota1_handle_cmd_quotaoff(l, ump, idtype);
error = lfsquota1_handle_cmd_quotaoff(l, ump, idtype);
#else
error = EOPNOTSUPP;
#endif
@ -699,18 +699,18 @@ quota_handle_cmd_quotaoff(struct mount *mp, struct lwp *l,
* Initialize the quota system.
*/
void
dqinit(void)
lfs_dqinit(void)
{
mutex_init(&dqlock, MUTEX_DEFAULT, IPL_NONE);
cv_init(&dqcv, "quota");
mutex_init(&lfs_dqlock, MUTEX_DEFAULT, IPL_NONE);
cv_init(&lfs_dqcv, "quota");
dqhashtbl = hashinit(desiredvnodes, HASH_LIST, true, &dqhash);
dquot_cache = pool_cache_init(sizeof(struct dquot), 0, 0, 0, "lfsdq",
NULL, IPL_NONE, NULL, NULL, NULL);
}
void
dqreinit(void)
lfs_dqreinit(void)
{
struct dquot *dq;
struct dqhashhead *oldhash, *hash;
@ -719,7 +719,7 @@ dqreinit(void)
int i;
hash = hashinit(desiredvnodes, HASH_LIST, true, &mask);
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
oldhash = dqhashtbl;
oldmask = dqhash;
dqhashtbl = hash;
@ -732,7 +732,7 @@ dqreinit(void)
LIST_INSERT_HEAD(&dqhashtbl[hashval], dq, dq_hash);
}
}
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
hashdone(oldhash, HASH_LIST, oldmask);
}
@ -740,13 +740,13 @@ dqreinit(void)
* Free resources held by quota system.
*/
void
dqdone(void)
lfs_dqdone(void)
{
pool_cache_destroy(dquot_cache);
hashdone(dqhashtbl, HASH_LIST, dqhash);
cv_destroy(&dqcv);
mutex_destroy(&dqlock);
cv_destroy(&lfs_dqcv);
mutex_destroy(&lfs_dqlock);
}
/*
@ -758,7 +758,7 @@ dqdone(void)
* additional dquots set up here.
*/
int
getinoquota(struct inode *ip)
lfs_getinoquota(struct inode *ip)
{
struct ulfsmount *ump = ip->i_ump;
struct vnode *vp = ITOV(ip);
@ -781,7 +781,7 @@ getinoquota(struct inode *ip)
*/
if (ip->i_dquot[i] != NODQUOT &&
ip->i_dquot[i]->dq_id != ino_ids[i]) {
dqrele(ITOV(ip), ip->i_dquot[i]);
lfs_dqrele(ITOV(ip), ip->i_dquot[i]);
ip->i_dquot[i] = NODQUOT;
}
/*
@ -789,7 +789,7 @@ getinoquota(struct inode *ip)
* ENODEV means that quotas are not enabled.
*/
if (ip->i_dquot[i] == NODQUOT &&
(error = dqget(vp, ino_ids[i], ump, i, &ip->i_dquot[i])) &&
(error = lfs_dqget(vp, ino_ids[i], ump, i, &ip->i_dquot[i])) &&
error != ENODEV)
return (error);
}
@ -801,7 +801,7 @@ getinoquota(struct inode *ip)
* reading the information from the file if necessary.
*/
int
dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
lfs_dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
struct dquot **dqp)
{
struct dquot *dq, *ndq;
@ -810,9 +810,9 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
int error = 0; /* XXX gcc */
/* Lock to see an up to date value for QTF_CLOSING. */
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
if ((ump->um_flags & (ULFS_QUOTA|ULFS_QUOTA2)) == 0) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
*dqp = NODQUOT;
return (ENODEV);
}
@ -820,7 +820,7 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
#ifdef LFS_QUOTA
if (ump->um_flags & ULFS_QUOTA) {
if (dqvp == NULLVP || (ump->umq1_qflags[type] & QTF_CLOSING)) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
*dqp = NODQUOT;
return (ENODEV);
}
@ -829,7 +829,7 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2) {
if (dqvp == NULLVP) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
*dqp = NODQUOT;
return (ENODEV);
}
@ -845,15 +845,15 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
dq->dq_ump->um_quotas[dq->dq_type] != dqvp)
continue;
KASSERT(dq->dq_cnt > 0);
dqref(dq);
mutex_exit(&dqlock);
lfs_dqref(dq);
mutex_exit(&lfs_dqlock);
*dqp = dq;
return (0);
}
/*
* Not in cache, allocate a new one.
*/
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
ndq = pool_cache_get(dquot_cache, PR_WAITOK);
/*
* Initialize the contents of the dquot structure.
@ -864,7 +864,7 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
ndq->dq_ump = ump;
ndq->dq_type = type;
mutex_init(&ndq->dq_interlock, MUTEX_DEFAULT, IPL_NONE);
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
dqh = &dqhashtbl[DQHASH(dqvp, id)];
LIST_FOREACH(dq, dqh, dq_hash) {
if (dq->dq_id != id ||
@ -874,8 +874,8 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
* Another thread beat us allocating this dquot.
*/
KASSERT(dq->dq_cnt > 0);
dqref(dq);
mutex_exit(&dqlock);
lfs_dqref(dq);
mutex_exit(&lfs_dqlock);
mutex_destroy(&ndq->dq_interlock);
pool_cache_put(dquot_cache, ndq);
*dqp = dq;
@ -883,27 +883,27 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
}
dq = ndq;
LIST_INSERT_HEAD(dqh, dq, dq_hash);
dqref(dq);
lfs_dqref(dq);
mutex_enter(&dq->dq_interlock);
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
#ifdef LFS_QUOTA
if (ump->um_flags & ULFS_QUOTA)
error = dq1get(dqvp, id, ump, type, dq);
error = lfs_dq1get(dqvp, id, ump, type, dq);
#endif
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2)
error = dq2get(dqvp, id, ump, type, dq);
error = lfs_dq2get(dqvp, id, ump, type, dq);
#endif
/*
* I/O error in reading quota file, release
* quota structure and reflect problem to caller.
*/
if (error) {
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
LIST_REMOVE(dq, dq_hash);
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
mutex_exit(&dq->dq_interlock);
dqrele(vp, dq);
lfs_dqrele(vp, dq);
*dqp = NODQUOT;
return (error);
}
@ -916,10 +916,10 @@ dqget(struct vnode *vp, u_long id, struct ulfsmount *ump, int type,
* Obtain a reference to a dquot.
*/
void
dqref(struct dquot *dq)
lfs_dqref(struct dquot *dq)
{
KASSERT(mutex_owned(&dqlock));
KASSERT(mutex_owned(&lfs_dqlock));
dq->dq_cnt++;
KASSERT(dq->dq_cnt > 0);
}
@ -928,51 +928,51 @@ dqref(struct dquot *dq)
* Release a reference to a dquot.
*/
void
dqrele(struct vnode *vp, struct dquot *dq)
lfs_dqrele(struct vnode *vp, struct dquot *dq)
{
if (dq == NODQUOT)
return;
mutex_enter(&dq->dq_interlock);
for (;;) {
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
if (dq->dq_cnt > 1) {
dq->dq_cnt--;
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
mutex_exit(&dq->dq_interlock);
return;
}
if ((dq->dq_flags & DQ_MOD) == 0)
break;
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
#ifdef LFS_QUOTA
if (dq->dq_ump->um_flags & ULFS_QUOTA)
(void) dq1sync(vp, dq);
(void) lfs_dq1sync(vp, dq);
#endif
#ifdef LFS_QUOTA2
if (dq->dq_ump->um_flags & ULFS_QUOTA2)
(void) dq2sync(vp, dq);
(void) lfs_dq2sync(vp, dq);
#endif
}
KASSERT(dq->dq_cnt == 1 && (dq->dq_flags & DQ_MOD) == 0);
LIST_REMOVE(dq, dq_hash);
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
mutex_exit(&dq->dq_interlock);
mutex_destroy(&dq->dq_interlock);
pool_cache_put(dquot_cache, dq);
}
int
qsync(struct mount *mp)
lfs_qsync(struct mount *mp)
{
struct ulfsmount *ump = VFSTOULFS(mp);
#ifdef LFS_QUOTA
if (ump->um_flags & ULFS_QUOTA)
return q1sync(mp);
return lfs_q1sync(mp);
#endif
#ifdef LFS_QUOTA2
if (ump->um_flags & ULFS_QUOTA2)
return q2sync(mp);
return lfs_q2sync(mp);
#endif
return 0;
}
@ -982,15 +982,15 @@ qsync(struct mount *mp)
* Check the hash chains for stray dquot's.
*/
void
dqflush(struct vnode *vp)
lfs_dqflush(struct vnode *vp)
{
struct dquot *dq;
int i;
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
for (i = 0; i <= dqhash; i++)
LIST_FOREACH(dq, &dqhashtbl[i], dq_hash)
KASSERT(dq->dq_ump->um_quotas[dq->dq_type] != vp);
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota.h,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota.h,v 1.4 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_quota.h,v 1.21 2012/02/18 06:13:23 matt Exp */
/*
@ -99,48 +99,48 @@ struct dquot {
*/
#define NODQUOT NULL
extern kmutex_t dqlock;
extern kcondvar_t dqcv;
extern kmutex_t lfs_dqlock;
extern kcondvar_t lfs_dqcv;
/*
* Quota name to error message mapping.
*/
extern const char *quotatypes[ULFS_MAXQUOTAS];
extern const char *lfs_quotatypes[ULFS_MAXQUOTAS];
int getinoquota(struct inode *);
int dqget(struct vnode *, u_long, struct ulfsmount *, int, struct dquot **);
void dqref(struct dquot *);
void dqrele(struct vnode *, struct dquot *);
void dqflush(struct vnode *);
int lfs_getinoquota(struct inode *);
int lfs_dqget(struct vnode *, u_long, struct ulfsmount *, int, struct dquot **);
void lfs_dqref(struct dquot *);
void lfs_dqrele(struct vnode *, struct dquot *);
void lfs_dqflush(struct vnode *);
int chkdq1(struct inode *, int64_t, kauth_cred_t, int);
int chkiq1(struct inode *, int32_t, kauth_cred_t, int);
int q1sync(struct mount *);
int dq1get(struct vnode *, u_long, struct ulfsmount *, int, struct dquot *);
int dq1sync(struct vnode *, struct dquot *);
int quota1_handle_cmd_get(struct ulfsmount *, const struct quotakey *,
int lfs_chkdq1(struct inode *, int64_t, kauth_cred_t, int);
int lfs_chkiq1(struct inode *, int32_t, kauth_cred_t, int);
int lfs_q1sync(struct mount *);
int lfs_dq1get(struct vnode *, u_long, struct ulfsmount *, int, struct dquot *);
int lfs_dq1sync(struct vnode *, struct dquot *);
int lfsquota1_handle_cmd_get(struct ulfsmount *, const struct quotakey *,
struct quotaval *);
int quota1_handle_cmd_put(struct ulfsmount *, const struct quotakey *,
int lfsquota1_handle_cmd_put(struct ulfsmount *, const struct quotakey *,
const struct quotaval *);
int quota1_handle_cmd_quotaon(struct lwp *, struct ulfsmount *, int,
int lfsquota1_handle_cmd_quotaon(struct lwp *, struct ulfsmount *, int,
const char *);
int quota1_handle_cmd_quotaoff(struct lwp *, struct ulfsmount *, int);
int lfsquota1_handle_cmd_quotaoff(struct lwp *, struct ulfsmount *, int);
int chkdq2(struct inode *, int64_t, kauth_cred_t, int);
int chkiq2(struct inode *, int32_t, kauth_cred_t, int);
int quota2_handle_cmd_get(struct ulfsmount *, const struct quotakey *,
int lfs_chkdq2(struct inode *, int64_t, kauth_cred_t, int);
int lfs_chkiq2(struct inode *, int32_t, kauth_cred_t, int);
int lfsquota2_handle_cmd_get(struct ulfsmount *, const struct quotakey *,
struct quotaval *);
int quota2_handle_cmd_put(struct ulfsmount *, const struct quotakey *,
int lfsquota2_handle_cmd_put(struct ulfsmount *, const struct quotakey *,
const struct quotaval *);
int quota2_handle_cmd_delete(struct ulfsmount *, const struct quotakey *);
int quota2_handle_cmd_cursorget(struct ulfsmount *, struct quotakcursor *,
int lfsquota2_handle_cmd_delete(struct ulfsmount *, const struct quotakey *);
int lfsquota2_handle_cmd_cursorget(struct ulfsmount *, struct quotakcursor *,
struct quotakey *, struct quotaval *, unsigned, unsigned *);
int quota2_handle_cmd_cursoropen(struct ulfsmount *, struct quotakcursor *);
int quota2_handle_cmd_cursorclose(struct ulfsmount *, struct quotakcursor *);
int quota2_handle_cmd_cursorskipidtype(struct ulfsmount *, struct quotakcursor *,
int lfsquota2_handle_cmd_cursoropen(struct ulfsmount *, struct quotakcursor *);
int lfsquota2_handle_cmd_cursorclose(struct ulfsmount *, struct quotakcursor *);
int lfsquota2_handle_cmd_cursorskipidtype(struct ulfsmount *, struct quotakcursor *,
int);
int quota2_handle_cmd_cursoratend(struct ulfsmount *, struct quotakcursor *,
int lfsquota2_handle_cmd_cursoratend(struct ulfsmount *, struct quotakcursor *,
int *);
int quota2_handle_cmd_cursorrewind(struct ulfsmount *, struct quotakcursor *);
int q2sync(struct mount *);
int dq2get(struct vnode *, u_long, struct ulfsmount *, int, struct dquot *);
int dq2sync(struct vnode *, struct dquot *);
int lfsquota2_handle_cmd_cursorrewind(struct ulfsmount *, struct quotakcursor *);
int lfs_q2sync(struct mount *);
int lfs_dq2get(struct vnode *, u_long, struct ulfsmount *, int, struct dquot *);
int lfs_dq2sync(struct vnode *, struct dquot *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota1.c,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota1.c,v 1.4 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_quota1.c,v 1.18 2012/02/02 03:00:48 matt Exp */
/*
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota1.c,v 1.3 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota1.c,v 1.4 2013/06/06 00:49:28 dholland Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -61,13 +61,13 @@ static int chkiqchg(struct inode *, int32_t, kauth_cred_t, int);
* Update disk usage, and take corrective action.
*/
int
chkdq1(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
lfs_chkdq1(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
{
struct dquot *dq;
int i;
int ncurblocks, error;
if ((error = getinoquota(ip)) != 0)
if ((error = lfs_getinoquota(ip)) != 0)
return error;
if (change == 0)
return (0);
@ -131,7 +131,7 @@ chkdqchg(struct inode *ip, int64_t change, kauth_cred_t cred, int type)
ip->i_uid == kauth_cred_geteuid(cred)) {
uprintf("\n%s: write failed, %s disk limit reached\n",
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
quotatypes[type]);
lfs_quotatypes[type]);
dq->dq_flags |= DQ_WARN(QL_BLOCK);
}
return (EDQUOT);
@ -147,7 +147,7 @@ chkdqchg(struct inode *ip, int64_t change, kauth_cred_t cred, int type)
if (ip->i_uid == kauth_cred_geteuid(cred))
uprintf("\n%s: warning, %s %s\n",
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
quotatypes[type], "disk quota exceeded");
lfs_quotatypes[type], "disk quota exceeded");
return (0);
}
if (time_second > dq->dq_btime) {
@ -155,7 +155,7 @@ chkdqchg(struct inode *ip, int64_t change, kauth_cred_t cred, int type)
ip->i_uid == kauth_cred_geteuid(cred)) {
uprintf("\n%s: write failed, %s %s\n",
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
quotatypes[type],
lfs_quotatypes[type],
"disk quota exceeded for too long");
dq->dq_flags |= DQ_WARN(QL_BLOCK);
}
@ -169,13 +169,13 @@ chkdqchg(struct inode *ip, int64_t change, kauth_cred_t cred, int type)
* Check the inode limit, applying corrective action.
*/
int
chkiq1(struct inode *ip, int32_t change, kauth_cred_t cred, int flags)
lfs_chkiq1(struct inode *ip, int32_t change, kauth_cred_t cred, int flags)
{
struct dquot *dq;
int i;
int ncurinodes, error;
if ((error = getinoquota(ip)) != 0)
if ((error = lfs_getinoquota(ip)) != 0)
return error;
if (change == 0)
return (0);
@ -238,7 +238,7 @@ chkiqchg(struct inode *ip, int32_t change, kauth_cred_t cred, int type)
ip->i_uid == kauth_cred_geteuid(cred)) {
uprintf("\n%s: write failed, %s inode limit reached\n",
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
quotatypes[type]);
lfs_quotatypes[type]);
dq->dq_flags |= DQ_WARN(QL_FILE);
}
return (EDQUOT);
@ -254,7 +254,7 @@ chkiqchg(struct inode *ip, int32_t change, kauth_cred_t cred, int type)
if (ip->i_uid == kauth_cred_geteuid(cred))
uprintf("\n%s: warning, %s %s\n",
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
quotatypes[type], "inode quota exceeded");
lfs_quotatypes[type], "inode quota exceeded");
return (0);
}
if (time_second > dq->dq_itime) {
@ -262,7 +262,7 @@ chkiqchg(struct inode *ip, int32_t change, kauth_cred_t cred, int type)
ip->i_uid == kauth_cred_geteuid(cred)) {
uprintf("\n%s: write failed, %s %s\n",
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
quotatypes[type],
lfs_quotatypes[type],
"inode quota exceeded for too long");
dq->dq_flags |= DQ_WARN(QL_FILE);
}
@ -273,7 +273,7 @@ chkiqchg(struct inode *ip, int32_t change, kauth_cred_t cred, int type)
}
int
quota1_umount(struct mount *mp, int flags)
lfsquota1_umount(struct mount *mp, int flags)
{
int i, error;
struct ulfsmount *ump = VFSTOULFS(mp);
@ -287,7 +287,7 @@ quota1_umount(struct mount *mp, int flags)
for (i = 0; i < ULFS_MAXQUOTAS; i++) {
if (ump->um_quotas[i] != NULLVP) {
quota1_handle_cmd_quotaoff(l, ump, i);
lfsquota1_handle_cmd_quotaoff(l, ump, i);
}
}
return 0;
@ -301,7 +301,7 @@ quota1_umount(struct mount *mp, int flags)
* set up a quota file for a particular file system.
*/
int
quota1_handle_cmd_quotaon(struct lwp *l, struct ulfsmount *ump, int type,
lfsquota1_handle_cmd_quotaon(struct lwp *l, struct ulfsmount *ump, int type,
const char *fname)
{
struct mount *mp = ump->um_mountp;
@ -343,12 +343,12 @@ quota1_handle_cmd_quotaon(struct lwp *l, struct ulfsmount *ump, int type,
return (EACCES);
}
if (*vpp != vp)
quota1_handle_cmd_quotaoff(l, ump, type);
mutex_enter(&dqlock);
lfsquota1_handle_cmd_quotaoff(l, ump, type);
mutex_enter(&lfs_dqlock);
while ((ump->umq1_qflags[type] & (QTF_CLOSING | QTF_OPENING)) != 0)
cv_wait(&dqcv, &dqlock);
cv_wait(&lfs_dqcv, &lfs_dqlock);
ump->umq1_qflags[type] |= QTF_OPENING;
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
mp->mnt_flag |= MNT_QUOTA;
vp->v_vflag |= VV_SYSTEM; /* XXXSMP */
*vpp = vp;
@ -360,12 +360,12 @@ quota1_handle_cmd_quotaon(struct lwp *l, struct ulfsmount *ump, int type,
ump->um_cred[type] = l->l_cred;
ump->umq1_btime[type] = MAX_DQ_TIME;
ump->umq1_itime[type] = MAX_IQ_TIME;
if (dqget(NULLVP, 0, ump, type, &dq) == 0) {
if (lfs_dqget(NULLVP, 0, ump, type, &dq) == 0) {
if (dq->dq_btime > 0)
ump->umq1_btime[type] = dq->dq_btime;
if (dq->dq_itime > 0)
ump->umq1_itime[type] = dq->dq_itime;
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
}
/* Allocate a marker vnode. */
mvp = vnalloc(mp);
@ -391,7 +391,7 @@ again:
(void)vunmark(mvp);
goto again;
}
if ((error = getinoquota(VTOI(vp))) != 0) {
if ((error = lfs_getinoquota(VTOI(vp))) != 0) {
vput(vp);
mutex_enter(&mntvnode_lock);
(void)vunmark(mvp);
@ -403,14 +403,14 @@ again:
mutex_exit(&mntvnode_lock);
vnfree(mvp);
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
ump->umq1_qflags[type] &= ~QTF_OPENING;
cv_broadcast(&dqcv);
cv_broadcast(&lfs_dqcv);
if (error == 0)
ump->um_flags |= ULFS_QUOTA;
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
if (error)
quota1_handle_cmd_quotaoff(l, ump, type);
lfsquota1_handle_cmd_quotaoff(l, ump, type);
return (error);
}
@ -418,7 +418,7 @@ again:
* turn off disk quotas for a filesystem.
*/
int
quota1_handle_cmd_quotaoff(struct lwp *l, struct ulfsmount *ump, int type)
lfsquota1_handle_cmd_quotaoff(struct lwp *l, struct ulfsmount *ump, int type)
{
struct mount *mp = ump->um_mountp;
struct vnode *vp;
@ -431,17 +431,17 @@ quota1_handle_cmd_quotaoff(struct lwp *l, struct ulfsmount *ump, int type)
/* Allocate a marker vnode. */
mvp = vnalloc(mp);
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
while ((ump->umq1_qflags[type] & (QTF_CLOSING | QTF_OPENING)) != 0)
cv_wait(&dqcv, &dqlock);
cv_wait(&lfs_dqcv, &lfs_dqlock);
if ((qvp = ump->um_quotas[type]) == NULLVP) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
vnfree(mvp);
return (0);
}
ump->umq1_qflags[type] |= QTF_CLOSING;
ump->um_flags &= ~ULFS_QUOTA;
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
/*
* Search vnodes associated with this mount point,
* deleting any references to quota file being closed.
@ -466,17 +466,17 @@ again:
ip = VTOI(vp);
dq = ip->i_dquot[type];
ip->i_dquot[type] = NODQUOT;
dqrele(vp, dq);
lfs_dqrele(vp, dq);
vput(vp);
mutex_enter(&mntvnode_lock);
}
mutex_exit(&mntvnode_lock);
#ifdef DIAGNOSTIC
dqflush(qvp);
lfs_dqflush(qvp);
#endif
qvp->v_vflag &= ~VV_SYSTEM;
error = vn_close(qvp, FREAD|FWRITE, l->l_cred);
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
ump->um_quotas[type] = NULLVP;
cred = ump->um_cred[type];
ump->um_cred[type] = NOCRED;
@ -484,8 +484,8 @@ again:
if (ump->um_quotas[i] != NULLVP)
break;
ump->umq1_qflags[type] &= ~QTF_CLOSING;
cv_broadcast(&dqcv);
mutex_exit(&dqlock);
cv_broadcast(&lfs_dqcv);
mutex_exit(&lfs_dqlock);
kauth_cred_free(cred);
if (i == ULFS_MAXQUOTAS)
mp->mnt_flag &= ~MNT_QUOTA;
@ -493,7 +493,7 @@ again:
}
int
quota1_handle_cmd_get(struct ulfsmount *ump, const struct quotakey *qk,
lfsquota1_handle_cmd_get(struct ulfsmount *ump, const struct quotakey *qk,
struct quotaval *qv)
{
struct dquot *dq;
@ -509,15 +509,15 @@ quota1_handle_cmd_get(struct ulfsmount *ump, const struct quotakey *qk,
return ENODEV;
if (id == QUOTA_DEFAULTID) { /* we want the grace period of id 0 */
if ((error = dqget(NULLVP, 0, ump, idtype, &dq)) != 0)
if ((error = lfs_dqget(NULLVP, 0, ump, idtype, &dq)) != 0)
return error;
} else {
if ((error = dqget(NULLVP, id, ump, idtype, &dq)) != 0)
if ((error = lfs_dqget(NULLVP, id, ump, idtype, &dq)) != 0)
return error;
}
dqblk_to_quotavals(&dq->dq_un.dq1_dqb, &blocks, &files);
dqrele(NULLVP, dq);
lfs_dqblk_to_quotavals(&dq->dq_un.dq1_dqb, &blocks, &files);
lfs_dqrele(NULLVP, dq);
if (id == QUOTA_DEFAULTID) {
if (blocks.qv_expiretime > 0)
blocks.qv_grace = blocks.qv_expiretime;
@ -553,7 +553,7 @@ quota1_encode_limit(uint64_t lim)
}
int
quota1_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
lfsquota1_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
const struct quotaval *val)
{
struct dquot *dq;
@ -583,7 +583,7 @@ quota1_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
/* just update grace times */
id_t id = 0;
if ((error = dqget(NULLVP, id, ump, key->qk_idtype, &dq)) != 0)
if ((error = lfs_dqget(NULLVP, id, ump, key->qk_idtype, &dq)) != 0)
return error;
mutex_enter(&dq->dq_interlock);
if (val->qv_grace != QUOTA_NOTIME) {
@ -596,11 +596,11 @@ quota1_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
}
dq->dq_flags |= DQ_MOD;
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return 0;
}
if ((error = dqget(NULLVP, key->qk_id, ump, key->qk_idtype, &dq)) != 0)
if ((error = lfs_dqget(NULLVP, key->qk_id, ump, key->qk_idtype, &dq)) != 0)
return (error);
mutex_enter(&dq->dq_interlock);
/*
@ -655,7 +655,7 @@ quota1_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
dq->dq_flags &= ~DQ_FAKE;
dq->dq_flags |= DQ_MOD;
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return (0);
}
@ -672,7 +672,7 @@ setquota1(struct mount *mp, u_long id, int type, struct dqblk *dqb)
struct ulfsmount *ump = VFSTOULFS(mp);
if ((error = dqget(NULLVP, id, ump, type, &ndq)) != 0)
if ((error = lfs_dqget(NULLVP, id, ump, type, &ndq)) != 0)
return (error);
dq = ndq;
mutex_enter(&dq->dq_interlock);
@ -707,7 +707,7 @@ setquota1(struct mount *mp, u_long id, int type, struct dqblk *dqb)
dq->dq_flags &= ~DQ_FAKE;
dq->dq_flags |= DQ_MOD;
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return (0);
}
@ -726,7 +726,7 @@ setuse(struct mount *mp, u_long id, int type, void *addr)
error = copyin(addr, (void *)&usage, sizeof (struct dqblk));
if (error)
return (error);
if ((error = dqget(NULLVP, id, ump, type, &ndq)) != 0)
if ((error = lfs_dqget(NULLVP, id, ump, type, &ndq)) != 0)
return (error);
dq = ndq;
mutex_enter(&dq->dq_interlock);
@ -748,7 +748,7 @@ setuse(struct mount *mp, u_long id, int type, void *addr)
dq->dq_flags &= ~DQ_WARN(QL_FILE);
dq->dq_flags |= DQ_MOD;
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return (0);
}
#endif
@ -757,7 +757,7 @@ setuse(struct mount *mp, u_long id, int type, void *addr)
* Q_SYNC - sync quota files to disk.
*/
int
q1sync(struct mount *mp)
lfs_q1sync(struct mount *mp)
{
struct ulfsmount *ump = VFSTOULFS(mp);
struct vnode *vp, *mvp;
@ -808,7 +808,7 @@ q1sync(struct mount *mp)
continue;
mutex_enter(&dq->dq_interlock);
if (dq->dq_flags & DQ_MOD)
dq1sync(vp, dq);
lfs_dq1sync(vp, dq);
mutex_exit(&dq->dq_interlock);
}
vput(vp);
@ -824,7 +824,7 @@ q1sync(struct mount *mp)
* reading the information from the file if necessary.
*/
int
dq1get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
lfs_dq1get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
struct dquot *dq)
{
struct iovec aiov;
@ -871,7 +871,7 @@ dq1get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
* Update the disk quota in the quota file.
*/
int
dq1sync(struct vnode *vp, struct dquot *dq)
lfs_dq1sync(struct vnode *vp, struct dquot *dq)
{
struct vnode *dqvp;
struct iovec aiov;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota1.h,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota1.h,v 1.4 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: quota1.h,v 1.7 2012/08/26 02:32:14 dholland Exp */
/*
@ -97,9 +97,9 @@ struct dqblk {
};
/* quota1_subr.c */
void dqblk_to_quotavals(const struct dqblk *,
void lfs_dqblk_to_quotavals(const struct dqblk *,
struct quotaval *, struct quotaval *);
void quotavals_to_dqblk(const struct quotaval *, const struct quotaval *,
void lfs_quotavals_to_dqblk(const struct quotaval *, const struct quotaval *,
struct dqblk *);
#endif /* !_UFS_LFS_ULFS_QUOTA1_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota1_subr.c,v 1.2 2013/06/06 00:44:40 dholland Exp $ */
/* $NetBSD: ulfs_quota1_subr.c,v 1.3 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: quota1_subr.c,v 1.7 2012/01/29 06:23:20 dholland Exp */
/*-
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota1_subr.c,v 1.2 2013/06/06 00:44:40 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota1_subr.c,v 1.3 2013/06/06 00:49:28 dholland Exp $");
#include <sys/types.h>
#include <machine/limits.h>
@ -55,7 +55,7 @@ q2e2dqblk_limit(uint64_t lim)
}
void
dqblk_to_quotavals(const struct dqblk *dqblk,
lfs_dqblk_to_quotavals(const struct dqblk *dqblk,
struct quotaval *blocks, struct quotaval *files)
{
/* XXX is qv_grace getting handled correctly? */
@ -72,7 +72,7 @@ dqblk_to_quotavals(const struct dqblk *dqblk,
}
void
quotavals_to_dqblk(const struct quotaval *blocks, const struct quotaval *files,
lfs_quotavals_to_dqblk(const struct quotaval *blocks, const struct quotaval *files,
struct dqblk *dqblk)
{
/* XXX is qv_grace getting handled correctly? */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota2.c,v 1.4 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota2.c,v 1.5 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_quota2.c,v 1.35 2012/09/27 07:47:56 bouyer Exp */
/*-
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.4 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.5 2013/06/06 00:49:28 dholland Exp $");
#include <sys/buf.h>
#include <sys/param.h>
@ -147,18 +147,18 @@ getq2h(struct ulfsmount *ump, int type,
struct buf *bp;
struct quota2_header *q2h;
KASSERT(mutex_owned(&dqlock));
KASSERT(mutex_owned(&lfs_dqlock));
error = bread(ump->um_quotas[type], 0, ump->umq2_bsize,
ump->um_cred[type], flags, &bp);
if (error)
return error;
if (bp->b_resid != 0)
panic("dq2get: %s quota file truncated", quotatypes[type]);
panic("dq2get: %s quota file truncated", lfs_quotatypes[type]);
q2h = (void *)bp->b_data;
if (ulfs_rw32(q2h->q2h_magic_number, needswap) != Q2_HEAD_MAGIC ||
q2h->q2h_type != type)
panic("dq2get: corrupted %s quota header", quotatypes[type]);
panic("dq2get: corrupted %s quota header", lfs_quotatypes[type]);
*bpp = bp;
*q2hp = q2h;
return 0;
@ -173,7 +173,7 @@ getq2e(struct ulfsmount *ump, int type, daddr_t lblkno, int blkoffset,
if (blkoffset & (sizeof(uint64_t) - 1)) {
panic("dq2get: %s quota file corrupted",
quotatypes[type]);
lfs_quotatypes[type]);
}
error = bread(ump->um_quotas[type], lblkno, ump->umq2_bsize,
ump->um_cred[type], flags, &bp);
@ -181,7 +181,7 @@ getq2e(struct ulfsmount *ump, int type, daddr_t lblkno, int blkoffset,
return error;
if (bp->b_resid != 0) {
panic("dq2get: %s quota file corrupted",
quotatypes[type]);
lfs_quotatypes[type]);
}
*q2ep = (void *)((char *)bp->b_data + blkoffset);
*bpp = bp;
@ -205,7 +205,7 @@ quota2_walk_list(struct ulfsmount *ump, struct buf *hbp, int type,
struct quota2_entry *q2e;
daddr_t lblkno, blkoff, olblkno = 0;
KASSERT(mutex_owner(&dqlock));
KASSERT(mutex_owner(&lfs_dqlock));
while (off != 0) {
lblkno = (off >> ump->um_mountp->mnt_fs_bshift);
@ -224,7 +224,7 @@ quota2_walk_list(struct ulfsmount *ump, struct buf *hbp, int type,
return ret;
if (bp->b_resid != 0) {
panic("quota2_walk_list: %s quota file corrupted",
quotatypes[type]);
lfs_quotatypes[type]);
}
}
q2e = (void *)((char *)(bp->b_data) + blkoff);
@ -268,7 +268,7 @@ quota2_walk_list(struct ulfsmount *ump, struct buf *hbp, int type,
}
int
quota2_umount(struct mount *mp, int flags)
lfsquota2_umount(struct mount *mp, int flags)
{
int i, error;
struct ulfsmount *ump = VFSTOULFS(mp);
@ -303,7 +303,7 @@ quota2_q2ealloc(struct ulfsmount *ump, int type, uid_t uid, struct dquot *dq)
const int needswap = ULFS_MPNEEDSWAP(ump);
KASSERT(mutex_owned(&dq->dq_interlock));
KASSERT(mutex_owned(&dqlock));
KASSERT(mutex_owned(&lfs_dqlock));
error = getq2h(ump, type, &hbp, &q2h, B_MODIFY);
if (error)
return error;
@ -324,7 +324,7 @@ quota2_q2ealloc(struct ulfsmount *ump, int type, uid_t uid, struct dquot *dq)
DIP_ASSIGN(ip, size, ip->i_size);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
uvm_vnp_setsize(vp, ip->i_size);
quota2_addfreeq2e(q2h, bp->b_data, size, ump->umq2_bsize,
lfsquota2_addfreeq2e(q2h, bp->b_data, size, ump->umq2_bsize,
needswap);
error = bwrite(bp);
error2 = ULFS_UPDATE(vp, NULL, NULL, UPDATE_WAIT);
@ -376,7 +376,7 @@ getinoquota2(struct inode *ip, bool alloc, bool modify, struct buf **bpp,
struct ulfsmount *ump = ip->i_ump;
u_int32_t ino_ids[ULFS_MAXQUOTAS];
error = getinoquota(ip);
error = lfs_getinoquota(ip);
if (error)
return error;
@ -405,7 +405,7 @@ getinoquota2(struct inode *ip, bool alloc, bool modify, struct buf **bpp,
* at umount time.
*/
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
ip->i_dquot[i] = NULL;
continue;
}
@ -415,9 +415,9 @@ getinoquota2(struct inode *ip, bool alloc, bool modify, struct buf **bpp,
continue;
}
/* need to alloc a new on-disk quot */
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = quota2_q2ealloc(ump, i, ino_ids[i], dq);
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
if (error)
return error;
}
@ -432,9 +432,9 @@ getinoquota2(struct inode *ip, bool alloc, bool modify, struct buf **bpp,
}
__inline static int __unused
quota2_check_limit(struct quota2_val *q2v, uint64_t change, time_t now)
lfsquota2_check_limit(struct quota2_val *q2v, uint64_t change, time_t now)
{
return quota_check_limit(q2v->q2v_cur, change, q2v->q2v_softlimit,
return lfsquota_check_limit(q2v->q2v_cur, change, q2v->q2v_softlimit,
q2v->q2v_hardlimit, q2v->q2v_time, now);
}
@ -495,8 +495,8 @@ quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
if (dq == NODQUOT)
continue;
KASSERT(q2e[i] != NULL);
quota2_ulfs_rwq2v(&q2e[i]->q2e_val[vtype], &q2v, needswap);
ql_stat = quota2_check_limit(&q2v, change, time_second);
lfsquota2_ulfs_rwq2v(&q2e[i]->q2e_val[vtype], &q2v, needswap);
ql_stat = lfsquota2_check_limit(&q2v, change, time_second);
if ((flags & FORCE) == 0 &&
kauth_authorize_system(cred, KAUTH_SYSTEM_FS_QUOTA,
@ -509,7 +509,7 @@ quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
uprintf("\n%s: write failed, %s %s "
"limit reached\n",
mp->mnt_stat.f_mntonname,
quotatypes[i], limnames[vtype]);
lfs_quotatypes[i], limnames[vtype]);
dq->dq_flags |= DQ_WARN(vtype);
}
error = EDQUOT;
@ -519,7 +519,7 @@ quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
uprintf("\n%s: write failed, %s %s "
"limit reached\n",
mp->mnt_stat.f_mntonname,
quotatypes[i], limnames[vtype]);
lfs_quotatypes[i], limnames[vtype]);
dq->dq_flags |= DQ_WARN(vtype);
}
error = EDQUOT;
@ -529,7 +529,7 @@ quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
uprintf("\n%s: warning, %s %s "
"quota exceeded\n",
mp->mnt_stat.f_mntonname,
quotatypes[i], limnames[vtype]);
lfs_quotatypes[i], limnames[vtype]);
dq->dq_flags |= DQ_WARN(vtype);
}
break;
@ -542,7 +542,7 @@ quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
*/
if (ql_stat & QL_F_CROSS) {
q2v.q2v_time = time_second + q2v.q2v_grace;
quota2_ulfs_rwq2v(&q2v, &q2e[i]->q2e_val[vtype],
lfsquota2_ulfs_rwq2v(&q2v, &q2e[i]->q2e_val[vtype],
needswap);
}
}
@ -566,19 +566,19 @@ quota2_check(struct inode *ip, int vtype, int64_t change, kauth_cred_t cred,
}
int
chkdq2(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
lfs_chkdq2(struct inode *ip, int64_t change, kauth_cred_t cred, int flags)
{
return quota2_check(ip, QL_BLOCK, change, cred, flags);
}
int
chkiq2(struct inode *ip, int32_t change, kauth_cred_t cred, int flags)
lfs_chkiq2(struct inode *ip, int32_t change, kauth_cred_t cred, int flags)
{
return quota2_check(ip, QL_FILE, change, cred, flags);
}
int
quota2_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
lfsquota2_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
const struct quotaval *val)
{
int error;
@ -599,30 +599,30 @@ quota2_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
return error;
if (key->qk_id == QUOTA_DEFAULTID) {
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = getq2h(ump, key->qk_idtype, &bp, &q2h, B_MODIFY);
if (error) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
goto out_wapbl;
}
quota2_ulfs_rwq2e(&q2h->q2h_defentry, &q2e, needswap);
lfsquota2_ulfs_rwq2e(&q2h->q2h_defentry, &q2e, needswap);
quota2_dict_update_q2e_limits(key->qk_objtype, val, &q2e);
quota2_ulfs_rwq2e(&q2e, &q2h->q2h_defentry, needswap);
mutex_exit(&dqlock);
lfsquota2_ulfs_rwq2e(&q2e, &q2h->q2h_defentry, needswap);
mutex_exit(&lfs_dqlock);
quota2_bwrite(ump->um_mountp, bp);
goto out_wapbl;
}
error = dqget(NULLVP, key->qk_id, ump, key->qk_idtype, &dq);
error = lfs_dqget(NULLVP, key->qk_id, ump, key->qk_idtype, &dq);
if (error)
goto out_wapbl;
mutex_enter(&dq->dq_interlock);
if (dq->dq2_lblkno == 0 && dq->dq2_blkoff == 0) {
/* need to alloc a new on-disk quot */
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = quota2_q2ealloc(ump, key->qk_idtype, key->qk_id, dq);
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
if (error)
goto out_il;
}
@ -632,14 +632,14 @@ quota2_handle_cmd_put(struct ulfsmount *ump, const struct quotakey *key,
if (error)
goto out_il;
quota2_ulfs_rwq2e(q2ep, &q2e, needswap);
lfsquota2_ulfs_rwq2e(q2ep, &q2e, needswap);
quota2_dict_update_q2e_limits(key->qk_objtype, val, &q2e);
quota2_ulfs_rwq2e(&q2e, q2ep, needswap);
lfsquota2_ulfs_rwq2e(&q2e, q2ep, needswap);
quota2_bwrite(ump->um_mountp, bp);
out_il:
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
out_wapbl:
ULFS_WAPBL_END(ump->um_mountp);
return error;
@ -676,7 +676,7 @@ dq2clear_callback(struct ulfsmount *ump, uint64_t *offp, struct quota2_entry *q2
return 0;
}
int
quota2_handle_cmd_delete(struct ulfsmount *ump, const struct quotakey *qk)
lfsquota2_handle_cmd_delete(struct ulfsmount *ump, const struct quotakey *qk)
{
int idtype;
id_t id;
@ -699,18 +699,18 @@ quota2_handle_cmd_delete(struct ulfsmount *ump, const struct quotakey *qk)
return EOPNOTSUPP;
/* get the default entry before locking the entry's buffer */
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = getq2h(ump, idtype, &hbp, &q2h, 0);
if (error) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
return error;
}
/* we'll copy to another disk entry, so no need to swap */
memcpy(&q2e, &q2h->q2h_defentry, sizeof(q2e));
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
brelse(hbp, 0);
error = dqget(NULLVP, id, ump, idtype, &dq);
error = lfs_dqget(NULLVP, id, ump, idtype, &dq);
if (error)
return error;
@ -764,7 +764,7 @@ quota2_handle_cmd_delete(struct ulfsmount *ump, const struct quotakey *qk)
}
/* we can free it. release bp so we can walk the list */
brelse(bp, 0);
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = getq2h(ump, idtype, &hbp, &q2h, 0);
if (error)
goto out_dqlock;
@ -780,13 +780,13 @@ quota2_handle_cmd_delete(struct ulfsmount *ump, const struct quotakey *qk)
bwrite(hbp);
out_dqlock:
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
out_wapbl:
ULFS_WAPBL_END(ump->um_mountp);
out_il:
mutex_exit(&dq->dq_interlock);
out_dq:
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return error;
}
@ -800,27 +800,27 @@ quota2_fetch_q2e(struct ulfsmount *ump, const struct quotakey *qk,
struct buf *bp;
const int needswap = ULFS_MPNEEDSWAP(ump);
error = dqget(NULLVP, qk->qk_id, ump, qk->qk_idtype, &dq);
error = lfs_dqget(NULLVP, qk->qk_id, ump, qk->qk_idtype, &dq);
if (error)
return error;
mutex_enter(&dq->dq_interlock);
if (dq->dq2_lblkno == 0 && dq->dq2_blkoff == 0) {
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return ENOENT;
}
error = getq2e(ump, qk->qk_idtype, dq->dq2_lblkno, dq->dq2_blkoff,
&bp, &q2ep, 0);
if (error) {
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return error;
}
quota2_ulfs_rwq2e(q2ep, ret, needswap);
lfsquota2_ulfs_rwq2e(q2ep, ret, needswap);
brelse(bp, 0);
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return 0;
}
@ -836,27 +836,27 @@ quota2_fetch_quotaval(struct ulfsmount *ump, const struct quotakey *qk,
const int needswap = ULFS_MPNEEDSWAP(ump);
id_t id2;
error = dqget(NULLVP, qk->qk_id, ump, qk->qk_idtype, &dq);
error = lfs_dqget(NULLVP, qk->qk_id, ump, qk->qk_idtype, &dq);
if (error)
return error;
mutex_enter(&dq->dq_interlock);
if (dq->dq2_lblkno == 0 && dq->dq2_blkoff == 0) {
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return ENOENT;
}
error = getq2e(ump, qk->qk_idtype, dq->dq2_lblkno, dq->dq2_blkoff,
&bp, &q2ep, 0);
if (error) {
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
return error;
}
quota2_ulfs_rwq2e(q2ep, &q2e, needswap);
lfsquota2_ulfs_rwq2e(q2ep, &q2e, needswap);
brelse(bp, 0);
mutex_exit(&dq->dq_interlock);
dqrele(NULLVP, dq);
lfs_dqrele(NULLVP, dq);
q2e_to_quotaval(&q2e, 0, &id2, qk->qk_objtype, ret);
KASSERT(id2 == qk->qk_id);
@ -864,7 +864,7 @@ quota2_fetch_quotaval(struct ulfsmount *ump, const struct quotakey *qk,
}
int
quota2_handle_cmd_get(struct ulfsmount *ump, const struct quotakey *qk,
lfsquota2_handle_cmd_get(struct ulfsmount *ump, const struct quotakey *qk,
struct quotaval *qv)
{
int error;
@ -890,14 +890,14 @@ quota2_handle_cmd_get(struct ulfsmount *ump, const struct quotakey *qk,
if (ump->um_quotas[qk->qk_idtype] == NULLVP)
return ENODEV;
if (qk->qk_id == QUOTA_DEFAULTID) {
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = getq2h(ump, qk->qk_idtype, &bp, &q2h, 0);
if (error) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
return error;
}
quota2_ulfs_rwq2e(&q2h->q2h_defentry, &q2e, needswap);
mutex_exit(&dqlock);
lfsquota2_ulfs_rwq2e(&q2h->q2h_defentry, &q2e, needswap);
mutex_exit(&lfs_dqlock);
brelse(bp, 0);
q2e_to_quotaval(&q2e, qk->qk_id == QUOTA_DEFAULTID, &id2,
qk->qk_objtype, qv);
@ -1136,10 +1136,10 @@ q2cursor_getkeys(struct ulfsmount *ump, int idtype, struct ulfsq2_cursor *cursor
* Read the header block.
*/
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = getq2h(ump, idtype, &hbp, &q2h, 0);
if (error) {
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
return error;
}
@ -1153,7 +1153,7 @@ q2cursor_getkeys(struct ulfsmount *ump, int idtype, struct ulfsq2_cursor *cursor
}
/* grab the entry with the default values out of the header */
quota2_ulfs_rwq2e(&q2h->q2h_defentry, default_q2e_ret, needswap);
lfsquota2_ulfs_rwq2e(&q2h->q2h_defentry, default_q2e_ret, needswap);
/* If we haven't done the defaults yet, that goes first. */
if (cursor->q2c_defaults_done == 0) {
@ -1205,7 +1205,7 @@ q2cursor_getkeys(struct ulfsmount *ump, int idtype, struct ulfsq2_cursor *cursor
}
scanfail:
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
brelse(hbp, 0);
if (error)
return error;
@ -1270,7 +1270,7 @@ q2cursor_getvals(struct ulfsmount *ump, struct q2cursor_state *state,
* the keys to fetch the values.
*/
int
quota2_handle_cmd_cursorget(struct ulfsmount *ump, struct quotakcursor *qkc,
lfsquota2_handle_cmd_cursorget(struct ulfsmount *ump, struct quotakcursor *qkc,
struct quotakey *keys, struct quotaval *vals, unsigned maxreturn,
unsigned *ret)
{
@ -1386,7 +1386,7 @@ quota2_handle_cmd_cursorget(struct ulfsmount *ump, struct quotakcursor *qkc,
}
int
quota2_handle_cmd_cursoropen(struct ulfsmount *ump, struct quotakcursor *qkc)
lfsquota2_handle_cmd_cursoropen(struct ulfsmount *ump, struct quotakcursor *qkc)
{
struct ulfsq2_cursor *cursor;
@ -1406,7 +1406,7 @@ quota2_handle_cmd_cursoropen(struct ulfsmount *ump, struct quotakcursor *qkc)
}
int
quota2_handle_cmd_cursorclose(struct ulfsmount *ump, struct quotakcursor *qkc)
lfsquota2_handle_cmd_cursorclose(struct ulfsmount *ump, struct quotakcursor *qkc)
{
struct ulfsq2_cursor *cursor;
int error;
@ -1423,7 +1423,7 @@ quota2_handle_cmd_cursorclose(struct ulfsmount *ump, struct quotakcursor *qkc)
}
int
quota2_handle_cmd_cursorskipidtype(struct ulfsmount *ump,
lfsquota2_handle_cmd_cursorskipidtype(struct ulfsmount *ump,
struct quotakcursor *qkc, int idtype)
{
struct ulfsq2_cursor *cursor;
@ -1450,7 +1450,7 @@ quota2_handle_cmd_cursorskipidtype(struct ulfsmount *ump,
}
int
quota2_handle_cmd_cursoratend(struct ulfsmount *ump, struct quotakcursor *qkc,
lfsquota2_handle_cmd_cursoratend(struct ulfsmount *ump, struct quotakcursor *qkc,
int *ret)
{
struct ulfsq2_cursor *cursor;
@ -1467,7 +1467,7 @@ quota2_handle_cmd_cursoratend(struct ulfsmount *ump, struct quotakcursor *qkc,
}
int
quota2_handle_cmd_cursorrewind(struct ulfsmount *ump, struct quotakcursor *qkc)
lfsquota2_handle_cmd_cursorrewind(struct ulfsmount *ump, struct quotakcursor *qkc)
{
struct ulfsq2_cursor *cursor;
int error;
@ -1491,7 +1491,7 @@ quota2_handle_cmd_cursorrewind(struct ulfsmount *ump, struct quotakcursor *qkc)
}
int
q2sync(struct mount *mp)
lfs_q2sync(struct mount *mp)
{
return 0;
}
@ -1524,7 +1524,7 @@ dq2get_callback(struct ulfsmount *ump, uint64_t *offp, struct quota2_entry *q2e,
}
int
dq2get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
lfs_dq2get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
struct dquot *dq)
{
struct buf *bp;
@ -1538,7 +1538,7 @@ dq2get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
};
KASSERT(mutex_owned(&dq->dq_interlock));
mutex_enter(&dqlock);
mutex_enter(&lfs_dqlock);
error = getq2h(ump, type, &bp, &q2h, 0);
if (error)
goto out_mutex;
@ -1549,12 +1549,12 @@ dq2get(struct vnode *dqvp, u_long id, struct ulfsmount *ump, int type,
dq2get_callback);
brelse(bp, 0);
out_mutex:
mutex_exit(&dqlock);
mutex_exit(&lfs_dqlock);
return error;
}
int
dq2sync(struct vnode *vp, struct dquot *dq)
lfs_dq2sync(struct vnode *vp, struct dquot *dq)
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota2.h,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota2.h,v 1.4 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: quota2.h,v 1.9 2012/02/05 14:19:04 dholland Exp */
/*-
@ -104,13 +104,13 @@ struct quota2_header {
((daddr_t)(idx) * sizeof(struct quota2_entry) + (hsize))
/* quota2_subr.c */
void quota2_addfreeq2e(struct quota2_header *, void *, uint64_t, uint64_t, int);
void quota2_create_blk0(uint64_t, void *bp, int, int, int);
void quota2_ulfs_rwq2v(const struct quota2_val *, struct quota2_val *, int);
void quota2_ulfs_rwq2e(const struct quota2_entry *, struct quota2_entry *, int);
void lfsquota2_addfreeq2e(struct quota2_header *, void *, uint64_t, uint64_t, int);
void lfsquota2_create_blk0(uint64_t, void *bp, int, int, int);
void lfsquota2_ulfs_rwq2v(const struct quota2_val *, struct quota2_val *, int);
void lfsquota2_ulfs_rwq2e(const struct quota2_entry *, struct quota2_entry *, int);
/*
* Return codes for quota_check_limit()
* Return codes for lfsquota_check_limit()
*/
#define QL_S_ALLOW_OK 0x00 /* below soft limit */
@ -124,6 +124,6 @@ void quota2_ulfs_rwq2e(const struct quota2_entry *, struct quota2_entry *, int);
#define QL_FLAGS(x) ((x) & 0xf0)
/* check a quota usage against limits */
int quota_check_limit(uint64_t, uint64_t, uint64_t, uint64_t, time_t, time_t);
int lfsquota_check_limit(uint64_t, uint64_t, uint64_t, uint64_t, time_t, time_t);
#endif /* _UFS_LFS_ULFS_QUOTA2_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota2_subr.c,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quota2_subr.c,v 1.4 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: quota2_subr.c,v 1.5 2012/02/05 14:19:04 dholland Exp */
/*-
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2_subr.c,v 1.3 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2_subr.c,v 1.4 2013/06/06 00:49:28 dholland Exp $");
#include <sys/param.h>
#include <sys/time.h>
@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_quota2_subr.c,v 1.3 2013/06/06 00:48:04 dhollan
#endif
void
quota2_addfreeq2e(struct quota2_header *q2h, void *bp, uint64_t baseoff,
lfsquota2_addfreeq2e(struct quota2_header *q2h, void *bp, uint64_t baseoff,
uint64_t bsize, int ns)
{
uint64_t blkoff = baseoff % bsize;
@ -60,7 +60,7 @@ quota2_addfreeq2e(struct quota2_header *q2h, void *bp, uint64_t baseoff,
}
void
quota2_create_blk0(uint64_t bsize, void *bp, int q2h_hash_shift, int type,
lfsquota2_create_blk0(uint64_t bsize, void *bp, int q2h_hash_shift, int type,
int ns)
{
struct quota2_header *q2h;
@ -85,11 +85,11 @@ quota2_create_blk0(uint64_t bsize, void *bp, int q2h_hash_shift, int type,
}
/* first quota entry, after the hash table */
quota2_addfreeq2e(q2h, bp, quota2_full_header_size, bsize, ns);
lfsquota2_addfreeq2e(q2h, bp, quota2_full_header_size, bsize, ns);
}
void
quota2_ulfs_rwq2v(const struct quota2_val *s, struct quota2_val *d, int needswap)
lfsquota2_ulfs_rwq2v(const struct quota2_val *s, struct quota2_val *d, int needswap)
{
d->q2v_hardlimit = ulfs_rw64(s->q2v_hardlimit, needswap);
d->q2v_softlimit = ulfs_rw64(s->q2v_softlimit, needswap);
@ -99,18 +99,18 @@ quota2_ulfs_rwq2v(const struct quota2_val *s, struct quota2_val *d, int needswap
}
void
quota2_ulfs_rwq2e(const struct quota2_entry *s, struct quota2_entry *d,
lfsquota2_ulfs_rwq2e(const struct quota2_entry *s, struct quota2_entry *d,
int needswap)
{
quota2_ulfs_rwq2v(&s->q2e_val[QL_BLOCK], &d->q2e_val[QL_BLOCK],
lfsquota2_ulfs_rwq2v(&s->q2e_val[QL_BLOCK], &d->q2e_val[QL_BLOCK],
needswap);
quota2_ulfs_rwq2v(&s->q2e_val[QL_FILE], &d->q2e_val[QL_FILE],
lfsquota2_ulfs_rwq2v(&s->q2e_val[QL_FILE], &d->q2e_val[QL_FILE],
needswap);
d->q2e_uid = ulfs_rw32(s->q2e_uid, needswap);
}
int
quota_check_limit(uint64_t cur, uint64_t change, uint64_t soft, uint64_t hard,
lfsquota_check_limit(uint64_t cur, uint64_t change, uint64_t soft, uint64_t hard,
time_t expire, time_t now)
{
if (cur + change > hard) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quotacommon.h,v 1.2 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_quotacommon.h,v 1.3 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: quota.h,v 1.30 2012/08/26 02:32:14 dholland Exp */
/*
@ -46,7 +46,7 @@
/*
* The following constants define the usage of the quota file array in the
* ulfsmount structure and dquot array in the inode structure. The semantics
* of the elements of these arrays are defined in the routine getinoquota;
* of the elements of these arrays are defined in the routine lfs_getinoquota;
* the remainder of the quota code treats them generically and need not be
* inspected when changing the size of the array.
*/
@ -97,9 +97,9 @@ quota_idtype_from_ulfs(int ulfstype)
#include <sys/cdefs.h>
__BEGIN_DECLS
void dqinit(void);
void dqreinit(void);
void dqdone(void);
void lfs_dqinit(void);
void lfs_dqreinit(void);
void lfs_dqdone(void);
__END_DECLS
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_vfsops.c,v 1.4 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_vfsops.c,v 1.5 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_vfsops.c,v 1.52 2013/01/22 09:39:18 dholland Exp */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_vfsops.c,v 1.4 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_vfsops.c,v 1.5 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -119,7 +119,7 @@ ulfs_quotactl(struct mount *mp, struct quotactl_args *args)
}
mutex_enter(&mp->mnt_updating);
error = quota_handle_cmd(mp, l, args);
error = lfsquota_handle_cmd(mp, l, args);
mutex_exit(&mp->mnt_updating);
vfs_unbusy(mp, false, NULL);
@ -197,7 +197,7 @@ ulfs_quotactl(struct mount *mp, struct quotactl_args *args)
break;
case Q_SYNC:
error = qsync(mp);
error = lfs_qsync(mp);
break;
default:
@ -248,7 +248,7 @@ ulfs_init(void)
ulfs_ihashinit();
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
dqinit();
lfs_dqinit();
#endif
#ifdef LFS_DIRHASH
ulfsdirhash_init();
@ -263,7 +263,7 @@ ulfs_reinit(void)
{
ulfs_ihashreinit();
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
dqreinit();
lfs_dqreinit();
#endif
}
@ -278,7 +278,7 @@ ulfs_done(void)
ulfs_ihashdone();
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
dqdone();
lfs_dqdone();
#endif
pool_cache_destroy(ulfs_direct_cache);
#ifdef LFS_DIRHASH

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_vnops.c,v 1.4 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_vnops.c,v 1.5 2013/06/06 00:49:28 dholland Exp $ */
/* from NetBSD: ufs_vnops.c,v 1.212 2013/03/18 19:35:48 plunky Exp */
/*-
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.4 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.5 2013/06/06 00:49:28 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -314,7 +314,7 @@ ulfs_check_possible(struct vnode *vp, struct inode *ip, mode_t mode,
return (EROFS);
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = chkdq(ip, 0, cred, 0);
error = lfs_chkdq(ip, 0, cred, 0);
fstrans_done(vp->v_mount);
if (error != 0)
return error;
@ -743,26 +743,26 @@ ulfs_chown(struct vnode *vp, uid_t uid, gid_t gid, kauth_cred_t cred,
ogid = ip->i_gid;
ouid = ip->i_uid;
change = DIP(ip, blocks);
(void) chkdq(ip, -change, cred, 0);
(void) chkiq(ip, -1, cred, 0);
(void) lfs_chkdq(ip, -change, cred, 0);
(void) lfs_chkiq(ip, -1, cred, 0);
#endif
ip->i_gid = gid;
DIP_ASSIGN(ip, gid, gid);
ip->i_uid = uid;
DIP_ASSIGN(ip, uid, uid);
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
if ((error = chkdq(ip, change, cred, 0)) == 0) {
if ((error = chkiq(ip, 1, cred, 0)) == 0)
if ((error = lfs_chkdq(ip, change, cred, 0)) == 0) {
if ((error = lfs_chkiq(ip, 1, cred, 0)) == 0)
goto good;
else
(void) chkdq(ip, -change, cred, FORCE);
(void) lfs_chkdq(ip, -change, cred, FORCE);
}
ip->i_gid = ogid;
DIP_ASSIGN(ip, gid, ogid);
ip->i_uid = ouid;
DIP_ASSIGN(ip, uid, ouid);
(void) chkdq(ip, change, cred, FORCE);
(void) chkiq(ip, 1, cred, FORCE);
(void) lfs_chkdq(ip, change, cred, FORCE);
(void) lfs_chkiq(ip, 1, cred, FORCE);
fstrans_done(vp->v_mount);
return (error);
good:
@ -1023,7 +1023,7 @@ ulfs_mkdir(void *v)
ip->i_gid = dp->i_gid;
DIP_ASSIGN(ip, gid, ip->i_gid);
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
if ((error = chkiq(ip, 1, cnp->cn_cred, 0))) {
if ((error = lfs_chkiq(ip, 1, cnp->cn_cred, 0))) {
ULFS_VFREE(tvp, ip->i_number, dmode);
ULFS_WAPBL_END(dvp->v_mount);
fstrans_done(dvp->v_mount);
@ -1845,7 +1845,7 @@ ulfs_makeinode(int mode, struct vnode *dvp, const struct ulfs_lookup_results *ul
return (error);
}
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
if ((error = chkiq(ip, 1, cnp->cn_cred, 0))) {
if ((error = lfs_chkiq(ip, 1, cnp->cn_cred, 0))) {
ULFS_VFREE(tvp, ip->i_number, mode);
ULFS_WAPBL_END1(dvp->v_mount, dvp);
vput(tvp);