2 * Compatibility header file for e2fsck which should be included
3 * instead of linux/jfs.h
5 * Copyright (C) 2000 Stephen C. Tweedie
7 * This file may be redistributed under the terms of the
8 * GNU General Public License version 2 or at your discretion
17 #if EXT2_FLAT_INCLUDES
22 #include "ext2fs/ext2_fs.h"
23 #include "ext2fs/ext2fs.h"
24 #include "blkid/blkid.h"
28 * Pull in the definition of the e2fsck context structure
42 unsigned int b_dirty:1;
43 unsigned int b_uptodate:1;
44 unsigned long long b_blocknr;
55 struct ext2_inode i_ext2;
68 #define K_DEV_JOURNAL 2
70 #define lock_buffer(bh) do {} while (0)
71 #define unlock_buffer(bh) do {} while (0)
72 #define buffer_req(bh) 1
73 #define do_readahead(journal, start) do {} while (0)
79 #define kmem_cache_alloc(cache, flags) malloc((cache)->object_length)
80 #define kmem_cache_free(cache, obj) free(obj)
81 #define kmem_cache_create(name, len, a, b, c) do_cache_create(len)
82 #define kmem_cache_destroy(cache) do_cache_destroy(cache)
83 #define kmalloc(len, flags) malloc(len)
84 #define kfree(p) free(p)
86 #define cond_resched() do { } while (0)
91 * Now pull in the real linux/jfs.h definitions.
93 #include <ext2fs/kernel-jbd.h>
96 * We use the standard libext2fs portability tricks for inline
99 #ifdef NO_INLINE_FUNCS
100 extern lkmem_cache_t *do_cache_create(int len);
101 extern void do_cache_destroy(lkmem_cache_t *cache);
102 extern size_t journal_tag_bytes(journal_t *journal);
105 #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
106 #ifdef E2FSCK_INCLUDE_INLINE_FUNCS
107 #if (__STDC_VERSION__ >= 199901L)
108 #define _INLINE_ extern inline
110 #define _INLINE_ inline
112 #else /* !E2FSCK_INCLUDE_INLINE FUNCS */
113 #if (__STDC_VERSION__ >= 199901L)
114 #define _INLINE_ inline
117 #define _INLINE_ extern __inline__
118 #else /* For Watcom C */
119 #define _INLINE_ extern inline
120 #endif /* __GNUC__ */
121 #endif /* __STDC_VERSION__ >= 199901L */
122 #endif /* E2FSCK_INCLUDE_INLINE_FUNCS */
125 _INLINE_ lkmem_cache_t *do_cache_create(int len)
127 lkmem_cache_t *new_cache;
129 new_cache = malloc(sizeof(*new_cache));
131 new_cache->object_length = len;
135 _INLINE_ void do_cache_destroy(lkmem_cache_t *cache)
144 * Kernel compatibility functions are defined in journal.c
146 int journal_bmap(journal_t *journal, blk64_t block, unsigned long long *phys);
147 struct buffer_head *getblk(kdev_t ctx, blk64_t blocknr, int blocksize);
148 int sync_blockdev(kdev_t kdev);
149 void ll_rw_block(int rw, int dummy, struct buffer_head *bh[]);
150 void mark_buffer_dirty(struct buffer_head *bh);
151 void mark_buffer_uptodate(struct buffer_head *bh, int val);
152 void brelse(struct buffer_head *bh);
153 int buffer_uptodate(struct buffer_head *bh);
154 void wait_on_buffer(struct buffer_head *bh);
157 * Define newer 2.5 interfaces
159 #define __getblk(dev, blocknr, blocksize) getblk(dev, blocknr, blocksize)
160 #define set_buffer_uptodate(bh) mark_buffer_uptodate(bh, 1)
165 #define J_ASSERT(x) assert(x)
167 #define JSB_HAS_INCOMPAT_FEATURE(jsb, mask) \
168 ((jsb)->s_header.h_blocktype == ext2fs_cpu_to_be32(JFS_SUPERBLOCK_V2) && \
169 ((jsb)->s_feature_incompat & ext2fs_cpu_to_be32((mask))))
172 extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
174 #define J_ASSERT(assert) \
175 do { if (!(assert)) { \
176 printf ("Assertion failure in %s() at %s line %d: " \
178 __FUNCTION__, __FILE__, __LINE__, # assert); \
179 fatal_error(e2fsck_global_ctx, 0); \
185 #define EFSBADCRC EXT2_ET_BAD_CRC
188 #define EFSCORRUPTED EXT2_ET_FILESYSTEM_CORRUPTED
192 extern int journal_recover (journal_t *journal);
193 extern int journal_skip_recovery (journal_t *);
196 extern int journal_init_revoke(journal_t *, int);
197 extern void journal_destroy_revoke(journal_t *);
198 extern void journal_destroy_revoke_caches(void);
199 extern int journal_init_revoke_caches(void);
201 extern int journal_set_revoke(journal_t *, unsigned long long, tid_t);
202 extern int journal_test_revoke(journal_t *, unsigned long long, tid_t);
203 extern void journal_clear_revoke(journal_t *);
205 #endif /* _JFS_USER_H */