1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.All Rights Reserved.
9 * define the userlevel xlog_t to be the subset of the kernel's
10 * xlog_t that we actually need to get our work done, avoiding
11 * the need to define any exotic kernel types in userland.
14 xfs_lsn_t l_tail_lsn
; /* lsn of 1st LR w/ unflush buffers */
15 xfs_lsn_t l_last_sync_lsn
;/* lsn of last LR on disk */
16 xfs_mount_t
*l_mp
; /* mount point */
17 struct xfs_buftarg
*l_dev
; /* dev_t of log */
18 xfs_daddr_t l_logBBstart
; /* start block of log */
19 int l_logBBsize
; /* size of log in 512 byte chunks */
20 int l_curr_cycle
; /* Cycle number of log writes */
21 int l_prev_cycle
; /* Cycle # b4 last block increment */
22 int l_curr_block
; /* current logical block of log */
23 int l_prev_block
; /* previous logical block of log */
24 int l_iclog_size
; /* size of log in bytes */
25 int l_iclog_size_log
;/* log power size of log */
26 int l_iclog_bufs
; /* number of iclog buffers */
27 atomic64_t l_grant_reserve_head
;
28 atomic64_t l_grant_write_head
;
29 uint l_sectbb_log
; /* log2 of sector size in bbs */
30 uint l_sectbb_mask
; /* sector size (in BBs)
32 int l_sectBBsize
; /* size of log sector in 512 byte chunks */
35 #include "xfs_log_recover.h"
38 * macros mapping kernel code to user code
40 * XXX: this is duplicated stuff - should be shared with libxfs.
43 #define EFSCORRUPTED 990
46 #define XFS_ERROR(e) (e)
48 #define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e)
50 #define XFS_ERROR_REPORT(e,l,mp) ((void) 0)
52 #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0)
53 #define XFS_MOUNT_WAS_CLEAN 0x1
54 #define unlikely(x) (x)
55 #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args)
56 #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args)
57 #define xfs_hex_dump(d,n) ((void) 0)
58 #define __round_mask(x, y) ((__typeof__(x))((y)-1))
59 #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
60 #define round_down(x, y) ((x) & ~__round_mask(x, y))
62 extern void xlog_warn(char *fmt
,...);
63 extern void xlog_exit(char *fmt
,...);
64 extern void xlog_panic(char *fmt
,...);
67 extern int print_exit
;
68 extern int print_skip_uuid
;
69 extern int print_record_header
;
71 /* libxfs parameters */
72 extern libxfs_init_t x
;
75 extern int xlog_is_dirty(struct xfs_mount
*, struct xlog
*, libxfs_init_t
*,
77 extern struct xfs_buf
*xlog_get_bp(struct xlog
*, int);
78 extern void xlog_put_bp(struct xfs_buf
*);
79 extern int xlog_bread(struct xlog
*log
, xfs_daddr_t blk_no
, int nbblks
,
80 xfs_buf_t
*bp
, char **offset
);
81 extern int xlog_bread_noalign(struct xlog
*log
, xfs_daddr_t blk_no
,
82 int nbblks
, xfs_buf_t
*bp
);
84 extern int xlog_find_zeroed(struct xlog
*log
, xfs_daddr_t
*blk_no
);
85 extern int xlog_find_cycle_start(struct xlog
*log
, xfs_buf_t
*bp
,
86 xfs_daddr_t first_blk
, xfs_daddr_t
*last_blk
,
88 extern int xlog_find_tail(struct xlog
*log
, xfs_daddr_t
*head_blk
,
89 xfs_daddr_t
*tail_blk
);
91 extern int xlog_test_footer(struct xlog
*log
);
92 extern int xlog_recover(struct xlog
*log
, int readonly
);
93 extern void xlog_recover_print_data(char *p
, int len
);
94 extern void xlog_recover_print_logitem(xlog_recover_item_t
*item
);
95 extern void xlog_recover_print_trans_head(xlog_recover_t
*tr
);
96 extern int xlog_print_find_oldest(struct xlog
*log
, xfs_daddr_t
*last_blk
);
98 /* for transactional view */
99 extern void xlog_recover_print_trans_head(xlog_recover_t
*tr
);
100 extern void xlog_recover_print_trans(xlog_recover_t
*trans
,
101 struct list_head
*itemq
, int print
);
102 extern int xlog_do_recovery_pass(struct xlog
*log
, xfs_daddr_t head_blk
,
103 xfs_daddr_t tail_blk
, int pass
);
104 extern int xlog_recover_do_trans(struct xlog
*log
, xlog_recover_t
*trans
,
106 extern int xlog_header_check_recover(xfs_mount_t
*mp
,
107 xlog_rec_header_t
*head
);
108 extern int xlog_header_check_mount(xfs_mount_t
*mp
,
109 xlog_rec_header_t
*head
);
111 #define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
112 #define xlog_assign_grant_head(l,a,b) ((void) 0)
113 #endif /* LIBXLOG_H */