Cleaned up formatting of AutoDocs (mostly indentation).
[AROS.git] / rom / partition / openpartitiontable.c
blobfaf43169c17c8a7d02838cf618189090e54f2e27
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/memory.h>
7 #include <proto/exec.h>
9 #include "partition_intern.h"
10 #include "partition_support.h"
11 #include "platform.h"
13 /*****************************************************************************
15 NAME */
16 #include <libraries/partition.h>
18 AROS_LH1(LONG, OpenPartitionTable,
20 /* SYNOPSIS */
21 AROS_LHA(struct PartitionHandle *, root, A1),
23 /* LOCATION */
24 struct Library *, PartitionBase, 7, Partition)
26 /* FUNCTION
27 Open a partition table. On success root->list will be filled with a
28 list of PartitionHandles. If one partition contains more
29 subpartitions, the caller should call OpenPartitionTable() on the
30 PartitionHandle recursively.
32 INPUTS
33 root - root partition
35 RESULT
36 0 for success; an error code otherwise.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 *****************************************************************************/
50 AROS_LIBFUNC_INIT
52 const struct PTFunctionTable * const *pst;
54 pst = PartitionSupport;
55 while (pst[0])
57 if (pst[0]->checkPartitionTable(PartitionBase, root))
59 root->table = AllocMem(sizeof(struct PartitionTableHandler), MEMF_PUBLIC | MEMF_CLEAR);
61 if (root->table)
63 LONG retval;
65 NEWLIST(&root->table->list);
67 root->table->type = pst[0]->type;
68 root->table->handler = (void *)pst[0];
70 retval = pst[0]->openPartitionTable(PartitionBase, root);
71 if (retval)
73 FreeMem(root->table, sizeof(struct PartitionTableHandler));
75 root->table = NULL;
77 return retval;
80 pst++;
82 return 1;
84 AROS_LIBFUNC_EXIT