[ofa-general] [PATCH] Allow paths to the device specific library to be absolute

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Tue Jul 14 14:16:53 PDT 2009


If the driver line starts with a / then no lib prefix is applied
and the full path is passed to dlopen. This lets a completely
contained installation exist that relies on RPATH for the binaries
and this mechanism for the drivers.

Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
---
 src/init.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

This is for libibverbs.. It makes things much easier if you do not
install libibverbs into the system library search path (ie an
installation under /opt)

The revised device line would look like:
device /opt/foo/lib/libml4

diff --git a/src/init.c b/src/init.c
index 82dfae4..441f80a 100644
--- a/src/init.c
+++ b/src/init.c
@@ -184,7 +184,9 @@ static void load_driver(const char *name)
 #define IBV_QUOTE(x)	__IBV_QUOTE(x)
 
 	if (asprintf(&so_name,
-		     "lib%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so",
+		     (name[0] == '/'?
+		      "%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so":
+		      "lib%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so"),
 		     name) < 0) {
 		fprintf(stderr, PFX "Warning: couldn't load driver '%s'.\n",
 			name);
-- 
1.6.0.4




More information about the general mailing list