From beb4f68781174b046bd650311318369a9717ec8e Mon Sep 17 00:00:00 2001 From: Vasiliy Ulyanov Date: Mon, 21 Jul 2014 09:25:39 +0400 Subject: [PATCH] [FIX] file ops handlers build with kernel >= 3.12 Change-Id: I7830639a40fa735fc7743d5856ea4230490f527b Signed-off-by: Vasiliy Ulyanov --- ks_features/file_ops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ks_features/file_ops.c b/ks_features/file_ops.c index b8f7f21..500d01e 100644 --- a/ks_features/file_ops.c +++ b/ks_features/file_ops.c @@ -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); } -- 2.7.4