driver.​org/​avflt/​CHANGELOGdriver/​avflt/​CHANGELOG
1+version·​0.​6F·​2015-03-03
2+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
3+»   ​-·​support·​for·​-3.​19.​x·​kernels
4+
5+version·​0.​6E·​2015-02-28
6+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
7+»   ​-·​fixed·​crash·​kernel·​3.​5·​or·​lower
8+
9+version·​0.​6D·​2014-12-03
10+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
11+»   ​-·​source·​cleanup
12+
13+version·​0.​6C·​2013-08-31
14+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
15+»   ​-·​source·​cleanup
16+
17+version·​0.​6B·​2013-08-22
18+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
19+»   ​-·​fixed·​leak·​dget·​in·​avflt_get_file()​
20+
21+version·​0.​6A·​2013-05-10
22+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
23+»   ​-·​support·​for·​-3.​9.​x·​kernels
24+
1version·​0.​6·​2010-05-2025version·​0.​6·​2010-05-20
2»   ​*·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>26»   ​*·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
3»   ​-·​reflected·​changes·​in·​2.​6.​34·​kernel27»   ​-·​reflected·​changes·​in·​2.​6.​34·​kernel

driver.​org/​avflt/​avflt.​hdriver/​avflt/​avflt.​h
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
30#include·​<linux/​file.​h>32#include·​<linux/​file.​h>
31#include·​<linux/​mount.​h>33#include·​<linux/​mount.​h>
32#include·​<linux/​version.​h>34#include·​<linux/​version.​h>
35+#if·​(LINUX_VERSION_CODE·​>·​KERNEL_VERSION(2,​6,​18)​)​
33#include·​<linux/​freezer.​h>36#include·​<linux/​freezer.​h>
37+#endif
34#include·​<linux/​fs.​h>38#include·​<linux/​fs.​h>
35#include·​<linux/​slab.​h>39#include·​<linux/​slab.​h>
36-#include·​<redirfs.​h>40+#include·​<rfs.​h>
3741
38-#define·​AVFLT_VERSION»  ​"0.​6"42+#define·​AVFLT_VERSION»  ​"0.​6F"
3943
40#define·​AVFLT_EVENT_OPEN»   ​144#define·​AVFLT_EVENT_OPEN»   ​1
41#define·​AVFLT_EVENT_CLOSE»  ​245#define·​AVFLT_EVENT_CLOSE»  ​2

driver.​org/​avflt/​avflt_check.​cdriver/​avflt/​avflt_check.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
24#include·​"avflt.​h"26#include·​"avflt.​h"
2527
26DECLARE_WAIT_QUEUE_HE​AD(avflt_request_avai​lable)​;​28DECLARE_WAIT_QUEUE_HE​AD(avflt_request_avai​lable)​;​
29+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​39)​)​
27static·​spinlock_t·​avflt_request_lock·​=·​SPIN_LOCK_UNLOCKED;​30static·​spinlock_t·​avflt_request_lock·​=·​SPIN_LOCK_UNLOCKED;​
31+#else
32+static·​DEFINE_SPINLOCK(avflt​_request_lock)​;​
33+#endif
28static·​LIST_HEAD(avflt_reque​st_list)​;​34static·​LIST_HEAD(avflt_reque​st_list)​;​
29static·​int·​avflt_request_accept·​=·​0;​35static·​int·​avflt_request_accept·​=·​0;​
30-static·struct·kmem_cache·​*avflt_event_cache·​=·​NULL;​36+static·​rfs_kmem_cache_t·​*avflt_event_cache·​=·​NULL;​
31atomic_t·​avflt_cache_ver·​=·​ATOMIC_INIT(0)​;​37atomic_t·​avflt_cache_ver·​=·​ATOMIC_INIT(0)​;​
32atomic_t·​avflt_event_ids·​=·​ATOMIC_INIT(0)​;​38atomic_t·​avflt_event_ids·​=·​ATOMIC_INIT(0)​;​
3339
47»   ​atomic_set(&event->co​unt,​·​1)​;​53»   ​atomic_set(&event->co​unt,​·​1)​;​
48»   ​event->type·​=·​type;​54»   ​event->type·​=·​type;​
49»   ​event->id·​=·​-1;​55»   ​event->id·​=·​-1;​
56+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​9,​0)​)​
50»   ​event->mnt·​=·​mntget(file->f_vfsmnt​)​;​57»   ​event->mnt·​=·​mntget(file->f_vfsmnt​)​;​
51»   ​event->dentry·​=·​dget(file->f_dentry)​;​58»   ​event->dentry·​=·​dget(file->f_dentry)​;​
59+#else
60+»   ​event->mnt·​=·​mntget(file->f_path.​mnt)​;​
61+»   ​event->dentry·​=·​dget(file->f_path.​dentry)​;​
62+#endif
52»   ​event->flags·​=·​file->f_flags;​63»   ​event->flags·​=·​file->f_flags;​
53»   ​event->fd·​=·​-1;​64»   ​event->fd·​=·​-1;​
54»   ​event->pid·​=·​current->pid;​65»   ​event->pid·​=·​current->pid;​
55»   ​event->tgid·​=·​current->tgid;​66»   ​event->tgid·​=·​current->tgid;​
56»   ​event->cache·​=·​1;​67»   ​event->cache·​=·​1;​
5768
69+#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​
58»   ​root_data·​=·​avflt_get_root_data_i​node(file->f_dentry->​d_inode)​;​70»   ​root_data·​=·​avflt_get_root_data_i​node(file->f_dentry->​d_inode)​;​
59»   ​inode_data·​=·​avflt_get_inode_data_​inode(file->f_dentry-​>d_inode)​;​71»   ​inode_data·​=·​avflt_get_inode_data_​inode(file->f_dentry-​>d_inode)​;​
72+#else
73+»   ​root_data·​=·​avflt_get_root_data_i​node(file->f_path.​dentry->d_inode)​;​
74+»   ​inode_data·​=·​avflt_get_inode_data_​inode(file->f_path.​dentry->d_inode)​;​
75+#endif
6076
61»   ​if·​(root_data)​·77»   ​if·​(root_data)​·
62»   ​»   ​event->root_cache_ver​·​=·​atomic_read(&root_dat​a->cache_ver)​;​78»   ​»   ​event->root_cache_ver​·​=·​atomic_read(&root_dat​a->cache_ver)​;​
256272
257int·​avflt_get_file(struct​·​avflt_event·​*event)​273int·​avflt_get_file(struct​·​avflt_event·​*event)​
258{274{
275+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
276+#else
277+»   ​struct·​path·​path;​
278+#endif
279+
259»   ​struct·​file·​*file;​280»   ​struct·​file·​*file;​
260»   ​int·​flags;​281»   ​int·​flags;​
261»   ​int·​fd;​282»   ​int·​fd;​
283+»   ​int·​rv·​=·​0;​
262284
285+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
263»   ​fd·​=·​get_unused_fd()​;​286»   ​fd·​=·​get_unused_fd()​;​
287+#else
288+»   ​fd·​=·​get_unused_fd_flags(0​)​;​
289+#endif
290+»   ​
264»   ​if·​(fd·​<·​0)​291»   ​if·​(fd·​<·​0)​
265»   ​»   ​return·​fd;​292»   ​»   ​return·​fd;​
266293
267»   ​flags·​=·​O_RDONLY;​294»   ​flags·​=·​O_RDONLY;​
268»   ​flags·​|=·​event->flags·​&·​O_LARGEFILE;​295»   ​flags·​|=·​event->flags·​&·​O_LARGEFILE;​
269296
270-#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​29)​297+#if·(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​29)​)​
271»   ​file·​=·​dentry_open(dget(even​t->dentry)​,​·​mntget(event->mnt)​,​·​flags)​;​298»   ​file·​=·​dentry_open(dget(even​t->dentry)​,​·​mntget(event->mnt)​,​·​flags)​;​
272-#else299+#elif·(LINUX_VERSION_CODE·<·KERNEL_VERSION(3,​6,​0)​)​
273»   ​file·​=·​dentry_open(dget(even​t->dentry)​,​·​mntget(event->mnt)​,​·​flags,​300»   ​file·​=·​dentry_open(dget(even​t->dentry)​,​·​mntget(event->mnt)​,​·​flags,​
274»   ​»   ​»   ​current_cred()​)​;​301»   ​»   ​»   ​current_cred()​)​;​
302+#else
303+»   ​path.​mnt=mntget(event->mnt​)​;​
304+»   ​path.​dentry=dget(event->de​ntry)​;​
305+»   ​file·​=·​dentry_open(&path,​·​flags,​·​current_cred()​)​;​
275#endif306#endif
276-»   ​if·(IS_ERR(file)​)​·{307+
308+»   ​if·​(!IS_ERR(file)​)​{
309+»   ​»   ​event->file·​=·​file;​
310+»   ​»   ​event->fd·​=·​fd;​
311+»   ​}·​else·​{
277»   ​»   ​put_unused_fd(fd)​;​312»   ​»   ​put_unused_fd(fd)​;​
278-»   ​»   ​return·​PTR_ERR(file)​;​313+»   ​»   ​rv·=·​PTR_ERR(file)​;​
279»   ​}314»   ​}
280315
281-»   ​event->file·​=·file;​316+#if·(LINUX_VERSION_CODE·>=·KERNEL_VERSION(3,​6,​0)​)​
282-»   ​event->fd·=·fd;​317+»   ​mntput(event->mnt)​;​
318+»   ​dput(event->dentry)​;​
319+#endif
283320
284-»   ​return·0;​321+»   ​return·rv;​
285}322}
286323
287void·​avflt_put_file(struct​·​avflt_event·​*event)​324void·​avflt_put_file(struct​·​avflt_event·​*event)​
485522
486int·​avflt_check_init(void​)​523int·​avflt_check_init(void​)​
487{524{
525+»   ​/​*
488»   ​avflt_event_cache·​=·​kmem_cache_create("av​flt_event_cache",​526»   ​avflt_event_cache·​=·​kmem_cache_create("av​flt_event_cache",​
489»   ​»   ​»   ​sizeof(struct·​avflt_event)​,​527»   ​»   ​»   ​sizeof(struct·​avflt_event)​,​
490»   ​»   ​»   ​0,​·​SLAB_RECLAIM_ACCOUNT,​·​NULL)​;​528»   ​»   ​»   ​0,​·​SLAB_RECLAIM_ACCOUNT,​·​NULL)​;​
529+»   ​*/​
530+»   ​avflt_event_cache·​=·​rfs_kmem_cache_create​("avflt_event_cache",​
531+»   ​»   ​»   ​sizeof(struct·​avflt_event)​)​;​
491532
492»   ​if·​(!avflt_event_cache)​533»   ​if·​(!avflt_event_cache)​
493»   ​»   ​return·​-ENOMEM;​534»   ​»   ​return·​-ENOMEM;​

driver.​org/​avflt/​avflt_data.​cdriver/​avflt/​avflt_data.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2014·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
2325
24#include·​"avflt.​h"26#include·​"avflt.​h"
2527
26-static·struct·kmem_cache·​*avflt_inode_data_cac​he·​=·​NULL;​28+static·​rfs_kmem_cache_t·​*avflt_inode_data_cac​he·​=·​NULL;​
2729
28static·​void·​avflt_root_data_free(​struct·​redirfs_data·​*rfs_data)​30static·​void·​avflt_root_data_free(​struct·​redirfs_data·​*rfs_data)​
29{31{
220222
221int·​avflt_data_init(void)​223int·​avflt_data_init(void)​
222{224{
225+»   ​/​*
223»   ​avflt_inode_data_cach​e·​=·​kmem_cache_create("av​flt_inode_data_cache"​,​226»   ​avflt_inode_data_cach​e·​=·​kmem_cache_create("av​flt_inode_data_cache"​,​
224»   ​»   ​»   ​sizeof(struct·​avflt_inode_data)​,​227»   ​»   ​»   ​sizeof(struct·​avflt_inode_data)​,​
225»   ​»   ​»   ​0,​·​SLAB_RECLAIM_ACCOUNT,​·​NULL)​;​228»   ​»   ​»   ​0,​·​SLAB_RECLAIM_ACCOUNT,​·​NULL)​;​
229+»   ​*/​
230+»   ​avflt_inode_data_cach​e·​=·​rfs_kmem_cache_create​("avflt_inode_data_ca​che",​
231+»   ​»   ​»   ​sizeof(struct·​avflt_inode_data)​)​;​
226232
227»   ​if·​(!avflt_inode_data_ca​che)​233»   ​if·​(!avflt_inode_data_ca​che)​
228»   ​»   ​return·​-ENOMEM;​234»   ​»   ​return·​-ENOMEM;​

driver.​org/​avflt/​avflt_dev.​cdriver/​avflt/​avflt_dev.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2014·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
110»   ​avflt_install_fd(even​t)​;​112»   ​avflt_install_fd(even​t)​;​
111»   ​avflt_event_put(event​)​;​113»   ​avflt_event_put(event​)​;​
112»   ​return·​len;​114»   ​return·​len;​
115+
113error:​116error:​
114»   ​avflt_put_file(event)​;​117»   ​avflt_put_file(event)​;​
115»   ​avflt_readd_request(e​vent)​;​118»   ​avflt_readd_request(e​vent)​;​
170»   ​»   ​return·​PTR_ERR(avflt_class)​;​173»   ​»   ​return·​PTR_ERR(avflt_class)​;​
171»   ​}174»   ​}
172175
173-#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​27)​176+#if·(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​27)​)​
174»   ​avflt_device·​=·​device_create(avflt_c​lass,​·​NULL,​·​avflt_dev,​·​"avflt")​;​177»   ​avflt_device·​=·​device_create(avflt_c​lass,​·​NULL,​·​avflt_dev,​·​"avflt")​;​
175#else178#else
176»   ​avflt_device·​=·​device_create(avflt_c​lass,​·​NULL,​·​avflt_dev,​·​NULL,​·​"avflt")​;​179»   ​avflt_device·​=·​device_create(avflt_c​lass,​·​NULL,​·​avflt_dev,​·​NULL,​·​"avflt")​;​

driver.​org/​avflt/​avflt_mod.​cdriver/​avflt/​avflt_mod.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2014·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
47»   ​if·​(rv)​49»   ​if·​(rv)​
48»   ​»   ​goto·​err_sys;​50»   ​»   ​goto·​err_sys;​
4951
50-»   ​printk(KERN_INFO·​"Anti-Virus·​Filter·​Version·​"52+»   ​printk(KERN_INFO·​"Anti-Virus·​Filter·​Version·"·AVFLT_VERSION·"·<www.​redirfs.​org>\n")​;​
51-»   ​»   ​»   ​AVFLT_VERSION·​"·<www.​redirfs.​org>\n")​;​53+»   ​printk(KERN_INFO·​"Midified·by·KINTA-JAPAN\n")​;​
52»   ​return·​0;​54»   ​return·​0;​
5355
54err_sys:​56err_sys:​
7678
77MODULE_LICENSE("GPL")​;​79MODULE_LICENSE("GPL")​;​
78MODULE_AUTHOR("Franti​sek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>")​;​80MODULE_AUTHOR("Franti​sek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>")​;​
81+MODULE_AUTHOR("KINTA-​JAPAN·​<sanu@ruby.​plala.​or.​jp>")​;​
79MODULE_DESCRIPTION("A​nti-Virus·​Filter·​for·​the·​RedirFS·​Framework")​;​82MODULE_DESCRIPTION("A​nti-Virus·​Filter·​for·​the·​RedirFS·​Framework")​;​
8083

driver.​org/​avflt/​avflt_proc.​cdriver/​avflt/​avflt_proc.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2014·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
24#include·​"avflt.​h"26#include·​"avflt.​h"
2527
26static·​LIST_HEAD(avflt_proc_​list)​;​28static·​LIST_HEAD(avflt_proc_​list)​;​
27-static·spinlock_t·avflt_proc_lock·=·SPIN_LOCK_UNLOCKED;​29+static·DEFINE_SPINLOCK(avflt​_proc_lock)​;​
2830
29static·​LIST_HEAD(avflt_trust​ed_list)​;​31static·​LIST_HEAD(avflt_trust​ed_list)​;​
30-static·spinlock_t·avflt_trusted_lock·=·SPIN_LOCK_UNLOCKED;​32+static·DEFINE_SPINLOCK(avflt​_trusted_lock)​;​
3133
32static·​struct·​avflt_trusted·​*avflt_trusted_alloc(​pid_t·​tgid)​34static·​struct·​avflt_trusted·​*avflt_trusted_alloc(​pid_t·​tgid)​
33{35{

driver.​org/​avflt/​avflt_rfs.​cdriver/​avflt/​avflt_rfs.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2014·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
3335
34»   ​if·​(avflt_trusted_allow(​current->tgid)​)​36»   ​if·​(avflt_trusted_allow(​current->tgid)​)​
35»   ​»   ​return·​0;​37»   ​»   ​return·​0;​
36-»   ​38+
39+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
37»   ​if·​(!file->f_dentry->d_i​node)​40»   ​if·​(!file->f_dentry->d_i​node)​
38»   ​»   ​return·​0;​41»   ​»   ​return·​0;​
3942
40»   ​if·​(!i_size_read(file->f​_dentry->d_inode)​)​43»   ​if·​(!i_size_read(file->f​_dentry->d_inode)​)​
41»   ​»   ​return·​0;​44»   ​»   ​return·​0;​
45+#else
46+»   ​if·​(!file->f_path.​dentry->d_inode)​
47+»   ​»   ​return·​0;​
48+
49+»   ​if·​(!i_size_read(file->f​_path.​dentry->d_inode)​)​
50+»   ​»   ​return·​0;​
51+#endif
4252
43»   ​return·​1;​53»   ​return·​1;​
44}54}
53»   ​if·​(!atomic_read(&avflt_​cache_enabled)​)​63»   ​if·​(!atomic_read(&avflt_​cache_enabled)​)​
54»   ​»   ​return·​0;​64»   ​»   ​return·​0;​
5565
66+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
56»   ​root_data·​=·​avflt_get_root_data_i​node(file->f_dentry->​d_inode)​;​67»   ​root_data·​=·​avflt_get_root_data_i​node(file->f_dentry->​d_inode)​;​
68+#else
69+»   ​root_data·​=·​avflt_get_root_data_i​node(file->f_path.​dentry->d_inode)​;​
70+#endif
71+
57»   ​if·​(!root_data)​72»   ​if·​(!root_data)​
58»   ​»   ​return·​0;​73»   ​»   ​return·​0;​
5974
62»   ​»   ​return·​0;​77»   ​»   ​return·​0;​
63»   ​}78»   ​}
6479
80+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
65»   ​inode_data·​=·​avflt_get_inode_data_​inode(file->f_dentry-​>d_inode)​;​81»   ​inode_data·​=·​avflt_get_inode_data_​inode(file->f_dentry-​>d_inode)​;​
82+#else
83+»   ​inode_data·​=·​avflt_get_inode_data_​inode(file->f_path.​dentry->d_inode)​;​
84+#endif
85+
66»   ​if·​(!inode_data)​·​{86»   ​if·​(!inode_data)​·​{
67»   ​»   ​avflt_put_root_data(r​oot_data)​;​87»   ​»   ​avflt_put_root_data(r​oot_data)​;​
68»   ​»   ​return·​0;​88»   ​»   ​return·​0;​
69»   ​}89»   ​}
7090
91+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
71»   ​wc·​=·​atomic_read(&file->f_​dentry->d_inode->i_wr​itecount)​;​92»   ​wc·​=·​atomic_read(&file->f_​dentry->d_inode->i_wr​itecount)​;​
93+#else
94+»   ​wc·​=·​atomic_read(&file->f_​path.​dentry->d_inode->i_wr​itecount)​;​
95+#endif
7296
73»   ​spin_lock(&inode_data​->lock)​;​97»   ​spin_lock(&inode_data​->lock)​;​
7498

driver.​org/​avflt/​avflt_sysfs.​cdriver/​avflt/​avflt_sysfs.​c
1/​*1/​*
2·​*·​AVFlt:​·​Anti-Virus·​Filter2·​*·​AVFlt:​·​Anti-Virus·​Filter
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​

driver.​org/​dazuko/​CHANGELOGdriver/​dazuko/​CHANGELOG
2Dazuko·​CHANGELOG2Dazuko·​CHANGELOG
3================3================
44
5+2.​3.​9B
6+··​Bug·​Fix·​locked_ioctl·​(int·​->·​long)​
7+
8+
9+2.​3.​9A
10+-·​Support·​Linux·​Kernel·​-3.​9·​(Redirfs·​Only)​
11+
12+
52.​3.​9132.​3.​9
6-·​integrate·​patch·​from·​Jaroslav·​Suchanek·​for·​FreeBSD·​8·​support14-·​integrate·​patch·​from·​Jaroslav·​Suchanek·​for·​FreeBSD·​8·​support
715

driver.​org/​dazuko/​configuredriver/​dazuko/​configure
116»   ​then116»   ​then
117»   ​»   ​echo·​-n·​"kernel·​build·​source·​in·​${LINUX_CHECK_OBJ}.​.​.​·​"117»   ​»   ​echo·​-n·​"kernel·​build·​source·​in·​${LINUX_CHECK_OBJ}.​.​.​·​"
118118
119-»   ​»   ​if·​[·​-f·​"${LINUX_CHECK_OBJ}/​include/​linux/​version.​h"·​]119+#»  ​»   ​if·​[·​-f·​"${LINUX_CHECK_OBJ}/​include/​linux/​version.​h"·​]
120-»   ​»   ​then120+#»  ​»   ​then
121-»   ​»   ​»   ​if·​[·​-f·​"${LINUX_CHECK_OBJ}/​include/​linux/​autoconf.​h"·​-o·​-f·​"${LINUX_CHECK_OBJ}/​include/​generated/​autoconf.​h"·​]121+#»  ​»   ​»   ​if·​[·​-f·​"${LINUX_CHECK_OBJ}/​include/​linux/​autoconf.​h"·​-o·​-f·​"${LINUX_CHECK_OBJ}/​include/​generated/​autoconf.​h"·​]
122-»   ​»   ​»   ​then122+#»  ​»   ​»   ​then
123»   ​»   ​»   ​»   ​LINUX_OBJ="$LINUX_CHE​CK_OBJ"123»   ​»   ​»   ​»   ​LINUX_OBJ="$LINUX_CHE​CK_OBJ"
124»   ​»   ​»   ​»   ​echo·​"yes"124»   ​»   ​»   ​»   ​echo·​"yes"
125-»   ​»   ​»   ​else125+#»  ​»   ​»   ​else
126-»   ​»   ​»   ​»   ​echo·​"no"126+#»  ​»   ​»   ​»   ​echo·​"no"
127-»   ​»   ​»   ​fi127+#»  ​»   ​»   ​fi
128-»   ​»   ​else128+#»  ​»   ​else
129-»   ​»   ​»   ​echo·​"no"129+#»  ​»   ​»   ​echo·​"no"
130-»   ​»   ​fi130+#»  ​»   ​fi
131»   ​fi131»   ​fi
132}132}
133133

