3 * (c) 2008-2009 Laurent Vivier <Laurent@lvivier.info>
5 * This file has been copied from EMILE, http://emile.sf.net
9 #ifndef __EXT2_UTILS_H__
10 #define __EXT2_UTILS_H__
15 /* from linux/stat.h */
17 #define S_IFMT 00170000
18 #define S_IFSOCK 0140000
19 #define S_IFLNK 0120000
20 #define S_IFREG 0100000
21 #define S_IFBLK 0060000
22 #define S_IFDIR 0040000
23 #define S_IFCHR 0020000
24 #define S_IFIFO 0010000
25 #define S_ISUID 0004000
26 #define S_ISGID 0002000
27 #define S_ISVTX 0001000
29 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
30 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
31 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
32 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
33 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
34 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
35 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
39 extern int ext2_probe(int fd
, long long offset
);
40 extern void ext2_get_super(int fd
, struct ext2_super_block
*super
);
41 extern void ext2_read_block(ext2_VOLUME
* volume
, unsigned int fsblock
);
42 extern void ext2_get_group_desc(ext2_VOLUME
* volume
,
43 int group_id
, struct ext2_group_desc
*gdp
);
44 extern int ext2_get_inode(ext2_VOLUME
* volume
,
45 unsigned int ino
, struct ext2_inode
*inode
);
46 extern unsigned int ext2_get_block_addr(ext2_VOLUME
* volume
,
47 struct ext2_inode
*inode
,
48 unsigned int logical
);
49 extern int ext2_read_data(ext2_VOLUME
* volume
, struct ext2_inode
*inode
,
50 off_t offset
, char *buffer
, size_t length
);
51 extern off_t
ext2_dir_entry(ext2_VOLUME
*volume
, struct ext2_inode
*inode
,
52 off_t offset
, struct ext2_dir_entry_2
*entry
);
53 extern unsigned int ext2_seek_name(ext2_VOLUME
*volume
, const char *name
);
54 #endif /* __EXT2_UTILS_H__ */