Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makefs/ffs tidy up error messages
details: https://anonhg.NetBSD.org/src/rev/1ceafc57f586
branches: trunk
changeset: 816232:1ceafc57f586
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 24 19:24:11 2016 +0000
description:
tidy up error messages
diffstat:
usr.sbin/makefs/ffs/buf.c | 10 +++++-----
usr.sbin/makefs/ffs/ffs_alloc.c | 29 +++++++++++++++--------------
usr.sbin/makefs/ffs/mkfs.c | 20 ++++++++++----------
3 files changed, 30 insertions(+), 29 deletions(-)
diffs (187 lines):
diff -r 682ee95c5a9b -r 1ceafc57f586 usr.sbin/makefs/ffs/buf.c
--- a/usr.sbin/makefs/ffs/buf.c Fri Jun 24 17:21:30 2016 +0000
+++ b/usr.sbin/makefs/ffs/buf.c Fri Jun 24 19:24:11 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.c,v 1.23 2015/12/24 15:52:37 christos Exp $ */
+/* $NetBSD: buf.c,v 1.24 2016/06/24 19:24:11 christos Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: buf.c,v 1.23 2015/12/24 15:52:37 christos Exp $");
+__RCSID("$NetBSD: buf.c,v 1.24 2016/06/24 19:24:11 christos Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -78,17 +78,17 @@
(long long)(*bpp)->b_blkno, (long long) offset,
(*bpp)->b_bcount);
if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1)
- err(1, "%s: lseek %lld (%lld)", __func__,
+ err(EXIT_FAILURE, "%s: lseek %lld (%lld)", __func__,
(long long)(*bpp)->b_blkno, (long long)offset);
rv = read((*bpp)->b_fs->fd, (*bpp)->b_data, (size_t)(*bpp)->b_bcount);
if (debug & DEBUG_BUF_BREAD)
printf("bread: read %ld (%lld) returned %zd\n",
(*bpp)->b_bcount, (long long)offset, rv);
if (rv == -1) /* read error */
- err(1, "%s: read %ld (%lld) returned %zd", __func__,
+ err(EXIT_FAILURE, "%s: read %ld (%lld) returned %zd", __func__,
(*bpp)->b_bcount, (long long)offset, rv);
else if (rv != (*bpp)->b_bcount) /* short read */
- err(1, "%s: read %ld (%lld) returned %zd", __func__,
+ errx(EXIT_FAILURE, "%s: read %ld (%lld) returned %zd", __func__,
(*bpp)->b_bcount, (long long)offset, rv);
else
return (0);
diff -r 682ee95c5a9b -r 1ceafc57f586 usr.sbin/makefs/ffs/ffs_alloc.c
--- a/usr.sbin/makefs/ffs/ffs_alloc.c Fri Jun 24 17:21:30 2016 +0000
+++ b/usr.sbin/makefs/ffs/ffs_alloc.c Fri Jun 24 19:24:11 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_alloc.c,v 1.28 2015/03/29 05:52:59 agc Exp $ */
+/* $NetBSD: ffs_alloc.c,v 1.29 2016/06/24 19:24:11 christos Exp $ */
/* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */
/*
@@ -47,7 +47,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs_alloc.c,v 1.28 2015/03/29 05:52:59 agc Exp $");
+__RCSID("$NetBSD: ffs_alloc.c,v 1.29 2016/06/24 19:24:11 christos Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -107,7 +107,7 @@
*bnp = 0;
if (size > fs->fs_bsize || ffs_fragoff(fs, size) != 0) {
- errx(1, "ffs_alloc: bad size: bsize %d size %d",
+ errx(EXIT_FAILURE, "%s: bad size: bsize %d size %d", __func__,
fs->fs_bsize, size);
}
if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0)
@@ -441,8 +441,8 @@
if (size > fs->fs_bsize || ffs_fragoff(fs, size) != 0 ||
ffs_fragnum(fs, bno) + ffs_numfrags(fs, size) > fs->fs_frag) {
- errx(1, "blkfree: bad size: bno %lld bsize %d size %ld",
- (long long)bno, fs->fs_bsize, size);
+ errx(EXIT_FAILURE, "%s: bad size: bno %lld bsize %d "
+ "size %ld", __func__, (long long)bno, fs->fs_bsize, size);
}
cg = dtog(fs, bno);
if (bno >= fs->fs_size) {
@@ -465,8 +465,8 @@
if (size == fs->fs_bsize) {
fragno = ffs_fragstoblks(fs, cgbno);
if (!ffs_isfreeblock(fs, cg_blksfree(cgp, needswap), fragno)) {
- errx(1, "blkfree: freeing free block %lld",
- (long long)bno);
+ errx(EXIT_FAILURE, "%s: freeing free block %lld",
+ __func__, (long long)bno);
}
ffs_setblock(fs, cg_blksfree(cgp, needswap), fragno);
ffs_clusteracct(fs, cgp, fragno, 1);
@@ -486,7 +486,8 @@
frags = ffs_numfrags(fs, size);
for (i = 0; i < frags; i++) {
if (isset(cg_blksfree(cgp, needswap), cgbno + i)) {
- errx(1, "blkfree: freeing free frag: block %lld",
+ errx(EXIT_FAILURE, "%s: freeing free frag: "
+ "block %lld", __func__,
(long long)(cgbno + i));
}
setbit(cg_blksfree(cgp, needswap), cgbno + i);
@@ -566,11 +567,10 @@
(const u_char *)fragtbl[fs->fs_frag],
(1 << (allocsiz - 1 + (fs->fs_frag % NBBY))));
if (loc == 0) {
- errx(1,
- "ffs_alloccg: map corrupted: start %d len %d offset %d %ld",
- ostart, olen,
- ufs_rw32(cgp->cg_freeoff, needswap),
- (long)cg_blksfree(cgp, needswap) - (long)cgp);
+ errx(EXIT_FAILURE, "%s: map corrupted: start %d "
+ "len %d offset %d %ld", __func__, ostart, olen,
+ ufs_rw32(cgp->cg_freeoff, needswap),
+ (long)cg_blksfree(cgp, needswap) - (long)cgp);
/* NOTREACHED */
}
}
@@ -592,6 +592,7 @@
subfield <<= 1;
}
}
- errx(1, "ffs_alloccg: block not in map: bno %lld", (long long)bno);
+ errx(EXIT_FAILURE, "%s: block not in map: bno %lld", __func__,
+ (long long)bno);
return (-1);
}
diff -r 682ee95c5a9b -r 1ceafc57f586 usr.sbin/makefs/ffs/mkfs.c
--- a/usr.sbin/makefs/ffs/mkfs.c Fri Jun 24 17:21:30 2016 +0000
+++ b/usr.sbin/makefs/ffs/mkfs.c Fri Jun 24 19:24:11 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkfs.c,v 1.33 2015/12/21 00:58:08 christos Exp $ */
+/* $NetBSD: mkfs.c,v 1.34 2016/06/24 19:24:11 christos Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -48,7 +48,7 @@
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else
#ifdef __RCSID
-__RCSID("$NetBSD: mkfs.c,v 1.33 2015/12/21 00:58:08 christos Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.34 2016/06/24 19:24:11 christos Exp $");
#endif
#endif
#endif /* not lint */
@@ -787,15 +787,15 @@
offset = bno * fsopts->sectorsize + fsopts->offset;
if (lseek(fsopts->fd, offset, SEEK_SET) < 0)
- err(1, "%s: seek error for sector %lld", __func__,
+ err(EXIT_FAILURE, "%s: seek error for sector %lld", __func__,
(long long)bno);
n = read(fsopts->fd, bf, size);
if (n == -1) {
- err(1, "%s: read error bno %lld size %d", __func__,
+ err(EXIT_FAILURE, "%s: read error bno %lld size %d", __func__,
(long long)bno, size);
}
else if (n != size)
- errx(1, "%s: short read error for sector %lld", __func__,
+ errx(EXIT_FAILURE, "%s: short read error for sector %lld", __func__,
(long long)bno);
}
@@ -810,15 +810,15 @@
offset = bno * fsopts->sectorsize + fsopts->offset;
if (lseek(fsopts->fd, offset, SEEK_SET) == -1)
- err(1, "%s: seek error for sector %lld", __func__,
+ err(EXIT_FAILURE, "%s: seek error for sector %lld", __func__,
(long long)bno);
n = write(fsopts->fd, bf, size);
if (n == -1)
- err(1, "%s: write error for sector %lld", __func__,
+ err(EXIT_FAILURE, "%s: write error for sector %lld", __func__,
(long long)bno);
else if (n != size)
- errx(1, "%s: short write error for sector %lld", __func__,
- (long long)bno);
+ errx(EXIT_FAILURE, "%s: short write error for sector %lld",
+ __func__, (long long)bno);
}
@@ -841,5 +841,5 @@
for (n = 0; n < sizeof(n) * CHAR_BIT; n++)
if (1 << n == val)
return (n);
- errx(1, "%s: %d is not a power of 2", __func__, val);
+ errx(EXIT_FAILURE, "%s: %d is not a power of 2", __func__, val);
}
Home |
Main Index |
Thread Index |
Old Index