Blame gfs2/fsck/metawalk.h

Packit 6ef888
#ifndef _METAWALK_H
Packit 6ef888
#define _METAWALK_H
Packit 6ef888
Packit 6ef888
#define DIR_LINEAR 1
Packit 6ef888
#define DIR_EXHASH 2
Packit 6ef888
Packit 6ef888
#include "util.h"
Packit 6ef888
Packit 6ef888
struct metawalk_fxns;
Packit 6ef888
Packit 6ef888
extern int check_inode_eattr(struct gfs2_inode *ip,
Packit 6ef888
			     struct metawalk_fxns *pass);
Packit 6ef888
extern int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass);
Packit 6ef888
extern int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass);
Packit 6ef888
extern int check_dir(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
Packit 6ef888
		     struct metawalk_fxns *pass);
Packit 6ef888
extern int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
Packit 6ef888
			    struct metawalk_fxns *pass);
Packit 6ef888
extern int check_leaf(struct gfs2_inode *ip, int lindex,
Packit 6ef888
		      struct metawalk_fxns *pass, uint64_t *leaf_no,
Packit 6ef888
		      struct gfs2_leaf *leaf, int *ref_count);
Packit 6ef888
extern int _fsck_bitmap_set(struct gfs2_inode *ip, uint64_t bblock,
Packit 6ef888
			    const char *btype, int mark, int error_on_dinode,
Packit 6ef888
			    const char *caller, int line);
Packit 6ef888
extern int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
Packit 6ef888
			      uint64_t blk, int error_on_dinode,
Packit 6ef888
			      int new_state);
Packit 6ef888
extern struct duptree *dupfind(uint64_t block);
Packit 6ef888
extern struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp,
Packit 6ef888
					    uint64_t block);
Packit 6ef888
Packit 6ef888
#define is_duplicate(dblock) ((dupfind(dblock)) ? 1 : 0)
Packit 6ef888
Packit 6ef888
#define fsck_bitmap_set(ip, b, bt, m) \
Packit 6ef888
	_fsck_bitmap_set(ip, b, bt, m, 0, __FUNCTION__, __LINE__)
Packit 6ef888
#define fsck_bitmap_set_noino(ip, b, bt, m) \
Packit 6ef888
	_fsck_bitmap_set(ip, b, bt, m, 1, __FUNCTION__, __LINE__)
Packit 6ef888
enum meta_check_rc {
Packit 6ef888
	meta_error = -1,
Packit 6ef888
	meta_is_good = 0,
Packit 6ef888
	meta_skip_further = 1,
Packit 6ef888
};
Packit 6ef888
Packit 6ef888
/* metawalk_fxns: function pointers to check various parts of the fs
Packit 6ef888
 *
Packit 6ef888
 * The functions should return -1 on fatal errors, 1 if the block
Packit 6ef888
 * should be skipped, and 0 on success
Packit 6ef888
 *
Packit 6ef888
 * private: Data that should be passed to the fxns
Packit 6ef888
 * check_leaf:
Packit 6ef888
 * check_metalist:
Packit 6ef888
 * check_data:
Packit 6ef888
 * check_eattr_indir:
Packit 6ef888
 * check_eattr_leaf:
Packit 6ef888
 * check_dentry:
Packit 6ef888
 * check_eattr_entry:
Packit 6ef888
 * check_eattr_extentry:
Packit 6ef888
 */
Packit 6ef888
struct metawalk_fxns {
Packit 6ef888
	void *private;
Packit 6ef888
	int invalid_meta_is_fatal;
Packit 6ef888
	int readahead;
Packit 6ef888
	int (*check_leaf_depth) (struct gfs2_inode *ip, uint64_t leaf_no,
Packit 6ef888
				 int ref_count, struct gfs2_buffer_head *lbh);
Packit 6ef888
	int (*check_leaf) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
			   void *private);
