NListtree.mcc: fix sorted insert
[AROS.git] / rom / partition / getpartitiontableattrs.c
blob5d97eccbf060a8669817f3f35f9a9020d5c2a291
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 */
7 #include <proto/utility.h>
9 #include "partition_support.h"
10 #include "platform.h"
11 #include "debug.h"
13 /*****************************************************************************
15 NAME */
16 #include <utility/tagitem.h>
17 #include <libraries/partition.h>
19 AROS_LH2(LONG, GetPartitionTableAttrs,
21 /* SYNOPSIS */
22 AROS_LHA(struct PartitionHandle *, root, A1),
23 AROS_LHA(struct TagItem *, taglist, A2),
25 /* LOCATION */
26 struct Library *, PartitionBase, 13, Partition)
28 /* FUNCTION
29 get attributes of a partition table
31 INPUTS
32 ph - PartitionHandle of the partition table
33 taglist - list of attributes; unknown tags are ignored
34 PTT_TYPE - ULONG * ; get partition table type
35 PTT_MAXLEADIN - LONG *
36 PTT_RESERVED - ULONG * ; get number of reserved blocks
38 RESULT
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 HISTORY
51 21-02-02 first version
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 if (root->table)
59 struct PTFunctionTable *handler = root->table->handler;
60 struct TagItem *tag;
62 while ((tag = NextTagItem((struct TagItem **)&taglist)))
64 LONG sup;
66 if (handler->getPartitionTableAttr)
67 sup = handler->getPartitionTableAttr(PartitionBase, root, tag);
68 else
69 sup = 0;
71 if (!sup)
73 switch (tag->ti_Tag)
75 case PTT_TYPE:
76 *((LONG *)tag->ti_Data) = root->table->type;
77 break;
79 case PTT_MAXLEADIN:
80 case PTT_RESERVED:
81 case PTT_MAX_PARTITIONS:
82 *((LONG *)tag->ti_Data) = 0;
83 break;
88 return 1;
91 /* There's no partition table here */
92 return 0;
94 AROS_LIBFUNC_EXIT