]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/libxlog.h
xfsprogs: Release v6.7.0
[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 {
7448af58
DW
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 */
d321ceac 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 70
c42edb2e
CH
71void xlog_init(struct xfs_mount *mp, struct xlog *log);
72int xlog_is_dirty(struct xfs_mount *mp, struct xlog *log);
7ac353a9 73
999f0b9c 74extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
999f0b9c 75extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
167137fe 76 struct xfs_buf *bp, char **offset);
999f0b9c 77extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
167137fe 78 int nbblks, struct xfs_buf *bp);
5e656dbb 79
999f0b9c 80extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no);
167137fe 81extern int xlog_find_cycle_start(struct xlog *log, struct xfs_buf *bp,
f8149110 82 xfs_daddr_t first_blk, xfs_daddr_t *last_blk,
5e656dbb 83 uint cycle);
999f0b9c 84extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk,
5e656dbb
BN
85 xfs_daddr_t *tail_blk);
86
999f0b9c 87extern int xlog_recover(struct xlog *log, int readonly);
d60ba955 88extern void xlog_recover_print_data(char *p, int len);
3d16b59a 89extern void xlog_recover_print_logitem(struct xlog_recover_item *item);
19879397 90extern void xlog_recover_print_trans_head(struct xlog_recover *tr);
999f0b9c 91extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_blk);
d321ceac 92
d321ceac 93/* for transactional view */
19879397
ES
94extern void xlog_recover_print_trans_head(struct xlog_recover *tr);
95extern void xlog_recover_print_trans(struct xlog_recover *trans,
c40bdaa2 96 struct list_head *itemq, int print);
999f0b9c 97extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk,
5e656dbb 98 xfs_daddr_t tail_blk, int pass);
19879397 99extern int xlog_recover_do_trans(struct xlog *log, struct xlog_recover *trans,
5e656dbb 100 int pass);
f8149110 101extern int xlog_header_check_recover(xfs_mount_t *mp,
5e656dbb
BN
102 xlog_rec_header_t *head);
103extern int xlog_header_check_mount(xfs_mount_t *mp,
104 xlog_rec_header_t *head);
d321ceac 105
c40bdaa2
DC
106#define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
107#define xlog_assign_grant_head(l,a,b) ((void) 0)
d321ceac 108#endif /* LIBXLOG_H */