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     __be32 h_magic;
38     __be32 h_blocktype;
39     __be32 h_sequence;
40 } journal_header_t;
41 
42 #define JBD2_CRC32_CHKSUM 1
43 #define JBD2_MD5_CHKSUM 2
44 #define JBD2_SHA1_CHKSUM 3
45 
46 #define JBD2_CRC32_CHKSUM_SIZE 4
47 
48 #define JBD2_CHECKSUM_BYTES (32 / sizeof(__u32))
49 
50 struct commit_header {
51     __be32 h_magic;
52     __be32 h_blocktype;
53     __be32 h_sequence;
54     unsigned char h_chksum_type;
55     unsigned char h_chksum_size;
56     unsigned char h_padding[2];
57     __be32 h_chksum[JBD2_CHECKSUM_BYTES];
58     __be64 h_commit_sec;
59     __be32 h_commit_nsec;
60 };
61 
62 typedef struct journal_block_tag_s {
63     __be32 t_blocknr;
64     __be32 t_flags;
65     __be32 t_blocknr_high;
66 } journal_block_tag_t;
67 
68 #define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
69 #define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
70 
71 typedef struct jbd2_journal_revoke_header_s {
72     journal_header_t r_header;
73     __be32 r_count;
74 } jbd2_journal_revoke_header_t;
75 
76 #define JBD2_FLAG_ESCAPE 1
77 #define JBD2_FLAG_SAME_UUID 2
78 #define JBD2_FLAG_DELETED 4
79 #define JBD2_FLAG_LAST_TAG 8
80 
81 typedef struct journal_superblock_s {
82     journal_header_t s_header;
83 
84     __be32 s_blocksize;
85     __be32 s_maxlen;
86     __be32 s_first;
87 
88     __be32 s_sequence;
89     __be32 s_start;
90 
91     __be32 s_errno;
92 
93     __be32 s_feature_compat;
94     __be32 s_feature_incompat;
95     __be32 s_feature_ro_compat;
96 
97     __u8 s_uuid[16];
98 
99     __be32 s_nr_users;
100 
101     __be32 s_dynsuper;
102 
103     __be32 s_max_transaction;
104     __be32 s_max_trans_data;
105 
106     __u32 s_padding[44];
107 
108     __u8 s_users[16 * 48];
109 
110 } journal_superblock_t;
111 
112 #define JBD2_HAS_COMPAT_FEATURE(j, mask) \
113     ((j)->j_format_version >= 2 && ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
114 #define JBD2_HAS_RO_COMPAT_FEATURE(j, mask) \
115     ((j)->j_format_version >= 2 && ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
116 #define JBD2_HAS_INCOMPAT_FEATURE(j, mask) \
117     ((j)->j_format_version >= 2 && ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
118 
119 #define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
120 
121 #define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
122 #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
123 #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
124 
125 #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
126 #define JBD2_KNOWN_ROCOMPAT_FEATURES 0
127 #define JBD2_KNOWN_INCOMPAT_FEATURES                              \
128     (JBD2_FEATURE_INCOMPAT_REVOKE | JBD2_FEATURE_INCOMPAT_64BIT | \
129      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