]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/libxlog.h
xfsprogs: remove xfs_caddr_t
[thirdparty/xfsprogs-dev.git] / include / libxlog.h
CommitLineData
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 25struct 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
897853d5 47#include "xfs/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
74extern void xlog_warn(char *fmt,...);
75extern void xlog_exit(char *fmt,...);
76extern void xlog_panic(char *fmt,...);
d321ceac 77
d321ceac 78/* exports */
d321ceac 79extern int print_exit;
873b7c85
GO
80extern int print_skip_uuid;
81extern int print_record_header;
d321ceac
NS
82
83/* libxfs parameters */
84extern libxfs_init_t x;
85
7ac353a9
ES
86
87extern int xlog_is_dirty(xfs_mount_t *mp, libxfs_init_t *x, int verbose);
999f0b9c 88extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
5e656dbb 89extern void xlog_put_bp(struct xfs_buf *);
999f0b9c 90extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
d60ba955 91 xfs_buf_t *bp, char **offset);
999f0b9c
DC
92extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
93 int nbblks, xfs_buf_t *bp);
5e656dbb 94
999f0b9c
DC
95extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no);
96extern int xlog_find_cycle_start(struct xlog *log, xfs_buf_t *bp,
5e656dbb
BN
97 xfs_daddr_t first_blk, xfs_daddr_t *last_blk,
98 uint cycle);
999f0b9c 99extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk,
5e656dbb
BN
100 xfs_daddr_t *tail_blk);
101
999f0b9c
DC
102extern int xlog_test_footer(struct xlog *log);
103extern int xlog_recover(struct xlog *log, int readonly);
d60ba955 104extern void xlog_recover_print_data(char *p, int len);
5e656dbb
BN
105extern void xlog_recover_print_logitem(xlog_recover_item_t *item);
106extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
999f0b9c 107extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_blk);
d321ceac 108
d321ceac 109/* for transactional view */
5e656dbb
BN
110extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
111extern void xlog_recover_print_trans(xlog_recover_t *trans,
c40bdaa2 112 struct list_head *itemq, int print);
999f0b9c 113extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk,
5e656dbb 114 xfs_daddr_t tail_blk, int pass);
999f0b9c 115extern int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *trans,
5e656dbb
BN
116 int pass);
117extern int xlog_header_check_recover(xfs_mount_t *mp,
118 xlog_rec_header_t *head);
119extern int xlog_header_check_mount(xfs_mount_t *mp,
120 xlog_rec_header_t *head);
d321ceac 121
c40bdaa2
DC
122#define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
123#define xlog_assign_grant_head(l,a,b) ((void) 0)
d321ceac 124#endif /* LIBXLOG_H */