Version 2.02.67 -
===============================
+ Replace strncmp kernel version number checks with proper ones.
Avoid selecting names under /dev/block if there is an alternative.
Update clustered log kernel module name to log-userspace for 2.6.31 onwards.
Activate only first head of Replicator for vgchange -ay.
unsigned maj2, min2, patchlevel2;
char vsn[80];
struct utsname uts;
+ unsigned kmaj, kmin, krel;
if (!_mirrored_checked) {
_mirrored_present = target_present(cmd, "mirror", 1);
* The dm-log-userspace module was added to the
* 2.6.31 kernel.
*/
- /* FIXME Replace the broken string comparison! */
- if (!uname(&uts) && strncmp(uts.release, "2.6.31", 6) < 0) {
+ if (!uname(&uts) &&
+ (sscanf(uts.release, "%u.%u.%u", &kmaj, &kmin, &krel) == 3) &&
+ KERNEL_VERSION(kmaj, kmin, krel) < KERNEL_VERSION(2, 6, 31)) {
if (module_present(cmd, "log-clustered"))
_mirror_attributes |= MIRROR_LOG_CLUSTERED;
} else if (module_present(cmd, "log-userspace"))
#define uninitialized_var(x) x = x
+#define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release))
+
#endif
int pos = 0;
char logbuf[DM_FORMAT_DEV_BUFSIZE];
const char *logtype;
+ unsigned kmaj, kmin, krel;
- r = uname(&uts);
- if (r)
+ if (!uname(&uts) || sscanf(uts.release, "%u.%u.%u", &kmaj, &kmin, &krel) != 3)
return_0;
if ((seg->flags & DM_BLOCK_ON_ERROR)) {
* "handle_errors" by the dm-mirror module's version
* number (>= 1.12) or by the kernel version (>= 2.6.22).
*/
- if (strncmp(uts.release, "2.6.22", 6) >= 0)
+ if (KERNEL_VERSION(kmaj, kmin, krel) >= KERNEL_VERSION(2, 6, 22))
handle_errors = 1;
else
block_on_error = 1;
* The dm-log-userspace module was added to the
* 2.6.31 kernel.
*/
- /* FIXME Replace the broken string comparison! */
- if (strncmp(uts.release, "2.6.31", 6) >= 0)
+ if (KERNEL_VERSION(kmaj, kmin, krel) >= KERNEL_VERSION(2, 6, 31))
dm_log_userspace = 1;
}