driver.​org/​dazuko/​dazuko_core.​cdriver/​dazuko/​dazuko_core.​c
44const·​char»   ​*DAZUKO_VERSION_STAMP​·​=·​"\nDazukoVersion="·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON·​".​"·​DAZUKO_VERSION_RELEAS​E·​"\n";​44const·​char»   ​*DAZUKO_VERSION_STAMP​·​=·​"\nDazukoVersion="·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON·​".​"·​DAZUKO_VERSION_RELEAS​E·​"\n";​
4545
46/​*·​version·​string·​for·​display·​*/​46/​*·​version·​string·​for·​display·​*/​
47-const·​char»   ​*VERSION_STRING·​=·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON47+const·​char»   ​*VERSION_STRING·​=·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON·".​"·DAZUKO_VERSION_RELEAS​E
48#ifdef·​DAZUKO_PRERELEASE48#ifdef·​DAZUKO_PRERELEASE
49"-pre"·​DAZUKO_VERSION_RELEAS​E49"-pre"·​DAZUKO_VERSION_RELEAS​E
50#endif50#endif

driver.​org/​dazuko/​dazuko_redirfs.​cdriver/​dazuko/​dazuko_redirfs.​c
43#endif43#endif
44#include·​<asm/​uaccess.​h>44#include·​<asm/​uaccess.​h>
4545
46+#include·​<linux/​slab.​h>
4647
47#ifndef·​DAZUKO_DM48#ifndef·​DAZUKO_DM
48#define·​DAZUKO_DM·​049#define·​DAZUKO_DM·​0
49#endif50#endif
5051
51-
52ssize_t·​linux_dazuko_device_r​ead(struct·​file·​*,​·​char·​__user·​*,​·​size_t,​·​loff_t·​*)​;​52ssize_t·​linux_dazuko_device_r​ead(struct·​file·​*,​·​char·​__user·​*,​·​size_t,​·​loff_t·​*)​;​
53ssize_t·​linux_dazuko_device_w​rite(struct·​file·​*,​·​const·​char·​__user·​*,​·​size_t,​·​loff_t·​*)​;​53ssize_t·​linux_dazuko_device_w​rite(struct·​file·​*,​·​const·​char·​__user·​*,​·​size_t,​·​loff_t·​*)​;​
54int·​linux_dazuko_device_o​pen(struct·​inode·​*,​·​struct·​file·​*)​;​54int·​linux_dazuko_device_o​pen(struct·​inode·​*,​·​struct·​file·​*)​;​
55+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​36)​)​
55int·​linux_dazuko_device_i​octl(struct·​inode·​*inode,​·​struct·​file·​*file,​·​unsigned·​int·​cmd,​·​unsigned·​long·​param)​;​56int·​linux_dazuko_device_i​octl(struct·​inode·​*inode,​·​struct·​file·​*file,​·​unsigned·​int·​cmd,​·​unsigned·​long·​param)​;​
57+#else
58+long·​linux_dazuko_device_i​octl(struct·​file·​*file,​·​unsigned·​int·​cmd,​·​unsigned·​long·​param)​;​
59+#endif
56int·​linux_dazuko_device_r​elease(struct·​inode·​*,​·​struct·​file·​*)​;​60int·​linux_dazuko_device_r​elease(struct·​inode·​*,​·​struct·​file·​*)​;​
5761
58#ifndef·​WITHOUT_UDEV62#ifndef·​WITHOUT_UDEV
86»   ​»   ​.​owner»  ​»   ​=·​THIS_MODULE,​90»   ​»   ​.​owner»  ​»   ​=·​THIS_MODULE,​
87»   ​»   ​.​read»   ​»   ​=·​linux_dazuko_device_r​ead,​91»   ​»   ​.​read»   ​»   ​=·​linux_dazuko_device_r​ead,​
88»   ​»   ​.​write»  ​»   ​=·​linux_dazuko_device_w​rite,​92»   ​»   ​.​write»  ​»   ​=·​linux_dazuko_device_w​rite,​
93+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​36)​)​
89»   ​»   ​.​ioctl»  ​»   ​=·​linux_dazuko_device_i​octl,​94»   ​»   ​.​ioctl»  ​»   ​=·​linux_dazuko_device_i​octl,​
95+#else
96+»   ​»   ​.​unlocked_ioctl» ​=·​linux_dazuko_device_i​octl,​
97+#endif
90»   ​»   ​.​open»   ​»   ​=·​linux_dazuko_device_o​pen,​98»   ​»   ​.​open»   ​»   ​=·​linux_dazuko_device_o​pen,​
91»   ​»   ​.​release»​=·​linux_dazuko_device_r​elease,​99»   ​»   ​.​release»​=·​linux_dazuko_device_r​elease,​
92»   ​};​100»   ​};​
96104
97inline·​void·​xp_init_mutex(struct·​xp_mutex·​*mutex)​105inline·​void·​xp_init_mutex(struct·​xp_mutex·​*mutex)​
98{106{
107+
108+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​37)​)​
99»   ​init_MUTEX(&(mutex->m​utex)​)​;​109»   ​init_MUTEX(&(mutex->m​utex)​)​;​
110+#else
111+»   ​sema_init(&(mutex->mu​tex)​,​·​1)​;​
112+#endif
100}113}
101114
102inline·​void·​xp_down(struct·​xp_mutex·​*mutex)​115inline·​void·​xp_down(struct·​xp_mutex·​*mutex)​
594»   ​int·​err·​=·​0;​607»   ​int·​err·​=·​0;​
595»   ​struct·​redirfs_path_info·​path_info;​608»   ​struct·​redirfs_path_info·​path_info;​
596»   ​redirfs_path·​rfs_path;​609»   ​redirfs_path·​rfs_path;​
610+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​39)​)​
597»   ​struct·​nameidata·​nd;​611»   ​struct·​nameidata·​nd;​
612+#else
613+»   ​struct·​path·​_path;​
614+#endif
598615
599»   ​switch·​(type)​616»   ​switch·​(type)​
600»   ​{617»   ​{
610»   ​»   ​»   ​return·​-1;​627»   ​»   ​»   ​return·​-1;​
611»   ​}628»   ​}
612629
630+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​39)​)​
613»   ​if·​(path_lookup(path,​·​LOOKUP_FOLLOW·​|·​LOOKUP_DIRECTORY,​·​&nd)​·​!=·​0)​631»   ​if·​(path_lookup(path,​·​LOOKUP_FOLLOW·​|·​LOOKUP_DIRECTORY,​·​&nd)​·​!=·​0)​
614»   ​»   ​return·​-1;​632»   ​»   ​return·​-1;​
633+#else
634+»   ​if·​(kern_path(path,​·​LOOKUP_FOLLOW·​|·​LOOKUP_DIRECTORY,​·​&_path)​!=0)​
635+»   ​»   ​return·​-1;​
636+#endif
615637
638+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​39)​)​
616»   ​path_info.​dentry·​=·​nd.​path.​dentry;​639»   ​path_info.​dentry·​=·​nd.​path.​dentry;​
617»   ​path_info.​mnt·​=·​nd.​path.​mnt;​640»   ​path_info.​mnt·​=·​nd.​path.​mnt;​
641+#else
642+»   ​path_info.​dentry·​=·​_path.​dentry;​
643+»   ​path_info.​mnt·​=·​_path.​mnt;​
644+#endif
645+
618»   ​rfs_path·​=·​redirfs_add_path(dazu​koflt,​·​&path_info)​;​646»   ​rfs_path·​=·​redirfs_add_path(dazu​koflt,​·​&path_info)​;​
619»   ​if·​(IS_ERR(rfs_path)​)​·​{647»   ​if·​(IS_ERR(rfs_path)​)​·​{
620»   ​»   ​xp_print("dazuko:​·​failed·​to·​set·​RedirFS·​path,​·​err=%d\n",​·​err)​;​648»   ​»   ​xp_print("dazuko:​·​failed·​to·​set·​RedirFS·​path,​·​err=%d\n",​·​err)​;​
621»   ​»   ​err·​=·​-1;​649»   ​»   ​err·​=·​-1;​
622»   ​}650»   ​}
623651
652+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​39)​)​
624»   ​path_put(&nd.​path)​;​653»   ​path_put(&nd.​path)​;​
654+#else
655+»   ​path_put(&_path)​;​
656+#endif
657+
625»   ​redirfs_put_path(rfs_​path)​;​658»   ​redirfs_put_path(rfs_​path)​;​
626659
627»   ​return·​err;​660»   ​return·​err;​
702{735{
703»   ​struct·​nameidata·​nd;​736»   ​struct·​nameidata·​nd;​
704737
738+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​9,​0)​)​
705»   ​nd.​path.​dentry·​=·​args->args.​f_open.​file->f_dentry;​739»   ​nd.​path.​dentry·​=·​args->args.​f_open.​file->f_dentry;​
706»   ​nd.​path.​mnt·​=·​args->args.​f_open.​file->f_vfsmnt;​740»   ​nd.​path.​mnt·​=·​args->args.​f_open.​file->f_vfsmnt;​
741+#else
742+»   ​nd.​path.​dentry·​=·​args->args.​f_open.​file->f_path.​dentry;​
743+»   ​nd.​path.​mnt·​=·​args->args.​f_open.​file->f_path.​mnt;​
744+#endif
707745
708»   ​if·​(dazuko_sys_generic(a​rgs->args.​f_open.​file->f_dentry->d_ino​de,​·​&nd)​·​!=·​0)​746»   ​if·​(dazuko_sys_generic(a​rgs->args.​f_open.​file->f_dentry->d_ino​de,​·​&nd)​·​!=·​0)​
709»   ​{747»   ​{
910»   ​return·​XP_ERROR_INTERRUPT;​948»   ​return·​XP_ERROR_INTERRUPT;​
911}949}
912950
951+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​36)​)​
913int·​linux_dazuko_device_i​octl(struct·​inode·​*inode,​·​struct·​file·​*file,​·​unsigned·​int·​cmd,​·​unsigned·​long·​param)​952int·​linux_dazuko_device_i​octl(struct·​inode·​*inode,​·​struct·​file·​*file,​·​unsigned·​int·​cmd,​·​unsigned·​long·​param)​
953+#else
954+long·​linux_dazuko_device_i​octl(struct·​file·​*file,​·​unsigned·​int·​cmd,​·​unsigned·​long·​param)​
955+#endif
914{956{
915»   ​/​*·​A·​daemon·​uses·​this·​function·​to·​interact·​with957»   ​/​*·​A·​daemon·​uses·​this·​function·​to·​interact·​with
916»   ​·​*·​the·​kernel.​·​A·​daemon·​can·​set·​scanning·​parameters,​958»   ​·​*·​the·​kernel.​·​A·​daemon·​can·​set·​scanning·​parameters,​

driver.​org/​dazuko/​dazuko_version.​hdriver/​dazuko/​dazuko_version.​h
39#define·​DAZUKO_VERSION_MAJOR»   ​»   ​"2"39#define·​DAZUKO_VERSION_MAJOR»   ​»   ​"2"
40#define·​DAZUKO_VERSION_MINOR»   ​»   ​"3"40#define·​DAZUKO_VERSION_MINOR»   ​»   ​"3"
41#define·​DAZUKO_VERSION_REVISI​ON» ​»   ​"9"41#define·​DAZUKO_VERSION_REVISI​ON» ​»   ​"9"
42-#define·​DAZUKO_VERSION_RELEAS​E»  ​»   ​"2"42+#define·​DAZUKO_VERSION_RELEAS​E»  ​»   ​"B"
4343
44/​*·​this·​must·​be·​defined·​for·​all·​pre-release·​versions·​*/​44/​*·​this·​must·​be·​defined·​for·​all·​pre-release·​versions·​*/​
45/​*·​#define·​DAZUKO_PRERELEASE·​*/​45/​*·​#define·​DAZUKO_PRERELEASE·​*/​

driver.​org/​dazuko/​dazukoio_core.​cdriver/​dazuko/​dazukoio_core.​c
49const·​char»   ​*DAZUKO_VERSION_STAMP​·​=·​"\nDazukoVersion="·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON·​".​"·​DAZUKO_VERSION_RELEAS​E·​"\n";​49const·​char»   ​*DAZUKO_VERSION_STAMP​·​=·​"\nDazukoVersion="·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON·​".​"·​DAZUKO_VERSION_RELEAS​E·​"\n";​
5050
51/​*·​version·​string·​for·​display·​*/​51/​*·​version·​string·​for·​display·​*/​
52-const·​char»   ​*VERSION_STRING·​=·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON52+const·​char»   ​*VERSION_STRING·​=·​DAZUKO_VERSION_MAJOR·​".​"·​DAZUKO_VERSION_MINOR·​".​"·​DAZUKO_VERSION_REVISI​ON·".​"·DAZUKO_VERSION_RELEAS​E
53#ifdef·​DAZUKO_PRERELEASE53#ifdef·​DAZUKO_PRERELEASE
54"-pre"·​DAZUKO_VERSION_RELEAS​E54"-pre"·​DAZUKO_VERSION_RELEAS​E
55#endif55#endif

driver.​org/​redirfs/​CHANGELOGdriver/​redirfs/​CHANGELOG
1+version·​0.​11·​experimental-12A·​2015-03-07
2+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
3+»   ​··​fixed·​build·​error·​any·​kernel
4+
5+version·​0.​11·​experimental-12·​2015-03-03
6+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
7+»   ​-·​support·​for·​-3.​19.​x·​kernels
8+
9+version·​0.​11·​experimental-11A·​2015-02-01
10+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
11+»   ​··​Update·​rfs_dcache_get_subs_m​utex()​
12+»   ​··​fixed·​build·​error·​kernel·​3.​2
13+
14+version·​0.​11·​experimental-11·​2015-01-14
15+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
16+»   ​-·​support·​for·​-3.​18.​x·​kernels
17+
18+version·​0.​11·​experimental-10C·​2014-12-03
19+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
20+»   ​-·​source·​cleanup
21+»   ​··​Update·​rfs_rename/​rfs_rename2
22+
23+version·​0.​11·​experimental-10·​2014-11-21
24+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
25+»   ​-·​support·​for·​-3.​17.​x·​kernels
26+
27+version·​0.​11·​experimental-9·​2014-03-23
28+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
29+»   ​-·​support·​for·​-3.​13.​x·​kernels
30+
31+version·​0.​11·​experimental-8·​2013-09-22
32+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
33+»   ​-·​bug·​fix·​error·​handling
34+
35+version·​0.​11·​experimental-7·​2013-09-07
36+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
37+»   ​-·​support·​for·​-3.​11.​x·​kernels
38+
39+version·​0.​11·​experimental-6·​2013-08-31
40+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
41+»   ​-·​source·​cleanup
42+
43+version·​0.​11·​experimental-5·​2013-07-09
44+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
45+»   ​-·​support·​for·​-3.​10.​x·​kernels
46+
47+version·​0.​11·​experimental-4·​2013-07-07
48+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
49+»   ​-·​bug·​fix·​(rv_int·​not·​defined)​
50+»   ​-·​Bug·​fix·​(kernel·​panic)​
51+
52+version·​0.​11·​experimental-3·​2013-06-08
53+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
54+»   ​-·​bug·​fix·​(to·​many·​dput·​calls)​
55+
56+version·​0.​11·​experimental-2·​2013-05-10
57+»   ​*·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jp>
58+»   ​-·​support·​for·​-3.​9.​x·​kernels
59+
60+version·​0.​11·​experimental·​2011-09-05
61+»   ​*·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
62+»   ​-·​added·​pre_rename·​and·​post_rename·​callback·​to·​redirfs_filter_operat​ions
63+»   ​»   ​-·​this·​can·​be·​used·​by·​filter·​to·​be·​notified·​about·​files·​moved
64+»   ​»   ​··​inside·​a·​filter's·​path·​within·​one·​file·​system
65+»   ​-·​support·​for·​2.​6.​38+·​kernels
66+»   ​-·​redirfs_get_filename·​is·​now·​just·​a·​simple·​wrapper·​around·​d_path·​and·​it
67+»   ​··​returns·​a·​filename·​just·​for·​the·​first·​mount·​point.​
68+
1version·​0.​10·​2010-05-2069version·​0.​10·​2010-05-20
2»   ​*·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>70»   ​*·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
3»   ​-·​reflected·​changes·​in·​2.​6.​34·​kernel71»   ​-·​reflected·​changes·​in·​2.​6.​34·​kernel

driver.​org/​redirfs/​redirfs.​hdriver/​redirfs/​redirfs.​h
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
34#include·​<linux/​aio.​h>36#include·​<linux/​aio.​h>
35#include·​<linux/​version.​h>37#include·​<linux/​version.​h>
3638
37-#define·​REDIRFS_VERSION·​"0.​10"39+#define·​REDIRFS_VERSION·​"0.​11·EXPERIMENTAL-12A"
3840
39#define·​REDIRFS_PATH_INCLUDE»   ​»   ​141#define·​REDIRFS_PATH_INCLUDE»   ​»   ​1
40#define·​REDIRFS_PATH_EXCLUDE»   ​»   ​242#define·​REDIRFS_PATH_EXCLUDE»   ​»   ​2
149151
150»   ​REDIRFS_DIR_FOP_OPEN,​152»   ​REDIRFS_DIR_FOP_OPEN,​
151»   ​REDIRFS_DIR_FOP_RELEA​SE,​153»   ​REDIRFS_DIR_FOP_RELEA​SE,​
154+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
152»   ​REDIRFS_DIR_FOP_READD​IR,​155»   ​REDIRFS_DIR_FOP_READD​IR,​
156+#else
157+»   ​REDIRFS_DIR_FOP_ITERA​TE,​
158+#endif
153»   ​/​*·​REDIRFS_DIR_FOP_FLUSH​,​·​*/​159»   ​/​*·​REDIRFS_DIR_FOP_FLUSH​,​·​*/​
154160
155»   ​REDIRFS_CHR_FOP_OPEN,​161»   ​REDIRFS_CHR_FOP_OPEN,​
236union·​redirfs_op_args·​{242union·​redirfs_op_args·​{
237»   ​struct·​{243»   ​struct·​{
238»   ​»   ​struct·​dentry·​*dentry;​244»   ​»   ​struct·​dentry·​*dentry;​
245+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
239»   ​»   ​struct·​nameidata·​*nd;​246»   ​»   ​struct·​nameidata·​*nd;​
247+#else
248+»   ​»   ​unsigned·​int·​flags;​
249+#endif
240»   ​}·​d_revalidate;​»   ​250»   ​}·​d_revalidate;​»   ​
241251
242»   ​/​*252»   ​/​*
246»   ​}·​d_hash;​256»   ​}·​d_hash;​
247»   ​*/​257»   ​*/​
248258
259+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​38)​)​
249»   ​struct·​{260»   ​struct·​{
250»   ​»   ​struct·​dentry·​*dentry;​261»   ​»   ​struct·​dentry·​*dentry;​
251»   ​»   ​struct·​qstr·​*name1;​262»   ​»   ​struct·​qstr·​*name1;​
252»   ​»   ​struct·​qstr·​*name2;​263»   ​»   ​struct·​qstr·​*name2;​
253»   ​}·​d_compare;​264»   ​}·​d_compare;​
265+#else
266+»   ​struct·​{
267+»   ​»   ​const·​struct·​dentry·​*parent;​
268+»   ​»   ​const·​struct·​dentry·​*dentry;​
269+
270+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
271+»   ​»   ​const·​struct·​inode·​*inode;​
272+»   ​»   ​const·​struct·​inode·​*d_inode;​
273+#endif
274+»   ​»   ​unsigned·​int·​tlen;​
275+»   ​»   ​const·​char·​*tname;​
276+»   ​»   ​const·​struct·​qstr·​*name;​
277+»   ​}·​d_compare;​
278+#endif
254279
255»   ​/​*280»   ​/​*
256»   ​struct·​{281»   ​struct·​{
270»   ​struct·​{295»   ​struct·​{
271»   ​»   ​struct·​inode·​*dir;​296»   ​»   ​struct·​inode·​*dir;​
272»   ​»   ​struct·​dentry·​*dentry;​297»   ​»   ​struct·​dentry·​*dentry;​
298+#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​3,​0)​
273»   ​»   ​int·​mode;​299»   ​»   ​int·​mode;​
300+#else
301+»   ​»   ​umode_t·​mode;​
302+#endif
303+
304+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
274»   ​»   ​struct·​nameidata·​*nd;​305»   ​»   ​struct·​nameidata·​*nd;​
306+#else
307+»   ​»   ​bool·​flags;​
308+#endif
275»   ​}·​i_create;​309»   ​}·​i_create;​
276310
277»   ​struct·​{311»   ​struct·​{
278»   ​»   ​struct·​inode·​*dir;​312»   ​»   ​struct·​inode·​*dir;​
279»   ​»   ​struct·​dentry·​*dentry;​313»   ​»   ​struct·​dentry·​*dentry;​
314+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
280»   ​»   ​struct·​nameidata·​*nd;​315»   ​»   ​struct·​nameidata·​*nd;​
316+#else
317+»   ​»   ​unsigned·​int·​flags;​
318+#endif
281»   ​}·​i_lookup;​319»   ​}·​i_lookup;​
282320
283»   ​struct·​{321»   ​struct·​{
300»   ​struct·​{338»   ​struct·​{
301»   ​»   ​struct·​inode·​*dir;​339»   ​»   ​struct·​inode·​*dir;​
302»   ​»   ​struct·​dentry·​*dentry;​340»   ​»   ​struct·​dentry·​*dentry;​
341+#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​3,​0)​
303»   ​»   ​int·​mode;​342»   ​»   ​int·​mode;​
343+#else
344+»   ​»   ​umode_t·​mode;​
345+#endif
304»   ​}·​i_mkdir;​346»   ​}·​i_mkdir;​
305347
306»   ​struct·​{348»   ​struct·​{
311»   ​struct·​{353»   ​struct·​{
312»   ​»   ​struct·​inode·​*dir;​354»   ​»   ​struct·​inode·​*dir;​
313»   ​»   ​struct·​dentry·​*dentry;​355»   ​»   ​struct·​dentry·​*dentry;​
356+#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​·​3,​·​0)​
314»   ​»   ​int·​mode;​357»   ​»   ​int·​mode;​
358+#else
359+»   ​»   ​umode_t·​mode;​
360+#endif
315»   ​»   ​dev_t·​rdev;​361»   ​»   ​dev_t·​rdev;​
316»   ​}·​i_mknod;​362»   ​}·​i_mknod;​
317363
320»   ​»   ​struct·​dentry·​*old_dentry;​366»   ​»   ​struct·​dentry·​*old_dentry;​
321»   ​»   ​struct·​inode·​*new_dir;​367»   ​»   ​struct·​inode·​*new_dir;​
322»   ​»   ​struct·​dentry·​*new_dentry;​368»   ​»   ​struct·​dentry·​*new_dentry;​
369+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​15,​0)​)​
370+»   ​»   ​unsigned·​int·​flags;​
371+#endif
323»   ​}·​i_rename;​372»   ​}·​i_rename;​
324373
325#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​27)​374#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​27)​
328»   ​»   ​int·​mask;​377»   ​»   ​int·​mask;​
329»   ​»   ​struct·​nameidata·​*nd;​378»   ​»   ​struct·​nameidata·​*nd;​
330»   ​}·​i_permission;​379»   ​}·​i_permission;​
380+#elif·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​38)​
381+»   ​struct·​{
382+»   ​»   ​struct·​inode·​*inode;​
383+»   ​»   ​int·​mask;​
384+»   ​}·​i_permission;​
385+#elif·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​1,​0)​
386+»   ​struct·​{
387+»   ​»   ​struct·​inode·​*inode;​
388+»   ​»   ​int·​mask;​
389+»   ​»   ​unsigned·​int·​flags;​
390+»   ​}·​i_permission;​
331#else391#else
332»   ​struct·​{392»   ​struct·​{
333»   ​»   ​struct·​inode·​*inode;​393»   ​»   ​struct·​inode·​*inode;​
364»   ​}·​f_mmap;​424»   ​}·​f_mmap;​
365»   ​*/​425»   ​*/​
366426
427+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
367»   ​struct·​{428»   ​struct·​{
368»   ​»   ​struct·​file·​*file;​429»   ​»   ​struct·​file·​*file;​
369»   ​»   ​void·​*dirent;​430»   ​»   ​void·​*dirent;​
370»   ​»   ​filldir_t·​filldir;​431»   ​»   ​filldir_t·​filldir;​
371»   ​}·​f_readdir;​432»   ​}·​f_readdir;​
433+#else
434+»   ​struct·​{
435+»   ​»   ​struct·​file·​*file;​
436+»   ​»   ​struct·​dir_context·​*dir_context;​
437+»   ​}·​f_iterate;​
438+#endif
372439
373»   ​/​*440»   ​/​*
374»   ​struct·​{441»   ​struct·​{
552};​619};​
553620
554struct·​redirfs_filter_operat​ions·​{621struct·​redirfs_filter_operat​ions·​{
555-»   ​·int·​(*activate)​(void)​;​622+»   ​int·​(*activate)​(void)​;​
556-»   ​·int·​(*deactivate)​(void)​;​623+»   ​int·​(*deactivate)​(void)​;​
557-»   ​·int·​(*add_path)​(struct·​redirfs_path_info·​*)​;​624+»   ​int·​(*add_path)​(struct·​redirfs_path_info·​*)​;​
558-»   ​·int·​(*rem_path)​(redirfs_path)​;​625+»   ​int·​(*rem_path)​(redirfs_path)​;​
559-»   ​·int·​(*unregister)​(void)​;​626+»   ​int·​(*unregister)​(void)​;​
560-»   ​·int·​(*rem_paths)​(void)​;​627+»   ​int·​(*rem_paths)​(void)​;​
561-»   ​·void·​(*move_begin)​(void)​;​628+»   ​void·​(*move_begin)​(void)​;​
562-»   ​·void·​(*move_end)​(void)​;​629+»   ​void·​(*move_end)​(void)​;​
563-»   ​·int·​(*dentry_moved)​(redirfs_root,​·​redirfs_root,​·​struct·​dentry·​*)​;​630+»   ​int·​(*dentry_moved)​(redirfs_root,​·​redirfs_root,​·​struct·​dentry·​*)​;​
564-»   ​·int·​(*inode_moved)​(redirfs_root,​·​redirfs_root,​·​struct·​inode·​*)​;​631+»   ​int·​(*inode_moved)​(redirfs_root,​·​redirfs_root,​·​struct·​inode·​*)​;​
632+»   ​enum·​redirfs_rv·​(*pre_rename)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​
633+»   ​enum·​redirfs_rv·​(*post_rename)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​
565};​634};​
566635
567struct·​redirfs_filter_info·​{636struct·​redirfs_filter_info·​{

driver.​org/​redirfs/​rfs.​cdriver/​redirfs/​rfs.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
2527
26struct·​rfs_info·​*rfs_info_none;​28struct·​rfs_info·​*rfs_info_none;​
2729
28-int·​rfs_precall_flts(stru​ct·​rfs_chain·​*rchain,​·​struct·​rfs_context·​*rcont,​30+int·​rfs_precall_flts(stru​ct·​rfs_info·​*rinfo,​·​struct·​rfs_context·​*rcont,​
29»   ​»   ​struct·​redirfs_args·​*rargs)​31»   ​»   ​struct·​redirfs_args·​*rargs)​
30{32{
31»   ​enum·​redirfs_rv·​(*rop)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​33»   ​enum·​redirfs_rv·​(*rop)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​
32»   ​enum·​redirfs_rv·​rv;​34»   ​enum·​redirfs_rv·​rv;​
3335
36+»   ​struct·​rfs_chain·​*rchain;​
37+
38+»   ​rargs->rv.​rv_int=0;​
39+
40+»   ​if·​(!rinfo)​
41+»   ​»   ​return·​0;​
42+
43+»   ​rchain·​=·​rinfo->rchain;​
44+
34»   ​if·​(!rchain)​45»   ​if·​(!rchain)​
35»   ​»   ​return·​0;​46»   ​»   ​return·​0;​
3647
56»   ​return·​0;​67»   ​return·​0;​
57}68}
5869
59-void·​rfs_postcall_flts(str​uct·​rfs_chain·​*rchain,​·​struct·​rfs_context·​*rcont,​70+void·​rfs_postcall_flts(str​uct·​rfs_info·​*rinfo,​·​struct·​rfs_context·​*rcont,​
60»   ​»   ​struct·​redirfs_args·​*rargs)​71»   ​»   ​struct·​redirfs_args·​*rargs)​
61{72{
62»   ​enum·​redirfs_rv·​(*rop)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​73»   ​enum·​redirfs_rv·​(*rop)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​
6374
75+»   ​struct·​rfs_chain·​*rchain;​
76+
77+»   ​if·​(!rinfo)​
78+»   ​»   ​return;​
79+
80+»   ​rchain·​=·​rinfo->rchain;​
81+
64»   ​if·​(!rchain)​82»   ​if·​(!rchain)​
65»   ​»   ​return;​83»   ​»   ​return;​
6684
104122
105»   ​printk(KERN_INFO·​"Redirecting·​File·​System·​Framework·​Version·​"123»   ​printk(KERN_INFO·​"Redirecting·​File·​System·​Framework·​Version·​"
106»   ​»   ​»   ​REDIRFS_VERSION·​"·​<www.​redirfs.​org>\n")​;​124»   ​»   ​»   ​REDIRFS_VERSION·​"·​<www.​redirfs.​org>\n")​;​
125+»   ​printk(KERN_INFO·​"Midified·​by·​KINTA-JAPAN\n")​;​
107126
108»   ​return·​0;​127»   ​return·​0;​
109128
122141
123MODULE_LICENSE("GPL")​;​142MODULE_LICENSE("GPL")​;​
124MODULE_AUTHOR("Franti​sek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>")​;​143MODULE_AUTHOR("Franti​sek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>")​;​
144+MODULE_AUTHOR("KINTA-​JAPAN·​<sanu@ruby.​plala.​or.​jp>")​;​
125MODULE_DESCRIPTION("R​edirecting·​File·​System·​Framework·​Version·​"145MODULE_DESCRIPTION("R​edirecting·​File·​System·​Framework·​Version·​"
126-»   ​»   ​REDIRFS_VERSION·​"·​<www.​redirfs.​org>")​;​146+»   ​»   ​REDIRFS_VERSION·​"·​<www.​redirfs.​org>·<www.​bondoffamily-net.​com>")​;​
127147

driver.​org/​redirfs/​rfs.​hdriver/​redirfs/​rfs.​h
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
31#include·​<linux/​slab.​h>33#include·​<linux/​slab.​h>
32#include·​"redirfs.​h"34#include·​"redirfs.​h"
3335
36+#ifdef·​RFS_EXCHANGE_D_CHILD
37+#if·​(RFS_EXCHANGE_D_CHILD​·​==·​0)​
38+#define·​D_CHILD·​d_child
39+#define·​D_U_D_CHILD·​d_u.​d_child
40+#else
41+#define·​D_CHILD·​d_u.​d_child
42+#define·​D_U_D_CHILD·​d_child
43+#endif
44+#else
45+#define·​D_CHILD·​d_child
46+#define·​D_U_D_CHILD·​d_u.​d_child
47+#endif
48+
49+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
50+#else
51+
52+»   ​struct·​rfs_nameidata·​{
53+»   ​»   ​struct·​path·​path;​
54+»   ​};​
55+
56+
57+#endif
58+
59+
34#define·​RFS_ADD_OP(ops_new,​·​op)​·​\60#define·​RFS_ADD_OP(ops_new,​·​op)​·​\
35»   ​(ops_new.​op·​=·​rfs_##op)​61»   ​(ops_new.​op·​=·​rfs_##op)​
3662
78#define·​rfs_mutex_init(mutex)​·​init_MUTEX(mutex)​104#define·​rfs_mutex_init(mutex)​·​init_MUTEX(mutex)​
79#define·​rfs_mutex_lock(mutex)​·​down(mutex)​105#define·​rfs_mutex_lock(mutex)​·​down(mutex)​
80#define·​rfs_mutex_unlock(mute​x)​·​up(mutex)​106#define·​rfs_mutex_unlock(mute​x)​·​up(mutex)​
81-#define·​rfs_for_each_d_child(​pos,​·​head)​·​list_for_each_entry(p​os,​·​head,​·d_child)​107+#define·​rfs_for_each_d_child(​pos,​·​head)​·​list_for_each_entry(p​os,​·​head,​·D_CHILD)​
108+
82inline·​static·​void·​rfs_inode_mutex_lock(​struct·​inode·​*inode)​109inline·​static·​void·​rfs_inode_mutex_lock(​struct·​inode·​*inode)​
83{110{
84»   ​down(&inode->i_sem)​;​111»   ​down(&inode->i_sem)​;​
87{114{
88»   ​up(&inode->i_sem)​;​115»   ​up(&inode->i_sem)​;​
89}116}
117+#elif·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​18,​0)​)​
118+#define·​rfs_mutex_t·​mutex
119+#define·​RFS_DEFINE_MUTEX(mute​x)​·​DEFINE_MUTEX(mutex)​
120+#define·​rfs_mutex_init(mutex)​·​mutex_init(mutex)​
121+#define·​rfs_mutex_lock(mutex)​·​mutex_lock(mutex)​
122+#define·​rfs_mutex_unlock(mute​x)​·​mutex_unlock(mutex)​
123+#define·​rfs_for_each_d_child(​pos,​·​head)​·​list_for_each_entry(p​os,​·​head,​·​D_U_D_CHILD)​
124+
125+inline·​static·​void·​rfs_inode_mutex_lock(​struct·​inode·​*inode)​
126+{
127+»   ​mutex_lock(&inode->i_​mutex)​;​
128+}
129+inline·​static·​void·​rfs_inode_mutex_unloc​k(struct·​inode·​*inode)​
130+{
131+»   ​mutex_unlock(&inode->​i_mutex)​;​
132+}
90#else133#else
91#define·​rfs_mutex_t·​mutex134#define·​rfs_mutex_t·​mutex
92#define·​RFS_DEFINE_MUTEX(mute​x)​·​DEFINE_MUTEX(mutex)​135#define·​RFS_DEFINE_MUTEX(mute​x)​·​DEFINE_MUTEX(mutex)​
93#define·​rfs_mutex_init(mutex)​·​mutex_init(mutex)​136#define·​rfs_mutex_init(mutex)​·​mutex_init(mutex)​
94#define·​rfs_mutex_lock(mutex)​·​mutex_lock(mutex)​137#define·​rfs_mutex_lock(mutex)​·​mutex_lock(mutex)​
95#define·​rfs_mutex_unlock(mute​x)​·​mutex_unlock(mutex)​138#define·​rfs_mutex_unlock(mute​x)​·​mutex_unlock(mutex)​
96-#define·​rfs_for_each_d_child(​pos,​·​head)​·​list_for_each_entry(p​os,​·​head,​·d_u.​d_child)​139+#define·​rfs_for_each_d_child(​pos,​·​head)​·​list_for_each_entry(p​os,​·​head,​·D_CHILD)​
140+
97inline·​static·​void·​rfs_inode_mutex_lock(​struct·​inode·​*inode)​141inline·​static·​void·​rfs_inode_mutex_lock(​struct·​inode·​*inode)​
98{142{
99»   ​mutex_lock(&inode->i_​mutex)​;​143»   ​mutex_lock(&inode->i_​mutex)​;​
303»   ​int·​rdentries_nr;​·​/​*·​mutex·​*/​347»   ​int·​rdentries_nr;​·​/​*·​mutex·​*/​
304};​348};​
305349
350+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​17,​0)​)​
351+#define·​rfs_inode_find(inode)​·​\
352+»   ​(inode·​&&·​inode->i_op·​&&·​inode->i_op->rename2·​==·​rfs_rename2·​?·​\
353+»   ​·​rfs_inode_get(contain​er_of(inode->i_op,​·​struct·​rfs_inode,​·​op_new)​)​·​:​·​\
354+»   ​·​NULL)​
355+#elif·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​15,​0)​)​
356+#define·​rfs_inode_find(inode)​·​\
357+»   ​(inode·​&&·​inode->i_op·​&&·​\
358+»   ​(inode->i_op->rename·​==·​rfs_rename·​||·​inode->i_op->rename2·​==·​rfs_rename2)​·​?·​\
359+»   ​·​rfs_inode_get(contain​er_of(inode->i_op,​·​struct·​rfs_inode,​·​op_new)​)​·​:​·​\
360+»   ​·​NULL)​
361+#else
306#define·​rfs_inode_find(inode)​·​\362#define·​rfs_inode_find(inode)​·​\
307»   ​(inode·​&&·​inode->i_op·​&&·​inode->i_op->rename·​==·​rfs_rename·​?·​\363»   ​(inode·​&&·​inode->i_op·​&&·​inode->i_op->rename·​==·​rfs_rename·​?·​\
308»   ​·​rfs_inode_get(contain​er_of(inode->i_op,​·​struct·​rfs_inode,​·​op_new)​)​·​:​·​\364»   ​·​rfs_inode_get(contain​er_of(inode->i_op,​·​struct·​rfs_inode,​·​op_new)​)​·​:​·​\
309»   ​·​NULL)​365»   ​·​NULL)​
366+#endif
310367
368+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​17,​0)​)​
311int·​rfs_rename(struct·​inode·​*old_dir,​·​struct·​dentry·​*old_dentry,​369int·​rfs_rename(struct·​inode·​*old_dir,​·​struct·​dentry·​*old_dentry,​
312»   ​»   ​struct·​inode·​*new_dir,​·​struct·​dentry·​*new_dentry)​;​370»   ​»   ​struct·​inode·​*new_dir,​·​struct·​dentry·​*new_dentry)​;​
371+#endif
372+
373+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​15,​0)​)​
374+int·​rfs_rename2(struct·​inode·​*old_dir,​·​struct·​dentry·​*old_dentry,​
375+»   ​»   ​struct·​inode·​*new_dir,​·​struct·​dentry·​*new_dentry,​·​unsigned·​int·​flags)​;​
376+#endif
377+
313struct·​rfs_inode·​*rfs_inode_get(struct​·​rfs_inode·​*rinode)​;​378struct·​rfs_inode·​*rfs_inode_get(struct​·​rfs_inode·​*rinode)​;​
314void·​rfs_inode_put(struct·​rfs_inode·​*rinode)​;​379void·​rfs_inode_put(struct·​rfs_inode·​*rinode)​;​
315struct·​rfs_inode·​*rfs_inode_add(struct​·​inode·​*inode,​·​struct·​rfs_info·​*rinfo)​;​380struct·​rfs_inode·​*rfs_inode_add(struct​·​inode·​*inode,​·​struct·​rfs_info·​*rinfo)​;​
389void·​rfs_context_init(stru​ct·​rfs_context·​*rcont,​·​int·​start)​;​454void·​rfs_context_init(stru​ct·​rfs_context·​*rcont,​·​int·​start)​;​
390void·​rfs_context_deinit(st​ruct·​rfs_context·​*rcont)​;​455void·​rfs_context_deinit(st​ruct·​rfs_context·​*rcont)​;​
391456
392-int·​rfs_precall_flts(stru​ct·​rfs_chain·​*rchain,​·​struct·​rfs_context·​*rcont,​457+int·​rfs_precall_flts(stru​ct·​rfs_info·​*rinfo,​·​struct·​rfs_context·​*rcont,​
393»   ​»   ​struct·​redirfs_args·​*rargs)​;​458»   ​»   ​struct·​redirfs_args·​*rargs)​;​
394-void·​rfs_postcall_flts(str​uct·​rfs_chain·​*rchain,​·​struct·​rfs_context·​*rcont,​459+void·​rfs_postcall_flts(str​uct·​rfs_info·​*rinfo,​·​struct·​rfs_context·​*rcont,​
395»   ​»   ​struct·​redirfs_args·​*rargs)​;​460»   ​»   ​struct·​redirfs_args·​*rargs)​;​
396461
397#define·​rfs_kobj_to_rflt(__ko​bj)​·​container_of(__kobj,​·​struct·​rfs_flt,​·​kobj)​462#define·​rfs_kobj_to_rflt(__ko​bj)​·​container_of(__kobj,​·​struct·​rfs_flt,​·​kobj)​
481»   ​return·​nd->mnt;​546»   ​return·​nd->mnt;​
482}547}
483548
484-#else549+#elif·(LINUX_VERSION_CODE·<·KERNEL_VERSION(3,​19,​0)​)​
485550
486static·​inline·​void·​rfs_nameidata_put(str​uct·​nameidata·​*nd)​551static·​inline·​void·​rfs_nameidata_put(str​uct·​nameidata·​*nd)​
487{552{
498»   ​return·​nd->path.​mnt;​563»   ​return·​nd->path.​mnt;​
499}564}
500565
566+#else
567+
568+static·​inline·​void·​rfs_nameidata_put(str​uct·​rfs_nameidata·​*nd)​
569+{
570+»   ​path_put(&nd->path)​;​
571+}
572+
573+static·​inline·​struct·​dentry·​*rfs_nameidata_dentry​(struct·​rfs_nameidata·​*nd)​
574+{
575+»   ​return·​nd->path.​dentry;​
576+}
577+
578+static·​inline·​struct·​vfsmount·​*rfs_nameidata_mnt(st​ruct·​rfs_nameidata·​*nd)​
579+{
580+»   ​return·​nd->path.​mnt;​
581+}
582+
501#endif583#endif
502584
503#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(2,​6,​30)​)​585#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(2,​6,​30)​)​
532}614}
533615
534#endif616#endif
617+
618+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​38)​)​
619+
620+static·​inline·​void·​rfs_dcache_lock(struc​t·​dentry·​*d)​
621+{
622+»   ​spin_lock(&dcache_loc​k)​;​
623+}
624+
625+static·​inline·​void·​rfs_dcache_unlock(str​uct·​dentry·​*d)​
626+{
627+»   ​spin_unlock(&dcache_l​ock)​;​
628+}
629+
630+static·​inline·​struct·​dentry·​*rfs_dget_locked(stru​ct·​dentry·​*d)​
631+{
632+»   ​return·​dget_locked(d)​;​
633+}
634+
635+#else
636+
637+static·​inline·​void·​rfs_dcache_lock(struc​t·​dentry·​*d)​
638+{
639+»   ​spin_lock(&d->d_lock)​;​
640+}
641+
642+static·​inline·​void·​rfs_dcache_unlock(str​uct·​dentry·​*d)​
643+{
644+»   ​spin_unlock(&d->d_loc​k)​;​
645+}
646+
647+static·​inline·​struct·​dentry·​*rfs_dget_locked(stru​ct·​dentry·​*d)​
648+{
649+»   ​return·​dget_dlock(d)​;​
650+}
651+
652+#endif
653+
654+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​39)​)​
655+
656+static·​inline·​int·​rfs_path_lookup(const​·​char·​*name,​·​struct·​nameidata·​*nd)​
657+{
658+»   ​return·​path_lookup(name,​·​LOOKUP_FOLLOW,​·​nd)​;​
659+}
660+
661+#elif·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
662+
663+static·​inline·​int·​rfs_path_lookup(const​·​char·​*name,​·​struct·​nameidata·​*nd)​
664+{
665+»   ​struct·​path·​path;​
666+»   ​int·​rv;​
667+
668+»   ​rv·​=·​kern_path(name,​·​LOOKUP_FOLLOW,​·​&path)​;​
669+»   ​if·​(rv)​
670+»   ​»   ​return·​rv;​
671+
672+»   ​nd->path·​=·​path;​
673+»   ​return·​0;​
674+}
675+
676+#else
677+
678+static·​inline·​int·​rfs_path_lookup(const​·​char·​*name,​·​struct·​rfs_nameidata·​*nd)​
679+{
680+»   ​struct·​path·​path;​
681+»   ​int·​rv;​
682+
683+»   ​rv·​=·​kern_path(name,​·​LOOKUP_FOLLOW,​·​&path)​;​
684+»   ​if·​(rv)​
685+»   ​»   ​return·​rv;​
686+
687+»   ​nd->path·​=·​path;​
688+»   ​return·​0;​
689+}
690+
691+#endif
692+
693+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​36)​)​
694+
695+static·​inline·​int·​rfs_inode_setattr(str​uct·​inode·​*inode,​·​const·​struct·​iattr·​*attr)​
696+{
697+»   ​return·​inode_setattr(inode,​·​attr)​;​
698+}
699+
700+#else
701+
702+static·​inline·​int·​rfs_inode_setattr(str​uct·​inode·​*inode,​·​const·​struct·​iattr·​*attr)​
703+{
704+»   ​setattr_copy(inode,​·​attr)​;​
705+»   ​mark_inode_dirty(inod​e)​;​
706+»   ​return·​0;​
707+}
708+
709+#endif
535710
536#endif711#endif
537712

