Message ID | 1437254414-831-1-git-send-email-jsg@jsg.id.au (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Jonathan, On 18 July 2015 at 22:20, Jonathan Gray <jsg@jsg.id.au> wrote: > Add defines for the device minor names and make use of them > in drmGetMinorName() so the correct paths will be used on OpenBSD. > > Signed-off-by: Jonathan Gray <jsg@jsg.id.au> > --- > xf86drm.c | 6 +++--- > xf86drm.h | 15 +++++++++++++++ > 2 files changed, 18 insertions(+), 3 deletions(-) > > diff --git a/xf86drm.c b/xf86drm.c > index 4de5210..7d7f9c7 100644 > --- a/xf86drm.c > +++ b/xf86drm.c > @@ -548,11 +548,11 @@ static const char *drmGetMinorName(int type) > { > switch (type) { > case DRM_NODE_PRIMARY: > - return "card"; > + return DRM_PRIMARY_MINOR_NAME; > case DRM_NODE_CONTROL: > - return "controlD"; > + return DRM_CONTROL_MINOR_NAME; > case DRM_NODE_RENDER: > - return "renderD"; > + return DRM_RENDER_MINOR_NAME; > default: > return NULL; > } > diff --git a/xf86drm.h b/xf86drm.h > index 40c55c9..d54ba51 100644 > --- a/xf86drm.h > +++ b/xf86drm.h > @@ -76,12 +76,27 @@ extern "C" { > (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) > #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) > > +#ifdef __OpenBSD__ > +#define DRM_PRIMARY_MINOR_NAME "drm" > +#define DRM_CONTROL_MINOR_NAME "drmC" > +#define DRM_RENDER_MINOR_NAME "drmR" > + Can we please not expose these via the public API ? I'm pondering about doing some API cleanup/deprecation (as I get some feedback and an extra function or two). Having these as is, makes it easier to abuse. Thanks Emil
diff --git a/xf86drm.c b/xf86drm.c index 4de5210..7d7f9c7 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -548,11 +548,11 @@ static const char *drmGetMinorName(int type) { switch (type) { case DRM_NODE_PRIMARY: - return "card"; + return DRM_PRIMARY_MINOR_NAME; case DRM_NODE_CONTROL: - return "controlD"; + return DRM_CONTROL_MINOR_NAME; case DRM_NODE_RENDER: - return "renderD"; + return DRM_RENDER_MINOR_NAME; default: return NULL; } diff --git a/xf86drm.h b/xf86drm.h index 40c55c9..d54ba51 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -76,12 +76,27 @@ extern "C" { (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) +#ifdef __OpenBSD__ +#define DRM_PRIMARY_MINOR_NAME "drm" +#define DRM_CONTROL_MINOR_NAME "drmC" +#define DRM_RENDER_MINOR_NAME "drmR" + +#define DRM_DIR_NAME "/dev" +#define DRM_DEV_NAME "%s/drm%d" +#define DRM_CONTROL_DEV_NAME "%s/drmC%d" +#define DRM_RENDER_DEV_NAME "%s/drmR%d" +#else #define DRM_DIR_NAME "/dev/dri" #define DRM_DEV_NAME "%s/card%d" #define DRM_CONTROL_DEV_NAME "%s/controlD%d" #define DRM_RENDER_DEV_NAME "%s/renderD%d" #define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ +#define DRM_PRIMARY_MINOR_NAME "card" +#define DRM_CONTROL_MINOR_NAME "controlD" +#define DRM_RENDER_MINOR_NAME "renderD" +#endif + #define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_ACCESS (-1002) #define DRM_ERR_NOT_ROOT (-1003)
Add defines for the device minor names and make use of them in drmGetMinorName() so the correct paths will be used on OpenBSD. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> --- xf86drm.c | 6 +++--- xf86drm.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-)