Sigh more compat fixes, this is almost right for 2.6.9 - 2.6.26 kernels.

git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@157 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
behlendo 2008-08-11 23:47:44 +00:00
parent b61a6e8bdc
commit 25557fd884
6 changed files with 32 additions and 19 deletions

View File

@ -526,10 +526,11 @@ AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
SPL_LINUX_TRY_COMPILE([ SPL_LINUX_TRY_COMPILE([
#include <linux/time.h> #include <linux/time.h>
],[
void set_normalized_timespec(struct timespec *ts, void set_normalized_timespec(struct timespec *ts,
time_t sec, long nsec); time_t sec, long nsec) { }
],[ ],
[],
[
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
],[ ],[
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)

View File

@ -9,12 +9,14 @@
#ifdef HAVE_DEVICE_CREATE #ifdef HAVE_DEVICE_CREATE
typedef struct class spl_class; typedef struct class spl_class;
typedef struct device spl_device;
#define spl_class_create(mod, name) class_create(mod, name) #define spl_class_create(mod, name) class_create(mod, name)
#define spl_class_destroy(cls) class_destroy(cls) #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) 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 * Preferred API from 2.6.13 to 2.6.17
@ -25,12 +27,14 @@ typedef struct class spl_class;
#ifdef HAVE_CLASS_DEVICE_CREATE #ifdef HAVE_CLASS_DEVICE_CREATE
typedef struct class spl_class; typedef struct class spl_class;
typedef struct class_device spl_device;
#define spl_class_create(mod, name) class_create(mod, name) #define spl_class_create(mod, name) class_create(mod, name)
#define spl_class_destroy(cls) class_destroy(cls) #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...) \
class_device_create(cls, parent, devt, device, fmt, ## args) class_device_create(cls, devt, device, fmt, ## args)
#define spl_device_destroy(cls, devt) class_device_destroy(cls, devt) #define spl_device_destroy(cls, cls_dev, devt) \
class_device_unregister(cls_dev)
/* /*
* Prefered API from 2.6.0 to 2.6.12 * Prefered API from 2.6.0 to 2.6.12
@ -40,12 +44,14 @@ typedef struct class spl_class;
#else /* Legacy API */ #else /* Legacy API */
typedef struct class_simple spl_class; 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_create(mod, name) class_simple_create(mod, name)
#define spl_class_destroy(cls) class_simple_destroy(cls) #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) 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
#endif #endif

View File

@ -82,6 +82,7 @@ typedef struct dev_info {
struct dev_ops *di_ops; struct dev_ops *di_ops;
struct cdev *di_cdev; struct cdev *di_cdev;
spl_class *di_class; spl_class *di_class;
spl_device *di_device;
major_t di_major; major_t di_major;
minor_t di_minor; minor_t di_minor;
dev_t di_dev; dev_t di_dev;

View 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 */ /* Do not append a 0 to devices with minor nums of 0 */
if (di->di_minor == 0) { if (di->di_minor == 0) {
spl_device_create(di->di_class, NULL, di->di_dev, di->di_device = spl_device_create(di->di_class, NULL,
NULL, "%s", name); di->di_dev, NULL,
"%s", name);
} else { } else {
spl_device_create(di->di_class, NULL, di->di_dev, di->di_device = spl_device_create(di->di_class, NULL,
NULL, "%s%d", name, di->di_minor); di->di_dev, NULL,
"%s%d", name, di->di_minor);
} }
di->di_cdev = cdev; di->di_cdev = cdev;
@ -188,7 +190,7 @@ static void
__ddi_remove_minor_node_locked(dev_info_t *di, char *name) __ddi_remove_minor_node_locked(dev_info_t *di, char *name)
{ {
if (di->di_class) { 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); spl_class_destroy(di->di_class);
di->di_class = NULL; di->di_class = NULL;

View File

@ -43,6 +43,7 @@
#include "splat-internal.h" #include "splat-internal.h"
static spl_class *splat_class; static spl_class *splat_class;
static spl_device *splat_device;
static struct list_head splat_module_list; static struct list_head splat_module_list;
static spinlock_t splat_module_lock; static spinlock_t splat_module_lock;
@ -630,7 +631,8 @@ splat_init(void)
goto error; goto error;
} }
spl_device_create(splat_class, NULL, MKDEV(SPLAT_MAJOR, 0), splat_device = spl_device_create(splat_class, NULL,
MKDEV(SPLAT_MAJOR, 0),
NULL, SPLAT_NAME); NULL, SPLAT_NAME);
printk(KERN_INFO "splat: Loaded Solaris Porting LAyer " printk(KERN_INFO "splat: Loaded Solaris Porting LAyer "
@ -646,7 +648,7 @@ splat_fini(void)
{ {
dev_t dev = MKDEV(SPLAT_MAJOR, 0); 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); spl_class_destroy(splat_class);
cdev_del(&splat_cdev); cdev_del(&splat_cdev);
unregister_chrdev_region(dev, SPLAT_MINORS); unregister_chrdev_region(dev, SPLAT_MINORS);

View File

@ -354,10 +354,10 @@ fd_uninstall(int fd)
{ {
struct file *fp; struct file *fp;
struct files_struct *files = current->files; struct files_struct *files = current->files;
#ifdef HAVE_FILES_FDTABLE
struct fdtable *fdt; struct fdtable *fdt;
spin_lock(&files->file_lock); spin_lock(&files->file_lock);
#ifdef HAVE_FILES_FDTABLE
fdt = files_fdtable(files); fdt = files_fdtable(files);
if (fd >= fdt->max_fds) if (fd >= fdt->max_fds)
@ -370,6 +370,7 @@ fd_uninstall(int fd)
rcu_assign_pointer(fdt->fd[fd], NULL); rcu_assign_pointer(fdt->fd[fd], NULL);
FD_CLR(fd, fdt->close_on_exec); FD_CLR(fd, fdt->close_on_exec);
#else #else
spin_lock(&files->file_lock);
if (fd >= files->max_fds) if (fd >= files->max_fds)
goto out_unlock; goto out_unlock;