Date: Mon, 20 Oct 2025 04:29:12 GMT From: Zhenlei Huang <zlei@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 790c27317ec1 - main - linux: Make the macro LINUX_IOCTL_SET public Message-ID: <202510200429.59K4TCqI001832@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=790c27317ec1a997a4e5c2bdee9e4acc610c8e3c commit 790c27317ec1a997a4e5c2bdee9e4acc610c8e3c Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2025-10-20 04:28:41 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-10-20 04:28:41 +0000 linux: Make the macro LINUX_IOCTL_SET public There're some other drivers want to register and unregister linux ioctl handler. Move the macro LINUX_IOCTL_SET from tdfx_linux.h to linux_ioctl.h so that they can also benefit it. While here, rename the declaration of linux ioctl function to be consistent with the name of the handler. Meanwhile, drop a comment about the macro, since its function is obvious. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53158 --- sys/compat/linux/linux_ioctl.h | 12 ++++++++++++ sys/dev/tdfx/tdfx_linux.c | 2 +- sys/dev/tdfx/tdfx_linux.h | 12 ------------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h index ccc25bc919ab..8345b7e4b719 100644 --- a/sys/compat/linux/linux_ioctl.h +++ b/sys/compat/linux/linux_ioctl.h @@ -823,4 +823,16 @@ int linux32_ioctl_register_handler(struct linux_ioctl_handler *h); int linux32_ioctl_unregister_handler(struct linux_ioctl_handler *h); #endif +#define LINUX_IOCTL_SET(n, low, high) \ +static linux_ioctl_function_t n##_linux_ioctl; \ +static struct linux_ioctl_handler n##_linux_handler = { \ + n##_linux_ioctl, \ + low, \ + high \ +}; \ +SYSINIT(n##_ioctl_register, SI_SUB_KLD, SI_ORDER_MIDDLE, \ + linux_ioctl_register_handler, &n##_linux_handler); \ +SYSUNINIT(n##_ioctl_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, \ + linux_ioctl_unregister_handler, &n##_linux_handler) + #endif /* !_LINUX_IOCTL_H_ */ diff --git a/sys/dev/tdfx/tdfx_linux.c b/sys/dev/tdfx/tdfx_linux.c index f3410106bad2..777144d21bb6 100644 --- a/sys/dev/tdfx/tdfx_linux.c +++ b/sys/dev/tdfx/tdfx_linux.c @@ -42,7 +42,7 @@ LINUX_IOCTL_SET(tdfx, LINUX_IOCTL_TDFX_MIN, LINUX_IOCTL_TDFX_MAX); * Linux emulation IOCTL for /dev/tdfx */ static int -linux_ioctl_tdfx(struct thread *td, struct linux_ioctl_args* args) +tdfx_linux_ioctl(struct thread *td, struct linux_ioctl_args* args) { cap_rights_t rights; int error = 0; diff --git a/sys/dev/tdfx/tdfx_linux.h b/sys/dev/tdfx/tdfx_linux.h index b87cb41f38fe..9d012c12274b 100644 --- a/sys/dev/tdfx/tdfx_linux.h +++ b/sys/dev/tdfx/tdfx_linux.h @@ -35,18 +35,6 @@ #include <machine/../linux/linux_proto.h> #include <compat/linux/linux_ioctl.h> -/* - * This code was donated by Vladimir N. Silynaev to allow for defining - * ioctls within modules - */ -#define LINUX_IOCTL_SET(n,low,high) \ -static linux_ioctl_function_t linux_ioctl_##n; \ -static struct linux_ioctl_handler n##_handler = {linux_ioctl_##n, low, high}; \ -SYSINIT(n##register, SI_SUB_KLD, SI_ORDER_MIDDLE,\ -linux_ioctl_register_handler, &n##_handler); \ -SYSUNINIT(n##unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,\ -linux_ioctl_unregister_handler, &n##_handler); - /* Values for /dev/3dfx */ /* Query IOCTLs */ #define LINUX_IOCTL_TDFX_QUERY_BOARDS 0x3302home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510200429.59K4TCqI001832>
