Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Replace DIOCGPART -> DIOCGPARTINFO which returns the dat...
details: https://anonhg.NetBSD.org/src/rev/4db90b98ad8f
branches: trunk
changeset: 342142:4db90b98ad8f
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 08 20:36:14 2015 +0000
description:
Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
diffstat:
sys/arch/atari/dev/hdfd.c | 6 +-
sys/compat/linux/arch/i386/linux_machdep.c | 6 +-
sys/compat/linux/common/linux_blkio.c | 14 ++--
sys/compat/linux/common/linux_hdio.c | 34 ++++++-------
sys/compat/netbsd32/netbsd32_ioctl.c | 22 +--------
sys/compat/netbsd32/netbsd32_ioctl.h | 9 +---
sys/compat/sunos/sunos_ioctl.c | 16 ++++--
sys/compat/sunos32/sunos32_ioctl.c | 29 +++++++-----
sys/dev/ccd.c | 6 +-
sys/dev/dksubr.c | 6 +-
sys/dev/isa/fd.c | 6 +-
sys/dev/pud/pud_dev.c | 60 +------------------------
sys/dev/qbus/rf.c | 6 +-
sys/dev/raidframe/rf_netbsdkintf.c | 6 +-
sys/dev/vnd.c | 6 +-
sys/kern/init_main.c | 10 ++--
sys/kern/subr_disk.c | 53 +++++++++++++++++++--
sys/kern/subr_disk_open.c | 23 ++++-----
sys/miscfs/specfs/spec_vnops.c | 72 +++++++----------------------
sys/rump/librump/rumpvfs/rumpblk.c | 18 +++++--
sys/sys/disklabel.h | 12 +++-
sys/sys/dkio.h | 6 +-
sys/sys/param.h | 4 +-
23 files changed, 185 insertions(+), 245 deletions(-)
diffs (truncated from 1083 to 300 lines):
diff -r 04320fddb42a -r 4db90b98ad8f sys/arch/atari/dev/hdfd.c
--- a/sys/arch/atari/dev/hdfd.c Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/arch/atari/dev/hdfd.c Tue Dec 08 20:36:14 2015 +0000
@@ -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 @@
switch (cmd) {
case DIOCGDINFO:
- case DIOCGPART:
+ case DIOCGPARTINFO:
fdgetdisklabel(fd, dev);
break;
}
diff -r 04320fddb42a -r 4db90b98ad8f sys/compat/linux/arch/i386/linux_machdep.c
--- a/sys/compat/linux/arch/i386/linux_machdep.c Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/compat/linux/arch/i386/linux_machdep.c Tue Dec 08 20:36:14 2015 +0000
@@ -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 @@
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;
diff -r 04320fddb42a -r 4db90b98ad8f sys/compat/linux/common/linux_blkio.c
--- a/sys/compat/linux/common/linux_blkio.c Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/compat/linux/common/linux_blkio.c Tue Dec 08 20:36:14 2015 +0000
@@ -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 @@
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 @@
* 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),
diff -r 04320fddb42a -r 4db90b98ad8f sys/compat/linux/common/linux_hdio.c
--- a/sys/compat/linux/common/linux_hdio.c Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/compat/linux/common/linux_hdio.c Tue Dec 08 20:36:14 2015 +0000
@@ -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 @@
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 @@
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 @@
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:
diff -r 04320fddb42a -r 4db90b98ad8f sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Tue Dec 08 20:36:14 2015 +0000
@@ -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 @@
/* 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 @@
* 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 @@
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);
diff -r 04320fddb42a -r 4db90b98ad8f sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h Tue Dec 08 20:36:14 2015 +0000
@@ -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 {
diff -r 04320fddb42a -r 4db90b98ad8f sys/compat/sunos/sunos_ioctl.c
--- a/sys/compat/sunos/sunos_ioctl.c Tue Dec 08 16:53:27 2015 +0000
+++ b/sys/compat/sunos/sunos_ioctl.c Tue Dec 08 20:36:14 2015 +0000
@@ -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 @@
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 @@
error = ERANGE; /* XXX */
break;
}
- if (pi.part->p_offset % pi.disklab->d_secpercyl != 0) {
+ if (pi.pi_offset % label.d_secpercyl != 0) {
Home |
Main Index |
Thread Index |
Old Index