This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / ufs / ufs_quota.c
index a3862ff..9efb46b 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)ufs_quota.c   7.11 (Berkeley) 6/21/91
  * SUCH DAMAGE.
  *
  *     from: @(#)ufs_quota.c   7.11 (Berkeley) 6/21/91
- *     $Id$
+ *     $Id: ufs_quota.c,v 1.3 1993/11/07 21:48:21 wollman Exp $
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -65,6 +65,7 @@ static char *quotatypes[] = INITQFNAMES;
  * MAXQUOTAS value in quotas.h should be increased, and the
  * additional dquots set up here.
  */
  * MAXQUOTAS value in quotas.h should be increased, and the
  * additional dquots set up here.
  */
+int
 getinoquota(ip)
        register struct inode *ip;
 {
 getinoquota(ip)
        register struct inode *ip;
 {
@@ -97,6 +98,7 @@ getinoquota(ip)
 /*
  * Update disk usage, and take corrective action.
  */
 /*
  * Update disk usage, and take corrective action.
  */
+int
 chkdq(ip, change, cred, flags)
        register struct inode *ip;
        long change;
 chkdq(ip, change, cred, flags)
        register struct inode *ip;
        long change;
@@ -119,7 +121,7 @@ chkdq(ip, change, cred, flags)
                                continue;
                        while (dq->dq_flags & DQ_LOCK) {
                                dq->dq_flags |= DQ_WANT;
                                continue;
                        while (dq->dq_flags & DQ_LOCK) {
                                dq->dq_flags |= DQ_WANT;
-                               sleep((caddr_t)dq, PINOD+1);
+                               tsleep((caddr_t)dq, PINOD+1, "chkdq", 0);
                        }
                        ncurblocks = dq->dq_curblocks + change;
                        if (ncurblocks >= 0)
                        }
                        ncurblocks = dq->dq_curblocks + change;
                        if (ncurblocks >= 0)
@@ -144,7 +146,7 @@ chkdq(ip, change, cred, flags)
                        continue;
                while (dq->dq_flags & DQ_LOCK) {
                        dq->dq_flags |= DQ_WANT;
                        continue;
                while (dq->dq_flags & DQ_LOCK) {
                        dq->dq_flags |= DQ_WANT;
-                       sleep((caddr_t)dq, PINOD+1);
+                       tsleep((caddr_t)dq, PINOD+1, "chkdq", 0);
                }
                dq->dq_curblocks += change;
                dq->dq_flags |= DQ_MOD;
                }
                dq->dq_curblocks += change;
                dq->dq_flags |= DQ_MOD;
@@ -156,11 +158,12 @@ chkdq(ip, change, cred, flags)
  * Check for a valid change to a users allocation.
  * Issue an error message if appropriate.
  */
  * Check for a valid change to a users allocation.
  * Issue an error message if appropriate.
  */
+int
 chkdqchg(ip, change, cred, type)
        struct inode *ip;
        long change;
        struct ucred *cred;
 chkdqchg(ip, change, cred, type)
        struct inode *ip;
        long change;
        struct ucred *cred;
-       int type;
+       enum quotatype type;
 {
        register struct dquot *dq = ip->i_dquot[type];
        long ncurblocks = dq->dq_curblocks + change;
 {
        register struct dquot *dq = ip->i_dquot[type];
        long ncurblocks = dq->dq_curblocks + change;
@@ -208,6 +211,7 @@ chkdqchg(ip, change, cred, type)
 /*
  * Check the inode limit, applying corrective action.
  */
 /*
  * Check the inode limit, applying corrective action.
  */
+int
 chkiq(ip, change, cred, flags)
        register struct inode *ip;
        long change;
 chkiq(ip, change, cred, flags)
        register struct inode *ip;
        long change;
@@ -230,7 +234,7 @@ chkiq(ip, change, cred, flags)
                                continue;
                        while (dq->dq_flags & DQ_LOCK) {
                                dq->dq_flags |= DQ_WANT;
                                continue;
                        while (dq->dq_flags & DQ_LOCK) {
                                dq->dq_flags |= DQ_WANT;
-                               sleep((caddr_t)dq, PINOD+1);
+                               tsleep((caddr_t)dq, PINOD+1, "chkiq", 0);
                        }
                        ncurinodes = dq->dq_curinodes + change;
                        if (ncurinodes >= 0)
                        }
                        ncurinodes = dq->dq_curinodes + change;
                        if (ncurinodes >= 0)
@@ -255,7 +259,7 @@ chkiq(ip, change, cred, flags)
                        continue;
                while (dq->dq_flags & DQ_LOCK) {
                        dq->dq_flags |= DQ_WANT;
                        continue;
                while (dq->dq_flags & DQ_LOCK) {
                        dq->dq_flags |= DQ_WANT;
-                       sleep((caddr_t)dq, PINOD+1);
+                       tsleep((caddr_t)dq, PINOD+1, "chkiq", 0);
                }
                dq->dq_curinodes += change;
                dq->dq_flags |= DQ_MOD;
                }
                dq->dq_curinodes += change;
                dq->dq_flags |= DQ_MOD;
@@ -267,11 +271,12 @@ chkiq(ip, change, cred, flags)
  * Check for a valid change to a users allocation.
  * Issue an error message if appropriate.
  */
  * Check for a valid change to a users allocation.
  * Issue an error message if appropriate.
  */
+int
 chkiqchg(ip, change, cred, type)
        struct inode *ip;
        long change;
        struct ucred *cred;
 chkiqchg(ip, change, cred, type)
        struct inode *ip;
        long change;
        struct ucred *cred;
-       int type;
+       enum quotatype type;
 {
        register struct dquot *dq = ip->i_dquot[type];
        long ncurinodes = dq->dq_curinodes + change;
 {
        register struct dquot *dq = ip->i_dquot[type];
        long ncurinodes = dq->dq_curinodes + change;
@@ -322,6 +327,7 @@ chkiqchg(ip, change, cred, type)
  * it is an error for a file to change size and not
  * to have a dquot structure associated with it.
  */
  * it is an error for a file to change size and not
  * to have a dquot structure associated with it.
  */
+void
 chkdquot(ip)
        register struct inode *ip;
 {
 chkdquot(ip)
        register struct inode *ip;
 {
@@ -347,10 +353,11 @@ chkdquot(ip)
 /*
  * Q_QUOTAON - set up a quota file for a particular file system.
  */
 /*
  * Q_QUOTAON - set up a quota file for a particular file system.
  */
+int
 quotaon(p, mp, type, fname)
        struct proc *p;
        struct mount *mp;
 quotaon(p, mp, type, fname)
        struct proc *p;
        struct mount *mp;
-       register int type;
+       enum quotatype type;
        caddr_t fname;
 {
        register struct ufsmount *ump = VFSTOUFS(mp);
        caddr_t fname;
 {
        register struct ufsmount *ump = VFSTOUFS(mp);
@@ -426,10 +433,11 @@ again:
 /*
  * Q_QUOTAOFF - turn off disk quotas for a filesystem.
  */
 /*
  * Q_QUOTAOFF - turn off disk quotas for a filesystem.
  */
+int
 quotaoff(p, mp, type)
        struct proc *p;
        struct mount *mp;
 quotaoff(p, mp, type)
        struct proc *p;
        struct mount *mp;
-       register int type;
+       enum quotatype type;
 {
        register struct vnode *vp;
        struct vnode *qvp, *nextvp;
 {
        register struct vnode *vp;
        struct vnode *qvp, *nextvp;
@@ -478,10 +486,11 @@ again:
 /*
  * Q_GETQUOTA - return current values in a dqblk structure.
  */
 /*
  * Q_GETQUOTA - return current values in a dqblk structure.
  */
+int
 getquota(mp, id, type, addr)
        struct mount *mp;
        u_long id;
 getquota(mp, id, type, addr)
        struct mount *mp;
        u_long id;
-       int type;
+       enum quotatype type;
        caddr_t addr;
 {
        struct dquot *dq;
        caddr_t addr;
 {
        struct dquot *dq;
@@ -497,10 +506,11 @@ getquota(mp, id, type, addr)
 /*
  * Q_SETQUOTA - assign an entire dqblk structure.
  */
 /*
  * Q_SETQUOTA - assign an entire dqblk structure.
  */
+int
 setquota(mp, id, type, addr)
        struct mount *mp;
        u_long id;
 setquota(mp, id, type, addr)
        struct mount *mp;
        u_long id;
-       int type;
+       enum quotatype type;
        caddr_t addr;
 {
        register struct dquot *dq;
        caddr_t addr;
 {
        register struct dquot *dq;
@@ -516,7 +526,7 @@ setquota(mp, id, type, addr)
        dq = ndq;
        while (dq->dq_flags & DQ_LOCK) {
                dq->dq_flags |= DQ_WANT;
        dq = ndq;
        while (dq->dq_flags & DQ_LOCK) {
                dq->dq_flags |= DQ_WANT;
-               sleep((caddr_t)dq, PINOD+1);
+               tsleep((caddr_t)dq, PINOD+1, "setquota", 0);
        }
        /*
         * Copy all but the current values.
        }
        /*
         * Copy all but the current values.
@@ -555,10 +565,11 @@ setquota(mp, id, type, addr)
 /*
  * Q_SETUSE - set current inode and block usage.
  */
 /*
  * Q_SETUSE - set current inode and block usage.
  */
+int
 setuse(mp, id, type, addr)
        struct mount *mp;
        u_long id;
 setuse(mp, id, type, addr)
        struct mount *mp;
        u_long id;
-       int type;
+       enum quotatype type;
        caddr_t addr;
 {
        register struct dquot *dq;
        caddr_t addr;
 {
        register struct dquot *dq;
@@ -574,7 +585,7 @@ setuse(mp, id, type, addr)
        dq = ndq;
        while (dq->dq_flags & DQ_LOCK) {
                dq->dq_flags |= DQ_WANT;
        dq = ndq;
        while (dq->dq_flags & DQ_LOCK) {
                dq->dq_flags |= DQ_WANT;
-               sleep((caddr_t)dq, PINOD+1);
+               tsleep((caddr_t)dq, PINOD+1, "setuse", 0);
        }
        /*
         * Reset time limit if have a soft limit and were
        }
        /*
         * Reset time limit if have a soft limit and were
@@ -600,6 +611,7 @@ setuse(mp, id, type, addr)
 /*
  * Q_SYNC - sync quota files to disk.
  */
 /*
  * Q_SYNC - sync quota files to disk.
  */
+int
 qsync(mp)
        struct mount *mp;
 {
 qsync(mp)
        struct mount *mp;
 {
@@ -669,6 +681,7 @@ long numdquot, desireddquot = DQUOTINC;
 /*
  * Initialize the quota system.
  */
 /*
  * Initialize the quota system.
  */
+void
 dqinit()
 {
        register union dqhead *dhp;
 dqinit()
 {
        register union dqhead *dhp;
@@ -690,11 +703,12 @@ dqinit()
  * Obtain a dquot structure for the specified identifier and quota file
  * reading the information from the file if necessary.
  */
  * Obtain a dquot structure for the specified identifier and quota file
  * reading the information from the file if necessary.
  */
+int
 dqget(vp, id, ump, type, dqp)
        struct vnode *vp;
        u_long id;
        register struct ufsmount *ump;
 dqget(vp, id, ump, type, dqp)
        struct vnode *vp;
        u_long id;
        register struct ufsmount *ump;
-       register int type;
+       enum quotatype type;
        struct dquot **dqp;
 {
        register struct dquot *dq;
        struct dquot **dqp;
 {
        register struct dquot *dq;
@@ -820,6 +834,7 @@ dqget(vp, id, ump, type, dqp)
 /*
  * Obtain a reference to a dquot.
  */
 /*
  * Obtain a reference to a dquot.
  */
+void
 dqref(dq)
        struct dquot *dq;
 {
 dqref(dq)
        struct dquot *dq;
 {
@@ -830,6 +845,7 @@ dqref(dq)
 /*
  * Release a reference to a dquot.
  */
 /*
  * Release a reference to a dquot.
  */
+void
 dqrele(vp, dq)
        struct vnode *vp;
        register struct dquot *dq;
 dqrele(vp, dq)
        struct vnode *vp;
        register struct dquot *dq;
@@ -859,6 +875,7 @@ dqrele(vp, dq)
 /*
  * Update the disk quota in the quota file.
  */
 /*
  * Update the disk quota in the quota file.
  */
+int
 dqsync(vp, dq)
        struct vnode *vp;
        register struct dquot *dq;
 dqsync(vp, dq)
        struct vnode *vp;
        register struct dquot *dq;
@@ -878,7 +895,7 @@ dqsync(vp, dq)
                VOP_LOCK(dqvp);
        while (dq->dq_flags & DQ_LOCK) {
                dq->dq_flags |= DQ_WANT;
                VOP_LOCK(dqvp);
        while (dq->dq_flags & DQ_LOCK) {
                dq->dq_flags |= DQ_WANT;
-               sleep((caddr_t)dq, PINOD+2);
+               tsleep((caddr_t)dq, PINOD+2, "dqsync", 0);
                if ((dq->dq_flags & DQ_MOD) == 0) {
                        if (vp != dqvp)
                                VOP_UNLOCK(dqvp);
                if ((dq->dq_flags & DQ_MOD) == 0) {
                        if (vp != dqvp)
                                VOP_UNLOCK(dqvp);
@@ -909,6 +926,7 @@ dqsync(vp, dq)
 /*
  * Flush all entries from the cache for a particular vnode.
  */
 /*
  * Flush all entries from the cache for a particular vnode.
  */
+void
 dqflush(vp)
        register struct vnode *vp;
 {
 dqflush(vp)
        register struct vnode *vp;
 {