]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/libxlog.h
libxfs: refactor manage_zones()
[thirdparty/xfsprogs-dev.git] / include / libxlog.h
CommitLineData
959ef981 1// SPDX-License-Identifier: GPL-2.0
d321ceac 2/*
f302e9e4 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.All Rights Reserved.
d321ceac
NS
4 */
5#ifndef LIBXLOG_H
6#define LIBXLOG_H
7
d321ceac
NS
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 */
999f0b9c 13struct xlog {
d321ceac
NS
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 */
75c8b434 17 struct xfs_buftarg *l_dev; /* dev_t of log */
d321ceac 18 xfs_daddr_t l_logBBstart; /* start block of log */
d321ceac
NS
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 */
c40bdaa2
DC
27 atomic64_t l_grant_reserve_head;
28 atomic64_t l_grant_write_head;
a562a63b 29 uint l_sectbb_log; /* log2 of sector size in bbs */
2aa2e7b9
BN
30 uint l_sectbb_mask; /* sector size (in BBs)
31 * alignment mask */
c40bdaa2 32 int l_sectBBsize; /* size of log sector in 512 byte chunks */
999f0b9c 33};
d321ceac 34
6b803e5a 35#include "xfs_log_recover.h"
d321ceac
NS
36
37/*
38 * macros mapping kernel code to user code
b626fb59
DC
39 *
40 * XXX: this is duplicated stuff - should be shared with libxfs.
d321ceac 41 */
93d9f139 42#ifndef EFSCORRUPTED
dfc130f3 43#define EFSCORRUPTED 990
93d9f139 44#endif
4ca431fc 45#define STATIC static
4ca431fc 46#define XFS_ERROR(e) (e)
dc0bd4a0 47#ifdef DEBUG
48#define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e)
49#else
4ca431fc 50#define XFS_ERROR_REPORT(e,l,mp) ((void) 0)
dc0bd4a0 51#endif
4ca431fc 52#define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0)
46eca962 53#define XFS_MOUNT_WAS_CLEAN 0x1
4ca431fc 54#define unlikely(x) (x)
b626fb59
DC
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))
d321ceac 61
1552a820
NS
62extern void xlog_warn(char *fmt,...);
63extern void xlog_exit(char *fmt,...);
64extern void xlog_panic(char *fmt,...);
d321ceac 65
d321ceac 66/* exports */
d321ceac 67extern int print_exit;
873b7c85
GO
68extern int print_skip_uuid;
69extern int print_record_header;
d321ceac
NS
70
71/* libxfs parameters */
72extern libxfs_init_t x;
73
7ac353a9 74
0ab627db
BF
75extern int xlog_is_dirty(struct xfs_mount *, struct xlog *, libxfs_init_t *,
76 int);
999f0b9c 77extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
5e656dbb 78extern void xlog_put_bp(struct xfs_buf *);
999f0b9c 79extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
d60ba955 80 xfs_buf_t *bp, char **offset);
999f0b9c
DC
81extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
82 int nbblks, xfs_buf_t *bp);
5e656dbb 83
999f0b9c
DC
84extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no);
85extern int xlog_find_cycle_start(struct xlog *log, xfs_buf_t *bp,
f8149110 86 xfs_daddr_t first_blk, xfs_daddr_t *last_blk,
5e656dbb 87 uint cycle);
999f0b9c 88extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk,
5e656dbb
BN
89 xfs_daddr_t *tail_blk);
90
999f0b9c 91extern int xlog_recover(struct xlog *log, int readonly);
d60ba955 92extern void xlog_recover_print_data(char *p, int len);
5e656dbb
BN
93extern void xlog_recover_print_logitem(xlog_recover_item_t *item);
94extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
999f0b9c 95extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_blk);
d321ceac 96
d321ceac 97/* for transactional view */
5e656dbb
BN
98extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
99extern void xlog_recover_print_trans(xlog_recover_t *trans,
c40bdaa2 100 struct list_head *itemq, int print);
999f0b9c 101extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk,
5e656dbb 102 xfs_daddr_t tail_blk, int pass);
999f0b9c 103extern int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *trans,
5e656dbb 104 int pass);
f8149110 105extern int xlog_header_check_recover(xfs_mount_t *mp,
5e656dbb
BN
106 xlog_rec_header_t *head);
107extern int xlog_header_check_mount(xfs_mount_t *mp,
108 xlog_rec_header_t *head);
d321ceac 109
c40bdaa2
DC
110#define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
111#define xlog_assign_grant_head(l,a,b) ((void) 0)
d321ceac 112#endif /* LIBXLOG_H */