diff -u usr/src/SUNWut/utdisk.orig/utdisk.c usr/src/SUNWut/utdisk/utdisk.c --- usr/src/SUNWut/utdisk.orig/utdisk.c 2007-08-02 00:45:55.000000000 +0200 +++ usr/src/SUNWut/utdisk/utdisk.c 2007-10-13 23:47:05.000000000 +0200 @@ -20,6 +20,9 @@ #include /* HDIO */ #include /* create_proc_read_entry */ #include /* __init macro */ +#ifdef HAVE_COMPAT_IOCTL +# include /* (un)lock_kernel() */ +#endif #include /* command values*/ #include /* SCSI_IOCTL_SEND_COMMAND */ #include /* MAX_COMMAND_SIZE */ @@ -49,6 +52,10 @@ static int utdisk_revalidate_disk(struct gendisk *gdp); static int utdisk_ioctl(struct inode *inodep, struct file *fp, unsigned int cmd, unsigned long arg); +#ifdef HAVE_COMPAT_IOCTL +static long utdisk_compat_ioctl(struct file *fp, + unsigned int cmd, unsigned long arg); +#endif /* HAVE_COMPAT_IOCTL */ static int utdisk_make_request(request_queue_t *q, struct bio *bio); static int utdisk_scsi_command(utdisk_state_t *dsp, struct block_device *bdevp, unsigned long arg); @@ -66,6 +73,9 @@ .owner = THIS_MODULE, .open = utdisk_open, .ioctl = utdisk_ioctl, +#ifdef HAVE_COMPAT_IOCTL + .compat_ioctl = utdisk_compat_ioctl, +#endif .release = utdisk_release, .media_changed = utdisk_media_changed, .revalidate_disk = utdisk_revalidate_disk, @@ -248,6 +258,23 @@ } +#ifdef HAVE_COMPAT_IOCTL +/* 32bit compat ioctl */ +static long +utdisk_compat_ioctl(struct file *fp, unsigned int command, unsigned long arg) +{ + int r; + + utprintf("%s: command=0x%x\n", __FUNCTION__, command); + + lock_kernel(); + r = utdisk_ioctl(fp->f_path.dentry->d_inode, fp, command, arg); + unlock_kernel(); + + return r; +} +#endif /* HAVE_COMPAT_IOCTL */ + /* ioctl */ static int utdisk_ioctl(struct inode *inodep, struct file *fp, unsigned int cmd, diff -u usr/src/SUNWut/utdisk.orig/utdiskctl.c usr/src/SUNWut/utdisk/utdiskctl.c --- usr/src/SUNWut/utdisk.orig/utdiskctl.c 2007-08-02 00:45:55.000000000 +0200 +++ usr/src/SUNWut/utdisk/utdiskctl.c 2007-10-13 23:25:23.000000000 +0200 @@ -23,6 +23,9 @@ #include /* module entry-point macros */ #include /* device entry points */ #include /* create_proc_read_entry */ +#ifdef HAVE_COMPAT_IOCTL +# include /* (un)lock_kernel() */ +#endif #include /* userland access */ #include "utdisk.h" #include "utdiskctl.h" @@ -62,6 +65,10 @@ size_t count, loff_t *ppos); static int utstk_ioctl(struct inode *inode, struct file *fp, unsigned int command, unsigned long arg); +#ifdef HAVE_COMPAT_IOCTL +static long utstk_compat_ioctl(struct file *fp, + unsigned int command, unsigned long arg); +#endif /* HAVE_COMPAT_IOCTL */ static int utstk_get_ctl_major(unsigned long arg, int flag32ptr); static int utstk_get_disk_major(unsigned long arg, int flag32ptr); static int utstk_hotplug(unsigned long arg, int flag32ptr); @@ -90,6 +97,9 @@ .open = utstk_open, .release = utstk_release, .ioctl = utstk_ioctl, +#ifdef HAVE_COMPAT_IOCTL + .compat_ioctl = utstk_compat_ioctl, +#endif .owner = THIS_MODULE, }; @@ -184,6 +194,7 @@ #if defined(CONFIG_COMPAT) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64) || defined(CONFIG_PPC64) +#ifndef HAVE_COMPAT_IOCTL /* This function tags all 32-bit ioctls so later code knows pointers are 32-bits */ static int tag32_utstk_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file) @@ -192,6 +203,7 @@ return(utstk_ioctl(inode, file, cmd | UTDISK_32BIT_PTRS, arg)); } +#endif /* HAVE_COMPAT_IOCTL */ #endif /* CONFIG_COMPAT */ @@ -260,6 +272,7 @@ utprintf("%s: major=%d\n", __FUNCTION__, utdc_major); #if defined(CONFIG_COMPAT) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64) || defined(CONFIG_PPC64) +#ifndef HAVE_COMPAT_IOCTL register_ioctl32_conversion(UTDISK_HOTPLUG, &tag32_utstk_ioctl); register_ioctl32_conversion(UTDISK_UNPLUG, &tag32_utstk_ioctl); register_ioctl32_conversion(UTDISK_MEDIA_CHANGE, &tag32_utstk_ioctl); @@ -268,6 +281,7 @@ register_ioctl32_conversion(UTDISK_GET_MESG, &tag32_utstk_ioctl); register_ioctl32_conversion(UTDISK_GET_CDB, &tag32_utstk_ioctl); register_ioctl32_conversion(UTDISK_DISK_READY, &tag32_utstk_ioctl); +#endif /* HAVE_COMPAT_IOCTL */ #endif /* CONFIG_COMPAT */ return (0); @@ -307,6 +321,7 @@ utdisk_bd_ops = NULL; #if defined(CONFIG_COMPAT) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64) || defined(CONFIG_PPC64) +#ifndef HAVE_COMPAT_IOCTL unregister_ioctl32_conversion(UTDISK_HOTPLUG); unregister_ioctl32_conversion(UTDISK_UNPLUG); unregister_ioctl32_conversion(UTDISK_MEDIA_CHANGE); @@ -315,6 +330,7 @@ unregister_ioctl32_conversion(UTDISK_GET_MESG); unregister_ioctl32_conversion(UTDISK_GET_CDB); unregister_ioctl32_conversion(UTDISK_DISK_READY); +#endif /* HAVE_COMPAT_IOCTL */ #endif /* CONFIG_COMPAT */ } @@ -560,6 +576,24 @@ } +#ifdef HAVE_COMPAT_IOCTL +/* 32bit compat ioctl */ +static long +utstk_compat_ioctl(struct file *fp, unsigned int command, unsigned long arg) +{ + int r; + + utprintf("%s: command=0x%x\n", __FUNCTION__, command); + + lock_kernel(); + r = fp->f_op->ioctl(fp->f_path.dentry->d_inode, fp, + command | UTDISK_32BIT_PTRS, arg); + unlock_kernel(); + + return r; +} +#endif /* HAVE_COMPAT_IOCTL */ + /* ioctl */ static int utstk_ioctl(struct inode *inode, struct file *fp, unsigned int command, diff -u usr/src/SUNWut/utdisk.orig/utdiskctl.h usr/src/SUNWut/utdisk/utdiskctl.h --- usr/src/SUNWut/utdisk.orig/utdiskctl.h 2007-08-02 00:45:55.000000000 +0200 +++ usr/src/SUNWut/utdisk/utdiskctl.h 2007-10-13 23:13:11.000000000 +0200 @@ -25,7 +25,9 @@ #include #if defined(CONFIG_COMPAT) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64) || defined(CONFIG_PPC64) #include -#include +#ifndef HAVE_COMPAT_IOCTL +# include +#endif #include #endif /* CONFIG_COMPAT */