summaryrefslogtreecommitdiffstats
path: root/tools/lvmcmdline.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2011-04-22 12:05:32 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2011-04-22 12:05:32 +0000
commitedcda01a1e18af6599275801a8237fe10112ed6f (patch)
tree7da7e0d4ce38e319432e032969fe52210884df55 /tools/lvmcmdline.c
parent40059f18d9b811cf0e25377ccfeb3490b8e96377 (diff)
downloadlvm2-edcda01a1e18af6599275801a8237fe10112ed6f.tar.gz
lvm2-edcda01a1e18af6599275801a8237fe10112ed6f.tar.xz
lvm2-edcda01a1e18af6599275801a8237fe10112ed6f.zip
Obtain device list from udev by default if LVM2 is compiled with udev support.
Also, add a new 'obtain_device_list_from_udev' setting to lvm.conf with which we can turn this feature on or off if needed. If set, the cache of block device nodes with all associated symlinks will be constructed out of the existing udev database content. This avoids using and opening any inapplicable non-block devices or subdirectories found in the device directory. This setting is applied to udev-managed device directory only, other directories will be scanned fully. LVM2 needs to be compiled with udev support for this setting to take effect. N.B. Any device node or symlink not managed by udev in udev directory will be ignored with this setting on.
Diffstat (limited to 'tools/lvmcmdline.c')
-rw-r--r--tools/lvmcmdline.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index eb198840..114230d7 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1282,6 +1282,9 @@ struct cmd_context *init_lvm(void)
{
struct cmd_context *cmd;
+ if (!udev_init_library_context())
+ stack;
+
if (!(cmd = create_toolcontext(0, NULL)))
return_NULL;
@@ -1313,6 +1316,7 @@ void lvm_fin(struct cmd_context *cmd)
{
_fin_commands();
destroy_toolcontext(cmd);
+ udev_fin_library_context();
}
static int _run_script(struct cmd_context *cmd, int argc, char **argv)