Blame view
block/partitions/sysv68.c
1.89 KB
19d0e8ce8 partition: add su... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
/* * fs/partitions/sysv68.c * * Copyright (C) 2007 Philippe De Muyter <phdm@macqel.be> */ #include "check.h" #include "sysv68.h" /* * Volume ID structure: on first 256-bytes sector of disk */ struct volumeid { u8 vid_unused[248]; u8 vid_mac[8]; /* ASCII string "MOTOROLA" */ }; /* * config block: second 256-bytes sector on disk */ struct dkconfig { u8 ios_unused0[128]; __be32 ios_slcblk; /* Slice table block number */ __be16 ios_slccnt; /* Number of entries in slice table */ u8 ios_unused1[122]; }; /* * combined volumeid and dkconfig block */ struct dkblk0 { struct volumeid dk_vid; struct dkconfig dk_ios; }; /* * Slice Table Structure */ struct slice { __be32 nblocks; /* slice size (in blocks) */ __be32 blkoff; /* block offset of slice */ }; |
1493bf217 block: use struct... |
47 |
int sysv68_partition(struct parsed_partitions *state) |
19d0e8ce8 partition: add su... |
48 49 50 51 52 53 54 |
{ int i, slices; int slot = 1; Sector sect; unsigned char *data; struct dkblk0 *b; struct slice *slice; |
9c867fbe0 partitions: fix s... |
55 |
char tmp[64]; |
19d0e8ce8 partition: add su... |
56 |
|
1493bf217 block: use struct... |
57 |
data = read_part_sector(state, 0, §); |
19d0e8ce8 partition: add su... |
58 59 60 61 62 63 64 65 66 67 68 |
if (!data) return -1; b = (struct dkblk0 *)data; if (memcmp(b->dk_vid.vid_mac, "MOTOROLA", sizeof(b->dk_vid.vid_mac))) { put_dev_sector(sect); return 0; } slices = be16_to_cpu(b->dk_ios.ios_slccnt); i = be32_to_cpu(b->dk_ios.ios_slcblk); put_dev_sector(sect); |
1493bf217 block: use struct... |
69 |
data = read_part_sector(state, i, §); |
19d0e8ce8 partition: add su... |
70 71 72 73 |
if (!data) return -1; slices -= 1; /* last slice is the whole disk */ |
9c867fbe0 partitions: fix s... |
74 75 |
snprintf(tmp, sizeof(tmp), "sysV68: %s(s%u)", state->name, slices); strlcat(state->pp_buf, tmp, PAGE_SIZE); |
19d0e8ce8 partition: add su... |
76 77 78 79 80 81 82 83 |
slice = (struct slice *)data; for (i = 0; i < slices; i++, slice++) { if (slot == state->limit) break; if (be32_to_cpu(slice->nblocks)) { put_partition(state, slot, be32_to_cpu(slice->blkoff), be32_to_cpu(slice->nblocks)); |
9c867fbe0 partitions: fix s... |
84 85 |
snprintf(tmp, sizeof(tmp), "(s%u)", i); strlcat(state->pp_buf, tmp, PAGE_SIZE); |
19d0e8ce8 partition: add su... |
86 87 88 |
} slot++; } |
9c867fbe0 partitions: fix s... |
89 90 |
strlcat(state->pp_buf, " ", PAGE_SIZE); |
19d0e8ce8 partition: add su... |
91 92 93 |
put_dev_sector(sect); return 1; } |