2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 #include <exec/memory.h>
7 #include <proto/exec.h>
8 #include "partition_support.h"
11 /*****************************************************************************
14 #include <libraries/partition.h>
16 AROS_LH2(LONG
, CreatePartitionTable
,
19 AROS_LHA(struct PartitionHandle
*, root
, A1
),
20 AROS_LHA(ULONG
, type
, D1
),
23 struct Library
*, PartitionBase
, 10, Partition
)
26 Create a new partition table.
29 root - partition to create table in
30 type - the type of the partition table to create
33 0 on success; an error code otherwise
36 After calling this function the state of the PartitionHandle will be
37 the same as when calling OpenPartitionTable(). Therefore before
38 closing the PartitionHandle you should call ClosePartitionTable().
48 *****************************************************************************/
53 if (root
->table
== NULL
)
55 const struct PTFunctionTable
* const *pst
;
57 pst
= PartitionSupport
;
60 if (pst
[0]->type
== type
)
62 if (pst
[0]->createPartitionTable
)
64 root
->table
= AllocMem
66 sizeof(struct PartitionTableHandler
),
67 MEMF_PUBLIC
| MEMF_CLEAR
71 root
->table
->type
= type
;
72 root
->table
->handler
= (APTR
)*pst
;
73 retval
= pst
[0]->createPartitionTable(PartitionBase
, root
);
76 FreeMem(root
->table
, sizeof(struct PartitionTableHandler
));