Whamcloud - gitweb
63ebef99d2a57bfece91f5a4d8f4c646fe5be9cf
[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
16 #define printk printf
17 #define KERN_ERR ""
18 #define KERN_DEBUG ""
19
20 #define REQ_OP_READ 0
21 #define REQ_OP_WRITE 1
22
23 #define cpu_to_le16(x)  ext2fs_cpu_to_le16(x)
24 #define cpu_to_be16(x)  ext2fs_cpu_to_be16(x)
25 #define cpu_to_le32(x)  ext2fs_cpu_to_le32(x)
26 #define cpu_to_be32(x)  ext2fs_cpu_to_be32(x)
27 #define cpu_to_le64(x)  ext2fs_cpu_to_le64(x)
28 #define cpu_to_be64(x)  ext2fs_cpu_to_be64(x)
29
30 #define le16_to_cpu(x)  ext2fs_le16_to_cpu(x)
31 #define be16_to_cpu(x)  ext2fs_be16_to_cpu(x)
32 #define le32_to_cpu(x)  ext2fs_le32_to_cpu(x)
33 #define be32_to_cpu(x)  ext2fs_be32_to_cpu(x)
34 #define le64_to_cpu(x)  ext2fs_le64_to_cpu(x)
35 #define be64_to_cpu(x)  ext2fs_be64_to_cpu(x)
36
37 typedef unsigned int tid_t;
38 typedef struct journal_s journal_t;
39 typedef struct kdev_s *kdev_t;
40
41 struct buffer_head;
42 struct inode;
43
44 typedef unsigned int gfp_t;
45 #define GFP_KERNEL      0
46 #define GFP_NOFS        0
47 #define __GFP_NOFAIL    0
48 #define JBD2_TAG_SIZE32 JBD_TAG_SIZE32
49 #define JBD2_BARRIER    0
50 typedef __u64 u64;
51 #define put_bh(x)       brelse(x)
52
53 static inline __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
54                                 __u32 crc, const void *address,
55                                 unsigned int length)
56 {
57         return ext2fs_crc32c_le(crc, address, length);
58 }
59 #define crc32_be(x, y, z)       ext2fs_crc32_be((x), (y), (z))
60 #define spin_lock_init(x)
61 #define spin_lock(x)
62 #define spin_unlock(x)
63 #define SLAB_HWCACHE_ALIGN      0
64 #define SLAB_TEMPORARY          0
65 #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
66                 sizeof(struct __struct), __alignof__(struct __struct),\
67                 (__flags), NULL)
68
69 #define blkdev_issue_flush(kdev, a, b)  sync_blockdev(kdev)
70 #define is_power_of_2(x)        ((x) != 0 && (((x) & ((x) - 1)) == 0))
71 #define pr_emerg(fmt)
72
73 struct journal_s
74 {
75         unsigned long           j_flags;
76         int                     j_errno;
77         struct buffer_head *    j_sb_buffer;
78         struct journal_superblock_s *j_superblock;
79         int                     j_format_version;
80         unsigned long           j_head;
81         unsigned long           j_tail;
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_maxlen;
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 };
98
99 #define is_journal_abort(x) 0
100
101 #define BUFFER_TRACE(bh, info)  do {} while (0)
102
103 /* Need this so we can compile with configure --enable-gcc-wall */
104 #ifdef NO_INLINE_FUNCS
105 #define inline
106 #endif
107
108 #endif /* _JFS_COMPAT_H */