Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src use getfsspecname()
details: https://anonhg.NetBSD.org/src/rev/b9de4253e0e0
branches: trunk
changeset: 778636:b9de4253e0e0
user: christos <christos%NetBSD.org@localhost>
date: Sat Apr 07 04:52:20 2012 +0000
description:
use getfsspecname()
diffstat:
sbin/dump/Makefile | 4 +++-
sbin/dump/main.c | 16 +++++++++++-----
sbin/dump/optr.c | 13 +++++++++----
sbin/dump_lfs/Makefile | 4 +++-
sbin/fsck/fsck.c | 9 ++++++---
sbin/fsck/fsutil.c | 10 +++++++---
sbin/fsck/preen.c | 16 +++++++++++-----
sbin/swapctl/swapctl.c | 31 ++++++++++++++++++-------------
sbin/tunefs/tunefs.c | 16 ++++++++++------
usr.sbin/dumpfs/dumpfs.c | 18 ++++++++++++------
usr.sbin/edquota/edquota.c | 15 +++++++++++----
usr.sbin/quotacheck/quotacheck.c | 16 ++++++++++++----
usr.sbin/quotaon/Makefile | 6 +++---
usr.sbin/quotaon/quotaon.c | 35 ++++++++++++++++++++++-------------
14 files changed, 138 insertions(+), 71 deletions(-)
diffs (truncated from 677 to 300 lines):
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/dump/Makefile
--- a/sbin/dump/Makefile Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/dump/Makefile Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2011/06/20 07:43:59 mrg Exp $
+# $NetBSD: Makefile,v 1.38 2012/04/07 04:52:20 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# dump.h header file
@@ -32,6 +32,8 @@
traverse.c unctime.c ffs_inode.c ffs_bswap.c
MAN= dump.8
MLINKS+=dump.8 rdump.8
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
.PATH: ${NETBSDSRCDIR}/sys/ufs/ffs
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/dump/main.c
--- a/sbin/dump/main.c Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/dump/main.c Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.67 2012/02/19 19:49:20 christos Exp $ */
+/* $NetBSD: main.c,v 1.68 2012/04/07 04:52:20 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: main.c,v 1.67 2012/02/19 19:49:20 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.68 2012/04/07 04:52:20 christos Exp $");
#endif
#endif /* not lint */
@@ -65,6 +65,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <util.h>
#include "dump.h"
#include "pathnames.h"
@@ -85,7 +86,6 @@
char default_time_string[] = "%T %Z"; /* default timestamp string */
char *time_string = default_time_string; /* timestamp string */
-int main(int, char *[]);
static long numarg(const char *, long, long);
static void obsolete(int *, char **[]);
static void usage(void);
@@ -108,6 +108,7 @@
char *mountpoint;
int just_estimate = 0;
char labelstr[LBLSIZE];
+ char buf[MAXPATHLEN];
char *new_time_format;
char *snap_backup = NULL;
@@ -294,7 +295,10 @@
break;
}
if ((dt = fstabsearch(argv[i])) != NULL) {
- disk = dt->fs_spec;
+ if (getfsspecname(buf, sizeof(buf), dt->fs_spec)
+ == NULL)
+ quit("%s (%s)", buf, strerror(errno));
+ disk = buf;
mountpoint = xstrdup(dt->fs_file);
goto multicheck;
}
@@ -402,7 +406,9 @@
mountpoint = NULL;
mntinfo = mntinfosearch(disk);
if ((dt = fstabsearch(disk)) != NULL) {
- disk = rawname(dt->fs_spec);
+ if (getfsspecname(buf, sizeof(buf), dt->fs_spec) == NULL)
+ quit("%s (%s)", buf, strerror(errno));
+ disk = rawname(buf);
mountpoint = dt->fs_file;
msg("Found %s on %s in %s\n", disk, mountpoint, _PATH_FSTAB);
} else if (mntinfo != NULL) {
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/dump/optr.c
--- a/sbin/dump/optr.c Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/dump/optr.c Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: optr.c,v 1.36 2006/12/18 20:07:32 christos Exp $ */
+/* $NetBSD: optr.c,v 1.37 2012/04/07 04:52:20 christos Exp $ */
/*-
* Copyright (c) 1980, 1988, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94";
#else
-__RCSID("$NetBSD: optr.c,v 1.36 2006/12/18 20:07:32 christos Exp $");
+__RCSID("$NetBSD: optr.c,v 1.37 2012/04/07 04:52:20 christos Exp $");
#endif
#endif /* not lint */
@@ -56,6 +56,7 @@
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#include <util.h>
#include <ufs/ufs/dinode.h>
@@ -321,11 +322,15 @@
allocfsent(struct fstab *fs)
{
struct fstab *new;
+ char buf[MAXPATHLEN];
- new = (struct fstab *)xmalloc(sizeof (*fs));
+ new = xmalloc(sizeof (*fs));
new->fs_file = xstrdup(fs->fs_file);
new->fs_type = xstrdup(fs->fs_type);
- new->fs_spec = xstrdup(fs->fs_spec);
+
+ if (getfsspecname(buf, sizeof(buf), fs->fs_spec) == NULL)
+ msg("%s (%s)", buf, strerror(errno));
+ new->fs_spec = xstrdup(buf);
new->fs_passno = fs->fs_passno;
new->fs_freq = fs->fs_freq;
return (new);
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/dump_lfs/Makefile
--- a/sbin/dump_lfs/Makefile Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/dump_lfs/Makefile Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2011/08/14 12:13:24 christos Exp $
+# $NetBSD: Makefile,v 1.14 2012/04/07 04:52:20 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# lfs_inode.c LFS filestore-specific routines
@@ -20,6 +20,8 @@
MAN= dump_lfs.8
MLINKS+=dump_lfs.8 rdump_lfs.8
#CFLAGS+=-g
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
.if ${MACHINE_ARCH} == "m68000"
COPTS.lfs_inode.c+= -fno-tree-ter
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/fsck/fsck.c
--- a/sbin/fsck/fsck.c Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/fsck/fsck.c Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck.c,v 1.50 2011/08/27 17:34:44 joerg Exp $ */
+/* $NetBSD: fsck.c,v 1.51 2012/04/07 04:52:20 christos Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsck.c,v 1.50 2011/08/27 17:34:44 joerg Exp $");
+__RCSID("$NetBSD: fsck.c,v 1.51 2012/04/07 04:52:20 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -100,6 +100,7 @@
const char *vfstype = NULL;
char globopt[3];
int ret = FSCK_EXIT_OK;
+ char buf[MAXPATHLEN];
globopt[0] = '-';
globopt[2] = '\0';
@@ -212,7 +213,9 @@
type = vfstype;
}
else {
- spec = fs->fs_spec;
+ spec = getfsspecname(buf, sizeof(buf), fs->fs_spec);
+ if (spec == NULL)
+ err(FSCK_EXIT_CHECK_FAILED, "%s", buf);
type = fs->fs_vfstype;
if (BADTYPE(fs->fs_type))
errx(FSCK_EXIT_CHECK_FAILED,
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/fsck/fsutil.c
--- a/sbin/fsck/fsutil.c Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/fsck/fsutil.c Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsutil.c,v 1.20 2011/06/09 19:57:50 christos Exp $ */
+/* $NetBSD: fsutil.c,v 1.21 2012/04/07 04:52:20 christos Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsutil.c,v 1.20 2011/06/09 19:57:50 christos Exp $");
+__RCSID("$NetBSD: fsutil.c,v 1.21 2012/04/07 04:52:20 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -45,6 +45,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <err.h>
+#include <util.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -236,7 +237,10 @@
retried++;
goto retry;
} else if ((fsp = getfsfile(newname)) != 0 && !retried) {
- newname = fsp->fs_spec;
+ char buf[MAXPATHLEN];
+ newname = getfsspecname(buf, sizeof(buf), fsp->fs_spec);
+ if (newname == NULL)
+ perr("%s", buf);
retried++;
goto retry;
}
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/fsck/preen.c
--- a/sbin/fsck/preen.c Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/fsck/preen.c Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: preen.c,v 1.30 2008/02/23 21:41:47 christos Exp $ */
+/* $NetBSD: preen.c,v 1.31 2012/04/07 04:52:20 christos Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: preen.c,v 1.30 2008/02/23 21:41:47 christos Exp $");
+__RCSID("$NetBSD: preen.c,v 1.31 2012/04/07 04:52:20 christos Exp $");
#endif
#endif /* not lint */
@@ -108,10 +108,16 @@
return FSCK_EXIT_CHECK_FAILED;
}
while ((fs = getfsent()) != 0) {
+ char buf[MAXPATHLEN];
+ const char *fsspec;
if ((auxarg = (*docheck)(fs)) == NULL)
continue;
-
- name = blockcheck(fs->fs_spec);
+ fsspec = getfsspecname(buf, sizeof(buf), fs->fs_spec);
+ if (fsspec == NULL) {
+ warn("%s", buf);
+ return FSCK_EXIT_CHECK_FAILED;
+ }
+ name = blockcheck(fsspec);
if (flags & CHECK_DEBUG)
printf("pass %d, name %s\n", passno, name);
@@ -135,7 +141,7 @@
} else if (passno == 2 && fs->fs_passno > 1) {
if (name == NULL) {
(void) fprintf(stderr,
- "BAD DISK NAME %s\n", fs->fs_spec);
+ "BAD DISK NAME %s\n", fsspec);
sumstatus = FSCK_EXIT_CHECK_FAILED;
continue;
}
diff -r a3a76b92e2cc -r b9de4253e0e0 sbin/swapctl/swapctl.c
--- a/sbin/swapctl/swapctl.c Sat Apr 07 04:13:06 2012 +0000
+++ b/sbin/swapctl/swapctl.c Sat Apr 07 04:52:20 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: swapctl.c,v 1.36 2011/08/27 18:57:50 joerg Exp $ */
+/* $NetBSD: swapctl.c,v 1.37 2012/04/07 04:52:20 christos Exp $ */
/*
* Copyright (c) 1996, 1997, 1999 Matthew R. Green
@@ -64,7 +64,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: swapctl.c,v 1.36 2011/08/27 18:57:50 joerg Exp $");
+__RCSID("$NetBSD: swapctl.c,v 1.37 2012/04/07 04:52:20 christos Exp $");
#endif
@@ -695,9 +695,14 @@
#define PRIORITYEQ "priority="
#define NFSMNTPT "nfsmntpt="
while ((fp = getfsent()) != NULL) {
- char *spec;
+ char buf[MAXPATHLEN];
+ char *spec, *fsspec;
- spec = fp->fs_spec;
+ if (getfsspecname(buf, sizeof(buf), fp->fs_spec) == NULL) {
+ warn("%s", buf);
+ continue;
+ }
+ fsspec = spec = buf;
cmd[0] = '\0';
Home |
Main Index |
Thread Index |
Old Index