Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dkwedge Use FSTYPE_DEFN from <sys/disklabel.h> to ge...
details: https://anonhg.NetBSD.org/src/rev/ce876038628d
branches: trunk
changeset: 331665:ce876038628d
user: apb <apb%NetBSD.org@localhost>
date: Mon Aug 18 14:18:59 2014 +0000
description:
Use FSTYPE_DEFN from <sys/disklabel.h> to generate case branches for
conversions from all known disklabel fstypes to strings. This replaces
the hand-coded list of conversions for only a few of the known types.
diffstat:
sys/dev/dkwedge/dkwedge_bsdlabel.c | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
diffs (48 lines):
diff -r 708bb1d830d6 -r ce876038628d sys/dev/dkwedge/dkwedge_bsdlabel.c
--- a/sys/dev/dkwedge/dkwedge_bsdlabel.c Mon Aug 18 13:46:07 2014 +0000
+++ b/sys/dev/dkwedge/dkwedge_bsdlabel.c Mon Aug 18 14:18:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dkwedge_bsdlabel.c,v 1.20 2014/08/18 13:46:07 apb Exp $ */
+/* $NetBSD: dkwedge_bsdlabel.c,v 1.21 2014/08/18 14:18:59 apb Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_bsdlabel.c,v 1.20 2014/08/18 13:46:07 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_bsdlabel.c,v 1.21 2014/08/18 14:18:59 apb Exp $");
#include <sys/param.h>
#ifdef _KERNEL
@@ -144,21 +144,15 @@
{
const char *str;
+ /*
+ * For each type known to FSTYPE_DEFN (from <sys/disklabel.h>),
+ * a suitable case branch will convert the type number to a string.
+ */
switch (fstype) {
- case FS_UNUSED: str = DKW_PTYPE_UNUSED; break;
- case FS_SWAP: str = DKW_PTYPE_SWAP; break;
- case FS_BSDFFS: str = DKW_PTYPE_FFS; break;
- case FS_MSDOS: str = DKW_PTYPE_FAT; break;
- case FS_BSDLFS: str = DKW_PTYPE_LFS; break;
- case FS_ISO9660: str = DKW_PTYPE_ISO9660; break;
- case FS_ADOS: str = DKW_PTYPE_AMIGADOS; break;
- case FS_HFS: str = DKW_PTYPE_APPLEHFS; break;
- case FS_FILECORE: str = DKW_PTYPE_FILECORE; break;
- case FS_EX2FS: str = DKW_PTYPE_EXT2FS; break;
- case FS_NTFS: str = DKW_PTYPE_NTFS; break;
- case FS_RAID: str = DKW_PTYPE_RAIDFRAME; break;
- case FS_CCD: str = DKW_PTYPE_CCD; break;
- case FS_APPLEUFS: str = DKW_PTYPE_APPLEUFS; break;
+#define FSTYPE_TO_STR_CASE(tag, number, name, fsck, mount) \
+ case __CONCAT(FS_,tag): str = name; break;
+ FSTYPE_DEFN(FSTYPE_TO_STR_CASE)
+#undef FSTYPE_TO_STR_CASE
default: str = NULL; break;
}
Home |
Main Index |
Thread Index |
Old Index