(submit/hotplug.h) 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>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-12 19:07:33 +01:00
parent f4edaa6b64
commit 0260e13073
15 changed files with 86 additions and 68 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"

62
config/hotplug_priv.h Normal file
View File

@ -0,0 +1,62 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
* Copyright © 2006-2007 Daniel Stone
*/
#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 "colormapst.h"
#include "cursorstr.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,9 @@
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "config/hotplug_priv.h"
#include "dix/input_priv.h"
#include "os/cmdline.h"
#include "xkbsrv.h"
#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
@ -48,12 +50,6 @@
#include "inpututils.h"
#include "optionstr.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 "os/cmdline.h"
@ -72,8 +75,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"
@ -97,7 +98,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 */