diff -pur cpint-2.5.3.orig/cpint.c cpint-2.5.3/cpint.c --- cpint-2.5.3.orig/cpint.c 2005-09-06 16:17:34.000000000 +0200 +++ cpint-2.5.3/cpint.c 2006-03-13 10:48:25.000000000 +0100 @@ -111,6 +111,11 @@ MODULE_DESCRIPTION("Linux on S/390 inter " Copyright 2000-2003 Neale Ferguson"); MODULE_LICENSE("GPL"); +#ifdef CONFIG_COMPAT +static long cpint_compat_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg); +#endif + static int cpint_open(struct inode *, struct file *); static int __init cpint_init(void); @@ -131,7 +136,7 @@ int cpint_nr_devs = CPINT_NR_DEVS; CPInt_Dev *cpint_devices; -static struct class_simple *cpint_class; +static struct class *cpint_class; /*----------------------------------------------------------*/ /* The different file operations */ @@ -144,6 +149,9 @@ static struct file_operations cpint_fops static struct file_operations idcmd_fops = { open:idcmd_open, ioctl:idcmd_ioctl, +#ifdef CONFIG_COMPAT + compat_ioctl:cpint_compat_ioctl, +#endif release:idcmd_release, }; @@ -152,6 +160,9 @@ static struct file_operations cpcmd_fops write:cpcmd_write, open:cpcmd_open, ioctl:cpcmd_ioctl, +#ifdef CONFIG_COMPAT + compat_ioctl:cpint_compat_ioctl, +#endif release:cpcmd_release, }; @@ -159,6 +170,9 @@ static struct file_operations applmon_fo write:applmon_write, open:applmon_open, ioctl:applmon_ioctl, +#ifdef CONFIG_COMPAT + compat_ioctl:cpint_compat_ioctl, +#endif release:applmon_release, }; @@ -208,18 +222,26 @@ char *cpNames[] = { "cpid", }; -#ifdef __s390x__ -static Converters converters[] = { - {CPIOCRC, NULL}, - {CPIOUPC, NULL}, - {IDGETBF, NULL}, - {MONSETPROD, NULL}, - {-1, NULL} -}; -#endif /*============== End of Variable Declarations ==============*/ +#ifdef CONFIG_COMPAT +long cpint_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + /* + * Filter out invalid commands + */ + if (cmd == CPIOCRC || cmd == CPIOUPC || + cmd == IDGETBF || cmd == MONSETPROD ) + return -EINVAL; + + /* + * Let the static ioctl translation table take care of it. + */ + return -ENOIOCTLCMD; +} +#endif + /************************************************************/ /* */ /* Name - cpint_open. */ @@ -271,7 +293,7 @@ cpint_open(struct inode *inode, struct f static int __init cpint_init(void) { - int result, i_dev, i_conv; + int result, i_dev; CPInt_Dev *dev; union { long long cpuid; @@ -309,7 +331,7 @@ cpint_init(void) /*------------------------------------------------------*/ /* Register this device class */ /*------------------------------------------------------*/ - cpint_class = class_simple_create(THIS_MODULE, "cpint"); + cpint_class = class_create(THIS_MODULE,"cpint"); if (IS_ERR(cpint_class)) { printk(KERN_ERR "Error creating cpint class.\n"); kfree(cpint_devices); @@ -325,9 +347,9 @@ cpint_init(void) fopIdx = fopMap[i_dev]; if (fopIdx > -1 && !(cpint_devs_map & (1 << fopIdx))) { - class_simple_device_add(cpint_class, - MKDEV(cpint_major, i_dev), NULL, - cpNames[fopIdx]); + class_device_create(cpint_class, NULL, + MKDEV(cpint_major, i_dev), NULL, + cpNames[fopIdx]); cpint_devs_map |= 1 << fopIdx; } } @@ -337,18 +359,6 @@ cpint_init(void) i_dev < cpint_nr_devs; dev++, i_dev++) init_waitqueue_head(&dev->devWait); -#ifdef __s390x__ - for (i_conv = 0; converters[i_conv].code != -1; i_conv++) { - int rc; - - rc = register_ioctl32_conversion(converters[i_conv].code, - converters[i_conv].handler); - - if (rc < 0) - printk("Unable to register ioctl32 handlers"); - } -#endif - return 0; } @@ -368,29 +378,18 @@ module_init(cpint_init); static void __exit cpint_cleanup(void) { - int i_dev, i_conv; - -#ifdef __s390x__ - for (i_conv = 0; converters[i_conv].code != -1; i_conv++) { - int rc; - - rc = unregister_ioctl32_conversion(converters[i_conv].code); - - if (rc < 0) - printk("Unable to unregister ioctl32 handlers"); - } -#endif + int i_dev; for (i_dev = 0; i_dev < CPINT_NR_DEVS; i_dev++) { int fopIdx; fopIdx = fopMap[i_dev]; if (fopIdx > -1 && (cpint_devs_map & (1 << fopIdx))) { - class_simple_device_remove(MKDEV(cpint_major, i_dev)); + class_device_destroy(cpint_class,MKDEV(cpint_major, i_dev)); } } cpint_devs_map = 0; - class_simple_destroy(cpint_class); + class_destroy(cpint_class); unregister_chrdev(cpint_major, "cpint"); for (i_dev = 0; i_dev < CPINT_NR_DEVS; i_dev++) { Only in cpint-2.5.3: cpint.c~