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>
This commit is contained in:
		
							parent
							
								
									ef533a912d
								
							
						
					
					
						commit
						2e3ad7e250
					
				| 
						 | 
					@ -141,12 +141,6 @@ typedef struct {
 | 
				
			||||||
    const char *moduleclass;    /* module class */
 | 
					    const char *moduleclass;    /* module class */
 | 
				
			||||||
} XF86ModReqInfo;
 | 
					} 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) \
 | 
					#define MODULE_VERSION_NUMERIC(maj, min, patch) \
 | 
				
			||||||
	((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
 | 
						((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
 | 
				
			||||||
#define GET_MODULE_MAJOR_VERSION(vers)	(((vers) >> 24) & 0xFF)
 | 
					#define GET_MODULE_MAJOR_VERSION(vers)	(((vers) >> 24) & 0xFF)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5293,12 +5293,12 @@ XFree86 common layer.
 | 
				
			||||||
		  as follows:
 | 
							  as follows:
 | 
				
			||||||
		      <programlisting>
 | 
							      <programlisting>
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
	CARD8        majorversion;  /* MAJOR_UNSPEC */
 | 
						CARD8        majorversion;
 | 
				
			||||||
	CARD8        minorversion;  /* MINOR_UNSPEC */
 | 
						CARD8        minorversion;
 | 
				
			||||||
	CARD16       patchlevel;    /* PATCH_UNSPEC */
 | 
						CARD16       patchlevel;
 | 
				
			||||||
	const char * abiclass;      /* ABI_CLASS_NONE */
 | 
						const char * abiclass;
 | 
				
			||||||
	CARD32       abiversion;    /* ABI_VERS_UNSPEC */
 | 
						CARD32       abiversion;
 | 
				
			||||||
	const char * moduleclass;   /* MOD_CLASS_NONE */
 | 
						const char * moduleclass;
 | 
				
			||||||
} XF86ModReqInfo;
 | 
					} XF86ModReqInfo;
 | 
				
			||||||
			</programlisting>
 | 
								</programlisting>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5323,8 +5323,8 @@ typedef struct {
 | 
				
			||||||
				   The module's minor version must be
 | 
									   The module's minor version must be
 | 
				
			||||||
				   no less than this value.  This
 | 
									   no less than this value.  This
 | 
				
			||||||
				   comparison is only made if
 | 
									   comparison is only made if
 | 
				
			||||||
				   <structfield>majorversion</structfield> is
 | 
									   <structfield>majorversion</structfield>
 | 
				
			||||||
				   specified and matches.
 | 
					                                   matches.
 | 
				
			||||||
			    </para></listitem></varlistentry>
 | 
								    </para></listitem></varlistentry>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<varlistentry>
 | 
								<varlistentry>
 | 
				
			||||||
| 
						 | 
					@ -5333,8 +5333,8 @@ typedef struct {
 | 
				
			||||||
				   The module's patchlevel must be no
 | 
									   The module's patchlevel must be no
 | 
				
			||||||
				   less than this value.  This comparison
 | 
									   less than this value.  This comparison
 | 
				
			||||||
				   is only made if
 | 
									   is only made if
 | 
				
			||||||
				   <structfield>minorversion</structfield> is
 | 
									   <structfield>minorversion</structfield>
 | 
				
			||||||
				   specified and matches.
 | 
									   matches.
 | 
				
			||||||
			    </para></listitem></varlistentry>
 | 
								    </para></listitem></varlistentry>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<varlistentry>
 | 
								<varlistentry>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -617,32 +617,24 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check against requirements that the caller has specified */
 | 
					    /* Check against requirements that the caller has specified */
 | 
				
			||||||
    if (req) {
 | 
					    if (req) {
 | 
				
			||||||
        if (req->majorversion != MAJOR_UNSPEC) {
 | 
					        if (data->majorversion != req->majorversion) {
 | 
				
			||||||
            if (data->majorversion != req->majorversion) {
 | 
					            LogMessageVerb(X_WARNING, 2, "%s: module major version (%d) "
 | 
				
			||||||
                LogMessageVerb(X_WARNING, 2, "%s: module major version (%d) "
 | 
					                           "doesn't match required major version (%d)\n",
 | 
				
			||||||
                               "doesn't match required major version (%d)\n",
 | 
					                           module, data->majorversion, req->majorversion);
 | 
				
			||||||
                               module, data->majorversion, req->majorversion);
 | 
					            return FALSE;
 | 
				
			||||||
                return FALSE;
 | 
					        }
 | 
				
			||||||
            }
 | 
					        else if (data->minorversion < req->minorversion) {
 | 
				
			||||||
            else if (req->minorversion != MINOR_UNSPEC) {
 | 
					            LogMessageVerb(X_WARNING, 2, "%s: module minor version (%d) is "
 | 
				
			||||||
                if (data->minorversion < req->minorversion) {
 | 
					                          "less than the required minor version (%d)\n",
 | 
				
			||||||
                    LogMessageVerb(X_WARNING, 2, "%s: module minor version "
 | 
					                          module, data->minorversion, req->minorversion);
 | 
				
			||||||
                                   "(%d) is less than the required minor "
 | 
					            return FALSE;
 | 
				
			||||||
                                   "version (%d)\n", module,
 | 
					        }
 | 
				
			||||||
                                  data->minorversion, req->minorversion);
 | 
					        else if (data->minorversion == req->minorversion &&
 | 
				
			||||||
                    return FALSE;
 | 
					                 data->patchlevel < req->patchlevel) {
 | 
				
			||||||
                }
 | 
					            LogMessageVerb(X_WARNING, 2, "%s: module patch level (%d) "
 | 
				
			||||||
                else if (data->minorversion == req->minorversion &&
 | 
					                           "is less than the required patch level "
 | 
				
			||||||
                         req->patchlevel != PATCH_UNSPEC) {
 | 
					                           "(%d)\n", module, data->patchlevel, req->patchlevel);
 | 
				
			||||||
                    if (data->patchlevel < req->patchlevel) {
 | 
					            return FALSE;
 | 
				
			||||||
                        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 (req->moduleclass) {
 | 
					        if (req->moduleclass) {
 | 
				
			||||||
            if (!data->moduleclass ||
 | 
					            if (!data->moduleclass ||
 | 
				
			||||||
| 
						 | 
					@ -663,8 +655,7 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
 | 
				
			||||||
                return FALSE;
 | 
					                return FALSE;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if ((req->abiclass != ABI_CLASS_NONE) &&
 | 
					        if (req->abiclass != ABI_CLASS_NONE) {
 | 
				
			||||||
            req->abiversion != ABI_VERS_UNSPEC) {
 | 
					 | 
				
			||||||
            int reqmaj, reqmin, maj, min;
 | 
					            int reqmaj, reqmin, maj, min;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            reqmaj = GET_ABI_MAJOR(req->abiversion);
 | 
					            reqmaj = GET_ABI_MAJOR(req->abiversion);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue