Skip to contentSkip to conversation

xfsprogs: fix harmless sparse endian nit

PATCH In review Eric Sandeen 2 participants 2 messages Oct 23, 2014 – Oct 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: fix harmless sparse endian nit

h_crc is __le32 but cpu_to_be32() is... __be32. So sparse complains, even though it's harmless.

Although sparse is smart about bare 0s, and we could drop the swap, other places explicitly swap to keep things clear (I guess?) so "swap" the 0 with the proper routine.

---

libxfs/rdwr.c +1 -1
index 9ee89d3..dd8baa6 100644
@@ -187,7 +187,7 @@ libxfs_log_header(
 		head->h_len = cpu_to_be32(sunit - BBSIZE);
 	else
 		head->h_len = cpu_to_be32(20);
-	head->h_crc = cpu_to_be32(0);
+	head->h_crc = cpu_to_le32(0);
 	head->h_prev_block = cpu_to_be32(-1);
 	head->h_num_logops = cpu_to_be32(1);
 	head->h_cycle_data[0] = cpu_to_be32(0xb0c0d0d0);

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Eric Sandeen

h_crc is __le32 but cpu_to_be32() is... __be32. So sparse complains, even though it's harmless.

Although sparse is smart about bare 0s, and we could drop the swap, other places explicitly swap to keep things clear (I guess?) so "swap" the 0 with the proper routine.

---

Looks good. I agree that the swap helps with clarity.

Quoted 15 lines
libxfs/rdwr.c +1 -1
index 9ee89d3..dd8baa6 100644
@@ -187,7 +187,7 @@ libxfs_log_header(
 		head->h_len = cpu_to_be32(sunit - BBSIZE);
 	else
 		head->h_len = cpu_to_be32(20);
-	head->h_crc = cpu_to_be32(0);
+	head->h_crc = cpu_to_le32(0);
 	head->h_prev_block = cpu_to_be32(-1);
 	head->h_num_logops = cpu_to_be32(1);
 	head->h_cycle_data[0] = cpu_to_be32(0xb0c0d0d0);
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs