SHA256
1
0
forked from pool/systemd

Accepting request 163799 from home:fcrozat:branches:Base:System

update to v201

OBS-URL: https://build.opensuse.org/request/show/163799
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=363
This commit is contained in:
Dr. Werner Fink 2013-04-13 11:09:53 +00:00 committed by Git OBS Bridge
parent f33f3c9208
commit 4d2be9c235
168 changed files with 2997 additions and 9008 deletions

View File

@ -1,115 +0,0 @@
Index: systemd-195/src/core/service.c
===================================================================
--- systemd-195.orig/src/core/service.c
+++ systemd-195/src/core/service.c
@@ -3391,12 +3391,13 @@ static void service_notify_message(Unit
#ifdef HAVE_SYSV_COMPAT
-#ifdef TARGET_SUSE
-static void sysv_facility_in_insserv_conf(Manager *mgr) {
- FILE *f=NULL;
+#if defined(TARGET_SUSE) || defined(TARGET_DEBIAN)
+static void sysv_parse_insserv_conf(Manager *mgr, const char* filename) {
+ FILE *f = NULL;
int r;
- if (!(f = fopen("/etc/insserv.conf", "re"))) {
+ if (!(f = fopen(filename, "re"))) {
+ log_error("Failed to open file %s", filename);
r = errno == ENOENT ? 0 : -errno;
goto finish;
}
@@ -3410,7 +3411,7 @@ static void sysv_facility_in_insserv_con
break;
r = -errno;
- log_error("Failed to read configuration file '/etc/insserv.conf': %s", strerror(-r));
+ log_error("Failed to read configuration file '%s': %s", filename, strerror(-r));
goto finish;
}
@@ -3425,23 +3426,30 @@ static void sysv_facility_in_insserv_con
Unit *u;
if (sysv_translate_facility(parsed[0], NULL, &facility) < 0)
continue;
+ if (streq(facility, SPECIAL_REMOTE_FS_TARGET)) {
+ /* insert also a Wants dependency from remote-fs-pre on remote-fs */
+ u = manager_get_unit(mgr, SPECIAL_REMOTE_FS_TARGET);
+ unit_add_dependency_by_name(u, UNIT_WANTS, SPECIAL_REMOTE_FS_PRE_TARGET, NULL, true);
+ free (facility);
+ facility=strdup(SPECIAL_REMOTE_FS_PRE_TARGET);
+ }
if ((u = manager_get_unit(mgr, facility)) && (u->type == UNIT_TARGET)) {
- UnitDependency e;
char *dep = NULL, *name, **j;
STRV_FOREACH (j, parsed+1) {
- if (*j[0]=='+') {
- e = UNIT_WANTS;
+ if (*j[0] == '+')
name = *j+1;
- }
- else {
- e = UNIT_REQUIRES;
+ else
name = *j;
- }
+ if (streq(name, "boot.localfs") ||
+ streq(name, "boot.crypto"))
+ continue;
if (sysv_translate_facility(name, NULL, &dep) < 0)
continue;
- r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, e, dep, NULL, true);
+ r = unit_add_two_dependencies_by_name_inverse(u, UNIT_WANTS, UNIT_BEFORE, dep, NULL, true);
+ if (*j[0] != '+')
+ r = unit_add_dependency_by_name(u, UNIT_REQUIRES, dep, NULL, true);
free(dep);
}
}
@@ -3454,6 +3462,35 @@ finish:
fclose(f);
}
+
+static void sysv_facility_in_insserv_conf(Manager *mgr) {
+ DIR *d =NULL;
+ struct dirent *de;
+
+#ifdef TARGET_DEBIAN
+ if (!(d = opendir("/etc/insserv.conf.d/")))
+ if (errno != ENOENT) {
+ log_warning("opendir() failed on /etc/insserv.conf.d/ %s", strerror(errno));
+ goto finish;
+ }
+
+ while ((de = readdir(d))) {
+ char *path = NULL;
+ if (ignore_file(de->d_name))
+ continue;
+
+ path = join("/etc/insserv.conf.d/", de->d_name, NULL);
+ sysv_parse_insserv_conf(mgr, path);
+ free(path);
+ }
+finish:
+ if (d)
+ closedir(d);
+#endif
+
+ sysv_parse_insserv_conf(mgr, "/etc/insserv.conf");
+}
+
#endif
static int service_enumerate(Manager *m) {
@@ -3604,7 +3641,7 @@ static int service_enumerate(Manager *m)
r = 0;
-#ifdef TARGET_SUSE
+#if defined(TARGET_SUSE) || defined(TARGET_DEBIAN)
sysv_facility_in_insserv_conf (m);
#endif

View File

@ -1,3 +1,7 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 11 Apr 2013 15:39:39 +0200
Subject: Reinstate TIMEOUT handling
Without treating events with timeouts specially some drivers would
cause a 30 seconds stall on boot: .
@ -10,29 +14,24 @@ the kernel (3.4?).
This reverts 43d5c5f03645c4b842659f9b5bd0ae465e885e92 and
57c6f8ae5f52a6e8ffc66a54966346f733dded39.
---
src/libudev/libudev-device.c | 19 +++++++++++++++++++
src/libudev/libudev-private.h | 1 +
src/udev/udevd.c | 13 ++++++++++---
3 files changed, 30 insertions(+), 3 deletions(-)
Note: this is mostly a FYI, and whether or not it makes sense
to apply this upstream depends on how big problems other report
regarding this issue.
src/libudev-device.c | 19 +++++++++++++++++++
src/libudev-private.h | 1 +
src/udevd.c | 13 ++++++++++---
4 files changed, 32 insertions(+), 3 deletions(-)
Index: systemd-195/src/libudev/libudev-device.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-device.c
+++ systemd-195/src/libudev/libudev-device.c
@@ -68,6 +68,7 @@ struct udev_device {
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 6bb2e41..4fdd242 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -78,6 +78,7 @@ struct udev_device {
struct udev_list tags_list;
unsigned long long int seqnum;
unsigned long long int usec_initialized;
usec_t usec_initialized;
+ int timeout;
int devlink_priority;
int refcount;
dev_t devnum;
@@ -162,6 +163,21 @@ static int udev_device_set_devnum(struct
@@ -172,6 +173,21 @@ static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
return 0;
}
@ -54,7 +53,7 @@ Index: systemd-195/src/libudev/libudev-device.c
const char *udev_device_get_devpath_old(struct udev_device *udev_device)
{
return udev_device->devpath_old;
@@ -418,6 +434,8 @@ void udev_device_add_property_from_strin
@@ -462,6 +478,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
udev_device_set_devpath_old(udev_device, &property[12]);
} else if (startswith(property, "SEQNUM=")) {
udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10));
@ -63,7 +62,7 @@ Index: systemd-195/src/libudev/libudev-device.c
} else if (startswith(property, "IFINDEX=")) {
udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10));
} else if (startswith(property, "DEVMODE=")) {
@@ -605,6 +623,7 @@ struct udev_device *udev_device_new(stru
@@ -653,6 +671,7 @@ struct udev_device *udev_device_new(struct udev *udev)
udev_list_init(udev, &udev_device->sysattr_value_list, true);
udev_list_init(udev, &udev_device->sysattr_list, false);
udev_list_init(udev, &udev_device->tags_list, true);
@ -71,23 +70,23 @@ Index: systemd-195/src/libudev/libudev-device.c
udev_device->watch_handle = -1;
/* copy global properties */
udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev))
Index: systemd-195/src/libudev/libudev-private.h
===================================================================
--- systemd-195.orig/src/libudev/libudev-private.h
+++ systemd-195/src/libudev/libudev-private.h
@@ -65,6 +65,7 @@ const char *udev_device_get_id_filename(
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index 54c51ac..d2124ea 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -77,6 +77,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device);
void udev_device_set_is_initialized(struct udev_device *udev_device);
int udev_device_add_tag(struct udev_device *udev_device, const char *tag);
void udev_device_cleanup_tags_list(struct udev_device *udev_device);
+int udev_device_get_timeout(struct udev_device *udev_device);
unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device);
void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized);
usec_t udev_device_get_usec_initialized(struct udev_device *udev_device);
void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized);
int udev_device_get_devlink_priority(struct udev_device *udev_device);
Index: systemd-195/src/udev/udevd.c
===================================================================
--- systemd-195.orig/src/udev/udevd.c
+++ systemd-195/src/udev/udevd.c
@@ -388,7 +388,7 @@ out:
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2ad7388..5a90b60 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -391,7 +391,7 @@ out:
}
}
@ -96,7 +95,7 @@ Index: systemd-195/src/udev/udevd.c
{
struct udev_list_node *loop;
@@ -414,7 +414,7 @@ static void event_run(struct event *even
@@ -417,7 +417,7 @@ static void event_run(struct event *event)
return;
}
@ -105,7 +104,7 @@ Index: systemd-195/src/udev/udevd.c
if (children_max > 1)
log_debug("maximum number (%i) of children reached\n", children);
return;
@@ -450,6 +450,13 @@ static int event_queue_insert(struct ude
@@ -455,6 +455,13 @@ static int event_queue_insert(struct udev_device *dev)
event->state = EVENT_QUEUED;
udev_list_node_append(&event->node, &event_list);
@ -119,7 +118,7 @@ Index: systemd-195/src/udev/udevd.c
return 0;
}
@@ -559,7 +566,7 @@ static void event_queue_start(struct ude
@@ -566,7 +573,7 @@ static void event_queue_start(struct udev *udev)
if (is_devpath_busy(event))
continue;

View File

@ -1,9 +1,18 @@
Index: systemd-195/src/udev/udev-builtin-path_id.c
===================================================================
--- systemd-195.orig/src/udev/udev-builtin-path_id.c
+++ systemd-195/src/udev/udev-builtin-path_id.c
@@ -302,6 +302,85 @@ out:
return hostdev;
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 12 Jul 2012 15:56:34 +0000
Subject: re-enable by_path links for ata devices
Fix by-path links for ATA transport (bnc#770910)
---
src/udev/udev-builtin-path_id.c | 92 +++++++++++++++++++++++++++++++++++------
1 file changed, 80 insertions(+), 12 deletions(-)
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index da02731..a77d4e8 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -338,6 +338,85 @@ static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char *
return parent;
}
+static struct udev_device *handle_ata(struct udev_device *parent, char **path)
@ -88,17 +97,20 @@ Index: systemd-195/src/udev/udev-builtin-path_id.c
static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
{
const char *devtype;
@@ -338,16 +417,8 @@ static struct udev_device *handle_scsi(s
@@ -374,19 +453,8 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
goto out;
}
- /*
- * We do not support the ATA transport class, it creates duplicated link
- * names as the fake SCSI host adapters are all separated, they are all
- * re-based as host == 0. ATA should just stop faking two duplicated
- * hierarchies for a single topology and leave the SCSI stuff alone;
- * until that happens, there are no by-path/ links for ATA devices behind
- * an ATA transport class.
- * 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;

View File

@ -1,8 +1,17 @@
Index: systemd-195/rules/60-persistent-storage.rules
===================================================================
--- systemd-195.orig/rules/60-persistent-storage.rules
+++ systemd-195/rules/60-persistent-storage.rules
@@ -44,6 +44,10 @@ KERNEL=="cciss*", ENV{DEVTYPE}=="disk",
From: Robert Milasan <rmilasan@suse.com>
Date: Wed, 27 Jun 2012 08:55:59 +0000
Subject: rules create by id scsi links for ATA devices
Re-enable creation of by-id scsi links for ATA devices. (bnc#769002)
---
rules/60-persistent-storage.rules | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index a4d009a..f720c7e 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -42,6 +42,10 @@ KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="s
KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"

View File

@ -1,11 +1,20 @@
Index: systemd-195/src/udev/udevd.c
===================================================================
--- systemd-195.orig/src/udev/udevd.c
+++ systemd-195/src/udev/udevd.c
@@ -1513,6 +1513,8 @@ int main(int argc, char *argv[])
From: Robert Milasan <rmilasan@suse.com>
Date: Mon, 6 Aug 2012 13:35:34 +0000
Subject: udev netlink null rules
udevd race for netlink events (bnc#774646)
---
src/udev/udevd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 5a90b60..2a0bf60 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1410,6 +1410,8 @@ int main(int argc, char *argv[])
dev = udev_monitor_receive_device(monitor);
if (dev != NULL) {
udev_device_set_usec_initialized(dev, now_usec());
udev_device_set_usec_initialized(dev, now(CLOCK_MONOTONIC));
+ if (rules == NULL)
+ rules = udev_rules_new(udev, resolve_names);
if (event_queue_insert(dev) < 0)

View File

@ -1,12 +1,22 @@
Index: systemd-190/rules/80-drivers.rules
===================================================================
--- systemd-190.orig/rules/80-drivers.rules
+++ systemd-190/rules/80-drivers.rules
@@ -7,6 +7,7 @@ SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}==
SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms"
SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block"
SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block"
From: Robert Milasan <rmilasan@suse.com>
Date: Tue, 7 Aug 2012 08:34:49 +0000
Subject: udev fix sg autoload regression
Fix regression in udev where sg driver is no longer loaded for disc
events. Will need a non-udev solution for 12.3 (bnc#761109).
---
rules/80-drivers.rules | 1 +
1 file changed, 1 insertion(+)
diff --git a/rules/80-drivers.rules b/rules/80-drivers.rules
index 50523e4..b863532 100644
--- a/rules/80-drivers.rules
+++ b/rules/80-drivers.rules
@@ -7,6 +7,7 @@ SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN{builtin}="kmod load tifm_sd"
SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN{builtin}="kmod load tifm_ms"
SUBSYSTEM=="memstick", RUN{builtin}="kmod load ms_block mspro_block"
SUBSYSTEM=="i2o", RUN{builtin}="kmod load i2o_block"
+SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", IMPORT{builtin}="kmod load sg"
SUBSYSTEM=="module", KERNEL=="parport_pc", RUN{builtin}="kmod load ppdev"
KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN{builtin}="kmod load sm_ftl"
LABEL="drivers_end"

View File

@ -1,13 +0,0 @@
Index: systemd-195/src/udev/udevd.c
===================================================================
--- systemd-195.orig/src/udev/udevd.c
+++ systemd-195/src/udev/udevd.c
@@ -820,7 +820,7 @@ static void static_dev_create_from_modul
FILE *f;
uname(&kernel);
- util_strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
+ util_strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL);
f = fopen(modules, "re");
if (f == NULL)
return;

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 5 Dec 2012 15:13:27 +0000
Subject: fix devname prefix
fix modules.devname path, it isn't in /usr.
---
src/udev/udevd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2a0bf60..6c2c2c9 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -827,7 +827,7 @@ static void static_dev_create_from_modules(struct udev *udev)
FILE *f;
uname(&kernel);
- strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
+ strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL);
f = fopen(modules, "re");
if (f == NULL)
return;

View File

@ -1,24 +0,0 @@
From 5bbbe461fd4d133eac49f41210e2fd4846f577d8 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 19 Dec 2012 13:12:26 +0100
Subject: [PATCH] udevd: add missing ':' to getopt_long 'e'
Parameter -e is set without additional argument in getopt
and this leads to segfault when calling 'systemd-udevd -e'.
---
src/udev/udevd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Index: systemd-195/src/udev/udevd.c
===================================================================
--- systemd-195.orig/src/udev/udevd.c
+++ systemd-195/src/udev/udevd.c
@@ -1104,7 +1104,7 @@ int main(int argc, char *argv[])
for (;;) {
int option;
- option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL);
+ option = getopt_long(argc, argv, "c:de:DtN:hV", options, NULL);
if (option == -1)
break;

View File

@ -1,72 +0,0 @@
From a24d03b8ee2ca62cd1273e27cf4e79ddcc0fbb1c Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 23 Nov 2012 14:12:39 +0100
Subject: [PATCH] udev: path_id - handle Hyper-V devices
Hyper-V has an abstract bus, which gets renumbered on guest
startup. So instead of the bus numbers we should be using
the device GUIDs, which can be retrieved from the 'device_id'
sysfs attribute.
---
src/udev/udev-builtin-path_id.c | 41 +++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
Index: systemd-195/src/udev/udev-builtin-path_id.c
===================================================================
--- systemd-195.orig/src/udev/udev-builtin-path_id.c
+++ systemd-195/src/udev/udev-builtin-path_id.c
@@ -381,6 +381,42 @@ out:
return hostdev;
}
+static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char **path) {
+ struct udev_device *hostdev;
+ struct udev_device *vmbusdev;
+ const char *guid_str;
+ char *lun = NULL;
+ char guid[38];
+ size_t i, k;
+
+ hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
+ if (!hostdev)
+ return NULL;
+
+ vmbusdev = udev_device_get_parent(hostdev);
+ if (!vmbusdev)
+ return NULL;
+
+ guid_str = udev_device_get_sysattr_value(vmbusdev, "device_id");
+ if (!guid_str)
+ return NULL;
+
+ if (strlen(guid_str) < 37 || guid_str[0] != '{' || guid_str[36] != '}')
+ return NULL;
+
+ for (i = 1, k = 0; i < 36; i++) {
+ if (guid_str[i] == '-')
+ continue;
+ guid[k++] = guid_str[i];
+ }
+ guid[k] = '\0';
+
+ format_lun_number(parent, &lun);
+ path_prepend(path, "vmbus-%s-%s", guid, lun);
+ free(lun);
+ return parent;
+}
+
static struct udev_device *handle_scsi(struct udev_device *parent, char **path)
{
const char *devtype;
@@ -422,6 +458,11 @@ static struct udev_device *handle_scsi(s
goto out;
}
+ if (strstr(name, "/vmbus_") != NULL) {
+ parent = handle_scsi_hyperv(parent, path);
+ goto out;
+ }
+
parent = handle_scsi_default(parent, path);
out:
return parent;

View File

@ -1,136 +0,0 @@
From 68c77c2f6168dca0ce7b5edb81612cd6be39e63d Mon Sep 17 00:00:00 2001
From: Alessandro Crismani <alessandro.crismani@gmail.com>
Date: Wed, 8 Aug 2012 14:19:32 +0200
Subject: [PATCH] keymap: Update the list of Samsung Series 9 models
Currently, keymaps are provided only for the NP90X3A laptop. Samsung
introduced updated models, codenamed 900X3B, 900X3C, 900X4B, 900X4C,
which are currently not matched by udev rules. This patch includes the
newer modules in udev rules and move the samsung-n90x3a file defining
keys to a more generic samsung-series-9 file.
The patch was tested on a 900X4C laptop, and other people reported
that the rules also work for 900X3B and 900X3C ones.
---
delete mode 100644 keymaps-force-release/samsung-90x3a
create mode 100644 keymaps-force-release/samsung-series-9
delete mode 100644 keymaps/samsung-90x3a
create mode 100644 keymaps/samsung-series-9
From 68c77c2f6168dca0ce7b5edb81612cd6be39e63d Mon Sep 17 00:00:00 2001
From: Alessandro Crismani <alessandro.crismani@gmail.com>
Date: Wed, 8 Aug 2012 14:19:32 +0200
Subject: [PATCH] keymap: Update the list of Samsung Series 9 models
Currently, keymaps are provided only for the NP90X3A laptop. Samsung
introduced updated models, codenamed 900X3B, 900X3C, 900X4B, 900X4C,
which are currently not matched by udev rules. This patch includes the
newer modules in udev rules and move the samsung-n90x3a file defining
keys to a more generic samsung-series-9 file.
The patch was tested on a 900X4C laptop, and other people reported
that the rules also work for 900X3B and 900X3C ones.
---
Makefile.am | 4 ++--
keymaps-force-release/samsung-90x3a | 6 ------
keymaps-force-release/samsung-series-9 | 6 ++++++
keymaps/samsung-90x3a | 5 -----
keymaps/samsung-series-9 | 5 +++++
src/udev/keymap/95-keyboard-force-release.rules | 2 +-
src/udev/keymap/95-keymap.rules | 2 +-
7 files changed, 15 insertions(+), 15 deletions(-)
delete mode 100644 keymaps-force-release/samsung-90x3a
create mode 100644 keymaps-force-release/samsung-series-9
delete mode 100644 keymaps/samsung-90x3a
create mode 100644 keymaps/samsung-series-9
Index: systemd-195/Makefile.am
===================================================================
--- systemd-195.orig/Makefile.am
+++ systemd-195/Makefile.am
@@ -2272,7 +2272,7 @@ dist_udevkeymap_DATA = \
keymaps/onkyo \
keymaps/oqo-model2 \
keymaps/samsung-other \
- keymaps/samsung-90x3a \
+ keymaps/samsung-series-9 \
keymaps/samsung-sq1us \
keymaps/samsung-sx20s \
keymaps/toshiba-satellite_a100 \
@@ -2286,7 +2286,7 @@ dist_udevkeymapforcerel_DATA = \
keymaps-force-release/dell-xps \
keymaps-force-release/hp-other \
keymaps-force-release/samsung-other \
- keymaps-force-release/samsung-90x3a \
+ keymaps-force-release/samsung-series-9 \
keymaps-force-release/common-volume-keys
src/udev/keymap/keys.txt: Makefile
Index: systemd-195/keymaps-force-release/samsung-90x3a
===================================================================
--- systemd-195.orig/keymaps-force-release/samsung-90x3a
+++ /dev/null
@@ -1,6 +0,0 @@
-# list of scancodes (hex or decimal), optional comment
-0xCE # Fn+F8 keyboard backlit up
-0x8D # Fn+F7 keyboard backlit down
-0x97 # Fn+F12 wifi on/off
-0x96 # Fn+F1 performance mode (?)
-0xD5 # Fn+F6 battery life extender
Index: systemd-195/keymaps-force-release/samsung-series-9
===================================================================
--- /dev/null
+++ systemd-195/keymaps-force-release/samsung-series-9
@@ -0,0 +1,6 @@
+# list of scancodes (hex or decimal), optional comment
+0xCE # Fn+F8 keyboard backlit up
+0x8D # Fn+F7 keyboard backlit down
+0x97 # Fn+F12 wifi on/off
+0x96 # Fn+F1 performance mode (?)
+0xD5 # Fn+F6 battery life extender
Index: systemd-195/keymaps/samsung-90x3a
===================================================================
--- systemd-195.orig/keymaps/samsung-90x3a
+++ /dev/null
@@ -1,5 +0,0 @@
-0x96 kbdillumup # Fn+F8 keyboard backlit up
-0x97 kbdillumdown # Fn+F7 keyboard backlit down
-0xD5 wlan # Fn+F12 wifi on/off
-0xCE prog1 # Fn+F1 performance mode
-0x8D prog2 # Fn+F6 battery life extender
Index: systemd-195/keymaps/samsung-series-9
===================================================================
--- /dev/null
+++ systemd-195/keymaps/samsung-series-9
@@ -0,0 +1,5 @@
+0x96 kbdillumup # Fn+F8 keyboard backlit up
+0x97 kbdillumdown # Fn+F7 keyboard backlit down
+0xD5 wlan # Fn+F12 wifi on/off
+0xCE prog1 # Fn+F1 performance mode
+0x8D prog2 # Fn+F6 battery life extender
Index: systemd-195/src/udev/keymap/95-keyboard-force-release.rules
===================================================================
--- systemd-195.orig/src/udev/keymap/95-keyboard-force-release.rules
+++ systemd-195/src/udev/keymap/95-keyboard-force-release.rules
@@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end
ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}"
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other"
-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*", RUN+="keyboard-force-release.sh $devpath samsung-90x3a"
+ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*|*900X3*|*900X4*", RUN+="keyboard-force-release.sh $devpath samsung-series-9"
ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys"
ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Latitude *U|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad"
Index: systemd-195/src/udev/keymap/95-keymap.rules
===================================================================
--- systemd-195.orig/src/udev/keymap/95-keymap.rules
+++ systemd-195/src/udev/keymap/95-keymap.rules
@@ -147,7 +147,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][n
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s"
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us"
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown"
-ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*", RUN+="keymap $name samsung-90x3a"
+ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*|*900X3*|*900X4*", RUN+="keymap $name samsung-series-9"
ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100"
ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110"

View File

@ -1,22 +0,0 @@
From a5dea3d43b3866b48c66d6bef9663cf8372fd96c Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinpitt@gnome.org>
Date: Wed, 28 Nov 2012 21:33:26 +0100
Subject: [PATCH] keymap: Add Samsung 700T
https://bugzilla.redhat.com/show_bug.cgi?id=879691
---
src/udev/keymap/95-keymap.rules | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Index: systemd-195/src/udev/keymap/95-keymap.rules
===================================================================
--- systemd-195.orig/src/udev/keymap/95-keymap.rules
+++ systemd-195/src/udev/keymap/95-keymap.rules
@@ -147,6 +147,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][n
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s"
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us"
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown"
+ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700T*", RUN+="keymap $name 0xAD leftmeta"
ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*|*900X3*|*900X4*", RUN+="keymap $name samsung-series-9"
ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100"

View File

@ -1,36 +0,0 @@
From cf2292f5ac87087f57dbd632a25a332c9d194ebf Mon Sep 17 00:00:00 2001
From: Mauro Dreissig <mukadr@gmail.com>
Date: Sun, 11 Nov 2012 22:07:51 -0200
Subject: [PATCH] libudev: avoid leak during realloc failure
---
src/libudev/libudev-list.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Index: systemd-195/src/libudev/libudev-list.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-list.c
+++ systemd-195/src/libudev/libudev-list.c
@@ -177,18 +177,20 @@ struct udev_list_entry *udev_list_entry_
if (list->unique) {
/* allocate or enlarge sorted array if needed */
if (list->entries_cur >= list->entries_max) {
+ struct udev_list_entry **entries;
unsigned int add;
add = list->entries_max;
if (add < 1)
add = 64;
- list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *));
- if (list->entries == NULL) {
+ entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *));
+ if (entries == NULL) {
free(entry->name);
free(entry->value);
free(entry);
return NULL;
}
+ list->entries = entries;
list->entries_max += add;
}

