From: Denys Vlasenko Date: Sun, 17 Feb 2013 13:31:55 +0000 (+0100) Subject: Merge two identical tables X-Git-Tag: v4.8~146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86738a232d74ddea29d2b9c90e8d036f63c438fd;p=strace Merge two identical tables * defs.h: Declare whence_codes[]. * desc.c: Delete static whence[]. (printflock[64]): Use whence_codes. * file.c: Make whence_codes[] non-static. Add SEEK_DATA and SEEK_HOLE to them. Signed-off-by: Denys Vlasenko --- diff --git a/defs.h b/defs.h index 3d5f3000..a349036a 100644 --- a/defs.h +++ b/defs.h @@ -475,6 +475,7 @@ extern const struct xlat open_mode_flags[]; extern const struct xlat addrfams[]; extern const struct xlat struct_user_offsets[]; extern const struct xlat open_access_modes[]; +extern const struct xlat whence_codes[]; /* Format of syscall return values */ #define RVAL_DECIMAL 000 /* decimal format */ diff --git a/desc.c b/desc.c index 9870e9cb..65e5ed06 100644 --- a/desc.c +++ b/desc.c @@ -218,13 +218,6 @@ static const struct xlat notifyflags[] = { }; #endif -static const struct xlat whence[] = { - { SEEK_SET, "SEEK_SET" }, - { SEEK_CUR, "SEEK_CUR" }, - { SEEK_END, "SEEK_END" }, - { 0, NULL }, -}; - static const struct xlat perf_event_open_flags[] = { #ifdef PERF_FLAG_FD_NO_GROUP { PERF_FLAG_FD_NO_GROUP, "PERF_FLAG_FD_NO_GROUP" }, @@ -282,7 +275,7 @@ printflock(struct tcb *tcp, long addr, int getlk) tprints("{type="); printxval(lockfcmds, fl.l_type, "F_???"); tprints(", whence="); - printxval(whence, fl.l_whence, "SEEK_???"); + printxval(whence_codes, fl.l_whence, "SEEK_???"); tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len); if (getlk) tprintf(", pid=%lu}", (unsigned long) fl.l_pid); @@ -305,7 +298,7 @@ printflock64(struct tcb *tcp, long addr, int getlk) tprints("{type="); printxval(lockfcmds, fl.l_type, "F_???"); tprints(", whence="); - printxval(whence, fl.l_whence, "SEEK_???"); + printxval(whence_codes, fl.l_whence, "SEEK_???"); tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len); if (getlk) tprintf(", pid=%lu}", (unsigned long) fl.l_pid); diff --git a/file.c b/file.c index e5354487..bea53121 100644 --- a/file.c +++ b/file.c @@ -516,10 +516,16 @@ sys_umask(struct tcb *tcp) return RVAL_OCTAL; } -static const struct xlat whence_codes[] = { +const struct xlat whence_codes[] = { { SEEK_SET, "SEEK_SET" }, { SEEK_CUR, "SEEK_CUR" }, { SEEK_END, "SEEK_END" }, +#ifdef SEEK_DATA + { SEEK_DATA, "SEEK_DATA" }, +#endif +#ifdef SEEK_HOLE + { SEEK_HOLE, "SEEK_HOLE" }, +#endif { 0, NULL }, };