Module Name:    src
Committed By:   apb
Date:           Mon Aug 18 13:46:07 UTC 2014

Modified Files:
        src/sys/dev/dkwedge: dkwedge_bsdlabel.c

Log Message:
Don't ignore unrecognised partition types in BSD disklabels;
instead, add them with wedge partition type "unknown#%u", where
%u is the underlying numeric partition type from the BSD disklabel.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/dkwedge/dkwedge_bsdlabel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dkwedge/dkwedge_bsdlabel.c
diff -u src/sys/dev/dkwedge/dkwedge_bsdlabel.c:1.19 src/sys/dev/dkwedge/dkwedge_bsdlabel.c:1.20
--- src/sys/dev/dkwedge/dkwedge_bsdlabel.c:1.19	Mon Mar 31 11:25:49 2014
+++ src/sys/dev/dkwedge/dkwedge_bsdlabel.c	Mon Aug 18 13:46:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkwedge_bsdlabel.c,v 1.19 2014/03/31 11:25:49 martin Exp $	*/
+/*	$NetBSD: dkwedge_bsdlabel.c,v 1.20 2014/08/18 13:46:07 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.19 2014/03/31 11:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_bsdlabel.c,v 1.20 2014/08/18 13:46:07 apb Exp $");
 
 #include <sys/param.h>
 #ifdef _KERNEL
@@ -232,18 +232,15 @@ addwedges(const mbr_args_t *a, const str
 
 		if (p->p_fstype == FS_UNUSED)
 			continue;
-		if ((ptype = bsdlabel_fstype_to_str(p->p_fstype)) == NULL) {
-			/*
-			 * XXX Should probably just add these...
-			 * XXX maybe just have an empty ptype?
-			 */
-			aprint_verbose("%s: skipping partition %d, type %d\n",
-			    a->pdk->dk_name, i, p->p_fstype);
-			continue;
-		}
-		strcpy(dkw.dkw_ptype, ptype);
+		ptype = bsdlabel_fstype_to_str(p->p_fstype);
+		if (ptype == NULL)
+			snprintf(dkw.dkw_ptype, sizeof(dkw.dkw_ptype),
+			    "unknown#%u", p->p_fstype);
+		else
+			strlcpy(dkw.dkw_ptype, ptype, sizeof(dkw.dkw_ptype));
 
-		strcpy(dkw.dkw_parent, a->pdk->dk_name);
+		strlcpy(dkw.dkw_parent, a->pdk->dk_name,
+		    sizeof(dkw.dkw_parent));
 		dkw.dkw_offset = p->p_offset;
 		dkw.dkw_size = p->p_size;
 

Reply via email to