Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux/arch/i386 Fix DIOCGPARTINFO



details:   https://anonhg.NetBSD.org/src/rev/fffaddb416ae
branches:  trunk
changeset: 342144:fffaddb416ae
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 08 21:27:50 2015 +0000

description:
Fix DIOCGPARTINFO

diffstat:

 sys/compat/linux/arch/i386/linux_machdep.c |  21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diffs (63 lines):

diff -r 0adcce5bc464 -r fffaddb416ae sys/compat/linux/arch/i386/linux_machdep.c
--- a/sys/compat/linux/arch/i386/linux_machdep.c        Tue Dec 08 20:56:21 2015 +0000
+++ b/sys/compat/linux/arch/i386/linux_machdep.c        Tue Dec 08 21:27:50 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.160 2015/12/08 20:36:14 christos Exp $     */
+/*     $NetBSD: linux_machdep.c,v 1.161 2015/12/08 21:27:50 christos Exp $     */
 
 /*-
  * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.160 2015/12/08 20:36:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.161 2015/12/08 21:27:50 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -807,7 +807,7 @@
        struct biosdisk_info *bip;
        file_t *fp;
        int fd;
-       struct disklabel label, *labp;
+       struct disklabel label;
        struct partinfo partp;
        int (*ioctlf)(struct file *, u_long, void *);
        u_long start, biostotal, realtotal;
@@ -935,28 +935,27 @@
                 */
                bip = fd2biosinfo(curproc, fp);
                ioctlf = fp->f_ops->fo_ioctl;
-               error = ioctlf(fp, DIOCGDEFLABEL, (void *)&label);
+               error = ioctlf(fp, DIOCGDINFO, (void *)&label);
                error1 = ioctlf(fp, DIOCGPARTINFO, (void *)&partp);
                if (error != 0 && error1 != 0) {
                        error = error1;
                        goto out;
                }
-               labp = error != 0 ? &label : partp.disklab;
-               start = error1 != 0 ? partp.part->p_offset : 0;
+               start = error1 != 0 ? partp.pi_offset : 0;
                if (bip != NULL && bip->bi_head != 0 && bip->bi_sec != 0
                    && bip->bi_cyl != 0) {
                        heads = bip->bi_head;
                        sectors = bip->bi_sec;
                        cylinders = bip->bi_cyl;
                        biostotal = heads * sectors * cylinders;
-                       realtotal = labp->d_ntracks * labp->d_nsectors *
-                           labp->d_ncylinders;
+                       realtotal = label.d_ntracks * label.d_nsectors *
+                           label.d_ncylinders;
                        if (realtotal > biostotal)
                                cylinders = realtotal / (heads * sectors);
                } else {
-                       heads = labp->d_ntracks;
-                       cylinders = labp->d_ncylinders;
-                       sectors = labp->d_nsectors;
+                       heads = label.d_ntracks;
+                       cylinders = label.d_ncylinders;
+                       sectors = label.d_nsectors;
                }
                if (com == LINUX_HDIO_GETGEO) {
                        hdg.start = start;



Home | Main Index | Thread Index | Old Index