View File

@ -1,40 +0,0 @@
From 5ae18ddc0d86673520c0dd6b59ccac8afc8aa605 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 20 Nov 2012 18:07:57 +0100
Subject: [PATCH] libudev: do not resolve $attr{device} symlinks
---
src/libudev/libudev-device.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
Index: systemd-195/src/libudev/libudev-device.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-device.c
+++ systemd-195/src/libudev/libudev-device.c
@@ -1369,16 +1369,17 @@ _public_ const char *udev_device_get_sys
goto out;
}
- /* resolve link to a device and return its syspath */
- util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL);
- dev = udev_device_new_from_syspath(udev_device->udev, path);
- if (dev != NULL) {
- list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr,
- udev_device_get_syspath(dev));
- val = udev_list_entry_get_value(list_entry);
- udev_device_unref(dev);
+ /* resolve custom link to a device and return its syspath */
+ if (!streq(sysattr, "device")) {
+ util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL);
+ dev = udev_device_new_from_syspath(udev_device->udev, path);
+ if (dev != NULL) {
+ list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr,
+ udev_device_get_syspath(dev));
+ val = udev_list_entry_get_value(list_entry);
+ udev_device_unref(dev);
+ }
}
-
goto out;
}

View File

@ -1,23 +0,0 @@
From e68893075083a7461b1572233d23fdb23541d630 Mon Sep 17 00:00:00 2001
From: Michael Terry <michael.terry@canonical.com>
Date: Fri, 14 Dec 2012 09:02:13 -0500
Subject: [PATCH] libudev: validate 'udev' argument to udev_enumerate_new()
https://bugs.freedesktop.org/show_bug.cgi?id=58289
---
src/libudev/libudev-enumerate.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
Index: systemd-195/src/libudev/libudev-enumerate.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-enumerate.c
+++ systemd-195/src/libudev/libudev-enumerate.c
@@ -73,6 +73,8 @@ _public_ struct udev_enumerate *udev_enu
{
struct udev_enumerate *udev_enumerate;
+ if (udev == NULL)
+ return NULL;
udev_enumerate = calloc(1, sizeof(struct udev_enumerate));
if (udev_enumerate == NULL)
return NULL;

View File

@ -1,56 +0,0 @@
From 3fd0c4c66df45ee457cfb5e4ca8e285914ebc32f Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 20 Nov 2012 18:07:14 +0100
Subject: [PATCH] udev: fix whitespace
---
src/udev/udev-event.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)
Index: systemd-195/src/udev/udev-event.c
===================================================================
--- systemd-195.orig/src/udev/udev-event.c
+++ systemd-195/src/udev/udev-event.c
@@ -90,24 +90,24 @@ size_t udev_event_apply_format(struct ud
const char fmt;
enum subst_type type;
} map[] = {
- { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE },
- { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE },
- { .name = "attr", .fmt = 's', .type = SUBST_ATTR },
- { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR },
- { .name = "env", .fmt = 'E', .type = SUBST_ENV },
- { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL },
- { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER },
- { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER },
- { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH },
- { .name = "id", .fmt = 'b', .type = SUBST_ID },
- { .name = "major", .fmt = 'M', .type = SUBST_MAJOR },
- { .name = "minor", .fmt = 'm', .type = SUBST_MINOR },
- { .name = "result", .fmt = 'c', .type = SUBST_RESULT },
- { .name = "parent", .fmt = 'P', .type = SUBST_PARENT },
- { .name = "name", .fmt = 'D', .type = SUBST_NAME },
- { .name = "links", .fmt = 'L', .type = SUBST_LINKS },
- { .name = "root", .fmt = 'r', .type = SUBST_ROOT },
- { .name = "sys", .fmt = 'S', .type = SUBST_SYS },
+ { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE },
+ { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE },
+ { .name = "attr", .fmt = 's', .type = SUBST_ATTR },
+ { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR },
+ { .name = "env", .fmt = 'E', .type = SUBST_ENV },
+ { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL },
+ { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER },
+ { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER },
+ { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH },
+ { .name = "id", .fmt = 'b', .type = SUBST_ID },
+ { .name = "major", .fmt = 'M', .type = SUBST_MAJOR },
+ { .name = "minor", .fmt = 'm', .type = SUBST_MINOR },
+ { .name = "result", .fmt = 'c', .type = SUBST_RESULT },
+ { .name = "parent", .fmt = 'P', .type = SUBST_PARENT },
+ { .name = "name", .fmt = 'D', .type = SUBST_NAME },
+ { .name = "links", .fmt = 'L', .type = SUBST_LINKS },
+ { .name = "root", .fmt = 'r', .type = SUBST_ROOT },
+ { .name = "sys", .fmt = 'S', .type = SUBST_SYS },
};
const char *from;
char *s;

View File

