Skip to content

Commit 8522803

Browse files
stefan11111metux
authored andcommitted
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 b61b35a Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
1 parent 3df2ae1 commit 8522803

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

hw/xfree86/common/xf86Init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
333333
LoaderSetPath(xf86ModulePath);
334334

335335
if (xf86Info.ignoreABI) {
336-
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
336+
LoaderSetIgnoreAbi();
337337
}
338338

339339
if (xf86DoShowOptions)
@@ -963,7 +963,7 @@ ddxProcessArgument(int argc, char **argv, int i)
963963
return 1;
964964
}
965965
if (!strcmp(argv[i], "-ignoreABI")) {
966-
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
966+
LoaderSetIgnoreAbi();
967967
return 1;
968968
}
969969
if (!strcmp(argv[i], "-verbose")) {

hw/xfree86/loader/loader.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,22 @@ LoaderUnload(const char *name, void *handle)
146146
dlclose(handle);
147147
}
148148

149-
unsigned long LoaderOptions = 0;
150-
149+
Bool LoaderIgnoreAbi = FALSE;
151150
Bool is_nvidia_proprietary = FALSE;
152151

153152
void
154-
LoaderSetOptions(unsigned long opts)
153+
LoaderSetIgnoreAbi(void)
155154
{
156-
LoaderOptions |= opts;
155+
/* Only used to keep consistency with the loader api */
156+
/* This really doesn't have to be a proc */
157+
LoaderIgnoreAbi = TRUE;
157158
}
158159

159160
Bool
160161
LoaderShouldIgnoreABI(void)
161162
{
162163
/* The nvidia proprietary DDX driver calls this deprecated function */
163-
return is_nvidia_proprietary || (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL);
164+
return is_nvidia_proprietary || LoaderIgnoreAbi;
164165
}
165166

166167
int

hw/xfree86/loader/loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ typedef struct {
6868
} ModuleVersions;
6969
extern const ModuleVersions LoaderVersionInfo;
7070

71-
extern unsigned long LoaderOptions;
71+
extern Bool LoaderIgnoreAbi;
7272

7373
extern Bool is_nvidia_proprietary;
7474

hw/xfree86/loader/loaderProcs.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ void LoaderUnload(const char *, void *);
7979
unsigned long LoaderGetModuleVersion(ModuleDescPtr mod);
8080

8181
void LoaderResetOptions(void);
82-
void LoaderSetOptions(unsigned long);
8382

84-
const char **LoaderListDir(const char *, const char **);
83+
void LoaderSetIgnoreAbi(void);
8584

86-
/* Options for LoaderSetOptions */
87-
#define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001
85+
const char **LoaderListDir(const char *, const char **);
8886

8987
#endif /* _LOADERPROCS_H */

hw/xfree86/loader/loadmod.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -457,27 +457,19 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
457457
vermaj = GET_ABI_MAJOR(ver);
458458
vermin = GET_ABI_MINOR(ver);
459459
if (abimaj != vermaj) {
460-
MessageType errtype;
461-
if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
462-
errtype = X_WARNING;
463-
else
464-
errtype = X_ERROR;
465-
LogMessageVerb(errtype, 0, "%s: module ABI major version (%d) "
460+
LogMessageVerb(LoaderIgnoreAbi ? X_WARNING : X_ERROR, 0,
461+
"%s: module ABI major version (%d) "
466462
"doesn't match the server's version (%d)\n",
467463
module, abimaj, vermaj);
468-
if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
464+
if (!LoaderIgnoreAbi)
469465
return FALSE;
470466
}
471467
else if (abimin > vermin) {
472-
MessageType errtype;
473-
if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
474-
errtype = X_WARNING;
475-
else
476-
errtype = X_ERROR;
477-
LogMessageVerb(errtype, 0, "%s: module ABI minor version (%d) "
468+
LogMessageVerb(LoaderIgnoreAbi ? X_WARNING : X_ERROR, 0,
469+
"%s: module ABI minor version (%d) "
478470
"is newer than the server's version (%d)\n",
479471
module, abimin, vermin);
480-
if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
472+
if (!LoaderIgnoreAbi)
481473
return FALSE;
482474
}
483475
}

0 commit comments

Comments
 (0)