Sync from SUSE:SLFO:Main systemd revision 717f834345a3e9dd5e11966b78076c4b
This commit is contained in:
parent
938aeca38d
commit
0159c86e80
@ -1,18 +1,20 @@
|
|||||||
From b627d5aae4a8221ccd80dafb592edabfa6cc47cd Mon Sep 17 00:00:00 2001
|
From 39bbd48fee33d820ba3a2ed52067234b623e13c4 Mon Sep 17 00:00:00 2001
|
||||||
From: Franck Bui <fbui@suse.com>
|
From: Franck Bui <fbui@suse.com>
|
||||||
Date: Fri, 13 Sep 2024 12:16:12 +0200
|
Date: Fri, 13 Sep 2024 12:16:12 +0200
|
||||||
Subject: [PATCH 1/1] udev: restore some legacy symlinks to maintain backward
|
Subject: [PATCH] udev: restore some legacy symlinks to maintain backward
|
||||||
compatibility
|
compatibility
|
||||||
|
|
||||||
Extracted the openSUSE git repository, branch "compats/udev-compat-symlinks",
|
Extracted from the openSUSE git repository, branch "compats/udev-compat-symlinks",
|
||||||
commit aa2d840a3b149497a0de95049482eb9f1c667a38.
|
commit aa2d840a3b149497a0de95049482eb9f1c667a38.
|
||||||
|
|
||||||
|
- 2025-01-29: port to sd_device while trying to minimize the number of behavior changes.
|
||||||
---
|
---
|
||||||
rules.d/61-persistent-storage-compat.rules | 137 ++++++++
|
rules.d/61-persistent-storage-compat.rules | 137 +++++++++
|
||||||
rules.d/meson.build | 1 +
|
rules.d/meson.build | 1 +
|
||||||
src/udev/compat/meson.build | 13 +
|
src/udev/compat/meson.build | 8 +
|
||||||
src/udev/compat/path_id_compat.c | 378 +++++++++++++++++++++
|
src/udev/compat/path_id_compat.c | 329 +++++++++++++++++++++
|
||||||
src/udev/meson.build | 2 +
|
src/udev/meson.build | 2 +
|
||||||
5 files changed, 531 insertions(+)
|
5 files changed, 477 insertions(+)
|
||||||
create mode 100644 rules.d/61-persistent-storage-compat.rules
|
create mode 100644 rules.d/61-persistent-storage-compat.rules
|
||||||
create mode 100644 src/udev/compat/meson.build
|
create mode 100644 src/udev/compat/meson.build
|
||||||
create mode 100644 src/udev/compat/path_id_compat.c
|
create mode 100644 src/udev/compat/path_id_compat.c
|
||||||
@ -174,29 +176,24 @@ index 3040fae8a4..ca07be282c 100644
|
|||||||
'70-mouse.rules',
|
'70-mouse.rules',
|
||||||
diff --git a/src/udev/compat/meson.build b/src/udev/compat/meson.build
|
diff --git a/src/udev/compat/meson.build b/src/udev/compat/meson.build
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..2f07b6a9c7
|
index 0000000000..d624229bd1
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/udev/compat/meson.build
|
+++ b/src/udev/compat/meson.build
|
||||||
@@ -0,0 +1,13 @@
|
@@ -0,0 +1,8 @@
|
||||||
+foreach prog : ['path_id_compat.c']
|
+executable('path_id_compat',
|
||||||
+
|
+ 'path_id_compat.c',
|
||||||
+ executable(prog.split('.')[0],
|
+ include_directories : includes,
|
||||||
+ prog,
|
|
||||||
+ include_directories : [includes,
|
|
||||||
+ libudev_includes],
|
|
||||||
+ dependencies : [userspace],
|
+ dependencies : [userspace],
|
||||||
+ c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
|
+ c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
|
||||||
+ link_with : [udev_link_with, libudev_basic],
|
+ link_with : libshared,
|
||||||
+ install_rpath : udev_rpath,
|
|
||||||
+ install : true,
|
+ install : true,
|
||||||
+ install_dir : udevlibexecdir)
|
+ install_dir : udevlibexecdir)
|
||||||
+endforeach
|
|
||||||
diff --git a/src/udev/compat/path_id_compat.c b/src/udev/compat/path_id_compat.c
|
diff --git a/src/udev/compat/path_id_compat.c b/src/udev/compat/path_id_compat.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..f0d8e189fe
|
index 0000000000..c5839916ea
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/udev/compat/path_id_compat.c
|
+++ b/src/udev/compat/path_id_compat.c
|
||||||
@@ -0,0 +1,378 @@
|
@@ -0,0 +1,329 @@
|
||||||
+/*
|
+/*
|
||||||
+ * path_id_compat.c: compose persistent device path (compat version)
|
+ * path_id_compat.c: compose persistent device path (compat version)
|
||||||
+ *
|
+ *
|
||||||
@ -228,8 +225,11 @@ index 0000000000..f0d8e189fe
|
|||||||
+#include <errno.h>
|
+#include <errno.h>
|
||||||
+#include <dirent.h>
|
+#include <dirent.h>
|
||||||
+
|
+
|
||||||
+#include "libudev.h"
|
+#include "device-util.h"
|
||||||
|
+#include "dirent-util.h"
|
||||||
|
+#include "fd-util.h"
|
||||||
+#include "parse-util.h"
|
+#include "parse-util.h"
|
||||||
|
+#include "sd-device.h"
|
||||||
+#include "string-util.h"
|
+#include "string-util.h"
|
||||||
+
|
+
|
||||||
+#define PATH_SIZE 16384
|
+#define PATH_SIZE 16384
|
||||||
@ -238,8 +238,7 @@ index 0000000000..f0d8e189fe
|
|||||||
+static const char *compat_version_str = NULL;
|
+static const char *compat_version_str = NULL;
|
||||||
+static unsigned compat_version;
|
+static unsigned compat_version;
|
||||||
+
|
+
|
||||||
+static int path_prepend(char **path, const char *fmt, ...)
|
+static int path_prepend(char **path, const char *fmt, ...) {
|
||||||
+{
|
|
||||||
+ va_list va;
|
+ va_list va;
|
||||||
+ char *old;
|
+ char *old;
|
||||||
+ char *pre;
|
+ char *pre;
|
||||||
@ -270,70 +269,61 @@ index 0000000000..f0d8e189fe
|
|||||||
+** Linux only supports 32 bit luns.
|
+** Linux only supports 32 bit luns.
|
||||||
+** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details.
|
+** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details.
|
||||||
+*/
|
+*/
|
||||||
+static int format_lun_number(struct udev_device *dev, char **path)
|
+static int format_lun_number(sd_device *dev, char **path) {
|
||||||
+{
|
+ unsigned long lun;
|
||||||
+ unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10);
|
+ const char *sysnum;
|
||||||
+
|
+
|
||||||
+ /* address method 0, peripheral device addressing with bus id of zero */
|
+ (void) sd_device_get_sysnum(dev, &sysnum);
|
||||||
+ if (lun < 256)
|
+
|
||||||
|
+ lun = strtoul(sysnum, NULL, 10);
|
||||||
|
+ if (lun < 256) /* address method 0, peripheral device addressing with bus id of zero */
|
||||||
+ return path_prepend(path, "lun-%d", lun);
|
+ return path_prepend(path, "lun-%d", lun);
|
||||||
+
|
+
|
||||||
+ /* handle all other lun addressing methods by using a variant of the original lun format */
|
+ /* handle all other lun addressing methods by using a variant of the original lun format */
|
||||||
+ return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff);
|
+ return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys)
|
+static sd_device *skip_subsystem(sd_device *dev, const char *subsys) {
|
||||||
+{
|
+ for (sd_device *parent = dev; ; ) {
|
||||||
+ struct udev_device *parent = dev;
|
+ if (!device_in_subsystem(parent, subsys))
|
||||||
+
|
|
||||||
+ while (parent != NULL) {
|
|
||||||
+ const char *subsystem;
|
|
||||||
+
|
|
||||||
+ subsystem = udev_device_get_subsystem(parent);
|
|
||||||
+ if (subsystem == NULL || strcmp(subsystem, subsys) != 0)
|
|
||||||
+ break;
|
+ break;
|
||||||
|
+
|
||||||
+ dev = parent;
|
+ dev = parent;
|
||||||
+ parent = udev_device_get_parent(parent);
|
+ if (sd_device_get_parent(dev, &parent) < 0)
|
||||||
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ return dev;
|
+ return dev;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path)
|
+static sd_device *handle_scsi_default(sd_device *parent, char **path) {
|
||||||
+{
|
+ sd_device *hostdev;
|
||||||
+ struct udev_device *hostdev;
|
|
||||||
+ int host, bus, target, lun;
|
+ int host, bus, target, lun;
|
||||||
+ const char *name;
|
+ const char *sysname, *base, *pos;
|
||||||
+ char *base;
|
+ _cleanup_closedir_ DIR *dir = NULL;
|
||||||
+ char *pos;
|
+ int basenum = -1;
|
||||||
+ DIR *dir;
|
|
||||||
+ struct dirent *dent;
|
|
||||||
+ int basenum;
|
|
||||||
+
|
+
|
||||||
+ hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
|
+ if (sd_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host", &hostdev) < 0)
|
||||||
+ if (hostdev == NULL)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ name = udev_device_get_sysname(parent);
|
+ if (sd_device_get_sysname(parent, &sysname) < 0)
|
||||||
+ if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
|
+ return NULL;
|
||||||
|
+ if (sscanf(sysname, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ /* rebase host offset to get the local relative number */
|
+ /* rebase host offset to get the local relative number */
|
||||||
+ basenum = -1;
|
+ if (sd_device_get_syspath(hostdev, &base) < 0)
|
||||||
+ base = strdup(udev_device_get_syspath(hostdev));
|
|
||||||
+ if (base == NULL)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+ pos = strrchr(base, '/');
|
+ pos = strrchr(base, '/');
|
||||||
+ if (pos == NULL) {
|
+ if (!pos)
|
||||||
+ parent = NULL;
|
+ return NULL;
|
||||||
+ goto out;
|
+
|
||||||
+ }
|
+ base = strndupa_safe(base, pos - base);
|
||||||
+ pos[0] = '\0';
|
|
||||||
+ dir = opendir(base);
|
+ dir = opendir(base);
|
||||||
+ if (dir == NULL) {
|
+ if (!dir)
|
||||||
+ parent = NULL;
|
+ return NULL;
|
||||||
+ goto out;
|
+
|
||||||
+ }
|
+ FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
|
|
||||||
+ char *rest;
|
+ char *rest;
|
||||||
+ int i;
|
+ int i;
|
||||||
+
|
+
|
||||||
@ -349,68 +339,55 @@ index 0000000000..f0d8e189fe
|
|||||||
+ if (basenum == -1 || i < basenum)
|
+ if (basenum == -1 || i < basenum)
|
||||||
+ basenum = i;
|
+ basenum = i;
|
||||||
+ }
|
+ }
|
||||||
+ closedir(dir);
|
+ if (basenum == -1)
|
||||||
+ if (basenum == -1) {
|
+ return NULL;
|
||||||
+ parent = NULL;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ host -= basenum;
|
+ host -= basenum;
|
||||||
+
|
+
|
||||||
+ path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
|
+ path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
|
||||||
+out:
|
|
||||||
+ free(base);
|
|
||||||
+ return hostdev;
|
+ return hostdev;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static struct udev_device *handle_ata(struct udev_device *parent, char **path)
|
+static sd_device *handle_ata(sd_device *parent, char **path) {
|
||||||
+{
|
+ sd_device *hostdev;
|
||||||
+ struct udev_device *hostdev;
|
|
||||||
+ int host, bus, target, lun;
|
+ int host, bus, target, lun;
|
||||||
+ const char *name;
|
+ const char *name;
|
||||||
+
|
+
|
||||||
+ hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
|
+ if (sd_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host", &hostdev) < 0)
|
||||||
+ if (hostdev == NULL)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ name = udev_device_get_sysname(parent);
|
+ if (sd_device_get_sysname(parent, &name) < 0)
|
||||||
|
+ return NULL;
|
||||||
+ if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
|
+ if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4)
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
|
+ path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
|
||||||
+
|
|
||||||
+ return hostdev;
|
+ return hostdev;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path)
|
+static sd_device *handle_scsi_sas(sd_device *parent, char **path) {
|
||||||
+{
|
+ _cleanup_closedir_ DIR *dir = NULL;
|
||||||
+ struct udev *udev = udev_device_get_udev(parent);
|
+ _cleanup_(sd_device_unrefp) sd_device *sasdev = NULL;
|
||||||
+ struct udev_device *targetdev;
|
+ sd_device *targetdev, *target_parent, *portdev;
|
||||||
+ struct udev_device *target_parent;
|
+ const char *sas_address, *syspath, *sysname;
|
||||||
+ struct udev_device *sasdev;
|
|
||||||
+ struct udev_device *portdev;
|
|
||||||
+ struct dirent *dent;
|
|
||||||
+ DIR *dir;
|
|
||||||
+ const char *sas_address;
|
|
||||||
+ int tmp_phy_id, phy_id = 255;
|
+ int tmp_phy_id, phy_id = 255;
|
||||||
+ char *lun = NULL;
|
+ _cleanup_free_ char *lun = NULL;
|
||||||
+
|
+
|
||||||
+ targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target");
|
+ if (sd_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target", &targetdev) < 0)
|
||||||
+ if (!targetdev)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ target_parent = udev_device_get_parent(targetdev);
|
+ if (sd_device_get_parent(targetdev, &target_parent) < 0)
|
||||||
+ if (!target_parent)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ portdev = udev_device_get_parent(target_parent);
|
+ if (sd_device_get_parent(target_parent, &portdev) < 0)
|
||||||
+ if (!portdev)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ dir = opendir(udev_device_get_syspath(portdev));
|
+ if (sd_device_get_syspath(portdev, &syspath) < 0)
|
||||||
|
+ return NULL;
|
||||||
|
+ dir = opendir(syspath);
|
||||||
+ if (!dir)
|
+ if (!dir)
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
|
+ FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
+ const char *name = dent->d_name;
|
+ const char *name = dent->d_name;
|
||||||
+ char *phy_id_str;
|
+ char *phy_id_str;
|
||||||
+
|
+
|
||||||
@ -430,23 +407,21 @@ index 0000000000..f0d8e189fe
|
|||||||
+ if (tmp_phy_id >= 0 && tmp_phy_id < phy_id)
|
+ if (tmp_phy_id >= 0 && tmp_phy_id < phy_id)
|
||||||
+ phy_id = tmp_phy_id;
|
+ phy_id = tmp_phy_id;
|
||||||
+ }
|
+ }
|
||||||
+ closedir(dir);
|
|
||||||
+
|
+
|
||||||
+ if (phy_id == 255)
|
+ if (phy_id == 255)
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device",
|
+ if (sd_device_get_sysname(target_parent, &sysname) < 0)
|
||||||
+ udev_device_get_sysname(target_parent));
|
|
||||||
+ if (sasdev == NULL)
|
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ sas_address = udev_device_get_sysattr_value(sasdev, "sas_address");
|
+ if (sd_device_new_from_subsystem_sysname(&sasdev, "sas_device", sysname) < 0)
|
||||||
+ if (sas_address == NULL) {
|
+ return NULL;
|
||||||
+ parent = NULL;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ format_lun_number(parent, &lun);
|
+ if (sd_device_get_sysattr_value(sasdev, "sas_address", &sas_address) < 0)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if (format_lun_number(parent, &lun) < 0)
|
||||||
|
+ return NULL;
|
||||||
+
|
+
|
||||||
+ switch (compat_version) {
|
+ switch (compat_version) {
|
||||||
+ case 1:
|
+ case 1:
|
||||||
@ -457,51 +432,38 @@ index 0000000000..f0d8e189fe
|
|||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (lun)
|
|
||||||
+ free(lun);
|
|
||||||
+out:
|
|
||||||
+ udev_device_unref(sasdev);
|
|
||||||
+ return parent;
|
+ return parent;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
|
+static sd_device *handle_scsi(sd_device *parent, char **path) {
|
||||||
+{
|
|
||||||
+ const char *devtype;
|
+ const char *devtype;
|
||||||
+ const char *name;
|
+ const char *name;
|
||||||
|
+ int r;
|
||||||
+
|
+
|
||||||
+ devtype = udev_device_get_devtype(parent);
|
+ r = sd_device_get_devtype(parent, &devtype);
|
||||||
+ if (devtype == NULL || strcmp(devtype, "scsi_device") != 0)
|
+ if (r < 0 || strcmp(devtype, "scsi_device") != 0)
|
||||||
+ return parent;
|
+ return parent;
|
||||||
+
|
+
|
||||||
+ /* lousy scsi sysfs does not have a "subsystem" for the transport */
|
+ /* lousy scsi sysfs does not have a "subsystem" for the transport */
|
||||||
+ name = udev_device_get_syspath(parent);
|
+ (void) sd_device_get_syspath(parent, &name);
|
||||||
+
|
+
|
||||||
+ if (strstr(name, "/end_device-") != NULL) {
|
+ if (strstr(name, "/end_device-") != NULL)
|
||||||
+ parent = handle_scsi_sas(parent, path);
|
+ return handle_scsi_sas(parent, path);
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ if (strstr(name, "/ata") != NULL) {
|
+ if (strstr(name, "/ata") != NULL)
|
||||||
+ parent = handle_ata(parent, path);
|
+ return handle_ata(parent, path);
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ parent = handle_scsi_default(parent, path);
|
+ return handle_scsi_default(parent, path);
|
||||||
+out:
|
|
||||||
+ return parent;
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+int main(int argc, char **argv)
|
+int main(int argc, char **argv) {
|
||||||
+{
|
|
||||||
+ static const struct option options[] = {
|
+ static const struct option options[] = {
|
||||||
+ { "compat", required_argument, NULL, 'V' },
|
+ { "compat", required_argument, NULL, 'V' },
|
||||||
+ };
|
+ };
|
||||||
+ struct udev *udev;
|
+ _cleanup_(sd_device_unrefp) sd_device *dev = NULL;
|
||||||
+ struct udev_device *dev;
|
+ _cleanup_free_ char *path = NULL;
|
||||||
+ struct udev_device *parent;
|
|
||||||
+ char syspath[PATH_SIZE];
|
+ char syspath[PATH_SIZE];
|
||||||
+ char *path = NULL;
|
+ int r = 1;
|
||||||
+ int rc = 1;
|
|
||||||
+
|
+
|
||||||
+ for (;;) {
|
+ for (;;) {
|
||||||
+ int option;
|
+ int option;
|
||||||
@ -520,63 +482,49 @@ index 0000000000..f0d8e189fe
|
|||||||
+ if (compat_version_str) {
|
+ if (compat_version_str) {
|
||||||
+ if (safe_atou(compat_version_str, &compat_version) < 0) {
|
+ if (safe_atou(compat_version_str, &compat_version) < 0) {
|
||||||
+ fprintf(stderr, "--compat takes an integer.\n");
|
+ fprintf(stderr, "--compat takes an integer.\n");
|
||||||
+ goto exit2;
|
+ return 1;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (argv[optind] == NULL) {
|
+ if (argv[optind] == NULL) {
|
||||||
+ fprintf(stderr, "No device specified\n");
|
+ fprintf(stderr, "No device specified\n");
|
||||||
+ rc = 2;
|
+ return 2;
|
||||||
+ goto exit2;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ udev = udev_new();
|
|
||||||
+ if (udev == NULL)
|
|
||||||
+ goto exit2;
|
|
||||||
+
|
|
||||||
+ snprintf(syspath, PATH_SIZE, "%s%s", SYSFS_PATH, argv[optind]);
|
+ snprintf(syspath, PATH_SIZE, "%s%s", SYSFS_PATH, argv[optind]);
|
||||||
+ dev = udev_device_new_from_syspath(udev, syspath);
|
+ if (sd_device_new_from_syspath(&dev, syspath) < 0) {
|
||||||
+ if (dev == NULL) {
|
|
||||||
+ fprintf(stderr, "unable to access '%s'\n", argv[optind]);
|
+ fprintf(stderr, "unable to access '%s'\n", argv[optind]);
|
||||||
+ rc = 3;
|
+ return 3;
|
||||||
+ goto exit1;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /* walk up the chain of devices and compose path */
|
+ /* walk up the chain of devices and compose path */
|
||||||
+ parent = dev;
|
+ for (sd_device *parent = dev; parent; ) {
|
||||||
+ while (parent != NULL) {
|
+ const char *sysname;
|
||||||
+ const char *subsys;
|
|
||||||
+
|
+
|
||||||
+ subsys = udev_device_get_subsystem(parent);
|
+ if (sd_device_get_sysname(parent, &sysname) < 0)
|
||||||
+
|
|
||||||
+ if (subsys == NULL) {
|
|
||||||
+ ;
|
+ ;
|
||||||
+ } else if (strcmp(subsys, "scsi") == 0) {
|
+ else if (device_in_subsystem(parent, "scsi"))
|
||||||
+ parent = handle_scsi(parent, &path);
|
+ parent = handle_scsi(parent, &path);
|
||||||
+ } else if (strcmp(subsys, "pci") == 0) {
|
+ else if (device_in_subsystem(parent, "pci")) {
|
||||||
+ path_prepend(&path, "pci-%s", udev_device_get_sysname(parent));
|
+ path_prepend(&path, "pci-%s", sysname);
|
||||||
+ parent = skip_subsystem(parent, "pci");
|
+ parent = skip_subsystem(parent, "pci");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ parent = udev_device_get_parent(parent);
|
+ if (!parent)
|
||||||
|
+ break;
|
||||||
|
+ if (sd_device_get_parent(parent, &parent) < 0) /* return -ENOENT when no more parent */
|
||||||
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (path != NULL) {
|
+ if (path) {
|
||||||
+ printf("ID_PATH_COMPAT%s=%s\n", strempty(compat_version_str), path);
|
+ printf("ID_PATH_COMPAT%s=%s\n", strempty(compat_version_str), path);
|
||||||
+ free(path);
|
+ r = 0;
|
||||||
+ rc = 0;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ udev_device_unref(dev);
|
+ return r;
|
||||||
+
|
|
||||||
+exit1:
|
|
||||||
+ udev_unref(udev);
|
|
||||||
+
|
|
||||||
+exit2:
|
|
||||||
+ return rc;
|
|
||||||
+}
|
+}
|
||||||
diff --git a/src/udev/meson.build b/src/udev/meson.build
|
diff --git a/src/udev/meson.build b/src/udev/meson.build
|
||||||
index 3535551e74..d728f512d6 100644
|
index 3535551e74..59073f33d7 100644
|
||||||
--- a/src/udev/meson.build
|
--- a/src/udev/meson.build
|
||||||
+++ b/src/udev/meson.build
|
+++ b/src/udev/meson.build
|
||||||
@@ -273,3 +273,5 @@ udev_pc = custom_target(
|
@@ -273,3 +273,5 @@ udev_pc = custom_target(
|
||||||
@ -584,7 +532,7 @@ index 3535551e74..d728f512d6 100644
|
|||||||
install_emptydir(sysconfdir / 'udev/rules.d')
|
install_emptydir(sysconfdir / 'udev/rules.d')
|
||||||
endif
|
endif
|
||||||
+
|
+
|
||||||
+subdir('compat') # must be after 'src/libudev' for the definition of 'libudev_basic'
|
+subdir('compat')
|
||||||
--
|
--
|
||||||
2.43.0
|
2.43.0
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
From b090866bc0e9192224acaeeec875ef4c8846b829 Mon Sep 17 00:00:00 2001
|
From 09184a555aec3ef612425ba6fe596cf05383ca09 Mon Sep 17 00:00:00 2001
|
||||||
From: Franck Bui <fbui@suse.com>
|
From: Franck Bui <fbui@suse.com>
|
||||||
Date: Fri, 10 Jun 2016 15:19:57 +0200
|
Date: Fri, 10 Jun 2016 15:19:57 +0200
|
||||||
Subject: [PATCH 1/1] pid1: handle console specificities/weirdness for s390
|
Subject: [PATCH 1/1] pid1: handle console specificities/weirdness for s390
|
||||||
@ -14,26 +14,29 @@ imported from upsteam made them uneeded.
|
|||||||
The remaining bits are probably hackish but at least they are now
|
The remaining bits are probably hackish but at least they are now
|
||||||
minimal.
|
minimal.
|
||||||
|
|
||||||
It was an attempt to address bnc#860937. And yes turning the console
|
It was an attempt to address bnc#860937 to automatically turn the console color
|
||||||
color mode off by passing $TERM=dumb via the kernel command line would
|
mode off by passing $TERM=dumb when the specified terminal device is other than
|
||||||
have been much more easier and enough.
|
"3270". For more details, see
|
||||||
|
https://www.ibm.com/docs/en/linux-on-systems?topic=setup-kernel-parameters.
|
||||||
This is actually implemented by recent systemd. There's also another
|
|
||||||
command line option: systemd.log_color=off.
|
|
||||||
|
|
||||||
See also a short discussion which happened on @systemd-maintainers
|
See also a short discussion which happened on @systemd-maintainers
|
||||||
whose $subject is "[PATCH] support conmode setting on command line".
|
whose $subject is "[PATCH] support conmode setting on command line".
|
||||||
|
|
||||||
[fbui: fixes bsc#860937]
|
[fbui: fixes bsc#860937]
|
||||||
|
|
||||||
|
Don't warn if "conmode=" is missing as this option should not be passed on
|
||||||
|
s390x KVM.
|
||||||
|
|
||||||
|
[fbui: fixes bsc#1236725]
|
||||||
---
|
---
|
||||||
src/basic/terminal-util.c | 15 ++++++++++++++-
|
src/basic/terminal-util.c | 14 +++++++++++++-
|
||||||
1 file changed, 14 insertions(+), 1 deletion(-)
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
|
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
|
||||||
index 878c1ec06a..355ecdc45f 100644
|
index 409f2abb45..630fc81836 100644
|
||||||
--- a/src/basic/terminal-util.c
|
--- a/src/basic/terminal-util.c
|
||||||
+++ b/src/basic/terminal-util.c
|
+++ b/src/basic/terminal-util.c
|
||||||
@@ -923,7 +923,20 @@ bool tty_is_vc_resolve(const char *tty) {
|
@@ -912,7 +912,19 @@ bool tty_is_vc_resolve(const char *tty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* default_term_for_tty(const char *tty) {
|
const char* default_term_for_tty(const char *tty) {
|
||||||
@ -45,9 +48,8 @@ index 878c1ec06a..355ecdc45f 100644
|
|||||||
+ if (tty && tty_is_console(tty)) {
|
+ if (tty && tty_is_console(tty)) {
|
||||||
+ _cleanup_free_ char *mode = NULL;
|
+ _cleanup_free_ char *mode = NULL;
|
||||||
+
|
+
|
||||||
+ /* Simply return "dumb" in case of OOM. */
|
+ /* Returns "dumb" in case of OOM. */
|
||||||
+ (void) proc_cmdline_get_key("conmode", 0, &mode);
|
+ (void) proc_cmdline_get_key("conmode", 0, &mode);
|
||||||
+ (void) proc_cmdline_value_missing("conmode", mode);
|
|
||||||
+ return streq_ptr(mode, "3270") ? "ibm327x" : "dumb";
|
+ return streq_ptr(mode, "3270") ? "ibm327x" : "dumb";
|
||||||
+ }
|
+ }
|
||||||
+#endif
|
+#endif
|
||||||
|
@ -117,9 +117,6 @@
|
|||||||
%{_systemd_util_dir}/systemd-sysupdate
|
%{_systemd_util_dir}/systemd-sysupdate
|
||||||
%if %{with sd_boot}
|
%if %{with sd_boot}
|
||||||
%{_systemd_util_dir}/systemd-tpm2-setup
|
%{_systemd_util_dir}/systemd-tpm2-setup
|
||||||
%endif
|
|
||||||
%{_systemd_util_dir}/systemd-userwork
|
|
||||||
%if %{with sd_boot}
|
|
||||||
%{_systemd_util_dir}/ukify
|
%{_systemd_util_dir}/ukify
|
||||||
%endif
|
%endif
|
||||||
# ssh-generator: in the futur to be moved to the main package
|
# ssh-generator: in the futur to be moved to the main package
|
||||||
|
@ -482,6 +482,7 @@
|
|||||||
%{_systemd_util_dir}/systemd-user-sessions
|
%{_systemd_util_dir}/systemd-user-sessions
|
||||||
%if %{without bootstrap}
|
%if %{without bootstrap}
|
||||||
%{_systemd_util_dir}/systemd-userdbd
|
%{_systemd_util_dir}/systemd-userdbd
|
||||||
|
%{_systemd_util_dir}/systemd-userwork
|
||||||
%endif
|
%endif
|
||||||
%{_systemd_util_dir}/systemd-xdg-autostart-condition
|
%{_systemd_util_dir}/systemd-xdg-autostart-condition
|
||||||
%{_systemd_util_dir}/user-preset/90-systemd.preset
|
%{_systemd_util_dir}/user-preset/90-systemd.preset
|
||||||
|
BIN
systemd-257.3+suse.3.ge03ffd74c4.tar.xz
(Stored with Git LFS)
Normal file
BIN
systemd-257.3+suse.3.ge03ffd74c4.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
systemd-v257.2.tar.xz
(Stored with Git LFS)
BIN
systemd-v257.2.tar.xz
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +1,43 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Feb 14 15:05:52 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Import commit e03ffd74c4a30c1c75e05874ce18d31e503437b7 (merge of v257.3)
|
||||||
|
|
||||||
|
For a complete list of changes, visit:
|
||||||
|
https://github.com/openSUSE/systemd/compare/47794646786ae4ddb6d3deb2030e2761447999ec...e03ffd74c4a30c1c75e05874ce18d31e503437b7
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Feb 14 13:38:22 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Import commit 47794646786ae4ddb6d3deb2030e2761447999ec
|
||||||
|
|
||||||
|
4779464678 import-pubring.gpg: add openSUSE build key (bsc#1236751)
|
||||||
|
2c8382881f systemd-pull: support .asc and .sha256.* signature (bsc#1236887)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Feb 6 08:20:18 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- triggers.systemd: convert posix.fork() and posix.exec() to rpm.execute() (bsc#1236741)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Feb 6 08:15:34 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Update 0009-pid1-handle-console-specificities-weirdness-for-s390.patch to not
|
||||||
|
warn when "conmode=" is not specified on s390x (bsc#1236725).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Feb 4 09:01:53 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Move systemd-userwork from the experimental sub-package to the main package (bsc#1236643)
|
||||||
|
|
||||||
|
It is likely an oversight from when systemd-userdb was migrated from the
|
||||||
|
experimental package to the main one.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 29 16:48:05 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Port path_id_compat to the sd_device API
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jan 9 10:37:48 UTC 2025 - Franck Bui <fbui@suse.com>
|
Thu Jan 9 10:37:48 UTC 2025 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
@ -240,6 +280,7 @@ Thu Jul 4 09:07:28 UTC 2024 - Franck Bui <fbui@suse.com>
|
|||||||
|
|
||||||
- commit 3b2e7dc5a285edbbb1bf6aed2d88b889d801613f (bsc#1234015)
|
- commit 3b2e7dc5a285edbbb1bf6aed2d88b889d801613f (bsc#1234015)
|
||||||
- commit c072860593329293e19580b337504adb52248462 (bsc#1229518)
|
- commit c072860593329293e19580b337504adb52248462 (bsc#1229518)
|
||||||
|
- commit cfbf7538d87023840c5574fa5b0452e5b0f42149 (bsc#1229228)
|
||||||
|
|
||||||
- Added pam.systemd-run0
|
- Added pam.systemd-run0
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
%define systemd_release %{?release_override}%{!?release_override:0}
|
%define systemd_release %{?release_override}%{!?release_override:0}
|
||||||
%define archive_version %{nil}
|
%define archive_version %{nil}
|
||||||
%else
|
%else
|
||||||
%define systemd_version 257.2
|
%define systemd_version 257.3
|
||||||
%define systemd_release 0
|
%define systemd_release 0
|
||||||
%define archive_version %{nil}
|
%define archive_version +suse.3.ge03ffd74c4
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define systemd_major 257
|
%define systemd_major 257
|
||||||
@ -182,7 +182,7 @@ Provides: systemd-analyze = %{version}-%{release}
|
|||||||
Obsoletes: pm-utils <= 1.4.1
|
Obsoletes: pm-utils <= 1.4.1
|
||||||
Obsoletes: suspend <= 1.0
|
Obsoletes: suspend <= 1.0
|
||||||
Obsoletes: systemd-analyze < 201
|
Obsoletes: systemd-analyze < 201
|
||||||
Source0: systemd-v%{version}%{archive_version}.tar.xz
|
Source0: systemd-%{version}%{archive_version}.tar.xz
|
||||||
Source1: systemd-rpmlintrc
|
Source1: systemd-rpmlintrc
|
||||||
Source3: systemd-update-helper
|
Source3: systemd-update-helper
|
||||||
%if %{with sysvcompat}
|
%if %{with sysvcompat}
|
||||||
@ -730,7 +730,7 @@ for the C APIs.
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p1 -n systemd-v%{version}%{archive_version}
|
%autosetup -p1 -n systemd-%{version}%{archive_version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%meson \
|
%meson \
|
||||||
|
@ -6,27 +6,17 @@
|
|||||||
|
|
||||||
# The contents of this are an example to be copied into systemd.spec.
|
# The contents of this are an example to be copied into systemd.spec.
|
||||||
#
|
#
|
||||||
# Minimum rpm version supported: 4.14.0
|
# Minimum rpm version supported: 4.15.0
|
||||||
|
|
||||||
%transfiletriggerin -P 900900 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
%transfiletriggerin -P 900900 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
||||||
-- This script will run after any package is initially installed or
|
-- This script will run after any package is initially installed or
|
||||||
-- upgraded. We care about the case where a package is initially
|
-- upgraded. We care about the case where a package is initially
|
||||||
-- installed, because other cases are covered by the *un scriptlets,
|
-- installed, because other cases are covered by the *un scriptlets,
|
||||||
-- so sometimes we will reload needlessly.
|
-- so sometimes we will reload needlessly.
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-update-helper", "system-reload-restart"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-update-helper", "system-reload-restart"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
%transfiletriggerin -P 900899 -p <lua> -- /usr/lib/systemd/user /etc/systemd/user
|
%transfiletriggerin -P 900899 -p <lua> -- /usr/lib/systemd/user /etc/systemd/user
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-update-helper", "user-reload-restart"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-update-helper", "user-reload-restart"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
%transfiletriggerpostun -P 1000100 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
%transfiletriggerpostun -P 1000100 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
||||||
-- On removal, we need to run daemon-reload after any units have been
|
-- On removal, we need to run daemon-reload after any units have been
|
||||||
@ -34,39 +24,19 @@ end
|
|||||||
-- On upgrade, we need to run daemon-reload after any new unit files
|
-- On upgrade, we need to run daemon-reload after any new unit files
|
||||||
-- have been installed, but before %postun scripts in packages get
|
-- have been installed, but before %postun scripts in packages get
|
||||||
-- executed.
|
-- executed.
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-update-helper", "system-reload"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-update-helper", "system-reload"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
%transfiletriggerpostun -P 1000100 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
%transfiletriggerpostun -P 1000100 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
||||||
-- Execute daemon-reload in user managers.
|
-- Execute daemon-reload in user managers.
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-update-helper", "user-reload"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-update-helper", "user-reload"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
%transfiletriggerpostun -P 10000 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
%transfiletriggerpostun -P 10000 -p <lua> -- /usr/lib/systemd/system /etc/systemd/system
|
||||||
-- We restart remaining system services that should be restarted here.
|
-- We restart remaining system services that should be restarted here.
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-update-helper", "system-restart"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-update-helper", "system-restart"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
%transfiletriggerpostun -P 9999 -p <lua> -- /usr/lib/systemd/user /etc/systemd/user
|
%transfiletriggerpostun -P 9999 -p <lua> -- /usr/lib/systemd/user /etc/systemd/user
|
||||||
-- We restart remaining user services that should be restarted here.
|
-- We restart remaining user services that should be restarted here.
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-update-helper", "user-restart"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-update-helper", "user-restart"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
%transfiletriggerin -P 1000700 -p <lua> -- /usr/lib/sysusers.d
|
%transfiletriggerin -P 1000700 -p <lua> -- /usr/lib/sysusers.d
|
||||||
-- This script will process files installed in /usr/lib/sysusers.d to create
|
-- This script will process files installed in /usr/lib/sysusers.d to create
|
||||||
@ -93,12 +63,7 @@ assert(rpm.execute("journalctl", "--update-catalog"))
|
|||||||
-- This script will automatically apply binfmt rules if files have been
|
-- This script will automatically apply binfmt rules if files have been
|
||||||
-- installed or updated in /usr/lib/binfmt.d.
|
-- installed or updated in /usr/lib/binfmt.d.
|
||||||
if posix.access("/run/systemd/system") then
|
if posix.access("/run/systemd/system") then
|
||||||
pid = posix.fork()
|
assert(rpm.execute("/usr/lib/systemd/systemd-binfmt"))
|
||||||
if pid == 0 then
|
|
||||||
assert(posix.exec("/usr/lib/systemd/systemd-binfmt"))
|
|
||||||
elseif pid > 0 then
|
|
||||||
posix.wait(pid)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
%transfiletriggerin -P 1000600 -p <lua> -- /usr/lib/tmpfiles.d
|
%transfiletriggerin -P 1000600 -p <lua> -- /usr/lib/tmpfiles.d
|
||||||
|
Loading…
x
Reference in New Issue
Block a user