On Sünnavend 05 November 2005 00:51, Christoph Hellwig wrote:
>
On Sat, Nov 05, 2005 at 12:10:46AM +0100, Arnd Bergmann wrote:
>
>
>
> BTW, I now have a set of 25 patches that moves all handlers from
>
> fs/compat_ioctl.c over to the respective drivers and subsystems,
>
> but I'm not sure how to best test that.
>
> I intend to at least give it a test run on my Opteron for the whatever
>
> ioctls I normally use, but the rest is just guesswork. Christoph,
>
> can you review those patches?
>
>
I'm not sure moving everything from fs/compat_ioctl.c is a good idea.
>
Everything that is just in a single driver or subsystem that has
>
common ioctl code - sure. else it doesn't make a lot of sense.
Ok, here is my full set of patches, let's see which ones are
sensible and which ones we are better off without.
Getting rid of fs/compat_ioctl.c completely could at least simplify
the compat_sys_ioctl() code a bit and would also make sure that
we only build the handlers into the kernel that can be used
potentially, which reduces the binary size.
The patch set is still largely untested, except for a single
compile test, but at least some of the patches are very simple,
so maybe I can get a quick ack or nack on them.
In general, I'm just moving over the handlers to the respective
subsystem without changing the logic, so the patch should not
have any effect on the ioctl operation itself, but it also
means that the handlers still use compat_alloc_user_space
or get_fs/set_fs when it's not really necessary.
Arnd <><
drivers/block/ioctl.c | 549 +++++
drivers/block/loop.c | 76
drivers/block/paride/pcd.c | 1
drivers/block/paride/pd.c | 1
drivers/block/paride/pt.c | 1
drivers/block/pktcdvd.c | 20
drivers/bluetooth/hci_ldisc.c | 22
drivers/cdrom/Makefile | 2
drivers/cdrom/aztcd.c | 1
drivers/cdrom/cdu31a.c | 1
drivers/cdrom/cm206.c | 1
drivers/cdrom/compat.c | 163 +
drivers/cdrom/gscd.c | 1
drivers/cdrom/mcdx.c | 1
drivers/cdrom/optcd.c | 1
drivers/cdrom/sbpcd.c | 1
drivers/cdrom/sjcd.c | 1
drivers/cdrom/sonycd535.c | 2
drivers/char/Makefile | 1
drivers/char/compat_mtio.c | 81
drivers/char/ftape/zftape/zftape-init.c | 1
drivers/char/n_tty.c | 1
drivers/char/raw.c | 91
drivers/char/tty_io.c | 191 +
drivers/char/viotape.c | 1
drivers/char/vt.c | 3
drivers/char/vt_ioctl.c | 195 +
drivers/i2c/i2c-dev.c | 141 +
drivers/ide/ide-cd.c | 1
drivers/ide/ide-floppy.c | 1
drivers/ide/ide-tape.c | 1
drivers/media/radio/miropcm20-radio.c | 1
drivers/media/radio/radio-aimslab.c | 1
drivers/media/radio/radio-aztech.c | 1
drivers/media/radio/radio-cadet.c | 1
drivers/media/radio/radio-gemtek-pci.c | 1
drivers/media/radio/radio-gemtek.c | 1
drivers/media/radio/radio-maestro.c | 1
drivers/media/radio/radio-maxiradio.c | 1
drivers/media/radio/radio-rtrack2.c | 1
drivers/media/radio/radio-sf16fmi.c | 1
drivers/media/radio/radio-sf16fmr2.c | 1
drivers/media/radio/radio-terratec.c | 1
drivers/media/radio/radio-trust.c | 1
drivers/media/radio/radio-typhoon.c | 1
drivers/media/radio/radio-zoltrix.c | 1
drivers/media/video/Makefile | 2
drivers/media/video/arv.c | 1
drivers/media/video/bttv-driver.c | 1
drivers/media/video/bw-qcam.c | 1
drivers/media/video/c-qcam.c | 1
drivers/media/video/compat_ioctl.c | 318 +++
drivers/media/video/cpia.c | 1
drivers/media/video/cx88/cx88-video.c | 2
drivers/media/video/meye.c | 1
drivers/media/video/pms.c | 1
drivers/media/video/saa5249.c | 1
drivers/media/video/saa7134/saa7134-video.c | 2
drivers/media/video/stradis.c | 1
drivers/media/video/w9966.c | 1
drivers/media/video/zoran_driver.c | 1
drivers/media/video/zr36120.c | 1
drivers/mtd/mtdchar.c | 94
drivers/net/ppp_generic.c | 179 +
drivers/s390/char/tape_char.c | 1
drivers/scsi/osst.c | 2
drivers/scsi/sg.c | 154 +
drivers/scsi/sr.c | 1
drivers/scsi/st.c | 2
drivers/usb/core/devio.c | 139 +
drivers/usb/media/dsbr100.c | 1
drivers/usb/media/ov511.c | 1
drivers/usb/media/pwc/pwc-if.c | 1
drivers/usb/media/se401.c | 1
drivers/usb/media/stv680.c | 1
drivers/usb/media/usbvideo.c | 1
drivers/usb/media/vicam.c | 1
drivers/usb/media/w9968cf.c | 1
drivers/video/fbmem.c | 147 +
fs/autofs/root.c | 35
fs/autofs4/root.c | 41
fs/block_dev.c | 10
fs/cifs/cifsfs.c | 10
fs/cifs/cifsfs.h | 2
fs/cifs/ioctl.c | 29
fs/compat.c | 27
fs/compat_ioctl.c | 2918 ----------------------------
fs/ext2/dir.c | 3
fs/ext2/ext2.h | 1
fs/ext2/file.c | 6
fs/ext2/ioctl.c | 31
fs/ext3/dir.c | 3
fs/ext3/file.c | 3
fs/ext3/ioctl.c | 66
fs/fat/dir.c | 54
fs/hfsplus/dir.c | 4
fs/hfsplus/hfsplus_fs.h | 4
fs/hfsplus/inode.c | 4
fs/hfsplus/ioctl.c | 29
fs/ncpfs/dir.c | 3
fs/ncpfs/file.c | 4
fs/ncpfs/ioctl.c | 241 ++
fs/reiserfs/dir.c | 3
fs/reiserfs/file.c | 4
fs/reiserfs/ioctl.c | 36
fs/smbfs/dir.c | 4
fs/smbfs/file.c | 4
fs/smbfs/ioctl.c | 16
fs/smbfs/proto.h | 1
fs/xfs/linux-2.6/xfs_ioctl32.c | 15
include/linux/cdrom.h | 2
include/linux/compat_ioctl.h | 387 ---
include/linux/ext2_fs.h | 7
include/linux/ext3_fs.h | 1
include/linux/fs.h | 3
include/linux/ioctl32.h | 2
include/linux/mtio.h | 12
include/linux/ncp_fs.h | 1
include/linux/net.h | 2
include/linux/reiserfs_fs.h | 9
include/linux/socket.h | 4
include/linux/tty.h | 2
include/linux/tty_driver.h | 4
include/linux/tty_ldisc.h | 2
include/linux/videodev.h | 2
include/net/sock.h | 9
net/atm/common.h | 1
net/atm/ioctl.c | 167 +
net/atm/pvc.c | 3
net/atm/svc.c | 3
net/bluetooth/bnep/sock.c | 1
net/bluetooth/cmtp/sock.c | 1
net/bluetooth/hci_sock.c | 1
net/bluetooth/hidp/sock.c | 1
net/bluetooth/rfcomm/sock.c | 1
net/compat.c | 1456 +++++++++----
net/socket.c | 7
137 files changed, 4527 insertions(+), 3807 deletions(-)
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: pmac serial_pci_guess_board problem
> That's the expected size of the ports. Remember this is a heuristic
> for finding the correct details of the ports. Some cards seem to
> have regions of 16 bytes which aren't serial ports.
>
> I'm _very_ nervous about changing this, especially as it pre-dates
> my time and you seem to imply that it's an OF problem. Can't it be
> fixed up in a PCI quirk?
Could be yes. a ppc64 specific one that re-do the BAR sizing... I wonder
what's up with OF tho ... Maybe Apple's OF can't assign BARs smaller
than 16 bytes ?
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Next Message by Date:
click to view message preview
[PATCH 22/25] serial: move ioctl32 code to tty_io.c
All driver implementing TIOCGSERIAL are tty drivers, so
the conversion handler can be part of tty_compat_ioctl.
In a perfect world, this would live in serial_core.c, but
there are still a number of drivers that are not moved
over to use that yet. If it were in serial_core, it
could also live without the get_fs/set_fs hacks.
CC: rmk+serial@xxxxxxxxxxxxxxxx
CC: linux-serial@xxxxxxxxxxxxxxx
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Index: linux-cg/drivers/char/tty_io.c
===================================================================
--- linux-cg.orig/drivers/char/tty_io.c 2005-11-05 14:22:34.000000000 +0100
+++ linux-cg/drivers/char/tty_io.c 2005-11-05 15:42:22.000000000 +0100
@@ -104,7 +104,6 @@
#include <linux/vt_kern.h>
#include <linux/selection.h>
#include <linux/devfs_fs_kernel.h>
-
#include <linux/kmod.h>
#undef TTY_DEBUG_HANGUP
@@ -153,7 +152,7 @@
static int tty_release(struct inode *, struct file *);
int tty_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg);
-long tty_compat_ioctl(struct file * file, unsigned int cmd, unsigned long arg);
+static long tty_compat_ioctl(struct file * file, unsigned int cmd, unsigned
long arg);
static int tty_fasync(int fd, struct file * filp, int on);
static void release_mem(struct tty_struct *tty, int idx);
@@ -2437,7 +2436,75 @@
#ifdef CONFIG_COMPAT
-long tty_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+#include <linux/serial.h>
+
+struct serial_struct32 {
+ compat_int_t type;
+ compat_int_t line;
+ compat_uint_t port;
+ compat_int_t irq;
+ compat_int_t flags;
+ compat_int_t xmit_fifo_size;
+ compat_int_t custom_divisor;
+ compat_int_t baud_base;
+ unsigned short close_delay;
+ char io_type;
+ char reserved_char[1];
+ compat_int_t hub6;
+ unsigned short closing_wait; /* time to wait before closing */
+ unsigned short closing_wait2; /* no longer used... */
+ compat_uint_t iomem_base;
+ unsigned short iomem_reg_shift;
+ unsigned int port_high;
+ /* compat_ulong_t iomap_base FIXME */
+ compat_int_t reserved[1];
+};
+
+static int serial_struct_ioctl(struct inode *inode, struct file *file,
+ unsigned cmd, unsigned long arg)
+{
+ typedef struct serial_struct SS;
+ typedef struct serial_struct32 SS32;
+ struct serial_struct32 __user *ss32 = compat_ptr(arg);
+ int err;
+ struct serial_struct ss;
+ mm_segment_t oldseg = get_fs();
+ __u32 udata;
+
+ if (cmd == TIOCSSERIAL) {
+ if (!access_ok(VERIFY_READ, ss32, sizeof(SS32)))
+ return -EFAULT;
+ if (__copy_from_user
+ (&ss, ss32, offsetof(SS32, iomem_base)))
+ return -EFAULT;
+ __get_user(udata, &ss32->iomem_base);
+ ss.iomem_base = compat_ptr(udata);
+ __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
+ __get_user(ss.port_high, &ss32->port_high);
+ ss.iomap_base = 0UL;
+ }
+ set_fs(KERNEL_DS);
+ lock_kernel();
+ err = tty_ioctl(inode, file, cmd, (unsigned long) (&ss));
+ unlock_kernel();
+ set_fs(oldseg);
+ if (cmd == TIOCGSERIAL && err >= 0) {
+ if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32)))
+ return -EFAULT;
+ if (__copy_to_user(ss32, &ss, offsetof(SS32, iomem_base)))
+ return -EFAULT;
+ __put_user((unsigned long) ss.iomem_base >> 32 ?
+ 0xffffffff : (unsigned) (unsigned long) ss.
+ iomem_base, &ss32->iomem_base);
+ __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
+ __put_user(ss.port_high, &ss32->port_high);
+
+ }
+ return err;
+}
+
+static long tty_compat_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
struct tty_struct *tty;
@@ -2499,6 +2566,14 @@
/* enter the native code path for those numbers known
* to be compatible */
switch (cmd) {
+ case TIOCGSERIAL:
+ case TIOCSSERIAL:
+ ret = serial_struct_ioctl(inode, file, cmd, arg);
+ break;
+#ifdef TIOCGLTC
+ case TIOCGLTC:
+ case TIOCSLTC:
+#endif
case TCFLSH:
case TCGETA:
case TCGETS:
Index: linux-cg/fs/compat_ioctl.c
===================================================================
--- linux-cg.orig/fs/compat_ioctl.c 2005-11-05 14:47:57.000000000 +0100
+++ linux-cg/fs/compat_ioctl.c 2005-11-05 15:46:46.000000000 +0100
@@ -356,67 +356,6 @@
#define HIDPGETCONNLIST _IOR('H', 210, int)
#define HIDPGETCONNINFO _IOR('H', 211, int)
-struct serial_struct32 {
- compat_int_t type;
- compat_int_t line;
- compat_uint_t port;
- compat_int_t irq;
- compat_int_t flags;
- compat_int_t xmit_fifo_size;
- compat_int_t custom_divisor;
- compat_int_t baud_base;
- unsigned short close_delay;
- char io_type;
- char reserved_char[1];
- compat_int_t hub6;
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short closing_wait2; /* no longer used... */
- compat_uint_t iomem_base;
- unsigned short iomem_reg_shift;
- unsigned int port_high;
- /* compat_ulong_t iomap_base FIXME */
- compat_int_t reserved[1];
-};
-
-static int serial_struct_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
-{
- typedef struct serial_struct SS;
- typedef struct serial_struct32 SS32;
- struct serial_struct32 __user *ss32 = compat_ptr(arg);
- int err;
- struct serial_struct ss;
- mm_segment_t oldseg = get_fs();
- __u32 udata;
-
- if (cmd == TIOCSSERIAL) {
- if (!access_ok(VERIFY_READ, ss32, sizeof(SS32)))
- return -EFAULT;
- if (__copy_from_user(&ss, ss32, offsetof(SS32, iomem_base)))
- return -EFAULT;
- __get_user(udata, &ss32->iomem_base);
- ss.iomem_base = compat_ptr(udata);
- __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
- __get_user(ss.port_high, &ss32->port_high);
- ss.iomap_base = 0UL;
- }
- set_fs(KERNEL_DS);
- err = sys_ioctl(fd,cmd,(unsigned long)(&ss));
- set_fs(oldseg);
- if (cmd == TIOCGSERIAL && err >= 0) {
- if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32)))
- return -EFAULT;
- if (__copy_to_user(ss32,&ss,offsetof(SS32,iomem_base)))
- return -EFAULT;
- __put_user((unsigned long)ss.iomem_base >> 32 ?
- 0xffffffff : (unsigned)(unsigned
long)ss.iomem_base,
- &ss32->iomem_base);
- __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
- __put_user(ss.port_high, &ss32->port_high);
-
- }
- return err;
-}
-
#undef CODE
#endif
@@ -425,13 +364,5 @@
HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans)
HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans)
HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans)
-/* Serial */
-HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl)
-HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
-#ifdef TIOCGLTC
-COMPATIBLE_IOCTL(TIOCGLTC)
-COMPATIBLE_IOCTL(TIOCSLTC)
-#endif
-
#undef DECLARES
#endif
--
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Previous Message by Thread:
click to view message preview
pmac serial_pci_guess_board problem
Russell,
I found that the serial port probe code in drivers/serial/8250_pci.c
no longer works properly for PowerMac G5 in 2.6.14. It seems some new
code now takes the PCI device info directly from the G5's Open
Firmware. The trouble is that OF sets the address length to 16 bytes,
not the expected 8 bytes.
Here's a fix, but I'd be interested to hear your comments.
-Geoff
Index: linux-2.6.14/drivers/serial/8250_pci.c
===================================================================
--- linux-2.6.14.orig/drivers/serial/8250_pci.c 2005-11-04 11:41:09.000000000
-0800
+++ linux-2.6.14/drivers/serial/8250_pci.c 2005-11-04 11:44:21.000000000
-0800
@@ -1478,7 +1478,11 @@
num_port = 0;
for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
+#if defined(CONFIG_PPC_PMAC64)
+ pci_resource_len(dev, i) == 16 &&
+#else
pci_resource_len(dev, i) == 8 &&
+#endif
(first_port == -1 || (first_port + num_port) == i)) {
num_port++;
if (first_port == -1)
-------- Original Message --------
Subject: Re: pci_resource_end() changed problem with 2.6.14
Date: Fri, 04 Nov 2005 17:56:09 +1100
From: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
To: Geoff Levand <geoffrey.levand@xxxxxxxxxxx>
CC: linuxppc64-dev@xxxxxxxxxx
References: <436ADBA7.7030706@xxxxxxxxxxx>
On Thu, 2005-11-03 at 19:55 -0800, Geoff Levand wrote:
> I found that the serial port probe code in drivers/serial/8250_pci.c
> no longer works properly for ppc64 in 2.6.14. It seems the value
> returned by pci_resource_len() on ppc64 changed from 8 to 16 since
> 2.6.13. I tested on a PC and pci_resource_len() returns 8 as
> expected.
>
> Any help on on where to look for the problem would be appreciated.
>
> Here's the code that hits the problem:
>
> if (pci_resource_flags(dev, i) & IORESOURCE_IO &&
> pci_resource_len(dev, i) == 8 &&
>
> And here are some test results:
Interesting... What does an lspci -vv shows for the BARs of the PCI
card ? Also, what do you have in /proc/device-tree ? What is the
machine precisely ?
2.6.14 now uses the OF device-tree to generate the linux PCI tree
instead of going directly to PCI probing. It's possible that this is
causing your problem if for some reason, the BAR sizing done by OF ends
up being different than what the kernel does ...
Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Next Message by Thread:
click to view message preview
[PATCH 22/25] serial: move ioctl32 code to tty_io.c
All driver implementing TIOCGSERIAL are tty drivers, so
the conversion handler can be part of tty_compat_ioctl.
In a perfect world, this would live in serial_core.c, but
there are still a number of drivers that are not moved
over to use that yet. If it were in serial_core, it
could also live without the get_fs/set_fs hacks.
CC: rmk+serial@xxxxxxxxxxxxxxxx
CC: linux-serial@xxxxxxxxxxxxxxx
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Index: linux-cg/drivers/char/tty_io.c
===================================================================
--- linux-cg.orig/drivers/char/tty_io.c 2005-11-05 14:22:34.000000000 +0100
+++ linux-cg/drivers/char/tty_io.c 2005-11-05 15:42:22.000000000 +0100
@@ -104,7 +104,6 @@
#include <linux/vt_kern.h>
#include <linux/selection.h>
#include <linux/devfs_fs_kernel.h>
-
#include <linux/kmod.h>
#undef TTY_DEBUG_HANGUP
@@ -153,7 +152,7 @@
static int tty_release(struct inode *, struct file *);
int tty_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg);
-long tty_compat_ioctl(struct file * file, unsigned int cmd, unsigned long arg);
+static long tty_compat_ioctl(struct file * file, unsigned int cmd, unsigned
long arg);
static int tty_fasync(int fd, struct file * filp, int on);
static void release_mem(struct tty_struct *tty, int idx);
@@ -2437,7 +2436,75 @@
#ifdef CONFIG_COMPAT
-long tty_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+#include <linux/serial.h>
+
+struct serial_struct32 {
+ compat_int_t type;
+ compat_int_t line;
+ compat_uint_t port;
+ compat_int_t irq;
+ compat_int_t flags;
+ compat_int_t xmit_fifo_size;
+ compat_int_t custom_divisor;
+ compat_int_t baud_base;
+ unsigned short close_delay;
+ char io_type;
+ char reserved_char[1];
+ compat_int_t hub6;
+ unsigned short closing_wait; /* time to wait before closing */
+ unsigned short closing_wait2; /* no longer used... */
+ compat_uint_t iomem_base;
+ unsigned short iomem_reg_shift;
+ unsigned int port_high;
+ /* compat_ulong_t iomap_base FIXME */
+ compat_int_t reserved[1];
+};
+
+static int serial_struct_ioctl(struct inode *inode, struct file *file,
+ unsigned cmd, unsigned long arg)
+{
+ typedef struct serial_struct SS;
+ typedef struct serial_struct32 SS32;
+ struct serial_struct32 __user *ss32 = compat_ptr(arg);
+ int err;
+ struct serial_struct ss;
+ mm_segment_t oldseg = get_fs();
+ __u32 udata;
+
+ if (cmd == TIOCSSERIAL) {
+ if (!access_ok(VERIFY_READ, ss32, sizeof(SS32)))
+ return -EFAULT;
+ if (__copy_from_user
+ (&ss, ss32, offsetof(SS32, iomem_base)))
+ return -EFAULT;
+ __get_user(udata, &ss32->iomem_base);
+ ss.iomem_base = compat_ptr(udata);
+ __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
+ __get_user(ss.port_high, &ss32->port_high);
+ ss.iomap_base = 0UL;
+ }
+ set_fs(KERNEL_DS);
+ lock_kernel();
+ err = tty_ioctl(inode, file, cmd, (unsigned long) (&ss));
+ unlock_kernel();
+ set_fs(oldseg);
+ if (cmd == TIOCGSERIAL && err >= 0) {
+ if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32)))
+ return -EFAULT;
+ if (__copy_to_user(ss32, &ss, offsetof(SS32, iomem_base)))
+ return -EFAULT;
+ __put_user((unsigned long) ss.iomem_base >> 32 ?
+ 0xffffffff : (unsigned) (unsigned long) ss.
+ iomem_base, &ss32->iomem_base);
+ __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
+ __put_user(ss.port_high, &ss32->port_high);
+
+ }
+ return err;
+}
+
+static long tty_compat_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
struct tty_struct *tty;
@@ -2499,6 +2566,14 @@
/* enter the native code path for those numbers known
* to be compatible */
switch (cmd) {
+ case TIOCGSERIAL:
+ case TIOCSSERIAL:
+ ret = serial_struct_ioctl(inode, file, cmd, arg);
+ break;
+#ifdef TIOCGLTC
+ case TIOCGLTC:
+ case TIOCSLTC:
+#endif
case TCFLSH:
case TCGETA:
case TCGETS:
Index: linux-cg/fs/compat_ioctl.c
===================================================================
--- linux-cg.orig/fs/compat_ioctl.c 2005-11-05 14:47:57.000000000 +0100
+++ linux-cg/fs/compat_ioctl.c 2005-11-05 15:46:46.000000000 +0100
@@ -356,67 +356,6 @@
#define HIDPGETCONNLIST _IOR('H', 210, int)
#define HIDPGETCONNINFO _IOR('H', 211, int)
-struct serial_struct32 {
- compat_int_t type;
- compat_int_t line;
- compat_uint_t port;
- compat_int_t irq;
- compat_int_t flags;
- compat_int_t xmit_fifo_size;
- compat_int_t custom_divisor;
- compat_int_t baud_base;
- unsigned short close_delay;
- char io_type;
- char reserved_char[1];
- compat_int_t hub6;
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short closing_wait2; /* no longer used... */
- compat_uint_t iomem_base;
- unsigned short iomem_reg_shift;
- unsigned int port_high;
- /* compat_ulong_t iomap_base FIXME */
- compat_int_t reserved[1];
-};
-
-static int serial_struct_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
-{
- typedef struct serial_struct SS;
- typedef struct serial_struct32 SS32;
- struct serial_struct32 __user *ss32 = compat_ptr(arg);
- int err;
- struct serial_struct ss;
- mm_segment_t oldseg = get_fs();
- __u32 udata;
-
- if (cmd == TIOCSSERIAL) {
- if (!access_ok(VERIFY_READ, ss32, sizeof(SS32)))
- return -EFAULT;
- if (__copy_from_user(&ss, ss32, offsetof(SS32, iomem_base)))
- return -EFAULT;
- __get_user(udata, &ss32->iomem_base);
- ss.iomem_base = compat_ptr(udata);
- __get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
- __get_user(ss.port_high, &ss32->port_high);
- ss.iomap_base = 0UL;
- }
- set_fs(KERNEL_DS);
- err = sys_ioctl(fd,cmd,(unsigned long)(&ss));
- set_fs(oldseg);
- if (cmd == TIOCGSERIAL && err >= 0) {
- if (!access_ok(VERIFY_WRITE, ss32, sizeof(SS32)))
- return -EFAULT;
- if (__copy_to_user(ss32,&ss,offsetof(SS32,iomem_base)))
- return -EFAULT;
- __put_user((unsigned long)ss.iomem_base >> 32 ?
- 0xffffffff : (unsigned)(unsigned
long)ss.iomem_base,
- &ss32->iomem_base);
- __put_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift);
- __put_user(ss.port_high, &ss32->port_high);
-
- }
- return err;
-}
-
#undef CODE
#endif
@@ -425,13 +364,5 @@
HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans)
HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans)
HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans)
-/* Serial */
-HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl)
-HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
-#ifdef TIOCGLTC
-COMPATIBLE_IOCTL(TIOCGLTC)
-COMPATIBLE_IOCTL(TIOCSLTC)
-#endif
-
#undef DECLARES
#endif
--
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html