#include <linux/modversions.h>
#endif
+#include <linux/version.h>
#include <linux/kernel.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include <linux/malloc.h>
+#else
+#include <linux/slab.h>
+#endif
#include <linux/proc_fs.h>
#include <linux/version.h>
int add_object_to_procdir(void);
int remove_object_from_procdir(void);
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
static int candev_readlink(struct proc_dir_entry *de, char *page);
#endif
/* The following functions are needed only for kernel version 2.2. Kernel
* version 2.4 already defines them for us.
*/
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
static void can_fill_inode(struct inode *inode, int fill)
{
if (fill)
*/
int can_init_procdir(void)
{
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
base->can_proc_entry = new_can_proc_entry(0, "can", S_IFDIR | S_IRUGO |
S_IXUGO, 0, &proc_root);
#else
{
if (remove_channel_from_procdir())
return -ENODEV;
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
if (can_remove_proc_entry(base->can_proc_entry, &proc_root))
return -ENODEV;
#else
sprintf(base->channel[cc]->ch_name, "channel%d",cc);
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
base->channel[cc]->ch_entry = new_can_proc_entry(0,
base->channel[cc]->ch_name,
S_IFDIR | S_IRUGO | S_IXUGO, 0,
while (cc != 0) {
cc--;
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
if (can_remove_proc_entry(base->channel[cc]->ch_entry,
base->can_proc_entry))
return -ENODEV;
sprintf(base->channel[cc]->object[i]->obj_name,"object%d",i);
sprintf(base->channel[cc]->object[i]->lnk_name,"dev");
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
base->channel[cc]->object[i]->obj_entry=new_can_proc_entry(
0, base->channel[cc]->object[i]->obj_name,
S_IFDIR | S_IRUGO | S_IXUGO, 0,
obj=1;
for (i=0; i<obj; i++) {
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
if (can_remove_proc_entry( base->channel[cc]->object[i]->lnk,
base->channel[cc]->object[i]->obj_entry))
return -ENODEV;
return 0;
}
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
static int candev_readlink(struct proc_dir_entry *de, char *page)
{
int i=0, nchip=0, nobj=0;