BSD 4_3 release
[unix-history] / usr / src / sys / sys / quota_ufs.c
index 625b5e4..4c5f0b6 100644 (file)
@@ -1,4 +1,10 @@
-/*     quota_ufs.c     6.1     83/07/29        */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)quota_ufs.c 7.1 (Berkeley) 6/5/86
+ */
 
 #ifdef QUOTA
 /*
 
 #ifdef QUOTA
 /*
  *
  * Routines used in checking limits on file system usage.
  */
  *
  * Routines used in checking limits on file system usage.
  */
-#include "../h/param.h"
-#include "../h/systm.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/proc.h"
-#include "../h/inode.h"
-#include "../h/quota.h"
-#include "../h/mount.h"
-#include "../h/fs.h"
-#include "../h/uio.h"
-#include "../h/nami.h"
+#include "param.h"
+#include "systm.h"
+#include "dir.h"
+#include "user.h"
+#include "proc.h"
+#include "inode.h"
+#include "quota.h"
+#include "mount.h"
+#include "fs.h"
+#include "uio.h"
 
 /*
  * Find the dquot structure that should
 
 /*
  * Find the dquot structure that should
@@ -85,6 +90,19 @@ chkdq(ip, change, force)
        if (dq->dq_bsoftlimit == 0)
                return (0);
        dq->dq_flags |= DQ_MOD;
        if (dq->dq_bsoftlimit == 0)
                return (0);
        dq->dq_flags |= DQ_MOD;
+       /*
+        * reset warnings if below disk quota.
+        */
+        if (dq->dq_bwarn == 0 && dq->dq_bsoftlimit &&
+           (dq->dq_curblocks + change) < dq->dq_bsoftlimit) {
+               dq->dq_bwarn = MAX_DQ_WARN;
+               if (dq->dq_own == u.u_quota) {
+                       uprintf("\nUNDER DISC QUOTA: (%s) by %d Kbytes\n",
+                               ip->i_fs->fs_fsmnt,
+                               dbtob(dq->dq_bsoftlimit -
+                               (dq->dq_curblocks + change)) / 1024);
+               }
+       }
        if (change < 0) {
                if ((int)dq->dq_curblocks + change >= 0)
                        dq->dq_curblocks += change;
        if (change < 0) {
                if ((int)dq->dq_curblocks + change >= 0)
                        dq->dq_curblocks += change;
@@ -140,8 +158,9 @@ chkdq(ip, change, force)
  */
 chkiq(dev, ip, uid, force)
        dev_t dev;
  */
 chkiq(dev, ip, uid, force)
        dev_t dev;
+       uid_t uid;
        register struct inode *ip;
        register struct inode *ip;
-       int uid, force;
+       int force;
 {
        register struct dquot *dq;
        register struct quota *q;
 {
        register struct dquot *dq;
        register struct quota *q;