patch-2.2.6 linux/drivers/block/genhd.c
Next file: linux/drivers/block/ide-cd.c
Previous file: linux/drivers/block/Makefile
Back to the patch index
Back to the overall index
- Lines: 52
- Date:
Mon Apr 12 16:18:27 1999
- Orig file:
v2.2.5/linux/drivers/block/genhd.c
- Orig date:
Tue Mar 23 14:35:47 1999
diff -u --recursive --new-file v2.2.5/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -776,11 +776,14 @@
#endif /* CONFIG_SUN_PARTITION */
#ifdef CONFIG_SGI_PARTITION
+#include <asm/byteorder.h>
static int sgi_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector)
{
int i, csum;
unsigned int *ui;
+ unsigned int start, blocks, cs;
+ int magic;
struct buffer_head *bh;
struct sgi_disklabel {
int magic_mushroom; /* Big fat spliff... */
@@ -810,15 +813,18 @@
}
label = (struct sgi_disklabel *) bh->b_data;
p = &label->partitions[0];
- if(label->magic_mushroom != SGI_LABEL_MAGIC) {
+ magic = label->magic_mushroom;
+ if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
printk("Dev %s SGI disklabel: bad magic %08x\n",
- kdevname(dev), label->magic_mushroom);
+ kdevname(dev), magic);
brelse(bh);
return 0;
}
ui = ((unsigned int *) (label + 1)) - 1;
- for(csum = 0; ui >= ((unsigned int *) label);)
- csum += *ui--;
+ for(csum = 0; ui >= ((unsigned int *) label);) {
+ cs = *ui--;
+ csum += be32_to_cpu(cs);
+ }
if(csum) {
printk("Dev %s SGI disklabel: csum bad, label corrupted\n",
kdevname(dev));
@@ -831,9 +837,11 @@
* current_minor.
*/
for(i = 0; i < 16; i++, p++) {
- if(!(p->num_blocks))
+ blocks = be32_to_cpu(p->num_blocks);
+ start = be32_to_cpu(p->first_block);
+ if(!blocks)
continue;
- add_partition(hd, current_minor, p->first_block, p->num_blocks);
+ add_partition(hd, current_minor, start, blocks);
current_minor++;
}
printk("\n");
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)