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 <vda.linux@googlemail.com>
diff --git a/defs.h b/defs.h
index 3d5f300..a349036 100644
--- a/defs.h
+++ b/defs.h
@@ -475,6 +475,7 @@
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 9870e9c..65e5ed0 100644
--- a/desc.c
+++ b/desc.c
@@ -218,13 +218,6 @@
};
#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 @@
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 @@
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 e535448..bea5312 100644
--- a/file.c
+++ b/file.c
@@ -516,10 +516,16 @@
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 },
};