1 // SPDX-License-Identifier: GPL-2.0
3 * fs/partitions/sysv68.c
5 * Copyright (C) 2007 Philippe De Muyter <phdm@macqel.be>
12 * Volume ID structure: on first 256-bytes sector of disk
17 u8 vid_mac
[8]; /* ASCII string "MOTOROLA" */
21 * config block: second 256-bytes sector on disk
26 __be32 ios_slcblk
; /* Slice table block number */
27 __be16 ios_slccnt
; /* Number of entries in slice table */
32 * combined volumeid and dkconfig block
36 struct volumeid dk_vid
;
37 struct dkconfig dk_ios
;
41 * Slice Table Structure
45 __be32 nblocks
; /* slice size (in blocks) */
46 __be32 blkoff
; /* block offset of slice */
50 int sysv68_partition(struct parsed_partitions
*state
)
60 data
= read_part_sector(state
, 0, §
);
64 b
= (struct dkblk0
*)data
;
65 if (memcmp(b
->dk_vid
.vid_mac
, "MOTOROLA", sizeof(b
->dk_vid
.vid_mac
))) {
69 slices
= be16_to_cpu(b
->dk_ios
.ios_slccnt
);
70 i
= be32_to_cpu(b
->dk_ios
.ios_slcblk
);
73 data
= read_part_sector(state
, i
, §
);
77 slices
-= 1; /* last slice is the whole disk */
78 snprintf(tmp
, sizeof(tmp
), "sysV68: %s(s%u)", state
->name
, slices
);
79 strlcat(state
->pp_buf
, tmp
, PAGE_SIZE
);
80 slice
= (struct slice
*)data
;
81 for (i
= 0; i
< slices
; i
++, slice
++) {
82 if (slot
== state
->limit
)
84 if (be32_to_cpu(slice
->nblocks
)) {
85 put_partition(state
, slot
,
86 be32_to_cpu(slice
->blkoff
),
87 be32_to_cpu(slice
->nblocks
));
88 snprintf(tmp
, sizeof(tmp
), "(s%u)", i
);
89 strlcat(state
->pp_buf
, tmp
, PAGE_SIZE
);
93 strlcat(state
->pp_buf
, "\n", PAGE_SIZE
);