loader: Remove *GetOS

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.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2015-06-05 10:58:20 -04:00
parent a6fcb15472
commit 97bd6e4536
6 changed files with 2 additions and 95 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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);

View File

@ -14,7 +14,6 @@ EXTRA_DIST = \
libloader_la_SOURCES = \
loader.c \
loaderProcs.h \
loadmod.c \
os.c
loadmod.c
libloader_la_LIBADD = $(DLOPEN_LIBS)

View File

@ -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++;

View File

@ -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 */
}