patch-2.2.13 linux/drivers/block/genhd.c

Next file: linux/drivers/block/ide-cd.c
Previous file: linux/arch/sparc64/prom/p1275.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.12/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -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);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)