Module Name: src
Committed By: christos
Date: Tue Dec 8 20:36:15 UTC 2015
Modified Files:
src/sys/arch/atari/dev: hdfd.c
src/sys/compat/linux/arch/i386: linux_machdep.c
src/sys/compat/linux/common: linux_blkio.c linux_hdio.c
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h
src/sys/compat/sunos: sunos_ioctl.c
src/sys/compat/sunos32: sunos32_ioctl.c
src/sys/dev: ccd.c dksubr.c vnd.c
src/sys/dev/isa: fd.c
src/sys/dev/pud: pud_dev.c
src/sys/dev/qbus: rf.c
src/sys/dev/raidframe: rf_netbsdkintf.c
src/sys/kern: init_main.c subr_disk.c subr_disk_open.c
src/sys/miscfs/specfs: spec_vnops.c
src/sys/rump/librump/rumpvfs: rumpblk.c
src/sys/sys: disklabel.h dkio.h param.h
Log Message:
Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/atari/dev/hdfd.c
cvs rdiff -u -r1.159 -r1.160 src/sys/compat/linux/arch/i386/linux_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/linux/common/linux_blkio.c
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/linux/common/linux_hdio.c
cvs rdiff -u -r1.82 -r1.83 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/netbsd32/netbsd32_ioctl.h
cvs rdiff -u -r1.63 -r1.64 src/sys/compat/sunos/sunos_ioctl.c
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/sunos32/sunos32_ioctl.c
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/ccd.c
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/dksubr.c
cvs rdiff -u -r1.255 -r1.256 src/sys/dev/vnd.c
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/isa/fd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pud/pud_dev.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/qbus/rf.c
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.476 -r1.477 src/sys/kern/init_main.c
cvs rdiff -u -r1.114 -r1.115 src/sys/kern/subr_disk.c
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_disk_open.c
cvs rdiff -u -r1.156 -r1.157 src/sys/miscfs/specfs/spec_vnops.c
cvs rdiff -u -r1.60 -r1.61 src/sys/rump/librump/rumpvfs/rumpblk.c
cvs rdiff -u -r1.118 -r1.119 src/sys/sys/disklabel.h
cvs rdiff -u -r1.21 -r1.22 src/sys/sys/dkio.h
cvs rdiff -u -r1.488 -r1.489 src/sys/sys/param.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/atari/dev/hdfd.c
diff -u src/sys/arch/atari/dev/hdfd.c:1.81 src/sys/arch/atari/dev/hdfd.c:1.82
--- src/sys/arch/atari/dev/hdfd.c:1.81 Sun Apr 26 11:15:19 2015
+++ src/sys/arch/atari/dev/hdfd.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hdfd.c,v 1.81 2015/04/26 15:15:19 mlelstv Exp $ */
+/* $NetBSD: hdfd.c,v 1.82 2015/12/08 20:36:14 christos Exp $ */
/*-
* Copyright (c) 1996 Leo Weppelman
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.81 2015/04/26 15:15:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.82 2015/12/08 20:36:14 christos Exp $");
#include "opt_ddb.h"
@@ -1306,7 +1306,7 @@ fdioctl(dev_t dev, u_long cmd, void *add
switch (cmd) {
case DIOCGDINFO:
- case DIOCGPART:
+ case DIOCGPARTINFO:
fdgetdisklabel(fd, dev);
break;
}
Index: src/sys/compat/linux/arch/i386/linux_machdep.c
diff -u src/sys/compat/linux/arch/i386/linux_machdep.c:1.159 src/sys/compat/linux/arch/i386/linux_machdep.c:1.160
--- src/sys/compat/linux/arch/i386/linux_machdep.c:1.159 Sun Nov 9 12:48:07 2014
+++ src/sys/compat/linux/arch/i386/linux_machdep.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.159 2014/11/09 17:48:07 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.160 2015/12/08 20:36:14 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.159 2014/11/09 17:48:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.160 2015/12/08 20:36:14 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -936,7 +936,7 @@ linux_machdepioctl(struct lwp *l, const
bip = fd2biosinfo(curproc, fp);
ioctlf = fp->f_ops->fo_ioctl;
error = ioctlf(fp, DIOCGDEFLABEL, (void *)&label);
- error1 = ioctlf(fp, DIOCGPART, (void *)&partp);
+ error1 = ioctlf(fp, DIOCGPARTINFO, (void *)&partp);
if (error != 0 && error1 != 0) {
error = error1;
goto out;
Index: src/sys/compat/linux/common/linux_blkio.c
diff -u src/sys/compat/linux/common/linux_blkio.c:1.17 src/sys/compat/linux/common/linux_blkio.c:1.18
--- src/sys/compat/linux/common/linux_blkio.c:1.17 Fri Mar 21 17:54:58 2008
+++ src/sys/compat/linux/common/linux_blkio.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_blkio.c,v 1.17 2008/03/21 21:54:58 ad Exp $ */
+/* $NetBSD: linux_blkio.c,v 1.18 2015/12/08 20:36:14 christos Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.17 2008/03/21 21:54:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.18 2015/12/08 20:36:14 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,7 +68,7 @@ linux_ioctl_blkio(struct lwp *l, const s
int error;
file_t *fp;
int (*ioctlf)(file_t *, u_long, void *);
- struct partinfo partp;
+ struct partinfo pi;
struct disklabel label;
if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
@@ -85,19 +85,19 @@ linux_ioctl_blkio(struct lwp *l, const s
* fails, it may be a disk without label; try to get
* the default label and compute the size from it.
*/
- error = ioctlf(fp, DIOCGPART, &partp);
+ error = ioctlf(fp, DIOCGPARTINFO, &pi);
if (error != 0) {
- error = ioctlf(fp, DIOCGDEFLABEL, &label);
+ error = ioctlf(fp, DIOCGDINFO, &label);
if (error != 0)
break;
size = label.d_nsectors * label.d_ntracks *
label.d_ncylinders;
} else
- size = partp.part->p_size;
+ size = pi.pi_size;
error = copyout(&size, SCARG(uap, data), sizeof size);
break;
case LINUX_BLKSECTGET:
- error = ioctlf(fp, DIOCGDEFLABEL, &label);
+ error = ioctlf(fp, DIOCGDINFO, &label);
if (error != 0)
break;
error = copyout(&label.d_secsize, SCARG(uap, data),
Index: src/sys/compat/linux/common/linux_hdio.c
diff -u src/sys/compat/linux/common/linux_hdio.c:1.16 src/sys/compat/linux/common/linux_hdio.c:1.17
--- src/sys/compat/linux/common/linux_hdio.c:1.16 Fri Mar 21 17:54:58 2008
+++ src/sys/compat/linux/common/linux_hdio.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_hdio.c,v 1.16 2008/03/21 21:54:58 ad Exp $ */
+/* $NetBSD: linux_hdio.c,v 1.17 2015/12/08 20:36:14 christos Exp $ */
/*
* Copyright (c) 2000 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.16 2008/03/21 21:54:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.17 2015/12/08 20:36:14 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -72,8 +72,8 @@ linux_ioctl_hdio(struct lwp *l, const st
struct file *fp;
int (*ioctlf)(struct file *, u_long, void *);
struct atareq req;
- struct disklabel label, *labp;
- struct partinfo partp;
+ struct disklabel label;
+ struct partinfo pi;
struct linux_hd_geometry hdg;
struct linux_hd_big_geometry hdg_big;
@@ -107,17 +107,16 @@ linux_ioctl_hdio(struct lwp *l, const st
error = linux_machdepioctl(l, uap, retval);
if (error == 0)
break;
- error = ioctlf(fp, DIOCGDEFLABEL, &label);
- error1 = ioctlf(fp, DIOCGPART, &partp);
+ error = ioctlf(fp, DIOCGDINFO, &label);
+ error1 = ioctlf(fp, DIOCGPARTINFO, &pi);
if (error != 0 && error1 != 0) {
error = error1;
break;
}
- labp = error != 0 ? &label : partp.disklab;
- hdg.start = error1 != 0 ? partp.part->p_offset : 0;
- hdg.heads = labp->d_ntracks;
- hdg.cylinders = labp->d_ncylinders;
- hdg.sectors = labp->d_nsectors;
+ hdg.start = error1 != 0 ? pi.pi_offset : 0;
+ hdg.heads = label.d_ntracks;
+ hdg.cylinders = label.d_ncylinders;
+ hdg.sectors = label.d_nsectors;
error = copyout(&hdg, SCARG(uap, data), sizeof hdg);
break;
case LINUX_HDIO_GETGEO_BIG:
@@ -125,17 +124,16 @@ linux_ioctl_hdio(struct lwp *l, const st
if (error == 0)
break;
case LINUX_HDIO_GETGEO_BIG_RAW:
- error = ioctlf(fp, DIOCGDEFLABEL, &label);
- error1 = ioctlf(fp, DIOCGPART, &partp);
+ error = ioctlf(fp, DIOCGDINFO, &label);
+ error1 = ioctlf(fp, DIOCGPARTINFO, &pi);
if (error != 0 && error1 != 0) {
error = error1;
break;
}
- labp = error != 0 ? &label : partp.disklab;
- hdg_big.start = error1 != 0 ? partp.part->p_offset : 0;
- hdg_big.heads = labp->d_ntracks;
- hdg_big.cylinders = labp->d_ncylinders;
- hdg_big.sectors = labp->d_nsectors;
+ hdg_big.start = error1 != 0 ? pi.pi_offset : 0;
+ hdg_big.heads = label.d_ntracks;
+ hdg_big.cylinders = label.d_ncylinders;
+ hdg_big.sectors = label.d_nsectors;
error = copyout(&hdg_big, SCARG(uap, data), sizeof hdg_big);
break;
case LINUX_HDIO_GET_UNMASKINTR:
Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.82 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.83
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.82 Sun Aug 2 03:37:57 2015
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.82 2015/08/02 07:37:57 maxv Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.83 2015/12/08 20:36:14 christos Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.82 2015/08/02 07:37:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.83 2015/12/08 20:36:14 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -87,14 +87,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioc
/* convert to/from different structures */
-static inline void
-netbsd32_to_partinfo(struct netbsd32_partinfo *s32p, struct partinfo *p, u_long cmd)
-{
-
- p->disklab = (struct disklabel *)NETBSD32PTR64(s32p->disklab);
- p->part = (struct partition *)NETBSD32PTR64(s32p->part);
-}
-
#if 0
static inline void
netbsd32_to_format_op(struct netbsd32_format_op *s32p, struct format_op *p, u_long cmd)
@@ -487,14 +479,6 @@ netbsd32_to_npf_ioctl_table(
* handle ioctl conversions from 64-bit kernel -> netbsd32
*/
-static inline void
-netbsd32_from_partinfo(struct partinfo *p, struct netbsd32_partinfo *s32p, u_long cmd)
-{
-
- NETBSD32PTR32(s32p->disklab, p->disklab);
- NETBSD32PTR32(s32p->part, p->part);
-}
-
#if 0
static inline void
netbsd32_from_format_op(struct format_op *p, struct netbsd32_format_op *s32p, u_long cmd)
@@ -1066,8 +1050,6 @@ netbsd32_ioctl(struct lwp *l, const stru
case AUDIO_WSEEK32:
IOCTL_CONV_TO(AUDIO_WSEEK, u_long);
- case DIOCGPART32:
- IOCTL_STRUCT_CONV_TO(DIOCGPART, partinfo);
#if 0 /* not implemented by anything */
case DIOCRFORMAT32:
IOCTL_STRUCT_CONV_TO(DIOCRFORMAT, format_op);
Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.52 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.53
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.52 Mon Jun 1 12:07:27 2015
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.52 2015/06/01 16:07:27 roy Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.53 2015/12/08 20:36:14 christos Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -71,13 +71,6 @@
/* from <sys/dkio.h> */
typedef netbsd32_pointer_t netbsd32_disklabel_tp_t;
typedef netbsd32_pointer_t netbsd32_partition_tp_t;
-struct netbsd32_partinfo {
- netbsd32_disklabel_tp_t disklab;
- netbsd32_partition_tp_t part;
-};
-#if 1
-#define DIOCGPART32 _IOW('d', 104, struct netbsd32_partinfo) /* get partition */
-#endif
#if 0 /* not implemented by anything */
struct netbsd32_format_op {
Index: src/sys/compat/sunos/sunos_ioctl.c
diff -u src/sys/compat/sunos/sunos_ioctl.c:1.63 src/sys/compat/sunos/sunos_ioctl.c:1.64
--- src/sys/compat/sunos/sunos_ioctl.c:1.63 Sat Sep 26 00:13:39 2015
+++ src/sys/compat/sunos/sunos_ioctl.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: sunos_ioctl.c,v 1.63 2015/09/26 04:13:39 christos Exp $ */
+/* $NetBSD: sunos_ioctl.c,v 1.64 2015/12/08 20:36:14 christos Exp $ */
/*
* Copyright (c) 1993 Markus Wild.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.63 2015/09/26 04:13:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_ioctl.c,v 1.64 2015/12/08 20:36:14 christos Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -871,8 +871,12 @@ sunos_sys_ioctl(struct lwp *l, const str
case SUN_DKIOCGPART:
{
struct partinfo pi;
+ struct disklabel label;
- error = (*ctl)(fp, DIOCGPART, &pi);
+ error = (*ctl)(fp, DIOCGDINFO, &label);
+ if (error)
+ break;
+ error = (*ctl)(fp, DIOCGPARTINFO, &pi);
if (error)
break;
@@ -880,14 +884,14 @@ sunos_sys_ioctl(struct lwp *l, const str
error = ERANGE; /* XXX */
break;
}
- if (pi.part->p_offset % pi.disklab->d_secpercyl != 0) {
+ if (pi.pi_offset % label.d_secpercyl != 0) {
error = ERANGE; /* XXX */
break;
}
#define datapart ((struct sun_dkpart *)SCARG(uap, data))
- datapart->sdkp_cyloffset = pi.part->p_offset / pi.disklab->d_secpercyl;
- datapart->sdkp_nsectors = pi.part->p_size;
+ datapart->sdkp_cyloffset = pi.pi_offset / label.d_secpercyl;
+ datapart->sdkp_nsectors = pi.pi_size;
#undef datapart
break;
}
Index: src/sys/compat/sunos32/sunos32_ioctl.c
diff -u src/sys/compat/sunos32/sunos32_ioctl.c:1.32 src/sys/compat/sunos32/sunos32_ioctl.c:1.33
--- src/sys/compat/sunos32/sunos32_ioctl.c:1.32 Sat Sep 26 00:13:39 2015
+++ src/sys/compat/sunos32/sunos32_ioctl.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: sunos32_ioctl.c,v 1.32 2015/09/26 04:13:39 christos Exp $ */
+/* $NetBSD: sunos32_ioctl.c,v 1.33 2015/12/08 20:36:14 christos Exp $ */
/* from: NetBSD: sunos_ioctl.c,v 1.35 2001/02/03 22:20:02 mrg Exp */
/*
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos32_ioctl.c,v 1.32 2015/09/26 04:13:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos32_ioctl.c,v 1.33 2015/12/08 20:36:14 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd32.h"
@@ -899,19 +899,24 @@ sunos32_sys_ioctl(struct lwp *l, const s
case SUN_DKIOCGPART:
{
struct partinfo pi;
+ struct disklabel label;
+ int fd = SCARG(&bsd_ua, fd);
- error = sunos32_do_ioctl(SCARG(&bsd_ua, fd), DIOCGPART, &pi, l);
+ error = sunos32_do_ioctl(fd, DIOCGPARTINFO, &pi, l);
if (error)
- return (error);
+ return error;
+ error = sunos32_do_ioctl(fd, DIOCGDINFO, &label, l);
+ if (error)
+ return error;
- if (pi.disklab->d_secpercyl == 0)
- return (ERANGE); /* XXX */
- if (pi.part->p_offset % pi.disklab->d_secpercyl != 0)
- return (ERANGE); /* XXX */
+ if (label.d_secpercyl == 0)
+ return ERANGE; /* XXX */
+ if (pi.pi_offset % label.d_secpercyl != 0)
+ return ERANGE; /* XXX */
/* XXX can't do direct writes to a user address (dsl) */
#define datapart ((struct sun_dkpart *)SCARG_P32(uap, data))
- datapart->sdkp_cyloffset = pi.part->p_offset / pi.disklab->d_secpercyl;
- datapart->sdkp_nsectors = pi.part->p_size;
+ datapart->sdkp_cyloffset = pi.pi_offset / label.d_secpercyl;
+ datapart->sdkp_nsectors = pi.pi_size;
#undef datapart
}
Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.165 src/sys/dev/ccd.c:1.166
--- src/sys/dev/ccd.c:1.165 Thu Aug 20 10:40:17 2015
+++ src/sys/dev/ccd.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.165 2015/08/20 14:40:17 christos Exp $ */
+/* $NetBSD: ccd.c,v 1.166 2015/12/08 20:36:14 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.165 2015/08/20 14:40:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.166 2015/12/08 20:36:14 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -1182,7 +1182,7 @@ ccdioctl(dev_t dev, u_long cmd, void *da
case DIOCMWEDGES:
case DIOCSDINFO:
case DIOCWDINFO:
- case DIOCGPART:
+ case DIOCGPARTINFO:
case DIOCWLABEL:
case DIOCKLABEL:
case DIOCGDEFLABEL:
Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.82 src/sys/dev/dksubr.c:1.83
--- src/sys/dev/dksubr.c:1.82 Sat Nov 28 09:37:49 2015
+++ src/sys/dev/dksubr.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.82 2015/11/28 14:37:49 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.83 2015/12/08 20:36:14 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.82 2015/11/28 14:37:49 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.83 2015/12/08 20:36:14 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -509,7 +509,7 @@ dk_ioctl(struct dk_softc *dksc, dev_t de
case DIOCGDINFO:
case DIOCSDINFO:
case DIOCWDINFO:
- case DIOCGPART:
+ case DIOCGPARTINFO:
case DIOCKLABEL:
case DIOCWLABEL:
case DIOCGDEFLABEL:
Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.255 src/sys/dev/vnd.c:1.256
--- src/sys/dev/vnd.c:1.255 Mon Nov 30 01:04:47 2015
+++ src/sys/dev/vnd.c Tue Dec 8 15:36:14 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.255 2015/11/30 06:04:47 mlelstv Exp $ */
+/* $NetBSD: vnd.c,v 1.256 2015/12/08 20:36:14 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.255 2015/11/30 06:04:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256 2015/12/08 20:36:14 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -1205,7 +1205,7 @@ vndioctl(dev_t dev, u_long cmd, void *da
case DIOCGDINFO:
case DIOCSDINFO:
case DIOCWDINFO:
- case DIOCGPART:
+ case DIOCGPARTINFO:
case DIOCKLABEL:
case DIOCWLABEL:
case DIOCGDEFLABEL:
Index: src/sys/dev/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.109 src/sys/dev/isa/fd.c:1.110
--- src/sys/dev/isa/fd.c:1.109 Sun Apr 26 11:15:20 2015
+++ src/sys/dev/isa/fd.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.109 2015/04/26 15:15:20 mlelstv Exp $ */
+/* $NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $ */
/*-
* Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.109 2015/04/26 15:15:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $");
#include "opt_ddb.h"
@@ -1411,7 +1411,7 @@ fdioctl(dev_t dev, u_long cmd, void *add
#endif
switch (cmd) {
- case DIOCGPART:
+ case DIOCGPARTINFO:
case DIOCGDINFO:
#ifdef __HAVE_OLD_DISKLABEL
case ODIOCGDINFO:
Index: src/sys/dev/pud/pud_dev.c
diff -u src/sys/dev/pud/pud_dev.c:1.6 src/sys/dev/pud/pud_dev.c:1.7
--- src/sys/dev/pud/pud_dev.c:1.6 Tue Dec 22 12:32:03 2009
+++ src/sys/dev/pud/pud_dev.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pud_dev.c,v 1.6 2009/12/22 17:32:03 pooka Exp $ */
+/* $NetBSD: pud_dev.c,v 1.7 2015/12/08 20:36:15 christos Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pud_dev.c,v 1.6 2009/12/22 17:32:03 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pud_dev.c,v 1.7 2015/12/08 20:36:15 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -58,36 +58,13 @@ doopenclose(dev_t dev, int flags, int fm
}
#include <sys/disklabel.h>
-/*
- * XXX: this is not "reentrant". But then again, partinfo isn't
- * exactly safe in any case.
- */
-static struct disklabel dl_partinfo;
-
static int
doioctl(dev_t dev, u_long cmd, void *data, int flag, int class, int type)
{
struct pud_req_ioctl *pc_ioctl;
size_t dlen, allocsize;
- u_long origcmd = cmd;
- void *origdata = NULL; /* XXXgcc */
int error;
- /*
- * XXX: kludge. This is a horrible abstraction violation, but
- * then again DIOCGPART is a horrible ioctl (even more horrible
- * than the generic ioctl). We handle it specially here since
- * the server in userspace has no chance to handle it. And it's
- * a common operation used by most file systems. But really, it
- * should be replaced by something a bit more ... transactional.
- */
- if (cmd == DIOCGPART) {
- cmd = DIOCGDINFO;
- origdata = data;
- flag = 0;
- data = &dl_partinfo;
- }
-
dlen = IOCPARM_LEN(cmd);
allocsize = sizeof(struct pud_req_ioctl) + dlen;
pc_ioctl = kmem_zalloc(allocsize, KM_SLEEP);
@@ -103,39 +80,6 @@ doioctl(dev_t dev, u_long cmd, void *dat
if (cmd & IOC_OUT)
memcpy(data, pc_ioctl->pm_data, dlen);
- /*
- * In case doing the infamous DIOCGPART, issue the real
- * ioctl and do pointer arithmetic to figure out the right
- * partition. We could use DISKPART() too, but this seems
- * "better".
- */
- if (origcmd == DIOCGPART) {
- struct partinfo *pi, *pi_user;
- int labidx;
-
- CTASSERT(sizeof(struct partinfo) <= sizeof(struct disklabel));
-
- pc_ioctl->pm_iocmd = DIOCGPART;
- pc_ioctl->pm_flag = 0;
-
- error = pud_request(dev, pc_ioctl, allocsize, class, type);
- if (error)
- goto out;
-
- pi_user = (struct partinfo *)pc_ioctl->pm_data;
- labidx = pi_user->part - &pi_user->disklab->d_partitions[0];
- /* userspace error, but punish caller, since we have no infra */
- if (labidx >= MAXPARTITIONS) {
- error = E2BIG;
- goto out;
- }
-
- pi = origdata;
- pi->disklab = &dl_partinfo;
- pi->part = &dl_partinfo.d_partitions[labidx];
-
- }
-
out:
kmem_free(pc_ioctl, allocsize);
return error;
Index: src/sys/dev/qbus/rf.c
diff -u src/sys/dev/qbus/rf.c:1.32 src/sys/dev/qbus/rf.c:1.33
--- src/sys/dev/qbus/rf.c:1.32 Sun Apr 26 11:15:20 2015
+++ src/sys/dev/qbus/rf.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rf.c,v 1.32 2015/04/26 15:15:20 mlelstv Exp $ */
+/* $NetBSD: rf.c,v 1.33 2015/12/08 20:36:15 christos Exp $ */
/*
* Copyright (c) 2002 Jochen Kunz.
* All rights reserved.
@@ -36,7 +36,7 @@ TODO:
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.32 2015/04/26 15:15:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.33 2015/12/08 20:36:15 christos Exp $");
/* autoconfig stuff */
#include <sys/param.h>
@@ -1101,7 +1101,7 @@ rfioctl(dev_t dev, u_long cmd, void *dat
return error;
switch (cmd) {
- /* get and set disklabel; DIOCGPART used internally */
+ /* get and set disklabel; DIOCGPARTINFO used internally */
case DIOCSDINFO: /* set */
return(0);
case DIOCWDINFO: /* set, update disk */
Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.325 src/sys/dev/raidframe/rf_netbsdkintf.c:1.326
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.325 Thu Aug 20 10:40:18 2015
+++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.325 2015/08/20 14:40:18 christos Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.326 2015/12/08 20:36:15 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.325 2015/08/20 14:40:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.326 2015/12/08 20:36:15 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1114,7 +1114,7 @@ raidioctl(dev_t dev, u_long cmd, void *d
case ODIOCSDINFO:
case ODIOCGDEFLABEL:
#endif
- case DIOCGPART:
+ case DIOCGPARTINFO:
case DIOCWLABEL:
case DIOCGDEFLABEL:
case DIOCAWEDGE:
Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.476 src/sys/kern/init_main.c:1.477
--- src/sys/kern/init_main.c:1.476 Mon Dec 7 06:38:46 2015
+++ src/sys/kern/init_main.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: init_main.c,v 1.476 2015/12/07 11:38:46 pgoyette Exp $ */
+/* $NetBSD: init_main.c,v 1.477 2015/12/08 20:36:15 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.476 2015/12/07 11:38:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.477 2015/12/08 20:36:15 christos Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -794,7 +794,7 @@ configure3(void)
static void
rootconf_handle_wedges(void)
{
- struct partinfo dpart;
+ struct disklabel label;
struct partition *p;
struct vnode *vp;
daddr_t startblk;
@@ -827,7 +827,7 @@ rootconf_handle_wedges(void)
if (vp == NULL)
return;
- error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, NOCRED);
+ error = VOP_IOCTL(vp, DIOCGDINFO, &label, FREAD, NOCRED);
VOP_CLOSE(vp, FREAD, NOCRED);
vput(vp);
if (error)
@@ -836,7 +836,7 @@ rootconf_handle_wedges(void)
KASSERT(booted_partition >= 0
&& booted_partition < MAXPARTITIONS);
- p = &dpart.disklab->d_partitions[booted_partition];
+ p = &label.d_partitions[booted_partition];
dev = booted_device;
startblk = p->p_offset;
Index: src/sys/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.114 src/sys/kern/subr_disk.c:1.115
--- src/sys/kern/subr_disk.c:1.114 Sat Nov 28 09:36:00 2015
+++ src/sys/kern/subr_disk.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk.c,v 1.114 2015/11/28 14:36:00 mlelstv Exp $ */
+/* $NetBSD: subr_disk.c,v 1.115 2015/12/08 20:36:15 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.114 2015/11/28 14:36:00 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.115 2015/12/08 20:36:15 christos Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -502,7 +502,8 @@ disk_ioctl(struct disk *dk, dev_t dev, u
struct lwp *l)
{
struct dkwedge_info *dkw;
- struct partinfo *pt;
+ struct partinfo *pi;
+ struct partition *dp;
#ifdef __HAVE_OLD_DISKLABEL
struct disklabel newlabel;
#endif
@@ -531,11 +532,15 @@ disk_ioctl(struct disk *dk, dev_t dev, u
/* The following should be moved to dk_ioctl */
switch (cmd) {
case DIOCGDINFO:
+ if (dk->dk_label == NULL)
+ return EBUSY;
memcpy(data, dk->dk_label, sizeof (*dk->dk_label));
return 0;
#ifdef __HAVE_OLD_DISKLABEL
case ODIOCGDINFO:
+ if (dk->dk_label == NULL)
+ return EBUSY;
memcpy(&newlabel, dk->dk_label, sizeof(newlabel));
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
return ENOTTY;
@@ -543,12 +548,46 @@ disk_ioctl(struct disk *dk, dev_t dev, u
return 0;
#endif
- case DIOCGPART:
+ case DIOCGPARTINFO:
+ pi = data;
+ memset(pi, 0, sizeof(*pi));
+ pi->pi_secsize = dk->dk_geom.dg_secsize;
+ pi->pi_bsize = BLKDEV_IOSIZE;
+
+ if (DISKPART(dev) == RAW_PART) {
+ pi->pi_size = dk->dk_geom.dg_secperunit;
+ return 0;
+ }
+
if (dk->dk_label == NULL)
return EBUSY;
- pt = data;
- pt->disklab = dk->dk_label;
- pt->part = &dk->dk_label->d_partitions[DISKPART(dev)];
+
+ dp = &dk->dk_label->d_partitions[DISKPART(dev)];
+ pi->pi_offset = dp->p_offset;
+ pi->pi_size = dp->p_size;
+
+ pi->pi_fstype = dp->p_fstype;
+ pi->pi_frag = dp->p_frag;
+ pi->pi_fsize = dp->p_fsize;
+ pi->pi_cpg = dp->p_cpg;
+
+ /*
+ * dholland 20130616: XXX this logic should not be
+ * here. It is here because the old buffer cache
+ * demands that all accesses to the same blocks need
+ * to be the same size; but it only works for FFS and
+ * nowadays I think it'll fail silently if the size
+ * info in the disklabel is wrong. (Or missing.) The
+ * buffer cache needs to be smarter; or failing that
+ * we need a reliable way here to get the right block
+ * size; or a reliable way to guarantee that (a) the
+ * fs is not mounted when we get here and (b) any
+ * buffers generated here will get purged when the fs
+ * does get mounted.
+ */
+ if (dp->p_fstype == FS_BSDFFS &&
+ dp->p_frag != 0 && dp->p_fsize != 0)
+ pi->pi_bsize = dp->p_frag * dp->p_fsize;
return 0;
case DIOCAWEDGE:
Index: src/sys/kern/subr_disk_open.c
diff -u src/sys/kern/subr_disk_open.c:1.12 src/sys/kern/subr_disk_open.c:1.13
--- src/sys/kern/subr_disk_open.c:1.12 Wed Dec 31 14:50:14 2014
+++ src/sys/kern/subr_disk_open.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk_open.c,v 1.12 2014/12/31 19:50:14 christos Exp $ */
+/* $NetBSD: subr_disk_open.c,v 1.13 2015/12/08 20:36:15 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.12 2014/12/31 19:50:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.13 2015/12/08 20:36:15 christos Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -91,7 +91,7 @@ opendisk(device_t dv)
int
getdisksize(struct vnode *vp, uint64_t *numsecp, unsigned int *secsizep)
{
- struct partinfo dpart;
+ struct partinfo pi;
struct dkwedge_info dkw;
struct disk *pdk;
unsigned int secsize;
@@ -113,10 +113,10 @@ getdisksize(struct vnode *vp, uint64_t *
}
if (error) {
- error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, NOCRED);
+ error = VOP_IOCTL(vp, DIOCGPARTINFO, &pi, FREAD, NOCRED);
if (error == 0) {
- secsize = dpart.disklab->d_secsize;
- numsec = dpart.part->p_size;
+ secsize = pi.pi_secsize;
+ numsec = pi.pi_size;
}
}
@@ -143,14 +143,14 @@ getdisksize(struct vnode *vp, uint64_t *
int
getdiskinfo(struct vnode *vp, struct dkwedge_info *dkw)
{
- struct partinfo dpart;
+ struct partinfo pi;
int error;
dev_t dev = vp->v_specnode->sn_rdev;
if (VOP_IOCTL(vp, DIOCGWEDGEINFO, dkw, FREAD, NOCRED) == 0)
return 0;
- if ((error = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, NOCRED)) != 0)
+ if ((error = VOP_IOCTL(vp, DIOCGPARTINFO, &pi, FREAD, NOCRED)) != 0)
return error;
snprintf(dkw->dkw_devname, sizeof(dkw->dkw_devname), "%s%" PRId32 "%c",
@@ -161,10 +161,9 @@ getdiskinfo(struct vnode *vp, struct dkw
strlcpy(dkw->dkw_parent, dkw->dkw_devname, sizeof(dkw->dkw_parent));
- dkw->dkw_size = dpart.part->p_size;
- dkw->dkw_offset = dpart.part->p_offset;
-
- strlcpy(dkw->dkw_ptype, getfstypename(dpart.part->p_fstype),
+ dkw->dkw_size = pi.pi_size;
+ dkw->dkw_offset = pi.pi_offset;
+ strlcpy(dkw->dkw_ptype, getfstypename(pi.pi_fstype),
sizeof(dkw->dkw_ptype));
return 0;
Index: src/sys/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.156 src/sys/miscfs/specfs/spec_vnops.c:1.157
--- src/sys/miscfs/specfs/spec_vnops.c:1.156 Mon Dec 7 20:57:13 2015
+++ src/sys/miscfs/specfs/spec_vnops.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.156 2015/12/08 01:57:13 christos Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.157 2015/12/08 20:36:15 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.156 2015/12/08 01:57:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.157 2015/12/08 20:36:15 christos Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -502,9 +502,9 @@ spec_open(void *v)
specnode_t *sn;
specdev_t *sd;
spec_ioctl_t ioctl;
- off_t off;
u_int gen;
const char *name;
+ struct partinfo pi;
l = curlwp;
vp = ap->a_vp;
@@ -660,29 +660,9 @@ spec_open(void *v)
ioctl = vp->v_type == VCHR ? cdev_ioctl : bdev_ioctl;
-
- // XXX: DIOCGPART is not 64 bit friendly so we avoid it fot the
- // raw partition
- if (DISKPART(vp->v_rdev) == RAW_PART)
- error = (*ioctl)(vp->v_rdev, DIOCGMEDIASIZE,
- &off, FREAD, curlwp);
- else
- error = EINVAL;
- if (error) {
- struct partinfo pi;
- error = (*ioctl)(vp->v_rdev, DIOCGPART, &pi, FREAD, curlwp);
- if (error == 0) {
- off = (off_t)pi.disklab->d_secsize * pi.part->p_size;
-#ifdef DIAGNOSTIC
- if (pi.disklab->d_secsize == UINT_MAX)
- printf("overflow in DIOCGPART dev=%jx\n",
- (uintmax_t)vp->v_rdev);
-#endif
- }
- }
-
+ error = (*ioctl)(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, curlwp);
if (error == 0)
- uvm_vnp_setsize(vp, (voff_t)off);
+ uvm_vnp_setsize(vp, (voff_t)pi.pi_secsize * pi.pi_size);
return 0;
}
@@ -706,7 +686,7 @@ spec_read(void *v)
struct buf *bp;
daddr_t bn;
int bsize, bscale;
- struct partinfo dpart;
+ struct partinfo pi;
int n, on;
int error = 0;
@@ -732,28 +712,11 @@ spec_read(void *v)
KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
if (uio->uio_offset < 0)
return (EINVAL);
- bsize = BLKDEV_IOSIZE;
- /*
- * dholland 20130616: XXX this logic should not be
- * here. It is here because the old buffer cache
- * demands that all accesses to the same blocks need
- * to be the same size; but it only works for FFS and
- * nowadays I think it'll fail silently if the size
- * info in the disklabel is wrong. (Or missing.) The
- * buffer cache needs to be smarter; or failing that
- * we need a reliable way here to get the right block
- * size; or a reliable way to guarantee that (a) the
- * fs is not mounted when we get here and (b) any
- * buffers generated here will get purged when the fs
- * does get mounted.
- */
- if (bdev_ioctl(vp->v_rdev, DIOCGPART, &dpart, FREAD, l) == 0) {
- if (dpart.part->p_fstype == FS_BSDFFS &&
- dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
- bsize = dpart.part->p_frag *
- dpart.part->p_fsize;
- }
+ if (bdev_ioctl(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, l) == 0)
+ bsize = pi.pi_bsize;
+ else
+ bsize = BLKDEV_IOSIZE;
bscale = bsize >> DEV_BSHIFT;
do {
@@ -795,7 +758,7 @@ spec_write(void *v)
struct buf *bp;
daddr_t bn;
int bsize, bscale;
- struct partinfo dpart;
+ struct partinfo pi;
int n, on;
int error = 0;
@@ -821,13 +784,12 @@ spec_write(void *v)
return (0);
if (uio->uio_offset < 0)
return (EINVAL);
- bsize = BLKDEV_IOSIZE;
- if (bdev_ioctl(vp->v_rdev, DIOCGPART, &dpart, FREAD, l) == 0) {
- if (dpart.part->p_fstype == FS_BSDFFS &&
- dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
- bsize = dpart.part->p_frag *
- dpart.part->p_fsize;
- }
+
+ if (bdev_ioctl(vp->v_rdev, DIOCGPARTINFO, &pi, FREAD, l) == 0)
+ bsize = pi.pi_bsize;
+ else
+ bsize = BLKDEV_IOSIZE;
+
bscale = bsize >> DEV_BSHIFT;
do {
bn = (uio->uio_offset >> DEV_BSHIFT) &~ (bscale - 1);
Index: src/sys/rump/librump/rumpvfs/rumpblk.c
diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.60 src/sys/rump/librump/rumpvfs/rumpblk.c:1.61
--- src/sys/rump/librump/rumpvfs/rumpblk.c:1.60 Tue May 26 12:48:05 2015
+++ src/sys/rump/librump/rumpvfs/rumpblk.c Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpblk.c,v 1.60 2015/05/26 16:48:05 pooka Exp $ */
+/* $NetBSD: rumpblk.c,v 1.61 2015/12/08 20:36:15 christos Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.60 2015/05/26 16:48:05 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.61 2015/12/08 20:36:15 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -421,6 +421,7 @@ rumpblk_ioctl(dev_t dev, u_long xfer, vo
devminor_t dmin = minor(dev);
struct rblkdev *rblk = &minors[dmin];
struct partinfo *pi;
+ struct diskpart *dp;
int error = 0;
/* well, me should support a few more, but we don't for now */
@@ -429,10 +430,17 @@ rumpblk_ioctl(dev_t dev, u_long xfer, vo
*(struct disklabel *)addr = rblk->rblk_label;
break;
- case DIOCGPART:
+ case DIOCGPARTINFO:
+ dp = &rblk->rblk_label.d_partitions[DISKPART(dmin)];
pi = addr;
- pi->part = &rblk->rblk_label.d_partitions[DISKPART(dmin)];
- pi->disklab = &rblk->rblk_label;
+ pi->pi_offset = dp->p_offset;
+ pi->pi_size = dp->p_size;
+ pi->pi_secsize = rblk->rblk_label.d_secsize;
+ pi->pi_bsize = BLKDEV_IOSIZE;
+ pi->pi_fstype = dp->p_fstype;
+ pi->pi_fsize = dp->p_fsize;
+ pi->pi_frag = dp->p_frag;
+ pi->pi_cpg = dp->p_cpg;
break;
/* it's synced enough along the write path */
Index: src/sys/sys/disklabel.h
diff -u src/sys/sys/disklabel.h:1.118 src/sys/sys/disklabel.h:1.119
--- src/sys/sys/disklabel.h:1.118 Fri Jan 2 14:42:07 2015
+++ src/sys/sys/disklabel.h Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.h,v 1.118 2015/01/02 19:42:07 christos Exp $ */
+/* $NetBSD: disklabel.h,v 1.119 2015/12/08 20:36:15 christos Exp $ */
/*
* Copyright (c) 1987, 1988, 1993
@@ -444,8 +444,14 @@ struct format_op {
* on a disk.
*/
struct partinfo {
- struct disklabel *disklab;
- struct partition *part;
+ uint64_t pi_offset;
+ uint64_t pi_size;
+ uint32_t pi_secsize;
+ uint32_t pi_bsize;
+ uint8_t pi_fstype;
+ uint8_t pi_frag;
+ uint16_t pi_cpg;
+ uint32_t pi_fsize;
};
struct disk;
Index: src/sys/sys/dkio.h
diff -u src/sys/sys/dkio.h:1.21 src/sys/sys/dkio.h:1.22
--- src/sys/sys/dkio.h:1.21 Mon Dec 29 13:41:20 2014
+++ src/sys/sys/dkio.h Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dkio.h,v 1.21 2014/12/29 18:41:20 mlelstv Exp $ */
+/* $NetBSD: dkio.h,v 1.22 2015/12/08 20:36:15 christos Exp $ */
/*
* Copyright (c) 1987, 1988, 1993
@@ -38,14 +38,14 @@
/*
* Disk-specific ioctls.
*/
- /* get and set disklabel; DIOCGPART used internally */
+ /* get and set disklabel; DIOCGPARTINFO used internally */
#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
#ifdef _KERNEL
#define DIOCGDINFO32 (DIOCGDINFO - (sizeof(uint32_t) << IOCPARM_SHIFT))
-#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
+#define DIOCGPARTINFO _IOW('d', 104, struct partinfo) /* get partition */
#endif
#if defined(__HAVE_OLD_DISKLABEL) && defined(_KERNEL)
Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.488 src/sys/sys/param.h:1.489
--- src/sys/sys/param.h:1.488 Mon Nov 30 17:47:19 2015
+++ src/sys/sys/param.h Tue Dec 8 15:36:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.488 2015/11/30 22:47:19 pgoyette Exp $ */
+/* $NetBSD: param.h,v 1.489 2015/12/08 20:36:15 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
* 2.99.9 (299000900)
*/
-#define __NetBSD_Version__ 799002300 /* NetBSD 7.99.23 */
+#define __NetBSD_Version__ 799002400 /* NetBSD 7.99.24 */
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)