]> granicus.if.org Git - zfs/commitdiff
Sigh more compat fixes, this is almost right for 2.6.9 - 2.6.26 kernels.
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Mon, 11 Aug 2008 23:47:44 +0000 (23:47 +0000)
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>
Mon, 11 Aug 2008 23:47:44 +0000 (23:47 +0000)
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@157 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c

autoconf/spl-build.m4
include/spl-device.h
include/sys/sunddi.h
modules/spl/spl-module.c
modules/splat/splat-ctl.c
modules/splat/splat-vnode.c

index 33465b6bb7bed64e273ba2e24d02db248cbe10d0..e13c5b8752cc6a95bb16f5711190207c89e204b5 100644 (file)
@@ -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)
index 2bbd299b8e578d78f707f15e99a66d2b327930fc..d18aedf072b13bf29dbcc46887d7b2a3f6a24d13 100644 (file)
@@ -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
index 764ae3820fe9b323eb38a8ed1acdc45dc9c9fd0c..bbfd412daf2933da20cc382652ef0f2b1a50184e 100644 (file)
@@ -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;
index 19c5db2cd3177ed11284dfde03265efdf95472db..18f57fdf1badc09168fee9baf0e1e839e10714a4 100644 (file)
@@ -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;
index 0c8b673d9606b971fe01db88532f9006fa0e1c9e..b82c85f9c91d7b826f09c1e36840f43f5a6f50f0 100644 (file)
@@ -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);
index c85b6165a8e7da406d5878a5a8752bd810992ba9..413651dac1d9252a3fece7bf59ab26c5d48e2311 100644 (file)
@@ -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;