This patch fixes the timer service such that the exec code will use
64-bit hdb_handle_t. The timer service uses the hdb handle as the
SaTmrTimerIdT (64-bit), so now there is not need to cast it as a
32-bit value. In other words, the timer_id should be cast as
hdb_handle_t, not unsigned int.

Note that without this fix, the current code will not work. Casting
the hdb_handle_t to be 32-bits is bad, and it causes hdb_handle_get to
fail.



Index: services/tmr.c
===================================================================
--- services/tmr.c      (revision 1768)
+++ services/tmr.c      (working copy)
@@ -265,7 +265,7 @@
                timer_instance = list_entry (cleanup_list, struct 
timer_instance, cleanup_list);
 
                /* DEBUG */
-               log_printf (LOG_LEVEL_NOTICE, "[DEBUG]: cleanup timer { id=%u 
}\n",
+               log_printf (LOG_LEVEL_NOTICE, "[DEBUG]: cleanup timer { 
id=0x%04x }\n",
                            (unsigned int)(timer_instance->timer_id));
 
                api->timer_delete (timer_instance->timer_handle);
@@ -289,7 +289,7 @@
        timer_instance->expiration_count += 1;
 
        /* DEBUG */
-       log_printf (LOG_LEVEL_NOTICE, "[DEBUG]: tmr_timer_expired { id=%u }\n",
+       log_printf (LOG_LEVEL_NOTICE, "[DEBUG]: tmr_timer_expired { id=0x%04x 
}\n",
                    (unsigned int)(timer_instance->timer_id));
 
        res_lib_tmr_timerexpiredcallback.header.size =
@@ -310,7 +310,7 @@
        }
        else {
                /* DEBUG */
-               log_printf (LOG_LEVEL_NOTICE, "[DEBUG]: skipping timer { id=%u 
}\n",
+               log_printf (LOG_LEVEL_NOTICE, "[DEBUG]: skipping timer { 
id=0x%04x }\n",
                            (unsigned int)(timer_instance->timer_id));
 
                timer_instance->timer_skip -= 1;
@@ -437,11 +437,11 @@
        SaTimeT current_time = 0;
 
        /* DEBUG */
-       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerReschedule { 
id=%u }\n",
+       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerReschedule { 
id=0x%04x }\n",
                    (unsigned int)(req_lib_tmr_timerreschedule->timer_id));
 
        hdb_handle_get (&timer_hdb,
-               (unsigned int)(req_lib_tmr_timerreschedule->timer_id),
+               (hdb_handle_t)(req_lib_tmr_timerreschedule->timer_id),
                (void *)&timer_instance);
        if (timer_instance == NULL) {
                error = SA_AIS_ERR_NOT_EXIST;
@@ -474,7 +474,7 @@
 
 error_put:
 
-       hdb_handle_put (&timer_hdb, (unsigned int)(timer_instance->timer_id));
+       hdb_handle_put (&timer_hdb, (hdb_handle_t)(timer_instance->timer_id));
 
 error_exit:
 
@@ -500,11 +500,11 @@
        SaAisErrorT error = SA_AIS_OK;
 
        /* DEBUG */
-       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerCancel { id=%u 
}\n",
+       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerCancel { 
id=0x%04x }\n",
                    (unsigned int)(req_lib_tmr_timercancel->timer_id));
 
        hdb_handle_get (&timer_hdb,
-               (unsigned int)(req_lib_tmr_timercancel->timer_id),
+               (hdb_handle_t)(req_lib_tmr_timercancel->timer_id),
                (void *)&timer_instance);
        if (timer_instance == NULL) {
                error = SA_AIS_ERR_NOT_EXIST;
@@ -517,8 +517,8 @@
 
        list_del (&timer_instance->cleanup_list);
 
-       hdb_handle_destroy (&timer_hdb, (unsigned 
int)(timer_instance->timer_id));
-       hdb_handle_put (&timer_hdb, (unsigned int)(timer_instance->timer_id));
+       hdb_handle_destroy (&timer_hdb, 
(hdb_handle_t)(timer_instance->timer_id));
+       hdb_handle_put (&timer_hdb, (hdb_handle_t)(timer_instance->timer_id));
 
 error_exit:
 
@@ -544,11 +544,11 @@
        SaAisErrorT error = SA_AIS_OK;
 
        /* DEBUG */
-       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrPeriodicTimerSkip { 
id=%u }\n",
+       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrPeriodicTimerSkip { 
id=0x%04x }\n",
                    (unsigned int)(req_lib_tmr_periodictimerskip->timer_id));
 
        hdb_handle_get (&timer_hdb,
-               (unsigned int)(req_lib_tmr_periodictimerskip->timer_id),
+               (hdb_handle_t)(req_lib_tmr_periodictimerskip->timer_id),
                (void *)&timer_instance);
        if (timer_instance == NULL) {
                error = SA_AIS_ERR_NOT_EXIST;
@@ -562,7 +562,7 @@
 
        timer_instance->timer_skip += 1;
 
-       hdb_handle_put (&timer_hdb, (unsigned int)(timer_instance->timer_id));
+       hdb_handle_put (&timer_hdb, (hdb_handle_t)(timer_instance->timer_id));
 
 error_exit:
 
@@ -588,11 +588,11 @@
        SaAisErrorT error = SA_AIS_OK;
 
        /* DEBUG */
-       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerRemainingTimeGet 
{ id=%u }\n",
+       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerRemainingTimeGet 
{ id=0x%04x }\n",
                    (unsigned 
int)(req_lib_tmr_timerremainingtimeget->timer_id));
 
        hdb_handle_get (&timer_hdb,
-               (unsigned int)(req_lib_tmr_timerremainingtimeget->timer_id),
+               (hdb_handle_t)(req_lib_tmr_timerremainingtimeget->timer_id),
                (void *)&timer_instance);
        if (timer_instance == NULL) {
                error = SA_AIS_ERR_NOT_EXIST;
@@ -603,7 +603,7 @@
                
(SaTimeT)((api->timer_expire_time_get(timer_instance->timer_handle)) -
                          (api->timer_time_get()));
 
-       hdb_handle_put (&timer_hdb, (unsigned int)(timer_instance->timer_id));
+       hdb_handle_put (&timer_hdb, (hdb_handle_t)(timer_instance->timer_id));
 
 error_exit:
 
@@ -629,11 +629,11 @@
        SaAisErrorT error = SA_AIS_OK;
 
        /* DEBUG */
-       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerAttributesGet { 
id=%u }\n",
+       log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimerAttributesGet { 
id=0x%04x }\n",
                    (unsigned int)(req_lib_tmr_timerattributesget->timer_id));
 
        hdb_handle_get (&timer_hdb,
-               (unsigned int)(req_lib_tmr_timerattributesget->timer_id),
+               (hdb_handle_t)(req_lib_tmr_timerattributesget->timer_id),
                (void *)&timer_instance);
        if (timer_instance == NULL) {
                error = SA_AIS_ERR_NOT_EXIST;
@@ -644,7 +644,7 @@
                &timer_instance->timer_attributes,
                sizeof (SaTmrTimerAttributesT));
 
-       hdb_handle_put (&timer_hdb, (unsigned int)(timer_instance->timer_id));
+       hdb_handle_put (&timer_hdb, (hdb_handle_t)(timer_instance->timer_id));
 
 error_exit:
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to