[PATCH xserver 06/19] loader: Remove *GetOS

Adam Jackson ajax at redhat.com
Mon Jan 23 19:32:20 UTC 2017


This API is dumb.  uname(3) exists, feel free to use it, but ideally
write to the interface not to the OS.  There are a couple of drivers
using this API, they could all reasonably just not.

This also removes the OS name from the loader subdirectory path search.
Having /usr/lib/xorg shared across OSes is a non-goal here.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/common/xf86.h       |  2 --
 hw/xfree86/common/xf86Helper.c |  4 ---
 hw/xfree86/common/xf86Module.h |  2 --
 hw/xfree86/loader/Makefile.am  |  3 +-
 hw/xfree86/loader/loadmod.c    | 14 +-------
 hw/xfree86/loader/os.c         | 72 ------------------------------------------
 6 files changed, 2 insertions(+), 95 deletions(-)
 delete mode 100644 hw/xfree86/loader/os.c

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index f724688..828bff1 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -343,8 +343,6 @@ xf86SetSilkenMouse(ScreenPtr pScreen);
 extern _X_EXPORT void *
 xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, const char *port_name,
                   const char **adaptor_name, void **adaptor_options);
-extern _X_EXPORT void
-xf86GetOS(const char **name, int *major, int *minor, int *teeny);
 extern _X_EXPORT ScrnInfoPtr
 xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
                    int entityIndex, EntityProc init,
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 9388436..f48af75 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1752,10 +1752,6 @@ xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, const char *port_name,
     return NULL;
 }
 
-/* Rather than duplicate loader's get OS function, just include it directly */
-#define LoaderGetOS xf86GetOS
-#include "loader/os.c"
-
 static void
 xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
                            EntityProc enter, EntityProc leave, void *private)
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index e0212cf..cd4227a 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -176,8 +176,6 @@ extern _X_EXPORT void *LoaderSymbol(const char *);
 extern _X_EXPORT const char **LoaderListDirs(const char **, const char **);
 extern _X_EXPORT void LoaderFreeDirList(char **);
 extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
-extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
-                                  int *teeny);
 extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
 extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass);
 
diff --git a/hw/xfree86/loader/Makefile.am b/hw/xfree86/loader/Makefile.am
index 9218cab..3529a7a 100644
--- a/hw/xfree86/loader/Makefile.am
+++ b/hw/xfree86/loader/Makefile.am
@@ -14,7 +14,6 @@ EXTRA_DIST = \
 libloader_la_SOURCES = \
 	loader.c \
 	loaderProcs.h \
-        loadmod.c \
-	os.c
+        loadmod.c
 
 libloader_la_LIBADD = $(DLOPEN_LIBS)
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 03c9966..95a37fc 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -269,9 +269,7 @@ InitSubdirs(const char **subdirlist)
     const char **tmp_subdirlist = NULL;
     char **subdirs = NULL;
     const char **s, **stmp = NULL;
-    const char *osname;
-    const char *slash;
-    int oslen = 0, len;
+    int len;
     Bool indefault;
 
     if (subdirlist == NULL) {
@@ -282,9 +280,6 @@ InitSubdirs(const char **subdirlist)
         subdirlist[1] = NULL;
     }
 
-    LoaderGetOS(&osname, NULL, NULL, NULL);
-    oslen = strlen(osname);
-
     {
         /* Count number of entries and check for invalid paths */
         for (i = 0, s = subdirlist; *s; i++, s++) {
@@ -323,12 +318,8 @@ InitSubdirs(const char **subdirlist)
             }
             len = strlen(*s);
             if (**s && (*s)[len - 1] != '/') {
-                slash = "/";
                 len++;
             }
-            else
-                slash = "";
-            len += oslen + 2;
             if (!(subdirs[i] = malloc(len))) {
                 while (--i >= 0)
                     free(subdirs[i]);
@@ -336,9 +327,6 @@ InitSubdirs(const char **subdirlist)
                 free(tmp_subdirlist);
                 return NULL;
             }
-            /* tack on the OS name */
-            sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
-            i++;
             /* path as given */
             subdirs[i] = strdup(*s);
             i++;
diff --git a/hw/xfree86/loader/os.c b/hw/xfree86/loader/os.c
deleted file mode 100644
index 8d03721..0000000
--- a/hw/xfree86/loader/os.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1999-2002 by The XFree86 Project, Inc.
- *
- * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "loaderProcs.h"
-
-/*
- * OSNAME is a standard form of the OS name that may be used by the
- * loader and by OS-specific modules.  OSNAME here is different from what's in
- * dix-config.h
- */
-
-#undef OSNAME
-#if defined(__linux__)
-#define OSNAME "linux"
-#elif defined(__FreeBSD__)
-#define OSNAME "freebsd"
-#elif defined(__DragonFly__)
-#define OSNAME "dragonfly"
-#elif defined(__NetBSD__)
-#define OSNAME "netbsd"
-#elif defined(__OpenBSD__)
-#define OSNAME "openbsd"
-#elif defined(__GNU__)
-#define OSNAME "hurd"
-#elif defined(SVR4) && defined(__sun)
-#define OSNAME "solaris"
-#elif defined(SVR5)
-#define OSNAME "svr5"
-#elif defined(SVR4)
-#define OSNAME "svr4"
-#else
-#define OSNAME "unknown"
-#endif
-
-/* Return the OS name, and run-time OS version */
-
-void
-LoaderGetOS(const char **name, int *major, int *minor, int *teeny)
-{
-    if (name)
-        *name = OSNAME;
-
-    /* reporting runtime versions isn't supported yet */
-}
-- 
2.9.3



More information about the xorg-devel mailing list