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:
Davidlohr Bueso 2010-10-07 10:48:28 -04:00 committed by Karel Zak
parent aadd32ea8e
commit 4f1509b969
5 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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:";

View File

@ -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);

View File

@ -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;
}
}
}
}