@ -1,69 +0,0 @@
From bf9d233f781f27841be6638ee745e9c80bda5f4d Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 13 Nov 2012 02:05:06 +0100
Subject: [PATCH] udev: properly handle symlink removal by 'change' event
If a 'change' event is supposed to remove created symlinks, we create
a new device structure from the sysfs device and fill it with the list
of links, to compute the delta of the old and new list of links to apply.
If the device is already 'remove'd by the kernel though, udev fails to
create the device structure, so the links are not removed properly.
> From: Neil Brown <nfbrown@suse.com>
> Date: Thu, 8 Nov 2012 10:39:06 +0100
> Subject: [PATCH] If a 'change' event does not get handled by udev until
> after the device has subsequently disappeared, udev mis-handles
> it. This can happen with 'md' devices which emit a change
> event and then a remove event when they are stopped. It is
> normally only noticed if udev is very busy (lots of arrays
> being stopped at once) or the machine is otherwise loaded
> and reponding slowly.
>
> There are two problems.
>
> 1/ udev_device_new_from_syspath() will refuse to create the device
> structure if the device does not exist in /sys, and particularly if
> the uevent file does not exist.
> If a 'db' file does exist, that is sufficient evidence that the device
> is genuine and should be created. Equally if we have just received an
> event from the kernel about the device, it must be real.
>
> This patch just disabled the test for the 'uevent' file, it doesn't
> try imposing any other tests - it isn't clear that they are really
> needed.
>
> 2/ udev_event_execute_rules() calls udev_device_read_db() on a 'device'
> structure that is largely uninitialised and in particular does not
> have the 'subsystem' set. udev_device_read_db() needs the subsystem
> so it tries to read the 'subsystem' symlink out of sysfs. If the
> device is already deleted, this naturally fails.
> udev_event_execute_rules() knows the subsystem (as it was in the
> event message) so this patch simply sets the subsystem for the device
> structure to be loaded to match the subsystem of the device structure
> that is handling the event.
>
> With these two changes, deleted handling of change events will still
> correctly remove any symlinks that are not needed any more.
Use udev_device_new() instead of allowing udev_device_new_from_syspath()
to proceed without a sysfs device.
---
src/udev/udev-event.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
Index: systemd-195/src/udev/udev-event.c
===================================================================
--- systemd-195.orig/src/udev/udev-event.c
+++ systemd-195/src/udev/udev-event.c
@@ -797,8 +797,10 @@ int udev_event_execute_rules(struct udev
if (major(udev_device_get_devnum(dev)) != 0)
udev_node_remove(dev);
} else {
- event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev));
+ event->dev_db = udev_device_new(event->udev);
if (event->dev_db != NULL) {
+ udev_device_set_syspath(event->dev_db, udev_device_get_syspath(dev));
+ udev_device_set_subsystem(event->dev_db, udev_device_get_subsystem(dev));
udev_device_read_db(event->dev_db, NULL);
udev_device_set_info_loaded(event->dev_db);

View File

@ -1,64 +0,0 @@
Index: systemd-195/src/udev/udev-builtin.c
===================================================================
--- systemd-195.orig/src/udev/udev-builtin.c
+++ systemd-195/src/udev/udev-builtin.c
@@ -42,24 +42,18 @@ static const struct udev_builtin *builti
#endif
};
-int udev_builtin_init(struct udev *udev)
+void udev_builtin_init(struct udev *udev)
{
unsigned int i;
- int err = 0;
if (initialized)
- return 0;
+ return;
- for (i = 0; i < ELEMENTSOF(builtins); i++) {
- if (builtins[i]->init) {
- err = builtins[i]->init(udev);
- if (err < 0)
- break;
- }
- }
+ for (i = 0; i < ELEMENTSOF(builtins); i++)
+ if (builtins[i]->init)
+ builtins[i]->init(udev);
initialized = true;
- return err;
}
void udev_builtin_exit(struct udev *udev)
@@ -79,13 +73,11 @@ void udev_builtin_exit(struct udev *udev
bool udev_builtin_validate(struct udev *udev)
{
unsigned int i;
- bool change = false;
for (i = 0; i < ELEMENTSOF(builtins); i++)
- if (builtins[i]->validate)
- if (builtins[i]->validate(udev))
- change = true;
- return change;
+ if (builtins[i]->validate && builtins[i]->validate(udev))
+ return true;
+ return false;
}
void udev_builtin_list(struct udev *udev)
Index: systemd-195/src/udev/udev.h
===================================================================
--- systemd-195.orig/src/udev/udev.h
+++ systemd-195/src/udev/udev.h
@@ -167,7 +167,7 @@ extern const struct udev_builtin udev_bu
extern const struct udev_builtin udev_builtin_usb_db;
extern const struct udev_builtin udev_builtin_usb_id;
extern const struct udev_builtin udev_builtin_uaccess;
-int udev_builtin_init(struct udev *udev);
+void udev_builtin_init(struct udev *udev);
void udev_builtin_exit(struct udev *udev);
enum udev_builtin_cmd udev_builtin_lookup(const char *command);
const char *udev_builtin_name(enum udev_builtin_cmd cmd);

View File

@ -1,335 +0,0 @@
Index: systemd-195/src/libudev/libudev-device-private.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-device-private.c
+++ systemd-195/src/libudev/libudev-device-private.c
@@ -147,7 +147,7 @@ int udev_device_update_db(struct udev_de
}
if (udev_device_get_usec_initialized(udev_device) > 0)
- fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device));
+ fprintf(f, "I:%llu\n", (unsigned long long)udev_device_get_usec_initialized(udev_device));
udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
if (!udev_list_entry_get_num(list_entry))
Index: systemd-195/src/libudev/libudev-device.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-device.c
+++ systemd-195/src/libudev/libudev-device.c
@@ -67,7 +67,7 @@ struct udev_device {
struct udev_list sysattr_list;
struct udev_list tags_list;
unsigned long long int seqnum;
- unsigned long long int usec_initialized;
+ usec_t usec_initialized;
int timeout;
int devlink_priority;
int refcount;
@@ -262,7 +262,7 @@ static int udev_device_set_devtype(struc
return 0;
}
-static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
+int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
{
free(udev_device->subsystem);
udev_device->subsystem = strdup(subsystem);
@@ -1286,7 +1286,7 @@ _public_ const char *udev_device_get_act
**/
_public_ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device)
{
- unsigned long long now_ts;
+ usec_t now_ts;
if (udev_device == NULL)
return 0;
@@ -1294,23 +1294,23 @@ _public_ unsigned long long int udev_dev
udev_device_read_db(udev_device, NULL);
if (udev_device->usec_initialized == 0)
return 0;
- now_ts = now_usec();
+ now_ts = now(CLOCK_MONOTONIC);
if (now_ts == 0)
return 0;
return now_ts - udev_device->usec_initialized;
}
-unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device)
+usec_t udev_device_get_usec_initialized(struct udev_device *udev_device)
{
return udev_device->usec_initialized;
}
-void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized)
+void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized)
{
char num[32];
udev_device->usec_initialized = usec_initialized;
- snprintf(num, sizeof(num), "%llu", usec_initialized);
+ snprintf(num, sizeof(num), "%llu", (unsigned long long)usec_initialized);
udev_device_add_property(udev_device, "USEC_INITIALIZED", num);
}
Index: systemd-195/src/libudev/libudev-private.h
===================================================================
--- systemd-195.orig/src/libudev/libudev-private.h
+++ systemd-195/src/libudev/libudev-private.h
@@ -48,6 +48,7 @@ struct udev_list_entry *udev_get_propert
/* libudev-device.c */
struct udev_device *udev_device_new(struct udev *udev);
mode_t udev_device_get_devnode_mode(struct udev_device *udev_device);
+int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
@@ -66,8 +67,8 @@ void udev_device_set_is_initialized(stru
int udev_device_add_tag(struct udev_device *udev_device, const char *tag);
void udev_device_cleanup_tags_list(struct udev_device *udev_device);
int udev_device_get_timeout(struct udev_device *udev_device);
-unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device);
-void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized);
+usec_t udev_device_get_usec_initialized(struct udev_device *udev_device);
+void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized);
int udev_device_get_devlink_priority(struct udev_device *udev_device);
int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
int udev_device_get_watch_handle(struct udev_device *udev_device);
@@ -166,7 +167,5 @@ uid_t util_lookup_user(struct udev *udev
gid_t util_lookup_group(struct udev *udev, const char *group);
int util_resolve_subsys_kernel(struct udev *udev, const char *string,
char *result, size_t maxsize, int read_value);
-unsigned long long ts_usec(const struct timespec *ts);
-unsigned long long now_usec(void);
ssize_t print_kmsg(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
#endif
Index: systemd-195/src/libudev/libudev-util.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-util.c
+++ systemd-195/src/libudev/libudev-util.c
@@ -691,23 +691,6 @@ uint64_t util_string_bloom64(const char
return bits;
}
-#define USEC_PER_SEC 1000000ULL
-#define NSEC_PER_USEC 1000ULL
-unsigned long long ts_usec(const struct timespec *ts)
-{
- return (unsigned long long) ts->tv_sec * USEC_PER_SEC +
- (unsigned long long) ts->tv_nsec / NSEC_PER_USEC;
-}
-
-unsigned long long now_usec(void)
-{
- struct timespec ts;
-
- if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
- return 0;
- return ts_usec(&ts);
-}
-
ssize_t print_kmsg(const char *fmt, ...)
{
int fd;
Index: systemd-195/src/udev/udev-event.c
===================================================================
--- systemd-195.orig/src/udev/udev-event.c
+++ systemd-195/src/udev/udev-event.c
@@ -48,7 +48,7 @@ struct udev_event *udev_event_new(struct
event->udev = udev;
udev_list_init(udev, &event->run_list, false);
event->fd_signal = -1;
- event->birth_usec = now_usec();
+ event->birth_usec = now(CLOCK_MONOTONIC);
event->timeout_usec = 30 * 1000 * 1000;
return event;
}
@@ -466,9 +466,9 @@ static void spawn_read(struct udev_event
int i;
if (event->timeout_usec > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - event->birth_usec;
+ age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec) {
log_error("timeout '%s'\n", cmd);
goto out;
@@ -554,9 +554,9 @@ static int spawn_wait(struct udev_event
int fdcount;
if (event->timeout_usec > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - event->birth_usec;
+ age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec)
timeout = 1000;
else
@@ -862,7 +862,7 @@ int udev_event_execute_rules(struct udev
if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0)
udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db));
else if (udev_device_get_usec_initialized(event->dev) == 0)
- udev_device_set_usec_initialized(event->dev, now_usec());
+ udev_device_set_usec_initialized(event->dev, now(CLOCK_MONOTONIC));
/* (re)write database file */
udev_device_update_db(dev);
Index: systemd-195/src/udev/udev-rules.c
===================================================================
--- systemd-195.orig/src/udev/udev-rules.c
+++ systemd-195/src/udev/udev-rules.c
@@ -47,7 +47,7 @@ struct uid_gid {
struct udev_rules {
struct udev *udev;
char **dirs;
- unsigned long long *dirs_ts_usec;
+ usec_t *dirs_ts_usec;
int resolve_names;
/* every key in the rules file becomes a token */
@@ -1691,7 +1691,7 @@ bool udev_rules_check_timestamp(struct u
if (stat(rules->dirs[i], &stats) < 0)
continue;
- if (rules->dirs_ts_usec[i] == ts_usec(&stats.st_mtim))
+ if (rules->dirs_ts_usec[i] == timespec_load(&stats.st_mtim))
continue;
/* first check */
@@ -1701,7 +1701,7 @@ bool udev_rules_check_timestamp(struct u
}
/* update timestamp */
- rules->dirs_ts_usec[i] = ts_usec(&stats.st_mtim);
+ rules->dirs_ts_usec[i] = timespec_load(&stats.st_mtim);
}
out:
return changed;
Index: systemd-195/src/udev/udev.h
===================================================================
--- systemd-195.orig/src/udev/udev.h
+++ systemd-195/src/udev/udev.h
@@ -41,8 +41,8 @@ struct udev_event {
gid_t gid;
struct udev_list run_list;
int exec_delay;
- unsigned long long birth_usec;
- unsigned long long timeout_usec;
+ usec_t birth_usec;
+ usec_t timeout_usec;
int fd_signal;
unsigned int builtin_run;
unsigned int builtin_ret;
Index: systemd-195/src/udev/udevadm-settle.c
===================================================================
--- systemd-195.orig/src/udev/udevadm-settle.c
+++ systemd-195/src/udev/udevadm-settle.c
@@ -47,9 +47,9 @@ static int adm_settle(struct udev *udev,
{ "help", no_argument, NULL, 'h' },
{}
};
- unsigned long long start_usec = now_usec();
- unsigned long long start = 0;
- unsigned long long end = 0;
+ usec_t start_usec = now(CLOCK_MONOTONIC);
+ usec_t start = 0;
+ usec_t end = 0;
int quiet = 0;
const char *exists = NULL;
unsigned int timeout = 120;
@@ -123,7 +123,7 @@ static int adm_settle(struct udev *udev,
start = 0;
end = 0;
}
- log_debug("start=%llu end=%llu current=%llu\n", start, end, kernel_seq);
+ log_debug("start=%llu end=%llu current=%llu\n", (unsigned long long)start, (unsigned long long)end, kernel_seq);
} else {
if (end > 0) {
log_error("seq-end needs seq-start parameter, ignoring\n");
@@ -199,9 +199,9 @@ static int adm_settle(struct udev *udev,
}
if (timeout > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - start_usec;
+ age_usec = now(CLOCK_MONOTONIC) - start_usec;
if (age_usec / (1000 * 1000) >= timeout) {
struct udev_list_entry *list_entry;
Index: systemd-195/src/udev/udevd.c
===================================================================
--- systemd-195.orig/src/udev/udevd.c
+++ systemd-195/src/udev/udevd.c
@@ -122,7 +122,7 @@ struct worker {
struct udev_monitor *monitor;
enum worker_state state;
struct event *event;
- unsigned long long event_start_usec;
+ usec_t event_start_usec;
};
/* passed from worker to main process */
@@ -378,7 +378,7 @@ out:
worker->monitor = worker_monitor;
worker->pid = pid;
worker->state = WORKER_RUNNING;
- worker->event_start_usec = now_usec();
+ worker->event_start_usec = now(CLOCK_MONOTONIC);
worker->event = event;
event->state = EVENT_RUNNING;
udev_list_node_append(&worker->node, &worker_list);
@@ -409,7 +409,7 @@ static void event_run(struct event *even
worker_ref(worker);
worker->event = event;
worker->state = WORKER_RUNNING;
- worker->event_start_usec = now_usec();
+ worker->event_start_usec = now(CLOCK_MONOTONIC);
event->state = EVENT_RUNNING;
return;
}
@@ -1381,7 +1381,7 @@ int main(int argc, char *argv[])
udev_list_node_init(&worker_list);
for (;;) {
- static unsigned long long last_usec;
+ static usec_t last_usec;
struct epoll_event ev[8];
int fdcount;
int timeout;
@@ -1452,7 +1452,7 @@ int main(int argc, char *argv[])
if (worker->state != WORKER_RUNNING)
continue;
- if ((now_usec() - worker->event_start_usec) > 30 * 1000 * 1000) {
+ if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > 30 * 1000 * 1000) {
log_error("worker [%u] %s timeout; kill it\n", worker->pid,
worker->event ? worker->event->devpath : "<idle>");
kill(worker->pid, SIGKILL);
@@ -1486,13 +1486,13 @@ int main(int argc, char *argv[])
}
/* check for changed config, every 3 seconds at most */
- if ((now_usec() - last_usec) > 3 * 1000 * 1000) {
+ if ((now(CLOCK_MONOTONIC) - last_usec) > 3 * 1000 * 1000) {
if (udev_rules_check_timestamp(rules))
reload = true;
if (udev_builtin_validate(udev))
reload = true;
- last_usec = now_usec();
+ last_usec = now(CLOCK_MONOTONIC);
}
/* reload requested, HUP signal received, rules changed, builtin changed */
@@ -1512,7 +1512,7 @@ int main(int argc, char *argv[])
dev = udev_monitor_receive_device(monitor);
if (dev != NULL) {
- udev_device_set_usec_initialized(dev, now_usec());
+ udev_device_set_usec_initialized(dev, now(CLOCK_MONOTONIC));
if (rules == NULL)
rules = udev_rules_new(udev, resolve_names);
if (event_queue_insert(dev) < 0)

View File

@ -1,59 +0,0 @@
Index: systemd-195/Makefile.am
===================================================================
--- systemd-195.orig/Makefile.am
+++ systemd-195/Makefile.am
@@ -2246,6 +2246,8 @@ dist_udevkeymap_DATA = \
keymaps/hewlett-packard-presario-2100 \
keymaps/hewlett-packard-tablet \
keymaps/hewlett-packard-tx2 \
+ keymaps/hewlett-packard_elitebook-8440p \
+ keymaps/hewlett-packard-hdx9494nr \
keymaps/ibm-thinkpad-usb-keyboard-trackpoint \
keymaps/inventec-symphony_6.0_7.0 \
keymaps/lenovo-3000 \
Index: systemd-195/keymaps/hewlett-packard-hdx9494nr
===================================================================
--- /dev/null
+++ systemd-195/keymaps/hewlett-packard-hdx9494nr
@@ -0,0 +1,3 @@
+0xB2 www # FnF3
+0xD8 f23 # touchpad off
+0xD9 f22 # touchpad on
Index: systemd-195/keymaps/hewlett-packard_elitebook-8440p
===================================================================
--- /dev/null
+++ systemd-195/keymaps/hewlett-packard_elitebook-8440p
@@ -0,0 +1,5 @@
+0x88 www
+0xA0 mute
+0xAE volumedown
+0xB0 volumeup
+0xEC mail
Index: systemd-195/src/udev/keymap/95-keyboard-force-release.rules
===================================================================
--- systemd-195.orig/src/udev/keymap/95-keyboard-force-release.rules
+++ systemd-195/src/udev/keymap/95-keyboard-force-release.rules
@@ -42,7 +42,7 @@ ENV{DMI_VENDOR}=="Viooo Corporation", AT
# These are all the HP laptops that setup a touchpad toggle key
ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other"
ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other"
-ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other"
+ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC|HDX9494NR", RUN+="keyboard-force-release.sh $devpath hp-other"
ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys"
Index: systemd-195/src/udev/keymap/95-keymap.rules
===================================================================
--- systemd-195.orig/src/udev/keymap/95-keymap.rules
+++ systemd-195/src/udev/keymap/95-keymap.rules
@@ -96,7 +96,9 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATT
ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2"
ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100"
ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www"
-ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill"
+ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill 0xB2 www"
+ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP EliteBook 8440p", RUN+="keymap $name hewlett-packard_elitebook-8440p"
+ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HDX9494NR", RUN+="keymap $name hewlett-packard-hdx9494nr"
# HP Pavillion dv6315ea has empty DMI_VENDOR
ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play

View File

@ -1,51 +0,0 @@
From 1d010426c01044350b2b32d8b3af5d064f7dfe27 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 10 Jan 2013 14:23:23 +0100
Subject: [PATCH] udev: Fix device matching in the accelerometer
As we were searching by ID_PATH, it would have been possible
for us to find a sibling device instead of the device we were
looking for.
This fixes device matching on the WeTab with the upstream kernel,
as it was trying to use the "Asus Laptop extra buttons" device
instead of the accelerometer.
---
src/udev/accelerometer/accelerometer.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index 21f5193..2fea388 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -257,7 +257,6 @@ int main (int argc, char** argv)
char devpath[PATH_MAX];
char *devnode;
- const char *id_path;
struct udev_enumerate *enumerate;
struct udev_list_entry *list_entry;
@@ -303,18 +302,10 @@ int main (int argc, char** argv)
return 1;
}
- id_path = udev_device_get_property_value(dev, "ID_PATH");
- if (id_path == NULL) {
- fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath);
- return 0;
- }
-
/* Get the children devices and find the devnode */
- /* FIXME: use udev_enumerate_add_match_parent() instead */
devnode = NULL;
enumerate = udev_enumerate_new(udev);
- udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path);
- udev_enumerate_add_match_subsystem(enumerate, "input");
+ udev_enumerate_add_match_parent(enumerate, dev);
udev_enumerate_scan_devices(enumerate);
udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) {
struct udev_device *device;
--
1.7.7

View File

@ -1,63 +0,0 @@
From 2ffcfb9b45262271019d1751cafc895c3dae8f0e Mon Sep 17 00:00:00 2001
From: Robert Milasan <rmilasan@suse.com>
Date: Sun, 10 Feb 2013 11:00:20 +0100
Subject: [PATCH] usb_id: some strange devices have a very bogus or strange serial
numer, making a mess in /dev/disk/by-id. Let's check if the
serial number is a valid, otherwise don't use it.
---
src/udev/udev-builtin-usb_id.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
Index: systemd-195/src/udev/udev-builtin-usb_id.c
===================================================================
--- systemd-195.orig/src/udev/udev-builtin-usb_id.c
+++ systemd-195/src/udev/udev-builtin-usb_id.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
@@ -31,6 +32,26 @@
#include "udev.h"
+static bool valid_string(const char *str)
+{
+ const char *s;
+
+ if (!str)
+ return false;
+
+ for (s = str; *s != '\0'; s++) {
+ if ((*s >= 'a' && *s <= 'z') ||
+ (*s >= 'A' && *s <= 'Z') ||
+ (*s >= '0' && *s <= '9') ||
+ *s == '-' || *s == '_')
+ continue;
+ else
+ return false;
+ }
+
+ return true;
+}
+
static void set_usb_iftype(char *to, int if_class_num, size_t len)
{
const char *type = "generic";
@@ -428,10 +449,10 @@ fallback:
}
if (serial_str[0] == '\0') {
- const char *usb_serial;
+ const char *usb_serial = NULL;
usb_serial = udev_device_get_sysattr_value(dev_usb, "serial");
- if (usb_serial) {
+ if (valid_string(usb_serial)) {
util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1);
util_replace_chars(serial_str, NULL);
}

View File

@ -1,8 +1,17 @@
Index: systemd-195/rules/60-cdrom_id.rules
===================================================================
--- systemd-195.orig/rules/60-cdrom_id.rules
+++ systemd-195/rules/60-cdrom_id.rules
@@ -15,6 +15,9 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdr
From: Robert Milasan <rmilasan@suse.com>
Date: Tue, 12 Feb 2013 09:16:23 +0000
Subject: create default links for primary cd_dvd drive
cdrom_id: created links for the default cd/dvd drive (bnc#783054).
---
rules/60-cdrom_id.rules | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rules/60-cdrom_id.rules b/rules/60-cdrom_id.rules
index 6eaf76a..ec0b19a 100644
--- a/rules/60-cdrom_id.rules
+++ b/rules/60-cdrom_id.rules
@@ -15,6 +15,9 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdr
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $devnode"

View File

@ -1,57 +0,0 @@
Index: systemd-195/src/udev/udev-node.c
===================================================================
--- systemd-195.orig/src/udev/udev-node.c
+++ systemd-195/src/udev/udev-node.c
@@ -31,15 +31,13 @@
#include "udev.h"
-#define TMP_FILE_EXT ".udev-tmp"
-
-static int node_symlink(struct udev *udev, const char *node, const char *slink)
+static int node_symlink(struct udev_device *dev, const char *node, const char *slink)
{
struct stat stats;
char target[UTIL_PATH_SIZE];
char *s;
size_t l;
- char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
+ char slink_tmp[UTIL_PATH_SIZE + 32];
int i = 0;
int tail = 0;
int err = 0;
@@ -101,7 +99,7 @@ static int node_symlink(struct udev *ude
}
log_debug("atomically replace '%s'\n", slink);
- util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL);
+ util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL);
unlink(slink_tmp);
do {
err = mkdir_parents_label(slink_tmp, 0755);
@@ -204,7 +202,7 @@ static void link_update(struct udev_devi
util_delete_path(udev, slink);
} else {
log_debug("creating link '%s' to '%s'\n", slink, target);
- node_symlink(udev, target, slink);
+ node_symlink(dev, target, slink);
}
if (add) {
@@ -304,7 +302,6 @@ out:
void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
{
- struct udev *udev = udev_device_get_udev(dev);
char filename[UTIL_PATH_SIZE];
struct udev_list_entry *list_entry;
@@ -318,7 +315,7 @@ void udev_node_add(struct udev_device *d
snprintf(filename, sizeof(filename), "/dev/%s/%u:%u",
strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char",
major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)));
- node_symlink(udev, udev_device_get_devnode(dev), filename);
+ node_symlink(dev, udev_device_get_devnode(dev), filename);
/* create/update symlinks, add symlinks to name index */
udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))

View File

@ -1,51 +0,0 @@
From a0ec302b9309bc56f6bed6162e47ad6c27165747 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 12 Feb 2013 15:19:38 +0100
Subject: [PATCH] cdrom_id: add data track count for bad virtual drive
implementations
Organization: SUSE Linux
/# /lib/udev/cdrom_id --debug /dev/sr0
probing: '/dev/sr0'
INQUIRY: [AMI ][Virtual CDROM ][1.00]
GET CONFIGURATION failed with SK=5h/ASC=20h/ACQ=00h
drive is pre-MMC2 and does not support 46h get configuration command
trying to work around the problem
READ DISC INFORMATION failed with SK=5h/ASC=20h/ACQ=00h
no current profile, but disc is present; assuming CD-ROM
READ TOC: len: 12, start track: 1, end track: 1
last track 1 starts at block 0
READ DISC INFORMATION failed with SK=5h/ASC=20h/ACQ=00h
ID_CDROM=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD=1
What is missing here is ID_CDROM_MEDIA_TRACK_COUNT_DATA to trigger
blkid in /lib/udev/rules.d/60-persistent-storage.rules
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*",
ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*",
ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
IMPORT{builtin}="blkid --noraid"
Signed-off-by: Robert Milasan <rmilasan@suse.com>
---
src/udev/cdrom_id/cdrom_id.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 1056536..b659cc3 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -513,6 +513,8 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd)
if (cd_media == 1) {
log_debug("no current profile, but disc is present; assuming CD-ROM\n");
cd_media_cd_rom = 1;
+ cd_media_track_count = 1;
+ cd_media_track_count_data = 1;
return 0;
} else {
log_debug("no current profile, assuming no media\n");
--
1.7.7

View File

@ -1,24 +0,0 @@
From 7962afbba9016ea03d9f2987fee341443fcde39d Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Sun, 17 Feb 2013 21:16:56 +0100
Subject: [PATCH] udev: usb_id: parse only 'size' bytes of the 'descriptors'
buffer
Signed-off-by: Robert Milasan <rmilasan@suse.com>
---
src/udev/udev-builtin-usb_id.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Index: systemd-195/src/udev/udev-builtin-usb_id.c
===================================================================
--- systemd-195.orig/src/udev/udev-builtin-usb_id.c
+++ systemd-195/src/udev/udev-builtin-usb_id.c
@@ -210,7 +210,7 @@ static int dev_if_packed_info(struct ude
pos = 0;
strpos = 0;
ifs_str[0] = '\0';
- while (pos < sizeof(buf) && strpos+7 < len-2) {
+ while (pos < size && strpos+7 < len-2) {
struct usb_interface_descriptor *desc;
char if_str[8];

View File

@ -1,37 +0,0 @@
From ddb5bee15a6ad71e5b596c035c1ee4dc04d5fd2e Mon Sep 17 00:00:00 2001
From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
Date: Sun, 17 Feb 2013 03:21:27 +0200
Subject: [PATCH] udev: expose new ISO9660 properties from libblkid
Signed-off-by: Robert Milasan <rmilasan@suse.com>
---
src/udev/udev-builtin-blkid.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
Index: systemd-195/src/udev/udev-builtin-blkid.c
===================================================================
--- systemd-195.orig/src/udev/udev-builtin-blkid.c
+++ systemd-195/src/udev/udev-builtin-blkid.c
@@ -78,6 +78,22 @@ static void print_property(struct udev_d
} else if (startswith(name, "PART_ENTRY_")) {
util_strscpyl(s, sizeof(s), "ID_", name, NULL);
udev_builtin_add_property(dev, test, s, value);
+
+ } else if (streq(name, "SYSTEM_ID")) {
+ blkid_encode_string(value, s, sizeof(s));
+ udev_builtin_add_property(dev, test, "ID_FS_SYSTEM_ID", s);
+
+ } else if (streq(name, "PUBLISHER_ID")) {
+ blkid_encode_string(value, s, sizeof(s));
+ udev_builtin_add_property(dev, test, "ID_FS_PUBLISHER_ID", s);
+
+ } else if (streq(name, "APPLICATION_ID")) {
+ blkid_encode_string(value, s, sizeof(s));
+ udev_builtin_add_property(dev, test, "ID_FS_APPLICATION_ID", s);
+
+ } else if (streq(name, "BOOT_SYSTEM_ID")) {
+ blkid_encode_string(value, s, sizeof(s));
+ udev_builtin_add_property(dev, test, "ID_FS_BOOT_SYSTEM_ID", s);
}
}

View File

@ -1,7 +1,51 @@
Index: systemd-195/src/udev/rule_generator/75-persistent-net-generator.rules
===================================================================
From: Robert Milasan <rmilasan@suse.com>
Date: Wed, 20 Mar 2013 10:14:59 +0000
Subject: re-add persistent net
udev: re-add persistent network rules (bnc#809843).
---
Makefile.am | 10 +-
.../75-persistent-net-generator.rules | 102 +++++++++++++++
src/udev/rule_generator/rule_generator.functions | 113 ++++++++++++++++
src/udev/rule_generator/write_net_rules | 145 +++++++++++++++++++++
4 files changed, 369 insertions(+), 1 deletion(-)
create mode 100644 src/udev/rule_generator/75-persistent-net-generator.rules
create mode 100644 src/udev/rule_generator/rule_generator.functions
create mode 100644 src/udev/rule_generator/write_net_rules
diff --git a/Makefile.am b/Makefile.am
index 10609f3..f5e4159 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2287,6 +2287,14 @@ EXTRA_DIST += \
src/gudev/seed-example.js
# ------------------------------------------------------------------------------
+dist_udevhome_SCRIPTS = \
+ src/udev/rule_generator/rule_generator.functions \
+ src/udev/rule_generator/write_net_rules
+
+dist_udevrules_DATA += \
+ src/udev/rule_generator/75-persistent-net-generator.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_KEYMAP
keymap_SOURCES = \
src/udev/keymap/keymap.c
@@ -2314,7 +2322,7 @@ dist_udevrules_DATA += \
src/udev/keymap/95-keymap.rules \
src/udev/keymap/95-keyboard-force-release.rules
-dist_udevhome_SCRIPTS = \
+dist_udevhome_SCRIPTS += \
src/udev/keymap/findkeyboards \
src/udev/keymap/keyboard-force-release.sh
diff --git a/src/udev/rule_generator/75-persistent-net-generator.rules b/src/udev/rule_generator/75-persistent-net-generator.rules
new file mode 100644
index 0000000..4f80573
--- /dev/null
+++ systemd-195/src/udev/rule_generator/75-persistent-net-generator.rules
+++ b/src/udev/rule_generator/75-persistent-net-generator.rules
@@ -0,0 +1,102 @@
+# do not edit this file, it will be overwritten on update
+
@ -105,10 +149,11 @@ Index: systemd-195/src/udev/rule_generator/75-persistent-net-generator.rules
+ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"
+
+LABEL="persistent_net_generator_end"
Index: systemd-195/src/udev/rule_generator/rule_generator.functions
===================================================================
diff --git a/src/udev/rule_generator/rule_generator.functions b/src/udev/rule_generator/rule_generator.functions
new file mode 100644
index 0000000..087bc34
--- /dev/null
+++ systemd-195/src/udev/rule_generator/rule_generator.functions
+++ b/src/udev/rule_generator/rule_generator.functions
@@ -0,0 +1,113 @@
+# functions used by the udev rule generator
+
@ -223,63 +268,11 @@ Index: systemd-195/src/udev/rule_generator/rule_generator.functions
+ $([ -e $RULES_FILE ] && echo $RULES_FILE) \
+ 2>/dev/null)
+}
Index: systemd-195/Makefile.in
===================================================================
--- systemd-195.orig/Makefile.in
+++ systemd-195/Makefile.in
@@ -1743,7 +1743,9 @@ am_v4l_id_OBJECTS = src/udev/v4l_id/v4l_
v4l_id_OBJECTS = $(am_v4l_id_OBJECTS)
v4l_id_DEPENDENCIES = libudev.la
am__dist_udevhome_SCRIPTS_DIST = src/udev/keymap/findkeyboards \
- src/udev/keymap/keyboard-force-release.sh
+ src/udev/keymap/keyboard-force-release.sh \
+ src/udev/rule_generator/rule_generator.functions \
+ src/udev/rule_generator/write_net_rules
SCRIPTS = $(dist_bin_SCRIPTS) $(dist_udevhome_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -2051,7 +2053,8 @@ am__dist_udevrules_DATA_DIST = rules/99-
src/udev/keymap/95-keymap.rules \
src/udev/keymap/95-keyboard-force-release.rules \
rules/75-probe_mtd.rules src/login/70-uaccess.rules \
- src/login/70-power-switch.rules
+ src/login/70-power-switch.rules \
+ src/udev/rule_generator/75-persistent-net-generator.rules
DATA = $(dbusinterface_DATA) $(dist_bashcompletion_DATA) \
$(dist_dbuspolicy_DATA) $(dist_dbussystemservice_DATA) \
$(dist_doc_DATA) $(dist_gatewayddocumentroot_DATA) \
Index: systemd-195/Makefile.am
===================================================================
--- systemd-195.orig/Makefile.am
+++ systemd-195/Makefile.am
@@ -2179,6 +2179,14 @@ EXTRA_DIST += \
# ------------------------------------------------------------------------------
+dist_udevhome_SCRIPTS = \
+ src/udev/rule_generator/rule_generator.functions \
+ src/udev/rule_generator/write_net_rules
+
+dist_udevrules_DATA += \
+ src/udev/rule_generator/75-persistent-net-generator.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_KEYMAP
keymap_SOURCES = \
src/udev/keymap/keymap.c
@@ -2206,7 +2214,7 @@ dist_udevrules_DATA += \
src/udev/keymap/95-keymap.rules \
src/udev/keymap/95-keyboard-force-release.rules
-dist_udevhome_SCRIPTS = \
+dist_udevhome_SCRIPTS += \
src/udev/keymap/findkeyboards \
src/udev/keymap/keyboard-force-release.sh
Index: systemd-195/src/udev/rule_generator/write_net_rules
===================================================================
diff --git a/src/udev/rule_generator/write_net_rules b/src/udev/rule_generator/write_net_rules
new file mode 100644
index 0000000..fad1cc5
--- /dev/null
+++ systemd-195/src/udev/rule_generator/write_net_rules
+++ b/src/udev/rule_generator/write_net_rules
@@ -0,0 +1,145 @@
+#!/bin/sh -e
+

View File

@ -1,8 +1,18 @@
Index: systemd-195/src/udev/udev-event.c
===================================================================
--- systemd-195.orig/src/udev/udev-event.c
+++ systemd-195/src/udev/udev-event.c
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_even
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 28 Mar 2013 09:24:43 +0000
Subject: udev always rename network
udev: ensure that the network interfaces are renamed even if they exist
(bnc#809843).
---
src/udev/udev-event.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 3db2cb7..3ee9039 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_event *event)
struct udev_device *dev = event->dev;
int sk;
struct ifreq ifr;
@ -10,9 +20,9 @@ Index: systemd-195/src/udev/udev-event.c
int err;
log_debug("changing net interface name from '%s' to '%s'\n",
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_even
util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev));
util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_event *event)
strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev));
strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
err = ioctl(sk, SIOCSIFNAME, &ifr);
- if (err >= 0) {
+ if (err == 0) {
@ -40,8 +50,8 @@ Index: systemd-195/src/udev/udev-event.c
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+
+ /* wait a maximum of 90 seconds for our target to become available */
+ util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname);
+ util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
+ strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname);
+ strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
+ loop = 90 * 20;
+ while (loop--) {
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };

View File

@ -1,15 +1,17 @@
From 81eca00461968aac09f9e8535f4327282698b495 Mon Sep 17 00:00:00 2001
From: Stefan Seyfried <seife+obs@b1-systems.com>
Date: Thu, 16 Dec 2010 11:30:17 +0100
Subject: [PATCH] Add bootsplash handling for password dialogs
Subject: Add bootsplash handling for password dialogs
openSUSE uses bootsplash.org, so add a crude handling for setting the
splash screen to verbose when a password is asked...
---
Index: systemd-195/src/shared/ask-password-api.c
===================================================================
--- systemd-195.orig/src/shared/ask-password-api.c
+++ systemd-195/src/shared/ask-password-api.c
src/shared/ask-password-api.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 8a0fb89..4bece69 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -63,6 +63,9 @@ int ask_password_tty(
bool reset_tty = false;
bool silent_mode = false;

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 4 Dec 2012 16:51:32 +0000
Subject: Ensure debugshell has a correct value
use /bin/bash if sushell isn't installed (bnc#789052).
---
units/debug-shell.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/debug-shell.service.in b/units/debug-shell.service.in
index a6acad3..64b5e0d 100644
--- a/units/debug-shell.service.in
+++ b/units/debug-shell.service.in
@@ -13,7 +13,7 @@ IgnoreOnIsolate=yes
[Service]
Environment=TERM=linux
-ExecStart=@SUSHELL@
+ExecStart=/bin/bash -c '[ -x @SUSHELL@ ] && exec @SUSHELL@ || exec /bin/bash'
Restart=always
RestartSec=0
StandardInput=tty

View File

@ -0,0 +1,39 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 7 Dec 2011 15:15:07 +0000
Subject: Fix /run/lock directories permissions to follow openSUSE policy
disable /var/lock/{subsys,lockdev} and change default permissions on
/var/lock (bnc#733523).
---
tmpfiles.d/legacy.conf | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tmpfiles.d/legacy.conf b/tmpfiles.d/legacy.conf
index 3fff347..81d5e47 100644
--- a/tmpfiles.d/legacy.conf
+++ b/tmpfiles.d/legacy.conf
@@ -10,12 +10,13 @@
# These files are considered legacy and are unnecessary on legacy-free
# systems.
-d /run/lock 0755 root root -
+# changed for openSUSE : only /run/lock should be available
+d /run/lock 0775 root lock -
# /run/lock/subsys is used for serializing SysV service execution, and
# hence without use on SysV-less systems.
-d /run/lock/subsys 0755 root root -
+#d /run/lock/subsys 0755 root root -
# /run/lock/lockdev is used to serialize access to tty devices via
# LCK..xxx style lock files, For more information see:
@@ -23,7 +24,7 @@ d /run/lock/subsys 0755 root root -
# On modern systems a BSD file lock is a better choice if
# serialization is needed on those devices.
-d /run/lock/lockdev 0775 root lock -
+#d /run/lock/lockdev 0775 root lock -
# /forcefsck, /fastboot and /forcequotecheck are deprecated in favor of the
# kernel command line options 'fsck.mode=force', 'fsck.mode=skip' and

View File

@ -1,7 +1,16 @@
Index: systemd-195/src/sleep/sleep.c
===================================================================
--- systemd-195.orig/src/sleep/sleep.c
+++ systemd-195/src/sleep/sleep.c
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 19 Feb 2013 11:20:31 +0100
Subject: Forward suspend / hibernate calls to pm-utils
forward suspend/hibernation calls to pm-utils, if installed (bnc#790157)
---
src/sleep/sleep.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 0707625..91cbdf9 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <errno.h>
@ -10,7 +19,7 @@ Index: systemd-195/src/sleep/sleep.c
#include "log.h"
#include "util.h"
@@ -31,6 +32,9 @@
@@ -32,6 +33,9 @@
int main(int argc, char *argv[]) {
const char *verb;
char* arguments[4];
@ -20,7 +29,7 @@ Index: systemd-195/src/sleep/sleep.c
int r;
FILE *f;
@@ -44,17 +48,27 @@ int main(int argc, char *argv[]) {
@@ -45,17 +49,27 @@ int main(int argc, char *argv[]) {
goto finish;
}
@ -50,7 +59,7 @@ Index: systemd-195/src/sleep/sleep.c
if (streq(argv[1], "hibernate")) {
if (write_one_line_file("/sys/power/disk", "platform") < 0)
write_one_line_file("/sys/power/disk", "shutdown");
@@ -64,13 +78,14 @@ int main(int argc, char *argv[]) {
@@ -65,13 +79,14 @@ int main(int argc, char *argv[]) {
write_one_line_file("/sys/power/disk", "shutdown");
}
@ -66,7 +75,7 @@ Index: systemd-195/src/sleep/sleep.c
arguments[0] = NULL;
arguments[1] = (char*) "pre";
arguments[2] = argv[1];
@@ -96,11 +111,16 @@ int main(int argc, char *argv[]) {
@@ -97,11 +112,16 @@ int main(int argc, char *argv[]) {
"SLEEP=hybrid-sleep",
NULL);
@ -83,7 +92,7 @@ Index: systemd-195/src/sleep/sleep.c
if (streq(argv[1], "suspend"))
log_struct(LOG_INFO,
@@ -118,6 +138,7 @@ int main(int argc, char *argv[]) {
@@ -119,6 +139,7 @@ int main(int argc, char *argv[]) {
arguments[1] = (char*) "post";
execute_directory(SYSTEM_SLEEP_PATH, NULL, arguments);

View File

@ -0,0 +1,129 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 11 Apr 2013 15:39:39 +0200
Subject: Reinstate TIMEOUT handling
Without treating events with timeouts specially some drivers would
cause a 30 seconds stall on boot: .
I also received reports of some drivers not working at all, even
after the timeout.
We will remove this patch when more drivers have been fixed in
the kernel (3.4?).
This reverts 43d5c5f03645c4b842659f9b5bd0ae465e885e92 and
57c6f8ae5f52a6e8ffc66a54966346f733dded39.
---
src/libudev/libudev-device.c | 19 +++++++++++++++++++
src/libudev/libudev-private.h | 1 +
src/udev/udevd.c | 13 ++++++++++---
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 6bb2e41..4fdd242 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -78,6 +78,7 @@ struct udev_device {
struct udev_list tags_list;
unsigned long long int seqnum;
usec_t usec_initialized;
+ int timeout;
int devlink_priority;
int refcount;
dev_t devnum;
@@ -172,6 +173,21 @@ static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
return 0;
}
+int udev_device_get_timeout(struct udev_device *udev_device)
+{
+ return udev_device->timeout;
+}
+
+static int udev_device_set_timeout(struct udev_device *udev_device, int timeout)
+{
+ char num[32];
+
+ udev_device->timeout = timeout;
+ snprintf(num, sizeof(num), "%u", timeout);
+ udev_device_add_property(udev_device, "TIMEOUT", num);
+ return 0;
+}
+
const char *udev_device_get_devpath_old(struct udev_device *udev_device)
{
return udev_device->devpath_old;
@@ -462,6 +478,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
udev_device_set_devpath_old(udev_device, &property[12]);
} else if (startswith(property, "SEQNUM=")) {
udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10));
+ } else if (startswith(property, "TIMEOUT=")) {
+ udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10));
} else if (startswith(property, "IFINDEX=")) {
udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10));
} else if (startswith(property, "DEVMODE=")) {
@@ -653,6 +671,7 @@ struct udev_device *udev_device_new(struct udev *udev)
udev_list_init(udev, &udev_device->sysattr_value_list, true);
udev_list_init(udev, &udev_device->sysattr_list, false);
udev_list_init(udev, &udev_device->tags_list, true);
+ udev_device->timeout = -1;
udev_device->watch_handle = -1;
/* copy global properties */
udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev))
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index 54c51ac..d2124ea 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -77,6 +77,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device);
void udev_device_set_is_initialized(struct udev_device *udev_device);
int udev_device_add_tag(struct udev_device *udev_device, const char *tag);
void udev_device_cleanup_tags_list(struct udev_device *udev_device);
+int udev_device_get_timeout(struct udev_device *udev_device);
usec_t udev_device_get_usec_initialized(struct udev_device *udev_device);
void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized);
int udev_device_get_devlink_priority(struct udev_device *udev_device);
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2ad7388..5a90b60 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -391,7 +391,7 @@ out:
}
}
-static void event_run(struct event *event)
+static void event_run(struct event *event, bool force)
{
struct udev_list_node *loop;
@@ -417,7 +417,7 @@ static void event_run(struct event *event)
return;
}
- if (children >= children_max) {
+ if (!force && children >= children_max) {
if (children_max > 1)
log_debug("maximum number (%i) of children reached\n", children);
return;
@@ -455,6 +455,13 @@ static int event_queue_insert(struct udev_device *dev)
event->state = EVENT_QUEUED;
udev_list_node_append(&event->node, &event_list);
+
+ /* run all events with a timeout set immediately */
+ if (udev_device_get_timeout(dev) > 0) {
+ event_run(event, true);
+ return 0;
+ }
+
return 0;
}
@@ -566,7 +573,7 @@ static void event_queue_start(struct udev *udev)
if (is_devpath_busy(event))
continue;
- event_run(event);
+ event_run(event, false);
}
}

View File

@ -0,0 +1,140 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 12 Apr 2013 16:56:26 +0200
Subject: Revert "service: drop support for SysV scripts for the early boot"
This reverts commit 3cdebc217c42c8529086f2965319b6a48eaaeabe.
Conflicts:
src/core/service.c
---
src/core/service.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index a1b2d93..da22e55 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -51,7 +51,8 @@
typedef enum RunlevelType {
RUNLEVEL_UP,
- RUNLEVEL_DOWN
+ RUNLEVEL_DOWN,
+ RUNLEVEL_SYSINIT
} RunlevelType;
static const struct {
@@ -66,6 +67,16 @@ static const struct {
{ "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP },
{ "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP },
+#ifdef TARGET_SUSE
+ /* SUSE style boot.d */
+ { "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
+#endif
+
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM)
+ /* Debian style rcS.d */
+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
+#endif
+
/* Standard SysV runlevels for shutdown */
{ "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
{ "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
@@ -74,10 +85,12 @@ static const struct {
directories in this order, and we want to make sure that
sysv_start_priority is known when we first load the
unit. And that value we only know from S links. Hence
- UP must be read before DOWN */
+ UP/SYSINIT must be read before DOWN */
};
#define RUNLEVELS_UP "12345"
+/* #define RUNLEVELS_DOWN "06" */
+#define RUNLEVELS_BOOT "bBsS"
#endif
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
@@ -332,6 +345,9 @@ static char *sysv_translate_name(const char *name) {
if (endswith(name, ".sh"))
/* Drop .sh suffix */
strcpy(stpcpy(r, name) - 3, ".service");
+ if (startswith(name, "boot."))
+ /* Drop SuSE-style boot. prefix */
+ strcpy(stpcpy(r, name + 5), ".service");
else
/* Normal init script name */
strcpy(stpcpy(r, name), ".service");
@@ -934,6 +950,13 @@ static int service_load_sysv_path(Service *s, const char *path) {
if ((r = sysv_exec_commands(s, supports_reload)) < 0)
goto finish;
+ if (s->sysv_runlevels &&
+ chars_intersect(RUNLEVELS_BOOT, s->sysv_runlevels) &&
+ chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
+ /* Service has both boot and "up" runlevels
+ configured. Kill the "up" ones. */
+ delete_chars(s->sysv_runlevels, RUNLEVELS_UP);
+ }
if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
/* If there a runlevels configured for this service
@@ -1015,6 +1038,9 @@ static int service_load_sysv_name(Service *s, const char *name) {
if (endswith(name, ".sh.service"))
return -ENOENT;
+ if (startswith(name, "boot."))
+ return -ENOENT;
+
STRV_FOREACH(p, UNIT(s)->manager->lookup_paths.sysvinit_path) {
char *path;
int r;
@@ -1035,6 +1061,18 @@ static int service_load_sysv_name(Service *s, const char *name) {
}
free(path);
+ if (r >= 0 && UNIT(s)->load_state == UNIT_STUB) {
+ /* Try SUSE style boot.* init scripts */
+
+ path = strjoin(*p, "/boot.", name, NULL);
+ if (!path)
+ return -ENOMEM;
+
+ /* Drop .service suffix */
+ path[strlen(path)-8] = 0;
+ r = service_load_sysv_path(s, path);
+ free(path);
+ }
if (r < 0)
return r;
@@ -3663,7 +3701,7 @@ static int service_enumerate(Manager *m) {
if (de->d_name[0] == 'S') {
- if (rcnd_table[i].type == RUNLEVEL_UP) {
+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
SERVICE(service)->sysv_start_priority_from_rcnd =
MAX(a*10 + b, SERVICE(service)->sysv_start_priority_from_rcnd);
@@ -3680,7 +3718,8 @@ static int service_enumerate(Manager *m) {
goto finish;
} else if (de->d_name[0] == 'K' &&
- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
+ (rcnd_table[i].type == RUNLEVEL_DOWN ||
+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
r = set_ensure_allocated(&shutdown_services,
trivial_hash_func, trivial_compare_func);
@@ -3720,7 +3759,9 @@ static int service_enumerate(Manager *m) {
* runlevels we assume the stop jobs will be implicitly added
* by the core logic. Also, we don't really distinguish here
* between the runlevels 0 and 6 and just add them to the
- * special shutdown target. */
+ * special shutdown target. On SUSE the boot.d/ runlevel is
+ * also used for shutdown, so we add links for that too to the
+ * shutdown target.*/
SET_FOREACH(service, shutdown_services, j) {
service = unit_follow_merge(service);

View File

@ -1,44 +0,0 @@
From 2161de72c517d34d1ceb9b4c1a300f0b54ce5a9c Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Mon, 29 Oct 2012 21:59:34 +0100
Subject: [PATCH] units: agetty overrides TERM
Environment=TERM=... has no effect on agetty who sets it by itself. To
really set TERM to a specified value, it has to be given on the command
line.
https://bugzilla.redhat.com/show_bug.cgi?id=870622
---
units/getty@.service.m4 | 3 +--
units/serial-getty@.service.m4 | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
Index: systemd-195/units/getty@.service.m4
===================================================================
--- systemd-195.orig/units/getty@.service.m4
+++ systemd-195/units/getty@.service.m4
@@ -41,9 +41,8 @@ IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty0
[Service]
-Environment=TERM=linux
# the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I 38400
+ExecStart=-/sbin/agetty --noclear %I 38400 linux
Type=idle
Restart=always
RestartSec=0
Index: systemd-195/units/serial-getty@.service.m4
===================================================================
--- systemd-195.orig/units/serial-getty@.service.m4
+++ systemd-195/units/serial-getty@.service.m4
@@ -37,8 +37,7 @@ Before=getty.target
IgnoreOnIsolate=yes
[Service]
-Environment=TERM=vt102
-ExecStart=-/sbin/agetty -s %I 115200,38400,9600
+ExecStart=-/sbin/agetty -s %I 115200,38400,9600 vt102
Type=idle
Restart=always
RestartSec=0

View File

@ -0,0 +1,47 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 10 Jan 2013 15:43:25 +0000
Subject: allow multiple sulogin to be started
allows multiple sulogin instance (bnc#793182).
---
units/getty@.service.m4 | 1 +
units/rescue.target | 1 +
units/serial-getty@.service.m4 | 1 +
3 files changed, 3 insertions(+)
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index 083eb97..243fea5 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -9,6 +9,7 @@
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
+Conflicts=rescue.service
After=systemd-user-sessions.service plymouth-quit-wait.service
m4_ifdef(`HAVE_SYSV_COMPAT',
After=rc-local.service
diff --git a/units/rescue.target b/units/rescue.target
index 3f59b14..20f6841 100644
--- a/units/rescue.target
+++ b/units/rescue.target
@@ -10,6 +10,7 @@ Description=Rescue Mode
Documentation=man:systemd.special(7)
Requires=sysinit.target rescue.service
After=sysinit.target rescue.service
+Conflicts=getty.target
AllowIsolate=yes
[Install]
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index 60d7737..2b18dbf 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -10,6 +10,7 @@ Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
BindsTo=dev-%i.device
+Conflicts=rescue.service
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
m4_ifdef(`HAVE_SYSV_COMPAT',
After=rc-local.service

View File

@ -0,0 +1,23 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 8 Apr 2013 14:51:47 +0200
Subject: apply ACL for nvidia device nodes
set ACL on nvidia devices (bnc#808319).
---
src/login/logind-acl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c
index cb045a9..51093f2 100644
--- a/src/login/logind-acl.c
+++ b/src/login/logind-acl.c
@@ -240,6 +240,9 @@ int devnode_acl_all(struct udev *udev,
goto finish;
}
+ devnode_acl("/dev/nvidia0", flush, del, old_uid, add, new_uid);
+ devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid);
+
finish:
if (e)
udev_enumerate_unref(e);

View File

@ -0,0 +1,38 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 26 Nov 2012 09:49:42 +0100
Subject: avoid assertion if invalid address familily is passed to
gethostbyaddr_r (bnc#791101)
---
src/nss-myhostname/nss-myhostname.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index b0fb832..b3aaca8 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -384,6 +384,12 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
struct address *addresses = NULL, *a;
unsigned n_addresses = 0, n;
+ if (af != AF_INET && af != AF_INET6) {
+ *errnop = EAFNOSUPPORT;
+ *h_errnop = NO_DATA;
+ return NSS_STATUS_UNAVAIL;
+ }
+
if (len != PROTO_ADDRESS_SIZE(af)) {
*errnop = EINVAL;
*h_errnop = NO_RECOVERY;
@@ -399,11 +405,6 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
if (memcmp(addr, LOCALADDRESS_IPV6, 16) == 0)
goto found;
-
- } else {
- *errnop = EAFNOSUPPORT;
- *h_errnop = NO_DATA;
- return NSS_STATUS_UNAVAIL;
}
ifconf_acquire_addresses(&addresses, &n_addresses);

View File

@ -4,3 +4,4 @@ systemd
libudev0
libgudev-1_0-0
libudev1
nss-myhostname

View File

@ -1,92 +0,0 @@
From f3910003bce32ebdc1dbb71fd9ca2d4b8352b563 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 30 Oct 2012 10:29:40 +0100
Subject: [PATCH] shared, libsystemd-daemon: check for empty strings in
strto*l conversions
strtol() and friends may set EINVAL if no conversion was performed, but
they are not required to do so. In practice they don't. We need to check
for it.
https://bugzilla.redhat.com/show_bug.cgi?id=870577
---
src/libsystemd-daemon/sd-daemon.c | 4 ++--
src/shared/conf-parser.c | 2 +-
src/shared/util.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
Index: systemd-195/src/libsystemd-daemon/sd-daemon.c
===================================================================
--- systemd-195.orig/src/libsystemd-daemon/sd-daemon.c
+++ systemd-195/src/libsystemd-daemon/sd-daemon.c
@@ -88,7 +88,7 @@ _sd_export_ int sd_listen_fds(int unset_
goto finish;
}
- if (!p || *p || l <= 0) {
+ if (!p || p == e || *p || l <= 0) {
r = -EINVAL;
goto finish;
}
@@ -112,7 +112,7 @@ _sd_export_ int sd_listen_fds(int unset_
goto finish;
}
- if (!p || *p) {
+ if (!p || p == e || *p) {
r = -EINVAL;
goto finish;
}
Index: systemd-195/src/shared/conf-parser.c
===================================================================
--- systemd-195.orig/src/shared/conf-parser.c
+++ systemd-195/src/shared/conf-parser.c
@@ -865,7 +865,7 @@ int config_parse_mode(
errno = 0;
l = strtol(rvalue, &x, 8);
- if (!x || *x || errno) {
+ if (!x || x == rvalue || *x || errno) {
log_error("[%s:%u] Failed to parse mode value, ignoring: %s", filename, line, rvalue);
return 0;
}
Index: systemd-195/src/shared/util.c
===================================================================
--- systemd-195.orig/src/shared/util.c
+++ systemd-195/src/shared/util.c
@@ -388,7 +388,7 @@ int safe_atou(const char *s, unsigned *r
errno = 0;
l = strtoul(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
if ((unsigned long) (unsigned) l != l)
@@ -408,7 +408,7 @@ int safe_atoi(const char *s, int *ret_i)
errno = 0;
l = strtol(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
if ((long) (int) l != l)
@@ -428,7 +428,7 @@ int safe_atollu(const char *s, long long
errno = 0;
l = strtoull(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_llu = l;
@@ -445,7 +445,7 @@ int safe_atolli(const char *s, long long
errno = 0;
l = strtoll(s, &x, 0);
- if (!x || *x || errno)
+ if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_lli = l;

View File

@ -1,30 +0,0 @@
From 7e1a84f55244ca78093b1dabc58683bc0e7f4304 Mon Sep 17 00:00:00 2001
From: Oleksii Shevchuk <alxchk@gmail.com>
Date: Sat, 3 Nov 2012 21:52:02 +0200
Subject: [PATCH] core: interpret \; token in ExecStart as escaped ;
Some commands (like 'find') take a semicolon as separate arg. With
current parser implementation there is no way to pass one.
Patch adds token \;
---
src/core/load-fragment.c | 2 ++
src/test/test-unit-file.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 5803044..4dc5c52 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -483,6 +483,8 @@ int config_parse_exec(
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
if (strncmp(w, ";", MAX(l, 1U)) == 0)
break;
+ else if (strncmp(w, "\\;", MAX(l, 1U)) == 0)
+ w ++;
if (honour_argv0 && w == rvalue) {
assert(!path);
--
1.7.10.4

View File

@ -1,207 +0,0 @@
From c040936be2a4c77e9465cffae47d77d5ec14fb49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 19 Nov 2012 16:02:45 +0100
Subject: [PATCH] core/load-fragment: be more precise in error messages
Whenever a message fails, mention the offending word, instead
of just giving the whole line. If one bad word causes just this
word to be rejected, print only the word. If one bad word causes
the whole line to be rejected, print the whole line too.
https://bugs.freedesktop.org/show_bug.cgi?id=56874
---
src/core/load-fragment.c | 69 +++++++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 38 deletions(-)
Index: systemd-195/src/core/load-fragment.c
===================================================================
--- systemd-195.orig/src/core/load-fragment.c
+++ systemd-195/src/core/load-fragment.c
@@ -85,7 +85,7 @@ int config_parse_unit_deps(
assert(rvalue);
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- char *t, *k;
+ char _cleanup_free_ *t = NULL, *k = NULL;
int r;
t = strndup(w, l);
@@ -93,15 +93,13 @@ int config_parse_unit_deps(
return -ENOMEM;
k = unit_name_printf(u, t);
- free(t);
if (!k)
return -ENOMEM;
r = unit_add_dependency_by_name(u, d, k, NULL, true);
if (r < 0)
- log_error("[%s:%u] Failed to add dependency on %s, ignoring: %s", filename, line, k, strerror(-r));
-
- free(k);
+ log_error("[%s:%u] Failed to add dependency on %s, ignoring: %s",
+ filename, line, k, strerror(-r));
}
return 0;
@@ -739,22 +737,25 @@ int config_parse_exec_cpu_affinity(
assert(data);
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- char *t;
+ char _cleanup_free_ *t = NULL;
int r;
unsigned cpu;
- if (!(t = strndup(w, l)))
+ t = strndup(w, l);
+ if (!t)
return -ENOMEM;
r = safe_atou(t, &cpu);
- free(t);
- if (!(c->cpuset))
- if (!(c->cpuset = cpu_set_malloc(&c->cpuset_ncpus)))
+ if (!c->cpuset) {
+ c->cpuset = cpu_set_malloc(&c->cpuset_ncpus);
+ if (!c->cpuset)
return -ENOMEM;
+ }
if (r < 0 || cpu >= c->cpuset_ncpus) {
- log_error("[%s:%u] Failed to parse CPU affinity, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse CPU affinity %s, ignoring: %s",
+ filename, line, t, rvalue);
return 0;
}
@@ -831,7 +832,8 @@ int config_parse_exec_secure_bits(
else if (first_word(w, "noroot-locked"))
c->secure_bits |= SECURE_NOROOT_LOCKED;
else {
- log_error("[%s:%u] Failed to parse secure bits, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse secure bits, ignoring: %s",
+ filename, line, rvalue);
return 0;
}
}
@@ -872,7 +874,7 @@ int config_parse_bounding_set(
* interface. */
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- char *t;
+ char _cleanup_free_ *t = NULL;
int r;
cap_value_t cap;
@@ -881,10 +883,9 @@ int config_parse_bounding_set(
return -ENOMEM;
r = cap_from_name(t, &cap);
- free(t);
-
if (r < 0) {
- log_error("[%s:%u] Failed to parse capability bounding set, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse capability in bounding set, ignoring: %s",
+ filename, line, t);
continue;
}
@@ -950,7 +951,7 @@ int config_parse_unit_cgroup(
char *state;
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- char *t, *k;
+ char _cleanup_free_ *t = NULL, *k = NULL, *ku = NULL;
int r;
t = strndup(w, l);
@@ -958,22 +959,17 @@ int config_parse_unit_cgroup(
return -ENOMEM;
k = unit_full_printf(u, t);
- free(t);
-
if (!k)
return -ENOMEM;
- t = cunescape(k);
- free(k);
-
- if (!t)
+ ku = cunescape(k);
+ if (!ku)
return -ENOMEM;
- r = unit_add_cgroup_from_text(u, t);
- free(t);
-
+ r = unit_add_cgroup_from_text(u, ku);
if (r < 0) {
- log_error("[%s:%u] Failed to parse cgroup value, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse cgroup value %s, ignoring: %s",
+ filename, line, k, rvalue);
return 0;
}
}
@@ -1333,33 +1329,30 @@ int config_parse_service_sockets(
assert(data);
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- char *t, *k;
+ char _cleanup_free_ *t = NULL, *k = NULL;
t = strndup(w, l);
if (!t)
return -ENOMEM;
k = unit_name_printf(UNIT(s), t);
- free(t);
-
if (!k)
return -ENOMEM;
if (!endswith(k, ".socket")) {
- log_error("[%s:%u] Unit must be of type socket, ignoring: %s", filename, line, rvalue);
- free(k);
+ log_error("[%s:%u] Unit must be of type socket, ignoring: %s",
+ filename, line, k);
continue;
}
r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_WANTS, UNIT_AFTER, k, NULL, true);
if (r < 0)
- log_error("[%s:%u] Failed to add dependency on %s, ignoring: %s", filename, line, k, strerror(-r));
+ log_error("[%s:%u] Failed to add dependency on %s, ignoring: %s",
+ filename, line, k, strerror(-r));
r = unit_add_dependency_by_name(UNIT(s), UNIT_TRIGGERED_BY, k, NULL, true);
if (r < 0)
return r;
-
- free(k);
}
return 0;
@@ -2087,17 +2080,17 @@ int config_parse_syscall_filter(
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
int id;
- char *t;
+ char _cleanup_free_ *t = NULL;
t = strndup(w, l);
if (!t)
return -ENOMEM;
id = syscall_from_name(t);
- free(t);
if (id < 0) {
- log_error("[%s:%u] Failed to parse syscall, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse syscall, ignoring: %s",
+ filename, line, t);
continue;
}

View File

@ -1,22 +0,0 @@
From 348a25edbb87ee4e67aa79fcb97a2bc1b5c11c7b Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 19 Dec 2012 14:38:53 +0100
Subject: [PATCH] coredumpctl: check return of strndup
---
src/journal/coredumpctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-195/src/journal/coredumpctl.c
===================================================================
--- systemd-195.orig/src/journal/coredumpctl.c
+++ systemd-195/src/journal/coredumpctl.c
@@ -222,7 +222,7 @@ static int retrieve(sd_journal *j, const
assert(len >= field);
*var = strndup((const char*)data + field, len - field);
- if (!var)
+ if (!*var)
return log_oom();
return 0;

View File

@ -0,0 +1,24 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Tue, 12 Feb 2013 09:16:23 +0000
Subject: create default links for primary cd_dvd drive
cdrom_id: created links for the default cd/dvd drive (bnc#783054).
---
rules/60-cdrom_id.rules | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rules/60-cdrom_id.rules b/rules/60-cdrom_id.rules
index 6eaf76a..ec0b19a 100644
--- a/rules/60-cdrom_id.rules
+++ b/rules/60-cdrom_id.rules
@@ -15,6 +15,9 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdr
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $devnode"
-KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM}=="1", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_CD_RW}=="1", SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD_RW}=="1", SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"
LABEL="cdrom_end"

View File

@ -1,31 +0,0 @@
From 1cda32b8a29750720872d3525084ac67b88e066f Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 23 Nov 2012 14:16:39 +0100
Subject: [PATCH] cryptsetup-generator: state file name in error messages
---
src/cryptsetup/cryptsetup-generator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: systemd-195/src/cryptsetup/cryptsetup-generator.c
===================================================================
--- systemd-195.orig/src/cryptsetup/cryptsetup-generator.c
+++ systemd-195/src/cryptsetup/cryptsetup-generator.c
@@ -230,7 +230,7 @@ static int create_disk(
f = fopen(p, "wxe");
if (!f) {
r = -errno;
- log_error("Failed to create unit file: %m");
+ log_error("Failed to create unit file %s: %m", p);
goto fail;
}
@@ -283,7 +283,7 @@ static int create_disk(
if (ferror(f)) {
r = -errno;
- log_error("Failed to write file: %m");
+ log_error("Failed to write file %s: %m", p);
goto fail;
}

View File

@ -1,29 +0,0 @@
From adc40dc2f670a6298cce918fb318ba6a4b80c306 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 21 Nov 2012 12:30:47 +0100
Subject: [PATCH] cryptsetup: fix nofail support
This was documented in the man page and supported in the generator,
but systemd-cryptestup itself would fail with this option.
systemd-cryptsetup should ignore 'nofail', as it does with 'noauto'.
---
src/cryptsetup/cryptsetup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 56a3b50..f332843 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -62,7 +62,7 @@ static int parse_one_option(const char *option) {
assert(option);
/* Handled outside of this tool */
- if (streq(option, "noauto"))
+ if (streq(option, "noauto") || streq(option, "nofail"))
return 0;
if (startswith(option, "cipher=")) {
--
1.7.10.4

View File

@ -1,90 +0,0 @@
Index: systemd-195/src/cryptsetup/cryptsetup-generator.c
===================================================================
--- systemd-195.orig/src/cryptsetup/cryptsetup-generator.c
+++ systemd-195/src/cryptsetup/cryptsetup-generator.c
@@ -136,7 +136,7 @@ static int create_disk(
const char *password,
const char *options) {
- char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL;
+ char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL, *path_file = NULL;
int r;
FILE *f = NULL;
bool noauto, nofail;
@@ -168,11 +168,63 @@ static int create_disk(
goto fail;
}
- d = unit_name_from_path(u, ".device");
- if (!d) {
- r = -ENOMEM;
- log_error("Failed to allocate device name.");
- goto fail;
+ if (!startswith(device,"/dev/")) {
+ char *e;
+
+ d = strdup(n);
+ if (!d) {
+ r = -ENOMEM;
+ log_error("Failed to allocate path name.");
+ goto fail;
+ }
+
+ e = endswith(d,".service");
+ if (!e) {
+ r = -ENOMEM;
+ log_error("Failed to modify path name.");
+ goto fail;
+ }
+
+ *e = 0;
+
+ d = strcat(d,".path");
+ if (asprintf(&path_file, "%s/%s", arg_dest, d) < 0) {
+ r = -ENOMEM;
+ log_error("Failed to allocate unit file name.");
+ goto fail;
+ }
+
+ f = fopen(path_file, "wxe");
+ if (!f) {
+ r = -errno;
+ log_error("Failed to create unit file %s: %m", path_file);
+ goto fail;
+ }
+
+ fprintf(f,
+ "[Unit]\n"
+ "Description=Cryptography Setup for %s\n"
+ "DefaultDependencies=no\n"
+ "[Path]\n"
+ "PathExists=%s\n",
+ device, device);
+
+ fflush(f);
+
+ if (ferror(f)) {
+ r = -errno;
+ log_error("Failed to write file: %m");
+ goto fail;
+ }
+
+ f = NULL;
+ } else {
+ d = unit_name_from_path(u, ".device");
+ if (!d) {
+ r = -ENOMEM;
+ log_error("Failed to allocate device name.");
+ goto fail;
+ }
}
f = fopen(p, "wxe");
@@ -298,6 +350,7 @@ fail:
free(n);
free(d);
free(e);
+ free(path_file);
free(from);
free(to);

View File

@ -1,47 +0,0 @@
From 18cf1a1be5ae6985f211ec6f02504506da36b223 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Thu, 31 Jan 2013 11:03:09 +0100
Subject: [PATCH] cryptsetup: accept both "read-only" and "readonly" spellings
Mukund Sivaraman pointed out that cryptsetup(5) mentions the "read-only"
option, while the code understands "readonly".
We could just fix the manpage, but for consistency in naming of
multi-word options it would be prettier to have "read-only". So let's
accept both spellings.
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=903463
---
man/crypttab.xml | 2 +-
src/cryptsetup/cryptsetup.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/crypttab.xml b/man/crypttab.xml
index 2379fc0..f976bda 100644
--- a/man/crypttab.xml
+++ b/man/crypttab.xml
@@ -182,7 +182,7 @@
</varlistentry>
<varlistentry>
- <term><varname>read-only</varname></term>
+ <term><varname>read-only</varname></term><term><varname>readonly</varname></term>
<listitem><para>Set up the encrypted
block device in read-only
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index f332843..a8cdf10 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -111,7 +111,7 @@ static int parse_one_option(const char *option) {
return 0;
}
- } else if (streq(option, "readonly"))
+ } else if (streq(option, "readonly") || streq(option, "read-only"))
opt_readonly = true;
else if (streq(option, "verify"))
opt_verify = true;
--
1.7.10.4

View File

@ -1,71 +0,0 @@
From 65343c749441322d1e65e8bb5d433b6fee8c28bf Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Tue, 6 Nov 2012 09:49:27 -0500
Subject: [PATCH] cryptsetup: hash=plain means don't use a hash
"plain" is a semantic value that cryptsetup(8) uses to describe a plain
dm-crypt volume that does not use a hash. Catch this value earlier and
ensure that a NULL params.hash is passed to crypt_format to avoid
passing an invalid hash type to the libcryptsetup backend.
FDO bug #56593.
---
src/cryptsetup/cryptsetup.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 916509a..e8ba3f0 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -342,7 +342,12 @@ int main(int argc, char *argv[]) {
opt_tries = opt_tries > 0 ? opt_tries : 3;
opt_key_size = (opt_key_size > 0 ? opt_key_size : 256);
- hash = opt_hash ? opt_hash : "ripemd160";
+ if (opt_hash) {
+ /* plain isn't a real hash type. it just means "use no hash" */
+ if (!streq(opt_hash, "plain"))
+ hash = opt_hash;
+ } else
+ hash = "ripemd160";
if (opt_cipher) {
size_t l;
@@ -463,7 +468,7 @@ int main(int argc, char *argv[]) {
opt_keyfile_size,
&params);
- pass_volume_key = streq(hash, "plain");
+ pass_volume_key = !!hash;
}
if (k < 0) {
--
1.7.10.4
From 8db9d8c2a4ef9806c286e258f9932a0972dc2375 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Tue, 6 Nov 2012 10:17:18 -0500
Subject: [PATCH] cryptsetup: fix inverted comparison in pass_volume_key
---
src/cryptsetup/cryptsetup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index e8ba3f0..56a3b50 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -468,7 +468,8 @@ int main(int argc, char *argv[]) {
opt_keyfile_size,
&params);
- pass_volume_key = !!hash;
+ /* hash == NULL implies the user passed "plain" */
+ pass_volume_key = (hash == NULL);
}
if (k < 0) {
--
1.7.10.4

View File

@ -1,18 +1,17 @@
From c6170719e7afbcecc04e8939e93e9678529e6391 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 9 Nov 2011 11:10:49 +0100
Subject: [PATCH] delay fsck / cryptsetup after md / dmraid / lvm are started
Subject: delay fsck / cryptsetup after md / dmraid / lvm are started
---
src/cryptsetup-generator.c | 1 +
units/fsck@.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
src/cryptsetup/cryptsetup-generator.c | 1 +
units/systemd-fsck@.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
Index: systemd-189/src/cryptsetup/cryptsetup-generator.c
===================================================================
--- systemd-189.orig/src/cryptsetup/cryptsetup-generator.c
+++ systemd-189/src/cryptsetup/cryptsetup-generator.c
@@ -192,6 +192,7 @@ static int create_disk(
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index bee8a36..6edc760 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -162,6 +162,7 @@ static int create_disk(
"DefaultDependencies=no\n"
"BindsTo=%s dev-mapper-%%i.device\n"
"After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
@ -20,10 +19,10 @@ Index: systemd-189/src/cryptsetup/cryptsetup-generator.c
"Before=umount.target\n",
d, d);
Index: systemd-189/units/systemd-fsck@.service.in
===================================================================
--- systemd-189.orig/units/systemd-fsck@.service.in
+++ systemd-189/units/systemd-fsck@.service.in
diff --git a/units/systemd-fsck@.service.in b/units/systemd-fsck@.service.in
index b3c71eb..c66a411 100644
--- a/units/systemd-fsck@.service.in
+++ b/units/systemd-fsck@.service.in
@@ -10,7 +10,7 @@ Description=File System Check on %f
Documentation=man:systemd-fsck@.service(8)
DefaultDependencies=no

View File

@ -1,24 +0,0 @@
From 377ec8bf1907a1a227d195cc3721c4acbad19213 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Wed, 14 Nov 2012 00:18:02 +0100
Subject: [PATCH] delta.c: fix option '-t'
Both the help and man page claims that it accepts -t with an argument
so let's do that.
---
src/delta/delta.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-195/src/delta/delta.c
===================================================================
--- systemd-195.orig/src/delta/delta.c
+++ systemd-195/src/delta/delta.c
@@ -375,7 +375,7 @@ static int parse_argv(int argc, char *ar
assert(argc >= 1);
assert(argv);
- while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "ht:", options, NULL)) >= 0) {
switch (c) {

View File

@ -1,97 +0,0 @@
commit d7228cb8529de83115af04bf653b4d204dad8fae
Author: Lennart Poettering <lennart@poettering.net>
Date: Thu Nov 22 01:51:06 2012 +0100
readahead: properly detect btrfs on SSD
diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c
index 10b0ccc..41aaff0 100644
--- a/src/readahead/readahead-common.c
+++ b/src/readahead/readahead-common.c
@@ -32,6 +32,7 @@
#include "log.h"
#include "readahead-common.h"
#include "util.h"
+#include "missing.h"
int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st) {
assert(fd >= 0);
@@ -62,14 +63,63 @@ int fs_on_ssd(const char *p) {
struct udev_device *udev_device = NULL, *look_at = NULL;
bool b = false;
const char *devtype, *rotational, *model, *id;
+ int r;
assert(p);
if (stat(p, &st) < 0)
return -errno;
- if (major(st.st_dev) == 0)
+ if (major(st.st_dev) == 0) {
+ _cleanup_fclose_ FILE *f = NULL;
+ int mount_id;
+ struct file_handle *h;
+
+ /* Might be btrfs, which exposes "ssd" as mount flag if it is on ssd.
+ *
+ * We first determine the mount ID here, if we can,
+ * and then lookup the mount ID in mountinfo to find
+ * the mount options. */
+
+ h = alloca(MAX_HANDLE_SZ);
+ h->handle_bytes = MAX_HANDLE_SZ;
+ r = name_to_handle_at(AT_FDCWD, p, h, &mount_id, AT_SYMLINK_FOLLOW);
+ if (r < 0)
+ return false;
+
+ f = fopen("/proc/self/mountinfo", "re");
+ if (!f)
+ return false;
+
+ for (;;) {
+ char line[LINE_MAX], *e;
+ _cleanup_free_ char *opts = NULL;
+ int mid;
+
+ if (!fgets(line, sizeof(line), f))
+ return false;
+
+ truncate_nl(line);
+
+ if (sscanf(line, "%i", &mid) != 1)
+ continue;
+
+ if (mid != mount_id)
+ continue;
+
+ e = strstr(line, " - ");
+ if (!e)
+ continue;
+
+ if (sscanf(e+3, "%*s %*s %ms", &opts) != 1)
+ continue;
+
+ if (streq(opts, "ssd") || startswith(opts, "ssd,") || endswith(opts, ",ssd") || strstr(opts, ",ssd,"))
+ return true;
+ }
+
return false;
+ }
udev = udev_new();
if (!udev)
@@ -97,9 +147,10 @@ int fs_on_ssd(const char *p) {
/* Second, try kernel attribute */
rotational = udev_device_get_sysattr_value(look_at, "queue/rotational");
- if (rotational)
- if ((b = streq(rotational, "0")))
- goto finish;
+ if (rotational) {
+ b = streq(rotational, "0");
+ goto finish;
+ }
/* Finally, fallback to heuristics */
look_at = udev_device_get_parent(look_at);

View File

@ -1,21 +0,0 @@
From 33db05b6bd6151c482f5efe01f2a6118efc82fde Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Tue, 12 Feb 2013 17:24:35 +0100
Subject: [PATCH] disable nss-myhostname warning (bnc#783841)
---
src/hostname/hostnamed.c | 1 +
1 Datei geändert, 1 Zeile hinzugefügt(+)
Index: systemd-195/src/hostname/hostnamed.c
===================================================================
--- systemd-195.orig/src/hostname/hostnamed.c
+++ systemd-195/src/hostname/hostnamed.c
@@ -124,6 +124,7 @@ static int read_data(void) {
static bool check_nss(void) {
void *dl;
+ return true;
if ((dl = dlopen("libnss_myhostname.so.2", RTLD_LAZY))) {
dlclose(dl);

View File

@ -0,0 +1,20 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Tue, 12 Feb 2013 17:24:35 +0100
Subject: disable nss-myhostname warning (bnc#783841)
---
src/hostname/hostnamed.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 859b5a0..4aad17b 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -134,6 +134,7 @@ static int read_data(void) {
static bool check_nss(void) {
void *dl;
+ return true;
dl = dlopen("libnss_myhostname.so.2", RTLD_LAZY);
if (dl) {

View File

@ -1,9 +0,0 @@
Index: systemd-189/units/local-fs-pre.target
===================================================================
--- systemd-189.orig/units/local-fs-pre.target
+++ systemd-189/units/local-fs-pre.target
@@ -8,3 +8,4 @@
[Unit]
Description=Local File Systems (Pre)
Documentation=man:systemd.special(7)
+After=md.service lvm.service dmraid.service

View File

@ -1,87 +0,0 @@
From 80cfe9e163b1c92f917e0a5e053b148fca790677 Mon Sep 17 00:00:00 2001
From: "Dr. Tilmann Bubeck" <t.bubeck@reinform.de>
Date: Fri, 4 May 2012 10:32:47 +0200
Subject: [PATCH] Do no isolate in case of emergency or severe problems
This patch changes local-fs.target and systemd-fsck to not use
"isolate" when going into emergency.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=810722
The motivation is, that when something wents wrong, we should
keep everything as it is, to let the user fix the problem. When
isolating we stop a lot of services and therefore change the
system heavily so that it gets harder for the user to fix.
An example is a crypted partition. When the fsck in a crypted
partition fails, it previously used "emergency/start/isolate"
which stops cryptsetup. Therefore if the user tries to fsck
e.g. /dev/mapper/luks-356c20ae-c7a2-4f1c-ae1d-1d290a91b691
as printed by the failing fsck, then it will not find this
device (because it got closed).
So please apply this patch to let the user see the failing
situation.
Thanks!
[zj: removed dead isolate param from start_target().]
https://bugs.freedesktop.org/show_bug.cgi?id=49463
https://bugzilla.redhat.com/show_bug.cgi?id=810722
---
src/fsck/fsck.c | 13 ++++---------
units/local-fs.target | 2 +-
2 files changed, 5 insertions(+), 10 deletions(-)
Index: systemd-195/src/fsck/fsck.c
===================================================================
--- systemd-195.orig/src/fsck/fsck.c
+++ systemd-195/src/fsck/fsck.c
@@ -40,10 +40,10 @@ static bool arg_skip = false;
static bool arg_force = false;
static bool arg_show_progress = false;
-static void start_target(const char *target, bool isolate) {
+static void start_target(const char *target) {
DBusMessage *m = NULL, *reply = NULL;
DBusError error;
- const char *mode, *basic_target = "basic.target";
+ const char *mode = "replace", *basic_target = "basic.target";
DBusConnection *bus = NULL;
assert(target);
@@ -55,11 +55,6 @@ static void start_target(const char *tar
goto finish;
}
- if (isolate)
- mode = "isolate";
- else
- mode = "replace";
-
log_info("Running request %s/start/%s", target, mode);
if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) {
@@ -379,10 +374,10 @@ int main(int argc, char *argv[]) {
if (status.si_code == CLD_EXITED && (status.si_status & 2) && root_directory)
/* System should be rebooted. */
- start_target(SPECIAL_REBOOT_TARGET, false);
+ start_target(SPECIAL_REBOOT_TARGET);
else if (status.si_code == CLD_EXITED && (status.si_status & 6))
/* Some other problem */
- start_target(SPECIAL_EMERGENCY_TARGET, true);
+ start_target(SPECIAL_EMERGENCY_TARGET);
else {
r = EXIT_SUCCESS;
log_warning("Ignoring error.");
Index: systemd-195/units/local-fs.target
===================================================================
--- systemd-195.orig/units/local-fs.target
+++ systemd-195/units/local-fs.target
@@ -9,4 +9,4 @@
Description=Local File Systems
Documentation=man:systemd.special(7)
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureIsolate=no

View File

@ -1,24 +0,0 @@
From 7d0c710d72f8a6e5c6909c65700aa088c53aebc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Bartoszkiewicz?= <mbartoszkiewicz@gmail.com>
Date: Sat, 12 Jan 2013 23:05:52 +0100
Subject: [PATCH] core: do not make sockets dependent on lo
/sys/subsystem/net/devices/lo is never considered active, so sockets
with BindToDevice=lo would never be activated.
---
src/core/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-195/src/core/socket.c
===================================================================
--- systemd-195.orig/src/core/socket.c
+++ systemd-195/src/core/socket.c
@@ -293,7 +293,7 @@ static int socket_add_device_link(Socket
assert(s);
- if (!s->bind_to_device)
+ if (!s->bind_to_device || streq(s->bind_to_device, "lo"))
return 0;
if (asprintf(&t, "/sys/subsystem/net/devices/%s", s->bind_to_device) < 0)

View File

@ -1,209 +0,0 @@
From c65eb8365344eeb72ee2c0b333ab54d925263b3f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 25 Jan 2013 22:33:33 +0100
Subject: [PATCH] shutdown: issue a sync() as soon as shutdown.target is queued
---
Makefile.am | 7 ++++--
src/core/job.c | 26 ++++++++++++++++++++
src/core/job.h | 2 ++
src/core/sync.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/core/sync.h | 24 +++++++++++++++++++
src/core/transaction.c | 1 +
6 files changed, 123 insertions(+), 2 deletions(-)
create mode 100644 src/core/sync.c
create mode 100644 src/core/sync.h
Index: systemd-195/Makefile.am
===================================================================
--- systemd-195.orig/Makefile.am
+++ systemd-195/Makefile.am
@@ -1038,7 +1038,9 @@ libsystemd_core_la_SOURCES = \
src/core/syscall-list.c \
src/core/syscall-list.h \
src/core/audit-fd.c \
- src/core/audit-fd.h
+ src/core/audit-fd.h \
+ src/core/sync.c \
+ src/core/sync.h
nodist_libsystemd_core_la_SOURCES = \
src/core/load-fragment-gperf.c \
@@ -1052,7 +1054,8 @@ libsystemd_core_la_CFLAGS = \
$(LIBWRAP_CFLAGS) \
$(PAM_CFLAGS) \
$(AUDIT_CFLAGS) \
- $(KMOD_CFLAGS)
+ $(KMOD_CFLAGS) \
+ -pthread
libsystemd_core_la_LIBADD = \
libsystemd-capability.la \
Index: systemd-195/src/core/job.c
===================================================================
--- systemd-195.orig/src/core/job.c
+++ systemd-195/src/core/job.c
@@ -34,6 +34,9 @@
#include "load-dropin.h"
#include "log.h"
#include "dbus-job.h"
+#include "special.h"
+#include "sync.h"
+#include "virt.h"
JobBusClient* job_bus_client_new(DBusConnection *connection, const char *name) {
JobBusClient *cl;
@@ -1045,6 +1048,29 @@ int job_coldplug(Job *j) {
return 0;
}
+void job_shutdown_magic(Job *j) {
+ assert(j);
+
+ /* The shutdown target gets some special treatment here: we
+ * tell the kernel to begin with flushing its disk caches, to
+ * optimize shutdown time a bit. Ideally we wouldn't hardcode
+ * this magic into PID 1. However all other processes aren't
+ * options either since they'd exit much sooner than PID 1 and
+ * asynchronous sync() would cause their exit to be
+ * delayed. */
+
+ if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET))
+ return;
+
+ if (j->type != JOB_START)
+ return;
+
+ if (detect_container(NULL) > 0)
+ return;
+
+ asynchronous_sync();
+}
+
static const char* const job_state_table[_JOB_STATE_MAX] = {
[JOB_WAITING] = "waiting",
[JOB_RUNNING] = "running"
Index: systemd-195/src/core/job.h
===================================================================
--- systemd-195.orig/src/core/job.h
+++ systemd-195/src/core/job.h
@@ -217,6 +217,8 @@ int job_finish_and_invalidate(Job *j, Jo
char *job_dbus_path(Job *j);
+void job_shutdown_magic(Job *j);
+
const char* job_type_to_string(JobType t);
JobType job_type_from_string(const char *s);
Index: systemd-195/src/core/sync.c
===================================================================
--- /dev/null
+++ systemd-195/src/core/sync.c
@@ -0,0 +1,65 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <pthread.h>
+#include <unistd.h>
+
+#include "sync.h"
+
+static void *sync_thread(void *p) {
+ sync();
+ return NULL;
+}
+
+int asynchronous_sync(void) {
+ pthread_attr_t a;
+ pthread_t t;
+ int r;
+
+ /* It kinda sucks that we have to resort to threads to
+ * implement an asynchronous sync(), but well, such is
+ * life.
+ *
+ * Note that issuing this command right before exiting a
+ * process will cause the process to wait for the sync() to
+ * complete. This function hence is nicely asynchronous really
+ * only in long running processes. */
+
+ r = pthread_attr_init(&a);
+ if (r != 0)
+ return -r;
+
+ r = pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
+ if (r != 0) {
+ r = -r;
+ goto finish;
+ }
+
+ r = pthread_create(&t, &a, sync_thread, NULL);
+ if (r != 0) {
+ r = -r;
+ goto finish;
+ }
+
+finish:
+ pthread_attr_destroy(&a);
+ return r;
+}
Index: systemd-195/src/core/sync.h
===================================================================
--- /dev/null
+++ systemd-195/src/core/sync.h
@@ -0,0 +1,24 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+int asynchronous_sync(void);
Index: systemd-195/src/core/transaction.c
===================================================================
--- systemd-195.orig/src/core/transaction.c
+++ systemd-195/src/core/transaction.c
@@ -592,6 +592,7 @@ static int transaction_apply(Transaction
job_add_to_run_queue(j);
job_add_to_dbus_queue(j);
job_start_timer(j);
+ job_shutdown_magic(j);
}
return 0;

View File

@ -0,0 +1,19 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 9 Feb 2012 16:19:38 +0000
Subject: ensure DM and LVM are started before local-fs-pre-target
ensure md / lvm /dmraid is started before mounting partitions,
if fsck was disabled for them (bnc#733283).
---
units/local-fs-pre.target | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/local-fs-pre.target b/units/local-fs-pre.target
index 809f2ed..05fcbd4 100644
--- a/units/local-fs-pre.target
+++ b/units/local-fs-pre.target
@@ -9,3 +9,4 @@
Description=Local File Systems (Pre)
Documentation=man:systemd.special(7)
RefuseManualStart=yes
+After=md.service lvm.service dmraid.service

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 24 Aug 2011 13:02:12 +0000
Subject: ensure ask-password-wall starts after getty@tty1
ensure passphrase is handled before starting getty on tty1.
---
units/systemd-ask-password-wall.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-ask-password-wall.service.in b/units/systemd-ask-password-wall.service.in
index 0eaa274..ca51e4e 100644
--- a/units/systemd-ask-password-wall.service.in
+++ b/units/systemd-ask-password-wall.service.in
@@ -8,7 +8,7 @@
[Unit]
Description=Forward Password Requests to Wall
Documentation=man:systemd-ask-password-console.service(8)
-After=systemd-user-sessions.service
+After=systemd-user-sessions.service getty@tty1.service
[Service]
ExecStartPre=-@SYSTEMCTL@ stop systemd-ask-password-console.path systemd-ask-password-console.service systemd-ask-password-plymouth.path systemd-ask-password-plymouth.service

View File

@ -0,0 +1,21 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 9 Jan 2012 17:01:22 +0000
Subject: ensure sysctl are applied after modules are loaded
(bnc#725412)
---
units/systemd-sysctl.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/units/systemd-sysctl.service.in b/units/systemd-sysctl.service.in
index 45e1ceb..caaaa9a 100644
--- a/units/systemd-sysctl.service.in
+++ b/units/systemd-sysctl.service.in
@@ -11,6 +11,7 @@ Documentation=man:systemd-sysctl.service(8) man:sysctl.d(5)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
+After=systemd-modules-load.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
ConditionPathExists=|/etc/sysctl.conf

View File

@ -0,0 +1,21 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 8 Apr 2013 14:51:47 +0200
Subject: ensure systemd-udevd is started before local-fs-pre for loopback
mount
ensure udevd is started (and therefore static devices are created)
before mounting (bnc#809820).
---
units/local-fs-pre.target | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/local-fs-pre.target b/units/local-fs-pre.target
index 05fcbd4..7f13907 100644
--- a/units/local-fs-pre.target
+++ b/units/local-fs-pre.target
@@ -9,4 +9,4 @@
Description=Local File Systems (Pre)
Documentation=man:systemd.special(7)
RefuseManualStart=yes
-After=md.service lvm.service dmraid.service
+After=md.service lvm.service dmraid.service systemd-udevd.service

View File

@ -1,13 +0,0 @@
Index: systemd-189/src/fsck/fsck.c
===================================================================
--- systemd-189.orig/src/fsck/fsck.c
+++ systemd-189/src/fsck/fsck.c
@@ -128,7 +128,7 @@ static int parse_proc_cmdline(void) {
arg_skip = true;
else if (startswith(w, "fsck"))
log_warning("Invalid fsck parameter. Ignoring.");
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) || defined(TARGET_SUSE)
else if (strneq(w, "fastboot", l))
arg_skip = true;
else if (strneq(w, "forcefsck", l))

View File

@ -1,21 +0,0 @@
From 86ed7ec58b9b6a0907bbb3b8d07c930e52915de0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 17 Jan 2013 17:38:00 +0100
Subject: [PATCH] util: fix bad memory access
---
src/shared/util.c | 1 -
1 file changed, 1 deletion(-)
Index: systemd-195/src/shared/util.c
===================================================================
--- systemd-195.orig/src/shared/util.c
+++ systemd-195/src/shared/util.c
@@ -543,7 +543,6 @@ int get_parent_of_pid(pid_t pid, pid_t *
if (!fgets(line, sizeof(line), f)) {
r = feof(f) ? -EIO : -errno;
- fclose(f);
return r;
}

View File

@ -1,23 +0,0 @@
From 7d73c1343be02a59b17de0cd34375deeb815d89c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 20 Nov 2012 00:19:27 +0100
Subject: [PATCH] journald: fix bad memory access
https://bugzilla.redhat.com/show_bug.cgi?id=875653
---
src/journal/journald-server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-195/src/journal/journald.c
===================================================================
--- systemd-195.orig/src/journal/journald.c
+++ systemd-195/src/journal/journald.c
@@ -342,7 +342,7 @@ static void server_rotate(Server *s) {
HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
r = journal_file_rotate(&f, s->compress, s->seal);
if (r < 0)
- if (f->path)
+ if (f)
log_error("Failed to rotate %s: %s", f->path, strerror(-r));
else
log_error("Failed to create user journal: %s", strerror(-r));

View File

@ -1,29 +0,0 @@
From e17187091d463ad008c0b74eb04de5078b2abb96 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Wed, 14 Nov 2012 14:44:05 +0100
Subject: [PATCH] configure.ac: fix FTBFS with new glibc
glibc moved clock_* functions from librt to the core libc. As a result,
clock_gettime is no more a suitable symbol to use when finding librt.
Look for mq_open instead.
Reference:
http://www.sourceware.org/git/gitweb.cgi?p=glibc.git&h=6e6249d0b461b952d0f544792372663feb6d792a
Fixes a FTBFS in Fedora Rawhide.
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-195/configure.ac
===================================================================
--- systemd-195.orig/configure.ac
+++ systemd-195/configure.ac
@@ -172,7 +172,7 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [L
-Wl,-z,now])
AC_SUBST([OUR_LDFLAGS], $with_ldflags)
-AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
+AC_SEARCH_LIBS([mq_open], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
save_LIBS="$LIBS"

View File

@ -1,29 +0,0 @@
From 645a9e5a2bbb06464a3fba1a3501e9d79e5bbad8 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 31 Oct 2012 11:53:56 +0100
Subject: [PATCH] dbus-manager: fix a fatal dbus abort in
bus_manager_message_handler()
If ListUnitFiles fails, or an OOM occurs, then dbus_message_unref()
will be called twice on "reply", causing systemd to crash. So remove
the call to dbus_message_unref(); it is unnecessary because of
the cleanup attribute on "reply".
[zj: modified to leave one dbus_message_unref() alone, per Colin
Walters' comment.]
---
src/core/dbus-manager.c | 1 -
1 file changed, 1 deletion(-)
Index: systemd-195/src/core/dbus-manager.c
===================================================================
--- systemd-195.orig/src/core/dbus-manager.c
+++ systemd-195/src/core/dbus-manager.c
@@ -1432,7 +1432,6 @@ static DBusHandlerResult bus_manager_mes
r = unit_file_get_list(m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
if (r < 0) {
unit_file_list_free(h);
- dbus_message_unref(reply);
return bus_send_error_reply(connection, message, NULL, r);
}

View File

@ -1,13 +0,0 @@
Index: systemd-195/units/debug-shell.service.in
===================================================================
--- systemd-195.orig/units/debug-shell.service.in
+++ systemd-195/units/debug-shell.service.in
@@ -13,7 +13,7 @@ IgnoreOnIsolate=yes
[Service]
Environment=TERM=linux
-ExecStart=@sushell@
+ExecStart=/bin/bash -c '[ -x @sushell@ ] && exec @sushell@ || exec /bin/bash'
Restart=always
RestartSec=0
StandardInput=tty

22
fix-devname-prefix.patch Normal file
View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 5 Dec 2012 15:13:27 +0000
Subject: fix devname prefix
fix modules.devname path, it isn't in /usr.
---
src/udev/udevd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2a0bf60..6c2c2c9 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -827,7 +827,7 @@ static void static_dev_create_from_modules(struct udev *udev)
FILE *f;
uname(&kernel);
- strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
+ strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL);
f = fopen(modules, "re");
if (f == NULL)
return;

View File

@ -1,40 +0,0 @@
From 6c142648aaced56ab681fcc97a71b06d588122a9 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Wed, 20 Mar 2013 21:32:05 +0100
Subject: [PATCH] Fix vacuum logic error
The vacuum code used to stop vacuuming after one deletion, even
when max_use was still exceeded.
Also make usage a uint64_t, as the code already pretends it is one.
Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
---
src/journal/journal-vacuum.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 731f6c7..4a3a5a9 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -36,7 +36,7 @@
#include "util.h"
struct vacuum_info {
- off_t usage;
+ uint64_t usage;
char *filename;
uint64_t realtime;
@@ -293,7 +293,7 @@ int journal_directory_vacuum(
if (unlinkat(dirfd(d), list[i].filename, 0) >= 0) {
log_debug("Deleted archived journal %s/%s.", directory, list[i].filename);
- if ((uint64_t) list[i].usage > sum)
+ if (list[i].usage < sum)
sum -= list[i].usage;
else
sum = 0;
--
1.8.1.4

View File

@ -1,26 +0,0 @@
From 978cf3c75fbd94fd0e046206ada6169b35edd919 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sun, 28 Oct 2012 17:37:16 +0100
Subject: [PATCH] logind: it's OK if a process on an pty requests a session
for seat0
After all, if a sudo/su inside an X terminal should get added to the
same session as the X session itself.
---
src/login/logind-dbus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: systemd-195/src/login/logind-dbus.c
===================================================================
--- systemd-195.orig/src/login/logind-dbus.c
+++ systemd-195/src/login/logind-dbus.c
@@ -409,8 +409,7 @@ static int bus_manager_create_session(Ma
if (vtnr != 0)
return -EINVAL;
- } else if (!isempty(tty) && s && seat_is_vtconsole(s))
- return -EINVAL;
+ }
if (s) {
if (seat_can_multi_session(s)) {

View File

@ -1,10 +0,0 @@
Index: systemd-195/units/local-fs-pre.target
===================================================================
--- systemd-195.orig/units/local-fs-pre.target
+++ systemd-195/units/local-fs-pre.target
@@ -8,4 +8,4 @@
[Unit]
Description=Local File Systems (Pre)
Documentation=man:systemd.special(7)
-After=md.service lvm.service dmraid.service
+After=md.service lvm.service dmraid.service systemd-udevd.service

View File

@ -1,43 +0,0 @@
From a99435109b83e7146a30ccf5387037b51c1fe907 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 21 Mar 2013 15:40:45 +0100
Subject: [PATCH] core: ensure LSB Provides are handled correctly
Let's say you have two initscripts, A and B:
A contains in its LSB header:
Required-Start: C
and B contains in its LSB header:
Provides: C
When systemd is parsing /etc/rc.d/, depending on the file order, you
can end up with either:
- B is parsed first. An unit "C.service" will be "created" and will be
added as additional name to B.service, with unit_add_name. No bug.
- A is parsed first. An unit "C.service" is created for the
"Required-Start" dependency (it will have no file attached, since
nothing provides this dependency yet). Then B is parsed and when trying
to handle "Provides: C", unit_add_name is called but will fail, because
"C.service" already exists in manager->units. Therefore, a merge should
occur for that case.
---
src/core/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/service.c b/src/core/service.c
index 4451d38..fa8a1cb 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -762,7 +762,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
continue;
if (unit_name_to_type(m) == UNIT_SERVICE)
- r = unit_add_name(u, m);
+ r = unit_merge_by_name(u, m);
else
/* NB: SysV targets
* which are provided
--
1.8.1.4

View File

@ -0,0 +1,22 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 20 Nov 2012 09:36:43 +0000
Subject: fix owner of /var/log/btmp
ensure btmp is owned only by root (bnc#777405).
---
tmpfiles.d/systemd.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tmpfiles.d/systemd.conf b/tmpfiles.d/systemd.conf
index ee86f2e..29d6e97 100644
--- a/tmpfiles.d/systemd.conf
+++ b/tmpfiles.d/systemd.conf
@@ -11,7 +11,7 @@ d /run/user 0755 root root ~10d
F /run/utmp 0664 root utmp -
f /var/log/wtmp 0664 root utmp -
-f /var/log/btmp 0600 root utmp -
+f /var/log/btmp 0600 root root -
d /var/cache/man - - - 30d

View File

@ -1,13 +0,0 @@
Index: systemd-44/tmpfiles.d/systemd.conf
===================================================================
--- systemd-44.orig/tmpfiles.d/systemd.conf
+++ systemd-44/tmpfiles.d/systemd.conf
@@ -11,7 +11,7 @@ d /run/user 0755 root root 10d
F /run/utmp 0664 root utmp -
f /var/log/wtmp 0664 root utmp -
-f /var/log/btmp 0600 root utmp -
+f /var/log/btmp 0600 root root -
d /var/cache/man - - - 30d

View File

@ -1,45 +0,0 @@
From ac97e2c559f5d386a332aba4a24bf9930cdb1c51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 19 Nov 2012 16:36:38 +0100
Subject: [PATCH] core/load-fragment: fix (potential) bad memory access
strncmp() could be used with size bigger then the size of the string,
because MAX was used instead of MIN.
If failing, print just the offending mount flag.
---
src/core/load-fragment.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
Index: systemd-195/src/core/load-fragment.c
===================================================================
--- systemd-195.orig/src/core/load-fragment.c
+++ systemd-195/src/core/load-fragment.c
@@ -1083,15 +1083,22 @@ int config_parse_exec_mount_flags(
assert(rvalue);
assert(data);
- FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- if (strncmp(w, "shared", MAX(l, 6U)) == 0)
+ FOREACH_WORD_SEPARATOR(w, l, rvalue, ", ", state) {
+ char _cleanup_free_ *t;
+
+ t = strndup(w, l);
+ if (!t)
+ return -ENOMEM;
+
+ if (streq(t, "shared"))
flags |= MS_SHARED;
- else if (strncmp(w, "slave", MAX(l, 5U)) == 0)
+ else if (streq(t, "slave"))
flags |= MS_SLAVE;
- else if (strncmp(w, "private", MAX(l, 7U)) == 0)
+ else if (streq(w, "private"))
flags |= MS_PRIVATE;
else {
- log_error("[%s:%u] Failed to parse mount flags, ignoring: %s", filename, line, rvalue);
+ log_error("[%s:%u] Failed to parse mount flag %s, ignoring: %s",
+ filename, line, t, rvalue);
return 0;
}
}

View File

@ -1,21 +1,20 @@
From f9d333f8d202fd853f2553ee6c3196b041ccfba5 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 23 Aug 2012 11:08:25 +0200
Subject: [PATCH] fix support for boot prefixed initscript (bnc#746506)
Subject: fix support for boot prefixed initscript (bnc#746506)
---
src/systemctl.c | 20 ++++++++++++++++++++
src/systemctl/systemctl.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
Index: systemd-195/src/systemctl/systemctl.c
===================================================================
--- systemd-195.orig/src/systemctl/systemctl.c
+++ systemd-195/src/systemctl/systemctl.c
@@ -3453,7 +3453,27 @@ static int enable_sysv_units(char **args
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index edd136a..36918f2 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3642,7 +3642,27 @@ static int enable_sysv_units(char **args) {
if (!found_sysv) {
free(p);
+#if defined(TARGET_SUSE)
+#ifdef HAVE_SYSV_COMPAT
+ p = NULL;
+ if (!isempty(arg_root))
+ asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name);

View File

@ -1,33 +0,0 @@
From b61e88162a6ce0c30da6984b0120959701283daa Mon Sep 17 00:00:00 2001
From: Olivier Brunel <i.am.jack.mail@gmail.com>
Date: Sat, 13 Oct 2012 14:24:15 +0200
Subject: [PATCH] swap: fix swap behaviour with symlinks
Starting a swap unit pointing to (What) a symlink (e.g. /dev/mapper/swap
or /dev/disk/by-uuid/...) would have said unit marked active, following
the one using the "actual" device (/dev/{dm-1,sda3}), but that new unit
would be seen as inactive.
Since all requests to stop swap units would follow/redirect to it,
and it is seen inactive, nothing would be done (swapoff never called).
This is because this unit would be treated twice in
swap_process_new_swap, the second call to swap_add_one causing it to
eventually be marked inactive.
---
src/core/swap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: systemd-195/src/core/swap.c
===================================================================
--- systemd-195.orig/src/core/swap.c
+++ systemd-195/src/core/swap.c
@@ -415,7 +415,8 @@ static int swap_process_new_swap(Manager
return -ENOMEM;
dn = udev_device_get_devnode(d);
- if (dn)
+ /* Skip dn==device, since that case will be handled below */
+ if (dn && !streq(dn, device))
r = swap_add_one(m, dn, device, prio, false, false, set_flags);
/* Add additional units for all symlinks */

View File

@ -0,0 +1,105 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 7 Nov 2011 18:04:20 +0100
Subject: force lvm restart after cryptsetup target is reached
---
src/cryptsetup/cryptsetup-generator.c | 58 ++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 8959bf5..d386b60 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <stdlib.h>
#include "log.h"
#include "util.h"
@@ -64,6 +65,55 @@ static bool has_option(const char *haystack, const char *needle) {
return false;
}
+static int create_storage_after_cryptsetup (void) {
+ int r;
+ char _cleanup_free_ *to = NULL, *p = NULL;
+ FILE _cleanup_fclose_ *f = NULL;
+
+ if (asprintf(&p, "%s/storage-after-cryptsetup.service", arg_dest) < 0)
+ return log_oom();
+
+ if (!(f = fopen(p, "wxe"))) {
+ log_error("Failed to create unit file: %m");
+ return -errno;
+ }
+
+ fprintf(f,
+ "[Unit]\n"
+ "Description=Restart storage after cryptsetup\n"
+ "DefaultDependencies=no\n"
+ "After=cryptsetup.target\n"
+ "Wants=cryptsetup.target\n"
+ "Before=local-fs.target\n"
+ "Before=shutdown.target\n");
+
+ fprintf(f,
+ "\n[Service]\n"
+ "RemainAfterExit=true\n"
+ "Type=oneshot\n"
+ "TimeoutSec=0\n"
+ "ExecStart=/usr/bin/systemctl restart lvm.service\n");
+
+ fflush(f);
+
+ if (ferror(f)) {
+ log_error("Failed to write file: %m");
+ return -errno;
+ }
+
+ if (asprintf(&to, "%s/local-fs.target.wants/storage-after-cryptsetup.service", arg_dest) < 0)
+ return log_oom();
+
+ mkdir_parents(to, 0755);
+
+ if (symlink("../storage-after-cryptsetup.service", to) < 0) {
+ log_error("Failed to create symlink ../storage-after-cryptsetup.service to '%s': %m", to);
+ return -errno;
+ }
+
+ return 0;
+}
+
static int create_disk(
const char *name,
const char *device,
@@ -284,6 +334,7 @@ int main(int argc, char *argv[]) {
FILE _cleanup_fclose_ *f = NULL;
unsigned n = 0;
int r = EXIT_SUCCESS;
+ bool no_crypttab = false;
char **i;
char _cleanup_strv_free_ **arg_proc_cmdline_disks_done = NULL;
char _cleanup_strv_free_ **arg_proc_cmdline_disks = NULL;
@@ -312,8 +363,10 @@ int main(int argc, char *argv[]) {
f = fopen("/etc/crypttab", "re");
if (!f) {
- if (errno == ENOENT)
+ if (errno == ENOENT) {
+ no_crypttab = true;
r = EXIT_SUCCESS;
+ }
else {
r = EXIT_FAILURE;
log_error("Failed to open /etc/crypttab: %m");
@@ -397,5 +450,8 @@ int main(int argc, char *argv[]) {
r = EXIT_FAILURE;
}
+ if ((r == EXIT_SUCCESS && !no_crypttab) && (create_storage_after_cryptsetup () < 0))
+ r = EXIT_FAILURE;
+
return r;
}

View File

@ -1,47 +0,0 @@
From 67ab5f761f9b854d8ce85f9ee47b298e497f8bd9 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Tue, 27 Nov 2012 01:09:28 +0100
Subject: [PATCH] fstab-generator: make error more helpful in case of
duplicates in fstab
Traditional sysvinit systems would not complain about duplicates in
fstab. Rather it (through monut -a) would mount one fs on top of another,
in effect the last entry taking precedent.
In systemd, the first entry takes precedent, all subsequent ones are
ignored and an error is printed.
The change of behavior and the source of this error message was causing
some confusion, so give a hint what migt be wrong.
---
src/fstab-generator/fstab-generator.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: systemd-195/src/fstab-generator/fstab-generator.c
===================================================================
--- systemd-195.orig/src/fstab-generator/fstab-generator.c
+++ systemd-195/src/fstab-generator/fstab-generator.c
@@ -111,7 +111,10 @@ static int add_swap(const char *what, st
f = fopen(unit, "wxe");
if (!f) {
r = -errno;
- log_error("Failed to create unit file %s: %m", unit);
+ if (errno == EEXIST)
+ log_error("Failed to create swap unit file %s, as it already exists. Duplicate entry in /etc/fstab?", unit);
+ else
+ log_error("Failed to create unit file %s: %m", unit);
goto finish;
}
@@ -262,7 +265,10 @@ static int add_mount(const char *what, c
f = fopen(unit, "wxe");
if (!f) {
r = -errno;
- log_error("Failed to create unit file %s: %m", unit);
+ if (errno == EEXIST)
+ log_error("Failed to create mount unit file %s, as it already exists. Duplicate entry in /etc/fstab?", unit);
+ else
+ log_error("Failed to create unit file %s: %m", unit);
goto finish;
}

View File

@ -1,115 +0,0 @@
From 40b8acd039cf1ea00167017e63d9c0a773002f0e Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 9 Nov 2012 12:00:46 +0100
Subject: [PATCH] fstab-generator: more specific error messages
---
src/fstab-generator/fstab-generator.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 251a346..62053b7 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -111,7 +111,7 @@ static int add_swap(const char *what, struct mntent *me) {
f = fopen(unit, "wxe");
if (!f) {
r = -errno;
- log_error("Failed to create unit file: %m");
+ log_error("Failed to create unit file %s: %m", unit);
goto finish;
}
@@ -138,7 +138,7 @@ static int add_swap(const char *what, struct mntent *me) {
fflush(f);
if (ferror(f)) {
- log_error("Failed to write unit file: %m");
+ log_error("Failed to write unit file %s: %m", unit);
r = -errno;
goto finish;
}
@@ -152,7 +152,7 @@ static int add_swap(const char *what, struct mntent *me) {
mkdir_parents_label(lnk, 0755);
if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink: %m");
+ log_error("Failed to create symlink %s: %m", lnk);
r = -errno;
goto finish;
}
@@ -171,7 +171,7 @@ static int add_swap(const char *what, struct mntent *me) {
mkdir_parents_label(lnk, 0755);
if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink: %m");
+ log_error("Failed to create symlink %s: %m", lnk);
r = -errno;
goto finish;
}
@@ -262,7 +262,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
f = fopen(unit, "wxe");
if (!f) {
r = -errno;
- log_error("Failed to create unit file: %m");
+ log_error("Failed to create unit file %s: %m", unit);
goto finish;
}
@@ -306,7 +306,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
fflush(f);
if (ferror(f)) {
- log_error("Failed to write unit file: %m");
+ log_error("Failed to write unit file %s: %m", unit);
r = -errno;
goto finish;
}
@@ -320,7 +320,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
mkdir_parents_label(lnk, 0755);
if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink: %m");
+ log_error("Failed to create symlink %s: %m", lnk);
r = -errno;
goto finish;
}
@@ -342,7 +342,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
mkdir_parents_label(lnk, 0755);
if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink: %m");
+ log_error("Failed to create symlink %s: %m", lnk);
r = -errno;
goto finish;
}
@@ -367,7 +367,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
f = fopen(automount_unit, "wxe");
if (!f) {
r = -errno;
- log_error("Failed to create unit file: %m");
+ log_error("Failed to create unit file %s: %m", automount_unit);
goto finish;
}
@@ -386,7 +386,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
fflush(f);
if (ferror(f)) {
- log_error("Failed to write unit file: %m");
+ log_error("Failed to write unit file %s: %m", automount_unit);
r = -errno;
goto finish;
}
@@ -400,7 +400,7 @@ static int add_mount(const char *what, const char *where, struct mntent *me) {
mkdir_parents_label(lnk, 0755);
if (symlink(automount_unit, lnk) < 0) {
- log_error("Failed to create symlink: %m");
+ log_error("Failed to create symlink %s: %m", lnk);
r = -errno;
goto finish;
}
--
1.7.10.4

View File

@ -1,25 +0,0 @@
From f9ea108e7c3544c03822277a1112a48dc62f6ed4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 24 Dec 2012 13:01:00 +0100
Subject: [PATCH] fstab-generator: properly detect bind mounts
This kinda undoes a83cbaccd03c3f28e47e9330f4a22ff65ce4b561 and
1d634e21b453f3c80d7c6c4bd90a6b84e42a3d2a but corrects the original code
to compare the mount type with "bind" rather than the mount options.
---
src/fstab-generator/fstab-generator.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: systemd-195/src/fstab-generator/fstab-generator.c
===================================================================
--- systemd-195.orig/src/fstab-generator/fstab-generator.c
+++ systemd-195/src/fstab-generator/fstab-generator.c
@@ -199,7 +199,7 @@ static bool mount_is_bind(struct mntent
return
hasmntopt(me, "bind") ||
- streq(me->mnt_opts, "bind");
+ streq(me->mnt_type, "bind");
}
static bool mount_is_network(struct mntent *me) {

View File

@ -1,36 +0,0 @@
Index: systemd-195/src/hostname/hostnamed.c
===================================================================
--- systemd-195.orig/src/hostname/hostnamed.c
+++ systemd-195/src/hostname/hostnamed.c
@@ -118,6 +118,10 @@ static int read_data(void) {
if (r < 0 && r != -ENOENT)
return r;
+ r = read_one_line_file("/etc/HOSTNAME", &data[PROP_STATIC_HOSTNAME]);
+ if (r < 0 && r != -ENOENT)
+ return r;
+
return 0;
}
@@ -204,6 +208,7 @@ static int write_data_hostname(void) {
static int write_data_static_hostname(void) {
+ int r;
if (isempty(data[PROP_STATIC_HOSTNAME])) {
if (unlink("/etc/hostname") < 0)
@@ -212,7 +217,11 @@ static int write_data_static_hostname(vo
return 0;
}
- return write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ r = write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ if (!r) {
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
+ }
+ return r;
}
static int write_data_other(void) {

View File

@ -1,13 +1,17 @@
Index: systemd-195/src/systemctl/systemctl.c
===================================================================
--- systemd-195.orig/src/systemctl/systemctl.c
+++ systemd-195/src/systemctl/systemctl.c
@@ -4118,10 +4118,32 @@ static int systemctl_parse_argv(int argc
};
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 22 Jan 2013 17:02:04 +0000
Subject: handle SYSTEMCTL_OPTIONS environment variable
int c;
+ char **to_free = NULL;
(bnc#798620)
---
src/systemctl/systemctl.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 36918f2..28d6586 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4340,6 +4340,26 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
@ -16,7 +20,7 @@ Index: systemd-195/src/systemctl/systemctl.c
+
+ if (*parsed_systemctl_options && **parsed_systemctl_options) {
+ char **k,**a;
+ char **new_argv = new(char*, strv_length(argv) + strv_length(parsed_systemctl_options) + 1);
+ char _cleanup_strv_free_ **new_argv = new(char*, strv_length(argv) + strv_length(parsed_systemctl_options) + 1);
+ new_argv[0] = strdup(argv[0]);
+ for (k = new_argv+1, a = parsed_systemctl_options; *a; k++, a++) {
+ *k = strdup(*a);
@ -28,19 +32,9 @@ Index: systemd-195/src/systemctl/systemctl.c
+ argv = new_argv;
+ argc = strv_length(new_argv);
+ strv_free (parsed_systemctl_options);
+ to_free = new_argv;
+ }
+ }
+
while ((c = getopt_long(argc, argv, "ht:p:aqfs:H:Pn:o:", options, NULL)) >= 0) {
while ((c = getopt_long(argc, argv, "ht:p:aqfs:H:Pn:o:i", options, NULL)) >= 0) {
switch (c) {
@@ -4297,6 +4319,8 @@ static int systemctl_parse_argv(int argc
return -EINVAL;
}
+ strv_free(to_free);
+
return 1;
}

View File

@ -1,20 +1,20 @@
m 5c894bc1e45f7c34bf7fc4ca0d20bf1c3b679bef Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 18 Aug 2011 18:28:01 +0200
Subject: [PATCH] handle disable_caplock and compose_table and kbd_rate
Date: Fri, 19 Aug 2011 15:29:49 +0000
Subject: handle disable_caplock and compose_table and kbd_rate
(bnc#746595)
---
src/vconsole-setup.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 121 insertions(+), 3 deletions(-)
src/vconsole/vconsole-setup.c | 156 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 153 insertions(+), 3 deletions(-)
Index: systemd-195/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-195.orig/src/vconsole/vconsole-setup.c
+++ systemd-195/src/vconsole/vconsole-setup.c
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index c1f662b..5f3354e 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -40,6 +40,7 @@
#include "log.h"
#include "macro.h"
#include "virt.h"
#include "fileio.h"
+#include "strv.h"
static bool is_vconsole(int fd) {
@ -23,14 +23,14 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
return r;
}
-static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
-static int keymap_load(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
- const char *args[8];
+static int load_keymap(const char *vc, const char *map, const char *map_toggle, bool utf8, bool disable_capslock, pid_t *_pid) {
+static int keymap_load(const char *vc, const char *map, const char *map_toggle, bool utf8, bool disable_capslock, pid_t *_pid) {
+ const char *args[9];
int i = 0;
pid_t pid;
@@ -119,6 +120,8 @@ static int load_keymap(const char *vc, c
@@ -119,6 +120,8 @@ static int keymap_load(const char *vc, const char *map, const char *map_toggle,
args[i++] = map;
if (map_toggle)
args[i++] = map_toggle;
@ -39,11 +39,11 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
args[i++] = NULL;
pid = fork();
@@ -172,6 +175,101 @@ static int load_font(const char *vc, con
return 0;
@@ -217,6 +220,101 @@ static void font_copy_to_all_vcs(int fd) {
}
}
+#ifdef TARGET_SUSE
+#ifdef HAVE_SYSV_COMPAT
+static int load_compose_table(const char *vc, const char *compose_table, pid_t *_pid) {
+ const char *args[1024];
+ int i = 0, j = 0;
@ -102,6 +102,7 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
+
+ return 0;
+}
+#endif
+
+static int set_kbd_rate(const char *vc, const char *kbd_rate, const char *kbd_delay, pid_t *_pid) {
+ const char *args[7];
@ -136,16 +137,15 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
+ *_pid = pid;
+ return 0;
+}
+#endif
+
int main(int argc, char **argv) {
const char *vc;
char *vc_keymap = NULL;
@@ -185,8 +283,16 @@ int main(int argc, char **argv) {
#if defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
char *vc_keytable = NULL;
#endif
+#ifdef TARGET_SUSE
@@ -224,8 +322,16 @@ int main(int argc, char **argv) {
char *vc_font = NULL;
char *vc_font_map = NULL;
char *vc_font_unimap = NULL;
+#ifdef HAVE_SYSV_COMPAT
+ char *vc_kbd_delay = NULL;
+ char *vc_kbd_rate = NULL;
+ char *vc_kbd_disable_caps_lock = NULL;
@ -155,47 +155,59 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
int fd = -1;
bool utf8;
+ bool disable_capslock = false;
int r = EXIT_FAILURE;
pid_t font_pid = 0, keymap_pid = 0;
bool font_copy = false;
int r = EXIT_FAILURE;
@@ -286,13 +392,43 @@ int main(int argc, char **argv) {
log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
}
@@ -277,6 +383,10 @@ int main(int argc, char **argv) {
#elif defined(TARGET_SUSE)
r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE,
"KEYTABLE", &vc_keymap,
+ if (r <= 0) {
+#ifdef HAVE_SYSV_COMPAT
+ r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE,
+ "KEYTABLE", &vc_keymap,
+ "KBD_DELAY", &vc_kbd_delay,
+ "KBD_RATE", &vc_kbd_rate,
+ "KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
+ "COMPOSETABLE", &vc_compose_table,
NULL);
if (r < 0 && r != -ENOENT)
log_warning("Failed to read /etc/sysconfig/keyboard: %s", strerror(-r));
@@ -289,6 +399,8 @@ int main(int argc, char **argv) {
if (r < 0 && r != -ENOENT)
log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r));
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/keyboard: %s", strerror(-r));
+
+ r = parse_env_file("/etc/sysconfig/console", NEWLINE,
+ "CONSOLE_FONT", &vc_font,
+ "CONSOLE_SCREENMAP", &vc_font_map,
+ "CONSOLE_UNICODEMAP", &vc_font_unimap,
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r));
+
+ disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
+
#elif defined(TARGET_ARCH)
r = parse_env_file("/etc/rc.conf", NEWLINE,
"KEYMAP", &vc_keymap,
@@ -435,7 +547,11 @@ int main(int argc, char **argv) {
+#endif
+ }
+
if (utf8)
enable_utf8(fd);
else
disable_utf8(fd);
- if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
+ if (load_keymap(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid) >= 0 &&
+#ifdef TARGET_SUSE
r = EXIT_FAILURE;
- if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, &keymap_pid) >= 0 &&
+
+ if (keymap_load(vc, vc_keymap, vc_keymap_toggle, utf8, disable_capslock, &keymap_pid) >= 0 &&
+#ifdef HAVE_SYSV_COMPAT
+ load_compose_table(vc, vc_compose_table, &compose_table_pid) >= 0 &&
+ set_kbd_rate(vc, vc_kbd_rate, vc_kbd_delay, &kbd_rate_pid) >= 0 &&
+#endif
load_font(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
font_load(vc, vc_font, vc_font_map, vc_font_unimap, &font_pid) >= 0)
r = EXIT_SUCCESS;
@@ -443,6 +559,14 @@ finish:
@@ -300,6 +436,14 @@ finish:
if (keymap_pid > 0)
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
+#ifdef TARGET_SUSE
+#ifdef HAVE_SYSV_COMPAT
+ if (compose_table_pid > 0)
+ wait_for_terminate_and_warn(KBD_LOADKEYS, compose_table_pid);
+
@ -203,14 +215,14 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
+ wait_for_terminate_and_warn("/bin/kbdrate", kbd_rate_pid);
+#endif
+
if (font_pid > 0)
if (font_pid > 0) {
wait_for_terminate_and_warn(KBD_SETFONT, font_pid);
@@ -450,6 +574,12 @@ finish:
if (font_copy)
@@ -310,6 +454,12 @@ finish:
free(vc_font);
free(vc_font_map);
free(vc_font_unimap);
+#ifdef TARGET_SUSE
+#ifdef HAVE_SYSV_COMPAT
+ free(vc_kbd_delay);
+ free(vc_kbd_rate);
+ free(vc_kbd_disable_caps_lock);

46
handle-etc-HOSTNAME.patch Normal file
View File

@ -0,0 +1,46 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 15 Feb 2013 16:04:39 +0000
Subject: handle /etc/HOSTNAME
(bnc#803653)
---
src/hostname/hostnamed.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 4aad17b..e7532f6 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -129,6 +129,10 @@ static int read_data(void) {
if (r < 0 && r != -ENOENT)
return r;
+ r = read_one_line_file("/etc/HOSTNAME", &data[PROP_STATIC_HOSTNAME]);
+ if (r < 0 && r != -ENOENT)
+ return r;
+
return 0;
}
@@ -283,6 +287,7 @@ static int write_data_hostname(void) {
static int write_data_static_hostname(void) {
+ int r;
if (isempty(data[PROP_STATIC_HOSTNAME])) {
if (unlink("/etc/hostname") < 0)
@@ -290,7 +295,12 @@ static int write_data_static_hostname(void) {
return 0;
}
- return write_one_line_file_atomic_label("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+
+ r = write_one_line_file_atomic_label("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ if (!r) {
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
+ }
+ return r;
}
static int write_data_other(void) {

View File

@ -1,8 +1,121 @@
Index: systemd-195/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-195.orig/src/vconsole/vconsole-setup.c
+++ systemd-195/src/vconsole/vconsole-setup.c
@@ -287,12 +287,14 @@ int main(int argc, char **argv) {
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Fri, 20 Apr 2012 17:16:37 +0200
Subject: handle numlock value in /etc/sysconfig/keyboard
(bnc#746595)
---
Makefile.am | 13 +++++++++++
configure.ac | 5 +++++
rules/73-seat-numlock.rules | 8 +++++++
src/login/numlock-on.c | 37 ++++++++++++++++++++++++++++++++
src/vconsole/vconsole-setup.c | 38 +++++++++++++++++++++++++++++++++
units/systemd-vconsole-setup.service.in | 2 +-
6 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 rules/73-seat-numlock.rules
create mode 100644 src/login/numlock-on.c
diff --git a/Makefile.am b/Makefile.am
index e44b075..00905d0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2113,6 +2113,19 @@ dist_udevrules_DATA += \
rules/61-accelerometer.rules
# ------------------------------------------------------------------------------
+numlock_on_SOURCES = \
+ src/login/numlock-on.c
+
+numlock_on_CFLAGS = \
+ $(AM_CFLAGS)
+
+udevlibexec_PROGRAMS += \
+ numlock-on
+
+dist_udevrules_DATA += \
+ rules/73-seat-numlock.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_GUDEV
if ENABLE_GTK_DOC
SUBDIRS += \
diff --git a/configure.ac b/configure.ac
index 5421461..a2d8755 100644
--- a/configure.ac
+++ b/configure.ac
@@ -787,6 +787,11 @@ AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
# ------------------------------------------------------------------------------
+AC_PATH_PROG([HWINFO], [hwinfo], [/usr/sbin/hwinfo], [/sbin:/usr/sbin:/usr/bin:/bin])
+AC_DEFINE_UNQUOTED([HWINFO], ["${HWINFO}"], [Path to hwinfo binary. (SUSE)])
+AC_PATH_PROG([SETLEDS], [setleds], [/bin/setleds], [/sbin:/usr/sbin:/usr/bin:/bin])
+AC_DEFINE_UNQUOTED([SETLEDS], ["${SETLEDS}"], [Path to setleds binary.])
+
# Location of the init scripts as mandated by LSB
SYSTEM_SYSVINIT_PATH=/etc/init.d
SYSTEM_SYSVRCND_PATH=/etc/rc.d
diff --git a/rules/73-seat-numlock.rules b/rules/73-seat-numlock.rules
new file mode 100644
index 0000000..e0061ed
--- /dev/null
+++ b/rules/73-seat-numlock.rules
@@ -0,0 +1,8 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TEST=="/run/numlock-on", RUN+="numlock-on $env{DEVNAME}"
diff --git a/src/login/numlock-on.c b/src/login/numlock-on.c
new file mode 100644
index 0000000..77a8368
--- /dev/null
+++ b/src/login/numlock-on.c
@@ -0,0 +1,37 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2012 Stanislav Brabec
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "config.h"
+#include <fcntl.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+int main (int argc, char *argv[]) {
+ static const char *args[] = { SETLEDS, "-D", "+num", NULL };
+
+ if (argc != 2)
+ return EX_USAGE;
+ close (STDIN_FILENO);
+ if (open (argv[1], O_RDONLY) != STDIN_FILENO)
+ return EX_IOERR;
+ /* add cast to prevent warning caused by -Wwrite-strings */
+ return execv(args[0], (char * const*) args);
+}
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 5f3354e..f5cafc1 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -326,12 +326,14 @@ int main(int argc, char **argv) {
char *vc_kbd_delay = NULL;
char *vc_kbd_rate = NULL;
char *vc_kbd_disable_caps_lock = NULL;
@ -14,10 +127,10 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
bool utf8;
bool disable_capslock = false;
+ bool numlock = false;
int r = EXIT_FAILURE;
pid_t font_pid = 0, keymap_pid = 0;
@@ -386,6 +388,7 @@ int main(int argc, char **argv) {
bool font_copy = false;
int r = EXIT_FAILURE;
@@ -399,6 +401,7 @@ int main(int argc, char **argv) {
"KBD_DELAY", &vc_kbd_delay,
"KBD_RATE", &vc_kbd_rate,
"KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
@ -25,7 +138,7 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
"COMPOSETABLE", &vc_compose_table,
NULL);
if (r < 0 && r != -ENOENT)
@@ -400,6 +403,37 @@ int main(int argc, char **argv) {
@@ -413,6 +416,37 @@ int main(int argc, char **argv) {
log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r));
disable_capslock = vc_kbd_disable_caps_lock && strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
@ -61,9 +174,9 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
+ } else
+ numlock = vc_kbd_numlock && strcasecmp(vc_kbd_numlock, "YES") == 0;
#elif defined(TARGET_ARCH)
r = parse_env_file("/etc/rc.conf", NEWLINE,
@@ -558,6 +592,10 @@ int main(int argc, char **argv) {
#endif
}
@@ -435,6 +469,10 @@ int main(int argc, char **argv) {
finish:
if (keymap_pid > 0)
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
@ -72,109 +185,13 @@ Index: systemd-195/src/vconsole/vconsole-setup.c
+ else
+ unlink("/run/numlock-on");
#ifdef TARGET_SUSE
#ifdef HAVE_SYSV_COMPAT
if (compose_table_pid > 0)
Index: systemd-195/Makefile.am
===================================================================
--- systemd-195.orig/Makefile.am
+++ systemd-195/Makefile.am
@@ -2017,6 +2017,19 @@ dist_udevrules_DATA += \
rules/61-accelerometer.rules
# ------------------------------------------------------------------------------
+numlock_on_SOURCES = \
+ src/login/numlock-on.c
+
+numlock_on_CFLAGS = \
+ $(AM_CFLAGS)
+
+udevlibexec_PROGRAMS += \
+ numlock-on
+
+dist_udevrules_DATA += \
+ rules/73-seat-numlock.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_GUDEV
if ENABLE_GTK_DOC
SUBDIRS += \
Index: systemd-195/configure.ac
===================================================================
--- systemd-195.orig/configure.ac
+++ systemd-195/configure.ac
@@ -660,6 +660,13 @@ fi
with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
+if test z"$with_distro" = z"suse" ; then
+ AC_PATH_PROG([HWINFO], [hwinfo], [/usr/sbin/hwinfo], [/sbin:/usr/sbin:/usr/bin:/bin])
+ AC_DEFINE_UNQUOTED([HWINFO], ["${HWINFO}"], [Path to hwinfo binary. (SUSE)])
+fi
+AC_PATH_PROG([SETLEDS], [setleds], [/bin/setleds], [/sbin:/usr/sbin:/usr/bin:/bin])
+AC_DEFINE_UNQUOTED([SETLEDS], ["${SETLEDS}"], [Path to setleds binary.])
+
# Location of the init scripts as mandated by LSB
SYSTEM_SYSVINIT_PATH=/etc/init.d
SYSTEM_SYSVRCND_PATH=/etc/rc.d
Index: systemd-195/rules/73-seat-numlock.rules
===================================================================
--- /dev/null
+++ systemd-195/rules/73-seat-numlock.rules
@@ -0,0 +1,8 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TEST=="/run/numlock-on", RUN+="numlock-on $env{DEVNAME}"
Index: systemd-195/src/login/numlock-on.c
===================================================================
--- /dev/null
+++ systemd-195/src/login/numlock-on.c
@@ -0,0 +1,36 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2012 Stanislav Brabec
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "config.h"
+#include <fcntl.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+int main (int argc, char *argv[]) {
+ static char *args[] = { SETLEDS, "-D", "+num", NULL };
+
+ if (argc != 2)
+ return EX_USAGE;
+ close (STDIN_FILENO);
+ if (open (argv[1], O_RDONLY) != STDIN_FILENO)
+ return EX_IOERR;
+ return execv(args[0], args);
+}
Index: systemd-195/units/systemd-vconsole-setup.service.in
===================================================================
--- systemd-195.orig/units/systemd-vconsole-setup.service.in
+++ systemd-195/units/systemd-vconsole-setup.service.in
@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup
diff --git a/units/systemd-vconsole-setup.service.in b/units/systemd-vconsole-setup.service.in
index 18faa63..44ebbd0 100644
--- a/units/systemd-vconsole-setup.service.in
+++ b/units/systemd-vconsole-setup.service.in
@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service

View File

@ -1,48 +0,0 @@
Index: systemd-195/src/core/locale-setup.c
===================================================================
--- systemd-195.orig/src/core/locale-setup.c
+++ systemd-195/src/core/locale-setup.c
@@ -69,6 +69,11 @@ static const char * const variable_names
int locale_setup(void) {
char *variables[_VARIABLE_MAX];
int r = 0, i;
+#if defined(TARGET_SUSE)
+ char *root_uses_lang;
+
+ zero(root_uses_lang);
+#endif
zero(variables);
@@ -134,11 +139,21 @@ int locale_setup(void) {
#elif defined(TARGET_SUSE)
if (r <= 0 &&
(r = parse_env_file("/etc/sysconfig/language", NEWLINE,
+ "ROOT_USES_LANG", &root_uses_lang,
"RC_LANG", &variables[VARIABLE_LANG],
NULL)) < 0) {
if (r != -ENOENT)
log_warning("Failed to read /etc/sysconfig/language: %s", strerror(-r));
+ } else {
+ if (!root_uses_lang || root_uses_lang && strcasecmp(root_uses_lang,"yes") != 0) {
+ if (root_uses_lang && strcasecmp(root_uses_lang,"ctype") == 0)
+ variables[VARIABLE_LC_CTYPE]=variables[VARIABLE_LANG];
+ else
+ free(variables[VARIABLE_LANG]);
+
+ variables[VARIABLE_LANG]=strdup("POSIX");
+ }
}
#elif defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM)
@@ -247,5 +262,9 @@ finish:
for (i = 0; i < _VARIABLE_MAX; i++)
free(variables[i]);
+#if defined(TARGET_SUSE)
+ free(root_uses_lang);
+#endif
+
return r;
}

View File

@ -0,0 +1,54 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 4 Dec 2012 16:51:32 +0000
Subject: handle root_uses_lang value in /etc/sysconfig/language
handle ROOT_USES_LANG=ctype (bnc#792182).
---
src/core/locale-setup.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c
index eefb256..d6cbea9 100644
--- a/src/core/locale-setup.c
+++ b/src/core/locale-setup.c
@@ -70,6 +70,11 @@ static const char * const variable_names[_VARIABLE_MAX] = {
int locale_setup(void) {
char *variables[_VARIABLE_MAX];
int r = 0, i;
+#ifdef HAVE_SYSV_COMPAT
+ char _cleanup_free_ *root_uses_lang;
+
+ zero(root_uses_lang);
+#endif
zero(variables);
@@ -119,6 +124,28 @@ int locale_setup(void) {
log_warning("Failed to read /etc/locale.conf: %s", strerror(-r));
}
+#ifdef HAVE_SYSV_COMPAT
+ if (r <= 0 &&
+ (r = parse_env_file("/etc/sysconfig/language", NEWLINE,
+ "ROOT_USES_LANG", &root_uses_lang,
+ "RC_LANG", &variables[VARIABLE_LANG],
+ NULL)) < 0) {
+
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/language: %s", strerror(-r));
+ } else {
+ if (!root_uses_lang || (root_uses_lang && !strcaseeq(root_uses_lang,"yes"))) {
+ if (root_uses_lang && strcaseeq(root_uses_lang,"ctype"))
+ variables[VARIABLE_LC_CTYPE]=variables[VARIABLE_LANG];
+ else
+ free(variables[VARIABLE_LANG]);
+
+ variables[VARIABLE_LANG]=strdup("POSIX");
+ }
+ }
+
+#endif
+
if (!variables[VARIABLE_LANG]) {
variables[VARIABLE_LANG] = strdup("C");
if (!variables[VARIABLE_LANG]) {

View File

@ -1,32 +0,0 @@
From f09a7d25545b5e3a2dd3dfc1ff7ebc8560a3354c Mon Sep 17 00:00:00 2001
From: Olivier Brunel <i.am.jack.mail@gmail.com>
Date: Mon, 5 Nov 2012 00:28:45 +0100
Subject: [PATCH] systemd: highlight ordering cycle deletions
Having unit(s) removed/not started, even if it solved the issue and allowed
to boot successfully, should still be considered an error, as something
clearly isn't right.
This patch elevates the log message from warning to error, and adds a status
message to make things more obvious.
---
src/core/transaction.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 4bce942..ee6992a 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -374,7 +374,8 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
if (delete) {
- log_warning("Breaking ordering cycle by deleting job %s/%s", delete->unit->id, job_type_to_string(delete->type));
+ log_error("Breaking ordering cycle by deleting job %s/%s", delete->unit->id, job_type_to_string(delete->type));
+ status_printf(ANSI_HIGHLIGHT_RED_ON " SKIP " ANSI_HIGHLIGHT_OFF, true, "Ordering cycle found, skip %s", unit_description(delete->unit));
transaction_delete_unit(tr, delete->unit);
return -EAGAIN;
}
--
1.7.10.4

View File

@ -1,24 +0,0 @@
From 59f432ea6d6d441d0af7c76c37e80730c8df473a Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 15 Nov 2012 22:47:04 +0100
Subject: [PATCH] hostnamectl: fix parsing of --no-ask-password
---
src/hostname/hostnamectl.c | 4 ++++
1 file changed, 4 insertions(+)
Index: systemd-195/src/hostname/hostnamectl.c
===================================================================
--- systemd-195.orig/src/hostname/hostnamectl.c
+++ systemd-195/src/hostname/hostnamectl.c
@@ -402,6 +402,10 @@ static int parse_argv(int argc, char *ar
arg_set_static = true;
break;
+ case ARG_NO_ASK_PASSWORD:
+ arg_ask_password = false;
+ break;
+
case '?':
return -EINVAL;

View File

@ -1,26 +0,0 @@
From f36d7992ef9588e24feaae5bb3d103ca63af71bd Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Mon, 29 Oct 2012 20:54:26 +0100
Subject: [PATCH] hostnamectl: do not choke on set-hostname with no argument
https://bugzilla.redhat.com/show_bug.cgi?id=871172
---
src/hostname/hostnamectl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 1d448bd..e7b2b49 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -430,7 +430,7 @@ static int hostnamectl_main(DBusConnection *bus, int argc, char *argv[], DBusErr
int (* const dispatch)(DBusConnection *bus, char **args, unsigned n);
} verbs[] = {
{ "status", LESS, 1, show_status },
- { "set-hostname", LESS, 2, set_hostname },
+ { "set-hostname", EQUAL, 2, set_hostname },
{ "set-icon-name", EQUAL, 2, set_icon_name },
};
--
1.7.10.4

View File

@ -1,173 +0,0 @@
Index: systemd-195/bash-completion/systemd-bash-completion.sh
===================================================================
--- systemd-195.orig/bash-completion/systemd-bash-completion.sh
+++ systemd-195/bash-completion/systemd-bash-completion.sh
@@ -114,15 +114,15 @@ _systemctl () {
[SNAPSHOTS]='delete'
[ENVS]='set-environment unset-environment'
[STANDALONE]='daemon-reexec daemon-reload default dot dump
- emergency exit halt kexec list-jobs list-units
- list-unit-files poweroff reboot rescue show-environment'
+ emergency exit halt hybrid-sleep hibernate kexec list-jobs list-units
+ list-unit-files poweroff reboot rescue show-environment suspend'
[NAME]='snapshot load'
[FILE]='link'
)
for ((i=0; $i <= $COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
- ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
verb=${COMP_WORDS[i]}
break
fi
@@ -245,7 +245,7 @@ _loginctl () {
for ((i=0; $i <= $COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
- ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG}]}; then
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
verb=${COMP_WORDS[i]}
break
fi
@@ -280,10 +280,21 @@ _loginctl () {
}
complete -F _loginctl loginctl
+__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
+ ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
+ _{P,U,G}ID _COMM _EXE _CMDLINE
+ _AUDIT_{SESSION,LOGINUID}
+ _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
+ _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
+ _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
+ _KERNEL_{DEVICE,SUBSYSTEM}
+ _UDEV_{SYSNAME,DEVNODE,DEVLINK}
+ __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
+
_journalctl() {
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
- [STANDALONE]='-a --all -b --this-boot -f --follow --header
+ [STANDALONE]='-a --all -b --this-boot --disk-usage -f --follow --header
-h --help -l --local --new-id128 -m --merge --no-pager
--no-tail -q --quiet --setup-keys --this-boot --verify
--version'
@@ -291,17 +302,6 @@ _journalctl() {
[ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until
--verify-key'
)
- local journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
- ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
- _{P,U,G}ID _COMM _EXE _CMDLINE
- _AUDIT_{SESSION,LOGINUID}
- _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
- _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
- _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
- _KERNEL_{DEVICE,SUBSYSTEM}
- _UDEV_{SYSNAME,DEVNODE,DEVLINK}
- __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
-
if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
case $prev in
@@ -313,7 +313,7 @@ _journalctl() {
comps='short short-monotonic verbose export json cat'
;;
--field|-F)
- comps=${journal_fields[*]}
+ comps=${__journal_fields[*]}
;;
--unit|-u)
comps=$(journalctl -F '_SYSTEMD_UNIT')
@@ -337,7 +337,7 @@ _journalctl() {
COMPREPLY=( $(compgen -W '${field_vals[*]}' -- "$cur") )
else
compopt -o nospace
- COMPREPLY=( $(compgen -W '${journal_fields[*]}' -S= -- "$cur") )
+ COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") )
fi
}
complete -F _journalctl journalctl
@@ -476,3 +476,81 @@ _hostnamectl() {
return 0
}
complete -F _hostnamectl hostnamectl
+
+__get_all_sysdevs() {
+ local -a devs=(/sys/bus/*/devices/*/ /sys/class/*/*/)
+ printf '%s\n' "${devs[@]%/}"
+}
+
+_udevadm() {
+ local i verb comps
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local OPTS='-h --help --version --debug'
+
+ local -A VERBS=(
+ [INFO]='info'
+ [TRIGGER]='trigger'
+ [SETTLE]='settle'
+ [CONTROL]='control'
+ [MONITOR]='monitor'
+ [HWDB]='hwdb'
+ [TESTBUILTIN]='test-builtin'
+ [TEST]='test'
+ )
+
+ for ((i=0; $i <= $COMP_CWORD; i++)); do
+ if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
+ ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
+ verb=${COMP_WORDS[i]}
+ break
+ fi
+ done
+
+ if [[ -z $verb && $cur = -* ]]; then
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+ return 0
+ fi
+
+ if [[ -z $verb ]]; then
+ comps=${VERBS[*]}
+
+ elif __contains_word "$verb" ${VERBS[INFO]}; then
+ if [[ $cur = -* ]]; then
+ comps='--help --query= --path= --name= --root --attribute-walk --export-db --cleanup-db'
+ else
+ comps=$( __get_all_sysdevs )
+ fi
+
+ elif __contains_word "$verb" ${VERBS[TRIGGER]}; then
+ comps='--help --verbose --dry-run --type= --action= --subsystem-match=
+ --subsystem-nomatch= --attr-match= --attr-nomatch= --property-match=
+ --tag-match= --sysname-match= --parent-match='
+
+ elif __contains_word "$verb" ${VERBS[SETTLE]}; then
+ comps='--help --timeout= --seq-start= --seq-end= --exit-if-exists= --quiet'
+
+ elif __contains_word "$verb" ${VERBS[CONTROL]}; then
+ comps='--help --exit --log-priority= --stop-exec-queue --start-exec-queue
+ --reload --property= --children-max= --timeout='
+
+ elif __contains_word "$verb" ${VERBS[MONITOR]}; then
+ comps='--help --kernel --udev --property --subsystem-match= --tag-match='
+
+ elif __contains_word "$verb" ${VERBS[HWDB]}; then
+ comps='--help --update --test='
+
+ elif __contains_word "$verb" ${VERBS[TEST]}; then
+ if [[ $cur = -* ]]; then
+ comps='--help --action='
+ else
+ comps=$( __get_all_sysdevs )
+ fi
+
+ elif __contains_word "$verb" ${VERBS[TESTBUILTIN]}; then
+ comps='blkid btrfs firmware hwdb input_id kmod net_id path_id usb_id uaccess'
+ fi
+
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+}
+complete -F _udevadm udevadm

View File

@ -1,304 +0,0 @@
From a4bcff5ba36115495994e9f9ba66074471de76ab Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 26 Oct 2012 03:24:03 +0200
Subject: [PATCH] journal: introduce entry array chain cache
When traversing entry array chains for a bisection or for retrieving an
item by index we previously always started at the beginning of the
chain. Since we tend to look at the same chains repeatedly, let's cache
where we have been the last time, and maybe we can skip ahead with this
the next time.
This turns most bisections and index lookups from O(log(n)*log(n)) into
O(log(n)). More importantly however, we seek around on disk much less,
which is good to reduce buffer cache and seek times on rotational disks.
---
.gitignore | 1 +
Makefile.am | 9 ++++
src/journal/journal-file.c | 109 +++++++++++++++++++++++++++++++++++++---
src/journal/journal-file.h | 3 ++
src/journal/test-journal-enum.c | 53 +++++++++++++++++++
src/shared/hashmap.c | 19 +++++++
src/shared/hashmap.h | 3 ++
7 files changed, 189 insertions(+), 8 deletions(-)
create mode 100644 src/journal/test-journal-enum.c
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index edf8e7d..6c9deac 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -65,6 +65,9 @@
/* n_data was the first entry we added after the initial file format design */
#define HEADER_SIZE_MIN ALIGN64(offsetof(Header, n_data))
+/* How many entries to keep in the entry array chain cache at max */
+#define CHAIN_CACHE_MAX 20
+
void journal_file_close(JournalFile *f) {
assert(f);
@@ -97,6 +100,8 @@ void journal_file_close(JournalFile *f) {
if (f->mmap)
mmap_cache_unref(f->mmap);
+ hashmap_free_free(f->chain_cache);
+
#ifdef HAVE_XZ
free(f->compress_buffer);
#endif
@@ -1307,37 +1312,89 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
return r;
}
+typedef struct ChainCacheItem {
+ uint64_t first; /* the array at the begin of the chain */
+ uint64_t array; /* the cached array */
+ uint64_t begin; /* the first item in the cached array */
+ uint64_t total; /* the total number of items in all arrays before this one in the chain */
+} ChainCacheItem;
+
+static void chain_cache_put(
+ Hashmap *h,
+ ChainCacheItem *ci,
+ uint64_t first,
+ uint64_t array,
+ uint64_t begin,
+ uint64_t total) {
+
+ if (!ci) {
+ if (hashmap_size(h) >= CHAIN_CACHE_MAX)
+ ci = hashmap_steal_first(h);
+ else {
+ ci = new(ChainCacheItem, 1);
+ if (!ci)
+ return;
+ }
+
+ ci->first = first;
+
+ if (hashmap_put(h, &ci->first, ci) < 0) {
+ free(ci);
+ return;
+ }
+ } else
+ assert(ci->first == first);
+
+ ci->array = array;
+ ci->begin = begin;
+ ci->total = total;
+}
+
static int generic_array_get(JournalFile *f,
uint64_t first,
uint64_t i,
Object **ret, uint64_t *offset) {
Object *o;
- uint64_t p = 0, a;
+ uint64_t p = 0, a, t = 0;
int r;
+ ChainCacheItem *ci;
assert(f);
a = first;
+
+ /* Try the chain cache first */
+ ci = hashmap_get(f->chain_cache, &first);
+ if (ci && i > ci->total) {
+ a = ci->array;
+ i -= ci->total;
+ t = ci->total;
+ }
+
while (a > 0) {
- uint64_t n;
+ uint64_t k;
r = journal_file_move_to_object(f, OBJECT_ENTRY_ARRAY, a, &o);
if (r < 0)
return r;
- n = journal_file_entry_array_n_items(o);
- if (i < n) {
+ k = journal_file_entry_array_n_items(o);
+ if (i < k) {
p = le64toh(o->entry_array.items[i]);
- break;
+ goto found;
}
- i -= n;
+ i -= k;
+ t += k;
a = le64toh(o->entry_array.next_entry_array_offset);
}
- if (a <= 0 || p <= 0)
- return 0;
+ return 0;
+
+found:
+ /* Let's cache this item for the next invocation */
+ chain_cache_put(f->chain_cache, ci, first, a, o->entry_array.items[0], t);
r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
if (r < 0)
@@ -1401,11 +1458,38 @@ static int generic_array_bisect(JournalFile *f,
bool subtract_one = false;
Object *o, *array = NULL;
int r;
+ ChainCacheItem *ci;
assert(f);
assert(test_object);
+ /* Start with the first array in the chain */
a = first;
+
+ ci = hashmap_get(f->chain_cache, &first);
+ if (ci && n > ci->total) {
+ /* Ah, we have iterated this bisection array chain
+ * previously! Let's see if we can skip ahead in the
+ * chain, as far as the last time. But we can't jump
+ * backwards in the chain, so let's check that
+ * first. */
+
+ r = test_object(f, ci->begin, needle);
+ if (r < 0)
+ return r;
+
+ if (r == TEST_LEFT) {
+ /* OK, what we are looking for is right of th
+ * begin of this EntryArray, so let's jump
+ * straight to previously cached array in the
+ * chain */
+
+ a = ci->array;
+ n -= ci->total;
+ t = ci->total;
+ }
+ }
+
while (a > 0) {
uint64_t left, right, k, lp;
@@ -1486,6 +1570,9 @@ found:
if (subtract_one && t == 0 && i == 0)
return 0;
+ /* Let's cache this item for the next invocation */
+ chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t);
+
if (subtract_one && i == 0)
p = last_p;
else if (subtract_one)
@@ -2265,6 +2352,12 @@ int journal_file_open(
goto fail;
}
+ f->chain_cache = hashmap_new(uint64_hash_func, uint64_compare_func);
+ if (!f->chain_cache) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
f->fd = open(f->path, f->flags|O_CLOEXEC, f->mode);
if (f->fd < 0) {
r = -errno;
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index d87cbe4..cdbc8e4 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -33,6 +33,7 @@
#include "journal-def.h"
#include "util.h"
#include "mmap-cache.h"
+#include "hashmap.h"
typedef struct JournalMetrics {
uint64_t max_use;
@@ -64,6 +65,8 @@ typedef struct JournalFile {
JournalMetrics metrics;
MMapCache *mmap;
+ Hashmap *chain_cache;
+
#ifdef HAVE_XZ
void *compress_buffer;
uint64_t compress_buffer_size;
diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c
index ef78070..dcfbb67 100644
--- a/src/shared/hashmap.c
+++ b/src/shared/hashmap.c
@@ -147,6 +147,25 @@ int trivial_compare_func(const void *a, const void *b) {
return a < b ? -1 : (a > b ? 1 : 0);
}
+unsigned uint64_hash_func(const void *p) {
+ uint64_t u;
+
+ assert_cc(sizeof(uint64_t) == 2*sizeof(unsigned));
+
+ u = *(const uint64_t*) p;
+
+ return (unsigned) ((u >> 32) ^ u);
+}
+
+int uint64_compare_func(const void *_a, const void *_b) {
+ uint64_t a, b;
+
+ a = *(const uint64_t*) _a;
+ b = *(const uint64_t*) _b;
+
+ return a < b ? -1 : (a > b ? 1 : 0);
+}
+
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
bool b;
Hashmap *h;
diff --git a/src/shared/hashmap.h b/src/shared/hashmap.h
index 55dea0a..6fd71cf 100644
--- a/src/shared/hashmap.h
+++ b/src/shared/hashmap.h
@@ -44,6 +44,9 @@ int string_compare_func(const void *a, const void *b);
unsigned trivial_hash_func(const void *p);
int trivial_compare_func(const void *a, const void *b);
+unsigned uint64_hash_func(const void *p);
+int uint64_compare_func(const void *a, const void *b);
+
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
void hashmap_free(Hashmap *h);
void hashmap_free_free(Hashmap *h);
--
1.8.1.1
From 34741aa3e2ee1e67a4cc735b7492aec13f0d822c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 26 Oct 2012 20:25:36 +0200
Subject: [PATCH] journal: special case the trivial cache chain cache entry
---
src/journal/journal-file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 6c9deac..3df099d 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1328,6 +1328,11 @@ static void chain_cache_put(
uint64_t total) {
if (!ci) {
+ /* If the chain item to cache for this chain is the
+ * first one it's not worth caching anything */
+ if (array == first)
+ return;
+
if (hashmap_size(h) >= CHAIN_CACHE_MAX)
ci = hashmap_steal_first(h);
else {
--
1.8.1.1

View File

@ -1,44 +0,0 @@
From 2cfd1ed4d853be4a22cc102037347c9041bf5ced Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 24 Jan 2013 17:55:42 +0100
Subject: [PATCH] man: systemd.exec - explicit Environment assignment
Be more verbose about using space in Environment field and not
using value of other variables
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=840260
---
man/systemd.exec.xml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: systemd-195/man/systemd.exec.xml
===================================================================
--- systemd-195.orig/man/systemd.exec.xml
+++ systemd-195/man/systemd.exec.xml
@@ -269,9 +269,24 @@
in which case all listed variables
will be set. If the same variable is
set twice the later setting will
- override the earlier setting. See
+ override the earlier setting.
+ Variable expansion is not performed
+ inside the strings, and $ has no special
+ meaning.
+ If you need to assign a value containing spaces
+ to a variable, use double quotes (")
+ for the assignment.</para>
+
+ <para>Example:
+ <programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=word 5 6"</programlisting>
+ gives three variables <literal>VAR1</literal>,
+ <literal>VAR2</literal>, <literal>VAR3</literal>.
+ </para>
+
+ <para>
+ See
<citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
- for details.</para></listitem>
+ for details about environment variables.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>EnvironmentFile=</varname></term>

View File

@ -1,33 +0,0 @@
From 3dd8ee8fa693597663b0338235becbb0b7a9520c Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Thu, 25 Oct 2012 16:16:17 +0200
Subject: [PATCH] util: fix possible integer overflows
---
src/shared/util.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: systemd-195/src/shared/util.c
===================================================================
--- systemd-195.orig/src/shared/util.c
+++ systemd-195/src/shared/util.c
@@ -152,6 +152,9 @@ usec_t timespec_load(const struct timesp
ts->tv_nsec == (long) -1)
return (usec_t) -1;
+ if ((usec_t) ts->tv_sec > (UINT64_MAX - (ts->tv_nsec / NSEC_PER_USEC)) / USEC_PER_SEC)
+ return (usec_t) -1;
+
return
(usec_t) ts->tv_sec * USEC_PER_SEC +
(usec_t) ts->tv_nsec / NSEC_PER_USEC;
@@ -179,6 +182,9 @@ usec_t timeval_load(const struct timeval
tv->tv_usec == (suseconds_t) -1)
return (usec_t) -1;
+ if ((usec_t) tv->tv_sec > (UINT64_MAX - tv->tv_usec) / USEC_PER_SEC)
+ return (usec_t) -1;
+
return
(usec_t) tv->tv_sec * USEC_PER_SEC +
(usec_t) tv->tv_usec;

View File

@ -1,221 +0,0 @@
From 94243ef299425d6c7089a7a05c48c9bb8f6cf3da Mon Sep 17 00:00:00 2001
From: Auke Kok <auke-jan.h.kok@intel.com>
Date: Fri, 22 Mar 2013 15:09:45 -0700
Subject: [PATCH 1/2] readahead: chunk on spinning media
Readahead has all sorts of bad side effects depending on your
storage media. On rotating disks, it may be degrading startup
performance if enough requests are queued spanning linearly
over all blocks early at boot, and mount, blkid and friends
want to insert reads to the start of these block devices after.
The end result is that on spinning disks with ext3/4 that udev
and mounts take a very long time, and nothing really happens until
readahead is completely finished.
This has the net effect that the CPU is almost entirely idle
for the entire period that readahead is working. We could have
finished starting up quite a lot of services in this time if
we were smarter at how we do readahead.
This patch sorts all requests into 2 second "chunks" and sub-sorts
each chunk by block. This adds a single cross-drive seek per "chunk"
but has the benefit that we will have a lot of the blocks we need
early on in the boot sequence loaded into memory faster.
For a comparison of how before/after bootcharts look (ext4 on a
mobile 5400rpm 250GB drive) please look at:
http://foo-projects.org/~sofar/blocked-tests/
There are bootcharts in the "before" and "after" folders where you
should be able to see that many low-level services finish 5-7
seconds earlier with the patch applied (after).
---
Makefile.am | 2 +-
src/readahead/readahead-collect.c | 28 +++++++++++++++++++++++++---
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 37c1cc2..5861976 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \
systemd_readahead_LDADD = \
libsystemd-shared.la \
libsystemd-daemon.la \
- libudev.la
+ libudev.la -lm
dist_doc_DATA += \
src/readahead/sd-readahead.c \
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 5d07f47..5d22949 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -42,6 +42,7 @@
#include <sys/vfs.h>
#include <getopt.h>
#include <sys/inotify.h>
+#include <math.h>
#ifdef HAVE_FANOTIFY_INIT
#include <sys/fanotify.h>
@@ -67,6 +68,7 @@
*/
static ReadaheadShared *shared = NULL;
+static struct timespec starttime;
/* Avoid collisions with the NULL pointer */
#define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1)
@@ -205,6 +207,7 @@ static unsigned long fd_first_block(int fd) {
struct item {
const char *path;
unsigned long block;
+ unsigned long bin;
};
static int qsort_compare(const void *a, const void *b) {
@@ -213,6 +216,13 @@ static int qsort_compare(const void *a, const void *b) {
i = a;
j = b;
+ /* sort by bin first */
+ if (i->bin < j->bin)
+ return -1;
+ if (i->bin > j->bin)
+ return 1;
+
+ /* then sort by sector */
if (i->block < j->block)
return -1;
if (i->block > j->block)
@@ -250,6 +260,8 @@ static int collect(const char *root) {
goto finish;
}
+ clock_gettime(CLOCK_MONOTONIC, &starttime);
+
/* If there's no pack file yet we lower the kernel readahead
* so that mincore() is accurate. If there is a pack file
* already we assume it is accurate enough so that kernel
@@ -447,10 +459,21 @@ static int collect(const char *root) {
free(p);
else {
unsigned long ul;
+ struct timespec ts;
+ struct item *entry;
+
+ entry = new0(struct item, 1);
ul = fd_first_block(m->fd);
- if ((k = hashmap_put(files, p, SECTOR_TO_PTR(ul))) < 0) {
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+
+ entry->block = ul;
+ entry->path = strdup(p);
+ entry->bin = round((ts.tv_sec - starttime.tv_sec +
+ ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0);
+
+ if ((k = hashmap_put(files, p, entry)) < 0) {
log_warning("set_put() failed: %s", strerror(-k));
free(p);
}
@@ -518,8 +541,7 @@ done:
j = ordered;
HASHMAP_FOREACH_KEY(q, p, files, i) {
- j->path = p;
- j->block = PTR_TO_SECTOR(q);
+ memcpy(j, q, sizeof(struct item));
j++;
}
--
1.8.1.4
From b0640287f784a320661f7206c9ade07b99003fd5 Mon Sep 17 00:00:00 2001
From: Auke Kok <auke-jan.h.kok@intel.com>
Date: Tue, 26 Mar 2013 11:13:47 -0700
Subject: [PATCH 2/2] readahead: cleanups
- check for OOM
- no need to use floats and round()
---
Makefile.am | 2 +-
src/readahead/readahead-collect.c | 20 ++++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 5861976..37c1cc2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2956,7 +2956,7 @@ systemd_readahead_SOURCES = \
systemd_readahead_LDADD = \
libsystemd-shared.la \
libsystemd-daemon.la \
- libudev.la -lm
+ libudev.la
dist_doc_DATA += \
src/readahead/sd-readahead.c \
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 5d22949..e2fd8df 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -68,7 +68,7 @@
*/
static ReadaheadShared *shared = NULL;
-static struct timespec starttime;
+static usec_t starttime;
/* Avoid collisions with the NULL pointer */
#define SECTOR_TO_PTR(s) ULONG_TO_PTR((s)+1)
@@ -260,7 +260,7 @@ static int collect(const char *root) {
goto finish;
}
- clock_gettime(CLOCK_MONOTONIC, &starttime);
+ starttime = now(CLOCK_MONOTONIC);
/* If there's no pack file yet we lower the kernel readahead
* so that mincore() is accurate. If there is a pack file
@@ -459,19 +459,27 @@ static int collect(const char *root) {
free(p);
else {
unsigned long ul;
- struct timespec ts;
+ usec_t entrytime;
struct item *entry;
entry = new0(struct item, 1);
+ if (!entry) {
+ r = log_oom();
+ goto finish;
+ }
ul = fd_first_block(m->fd);
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ entrytime = now(CLOCK_MONOTONIC);
entry->block = ul;
entry->path = strdup(p);
- entry->bin = round((ts.tv_sec - starttime.tv_sec +
- ((ts.tv_nsec - starttime.tv_nsec) / 1000000000.0)) / 2.0);
+ if (!entry->path) {
+ free(entry);
+ r = log_oom();
+ goto finish;
+ }
+ entry->bin = (entrytime - starttime) / 2000000;
if ((k = hashmap_put(files, p, entry)) < 0) {
log_warning("set_put() failed: %s", strerror(-k));
--
1.8.1.4

View File

@ -1,48 +0,0 @@
From 1abc85b8d026a2d72442b0edaee5213d0ee73c1f Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Thu, 25 Oct 2012 02:31:49 +0200
Subject: [PATCH] job: avoid recursion into transaction code from job
cancelation
I hit an "assert(j->installed)" failure in transaction_apply(). Looking
into the backtrace I saw what happened:
1. The system was booting. var.mount/start was an installed job.
2. I pressed Ctrl+Alt+Del.
3. reboot.target was going to be isolated.
4. transaction_apply() proceeded to install a var.mount/stop job.
5. job_install() canceled the conflicting start job.
6. Depending jobs ended recursively with JOB_DEPENDENCY, among them was
local-fs.target/start.
7. Its OnFailure action triggered - emergency.target was now going to be
isolated.
8. We recursed back into transaction_apply() where the half-installed
var.mount/stop job confused us.
Recursing from job installation back into the transaction code cannot be
a good idea. Avoid the problem by canceling the conflicting job
non-recursively in job_install(). I don't think we'll miss anything by
not recursing here. After all, we are called from transaction_apply().
We will not be installing just this one job, but all jobs from a
transaction. All requirement dependencies will be included in it and
will be installed separately. Every transaction job will get a chance
to cancel its own conflicting installed job.
---
src/core/job.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/job.c b/src/core/job.c
index cb5674b..f08b8cb 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -180,7 +180,7 @@ Job* job_install(Job *j) {
if (uj) {
if (j->type != JOB_NOP && job_type_is_conflicting(uj->type, j->type))
- job_finish_and_invalidate(uj, JOB_CANCELED, true);
+ job_finish_and_invalidate(uj, JOB_CANCELED, false);
else {
/* not conflicting, i.e. mergeable */
--
1.7.10.4

View File

@ -1,34 +0,0 @@
From 0f91dd8749c1a1ec308cc645269be92166413e38 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 26 Oct 2012 01:07:41 +0200
Subject: [PATCH] journal: properly determine cutoff max date
---
src/journal/sd-journal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 09b0eb8..d5d2d78 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2121,7 +2121,7 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
if (from)
*from = MIN(fr, *from);
if (to)
- *to = MIN(t, *to);
+ *to = MAX(t, *to);
}
}
@@ -2160,7 +2160,7 @@ _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
if (from)
*from = MIN(fr, *from);
if (to)
- *to = MIN(t, *to);
+ *to = MAX(t, *to);
}
}
--
1.7.10.4

Some files were not shown because too many files have changed in this diff Show More