1*6a54128fSAndroid Build Coastguard Worker /*
2*6a54128fSAndroid Build Coastguard Worker * Compatibility header file for e2fsck which should be included
3*6a54128fSAndroid Build Coastguard Worker * instead of linux/jfs.h
4*6a54128fSAndroid Build Coastguard Worker *
5*6a54128fSAndroid Build Coastguard Worker * Copyright (C) 2000 Stephen C. Tweedie
6*6a54128fSAndroid Build Coastguard Worker *
7*6a54128fSAndroid Build Coastguard Worker * This file may be redistributed under the terms of the
8*6a54128fSAndroid Build Coastguard Worker * GNU General Public License version 2 or at your discretion
9*6a54128fSAndroid Build Coastguard Worker * any later version.
10*6a54128fSAndroid Build Coastguard Worker */
11*6a54128fSAndroid Build Coastguard Worker #ifndef _JFS_USER_H
12*6a54128fSAndroid Build Coastguard Worker #define _JFS_USER_H
13*6a54128fSAndroid Build Coastguard Worker
14*6a54128fSAndroid Build Coastguard Worker #include "config.h"
15*6a54128fSAndroid Build Coastguard Worker
16*6a54128fSAndroid Build Coastguard Worker #ifdef DEBUGFS
17*6a54128fSAndroid Build Coastguard Worker #include <stdio.h>
18*6a54128fSAndroid Build Coastguard Worker #include <stdlib.h>
19*6a54128fSAndroid Build Coastguard Worker #if EXT2_FLAT_INCLUDES
20*6a54128fSAndroid Build Coastguard Worker #include "ext2_fs.h"
21*6a54128fSAndroid Build Coastguard Worker #include "ext2fs.h"
22*6a54128fSAndroid Build Coastguard Worker #include "blkid.h"
23*6a54128fSAndroid Build Coastguard Worker #else
24*6a54128fSAndroid Build Coastguard Worker #include "ext2fs/ext2_fs.h"
25*6a54128fSAndroid Build Coastguard Worker #include "ext2fs/ext2fs.h"
26*6a54128fSAndroid Build Coastguard Worker #include "blkid/blkid.h"
27*6a54128fSAndroid Build Coastguard Worker #endif
28*6a54128fSAndroid Build Coastguard Worker #else
29*6a54128fSAndroid Build Coastguard Worker /*
30*6a54128fSAndroid Build Coastguard Worker * Pull in the definition of the e2fsck context structure
31*6a54128fSAndroid Build Coastguard Worker */
32*6a54128fSAndroid Build Coastguard Worker #include "e2fsck.h"
33*6a54128fSAndroid Build Coastguard Worker #endif
34*6a54128fSAndroid Build Coastguard Worker
35*6a54128fSAndroid Build Coastguard Worker #if __STDC_VERSION__ < 199901L
36*6a54128fSAndroid Build Coastguard Worker # if __GNUC__ >= 2 || _MSC_VER >= 1300
37*6a54128fSAndroid Build Coastguard Worker # define __func__ __FUNCTION__
38*6a54128fSAndroid Build Coastguard Worker # else
39*6a54128fSAndroid Build Coastguard Worker # define __func__ "<unknown>"
40*6a54128fSAndroid Build Coastguard Worker # endif
41*6a54128fSAndroid Build Coastguard Worker #endif
42*6a54128fSAndroid Build Coastguard Worker
43*6a54128fSAndroid Build Coastguard Worker struct buffer_head {
44*6a54128fSAndroid Build Coastguard Worker #ifdef DEBUGFS
45*6a54128fSAndroid Build Coastguard Worker ext2_filsys b_fs;
46*6a54128fSAndroid Build Coastguard Worker #else
47*6a54128fSAndroid Build Coastguard Worker e2fsck_t b_ctx;
48*6a54128fSAndroid Build Coastguard Worker #endif
49*6a54128fSAndroid Build Coastguard Worker io_channel b_io;
50*6a54128fSAndroid Build Coastguard Worker int b_size;
51*6a54128fSAndroid Build Coastguard Worker int b_err;
52*6a54128fSAndroid Build Coastguard Worker unsigned int b_dirty:1;
53*6a54128fSAndroid Build Coastguard Worker unsigned int b_uptodate:1;
54*6a54128fSAndroid Build Coastguard Worker unsigned long long b_blocknr;
55*6a54128fSAndroid Build Coastguard Worker char b_data[4096];
56*6a54128fSAndroid Build Coastguard Worker };
57*6a54128fSAndroid Build Coastguard Worker
58*6a54128fSAndroid Build Coastguard Worker struct inode {
59*6a54128fSAndroid Build Coastguard Worker #ifdef DEBUGFS
60*6a54128fSAndroid Build Coastguard Worker ext2_filsys i_fs;
61*6a54128fSAndroid Build Coastguard Worker #else
62*6a54128fSAndroid Build Coastguard Worker e2fsck_t i_ctx;
63*6a54128fSAndroid Build Coastguard Worker #endif
64*6a54128fSAndroid Build Coastguard Worker ext2_ino_t i_ino;
65*6a54128fSAndroid Build Coastguard Worker struct ext2_inode i_ext2;
66*6a54128fSAndroid Build Coastguard Worker };
67*6a54128fSAndroid Build Coastguard Worker
68*6a54128fSAndroid Build Coastguard Worker struct kdev_s {
69*6a54128fSAndroid Build Coastguard Worker #ifdef DEBUGFS
70*6a54128fSAndroid Build Coastguard Worker ext2_filsys k_fs;
71*6a54128fSAndroid Build Coastguard Worker #else
72*6a54128fSAndroid Build Coastguard Worker e2fsck_t k_ctx;
73*6a54128fSAndroid Build Coastguard Worker #endif
74*6a54128fSAndroid Build Coastguard Worker int k_dev;
75*6a54128fSAndroid Build Coastguard Worker };
76*6a54128fSAndroid Build Coastguard Worker
77*6a54128fSAndroid Build Coastguard Worker #define K_DEV_FS 1
78*6a54128fSAndroid Build Coastguard Worker #define K_DEV_JOURNAL 2
79*6a54128fSAndroid Build Coastguard Worker
80*6a54128fSAndroid Build Coastguard Worker #define lock_buffer(bh) do {} while (0)
81*6a54128fSAndroid Build Coastguard Worker #define unlock_buffer(bh) do {} while (0)
82*6a54128fSAndroid Build Coastguard Worker #define buffer_req(bh) 1
83*6a54128fSAndroid Build Coastguard Worker #define do_readahead(journal, start) do {} while (0)
84*6a54128fSAndroid Build Coastguard Worker
85*6a54128fSAndroid Build Coastguard Worker struct kmem_cache {
86*6a54128fSAndroid Build Coastguard Worker unsigned int object_size;
87*6a54128fSAndroid Build Coastguard Worker };
88*6a54128fSAndroid Build Coastguard Worker
89*6a54128fSAndroid Build Coastguard Worker #define cond_resched() do { } while (0)
90*6a54128fSAndroid Build Coastguard Worker
91*6a54128fSAndroid Build Coastguard Worker #define __init
92*6a54128fSAndroid Build Coastguard Worker
93*6a54128fSAndroid Build Coastguard Worker /*
94*6a54128fSAndroid Build Coastguard Worker * Now pull in the real linux/jfs.h definitions.
95*6a54128fSAndroid Build Coastguard Worker */
96*6a54128fSAndroid Build Coastguard Worker #include <ext2fs/kernel-jbd.h>
97*6a54128fSAndroid Build Coastguard Worker
98*6a54128fSAndroid Build Coastguard Worker /*
99*6a54128fSAndroid Build Coastguard Worker * We use the standard libext2fs portability tricks for inline
100*6a54128fSAndroid Build Coastguard Worker * functions.
101*6a54128fSAndroid Build Coastguard Worker */
102*6a54128fSAndroid Build Coastguard Worker #ifdef NO_INLINE_FUNCS
103*6a54128fSAndroid Build Coastguard Worker extern struct kmem_cache *kmem_cache_create(const char *name,
104*6a54128fSAndroid Build Coastguard Worker unsigned int size,
105*6a54128fSAndroid Build Coastguard Worker unsigned int align,
106*6a54128fSAndroid Build Coastguard Worker unsigned int flags,
107*6a54128fSAndroid Build Coastguard Worker void (*ctor)(void *));
108*6a54128fSAndroid Build Coastguard Worker extern void kmem_cache_destroy(struct kmem_cache *s);
109*6a54128fSAndroid Build Coastguard Worker extern void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags);
110*6a54128fSAndroid Build Coastguard Worker extern void kmem_cache_free(struct kmem_cache *s, void *objp);
111*6a54128fSAndroid Build Coastguard Worker extern void *kmalloc(size_t size, gfp_t flags);
112*6a54128fSAndroid Build Coastguard Worker extern void kfree(const void *objp);
113*6a54128fSAndroid Build Coastguard Worker extern size_t journal_tag_bytes(journal_t *journal);
114*6a54128fSAndroid Build Coastguard Worker extern __u32 __hash_32(__u32 val);
115*6a54128fSAndroid Build Coastguard Worker extern __u32 hash_32(__u32 val, unsigned int bits);
116*6a54128fSAndroid Build Coastguard Worker extern __u32 hash_64(__u64 val, unsigned int bits);
117*6a54128fSAndroid Build Coastguard Worker extern void *kmalloc_array(unsigned n, unsigned size, int flags);
118*6a54128fSAndroid Build Coastguard Worker extern __u32 jbd2_chksum(journal_t *j, __u32 crc, const void *address,
119*6a54128fSAndroid Build Coastguard Worker unsigned int length);
120*6a54128fSAndroid Build Coastguard Worker extern void jbd2_descriptor_block_csum_set(journal_t *j,
121*6a54128fSAndroid Build Coastguard Worker struct buffer_head *bh);
122*6a54128fSAndroid Build Coastguard Worker #endif
123*6a54128fSAndroid Build Coastguard Worker
124*6a54128fSAndroid Build Coastguard Worker #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
125*6a54128fSAndroid Build Coastguard Worker #ifdef E2FSCK_INCLUDE_INLINE_FUNCS
126*6a54128fSAndroid Build Coastguard Worker #if (__STDC_VERSION__ >= 199901L)
127*6a54128fSAndroid Build Coastguard Worker #define _INLINE_ extern inline
128*6a54128fSAndroid Build Coastguard Worker #else
129*6a54128fSAndroid Build Coastguard Worker #define _INLINE_ inline
130*6a54128fSAndroid Build Coastguard Worker #endif
131*6a54128fSAndroid Build Coastguard Worker #else /* !E2FSCK_INCLUDE_INLINE FUNCS */
132*6a54128fSAndroid Build Coastguard Worker #if (__STDC_VERSION__ >= 199901L)
133*6a54128fSAndroid Build Coastguard Worker #define _INLINE_ inline
134*6a54128fSAndroid Build Coastguard Worker #else /* not C99 */
135*6a54128fSAndroid Build Coastguard Worker #ifdef __GNUC__
136*6a54128fSAndroid Build Coastguard Worker #define _INLINE_ extern __inline__
137*6a54128fSAndroid Build Coastguard Worker #else /* For Watcom C */
138*6a54128fSAndroid Build Coastguard Worker #define _INLINE_ extern inline
139*6a54128fSAndroid Build Coastguard Worker #endif /* __GNUC__ */
140*6a54128fSAndroid Build Coastguard Worker #endif /* __STDC_VERSION__ >= 199901L */
141*6a54128fSAndroid Build Coastguard Worker #endif /* E2FSCK_INCLUDE_INLINE_FUNCS */
142*6a54128fSAndroid Build Coastguard Worker
143*6a54128fSAndroid Build Coastguard Worker _INLINE_ struct kmem_cache *
kmem_cache_create(const char * name EXT2FS_ATTR ((unused)),unsigned int size,unsigned int align EXT2FS_ATTR ((unused)),unsigned int flags EXT2FS_ATTR ((unused)),void (* ctor)(void *)EXT2FS_ATTR ((unused)))144*6a54128fSAndroid Build Coastguard Worker kmem_cache_create(const char *name EXT2FS_ATTR((unused)),
145*6a54128fSAndroid Build Coastguard Worker unsigned int size,
146*6a54128fSAndroid Build Coastguard Worker unsigned int align EXT2FS_ATTR((unused)),
147*6a54128fSAndroid Build Coastguard Worker unsigned int flags EXT2FS_ATTR((unused)),
148*6a54128fSAndroid Build Coastguard Worker void (*ctor)(void *) EXT2FS_ATTR((unused)))
149*6a54128fSAndroid Build Coastguard Worker {
150*6a54128fSAndroid Build Coastguard Worker struct kmem_cache *new_cache;
151*6a54128fSAndroid Build Coastguard Worker
152*6a54128fSAndroid Build Coastguard Worker new_cache = malloc(sizeof(*new_cache));
153*6a54128fSAndroid Build Coastguard Worker if (new_cache)
154*6a54128fSAndroid Build Coastguard Worker new_cache->object_size = size;
155*6a54128fSAndroid Build Coastguard Worker return new_cache;
156*6a54128fSAndroid Build Coastguard Worker }
157*6a54128fSAndroid Build Coastguard Worker
kmem_cache_destroy(struct kmem_cache * s)158*6a54128fSAndroid Build Coastguard Worker _INLINE_ void kmem_cache_destroy(struct kmem_cache *s)
159*6a54128fSAndroid Build Coastguard Worker {
160*6a54128fSAndroid Build Coastguard Worker free(s);
161*6a54128fSAndroid Build Coastguard Worker }
162*6a54128fSAndroid Build Coastguard Worker
kmem_cache_alloc(struct kmem_cache * cachep,gfp_t flags EXT2FS_ATTR ((unused)))163*6a54128fSAndroid Build Coastguard Worker _INLINE_ void *kmem_cache_alloc(struct kmem_cache *cachep,
164*6a54128fSAndroid Build Coastguard Worker gfp_t flags EXT2FS_ATTR((unused)))
165*6a54128fSAndroid Build Coastguard Worker {
166*6a54128fSAndroid Build Coastguard Worker return malloc(cachep->object_size);
167*6a54128fSAndroid Build Coastguard Worker }
168*6a54128fSAndroid Build Coastguard Worker
kmem_cache_free(struct kmem_cache * s EXT2FS_ATTR ((unused)),void * objp)169*6a54128fSAndroid Build Coastguard Worker _INLINE_ void kmem_cache_free(struct kmem_cache *s EXT2FS_ATTR((unused)),
170*6a54128fSAndroid Build Coastguard Worker void *objp)
171*6a54128fSAndroid Build Coastguard Worker {
172*6a54128fSAndroid Build Coastguard Worker free(objp);
173*6a54128fSAndroid Build Coastguard Worker }
174*6a54128fSAndroid Build Coastguard Worker
kmalloc(size_t size,gfp_t flags EXT2FS_ATTR ((unused)))175*6a54128fSAndroid Build Coastguard Worker _INLINE_ void *kmalloc(size_t size, gfp_t flags EXT2FS_ATTR((unused)))
176*6a54128fSAndroid Build Coastguard Worker {
177*6a54128fSAndroid Build Coastguard Worker return malloc(size);
178*6a54128fSAndroid Build Coastguard Worker }
179*6a54128fSAndroid Build Coastguard Worker
kfree(const void * objp)180*6a54128fSAndroid Build Coastguard Worker _INLINE_ void kfree(const void *objp)
181*6a54128fSAndroid Build Coastguard Worker {
182*6a54128fSAndroid Build Coastguard Worker #ifdef HAVE_INTPTR_T
183*6a54128fSAndroid Build Coastguard Worker /*
184*6a54128fSAndroid Build Coastguard Worker * Work around a botch in the C standard, which triggers
185*6a54128fSAndroid Build Coastguard Worker * compiler warnings. For better or for worse, the kernel
186*6a54128fSAndroid Build Coastguard Worker * uses const void * for kfree, while the C standard mandates
187*6a54128fSAndroid Build Coastguard Worker * the use of void *. See: https://yarchive.net/comp/const.html
188*6a54128fSAndroid Build Coastguard Worker */
189*6a54128fSAndroid Build Coastguard Worker free((void *)(intptr_t)objp);
190*6a54128fSAndroid Build Coastguard Worker #else
191*6a54128fSAndroid Build Coastguard Worker free((void *)objp);
192*6a54128fSAndroid Build Coastguard Worker #endif
193*6a54128fSAndroid Build Coastguard Worker }
194*6a54128fSAndroid Build Coastguard Worker
195*6a54128fSAndroid Build Coastguard Worker /* generic hashing taken from the Linux kernel */
196*6a54128fSAndroid Build Coastguard Worker #define GOLDEN_RATIO_32 0x61C88647
197*6a54128fSAndroid Build Coastguard Worker #define GOLDEN_RATIO_64 0x61C8864680B583EBull
198*6a54128fSAndroid Build Coastguard Worker
__hash_32(__u32 val)199*6a54128fSAndroid Build Coastguard Worker _INLINE_ __u32 __hash_32(__u32 val)
200*6a54128fSAndroid Build Coastguard Worker {
201*6a54128fSAndroid Build Coastguard Worker return val * GOLDEN_RATIO_32;
202*6a54128fSAndroid Build Coastguard Worker }
203*6a54128fSAndroid Build Coastguard Worker
hash_32(__u32 val,unsigned int bits)204*6a54128fSAndroid Build Coastguard Worker _INLINE_ __u32 hash_32(__u32 val, unsigned int bits)
205*6a54128fSAndroid Build Coastguard Worker {
206*6a54128fSAndroid Build Coastguard Worker /* High bits are more random, so use them. */
207*6a54128fSAndroid Build Coastguard Worker return __hash_32(val) >> (32 - bits);
208*6a54128fSAndroid Build Coastguard Worker }
209*6a54128fSAndroid Build Coastguard Worker
hash_64(__u64 val,unsigned int bits)210*6a54128fSAndroid Build Coastguard Worker _INLINE_ __u32 hash_64(__u64 val, unsigned int bits)
211*6a54128fSAndroid Build Coastguard Worker {
212*6a54128fSAndroid Build Coastguard Worker if (sizeof(long) >= 8) {
213*6a54128fSAndroid Build Coastguard Worker /* 64x64-bit multiply is efficient on all 64-bit processors */
214*6a54128fSAndroid Build Coastguard Worker return val * GOLDEN_RATIO_64 >> (64 - bits);
215*6a54128fSAndroid Build Coastguard Worker } else {
216*6a54128fSAndroid Build Coastguard Worker /* Hash 64 bits using only 32x32-bit multiply. */
217*6a54128fSAndroid Build Coastguard Worker return hash_32((__u32)val ^ __hash_32(val >> 32), bits);
218*6a54128fSAndroid Build Coastguard Worker }
219*6a54128fSAndroid Build Coastguard Worker }
220*6a54128fSAndroid Build Coastguard Worker
kmalloc_array(unsigned n,unsigned size,int flags EXT2FS_ATTR ((unused)))221*6a54128fSAndroid Build Coastguard Worker _INLINE_ void *kmalloc_array(unsigned n, unsigned size,
222*6a54128fSAndroid Build Coastguard Worker int flags EXT2FS_ATTR((unused)))
223*6a54128fSAndroid Build Coastguard Worker {
224*6a54128fSAndroid Build Coastguard Worker if (n && (~0U)/n < size)
225*6a54128fSAndroid Build Coastguard Worker return NULL;
226*6a54128fSAndroid Build Coastguard Worker return malloc(n * size);
227*6a54128fSAndroid Build Coastguard Worker }
228*6a54128fSAndroid Build Coastguard Worker
jbd2_chksum(journal_t * j EXT2FS_ATTR ((unused)),__u32 crc,const void * address,unsigned int length)229*6a54128fSAndroid Build Coastguard Worker _INLINE_ __u32 jbd2_chksum(journal_t *j EXT2FS_ATTR((unused)),
230*6a54128fSAndroid Build Coastguard Worker __u32 crc, const void *address,
231*6a54128fSAndroid Build Coastguard Worker unsigned int length)
232*6a54128fSAndroid Build Coastguard Worker {
233*6a54128fSAndroid Build Coastguard Worker return ext2fs_crc32c_le(crc, address, length);
234*6a54128fSAndroid Build Coastguard Worker }
235*6a54128fSAndroid Build Coastguard Worker
jbd2_descriptor_block_csum_set(journal_t * j,struct buffer_head * bh)236*6a54128fSAndroid Build Coastguard Worker _INLINE_ void jbd2_descriptor_block_csum_set(journal_t *j,
237*6a54128fSAndroid Build Coastguard Worker struct buffer_head *bh)
238*6a54128fSAndroid Build Coastguard Worker {
239*6a54128fSAndroid Build Coastguard Worker struct jbd2_journal_block_tail *tail;
240*6a54128fSAndroid Build Coastguard Worker __u32 csum;
241*6a54128fSAndroid Build Coastguard Worker
242*6a54128fSAndroid Build Coastguard Worker if (!jbd2_journal_has_csum_v2or3(j))
243*6a54128fSAndroid Build Coastguard Worker return;
244*6a54128fSAndroid Build Coastguard Worker
245*6a54128fSAndroid Build Coastguard Worker tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
246*6a54128fSAndroid Build Coastguard Worker sizeof(struct jbd2_journal_block_tail));
247*6a54128fSAndroid Build Coastguard Worker tail->t_checksum = 0;
248*6a54128fSAndroid Build Coastguard Worker csum = jbd2_chksum(j, j->j_csum_seed, bh->b_data, j->j_blocksize);
249*6a54128fSAndroid Build Coastguard Worker tail->t_checksum = cpu_to_be32(csum);
250*6a54128fSAndroid Build Coastguard Worker }
251*6a54128fSAndroid Build Coastguard Worker #undef _INLINE_
252*6a54128fSAndroid Build Coastguard Worker #endif
253*6a54128fSAndroid Build Coastguard Worker
254*6a54128fSAndroid Build Coastguard Worker /*
255*6a54128fSAndroid Build Coastguard Worker * Kernel compatibility functions are defined in journal.c
256*6a54128fSAndroid Build Coastguard Worker */
257*6a54128fSAndroid Build Coastguard Worker int jbd2_journal_bmap(journal_t *journal, unsigned long block,
258*6a54128fSAndroid Build Coastguard Worker unsigned long long *phys);
259*6a54128fSAndroid Build Coastguard Worker struct buffer_head *getblk(kdev_t ctx, unsigned long long blocknr,
260*6a54128fSAndroid Build Coastguard Worker int blocksize);
261*6a54128fSAndroid Build Coastguard Worker int sync_blockdev(kdev_t kdev);
262*6a54128fSAndroid Build Coastguard Worker void ll_rw_block(int rw, int op_flags, int nr, struct buffer_head *bh[]);
263*6a54128fSAndroid Build Coastguard Worker void mark_buffer_dirty(struct buffer_head *bh);
264*6a54128fSAndroid Build Coastguard Worker void mark_buffer_uptodate(struct buffer_head *bh, int val);
265*6a54128fSAndroid Build Coastguard Worker void brelse(struct buffer_head *bh);
266*6a54128fSAndroid Build Coastguard Worker int buffer_uptodate(struct buffer_head *bh);
267*6a54128fSAndroid Build Coastguard Worker void wait_on_buffer(struct buffer_head *bh);
268*6a54128fSAndroid Build Coastguard Worker
269*6a54128fSAndroid Build Coastguard Worker /*
270*6a54128fSAndroid Build Coastguard Worker * Define newer 2.5 interfaces
271*6a54128fSAndroid Build Coastguard Worker */
272*6a54128fSAndroid Build Coastguard Worker #define __getblk(dev, blocknr, blocksize) getblk(dev, blocknr, blocksize)
273*6a54128fSAndroid Build Coastguard Worker #define set_buffer_uptodate(bh) mark_buffer_uptodate(bh, 1)
274*6a54128fSAndroid Build Coastguard Worker
275*6a54128fSAndroid Build Coastguard Worker #ifdef DEBUGFS
276*6a54128fSAndroid Build Coastguard Worker #include <assert.h>
277*6a54128fSAndroid Build Coastguard Worker #undef J_ASSERT
278*6a54128fSAndroid Build Coastguard Worker #define J_ASSERT(x) assert(x)
279*6a54128fSAndroid Build Coastguard Worker
280*6a54128fSAndroid Build Coastguard Worker #define JSB_HAS_INCOMPAT_FEATURE(jsb, mask) \
281*6a54128fSAndroid Build Coastguard Worker ((jsb)->s_header.h_blocktype == ext2fs_cpu_to_be32(JBD2_SUPERBLOCK_V2) && \
282*6a54128fSAndroid Build Coastguard Worker ((jsb)->s_feature_incompat & ext2fs_cpu_to_be32((mask))))
283*6a54128fSAndroid Build Coastguard Worker #else /* !DEBUGFS */
284*6a54128fSAndroid Build Coastguard Worker
285*6a54128fSAndroid Build Coastguard Worker extern e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
286*6a54128fSAndroid Build Coastguard Worker
287*6a54128fSAndroid Build Coastguard Worker #define J_ASSERT(assert) \
288*6a54128fSAndroid Build Coastguard Worker do { if (!(assert)) { \
289*6a54128fSAndroid Build Coastguard Worker printf ("Assertion failure in %s() at %s line %d: " \
290*6a54128fSAndroid Build Coastguard Worker "\"%s\"\n", \
291*6a54128fSAndroid Build Coastguard Worker __func__, __FILE__, __LINE__, # assert); \
292*6a54128fSAndroid Build Coastguard Worker fatal_error(e2fsck_global_ctx, 0); \
293*6a54128fSAndroid Build Coastguard Worker } } while (0)
294*6a54128fSAndroid Build Coastguard Worker
295*6a54128fSAndroid Build Coastguard Worker #endif /* DEBUGFS */
296*6a54128fSAndroid Build Coastguard Worker
297*6a54128fSAndroid Build Coastguard Worker #ifndef EFSBADCRC
298*6a54128fSAndroid Build Coastguard Worker #define EFSBADCRC EXT2_ET_BAD_CRC
299*6a54128fSAndroid Build Coastguard Worker #endif
300*6a54128fSAndroid Build Coastguard Worker #ifndef EFSCORRUPTED
301*6a54128fSAndroid Build Coastguard Worker #define EFSCORRUPTED EXT2_ET_FILESYSTEM_CORRUPTED
302*6a54128fSAndroid Build Coastguard Worker #endif
303*6a54128fSAndroid Build Coastguard Worker
304*6a54128fSAndroid Build Coastguard Worker /* recovery.c */
305*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_recover (journal_t *journal);
306*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_skip_recovery (journal_t *);
307*6a54128fSAndroid Build Coastguard Worker
308*6a54128fSAndroid Build Coastguard Worker /* revoke.c */
309*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_init_revoke(journal_t *, int);
310*6a54128fSAndroid Build Coastguard Worker extern void jbd2_journal_destroy_revoke(journal_t *);
311*6a54128fSAndroid Build Coastguard Worker extern void jbd2_journal_destroy_revoke_record_cache(void);
312*6a54128fSAndroid Build Coastguard Worker extern void jbd2_journal_destroy_revoke_table_cache(void);
313*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_init_revoke_record_cache(void);
314*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_init_revoke_table_cache(void);
315*6a54128fSAndroid Build Coastguard Worker
316*6a54128fSAndroid Build Coastguard Worker
317*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
318*6a54128fSAndroid Build Coastguard Worker extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
319*6a54128fSAndroid Build Coastguard Worker extern void jbd2_journal_clear_revoke(journal_t *);
320*6a54128fSAndroid Build Coastguard Worker
321*6a54128fSAndroid Build Coastguard Worker #endif /* _JFS_USER_H */
322