[PATCH] schedwrk: not use hdb_handle_t directly but allocate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hello,

handle2void()  didn't work well on my ppc32 machine.
I am new to corosync and just let it stop without SIGKILL,
there will be better solution...

---
 exec/schedwrk.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/exec/schedwrk.c b/exec/schedwrk.c
index 0591063..1210112 100644
--- a/exec/schedwrk.c
+++ b/exec/schedwrk.c
@@ -60,10 +60,16 @@ handle2void (hdb_handle_t h) { union u u; u.h = h;
return u.v; }

 static int schedwrk_do (enum totem_callback_token_type type, const
void *context)
 {
-       hdb_handle_t handle = void2handle (context);
+       hdb_handle_t handle;
       struct schedwrk_instance *instance;
       int res;

+       if (context == NULL) {
+               goto error_exit;
+       }
+       handle = *((hdb_handle_t *)context);
+       free(context);
+
       res = hdb_handle_get (&schedwrk_instance_database,
               hdb_nocheck_convert (handle),
               (void *)&instance);
@@ -106,6 +112,7 @@ static int schedwrk_internal_create (
 {
       struct schedwrk_instance *instance;
       int res;
+       void *vhandle;

       res = hdb_handle_create (&schedwrk_instance_database,
               sizeof (struct schedwrk_instance), handle);
@@ -118,12 +125,18 @@ static int schedwrk_internal_create (
               goto error_destroy;
       }

+       vhandle = malloc(sizeof(hdb_handle_t));
+       if (vhandle == NULL) {
+               goto error_destroy;
+       }
+       memcpy(vhandle, handle, sizeof(hdb_handle_t));
+
       totempg_callback_token_create (
               &instance->callback_handle,
               TOTEM_CALLBACK_TOKEN_SENT,
               1,
               schedwrk_do,
-               handle2void (*handle));
+               vhandle);

       instance->schedwrk_fn = schedwrk_fn;
       instance->context = context;
_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux