Whamcloud - gitweb
42c9e3091db2b08dd14d2a5d6a7c1021dc1fbe73
[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_be32(n) htonl(n)
24 #define be32_to_cpu(n) ntohl(n)
25 #define cpu_to_be16(n) htons(n)
26 #define be16_to_cpu(n) ntohs(n)
27
28 typedef unsigned int tid_t;
29 typedef struct journal_s journal_t;
30 typedef struct kdev_s *kdev_t;
31
32 struct buffer_head;
33 struct inode;
34
35 #define GFP_KERNEL      0
36 #define JBD2_TAG_SIZE32 JBD_TAG_SIZE32
37 #define JBD2_BARRIER    0
38 typedef __u64 u64;
39 #define put_bh(x)       brelse(x)
40 #define be64_to_cpu(x)  ext2fs_be64_to_cpu(x)
41
42 static inline __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
43                                 __u32 crc, const void *address,
44                                 unsigned int length)
45 {
46         return ext2fs_crc32c_le(crc, address, length);
47 }
48 #define crc32_be(x, y, z)       ext2fs_crc32_be((x), (y), (z))
49 #define spin_lock_init(x)
50 #define spin_lock(x)
51 #define spin_unlock(x)
52 #define yield()
53 #define SLAB_HWCACHE_ALIGN      0
54 #define SLAB_TEMPORARY          0
55 #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
56                 sizeof(struct __struct), __alignof__(struct __struct),\
57                 (__flags), NULL)
58
59 #define blkdev_issue_flush(kdev, a, b)  sync_blockdev(kdev)
60 #define is_power_of_2(x)        ((x) != 0 && (((x) & ((x) - 1)) == 0))
61
62 struct journal_s
63 {
64         unsigned long           j_flags;
65         int                     j_errno;
66         struct buffer_head *    j_sb_buffer;
67         struct journal_superblock_s *j_superblock;
68         int                     j_format_version;
69         unsigned long           j_head;
70         unsigned long           j_tail;
71         unsigned long           j_free;
72         unsigned long           j_first, j_last;
73         kdev_t                  j_dev;
74         kdev_t                  j_fs_dev;
75         int                     j_blocksize;
76         unsigned int            j_blk_offset;
77         unsigned int            j_maxlen;
78         struct inode *          j_inode;
79         tid_t                   j_tail_sequence;
80         tid_t                   j_transaction_sequence;
81         __u8                    j_uuid[16];
82         struct jbd2_revoke_table_s *j_revoke;
83         struct jbd2_revoke_table_s *j_revoke_table[2];
84         tid_t                   j_failed_commit;
85         __u32                   j_csum_seed;
86 };
87
88 #define is_journal_abort(x) 0
89
90 #define BUFFER_TRACE(bh, info)  do {} while (0)
91
92 /* Need this so we can compile with configure --enable-gcc-wall */
93 #ifdef NO_INLINE_FUNCS
94 #define inline
95 #endif
96
97 #endif /* _JFS_COMPAT_H */