SHA256
1
0
forked from pool/systemd
systemd/1001-re-enable-by_path-links-for-ata-devices.patch
Dominique Leuenberger 70c63e98f9 Accepting request 286653 from Base:System
- mark more subpackages as !bootstrap for systemd-mini usage.

- spec : remove --with-firmware-path, firmware loader was removed in v217
- spec: remove --disable-multi-seat-x, gone.(fixed in xorg)
- spec: Do not enable systemd-readahead-collect.service and
systemd-readahead-replay.service as these do not exist anymore.
- spec: drop timedate-add-support-for-openSUSE-version-of-etc-sysconfig.patch
  Yast was fixed to write all timezone changes exactly how timedated expects
  things to be done.
- spec: remove handle-etc-HOSTNAME.patch, since late 2014 the netcfg
  package handles the migration from /etc/HOSTNAME to /etc/hostname
  and owns both files.
-spec: remove boot.udev and systemd-journald.init as they currently
  serve no purpose.
- suse-sysv-bootd-support.diff: Remove HAVE_SYSVINIT conditions, we
   are in sysvcompat-only codepath, also remove the code targetting other
   distributions, never compiled as the TARGET_$DISTRO macros are never defined.
- systemd-powerd-initctl-support.patch guard with HAVE_SYSV_COMPAT
- set-and-use-default-logconsole.patch: fix HAVE_SYSV_COMPAT guards
- insserv-generator.patch: Only build when sysvcompat is enabled
- vhangup-on-all-consoles.patch add a comment indicating this is a workaround
  for a kernel bug.
- spec: Add option to allow disabling sysvinit compat at build time.
- spec: Add option to enable resolved at build time.
- spec: Remove all %ifs for !factory products, current systemd releases can
  neither be built nor installed in older products without upgrading
  several components of the base system. 
  (removed: 1008-add-msft-compability-rules.patch was only for =< 13.1)
- spec: remove all dummy "aliases" to /etc/init.d, that made sense only when
  those init scripts still existed. (dummy localfs.service source: gone)

OBS-URL: https://build.opensuse.org/request/show/286653
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=215
2015-03-01 13:49:19 +00:00

100 lines
3.5 KiB
Diff

From 5cf46aa4339670afac386b1b0e630b739f3621c7 Mon Sep 17 00:00:00 2001
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 12 Jul 2012 15:56:34 +0000
Subject: [PATCH] Persistent by_path links for ata devices
With newer kernel we have the 'port_no' attribute,
which allows us to construct a valid ata by-path link.
With this patch ATA links of the form
ata-<port>.[01]
(for master/slave devices) or
ata-<port>.<pmp>.0
(for devices behind port multipliers)
are generated.
References: bnc#770910,FATE#317063
Signed-off-by: Robert Milasan <rmilasan@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
src/udev/udev-builtin-path_id.c | 53 ++++++++++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 12 deletions(-)
Index: systemd-218/src/udev/udev-builtin-path_id.c
===================================================================
--- systemd-218.orig/src/udev/udev-builtin-path_id.c
+++ systemd-218/src/udev/udev-builtin-path_id.c
@@ -426,6 +426,46 @@ static struct udev_device *handle_scsi_h
return parent;
}
+static struct udev_device *handle_ata(struct udev_device *parent, char **path)
+{
+ struct udev *udev = udev_device_get_udev(parent);
+ struct udev_device *hostdev, *portdev;
+ int host, bus, target, lun, port_no;
+ const char *name, *atahost, *port;
+
+ hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
+ if (hostdev == NULL)
+ return NULL;
+
+ name = udev_device_get_sysname(parent);
+ if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
+ return NULL;
+
+ /* The ata port is the parent of the SCSI host */
+ hostdev = udev_device_get_parent(hostdev);
+ atahost = udev_device_get_sysname(hostdev);
+ if (strncmp(atahost, "ata", 3))
+ return NULL;
+
+ /* ATA port number is found in 'port_no' attribute */
+ portdev = udev_device_new_from_subsystem_sysname(udev, "ata_port",
+ atahost);
+ port = udev_device_get_sysattr_value(portdev, "port_no");
+ if (!port || sscanf(port, "%d", &port_no) != 1) {
+ hostdev = NULL;
+ goto out;
+ }
+ if (bus != 0)
+ /* Devices behind port multiplier have a bus != 0*/
+ path_prepend(path, "ata-%u.%u.0", port_no, bus);
+ else
+ /* Master/slave are distinguished by target id */
+ path_prepend(path, "ata-%u.%u", port_no, target);
+out:
+ udev_device_unref(portdev);
+ return hostdev;
+}
+
static struct udev_device *handle_scsi(struct udev_device *parent, char **path, bool *supported_parent) {
const char *devtype;
const char *name;
@@ -465,19 +505,8 @@ static struct udev_device *handle_scsi(s
goto out;
}
- /*
- * We do not support the ATA transport class, it uses global counters
- * to name the ata devices which numbers spread across multiple
- * controllers.
- *
- * The real link numbers are not exported. Also, possible chains of ports
- * behind port multipliers cannot be composed that way.
- *
- * Until all that is solved at the kernel level, there are no by-path/
- * links for ATA devices.
- */
if (strstr(name, "/ata") != NULL) {
- parent = NULL;
+ parent = handle_ata(parent, path);
goto out;
}