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