2
* Minix partition parsing code
4
* Copyright (C) 2009 Karel Zak <kzak@redhat.com>
6
* This file may be redistributed under the terms of the
7
* GNU Lesser General Public License.
14
#include "partitions.h"
18
static int probe_minix_pt(blkid_probe pr,
19
const struct blkid_idmag *mag __attribute__((__unused__)))
21
struct dos_partition *p;
22
blkid_parttable tab = NULL;
23
blkid_partition parent;
28
data = blkid_probe_get_sector(pr, 0);
32
ls = blkid_probe_get_partlist(pr);
36
/* Parent is required, because Minix uses the same PT as DOS and
37
* difference is only in primary partition (parent) type.
39
parent = blkid_partlist_get_parent(ls);
43
if (blkid_partition_get_type(parent) != BLKID_MINIX_PARTITION)
46
if (blkid_partitions_need_typeonly(pr))
47
/* caller does not ask for details about partitions */
50
p = (struct dos_partition *) (data + BLKID_MSDOS_PT_OFFSET);
52
tab = blkid_partlist_new_parttable(ls, "minix", BLKID_MSDOS_PT_OFFSET);
56
for (i = 0; i < MINIX_MAXPARTITIONS; i++, p++) {
60
if (p->sys_type != BLKID_MINIX_PARTITION)
63
start = dos_partition_start(p);
64
size = dos_partition_size(p);
66
if (parent && !blkid_is_nested_dimension(parent, start, size)) {
67
DBG(DEBUG_LOWPROBE, printf(
68
"WARNING: minix partition (%d) overflow "
69
"detected, ignore\n", i));
73
par = blkid_partlist_add_partition(ls, tab, start, size);
77
blkid_partition_set_type(par, p->sys_type);
78
blkid_partition_set_flags(par, p->boot_ind);
90
const struct blkid_idinfo minix_pt_idinfo =
93
.probefunc = probe_minix_pt,
96
{ .magic = "\x55\xAA", .len = 2, .sboff = 510 },