include: move out private definitions from hotplug.h

Public server module API shouldn't be clobbered with private definitions,
thus move them out to private header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1360>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-12 19:07:33 +01:00
parent dda06aff96
commit e67f2a5eb5
16 changed files with 115 additions and 73 deletions

View File

@ -26,9 +26,11 @@
#include <dix-config.h>
#include <unistd.h>
#include "config/hotplug_priv.h"
#include "os.h"
#include "inputstr.h"
#include "hotplug.h"
#include "config-backends.h"
#include "systemd-logind.h"

View File

@ -26,16 +26,17 @@
#include <dix-config.h>
#include <dbus/dbus.h>
#include <hal/libhal.h>
#include <string.h>
#include <sys/select.h>
#include <dbus/dbus.h>
#include <hal/libhal.h>
#include "config/hotplug_priv.h"
#include "config/dbus-core.h"
#include "input.h"
#include "inputstr.h"
#include "hotplug.h"
#include "config-backends.h"
#include "os.h"

85
config/hotplug_priv.h Normal file
View File

@ -0,0 +1,85 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
/*
* Copyright © 2006-2007 Daniel Stone
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Daniel Stone <daniel@fooishbar.org>
*/
#ifndef _XSERVER_HOTPLUG_PRIV_H
#define _XSERVER_HOTPLUG_PRIV_H
#include <X11/Xfuncproto.h>
#include "hotplug.h"
#include "list.h"
/* Bump this each time you add something to the struct
* so that drivers can easily tell what is available
*/
#define ODEV_ATTRIBUTES_VERSION 1
struct OdevAttributes {
/* path to kernel device node - Linux e.g. /dev/dri/card0 */
char *path;
/* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
char *syspath;
/* DRI-style bus id */
char *busid;
/* Server managed FD */
int fd;
/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
int major;
/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
int minor;
/* kernel driver name */
char *driver;
};
/* Note starting with xserver 1.16 this function never fails */
struct OdevAttributes *
config_odev_allocate_attributes(void);
void
config_odev_free_attributes(struct OdevAttributes *attribs);
typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
#ifdef CONFIG_UDEV_KMS
void NewGPUDeviceRequest(struct OdevAttributes *attribs);
void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
#endif
#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
struct xf86_platform_device *
xf86_find_platform_device_by_devnum(int major, int minor);
#endif /* _XSERVER_HOTPLUG_PRIV_H */

View File

@ -29,9 +29,10 @@
#include <ctype.h>
#include <unistd.h>
#include "config/hotplug_priv.h"
#include "input.h"
#include "inputstr.h"
#include "hotplug.h"
#include "config-backends.h"
#include "os.h"
#include "globals.h"

View File

@ -84,6 +84,7 @@ Equipment Corporation.
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "config/hotplug_priv.h"
#include "dix/callback_priv.h"
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
@ -111,7 +112,6 @@ Equipment Corporation.
#include "cursorstr.h"
#include "selection.h"
#include "servermd.h"
#include "hotplug.h"
#include "dixfont.h"
#include "extnsionst.h"
#include "privates.h"

View File

@ -22,6 +22,7 @@
#include <dix-config.h>
#include "config/hotplug_priv.h"
#include "dix/screenint_priv.h"
#include "os/cmdline.h"
#include "os/ddx_priv.h"
@ -50,10 +51,6 @@
#include <execinfo.h>
#endif
#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
#include <hotplug.h>
#endif
/* This stub can be safely removed once we can
* split input and GPU parts in hotplug.h et al. */
#include <systemd-logind.h>

View File

