summaryrefslogtreecommitdiff
path: root/src/extent_db.h
blob: 3e0d83694bd8d76c4a51478522354fe5364e3af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***************************************************************************
 *   Copyright (C) 2011 by Roberto Maar  				   *
 *   robi@users.berlios.de  						   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
// The Magic functions for ext4 need a small stack to the cache found extents
// Extent_db.h contains the header for it.

#ifndef EXTENT_DB_H
#define EXTENT_DB_H

/* ext3/4 libraries */
#include <ext2fs/ext2fs.h>

struct extent_area {
	blk_t		blocknr;
	__u16		depth;
	blk_t		l_start;
	blk_t		l_end;
	blk_t		start_b;
	blk_t		end_b;
	__u16		len;
	__u64		size;
	__u32		b_count;
};



struct extent_db_item {
	struct extent_db_item		*next;
	struct extent_area		*entry;
	struct extent_db_item		*last;
	
};


struct extent_db_t {
	struct extent_db_item		*next;
	__u32				count;
	__u16				max_depth;
	ext2fs_block_bitmap		d_bmap;
	
};
	
	

struct extent_area* new_extent_area();
struct extent_db_t* extent_db_init(ext2fs_block_bitmap);
int extent_db_add (struct extent_db_t* db, struct extent_area*, int);
int extent_db_del(struct extent_db_t* ,blk_t);
void extent_db_clear(struct extent_db_t*);
__u32 extentd_db_find( struct extent_db_t*, __u32, struct extent_area*);




#endif