grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / partition / destroypartitiontable.c
blob07fecb072f80e834f83c8310c7e7d6116467623e
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/memory.h>
7 #include <proto/exec.h>
8 #include <proto/partition.h>
9 #include "partition_support.h"
10 #include "platform.h"
12 /*****************************************************************************
14 NAME */
15 #include <libraries/partition.h>
17 AROS_LH1(LONG, DestroyPartitionTable,
19 /* SYNOPSIS */
20 AROS_LHA(struct PartitionHandle *, root, A1),
22 /* LOCATION */
23 struct Library *, PartitionBase, 19, Partition)
25 /* FUNCTION
26 Destroy a partition table by immediately overwriting table data on disk.
28 INPUTS
29 root - partition table to destroy
31 RESULT
32 0 on success; an error code otherwise
34 NOTES
35 After calling this function the state of the PartitionHandle will be the
36 same as before calling OpenPartitionTable(). Therefore do not reference
37 any child PartitionHandles any more.
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
50 LONG retval=1;
52 if (root->table)
54 struct PTFunctionTable *handler = root->table->handler;
56 #undef DestroyPartitionTable
57 if (handler->destroyPartitionTable)
59 retval = handler->destroyPartitionTable(PartitionBase, root);
60 if (retval == 0)
61 ClosePartitionTable(root);
64 return retval;
65 AROS_LIBFUNC_EXIT