Whamcloud - gitweb
e2fsck: resync jbd2 revoke code from Linux 3.16
[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 #include <arpa/inet.h>
11
12 #define printk printf
13 #define KERN_ERR ""
14 #define KERN_DEBUG ""
15
16 #define READ 0
17 #define WRITE 1
18
19 #define cpu_to_be32(n) htonl(n)
20 #define be32_to_cpu(n) ntohl(n)
21 #define cpu_to_be16(n) htons(n)
22 #define be16_to_cpu(n) ntohs(n)
23
24 typedef unsigned int tid_t;
25 typedef struct journal_s journal_t;
26
27 struct buffer_head;
28 struct inode;
29
30 #define GFP_KERNEL      0
31 #define JFS_TAG_SIZE32  JBD_TAG_SIZE32
32 #define JFS_BARRIER     0
33 typedef __u64 u64;
34 #define JFS_CRC32_CHKSUM        JBD2_CRC32_CHKSUM
35 #define JFS_CRC32_CHKSUM_SIZE   JBD2_CRC32_CHKSUM_SIZE
36 #define put_bh(x)       brelse(x)
37 #define be64_to_cpu(x)  ext2fs_be64_to_cpu(x)
38
39 static inline __u32 jbd2_chksum(journal_t *j, __u32 crc, const void *address,
40                         unsigned int length)
41 {
42         return ext2fs_crc32c_le(crc, address, length);
43 }
44 #define crc32_be(x, y, z)       ext2fs_crc32_be((x), (y), (z))
45 #define spin_lock_init(x)
46 #define spin_lock(x)
47 #define spin_unlock(x)
48 #define yield()
49 #define SLAB_HWCACHE_ALIGN      0
50 #define SLAB_TEMPORARY          0
51 #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
52                 sizeof(struct __struct), __alignof__(struct __struct),\
53                 (__flags), NULL)
54
55 #define blkdev_issue_flush(kdev, a, b)  sync_blockdev(kdev)
56 #define is_power_of_2(x)        ((x) != 0 && (((x) & ((x) - 1)) == 0))
57
58 struct journal_s
59 {
60         unsigned long           j_flags;
61         int                     j_errno;
62         struct buffer_head *    j_sb_buffer;
63         struct journal_superblock_s *j_superblock;
64         int                     j_format_version;
65         unsigned long           j_head;
66         unsigned long           j_tail;
67         unsigned long           j_free;
68         unsigned long           j_first, j_last;
69         kdev_t                  j_dev;
70         kdev_t                  j_fs_dev;
71         int                     j_blocksize;
72         unsigned int            j_blk_offset;
73         unsigned int            j_maxlen;
74         struct inode *          j_inode;
75         tid_t                   j_tail_sequence;
76         tid_t                   j_transaction_sequence;
77         __u8                    j_uuid[16];
78         struct jbd2_revoke_table_s *j_revoke;
79         struct jbd2_revoke_table_s *j_revoke_table[2];
80         tid_t                   j_failed_commit;
81         __u32                   j_csum_seed;
82 };
83
84 #define J_ASSERT(assert)                                                \
85         do { if (!(assert)) {                                           \
86                 printf ("Assertion failure in %s() at %s line %d: "     \
87                         "\"%s\"\n",                                     \
88                         __FUNCTION__, __FILE__, __LINE__, # assert);    \
89                 fatal_error(e2fsck_global_ctx, 0);                      \
90         } } while (0)
91
92 #define is_journal_abort(x) 0
93
94 #define BUFFER_TRACE(bh, info)  do {} while (0)
95
96 /* Need this so we can compile with configure --enable-gcc-wall */
97 #ifdef NO_INLINE_FUNCS
98 #define inline
99 #endif
100
101 #endif /* _JFS_COMPAT_H */