From: Davidlohr Bueso Date: Thu, 7 Oct 2010 14:48:28 +0000 (-0400) Subject: partx: integrate support for mac and sun partitions, based on kpartx. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f1509b96935ee61c618b5b26a0ed5defa74b204;p=util-linux 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 Signed-off-by: Karel Zak --- diff --git a/partx/Makefile.am b/partx/Makefile.am index 36163aa9..a26963ed 100644 --- a/partx/Makefile.am +++ b/partx/Makefile.am @@ -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 diff --git a/partx/mac.c b/partx/mac.c index ed4ed9b9..a5677f01 100644 --- a/partx/mac.c +++ b/partx/mac.c @@ -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; diff --git a/partx/partx.c b/partx/partx.c index 14d2609f..aa5a2ad8 100644 --- a/partx/partx.c +++ b/partx/partx.c @@ -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:"; diff --git a/partx/partx.h b/partx/partx.h index d98d77a4..8702f259 100644 --- a/partx/partx.h +++ b/partx/partx.h @@ -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); diff --git a/partx/sun.c b/partx/sun.c index c8143686..30cbd9fb 100644 --- a/partx/sun.c +++ b/partx/sun.c @@ -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; - } } } }