]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame_incremental - include/libxlog.h
xfsprogs: Release v6.15.0
[thirdparty/xfsprogs-dev.git] / include / libxlog.h
... / ...
CommitLineData
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.All Rights Reserved.
4 */
5#ifndef LIBXLOG_H
6#define LIBXLOG_H
7
8/*
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.
12 */
13struct xlog {
14 atomic64_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */
15 atomic64_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)
31 * alignment mask */
32 int l_sectBBsize; /* size of log sector in 512 byte chunks */
33};
34
35#include "xfs_log_recover.h"
36
37/*
38 * macros mapping kernel code to user code
39 *
40 * XXX: this is duplicated stuff - should be shared with libxfs.
41 */
42#ifndef EFSCORRUPTED
43#define EFSCORRUPTED 990
44#endif
45#define STATIC static
46#define XFS_ERROR(e) (e)
47#ifdef DEBUG
48#define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e)
49#else
50#define XFS_ERROR_REPORT(e,l,mp) ((void) 0)
51#endif
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))
61
62extern void xlog_warn(char *fmt,...);
63extern void xlog_exit(char *fmt,...);
64extern void xlog_panic(char *fmt,...);
65
66/* exports */
67extern int print_exit;
68extern int print_skip_uuid;
69extern int print_record_header;
70
71void xlog_init(struct xfs_mount *mp, struct xlog *log);
72int xlog_is_dirty(struct xfs_mount *mp, struct xlog *log);
73
74extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
75extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
76 struct xfs_buf *bp, char **offset);
77extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
78 int nbblks, struct xfs_buf *bp);
79
80extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no);
81extern int xlog_find_cycle_start(struct xlog *log, struct xfs_buf *bp,
82 xfs_daddr_t first_blk, xfs_daddr_t *last_blk,
83 uint cycle);
84extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk,
85 xfs_daddr_t *tail_blk);
86
87extern int xlog_recover(struct xlog *log, int readonly);
88extern void xlog_recover_print_data(char *p, int len);
89extern void xlog_recover_print_logitem(struct xlog_recover_item *item);
90extern void xlog_recover_print_trans_head(struct xlog_recover *tr);
91extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_blk);
92
93/* for transactional view */
94extern void xlog_recover_print_trans_head(struct xlog_recover *tr);
95extern void xlog_recover_print_trans(struct xlog_recover *trans,
96 struct list_head *itemq, int print);
97extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk,
98 xfs_daddr_t tail_blk, int pass);
99extern int xlog_recover_do_trans(struct xlog *log, struct xlog_recover *trans,
100 int pass);
101extern int xlog_header_check_recover(xfs_mount_t *mp,
102 xlog_rec_header_t *head);
103extern int xlog_header_check_mount(xfs_mount_t *mp,
104 xlog_rec_header_t *head);
105
106#define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
107#define xlog_assign_grant_head(l,a,b) ((void) 0)
108#endif /* LIBXLOG_H */