diff options
-rw-r--r-- | autoconf/spl-build.m4 | 7 | ||||
-rw-r--r-- | include/spl-device.h | 20 | ||||
-rw-r--r-- | include/sys/sunddi.h | 1 | ||||
-rw-r--r-- | modules/spl/spl-module.c | 12 | ||||
-rw-r--r-- | modules/splat/splat-ctl.c | 8 | ||||
-rw-r--r-- | modules/splat/splat-vnode.c | 3 |
6 files changed, 32 insertions, 19 deletions
diff --git a/autoconf/spl-build.m4 b/autoconf/spl-build.m4 index 33465b6bb..e13c5b875 100644 --- a/autoconf/spl-build.m4 +++ b/autoconf/spl-build.m4 @@ -526,10 +526,11 @@ AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [ AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) SPL_LINUX_TRY_COMPILE([ #include <linux/time.h> - ],[ void set_normalized_timespec(struct timespec *ts, - time_t sec, long nsec); - ],[ + time_t sec, long nsec) { } + ], + [], + [ AC_MSG_RESULT(no) ],[ AC_MSG_RESULT(yes) diff --git a/include/spl-device.h b/include/spl-device.h index 2bbd299b8..d18aedf07 100644 --- a/include/spl-device.h +++ b/include/spl-device.h @@ -9,12 +9,14 @@ #ifdef HAVE_DEVICE_CREATE typedef struct class spl_class; +typedef struct device spl_device; #define spl_class_create(mod, name) class_create(mod, name) #define spl_class_destroy(cls) class_destroy(cls) -#define spl_device_create(cls, parent, devt, device, fmt, args...) \ +#define spl_device_create(cls, parent, devt, device, fmt, args...) \ device_create(cls, parent, devt, fmt, ## args) -#define spl_device_destroy(cls, devt) device_destroy(cls, devt) +#define spl_device_destroy(cls, cls_dev, devt) \ + device_destroy(cls, devt) /* * Preferred API from 2.6.13 to 2.6.17 @@ -25,12 +27,14 @@ typedef struct class spl_class; #ifdef HAVE_CLASS_DEVICE_CREATE typedef struct class spl_class; +typedef struct class_device spl_device; #define spl_class_create(mod, name) class_create(mod, name) #define spl_class_destroy(cls) class_destroy(cls) -#define spl_device_create(cls, parent, devt, device, fmt, args...) \ - class_device_create(cls, parent, devt, device, fmt, ## args) -#define spl_device_destroy(cls, devt) class_device_destroy(cls, devt) +#define spl_device_create(cls, parent, devt, device, fmt, args...) \ + class_device_create(cls, devt, device, fmt, ## args) +#define spl_device_destroy(cls, cls_dev, devt) \ + class_device_unregister(cls_dev) /* * Prefered API from 2.6.0 to 2.6.12 @@ -40,12 +44,14 @@ typedef struct class spl_class; #else /* Legacy API */ typedef struct class_simple spl_class; +typedef struct class_device spl_class_device; #define spl_class_create(mod, name) class_simple_create(mod, name) #define spl_class_destroy(cls) class_simple_destroy(cls) -#define spl_device_create(cls, parent, devt, device, fmt, args...) \ +#define spl_device_create(cls, parent, devt, device, fmt, args...) \ class_simple_device_add(cls, devt, device, fmt, ## args) -#define spl_device_destroy(cls, devt) class_simple_device_remove(devt) +#define spl_device_destroy(cls, cls_dev, devt) \ + class_simple_device_remove(devt) #endif #endif diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h index 764ae3820..bbfd412da 100644 --- a/include/sys/sunddi.h +++ b/include/sys/sunddi.h @@ -82,6 +82,7 @@ typedef struct dev_info { struct dev_ops *di_ops; struct cdev *di_cdev; spl_class *di_class; + spl_device *di_device; major_t di_major; minor_t di_minor; dev_t di_dev; diff --git a/modules/spl/spl-module.c b/modules/spl/spl-module.c index 19c5db2cd..18f57fdf1 100644 --- a/modules/spl/spl-module.c +++ b/modules/spl/spl-module.c @@ -165,11 +165,13 @@ __ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, /* Do not append a 0 to devices with minor nums of 0 */ if (di->di_minor == 0) { - spl_device_create(di->di_class, NULL, di->di_dev, - NULL, "%s", name); + di->di_device = spl_device_create(di->di_class, NULL, + di->di_dev, NULL, + "%s", name); } else { - spl_device_create(di->di_class, NULL, di->di_dev, - NULL, "%s%d", name, di->di_minor); + di->di_device = spl_device_create(di->di_class, NULL, + di->di_dev, NULL, + "%s%d", name, di->di_minor); } di->di_cdev = cdev; @@ -188,7 +190,7 @@ static void __ddi_remove_minor_node_locked(dev_info_t *di, char *name) { if (di->di_class) { - spl_device_destroy(di->di_class, di->di_dev); + spl_device_destroy(di->di_class, di->di_device, di->di_dev); spl_class_destroy(di->di_class); di->di_class = NULL; diff --git a/modules/splat/splat-ctl.c b/modules/splat/splat-ctl.c index 0c8b673d9..b82c85f9c 100644 --- a/modules/splat/splat-ctl.c +++ b/modules/splat/splat-ctl.c @@ -43,6 +43,7 @@ #include "splat-internal.h" static spl_class *splat_class; +static spl_device *splat_device; static struct list_head splat_module_list; static spinlock_t splat_module_lock; @@ -630,8 +631,9 @@ splat_init(void) goto error; } - spl_device_create(splat_class, NULL, MKDEV(SPLAT_MAJOR, 0), - NULL, SPLAT_NAME); + splat_device = spl_device_create(splat_class, NULL, + MKDEV(SPLAT_MAJOR, 0), + NULL, SPLAT_NAME); printk(KERN_INFO "splat: Loaded Solaris Porting LAyer " "Tests v%s\n", VERSION); @@ -646,7 +648,7 @@ splat_fini(void) { dev_t dev = MKDEV(SPLAT_MAJOR, 0); - spl_device_destroy(splat_class, dev); + spl_device_destroy(splat_class, splat_device, dev); spl_class_destroy(splat_class); cdev_del(&splat_cdev); unregister_chrdev_region(dev, SPLAT_MINORS); diff --git a/modules/splat/splat-vnode.c b/modules/splat/splat-vnode.c index c85b6165a..413651dac 100644 --- a/modules/splat/splat-vnode.c +++ b/modules/splat/splat-vnode.c @@ -354,10 +354,10 @@ fd_uninstall(int fd) { struct file *fp; struct files_struct *files = current->files; +#ifdef HAVE_FILES_FDTABLE struct fdtable *fdt; spin_lock(&files->file_lock); -#ifdef HAVE_FILES_FDTABLE fdt = files_fdtable(files); if (fd >= fdt->max_fds) @@ -370,6 +370,7 @@ fd_uninstall(int fd) rcu_assign_pointer(fdt->fd[fd], NULL); FD_CLR(fd, fdt->close_on_exec); #else + spin_lock(&files->file_lock); if (fd >= files->max_fds) goto out_unlock; |