mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: gather version info with single check
As we already collect version info anyway, allow to use it through a single call (can makes logs shorter and saves ioctl).
This commit is contained in:
parent
def65507e6
commit
4d116d7a28
@ -1,5 +1,6 @@
|
||||
Version 2.02.153 -
|
||||
==================================
|
||||
Add function to check for target presence and version via 1 ioctl.
|
||||
|
||||
Version 2.02.152 - 30th April 2016
|
||||
==================================
|
||||
|
@ -632,25 +632,32 @@ int module_present(struct cmd_context *cmd, const char *target_name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int target_present(struct cmd_context *cmd, const char *target_name,
|
||||
int use_modprobe)
|
||||
int target_present_version(struct cmd_context *cmd, const char *target_name,
|
||||
int use_modprobe,
|
||||
uint32_t *maj, uint32_t *min, uint32_t *patchlevel)
|
||||
{
|
||||
uint32_t maj, min, patchlevel;
|
||||
|
||||
if (!activation())
|
||||
return 0;
|
||||
return_0;
|
||||
|
||||
#ifdef MODPROBE_CMD
|
||||
if (use_modprobe) {
|
||||
if (target_version(target_name, &maj, &min, &patchlevel))
|
||||
if (target_version(target_name, maj, min, patchlevel))
|
||||
return 1;
|
||||
|
||||
if (!module_present(cmd, target_name))
|
||||
return_0;
|
||||
}
|
||||
#endif
|
||||
return target_version(target_name, maj, min, patchlevel);
|
||||
}
|
||||
|
||||
return target_version(target_name, &maj, &min, &patchlevel);
|
||||
int target_present(struct cmd_context *cmd, const char *target_name,
|
||||
int use_modprobe)
|
||||
{
|
||||
uint32_t maj, min, patchlevel;
|
||||
|
||||
return target_present_version(cmd, target_name, use_modprobe,
|
||||
&maj, &min, &patchlevel);
|
||||
}
|
||||
|
||||
static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv,
|
||||
|
@ -92,6 +92,9 @@ int library_version(char *version, size_t size);
|
||||
int lvm1_present(struct cmd_context *cmd);
|
||||
|
||||
int module_present(struct cmd_context *cmd, const char *target_name);
|
||||
int target_present_version(struct cmd_context *cmd, const char *target_name,
|
||||
int use_modprobe, uint32_t *maj,
|
||||
uint32_t *min, uint32_t *patchlevel);
|
||||
int target_present(struct cmd_context *cmd, const char *target_name,
|
||||
int use_modprobe);
|
||||
int target_version(const char *target_name, uint32_t *maj,
|
||||
|
Loading…
Reference in New Issue
Block a user