forked from pool/systemd
.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=709
This commit is contained in:
parent
3f7ac6f17c
commit
b1aa3ea339
176
0001-journal-compress-return-early-in-uncompress_startswi.patch
Normal file
176
0001-journal-compress-return-early-in-uncompress_startswi.patch
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
Based on 5e592c66bdf76dfc8445b332f7a5088ca504ee90 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Fri, 4 Jul 2014 19:53:58 -0400
|
||||||
|
Subject: [PATCH] journal/compress: return early in uncompress_startswith
|
||||||
|
|
||||||
|
uncompress_startswith would always decode the whole stream, even
|
||||||
|
if it did not start with the given prefix.
|
||||||
|
|
||||||
|
Reallocation policy was also strange.
|
||||||
|
---
|
||||||
|
src/journal/compress.c | 91 ++++++++++++++-----------------------------------
|
||||||
|
1 file changed, 27 insertions(+), 64 deletions(-)
|
||||||
|
|
||||||
|
--- src/journal/compress.c
|
||||||
|
+++ src/journal/compress.c 2014-07-09 00:00:00.000000000 +0000
|
||||||
|
@@ -69,10 +69,9 @@ fail:
|
||||||
|
bool uncompress_blob(const void *src, uint64_t src_size,
|
||||||
|
void **dst, uint64_t *dst_alloc_size, uint64_t* dst_size, uint64_t dst_max) {
|
||||||
|
|
||||||
|
- lzma_stream s = LZMA_STREAM_INIT;
|
||||||
|
+ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
|
||||||
|
lzma_ret ret;
|
||||||
|
uint64_t space;
|
||||||
|
- bool b = false;
|
||||||
|
|
||||||
|
assert(src);
|
||||||
|
assert(src_size > 0);
|
||||||
|
@@ -85,26 +84,18 @@ bool uncompress_blob(const void *src, ui
|
||||||
|
if (ret != LZMA_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
- if (*dst_alloc_size <= src_size) {
|
||||||
|
- void *p;
|
||||||
|
-
|
||||||
|
- p = realloc(*dst, src_size*2);
|
||||||
|
- if (!p)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- *dst = p;
|
||||||
|
- *dst_alloc_size = src_size*2;
|
||||||
|
- }
|
||||||
|
+ space = MIN(src_size * 2, dst_max ?: (uint64_t) -1);
|
||||||
|
+ if (!greedy_realloc(dst, dst_alloc_size, space, 1))
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
s.next_in = src;
|
||||||
|
s.avail_in = src_size;
|
||||||
|
|
||||||
|
s.next_out = *dst;
|
||||||
|
- space = dst_max > 0 ? MIN(*dst_alloc_size, dst_max) : *dst_alloc_size;
|
||||||
|
s.avail_out = space;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
- void *p;
|
||||||
|
+ uint64_t used;
|
||||||
|
|
||||||
|
ret = lzma_code(&s, LZMA_FINISH);
|
||||||
|
|
||||||
|
@@ -112,31 +103,25 @@ bool uncompress_blob(const void *src, ui
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (ret != LZMA_OK)
|
||||||
|
- goto fail;
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
if (dst_max > 0 && (space - s.avail_out) >= dst_max)
|
||||||
|
break;
|
||||||
|
|
||||||
|
- p = realloc(*dst, space*2);
|
||||||
|
- if (!p)
|
||||||
|
- goto fail;
|
||||||
|
-
|
||||||
|
- s.next_out = (uint8_t*) p + ((uint8_t*) s.next_out - (uint8_t*) *dst);
|
||||||
|
- s.avail_out += space;
|
||||||
|
+ if (dst_max > 0 && space == dst_max)
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
- space *= 2;
|
||||||
|
+ used = space - s.avail_out;
|
||||||
|
+ space = MIN(2 * space, dst_max ?: (uint64_t) -1);
|
||||||
|
+ if (!greedy_realloc(dst, dst_alloc_size, space, 1))
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
- *dst = p;
|
||||||
|
- *dst_alloc_size = space;
|
||||||
|
+ s.avail_out = space - used;
|
||||||
|
+ s.next_out = *dst + used;
|
||||||
|
}
|
||||||
|
|
||||||
|
*dst_size = space - s.avail_out;
|
||||||
|
- b = true;
|
||||||
|
-
|
||||||
|
-fail:
|
||||||
|
- lzma_end(&s);
|
||||||
|
-
|
||||||
|
- return b;
|
||||||
|
+ return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool uncompress_startswith(const void *src, uint64_t src_size,
|
||||||
|
@@ -144,9 +129,8 @@ bool uncompress_startswith(const void *s
|
||||||
|
const void *prefix, uint64_t prefix_len,
|
||||||
|
uint8_t extra) {
|
||||||
|
|
||||||
|
- lzma_stream s = LZMA_STREAM_INIT;
|
||||||
|
+ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
|
||||||
|
lzma_ret ret;
|
||||||
|
- bool b = false;
|
||||||
|
|
||||||
|
/* Checks whether the uncompressed blob starts with the
|
||||||
|
* mentioned prefix. The byte extra needs to follow the
|
||||||
|
@@ -163,16 +147,8 @@ bool uncompress_startswith(const void *s
|
||||||
|
if (ret != LZMA_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
- if (*buffer_size <= prefix_len) {
|
||||||
|
- void *p;
|
||||||
|
-
|
||||||
|
- p = realloc(*buffer, prefix_len*2);
|
||||||
|
- if (!p)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- *buffer = p;
|
||||||
|
- *buffer_size = prefix_len*2;
|
||||||
|
- }
|
||||||
|
+ if (!(greedy_realloc(buffer, buffer_size, prefix_len + 1, 1)))
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
s.next_in = src;
|
||||||
|
s.avail_in = src_size;
|
||||||
|
@@ -181,36 +157,23 @@ bool uncompress_startswith(const void *s
|
||||||
|
s.avail_out = *buffer_size;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
- void *p;
|
||||||
|
-
|
||||||
|
ret = lzma_code(&s, LZMA_FINISH);
|
||||||
|
|
||||||
|
if (ret != LZMA_STREAM_END && ret != LZMA_OK)
|
||||||
|
- goto fail;
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
- if ((*buffer_size - s.avail_out > prefix_len) &&
|
||||||
|
- memcmp(*buffer, prefix, prefix_len) == 0 &&
|
||||||
|
- ((const uint8_t*) *buffer)[prefix_len] == extra)
|
||||||
|
- break;
|
||||||
|
+ if (*buffer_size - s.avail_out >= prefix_len + 1)
|
||||||
|
+ return memcmp(*buffer, prefix, prefix_len) == 0 &&
|
||||||
|
+ ((const uint8_t*) *buffer)[prefix_len] == extra;
|
||||||
|
|
||||||
|
if (ret == LZMA_STREAM_END)
|
||||||
|
- goto fail;
|
||||||
|
-
|
||||||
|
- p = realloc(*buffer, *buffer_size*2);
|
||||||
|
- if (!p)
|
||||||
|
- goto fail;
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
- s.next_out = (uint8_t*) p + ((uint8_t*) s.next_out - (uint8_t*) *buffer);
|
||||||
|
s.avail_out += *buffer_size;
|
||||||
|
|
||||||
|
- *buffer = p;
|
||||||
|
- *buffer_size *= 2;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- b = true;
|
||||||
|
-
|
||||||
|
-fail:
|
||||||
|
- lzma_end(&s);
|
||||||
|
+ if (!(greedy_realloc(buffer, buffer_size, *buffer_size * 2, 1)))
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
- return b;
|
||||||
|
+ s.next_out = *buffer + *buffer_size - s.avail_out;
|
||||||
|
+ }
|
||||||
|
}
|
37
0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
Normal file
37
0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 154034270c4643b7cfe61c0be1676d78bb1b7b07 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Herrmann <dh.herrmann@gmail.com>
|
||||||
|
Date: Tue, 8 Jul 2014 12:56:55 +0200
|
||||||
|
Subject: [PATCH] logind: allow switching to unused VTs via SwitchTo()
|
||||||
|
|
||||||
|
If compositors use the new SwitchTo() logic to map F1-F12, we should allow
|
||||||
|
them to switch to unregistered VTs, too. Otherwise, the auto-spawn logic
|
||||||
|
of gettys won't trigger.
|
||||||
|
|
||||||
|
Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
|
||||||
|
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
|
||||||
|
---
|
||||||
|
src/login/logind-seat.c | 7 ++++++-
|
||||||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git src/login/logind-seat.c src/login/logind-seat.c
|
||||||
|
index 3114de8..9992195 100644
|
||||||
|
--- src/login/logind-seat.c
|
||||||
|
+++ src/login/logind-seat.c
|
||||||
|
@@ -275,8 +275,13 @@ int seat_switch_to(Seat *s, unsigned int num) {
|
||||||
|
if (!num)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
- if (num >= s->position_count || !s->positions[num])
|
||||||
|
+ if (num >= s->position_count || !s->positions[num]) {
|
||||||
|
+ /* allow switching to unused VTs to trigger auto-activate */
|
||||||
|
+ if (seat_has_vts(s) && num < 64)
|
||||||
|
+ return chvt(num);
|
||||||
|
+
|
||||||
|
return -EINVAL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return session_activate(s->positions[num]);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.7.9.2
|
||||||
|
|
26
0002-hostnamed-add-a-new-chassis-type-for-watches.patch
Normal file
26
0002-hostnamed-add-a-new-chassis-type-for-watches.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From c49e59c1831f20fe02276d7bc6ba7d23d24c4ab3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lennart Poettering <lennart@poettering.net>
|
||||||
|
Date: Wed, 9 Jul 2014 13:20:05 +0200
|
||||||
|
Subject: [PATCH] hostnamed: add a new chassis type for watches
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hostname/hostnamed.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git src/hostname/hostnamed.c src/hostname/hostnamed.c
|
||||||
|
index 514554d..eaae113 100644
|
||||||
|
--- src/hostname/hostnamed.c
|
||||||
|
+++ src/hostname/hostnamed.c
|
||||||
|
@@ -144,7 +144,8 @@ static bool valid_chassis(const char *chassis) {
|
||||||
|
"laptop\0"
|
||||||
|
"server\0"
|
||||||
|
"tablet\0"
|
||||||
|
- "handset\0",
|
||||||
|
+ "handset\0"
|
||||||
|
+ "watch\0",
|
||||||
|
chassis);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.7.9.2
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
Based on 1930eed2a7855d2df06ccf51f9e394428bf547e2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jon Severinsson <jon@severinsson.net>
|
||||||
|
Date: Tue, 8 Jul 2014 18:29:46 +0200
|
||||||
|
Subject: [PATCH] journal/compress: improve xz compression performance
|
||||||
|
|
||||||
|
The new lzma2 compression options at the top of compress_blob_xz are
|
||||||
|
equivalent to using preset "0", exept for using a 1 MiB dictionary
|
||||||
|
(the same as preset "1"). This makes the memory usage at most 7.5 MiB
|
||||||
|
in the compressor, and 1 MiB in the decompressor, instead of the
|
||||||
|
previous 92 MiB in the compressor and 8 MiB in the decompressor.
|
||||||
|
|
||||||
|
According to test-compress-benchmark this commit makes XZ compression
|
||||||
|
20 times faster, with no increase in compressed data size.
|
||||||
|
Using more realistic test data (an ELF binary rather than repeating
|
||||||
|
ASCII letters 'a' through 'z' in order) it only provides a factor 10
|
||||||
|
speedup, and at a cost if a 10% increase in compressed data size.
|
||||||
|
But that is still a worthwhile trade-off.
|
||||||
|
|
||||||
|
According to test-compress-benchmark XZ compression is still 25 times
|
||||||
|
slower than LZ4, but the compressed data is one eighth the size.
|
||||||
|
Using more realistic test data XZ compression is only 18 times slower
|
||||||
|
than LZ4, and the compressed data is only one quarter the size.
|
||||||
|
|
||||||
|
---
|
||||||
|
src/journal/compress.c | 33 ++++++++++++++-------------------
|
||||||
|
1 file changed, 14 insertions(+), 19 deletions(-)
|
||||||
|
|
||||||
|
--- src/journal/compress.c
|
||||||
|
+++ src/journal/compress.c 2014-07-09 12:09:45.814235274 +0000
|
||||||
|
@@ -28,8 +28,15 @@
|
||||||
|
#include "compress.h"
|
||||||
|
|
||||||
|
bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_size) {
|
||||||
|
- lzma_stream s = LZMA_STREAM_INIT;
|
||||||
|
+ static const lzma_options_lzma opt = {
|
||||||
|
+ 1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT,
|
||||||
|
+ LZMA_PB_DEFAULT, LZMA_MODE_FAST, 128, LZMA_MF_HC3, 4};
|
||||||
|
+ static const lzma_filter filters[2] = {
|
||||||
|
+ {LZMA_FILTER_LZMA2, (lzma_options_lzma*) &opt},
|
||||||
|
+ {LZMA_VLI_UNKNOWN, NULL}
|
||||||
|
+ };
|
||||||
|
lzma_ret ret;
|
||||||
|
+ size_t out_pos = 0;
|
||||||
|
bool b = false;
|
||||||
|
|
||||||
|
assert(src);
|
||||||
|
@@ -40,29 +47,17 @@ bool compress_blob(const void *src, uint
|
||||||
|
/* Returns false if we couldn't compress the data or the
|
||||||
|
* compressed result is longer than the original */
|
||||||
|
|
||||||
|
- ret = lzma_easy_encoder(&s, LZMA_PRESET_DEFAULT, LZMA_CHECK_NONE);
|
||||||
|
- if (ret != LZMA_OK)
|
||||||
|
+ if (src_size < 80)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
- s.next_in = src;
|
||||||
|
- s.avail_in = src_size;
|
||||||
|
- s.next_out = dst;
|
||||||
|
- s.avail_out = src_size;
|
||||||
|
-
|
||||||
|
- /* Does it fit? */
|
||||||
|
- if (lzma_code(&s, LZMA_FINISH) != LZMA_STREAM_END)
|
||||||
|
- goto fail;
|
||||||
|
-
|
||||||
|
- /* Is it actually shorter? */
|
||||||
|
- if (s.avail_out == 0)
|
||||||
|
- goto fail;
|
||||||
|
+ ret = lzma_stream_buffer_encode((lzma_filter*) filters, LZMA_CHECK_NONE, NULL,
|
||||||
|
+ src, src_size, dst, &out_pos, src_size - 1);
|
||||||
|
+ if (ret != LZMA_OK)
|
||||||
|
+ return false;
|
||||||
|
|
||||||
|
- *dst_size = src_size - s.avail_out;
|
||||||
|
+ *dst_size = out_pos;
|
||||||
|
b = true;
|
||||||
|
|
||||||
|
-fail:
|
||||||
|
- lzma_end(&s);
|
||||||
|
-
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 9 13:14:02 UTC 2014 - werner@suse.de
|
||||||
|
|
||||||
|
- Add patches
|
||||||
|
0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
|
||||||
|
0002-hostnamed-add-a-new-chassis-type-for-watches.patch
|
||||||
|
- Port and add upstream patches
|
||||||
|
0001-journal-compress-return-early-in-uncompress_startswi.patch
|
||||||
|
0002-journal-compress-improve-xz-compression-performance.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jul 8 10:59:26 UTC 2014 - werner@suse.de
|
Tue Jul 8 10:59:26 UTC 2014 - werner@suse.de
|
||||||
|
|
||||||
|
@ -667,6 +667,14 @@ Patch326: 0005-service-don-t-accept-negative-ERRNO-notification-mes.patch
|
|||||||
Patch327: 0006-systemctl-show-StatusErrno-value-in-systemctl-status.patch
|
Patch327: 0006-systemctl-show-StatusErrno-value-in-systemctl-status.patch
|
||||||
# PATCH-FIX-UPSTREAM added at 2014/07/08
|
# PATCH-FIX-UPSTREAM added at 2014/07/08
|
||||||
Patch328: 0007-service-flush-status-text-and-errno-values-each-time.patch
|
Patch328: 0007-service-flush-status-text-and-errno-values-each-time.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch329: 0001-journal-compress-return-early-in-uncompress_startswi.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch330: 0002-journal-compress-improve-xz-compression-performance.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch331: 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch332: 0002-hostnamed-add-a-new-chassis-type-for-watches.patch
|
||||||
|
|
||||||
# UDEV PATCHES
|
# UDEV PATCHES
|
||||||
# ============
|
# ============
|
||||||
@ -1258,6 +1266,10 @@ cp %{SOURCE7} m4/
|
|||||||
%patch326 -p0
|
%patch326 -p0
|
||||||
%patch327 -p0
|
%patch327 -p0
|
||||||
%patch328 -p0
|
%patch328 -p0
|
||||||
|
%patch329 -p0
|
||||||
|
%patch330 -p0
|
||||||
|
%patch331 -p0
|
||||||
|
%patch332 -p0
|
||||||
|
|
||||||
# udev patches
|
# udev patches
|
||||||
%patch1001 -p1
|
%patch1001 -p1
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 9 13:14:02 UTC 2014 - werner@suse.de
|
||||||
|
|
||||||
|
- Add patches
|
||||||
|
0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
|
||||||
|
0002-hostnamed-add-a-new-chassis-type-for-watches.patch
|
||||||
|
- Port and add upstream patches
|
||||||
|
0001-journal-compress-return-early-in-uncompress_startswi.patch
|
||||||
|
0002-journal-compress-improve-xz-compression-performance.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jul 8 10:59:26 UTC 2014 - werner@suse.de
|
Tue Jul 8 10:59:26 UTC 2014 - werner@suse.de
|
||||||
|
|
||||||
|
12
systemd.spec
12
systemd.spec
@ -662,6 +662,14 @@ Patch326: 0005-service-don-t-accept-negative-ERRNO-notification-mes.patch
|
|||||||
Patch327: 0006-systemctl-show-StatusErrno-value-in-systemctl-status.patch
|
Patch327: 0006-systemctl-show-StatusErrno-value-in-systemctl-status.patch
|
||||||
# PATCH-FIX-UPSTREAM added at 2014/07/08
|
# PATCH-FIX-UPSTREAM added at 2014/07/08
|
||||||
Patch328: 0007-service-flush-status-text-and-errno-values-each-time.patch
|
Patch328: 0007-service-flush-status-text-and-errno-values-each-time.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch329: 0001-journal-compress-return-early-in-uncompress_startswi.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch330: 0002-journal-compress-improve-xz-compression-performance.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch331: 0001-logind-allow-switching-to-unused-VTs-via-SwitchTo.patch
|
||||||
|
# PATCH-FIX-UPSTREAM added at 2014/07/09
|
||||||
|
Patch332: 0002-hostnamed-add-a-new-chassis-type-for-watches.patch
|
||||||
|
|
||||||
# UDEV PATCHES
|
# UDEV PATCHES
|
||||||
# ============
|
# ============
|
||||||
@ -1253,6 +1261,10 @@ cp %{SOURCE7} m4/
|
|||||||
%patch326 -p0
|
%patch326 -p0
|
||||||
%patch327 -p0
|
%patch327 -p0
|
||||||
%patch328 -p0
|
%patch328 -p0
|
||||||
|
%patch329 -p0
|
||||||
|
%patch330 -p0
|
||||||
|
%patch331 -p0
|
||||||
|
%patch332 -p0
|
||||||
|
|
||||||
# udev patches
|
# udev patches
|
||||||
%patch1001 -p1
|
%patch1001 -p1
|
||||||
|
Loading…
Reference in New Issue
Block a user