Just code cleanup. Remove some unused code, add a comment or two, etc.

Ryan

Index: services/lck.c
===================================================================
--- services/lck.c      (revision 2017)
+++ services/lck.c      (working copy)
@@ -68,9 +68,6 @@
 #include "../include/saLck.h"
 #include "../include/ipc_lck.h"
 
-/*If you want compile useful debug functions, uncomment next line*/
-/*#define _LCK_DEBUG_*/
-
 LOGSYS_DECLARE_SUBSYS ("LCK");
 
 enum lck_message_req_types {
@@ -931,7 +928,6 @@
                            (unsigned int)(lock->lock_id), lock->lock_status);
        }
 }
-#endif
 
 static void lck_print_resource_lock_list (
        struct resource *resource)
@@ -982,14 +978,15 @@
                                    (unsigned 
int)(resource->ex_lock_granted->lock_id));
                }
 
-               lck_print_resource_lock_list (resource);
-/*             lck_print_ex_pending_list (resource); */
-/*             lck_print_pr_pending_list (resource); */
-/*             lck_print_pr_granted_list (resource); */
+/*             lck_print_resource_lock_list (resource); */
+/*             lck_print_ex_pending_list (resource);    */
+/*             lck_print_pr_pending_list (resource);    */
+/*             lck_print_pr_granted_list (resource);    */
        }
 
        return;
 }
