summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasiliy Ulyanov <v.ulyanov@samsung.com>2014-07-21 09:25:39 +0400
committerVasiliy Ulyanov <v.ulyanov@samsung.com>2014-07-21 09:25:39 +0400
commitbeb4f68781174b046bd650311318369a9717ec8e (patch)
treed3e99aaf8ab935a2cb6d587bd6ba3bbb688ee0d9
parent116731a4720a1a6e62b760d69ea420b331b01df0 (diff)
downloadswap-modules-beb4f68781174b046bd650311318369a9717ec8e.tar.gz
swap-modules-beb4f68781174b046bd650311318369a9717ec8e.tar.bz2
swap-modules-beb4f68781174b046bd650311318369a9717ec8e.zip
[FIX] file ops handlers build with kernel >= 3.12
Change-Id: I7830639a40fa735fc7743d5856ea4230490f527b Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
-rw-r--r--ks_features/file_ops.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ks_features/file_ops.c b/ks_features/file_ops.c
index b8f7f21c..500d01e9 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);
}