diff options
Diffstat (limited to 'fs/jffs2/os-linux.h')
-rw-r--r-- | fs/jffs2/os-linux.h | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 5a2d2ee4f641..7bf72e012c94 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -7,41 +7,24 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: os-linux.h,v 1.56 2005/05/03 15:19:00 dedekind Exp $ | 10 | * $Id: os-linux.h,v 1.57 2005/07/06 12:13:09 dwmw2 Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #ifndef __JFFS2_OS_LINUX_H__ | 14 | #ifndef __JFFS2_OS_LINUX_H__ |
15 | #define __JFFS2_OS_LINUX_H__ | 15 | #define __JFFS2_OS_LINUX_H__ |
16 | #include <linux/version.h> | ||
17 | 16 | ||
18 | /* JFFS2 uses Linux mode bits natively -- no need for conversion */ | 17 | /* JFFS2 uses Linux mode bits natively -- no need for conversion */ |
19 | #define os_to_jffs2_mode(x) (x) | 18 | #define os_to_jffs2_mode(x) (x) |
20 | #define jffs2_to_os_mode(x) (x) | 19 | #define jffs2_to_os_mode(x) (x) |
21 | 20 | ||
22 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,73) | ||
23 | #define kstatfs statfs | ||
24 | #endif | ||
25 | |||
26 | struct kstatfs; | 21 | struct kstatfs; |
27 | struct kvec; | 22 | struct kvec; |
28 | 23 | ||
29 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2) | ||
30 | #define JFFS2_INODE_INFO(i) (list_entry(i, struct jffs2_inode_info, vfs_inode)) | 24 | #define JFFS2_INODE_INFO(i) (list_entry(i, struct jffs2_inode_info, vfs_inode)) |
31 | #define OFNI_EDONI_2SFFJ(f) (&(f)->vfs_inode) | 25 | #define OFNI_EDONI_2SFFJ(f) (&(f)->vfs_inode) |
32 | #define JFFS2_SB_INFO(sb) (sb->s_fs_info) | 26 | #define JFFS2_SB_INFO(sb) (sb->s_fs_info) |
33 | #define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv) | 27 | #define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv) |
34 | #elif defined(JFFS2_OUT_OF_KERNEL) | ||
35 | #define JFFS2_INODE_INFO(i) ((struct jffs2_inode_info *) &(i)->u) | ||
36 | #define OFNI_EDONI_2SFFJ(f) ((struct inode *) ( ((char *)f) - ((char *)(&((struct inode *)NULL)->u)) ) ) | ||
37 | #define JFFS2_SB_INFO(sb) ((struct jffs2_sb_info *) &(sb)->u) | ||
38 | #define OFNI_BS_2SFFJ(c) ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->u)) ) ) | ||
39 | #else | ||
40 | #define JFFS2_INODE_INFO(i) (&i->u.jffs2_i) | ||
41 | #define OFNI_EDONI_2SFFJ(f) ((struct inode *) ( ((char *)f) - ((char *)(&((struct inode *)NULL)->u)) ) ) | ||
42 | #define JFFS2_SB_INFO(sb) (&sb->u.jffs2_sb) | ||
43 | #define OFNI_BS_2SFFJ(c) ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->u)) ) ) | ||
44 | #endif | ||
45 | 28 | ||
46 | 29 | ||
47 | #define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) | 30 | #define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) |
@@ -49,28 +32,14 @@ struct kvec; | |||
49 | #define JFFS2_F_I_UID(f) (OFNI_EDONI_2SFFJ(f)->i_uid) | 32 | #define JFFS2_F_I_UID(f) (OFNI_EDONI_2SFFJ(f)->i_uid) |
50 | #define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid) | 33 | #define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid) |
51 | 34 | ||
52 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,1) | ||
53 | #define JFFS2_F_I_RDEV_MIN(f) (iminor(OFNI_EDONI_2SFFJ(f))) | 35 | #define JFFS2_F_I_RDEV_MIN(f) (iminor(OFNI_EDONI_2SFFJ(f))) |
54 | #define JFFS2_F_I_RDEV_MAJ(f) (imajor(OFNI_EDONI_2SFFJ(f))) | 36 | #define JFFS2_F_I_RDEV_MAJ(f) (imajor(OFNI_EDONI_2SFFJ(f))) |
55 | #else | ||
56 | #define JFFS2_F_I_RDEV_MIN(f) (MINOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev))) | ||
57 | #define JFFS2_F_I_RDEV_MAJ(f) (MAJOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev))) | ||
58 | #endif | ||
59 | 37 | ||
60 | /* Urgh. The things we do to keep the 2.4 build working */ | ||
61 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,47) | ||
62 | #define ITIME(sec) ((struct timespec){sec, 0}) | 38 | #define ITIME(sec) ((struct timespec){sec, 0}) |
63 | #define I_SEC(tv) ((tv).tv_sec) | 39 | #define I_SEC(tv) ((tv).tv_sec) |
64 | #define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime.tv_sec) | 40 | #define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime.tv_sec) |
65 | #define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime.tv_sec) | 41 | #define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime.tv_sec) |
66 | #define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime.tv_sec) | 42 | #define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime.tv_sec) |
67 | #else | ||
68 | #define ITIME(x) (x) | ||
69 | #define I_SEC(x) (x) | ||
70 | #define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime) | ||
71 | #define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime) | ||
72 | #define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime) | ||
73 | #endif | ||
74 | 43 | ||
75 | #define sleep_on_spinunlock(wq, s) \ | 44 | #define sleep_on_spinunlock(wq, s) \ |
76 | do { \ | 45 | do { \ |
@@ -84,17 +53,12 @@ struct kvec; | |||
84 | 53 | ||
85 | static inline void jffs2_init_inode_info(struct jffs2_inode_info *f) | 54 | static inline void jffs2_init_inode_info(struct jffs2_inode_info *f) |
86 | { | 55 | { |
87 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2) | ||
88 | f->highest_version = 0; | 56 | f->highest_version = 0; |
89 | f->fragtree = RB_ROOT; | 57 | f->fragtree = RB_ROOT; |
90 | f->metadata = NULL; | 58 | f->metadata = NULL; |
91 | f->dents = NULL; | 59 | f->dents = NULL; |
92 | f->flags = 0; | 60 | f->flags = 0; |
93 | f->usercompr = 0; | 61 | f->usercompr = 0; |
94 | #else | ||
95 | memset(f, 0, sizeof(*f)); | ||
96 | init_MUTEX_LOCKED(&f->sem); | ||
97 | #endif | ||
98 | } | 62 | } |
99 | 63 | ||
100 | 64 | ||