Add five GEOM oriented ioctls to get basic information about a geom device.

This commit is contained in:
Poul-Henning Kamp 2002-03-19 13:54:15 +00:00
parent 1fa5ae8f93
commit 00dcdc8d67
4 changed files with 49 additions and 11 deletions

View file

@ -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();

View file

@ -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
/*

View file

@ -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
/*

View file

@ -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
/*