partx: integrate support for mac and sun partitions, based on kpartx.
[kzak@redhat.com: - remove unnecessary members from struct slice, - fix gcc warnings] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
aadd32ea8e
commit
4f1509b969
|
@ -3,7 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am
|
|||
if BUILD_PARTX
|
||||
|
||||
usrsbin_exec_PROGRAMS = addpart delpart partx
|
||||
partx_SOURCES = bsd.c dos.c partx.c solaris.c unixware.c gpt.c crc32.c \
|
||||
partx_SOURCES = bsd.c dos.c partx.c solaris.c unixware.c sun.c mac.c gpt.c crc32.c \
|
||||
efi.h gpt.h crc32.h partx.h dos.h $(top_srcdir)/lib/blkdev.c
|
||||
|
||||
if LINUX
|
||||
|
|
|
@ -36,7 +36,7 @@ read_mac_pt(int fd, struct slice all, struct slice *sp, int ns) {
|
|||
struct mac_driver_desc *md;
|
||||
struct mac_partition *part;
|
||||
unsigned secsize;
|
||||
char *data;
|
||||
unsigned char *data;
|
||||
int blk, blocks_in_map;
|
||||
int n = 0;
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@ initpts(void)
|
|||
addpts("bsd", read_bsd_pt);
|
||||
addpts("solaris", read_solaris_pt);
|
||||
addpts("unixware", read_unixware_pt);
|
||||
addpts("sun", read_sun_pt);
|
||||
addpts("mac", read_mac_pt);
|
||||
}
|
||||
|
||||
static char short_opts[] = "ladgvn:t:";
|
||||
|
|
|
@ -20,6 +20,7 @@ struct slice {
|
|||
typedef int (ptreader)(int fd, struct slice all, struct slice *sp, int ns);
|
||||
|
||||
extern ptreader read_dos_pt, read_bsd_pt, read_solaris_pt, read_unixware_pt, read_gpt_pt;
|
||||
extern ptreader read_sun_pt, read_mac_pt;
|
||||
|
||||
unsigned char *getblock(int fd, unsigned int secnr);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ read_sun_pt(int fd, struct slice all, struct slice *sp, int ns) {
|
|||
struct sun_raw_part *s;
|
||||
unsigned int offset = all.start, end;
|
||||
int i, j, n;
|
||||
char *bp;
|
||||
unsigned char *bp;
|
||||
|
||||
bp = getblock(fd, offset);
|
||||
if (bp == NULL)
|
||||
|
@ -123,10 +123,6 @@ read_sun_pt(int fd, struct slice all, struct slice *sp, int ns) {
|
|||
"sun_disklabel: slice %d overlaps with %d\n", i , j);
|
||||
sp[i].size = 0;
|
||||
}
|
||||
} else {
|
||||
if (end <= sp[j].start + sp[j].size) {
|
||||
sp[i].container = j + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue