From d35fd59ebd129d26cc7bf3180a58182e41361c2e Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Wed, 29 Jan 2020 19:45:29 +0100
Subject: [PATCH 86/86] v4l2: provide V4L2_CTRL_FLAG_NEXT_CTRL in an xlat
---
tests/ioctl_v4l2.c | 9 ++++-----
v4l2.c | 3 +--
2 files changed, 5 insertions(+), 7 deletions(-)
Index: strace-5.1/tests/ioctl_v4l2.c
===================================================================
--- strace-5.1.orig/tests/ioctl_v4l2.c 2020-01-29 21:14:03.918926110 +0100
+++ strace-5.1/tests/ioctl_v4l2.c 2020-01-29 21:15:20.737200682 +0100
@@ -14,6 +14,10 @@
#include <linux/types.h>
#include <linux/videodev2.h>
+#ifndef V4L2_CTRL_FLAG_NEXT_CTRL
+# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
+#endif
+
#define cc0(arg) ((unsigned int) (unsigned char) (arg))
#define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8))
#define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16))
@@ -748,14 +752,9 @@
struct v4l2_queryctrl *const p_v4l2_queryctrl =
page_end - sizeof(*p_v4l2_queryctrl);
ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl);
-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL"
"|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n",
p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL);
-#else
- printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})"
- " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id);
-#endif
TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl);
p_queryctrl->id = V4L2_CID_SATURATION;
Index: strace-5.1/v4l2.c
===================================================================
--- strace-5.1.orig/v4l2.c 2020-01-29 21:15:19.011216936 +0100
+++ strace-5.1/v4l2.c 2020-01-29 21:15:20.738200672 +0100
@@ -954,6 +954,7 @@
#include "xlat/v4l2_control_types.h"
#include "xlat/v4l2_control_flags.h"
+#include "xlat/v4l2_control_query_flags.h"
static int
print_v4l2_queryctrl(struct tcb *const tcp, const kernel_ulong_t arg)
@@ -975,7 +976,6 @@
}
if (entering(tcp) || get_tcb_priv_ulong(tcp)) {
-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
const unsigned long next = c.id & V4L2_CTRL_FLAG_NEXT_CTRL;
set_tcb_priv_ulong(tcp, next);
if (next) {
@@ -983,7 +983,6 @@
tprints("|");
c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
}
-#endif
printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
}
Index: strace-5.1/tests-m32/ioctl_v4l2.c
===================================================================
--- strace-5.1.orig/tests-m32/ioctl_v4l2.c 2020-01-29 21:14:03.918926110 +0100
+++ strace-5.1/tests-m32/ioctl_v4l2.c 2020-01-29 21:15:20.739200663 +0100
@@ -14,6 +14,10 @@
#include <linux/types.h>
#include <linux/videodev2.h>
+#ifndef V4L2_CTRL_FLAG_NEXT_CTRL
+# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
+#endif
+
#define cc0(arg) ((unsigned int) (unsigned char) (arg))
#define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8))
#define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16))
@@ -748,14 +752,9 @@
struct v4l2_queryctrl *const p_v4l2_queryctrl =
page_end - sizeof(*p_v4l2_queryctrl);
ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl);
-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL"
"|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n",
p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL);
-#else
- printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})"
- " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id);
-#endif
TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl);
p_queryctrl->id = V4L2_CID_SATURATION;
Index: strace-5.1/tests-mx32/ioctl_v4l2.c
===================================================================
--- strace-5.1.orig/tests-mx32/ioctl_v4l2.c 2020-01-29 21:14:03.918926110 +0100
+++ strace-5.1/tests-mx32/ioctl_v4l2.c 2020-01-29 21:15:20.740200653 +0100
@@ -14,6 +14,10 @@
#include <linux/types.h>
#include <linux/videodev2.h>
+#ifndef V4L2_CTRL_FLAG_NEXT_CTRL
+# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
+#endif
+
#define cc0(arg) ((unsigned int) (unsigned char) (arg))
#define cc1(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 8))
#define cc2(arg) ((unsigned int) (unsigned char) ((unsigned int) (arg) >> 16))
@@ -748,14 +752,9 @@
struct v4l2_queryctrl *const p_v4l2_queryctrl =
page_end - sizeof(*p_v4l2_queryctrl);
ioctl(-1, VIDIOC_QUERYCTRL, p_v4l2_queryctrl);
-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL"
"|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n",
p_v4l2_queryctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL);
-#else
- printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})"
- " = -1 EBADF (%m)\n", p_v4l2_queryctrl->id);
-#endif
TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_queryctrl, p_queryctrl);
p_queryctrl->id = V4L2_CID_SATURATION;
Index: strace-5.1/xlat/v4l2_control_query_flags.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ strace-5.1/xlat/v4l2_control_query_flags.h 2020-01-29 21:16:03.273800088 +0100
@@ -0,0 +1,40 @@
+/* Generated by ./xlat/gen.sh from ./xlat/v4l2_control_query_flags.in; do not edit. */
+
+#include "gcc_compat.h"
+#include "static_assert.h"
+
+#if defined(V4L2_CTRL_FLAG_NEXT_CTRL) || (defined(HAVE_DECL_V4L2_CTRL_FLAG_NEXT_CTRL) && HAVE_DECL_V4L2_CTRL_FLAG_NEXT_CTRL)
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_CTRL_FLAG_NEXT_CTRL) == (0x80000000), "V4L2_CTRL_FLAG_NEXT_CTRL != 0x80000000");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
+#endif
+#if defined(V4L2_CTRL_FLAG_NEXT_COMPOUND) || (defined(HAVE_DECL_V4L2_CTRL_FLAG_NEXT_COMPOUND) && HAVE_DECL_V4L2_CTRL_FLAG_NEXT_COMPOUND)
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((V4L2_CTRL_FLAG_NEXT_COMPOUND) == (0x40000000), "V4L2_CTRL_FLAG_NEXT_COMPOUND != 0x40000000");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define V4L2_CTRL_FLAG_NEXT_COMPOUND 0x40000000
+#endif
+
+#ifndef XLAT_MACROS_ONLY
+
+# ifdef IN_MPERS
+
+extern const struct xlat v4l2_control_query_flags[];
+
+# else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat v4l2_control_query_flags[] = {
+ XLAT(V4L2_CTRL_FLAG_NEXT_CTRL),
+ XLAT(V4L2_CTRL_FLAG_NEXT_COMPOUND),
+ XLAT_END
+};
+
+# endif /* !IN_MPERS */
+
+#endif /* !XLAT_MACROS_ONLY */