1 // SPDX-License-Identifier: GPL-2.0
5 * Code extracted from drivers/block/genhd.c
7 * Copyright (C) 1991-1998 Linus Torvalds
8 * Re-organised Feb 1998 Russell King
13 #define MAX_OSF_PARTITIONS 18
14 #define DISKLABELMAGIC (0x82564557UL)
16 int osf_partition(struct parsed_partitions *state)
20 unsigned int npartitions;
25 __le16 d_type,d_subtype;
34 __le16 d_sparespertrack;
35 __le16 d_sparespercyl;
37 __le16 d_rpm, d_interleave, d_trackskew, d_cylskew;
38 __le32 d_headswitch, d_trkseek, d_flags;
39 __le32 d_drivedata[5];
44 __le32 d_bbsize, d_sbsize;
52 } d_partitions[MAX_OSF_PARTITIONS];
54 struct d_partition * partition;
56 data = read_part_sector(state, 0, §);
60 label = (struct disklabel *) (data+64);
61 partition = label->d_partitions;
62 if (le32_to_cpu(label->d_magic) != DISKLABELMAGIC) {
66 if (le32_to_cpu(label->d_magic2) != DISKLABELMAGIC) {
70 npartitions = le16_to_cpu(label->d_npartitions);
71 if (npartitions > MAX_OSF_PARTITIONS) {
75 for (i = 0 ; i < npartitions; i++, partition++) {
76 if (slot == state->limit)
78 if (le32_to_cpu(partition->p_size))
79 put_partition(state, slot,
80 le32_to_cpu(partition->p_offset),
81 le32_to_cpu(partition->p_size));
84 strlcat(state->pp_buf, "\n", PAGE_SIZE);