Home | History | Annotate | Download | only in ext2fs
      1 /*
      2  * ext2fsP.h --- private header file for ext2 library
      3  *
      4  * Copyright (C) 1997 Theodore Ts'o.
      5  *
      6  * %Begin-Header%
      7  * This file may be redistributed under the terms of the GNU Library
      8  * General Public License, version 2.
      9  * %End-Header%
     10  */
     11 
     12 #include "ext2fs.h"
     13 
     14 #define EXT2FS_MAX_NESTED_LINKS  8
     15 
     16 /*
     17  * Badblocks list
     18  */
     19 struct ext2_struct_u32_list {
     20 	int	magic;
     21 	int	num;
     22 	int	size;
     23 	__u32	*list;
     24 	int	badblocks_flags;
     25 };
     26 
     27 struct ext2_struct_u32_iterate {
     28 	int			magic;
     29 	ext2_u32_list		bb;
     30 	int			ptr;
     31 };
     32 
     33 
     34 /*
     35  * Directory block iterator definition
     36  */
     37 struct ext2_struct_dblist {
     38 	int			magic;
     39 	ext2_filsys		fs;
     40 	unsigned long long	size;
     41 	unsigned long long	count;
     42 	int			sorted;
     43 	struct ext2_db_entry2 *	list;
     44 };
     45 
     46 /*
     47  * For directory iterators
     48  */
     49 struct dir_context {
     50 	ext2_ino_t		dir;
     51 	int		flags;
     52 	char		*buf;
     53 	int (*func)(ext2_ino_t	dir,
     54 		    int	entry,
     55 		    struct ext2_dir_entry *dirent,
     56 		    int	offset,
     57 		    int	blocksize,
     58 		    char	*buf,
     59 		    void	*priv_data);
     60 	void		*priv_data;
     61 	errcode_t	errcode;
     62 };
     63 
     64 /*
     65  * Inode cache structure
     66  */
     67 struct ext2_inode_cache {
     68 	void *				buffer;
     69 	blk64_t				buffer_blk;
     70 	int				cache_last;
     71 	int				cache_size;
     72 	int				refcount;
     73 	struct ext2_inode_cache_ent	*cache;
     74 };
     75 
     76 struct ext2_inode_cache_ent {
     77 	ext2_ino_t		ino;
     78 	struct ext2_inode	inode;
     79 };
     80 
     81 /* Function prototypes */
     82 
     83 extern int ext2fs_process_dir_block(ext2_filsys  	fs,
     84 				    blk64_t		*blocknr,
     85 				    e2_blkcnt_t		blockcnt,
     86 				    blk64_t		ref_block,
     87 				    int			ref_offset,
     88 				    void		*priv_data);
     89 
     90 /* Generic numeric progress meter */
     91 
     92 struct ext2fs_numeric_progress_struct {
     93 	__u64		max;
     94 	int		log_max;
     95 	int		skip_progress;
     96 };
     97 
     98 extern void ext2fs_numeric_progress_init(ext2_filsys fs,
     99 					 struct ext2fs_numeric_progress_struct * progress,
    100 					 const char *label, __u64 max);
    101 extern void ext2fs_numeric_progress_update(ext2_filsys fs,
    102 					   struct ext2fs_numeric_progress_struct * progress,
    103 					   __u64 val);
    104 extern void ext2fs_numeric_progress_close(ext2_filsys fs,
    105 					  struct ext2fs_numeric_progress_struct * progress,
    106 					  const char *message);
    107 
    108 /*
    109  * 64-bit bitmap support
    110  */
    111 
    112 extern errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
    113 					   int type, __u64 start, __u64 end,
    114 					   __u64 real_end,
    115 					   const char * description,
    116 					   ext2fs_generic_bitmap *bmap);
    117 
    118 extern void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap);
    119 
    120 extern errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
    121 					  ext2fs_generic_bitmap *dest);
    122 
    123 extern errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
    124 					    __u64 new_end,
    125 					    __u64 new_real_end);
    126 extern errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
    127 					       errcode_t neq,
    128 					       __u64 end, __u64 *oend);
    129 extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
    130 				    __u64 arg);
    131 extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
    132 				      __u64 arg);
    133 extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
    134 				    __u64 arg);
    135 extern errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bitmap,
    136 					       __u64 start, unsigned int num,
    137 					       void *in);
    138 extern errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bitmap,
    139 					       __u64 start, unsigned int num,
    140 					       void *out);
    141 extern void ext2fs_warn_bitmap32(ext2fs_generic_bitmap bitmap,const char *func);
    142 
    143 extern int ext2fs_mem_is_zero(const char *mem, size_t len);
    144 
    145 extern int ext2fs_file_block_offset_too_big(ext2_filsys fs,
    146 					    struct ext2_inode *inode,
    147 					    blk64_t offset);
    148