chiark / gitweb /
bus: add userdata API for bus name tracker objects
authorLennart Poettering <lennart@poettering.net>
Tue, 6 May 2014 17:15:36 +0000 (19:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 14 May 2014 20:58:43 +0000 (22:58 +0200)
src/libsystemd/libsystemd.sym.m4
src/libsystemd/sd-bus/bus-track.c
src/systemd/sd-bus.h

index d18d576..14d9dcf 100644 (file)
@@ -331,6 +331,8 @@ m4_ifdef(`ENABLE_KDBUS',
         sd_bus_track_ref;
         sd_bus_track_unref;
         sd_bus_track_get_bus;
+        sd_bus_track_get_userdata;
+        sd_bus_track_set_userdata;
         sd_bus_track_add_sender;
         sd_bus_track_remove_sender;
         sd_bus_track_add_name;
index e21959d..0f6a2ea 100644 (file)
@@ -312,3 +312,20 @@ void bus_track_dispatch(sd_bus_track *track) {
 
         sd_bus_track_unref(track);
 }
+
+_public_ void *sd_bus_track_get_userdata(sd_bus_track *track) {
+        assert_return(track, NULL);
+
+        return track->userdata;
+}
+
+_public_ void *sd_bus_track_set_userdata(sd_bus_track *track, void *userdata) {
+        void *ret;
+
+        assert_return(track, NULL);
+
+        ret = track->userdata;
+        track->userdata = userdata;
+
+        return ret;
+}
index ff2333f..c6787ca 100644 (file)
@@ -358,7 +358,10 @@ int sd_bus_path_decode(const char *path, const char *prefix, char **ret_external
 int sd_bus_track_new(sd_bus *bus, sd_bus_track **track, sd_bus_track_handler_t handler, void *userdata);
 sd_bus_track* sd_bus_track_ref(sd_bus_track *track);
 sd_bus_track* sd_bus_track_unref(sd_bus_track *track);
+
 sd_bus* sd_bus_track_get_bus(sd_bus_track *track);
+void *sd_bus_track_get_userdata(sd_bus_track *track);
+void *sd_bus_track_set_userdata(sd_bus_track *track, void *userdata);
 
 int sd_bus_track_add_sender(sd_bus_track *track, sd_bus_message *m);
 int sd_bus_track_remove_sender(sd_bus_track *track, sd_bus_message *m);