Просмотр исходного кода

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
Fabio M. Di Nitto 17 лет назад
Родитель
Сommit
38f8abd072
2 измененных файлов с 16 добавлено и 18 удалено
  1. 2 2
      exec/objdb.c
  2. 14 16
      exec/service.c

+ 2 - 2
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);
 

+ 14 - 16
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)
+	{
+
+		found = 0;
 
-		res = corosync_api->object_find_next (
+		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);