]> err.no Git - util-linux/commitdiff
swapon: move DELETED_SUFFIX to include/pathnames.h
authorKarel Zak <kzak@redhat.com>
Fri, 2 Apr 2010 09:43:36 +0000 (11:43 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 2 Apr 2010 09:43:36 +0000 (11:43 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/pathnames.h
mount/swapon.c

index 9c4eb009b60acc798f1d5f2576e091a9a1144856..7d57c528f4d013ae532dffa9740f56cbc46cba02 100644 (file)
 # error "we need an ANSI compiler"
 #endif
 
+/* used by kernel in /proc (e.g. /proc/swaps) for deleted files */
+#define PATH_DELETED_SUFFIX    "\\040(deleted)"
+#define PATH_DELETED_SUFFIX_SZ (sizeof(PATH_DELETED_SUFFIX) - 1)
+
 /* DEFPATHs from <paths.h> don't include /usr/local */
 #undef _PATH_DEFPATH
 #define        _PATH_DEFPATH           "/usr/local/bin:/bin:/usr/bin"
index 501254bc5430a6491ceee1de15f01a41367041bd..4ee3c2f75006414f3b3598da573cd2f82d3ce8fa 100644 (file)
@@ -121,9 +121,6 @@ swapoff_usage(FILE *fp, int n) {
 static int numSwaps;
 static char **swapFiles;       /* array of swap file and partition names */
 
-#define DELETED_SUFFIX         "\\040(deleted)"
-#define DELETED_SUFFIX_SZ      (sizeof(DELETED_SUFFIX) - 1)
-
 static void
 read_proc_swaps(void) {
        FILE *swaps;
@@ -163,9 +160,9 @@ read_proc_swaps(void) {
                 * in /proc/swaps, we have to remove this junk.
                 */
                sz = strlen(line);
-               if (sz > DELETED_SUFFIX_SZ) {
-                      p = line + (sz - DELETED_SUFFIX_SZ);
-                      if (strcmp(p, DELETED_SUFFIX) == 0)
+               if (sz > PATH_DELETED_SUFFIX_SZ) {
+                      p = line + (sz - PATH_DELETED_SUFFIX_SZ);
+                      if (strcmp(p, PATH_DELETED_SUFFIX) == 0)
                               *p = '\0';
                }