Source-Changes-HG archive

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

[src/trunk]: src/sys/kern get the wedge info first if it exists, because this...



details:   https://anonhg.NetBSD.org/src/rev/d92dcce793e3
branches:  trunk
changeset: 335255:d92dcce793e3
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 31 19:50:14 2014 +0000

description:
get the wedge info first if it exists, because this will support larger sizes.

diffstat:

 sys/kern/subr_disk_open.c |  32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diffs (55 lines):

diff -r 9b32e55535c0 -r d92dcce793e3 sys/kern/subr_disk_open.c
--- a/sys/kern/subr_disk_open.c Wed Dec 31 19:37:35 2014 +0000
+++ b/sys/kern/subr_disk_open.c Wed Dec 31 19:50:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk_open.c,v 1.11 2012/10/27 17:18:39 chs Exp $  */
+/*     $NetBSD: subr_disk_open.c,v 1.12 2014/12/31 19:50:14 christos Exp $     */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.11 2012/10/27 17:18:39 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.12 2014/12/31 19:50:14 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -98,19 +98,25 @@
        uint64_t numsec;
        int error;
 
-       error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, NOCRED);
+       /*
+        * We attempt to get the wedge information first if it exists,
+        * because the label does not support larger size disks.
+        */
+       error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED);
        if (error == 0) {
-               secsize = dpart.disklab->d_secsize;
-               numsec  = dpart.part->p_size;
-       } else {
-               error = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, NOCRED);
+               pdk = disk_find(dkw.dkw_parent);
+               if (pdk != NULL) {
+                       secsize = DEV_BSIZE << pdk->dk_blkshift;
+                       numsec  = dkw.dkw_size;
+               } else
+                       error = ENODEV;
+       }
+
+       if (error) {
+               error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, NOCRED);
                if (error == 0) {
-                       pdk = disk_find(dkw.dkw_parent);
-                       if (pdk != NULL) {
-                               secsize = DEV_BSIZE << pdk->dk_blkshift;
-                               numsec  = dkw.dkw_size;
-                       } else
-                               error = ENODEV;
+                       secsize = dpart.disklab->d_secsize;
+                       numsec  = dpart.part->p_size;
                }
        }
 



Home | Main Index | Thread Index | Old Index