This source file includes following definitions.
- ecryptfs_d_revalidate
- ecryptfs_dentry_free_rcu
- ecryptfs_d_release
1
2
3
4
5
6
7
8
9
10
11 #include <linux/dcache.h>
12 #include <linux/namei.h>
13 #include <linux/mount.h>
14 #include <linux/fs_stack.h>
15 #include <linux/slab.h>
16 #include "ecryptfs_kernel.h"
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
32 {
33 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
34 int rc = 1;
35
36 if (flags & LOOKUP_RCU)
37 return -ECHILD;
38
39 if (lower_dentry->d_flags & DCACHE_OP_REVALIDATE)
40 rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
41
42 if (d_really_is_positive(dentry)) {
43 struct inode *inode = d_inode(dentry);
44
45 fsstack_copy_attr_all(inode, ecryptfs_inode_to_lower(inode));
46 if (!inode->i_nlink)
47 return 0;
48 }
49 return rc;
50 }
51
52 struct kmem_cache *ecryptfs_dentry_info_cache;
53
54 static void ecryptfs_dentry_free_rcu(struct rcu_head *head)
55 {
56 kmem_cache_free(ecryptfs_dentry_info_cache,
57 container_of(head, struct ecryptfs_dentry_info, rcu));
58 }
59
60
61
62
63
64
65
66 static void ecryptfs_d_release(struct dentry *dentry)
67 {
68 struct ecryptfs_dentry_info *p = dentry->d_fsdata;
69 if (p) {
70 path_put(&p->lower_path);
71 call_rcu(&p->rcu, ecryptfs_dentry_free_rcu);
72 }
73 }
74
75 const struct dentry_operations ecryptfs_dops = {
76 .d_revalidate = ecryptfs_d_revalidate,
77 .d_release = ecryptfs_d_release,
78 };