mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
xfree86: loader: simplify setting IgnoreABI option
IgnoreABI option is kept in a single bit of an unsigned long variable
LoaderOptions that has no other use.
This patch replaces it with a variable named LoaderIgnoreAbi
and a proc for setting it.
Inspired by b61b35a0b3
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
committed by
Enrico Weigelt
parent
3df2ae1c9e
commit
8522803f8c
@@ -333,7 +333,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
||||
LoaderSetPath(xf86ModulePath);
|
||||
|
||||
if (xf86Info.ignoreABI) {
|
||||
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
|
||||
LoaderSetIgnoreAbi();
|
||||
}
|
||||
|
||||
if (xf86DoShowOptions)
|
||||
@@ -963,7 +963,7 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(argv[i], "-ignoreABI")) {
|
||||
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
|
||||
LoaderSetIgnoreAbi();
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(argv[i], "-verbose")) {
|
||||
|
||||
@@ -146,21 +146,22 @@ LoaderUnload(const char *name, void *handle)
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
unsigned long LoaderOptions = 0;
|
||||
|
||||
Bool LoaderIgnoreAbi = FALSE;
|
||||
Bool is_nvidia_proprietary = FALSE;
|
||||
|
||||
void
|
||||
LoaderSetOptions(unsigned long opts)
|
||||
LoaderSetIgnoreAbi(void)
|
||||
{
|
||||
LoaderOptions |= opts;
|
||||
/* Only used to keep consistency with the loader api */
|
||||
/* This really doesn't have to be a proc */
|
||||
LoaderIgnoreAbi = TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
LoaderShouldIgnoreABI(void)
|
||||
{
|
||||
/* The nvidia proprietary DDX driver calls this deprecated function */
|
||||
return is_nvidia_proprietary || (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL);
|
||||
return is_nvidia_proprietary || LoaderIgnoreAbi;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -68,7 +68,7 @@ typedef struct {
|
||||
} ModuleVersions;
|
||||
extern const ModuleVersions LoaderVersionInfo;
|
||||
|
||||
extern unsigned long LoaderOptions;
|
||||
extern Bool LoaderIgnoreAbi;
|
||||
|
||||
extern Bool is_nvidia_proprietary;
|
||||
|
||||
|
||||
@@ -79,11 +79,9 @@ void LoaderUnload(const char *, void *);
|
||||
unsigned long LoaderGetModuleVersion(ModuleDescPtr mod);
|
||||
|
||||
void LoaderResetOptions(void);
|
||||
void LoaderSetOptions(unsigned long);
|
||||
|
||||
void LoaderSetIgnoreAbi(void);
|
||||
|
||||
const char **LoaderListDir(const char *, const char **);
|
||||
|
||||
/* Options for LoaderSetOptions */
|
||||
#define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001
|
||||
|
||||
#endif /* _LOADERPROCS_H */
|
||||
|
||||
@@ -457,27 +457,19 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
|
||||
vermaj = GET_ABI_MAJOR(ver);
|
||||
vermin = GET_ABI_MINOR(ver);
|
||||
if (abimaj != vermaj) {
|
||||
MessageType errtype;
|
||||
if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
|
||||
errtype = X_WARNING;
|
||||
else
|
||||
errtype = X_ERROR;
|
||||
LogMessageVerb(errtype, 0, "%s: module ABI major version (%d) "
|
||||
LogMessageVerb(LoaderIgnoreAbi ? X_WARNING : X_ERROR, 0,
|
||||
"%s: module ABI major version (%d) "
|
||||
"doesn't match the server's version (%d)\n",
|
||||
module, abimaj, vermaj);
|
||||
if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
|
||||
if (!LoaderIgnoreAbi)
|
||||
return FALSE;
|
||||
}
|
||||
else if (abimin > vermin) {
|
||||
MessageType errtype;
|
||||
if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
|
||||
errtype = X_WARNING;
|
||||
else
|
||||
errtype = X_ERROR;
|
||||
LogMessageVerb(errtype, 0, "%s: module ABI minor version (%d) "
|
||||
LogMessageVerb(LoaderIgnoreAbi ? X_WARNING : X_ERROR, 0,
|
||||
"%s: module ABI minor version (%d) "
|
||||
"is newer than the server's version (%d)\n",
|
||||
module, abimin, vermin);
|
||||
if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
|
||||
if (!LoaderIgnoreAbi)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user