From edcda01a1e18af6599275801a8237fe10112ed6f Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Fri, 22 Apr 2011 12:05:32 +0000 Subject: 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. --- tools/lvmcmdline.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/lvmcmdline.c') 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) -- cgit