Skip to content
Snippets Groups Projects
Commit dab6f24c authored by Anders Lindh Olsson's avatar Anders Lindh Olsson :8ball:
Browse files

Merge branch 'e3-1402' into 'master'

E3-1402

See merge request !152
parents 06641947 8cb92c50
No related branches found
No related tags found
1 merge request!152E3-1402
Pipeline #169422 passed
...@@ -17,3 +17,7 @@ repos: ...@@ -17,3 +17,7 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- id: check-yaml - id: check-yaml
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.0
hooks:
- id: clang-format
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include <dbAccess.h> #include <dbAccess.h>
#include <epicsExport.h> #include <epicsExport.h>
#include <epicsStdio.h> #include <epicsStdio.h>
#include <errno.h>
#include <errlog.h> #include <errlog.h>
#include <errno.h>
#include <initHooks.h> #include <initHooks.h>
#include <iocsh.h> #include <iocsh.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -18,7 +18,7 @@ struct cmditem { ...@@ -18,7 +18,7 @@ struct cmditem {
char *a[12]; char *a[12];
char cmd[256]; char cmd[256];
} x; } x;
} *cmdlist, **cmdlast = &cmdlist; } * cmdlist, **cmdlast = &cmdlist;
void afterInitHook(initHookState state) { void afterInitHook(initHookState state) {
struct cmditem *item; struct cmditem *item;
......
#include "common.h"
#include <dbAccess.h> #include <dbAccess.h>
#include <errlog.h>
#include <errno.h> #include <errno.h>
#include <error.h> #include <error.h>
#include <errlog.h>
#include <limits.h> #include <limits.h>
#include <osiFileName.h> #include <osiFileName.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -9,8 +11,6 @@ ...@@ -9,8 +11,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "common.h"
char *realpathSeparator(const char *location) { char *realpathSeparator(const char *location) {
size_t size = 0; size_t size = 0;
char *buffer = realpath(location, NULL); char *buffer = realpath(location, NULL);
...@@ -22,10 +22,10 @@ char *realpathSeparator(const char *location) { ...@@ -22,10 +22,10 @@ char *realpathSeparator(const char *location) {
size = strnlen(buffer, PATH_MAX); size = strnlen(buffer, PATH_MAX);
/* linux realpath removes trailing slash */ /* linux realpath removes trailing slash */
if (buffer[size - 1] != OSI_PATH_SEPARATOR[0]) { if (buffer[size - 1] != OSI_PATH_SEPARATOR[0]) {
char* tmp = realloc(buffer, size + sizeof(OSI_PATH_SEPARATOR)); char *tmp = realloc(buffer, size + sizeof(OSI_PATH_SEPARATOR));
if (!tmp){ if (!tmp) {
free(buffer); free(buffer);
return NULL; return NULL;
} }
buffer = tmp; buffer = tmp;
strcpy(buffer + size, OSI_PATH_SEPARATOR); strcpy(buffer + size, OSI_PATH_SEPARATOR);
...@@ -69,8 +69,9 @@ void pathAdd(const char *varname, const char *dirname) { ...@@ -69,8 +69,9 @@ void pathAdd(const char *varname, const char *dirname) {
if (!varname || !dirname) { if (!varname || !dirname) {
errlogPrintf("usage: pathAdd \"ENVIRONMENT_VARIABLE\",\"directory\"\n"); errlogPrintf("usage: pathAdd \"ENVIRONMENT_VARIABLE\",\"directory\"\n");
errlogPrintf(" Adds or moves the directory to the front of the " errlogPrintf(
"ENVIRONMENT_VARIABLE\n"); " Adds or moves the directory to the front of the "
"ENVIRONMENT_VARIABLE\n");
errlogPrintf(" but after a leading \".\".\n"); errlogPrintf(" but after a leading \".\".\n");
return; return;
} }
......
...@@ -10,4 +10,4 @@ extern int requireDebug; ...@@ -10,4 +10,4 @@ extern int requireDebug;
char *realpathSeparator(const char *location); char *realpathSeparator(const char *location);
int putenvprintf(const char *format, ...); int putenvprintf(const char *format, ...);
void pathAdd(const char *varname, const char *dirname); void pathAdd(const char *varname, const char *dirname);
#endif /*__COMMON_H_*/ #endif /*__COMMON_H_*/
#include "module.h"
#include <dbAccess.h> #include <dbAccess.h>
#include <error.h>
#include <errlog.h> #include <errlog.h>
#include <error.h>
#include <limits.h> #include <limits.h>
#include <osiFileName.h> #include <osiFileName.h>
#include <stdio.h> #include <stdio.h>
...@@ -8,11 +10,10 @@ ...@@ -8,11 +10,10 @@
#include <string.h> #include <string.h>
#include "common.h" #include "common.h"
#include "module.h"
#define MAX_MODULE_SIZE 256 #define MAX_MODULE_SIZE 256
unsigned long int bufferSize=0; unsigned long int bufferSize = 0;
const char *getLibVersion(struct linkedList *linkedlist, const char *libname) { const char *getLibVersion(struct linkedList *linkedlist, const char *libname) {
struct module *m = NULL; struct module *m = NULL;
...@@ -42,8 +43,8 @@ int isModuleLoaded(struct linkedList *linkedlist, const char *libname) { ...@@ -42,8 +43,8 @@ int isModuleLoaded(struct linkedList *linkedlist, const char *libname) {
return FALSE; return FALSE;
} }
int registerModule(struct linkedList *linkedlist, const char *moduleName, const char *version, int registerModule(struct linkedList *linkedlist, const char *moduleName,
const char *location) { const char *version, const char *location) {
char *absLocation = NULL; char *absLocation = NULL;
char *absLocationRequire = NULL; char *absLocationRequire = NULL;
char *argstring = NULL; char *argstring = NULL;
...@@ -62,27 +63,28 @@ int registerModule(struct linkedList *linkedlist, const char *moduleName, const ...@@ -62,27 +63,28 @@ int registerModule(struct linkedList *linkedlist, const char *moduleName, const
} }
struct module *module = NULL; struct module *module = NULL;
if (!(module = (struct module*)calloc(sizeof(struct module), 1))) { if (!(module = (struct module *)calloc(sizeof(struct module), 1))) {
goto out_of_memory; goto out_of_memory;
} }
/* Check if string is well formated, there is a \0 in the next MAX_MODULE_SIZE /* Check if string is well formated, there is a \0 in the next MAX_MODULE_SIZE
bytes. */ bytes. */
int nameSize = strnlen(moduleName, MAX_MODULE_SIZE)+1; int nameSize = strnlen(moduleName, MAX_MODULE_SIZE) + 1;
if(nameSize > MAX_MODULE_SIZE) return -1; if (nameSize > MAX_MODULE_SIZE) return -1;
if (!(module->name = calloc(nameSize, sizeof(char)))){ if (!(module->name = calloc(nameSize, sizeof(char)))) {
goto out_of_memory; goto out_of_memory;
} }
strcpy(module->name, moduleName); strcpy(module->name, moduleName);
int versionSize = strnlen(version, MAX_MODULE_SIZE)+1; int versionSize = strnlen(version, MAX_MODULE_SIZE) + 1;
if(versionSize > MAX_MODULE_SIZE) return -1; if (versionSize > MAX_MODULE_SIZE) return -1;
if (!(module->version = calloc(versionSize, sizeof(char)))){ if (!(module->version = calloc(versionSize, sizeof(char)))) {
goto out_of_memory; goto out_of_memory;
} }
strcpy(module->version, version); strcpy(module->version, version);
if (!(module->path = calloc(strnlen(absLocation, PATH_MAX)+1, sizeof(char)))){ if (!(module->path =
calloc(strnlen(absLocation, PATH_MAX) + 1, sizeof(char)))) {
goto out_of_memory; goto out_of_memory;
} }
strcpy(module->path, absLocation ? absLocation : ""); strcpy(module->path, absLocation ? absLocation : "");
...@@ -93,7 +95,7 @@ int registerModule(struct linkedList *linkedlist, const char *moduleName, const ...@@ -93,7 +95,7 @@ int registerModule(struct linkedList *linkedlist, const char *moduleName, const
* function. The size here will be calculated based on the string that is * function. The size here will be calculated based on the string that is
* being written in fillModuleListRecord. So the magic number here is related * being written in fillModuleListRecord. So the magic number here is related
* to that string format.*/ * to that string format.*/
bufferSize += nameSize+versionSize+2; bufferSize += nameSize + versionSize + 2;
if (linkedlist->size == 0) { if (linkedlist->size == 0) {
linkedlist->head = module; linkedlist->head = module;
} else { } else {
...@@ -130,7 +132,8 @@ int registerModule(struct linkedList *linkedlist, const char *moduleName, const ...@@ -130,7 +132,8 @@ int registerModule(struct linkedList *linkedlist, const char *moduleName, const
if (asprintf(&argstring, if (asprintf(&argstring,
"REQUIRE_IOC=%.30s, MODULE=%.24s, VERSION=%.39s, " "REQUIRE_IOC=%.30s, MODULE=%.24s, VERSION=%.39s, "
"MODULE_COUNT=%u, BUFFER_SIZE=%lu", "MODULE_COUNT=%u, BUFFER_SIZE=%lu",
getenv("REQUIRE_IOC"), module->name, module->version, linkedlist->size, bufferSize) < 0){ getenv("REQUIRE_IOC"), module->name, module->version,
linkedlist->size, bufferSize) < 0) {
errlogPrintf("Error asprintf failed\n"); errlogPrintf("Error asprintf failed\n");
return 0; return 0;
} }
......
...@@ -2,22 +2,22 @@ ...@@ -2,22 +2,22 @@
#define __MODULE_H__ #define __MODULE_H__
struct module { struct module {
struct module *next; struct module *next;
char *name; char *name;
char *version; char *version;
char *path; char *path;
}; };
struct linkedList { struct linkedList {
struct module *head; struct module *head;
struct module *tail; struct module *tail;
unsigned int size; unsigned int size;
}; };
const char *getLibVersion(struct linkedList *linkedlist, const char *libname); const char *getLibVersion(struct linkedList *linkedlist, const char *libname);
const char *getLibLocation(struct linkedList *linkedlist, const char *libname); const char *getLibLocation(struct linkedList *linkedlist, const char *libname);
int isModuleLoaded(struct linkedList *linkedlist, const char *libname); int isModuleLoaded(struct linkedList *linkedlist, const char *libname);
int registerModule(struct linkedList *linkedlist, const char *module, const char* version, const char *location); int registerModule(struct linkedList *linkedlist, const char *module,
const char *version, const char *location);
#endif /*__MODULE_H__*/ #endif /*__MODULE_H__*/
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include <epicsExport.h> #include <epicsExport.h>
#include <epicsStdio.h> #include <epicsStdio.h>
#include <epicsVersion.h> #include <epicsVersion.h>
#include <errno.h>
#include <errlog.h> #include <errlog.h>
#include <errno.h>
#include <initHooks.h> #include <initHooks.h>
#include <iocsh.h> #include <iocsh.h>
#include <osiFileName.h> #include <osiFileName.h>
...@@ -81,10 +81,10 @@ int requireDebug; ...@@ -81,10 +81,10 @@ int requireDebug;
#define IF_OPEN_DIR(f) if ((dir = opendir(f))) #define IF_OPEN_DIR(f) if ((dir = opendir(f)))
#define DIR_ENTRY struct dirent * #define DIR_ENTRY struct dirent *
#define START_DIR_LOOP while ((errno = 0, direntry = readdir(dir)) != NULL) #define START_DIR_LOOP while ((errno = 0, direntry = readdir(dir)) != NULL)
#define END_DIR_LOOP \ #define END_DIR_LOOP \
if (!direntry && errno) \ if (!direntry && errno) \
errlogPrintf("error reading directory %s: %s\n", filename, \ errlogPrintf("error reading directory %s: %s\n", filename, \
strerror(errno)); \ strerror(errno)); \
if (dir) closedir(dir); if (dir) closedir(dir);
#ifdef _DIRENT_HAVE_D_TYPE #ifdef _DIRENT_HAVE_D_TYPE
#define SKIP_NON_DIR(e) \ #define SKIP_NON_DIR(e) \
...@@ -175,12 +175,12 @@ static int setupDbPath(const char *module, const char *dbdir) { ...@@ -175,12 +175,12 @@ static int setupDbPath(const char *module, const char *dbdir) {
static int getRecordHandle(const char *namepart, short type, DBADDR *paddr) { static int getRecordHandle(const char *namepart, short type, DBADDR *paddr) {
char recordname[PVNAME_STRINGSZ] = {0}; char recordname[PVNAME_STRINGSZ] = {0};
sprintf(recordname, "%.*s%s", (int)(PVNAME_STRINGSZ - strnlen(namepart, PVNAME_STRINGSZ-1) - 1), sprintf(recordname, "%.*s%s",
(int)(PVNAME_STRINGSZ - strnlen(namepart, PVNAME_STRINGSZ - 1) - 1),
getenv("REQUIRE_IOC"), namepart); getenv("REQUIRE_IOC"), namepart);
if (dbNameToAddr(recordname, paddr) != 0) { if (dbNameToAddr(recordname, paddr) != 0) {
errlogPrintf("require:getRecordHandle : record %s not found\n", errlogPrintf("require:getRecordHandle : record %s not found\n", recordname);
recordname);
return -1; return -1;
} }
if (paddr->field_type != type) { if (paddr->field_type != type) {
...@@ -206,8 +206,7 @@ initHookAfterFinishDevSup. But use double indirection here because in 3.13 we ...@@ -206,8 +206,7 @@ initHookAfterFinishDevSup. But use double indirection here because in 3.13 we
must wait until initHooks is loaded before we can register the hook. must wait until initHooks is loaded before we can register the hook.
*/ */
static void fillModuleListRecord(initHookState state) { static void fillModuleListRecord(initHookState state) {
if (state != initHookAfterFinishDevSup) if (state != initHookAfterFinishDevSup) return;
return;
struct dbAddr modules = {0}, versions = {0}, modver = {0}; struct dbAddr modules = {0}, versions = {0}, modver = {0};
char *bufferModules, *bufferVersions, *bufferModver; char *bufferModules, *bufferVersions, *bufferModver;
...@@ -219,11 +218,14 @@ static void fillModuleListRecord(initHookState state) { ...@@ -219,11 +218,14 @@ static void fillModuleListRecord(initHookState state) {
getRecordHandle(":Versions", DBF_STRING, &versions); getRecordHandle(":Versions", DBF_STRING, &versions);
getRecordHandle(":ModuleVersions", DBF_CHAR, &modver); getRecordHandle(":ModuleVersions", DBF_CHAR, &modver);
bufferModules = (char *)calloc(MAX_STRING_SIZE*loadedModules.size, sizeof(char)); bufferModules =
bufferVersions = (char *)calloc(MAX_STRING_SIZE*loadedModules.size, sizeof(char)); (char *)calloc(MAX_STRING_SIZE * loadedModules.size, sizeof(char));
bufferModver = (char *)calloc(MAX_STRING_SIZE*loadedModules.size, sizeof(char)); bufferVersions =
(char *)calloc(MAX_STRING_SIZE * loadedModules.size, sizeof(char));
bufferModver =
(char *)calloc(MAX_STRING_SIZE * loadedModules.size, sizeof(char));
for (m = loadedModules.head, i = 0; m != NULL ; m = m->next, i++){ for (m = loadedModules.head, i = 0; m != NULL; m = m->next, i++) {
debug("require: %s[%d] = \"%.*s\"\n", modules.precord->name, i, debug("require: %s[%d] = \"%.*s\"\n", modules.precord->name, i,
MAX_STRING_SIZE - 1, m->name); MAX_STRING_SIZE - 1, m->name);
sprintf((char *)(bufferModules) + i * MAX_STRING_SIZE, "%.*s", sprintf((char *)(bufferModules) + i * MAX_STRING_SIZE, "%.*s",
...@@ -232,34 +234,33 @@ static void fillModuleListRecord(initHookState state) { ...@@ -232,34 +234,33 @@ static void fillModuleListRecord(initHookState state) {
MAX_STRING_SIZE - 1, m->version); MAX_STRING_SIZE - 1, m->version);
sprintf((char *)(bufferVersions) + i * MAX_STRING_SIZE, "%.*s", sprintf((char *)(bufferVersions) + i * MAX_STRING_SIZE, "%.*s",
MAX_STRING_SIZE - 1, m->version); MAX_STRING_SIZE - 1, m->version);
debug("require: %s+=\"%s %s\"\n", modver.precord->name, debug("require: %s+=\"%s %s\"\n", modver.precord->name, m->name,
m->name, m->version); m->version);
c += sprintf((char *)(bufferModver) + c, "%s %s\n", c += sprintf((char *)(bufferModver) + c, "%s %s\n", m->name, m->version);
m->name, m->version);
} }
if (dbPut(&modules, DBF_STRING, bufferModules, loadedModules.size) != 0){ if (dbPut(&modules, DBF_STRING, bufferModules, loadedModules.size) != 0) {
errlogPrintf("require: Error to put Modules\n"); errlogPrintf("require: Error to put Modules\n");
} }
if (dbPut(&versions, DBF_STRING, bufferVersions, loadedModules.size) != 0){ if (dbPut(&versions, DBF_STRING, bufferVersions, loadedModules.size) != 0) {
errlogPrintf("require: Error to put Versions\n"); errlogPrintf("require: Error to put Versions\n");
} }
if (dbPut(&modver, DBF_CHAR, bufferModver, strlen(bufferModver)) != 0){ if (dbPut(&modver, DBF_CHAR, bufferModver, strlen(bufferModver)) != 0) {
errlogPrintf("require: Error to put ModuleVersions\n"); errlogPrintf("require: Error to put ModuleVersions\n");
} }
} }
static int registerRequire(){ static int registerRequire() {
char *requireLocation = NULL; char *requireLocation = NULL;
char *requireVersion = NULL; char *requireVersion = NULL;
requireLocation = getenv(E3_REQUIRE_LOCATION); requireLocation = getenv(E3_REQUIRE_LOCATION);
if (!requireLocation){ if (!requireLocation) {
errlogPrintf("require: Failed to get " E3_REQUIRE_LOCATION "\n"); errlogPrintf("require: Failed to get " E3_REQUIRE_LOCATION "\n");
return -1; return -1;
} }
requireVersion = getenv(E3_REQUIRE_VERSION); requireVersion = getenv(E3_REQUIRE_VERSION);
if (!requireVersion){ if (!requireVersion) {
errlogPrintf("require: Failed to get " E3_REQUIRE_VERSION "\n"); errlogPrintf("require: Failed to get " E3_REQUIRE_VERSION "\n");
return -1; return -1;
} }
...@@ -280,8 +281,7 @@ int libversionShow(const char *outfile) { ...@@ -280,8 +281,7 @@ int libversionShow(const char *outfile) {
} }
} }
for (m = loadedModules.head; m; m = m->next) { for (m = loadedModules.head; m; m = m->next) {
fprintf(out, "%s-%20s %s\n", m->name, fprintf(out, "%s-%20s %s\n", m->name, m->version, m->path);
m->version, m->path);
} }
if (fflush(out) < 0 && outfile) { if (fflush(out) < 0 && outfile) {
errlogPrintf("can't write to %s: %s\n", outfile, strerror(errno)); errlogPrintf("can't write to %s: %s\n", outfile, strerror(errno));
...@@ -495,11 +495,11 @@ static off_t fileSize(const char *filename) { ...@@ -495,11 +495,11 @@ static off_t fileSize(const char *filename) {
} }
#define fileExists(filename) (fileSize(filename) >= 0) #define fileExists(filename) (fileSize(filename) >= 0)
#define fileNotEmpty(filename) (fileSize(filename) > 0) #define fileNotEmpty(filename) (fileSize(filename) > 0)
#define TRY_FILE(offs, ...) \ #define TRY_FILE(offs, ...) \
(snprintf(filename + offs, PATH_MAX - offs, __VA_ARGS__) && \ (snprintf(filename + offs, PATH_MAX - offs, __VA_ARGS__) && \
fileExists(filename)) fileExists(filename))
#define TRY_NONEMPTY_FILE(offs, ...) \ #define TRY_NONEMPTY_FILE(offs, ...) \
(snprintf(filename + offs, PATH_MAX - offs, __VA_ARGS__) && \ (snprintf(filename + offs, PATH_MAX - offs, __VA_ARGS__) && \
fileNotEmpty(filename)) fileNotEmpty(filename))
...@@ -551,8 +551,8 @@ static int handleDependencies(const char *module, char *depfilename) { ...@@ -551,8 +551,8 @@ static int handleDependencies(const char *module, char *depfilename) {
* *
* Sets <filename> to be the path the the underlying module. * Sets <filename> to be the path the the underlying module.
*/ */
static char* fetch_module_version(char *filename, size_t max_file_len, static char *fetch_module_version(char *filename, size_t max_file_len,
const char *module, const char *version) { const char *module, const char *version) {
const char *dirname = NULL; const char *dirname = NULL;
const char *driverpath = NULL; const char *driverpath = NULL;
const char *end = NULL; const char *end = NULL;
...@@ -676,17 +676,18 @@ static char* fetch_module_version(char *filename, size_t max_file_len, ...@@ -676,17 +676,18 @@ static char* fetch_module_version(char *filename, size_t max_file_len,
if (!found) { if (!found) {
if (someArchFound) if (someArchFound)
errlogPrintf("Module %s%s%s not available for %s\n(but maybe for other " errlogPrintf(
"EPICS versions or architectures)\n", "Module %s%s%s not available for %s\n(but maybe for other "
module, version ? " version " : "", version ? version : "", "EPICS versions or architectures)\n",
targetArch); module, version ? " version " : "", version ? version : "",
targetArch);
else if (someVersionFound) else if (someVersionFound)
errlogPrintf( errlogPrintf(
"Module %s%s%s not available (but other versions are available)\n", "Module %s%s%s not available (but other versions are available)\n",
module, version ? " version " : "", version ? version : ""); module, version ? " version " : "", version ? version : "");
else else
errlogPrintf("Module %s%s%s not available\n", module, errlogPrintf("Module %s%s%s not available\n", module,
version ? " version " : "", version ? version : ""); version ? " version " : "", version ? version : "");
if (founddir) free(founddir); if (founddir) free(founddir);
return NULL; return NULL;
} }
...@@ -696,7 +697,7 @@ static char* fetch_module_version(char *filename, size_t max_file_len, ...@@ -696,7 +697,7 @@ static char* fetch_module_version(char *filename, size_t max_file_len,
found, founddir); found, founddir);
snprintf(filename, max_file_len, "%s" OSI_PATH_SEPARATOR, founddir); snprintf(filename, max_file_len, "%s" OSI_PATH_SEPARATOR, founddir);
versionLength = strlen(found)+1; versionLength = strlen(found) + 1;
selectedVersion = calloc(versionLength, sizeof(char)); selectedVersion = calloc(versionLength, sizeof(char));
memcpy(selectedVersion, found, versionLength); memcpy(selectedVersion, found, versionLength);
free(founddir); free(founddir);
...@@ -741,7 +742,7 @@ static const char *compare_module_version(char *filename, const char *module, ...@@ -741,7 +742,7 @@ static const char *compare_module_version(char *filename, const char *module,
version, found); version, found);
if (compareVersions(found, version, FALSE) == MISMATCH) { if (compareVersions(found, version, FALSE) == MISMATCH) {
errlogPrintf("Requested %s version %s not available, found only %s.\n", errlogPrintf("Requested %s version %s not available, found only %s.\n",
module, version, found); module, version, found);
return NULL; return NULL;
} }
} }
...@@ -802,7 +803,7 @@ static int require_priv(const char *module, const char *version) { ...@@ -802,7 +803,7 @@ static int require_priv(const char *module, const char *version) {
debug("require: module=\"%s\" version=\"%s\"\n", module, version); debug("require: module=\"%s\" version=\"%s\"\n", module, version);
/* check already loaded verion */ /* check already loaded verion */
loaded = getLibVersion(&loadedModules,module); loaded = getLibVersion(&loadedModules, module);
if (loaded) { if (loaded) {
/* Library already loaded. Check Version. */ /* Library already loaded. Check Version. */
switch (compareVersions(loaded, version, FALSE)) { switch (compareVersions(loaded, version, FALSE)) {
...@@ -828,7 +829,7 @@ static int require_priv(const char *module, const char *version) { ...@@ -828,7 +829,7 @@ static int require_priv(const char *module, const char *version) {
/* Step 1: Search for module in driverpath */ /* Step 1: Search for module in driverpath */
selectedVersion = selectedVersion =
fetch_module_version(filename, sizeof(filename), module, version); fetch_module_version(filename, sizeof(filename), module, version);
if (!selectedVersion){ if (!selectedVersion) {
returnvalue = -1; returnvalue = -1;
goto require_priv_end; goto require_priv_end;
} }
...@@ -858,7 +859,8 @@ static int require_priv(const char *module, const char *version) { ...@@ -858,7 +859,8 @@ static int require_priv(const char *module, const char *version) {
/* Step 3: Ensure that we have loaded the correct version */ /* Step 3: Ensure that we have loaded the correct version */
debug("require: Check that the loaded and requested versions match\n"); debug("require: Check that the loaded and requested versions match\n");
found = compare_module_version(filename, module, selectedVersion, libdiroffs); found =
compare_module_version(filename, module, selectedVersion, libdiroffs);
if (!found) { if (!found) {
returnvalue = -1; returnvalue = -1;
goto require_priv_end; goto require_priv_end;
...@@ -941,7 +943,7 @@ static void requireRegister(void) { ...@@ -941,7 +943,7 @@ static void requireRegister(void) {
iocshRegister(&libversionShowDef, libversionShowFunc); iocshRegister(&libversionShowDef, libversionShowFunc);
iocshRegister(&ldDef, ldFunc); iocshRegister(&ldDef, ldFunc);
iocshRegister(&pathAddDef, pathAddFunc); iocshRegister(&pathAddDef, pathAddFunc);
if(registerRequire() != 0){ if (registerRequire() != 0) {
errlogPrintf("require: Could not register require.\n"); errlogPrintf("require: Could not register require.\n");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment