Line
Link Here
|
0 |
-- rlocate-module/rlocate.c |
0 |
++ rlocate-module/rlocate.c |
Lines 60-65
Link Here
|
60 |
#else |
60 |
#else |
61 |
static struct class *rlocate_class; |
61 |
static struct class *rlocate_class; |
62 |
#endif |
62 |
#endif |
|
|
63 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
64 |
static struct rw_semaphore namespace_sem; |
65 |
#endif |
63 |
|
66 |
|
64 |
MODULE_AUTHOR("Rasto Levrinc"); |
67 |
MODULE_AUTHOR("Rasto Levrinc"); |
65 |
MODULE_DESCRIPTION("rlocate"); |
68 |
MODULE_DESCRIPTION("rlocate"); |
Lines 680-686
Link Here
|
680 |
ret = PTR_ERR(rlocate_class); |
681 |
ret = PTR_ERR(rlocate_class); |
681 |
goto no_simple_class; |
682 |
goto no_simple_class; |
682 |
} |
683 |
} |
|
|
684 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
685 |
class_device_create(rlocate_class, NULL, MKDEV(Major, 0), NULL, |
686 |
#else |
683 |
class_device_create(rlocate_class, MKDEV(Major, 0), NULL, |
687 |
class_device_create(rlocate_class, MKDEV(Major, 0), NULL, |
|
|
688 |
#endif |
684 |
DEVICE_NAME); |
689 |
DEVICE_NAME); |
685 |
// devfs |
690 |
// devfs |
686 |
devfs_mk_cdev(MKDEV(Major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVICE_NAME); |
691 |
devfs_mk_cdev(MKDEV(Major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVICE_NAME); |
Lines 835-841
Link Here
|
835 |
} |
836 |
} |
836 |
return; |
837 |
return; |
837 |
} |
838 |
} |
|
|
839 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
840 |
down_read(&namespace_sem); |
841 |
#else |
838 |
down_read(&namespace->sem); |
842 |
down_read(&namespace->sem); |
|
|
843 |
#endif |
839 |
list_for_each(head, &namespace->list) { |
844 |
list_for_each(head, &namespace->list) { |
840 |
mnt = list_entry(head, struct vfsmount, mnt_list); |
845 |
mnt = list_entry(head, struct vfsmount, mnt_list); |
841 |
if (mnt->mnt_root == sb_root) { |
846 |
if (mnt->mnt_root == sb_root) { |
Lines 848-854
Link Here
|
848 |
} |
849 |
} |
849 |
} |
850 |
} |
850 |
} |
851 |
} |
|
|
852 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
853 |
up_read(&namespace_sem); |
854 |
#else |
851 |
up_read(&namespace->sem); |
855 |
up_read(&namespace->sem); |
|
|
856 |
#endif |
852 |
dput(sb_root); |
857 |
dput(sb_root); |
853 |
} |
858 |
} |
854 |
|
859 |
|
Lines 930-935
Link Here
|
930 |
static int __init init_rlocate(void) |
931 |
static int __init init_rlocate(void) |
931 |
{ |
932 |
{ |
932 |
int ret; |
933 |
int ret; |
|
|
934 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) |
935 |
init_rwsem(&namespace_sem); |
936 |
#endif |
933 |
printk(KERN_INFO "rlocate version "RL_VERSION"\n"); |
937 |
printk(KERN_INFO "rlocate version "RL_VERSION"\n"); |
934 |
//init_waitqueue_head (&filenames_wq); |
938 |
//init_waitqueue_head (&filenames_wq); |
935 |
// register dev |
939 |
// register dev |