1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

Accept kernel version 3 (3.0-rc and similar).

This commit is contained in:
Milan Broz 2011-06-09 15:07:40 +00:00
parent aa809cb877
commit fa380602cf
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.65 - Version 1.02.65 -
================================== ==================================
Accept new kernel version 3 formats in initialisation.
Version 1.02.64 - 29th April 2011 Version 1.02.64 - 29th April 2011
================================== ==================================

View File

@ -73,9 +73,9 @@ static unsigned _dm_version_minor = 0;
static unsigned _dm_version_patchlevel = 0; static unsigned _dm_version_patchlevel = 0;
static int _log_suppress = 0; static int _log_suppress = 0;
static int _kernel_major; static int _kernel_major = 0;
static int _kernel_minor; static int _kernel_minor = 0;
static int _kernel_release; static int _kernel_release = 0;
/* /*
* If the kernel dm driver only supports one major number * If the kernel dm driver only supports one major number
@ -152,6 +152,7 @@ static int _uname(void)
{ {
static int _uts_set = 0; static int _uts_set = 0;
struct utsname _uts; struct utsname _uts;
int parts;
if (_uts_set) if (_uts_set)
return 1; return 1;
@ -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;
} }
if (sscanf(_uts.release, "%d.%d.%d",
parts = sscanf(_uts.release, "%d.%d.%d",
&_kernel_major, &_kernel_major,
&_kernel_minor, &_kernel_minor,
&_kernel_release) != 3) { &_kernel_release);
/* Kernels with a major number of 2 always had 3 parts. */
if (parts < 1 || (_kernel_major < 3 && parts < 3)) {
log_error("Could not determine kernel version used."); log_error("Could not determine kernel version used.");
return 0; return 0;
} }