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