4 * Code extracted from drivers/block/genhd.c
6 * Copyright (C) 1991-1998 Linus Torvalds
7 * Re-organised Feb 1998 Russell King
11 #include <linux/genhd.h>
12 #include <linux/kernel.h>
13 #include <linux/major.h>
14 #include <linux/string.h>
15 #include <linux/blk.h>
20 int osf_partition(struct gendisk *hd, struct block_device *bdev,
21 unsigned long first_sector, int current_minor)
26 int mask = (1 << hd->minor_shift) - 1;
41 u16 d_rpm, d_interleave, d_trackskew, d_cylskew;
42 u32 d_headswitch, d_trkseek, d_flags;
48 u32 d_bbsize, d_sbsize;
58 struct d_partition * partition;
60 data = read_dev_sector(bdev, 0, §);
64 label = (struct disklabel *) (data+64);
65 partition = label->d_partitions;
66 if (le32_to_cpu(label->d_magic) != DISKLABELMAGIC) {
70 if (le32_to_cpu(label->d_magic2) != DISKLABELMAGIC) {
74 for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
75 if ((current_minor & mask) == 0)
77 if (le32_to_cpu(partition->p_size))
78 add_gd_partition(hd, current_minor,
79 first_sector+le32_to_cpu(partition->p_offset),
80 le32_to_cpu(partition->p_size));