
From: viro@www.linux.org.uk

Fix for endianness bug in UDF: it writes major and minor as 32bit
host-endian and reads them as 32bit little-endian; obviously a bad idea on
big-endian boxen ;-) Needed both for 2.4 and 2.6.



 fs/udf/inode.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff -puN fs/udf/inode.c~large-dev_t-2nd-10 fs/udf/inode.c
--- 25/fs/udf/inode.c~large-dev_t-2nd-10	2003-09-05 00:50:07.000000000 -0700
+++ 25-akpm/fs/udf/inode.c	2003-09-05 00:50:07.000000000 -0700
@@ -1234,9 +1234,10 @@ static void udf_fill_inode(struct inode 
 
 		if (dsea)
 		{
-			init_special_inode(inode, inode->i_mode,
-				((le32_to_cpu(dsea->majorDeviceIdent)) << 8) |
-				(le32_to_cpu(dsea->minorDeviceIdent) & 0xFF));
+			init_special_inode(inode, inode->i_mode, MKDEV(
+				le32_to_cpu(dsea->majorDeviceIdent),
+				le32_to_cpu(dsea->minorDeviceIdent)
+			));
 			/* Developer ID ??? */
 			udf_release_data(tbh);
 		}
@@ -1392,8 +1393,8 @@ udf_update_inode(struct inode *inode, in
 		strcpy(eid->ident, UDF_ID_DEVELOPER);
 		eid->identSuffix[0] = UDF_OS_CLASS_UNIX;
 		eid->identSuffix[1] = UDF_OS_ID_LINUX;
-		dsea->majorDeviceIdent = inode->i_rdev >> 8;
-		dsea->minorDeviceIdent = inode->i_rdev & 0xFF;
+		dsea->majorDeviceIdent = cpu_to_le32(imajor(inode));
+		dsea->minorDeviceIdent = cpu_to_le32(iminor(inode));
 		mark_buffer_dirty_inode(tbh, inode);
 		udf_release_data(tbh);
 	}

_
