Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 May 2011 12:48:46 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        emulation@FreeBSD.org
Subject:   pls review: dummy handlers for linux wlan ioctls
Message-ID:  <4DC5157E.2020606@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

The purpose of this code is just to reduce amount of noise produced when some
software uses those ioctls (e.g. newer Skype).  All ioctls return ENOTSUP.


    linux emu: add dummy handler for ioctls related to wireless interfaces

diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 63f6888..7d90402 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -110,6 +110,7 @@ static linux_ioctl_function_t linux_ioctl_v4l;
 static linux_ioctl_function_t linux_ioctl_v4l2;
 static linux_ioctl_function_t linux_ioctl_special;
 static linux_ioctl_function_t linux_ioctl_fbsd_usb;
+static linux_ioctl_function_t linux_ioctl_wlan;

 static struct linux_ioctl_handler cdrom_handler =
 { linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX };
@@ -139,6 +140,8 @@ static struct linux_ioctl_handler video2_handler =
 { linux_ioctl_v4l2, LINUX_IOCTL_VIDEO2_MIN, LINUX_IOCTL_VIDEO2_MAX };
 static struct linux_ioctl_handler fbsd_usb =
 { linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX };
+static struct linux_ioctl_handler wlan_handler =
+{ linux_ioctl_wlan, LINUX_IOCTL_WLAN_MIN, LINUX_IOCTL_WLAN_MAX };

 DATA_SET(linux_ioctl_handler_set, cdrom_handler);
 DATA_SET(linux_ioctl_handler_set, vfat_handler);
@@ -154,6 +157,7 @@ DATA_SET(linux_ioctl_handler_set, sg_handler);
 DATA_SET(linux_ioctl_handler_set, video_handler);
 DATA_SET(linux_ioctl_handler_set, video2_handler);
 DATA_SET(linux_ioctl_handler_set, fbsd_usb);
+DATA_SET(linux_ioctl_handler_set, wlan_handler);

 struct handler_element
 {
@@ -2598,6 +2602,24 @@ linux_ioctl_private(struct thread *td, struct
linux_ioctl_args *args)
 }

 /*
+ * Wireless interface ioctl handler
+ */
+static int
+linux_ioctl_wlan(struct thread *td, struct linux_ioctl_args *args)
+{
+	struct file *fp;
+	int error, type;
+
+	if ((error = fget(td, args->fd, &fp)) != 0)
+		return (error);
+	type = fp->f_type;
+	fdrop(fp, td);
+	if (type == DTYPE_SOCKET)
+		return (ENOTSUP);
+	return (ENOIOCTL);
+}
+
+/*
  * DRM ioctl handler (sys/dev/drm)
  */
 static int
diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h
index a7ecbab..24b8d88f 100644
--- a/sys/compat/linux/linux_ioctl.h
+++ b/sys/compat/linux/linux_ioctl.h
@@ -257,6 +257,13 @@
 #define LINUX_IOCTL_PRIVATE_MAX	LINUX_SIOCDEVPRIVATE+0xf

 /*
+ * Wireless interfaces ioctl calls
+ */
+#define	SIOCGIWNAME		0x8b01
+#define	LINUX_IOCTL_WLAN_MIN	0x8b00
+#define	LINUX_IOCTL_WLAN_MAX	0x8bff
+
+/*
  * sound
  */
 #define	LINUX_SOUND_MIXER_WRITE_VOLUME	0x4d00

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DC5157E.2020606>