Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev/dkwedge Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/8222c212cbe7
branches:  netbsd-7
changeset: 798538:8222c212cbe7
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 11 10:31:16 2014 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #200):
        sys/dev/dkwedge/dkwedge_bsdlabel.c: revision 1.23
        sys/dev/dkwedge/dkwedge_mbr.c: revision 1.8
        sys/dev/dkwedge/dkwedge_gpt.c: revision 1.14
Handle disks with non DEV_BSIZE sectors.
get sector size from disk structure.
Be less noisy when handling wedge name conflicts.

diffstat:

 sys/dev/dkwedge/dkwedge_bsdlabel.c |  16 +++++++++-------
 sys/dev/dkwedge/dkwedge_gpt.c      |  16 +++++++++-------
 sys/dev/dkwedge/dkwedge_mbr.c      |   6 +++---
 3 files changed, 21 insertions(+), 17 deletions(-)

diffs (139 lines):

diff -r 8717a356f6bb -r 8222c212cbe7 sys/dev/dkwedge/dkwedge_bsdlabel.c
--- a/sys/dev/dkwedge/dkwedge_bsdlabel.c        Tue Nov 11 10:21:25 2014 +0000
+++ b/sys/dev/dkwedge/dkwedge_bsdlabel.c        Tue Nov 11 10:31:16 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.19.4.1 2014/11/11 10:31:16 martin 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.19.4.1 2014/11/11 10:31:16 martin Exp $");
 
 #include <sys/param.h>
 #ifdef _KERNEL
@@ -137,6 +137,7 @@
        struct vnode    *vp;
        void            *buf;
        int             error;
+       uint32_t        secsize;
 } mbr_args_t;
 
 static const char *
@@ -283,7 +284,7 @@
        int error, swapped;
        uint16_t npartitions;
 
-       error = dkwedge_read(a->pdk, a->vp, label_sector, a->buf, DEV_BSIZE);
+       error = dkwedge_read(a->pdk, a->vp, label_sector, a->buf, a->secsize);
        if (error) {
                aprint_error("%s: unable to read BSD disklabel @ %" PRId64
                    ", error = %d\n", a->pdk->dk_name, label_sector, error);
@@ -297,7 +298,7 @@
         * in the sector.
         */
        lp = a->buf;
-       lp_lim = (char *)a->buf + DEV_BSIZE - DISKLABEL_MINSIZE;
+       lp_lim = (char *)a->buf + a->secsize - DISKLABEL_MINSIZE;
        for (;; lp = (void *)((char *)lp + sizeof(uint32_t))) {
                if ((char *)lp > (char *)lp_lim)
                        return (SCAN_CONTINUE);
@@ -316,7 +317,7 @@
 
                /* Validate label length. */
                if ((char *)lp + DISKLABEL_SIZE(npartitions) >
-                   (char *)a->buf + DEV_BSIZE) {
+                   (char *)a->buf + a->secsize) {
                        aprint_error("%s: BSD disklabel @ "
                            "%" PRId64 "+%zd has bogus partition count (%u)\n",
                            a->pdk->dk_name, label_sector, label_offset,
@@ -360,7 +361,7 @@
        this_ext = 0;
        for (;;) {
                a->error = dkwedge_read(a->pdk, a->vp, this_ext, a->buf,
-                                       DEV_BSIZE);
+                                       a->secsize);
                if (a->error) {
                        aprint_error("%s: unable to read MBR @ %u, "
                            "error = %d\n", a->pdk->dk_name, this_ext,
@@ -456,8 +457,9 @@
        int rval;
 
        a.pdk = pdk;
+       a.secsize = DEV_BSIZE << pdk->dk_blkshift;
        a.vp = vp;
-       a.buf = DKW_MALLOC(DEV_BSIZE);
+       a.buf = DKW_MALLOC(a.secsize);
        a.error = 0;
 
        /* MBR search. */
diff -r 8717a356f6bb -r 8222c212cbe7 sys/dev/dkwedge/dkwedge_gpt.c
--- a/sys/dev/dkwedge/dkwedge_gpt.c     Tue Nov 11 10:21:25 2014 +0000
+++ b/sys/dev/dkwedge/dkwedge_gpt.c     Tue Nov 11 10:31:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dkwedge_gpt.c,v 1.12 2010/05/17 23:09:52 jakllsch Exp $        */
+/*     $NetBSD: dkwedge_gpt.c,v 1.12.34.1 2014/11/11 10:31:16 martin Exp $     */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.12 2010/05/17 23:09:52 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_gpt.c,v 1.12.34.1 2014/11/11 10:31:16 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -265,13 +265,15 @@
                 * Try with the partition name first.  If that fails,
                 * use the GUID string.  If that fails, punt.
                 */
-               if ((error = dkwedge_add(&dkw)) == EEXIST) {
-                       aprint_error("%s: wedge named '%s' already exists, "
-                           "trying '%s'\n", pdk->dk_name,
-                           dkw.dkw_wname, /* XXX Unicode */
-                           ent_guid_str);
+               if ((error = dkwedge_add(&dkw)) == EEXIST &&
+                   strcmp(dkw.dkw_wname, ent_guid_str) != 0) {
                        strcpy(dkw.dkw_wname, ent_guid_str);
                        error = dkwedge_add(&dkw);
+                       if (!error)
+                               aprint_error("%s: wedge named '%s' already "
+                                   "existed, using '%s'\n", pdk->dk_name,
+                                   dkw.dkw_wname, /* XXX Unicode */
+                                   ent_guid_str);
                }
                if (error == EEXIST)
                        aprint_error("%s: wedge named '%s' already exists, "
diff -r 8717a356f6bb -r 8222c212cbe7 sys/dev/dkwedge/dkwedge_mbr.c
--- a/sys/dev/dkwedge/dkwedge_mbr.c     Tue Nov 11 10:21:25 2014 +0000
+++ b/sys/dev/dkwedge/dkwedge_mbr.c     Tue Nov 11 10:31:16 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dkwedge_mbr.c,v 1.7 2012/04/07 05:09:09 christos Exp $ */
+/*     $NetBSD: dkwedge_mbr.c,v 1.7.14.1 2014/11/11 10:31:16 martin Exp $      */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_mbr.c,v 1.7 2012/04/07 05:09:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_mbr.c,v 1.7.14.1 2014/11/11 10:31:16 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -168,7 +168,7 @@
        mbr_args_t a;
 
        a.pdk = pdk;
-       a.secsize = pdk->dk_label->d_secsize;
+       a.secsize = DEV_BSIZE << pdk->dk_blkshift;  
        a.vp = vp;
        a.buf = malloc(a.secsize, M_DEVBUF, M_WAITOK);
        a.error = 0;



Home | Main Index | Thread Index | Old Index