Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Mention which ioctls need to move to dk_ioctl, and ...
details: https://anonhg.NetBSD.org/src/rev/e50923161b56
branches: trunk
changeset: 805399:e50923161b56
user: christos <christos%NetBSD.org@localhost>
date: Wed Dec 31 19:58:59 2014 +0000
description:
Mention which ioctls need to move to dk_ioctl, and don't allow wedges on
wedges.
diffstat:
sys/kern/subr_disk.c | 46 ++++++++++++++++++++++++----------------------
1 files changed, 24 insertions(+), 22 deletions(-)
diffs (87 lines):
diff -r b93508e1ae8b -r e50923161b56 sys/kern/subr_disk.c
--- a/sys/kern/subr_disk.c Wed Dec 31 19:52:04 2014 +0000
+++ b/sys/kern/subr_disk.c Wed Dec 31 19:58:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk.c,v 1.108 2014/12/31 19:52:06 christos Exp $ */
+/* $NetBSD: subr_disk.c,v 1.109 2014/12/31 19:58:59 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.108 2014/12/31 19:52:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.109 2014/12/31 19:58:59 christos Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -498,16 +498,34 @@
#endif
switch (cmd) {
+ case DIOCGDISKINFO:
+ if (dk->dk_info == NULL)
+ return ENOTSUP;
+ return prop_dictionary_copyout_ioctl(data, cmd, dk->dk_info);
+
+ case DIOCGSECTORSIZE:
+ *(u_int *)data = dk->dk_geom.dg_secsize;
+ return 0;
+
+ case DIOCGMEDIASIZE:
+ *(off_t *)data = (off_t)dk->dk_geom.dg_secsize *
+ dk->dk_geom.dg_secperunit;
+ return 0;
+ default:
+ break;
+ }
+
+ if (dev == 0)
+ return EPASSTHROUGH;
+
+ /* The following should be moved to dk_ioctl */
+ switch (cmd) {
case DIOCGDINFO:
- if (dev == 0)
- return EPASSTHROUGH;
memcpy(data, dk->dk_label, sizeof (*dk->dk_label));
return 0;
#ifdef __HAVE_OLD_DISKLABEL
case ODIOCGDINFO:
- if (dev == 0)
- return EPASSTHROUGH;
memcpy(&newlabel, dk->dk_label, sizeof(newlabel));
if (newlabel.d_npartitions > OLDMAXPARTITIONS)
return ENOTTY;
@@ -516,8 +534,6 @@
#endif
case DIOCGPART:
- if (dev == 0)
- return EPASSTHROUGH;
pt = data;
pt->disklab = dk->dk_label;
pt->part = &dk->dk_label->d_partitions[DISKPART(dev)];
@@ -549,20 +565,6 @@
dkwedge_discover(dk);
return 0;
- case DIOCGDISKINFO:
- if (dk->dk_info == NULL)
- return ENOTSUP;
- return prop_dictionary_copyout_ioctl(data, cmd, dk->dk_info);
-
- case DIOCGSECTORSIZE:
- *(u_int *)data = dk->dk_geom.dg_secsize;
- return 0;
-
- case DIOCGMEDIASIZE:
- *(off_t *)data = (off_t)dk->dk_geom.dg_secsize *
- dk->dk_geom.dg_secperunit;
- return 0;
-
default:
return EPASSTHROUGH;
}
Home |
Main Index |
Thread Index |
Old Index