Make change to allow to compile under kernel version > 2.6.36 (tested with a 3.2.9 kernel)

This commit is contained in:
Godzil
2012-04-04 11:31:16 +02:00
parent efd39ff55a
commit 789713fa0b
2 changed files with 86 additions and 25 deletions

View File

@@ -44,6 +44,7 @@
# define __KFUSD_H__
# include "fusd_msg.h"
# include <linux/version.h>
/* magic numbers for structure checking; unique w.r.t
* /usr/src/linux/Documentation/magic-number.txt */
@@ -125,8 +126,11 @@ struct fusd_dev_t_s {
char *dev_name;
struct CLASS *clazz;
int owns_class;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
struct class_device *device;
#else
struct device *device;
#endif
void *private_data; /* User's private data */
struct cdev* handle;
dev_t dev_id;
@@ -269,8 +273,11 @@ static void fusd_vfree(void *ptr);
/* Functions like this should be in the kernel, but they are not. Sigh. */
# ifdef CONFIG_SMP
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
DECLARE_MUTEX(atomic_ops);
#else
DEFINE_SEMAPHORE(atomic_ops);
#endif
static __inline__ int atomic_inc_and_ret(int *i)
{
int val;