From patchwork Mon Jul 20 17:12:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Gray X-Patchwork-Id: 6829481 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5EB899F358 for ; Mon, 20 Jul 2015 17:13:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BC8F20431 for ; Mon, 20 Jul 2015 17:13:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A03AF2025A for ; Mon, 20 Jul 2015 17:13:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 873D272071; Mon, 20 Jul 2015 10:13:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lechuck.jsg.id.au (jsg.id.au [210.15.216.215]) by gabe.freedesktop.org (Postfix) with ESMTPS id 840187205A for ; Mon, 20 Jul 2015 10:12:58 -0700 (PDT) Received: from carla.jsg.id.au (carla.jsg.id.au [192.168.1.42]); by lechuck.jsg.id.au (OpenSMTPD) with ESMTP id dfa4f0dd; Tue, 21 Jul 2015 03:12:56 +1000 (AEST) Received: from carla.jsg.id.au (localhost.jsg.id.au [127.0.0.1]); by carla.jsg.id.au (OpenSMTPD) with ESMTP id 05c908f2; Tue, 21 Jul 2015 03:12:56 +1000 (AEST) From: Jonathan Gray To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm v2] xf86drm: use the correct device minor names on OpenBSD Date: Tue, 21 Jul 2015 03:12:56 +1000 Message-Id: <1437412376-18809-1-git-send-email-jsg@jsg.id.au> X-Mailer: git-send-email 2.3.0 In-Reply-To: References: Cc: emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add defines for the device minor names and make use of them in drmGetMinorName() so the correct paths will be used on OpenBSD. v2: don't add new defines to xf86drm.h to keep them out of the API as requested by Emil. Signed-off-by: Jonathan Gray --- xf86drm.c | 16 +++++++++++++--- xf86drm.h | 7 +++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index 4de5210..c365778 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -64,6 +64,16 @@ #include "xf86drm.h" #include "libdrm_macros.h" +#ifdef __OpenBSD__ +#define DRM_PRIMARY_MINOR_NAME "drm" +#define DRM_CONTROL_MINOR_NAME "drmC" +#define DRM_RENDER_MINOR_NAME "drmR" +#else +#define DRM_PRIMARY_MINOR_NAME "card" +#define DRM_CONTROL_MINOR_NAME "controlD" +#define DRM_RENDER_MINOR_NAME "renderD" +#endif + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #define DRM_MAJOR 145 #endif @@ -548,11 +558,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..e3a19dc 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -76,11 +76,18 @@ 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_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 */ +#endif #define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_ACCESS (-1002)