]>
Commit | Line | Data |
---|---|---|
d321ceac | 1 | /* |
f302e9e4 | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc.All Rights Reserved. |
d321ceac | 3 | * |
f302e9e4 NS |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License as | |
d321ceac NS |
6 | * published by the Free Software Foundation. |
7 | * | |
f302e9e4 NS |
8 | * This program is distributed in the hope that it would be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU General Public License for more details. | |
d321ceac | 12 | * |
f302e9e4 NS |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write the Free Software Foundation, | |
15 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
d321ceac NS |
16 | */ |
17 | #ifndef LIBXLOG_H | |
18 | #define LIBXLOG_H | |
19 | ||
d321ceac NS |
20 | /* |
21 | * define the userlevel xlog_t to be the subset of the kernel's | |
22 | * xlog_t that we actually need to get our work done, avoiding | |
23 | * the need to define any exotic kernel types in userland. | |
24 | */ | |
999f0b9c | 25 | struct xlog { |
d321ceac NS |
26 | xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */ |
27 | xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */ | |
28 | xfs_mount_t *l_mp; /* mount point */ | |
75c8b434 | 29 | struct xfs_buftarg *l_dev; /* dev_t of log */ |
d321ceac | 30 | xfs_daddr_t l_logBBstart; /* start block of log */ |
d321ceac NS |
31 | int l_logBBsize; /* size of log in 512 byte chunks */ |
32 | int l_curr_cycle; /* Cycle number of log writes */ | |
33 | int l_prev_cycle; /* Cycle # b4 last block increment */ | |
34 | int l_curr_block; /* current logical block of log */ | |
35 | int l_prev_block; /* previous logical block of log */ | |
36 | int l_iclog_size; /* size of log in bytes */ | |
37 | int l_iclog_size_log;/* log power size of log */ | |
38 | int l_iclog_bufs; /* number of iclog buffers */ | |
c40bdaa2 DC |
39 | atomic64_t l_grant_reserve_head; |
40 | atomic64_t l_grant_write_head; | |
a562a63b | 41 | uint l_sectbb_log; /* log2 of sector size in bbs */ |
2aa2e7b9 BN |
42 | uint l_sectbb_mask; /* sector size (in BBs) |
43 | * alignment mask */ | |
c40bdaa2 | 44 | int l_sectBBsize; /* size of log sector in 512 byte chunks */ |
999f0b9c | 45 | }; |
d321ceac | 46 | |
6b803e5a | 47 | #include "xfs_log_recover.h" |
d321ceac NS |
48 | |
49 | /* | |
50 | * macros mapping kernel code to user code | |
b626fb59 DC |
51 | * |
52 | * XXX: this is duplicated stuff - should be shared with libxfs. | |
d321ceac | 53 | */ |
93d9f139 | 54 | #ifndef EFSCORRUPTED |
dfc130f3 | 55 | #define EFSCORRUPTED 990 |
93d9f139 | 56 | #endif |
4ca431fc | 57 | #define STATIC static |
4ca431fc | 58 | #define XFS_ERROR(e) (e) |
dc0bd4a0 | 59 | #ifdef DEBUG |
60 | #define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e) | |
61 | #else | |
4ca431fc | 62 | #define XFS_ERROR_REPORT(e,l,mp) ((void) 0) |
dc0bd4a0 | 63 | #endif |
4ca431fc | 64 | #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0) |
46eca962 | 65 | #define XFS_MOUNT_WAS_CLEAN 0x1 |
4ca431fc | 66 | #define unlikely(x) (x) |
b626fb59 DC |
67 | #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) |
68 | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) | |
69 | #define xfs_hex_dump(d,n) ((void) 0) | |
70 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | |
71 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | |
72 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | |
d321ceac | 73 | |
1552a820 NS |
74 | extern void xlog_warn(char *fmt,...); |
75 | extern void xlog_exit(char *fmt,...); | |
76 | extern void xlog_panic(char *fmt,...); | |
d321ceac | 77 | |
d321ceac | 78 | /* exports */ |
d321ceac | 79 | extern int print_exit; |
873b7c85 GO |
80 | extern int print_skip_uuid; |
81 | extern int print_record_header; | |
d321ceac NS |
82 | |
83 | /* libxfs parameters */ | |
84 | extern libxfs_init_t x; | |
85 | ||
7ac353a9 | 86 | |
0ab627db BF |
87 | extern int xlog_is_dirty(struct xfs_mount *, struct xlog *, libxfs_init_t *, |
88 | int); | |
999f0b9c | 89 | extern struct xfs_buf *xlog_get_bp(struct xlog *, int); |
5e656dbb | 90 | extern void xlog_put_bp(struct xfs_buf *); |
999f0b9c | 91 | extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks, |
d60ba955 | 92 | xfs_buf_t *bp, char **offset); |
999f0b9c DC |
93 | extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no, |
94 | int nbblks, xfs_buf_t *bp); | |
5e656dbb | 95 | |
999f0b9c DC |
96 | extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no); |
97 | extern int xlog_find_cycle_start(struct xlog *log, xfs_buf_t *bp, | |
f8149110 | 98 | xfs_daddr_t first_blk, xfs_daddr_t *last_blk, |
5e656dbb | 99 | uint cycle); |
999f0b9c | 100 | extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk, |
5e656dbb BN |
101 | xfs_daddr_t *tail_blk); |
102 | ||
999f0b9c DC |
103 | extern int xlog_test_footer(struct xlog *log); |
104 | extern int xlog_recover(struct xlog *log, int readonly); | |
d60ba955 | 105 | extern void xlog_recover_print_data(char *p, int len); |
5e656dbb BN |
106 | extern void xlog_recover_print_logitem(xlog_recover_item_t *item); |
107 | extern void xlog_recover_print_trans_head(xlog_recover_t *tr); | |
999f0b9c | 108 | extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_blk); |
d321ceac | 109 | |
d321ceac | 110 | /* for transactional view */ |
5e656dbb BN |
111 | extern void xlog_recover_print_trans_head(xlog_recover_t *tr); |
112 | extern void xlog_recover_print_trans(xlog_recover_t *trans, | |
c40bdaa2 | 113 | struct list_head *itemq, int print); |
999f0b9c | 114 | extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk, |
5e656dbb | 115 | xfs_daddr_t tail_blk, int pass); |
999f0b9c | 116 | extern int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *trans, |
5e656dbb | 117 | int pass); |
f8149110 | 118 | extern int xlog_header_check_recover(xfs_mount_t *mp, |
5e656dbb BN |
119 | xlog_rec_header_t *head); |
120 | extern int xlog_header_check_mount(xfs_mount_t *mp, | |
121 | xlog_rec_header_t *head); | |
d321ceac | 122 | |
c40bdaa2 DC |
123 | #define xlog_assign_atomic_lsn(l,a,b) ((void) 0) |
124 | #define xlog_assign_grant_head(l,a,b) ((void) 0) | |
d321ceac | 125 | #endif /* LIBXLOG_H */ |