source: branches/stable/mindi-busybox/e2fsprogs/ext2fs/kernel-jbd.h @ 821

Last change on this file since 821 was 821, checked in by Bruno Cornec, 14 years ago

Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)

File size: 6.2 KB
Line 
1/*
2 * linux/include/linux/jbd.h
3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com>
5 *
6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
7 *
8 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference.
11 *
12 * Definitions for transaction data structures for the buffer cache
13 * filesystem journaling support.
14 */
15
16#ifndef _LINUX_JBD_H
17#define _LINUX_JBD_H
18
19#include <sys/types.h>
20#include <linux/types.h>
21#include "ext2fs.h"
22
23/*
24 * Standard header for all descriptor blocks:
25 */
26
27typedef struct journal_header_s
28{
29    __u32       h_magic;
30    __u32       h_blocktype;
31    __u32       h_sequence;
32} journal_header_t;
33
34/*
35 * This is the global e2fsck structure.
36 */
37typedef struct e2fsck_struct *e2fsck_t;
38
39
40struct inode {
41    e2fsck_t        i_ctx;
42    ext2_ino_t      i_ino;
43    struct ext2_inode i_ext2;
44};
45
46
47/*
48 * The journal superblock.  All fields are in big-endian byte order.
49 */
50typedef struct journal_superblock_s
51{
52/* 0x0000 */
53    journal_header_t s_header;
54
55/* 0x000C */
56    /* Static information describing the journal */
57    __u32   s_blocksize;        /* journal device blocksize */
58    __u32   s_maxlen;       /* total blocks in journal file */
59    __u32   s_first;        /* first block of log information */
60
61/* 0x0018 */
62    /* Dynamic information describing the current state of the log */
63    __u32   s_sequence;     /* first commit ID expected in log */
64    __u32   s_start;        /* blocknr of start of log */
65
66/* 0x0020 */
67    /* Error value, as set by journal_abort(). */
68    __s32   s_errno;
69
70/* 0x0024 */
71    /* Remaining fields are only valid in a version-2 superblock */
72    __u32   s_feature_compat;   /* compatible feature set */
73    __u32   s_feature_incompat; /* incompatible feature set */
74    __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
75/* 0x0030 */
76    __u8    s_uuid[16];     /* 128-bit uuid for journal */
77
78/* 0x0040 */
79    __u32   s_nr_users;     /* Nr of filesystems sharing log */
80
81    __u32   s_dynsuper;     /* Blocknr of dynamic superblock copy*/
82
83/* 0x0048 */
84    __u32   s_max_transaction;  /* Limit of journal blocks per trans.*/
85    __u32   s_max_trans_data;   /* Limit of data blocks per trans. */
86
87/* 0x0050 */
88    __u32   s_padding[44];
89
90/* 0x0100 */
91    __u8    s_users[16*48];     /* ids of all fs'es sharing the log */
92/* 0x0400 */
93} journal_superblock_t;
94
95
96extern int journal_blocks_per_page(struct inode *inode);
97extern int jbd_blocks_per_page(struct inode *inode);
98
99#define JFS_MIN_JOURNAL_BLOCKS 1024
100
101
102/*
103 * Internal structures used by the logging mechanism:
104 */
105
106#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
107
108/*
109 * Descriptor block types:
110 */
111
112#define JFS_DESCRIPTOR_BLOCK    1
113#define JFS_COMMIT_BLOCK    2
114#define JFS_SUPERBLOCK_V1   3
115#define JFS_SUPERBLOCK_V2   4
116#define JFS_REVOKE_BLOCK    5
117
118/*
119 * The block tag: used to describe a single buffer in the journal
120 */
121typedef struct journal_block_tag_s
122{
123    __u32       t_blocknr;  /* The on-disk block number */
124    __u32       t_flags;    /* See below */
125} journal_block_tag_t;
126
127/*
128 * The revoke descriptor: used on disk to describe a series of blocks to
129 * be revoked from the log
130 */
131typedef struct journal_revoke_header_s
132{
133    journal_header_t r_header;
134    int      r_count;   /* Count of bytes used in the block */
135} journal_revoke_header_t;
136
137
138/* Definitions for the journal tag flags word: */
139#define JFS_FLAG_ESCAPE     1   /* on-disk block is escaped */
140#define JFS_FLAG_SAME_UUID  2   /* block has same uuid as previous */
141#define JFS_FLAG_DELETED    4   /* block deleted by this transaction */
142#define JFS_FLAG_LAST_TAG   8   /* last tag in this descriptor block */
143
144
145
146
147#define JFS_HAS_COMPAT_FEATURE(j,mask)                  \
148    ((j)->j_format_version >= 2 &&                  \
149     ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
150#define JFS_HAS_RO_COMPAT_FEATURE(j,mask)               \
151    ((j)->j_format_version >= 2 &&                  \
152     ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
153#define JFS_HAS_INCOMPAT_FEATURE(j,mask)                \
154    ((j)->j_format_version >= 2 &&                  \
155     ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
156
157#define JFS_FEATURE_INCOMPAT_REVOKE 0x00000001
158
159/* Features known to this kernel version: */
160#define JFS_KNOWN_COMPAT_FEATURES   0
161#define JFS_KNOWN_ROCOMPAT_FEATURES 0
162#define JFS_KNOWN_INCOMPAT_FEATURES JFS_FEATURE_INCOMPAT_REVOKE
163
164/* Comparison functions for transaction IDs: perform comparisons using
165 * modulo arithmetic so that they work over sequence number wraps. */
166
167
168/*
169 * Definitions which augment the buffer_head layer
170 */
171
172/* journaling buffer types */
173#define BJ_None     0   /* Not journaled */
174#define BJ_SyncData 1   /* Normal data: flush before commit */
175#define BJ_AsyncData    2   /* writepage data: wait on it before commit */
176#define BJ_Metadata 3   /* Normal journaled metadata */
177#define BJ_Forget   4   /* Buffer superceded by this transaction */
178#define BJ_IO       5   /* Buffer is for temporary IO use */
179#define BJ_Shadow   6   /* Buffer contents being shadowed to the log */
180#define BJ_LogCtl   7   /* Buffer contains log descriptors */
181#define BJ_Reserved 8   /* Buffer is reserved for access by journal */
182#define BJ_Types    9
183
184
185struct kdev_s {
186    e2fsck_t        k_ctx;
187    int             k_dev;
188};
189
190typedef struct kdev_s *kdev_t;
191typedef unsigned int tid_t;
192
193struct journal_s
194{
195    unsigned long       j_flags;
196    int         j_errno;
197    struct buffer_head *    j_sb_buffer;
198    struct journal_superblock_s *j_superblock;
199    int         j_format_version;
200    unsigned long       j_head;
201    unsigned long       j_tail;
202    unsigned long       j_free;
203    unsigned long       j_first, j_last;
204    kdev_t          j_dev;
205    kdev_t          j_fs_dev;
206    int         j_blocksize;
207    unsigned int        j_blk_offset;
208    unsigned int        j_maxlen;
209    struct inode *      j_inode;
210    tid_t           j_tail_sequence;
211    tid_t           j_transaction_sequence;
212    __u8            j_uuid[16];
213    struct jbd_revoke_table_s *j_revoke;
214};
215
216typedef struct journal_s journal_t;
217
218extern int     journal_recover    (journal_t *journal);
219extern int     journal_skip_recovery (journal_t *);
220
221/* Primary revoke support */
222extern int     journal_init_revoke(journal_t *, int);
223extern void    journal_destroy_revoke_caches(void);
224extern int     journal_init_revoke_caches(void);
225
226/* Recovery revoke support */
227extern int     journal_set_revoke(journal_t *, unsigned long, tid_t);
228extern int     journal_test_revoke(journal_t *, unsigned long, tid_t);
229extern void    journal_clear_revoke(journal_t *);
230extern void    journal_brelse_array(struct buffer_head *b[], int n);
231
232extern void    journal_destroy_revoke(journal_t *);
233
234
235#endif  /* _LINUX_JBD_H */
Note: See TracBrowser for help on using the repository browser.