• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef _JFS_COMPAT_H
3 #define _JFS_COMPAT_H
4 
5 #include "kernel-list.h"
6 #include <errno.h>
7 #ifdef HAVE_NETINET_IN_H
8 #include <netinet/in.h>
9 #endif
10 #include <arpa/inet.h>
11 #include <stdbool.h>
12 
13 #define printk printf
14 #define KERN_ERR ""
15 #define KERN_DEBUG ""
16 
17 #define REQ_OP_READ 0
18 #define REQ_OP_WRITE 1
19 
20 #define cpu_to_le16(x)	ext2fs_cpu_to_le16(x)
21 #define cpu_to_be16(x)	ext2fs_cpu_to_be16(x)
22 #define cpu_to_le32(x)	ext2fs_cpu_to_le32(x)
23 #define cpu_to_be32(x)	ext2fs_cpu_to_be32(x)
24 #define cpu_to_le64(x)	ext2fs_cpu_to_le64(x)
25 #define cpu_to_be64(x)	ext2fs_cpu_to_be64(x)
26 
27 #define le16_to_cpu(x)	ext2fs_le16_to_cpu(x)
28 #define be16_to_cpu(x)	ext2fs_be16_to_cpu(x)
29 #define le32_to_cpu(x)	ext2fs_le32_to_cpu(x)
30 #define be32_to_cpu(x)	ext2fs_be32_to_cpu(x)
31 #define le64_to_cpu(x)	ext2fs_le64_to_cpu(x)
32 #define be64_to_cpu(x)	ext2fs_be64_to_cpu(x)
33 
34 typedef unsigned int tid_t;
35 typedef struct journal_s journal_t;
36 typedef struct kdev_s *kdev_t;
37 
38 struct buffer_head;
39 struct inode;
40 
41 typedef unsigned int gfp_t;
42 #define GFP_KERNEL	0
43 #define GFP_NOFS	0
44 #define __GFP_NOFAIL	0
45 #define JBD2_TAG_SIZE32	JBD_TAG_SIZE32
46 #define JBD2_BARRIER	0
47 typedef __u64 u64;
48 #define put_bh(x)	brelse(x)
49 
50 #define crc32_be(x, y, z)	ext2fs_crc32_be((x), (y), (z))
51 #define spin_lock_init(x)
52 #define spin_lock(x)
53 #define spin_unlock(x)
54 #define SLAB_HWCACHE_ALIGN	0
55 #define SLAB_TEMPORARY		0
56 #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
57                 sizeof(struct __struct), __alignof__(struct __struct),\
58                 (__flags), NULL)
59 
60 #define blkdev_issue_flush(kdev)	sync_blockdev(kdev)
61 #define is_power_of_2(x)	((x) != 0 && (((x) & ((x) - 1)) == 0))
62 #define pr_emerg(fmt)
63 #define pr_err(...)
64 
65 enum passtype {PASS_SCAN, PASS_REVOKE, PASS_REPLAY};
66 
67 #define JBD2_FC_REPLAY_STOP		0
68 #define JBD2_FC_REPLAY_CONTINUE		1
69 
70 struct journal_s
71 {
72 	unsigned long		j_flags;
73 	int			j_errno;
74 	struct buffer_head *	j_sb_buffer;
75 	struct journal_superblock_s *j_superblock;
76 	int			j_format_version;
77 	unsigned long		j_head;
78 	unsigned long		j_tail;
79 	unsigned long		j_fc_first;
80 	unsigned long		j_fc_off;
81 	unsigned long		j_fc_last;
82 	unsigned long		j_free;
83 	unsigned long		j_first, j_last;
84 	kdev_t			j_dev;
85 	kdev_t			j_fs_dev;
86 	int			j_blocksize;
87 	unsigned int		j_blk_offset;
88 	unsigned int		j_total_len;
89 	struct inode *		j_inode;
90 	tid_t			j_tail_sequence;
91 	tid_t			j_transaction_sequence;
92 	__u8			j_uuid[16];
93 	struct jbd2_revoke_table_s *j_revoke;
94 	struct jbd2_revoke_table_s *j_revoke_table[2];
95 	tid_t			j_failed_commit;
96 	__u32			j_csum_seed;
97 	int (*j_fc_replay_callback)(struct journal_s *journal,
98 				    struct buffer_head *bh,
99 				    enum passtype pass, int off,
100 				    tid_t expected_tid);
101 
102 };
103 
104 #define is_journal_abort(x) 0
105 
106 #define BUFFER_TRACE(bh, info)	do {} while (0)
107 
108 /* Need this so we can compile with configure --enable-gcc-wall */
109 #ifdef NO_INLINE_FUNCS
110 #define inline
111 #endif
112 
113 #endif /* _JFS_COMPAT_H */
114