Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Kernel v2.6.25-git19 /mm/swapfile.c

Filename:/mm/swapfile.c
Lines Added:9
Lines Deleted:5
Also changed in: (Previous) 2.6.25-git18  2.6.25-git17  2.6.25-git16  2.6.25-git15  2.6.25-git14  2.6.25-git13 
(Following) 2.6.25-git20  2.6.26-rc1  2.6.26-rc2  2.6.26-rc3  2.6.26-rc4  2.6.26-rc5 

Location
[  2.6.25-git19
  [  mm
     o  swapfile.c

Patch

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2da149c..bd1bb59 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1426,11 +1426,7 @@ static const struct file_operations proc_swaps_operations = {
 
 static int __init procswaps_init(void)
 {
-   struct proc_dir_entry *entry;
-
-   entry = create_proc_entry("swaps", 0, NULL);
-   if (entry)
-      entry->proc_fops = &proc_swaps_operations;
+   proc_create("swaps", 0, NULL, &proc_swaps_operations);
    return 0;
 }
 __initcall(procswaps_init);
@@ -1582,6 +1578,14 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
       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) {


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.