aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2013-05-14 00:24:14 +0900
committerDaniel Phillips <daniel@tux3.org>2013-05-14 00:24:14 +0900
commit827605fd6765aa2a74f51bfd0b59d76dfe349966 (patch)
tree085f736c58bc26201e3a179d4c37e256881f8991
parent60bc76520d89c430e28b2bf9e019151e19ad24b1 (diff)
downloadlinux-tux3-827605fd6765aa2a74f51bfd0b59d76dfe349966.tar.gz
tux3: Fix file->f_dentry->d_inode for kernel v3.9
file->f_dentry->d_inode was replaced by file_inode(). Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/dir.c7
-rw-r--r--fs/tux3/kcompat.h10
2 files changed, 12 insertions, 5 deletions
diff --git a/fs/tux3/dir.c b/fs/tux3/dir.c
index a499eaea4e9396..0c75c546be1eaa 100644
--- a/fs/tux3/dir.c
+++ b/fs/tux3/dir.c
@@ -23,6 +23,7 @@
*/
#include "tux3.h"
+#include "kcompat.h"
#define TUX_DIR_ALIGN sizeof(inum_t)
#define TUX_DIR_HEAD (offsetof(tux_dirent, name))
@@ -275,11 +276,7 @@ static unsigned char filetype[TUX_TYPES] = {
int tux_readdir(struct file *file, void *state, filldir_t filldir)
{
loff_t pos = file->f_pos;
-#ifdef __KERNEL__
- struct inode *dir = file->f_dentry->d_inode;
-#else
- struct inode *dir = file->f_inode;
-#endif
+ struct inode *dir = file_inode(file);
int revalidate = file->f_version != dir->i_version;
struct sb *sb = tux_sb(dir->i_sb);
unsigned blockbits = sb->blockbits;
diff --git a/fs/tux3/kcompat.h b/fs/tux3/kcompat.h
index aae8619d0fc4c4..58a5cb12104954 100644
--- a/fs/tux3/kcompat.h
+++ b/fs/tux3/kcompat.h
@@ -1,10 +1,20 @@
#ifndef TUX3_KCOMPAT_H
#define TUX3_KCOMPAT_H
+#ifdef __KERNEL__
+
/*
* Temporary support for older kernel
*/
#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+static inline struct inode *file_inode(struct file *file)
+{
+ return file->f_dentry->d_inode;
+}
+#endif
+
+#endif /* !__KERNEL__ */
#endif /* !TUX3_KCOMPAT_H */