xfs2: auto-switch endianness and fix build bug
authorAlan Cox <alan@etchedpixels.co.uk>
Sun, 30 Nov 2014 20:56:44 +0000 (20:56 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Sun, 30 Nov 2014 20:56:44 +0000 (20:56 +0000)
Standalone/xfs2.c

index 7ce0657..68207de 100644 (file)
@@ -900,7 +900,7 @@ blkno_t bmap(inoptr ip, blkno_t bn, int rwflg)
                 }
                 ******/
                 i = (bn>>sh) & 0xff;
-                if ((swizzle16(nb) = ((blkno_t *)bp)[i]))
+                if ((swizzle16(nb) == ((blkno_t *)bp)[i]))
                     brelse(bp);
                 else
                 {
@@ -1024,6 +1024,8 @@ int fmount(int dev, inoptr ino)
     brelse((bufptr)buf);
     
     /* See if there really is a filesystem on the device */
+    if (fp->s_mounted == SMOUNTED_WRONGENDIAN)
+     swizzling = 1;
     if (swizzle16(fp->s_mounted) != SMOUNTED ||
          swizzle16(fp->s_isize) >= swizzle16(fp->s_fsize))
         return (-1);