summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/dnbd2.h4
-rw-r--r--kernel/sysfs.c19
2 files changed, 18 insertions, 5 deletions
diff --git a/kernel/dnbd2.h b/kernel/dnbd2.h
index c49c9b9..2bf0f76 100644
--- a/kernel/dnbd2.h
+++ b/kernel/dnbd2.h
@@ -12,7 +12,11 @@
#include <linux/inet.h>
#include <linux/in.h>
#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+#include <linux/semaphore.h>
+#else
#include <asm/semaphore.h>
+#endif
#include <net/sock.h>
#include "../include/dnbd2.h"
diff --git a/kernel/sysfs.c b/kernel/sysfs.c
index 2ed8174..d23fbed 100644
--- a/kernel/sysfs.c
+++ b/kernel/sysfs.c
@@ -440,14 +440,23 @@ int start_sysfs(dnbd2_device_t *dev)
int i;
char name[] = "server99";
- if (setup_kobj(&dev->kobj, "config", &dev->disk->dev.kobj, &device_ktype))
- return -1;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
+ if (setup_kobj(&dev->kobj, "config", get_disk(dev->disk), &device_ktype))
+#else
+ if (setup_kobj(&dev->kobj, "config", &dev->disk->dev.kobj, &device_ktype))
+#endif
+ return -1;
for_each_server(i) {
sprintf(name, "server%d", i);
- if (setup_kobj(&dev->servers[i].kobj, name,
- &dev->disk->dev.kobj, &server_ktype))
- goto out;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
+ if (setup_kobj(&dev->servers[i].kobj, name,
+ get_disk(dev->disk), &server_ktype))
+#else
+ if(setup_kobj(&dev-servers[i].kobj, name,
+ &dev->disk->dev.kobj, &server_ktype))
+#endif
+ goto out;
}
return 0;