[PATCH] Implement ioctl emulation for the parport character device

Fixes bugzilla.kernel.org bug 2903.

Cc: <tim@cyberelk.net>
Cc: <andrea@suse.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Andi Kleen and committed by Linus Torvalds c6b44d10 cbe8dd4a

+29
+29
fs/compat_ioctl.c
··· 122 122 #include <linux/dvb/dmx.h> 123 123 #include <linux/dvb/frontend.h> 124 124 #include <linux/dvb/video.h> 125 + #include <linux/lp.h> 125 126 126 127 /* Aiee. Someone does not find a difference between int and long */ 127 128 #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) ··· 2736 2735 } 2737 2736 #endif 2738 2737 2738 + static int 2739 + lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 2740 + { 2741 + struct compat_timeval *tc = (struct compat_timeval *)arg; 2742 + struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval)); 2743 + struct timeval ts; 2744 + if (get_user(ts.tv_sec, &tc->tv_sec) || 2745 + get_user(ts.tv_usec, &tc->tv_usec) || 2746 + put_user(ts.tv_sec, &tn->tv_sec) || 2747 + put_user(ts.tv_usec, &tn->tv_usec)) 2748 + return -EFAULT; 2749 + return sys_ioctl(fd, cmd, (unsigned long)tn); 2750 + } 2751 + 2739 2752 #define HANDLE_IOCTL(cmd,handler) \ 2740 2753 { (cmd), (ioctl_trans_handler_t)(handler) }, 2741 2754 ··· 2977 2962 HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) 2978 2963 HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) 2979 2964 HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette) 2965 + 2966 + /* parport */ 2967 + COMPATIBLE_IOCTL(LPTIME) 2968 + COMPATIBLE_IOCTL(LPCHAR) 2969 + COMPATIBLE_IOCTL(LPABORTOPEN) 2970 + COMPATIBLE_IOCTL(LPCAREFUL) 2971 + COMPATIBLE_IOCTL(LPWAIT) 2972 + COMPATIBLE_IOCTL(LPSETIRQ) 2973 + COMPATIBLE_IOCTL(LPGETSTATUS) 2974 + COMPATIBLE_IOCTL(LPGETSTATUS) 2975 + COMPATIBLE_IOCTL(LPRESET) 2976 + /*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/ 2977 + COMPATIBLE_IOCTL(LPGETFLAGS) 2978 + HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans) 2980 2979 }; 2981 2980 2982 2981 int ioctl_table_size = ARRAY_SIZE(ioctl_start);