1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

vdo: modprobe dm-vdo for kernels >= 6.9

Modprobe "dm-vdo" with new kernels >= 6.9 and go for
'kvdo' with older Linux kernels.
This commit is contained in:
Zdenek Kabelac 2024-04-07 12:56:33 +02:00
parent a82b93b298
commit dbc0105e1a

View File

@ -606,6 +606,7 @@ int module_present(struct cmd_context *cmd, const char *target_name)
#ifdef MODPROBE_CMD #ifdef MODPROBE_CMD
char module[128]; char module[128];
const char *argv[] = { MODPROBE_CMD, module, NULL }; const char *argv[] = { MODPROBE_CMD, module, NULL };
unsigned maj, min;
#endif #endif
struct stat st; struct stat st;
char path[PATH_MAX]; char path[PATH_MAX];
@ -627,8 +628,10 @@ int module_present(struct cmd_context *cmd, const char *target_name)
} }
#ifdef MODPROBE_CMD #ifdef MODPROBE_CMD
if (strcmp(target_name, TARGET_NAME_VDO) == 0) if ((strcmp(target_name, TARGET_NAME_VDO) == 0) &&
argv[1] = MODULE_NAME_VDO; /* ATM kvdo is without dm- prefix */ (sscanf(cmd->kernel_vsn, "%u.%u", &maj, &min) == 2) &&
((maj < 6) || ((maj == 6) && (min < 9))))
argv[1] = MODULE_NAME_VDO; /* Kernels < 6.9 -> "kvdo" without dm- prefix */
else if (dm_snprintf(module, sizeof(module), "dm-%s", target_name) < 0) { else if (dm_snprintf(module, sizeof(module), "dm-%s", target_name) < 0) {
log_error("module_present module name too long: %s", log_error("module_present module name too long: %s",
target_name); target_name);