4 * Code extracted from drivers/block/genhd.c
6 * Copyright (C) 1991-1998 Linus Torvalds
7 * Re-organised Feb 1998 Russell King
13 int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
19 struct sun_disklabel {
20 unsigned char info[128]; /* Informative text string */
21 unsigned char spare0[14];
28 unsigned char spare[246]; /* Boot information etc. */
29 unsigned short rspeed; /* Disk rotational speed */
30 unsigned short pcylcount; /* Physical cylinder count */
31 unsigned short sparecyl; /* extra sects per cylinder */
32 unsigned char spare2[4]; /* More magic... */
33 unsigned short ilfact; /* Interleave factor */
34 unsigned short ncyl; /* Data cylinder count */
35 unsigned short nacyl; /* Alt. cylinder count */
36 unsigned short ntrks; /* Tracks per cylinder */
37 unsigned short nsect; /* Sectors per track */
38 unsigned char spare3[4]; /* Even more magic... */
39 struct sun_partition {
43 unsigned short magic; /* Magic number */
44 unsigned short csum; /* Label xor'd checksum */
46 struct sun_partition *p;
48 char b[BDEVNAME_SIZE];
50 label = (struct sun_disklabel *)read_dev_sector(bdev, 0, §);
54 p = label->partitions;
55 if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
56 /* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n",
57 bdevname(bdev, b), be16_to_cpu(label->magic)); */
61 /* Look at the checksum */
62 ush = ((unsigned short *) (label+1)) - 1;
63 for (csum = 0; ush >= ((unsigned short *) label);)
66 printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
72 /* All Sun disks have 8 partition entries */
73 spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);
74 for (i = 0; i < 8; i++, p++) {
75 unsigned long st_sector;
78 st_sector = be32_to_cpu(p->start_cylinder) * spc;
79 num_sectors = be32_to_cpu(p->num_sectors);
81 put_partition(state, slot, st_sector, num_sectors);
82 if (label->infos[i].id == LINUX_RAID_PARTITION)
83 state->parts[slot].flags = 1;