Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck - use warn/err properly



details:   https://anonhg.NetBSD.org/src/rev/7e78d9622ceb
branches:  trunk
changeset: 752762:7e78d9622ceb
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 06 00:30:54 2010 +0000

description:
- use warn/err properly
- wrap long lines

diffstat:

 sbin/fsck/partutil.c |  26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diffs (69 lines):

diff -r b333802d5660 -r 7e78d9622ceb sbin/fsck/partutil.c
--- a/sbin/fsck/partutil.c      Fri Mar 05 23:08:18 2010 +0000
+++ b/sbin/fsck/partutil.c      Sat Mar 06 00:30:54 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: partutil.c,v 1.9 2009/07/16 23:50:32 dyoung Exp $      */
+/*     $NetBSD: partutil.c,v 1.10 2010/03/06 00:30:54 christos Exp $   */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: partutil.c,v 1.9 2009/07/16 23:50:32 dyoung Exp $");
+__RCSID("$NetBSD: partutil.c,v 1.10 2010/03/06 00:30:54 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/disklabel.h>
@@ -76,12 +76,16 @@
 static void
 dict2geom(struct disk_geom *geo, prop_dictionary_t dict)
 {
-       memset(geo, 0, sizeof(struct disk_geom));
-       prop_dictionary_get_int64(dict, "sectors-per-unit", &geo->dg_secperunit);
+       (void)memset(geo, 0, sizeof(struct disk_geom));
+       prop_dictionary_get_int64(dict, "sectors-per-unit",
+           &geo->dg_secperunit);
        prop_dictionary_get_uint32(dict, "sector-size", &geo->dg_secsize);
-       prop_dictionary_get_uint32(dict, "sectors-per-track", &geo->dg_nsectors);
-       prop_dictionary_get_uint32(dict, "tracks-per-cylinder", &geo->dg_ntracks);
-       prop_dictionary_get_uint32(dict, "cylinders-per-unit", &geo->dg_ncylinders);
+       prop_dictionary_get_uint32(dict, "sectors-per-track",
+           &geo->dg_nsectors);
+       prop_dictionary_get_uint32(dict, "tracks-per-cylinder",
+           &geo->dg_ntracks);
+       prop_dictionary_get_uint32(dict, "cylinders-per-unit",
+           &geo->dg_ncylinders);
 }
 
 
@@ -159,7 +163,7 @@
        if (dt) {
                lp = getdiskbyname(dt);
                if (lp == NULL)
-                       errx(1, "%s: unknown disk type", dt);
+                       errx(1, "unknown disk type `%s'", dt);
        }
 
        /* Get disk description dictionary */
@@ -171,7 +175,7 @@
                 * cgd, ccd pseudo disk drives doesn't support DIOCGDDISKINFO
                 */
                if (ioctl(fd, DIOCGDINFO, lp) == -1) {
-                       printf("DIOCGDINFO on %s failed\n", s);
+                       warn("DIOCGDINFO on %s failed", s);
                        return -1;
                }
                label2geom(geo, lp);
@@ -183,8 +187,8 @@
        /* Get info about partition/wedge */
        if (ioctl(fd, DIOCGWEDGEINFO, dkw) == -1) {
                if (ioctl(fd, DIOCGDINFO, lp) == -1)
-                       errx(errno, "Please implement DIOCGWEDGEINFO or "
-                           "DIOCGDINFO for disk device %s\n", s);
+                       err(1, "Please implement DIOCGWEDGEINFO or "
+                           "DIOCGDINFO for disk device %s", s);
 
                part2wedge(dkw, lp, s);
        }



Home | Main Index | Thread Index | Old Index