mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Add class / device portability code. Two autoconf tests
were added to cover the 3 possible APIs from 2.6.9 to 2.6.26. We attempt to use the newest interfaces and if not available fallback to the oldest. This a rework of some changes proposed by Ricardo for RHEL4. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@150 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#ifndef _SPL_DEVICE_H
|
||||
#define _SPL_DEVICE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
/*
|
||||
* Preferred API from 2.6.18 to 2.6.26+
|
||||
*/
|
||||
#ifdef HAVE_DEVICE_CREATE
|
||||
|
||||
typedef struct class spl_class;
|
||||
|
||||
#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...) \
|
||||
device_create(cls, parent, devt, fmt, ## args)
|
||||
#define spl_device_destroy(cls, devt) device_destroy(cls, devt)
|
||||
|
||||
/*
|
||||
* Preferred API from 2.6.13 to 2.6.17
|
||||
* Depricated in 2.6.18
|
||||
* Removed in 2.6.26
|
||||
*/
|
||||
#else
|
||||
#ifdef HAVE_CLASS_DEVICE_CREATE
|
||||
|
||||
typedef struct class spl_class;
|
||||
|
||||
#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)
|
||||
|
||||
/*
|
||||
* Prefered API from 2.6.0 to 2.6.12
|
||||
* Depricated in 2.6.13
|
||||
* Removed in 2.6.13
|
||||
*/
|
||||
#else /* Legacy API */
|
||||
|
||||
typedef struct class_simple spl_class;
|
||||
|
||||
#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...) \
|
||||
class_simple_device_add(cls, devt, device, fmt, ## args)
|
||||
#define spl_device_destroy(cls, devt) class_simple_device_remove(devt)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _SPL_DEVICE_H */
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#define SPLAT_MAJOR 229 /* XXX - Arbitrary */
|
||||
#define SPLAT_MINORS 1
|
||||
#define SPLAT_NAME "splatctl"
|
||||
#define SPLAT_DEV "/dev/splatctl"
|
||||
|
||||
#define SPLAT_NAME_SIZE 12
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/device.h>
|
||||
#include <spl-device.h>
|
||||
|
||||
typedef int ddi_devid_t;
|
||||
|
||||
@@ -81,7 +81,7 @@ typedef struct dev_info {
|
||||
kmutex_t di_lock;
|
||||
struct dev_ops *di_ops;
|
||||
struct cdev *di_cdev;
|
||||
struct class *di_class;
|
||||
spl_class *di_class;
|
||||
major_t di_major;
|
||||
minor_t di_minor;
|
||||
dev_t di_dev;
|
||||
|
||||
Reference in New Issue
Block a user