Disable userid to username lookups by default. Add a -U flag to perform them.

In single user mode lookups that involve the network might not work and they
slow down fsck.
This commit is contained in:
christos 2008-10-09 16:56:23 +00:00
parent ab610e81be
commit 59334248e2
12 changed files with 54 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.h,v 1.13 2005/06/26 23:01:39 christos Exp $ */
/* $NetBSD: fsck.h,v 1.14 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -197,6 +197,7 @@ long secsize; /* actual disk sector size */
char nflag; /* assume a no response */
char yflag; /* assume a yes response */
int bflag; /* location of alternate super block */
int Uflag; /* resolve user names */
int debug; /* output debugging info */
int preen; /* just fix normal inconsistencies */
char havesb; /* superblock has been read */

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fsck_ext2fs.8,v 1.14 2004/03/22 19:46:53 bouyer Exp $
.\" $NetBSD: fsck_ext2fs.8,v 1.15 2008/10/09 16:56:23 christos Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -56,7 +56,7 @@
.\"
.\" @(#)fsck.8 8.3 (Berkeley) 11/29/94
.\"
.Dd November 29, 1994
.Dd October 9, 2008
.Dt FSCK_EXT2FS 8
.Os
.Sh NAME
@ -70,6 +70,7 @@
.Op Fl f
.Op Fl m Ar mode
.Op Fl p
.Op Fl U
.Op Fl y
.Op Fl n
.Ar filesystem ...
@ -178,6 +179,8 @@ which is assumed to be affirmative;
do not open the filesystem for writing.
.It Fl p
Specify ``preen'' mode, described above.
.It Fl U
Resolve numeric userids to usernames.
.It Fl y
Assume a yes response to all questions asked by
.Nm ;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.22 2008/03/16 23:17:55 lukem Exp $ */
/* $NetBSD: inode.c,v 1.23 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95";
#else
__RCSID("$NetBSD: inode.c,v 1.22 2008/03/16 23:17:55 lukem Exp $");
__RCSID("$NetBSD: inode.c,v 1.23 2008/10/09 16:56:23 christos Exp $");
#endif
#endif /* not lint */
@ -619,7 +619,7 @@ pinode(ino_t ino)
dp = ginode(ino);
printf(" OWNER=");
#ifndef SMALL
if ((pw = getpwuid((int)dp->e2di_uid)) != 0)
if (Uflag && (pw = getpwuid((int)dp->e2di_uid)) != 0)
printf("%s ", pw->pw_name);
else
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.29 2008/07/20 01:20:22 lukem Exp $ */
/* $NetBSD: main.c,v 1.30 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
__RCSID("$NetBSD: main.c,v 1.29 2008/07/20 01:20:22 lukem Exp $");
__RCSID("$NetBSD: main.c,v 1.30 2008/10/09 16:56:23 christos Exp $");
#endif
#endif /* not lint */
@ -107,7 +107,7 @@ main(int argc, char *argv[])
sync();
skipclean = 1;
while ((ch = getopt(argc, argv, "b:dfm:npqy")) != -1) {
while ((ch = getopt(argc, argv, "b:dfm:npqUy")) != -1) {
switch (ch) {
case 'b':
skipclean = 0;
@ -146,6 +146,12 @@ main(int argc, char *argv[])
case 'q': /* Quiet not implemented */
break;
#ifndef SMALL
case 'U':
Uflag++;
break;
#endif
case 'y':
yflag++;
nflag = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.h,v 1.46 2008/02/23 21:41:48 christos Exp $ */
/* $NetBSD: fsck.h,v 1.47 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -251,6 +251,7 @@ long dev_bsize; /* computed value of DEV_BSIZE */
long secsize; /* actual disk sector size */
char nflag; /* assume a no response */
char yflag; /* assume a yes response */
int Uflag; /* resolve user names */
int bflag; /* location of alternate super block */
int debug; /* output debugging info */
int cvtlevel; /* convert to newer file system format */

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fsck_ffs.8,v 1.43 2008/08/30 15:07:40 gdt Exp $
.\" $NetBSD: fsck_ffs.8,v 1.44 2008/10/09 16:56:23 christos Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)fsck.8 8.3 (Berkeley) 11/29/94
.\"
.Dd August 30, 2008
.Dd October 9, 2008
.Dt FSCK_FFS 8
.Os
.Sh NAME
@ -37,7 +37,7 @@
.Nd Fast File System consistency check and interactive repair
.Sh SYNOPSIS
.Nm
.Op Fl adFfPpqX
.Op Fl adFfPpqUX
.Op Fl B Ar byteorder
.Op Fl b Ar block
.Op Fl c Ar level
@ -260,6 +260,8 @@ for more details.
The point is to check an internally-consistent version of the
filesystem to find out if it is damaged; on failure one should unmount
the filesystem and repair it.
.It Fl U
Resolve user ids to usernames.
.It Fl X
Similar to
.Fl x

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.60 2008/07/08 08:14:37 simonb Exp $ */
/* $NetBSD: inode.c,v 1.61 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: inode.c,v 1.60 2008/07/08 08:14:37 simonb Exp $");
__RCSID("$NetBSD: inode.c,v 1.61 2008/10/09 16:56:23 christos Exp $");
#endif
#endif /* not lint */
@ -647,7 +647,7 @@ pinode(ino_t ino)
dp = ginode(ino);
printf(" OWNER=");
#ifndef SMALL
if ((pw = getpwuid((int)iswap32(DIP(dp, uid)))) != 0)
if (Uflag && (pw = getpwuid((int)iswap32(DIP(dp, uid)))) != 0)
printf("%s ", pw->pw_name);
else
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.70 2008/08/30 14:07:32 dogcow Exp $ */
/* $NetBSD: main.c,v 1.71 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
#else
__RCSID("$NetBSD: main.c,v 1.70 2008/08/30 14:07:32 dogcow Exp $");
__RCSID("$NetBSD: main.c,v 1.71 2008/10/09 16:56:23 christos Exp $");
#endif
#endif /* not lint */
@ -97,7 +97,7 @@ main(int argc, char *argv[])
forceimage = 0;
endian = 0;
isappleufs = 0;
while ((ch = getopt(argc, argv, "aB:b:c:dFfm:npPqyx:X")) != -1) {
while ((ch = getopt(argc, argv, "aB:b:c:dFfm:npPqUyx:X")) != -1) {
switch (ch) {
case 'a':
isappleufs = 1;
@ -163,6 +163,11 @@ main(int argc, char *argv[])
case 'q':
quiet++;
break;
#ifndef SMALL
case 'U':
Uflag++;
break;
#endif
case 'y':
yflag++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.h,v 1.17 2008/04/28 20:23:08 martin Exp $ */
/* $NetBSD: fsck.h,v 1.18 2008/10/09 16:56:23 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -196,6 +196,8 @@ struct inoinfo {
#define clrbmap(blkno) blockmap[blkno] = 0
#endif
int Uflag; /* resolve user names */
#define STOP 0x01
#define SKIP 0x02
#define KEEPON 0x04

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fsck_lfs.8,v 1.20 2005/04/14 21:29:29 wiz Exp $
.\" $NetBSD: fsck_lfs.8,v 1.21 2008/10/09 16:56:23 christos Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)fsck.8 8.3 (Berkeley) 11/29/94
.\"
.Dd April 14, 2005
.Dd October 9, 2008
.Dt FSCK_LFS 8
.Os
.Sh NAME
@ -37,7 +37,7 @@
.Nd Log-structured File System consistency check and interactive repair
.Sh SYNOPSIS
.Nm fsck_lfs
.Op Fl dfpq
.Op Fl dfpqU
.Op Fl b Ar block
.Op Fl m Ar mode
.Op Fl y | n
@ -137,6 +137,8 @@ Currently, in this mode
rolls forward from the older checkpoint, and performs no other action.
.It Fl q
Quiet mode, do not output any messages for clean filesystems.
.It Fl U
Resolve user ids to user names.
.It Fl y
Assume a yes response to all questions asked by
.Nm ;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.39 2008/05/16 09:21:59 hannken Exp $ */
/* $NetBSD: inode.c,v 1.40 2008/10/09 16:56:23 christos Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -531,7 +531,7 @@ pinode(ino_t ino)
if (dp) {
printf(" OWNER=");
#ifndef SMALL
if ((pw = getpwuid((int) dp->di_uid)) != 0)
if (Uflag && (pw = getpwuid((int) dp->di_uid)) != 0)
printf("%s ", pw->pw_name);
else
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.37 2008/02/23 21:41:48 christos Exp $ */
/* $NetBSD: main.c,v 1.38 2008/10/09 16:56:23 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -74,7 +74,7 @@ main(int argc, char **argv)
{
int ch;
int ret = FSCK_EXIT_OK;
const char *optstring = "b:dfi:m:npPqy";
const char *optstring = "b:dfi:m:npPqUy";
skipclean = 1;
exitonfail = 0;
@ -122,7 +122,11 @@ main(int argc, char **argv)
case 'q':
quiet++;
break;
#ifndef SMALL
case 'U':
Uflag++;
break;
#endif
case 'y':
yflag++;
nflag = 0;