Update uname patch

Milan's update for uname of kernel 3.0 test.
This commit is contained in:
Zdenek Kabelac 2011-06-22 13:29:10 +02:00
parent d47b2bc379
commit f583cdcadd

View File

@ -1,5 +1,18 @@
--- a/libdm/ioctl/libdm-iface.c --- LVM2.2.02.84.old/libdm/ioctl/libdm-iface.c 2011-02-04 22:26:33.000000000 +0100
+++ b/libdm/ioctl/libdm-iface.c +++ LVM2.2.02.84/libdm/ioctl/libdm-iface.c 2011-06-21 13:24:14.261923553 +0200
@@ -73,9 +73,9 @@ static unsigned _dm_version_minor = 0;
static unsigned _dm_version_patchlevel = 0;
static int _log_suppress = 0;
-static int _kernel_major;
-static int _kernel_minor;
-static int _kernel_release;
+static int _kernel_major = 0;
+static int _kernel_minor = 0;
+static int _kernel_release = 0;
/*
* If the kernel dm driver only supports one major number
@@ -152,6 +152,7 @@ static int _uname(void) @@ -152,6 +152,7 @@ static int _uname(void)
{ {
static int _uts_set = 0; static int _uts_set = 0;
@ -8,7 +21,7 @@
if (_uts_set) if (_uts_set)
return 1; return 1;
@@ -160,10 +161,18 @@ static int _uname(void) @@ -160,10 +161,14 @@ static int _uname(void)
log_error("uname failed: %s", strerror(errno)); log_error("uname failed: %s", strerror(errno));
return 0; return 0;
} }
@ -20,13 +33,45 @@
- &_kernel_release) != 3) { - &_kernel_release) != 3) {
+ &_kernel_release); + &_kernel_release);
+ +
+ if (parts == 1 && _kernel_major >= 3) { + /* Kernels with a major number of 2 always had 3 parts. */
+ _kernel_minor = 0; + if (parts < 1 || (_kernel_major < 3 && parts < 3)) {
+ _kernel_release = 0;
+ } else if (parts == 2 && _kernel_major >= 3) {
+ _kernel_release = 0;
+ } else if (parts != 3) {
log_error("Could not determine kernel version used."); log_error("Could not determine kernel version used.");
return 0; return 0;
} }
--- LVM2.2.02.84.old/libdm/libdm-deptree.c 2010-11-29 13:42:10.000000000 +0100
+++ LVM2.2.02.84/libdm/libdm-deptree.c 2011-06-21 13:25:11.062393944 +0200
@@ -1541,13 +1541,20 @@ static int _mirror_emit_segment_line(str
int dm_log_userspace = 0;
struct utsname uts;
unsigned log_parm_count;
- int pos = 0;
+ int pos = 0, parts;
char logbuf[DM_FORMAT_DEV_BUFSIZE];
const char *logtype;
- unsigned kmaj, kmin, krel;
+ unsigned kmaj = 0, kmin = 0, krel = 0;
- if (uname(&uts) == -1 || sscanf(uts.release, "%u.%u.%u", &kmaj, &kmin, &krel) != 3) {
- log_error("Cannot read kernel release version");
+ if (uname(&uts) == -1) {
+ log_error("Cannot read kernel release version.");
+ return 0;
+ }
+
+ /* Kernels with a major number of 2 always had 3 parts. */
+ parts = sscanf(uts.release, "%u.%u.%u", &kmaj, &kmin, &krel);
+ if (parts < 1 || (kmaj < 3 && parts < 3)) {
+ log_error("Wrong kernel release version %s.", uts.release);
return 0;
}
--- LVM2.2.02.84.old/WHATS_NEW_DM 2011-02-09 13:04:39.000000000 +0100
+++ LVM2.2.02.84/WHATS_NEW_DM 2011-06-21 13:24:58.862292506 +0200
@@ -1,3 +1,7 @@
+Version 1.02.65 -
+==================================
+ Accept new kernel version 3 formats in initialisation.
+
Version 1.02.63 - 9th February 2011
===================================
Reinstate DEBUG_MEM as it's part of the API. (1.02.62)