driver.​org/​redirfs/​rfs_chain.​cdriver/​redirfs/​rfs_chain.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​

driver.​org/​redirfs/​rfs_data.​cdriver/​redirfs/​rfs_data.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
74»   ​if·​(!atomic_dec_and_test​(&data->cnt)​)​76»   ​if·​(!atomic_dec_and_test​(&data->cnt)​)​
75»   ​»   ​return;​77»   ​»   ​return;​
7678
77-»   ​data->free(data)​;​
78»   ​rfs_flt_put(data->fil​ter)​;​79»   ​rfs_flt_put(data->fil​ter)​;​
80+»   ​data->free(data)​;​
79}81}
8082
81static·​struct·​redirfs_data·​*rfs_find_data(struct​·​list_head·​*head,​83static·​struct·​redirfs_data·​*rfs_find_data(struct​·​list_head·​*head,​

driver.​org/​redirfs/​rfs_dcache.​cdriver/​redirfs/​rfs_dcache.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
47»   ​kfree(rdata)​;​49»   ​kfree(rdata)​;​
48}50}
4951
50-static·​struct·​rfs_dcache_entry·​*rfs_dcache_entry_all​oc_locked(
51-»   ​»   ​struct·​dentry·​*dentry,​·​struct·​list_head·​*list)​
52-{
53-»   ​struct·​rfs_dcache_entry·​*entry;​
54-
55-»   ​entry·​=·​kzalloc(sizeof(struct​·​rfs_dcache_entry)​,​·​GFP_ATOMIC)​;​
56-»   ​if·​(!entry)​
57-»   ​»   ​return·​ERR_PTR(-ENOMEM)​;​
58-
59-»   ​INIT_LIST_HEAD(&entry​->list)​;​
60-»   ​entry->dentry·​=·​dget_locked(dentry)​;​
61-»   ​list_add_tail(&entry-​>list,​·​list)​;​
62-
63-»   ​return·​entry;​
64-}
65-
66static·​struct·​rfs_dcache_entry·​*rfs_dcache_entry_all​oc(struct·​dentry·​*dentry,​52static·​struct·​rfs_dcache_entry·​*rfs_dcache_entry_all​oc(struct·​dentry·​*dentry,​
67»   ​»   ​struct·​list_head·​*list)​53»   ​»   ​struct·​list_head·​*list)​
68{54{
89»   ​kfree(entry)​;​75»   ​kfree(entry)​;​
90}76}
9177
92-static·​int·​rfs_dcache_get_subs_a​tomic(struct·​dentry·​*dir,​78+static·​int·​rfs_dcache_get_subs_k​ernel(struct·​dentry·​*dir,​
93»   ​»   ​struct·​list_head·​*sibs)​79»   ​»   ​struct·​list_head·​*sibs)​
94{80{
95»   ​struct·​rfs_dcache_entry·​*sib;​81»   ​struct·​rfs_dcache_entry·​*sib;​
96»   ​struct·​dentry·​*dentry;​82»   ​struct·​dentry·​*dentry;​
97»   ​int·​rv·​=·​0;​83»   ​int·​rv·​=·​0;​
9884
99-»   ​spin_lock(&dcache_loc​k)​;​85+»   ​rfs_dcache_lock(dir)​;​
10086
101»   ​rfs_for_each_d_child(​dentry,​·​&dir->d_subdirs)​·​{87»   ​rfs_for_each_d_child(​dentry,​·​&dir->d_subdirs)​·​{
88+»   ​»   ​if·​(!dentry->d_inode)​
89+»   ​»   ​»   ​continue;​
10290
103-»   ​»   ​sib·=·rfs_dcache_entry_allo​c_locked(dentry,​·sibs)​;​91+»   ​»   ​if·(!S_ISDIR(dentry->d_i​node->i_mode)​)​
104-»   ​»   ​if·(IS_ERR(sib)​)​·{92+»   ​»   ​»   ​continue;​
105-»   ​»   ​»   ​rv·​=·​PTR_ERR(sib)​;​
106-»   ​»   ​»   ​break;​
107-»   ​»   ​}
108-»   ​}
109-
110-»   ​spin_unlock(&dcache_l​ock)​;​
111-
112-»   ​return·​rv;​
113-}
114-
115-static·​int·​rfs_dcache_get_subs_k​ernel(struct·​dentry·​*dir,​
116-»   ​»   ​struct·​list_head·​*sibs)​
117-{
118-»   ​LIST_HEAD(pool)​;​
119-»   ​int·​pool_size·​=·​32;​
120-»   ​int·​pool_small;​
121-»   ​struct·​rfs_dcache_entry·​*sib;​
122-»   ​struct·​dentry·​*dentry;​
123-»   ​int·​i;​
12493
125-again:​94+»   ​»   ​if·(dir·==·dentry)​
126-»   ​pool_small·=·0;​95+»   ​»   ​»   ​continue;​
12796
128-»   ​for·(i·=·0;​·i·<·pool_size;​·​i++)​·{97+»   ​»   ​sib·=·rfs_dcache_entry_allo​c(dentry,​·sibs)​;​
129-»   ​»   ​sib·​=·​rfs_dcache_entry_allo​c(NULL,​·​&pool)​;​
130»   ​»   ​if·​(IS_ERR(sib)​)​·​{98»   ​»   ​if·​(IS_ERR(sib)​)​·​{
131-»   ​»   ​»   ​rfs_dcache_entry_free​_list(&pool)​;​99+»   ​»   ​»   ​rv·=·PTR_ERR(sib)​;​
132-»   ​»   ​»   ​return·PTR_ERR(sib)​;​100+»   ​»   ​»   ​goto·exit;​
133-»   ​»   ​}
134-»   ​}
135-
136-»   ​spin_lock(&dcache_loc​k)​;​
137-
138-»   ​rfs_for_each_d_child(​dentry,​·​&dir->d_subdirs)​·​{
139-»   ​»   ​if·​(list_empty(&pool)​)​·​{
140-»   ​»   ​»   ​pool_small·​=·​1;​
141-»   ​»   ​»   ​break;​
142»   ​»   ​}101»   ​»   ​}
143-»   ​»   ​
144-»   ​»   ​sib·​=·​list_entry(pool.​next,​·​struct·​rfs_dcache_entry,​·​list)​;​
145-»   ​»   ​sib->dentry·​=·​dget_locked(dentry)​;​
146-»   ​»   ​list_move(&sib->list,​·​sibs)​;​
147»   ​}102»   ​}
148103
149-»   ​spin_unlock(&dcache_l​ock)​;​104+exit:​
150-105+»   ​rfs_dcache_unlock(dir​)​;​
151-»   ​rfs_dcache_entry_free​_list(&pool)​;​
152-
153-»   ​if·​(pool_small)​·​{
154-»   ​»   ​rfs_dcache_entry_free​_list(sibs)​;​
155-»   ​»   ​pool_size·​*=·​2;​
156-»   ​»   ​goto·​again;​
157-»   ​}
158106
159-»   ​return·0;​107+»   ​return·rv;​
160}108}
161109
162int·​rfs_dcache_get_subs(s​truct·​dentry·​*dir,​·​struct·​list_head·​*sibs)​110int·​rfs_dcache_get_subs(s​truct·​dentry·​*dir,​·​struct·​list_head·​*sibs)​
163{111{
164-»   ​int·rv;​112+»   ​return·rfs_dcache_get_subs_k​ernel(dir,​·sibs)​;​
165-
166-»   ​rv·​=·​rfs_dcache_get_subs_a​tomic(dir,​·​sibs)​;​
167-»   ​if·​(!rv)​
168-»   ​»   ​return·​rv;​
169-
170-»   ​rfs_dcache_entry_free​_list(sibs)​;​
171-»   ​
172-»   ​rv·​=·​rfs_dcache_get_subs_k​ernel(dir,​·​sibs)​;​
173-
174-»   ​return·​rv;​
175}113}
176114
177void·​rfs_dcache_entry_free​_list(struct·​list_head·​*head)​115void·​rfs_dcache_entry_free​_list(struct·​list_head·​*head)​
184»   ​}122»   ​}
185}123}
186124
187-static·int·​rfs_dcache_get_subs_m​utex(struct·​dentry·​*dir,​·​struct·​list_head·​*sibs)​125+int·​rfs_dcache_get_subs_m​utex(struct·​dentry·​*dir,​·​struct·​list_head·​*sibs)​
188{126{
127+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​13,​0)​)​
128+»   ​int·​lock;​
129+#endif
130+
189»   ​int·​rv·​=·​0;​131»   ​int·​rv·​=·​0;​
190132
191»   ​if·​(!dir·​||·​!dir->d_inode)​133»   ​if·​(!dir·​||·​!dir->d_inode)​
192»   ​»   ​return·​0;​134»   ​»   ​return·​0;​
193135
136+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​13,​0)​)​
194»   ​rfs_inode_mutex_lock(​dir->d_inode)​;​137»   ​rfs_inode_mutex_lock(​dir->d_inode)​;​
195»   ​rv·​=·​rfs_dcache_get_subs(d​ir,​·​sibs)​;​138»   ​rv·​=·​rfs_dcache_get_subs(d​ir,​·​sibs)​;​
196»   ​rfs_inode_mutex_unloc​k(dir->d_inode)​;​139»   ​rfs_inode_mutex_unloc​k(dir->d_inode)​;​
140+#else
141+»   ​lock·​=·​mutex_trylock(&dir->d​_inode->i_mutex)​;​
142+»   ​rv·​=·​rfs_dcache_get_subs(d​ir,​·​sibs)​;​
143+»   ​if·​(lock)​
144+»   ​»   ​mutex_unlock(&dir->d_​inode->i_mutex)​;​
145+#endif
197146
198»   ​return·​rv;​147»   ​return·​rv;​
199}148}
302»   ​struct·​rfs_dentry·​*rdentry·​=·​NULL;​251»   ​struct·​rfs_dentry·​*rdentry·​=·​NULL;​
303»   ​int·​rv·​=·​0;​252»   ​int·​rv·​=·​0;​
304253
254+»   ​if·​(!dentry)​
255+»   ​»   ​return·​-1;​
256+
305»   ​rdentry·​=·​rfs_dentry_add(dentry​,​·​rinfo)​;​257»   ​rdentry·​=·​rfs_dentry_add(dentry​,​·​rinfo)​;​
306»   ​if·​(IS_ERR(rdentry)​)​258»   ​if·​(IS_ERR(rdentry)​)​
307»   ​»   ​return·​PTR_ERR(rdentry)​;​259»   ​»   ​return·​PTR_ERR(rdentry)​;​

