Module Name: src Committed By: christos Date: Sat Mar 6 00:30:54 UTC 2010
Modified Files: src/sbin/fsck: partutil.c Log Message: - use warn/err properly - wrap long lines To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/fsck/partutil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/fsck/partutil.c diff -u src/sbin/fsck/partutil.c:1.9 src/sbin/fsck/partutil.c:1.10 --- src/sbin/fsck/partutil.c:1.9 Thu Jul 16 19:50:32 2009 +++ src/sbin/fsck/partutil.c Fri Mar 5 19:30:54 2010 @@ -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); }