[PATCH] Fix for broken Amiga RDSK support in 2.2.x

BennyBoy (zj15@dial.pipex.com)
Tue, 14 Sep 1999 20:29:14 +0100


Hi,

Basically this fixes the kernel lock myself and Alex Butcher outlined in
earlier mails to l-k.

The patch is literally just some of the code lifted from 2.3.18
fs/partitions/amiga.c and pasted into /drivers/block/genhd.c
So, kudos to that person for the fix.

Benny

--- linux-ami/drivers/block/genhd.c Tue Sep 14 19:40:23 1999
+++ linux/drivers/block/genhd.c Tue Sep 14 20:47:56 1999
@@ -901,7 +901,7 @@
u32 sum = 0;

while (size--)
- sum += htonl(*m++);
+ sum += be32_to_cpu(*m++);
return sum;
}

@@ -933,15 +933,15 @@
kdevname(dev),blk);
goto rdb_done;
}
- if (*(u32 *)bh->b_data == htonl(IDNAME_RIGIDDISK)) {
+ if (*(u32 *)bh->b_data == cpu_to_be32(IDNAME_RIGIDDISK)) {
rdb = (struct RigidDiskBlock *)bh->b_data;
- if (checksum_block((u32 *)bh->b_data,htonl(rdb->rdb_SummedLongs) &
0x7F)) {
+ if (checksum_block((u32 *)bh->b_data,be32_to_cpu(rdb->rdb_SummedLongs) &
0x7F)) {
/* Try again with 0xdc..0xdf zeroed, Windows might have
* trashed it.
*/
*(u32 *)(&bh->b_data[0xdc]) = 0;
if (checksum_block((u32 *)bh->b_data,
- htonl(rdb->rdb_SummedLongs) & 0x7F)) {
+ be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F)) {
brelse(bh);
printk("Dev %s: RDB in block %d has bad checksum\n",
kdevname(dev),blk);
@@ -951,7 +951,7 @@
"ignored in checksum calculation\n",blk);
}
printk(" RDSK");
- blk = htonl(rdb->rdb_PartitionList);
+ blk = be32_to_cpu(rdb->rdb_PartitionList);
brelse(bh);
for (part = 1; blk > 0 && part <= 16; part++) {
if (!(bh = bread(dev,blk,blocksize))) {
@@ -960,22 +960,22 @@
goto rdb_done;
}
pb = (struct PartitionBlock *)bh->b_data;
- blk = htonl(pb->pb_Next);
- if (pb->pb_ID == htonl(IDNAME_PARTITION) && checksum_block(
- (u32 *)pb,htonl(pb->pb_SummedLongs) & 0x7F) == 0 ) {
+ blk = be32_to_cpu(pb->pb_Next);
+ if (pb->pb_ID == cpu_to_be32(IDNAME_PARTITION) && checksum_block(
+ (u32 *)pb,be32_to_cpu(pb->pb_SummedLongs) & 0x7F) == 0 ) {

/* Tell Kernel about it */

- if (!(nr_sects = (htonl(pb->pb_Environment[10]) + 1 -
- htonl(pb->pb_Environment[9])) *
- htonl(pb->pb_Environment[3]) *
- htonl(pb->pb_Environment[5]))) {
+ if (!(nr_sects = (be32_to_cpu(pb->pb_Environment[10]) + 1 -
+ be32_to_cpu(pb->pb_Environment[9])) *
+ be32_to_cpu(pb->pb_Environment[3]) *
+ be32_to_cpu(pb->pb_Environment[5]))) {
brelse(bh);
continue;
}
- start_sect = htonl(pb->pb_Environment[9]) *
- htonl(pb->pb_Environment[3]) *
- htonl(pb->pb_Environment[5]);
+ start_sect = be32_to_cpu(pb->pb_Environment[9]) *
+ be32_to_cpu(pb->pb_Environment[3]) *
+ be32_to_cpu(pb->pb_Environment[5]);
add_partition(hd,current_minor,
start_sect,nr_sects,0);
current_minor++;
@@ -984,6 +984,7 @@
brelse(bh);
}
printk("\n");
+ break;
}
else
brelse(bh);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/