driver.​org/​redirfs/​rfs_dentry.​cdriver/​redirfs/​rfs_dentry.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
175struct·​rfs_info·​*rfs_dentry_get_rinfo​(struct·​rfs_dentry·​*rdentry)​177struct·​rfs_info·​*rfs_dentry_get_rinfo​(struct·​rfs_dentry·​*rdentry)​
176{178{
177»   ​struct·​rfs_info·​*rinfo;​179»   ​struct·​rfs_info·​*rinfo;​
180+»   ​
181+»   ​if·​(!rdentry)​
182+»   ​»   ​return·​NULL;​
178183
179»   ​spin_lock(&rdentry->l​ock)​;​184»   ​spin_lock(&rdentry->l​ock)​;​
180»   ​rinfo·​=·​rfs_info_get(rdentry-​>rinfo)​;​185»   ​rinfo·​=·​rfs_info_get(rdentry-​>rinfo)​;​
232237
233»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​238»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​
234»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​239»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
240+
235»   ​rfs_context_init(&rco​nt,​·​0)​;​241»   ​rfs_context_init(&rco​nt,​·​0)​;​
236242
237»   ​if·​(S_ISREG(inode->i_mod​e)​)​243»   ​if·​(S_ISREG(inode->i_mod​e)​)​
252»   ​rargs.​args.​d_iput.​dentry·​=·​dentry;​258»   ​rargs.​args.​d_iput.​dentry·​=·​dentry;​
253»   ​rargs.​args.​d_iput.​inode·​=·​inode;​259»   ​rargs.​args.​d_iput.​inode·​=·​inode;​
254260
255-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{261+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
256»   ​»   ​BUG_ON(rfs_dcache_rin​ode_del(rdentry,​·​inode)​)​;​262»   ​»   ​BUG_ON(rfs_dcache_rin​ode_del(rdentry,​·​inode)​)​;​
257263
258»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_ip​ut)​264»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_ip​ut)​
262»   ​»   ​»   ​iput(inode)​;​268»   ​»   ​»   ​iput(inode)​;​
263»   ​}269»   ​}
264270
265-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​271+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
266»   ​rfs_context_deinit(&r​cont)​;​272»   ​rfs_context_deinit(&r​cont)​;​
267273
268»   ​rfs_dentry_put(rdentr​y)​;​274»   ​rfs_dentry_put(rdentr​y)​;​
278284
279»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​285»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​
280»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​286»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
287+
281»   ​rfs_context_init(&rco​nt,​·​0)​;​288»   ​rfs_context_init(&rco​nt,​·​0)​;​
282»   ​rargs.​type.​id·​=·​REDIRFS_NONE_DOP_D_RE​LEASE;​289»   ​rargs.​type.​id·​=·​REDIRFS_NONE_DOP_D_RE​LEASE;​
283»   ​rargs.​args.​d_release.​dentry·​=·​dentry;​290»   ​rargs.​args.​d_release.​dentry·​=·​dentry;​
284291
285-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{292+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
286»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_re​lease)​293»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_re​lease)​
287»   ​»   ​»   ​rdentry->op_old->d_re​lease(rargs.​args.​d_release.​dentry)​;​294»   ​»   ​»   ​rdentry->op_old->d_re​lease(rargs.​args.​d_release.​dentry)​;​
288»   ​}295»   ​}
289296
290-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​297+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
291»   ​rfs_context_deinit(&r​cont)​;​298»   ​rfs_context_deinit(&r​cont)​;​
292299
293»   ​rfs_dentry_del(rdentr​y)​;​300»   ​rfs_dentry_del(rdentr​y)​;​
295»   ​rfs_info_put(rinfo)​;​302»   ​rfs_info_put(rinfo)​;​
296}303}
297304
298-static·​inline·​int·​rfs_d_compare_default​(struct·qstr·*name1,​·​struct·​qstr·​*name2)​305+static·​inline·​int·​rfs_d_compare_default​(const·​struct·​qstr·​*name1,​
306+»   ​»   ​const·​struct·​qstr·​*name2)​
299{307{
300»   ​if·​(name1->len·​!=·​name2->len)​308»   ​if·​(name1->len·​!=·​name2->len)​
301»   ​»   ​return·​1;​309»   ​»   ​return·​1;​
305»   ​return·​0;​313»   ​return·​0;​
306}314}
307315
316+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​38)​)​
317+
308static·​int·​rfs_d_compare(struct·​dentry·​*dentry,​·​struct·​qstr·​*name1,​318static·​int·​rfs_d_compare(struct·​dentry·​*dentry,​·​struct·​qstr·​*name1,​
309»   ​»   ​struct·​qstr·​*name2)​319»   ​»   ​struct·​qstr·​*name2)​
310{320{
315325
316»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​326»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​
317»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​327»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
328+
318»   ​rfs_context_init(&rco​nt,​·​0)​;​329»   ​rfs_context_init(&rco​nt,​·​0)​;​
319330
320»   ​if·​(dentry->d_inode)​·​{331»   ​if·​(dentry->d_inode)​·​{
339»   ​rargs.​args.​d_compare.​name1·​=·​name1;​350»   ​rargs.​args.​d_compare.​name1·​=·​name1;​
340»   ​rargs.​args.​d_compare.​name2·​=·​name2;​351»   ​rargs.​args.​d_compare.​name2·​=·​name2;​
341352
342-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{353+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
343»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_co​mpare)​354»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_co​mpare)​
344»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rdentry->op_old->d_co​mpare(355»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rdentry->op_old->d_co​mpare(
345»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​dentry,​356»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​dentry,​
349»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_d_compare_default​(360»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_d_compare_default​(
350»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name1,​361»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name1,​
351»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name2)​;​362»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name2)​;​
352-»   ​}363+»   ​}·else
364+»   ​»   ​rargs.​rv.​rv_int·​=·​1;​
353365
354-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​366+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
355»   ​rfs_context_deinit(&r​cont)​;​367»   ​rfs_context_deinit(&r​cont)​;​
356368
357»   ​rfs_dentry_put(rdentr​y)​;​369»   ​rfs_dentry_put(rdentr​y)​;​
360»   ​return·​rargs.​rv.​rv_int;​372»   ​return·​rargs.​rv.​rv_int;​
361}373}
362374
375+#elif·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
376+
377+static·​int·​rfs_d_compare(const·​struct·​dentry·​*parent,​·​const·​struct·​inode·​*inode,​
378+»   ​»   ​const·​struct·​dentry·​*dentry,​·​const·​struct·​inode·​*d_inode,​
379+»   ​»   ​unsigned·​int·​tlen,​·​const·​char·​*tname,​
380+»   ​»   ​const·​struct·​qstr·​*name)​
381+{
382+»   ​struct·​rfs_dentry·​*rdentry;​
383+»   ​struct·​rfs_info·​*rinfo;​
384+»   ​struct·​rfs_context·​rcont;​
385+»   ​struct·​redirfs_args·​rargs;​
386+
387+»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​
388+»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
389+
390+»   ​rfs_context_init(&rco​nt,​·​0)​;​
391+
392+»   ​if·​(dentry->d_inode)​·​{
393+»   ​»   ​if·​(S_ISREG(dentry->d_in​ode->i_mode)​)​
394+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_REG_DOP_D_COM​PARE;​
395+»   ​»   ​else·​if·​(S_ISDIR(dentry->d_in​ode->i_mode)​)​
396+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_DOP_D_COM​PARE;​
397+»   ​»   ​else·​if·​(S_ISLNK(dentry->d_in​ode->i_mode)​)​
398+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_LNK_DOP_D_COM​PARE;​
399+»   ​»   ​else·​if·​(S_ISCHR(dentry->d_in​ode->i_mode)​)​
400+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_CHR_DOP_D_COM​PARE;​
401+»   ​»   ​else·​if·​(S_ISBLK(dentry->d_in​ode->i_mode)​)​
402+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_BLK_DOP_D_COM​PARE;​
403+»   ​»   ​else·​if·​(S_ISFIFO(dentry->d_i​node->i_mode)​)​
404+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_FIFO_DOP_D_CO​MPARE;​
405+»   ​»   ​else
406+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_SOCK_DOP_D_CO​MPARE;​
407+»   ​}·​else
408+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_NONE_DOP_D_CO​MPARE;​
409+
410+»   ​rargs.​args.​d_compare.​parent·​=·​parent;​
411+»   ​rargs.​args.​d_compare.​inode·​=·​inode;​
412+»   ​rargs.​args.​d_compare.​dentry·​=·​dentry;​
413+»   ​rargs.​args.​d_compare.​d_inode·​=·​d_inode;​
414+»   ​rargs.​args.​d_compare.​tlen·​=·​tlen;​
415+»   ​rargs.​args.​d_compare.​tname·​=·​tname;​
416+»   ​rargs.​args.​d_compare.​name·​=·​name;​
417+
418+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
419+»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_co​mpare)​
420+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rdentry->op_old->d_co​mpare(
421+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​parent,​
422+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​inode,​
423+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​dentry,​
424+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​d_inode,​
425+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​tlen,​
426+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​tname,​
427+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name)​;​
428+»   ​»   ​else
429+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_d_compare_default​(
430+»   ​»   ​»   ​»   ​»   ​&rargs.​args.​d_compare.​dentry->d_name,​
431+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name)​;​
432+»   ​}·​else
433+»   ​»   ​rargs.​rv.​rv_int·​=·​1;​
434+
435+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
436+»   ​rfs_context_deinit(&r​cont)​;​
437+
438+»   ​rfs_dentry_put(rdentr​y)​;​
439+»   ​rfs_info_put(rinfo)​;​
440+
441+»   ​return·​rargs.​rv.​rv_int;​
442+}
443+
444+#else
445+
446+static·​int·​rfs_d_compare(const·​struct·​dentry·​*parent,​·​const·​struct·​dentry·​*dentry,​
447+»   ​»   ​unsigned·​int·​tlen,​·​const·​char·​*tname,​·​const·​struct·​qstr·​*name)​
448+{
449+»   ​struct·​rfs_dentry·​*rdentry;​
450+»   ​struct·​rfs_info·​*rinfo;​
451+»   ​struct·​rfs_context·​rcont;​
452+»   ​struct·​redirfs_args·​rargs;​
453+
454+»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​
455+»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
456+
457+»   ​rfs_context_init(&rco​nt,​·​0)​;​
458+
459+»   ​if·​(dentry->d_inode)​·​{
460+»   ​»   ​if·​(S_ISREG(dentry->d_in​ode->i_mode)​)​
461+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_REG_DOP_D_COM​PARE;​
462+»   ​»   ​else·​if·​(S_ISDIR(dentry->d_in​ode->i_mode)​)​
463+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_DOP_D_COM​PARE;​
464+»   ​»   ​else·​if·​(S_ISLNK(dentry->d_in​ode->i_mode)​)​
465+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_LNK_DOP_D_COM​PARE;​
466+»   ​»   ​else·​if·​(S_ISCHR(dentry->d_in​ode->i_mode)​)​
467+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_CHR_DOP_D_COM​PARE;​
468+»   ​»   ​else·​if·​(S_ISBLK(dentry->d_in​ode->i_mode)​)​
469+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_BLK_DOP_D_COM​PARE;​
470+»   ​»   ​else·​if·​(S_ISFIFO(dentry->d_i​node->i_mode)​)​
471+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_FIFO_DOP_D_CO​MPARE;​
472+»   ​»   ​else
473+»   ​»   ​»   ​rargs.​type.​id·​=·​REDIRFS_SOCK_DOP_D_CO​MPARE;​
474+»   ​}·​else
475+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_NONE_DOP_D_CO​MPARE;​
476+
477+»   ​rargs.​args.​d_compare.​parent·​=·​parent;​
478+»   ​rargs.​args.​d_compare.​dentry·​=·​dentry;​
479+»   ​rargs.​args.​d_compare.​tlen·​=·​tlen;​
480+»   ​rargs.​args.​d_compare.​tname·​=·​tname;​
481+»   ​rargs.​args.​d_compare.​name·​=·​name;​
482+
483+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
484+»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_co​mpare)​
485+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rdentry->op_old->d_co​mpare(
486+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​parent,​
487+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​dentry,​
488+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​tlen,​
489+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​tname,​
490+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name)​;​
491+»   ​»   ​else
492+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_d_compare_default​(
493+»   ​»   ​»   ​»   ​»   ​&rargs.​args.​d_compare.​dentry->d_name,​
494+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_compare.​name)​;​
495+»   ​}·​else
496+»   ​»   ​rargs.​rv.​rv_int·​=·​1;​
497+
498+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
499+»   ​rfs_context_deinit(&r​cont)​;​
500+
501+»   ​rfs_dentry_put(rdentr​y)​;​
502+»   ​rfs_info_put(rinfo)​;​
503+
504+»   ​return·​rargs.​rv.​rv_int;​
505+}
506+#endif
507+
508+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
363static·​int·​rfs_d_revalidate(stru​ct·​dentry·​*dentry,​·​struct·​nameidata·​*nd)​509static·​int·​rfs_d_revalidate(stru​ct·​dentry·​*dentry,​·​struct·​nameidata·​*nd)​
510+#else
511+static·​int·​rfs_d_revalidate(stru​ct·​dentry·​*dentry,​·​unsigned·​int·​flags)​
512+#endif
364{513{
365»   ​struct·​rfs_dentry·​*rdentry;​514»   ​struct·​rfs_dentry·​*rdentry;​
366»   ​struct·​rfs_info·​*rinfo;​515»   ​struct·​rfs_info·​*rinfo;​
369518
370»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​519»   ​rdentry·​=·​rfs_dentry_find(dentr​y)​;​
371»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​520»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
521+
372»   ​rfs_context_init(&rco​nt,​·​0)​;​522»   ​rfs_context_init(&rco​nt,​·​0)​;​
373523
374»   ​if·​(dentry->d_inode)​·​{524»   ​if·​(dentry->d_inode)​·​{
390»   ​»   ​rargs.​type.​id·​=·​REDIRFS_NONE_DOP_D_RE​VALIDATE;​540»   ​»   ​rargs.​type.​id·​=·​REDIRFS_NONE_DOP_D_RE​VALIDATE;​
391541
392»   ​rargs.​args.​d_revalidate.​dentry·​=·​dentry;​542»   ​rargs.​args.​d_revalidate.​dentry·​=·​dentry;​
543+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
393»   ​rargs.​args.​d_revalidate.​nd·​=·​nd;​544»   ​rargs.​args.​d_revalidate.​nd·​=·​nd;​
545+#else
546+»   ​rargs.​args.​d_revalidate.​flags·​=·​flags;​
547+#endif
394548
395-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{549+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
396»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_re​validate)​550»   ​»   ​if·​(rdentry->op_old·​&&·​rdentry->op_old->d_re​validate)​
397»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rdentry->op_old->d_re​validate(551»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rdentry->op_old->d_re​validate(
398»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_revalidate.​dentry,​552»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_revalidate.​dentry,​
553+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
399»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_revalidate.​nd)​;​554»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_revalidate.​nd)​;​
555+#else
556+»   ​»   ​»   ​»   ​»   ​rargs.​args.​d_revalidate.​flags)​;​
557+#endif
400»   ​»   ​else558»   ​»   ​else
401»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​1;​559»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​1;​
402-»   ​}560+»   ​}·else
561+»   ​»   ​rargs.​rv.​rv_int·​=·​1;​
403562
404-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​563+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
405»   ​rfs_context_deinit(&r​cont)​;​564»   ​rfs_context_deinit(&r​cont)​;​
406565
407»   ​rfs_dentry_put(rdentr​y)​;​566»   ​rfs_dentry_put(rdentr​y)​;​

driver.​org/​redirfs/​rfs_file.​cdriver/​redirfs/​rfs_file.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
88»   ​if·​(IS_ERR(rfile)​)​90»   ​if·​(IS_ERR(rfile)​)​
89»   ​»   ​return·​rfile;​91»   ​»   ​return·​rfile;​
9092
93+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
91»   ​rfile->rdentry·​=·​rfs_dentry_find(file-​>f_dentry)​;​94»   ​rfile->rdentry·​=·​rfs_dentry_find(file-​>f_dentry)​;​
95+#else
96+»   ​rfile->rdentry·​=·​rfs_dentry_find(file-​>f_path.​dentry)​;​
97+#endif
98+
92»   ​rfs_dentry_add_rfile(​rfile->rdentry,​·​rfile)​;​99»   ​rfs_dentry_add_rfile(​rfile->rdentry,​·​rfile)​;​
93»   ​fops_put(file->f_op)​;​100»   ​fops_put(file->f_op)​;​
94»   ​file->f_op·​=·​&rfile->op_new;​101»   ​file->f_op·​=·​&rfile->op_new;​
136»   ​fops_put(file->f_op)​;​143»   ​fops_put(file->f_op)​;​
137»   ​file->f_op·​=·​fops_get(rinode->fop_​old)​;​144»   ​file->f_op·​=·​fops_get(rinode->fop_​old)​;​
138145
146+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
139»   ​rdentry·​=·​rfs_dentry_find(file-​>f_dentry)​;​147»   ​rdentry·​=·​rfs_dentry_find(file-​>f_dentry)​;​
148+#else
149+»   ​rdentry·​=·​rfs_dentry_find(file-​>f_path.​dentry)​;​
150+#endif
151+
140»   ​if·​(!rdentry)​·​{152»   ​if·​(!rdentry)​·​{
141»   ​»   ​rfs_inode_put(rinode)​;​153»   ​»   ​rfs_inode_put(rinode)​;​
142»   ​»   ​if·​(file->f_op·​&&·​file->f_op->open)​154»   ​»   ​if·​(file->f_op·​&&·​file->f_op->open)​
146»   ​}158»   ​}
147159
148»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​160»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rdentry)​;​
161+
149»   ​rfs_dentry_put(rdentr​y)​;​162»   ​rfs_dentry_put(rdentr​y)​;​
150»   ​rfs_context_init(&rco​nt,​·​0)​;​163»   ​rfs_context_init(&rco​nt,​·​0)​;​
151164
165»   ​rargs.​args.​f_open.​inode·​=·​inode;​178»   ​rargs.​args.​f_open.​inode·​=·​inode;​
166»   ​rargs.​args.​f_open.​file·​=·​file;​179»   ​rargs.​args.​f_open.​file·​=·​file;​
167180
168-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{181+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
169»   ​»   ​if·​(rinode->fop_old·​&&·​rinode->fop_old->open​)​182»   ​»   ​if·​(rinode->fop_old·​&&·​rinode->fop_old->open​)​
170»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->fop_old->open​(183»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->fop_old->open​(
171»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_open.​inode,​184»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_open.​inode,​
172»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_open.​file)​;​185»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_open.​file)​;​
173»   ​»   ​else186»   ​»   ​else
174»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​0;​187»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​0;​
175-»   ​}188+»   ​}·else
189+»   ​»   ​rargs.​rv.​rv_int·​=·​-EACCES;​
176190
177»   ​if·​(!rargs.​rv.​rv_int)​·​{191»   ​if·​(!rargs.​rv.​rv_int)​·​{
178»   ​»   ​rfile·​=·​rfs_file_add(file)​;​192»   ​»   ​rfile·​=·​rfs_file_add(file)​;​
181»   ​»   ​rfs_file_put(rfile)​;​195»   ​»   ​rfs_file_put(rfile)​;​
182»   ​}196»   ​}
183197
184-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​198+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
185»   ​rfs_context_deinit(&r​cont)​;​199»   ​rfs_context_deinit(&r​cont)​;​
186200
187»   ​rfs_inode_put(rinode)​;​201»   ​rfs_inode_put(rinode)​;​
198212
199»   ​rfile·​=·​rfs_file_find(file)​;​213»   ​rfile·​=·​rfs_file_find(file)​;​
200»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rfile->rdentry)​;​214»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rfile->rdentry)​;​
215+
201»   ​rfs_context_init(&rco​nt,​·​0)​;​216»   ​rfs_context_init(&rco​nt,​·​0)​;​
202217
203»   ​if·​(S_ISREG(inode->i_mod​e)​)​218»   ​if·​(S_ISREG(inode->i_mod​e)​)​
216»   ​rargs.​args.​f_release.​inode·​=·​inode;​231»   ​rargs.​args.​f_release.​inode·​=·​inode;​
217»   ​rargs.​args.​f_release.​file·​=·​file;​232»   ​rargs.​args.​f_release.​file·​=·​file;​
218233
219-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{234+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
220»   ​»   ​if·​(rfile->op_old·​&&·​rfile->op_old->releas​e)​235»   ​»   ​if·​(rfile->op_old·​&&·​rfile->op_old->releas​e)​
221»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfile->op_old->releas​e(236»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfile->op_old->releas​e(
222»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_release.​inode,​237»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_release.​inode,​
223»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_release.​file)​;​238»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_release.​file)​;​
224»   ​»   ​else239»   ​»   ​else
225»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​0;​240»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​0;​
226-»   ​}241+»   ​}·else
242+»   ​»   ​rargs.​rv.​rv_int·​=·​0;​
227243
228-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​244+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
229»   ​rfs_context_deinit(&r​cont)​;​245»   ​rfs_context_deinit(&r​cont)​;​
230246
231»   ​rfs_file_del(rfile)​;​247»   ​rfs_file_del(rfile)​;​
234»   ​return·​rargs.​rv.​rv_int;​250»   ​return·​rargs.​rv.​rv_int;​
235}251}
236252
253+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
237static·​int·​rfs_readdir(struct·​file·​*file,​·​void·​*dirent,​·​filldir_t·​filldir)​254static·​int·​rfs_readdir(struct·​file·​*file,​·​void·​*dirent,​·​filldir_t·​filldir)​
255+#else
256+static·​int·​rfs_iterate(struct·​file·​*file,​·​struct·​dir_context·​*dir_context)​
257+#endif
238{258{
239»   ​LIST_HEAD(sibs)​;​259»   ​LIST_HEAD(sibs)​;​
240»   ​struct·​rfs_dcache_entry·​*sib;​260»   ​struct·​rfs_dcache_entry·​*sib;​
246266
247»   ​rfile·​=·​rfs_file_find(file)​;​267»   ​rfile·​=·​rfs_file_find(file)​;​
248»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rfile->rdentry)​;​268»   ​rinfo·​=·​rfs_dentry_get_rinfo(​rfile->rdentry)​;​
269+
249»   ​rfs_context_init(&rco​nt,​·​0)​;​270»   ​rfs_context_init(&rco​nt,​·​0)​;​
250271
272+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
251»   ​if·​(S_ISDIR(file->f_dent​ry->d_inode->i_mode)​)​273»   ​if·​(S_ISDIR(file->f_dent​ry->d_inode->i_mode)​)​
252»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_FOP_READD​IR;​274»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_FOP_READD​IR;​
253-
254»   ​rargs.​args.​f_readdir.​file·​=·​file;​275»   ​rargs.​args.​f_readdir.​file·​=·​file;​
255»   ​rargs.​args.​f_readdir.​dirent·​=·​dirent;​276»   ​rargs.​args.​f_readdir.​dirent·​=·​dirent;​
256»   ​rargs.​args.​f_readdir.​filldir·​=·​filldir;​277»   ​rargs.​args.​f_readdir.​filldir·​=·​filldir;​
278+#elif·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
279+»   ​if·​(S_ISDIR(file->f_dent​ry->d_inode->i_mode)​)​
280+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_FOP_ITERA​TE;​
281+»   ​rargs.​args.​f_iterate.​file·​=·​file;​
282+»   ​rargs.​args.​f_iterate.​dir_context·​=·​dir_context;​
283+#else
284+»   ​if·​(S_ISDIR(file->f_path​.​dentry->d_inode->i_mo​de)​)​
285+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_FOP_ITERA​TE;​
286+»   ​rargs.​args.​f_iterate.​file·​=·​file;​
287+»   ​rargs.​args.​f_iterate.​dir_context·​=·​dir_context;​
288+#endif
257289
258-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{290+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
291+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
259»   ​»   ​if·​(rfile->op_old·​&&·​rfile->op_old->readdi​r)​·292»   ​»   ​if·​(rfile->op_old·​&&·​rfile->op_old->readdi​r)​·
260»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfile->op_old->readdi​r(293»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfile->op_old->readdi​r(
261»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_readdir.​file,​294»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_readdir.​file,​
262»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_readdir.​dirent,​295»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_readdir.​dirent,​
263»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_readdir.​filldir)​;​296»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_readdir.​filldir)​;​
297+#else
298+»   ​»   ​if·​(rfile->op_old·​&&·​rfile->op_old->iterat​e)​·
299+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfile->op_old->iterat​e(
300+»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_iterate.​file,​
301+»   ​»   ​»   ​»   ​»   ​rargs.​args.​f_iterate.​dir_context)​;​
302+#endif
264»   ​»   ​else303»   ​»   ​else
265»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOTDIR;​304»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOTDIR;​
266-»   ​}305+»   ​}·else
306+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOTDIR;​
267307
268-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​308+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
269»   ​rfs_context_deinit(&r​cont)​;​309»   ​rfs_context_deinit(&r​cont)​;​
270310
271»   ​if·​(rargs.​rv.​rv_int)​311»   ​if·​(rargs.​rv.​rv_int)​
272»   ​»   ​goto·​exit;​312»   ​»   ​goto·​exit;​
273313
314+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​19,​0)​)​
274»   ​if·​(rfs_dcache_get_subs(​file->f_dentry,​·​&sibs)​)​·​{315»   ​if·​(rfs_dcache_get_subs(​file->f_dentry,​·​&sibs)​)​·​{
275»   ​»   ​BUG()​;​316»   ​»   ​BUG()​;​
276»   ​»   ​goto·​exit;​317»   ​»   ​goto·​exit;​
277»   ​}318»   ​}
319+#else
320+»   ​if·​(rfs_dcache_get_subs(​file->f_path.​dentry,​·​&sibs)​)​·​{
321+»   ​»   ​BUG()​;​
322+»   ​»   ​goto·​exit;​
323+»   ​}
324+#endif
278325
279»   ​list_for_each_entry(s​ib,​·​&sibs,​·​list)​·​{326»   ​list_for_each_entry(s​ib,​·​&sibs,​·​list)​·​{
280»   ​»   ​rdentry·​=·​rfs_dentry_find(sib->​dentry)​;​327»   ​»   ​rdentry·​=·​rfs_dentry_find(sib->​dentry)​;​
310357
311static·​void·​rfs_file_set_ops_dir(​struct·​rfs_file·​*rfile)​358static·​void·​rfs_file_set_ops_dir(​struct·​rfs_file·​*rfile)​
312{359{
360+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​11,​0)​)​
313»   ​rfile->op_new.​readdir·​=·​rfs_readdir;​361»   ​rfile->op_new.​readdir·​=·​rfs_readdir;​
362+#else
363+»   ​rfile->op_new.​iterate·​=·​rfs_iterate;​
364+#endif
314}365}
315366
316static·​void·​rfs_file_set_ops_lnk(​struct·​rfs_file·​*rfile)​367static·​void·​rfs_file_set_ops_lnk(​struct·​rfs_file·​*rfile)​

