Whamcloud - gitweb
Many files:
[tools/e2fsprogs.git] / e2fsck / jfs_user.h
1 /*
2  * Compatibility header file for e2fsck which should be included
3  * instead of linux/jfs.h
4  *
5  * Copyright (C) 2000 Stephen C. Tweedie
6  *
7  * This file may be redistributed under the terms of the
8  * GNU General Public License version 2 or at your discretion
9  * any later version.
10  */
11
12 /*
13  * Pull in the definition of the e2fsck context structure
14  */
15 #include "e2fsck.h"
16
17 struct buffer_head {
18         char     b_data[8192];
19         e2fsck_t b_ctx;
20         io_channel b_io;
21         int      b_size;
22         blk_t    b_blocknr;
23         int      b_dirty;
24         int      b_uptodate;
25         int      b_err;
26 };
27
28 struct inode {
29         e2fsck_t i_ctx;
30         ino_t    i_ino;
31         struct ext2_inode i_ext2;
32 };
33
34 typedef e2fsck_t kdev_t;
35
36 /*
37  * Kernel compatibility functions are defined in journal.c
38  */
39 int bmap(struct inode *inode, int block);
40 struct buffer_head *getblk(e2fsck_t ctx, blk_t blocknr, int blocksize);
41 void ll_rw_block(int rw, int dummy, struct buffer_head *bh[]);
42 void mark_buffer_dirty(struct buffer_head *bh, int dummy);
43 void brelse(struct buffer_head *bh);
44 int buffer_uptodate(struct buffer_head *bh);
45 void wait_on_buffer(struct buffer_head *bh);
46 #define fsync_dev(dev) do {} while(0)
47 #define buffer_req(bh) 1
48 #define do_readahead(journal, start) do {} while(0)
49         
50 extern e2fsck_t e2fsck_global_ctx;  /* Try your very best not to use this! */
51
52 typedef struct {
53         int     object_length;
54 } kmem_cache_t;
55
56 #define kmem_cache_alloc(cache,flags) malloc((cache)->object_length)
57 #define kmem_cache_free(cache,obj) free(obj)
58 #define kmem_cache_create(name,len,a,b,c,d) do_cache_create(len)
59 #define kmalloc(len,flags) malloc(len)
60 #define kfree(p) free(p)
61
62 /*
63  * We use the standard libext2fs portability tricks for inline
64  * functions.  
65  */
66 extern kmem_cache_t * do_cache_create(int len);
67         
68 #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
69 #ifdef E2FSCK_INCLUDE_INLINE_FUNCS
70 #define _INLINE_ extern
71 #else
72 #ifdef __GNUC__
73 #define _INLINE_ extern __inline__
74 #else                           /* For Watcom C */
75 #define _INLINE_ extern inline
76 #endif
77 #endif
78
79 _INLINE_ kmem_cache_t * do_cache_create(int len)
80 {
81         kmem_cache_t *new_cache;
82         new_cache = malloc(sizeof(*new_cache));
83         if (new_cache)
84                 new_cache->object_length = len;
85         return new_cache;
86 }
87
88 #undef _INLINE_
89 #endif
90
91 /*
92  * Now pull in the real linux/jfs.h definitions.
93  */
94 #include <linux/jfs.h>