All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Izen <leo.izen@gmail.com>
To: linux-media@vger.kernel.org
Cc: Leo Izen <leo.izen@gmail.com>
Subject: [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public header
Date: Thu,  5 Jun 2025 08:56:51 -0400	[thread overview]
Message-ID: <20250605125822.104842-1-leo.izen@gmail.com> (raw)
In-Reply-To: <f75fa09d-190e-47f9-99f0-e2f1b1637e51@gmail.com>

Commit fd882f9e77b13cbc6a669e6836c3943393b44152 introduced the flag
HAVE_POSIX_IOCTL to change which v4l2_ioctl function is declared in
libv4l2.h, but this is a public header and may conflict with another
project which may use HAVE_POSIX_IOCTL on its own to determine which
ioctl funtion it should declare.

This commit namespaces the flag so it can't conflict with another
project's configuration. Notably, if it uses #if instead of #ifdef and
defines HAVE_POSIX_IOCTL to be 0, then it will create an incompatible
function signature between v4l2_ioctl and the project's.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
 lib/include/libv4l2.h     | 2 +-
 lib/libv4l1/v4l1compat.c  | 2 +-
 lib/libv4l2/libv4l2.c     | 2 +-
 lib/libv4l2/v4l2convert.c | 2 +-
 meson.build               | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
index 16565555..25ababc7 100644
--- a/lib/include/libv4l2.h
+++ b/lib/include/libv4l2.h
@@ -63,7 +63,7 @@ LIBV4L_PUBLIC extern FILE *v4l2_log_file;
 LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
 LIBV4L_PUBLIC int v4l2_close(int fd);
 LIBV4L_PUBLIC int v4l2_dup(int fd);
-#ifdef HAVE_POSIX_IOCTL
+#ifdef LIBV4L_HAVE_POSIX_IOCTL
 LIBV4L_PUBLIC int v4l2_ioctl(int fd, int request, ...);
 #else
 LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c
index 2db68423..c4ca3a70 100644
--- a/lib/libv4l1/v4l1compat.c
+++ b/lib/libv4l1/v4l1compat.c
@@ -90,7 +90,7 @@ LIBV4L_PUBLIC int dup(int fd)
 	return v4l1_dup(fd);
 }
 
-#ifdef HAVE_POSIX_IOCTL
+#ifdef LIBV4L_HAVE_POSIX_IOCTL
 LIBV4L_PUBLIC int ioctl(int fd, int request, ...)
 #else
 LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...)
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 1607ec35..289501d9 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -1051,7 +1051,7 @@ static int v4l2_s_fmt(int index, struct v4l2_format *dest_fmt)
 	return 0;
 }
 
-#ifdef HAVE_POSIX_IOCTL
+#ifdef LIBV4L_HAVE_POSIX_IOCTL
 int v4l2_ioctl(int fd, int request, ...)
 #else
 int v4l2_ioctl(int fd, unsigned long int request, ...)
diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c
index 396ed3ea..b33472e5 100644
--- a/lib/libv4l2/v4l2convert.c
+++ b/lib/libv4l2/v4l2convert.c
@@ -123,7 +123,7 @@ LIBV4L_PUBLIC int dup(int fd)
 	return v4l2_dup(fd);
 }
 
-#ifdef HAVE_POSIX_IOCTL
+#ifdef LIBV4L_HAVE_POSIX_IOCTL
 LIBV4L_PUBLIC int ioctl(int fd, int request, ...)
 #else
 LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...)
diff --git a/meson.build b/meson.build
index 88781e59..590ef11e 100644
--- a/meson.build
+++ b/meson.build
@@ -365,7 +365,7 @@ ioctl_posix_test = '''
 int ioctl (int, int, ...);
 '''
 if cc.compiles(ioctl_posix_test)
-    conf.set('HAVE_POSIX_IOCTL', 1)
+    conf.set('LIBV4L_HAVE_POSIX_IOCTL', 1)
 endif
 
 c_arguments = []
-- 
2.49.0


      reply	other threads:[~2025-06-05 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 18:58 [v4l-utils] [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public, header Leo Izen
2025-06-05 12:56 ` Leo Izen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250605125822.104842-1-leo.izen@gmail.com \
    --to=leo.izen@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.