Upload Tizen:Base source
[framework/base/util-linux-ng.git] / partx / partx.h
1 #ifndef PARTX_H_INCLUDED
2 #define PARTX_H_INCLUDED
3
4 /*
5  * For each partition type there is a routine that takes
6  * a block device and a range, and returns the list of
7  * slices found there in the supplied array SP that can
8  * hold NS entries. The return value is the number of
9  * entries stored, or -1 if the appropriate type is not
10  * present.
11  */
12
13
14 /* units: 512 byte sectors */
15 struct slice {
16         unsigned int start;
17         unsigned int size;
18 };
19
20 typedef int (ptreader)(int fd, struct slice all, struct slice *sp, int ns);
21
22 extern ptreader read_dos_pt, read_bsd_pt, read_solaris_pt, read_unixware_pt, read_gpt_pt;
23
24 unsigned char *getblock(int fd, unsigned int secnr);
25
26 static inline int
27 four2int(unsigned char *p) {
28         return p[0] + (p[1]<<8) + (p[2]<<16) + (p[3]<<24);
29 }
30
31 #endif /* PARTX_H_INCLUDED */