diff options
author | Adam Jackson <ajax@redhat.com> | 2016-04-13 15:50:39 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-01-25 14:22:05 -0500 |
commit | 2e3ad7e2506d9eb6667a5f229b5213d215451a5a (patch) | |
tree | 851d554da1c3764ba771504968a87941c201a4b7 | |
parent | ef533a912d18db31456b29a18c8bced649309565 (diff) |
loader: Remove silly "unspecified" version handling
Everybody using this functionality specifies a major version, which
makes sense. If you don't care about a minor version, that's equivalent
to saying you require minor >= 0, so just say so; likewise patch level.
Likewise ABI class is always specified.
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xfree86/common/xf86Module.h | 6 | ||||
-rw-r--r-- | hw/xfree86/doc/ddxDesign.xml | 20 | ||||
-rw-r--r-- | hw/xfree86/loader/loadmod.c | 47 |
3 files changed, 29 insertions, 44 deletions
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index ff0e23ee5..faea07f74 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -141,12 +141,6 @@ typedef struct { const char *moduleclass; /* module class */ } XF86ModReqInfo; -/* values to indicate unspecified fields in XF86ModReqInfo. */ -#define MAJOR_UNSPEC 0xFF -#define MINOR_UNSPEC 0xFF -#define PATCH_UNSPEC 0xFFFF -#define ABI_VERS_UNSPEC 0xFFFFFFFF - #define MODULE_VERSION_NUMERIC(maj, min, patch) \ ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) #define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml index 2ff2894b9..05ee04281 100644 --- a/hw/xfree86/doc/ddxDesign.xml +++ b/hw/xfree86/doc/ddxDesign.xml @@ -5293,12 +5293,12 @@ XFree86 common layer. as follows: <programlisting> typedef struct { - CARD8 majorversion; /* MAJOR_UNSPEC */ - CARD8 minorversion; /* MINOR_UNSPEC */ - CARD16 patchlevel; /* PATCH_UNSPEC */ - const char * abiclass; /* ABI_CLASS_NONE */ - CARD32 abiversion; /* ABI_VERS_UNSPEC */ - const char * moduleclass; /* MOD_CLASS_NONE */ + CARD8 majorversion; + CARD8 minorversion; + CARD16 patchlevel; + const char * abiclass; + CARD32 abiversion; + const char * moduleclass; } XF86ModReqInfo; </programlisting> @@ -5323,8 +5323,8 @@ typedef struct { The module's minor version must be no less than this value. This comparison is only made if - <structfield>majorversion</structfield> is - specified and matches. + <structfield>majorversion</structfield> + matches. </para></listitem></varlistentry> <varlistentry> @@ -5333,8 +5333,8 @@ typedef struct { The module's patchlevel must be no less than this value. This comparison is only made if - <structfield>minorversion</structfield> is - specified and matches. + <structfield>minorversion</structfield> + matches. </para></listitem></varlistentry> <varlistentry> diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 85689be41..528cc88b1 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -617,32 +617,24 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, /* Check against requirements that the caller has specified */ if (req) { - if (req->majorversion != MAJOR_UNSPEC) { - if (data->majorversion != req->majorversion) { - LogMessageVerb(X_WARNING, 2, "%s: module major version (%d) " - "doesn't match required major version (%d)\n", - module, data->majorversion, req->majorversion); - return FALSE; - } - else if (req->minorversion != MINOR_UNSPEC) { - if (data->minorversion < req->minorversion) { - LogMessageVerb(X_WARNING, 2, "%s: module minor version " - "(%d) is less than the required minor " - "version (%d)\n", module, - data->minorversion, req->minorversion); - return FALSE; - } - else if (data->minorversion == req->minorversion && - req->patchlevel != PATCH_UNSPEC) { - if (data->patchlevel < req->patchlevel) { - LogMessageVerb(X_WARNING, 2, "%sL module patch level " - "(%d) is less than the required patch " - "level (%d)\n", module, data->patchlevel, - req->patchlevel); - return FALSE; - } - } - } + if (data->majorversion != req->majorversion) { + LogMessageVerb(X_WARNING, 2, "%s: module major version (%d) " + "doesn't match required major version (%d)\n", + module, data->majorversion, req->majorversion); + return FALSE; + } + else if (data->minorversion < req->minorversion) { + LogMessageVerb(X_WARNING, 2, "%s: module minor version (%d) is " + "less than the required minor version (%d)\n", + module, data->minorversion, req->minorversion); + return FALSE; + } + else if (data->minorversion == req->minorversion && + data->patchlevel < req->patchlevel) { + LogMessageVerb(X_WARNING, 2, "%s: module patch level (%d) " + "is less than the required patch level " + "(%d)\n", module, data->patchlevel, req->patchlevel); + return FALSE; } if (req->moduleclass) { if (!data->moduleclass || @@ -663,8 +655,7 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, return FALSE; } } - if ((req->abiclass != ABI_CLASS_NONE) && - req->abiversion != ABI_VERS_UNSPEC) { + if (req->abiclass != ABI_CLASS_NONE) { int reqmaj, reqmin, maj, min; reqmaj = GET_ABI_MAJOR(req->abiversion); |