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
13 #define likely(x) __builtin_expect(!!(x), 1)
14 #define unlikely(x) __builtin_expect(!!(x), 0)
16 #define safe_sprintf(var, format, args...) \
17 snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
20 * units: 512 byte sectors
27 typedef int (ptreader)(int fd, struct slice all, struct slice *sp, int ns);
29 extern ptreader read_dos_pt;
30 extern ptreader read_bsd_pt;
31 extern ptreader read_solaris_pt;
32 extern ptreader read_unixware_pt;
33 extern ptreader read_gpt_pt;
35 char *getblock(int fd, unsigned int secnr);
38 four2int(unsigned char *p) {
39 return p[0] + (p[1]<<8) + (p[2]<<16) + (p[3]<<24);
42 #endif /* _KPARTX_H */