file.c: move swapon parser to a separate file
* swapon.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_swapon and related code to swapon.c.
diff --git a/Makefile.am b/Makefile.am
index 1cb8579..d250125 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,6 +56,7 @@
statfs.c \
strace.c \
stream.c \
+ swapon.c \
syscall.c \
sysctl.c \
sysinfo.c \
diff --git a/file.c b/file.c
index e4dd33b..d748db7 100644
--- 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 @@
}
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
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;
+}