Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge Don't ignore unrecognised partition types in...



details:   https://anonhg.NetBSD.org/src/rev/708bb1d830d6
branches:  trunk
changeset: 331664:708bb1d830d6
user:      apb <apb%NetBSD.org@localhost>
date:      Mon Aug 18 13:46:07 2014 +0000

description:
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.

diffstat:

 sys/dev/dkwedge/dkwedge_bsdlabel.c |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diffs (45 lines):

diff -r 8edc10717dec -r 708bb1d830d6 sys/dev/dkwedge/dkwedge_bsdlabel.c
--- a/sys/dev/dkwedge/dkwedge_bsdlabel.c        Mon Aug 18 09:45:52 2014 +0000
+++ b/sys/dev/dkwedge/dkwedge_bsdlabel.c        Mon Aug 18 13:46:07 2014 +0000
@@ -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 @@
 
                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;
 



Home | Main Index | Thread Index | Old Index