X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/4cf24de229090b1ab6279570a564d224e13dd706..786c7d54e8d820e89997e507c29ea716c0d55fd9:/lincan/src/proc.c diff --git a/lincan/src/proc.c b/lincan/src/proc.c index 401148e..79309e0 100644 --- a/lincan/src/proc.c +++ b/lincan/src/proc.c @@ -17,8 +17,13 @@ #include #endif +#include #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) #include +#else +#include +#endif #include #include @@ -31,7 +36,7 @@ int remove_channel_from_procdir(void); 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 @@ -45,7 +50,7 @@ struct canproc_t *base=&can_proc_base; /* 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) @@ -96,7 +101,7 @@ int can_remove_proc_entry(struct proc_dir_entry *del, struct proc_dir_entry *par */ 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 @@ -118,7 +123,7 @@ int can_delete_procdir(void) { 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 @@ -144,7 +149,7 @@ int add_channel_to_procdir(void) 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, @@ -171,7 +176,7 @@ int remove_channel_from_procdir(void) 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; @@ -210,7 +215,7 @@ int add_object_to_procdir(void) 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, @@ -258,7 +263,7 @@ int remove_object_from_procdir(void) obj=1; for (i=0; ichannel[cc]->object[i]->lnk, base->channel[cc]->object[i]->obj_entry)) return -ENODEV; @@ -277,7 +282,7 @@ int remove_object_from_procdir(void) 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;