Skip to content

Commit fc0c97f

Browse files
committed
verbs: make libibverbs plugins relocatable
Allow overriding the libibverbs configuration directory setting the environment variable VERBS_CONFIG_DIR. Signed-off-by: Andrea Bocci <[email protected]>
1 parent b2ff238 commit fc0c97f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libibverbs/dynamic_driver.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,33 @@ static void read_config_file(const char *path)
115115

116116
static void read_config(void)
117117
{
118+
char *verbs_config_dir;
118119
DIR *conf_dir;
119120
struct dirent *dent;
120121
char *path;
121122

122-
conf_dir = opendir(IBV_CONFIG_DIR);
123+
verbs_config_dir = getenv("VERBS_CONFIG_DIR");
124+
if (!verbs_config_dir) {
125+
verbs_config_dir = IBV_CONFIG_DIR;
126+
}
127+
128+
conf_dir = opendir(verbs_config_dir);
123129
if (!conf_dir) {
124130
fprintf(stderr,
125131
PFX "Warning: couldn't open config directory '%s'.\n",
126-
IBV_CONFIG_DIR);
132+
verbs_config_dir);
127133
return;
128134
}
129135

130136
while ((dent = readdir(conf_dir))) {
131137
struct stat buf;
132138

133-
if (asprintf(&path, "%s/%s", IBV_CONFIG_DIR, dent->d_name) <
139+
if (asprintf(&path, "%s/%s", verbs_config_dir, dent->d_name) <
134140
0) {
135141
fprintf(stderr,
136142
PFX
137143
"Warning: couldn't read config file %s/%s.\n",
138-
IBV_CONFIG_DIR, dent->d_name);
144+
verbs_config_dir, dent->d_name);
139145
goto out;
140146
}
141147

0 commit comments

Comments
 (0)