+#endif /* _LCK_DEBUG_ */
 
 static void lck_resource_close (
        const mar_name_t *resource_name,
@@ -1362,7 +1359,6 @@
 {
        /* DEBUG */
        log_printf (LOGSYS_LEVEL_DEBUG, "[DEBUG]: lck_sync_init\n");
-       log_printf (LOGSYS_LEVEL_DEBUG, "[DEBUG]:\t global_lock_count = %u\n", 
global_lock_count);
 
        /* DEBUG */
        lck_print_resource_list (&resource_list_head);
@@ -1444,7 +1440,6 @@
        lck_sync_state = LCK_SYNC_STATE_NOT_STARTED;
 
        /* DEBUG */
-       lck_print_resource_list (&resource_list_head);
        log_printf (LOGSYS_LEVEL_DEBUG, "[DEBUG]:\t global_lock_count = %u\n", 
global_lock_count);
 
        return;
@@ -1472,12 +1467,11 @@
 
 static int lck_exec_init_fn (struct corosync_api_v1 *corosync_api)
 {
-       /* DEBUG */
-
 #ifdef OPENAIS_SOLARIS
        logsys_subsys_init();
 #endif
 
+       /* DEBUG */
        log_printf (LOGSYS_LEVEL_DEBUG, "[DEBUG]: lck_exec_init_fn\n");
 
        api = corosync_api;
@@ -2052,9 +2046,6 @@
                memcpy (&resource->resource_name,
                        &req_exec_lck_resourceopen->resource_name,
                        sizeof (mar_name_t));
-/*             memcpy (&resource->source, */
-/*                     &req_exec_lck_resourceopen->source, */
-/*                     sizeof (mar_message_source_t)); */
 
                resource->ex_lock_granted = NULL;
 
@@ -2160,9 +2151,6 @@
                memcpy (&resource->resource_name,
                        &req_exec_lck_resourceopenasync->resource_name,
                        sizeof (mar_name_t));
-/*             memcpy (&resource->source, */
-/*                     &req_exec_lck_resourceopenasync->source, */
-/*                     sizeof (mar_message_source_t)); */
 
                resource->ex_lock_granted = NULL;
 
@@ -2320,9 +2308,7 @@
        /* DEBUG */
        log_printf (LOGSYS_LEVEL_DEBUG, "EXEC request: saLckResourceLock\n");
 
-       /* if ((req_exec_lck_resourcelock->lock_flags & ~SA_LCK_LOCK_NO_QUEUE) 
&& */
-       if (global_lock_count == MAX_NUM_LOCKS)
-       {
+       if (global_lock_count == MAX_NUM_LOCKS) {
                error = SA_AIS_ERR_NO_RESOURCES;
                goto error_exit;
        }
@@ -2331,7 +2317,7 @@
                &req_exec_lck_resourcelock->resource_name);
 
        if (resource == NULL) {
-               error = SA_AIS_ERR_LIBRARY; /* ? */
+               error = SA_AIS_ERR_LIBRARY;
                goto error_exit;
        }
 
@@ -2363,12 +2349,8 @@
        list_init (&lock->resource_lock_list);
        list_add_tail (&lock->resource_lock_list, 
&resource->resource_lock_list_head);
 
-       /* !!! */
-
        lck_lock (resource, lock);
 
-       /* !!! */
-
 error_exit:
        if (api->ipc_source_is_local (&req_exec_lck_resourcelock->source))
        {
@@ -2414,7 +2396,6 @@
        /* DEBUG */
        log_printf (LOGSYS_LEVEL_DEBUG, "EXEC request: 
saLckResourceLockAsync\n");
 
-       /* if ((req_exec_lck_resourcelockasync->lock_flags & 
~SA_LCK_LOCK_NO_QUEUE) && */
        if (global_lock_count == MAX_NUM_LOCKS)
        {
                error = SA_AIS_ERR_NO_RESOURCES;
@@ -2425,7 +2406,7 @@
                &req_exec_lck_resourcelockasync->resource_name);
 
        if (resource == NULL) {
-               error = SA_AIS_ERR_LIBRARY; /* ? */
+               error = SA_AIS_ERR_LIBRARY;
                goto error_exit;
        }
 
@@ -2457,12 +2438,8 @@
        list_init (&lock->resource_lock_list);
        list_add_tail (&lock->resource_lock_list, 
&resource->resource_lock_list_head);
 
-       /* !!! */
-
        lck_lock (resource, lock);
 
-       /* !!! */
-
 error_exit:
        if (api->ipc_source_is_local (&req_exec_lck_resourcelockasync->source))
        {
@@ -2477,7 +2454,6 @@
                        &res_lib_lck_resourcelockasync,
                        sizeof (struct res_lib_lck_resourcelockasync));
 
-               /* if ((lock != NULL) && (lock->lock_status == 
SA_LCK_LOCK_GRANTED)) { */
                if ((lock != NULL) && (lock->lock_status != 0)) {
                        lck_lockgrant_callback_send (lock, error);
                }
@@ -2685,7 +2661,7 @@
                break;
        }
 
-/*error_exit:*/
+/* error_exit: */
        if (api->ipc_source_is_local (&req_exec_lck_limitget->source))
        {
                res_lib_lck_limitget.header.size =
@@ -2709,7 +2685,6 @@
        const struct req_exec_lck_resourcelock_timeout 
*req_exec_lck_resourcelock_timeout =
                message;
        struct res_lib_lck_resourcelock res_lib_lck_resourcelock;
-/*     SaAisErrorT error = SA_AIS_OK;*/
 
        struct resource *resource = NULL;
        struct resource_lock *resource_lock = NULL;
Index: lib/lck.c
===================================================================
--- lib/lck.c   (revision 2017)
+++ lib/lck.c   (working copy)
@@ -618,9 +618,6 @@
        req_lib_lck_resourceopen.header.id =
                MESSAGE_REQ_LCK_RESOURCEOPEN;
 
-/*     memcpy (&req_lib_lck_resourceopen.resource_name, */
-/*             lckResourceName, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourceopen.resource_name,
                (SaNameT *)lckResourceName);
@@ -737,9 +734,6 @@
        req_lib_lck_resourceopenasync.header.id =
                MESSAGE_REQ_LCK_RESOURCEOPENASYNC;
 
-/*     memcpy (&req_lib_lck_resourceopenasync.resource_name, */
-/*             lckResourceName, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourceopenasync.resource_name,
                (SaNameT *)lckResourceName);
@@ -811,9 +805,6 @@
        req_lib_lck_resourceclose.header.id =
                MESSAGE_REQ_LCK_RESOURCECLOSE;
 
-/*     memcpy (&req_lib_lck_resourceclose.resource_name, */
-/*             &lckResourceInstance->resource_name, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourceclose.resource_name,
                &lckResourceInstance->resource_name);
@@ -891,9 +882,6 @@
                goto error_exit;
        }
 
-/*     memcpy (&req_lib_lck_resourcelock.resource_name, */
-/*             &lckResourceInstance->resource_name, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourcelock.resource_name,
                &lckResourceInstance->resource_name);
@@ -1025,9 +1013,6 @@
                goto error_exit;
        }
 
-/*     memcpy (&req_lib_lck_resourcelockasync.resource_name, */
-/*             &lckResourceInstance->resource_name, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourcelockasync.resource_name,
                &lckResourceInstance->resource_name);
@@ -1063,19 +1048,6 @@
                goto error_destroy;
        }
 
-       /*
-       error = coroipcc_service_connect (
-               COROSYNC_SOCKET_NAME,
-               LCK_SERVICE,
-               IPC_REQUEST_SIZE,
-               IPC_RESPONSE_SIZE,
-               IPC_DISPATCH_SIZE,
-               &ipc_handle);
-       if (error != SA_AIS_OK) {
-               goto error_put_destroy;
-       }
-       */
-
        lckLockIdInstance->ipc_handle = lckResourceInstance->ipc_handle;
        lckLockIdInstance->resource_id = lckResourceInstance->resource_id;
        lckLockIdInstance->lck_handle = lckResourceInstance->lck_handle;
@@ -1099,7 +1071,6 @@
        iov.iov_len = sizeof (struct req_lib_lck_resourcelockasync);
 
        error = coroipcc_msg_send_reply_receive (
-               /* ipc_handle, */
                lckResourceInstance->ipc_handle,
                &iov,
                1,
@@ -1107,13 +1078,11 @@
                sizeof (struct res_lib_lck_resourcelockasync));
 
        if (error != SA_AIS_OK) {
-               /* goto error_disconnect; */
                goto error_put_destroy;
        }
 
        if (res_lib_lck_resourcelockasync.header.error != SA_AIS_OK) {
                error = res_lib_lck_resourcelockasync.header.error;
-               /* goto error_disconnect; */
                goto error_put_destroy;
        }
 
@@ -1125,10 +1094,6 @@
 
        return (error);
 
-/*
-error_disconnect:
-       coroipcc_service_disconnect (ipc_handle);
-*/
 error_put_destroy:
        hdb_handle_put (&lckLockIdHandleDatabase, *lockId);
 error_destroy:
@@ -1167,9 +1132,6 @@
                goto error_put;
        }
 
-/*     memcpy (&req_lib_lck_resourceunlock.resource_name, */
-/*             &lckResourceInstance->resource_name, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourceunlock.resource_name,
                &lckResourceInstance->resource_name);
@@ -1244,9 +1206,6 @@
                goto error_put;
        }
 
-/*     memcpy (&req_lib_lck_resourceunlockasync.resource_name, */
-/*             &lckResourceInstance->resource_name, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_resourceunlockasync.resource_name,
                &lckResourceInstance->resource_name);
@@ -1262,6 +1221,9 @@
                goto error_put;
        }
 
+       /*
+        * Check that saLckResourceUnlockCallback is defined.
+        */
        if (lckInstance->callbacks.saLckResourceUnlockCallback == NULL) {
                hdb_handle_put (&lckHandleDatabase,
                        lckResourceInstance->lck_handle);
@@ -1328,9 +1290,6 @@
                goto error_exit;
        }
 
-/*     memcpy (&req_lib_lck_lockpurge.resource_name, */
-/*             &lckResourceInstance->resource_name, sizeof (SaNameT)); */
-
        marshall_SaNameT_to_mar_name_t (
                &req_lib_lck_lockpurge.resource_name,
                &lckResourceInstance->resource_name);
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to