aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2002-03-19 13:54:15 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2002-03-19 13:54:15 +0000
commit00dcdc8d67215f07b8c43eee8a98a58cb61eed8f (patch)
tree045a98068ab44510351eedb7469fd082579845d3 /sys
parent1fa5ae8f9361fddc36fd4410d54d741fb554bdf3 (diff)
downloadsrc-00dcdc8d67215f07b8c43eee8a98a58cb61eed8f.tar.gz
src-00dcdc8d67215f07b8c43eee8a98a58cb61eed8f.zip
Add five GEOM oriented ioctls to get basic information about a geom device.
Notes
Notes: svn path=/head/; revision=92698
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/geom_dev.c42
-rw-r--r--sys/sys/disklabel.h6
-rw-r--r--sys/sys/diskmbr.h6
-rw-r--r--sys/sys/diskpc98.h6
4 files changed, 49 insertions, 11 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index d0be27acb327..ee851220ac6a 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -248,17 +248,37 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
error = 0;
DROP_GIANT();
- gio = g_malloc(sizeof *gio, M_WAITOK);
- gio->cmd = cmd;
- gio->data = data;
- gio->fflag = fflag;
- gio->td = td;
- i = sizeof *gio;
- if (cmd & IOC_IN)
- error = g_io_setattr("GEOM::ioctl", cp, i, gio, td);
- else
- error = g_io_getattr("GEOM::ioctl", cp, &i, gio, td);
- g_free(gio);
+ i = IOCPARM_LEN(cmd);
+ switch (cmd) {
+ case DIOCGSECTORSIZE:
+ error = g_io_getattr("GEOM::sectorsize", cp, &i, data, td);
+ break;
+ case DIOCGMEDIASIZE:
+ error = g_io_getattr("GEOM::mediasize", cp, &i, data, td);
+ break;
+ case DIOCGFWSECTORS:
+ error = g_io_getattr("GEOM::fwsectors", cp, &i, data, td);
+ break;
+ case DIOCGFWHEADS:
+ error = g_io_getattr("GEOM::fwheads", cp, &i, data, td);
+ break;
+ case DIOCGFWCYLINDERS:
+ error = g_io_getattr("GEOM::fwcylinders", cp, &i, data, td);
+ break;
+ default:
+ gio = g_malloc(sizeof *gio, M_WAITOK);
+ gio->cmd = cmd;
+ gio->data = data;
+ gio->fflag = fflag;
+ gio->td = td;
+ i = sizeof *gio;
+ if (cmd & IOC_IN)
+ error = g_io_setattr("GEOM::ioctl", cp, i, gio, td);
+ else
+ error = g_io_getattr("GEOM::ioctl", cp, &i, gio, td);
+ g_free(gio);
+ break;
+ }
if (error != 0 && cmd == DIOCGDVIRGIN) {
g_topology_lock();
diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h
index a3b927f37441..4cf122392c6a 100644
--- a/sys/sys/disklabel.h
+++ b/sys/sys/disklabel.h
@@ -418,6 +418,12 @@ struct dos_partition {
#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */
+#define DIOCGSECTORSIZE _IOR('d', 128, u_int) /* Get sector size in bytes */
+#define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */
+#define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware sectorcount */
+#define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware headcount */
+#define DIOCGFWCYLINDERS _IOR('d', 132, u_int) /* Get firmware cyl'scount */
+
#ifdef _KERNEL
/*
diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h
index a3b927f37441..4cf122392c6a 100644
--- a/sys/sys/diskmbr.h
+++ b/sys/sys/diskmbr.h
@@ -418,6 +418,12 @@ struct dos_partition {
#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */
+#define DIOCGSECTORSIZE _IOR('d', 128, u_int) /* Get sector size in bytes */
+#define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */
+#define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware sectorcount */
+#define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware headcount */
+#define DIOCGFWCYLINDERS _IOR('d', 132, u_int) /* Get firmware cyl'scount */
+
#ifdef _KERNEL
/*
diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h
index a3b927f37441..4cf122392c6a 100644
--- a/sys/sys/diskpc98.h
+++ b/sys/sys/diskpc98.h
@@ -418,6 +418,12 @@ struct dos_partition {
#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */
+#define DIOCGSECTORSIZE _IOR('d', 128, u_int) /* Get sector size in bytes */
+#define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */
+#define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware sectorcount */
+#define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware headcount */
+#define DIOCGFWCYLINDERS _IOR('d', 132, u_int) /* Get firmware cyl'scount */
+
#ifdef _KERNEL
/*