]> git.hungrycats.org Git - linux/commitdiff
[PATCH] large dev_t - second series (10/15)
authorAlexander Viro <viro@www.linux.org.uk>
Fri, 5 Sep 2003 03:54:36 +0000 (20:54 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 5 Sep 2003 03:54:36 +0000 (20:54 -0700)
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

index 1c2fba3d5655e4702ba5a35b8f30d7c573a2a5ee..d892081d73abd39e85e5c9074025bf895556b1aa 100644 (file)
@@ -1234,9 +1234,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
 
                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, int do_sync)
                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);
        }