aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorChris Dearman <chris@mips.com>2008-04-28 05:12:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:19 -0400
commit797df5749032c2286bc7ff3a52de41fde0cdf0a5 (patch)
tree38ebb9f0672c6eeab3269cc875f22422fa2c908b /mm/swapfile.c
parent19770b32609b6bf97a3dece2529089494cbfc549 (diff)
mm: try both endianess when checking for endianess
When checking for the swap header try byteswapping the endianess dependent fields to allow the swap partition to be shared between big & little endian systems. Signed-off-by: Chris Dearman <chris@mips.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Acked-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2da149cfc9ac..67051be7083a 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1582,6 +1582,14 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1582 error = -EINVAL; 1582 error = -EINVAL;
1583 goto bad_swap; 1583 goto bad_swap;
1584 case 2: 1584 case 2:
1585 /* swap partition endianess hack... */
1586 if (swab32(swap_header->info.version) == 1) {
1587 swab32s(&swap_header->info.version);
1588 swab32s(&swap_header->info.last_page);
1589 swab32s(&swap_header->info.nr_badpages);
1590 for (i = 0; i < swap_header->info.nr_badpages; i++)
1591 swab32s(&swap_header->info.badpages[i]);
1592 }
1585 /* Check the swap header's sub-version and the size of 1593 /* Check the swap header's sub-version and the size of
1586 the swap file and bad block lists */ 1594 the swap file and bad block lists */
1587 if (swap_header->info.version != 1) { 1595 if (swap_header->info.version != 1) {