• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 READ 0
21 #define 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 JFS_TAG_SIZE32	JBD_TAG_SIZE32
37 #define JFS_BARRIER	0
38 typedef __u64 u64;
39 #define JFS_CRC32_CHKSUM	JBD2_CRC32_CHKSUM
40 #define JFS_CRC32_CHKSUM_SIZE	JBD2_CRC32_CHKSUM_SIZE
41 #define put_bh(x)	brelse(x)
42 #define be64_to_cpu(x)	ext2fs_be64_to_cpu(x)
43 
jbd2_chksum(journal_t * j EXT2FS_ATTR ((unused)),__u32 crc,const void * address,unsigned int length)44 static inline __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
45 				__u32 crc, const void *address,
46 				unsigned int length)
47 {
48 	return ext2fs_crc32c_le(crc, address, length);
49 }
50 #define crc32_be(x, y, z)	ext2fs_crc32_be((x), (y), (z))
51 #define spin_lock_init(x)
52 #define spin_lock(x)
53 #define spin_unlock(x)
54 #define yield()
55 #define SLAB_HWCACHE_ALIGN	0
56 #define SLAB_TEMPORARY		0
57 #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
58                 sizeof(struct __struct), __alignof__(struct __struct),\
59                 (__flags), NULL)
60 
61 #define blkdev_issue_flush(kdev, a, b)	sync_blockdev(kdev)
62 #define is_power_of_2(x)	((x) != 0 && (((x) & ((x) - 1)) == 0))
63 
64 struct journal_s
65 {
66 	unsigned long		j_flags;
67 	int			j_errno;
68 	struct buffer_head *	j_sb_buffer;
69 	struct journal_superblock_s *j_superblock;
70 	int			j_format_version;
71 	unsigned long		j_head;
72 	unsigned long		j_tail;
73 	unsigned long		j_free;
74 	unsigned long		j_first, j_last;
75 	kdev_t			j_dev;
76 	kdev_t			j_fs_dev;
77 	int			j_blocksize;
78 	unsigned int		j_blk_offset;
79 	unsigned int		j_maxlen;
80 	struct inode *		j_inode;
81 	tid_t			j_tail_sequence;
82 	tid_t			j_transaction_sequence;
83 	__u8			j_uuid[16];
84 	struct jbd2_revoke_table_s *j_revoke;
85 	struct jbd2_revoke_table_s *j_revoke_table[2];
86 	tid_t			j_failed_commit;
87 	__u32			j_csum_seed;
88 };
89 
90 #define J_ASSERT(assert)						\
91 	do { if (!(assert)) {						\
92 		printf ("Assertion failure in %s() at %s line %d: "	\
93 			"\"%s\"\n",					\
94 			__FUNCTION__, __FILE__, __LINE__, # assert);	\
95 		fatal_error(e2fsck_global_ctx, 0);			\
96 	} } while (0)
97 
98 #define is_journal_abort(x) 0
99 
100 #define BUFFER_TRACE(bh, info)	do {} while (0)
101 
102 /* Need this so we can compile with configure --enable-gcc-wall */
103 #ifdef NO_INLINE_FUNCS
104 #define inline
105 #endif
106 
107 #endif /* _JFS_COMPAT_H */
108