From 38f8abd072ea09cf1ed03698309bb1590db7a28f Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Tue, 12 Aug 2008 08:41:09 +0000 Subject: [PATCH] objdb: change list_add to list_add_tail when adding keys and objects service: change openais_service_unlink_all to deal with the new objdb order cleanup a few whitespaces git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1627 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/objdb.c | 4 ++-- exec/service.c | 30 ++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/exec/objdb.c b/exec/objdb.c index a2cc8886..7721bc3a 100644 --- a/exec/objdb.c +++ b/exec/objdb.c @@ -360,7 +360,7 @@ static int object_create ( object_instance->object_name_len = object_name_len; - list_add (&object_instance->child_list, &parent_instance->child_head); + list_add_tail (&object_instance->child_list, &parent_instance->child_head); object_instance->object_handle = *object_handle; object_instance->find_child_list = &object_instance->child_head; @@ -488,7 +488,7 @@ static int object_key_create ( object_key->value_len = value_len; list_init (&object_key->list); - list_add (&object_key->list, &instance->key_head); + list_add_tail (&object_key->list, &instance->key_head); object_key_changed_notification(object_handle, key_name, key_len, value, value_len, OBJECT_KEY_CREATED); diff --git a/exec/service.c b/exec/service.c index efa1acd5..bbe1e610 100644 --- a/exec/service.c +++ b/exec/service.c @@ -266,7 +266,7 @@ extern unsigned int openais_service_unlink_and_exit ( strlen ("ver"), (void *)&found_service_ver, NULL); - + /* * If service found and linked exit it */ @@ -294,34 +294,32 @@ extern unsigned int openais_service_unlink_all ( unsigned int *service_ver; unsigned int object_service_handle; unsigned int object_find_handle; - unsigned int res; + int found; log_printf(LOG_LEVEL_NOTICE, "Unloading all openais components\n"); - - res = 0; + /* * TODO * Deleting of keys not supported during iteration at this time * hence this ugly hack */ - for (;;) { - corosync_api->object_find_create ( + while(corosync_api->object_find_create ( object_internal_configuration_handle, "service", strlen ("service"), - &object_find_handle); + &object_find_handle) == 0) + { - res = corosync_api->object_find_next ( + found = 0; + + while(corosync_api->object_find_next ( object_find_handle, - &object_service_handle); + &object_service_handle) == 0) + found = 1; - /* - * Exit from unloading - */ - if (res == -1) { + if(!found) break; - } - + corosync_api->object_key_get ( object_service_handle, "name", @@ -335,7 +333,7 @@ extern unsigned int openais_service_unlink_all ( strlen ("ver"), (void *)&service_ver, NULL); - + openais_service_unlink_common ( corosync_api, object_service_handle, service_name, *service_ver);