summaryrefslogtreecommitdiffstats
path: root/sbin/quotacheck
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1998-07-15 06:48:52 +0000
committercharnier <charnier@FreeBSD.org>1998-07-15 06:48:52 +0000
commit6e847632809dec9a840a4278f162d18639f6dbde (patch)
treebe01d8ba5ec8ff8ad11fdf8365ab85695efd1cfa /sbin/quotacheck
parent4d8552339bf6ea3265942a447c74c8ba67a87779 (diff)
downloadFreeBSD-src-6e847632809dec9a840a4278f162d18639f6dbde.zip
FreeBSD-src-6e847632809dec9a840a4278f162d18639f6dbde.tar.gz
Correct use of .Nm. Add rcsid. Remove unused #includes. Use warn().
Errx(1, "malloc failed") is better than err(1, NULL).
Diffstat (limited to 'sbin/quotacheck')
-rw-r--r--sbin/quotacheck/quotacheck.824
-rw-r--r--sbin/quotacheck/quotacheck.c27
2 files changed, 27 insertions, 24 deletions
diff --git a/sbin/quotacheck/quotacheck.8 b/sbin/quotacheck/quotacheck.8
index b9bbdad..080f885 100644
--- a/sbin/quotacheck/quotacheck.8
+++ b/sbin/quotacheck/quotacheck.8
@@ -33,6 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)quotacheck.8 8.1 (Berkeley) 6/5/93
+.\" $Id$
.\"
.Dd June 5, 1993
.Dt QUOTACHECK 8
@@ -45,7 +46,8 @@
.Op Fl g
.Op Fl u
.Op Fl v
-.Ar filesystem Ar ...
+.Ar filesystem
+.Ar
.Nm quotacheck
.Op Fl g
.Op Fl u
@@ -63,13 +65,11 @@ incorrect quotas are updated (the latter only
occurs if an active filesystem is checked).
By default both user and group quotas are checked.
.Pp
-Available options:
-.Bl -tag -width Ds
+The following options are available:
+.Bl -tag -width indent
.It Fl a
-If the
-.Fl a
-flag is supplied in place of any filesystem names,
-.Nm quotacheck
+If supplied in place of any filesystem names,
+.Nm
will check all the filesystems indicated in
.Pa /etc/fstab
to be read-write with disk quotas.
@@ -85,7 +85,7 @@ Only user quotas listed in
.Pa /etc/fstab
are to be checked.
.It Fl v
-.Nm quotacheck
+.Nm Quotacheck
reports discrepancies between the
calculated and recorded disk quotas and other additional diagnostic messages.
.El
@@ -101,8 +101,8 @@ using the pass numbers in
in an identical fashion to
.Xr fsck 8 .
.Pp
-Normally
-.Nm quotacheck
+Normally,
+.Nm
operates silently.
.Pp
.Nm Quotacheck
@@ -115,7 +115,7 @@ which are located at the root of the associated file system.
These defaults may be overridden in
.Pa /etc/fstab .
If a file is not present,
-.Nm quotacheck
+.Nm
will create it.
.Pp
.Nm Quotacheck
@@ -131,7 +131,7 @@ accesses the raw device in calculating the actual
disk usage for each user.
Thus, the filesystems
checked should be quiescent while
-.Nm quotacheck
+.Nm
is running.
.Sh FILES
.Bl -tag -width quota.group -compact
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c
index d9ae421..6b1e7c0 100644
--- a/sbin/quotacheck/quotacheck.c
+++ b/sbin/quotacheck/quotacheck.c
@@ -32,41 +32,42 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id: quotacheck.c,v 1.8 1997/06/30 11:08:29 charnier Exp $
*/
#ifndef lint
-static char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1980, 1990, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)quotacheck.c 8.3 (Berkeley) 1/29/94";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
/*
* Fix up / report on disk quotas & usage
*/
#include <sys/param.h>
-#include <sys/queue.h>
#include <sys/stat.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/quota.h>
#include <ufs/ffs/fs.h>
+#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <fstab.h>
-#include <pwd.h>
#include <grp.h>
-#include <errno.h>
-#include <unistd.h>
+#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <err.h>
+#include <unistd.h>
char *qfname = QUOTAFILENAME;
char *qfextension[] = INITQFNAMES;
@@ -110,6 +111,8 @@ struct fileusage *
addid __P((u_long, int, char *));
char *blockcheck __P((char *));
void bread __P((daddr_t, char *, long));
+extern int checkfstab __P((int, int, int (*)(struct fstab *),
+ int (*)(char *, char *, long, int)));
int chkquota __P((char *, char *, struct quotaname *));
void freeinodebuf __P((void));
struct dinode *
@@ -220,7 +223,7 @@ needchk(fs)
strcmp(fs->fs_type, FSTAB_RW))
return (NULL);
if ((qnp = malloc(sizeof(*qnp))) == NULL)
- err(1, NULL);
+ errx(1, "malloc failed");
qnp->flags = 0;
if (gflag && hasquota(fs, GRPQUOTA, &qfnp)) {
strcpy(qnp->grpqfname, qfnp);
@@ -250,7 +253,7 @@ chkquota(fsname, mntpt, qnp)
ino_t ino;
if ((fi = open(fsname, O_RDONLY, 0)) < 0) {
- perror(fsname);
+ warn("%s", fsname);
return (1);
}
if (vflag) {
@@ -510,7 +513,7 @@ addid(id, type, name)
else
len = 10;
if ((fup = calloc(1, sizeof(*fup) + len)) == NULL)
- err(1, NULL);
+ errx(1, "calloc failed");
fhp = &fuhead[type][id & (FUHASH - 1)];
fup->fu_next = *fhp;
*fhp = fup;
@@ -586,7 +589,7 @@ resetinodebuf()
}
if (inodebuf == NULL &&
(inodebuf = malloc((u_int)inobufsize)) == NULL)
- err(1, NULL);
+ errx(1, "malloc failed");
while (nextino < ROOTINO)
getnextinode(nextino);
}
OpenPOWER on IntegriCloud