]> granicus.if.org Git - strace/commitdiff
Implement decoding of fallocate FALLOC_FL_* flags
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 21:40:23 +0000 (21:40 +0000)
* xlat/falloc_flags.in: New file.
* configure.ac (AC_CHECK_HEADERS): Add linux/falloc.h.
* fallocate.c [HAVE_LINUX_FALLOC_H]: Include <linux/falloc.h>.
Include xlat/falloc_flags.h.
(sys_fallocate): Decode flags.

configure.ac
fallocate.c
xlat/falloc_flags.in [new file with mode: 0644]

index 8dba8afd7c24564c6cdbbd5563d9b9c5c753bfb0..fbd8a83d360f15143e331688f964ff0597e496bb 100644 (file)
@@ -232,6 +232,7 @@ AC_CHECK_HEADERS(m4_normalize([
        elf.h
        inttypes.h
        ioctls.h
+       linux/falloc.h
        linux/perf_event.h
        linux/ptrace.h
        linux/utsname.h
index c906cc53350e7a66196e831547e2e035a54958ef..990106d2288649a0979fda44b65e7a613d9eb028 100644 (file)
@@ -1,14 +1,30 @@
 #include "defs.h"
 
+#ifdef HAVE_LINUX_FALLOC_H
+# include <linux/falloc.h>
+#endif
+
+#include "xlat/falloc_flags.h"
+
 int
 sys_fallocate(struct tcb *tcp)
 {
        if (entering(tcp)) {
                int argn;
-               printfd(tcp, tcp->u_arg[0]);            /* fd */
-               tprintf(", %#lo, ", tcp->u_arg[1]);     /* mode */
-               argn = printllval(tcp, "%llu, ", 2);    /* offset */
-               printllval(tcp, "%llu", argn);          /* len */
+
+               /* fd */
+               printfd(tcp, tcp->u_arg[0]);
+               tprints(", ");
+
+               /* mode */
+               printflags(falloc_flags, tcp->u_arg[1], "FALLOC_FL_???");
+               tprints(", ");
+
+               /* offset */
+               argn = printllval(tcp, "%llu, ", 2);
+
+               /* len */
+               printllval(tcp, "%llu", argn);
        }
        return 0;
 }
diff --git a/xlat/falloc_flags.in b/xlat/falloc_flags.in
new file mode 100644 (file)
index 0000000..ff411bb
--- /dev/null
@@ -0,0 +1,5 @@
+FALLOC_FL_KEEP_SIZE
+FALLOC_FL_PUNCH_HOLE
+FALLOC_FL_NO_HIDE_STALE
+FALLOC_FL_COLLAPSE_RANGE
+FALLOC_FL_ZERO_RANGE