aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
diff options
context:
space:
mode:
authorNick Sayer <nsayer@FreeBSD.org>2000-03-09 15:14:14 +0000
committerNick Sayer <nsayer@FreeBSD.org>2000-03-09 15:14:14 +0000
commit9deb82d47809d519894e99fb384188ccb3280215 (patch)
tree5e1f3fb644def10c96e302fdf68d570a371f1d59 /sys/compat/linux/linux_ioctl.c
parenta9a948a9bb0d1f95149344216ee9d79f685a3b95 (diff)
downloadsrc-9deb82d47809d519894e99fb384188ccb3280215.tar.gz
src-9deb82d47809d519894e99fb384188ccb3280215.zip
Implement Linux BLKGETSIZE ioctl, and open the door to implementing
other BLK.* ioctls should the desire arize. Approved by: jkh (via dufault)
Notes
Notes: svn path=/head/; revision=57858
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r--sys/compat/linux/linux_ioctl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index a4747c686861..cd532e601099 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -46,6 +46,7 @@
#include <net/if_types.h>
#include <sys/sockio.h>
#include <sys/soundcard.h>
+#include <sys/disklabel.h>
#include <machine/console.h>
@@ -55,12 +56,15 @@
#include <i386/linux/linux_proto.h>
#include <i386/linux/linux_util.h>
+static linux_ioctl_function_t linux_ioctl_disk;
static linux_ioctl_function_t linux_ioctl_cdrom;
static linux_ioctl_function_t linux_ioctl_console;
static linux_ioctl_function_t linux_ioctl_socket;
static linux_ioctl_function_t linux_ioctl_sound;
static linux_ioctl_function_t linux_ioctl_termio;
+static struct linux_ioctl_handler disk_handler =
+{ linux_ioctl_disk, LINUX_IOCTL_DISK_MIN, LINUX_IOCTL_DISK_MAX };
static struct linux_ioctl_handler cdrom_handler =
{ linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX };
static struct linux_ioctl_handler console_handler =
@@ -72,6 +76,7 @@ static struct linux_ioctl_handler sound_handler =
static struct linux_ioctl_handler termio_handler =
{ linux_ioctl_termio, LINUX_IOCTL_TERMIO_MIN, LINUX_IOCTL_TERMIO_MAX };
+DATA_SET(linux_ioctl_handler_set, disk_handler);
DATA_SET(linux_ioctl_handler_set, cdrom_handler);
DATA_SET(linux_ioctl_handler_set, console_handler);
DATA_SET(linux_ioctl_handler_set, socket_handler);
@@ -88,6 +93,24 @@ struct handler_element
static TAILQ_HEAD(, handler_element) handlers =
TAILQ_HEAD_INITIALIZER(handlers);
+static int
+linux_ioctl_disk(struct proc *p, struct linux_ioctl_args *args)
+{
+ struct file *fp = p->p_fd->fd_ofiles[args->fd];
+ int error;
+ struct disklabel dl;
+
+ switch (args->cmd & 0xffff) {
+ case LINUX_BLKGETSIZE:
+ error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, p);
+ if (error)
+ return (error);
+ return copyout(&(dl.d_secperunit), (caddr_t)args->arg, sizeof(dl.d_secperunit));
+ break;
+ }
+ return (ENOIOCTL);
+}
+
/*
* termio related ioctls
*/