From fd77dbfa68f35e67b3f9d3cc64cdb7f3ad3abae4 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 8 Feb 2024 16:03:56 +0100 Subject: [PATCH] (submit/split-client.h) os: split off internal definitions from client.h The client.h file is part of the public module API, but it also contains definitions that aren't useful for being used in modules. Splitting them out into their own client_priv.h file, which isn't part of the API. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xres.c | 2 +- Xext/xselinux_hooks.c | 2 +- dix/dispatch.c | 2 +- dix/main.c | 2 +- include/client.h | 16 +++------------- include/dixstruct.h | 4 +++- os/client.c | 6 ++++-- os/client_priv.h | 27 +++++++++++++++++++++++++++ 8 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 os/client_priv.h diff --git a/Xext/xres.c b/Xext/xres.c index b54bf99ed..cc9edb47f 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -15,6 +15,7 @@ #include "dix/registry_priv.h" #include "miext/extinit_priv.h" +#include "os/client_priv.h" #include "misc.h" #include "os.h" @@ -25,7 +26,6 @@ #include "windowstr.h" #include "gcstruct.h" #include "protocol-versions.h" -#include "client.h" #include "list.h" #include "misc.h" #include "hashtable.h" diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c index f083385e9..50c5254d4 100644 --- a/Xext/xselinux_hooks.c +++ b/Xext/xselinux_hooks.c @@ -36,6 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dix/registry_priv.h" #include "dix/selection_priv.h" +#include "os/client_priv.h" #include "inputstr.h" #include "scrnintstr.h" @@ -43,7 +44,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "propertyst.h" #include "extnsionst.h" #include "xacestr.h" -#include "client.h" #define _XSELINUX_NEED_FLASK_MAP #include "xselinuxint.h" diff --git a/dix/dispatch.c b/dix/dispatch.c index 532d4616b..450eec305 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -114,6 +114,7 @@ Equipment Corporation. #include "include/resource.h" #include "miext/extinit_priv.h" #include "os/auth.h" +#include "os/client_priv.h" #include "os/ddx_priv.h" #include "os/osdep.h" @@ -134,7 +135,6 @@ Equipment Corporation. #include "xace.h" #include "inputstr.h" #include "xkbsrv.h" -#include "client.h" #include "xfixesint.h" #include "dixstruct_priv.h" diff --git a/dix/main.c b/dix/main.c index 78774a12d..f61e911d0 100644 --- a/dix/main.c +++ b/dix/main.c @@ -93,6 +93,7 @@ Equipment Corporation. #include "dix/selection_priv.h" #include "os/audit.h" #include "os/auth.h" +#include "os/client_priv.h" #include "os/cmdline.h" #include "os/ddx_priv.h" #include "os/osdep.h" @@ -113,7 +114,6 @@ Equipment Corporation. #include "dixfont.h" #include "extnsionst.h" #include "privates.h" -#include "client.h" #include "exevents.h" #ifdef PANORAMIX #include "panoramiXsrv.h" diff --git a/include/client.h b/include/client.h index 87f2b1172..8ecd41704 100644 --- a/include/client.h +++ b/include/client.h @@ -29,22 +29,12 @@ #ifdef HAVE_DIX_CONFIG_H #include #endif /* HAVE_DIX_CONFIG_H */ -#include -#include -/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs - * instead of accessing the fields directly. */ -typedef struct { - pid_t pid; /* process ID, -1 if not available */ - const char *cmdname; /* process name, NULL if not available */ - const char *cmdargs; /* process arguments, NULL if not available */ -} ClientIdRec, *ClientIdPtr; +#include +#include struct _Client; - -/* Initialize and clean up. */ -void ReserveClientIds(struct _Client *client); -void ReleaseClientIds(struct _Client *client); +typedef struct _ClientId *ClientIdPtr; /* Determine client IDs for caching. Exported on purpose for * extensions such as SELinux. */ diff --git a/include/dixstruct.h b/include/dixstruct.h index c16d00f7d..875565877 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -76,6 +76,8 @@ typedef struct _saveSet { /* currently largest one in use is 4 */ #define MAX_CLIENT_RECV_FD 8 +struct _ClientId; + typedef struct _Client { void *requestBuffer; void *osPrivate; /* for OS layer, including scheduler */ @@ -112,7 +114,7 @@ typedef struct _Client { int smart_stop_tick; DeviceIntPtr clientPtr; - ClientIdPtr clientIds; + struct _ClientId *clientIds; int recv_fd_count; int recv_fd_list[MAX_CLIENT_RECV_FD]; diff --git a/os/client.c b/os/client.c index 6a119afc1..fe2ecaa38 100644 --- a/os/client.c +++ b/os/client.c @@ -50,12 +50,14 @@ * * Author: Rami Ylimäki */ +#include #include #include #include -#include "client.h" +#include "os/client_priv.h" + #include "os.h" #include "dixstruct.h" @@ -445,7 +447,7 @@ ReserveClientIds(struct _Client *client) return; assert(!client->clientIds); - client->clientIds = calloc(1, sizeof(ClientIdRec)); + client->clientIds = calloc(1, sizeof(struct _ClientId)); if (!client->clientIds) return; diff --git a/os/client_priv.h b/os/client_priv.h new file mode 100644 index 000000000..176e72045 --- /dev/null +++ b/os/client_priv.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + * Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). + */ +#ifndef _XSERVER_DIX_CLIENT_PRIV_H +#define _XSERVER_DIX_CLIENT_PRIV_H + +#include + +#include "client.h" + +/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs + * instead of accessing the fields directly. */ +struct _ClientId { + pid_t pid; /* process ID, -1 if not available */ + const char *cmdname; /* process name, NULL if not available */ + const char *cmdargs; /* process arguments, NULL if not available */ +}; + +struct _Client; + +/* Initialize and clean up. */ +void ReserveClientIds(struct _Client *client); +void ReleaseClientIds(struct _Client *client); + +#endif /* _XSERVER_DIX_CLIENT_PRIV_H */