diff options
author | <jejb@titanic.il.steeleye.com> | 2005-04-10 23:29:42 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic> | 2005-04-18 13:34:15 -0400 |
commit | f4c2c15b930b23edaa633b09fe3f4c01b4ecce9f (patch) | |
tree | 0e3625ea704d516508dc3a1890112eefe6fbc204 /drivers | |
parent | 2bc474c3646efba67bdc83b7fc7d8ee7562e0106 (diff) |
[PATCH] Convert i2o to compat_ioctl
Also broken design in its compat handlers - CONFIG_COMPAT doesn't
mean that there should be no native ioctls.
Signed-off-by: Andi Kleen <ak@muc.de>
Reworked with comments from Markus Lidel by:
Christoph Hellwig <hch@infradead.org>
Rejections fixed and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/message/i2o/i2o_config.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 5fc5004ea07a..1fb5cdf67f8f 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -54,6 +54,9 @@ | |||
54 | 54 | ||
55 | extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int); | 55 | extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int); |
56 | 56 | ||
57 | static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, | ||
58 | unsigned long arg); | ||
59 | |||
57 | static spinlock_t i2o_config_lock; | 60 | static spinlock_t i2o_config_lock; |
58 | 61 | ||
59 | #define MODINC(x,y) ((x) = ((x) + 1) % (y)) | 62 | #define MODINC(x,y) ((x) = ((x) + 1) % (y)) |
@@ -538,8 +541,7 @@ static int i2o_cfg_evt_get(unsigned long arg, struct file *fp) | |||
538 | } | 541 | } |
539 | 542 | ||
540 | #ifdef CONFIG_COMPAT | 543 | #ifdef CONFIG_COMPAT |
541 | static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, | 544 | static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long arg) |
542 | struct file *file) | ||
543 | { | 545 | { |
544 | struct i2o_cmd_passthru32 __user *cmd; | 546 | struct i2o_cmd_passthru32 __user *cmd; |
545 | struct i2o_controller *c; | 547 | struct i2o_controller *c; |
@@ -752,7 +754,26 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, | |||
752 | return rcode; | 754 | return rcode; |
753 | } | 755 | } |
754 | 756 | ||
755 | #else | 757 | static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
758 | { | ||
759 | int ret; | ||
760 | lock_kernel(); | ||
761 | switch (cmd) { | ||
762 | case I2OGETIOPS: | ||
763 | ret = i2o_cfg_ioctl(NULL, file, cmd, arg); | ||
764 | break; | ||
765 | case I2OPASSTHRU32: | ||
766 | ret = i2o_cfg_passthru32(file, cmd, arg); | ||
767 | break; | ||
768 | default: | ||
769 | ret = -ENOIOCTLCMD; | ||
770 | break; | ||
771 | } | ||
772 | unlock_kernel(); | ||
773 | return ret; | ||
774 | } | ||
775 | |||
776 | #endif | ||
756 | 777 | ||
757 | static int i2o_cfg_passthru(unsigned long arg) | 778 | static int i2o_cfg_passthru(unsigned long arg) |
758 | { | 779 | { |
@@ -958,7 +979,6 @@ static int i2o_cfg_passthru(unsigned long arg) | |||
958 | kfree(reply); | 979 | kfree(reply); |
959 | return rcode; | 980 | return rcode; |
960 | } | 981 | } |
961 | #endif | ||
962 | 982 | ||
963 | /* | 983 | /* |
964 | * IOCTL Handler | 984 | * IOCTL Handler |
@@ -1013,11 +1033,9 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, | |||
1013 | ret = i2o_cfg_evt_get(arg, fp); | 1033 | ret = i2o_cfg_evt_get(arg, fp); |
1014 | break; | 1034 | break; |
1015 | 1035 | ||
1016 | #ifndef CONFIG_COMPAT | ||
1017 | case I2OPASSTHRU: | 1036 | case I2OPASSTHRU: |
1018 | ret = i2o_cfg_passthru(arg); | 1037 | ret = i2o_cfg_passthru(arg); |
1019 | break; | 1038 | break; |
1020 | #endif | ||
1021 | 1039 | ||
1022 | default: | 1040 | default: |
1023 | osm_debug("unknown ioctl called!\n"); | 1041 | osm_debug("unknown ioctl called!\n"); |
@@ -1105,6 +1123,9 @@ static struct file_operations config_fops = { | |||
1105 | .owner = THIS_MODULE, | 1123 | .owner = THIS_MODULE, |
1106 | .llseek = no_llseek, | 1124 | .llseek = no_llseek, |
1107 | .ioctl = i2o_cfg_ioctl, | 1125 | .ioctl = i2o_cfg_ioctl, |
1126 | #ifdef CONFIG_COMPAT | ||
1127 | .compat_ioctl = i2o_cfg_compat_ioctl, | ||
1128 | #endif | ||
1108 | .open = cfg_open, | 1129 | .open = cfg_open, |
1109 | .release = cfg_release, | 1130 | .release = cfg_release, |
1110 | .fasync = cfg_fasync, | 1131 | .fasync = cfg_fasync, |
@@ -1134,19 +1155,11 @@ static int __init i2o_config_init(void) | |||
1134 | misc_deregister(&i2o_miscdev); | 1155 | misc_deregister(&i2o_miscdev); |
1135 | return -EBUSY; | 1156 | return -EBUSY; |
1136 | } | 1157 | } |
1137 | #ifdef CONFIG_COMPAT | ||
1138 | register_ioctl32_conversion(I2OPASSTHRU32, i2o_cfg_passthru32); | ||
1139 | register_ioctl32_conversion(I2OGETIOPS, (void *)sys_ioctl); | ||
1140 | #endif | ||
1141 | return 0; | 1158 | return 0; |
1142 | } | 1159 | } |
1143 | 1160 | ||
1144 | static void i2o_config_exit(void) | 1161 | static void i2o_config_exit(void) |
1145 | { | 1162 | { |
1146 | #ifdef CONFIG_COMPAT | ||
1147 | unregister_ioctl32_conversion(I2OPASSTHRU32); | ||
1148 | unregister_ioctl32_conversion(I2OGETIOPS); | ||
1149 | #endif | ||
1150 | misc_deregister(&i2o_miscdev); | 1163 | misc_deregister(&i2o_miscdev); |
1151 | i2o_driver_unregister(&i2o_config_driver); | 1164 | i2o_driver_unregister(&i2o_config_driver); |
1152 | } | 1165 | } |