diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2017-05-04 12:35:31 -0500 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2017-05-04 12:38:35 -0500 |
commit | c7a7c45fec58ff593aecce92699b9ee41823d48e (patch) | |
tree | 523724b21950f962841b7f0a706862cadc8d01f9 | |
parent | a4555f605b2ffe676cbf00fbade1b4447072e33b (diff) | |
download | phosphor-objmgr-c7a7c45fec58ff593aecce92699b9ee41823d48e.tar.gz phosphor-objmgr-c7a7c45fec58ff593aecce92699b9ee41823d48e.zip |
Revert "Add mapper-wait-until-removed"
This reverts commit 9f4c3c7c408a5f84a52416da99d0dd8035f1ae5a.
After further design discussions, the new wait until
removed implementation should be a new API. Reverting this
change to put back the original wait interfaces since new
ones will be created instead of modifying the existing ones.
Change-Id: I605439dcb24c6dca7f394325afc6587eacf417f1
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
-rw-r--r-- | libmapper/app.c | 10 | ||||
-rw-r--r-- | libmapper/mapper.c | 69 | ||||
-rw-r--r-- | libmapper/mapper.h | 4 |
3 files changed, 25 insertions, 58 deletions
diff --git a/libmapper/app.c b/libmapper/app.c index aa42461..7efc08c 100644 --- a/libmapper/app.c +++ b/libmapper/app.c @@ -119,10 +119,7 @@ static int wait_main(int argc, char *argv[]) goto finish; } - if (!strcmp(argv[1], "wait")) - r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait, true); - else if (!strcmp(argv[1], "wait-until-removed")) - r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait, false); + r = mapper_wait_async(conn, loop, argv+2, quit, loop, &wait); if(r < 0) { fprintf(stderr, "Error configuring waitlist: %s\n", strerror(-r)); @@ -181,8 +178,6 @@ int main(int argc, char *argv[]) "\nCOMMANDS:\n" " call invoke the specified method\n" " wait wait for the specified objects to appear on the DBus\n" - " wait-until-removed" - " wait until the specified objects are not present in the DBus\n" " get-service return the service identifier for input path\n"; if(argc < 2) { @@ -192,8 +187,7 @@ int main(int argc, char *argv[]) if(!strcmp(argv[1], "call")) call_main(argc, argv); - if(!strcmp(argv[1], "wait") || - !strcmp(argv[1], "wait-until-removed")) + if(!strcmp(argv[1], "wait")) wait_main(argc, argv); if(!strcmp(argv[1], "get-service")) get_service_main(argc, argv); diff --git a/libmapper/mapper.c b/libmapper/mapper.c index ad64d4a..962b4e0 100644 --- a/libmapper/mapper.c +++ b/libmapper/mapper.c @@ -35,11 +35,6 @@ static const char *async_wait_interfaces_added_match = "interface='org.freedesktop.DBus.ObjectManager'," "member='InterfacesAdded'"; -static const char *async_wait_interfaces_removed_match = - "type='signal'," - "interface='org.freedesktop.DBus.ObjectManager'," - "member='InterfacesRemoved'"; - static const int mapper_busy_retries = 5; static const uint64_t mapper_busy_delay_interval_usec = 1000000; @@ -56,7 +51,6 @@ struct mapper_async_wait int count; int finished; int r; - bool added; }; struct async_wait_callback_data @@ -163,12 +157,8 @@ static int async_wait_getobject_callback(sd_bus_message *m, goto exit; r = sd_bus_message_get_errno(m); - if(r == ENOENT) { - if (wait->added) - goto exit; - else - r = 0; - } + if(r == ENOENT) + goto exit; if(r == EBUSY && data->retry < mapper_busy_retries) { r = sd_event_now(wait->loop, @@ -306,8 +296,7 @@ int mapper_wait_async(sd_bus *conn, char *objs[], void (*callback)(int, void *), void *userdata, - mapper_async_wait **w, - bool added) + mapper_async_wait **w) { int r; mapper_async_wait *wait = NULL; @@ -324,7 +313,6 @@ int mapper_wait_async(sd_bus *conn, wait->count = sarraylen(objs); if(!wait->count) return 0; - wait->added = added; wait->objs = sarraydup(objs); if(!wait->objs) { @@ -339,39 +327,26 @@ int mapper_wait_async(sd_bus *conn, } memset(wait->status, 0, sizeof(*wait->status) * wait->count); - if (wait->added) { - r = sd_bus_add_match(conn, - &wait->introspection_slot, - async_wait_introspection_match, - async_wait_match_introspection_complete, - wait); - if(r < 0) { - fprintf(stderr, "Error adding match rule: %s\n", - strerror(-r)); - goto free_status; - } + r = sd_bus_add_match(conn, + &wait->introspection_slot, + async_wait_introspection_match, + async_wait_match_introspection_complete, + wait); + if(r < 0) { + fprintf(stderr, "Error adding match rule: %s\n", + strerror(-r)); + goto free_status; + } - r = sd_bus_add_match(conn, - &wait->intf_slot, - async_wait_interfaces_added_match, - async_wait_match_introspection_complete, - wait); - if(r < 0) { - fprintf(stderr, "Error adding match rule: %s\n", - strerror(-r)); - goto unref_name_slot; - } - } else { - r = sd_bus_add_match(conn, - &wait->intf_slot, - async_wait_interfaces_removed_match, - async_wait_match_introspection_complete, - wait); - if(r < 0) { - fprintf(stderr, "Error adding match rule: %s\n", - strerror(-r)); - goto unref_name_slot; - } + r = sd_bus_add_match(conn, + &wait->intf_slot, + async_wait_interfaces_added_match, + async_wait_match_introspection_complete, + wait); + if(r < 0) { + fprintf(stderr, "Error adding match rule: %s\n", + strerror(-r)); + goto unref_name_slot; } r = async_wait_get_objects(wait); diff --git a/libmapper/mapper.h b/libmapper/mapper.h index 9f85c5f..7459e15 100644 --- a/libmapper/mapper.h +++ b/libmapper/mapper.h @@ -1,4 +1,3 @@ -#include <stdbool.h> #include <systemd/sd-bus.h> #include <systemd/sd-event.h> @@ -9,8 +8,7 @@ typedef struct mapper_async_wait mapper_async_wait; void mapper_wait_async_free(mapper_async_wait *); int mapper_wait_async(sd_bus *, sd_event *, char *[], - void (*)(int, void *), void *, mapper_async_wait **, - bool); + void (*)(int, void *), void *, mapper_async_wait **); int mapper_get_service(sd_bus *conn, const char *obj, char **service); int mapper_get_object(sd_bus *conn, const char *obj, sd_bus_message **reply); #ifdef __cplusplus |