This patch simply moves the definitions of LCK service limits to
ipc_msg.h, which is consistent with the MSG service. This allows us to
use the limit in the IPC request/response structs for the
service. Also, the saLckLimitGet function can be handled entirely in
the library due to this change.

Ryan

Index: services/lck.c
===================================================================
--- services/lck.c      (revision 2056)
+++ services/lck.c      (working copy)
@@ -152,14 +152,6 @@
 unsigned int global_lock_count = 0;
 unsigned int sync_lock_count = 0;
 
-/*
- * Define the limits for the lock service.
- * These limits are implementation specific and
- * can be obtained via the library call saLckLimitGet
- * by passing the appropriate limitId (see saLck.h).
- */
-#define MAX_NUM_LOCKS 256
-
 DECLARE_HDB_DATABASE (resource_hdb, NULL);
 
 DECLARE_LIST_INIT(resource_list_head);
@@ -2682,22 +2674,10 @@
                message;
        struct res_lib_lck_limitget res_lib_lck_limitget;
        SaAisErrorT error = SA_AIS_OK;
-       SaUint64T value = 0;
 
        /* DEBUG */
        log_printf (LOGSYS_LEVEL_DEBUG, "EXEC request: saLckLimitGet\n");
 
-       switch (req_exec_lck_limitget->limit_id)
-       {
-       case SA_LCK_MAX_NUM_LOCKS_ID:
-               value = MAX_NUM_LOCKS;
-               break;
-       default:
-               error = SA_AIS_ERR_INVALID_PARAM;
-               break;
-       }
-
-/* error_exit: */
        if (api->ipc_source_is_local (&req_exec_lck_limitget->source))
        {
                res_lib_lck_limitget.header.size =
@@ -2705,7 +2685,6 @@
                res_lib_lck_limitget.header.id =
                        MESSAGE_RES_LCK_LIMITGET;
                res_lib_lck_limitget.header.error = error;
-               res_lib_lck_limitget.value = value;
 
                api->ipc_response_send (
                        req_exec_lck_limitget->source.conn,
@@ -3272,7 +3251,7 @@
        void *conn,
        const void *msg)
 {
-       const struct req_lib_lck_limitget *req_lib_lck_limitget = msg;
+/*     const struct req_lib_lck_limitget *req_lib_lck_limitget = msg; */
        struct req_exec_lck_limitget req_exec_lck_limitget;
        struct iovec iovec;
 
@@ -3286,8 +3265,6 @@
 
        api->ipc_source_set (&req_exec_lck_limitget.source, conn);
 
-       req_exec_lck_limitget.limit_id = req_lib_lck_limitget->limit_id;
-
        iovec.iov_base = (void *)&req_exec_lck_limitget;
        iovec.iov_len = sizeof (struct req_exec_lck_limitget);
 
Index: include/ipc_lck.h
===================================================================
--- include/ipc_lck.h   (revision 2056)
+++ include/ipc_lck.h   (working copy)
@@ -69,6 +69,14 @@
        MESSAGE_RES_LCK_RESOURCEUNLOCK_CALLBACK = 12,
 };
 
+/*
+ * Define the limits for the lock service.
+ * These limits are implementation specific and
+ * can be obtained via the library call saLckLimitGet
+ * by passing the appropriate limitId (see saLck.h).
+ */
+#define MAX_NUM_LOCKS 256
+
 struct req_lib_lck_resourceopen {
        coroipc_request_header_t header __attribute__((aligned(8)));
        mar_name_t resource_name __attribute__((aligned(8)));
Index: lib/lck.c
===================================================================
--- lib/lck.c   (revision 2056)
+++ lib/lck.c   (working copy)
@@ -1304,46 +1304,31 @@
        SaLimitValueT *limitValue)
 {
        struct lckInstance *lckInstance;
-       struct req_lib_lck_limitget req_lib_lck_limitget;
-       struct res_lib_lck_limitget res_lib_lck_limitget;
-       struct iovec iov;
        SaAisErrorT error = SA_AIS_OK;
 
+       if (limitValue == NULL) {
+               error = SA_AIS_ERR_INVALID_PARAM;
+               goto error_exit;
+       }
+
        error = hdb_error_to_sa (hdb_handle_get (&lckHandleDatabase,
                lckHandle, (void *)&lckInstance));
        if (error != SA_AIS_OK) {
                goto error_exit;
        }
 
-       req_lib_lck_limitget.header.size =
-               sizeof (struct req_lib_lck_limitget);
-       req_lib_lck_limitget.header.id =
-               MESSAGE_REQ_LCK_LIMITGET;
-       req_lib_lck_limitget.limit_id = limitId;
-
-       iov.iov_base = (void *)&req_lib_lck_limitget;
-       iov.iov_len = sizeof (struct req_lib_lck_limitget);
-
-       error = coroipcc_msg_send_reply_receive (
-               lckInstance->ipc_handle,
-               &iov,
-               1,
-               &res_lib_lck_limitget,
-               sizeof (struct res_lib_lck_limitget));
-
-       if (error != SA_AIS_OK) {
-               goto error_put;
+       switch (limitId)
+       {
+       case SA_LCK_MAX_NUM_LOCKS_ID:
+               limitValue->uint64Value = MAX_NUM_LOCKS;
+               break;
+       default:
+               error = SA_AIS_ERR_INVALID_PARAM;
+               break;
        }
 
-       if (res_lib_lck_limitget.header.error != SA_AIS_OK) {
-               error = res_lib_lck_limitget.header.error;
-               goto error_put;
-       }
-
-       (*limitValue).uint64Value = res_lib_lck_limitget.value;
-
-error_put:
        hdb_handle_put (&lckHandleDatabase, lckHandle);
+
 error_exit:
        return (error);
 }
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to