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