Packit 6ef888
	/* parameters to the check_metalist sub-functions:
Packit 6ef888
	   ip: incore inode pointer
Packit 6ef888
	   block: block number of the metadata block to be checked
Packit 6ef888
	   bh: buffer_head to be returned
Packit 6ef888
	   h: height
Packit 6ef888
	   is_valid: returned as 1 if the metadata block is valid and should
Packit 6ef888
	             be added to the metadata list for further processing.
Packit 6ef888
	   was_duplicate: returns as 1 if the metadata block was determined
Packit 6ef888
	             to be a duplicate reference, in which case we want to
Packit 6ef888
		     skip adding it to the metadata list.
Packit 6ef888
	   private: Pointer to pass-specific data
Packit 6ef888
	   returns: 0 - everything is good, but there may be duplicates
Packit 6ef888
	            1 - skip further processing
Packit 6ef888
	*/
Packit 6ef888
	int (*check_metalist) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
			       struct gfs2_buffer_head **bh, int h,
Packit 6ef888
			       int *is_valid, int *was_duplicate,
Packit 6ef888
			       void *private);
Packit 6ef888
	int (*check_data) (struct gfs2_inode *ip, uint64_t metablock,
Packit 6ef888
			   uint64_t block, void *private,
Packit 6ef888
			   struct gfs2_buffer_head *bh, uint64_t *ptr);
Packit 6ef888
	int (*check_eattr_indir) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
				  uint64_t parent,
Packit 6ef888
				  struct gfs2_buffer_head **bh, void *private);
Packit 6ef888
	int (*check_eattr_leaf) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
				 uint64_t parent, struct gfs2_buffer_head **bh,
Packit 6ef888
				 void *private);
Packit 6ef888
	int (*check_dentry) (struct gfs2_inode *ip, struct gfs2_dirent *de,
Packit 6ef888
			     struct gfs2_dirent *prev,
Packit 6ef888
			     struct gfs2_buffer_head *bh,
Packit 6ef888
			     char *filename, uint32_t *count,
Packit 6ef888
			     int *lindex, void *private);
Packit 6ef888
	int (*check_eattr_entry) (struct gfs2_inode *ip,
Packit 6ef888
				  struct gfs2_buffer_head *leaf_bh,
Packit 6ef888
				  struct gfs2_ea_header *ea_hdr,
Packit 6ef888
				  struct gfs2_ea_header *ea_hdr_prev,
Packit 6ef888
				  void *private);
Packit 6ef888
	int (*check_eattr_extentry) (struct gfs2_inode *ip, int i,
Packit 6ef888
				     uint64_t *ea_data_ptr,
Packit 6ef888
				     struct gfs2_buffer_head *leaf_bh,
Packit 6ef888
				     uint32_t tot_ealen,
Packit 6ef888
				     struct gfs2_ea_header *ea_hdr,
Packit 6ef888
				     struct gfs2_ea_header *ea_hdr_prev,
Packit 6ef888
				     void *private);
Packit 6ef888
	int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
Packit 6ef888
				   int leaf_pointer_errors, void *private);
Packit 6ef888
	void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
Packit 6ef888
	int (*check_hash_tbl) (struct gfs2_inode *ip, uint64_t *tbl,
Packit 6ef888
			       unsigned hsize, void *private);
Packit 6ef888
	int (*repair_leaf) (struct gfs2_inode *ip, uint64_t *leaf_no,
Packit 6ef888
			    int lindex, int ref_count, const char *msg);
Packit 6ef888
	int (*undo_check_meta) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
				int h, void *private);
Packit 6ef888
	int (*undo_check_data) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
				void *private);
Packit 6ef888
	int (*delete_block) (struct gfs2_inode *ip, uint64_t block,
Packit 6ef888
			     struct gfs2_buffer_head **bh, const char *btype,
Packit 6ef888
			     void *private);
Packit 6ef888
};
Packit 6ef888
Packit 6ef888
#endif /* _METAWALK_H */