From 8d3b471145cc61de7ae97bde18230f8cf2d70eb5 Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 19 Aug 2012 10:48:41 +0000 Subject: [PATCH] Added basic implementation of destroying a GPT table: just delete the dummy MBR. Needed to allow InstallAROS etc. to wipe a GPT disk. Also added missing properties. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@45601 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/partition/addbootfilesystem.c | 2 +- rom/partition/findfilesystema.c | 2 +- rom/partition/getfilesystemattrsa.c | 2 +- rom/partition/loadfilesystem.c | 2 +- rom/partition/partitiongpt.c | 10 ++++++++-- rom/partition/partitiongpt.h | 12 +++++++++++- rom/partition/partitionmbr.c | 6 +++--- rom/partition/partitionmbr.h | 6 +++--- 8 files changed, 29 insertions(+), 13 deletions(-) diff --git a/rom/partition/addbootfilesystem.c b/rom/partition/addbootfilesystem.c index 72fdf2fce0..e2df246316 100644 --- a/rom/partition/addbootfilesystem.c +++ b/rom/partition/addbootfilesystem.c @@ -1,6 +1,6 @@ /* Copyright © 2011, The AROS Development Team. All rights reserved. - $Id: $ + $Id$ */ diff --git a/rom/partition/findfilesystema.c b/rom/partition/findfilesystema.c index b8de9f8ffb..709cffc04c 100644 --- a/rom/partition/findfilesystema.c +++ b/rom/partition/findfilesystema.c @@ -1,6 +1,6 @@ /* Copyright © 2011, The AROS Development Team. All rights reserved. - $Id: querypartitionattrs.c 38180 2011-04-12 12:32:14Z sonic $ + $Id$ */ #include "partition_support.h" diff --git a/rom/partition/getfilesystemattrsa.c b/rom/partition/getfilesystemattrsa.c index c6c70acde8..99bc7e4423 100644 --- a/rom/partition/getfilesystemattrsa.c +++ b/rom/partition/getfilesystemattrsa.c @@ -1,6 +1,6 @@ /* Copyright © 2011, The AROS Development Team. All rights reserved. - $Id: getpartitiontableattrs.c 38180 2011-04-12 12:32:14Z sonic $ + $Id$ */ diff --git a/rom/partition/loadfilesystem.c b/rom/partition/loadfilesystem.c index 7233456851..a2e82ea42f 100644 --- a/rom/partition/loadfilesystem.c +++ b/rom/partition/loadfilesystem.c @@ -1,6 +1,6 @@ /* Copyright © 2011, The AROS Development Team. All rights reserved. - $Id: querypartitionattrs.c 38180 2011-04-12 12:32:14Z sonic $ + $Id$ */ #include "partition_support.h" diff --git a/rom/partition/partitiongpt.c b/rom/partition/partitiongpt.c index 11a65cabe0..7b3dbf9dba 100644 --- a/rom/partition/partitiongpt.c +++ b/rom/partition/partitiongpt.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ Desc: GPT partition table handler @@ -648,6 +648,12 @@ static LONG PartitionGPTSetPartitionAttrs(struct Library *PartitionBase, struct return 0; } +static ULONG PartitionGPTDestroyPartitionTable(struct Library *PartitionBase, + struct PartitionHandle *root) +{ + return PartitionMBRDestroyPartitionTable(PartitionBase, root); +} + static const struct PartitionAttribute PartitionGPTPartitionTableAttrs[]= { {PTT_TYPE, PLAM_READ}, @@ -684,6 +690,6 @@ const struct PTFunctionTable PartitionGPT = PartitionGPTSetPartitionAttrs, PartitionGPTPartitionTableAttrs, PartitionGPTPartitionAttrs, - NULL, + PartitionGPTDestroyPartitionTable, NULL }; diff --git a/rom/partition/partitiongpt.h b/rom/partition/partitiongpt.h index d11e5b60b0..ce868e069c 100644 --- a/rom/partition/partitiongpt.h +++ b/rom/partition/partitiongpt.h @@ -1,3 +1,11 @@ +/* + Copyright © 1995-2012, The AROS Development Team. All rights reserved. + $Id$ +*/ + +#ifndef PARTITIONGPT_H +#define PARTITIONGPT_H + #include /* Type ID for legacy MBR */ @@ -16,7 +24,7 @@ struct GPTHeader UQUAD DataStart; /* Number of the first usable block for data */ UQUAD DataEnd; /* Number of the last usable block for data */ uuid_t DiskID; /* Disk unique ID */ - UQUAD StartBlock; /* Number if the first partition entry block */ + UQUAD StartBlock; /* Number of the first partition entry block */ ULONG NumEntries; /* Number of partitions in the table */ ULONG EntrySize; /* Size of one entry */ ULONG PartCRC32; /* CRC32 of the partition entries array */ @@ -47,3 +55,5 @@ struct GPTPartition /* AROS-specific flags */ #define GPT_PF1_AROS_BOOTABLE (1 << 28) #define GPT_PF1_AROS_BOOTPRI 0x000000FF /* Mask for boot priority */ + +#endif /* PARTITIONGPT_H */ diff --git a/rom/partition/partitionmbr.c b/rom/partition/partitionmbr.c index 2000428222..dabc89e179 100644 --- a/rom/partition/partitionmbr.c +++ b/rom/partition/partitionmbr.c @@ -1,7 +1,6 @@ /* - Copyright © 1995-2011, The AROS Development Team. All rights reserved. + Copyright © 1995-2012, The AROS Development Team. All rights reserved. $Id$ - */ #include @@ -528,7 +527,8 @@ static const struct PartitionAttribute PartitionMBRPartitionAttrs[]= {TAG_DONE, 0} }; -static ULONG PartitionMBRDestroyPartitionTable(struct Library *PartitionBase, struct PartitionHandle *root) +ULONG PartitionMBRDestroyPartitionTable(struct Library *PartitionBase, + struct PartitionHandle *root) { struct MBR *mbr = root->table->data; diff --git a/rom/partition/partitionmbr.h b/rom/partition/partitionmbr.h index 7509aa08e9..38ee7aad61 100644 --- a/rom/partition/partitionmbr.h +++ b/rom/partition/partitionmbr.h @@ -2,9 +2,8 @@ #define PARTITIONMBR_H /* - Copyright © 2007-2011, The AROS Development Team. All rights reserved. + Copyright © 2007-2012, The AROS Development Team. All rights reserved. $Id$ - */ #include @@ -36,7 +35,6 @@ struct MBR { #define MBR_STATUS_VALID(status) ((!(status & 0x0F)) || (status & 0x80)) LONG MBRCheckPartitionTable(struct Library *PartitionBase, struct PartitionHandle *root, void *buffer); - void PartitionMBRSetGeometry ( struct PartitionHandle *root, @@ -45,6 +43,8 @@ void PartitionMBRSetGeometry ULONG count, ULONG relative_sector ); +ULONG PartitionMBRDestroyPartitionTable(struct Library *PartitionBase, + struct PartitionHandle *root); #define MBR_MAX_PARTITIONS (4) #define MBRT_EXTENDED (0x05) -- 2.11.4.GIT