From: Leo Izen <leo.izen@gmail.com>
To: linux-media@vger.kernel.org
Subject: [v4l-utils] [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public, header
Date: Wed, 4 Jun 2025 14:58:08 -0400 [thread overview]
Message-ID: <f75fa09d-190e-47f9-99f0-e2f1b1637e51@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3223 bytes --]
From b80603d4088fd30fd9d7b6b56490e7e138551e9d Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen@gmail.com>
Date: Wed, 4 Jun 2025 14:50:05 -0400
Subject: [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public
header
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
[-- Attachment #2: 0001-libv4l2-prefix-HAVE_POSIX_IOCTL-with-LIBV4L_-for-pub.patch --]
[-- Type: text/x-patch, Size: 3193 bytes --]
From b80603d4088fd30fd9d7b6b56490e7e138551e9d Mon Sep 17 00:00:00 2001
From: Leo Izen <leo.izen@gmail.com>
Date: Wed, 4 Jun 2025 14:50:05 -0400
Subject: [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public
header
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
next reply other threads:[~2025-06-04 18:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 18:58 Leo Izen [this message]
2025-06-05 12:56 ` [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public header Leo Izen
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=f75fa09d-190e-47f9-99f0-e2f1b1637e51@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.