[prev in list] [next in list] [prev in thread] [next in thread] 

List:       swsusp-devel
Subject:    [swsusp] Problem with devfs
From:       Stephan Loescher <loescher () gmx ! de>
Date:       2001-07-22 14:20:59
[Download RAW message or body]


Hi!

I have tried swsusp with Kernel 2.4.6. (The two patch-rejects where easy
to fix.)
But there is a problem with devfs: The name of my swap-partition is
/dev/ide/host0/bus0/target0/lun0/part1
an this pathname is too long for swsusp.

The obvious solution would be this patch:

--- linux/include/linux/swsusp.h.orig       Sun Jul 22 15:55:09 2001
+++ linux/include/linux/swsusp.h            Sun Jul 22 16:01:35 2001
@@ -20,7 +20,7 @@
                                         */
 } suspend_pagedir_t;
 
-#define SWAP_FILENAME_MAXLENGTH        32
+#define SWAP_FILENAME_MAXLENGTH        1024
 
 struct suspend_header {
        __u32 version_code;

Must I expect problems after this patch?

How long can pathnames be with Linux?
Is this PATH_MAX (=4095) defined in limits.h?
If so, I suggest to set
#define SWAP_FILENAME_MAXLENGTH        PATH_MAX
Or even replace SWAP_FILENAME_MAXLENGTH with PATH_MAX

The the complete patch would be this:

----- snip ------------------------------------------------------------
--- include/linux/swsusp.h.orig Sun Jul 22 15:55:09 2001
+++ include/linux/swsusp.h      Sun Jul 22 16:15:10 2001
@@ -4,6 +4,7 @@
 #include <asm/swsusp.h>
 #include <linux/swap.h>
 #include <linux/notifier.h>
+#include <linux/limits.h>
 
 extern unsigned char software_suspend_enabled;
 
@@ -20,8 +21,6 @@
                                         */
 } suspend_pagedir_t;
 
-#define SWAP_FILENAME_MAXLENGTH        32
-
 struct suspend_header {
        __u32 version_code;
        unsigned long num_physpages;
@@ -32,7 +31,7 @@
        unsigned long suspend_pagedir;
        unsigned int num_pbes;
        struct swap_location {
-               char filename[SWAP_FILENAME_MAXLENGTH];
+               char filename[PATH_MAX];
        } swap_location[MAX_SWAPFILES];
 };
 
--- kernel/swsusp.c.orig        Sun Jul 22 15:54:01 2001
+++ kernel/swsusp.c     Sun Jul 22 16:16:19 2001
@@ -353,7 +353,7 @@
                        path = d_path(p->swap_file, p->swap_vfsmnt, page, PAGE_S
IZE);
                        len = page + PAGE_SIZE - path;
 
-                       if(len > SWAP_FILENAME_MAXLENGTH)
+                       if(len > PATH_MAX)
                                panic("\nFilename for %s swapfile is too long",p
ath);
 
                        strcpy(sh->swap_location[i].filename,path);

----- snap ------------------------------------------------------------

Stephan.

-- 
loescher@leo.org
http://www.leo.org/~loescher/
Try LEO: http://www.leo.org/

_______________________________________________
swsusp maillist  -  swsusp@lister.fornax.hu
http://lister.fornax.hu/mailman/listinfo/swsusp

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic