diff options
author | Arnd Bergmann <arnd@arndb.de> | 2005-11-09 00:39:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:36 -0500 |
commit | c7f82d9c49e763f40f7ea7126a2c9f067bfde71f (patch) | |
tree | 794bd9dc020f29555c5ab11c18f4b843174794f5 /fs | |
parent | 01a16fae8e0e99a5abdd1c6c9a2b67e7e6167c18 (diff) |
[PATCH] fbdev: move ioctl32 code to fbmem.c
The frame buffer layer already had some code dealing with compat ioctls, this
patch moves over the remaining code from fs/compat_ioctl.c
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/compat_ioctl.c | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 71c9d45c0624..26300fccb4fc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -840,146 +840,6 @@ static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
840 | return err ? -EFAULT : 0; | 840 | return err ? -EFAULT : 0; |
841 | } | 841 | } |
842 | 842 | ||
843 | struct fb_fix_screeninfo32 { | ||
844 | char id[16]; | ||
845 | compat_caddr_t smem_start; | ||
846 | u32 smem_len; | ||
847 | u32 type; | ||
848 | u32 type_aux; | ||
849 | u32 visual; | ||
850 | u16 xpanstep; | ||
851 | u16 ypanstep; | ||
852 | u16 ywrapstep; | ||
853 | u32 line_length; | ||
854 | compat_caddr_t mmio_start; | ||
855 | u32 mmio_len; | ||
856 | u32 accel; | ||
857 | u16 reserved[3]; | ||
858 | }; | ||
859 | |||
860 | struct fb_cmap32 { | ||
861 | u32 start; | ||
862 | u32 len; | ||
863 | compat_caddr_t red; | ||
864 | compat_caddr_t green; | ||
865 | compat_caddr_t blue; | ||
866 | compat_caddr_t transp; | ||
867 | }; | ||
868 | |||
869 | static int fb_getput_cmap(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
870 | { | ||
871 | struct fb_cmap_user __user *cmap; | ||
872 | struct fb_cmap32 __user *cmap32; | ||
873 | __u32 data; | ||
874 | int err; | ||
875 | |||
876 | cmap = compat_alloc_user_space(sizeof(*cmap)); | ||
877 | cmap32 = compat_ptr(arg); | ||
878 | |||
879 | if (copy_in_user(&cmap->start, &cmap32->start, 2 * sizeof(__u32))) | ||
880 | return -EFAULT; | ||
881 | |||
882 | if (get_user(data, &cmap32->red) || | ||
883 | put_user(compat_ptr(data), &cmap->red) || | ||
884 | get_user(data, &cmap32->green) || | ||
885 | put_user(compat_ptr(data), &cmap->green) || | ||
886 | get_user(data, &cmap32->blue) || | ||
887 | put_user(compat_ptr(data), &cmap->blue) || | ||
888 | get_user(data, &cmap32->transp) || | ||
889 | put_user(compat_ptr(data), &cmap->transp)) | ||
890 | return -EFAULT; | ||
891 | |||
892 | err = sys_ioctl(fd, cmd, (unsigned long) cmap); | ||
893 | |||
894 | if (!err) { | ||
895 | if (copy_in_user(&cmap32->start, | ||
896 | &cmap->start, | ||
897 | 2 * sizeof(__u32))) | ||
898 | err = -EFAULT; | ||
899 | } | ||
900 | return err; | ||
901 | } | ||
902 | |||
903 | static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix, | ||
904 | struct fb_fix_screeninfo32 __user *fix32) | ||
905 | { | ||
906 | __u32 data; | ||
907 | int err; | ||
908 | |||
909 | err = copy_to_user(&fix32->id, &fix->id, sizeof(fix32->id)); | ||
910 | |||
911 | data = (__u32) (unsigned long) fix->smem_start; | ||
912 | err |= put_user(data, &fix32->smem_start); | ||
913 | |||
914 | err |= put_user(fix->smem_len, &fix32->smem_len); | ||
915 | err |= put_user(fix->type, &fix32->type); | ||
916 | err |= put_user(fix->type_aux, &fix32->type_aux); | ||
917 | err |= put_user(fix->visual, &fix32->visual); | ||
918 | err |= put_user(fix->xpanstep, &fix32->xpanstep); | ||
919 | err |= put_user(fix->ypanstep, &fix32->ypanstep); | ||
920 | err |= put_user(fix->ywrapstep, &fix32->ywrapstep); | ||
921 | err |= put_user(fix->line_length, &fix32->line_length); | ||
922 | |||
923 | data = (__u32) (unsigned long) fix->mmio_start; | ||
924 | err |= put_user(data, &fix32->mmio_start); | ||
925 | |||
926 | err |= put_user(fix->mmio_len, &fix32->mmio_len); | ||
927 | err |= put_user(fix->accel, &fix32->accel); | ||
928 | err |= copy_to_user(fix32->reserved, fix->reserved, | ||
929 | sizeof(fix->reserved)); | ||
930 | |||
931 | return err; | ||
932 | } | ||
933 | |||
934 | static int fb_get_fscreeninfo(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
935 | { | ||
936 | mm_segment_t old_fs; | ||
937 | struct fb_fix_screeninfo fix; | ||
938 | struct fb_fix_screeninfo32 __user *fix32; | ||
939 | int err; | ||
940 | |||
941 | fix32 = compat_ptr(arg); | ||
942 | |||
943 | old_fs = get_fs(); | ||
944 | set_fs(KERNEL_DS); | ||
945 | err = sys_ioctl(fd, cmd, (unsigned long) &fix); | ||
946 | set_fs(old_fs); | ||
947 | |||
948 | if (!err) | ||
949 | err = do_fscreeninfo_to_user(&fix, fix32); | ||
950 | |||
951 | return err; | ||
952 | } | ||
953 | |||
954 | static int fb_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
955 | { | ||
956 | int err; | ||
957 | |||
958 | switch (cmd) { | ||
959 | case FBIOGET_FSCREENINFO: | ||
960 | err = fb_get_fscreeninfo(fd,cmd, arg); | ||
961 | break; | ||
962 | |||
963 | case FBIOGETCMAP: | ||
964 | case FBIOPUTCMAP: | ||
965 | err = fb_getput_cmap(fd, cmd, arg); | ||
966 | break; | ||
967 | |||
968 | default: | ||
969 | do { | ||
970 | static int count; | ||
971 | if (++count <= 20) | ||
972 | printk("%s: Unknown fb ioctl cmd fd(%d) " | ||
973 | "cmd(%08x) arg(%08lx)\n", | ||
974 | __FUNCTION__, fd, cmd, arg); | ||
975 | } while(0); | ||
976 | err = -ENOSYS; | ||
977 | break; | ||
978 | }; | ||
979 | |||
980 | return err; | ||
981 | } | ||
982 | |||
983 | static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | 843 | static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) |
984 | { | 844 | { |
985 | mm_segment_t old_fs = get_fs(); | 845 | mm_segment_t old_fs = get_fs(); |
@@ -2953,10 +2813,7 @@ HANDLE_IOCTL(BLKGETSIZE, w_long) | |||
2953 | HANDLE_IOCTL(0x1260, broken_blkgetsize) | 2813 | HANDLE_IOCTL(0x1260, broken_blkgetsize) |
2954 | HANDLE_IOCTL(BLKFRAGET, w_long) | 2814 | HANDLE_IOCTL(BLKFRAGET, w_long) |
2955 | HANDLE_IOCTL(BLKSECTGET, w_long) | 2815 | HANDLE_IOCTL(BLKSECTGET, w_long) |
2956 | HANDLE_IOCTL(FBIOGET_FSCREENINFO, fb_ioctl_trans) | ||
2957 | HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans) | 2816 | HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans) |
2958 | HANDLE_IOCTL(FBIOGETCMAP, fb_ioctl_trans) | ||
2959 | HANDLE_IOCTL(FBIOPUTCMAP, fb_ioctl_trans) | ||
2960 | HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans) | 2817 | HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans) |
2961 | HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) | 2818 | HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) |
2962 | HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) | 2819 | HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) |