Search
j0ke.net Open Build Service
>
Projects
>
GFS
>
openais
> revision-1449.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File revision-1449.patch of Package openais (Revision 27)
Currently displaying revision
27
,
show latest
Index: exec/service.c =================================================================== --- exec/service.c (revision 1446) +++ exec/service.c (revision 1449) @@ -87,7 +87,7 @@ } }; -struct openais_service_handler *ais_service[128]; +struct openais_service_handler *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT]; /* * Adds a service handler to the object database Index: exec/service.h =================================================================== --- exec/service.h (revision 1446) +++ exec/service.h (revision 1449) @@ -44,6 +44,7 @@ #endif #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) ) +#define SERVICE_HANDLER_MAXIMUM_COUNT 64 enum openais_flow_control { OPENAIS_FLOW_CONTROL_REQUIRED = 1, Index: exec/sync.c =================================================================== --- exec/sync.c (revision 1446) +++ exec/sync.c (revision 1449) @@ -198,9 +198,10 @@ { int res; -// TODO rewrite this to get rid of the for (;;) for (;;) { - res = sync_callbacks_retrieve (sync_recovery_index, &sync_callbacks); + res = sync_callbacks_retrieve (sync_recovery_index, + &sync_callbacks); + /* * No more service handlers have sync callbacks at this time ` */ @@ -418,7 +419,6 @@ log_printf (LOG_LEVEL_DEBUG, "Committing synchronization for (%s)\n", sync_callbacks.name); - } /* Index: exec/main.c =================================================================== --- exec/main.c (revision 1446) +++ exec/main.c (revision 1449) @@ -175,15 +175,29 @@ static int openais_sync_callbacks_retrieve (int sync_id, struct sync_callbacks *callbacks) { - if (ais_service[sync_id] == NULL) { + unsigned int ais_service_index; + unsigned int ais_services_found = 0; + + for (ais_service_index = 0; + ais_service_index < SERVICE_HANDLER_MAXIMUM_COUNT; + ais_service_index++) { + + if (ais_service[ais_service_index] != NULL) { + if (ais_services_found == sync_id) { + break; + } + ais_services_found += 1; + } + } + if (ais_service_index == SERVICE_HANDLER_MAXIMUM_COUNT) { memset (callbacks, 0, sizeof (struct sync_callbacks)); return (-1); } - callbacks->name = ais_service[sync_id]->name; - callbacks->sync_init = ais_service[sync_id]->sync_init; - callbacks->sync_process = ais_service[sync_id]->sync_process; - callbacks->sync_activate = ais_service[sync_id]->sync_activate; - callbacks->sync_abort = ais_service[sync_id]->sync_abort; + callbacks->name = ais_service[ais_service_index]->name; + callbacks->sync_init = ais_service[ais_service_index]->sync_init; + callbacks->sync_process = ais_service[ais_service_index]->sync_process; + callbacks->sync_activate = ais_service[ais_service_index]->sync_activate; + callbacks->sync_abort = ais_service[ais_service_index]->sync_abort; return (0); }