Skip to contentSkip to conversation

MTD: Fix MEMGETINFO and MEMGETREGIONINFO for devices >= 4GB

PATCH In review Felix Radensky 2 participants 2 messages Oct 7, 2009 – Oct 11, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD: Fix MEMGETINFO and MEMGETREGIONINFO for devices >= 4GB

Currently MEMGETINFO and MEMGETREGIONINFO report invalid information for devices >= 4GB, since relevant fields in MTD ABI structures are 32-bit while corresponding fields in kernel internal structures are 64-bit. Fix ABI fields to be 64-bit as well.

---
 include/mtd/mtd-abi.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/mtd/mtd-abi.h +2 -2
index be51ae2..c66044d 100644
@@ -64,7 +64,7 @@ struct mtd_oob_buf64 {
 struct mtd_info_user {
 	__u8 type;
 	__u32 flags;
-	__u32 size;	 // Total size of the MTD
+	__u64 size;	 // Total size of the MTD
 	__u32 erasesize;
 	__u32 writesize;
 	__u32 oobsize;   // Amount of OOB data per block (e.g. 16)
@@ -75,7 +75,7 @@ struct mtd_info_user {
 };
 
 struct region_info_user {
-	__u32 offset;		/* At which this region starts,
+	__u64 offset;		/* At which this region starts,
 					 * from the beginning of the MTD */
 	__u32 erasesize;		/* For this region */
 	__u32 numblocks;		/* Number of blocks in this region */
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 10 lines · Felix Radensky

Currently MEMGETINFO and MEMGETREGIONINFO report invalid information for devices >= 4GB, since relevant fields in MTD ABI structures are 32-bit while corresponding fields in kernel internal structures are 64-bit. Fix ABI fields to be 64-bit as well.

---
 include/mtd/mtd-abi.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Nack. As it was discussed several times, you cannot change these data structure because you will break binary compatibility.

New ioctls is the way out.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)