]> granicus.if.org Git - strace/commitdiff
file.c: move swapon parser to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 21:37:52 +0000 (21:37 +0000)
* swapon.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_swapon and related code to swapon.c.

Makefile.am
file.c
swapon.c [new file with mode: 0644]

index 1cb85796bfcf29988fed679cc590254755953043..d250125f0f6730a1dce1049ad0bf9f3d86079709 100644 (file)
@@ -56,6 +56,7 @@ strace_SOURCES =      \
        statfs.c        \
        strace.c        \
        stream.c        \
+       swapon.c        \
        syscall.c       \
        sysctl.c        \
        sysinfo.c       \
diff --git a/file.c b/file.c
index e4dd33b6aa0b6d91048bceff1a162314ddebf3d3..d748db7b83497ab4ed969d93b64de077a4419bf0 100644 (file)
--- a/file.c
+++ b/file.c
@@ -29,7 +29,6 @@
  */
 
 #include "defs.h"
-#include <sys/swap.h>
 
 #if defined(SPARC) || defined(SPARC64)
 struct stat {
@@ -1927,26 +1926,3 @@ sys_fallocate(struct tcb *tcp)
        }
        return 0;
 }
-
-#ifndef SWAP_FLAG_PREFER
-# define SWAP_FLAG_PREFER 0x8000
-#endif
-#ifndef SWAP_FLAG_DISCARD
-# define SWAP_FLAG_DISCARD 0x10000
-#endif
-#include "xlat/swap_flags.h"
-
-int
-sys_swapon(struct tcb *tcp)
-{
-       if (entering(tcp)) {
-               int flags = tcp->u_arg[1];
-               printpath(tcp, tcp->u_arg[0]);
-               tprints(", ");
-               printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
-                       "SWAP_FLAG_???");
-               if (flags & SWAP_FLAG_PREFER)
-                       tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
-       }
-       return 0;
-}
diff --git a/swapon.c b/swapon.c
new file mode 100644 (file)
index 0000000..c26bb06
--- /dev/null
+++ b/swapon.c
@@ -0,0 +1,27 @@
+#include "defs.h"
+
+#include <sys/swap.h>
+
+#ifndef SWAP_FLAG_PREFER
+# define SWAP_FLAG_PREFER 0x8000
+#endif
+#ifndef SWAP_FLAG_DISCARD
+# define SWAP_FLAG_DISCARD 0x10000
+#endif
+
+#include "xlat/swap_flags.h"
+
+int
+sys_swapon(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               int flags = tcp->u_arg[1];
+               printpath(tcp, tcp->u_arg[0]);
+               tprints(", ");
+               printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
+                       "SWAP_FLAG_???");
+               if (flags & SWAP_FLAG_PREFER)
+                       tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
+       }
+       return 0;
+}