📄 reiserfs_lib.h
字号:
/* * Copyright 2000-2004 by Hans Reiser, licensing governed by * reiserfsprogs/README */#ifndef REISERFSPROGS_LIB_H#define REISERFSPROGS_LIB_H#define BADBLOCK_DIRID 1#define BADBLOCK_OBJID (__u32)-1typedef struct reiserfs_filsys reiserfs_filsys_t;#include "reiserfs_fs.h"struct _bitmap { unsigned long bm_byte_size; unsigned long bm_bit_size; char * bm_map; unsigned long bm_set_bits; int bm_dirty; /* used for fetched bitmap */};typedef struct _bitmap reiserfs_bitmap_t;typedef __u32 (*hashf_t) (const char *, int);struct reiserfs_filsys { unsigned int fs_blocksize; int fs_format; /* on-disk format version */ hashf_t fs_hash_function; /* pointer to function which is used to sort names in directory. It is set by reiserfs_open if it is set in the super block, otherwise it is set by first is_properly_hashed */ char * fs_file_name; /* file name of underlying device */ int fs_dev; /* descriptor of opened block device file */ struct buffer_head * fs_super_bh; /* buffer containing super block */ struct reiserfs_super_block * fs_ondisk_sb; /* pointer to its b_data */ reiserfs_bitmap_t * fs_bitmap2; /* ondisk bitmap after reiserfs_open_ondisk_bitmap */ /* opened journal fields */ char * fs_j_file_name; /* file name of relocated journal device */ int fs_journal_dev; /* descriptor of opened journal device */ struct buffer_head * fs_jh_bh; /* buffer containing journal header */ /* badblocks */ reiserfs_bitmap_t * fs_badblocks_bm; int fs_dirt; int fs_flags; void * fs_vp; int (*block_allocator) (reiserfs_filsys_t * fs, unsigned long * free_blocknrs, unsigned long start, int amount_needed); int (*block_deallocator) (reiserfs_filsys_t * fs, unsigned long block);};struct _transaction { unsigned long mount_id; unsigned long trans_id; unsigned long desc_blocknr; unsigned long trans_len; unsigned long commit_blocknr; unsigned long next_trans_offset;};typedef struct _transaction reiserfs_trans_t;/* reiserfslib.c */void init_tb_struct (struct tree_balance * tb, reiserfs_filsys_t *, struct path * path, int size);reiserfs_filsys_t * reiserfs_open (char * filename, int flags, int * error, void * vp, int skip_check);reiserfs_filsys_t * reiserfs_create (char * filename, int version, unsigned long block_count, int block_size, int default_journal, int new_format);void reiserfs_flush (reiserfs_filsys_t *);void reiserfs_free (reiserfs_filsys_t *);void reiserfs_close (reiserfs_filsys_t *);void reiserfs_reopen (reiserfs_filsys_t *, int flags);int is_opened_rw (reiserfs_filsys_t * fs);/*void reiserfs_read_bitmap_blocks (reiserfs_filsys_t *);void reiserfs_free_bitmap_blocks (reiserfs_filsys_t *);*/int no_reiserfs_found (reiserfs_filsys_t *);int is_block_count_correct (unsigned long block_of_super_block, unsigned int block_size, unsigned long block_count, unsigned long journal_size);//unsigned long min_block_amount (int block_size, unsigned long journal_size);unsigned long get_size_of_journal_or_reserved_area (struct reiserfs_super_block * sb);int reiserfs_new_blocknrs (reiserfs_filsys_t *, unsigned long * free_blocknrs, unsigned long start, int amount_needed);int reiserfs_free_block (reiserfs_filsys_t *, unsigned long block);int spread_bitmaps (reiserfs_filsys_t *);int filesystem_dirty (reiserfs_filsys_t *);void mark_filesystem_dirty (reiserfs_filsys_t *);void reiserfs_paste_into_item (reiserfs_filsys_t *, struct path * path, const void * body, int size);void reiserfs_insert_item (reiserfs_filsys_t *, struct path * path, struct item_head * ih, const void * body);int reiserfs_locate_entry (reiserfs_filsys_t *, struct key * dir, char * name, struct path * path);int reiserfs_find_entry (reiserfs_filsys_t *, struct key * dir, char * name, unsigned int * min_gen_counter, struct key * key);int reiserfs_add_entry (reiserfs_filsys_t *, struct key * dir, char * name, int name_len, struct key * key, __u16 fsck_need);struct key * uget_lkey (struct path * path);struct key * uget_rkey (struct path * path);int reiserfs_search_by_key_3 (reiserfs_filsys_t *, struct key * key, struct path * path);int reiserfs_search_by_key_4 (reiserfs_filsys_t *, struct key * key, struct path * path);int reiserfs_search_by_entry_key (reiserfs_filsys_t *, struct key * key, struct path * path);int usearch_by_position (reiserfs_filsys_t *, struct key * key, int version, struct path * path);struct key * reiserfs_next_key (struct path * path);void copy_key (void * to, void * from);void copy_short_key (void * to, void * from);void copy_item_head(void * p_v_to, void * p_v_from);int comp_keys (const void * k1, const void * k2);int comp_keys_3 (const void * k1, const void * k2);int comp_short_keys (const void * p_s_key1, const void * p_s_key2);int comp_items (struct item_head * p_s_ih, struct path * p_s_path);__u32 hash_value (hashf_t func, char * name, int namelen);int create_dir_sd (reiserfs_filsys_t * fs, struct path * path, struct key * key, void (*modify_item)(struct item_head *, void *));void make_sure_root_dir_exists (reiserfs_filsys_t * fs, void (*modyfy_item)(struct item_head *, void *), int ih_flags);typedef void (*badblock_func_t) (reiserfs_filsys_t *fs, struct path *badblock_path, void *data);void mark_badblock(reiserfs_filsys_t *fs, struct path *badblock_path, void *data);int create_badblock_bitmap (reiserfs_filsys_t * fs, char * badblocks_file);void add_badblock_list (reiserfs_filsys_t * fs, int no_badblock_in_tree_yet);void badblock_list(reiserfs_filsys_t * fs, badblock_func_t action, void *data);extern struct key root_dir_key;extern struct key parent_root_dir_key;extern struct key lost_found_dir_key;extern __u16 root_dir_format;extern __u16 lost_found_dir_format;/* bitmap.c */int reiserfs_open_ondisk_bitmap (reiserfs_filsys_t *);int reiserfs_create_ondisk_bitmap (reiserfs_filsys_t *);void reiserfs_free_ondisk_bitmap (reiserfs_filsys_t *);void reiserfs_close_ondisk_bitmap (reiserfs_filsys_t *);int reiserfs_flush_to_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t * fs);reiserfs_bitmap_t * reiserfs_create_bitmap (unsigned int bit_count);int reiserfs_expand_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count);void reiserfs_shrink_bitmap (reiserfs_bitmap_t * bm, unsigned int bit_count);void reiserfs_delete_bitmap (reiserfs_bitmap_t * bm);void reiserfs_bitmap_copy (reiserfs_bitmap_t * to, reiserfs_bitmap_t * from);int reiserfs_bitmap_compare (reiserfs_bitmap_t * bm1, reiserfs_bitmap_t * bm2);void reiserfs_bitmap_disjunction (reiserfs_bitmap_t * disk, reiserfs_bitmap_t * cont);void reiserfs_bitmap_delta (reiserfs_bitmap_t * base, reiserfs_bitmap_t * exclude);void reiserfs_bitmap_set_bit (reiserfs_bitmap_t * bm, unsigned int bit_number);void reiserfs_bitmap_clear_bit (reiserfs_bitmap_t * bm, unsigned int bit_number);int reiserfs_bitmap_test_bit (reiserfs_bitmap_t * bm, unsigned int bit_number);int reiserfs_bitmap_find_zero_bit (reiserfs_bitmap_t * bm, unsigned long * start);/*int reiserfs_fetch_ondisk_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *);*//*int reiserfs_flush_bitmap (reiserfs_bitmap_t * bm, reiserfs_filsys_t *);*/void reiserfs_bitmap_zero (reiserfs_bitmap_t * bm);void reiserfs_bitmap_fill (reiserfs_bitmap_t * bm);unsigned int reiserfs_bitmap_ones (reiserfs_bitmap_t * bm);unsigned int reiserfs_bitmap_zeros (reiserfs_bitmap_t * bm);FILE * open_file(char * filename, char * option);void close_file(FILE * fp);void reiserfs_bitmap_save (FILE * fp, reiserfs_bitmap_t * bm);/* this probably should be in fsck */void reiserfs_begin_stage_info_save(FILE * file, unsigned long stage);void reiserfs_end_stage_info_save(FILE * file);int is_stage_magic_correct (FILE * fp);//void reiserfs_stage_info_save(struct fsck_data *, FILE * file);reiserfs_bitmap_t * reiserfs_bitmap_load (FILE * fp);void reiserfs_bitmap_invert (reiserfs_bitmap_t * bm);int reiserfs_remove_entry (reiserfs_filsys_t *, struct key * key);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -