From 85a364a4ace102e4605c89ae9fe84071ea3afe91 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 6 Dec 2014 03:53:16 +0000 Subject: [PATCH] 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. --- Makefile.am | 1 + file.c | 24 ------------------------ swapon.c | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 swapon.c diff --git a/Makefile.am b/Makefile.am index 1cb85796..d250125f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 e4dd33b6..d748db7b 100644 --- a/file.c +++ b/file.c @@ -29,7 +29,6 @@ */ #include "defs.h" -#include #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 index 00000000..c26bb061 --- /dev/null +++ b/swapon.c @@ -0,0 +1,27 @@ +#include "defs.h" + +#include + +#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; +} -- 2.40.0