Fix fs configuration support
[project/make_ext4fs.git] / jbd2.h
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef _LINUX_JBD2_H
13 #define _LINUX_JBD2_H
14
15 #define JBD2_DEBUG
16 #define jfs_debug jbd_debug
17
18 #define journal_oom_retry 1
19
20 #undef JBD2_PARANOID_IOFAIL
21
22 #define JBD2_DEFAULT_MAX_COMMIT_AGE 5
23
24 #define jbd_debug(f, a...)  
25
26 #define JBD2_MIN_JOURNAL_BLOCKS 1024
27
28 #define JBD2_MAGIC_NUMBER 0xc03b3998U  
29
30 #define JBD2_DESCRIPTOR_BLOCK 1
31 #define JBD2_COMMIT_BLOCK 2
32 #define JBD2_SUPERBLOCK_V1 3
33 #define JBD2_SUPERBLOCK_V2 4
34 #define JBD2_REVOKE_BLOCK 5
35
36 typedef struct journal_header_s
37 {
38  __be32 h_magic;
39  __be32 h_blocktype;
40  __be32 h_sequence;
41 } journal_header_t;
42
43 #define JBD2_CRC32_CHKSUM 1
44 #define JBD2_MD5_CHKSUM 2
45 #define JBD2_SHA1_CHKSUM 3
46
47 #define JBD2_CRC32_CHKSUM_SIZE 4
48
49 #define JBD2_CHECKSUM_BYTES (32 / sizeof(__u32))
50
51 struct commit_header {
52  __be32 h_magic;
53  __be32 h_blocktype;
54  __be32 h_sequence;
55  unsigned char h_chksum_type;
56  unsigned char h_chksum_size;
57  unsigned char h_padding[2];
58  __be32 h_chksum[JBD2_CHECKSUM_BYTES];
59  __be64 h_commit_sec;
60  __be32 h_commit_nsec;
61 };
62
63 typedef struct journal_block_tag_s
64 {
65  __be32 t_blocknr;
66  __be32 t_flags;
67  __be32 t_blocknr_high;
68 } journal_block_tag_t;
69
70 #define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
71 #define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
72
73 typedef struct jbd2_journal_revoke_header_s
74 {
75  journal_header_t r_header;
76  __be32 r_count;
77 } jbd2_journal_revoke_header_t;
78
79 #define JBD2_FLAG_ESCAPE 1  
80 #define JBD2_FLAG_SAME_UUID 2  
81 #define JBD2_FLAG_DELETED 4  
82 #define JBD2_FLAG_LAST_TAG 8  
83
84 typedef struct journal_superblock_s
85 {
86
87  journal_header_t s_header;
88
89  __be32 s_blocksize;
90  __be32 s_maxlen;
91  __be32 s_first;
92
93  __be32 s_sequence;
94  __be32 s_start;
95
96  __be32 s_errno;
97
98  __be32 s_feature_compat;
99  __be32 s_feature_incompat;
100  __be32 s_feature_ro_compat;
101
102  __u8 s_uuid[16];
103
104  __be32 s_nr_users;
105
106  __be32 s_dynsuper;
107
108  __be32 s_max_transaction;
109  __be32 s_max_trans_data;
110
111  __u32 s_padding[44];
112
113  __u8 s_users[16*48];
114
115 } journal_superblock_t;
116
117 #define JBD2_HAS_COMPAT_FEATURE(j,mask)   ((j)->j_format_version >= 2 &&   ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
118 #define JBD2_HAS_RO_COMPAT_FEATURE(j,mask)   ((j)->j_format_version >= 2 &&   ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
119 #define JBD2_HAS_INCOMPAT_FEATURE(j,mask)   ((j)->j_format_version >= 2 &&   ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
120
121 #define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
122
123 #define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
124 #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
125 #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
126
127 #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
128 #define JBD2_KNOWN_ROCOMPAT_FEATURES 0
129 #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE |   JBD2_FEATURE_INCOMPAT_64BIT |   JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
130
131 #define BJ_None 0  
132 #define BJ_Metadata 1  
133 #define BJ_Forget 2  
134 #define BJ_IO 3  
135 #define BJ_Shadow 4  
136 #define BJ_LogCtl 5  
137 #define BJ_Reserved 6  
138 #define BJ_Types 7
139
140 #endif
141