1
#ifndef PARTX_H_INCLUDED
2
#define PARTX_H_INCLUDED
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
14
/* units: 512 byte sectors */
20
typedef int (ptreader)(int fd, struct slice all, struct slice *sp, int ns);
22
extern ptreader read_dos_pt, read_bsd_pt, read_solaris_pt, read_unixware_pt, read_gpt_pt;
24
unsigned char *getblock(int fd, unsigned int secnr);
27
four2int(unsigned char *p) {
28
return p[0] + (p[1]<<8) + (p[2]<<16) + (p[3]<<24);
31
#endif /* PARTX_H_INCLUDED */
1
#ifndef UTIL_LINUX_PARTX_H
2
#define UTIL_LINUX_PARTX_H
5
#include <linux/blkpg.h>
7
static inline int partx_del_partition(int fd, int partno)
9
struct blkpg_ioctl_arg a;
10
struct blkpg_partition p;
17
a.op = BLKPG_DEL_PARTITION;
19
a.datalen = sizeof(p);
22
return ioctl(fd, BLKPG, &a);
25
static inline int partx_add_partition(int fd, int partno,
26
unsigned long start, unsigned long size)
28
struct blkpg_ioctl_arg a;
29
struct blkpg_partition p;
36
a.op = BLKPG_ADD_PARTITION;
38
a.datalen = sizeof(p);
41
return ioctl(fd, BLKPG, &a);
44
#endif /* UTIL_LINUX_PARTX_H */