All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Try both endianess when checking for endianess.
@ 2008-02-25 19:26 Ralf Baechle
  0 siblings, 0 replies; only message in thread
From: Ralf Baechle @ 2008-02-25 19:26 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel; +Cc: Chris Dearman, linux-mips

From: Chris Dearman <chris@mips.com>

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>

 mm/swapfile.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-queue/mm/swapfile.c
===================================================================
--- linux-queue.orig/mm/swapfile.c
+++ linux-queue/mm/swapfile.c
@@ -1551,6 +1551,14 @@ asmlinkage long sys_swapon(const char __
 		error = -EINVAL;
 		goto bad_swap;
 	case 2:
+		/* swap partition endianess hack... */
+		if (swab32(swap_header->info.version) == 1) {
+			swab32s(&swap_header->info.version);
+			swab32s(&swap_header->info.last_page);
+			swab32s(&swap_header->info.nr_badpages);
+			for (i = 0; i < swap_header->info.nr_badpages; i++)
+				swab32s(&swap_header->info.badpages[i]);
+		}
 		/* Check the swap header's sub-version and the size of
                    the swap file and bad block lists */
 		if (swap_header->info.version != 1) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-25 19:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-25 19:26 [PATCH] Try both endianess when checking for endianess Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.