Skip to content

Commit

Permalink
[dlopen] move all dlopen lib names at the top of the respective files
Browse files Browse the repository at this point in the history
makes it easier to figure out library supported version

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Sep 10, 2017
1 parent 697bf95 commit 13556bb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
4 changes: 3 additions & 1 deletion libknet/compress_bzip2.c
Expand Up @@ -20,6 +20,8 @@
#include "logging.h"
#include "common.h"

#define LIBBZ2_1 "libbz2.so.1"

/*
* global vars for dlopen
*/
Expand Down Expand Up @@ -69,7 +71,7 @@ int bzip2_load_lib(
int err = 0, savederrno = 0;

if (!bzip2_lib) {
bzip2_lib = open_lib(knet_h, "libbz2.so.1", 0);
bzip2_lib = open_lib(knet_h, LIBBZ2_1, 0);
if (!bzip2_lib) {
savederrno = errno;
err = -1;
Expand Down
6 changes: 4 additions & 2 deletions libknet/compress_lz4.c
Expand Up @@ -20,6 +20,8 @@
#include "logging.h"
#include "common.h"

#define LIBLZ4_1 "liblz4.so.1"

/*
* global vars for dlopen
*/
Expand Down Expand Up @@ -82,7 +84,7 @@ int lz4_load_lib(
int err = 0, savederrno = 0;

if (!lz4_lib) {
lz4_lib = open_lib(knet_h, "liblz4.so.1", 0);
lz4_lib = open_lib(knet_h, LIBLZ4_1, 0);
if (!lz4_lib) {
savederrno = EAGAIN;
err = -1;
Expand Down Expand Up @@ -117,7 +119,7 @@ int lz4_val_level(
int compress_level)
{
if (compress_level <= 0) {
log_info(knet_h, KNET_SUB_LZ4COMP, "lz4 acceleration level 0 (or negatives) are automatically remapped to 1 by liblz4");
log_info(knet_h, KNET_SUB_LZ4COMP, "lz4 acceleration level 0 (or negatives) are automatically remapped to 1 by %s", LIBLZ4_1);
}

return 0;
Expand Down
4 changes: 3 additions & 1 deletion libknet/compress_lzma.c
Expand Up @@ -20,6 +20,8 @@
#include "logging.h"
#include "common.h"

#define LIBLZMA_5 "liblzma.so.5"

/*
* global vars for dlopen
*/
Expand Down Expand Up @@ -72,7 +74,7 @@ int lzma_load_lib(
int err = 0, savederrno = 0;

if (!lzma_lib) {
lzma_lib = open_lib(knet_h, "liblzma.so.5", 0);
lzma_lib = open_lib(knet_h, LIBLZMA_5, 0);
if (!lzma_lib) {
savederrno = EAGAIN;
err = -1;
Expand Down
4 changes: 3 additions & 1 deletion libknet/compress_lzo2.c
Expand Up @@ -20,6 +20,8 @@
#include "logging.h"
#include "common.h"

#define LIBLZO2_2 "liblzo2.so.2"

/*
* global vars for dlopen
*/
Expand Down Expand Up @@ -120,7 +122,7 @@ int lzo2_load_lib(
int err = 0, savederrno = 0;

if (!lzo2_lib) {
lzo2_lib = open_lib(knet_h, "liblzo2.so.2", 0);
lzo2_lib = open_lib(knet_h, LIBLZO2_2, 0);
if (!lzo2_lib) {
savederrno = EAGAIN;
err = -1;
Expand Down
4 changes: 3 additions & 1 deletion libknet/compress_zlib.c
Expand Up @@ -20,6 +20,8 @@
#include "logging.h"
#include "common.h"

#define LIBZ_1 "libz.so.1"

/*
* global vars for dlopen
*/
Expand Down Expand Up @@ -70,7 +72,7 @@ int zlib_load_lib(
int err = 0, savederrno = 0;

if (!zlib_lib) {
zlib_lib = open_lib(knet_h, "libz.so.1", 0);
zlib_lib = open_lib(knet_h, LIBZ_1, 0);
if (!zlib_lib) {
savederrno = EAGAIN;
err = -1;
Expand Down
6 changes: 4 additions & 2 deletions libknet/crypto_nss.c
Expand Up @@ -27,6 +27,8 @@
#include "crypto_nss.h"
#include "logging.h"

#define LIBNSS3 "libnss3.so"

/*
* global vars for dlopen
*/
Expand Down Expand Up @@ -344,7 +346,7 @@ static int init_nss_db(knet_handle_t knet_h)
void nsscrypto_unload_lib(
knet_handle_t knet_h)
{
log_warn(knet_h, KNET_SUB_NSSCRYPTO, "libnss runtime unload can cause minor (< 2kb) memory leaks! Please reload your application at a convenient time (and no, we cannot detect if you are shutting down the app or closing one handle, so you will get this message regardless).");
log_warn(knet_h, KNET_SUB_NSSCRYPTO, "%s runtime unload can cause minor (< 2kb) memory leaks! Please reload your application at a convenient time (and no, we cannot detect if you are shutting down the app or closing one handle, so you will get this message regardless).", LIBNSS3);
if (nss_lib) {
(*_int_NSS_Shutdown)();
if ((*_int_PR_Initialized)()) {
Expand All @@ -363,7 +365,7 @@ int nsscrypto_load_lib(
int err = 0, savederrno = 0;

if (!nss_lib) {
nss_lib = open_lib(knet_h, "libnss3.so", 0);
nss_lib = open_lib(knet_h, LIBNSS3, 0);
if (!nss_lib) {
savederrno = errno;
err = -1;
Expand Down

0 comments on commit 13556bb

Please sign in to comment.