0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "check.h"
0011
0012 int ultrix_partition(struct parsed_partitions *state)
0013 {
0014 int i;
0015 Sector sect;
0016 unsigned char *data;
0017 struct ultrix_disklabel {
0018 s32 pt_magic;
0019 s32 pt_valid;
0020 struct pt_info {
0021 s32 pi_nblocks;
0022 u32 pi_blkoff;
0023 } pt_part[8];
0024 } *label;
0025
0026 #define PT_MAGIC 0x032957
0027 #define PT_VALID 1
0028
0029 data = read_part_sector(state, (16384 - sizeof(*label))/512, §);
0030 if (!data)
0031 return -1;
0032
0033 label = (struct ultrix_disklabel *)(data + 512 - sizeof(*label));
0034
0035 if (label->pt_magic == PT_MAGIC && label->pt_valid == PT_VALID) {
0036 for (i=0; i<8; i++)
0037 if (label->pt_part[i].pi_nblocks)
0038 put_partition(state, i+1,
0039 label->pt_part[i].pi_blkoff,
0040 label->pt_part[i].pi_nblocks);
0041 put_dev_sector(sect);
0042 strlcat(state->pp_buf, "\n", PAGE_SIZE);
0043 return 1;
0044 } else {
0045 put_dev_sector(sect);
0046 return 0;
0047 }
0048 }