2
* uktrix partition parsing code
4
* Copyright (C) 2010 Karel Zak <kzak@redhat.com>
6
* This file may be redistributed under the terms of the
7
* GNU Lesser General Public License.
15
#include "partitions.h"
17
#define ULTRIX_MAXPARTITIONS 8
18
#define ULTRIX_MAGIC 0x032957
20
/* sector with partition table */
21
#define ULTRIX_SECTOR ((16384 - sizeof(struct ultrix_disklabel)) >> 9)
22
/* position of partition table within ULTRIX_SECTOR */
23
#define ULTRIX_OFFSET (512 - sizeof(struct ultrix_disklabel))
25
struct ultrix_disklabel {
26
int32_t pt_magic; /* magic no. indicating part. info exits */
27
int32_t pt_valid; /* set by driver if pt is current */
29
int32_t pi_nblocks; /* no. of sectors */
30
uint32_t pi_blkoff; /* block offset for start */
31
} pt_part[ULTRIX_MAXPARTITIONS];
32
} __attribute__((packed));
35
static int probe_ultrix_pt(blkid_probe pr, const struct blkid_idmag *mag)
38
struct ultrix_disklabel *l;
39
blkid_parttable tab = NULL;
43
data = blkid_probe_get_sector(pr, ULTRIX_SECTOR);
47
l = (struct ultrix_disklabel *) (data + ULTRIX_OFFSET);
49
if (l->pt_magic != ULTRIX_MAGIC || l->pt_valid != 1)
52
if (blkid_partitions_need_typeonly(pr))
53
/* caller does not ask for details about partitions */
56
ls = blkid_probe_get_partlist(pr);
60
tab = blkid_partlist_new_parttable(ls, "ultrix", 0);
64
for (i = 0; i < ULTRIX_MAXPARTITIONS; i++) {
65
if (!l->pt_part[i].pi_nblocks)
66
blkid_partlist_increment_partno(ls);
68
if (!blkid_partlist_add_partition(ls, tab,
69
l->pt_part[i].pi_blkoff,
70
l->pt_part[i].pi_nblocks))
82
const struct blkid_idinfo ultrix_pt_idinfo =
85
.probefunc = probe_ultrix_pt,
86
.magics = BLKID_NONE_MAGIC