summaryrefslogtreecommitdiff
path: root/lib/misc/lvm-globals.c
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2013-03-05 01:47:43 -0800
committerAnas Nashif <anas.nashif@intel.com>2013-03-05 01:47:43 -0800
commit44a3c2255bc480c82f34db156553a595606d8a0b (patch)
tree5e6df96a6c6e40207cb3a711860e16b543918c0d /lib/misc/lvm-globals.c
parent8bd28eea831fd5215c12e6fcecc8e9a772398ed9 (diff)
downloaddevice-mapper-44a3c2255bc480c82f34db156553a595606d8a0b.tar.gz
device-mapper-44a3c2255bc480c82f34db156553a595606d8a0b.tar.bz2
device-mapper-44a3c2255bc480c82f34db156553a595606d8a0b.zip
Imported Upstream version 2.02.98upstream/2.02.98upstream/1.02.77
Diffstat (limited to 'lib/misc/lvm-globals.c')
-rw-r--r--lib/misc/lvm-globals.c102
1 files changed, 86 insertions, 16 deletions
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 9da61fe..fe38008 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -17,16 +17,18 @@
#include "device.h"
#include "memlock.h"
#include "lvm-string.h"
-#include "lvm-file.h"
#include "defaults.h"
+#include "metadata-exported.h"
#include <stdarg.h>
static int _verbose_level = VERBOSE_BASE_LEVEL;
+static int _silent = 0;
static int _test = 0;
static int _md_filtering = 0;
static int _pvmove = 0;
static int _full_scan_done = 0; /* Restrict to one full scan during each cmd */
+static int _obtain_device_list_from_udev = DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV;
static int _trust_cache = 0; /* Don't scan when incomplete VGs encountered */
static int _debug_level = 0;
static int _log_cmd_name = 0;
@@ -40,18 +42,28 @@ static int _ignore_suspended_devices = 0;
static int _error_message_produced = 0;
static unsigned _is_static = 0;
static int _udev_checking = 1;
+static int _retry_deactivation = DEFAULT_RETRY_DEACTIVATION;
+static int _activation_checks = 0;
static char _sysfs_dir_path[PATH_MAX] = "";
static int _dev_disable_after_error_count = DEFAULT_DISABLE_AFTER_ERROR_COUNT;
+static uint64_t _pv_min_size = (DEFAULT_PV_MIN_SIZE_KB * 1024L >> SECTOR_SHIFT);
+static int _detect_internal_vg_cache_corruption =
+ DEFAULT_DETECT_INTERNAL_VG_CACHE_CORRUPTION;
void init_verbose(int level)
{
_verbose_level = level;
}
+void init_silent(int silent)
+{
+ _silent = silent;
+}
+
void init_test(int level)
{
if (!_test && level)
- log_print("Test mode: Metadata will NOT be updated.");
+ log_warn("TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.");
_test = level;
}
@@ -70,6 +82,11 @@ void init_full_scan_done(int level)
_full_scan_done = level;
}
+void init_obtain_device_list_from_udev(int device_list_from_udev)
+{
+ _obtain_device_list_from_udev = device_list_from_udev;
+}
+
void init_trust_cache(int trustcache)
{
_trust_cache = trustcache;
@@ -123,24 +140,47 @@ void init_udev_checking(int checking)
log_debug("LVM udev checking disabled");
}
+void init_retry_deactivation(int retry)
+{
+ _retry_deactivation = retry;
+}
+
+void init_activation_checks(int checks)
+{
+ if ((_activation_checks = checks))
+ log_debug("LVM activation checks enabled");
+ else
+ log_debug("LVM activation checks disabled");
+}
+
void init_dev_disable_after_error_count(int value)
{
_dev_disable_after_error_count = value;
}
+void init_pv_min_size(uint64_t sectors)
+{
+ _pv_min_size = sectors;
+}
+
+void init_detect_internal_vg_cache_corruption(int detect)
+{
+ _detect_internal_vg_cache_corruption = detect;
+}
+
void set_cmd_name(const char *cmd)
{
- strncpy(_cmd_name, cmd, sizeof(_cmd_name));
+ strncpy(_cmd_name, cmd, sizeof(_cmd_name) - 1);
_cmd_name[sizeof(_cmd_name) - 1] = '\0';
}
void set_sysfs_dir_path(const char *path)
{
- strncpy(_sysfs_dir_path, path, sizeof(_sysfs_dir_path));
+ strncpy(_sysfs_dir_path, path, sizeof(_sysfs_dir_path) - 1);
_sysfs_dir_path[sizeof(_sysfs_dir_path) - 1] = '\0';
}
-const char *log_command_name()
+const char *log_command_name(void)
{
if (!_log_cmd_name)
return "";
@@ -158,42 +198,47 @@ int error_message_produced(void)
return _error_message_produced;
}
-int test_mode()
+int test_mode(void)
{
return _test;
}
-int md_filtering()
+int md_filtering(void)
{
return _md_filtering;
}
-int pvmove_mode()
+int pvmove_mode(void)
{
return _pvmove;
}
-int full_scan_done()
+int full_scan_done(void)
{
return _full_scan_done;
}
-int trust_cache()
+int obtain_device_list_from_udev(void)
+{
+ return _obtain_device_list_from_udev;
+}
+
+int trust_cache(void)
{
return _trust_cache;
}
-int background_polling()
+int background_polling(void)
{
return _background_polling;
}
-int ignorelockingfailure()
+int ignorelockingfailure(void)
{
return _ignorelockingfailure;
}
-int security_level()
+int security_level(void)
{
return _security_level;
}
@@ -218,16 +263,21 @@ void init_debug(int level)
_debug_level = level;
}
-int verbose_level()
+int verbose_level(void)
{
return _verbose_level;
}
-int debug_level()
+int debug_level(void)
{
return _debug_level;
}
+int silent_mode(void)
+{
+ return _silent;
+}
+
unsigned is_static(void)
{
return _is_static;
@@ -238,7 +288,17 @@ int udev_checking(void)
return _udev_checking;
}
-const char *sysfs_dir_path()
+int retry_deactivation(void)
+{
+ return _retry_deactivation;
+}
+
+int activation_checks(void)
+{
+ return _activation_checks;
+}
+
+const char *sysfs_dir_path(void)
{
return _sysfs_dir_path;
}
@@ -247,3 +307,13 @@ int dev_disable_after_error_count(void)
{
return _dev_disable_after_error_count;
}
+
+uint64_t pv_min_size(void)
+{
+ return _pv_min_size;
+}
+
+int detect_internal_vg_cache_corruption(void)
+{
+ return _detect_internal_vg_cache_corruption;
+}