mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add DM_DEFAULT_NAME_MANGLING_MODE env. variable to override configured value.
Just in case of emergency when name mangling code causes any problems so we can override the default value and switch off the mangling globally.
This commit is contained in:
parent
3eb23ab3d2
commit
05bfdefdf8
@ -1,5 +1,7 @@
|
|||||||
Version 1.02.71 -
|
Version 1.02.71 -
|
||||||
====================================
|
====================================
|
||||||
|
Add DM_DEFAULT_NAME_MANGLING_MODE env. variable to override configured value.
|
||||||
|
Add dm_lib_init to automatically initialise device-mapper library on load.
|
||||||
Replace any '\' char with '\\' in table specification on input.
|
Replace any '\' char with '\\' in table specification on input.
|
||||||
Add mangle command to dmsetup to provide renaming to correct mangled form.
|
Add mangle command to dmsetup to provide renaming to correct mangled form.
|
||||||
Add 'mangled_name' and 'unmangled_name' fields to dmsetup info -c -o.
|
Add 'mangled_name' and 'unmangled_name' fields to dmsetup info -c -o.
|
||||||
|
@ -365,6 +365,12 @@ int dm_device_has_holders(uint32_t major, uint32_t minor);
|
|||||||
*/
|
*/
|
||||||
int dm_device_has_mounted_fs(uint32_t major, uint32_t minor);
|
int dm_device_has_mounted_fs(uint32_t major, uint32_t minor);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise library
|
||||||
|
*/
|
||||||
|
void dm_lib_init(void) __attribute__((constructor));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release library resources
|
* Release library resources
|
||||||
*/
|
*/
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
# include <selinux/label.h>
|
# include <selinux/label.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME "DM_DEFAULT_NAME_MANGLING_MODE"
|
||||||
|
|
||||||
#define DEV_DIR "/dev/"
|
#define DEV_DIR "/dev/"
|
||||||
|
|
||||||
#ifdef UDEV_SYNC_SUPPORT
|
#ifdef UDEV_SYNC_SUPPORT
|
||||||
@ -66,7 +68,7 @@ static char _default_uuid_prefix[DM_MAX_UUID_PREFIX_LEN + 1] = "LVM-";
|
|||||||
|
|
||||||
static int _verbose = 0;
|
static int _verbose = 0;
|
||||||
static int _suspended_dev_counter = 0;
|
static int _suspended_dev_counter = 0;
|
||||||
static int _name_mangling_mode = DEFAULT_DM_NAME_MANGLING;
|
static int _name_mangling_mode = -1;
|
||||||
|
|
||||||
#ifdef HAVE_SELINUX_LABEL_H
|
#ifdef HAVE_SELINUX_LABEL_H
|
||||||
static struct selabel_handle *_selabel_handle = NULL;
|
static struct selabel_handle *_selabel_handle = NULL;
|
||||||
@ -79,6 +81,22 @@ static int _sync_with_udev = 1;
|
|||||||
static int _udev_checking = 1;
|
static int _udev_checking = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void dm_lib_init(void)
|
||||||
|
{
|
||||||
|
const char *env;
|
||||||
|
|
||||||
|
env = getenv(DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME);
|
||||||
|
if (env && *env) {
|
||||||
|
if (!strcasecmp(env, "none"))
|
||||||
|
_name_mangling_mode = DM_STRING_MANGLING_NONE;
|
||||||
|
else if (!strcasecmp(env, "auto"))
|
||||||
|
_name_mangling_mode = DM_STRING_MANGLING_AUTO;
|
||||||
|
else if (!strcasecmp(env, "hex"))
|
||||||
|
_name_mangling_mode = DM_STRING_MANGLING_HEX;
|
||||||
|
} else
|
||||||
|
_name_mangling_mode = DEFAULT_DM_NAME_MANGLING;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Library users can provide their own logging
|
* Library users can provide their own logging
|
||||||
* function.
|
* function.
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "libdevmapper.h"
|
#include "libdevmapper.h"
|
||||||
|
|
||||||
|
#define DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME "DM_DEFAULT_NAME_MANGLING_MODE"
|
||||||
|
|
||||||
#define DEV_NAME(dmt) (dmt->mangled_dev_name ? : dmt->dev_name)
|
#define DEV_NAME(dmt) (dmt->mangled_dev_name ? : dmt->dev_name)
|
||||||
|
|
||||||
int mangle_name(const char *str, size_t len, char *buf,
|
int mangle_name(const char *str, size_t len, char *buf,
|
||||||
|
Loading…
Reference in New Issue
Block a user