]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Remove message->priority field
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Apr 2020 16:17:18 +0000 (18:17 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 7 Apr 2020 13:29:23 +0000 (15:29 +0200)
A warning is emitted from sd_bus_message_{get,set}_priority. Those functions
are exposed by pystemd, so we have no easy way of checking if anything is
calling them.

Just making the functions always return without doing anything would be an
option, but then we could leave the caller with an undefined variable. So I
think it's better to make the functions emit a warnings and return priority=0
in the get operation.

man/sd_bus_message_dump.xml
src/busctl/busctl.c
src/libsystemd/sd-bus/bus-dump.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/bus-message.h

index db9e46d991361dccda9901d452ff4b3e22f7c9f5..720b114273d21d9cb34cea1cb0199e0f25fe4c59 100644 (file)
@@ -65,7 +65,7 @@
 
     <para>Output for a signal message (with <constant>SD_BUS_MESSAGE_DUMP_WITH_HEADER</constant>):
     <programlisting>
-‣ Type=signal  Endian=l  Flags=1  Version=1  Priority=0 Cookie=22
+‣ Type=signal  Endian=l  Flags=1  Version=1  Cookie=22
   Path=/value/a  Interface=org.freedesktop.DBus.Properties  Member=PropertiesChanged
   MESSAGE "sa{sv}as" {
           STRING "org.freedesktop.systemd.ValueTest";
index 3c75be381fc6c9bf2cfb8c20b84df416390cf76b..3d03eb37a633fb12c9935ed1a03f12ae77408bb9 100644 (file)
@@ -1200,7 +1200,6 @@ static int message_json(sd_bus_message *m, FILE *f) {
                                        JSON_BUILD_PAIR("endian", JSON_BUILD_STRING(e)),
                                        JSON_BUILD_PAIR("flags", JSON_BUILD_INTEGER(m->header->flags)),
                                        JSON_BUILD_PAIR("version", JSON_BUILD_INTEGER(m->header->version)),
-                                       JSON_BUILD_PAIR_CONDITION(m->priority != 0, "priority", JSON_BUILD_INTEGER(m->priority)),
                                        JSON_BUILD_PAIR("cookie", JSON_BUILD_INTEGER(BUS_MESSAGE_COOKIE(m))),
                                        JSON_BUILD_PAIR_CONDITION(m->reply_cookie != 0, "reply_cookie", JSON_BUILD_INTEGER(m->reply_cookie)),
                                        JSON_BUILD_PAIR_CONDITION(m->sender, "sender", JSON_BUILD_STRING(m->sender)),
index caab5e5ebe65c873649021dbccd0addb55ae86f2..94107c297f4c042d93c0faf3371452e552041d70 100644 (file)
@@ -56,7 +56,7 @@ _public_ int sd_bus_message_dump(sd_bus_message *m, FILE *f, uint64_t flags) {
 
         if (flags & SD_BUS_MESSAGE_DUMP_WITH_HEADER) {
                 fprintf(f,
-                        "%s%s%s Type=%s%s%s  Endian=%c  Flags=%u  Version=%u  Priority=%"PRIi64,
+                        "%s%s%s Type=%s%s%s  Endian=%c  Flags=%u  Version=%u",
                         m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() :
                         m->header->type == SD_BUS_MESSAGE_METHOD_RETURN ? ansi_highlight_green() :
                         m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "",
@@ -69,8 +69,7 @@ _public_ int sd_bus_message_dump(sd_bus_message *m, FILE *f, uint64_t flags) {
 
                         m->header->endian,
                         m->header->flags,
-                        m->header->version,
-                        m->priority);
+                        m->header->version);
 
                 /* Display synthetic message serial number in a more readable
                  * format than (uint32_t) -1 */
index 62c34d93122560cd18596035db310e8f972ef61c..8c0234405aae6bf16b896f197228772ef69b41f0 100644 (file)
@@ -5924,18 +5924,31 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
 }
 
 _public_ int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority) {
+        static bool warned = false;
+
         assert_return(m, -EINVAL);
         assert_return(priority, -EINVAL);
 
-        *priority = m->priority;
+        if (!warned) {
+                log_debug("sd_bus_message_get_priority() is deprecated and always returns 0.");
+                warned = true;
+        }
+
+        *priority = 0;
         return 0;
 }
 
 _public_ int sd_bus_message_set_priority(sd_bus_message *m, int64_t priority) {
+        static bool warned = false;
+
         assert_return(m, -EINVAL);
         assert_return(!m->sealed, -EPERM);
 
-        m->priority = priority;
+        if (!warned) {
+                log_debug("sd_bus_message_set_priority() is deprecated and does nothing.");
+                warned = true;
+        }
+
         return 0;
 }
 
index a88a531e15b82d8b5050f16c7cf61e8cd3b8bbcc..5d869213ab80f0a0d70c9f73ae83b0901628cd57 100644 (file)
@@ -76,7 +76,6 @@ struct sd_bus_message {
         usec_t monotonic;
         usec_t realtime;
         uint64_t seqnum;
-        int64_t priority;
         uint64_t verify_destination_id;
 
         bool sealed:1;