From 2cbdb2327c7575282d83e7331eb8e957e72ce394 Mon Sep 17 00:00:00 2001 From: james Date: Sat, 14 Sep 2013 08:54:25 +0000 Subject: add lvm, raid, new ext3 to sync --- src/Makefile.am | 7 +++++-- src/gpt.c | 15 +++++++++++++-- src/gpt.h | 2 ++ src/sync.c | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index d68413b..c234c43 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,9 +5,12 @@ # Copyright (c) 2007 James McKenzie , # All rights reserved. # -# $Id: Makefile.am,v 1.10 2012/09/10 08:28:34 james Exp $ +# $Id: Makefile.am,v 1.11 2013/09/14 08:54:25 james Exp $ # # $Log: Makefile.am,v $ +# Revision 1.11 2013/09/14 08:54:25 james +# add lvm, raid, new ext3 to sync +# # Revision 1.10 2012/09/10 08:28:34 james # *** empty log message *** # @@ -46,7 +49,7 @@ noinst_HEADERS = disk.h gpt.h guid.h project.h prototypes.h bin_PROGRAMS = gpt -SRCS=gpt.c version.c util.c guid.c crc.c header.c disk.c pmbr.c show.c entry.c new.c modify.c sync.c fixup.c dump.c +SRCS=gpt.c version.c util.c guid.c crc.c header.c disk.c pmbr.c show.c entry.c new.c modify.c sync.c fixup.c dump.c set_flag.c gpt_SOURCES = ${SRCS} gpt_LDADD = diff --git a/src/gpt.c b/src/gpt.c index 373ff02..f13047e 100644 --- a/src/gpt.c +++ b/src/gpt.c @@ -6,10 +6,13 @@ * */ -static char rcsid[] = "$Id: gpt.c,v 1.23 2012/09/10 08:28:35 james Exp $"; +static char rcsid[] = "$Id: gpt.c,v 1.24 2013/09/14 08:54:25 james Exp $"; /* * $Log: gpt.c,v $ + * Revision 1.24 2013/09/14 08:54:25 james + * add lvm, raid, new ext3 to sync + * * Revision 1.23 2012/09/10 08:28:35 james * *** empty log message *** * @@ -133,7 +136,7 @@ main (int argc, char *argv[]) fprintf (stderr, "sizeof(off_t)=%d\n", sizeof (off_t)); - while ((c = getopt (argc, argv, "CQqd:hlsef:g:unac")) != EOF) + while ((c = getopt (argc, argv, "CQqd:hlsef:g:unacb:B:")) != EOF) { switch (c) { @@ -184,6 +187,14 @@ main (int argc, char *argv[]) e = entry_read (d, &h.header, n); printf ("%lld\n", e.end); return 0; + case 'b': + n = atoi (optarg); + set_flag (d, n,0); + return 0; + case 'B': + n = atoi (optarg); + set_flag (d, n,1); + return 0; case 'g': h = headers_get (d); n = atoi (optarg); diff --git a/src/gpt.h b/src/gpt.h index 6eac681..25bb9f9 100644 --- a/src/gpt.h +++ b/src/gpt.h @@ -57,6 +57,8 @@ typedef struct #define MBR_PARTITION_TYPE_EFI 0xee #define MBR_PARTITION_TYPE_LINUX 0x83 #define MBR_PARTITION_TYPE_SWAP 0x82 +#define MBR_PARTITION_TYPE_LVM 0x8e +#define MBR_PARTITION_TYPE_RAID 0xfd #define MBR_PARTITION_TYPE_HFS 0xaf #define MBR_PARTITION_TYPE_UNKOWN 0xff #define MBR_PARTITION_BOOTABLE 0x80 diff --git a/src/sync.c b/src/sync.c index e98e4a0..0aee0a6 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1,6 +1,9 @@ #include "project.h" + + + void sync_tables (DISK * d) { @@ -12,6 +15,9 @@ sync_tables (DISK * d) GUID guid_swap = GUID_TYPE_LINUX_SWAP; GUID guid_hfs = GUID_TYPE_APPLE_HFS; GUID guid_efi = GUID_TYPE_SYSTEM; + GUID guid_new_ext3= GUID_TYPE_NEW_LINUX_EXT3; + GUID guid_raid = GUID_TYPE_LINUX_RAID; + GUID guid_lvm = GUID_TYPE_LINUX_LVM; int mbr_entry = 0; int seen_linux = 0; @@ -35,6 +41,18 @@ sync_tables (DISK * d) { type = MBR_PARTITION_TYPE_EFI; } + else if (!guid_cmp (&e.type, &guid_ext3) || !guid_cmp (&e.type, &guid_new_ext3)) + { + type = MBR_PARTITION_TYPE_LINUX; + } + else if (!guid_cmp (&e.type, &guid_raid)) + { + type = MBR_PARTITION_TYPE_RAID; + } + else if (!guid_cmp (&e.type, &guid_lvm)) + { + type = MBR_PARTITION_TYPE_LVM; + } else if (!guid_cmp (&e.type, &guid_ext3)) { type = MBR_PARTITION_TYPE_LINUX; -- cgit v1.2.3