[FIX] file ops handlers build with kernel >= 3.12 41/24741/1
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Mon, 21 Jul 2014 05:25:39 +0000 (09:25 +0400)
committerVasiliy Ulyanov <v.ulyanov@samsung.com>
Mon, 21 Jul 2014 05:25:39 +0000 (09:25 +0400)
Change-Id: I7830639a40fa735fc7743d5856ea4230490f527b
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
ks_features/file_ops.c

index b8f7f21..500d01e 100644 (file)
@@ -210,6 +210,15 @@ static inline char *fops_path_buf(void)
        return __get_cpu_var(__path_buf);
 }
 
+static inline unsigned fops_dcount(const struct dentry *dentry)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+       return dentry->d_count;
+#else
+       return d_count(dentry);
+#endif
+}
+
 /* kernel function args */
 #define fops_karg(_type, _regs, _idx) ((_type)swap_get_karg(_regs, _idx))
 /* syscall args */
@@ -606,7 +615,7 @@ static int filp_close_entry_handler(struct kretprobe_instance *ri,
                struct dentry *dentry = file->f_dentry;
 
                /* release the file if it is going to be removed soon */
-               if (dentry && dentry->d_count == 2)
+               if (dentry && fops_dcount(dentry) == 2)
                        fops_dremove(dentry);
        }