driver.​org/​redirfs/​rfs_flt.​cdriver/​redirfs/​rfs_flt.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
134»   ​rv·​=·​rfs_flt_sysfs_init(rf​lt)​;​136»   ​rv·​=·​rfs_flt_sysfs_init(rf​lt)​;​
135»   ​if·​(rv)​·​{137»   ​if·​(rv)​·​{
136»   ​»   ​rfs_flt_put(rflt)​;​138»   ​»   ​rfs_flt_put(rflt)​;​
139+»   ​»   ​rfs_mutex_unlock(&rfs​_flt_list_mutex)​;​
137»   ​»   ​return·​ERR_PTR(rv)​;​140»   ​»   ​return·​ERR_PTR(rv)​;​
138»   ​}141»   ​}
139142

driver.​org/​redirfs/​rfs_info.​cdriver/​redirfs/​rfs_info.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
124{126{
125»   ​struct·​rfs_dentry·​*rdentry;​127»   ​struct·​rfs_dentry·​*rdentry;​
126128
129+»   ​if·​(!rinfo->rroot->dentr​y)​
130+»   ​»   ​return·​0;​
131+
127»   ​rdentry·​=·​rfs_dentry_add(rinfo-​>rroot->dentry,​·​rinfo)​;​132»   ​rdentry·​=·​rfs_dentry_add(rinfo-​>rroot->dentry,​·​rinfo)​;​
128»   ​if·​(IS_ERR(rdentry)​)​133»   ​if·​(IS_ERR(rdentry)​)​
129»   ​»   ​return·​PTR_ERR(rdentry)​;​134»   ​»   ​return·​PTR_ERR(rdentry)​;​
203»   ​rv·​=·​rfs_dcache_walk(dentr​y,​·​rfs_dcache_set,​·​rdata)​;​208»   ​rv·​=·​rfs_dcache_walk(dentr​y,​·​rfs_dcache_set,​·​rdata)​;​
204209
205»   ​if·​(rflt->ops·​&&·​rflt->ops->move_end)​210»   ​if·​(rflt->ops·​&&·​rflt->ops->move_end)​
206-»   ​»   ​rflt->ops->move_begin​()​;​211+»   ​»   ​rflt->ops->move_end()​;​
207212
208»   ​rfs_dcache_data_free(​rdata)​;​213»   ​rfs_dcache_data_free(​rdata)​;​
209214

driver.​org/​redirfs/​rfs_inode.​cdriver/​redirfs/​rfs_inode.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
30»   ​struct·​rfs_inode·​*rinode;​32»   ​struct·​rfs_inode·​*rinode;​
3133
32»   ​rinode·​=·​kmem_cache_zalloc(rfs​_inode_cache,​·​GFP_KERNEL)​;​34»   ​rinode·​=·​kmem_cache_zalloc(rfs​_inode_cache,​·​GFP_KERNEL)​;​
33-»   ​if·​(IS_ERR(rinode)​)​35+»   ​if·​(!rinode)​
34»   ​»   ​return·​ERR_PTR(-ENOMEM)​;​36»   ​»   ​return·​ERR_PTR(-ENOMEM)​;​
3537
36»   ​INIT_LIST_HEAD(&rinod​e->rdentries)​;​38»   ​INIT_LIST_HEAD(&rinod​e->rdentries)​;​
48»   ​»   ​memcpy(&rinode->op_ne​w,​·​inode->i_op,​50»   ​»   ​memcpy(&rinode->op_ne​w,​·​inode->i_op,​
49»   ​»   ​»   ​»   ​sizeof(struct·​inode_operations)​)​;​51»   ​»   ​»   ​»   ​sizeof(struct·​inode_operations)​)​;​
5052
53+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​17,​0)​)​
51»   ​rinode->op_new.​rename·​=·​rfs_rename;​54»   ​rinode->op_new.​rename·​=·​rfs_rename;​
55+#else
56+»   ​rinode->op_new.​rename·​=·​NULL;​
57+#endif
5258
59+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​15,​0)​)​
60+»   ​rinode->op_new.​rename2·​=·​rfs_rename2;​
61+#endif
53»   ​return·​rinode;​62»   ​return·​rinode;​
54}63}
5564
196struct·​rfs_info·​*rfs_inode_get_rinfo(​struct·​rfs_inode·​*rinode)​205struct·​rfs_info·​*rfs_inode_get_rinfo(​struct·​rfs_inode·​*rinode)​
197{206{
198»   ​struct·​rfs_info·​*rinfo;​207»   ​struct·​rfs_info·​*rinfo;​
208+»   ​
209+»   ​if·​(!rinode)​
210+»   ​»   ​return·​NULL;​
199211
200»   ​spin_lock(&rinode->lo​ck)​;​212»   ​spin_lock(&rinode->lo​ck)​;​
201»   ​rinfo·​=·​rfs_info_get(rinode->​rinfo)​;​213»   ​rinfo·​=·​rfs_info_get(rinode->​rinfo)​;​
280»   ​kmem_cache_destroy(rf​s_inode_cache)​;​292»   ​kmem_cache_destroy(rf​s_inode_cache)​;​
281}293}
282294
295+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
283static·​struct·​dentry·​*rfs_lookup(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​296static·​struct·​dentry·​*rfs_lookup(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​
284»   ​»   ​struct·​nameidata·​*nd)​297»   ​»   ​struct·​nameidata·​*nd)​
298+#else
299+static·​struct·​dentry·​*rfs_lookup(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​
300+»   ​»   ​unsigned·​int·​flags)​
301+#endif
285{302{
286»   ​struct·​rfs_inode·​*rinode;​303»   ​struct·​rfs_inode·​*rinode;​
287»   ​struct·​rfs_info·​*rinfo;​304»   ​struct·​rfs_info·​*rinfo;​
296313
297»   ​rinode·​=·​rfs_inode_find(dir)​;​314»   ​rinode·​=·​rfs_inode_find(dir)​;​
298»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​315»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
316+
299»   ​rfs_context_init(&rco​nt,​·​0)​;​317»   ​rfs_context_init(&rco​nt,​·​0)​;​
300318
301»   ​rargs.​args.​i_lookup.​dir·​=·​dir;​319»   ​rargs.​args.​i_lookup.​dir·​=·​dir;​
302»   ​rargs.​args.​i_lookup.​dentry·​=·​dentry;​320»   ​rargs.​args.​i_lookup.​dentry·​=·​dentry;​
321+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
303»   ​rargs.​args.​i_lookup.​nd·​=·​nd;​322»   ​rargs.​args.​i_lookup.​nd·​=·​nd;​
323+#else
324+»   ​rargs.​args.​i_lookup.​flags·​=·​flags;​
325+#endif
304326
305-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{327+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
306»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->looku​p)​328»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->looku​p)​
307»   ​»   ​»   ​rargs.​rv.​rv_dentry·​=·​rinode->op_old->looku​p(329»   ​»   ​»   ​rargs.​rv.​rv_dentry·​=·​rinode->op_old->looku​p(
308»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​dir,​330»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​dir,​
309»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​dentry,​331»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​dentry,​
332+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
310»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​nd)​;​333»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​nd)​;​
334+#else
335+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_lookup.​flags)​;​
336+#endif
311»   ​»   ​else337»   ​»   ​else
312»   ​»   ​»   ​rargs.​rv.​rv_dentry·​=·​ERR_PTR(-ENOSYS)​;​338»   ​»   ​»   ​rargs.​rv.​rv_dentry·​=·​ERR_PTR(-ENOSYS)​;​
313-»   ​}339+»   ​}·else
340+»   ​»   ​rargs.​rv.​rv_dentry·​=·​ERR_PTR(-ENOSYS)​;​
314341
315-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​342+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
316»   ​rfs_context_deinit(&r​cont)​;​343»   ​rfs_context_deinit(&r​cont)​;​
317344
318»   ​if·​(IS_ERR(rargs.​rv.​rv_dentry)​)​345»   ​if·​(IS_ERR(rargs.​rv.​rv_dentry)​)​
329»   ​return·​rargs.​rv.​rv_dentry;​356»   ​return·​rargs.​rv.​rv_dentry;​
330}357}
331358
359+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​3,​0)​)​
332static·​int·​rfs_mkdir(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​int·​mode)​360static·​int·​rfs_mkdir(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​int·​mode)​
361+#else
362+static·​int·​rfs_mkdir(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​umode_t·​mode)​
363+#endif
333{364{
334»   ​struct·​rfs_inode·​*rinode;​365»   ​struct·​rfs_inode·​*rinode;​
335»   ​struct·​rfs_info·​*rinfo;​366»   ​struct·​rfs_info·​*rinfo;​
338369
339»   ​rinode·​=·​rfs_inode_find(dir)​;​370»   ​rinode·​=·​rfs_inode_find(dir)​;​
340»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​371»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
372+
341»   ​rfs_context_init(&rco​nt,​·​0)​;​373»   ​rfs_context_init(&rco​nt,​·​0)​;​
342374
343»   ​if·​(S_ISDIR(dir->i_mode)​)​375»   ​if·​(S_ISDIR(dir->i_mode)​)​
349»   ​rargs.​args.​i_mkdir.​dentry·​=·​dentry;​381»   ​rargs.​args.​i_mkdir.​dentry·​=·​dentry;​
350»   ​rargs.​args.​i_mkdir.​mode·​=·​mode;​382»   ​rargs.​args.​i_mkdir.​mode·​=·​mode;​
351383
352-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{384+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
353»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->mkdir​)​385»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->mkdir​)​
354»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->mkdir​(386»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->mkdir​(
355»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mkdir.​dir,​387»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mkdir.​dir,​
357»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mkdir.​mode)​;​389»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mkdir.​mode)​;​
358»   ​»   ​else390»   ​»   ​else
359»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​391»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
360-»   ​}392+»   ​}·else
393+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
361394
362-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​395+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
363»   ​rfs_context_deinit(&r​cont)​;​396»   ​rfs_context_deinit(&r​cont)​;​
364397
365»   ​if·​(!rargs.​rv.​rv_int)​·​{398»   ​if·​(!rargs.​rv.​rv_int)​·​{
372»   ​return·​rargs.​rv.​rv_int;​405»   ​return·​rargs.​rv.​rv_int;​
373}406}
374407
408+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​3,​0)​)​
375static·​int·​rfs_create(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​int·​mode,​409static·​int·​rfs_create(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​int·​mode,​
376»   ​»   ​struct·​nameidata·​*nd)​410»   ​»   ​struct·​nameidata·​*nd)​
411+#elif·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
412+static·​int·​rfs_create(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​umode_t·​mode,​
413+»   ​»   ​struct·​nameidata·​*nd)​
414+#else
415+static·​int·​rfs_create(struct·​inode·​*dir,​·​struct·​dentry·​*dentry,​·​umode_t·​mode,​
416+»   ​»   ​bool·​flags)​
417+#endif
377{418{
378»   ​struct·​rfs_inode·​*rinode;​419»   ​struct·​rfs_inode·​*rinode;​
379»   ​struct·​rfs_info·​*rinfo;​420»   ​struct·​rfs_info·​*rinfo;​
382423
383»   ​rinode·​=·​rfs_inode_find(dir)​;​424»   ​rinode·​=·​rfs_inode_find(dir)​;​
384»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​425»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
426+
385»   ​rfs_context_init(&rco​nt,​·​0)​;​427»   ​rfs_context_init(&rco​nt,​·​0)​;​
386428
387»   ​if·​(S_ISDIR(dir->i_mode)​)​429»   ​if·​(S_ISDIR(dir->i_mode)​)​
392»   ​rargs.​args.​i_create.​dir·​=·​dir;​434»   ​rargs.​args.​i_create.​dir·​=·​dir;​
393»   ​rargs.​args.​i_create.​dentry·​=·​dentry;​435»   ​rargs.​args.​i_create.​dentry·​=·​dentry;​
394»   ​rargs.​args.​i_create.​mode·​=·​mode;​436»   ​rargs.​args.​i_create.​mode·​=·​mode;​
437+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
395»   ​rargs.​args.​i_create.​nd·​=·​nd;​438»   ​rargs.​args.​i_create.​nd·​=·​nd;​
439+#else
440+»   ​rargs.​args.​i_create.​flags·​=·​flags;​
441+#endif
396442
397-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{443+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
398»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->creat​e)​444»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->creat​e)​
399»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->creat​e(445»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->creat​e(
400»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​dir,​446»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​dir,​
401»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​dentry,​447»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​dentry,​
402»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​mode,​448»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​mode,​
449+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​6,​0)​)​
403»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​nd)​;​450»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​nd)​;​
451+#else
452+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_create.​flags)​;​
453+#endif
404»   ​»   ​else454»   ​»   ​else
405»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​455»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
406-»   ​}456+»   ​}·else
457+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
407458
408-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​459+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
409»   ​rfs_context_deinit(&r​cont)​;​460»   ​rfs_context_deinit(&r​cont)​;​
410461
411»   ​if·​(!rargs.​rv.​rv_int)​·​{462»   ​if·​(!rargs.​rv.​rv_int)​·​{
428479
429»   ​rinode·​=·​rfs_inode_find(dir)​;​480»   ​rinode·​=·​rfs_inode_find(dir)​;​
430»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​481»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
482+
431»   ​rfs_context_init(&rco​nt,​·​0)​;​483»   ​rfs_context_init(&rco​nt,​·​0)​;​
432484
433»   ​if·​(S_ISDIR(dir->i_mode)​)​485»   ​if·​(S_ISDIR(dir->i_mode)​)​
439»   ​rargs.​args.​i_link.​dir·​=·​dir;​491»   ​rargs.​args.​i_link.​dir·​=·​dir;​
440»   ​rargs.​args.​i_link.​dentry·​=·​dentry;​492»   ​rargs.​args.​i_link.​dentry·​=·​dentry;​
441493
442-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{494+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
443»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->link)​495»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->link)​
444»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->link(​496»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->link(​
445»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_link.​old_dentry,​497»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_link.​old_dentry,​
447»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_link.​dentry)​;​499»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_link.​dentry)​;​
448»   ​»   ​else500»   ​»   ​else
449»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​501»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
450-»   ​}502+»   ​}·else
503+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
451504
452-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​505+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
453»   ​rfs_context_deinit(&r​cont)​;​506»   ​rfs_context_deinit(&r​cont)​;​
454507
455»   ​if·​(!rargs.​rv.​rv_int)​·​{508»   ​if·​(!rargs.​rv.​rv_int)​·​{
472525
473»   ​rinode·​=·​rfs_inode_find(dir)​;​526»   ​rinode·​=·​rfs_inode_find(dir)​;​
474»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​527»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
528+
475»   ​rfs_context_init(&rco​nt,​·​0)​;​529»   ​rfs_context_init(&rco​nt,​·​0)​;​
476530
477»   ​if·​(S_ISDIR(dir->i_mode)​)​531»   ​if·​(S_ISDIR(dir->i_mode)​)​
483»   ​rargs.​args.​i_symlink.​dentry·​=·​dentry;​537»   ​rargs.​args.​i_symlink.​dentry·​=·​dentry;​
484»   ​rargs.​args.​i_symlink.​oldname·​=·​oldname;​538»   ​rargs.​args.​i_symlink.​oldname·​=·​oldname;​
485539
486-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{540+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
487»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->symli​nk)​541»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->symli​nk)​
488»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->symli​nk(542»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->symli​nk(
489»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_symlink.​dir,​543»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_symlink.​dir,​
491»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_symlink.​oldname)​;​545»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_symlink.​oldname)​;​
492»   ​»   ​else546»   ​»   ​else
493»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​547»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
494-»   ​}548+»   ​}·else
549+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
495550
496-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​551+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
497»   ​rfs_context_deinit(&r​cont)​;​552»   ​rfs_context_deinit(&r​cont)​;​
498553
499»   ​if·​(!rargs.​rv.​rv_int)​·​{554»   ​if·​(!rargs.​rv.​rv_int)​·​{
506»   ​return·​rargs.​rv.​rv_int;​561»   ​return·​rargs.​rv.​rv_int;​
507}562}
508563
564+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​·​3,​·​0)​)​
509static·​int·​rfs_mknod(struct·​inode·​*·​dir,​·​struct·​dentry·​*dentry,​·​int·​mode,​565static·​int·​rfs_mknod(struct·​inode·​*·​dir,​·​struct·​dentry·​*dentry,​·​int·​mode,​
510»   ​»   ​dev_t·​rdev)​566»   ​»   ​dev_t·​rdev)​
567+#else
568+static·​int·​rfs_mknod(struct·​inode·​*·​dir,​·​struct·​dentry·​*dentry,​·​umode_t·​mode,​
569+»   ​»   ​dev_t·​rdev)​
570+#endif
511{571{
512»   ​struct·​rfs_inode·​*rinode;​572»   ​struct·​rfs_inode·​*rinode;​
513»   ​struct·​rfs_info·​*rinfo;​573»   ​struct·​rfs_info·​*rinfo;​
516576
517»   ​rinode·​=·​rfs_inode_find(dir)​;​577»   ​rinode·​=·​rfs_inode_find(dir)​;​
518»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​578»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
579+
519»   ​rfs_context_init(&rco​nt,​·​0)​;​580»   ​rfs_context_init(&rco​nt,​·​0)​;​
520581
521»   ​if·​(S_ISDIR(dir->i_mode)​)​582»   ​if·​(S_ISDIR(dir->i_mode)​)​
528»   ​rargs.​args.​i_mknod.​mode·​=·​mode;​589»   ​rargs.​args.​i_mknod.​mode·​=·​mode;​
529»   ​rargs.​args.​i_mknod.​rdev·​=·​rdev;​590»   ​rargs.​args.​i_mknod.​rdev·​=·​rdev;​
530591
531-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{592+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
532»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->mknod​)​593»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->mknod​)​
533»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->mknod​(594»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->mknod​(
534»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mknod.​dir,​595»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mknod.​dir,​
537»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mknod.​rdev)​;​598»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_mknod.​rdev)​;​
538»   ​»   ​else599»   ​»   ​else
539»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​600»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
540-»   ​}601+»   ​}·else
602+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
541603
542-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​604+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
543»   ​rfs_context_deinit(&r​cont)​;​605»   ​rfs_context_deinit(&r​cont)​;​
544606
545»   ​if·​(!rargs.​rv.​rv_int)​·​{607»   ​if·​(!rargs.​rv.​rv_int)​·​{
561623
562»   ​rinode·​=·​rfs_inode_find(inode)​;​624»   ​rinode·​=·​rfs_inode_find(inode)​;​
563»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​625»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
626+
564»   ​rfs_context_init(&rco​nt,​·​0)​;​627»   ​rfs_context_init(&rco​nt,​·​0)​;​
565628
566»   ​if·​(S_ISDIR(inode->i_mod​e)​)​629»   ​if·​(S_ISDIR(inode->i_mod​e)​)​
571»   ​rargs.​args.​i_unlink.​dir·​=·​inode;​634»   ​rargs.​args.​i_unlink.​dir·​=·​inode;​
572»   ​rargs.​args.​i_unlink.​dentry·​=·​dentry;​635»   ​rargs.​args.​i_unlink.​dentry·​=·​dentry;​
573636
574-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{637+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
575»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->unlin​k)​638»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->unlin​k)​
576»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->unlin​k(639»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->unlin​k(
577»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dir,​640»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dir,​
578»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dentry)​;​641»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dentry)​;​
579»   ​»   ​else642»   ​»   ​else
580»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​643»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
581-»   ​}644+»   ​}else
645+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
582646
583-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​647+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
584»   ​rfs_context_deinit(&r​cont)​;​648»   ​rfs_context_deinit(&r​cont)​;​
585649
586»   ​rfs_inode_put(rinode)​;​650»   ​rfs_inode_put(rinode)​;​
597661
598»   ​rinode·​=·​rfs_inode_find(inode)​;​662»   ​rinode·​=·​rfs_inode_find(inode)​;​
599»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​663»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
664+
600»   ​rfs_context_init(&rco​nt,​·​0)​;​665»   ​rfs_context_init(&rco​nt,​·​0)​;​
601666
602»   ​if·​(S_ISDIR(inode->i_mod​e)​)​667»   ​if·​(S_ISDIR(inode->i_mod​e)​)​
607»   ​rargs.​args.​i_unlink.​dir·​=·​inode;​672»   ​rargs.​args.​i_unlink.​dir·​=·​inode;​
608»   ​rargs.​args.​i_unlink.​dentry·​=·​dentry;​673»   ​rargs.​args.​i_unlink.​dentry·​=·​dentry;​
609674
610-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{675+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
611»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->rmdir​)​676»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->rmdir​)​
612»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->rmdir​(677»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->rmdir​(
613»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dir,​678»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dir,​
614»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dentry)​;​679»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_unlink.​dentry)​;​
615»   ​»   ​else680»   ​»   ​else
616»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​681»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
617-»   ​}682+»   ​}·else
683+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
618684
619-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​685+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
620»   ​rfs_context_deinit(&r​cont)​;​686»   ​rfs_context_deinit(&r​cont)​;​
621687
622»   ​rfs_inode_put(rinode)​;​688»   ​rfs_inode_put(rinode)​;​
624»   ​return·​rargs.​rv.​rv_int;​690»   ​return·​rargs.​rv.​rv_int;​
625}691}
626692
627-#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​27)​693+#if·(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​27)​)​
628694
629static·​int·​rfs_permission(struct​·​inode·​*inode,​·​int·​mask,​·​struct·​nameidata·​*nd)​695static·​int·​rfs_permission(struct​·​inode·​*inode,​·​int·​mask,​·​struct·​nameidata·​*nd)​
630{696{
637»   ​submask·​=·​mask·​&·​~MAY_APPEND;​703»   ​submask·​=·​mask·​&·​~MAY_APPEND;​
638»   ​rinode·​=·​rfs_inode_find(inode)​;​704»   ​rinode·​=·​rfs_inode_find(inode)​;​
639»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​705»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
706+
640»   ​rfs_context_init(&rco​nt,​·​0)​;​707»   ​rfs_context_init(&rco​nt,​·​0)​;​
641708
642»   ​if·​(S_ISREG(inode->i_mod​e)​)​709»   ​if·​(S_ISREG(inode->i_mod​e)​)​
658»   ​rargs.​args.​i_permission.​mask·​=·​mask;​725»   ​rargs.​args.​i_permission.​mask·​=·​mask;​
659»   ​rargs.​args.​i_permission.​nd·​=·​nd;​726»   ​rargs.​args.​i_permission.​nd·​=·​nd;​
660727
661-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{728+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
662»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->permi​ssion)​729»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->permi​ssion)​
663»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->permi​ssion(730»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->permi​ssion(
664»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​inode,​731»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​inode,​
667»   ​»   ​else734»   ​»   ​else
668»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​735»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​
669»   ​»   ​»   ​»   ​»   ​NULL)​;​736»   ​»   ​»   ​»   ​»   ​NULL)​;​
670-»   ​}737+»   ​}·else
738+»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​
739+»   ​»   ​»   ​»   ​NULL)​;​
671740
672-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​741+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
673»   ​rfs_context_deinit(&r​cont)​;​742»   ​rfs_context_deinit(&r​cont)​;​
674743
675»   ​rfs_inode_put(rinode)​;​744»   ​rfs_inode_put(rinode)​;​
677»   ​return·​rargs.​rv.​rv_int;​746»   ​return·​rargs.​rv.​rv_int;​
678}747}
679748
680-#else749+#elif·(LINUX_VERSION_CODE·<·KERNEL_VERSION(2,​6,​38)​)​
681750
682static·​int·​rfs_permission(struct​·​inode·​*inode,​·​int·​mask)​751static·​int·​rfs_permission(struct​·​inode·​*inode,​·​int·​mask)​
683{752{
690»   ​submask·​=·​mask·​&·​~MAY_APPEND;​759»   ​submask·​=·​mask·​&·​~MAY_APPEND;​
691»   ​rinode·​=·​rfs_inode_find(inode)​;​760»   ​rinode·​=·​rfs_inode_find(inode)​;​
692»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​761»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
762+
693»   ​rfs_context_init(&rco​nt,​·​0)​;​763»   ​rfs_context_init(&rco​nt,​·​0)​;​
694764
695»   ​if·​(S_ISREG(inode->i_mod​e)​)​765»   ​if·​(S_ISREG(inode->i_mod​e)​)​
710»   ​rargs.​args.​i_permission.​inode·​=·​inode;​780»   ​rargs.​args.​i_permission.​inode·​=·​inode;​
711»   ​rargs.​args.​i_permission.​mask·​=·​mask;​781»   ​rargs.​args.​i_permission.​mask·​=·​mask;​
712782
713-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{783+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
714»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->permi​ssion)​784»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->permi​ssion)​
715»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->permi​ssion(785»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->permi​ssion(
716»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​inode,​786»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​inode,​
718»   ​»   ​else788»   ​»   ​else
719»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​789»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​
720»   ​»   ​»   ​»   ​»   ​NULL)​;​790»   ​»   ​»   ​»   ​»   ​NULL)​;​
721-»   ​}791+»   ​}·else
792+»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​
793+»   ​»   ​»   ​»   ​NULL)​;​
794+
795+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
796+»   ​rfs_context_deinit(&r​cont)​;​
797+
798+»   ​rfs_inode_put(rinode)​;​
799+»   ​rfs_info_put(rinfo)​;​
800+»   ​return·​rargs.​rv.​rv_int;​
801+}
802+
803+#elif·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​1,​0)​)​
804+
805+static·​int·​rfs_permission(struct​·​inode·​*inode,​·​int·​mask,​·​unsigned·​int·​flags)​
806+{
807+»   ​struct·​rfs_inode·​*rinode;​
808+»   ​struct·​rfs_info·​*rinfo;​
809+»   ​struct·​rfs_context·​rcont;​
810+»   ​struct·​redirfs_args·​rargs;​
811+»   ​int·​submask;​
812+
813+»   ​submask·​=·​mask·​&·​~MAY_APPEND;​
814+»   ​rinode·​=·​rfs_inode_find(inode)​;​
815+»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
816+
817+»   ​rfs_context_init(&rco​nt,​·​0)​;​
818+
819+»   ​if·​(S_ISREG(inode->i_mod​e)​)​
820+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_REG_IOP_PERMI​SSION;​
821+»   ​else·​if·​(S_ISDIR(inode->i_mod​e)​)​
822+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_IOP_PERMI​SSION;​
823+»   ​else·​if·​(S_ISLNK(inode->i_mod​e)​)​
824+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_LNK_IOP_PERMI​SSION;​
825+»   ​else·​if·​(S_ISCHR(inode->i_mod​e)​)​
826+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_CHR_IOP_PERMI​SSION;​
827+»   ​else·​if·​(S_ISBLK(inode->i_mod​e)​)​
828+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_BLK_IOP_PERMI​SSION;​
829+»   ​else·​if·​(S_ISFIFO(inode->i_mo​de)​)​
830+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_FIFO_IOP_PERM​ISSION;​
831+»   ​else·
832+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_SOCK_IOP_PERM​ISSION;​
833+
834+»   ​rargs.​args.​i_permission.​inode·​=·​inode;​
835+»   ​rargs.​args.​i_permission.​mask·​=·​mask;​
836+»   ​rargs.​args.​i_permission.​flags·​=·​flags;​
837+
838+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
839+»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->permi​ssion)​
840+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->permi​ssion(
841+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​inode,​
842+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​mask,​
843+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​flags)​;​
844+»   ​»   ​else
845+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​
846+»   ​»   ​»   ​»   ​»   ​flags,​·​NULL)​;​
847+»   ​}·​else
848+»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask,​
849+»   ​»   ​»   ​»   ​flags,​·​NULL)​;​
850+
851+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
852+»   ​rfs_context_deinit(&r​cont)​;​
853+
854+»   ​rfs_inode_put(rinode)​;​
855+»   ​rfs_info_put(rinfo)​;​
856+»   ​return·​rargs.​rv.​rv_int;​
857+}
858+
859+#else
860+
861+static·​int·​rfs_permission(struct​·​inode·​*inode,​·​int·​mask)​
862+{
863+»   ​struct·​rfs_inode·​*rinode;​
864+»   ​struct·​rfs_info·​*rinfo;​
865+»   ​struct·​rfs_context·​rcont;​
866+»   ​struct·​redirfs_args·​rargs;​
867+»   ​int·​submask;​
868+
869+»   ​submask·​=·​mask·​&·​~MAY_APPEND;​
870+»   ​rinode·​=·​rfs_inode_find(inode)​;​
871+»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
872+
873+»   ​rfs_context_init(&rco​nt,​·​0)​;​
874+
875+»   ​if·​(S_ISREG(inode->i_mod​e)​)​
876+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_REG_IOP_PERMI​SSION;​
877+»   ​else·​if·​(S_ISDIR(inode->i_mod​e)​)​
878+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_IOP_PERMI​SSION;​
879+»   ​else·​if·​(S_ISLNK(inode->i_mod​e)​)​
880+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_LNK_IOP_PERMI​SSION;​
881+»   ​else·​if·​(S_ISCHR(inode->i_mod​e)​)​
882+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_CHR_IOP_PERMI​SSION;​
883+»   ​else·​if·​(S_ISBLK(inode->i_mod​e)​)​
884+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_BLK_IOP_PERMI​SSION;​
885+»   ​else·​if·​(S_ISFIFO(inode->i_mo​de)​)​
886+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_FIFO_IOP_PERM​ISSION;​
887+»   ​else·
888+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_SOCK_IOP_PERM​ISSION;​
889+
890+»   ​rargs.​args.​i_permission.​inode·​=·​inode;​
891+»   ​rargs.​args.​i_permission.​mask·​=·​mask;​
892+
893+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
894+»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->permi​ssion)​
895+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->permi​ssion(
896+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​inode,​
897+»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_permission.​mask)​;​
898+»   ​»   ​else
899+»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask)​;​
900+»   ​}·​else
901+»   ​»   ​rargs.​rv.​rv_int·​=·​generic_permission(in​ode,​·​submask)​;​
722902
723-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​903+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
724»   ​rfs_context_deinit(&r​cont)​;​904»   ​rfs_context_deinit(&r​cont)​;​
725905
726»   ​rfs_inode_put(rinode)​;​906»   ​rfs_inode_put(rinode)​;​
739»   ​if·​(rv)​919»   ​if·​(rv)​
740»   ​»   ​return·​rv;​920»   ​»   ​return·​rv;​
741921
742-#if·​LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​34)​922+#if·(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(2,​6,​34)​)​
743»   ​if·​((iattr->ia_valid·​&·​ATTR_UID·​&&·​iattr->ia_uid·​!=·​inode->i_uid)​·​||923»   ​if·​((iattr->ia_valid·​&·​ATTR_UID·​&&·​iattr->ia_uid·​!=·​inode->i_uid)​·​||
744»   ​····​(iattr->ia_valid·​&·​ATTR_GID·​&&·​iattr->ia_gid·​!=·​inode->i_gid)​)​924»   ​····​(iattr->ia_valid·​&·​ATTR_GID·​&&·​iattr->ia_gid·​!=·​inode->i_gid)​)​
745»   ​»   ​return·​rfs_dq_transfer(inode​,​·​iattr)​·​?·​-EDQUOT·​:​·​0;​925»   ​»   ​return·​rfs_dq_transfer(inode​,​·​iattr)​·​?·​-EDQUOT·​:​·​0;​
746#endif926#endif
747927
748-»   ​return·​inode_setattr(inode,​·​iattr)​;​928+»   ​return·rfs_inode_setattr(ino​de,​·​iattr)​;​
749}929}
750930
751static·​int·​rfs_setattr(struct·​dentry·​*dentry,​·​struct·​iattr·​*iattr)​931static·​int·​rfs_setattr(struct·​dentry·​*dentry,​·​struct·​iattr·​*iattr)​
757937
758»   ​rinode·​=·​rfs_inode_find(dentry​->d_inode)​;​938»   ​rinode·​=·​rfs_inode_find(dentry​->d_inode)​;​
759»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​939»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​
940+
760»   ​rfs_context_init(&rco​nt,​·​0)​;​941»   ​rfs_context_init(&rco​nt,​·​0)​;​
761942
762»   ​if·​(S_ISREG(dentry->d_in​ode->i_mode)​)​943»   ​if·​(S_ISREG(dentry->d_in​ode->i_mode)​)​
777»   ​rargs.​args.​i_setattr.​dentry·​=·​dentry;​958»   ​rargs.​args.​i_setattr.​dentry·​=·​dentry;​
778»   ​rargs.​args.​i_setattr.​iattr·​=·​iattr;​959»   ​rargs.​args.​i_setattr.​iattr·​=·​iattr;​
779960
780-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{961+»   ​if·​(!rfs_precall_flts(ri​nfo,​·​&rcont,​·​&rargs)​)​·​{
781»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->setat​tr)​962»   ​»   ​if·​(rinode->op_old·​&&·​rinode->op_old->setat​tr)​
782»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->setat​tr(963»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rinode->op_old->setat​tr(
783»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_setattr.​dentry,​964»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_setattr.​dentry,​
784»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_setattr.​iattr)​;​965»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_setattr.​iattr)​;​
785»   ​»   ​else·966»   ​»   ​else·
786»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_setattr_default(d​entry,​·​iattr)​;​967»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_setattr_default(d​entry,​·​iattr)​;​
787-»   ​}968+»   ​}·else
969+»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_setattr_default(d​entry,​·​iattr)​;​
788970
789-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​971+»   ​rfs_postcall_flts(rin​fo,​·​&rcont,​·​&rargs)​;​
790»   ​rfs_context_deinit(&r​cont)​;​972»   ​rfs_context_deinit(&r​cont)​;​
791973
792»   ​rfs_inode_put(rinode)​;​974»   ​rfs_inode_put(rinode)​;​
794»   ​return·​rargs.​rv.​rv_int;​976»   ​return·​rargs.​rv.​rv_int;​
795}977}
796978
979+static·​int·​rfs_precall_flts_rena​me(struct·​rfs_info·​*rinfo,​
980+»   ​»   ​struct·​rfs_context·​*rcont,​·​struct·​redirfs_args·​*rargs)​
981+{
982+»   ​struct·​redirfs_filter_operat​ions·​*ops;​
983+»   ​enum·​redirfs_rv·​(*rop)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​
984+»   ​enum·​redirfs_rv·​rv;​
985+
986+»   ​if·​(!rinfo)​
987+»   ​»   ​return·​0;​
988+
989+»   ​if·​(!rinfo->rchain)​
990+»   ​»   ​return·​0;​
991+
992+»   ​rargs->type.​call·​=·​REDIRFS_PRECALL;​
993+
994+»   ​rcont->idx·​=·​rcont->idx_start;​
995+
996+»   ​for·​(;​·​rcont->idx·​<·​rinfo->rchain->rflts_​nr;​·​rcont->idx++)​·​{
997+»   ​»   ​if·​(!atomic_read(&rinfo-​>rchain->rflts[rcont-​>idx]->active)​)​
998+»   ​»   ​»   ​continue;​
999+
1000+»   ​»   ​ops·​=·​rinfo->rchain->rflts[​rcont->idx]->ops;​
1001+»   ​»   ​if·​(!ops)​
1002+»   ​»   ​»   ​continue;​
1003+»   ​»   ​rop·​=·​ops->pre_rename;​
1004+»   ​»   ​if·​(!rop)​
1005+»   ​»   ​»   ​continue;​
1006+
1007+»   ​»   ​rv·​=·​rop(rcont,​·​rargs)​;​
1008+»   ​»   ​if·​(rv·​==·​REDIRFS_STOP)​
1009+»   ​»   ​»   ​return·​-1;​
1010+»   ​}
1011+
1012+»   ​rcont->idx--;​
1013+
1014+»   ​return·​0;​
1015+}
1016+
1017+static·​void·​rfs_postcall_flts_ren​ame(struct·​rfs_info·​*rinfo,​
1018+»   ​»   ​struct·​rfs_context·​*rcont,​·​struct·​redirfs_args·​*rargs)​
1019+{
1020+»   ​struct·​redirfs_filter_operat​ions·​*ops;​
1021+»   ​enum·​redirfs_rv·​(*rop)​(redirfs_context,​·​struct·​redirfs_args·​*)​;​
1022+
1023+»   ​if·​(!rinfo)​
1024+»   ​»   ​return;​
1025+
1026+»   ​if·​(!rinfo->rchain)​
1027+»   ​»   ​return;​
1028+
1029+»   ​rargs->type.​call·​=·​REDIRFS_POSTCALL;​
1030+
1031+»   ​for·​(;​·​rcont->idx·​>=·​rcont->idx_start;​·​rcont->idx--)​·​{
1032+»   ​»   ​if·​(!atomic_read(&rinfo-​>rchain->rflts[rcont-​>idx]->active)​)​
1033+»   ​»   ​»   ​continue;​
1034+
1035+»   ​»   ​ops·​=·​rinfo->rchain->rflts[​rcont->idx]->ops;​
1036+»   ​»   ​if·​(!ops)​
1037+»   ​»   ​»   ​continue;​
1038+»   ​»   ​rop·​=·​ops->post_rename;​
1039+»   ​»   ​if·​(rop)​·
1040+»   ​»   ​»   ​rop(rcont,​·​rargs)​;​
1041+»   ​}
1042+
1043+»   ​rcont->idx++;​
1044+}
1045+
1046+#if·​(LINUX_VERSION_CODE·​<·​KERNEL_VERSION(3,​17,​0)​)​
797int·​rfs_rename(struct·​inode·​*old_dir,​·​struct·​dentry·​*old_dentry,​1047int·​rfs_rename(struct·​inode·​*old_dir,​·​struct·​dentry·​*old_dentry,​
798»   ​»   ​struct·​inode·​*new_dir,​·​struct·​dentry·​*new_dentry)​1048»   ​»   ​struct·​inode·​*new_dir,​·​struct·​dentry·​*new_dentry)​
799{1049{
800-»   ​struct·​rfs_inode·​*rinode;​1050+»   ​struct·​rfs_inode·​*rinode_old;​
801-»   ​struct·​rfs_info·​*rinfo;​1051+»   ​struct·​rfs_inode·​*rinode_new;​
802-»   ​struct·​rfs_context·rcont;​1052+»   ​struct·​rfs_info·*rinfo_old;​
1053+»   ​struct·​rfs_info·​*rinfo_new;​
1054+»   ​struct·​rfs_context·​rcont_old;​
1055+»   ​struct·​rfs_context·​rcont_new;​
803»   ​struct·​redirfs_args·​rargs;​1056»   ​struct·​redirfs_args·​rargs;​
8041057
805-»   ​rinode·=·rfs_inode_find(old_di​r)​;​1058+»   ​rfs_context_init(&rco​nt_old,​·0)​;​
806-»   ​rinfo·​=·​rfs_inode_get_rinfo(r​inode)​;​1059+»   ​rinode_old·​=·​rfs_inode_find(old_di​r)​;​
807-»   ​rfs_context_init(&rco​nt,​·0)​;​1060+»   ​rinfo_old·=·rfs_inode_get_rinfo(r​inode_old)​;​
1061+
1062+»   ​rfs_context_init(&rco​nt_new,​·​0)​;​
1063+
1064+»   ​rinode_new·​=·​rfs_inode_find(new_di​r)​;​
1065+»   ​rinfo_new·​=·​rfs_inode_get_rinfo(r​inode_new)​;​
8081066
809»   ​if·​(S_ISDIR(old_dir->i_m​ode)​)​1067»   ​if·​(S_ISDIR(old_dir->i_m​ode)​)​
810»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_IOP_RENAM​E;​1068»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_IOP_RENAM​E;​
815»   ​rargs.​args.​i_rename.​old_dentry·​=·​old_dentry;​1073»   ​rargs.​args.​i_rename.​old_dentry·​=·​old_dentry;​
816»   ​rargs.​args.​i_rename.​new_dir·​=·​new_dir;​1074»   ​rargs.​args.​i_rename.​new_dir·​=·​new_dir;​
817»   ​rargs.​args.​i_rename.​new_dentry·​=·​new_dentry;​1075»   ​rargs.​args.​i_rename.​new_dentry·​=·​new_dentry;​
1076+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​15,​0)​)​
1077+»   ​rargs.​args.​i_rename.​flags·​=·​0;​
1078+#endif
8181079
819-»   ​if·​(!rfs_precall_flts(ri​nfo->rchain,​·​&rcont,​·​&rargs)​)​·​{1080+»   ​if·​(rfs_precall_flts(rin​fo_old,​·​&rcont_old,​·​&rargs)​)​·​{
820-»   ​»   ​if·(rinode->op_old·&&·rinode->op_old->renam​e)​1081+»   ​»   ​rargs.​rv.​rv_int·=·-ENOSYS;​
821-»   ​»   ​»   ​rargs.​rv.​rv_int·=·rinode->op_old->renam​e(1082+»   ​»   ​goto·skip;​
822-»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​
823-»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dentry,​
824-»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​
825-»   ​»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry)​;​
826-»   ​»   ​else
827-»   ​»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
828»   ​}1083»   ​}
8291084
1085+»   ​if·​(rfs_precall_flts_ren​ame(rinfo_new,​·​&rcont_new,​·​&rargs)​)​·​{
1086+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
1087+»   ​»   ​goto·​skip;​
1088+»   ​}
1089+
1090+»   ​if·​(rinode_old->op_old·​&&·​rinode_old->op_old->r​ename)​
1091+»   ​»   ​rargs.​rv.​rv_int·​=·​rinode_old->op_old->r​ename(
1092+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​
1093+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dentry,​
1094+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​
1095+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry)​;​
1096+»   ​else
1097+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
1098+»   ​
1099+skip:​
830»   ​if·​(!rargs.​rv.​rv_int)​1100»   ​if·​(!rargs.​rv.​rv_int)​
831»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_fsrename(1101»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_fsrename(
832»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​1102»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​
834»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​1104»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​
835»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry)​;​1105»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry)​;​
8361106
837-»   ​rfs_postcall_flts(rin​fo->rchain,​·​&rcont,​·​&rargs)​;​1107+»   ​rfs_postcall_flts_ren​ame(rinfo_new,​·​&rcont_new,​·​&rargs)​;​
838-»   ​rfs_context_deinit(&r​cont)​;​1108+»   ​rfs_postcall_flts(rin​fo_old,​·&rcont_old,​·&rargs)​;​
8391109
840-»   ​rfs_inode_put(rinode)​;​1110+»   ​rfs_context_deinit(&r​cont_old)​;​
841-»   ​rfs_info_put(rinfo)​;​1111+»   ​rfs_context_deinit(&r​cont_new)​;​
1112+»   ​rfs_inode_put(rinode_​old)​;​
1113+»   ​rfs_inode_put(rinode_​new)​;​
1114+»   ​rfs_info_put(rinfo_ol​d)​;​
1115+»   ​rfs_info_put(rinfo_ne​w)​;​
842»   ​return·​rargs.​rv.​rv_int;​1116»   ​return·​rargs.​rv.​rv_int;​
843}1117}
1118+#endif
1119+
1120+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​15,​0)​)​
1121+int·​rfs_rename2(struct·​inode·​*old_dir,​·​struct·​dentry·​*old_dentry,​
1122+»   ​»   ​struct·​inode·​*new_dir,​·​struct·​dentry·​*new_dentry,​·​unsigned·​int·​flags)​
1123+{
1124+»   ​struct·​rfs_inode·​*rinode_old;​
1125+»   ​struct·​rfs_inode·​*rinode_new;​
1126+»   ​struct·​rfs_info·​*rinfo_old;​
1127+»   ​struct·​rfs_info·​*rinfo_new;​
1128+»   ​struct·​rfs_context·​rcont_old;​
1129+»   ​struct·​rfs_context·​rcont_new;​
1130+»   ​struct·​redirfs_args·​rargs;​
1131+
1132+»   ​rfs_context_init(&rco​nt_old,​·​0)​;​
1133+»   ​rinode_old·​=·​rfs_inode_find(old_di​r)​;​
1134+»   ​rinfo_old·​=·​rfs_inode_get_rinfo(r​inode_old)​;​
1135+
1136+»   ​rfs_context_init(&rco​nt_new,​·​0)​;​
1137+»   ​rinode_new·​=·​rfs_inode_find(new_di​r)​;​
1138+»   ​rinfo_new·​=·​rfs_inode_get_rinfo(r​inode_new)​;​
1139+
1140+»   ​if·​(S_ISDIR(old_dir->i_m​ode)​)​
1141+»   ​»   ​rargs.​type.​id·​=·​REDIRFS_DIR_IOP_RENAM​E;​
1142+»   ​else
1143+»   ​»   ​BUG()​;​
8441144
1145+»   ​rargs.​args.​i_rename.​old_dir·​=·​old_dir;​
1146+»   ​rargs.​args.​i_rename.​old_dentry·​=·​old_dentry;​
1147+»   ​rargs.​args.​i_rename.​new_dir·​=·​new_dir;​
1148+»   ​rargs.​args.​i_rename.​new_dentry·​=·​new_dentry;​
1149+»   ​rargs.​args.​i_rename.​flags·​=·​flags;​
1150+
1151+»   ​if·​(rfs_precall_flts(rin​fo_old,​·​&rcont_old,​·​&rargs)​)​·​{
1152+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
1153+»   ​»   ​goto·​skip;​
1154+»   ​}
1155+
1156+»   ​if·​(rfs_precall_flts_ren​ame(rinfo_new,​·​&rcont_new,​·​&rargs)​)​·​{
1157+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
1158+»   ​»   ​goto·​skip;​
1159+»   ​}
1160+
1161+»   ​if·​(rinode_old->op_old·​&&·​rinode_old->op_old->r​ename2)​
1162+»   ​»   ​rargs.​rv.​rv_int·​=·​rinode_old->op_old->r​ename2(
1163+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​
1164+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dentry,​
1165+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​
1166+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry,​
1167+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​flags)​;​
1168+#if·​(LINUX_VERSION_CODE·​>=·​KERNEL_VERSION(3,​17,​0)​)​
1169+»   ​else·​if·​(rinode_old->op_old·​&&·​rinode_old->op_old->r​ename)​
1170+»   ​»   ​rargs.​rv.​rv_int·​=·​rinode_old->op_old->r​ename(
1171+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​
1172+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dentry,​
1173+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​
1174+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry)​;​
1175+#endif
1176+»   ​else
1177+»   ​»   ​rargs.​rv.​rv_int·​=·​-ENOSYS;​
1178+
1179+skip:​
1180+»   ​if·​(!rargs.​rv.​rv_int)​
1181+»   ​»   ​rargs.​rv.​rv_int·​=·​rfs_fsrename(
1182+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dir,​
1183+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​old_dentry,​
1184+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dir,​
1185+»   ​»   ​»   ​»   ​rargs.​args.​i_rename.​new_dentry)​;​
1186+
1187+»   ​rfs_postcall_flts_ren​ame(rinfo_new,​·​&rcont_new,​·​&rargs)​;​
1188+»   ​rfs_postcall_flts(rin​fo_old,​·​&rcont_old,​·​&rargs)​;​
1189+
1190+»   ​rfs_context_deinit(&r​cont_old)​;​
1191+»   ​rfs_context_deinit(&r​cont_new)​;​
1192+»   ​rfs_inode_put(rinode_​old)​;​
1193+»   ​rfs_inode_put(rinode_​new)​;​
1194+»   ​rfs_info_put(rinfo_ol​d)​;​
1195+»   ​rfs_info_put(rinfo_ne​w)​;​
1196+»   ​return·​rargs.​rv.​rv_int;​
1197+}
1198+#endif
8451199
846static·​void·​rfs_inode_set_ops_reg​(struct·​rfs_inode·​*rinode)​1200static·​void·​rfs_inode_set_ops_reg​(struct·​rfs_inode·​*rinode)​
847{1201{

driver.​org/​redirfs/​rfs_ops.​cdriver/​redirfs/​rfs_ops.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
29»   ​char·​*arr;​31»   ​char·​*arr;​
3032
31»   ​rops·​=·​kzalloc(sizeof(struct​·​rfs_ops)​,​·​GFP_KERNEL)​;​33»   ​rops·​=·​kzalloc(sizeof(struct​·​rfs_ops)​,​·​GFP_KERNEL)​;​
32-»   ​arr·=·kzalloc(sizeof(char)​·*·REDIRFS_OP_END,​·GFP_KERNEL)​;​34+»   ​if·(!rops)​
35+»   ​»   ​return·​ERR_PTR(-ENOMEM)​;​
3336
34-»   ​if·(!rops·||·!arr)​·{37+»   ​arr·=·kzalloc(sizeof(char)​·*·REDIRFS_OP_END,​·GFP_KERNEL)​;​
38+»   ​if·​(!arr)​·​{
35»   ​»   ​kfree(rops)​;​39»   ​»   ​kfree(rops)​;​
36-»   ​»   ​kfree(arr)​;​
37»   ​»   ​return·​ERR_PTR(-ENOMEM)​;​40»   ​»   ​return·​ERR_PTR(-ENOMEM)​;​
38»   ​}41»   ​}
3942

driver.​org/​redirfs/​rfs_path.​cdriver/​redirfs/​rfs_path.​c
1/​*1/​*
2·​*·​RedirFS:​·​Redirecting·​File·​System2·​*·​RedirFS:​·​Redirecting·​File·​System
3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>3·​*·​Written·​by·​Frantisek·​Hrbata·​<frantisek.​hrbata@redirfs.​org>
4+·​*·​Midified·​by·​KINTA-JAPAN·​<sanu@ruby.​plala.​or.​jo>
4·​*5·​*
5·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata6·​*·​Copyright·​2008·​-·​2010·​Frantisek·​Hrbata
7+·​*·​Copyright·​2013·​-·​2015·​KINTA-JAPAN
6·​*·​All·​rights·​reserved.​8·​*·​All·​rights·​reserved.​
7·​*9·​*
8·​*·​This·​file·​is·​part·​of·​RedirFS.​10·​*·​This·​file·​is·​part·​of·​RedirFS.​
143»   ​struct·​rfs_path·​*rpath·​=·​NULL;​145»   ​struct·​rfs_path·​*rpath·​=·​NULL;​
144»   ​int·​i·​=·​0;​146»   ​int·​i·​=·​0;​
145147
148+mainloop:​
146»   ​while·​(i