@ -37,7 +37,11 @@
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "config/hotplug_priv.h"
#include "dix/input_priv.h"
#include "mi/mi_priv.h"
#include "mi/mipointer_priv.h"
#include "os/cmdline.h"
#include "xkbsrv.h"
#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
@ -49,14 +53,6 @@
#include "inpututils.h"
#include "optionstr.h"
#include "mi/mi_priv.h"
#include "mi/mipointer_priv.h"
#include "os/cmdline.h"
#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
#include <hotplug.h>
#endif
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
struct KdConfigDevice {

View File

@ -37,6 +37,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
#include "config/hotplug_priv.h"
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"

View File

@ -48,8 +48,11 @@
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "config/dbus-core.h"
#include "config/hotplug_priv.h"
#include "dix/input_priv.h"
#include "dix/screenint_priv.h"
#include "mi/mi_priv.h"
@ -71,8 +74,6 @@
#include "xf86cmap.h"
#include "xorgVersion.h"
#include "mipointer.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "xf86Extensions.h"
#include "xf86DDC.h"
#include "xf86Xinput.h"
@ -96,7 +97,6 @@
#include <linux/major.h>
#include <sys/sysmacros.h>
#endif
#include <hotplug.h>
void (*xf86OSPMClose) (void) = NULL;
static Bool xorgHWOpenConsole = FALSE;

View File

@ -37,10 +37,10 @@
#include <fcntl.h>
#include <unistd.h>
#include "config/hotplug_priv.h"
#include "dix/screenint_priv.h"
#include "os.h"
#include "hotplug.h"
#include "systemd-logind.h"
#include "loaderProcs.h"

View File

@ -24,7 +24,6 @@
#ifndef XF86_PLATFORM_BUS_H
#define XF86_PLATFORM_BUS_H
#include "hotplug.h"
#include "xf86MatchDrivers.h"
struct xf86_platform_device {

View File

@ -40,6 +40,7 @@
#include <X11/extensions/randr.h>
#include <X11/extensions/Xv.h>
#include "config/hotplug_priv.h"
#include "dix/dix_priv.h"
#include "xf86.h"

View File

@ -33,6 +33,7 @@
#include <unistd.h>
#include "config/dbus-core.h"
#include "config/hotplug_priv.h"
#include "os.h"
#include "linux.h"

View File

@ -10,6 +10,8 @@
#include <errno.h>
#include <string.h>
#include "config/hotplug_priv.h"
/* Linux platform device support */
#include "xf86_OSproc.h"
@ -18,7 +20,6 @@
#include "xf86platformBus.h"
#include "xf86Bus.h"
#include "hotplug.h"
#include "systemd-logind.h"
static Bool

View File

@ -53,6 +53,9 @@ void xf86OSInitVidMem(VidMemInfoPtr);
#ifdef XSERVER_PLATFORM_BUS
#include "hotplug.h"
struct OdevAttributes;
void
xf86PlatformDeviceProbe(struct OdevAttributes *attribs);

View File

@ -26,58 +26,10 @@
#ifndef HOTPLUG_H
#define HOTPLUG_H
#include "list.h"
#include <X11/Xfuncproto.h>
extern _X_EXPORT void config_pre_init(void);
extern _X_EXPORT void config_init(void);
extern _X_EXPORT void config_fini(void);
/* Bump this each time you add something to the struct
* so that drivers can easily tell what is available
*/
#define ODEV_ATTRIBUTES_VERSION 1
struct OdevAttributes {
/* path to kernel device node - Linux e.g. /dev/dri/card0 */
char *path;
/* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
char *syspath;
/* DRI-style bus id */
char *busid;
/* Server managed FD */
int fd;
/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
int major;
/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
int minor;
/* kernel driver name */
char *driver;
};
/* Note starting with xserver 1.16 this function never fails */
struct OdevAttributes *
config_odev_allocate_attributes(void);
void
config_odev_free_attributes(struct OdevAttributes *attribs);
typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
#ifdef CONFIG_UDEV_KMS
void NewGPUDeviceRequest(struct OdevAttributes *attribs);
void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
#endif
#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
struct xf86_platform_device *
xf86_find_platform_device_by_devnum(int major, int minor);
#endif /* HOTPLUG_H */