- fix #570136 - RHEL6: libblkid: support alignment_offset=-1
This commit is contained in:
parent
5ddedddbbb
commit
4f62fccdf2
2 changed files with 137 additions and 1 deletions
129
util-linux-ng-2.17-blkid-alignment-offset.patch
Normal file
129
util-linux-ng-2.17-blkid-alignment-offset.patch
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
diff -up util-linux-ng-2.17.1/shlibs/blkid/src/topology/ioctl.c.kzak util-linux-ng-2.17.1/shlibs/blkid/src/topology/ioctl.c
|
||||
--- util-linux-ng-2.17.1/shlibs/blkid/src/topology/ioctl.c.kzak 2010-03-03 14:40:53.000000000 +0100
|
||||
+++ util-linux-ng-2.17.1/shlibs/blkid/src/topology/ioctl.c 2010-03-03 15:08:36.000000000 +0100
|
||||
@@ -44,11 +44,18 @@ static int probe_ioctl_tp(blkid_probe pr
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
|
||||
struct topology_val *val = &topology_vals[i];
|
||||
- unsigned int data;
|
||||
+ unsigned int data = 0;
|
||||
int rc;
|
||||
|
||||
- if (ioctl(pr->fd, val->ioc, &data) == -1)
|
||||
+ if (val->ioc == BLKALIGNOFF) {
|
||||
+ int sdata = 0;
|
||||
+ if (ioctl(pr->fd, val->ioc, &sdata) == -1)
|
||||
+ goto nothing;
|
||||
+ data = sdata < 0 ? 0 : sdata;
|
||||
+
|
||||
+ } else if (ioctl(pr->fd, val->ioc, &data) == -1)
|
||||
goto nothing;
|
||||
+
|
||||
rc = val->set_result(pr, (unsigned long) data);
|
||||
if (rc)
|
||||
goto err;
|
||||
diff -up util-linux-ng-2.17.1/shlibs/blkid/src/topology/sysfs.c.kzak util-linux-ng-2.17.1/shlibs/blkid/src/topology/sysfs.c
|
||||
--- util-linux-ng-2.17.1/shlibs/blkid/src/topology/sysfs.c.kzak 2010-03-03 14:39:56.000000000 +0100
|
||||
+++ util-linux-ng-2.17.1/shlibs/blkid/src/topology/sysfs.c 2010-03-03 15:14:32.000000000 +0100
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
+#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -19,15 +20,14 @@
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
-static unsigned long dev_topology_attribute(const char *attribute,
|
||||
- dev_t dev, dev_t *primary)
|
||||
+static int dev_topology_attribute(const char *attribute,
|
||||
+ dev_t dev, dev_t *primary, int64_t *result)
|
||||
{
|
||||
const char *sysfs_fmt_str = "/sys/dev/block/%d:%d/%s";
|
||||
char path[PATH_MAX];
|
||||
int len;
|
||||
FILE *fp = NULL;
|
||||
struct stat info;
|
||||
- unsigned long result = 0UL;
|
||||
|
||||
len = snprintf(path, sizeof(path), sysfs_fmt_str,
|
||||
major(dev), minor(dev), attribute);
|
||||
@@ -58,7 +58,7 @@ static unsigned long dev_topology_attrib
|
||||
goto err;
|
||||
}
|
||||
|
||||
- if (fscanf(fp, "%lu", &result) != 1) {
|
||||
+ if (fscanf(fp, "%" SCNd64, result) != 1) {
|
||||
DBG(DEBUG_LOWPROBE, printf(
|
||||
"topology: %s: unexpected file format\n", path));
|
||||
goto err;
|
||||
@@ -67,15 +67,15 @@ static unsigned long dev_topology_attrib
|
||||
fclose(fp);
|
||||
|
||||
DBG(DEBUG_LOWPROBE,
|
||||
- printf("topology: attribute %s = %lu\n", attribute, result));
|
||||
+ printf("topology: attribute %s = %"PRId64"\n", attribute, *result));
|
||||
|
||||
- return result;
|
||||
+ return 0;
|
||||
err:
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
DBG(DEBUG_LOWPROBE,
|
||||
printf("topology: failed to read %s attribute\n", attribute));
|
||||
- return 0;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -107,17 +107,16 @@ static int probe_sysfs_tp(blkid_probe pr
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
|
||||
struct topology_val *val = &topology_vals[i];
|
||||
- unsigned long data;
|
||||
+ int64_t data = 0;
|
||||
|
||||
- /*
|
||||
- * Don't bother reporting any of the topology information
|
||||
- * if it's zero.
|
||||
- */
|
||||
- data = dev_topology_attribute(val->sysfs_name, dev, &pri_dev);
|
||||
- if (!data)
|
||||
+ if (dev_topology_attribute(val->sysfs_name, dev,
|
||||
+ &pri_dev, &data))
|
||||
continue;
|
||||
|
||||
- rc = val->set_result(pr, data);
|
||||
+ if (!strcmp(val->sysfs_name, "alignment_offset") && data < 0)
|
||||
+ data = 0;
|
||||
+
|
||||
+ rc = val->set_result(pr, (unsigned long) data);
|
||||
if (rc)
|
||||
goto err;
|
||||
count++;
|
||||
diff -up util-linux-ng-2.17.1/shlibs/blkid/src/topology/topology.c.kzak util-linux-ng-2.17.1/shlibs/blkid/src/topology/topology.c
|
||||
--- util-linux-ng-2.17.1/shlibs/blkid/src/topology/topology.c.kzak 2010-03-03 15:15:42.000000000 +0100
|
||||
+++ util-linux-ng-2.17.1/shlibs/blkid/src/topology/topology.c 2010-03-03 15:06:43.000000000 +0100
|
||||
@@ -43,6 +43,10 @@
|
||||
* @ALIGNMENT_OFFSET: indicates how many bytes the beginning o the device is
|
||||
* offset from the disk's natural alignment.
|
||||
*
|
||||
+ * The NAME=value tags are not defined when the corresponding topology value
|
||||
+ * is zero. The MINIMUM_IO_SIZE should be always defined if kernel provides
|
||||
+ * topology information.
|
||||
+ *
|
||||
* Binary interface:
|
||||
*
|
||||
* blkid_probe_get_tolology()
|
||||
@@ -214,6 +218,8 @@ static int topology_set_value(blkid_prob
|
||||
|
||||
if (!chn)
|
||||
return -1;
|
||||
+ if (!data)
|
||||
+ return 0; /* ignore zeros */
|
||||
|
||||
if (chn->binary) {
|
||||
unsigned long *v =
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
Summary: A collection of basic system utilities
|
||||
Name: util-linux-ng
|
||||
Version: 2.17.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
|
||||
Group: System Environment/Base
|
||||
URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng
|
||||
|
|
@ -103,6 +103,9 @@ Patch5: util-linux-ng-2.16-blkid-cachefile.patch
|
|||
Patch7: util-linux-ng-2.13-login-lastlog.patch
|
||||
# 231192 - ipcs is not printing correct values on pLinux
|
||||
Patch8: util-linux-ng-2.15-ipcs-32bit.patch
|
||||
# 570136 - RHEL6: libblkid: support alignment_offset=-1
|
||||
Patch9: util-linux-ng-2.17-blkid-alignment-offset.patch
|
||||
|
||||
|
||||
%description
|
||||
The util-linux-ng package contains a large variety of low-level system
|
||||
|
|
@ -196,6 +199,7 @@ cp %{SOURCE8} %{SOURCE9} .
|
|||
%patch5 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
|
||||
%build
|
||||
unset LINGUAS || :
|
||||
|
|
@ -715,6 +719,9 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Wed Mar 3 2010 Karel Zak <kzak@redhat.com> 2.17.1-2
|
||||
- fix #570136 - RHEL6: libblkid: support alignment_offset=-1
|
||||
|
||||
* Mon Feb 22 2010 Karel Zak <kzak@redhat.com> 2.17.1-1
|
||||
- upgrade to the final 2.17.1
|
||||
ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/v2.17.1-ReleaseNotes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue