teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0441-sd-bus-use-terms-from-the-D-Bus-Specification-a-bit-.patch

Zbigniew Jędrzejewski-Szmek 62fe94
From d20a3daaa79edfa4c8d84d243f2a98c82dddd5c6 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 62fe94
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Zbigniew Jędrzejewski-Szmek 62fe94
Date: Wed, 1 Oct 2014 16:11:59 +0100
Zbigniew Jędrzejewski-Szmek 62fe94
Subject: [PATCH] sd-bus: use terms from the D-Bus Specification a bit more
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
D-Bus' type hierarchy as described in the spec is:
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
\- basic
Zbigniew Jędrzejewski-Szmek 62fe94
   \- fixed type (u, i, etc.)
Zbigniew Jędrzejewski-Szmek 62fe94
   \- string-like type (s, o, g)
Zbigniew Jędrzejewski-Szmek 62fe94
\- container
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
Someone seems to have referred to basic types as "simple types" at
Zbigniew Jędrzejewski-Szmek 62fe94
some point, but that term isn't defined in the D-Bus Specification,
Zbigniew Jędrzejewski-Szmek 62fe94
and seems redundant.
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
So far I haven't renamed functions that use "trivial" in their names
Zbigniew Jędrzejewski-Szmek 62fe94
to mean "fixed type", to avoid confusion about whether a struct of
Zbigniew Jędrzejewski-Szmek 62fe94
constant length, like (iu), is a fixed type. The answer is that it is
Zbigniew Jędrzejewski-Szmek 62fe94
fixed-length, but is not a "fixed type", so I can see that something
Zbigniew Jędrzejewski-Szmek 62fe94
like bus_type_is_fixed() might be ambiguous.
Zbigniew Jędrzejewski-Szmek 62fe94
---
Zbigniew Jędrzejewski-Szmek 62fe94
 src/libsystemd/sd-bus/PORTING-DBUS1 | 10 +++++-----
Zbigniew Jędrzejewski-Szmek 62fe94
 src/libsystemd/sd-bus/bus-type.h    |  2 ++
Zbigniew Jędrzejewski-Szmek 62fe94
 2 files changed, 7 insertions(+), 5 deletions(-)
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/src/libsystemd/sd-bus/PORTING-DBUS1 b/src/libsystemd/sd-bus/PORTING-DBUS1
Zbigniew Jędrzejewski-Szmek 62fe94
index 63c345b11a..81e94132b3 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/src/libsystemd/sd-bus/PORTING-DBUS1
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/src/libsystemd/sd-bus/PORTING-DBUS1
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -156,11 +156,11 @@ multiple items. Some restrictions apply however:
Zbigniew Jędrzejewski-Szmek 62fe94
    contained in the payload, as well is immediately before framing of a
Zbigniew Jędrzejewski-Szmek 62fe94
    Gvariant, as well after as any padding bytes if there are any. The
Zbigniew Jędrzejewski-Szmek 62fe94
    padding bytes must be wholly contained in the preceding
Zbigniew Jędrzejewski-Szmek 62fe94
-   PAYLOAD_VEC/PAYLOAD_MEMFD item. You may not split up simple types
Zbigniew Jędrzejewski-Szmek 62fe94
-   nor arrays of trivial types. The latter is necessary to allow APIs
Zbigniew Jędrzejewski-Szmek 62fe94
-   to return direct pointers to linear chunks of fixed size trivial
Zbigniew Jędrzejewski-Szmek 62fe94
-   arrays. Examples: The simple types "u", "s", "t" have to be in the
Zbigniew Jędrzejewski-Szmek 62fe94
-   same payload item. The array of simple types "ay", "ai" have to be
Zbigniew Jędrzejewski-Szmek 62fe94
+   PAYLOAD_VEC/PAYLOAD_MEMFD item. You may not split up basic types
Zbigniew Jędrzejewski-Szmek 62fe94
+   nor arrays of fixed types. The latter is necessary to allow APIs
Zbigniew Jędrzejewski-Szmek 62fe94
+   to return direct pointers to linear arrays of numeric
Zbigniew Jędrzejewski-Szmek 62fe94
+   values. Examples: The basic types "u", "s", "t" have to be in the
Zbigniew Jędrzejewski-Szmek 62fe94
+   same payload item. The array of fixed types "ay", "ai" have to be
Zbigniew Jędrzejewski-Szmek 62fe94
    fully in contained in the same payload item. For an array "as" or
Zbigniew Jędrzejewski-Szmek 62fe94
    "a(si)" the only restriction however is to keep each string
Zbigniew Jędrzejewski-Szmek 62fe94
    individually in an uninterrupted item, to keep the framing of each
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/src/libsystemd/sd-bus/bus-type.h b/src/libsystemd/sd-bus/bus-type.h
Zbigniew Jędrzejewski-Szmek 62fe94
index 2e423bbfdb..581e8d5841 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/src/libsystemd/sd-bus/bus-type.h
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/src/libsystemd/sd-bus/bus-type.h
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -29,6 +29,8 @@
Zbigniew Jędrzejewski-Szmek 62fe94
 bool bus_type_is_valid(char c) _const_;
Zbigniew Jędrzejewski-Szmek 62fe94
 bool bus_type_is_valid_in_signature(char c) _const_;
Zbigniew Jędrzejewski-Szmek 62fe94
 bool bus_type_is_basic(char c) _const_;
Zbigniew Jędrzejewski-Szmek 62fe94
+/* "trivial" is systemd's term for what the D-Bus Specification calls
Zbigniew Jędrzejewski-Szmek 62fe94
+ * a "fixed type": that is, a basic type of fixed length */
Zbigniew Jędrzejewski-Szmek 62fe94
 bool bus_type_is_trivial(char c) _const_;
Zbigniew Jędrzejewski-Szmek 62fe94
 bool bus_type_is_container(char c) _const_;
Zbigniew Jędrzejewski-Szmek 62fe94