| 156 | struct sync_callbacks *callbacks); |
| 157 | |
| 158 | int sync_init ( |
| 159 | int (*sync_callbacks_retrieve) ( |
| 160 | int service_id, |
| 161 | struct sync_callbacks *callbacks), |
| 162 | void (*synchronization_completed) (void)) |
| 163 | { |
| 164 | unsigned int res; |
| 165 | |
| 166 | res = totempg_groups_initialize ( |
| 167 | &sync_group_handle, |
| 168 | sync_deliver_fn, |
| 169 | NULL); |
| 170 | if (res == -1) { |
| 171 | log_printf (LOGSYS_LEVEL_ERROR, |
| 172 | "Couldn't initialize groups interface."); |
| 173 | return (-1); |
| 174 | } |
| 175 | |
| 176 | res = totempg_groups_join ( |
| 177 | sync_group_handle, |
| 178 | &sync_group, |
| 179 | 1); |
| 180 | if (res == -1) { |
| 181 | log_printf (LOGSYS_LEVEL_ERROR, "Couldn't join group."); |
| 182 | return (-1); |
| 183 | } |
| 184 | |
| 185 | sync_synchronization_completed = synchronization_completed; |
| 186 | my_sync_callbacks_retrieve = sync_callbacks_retrieve; |
| 187 | |
| 188 | return (0); |
| 189 | } |
| 190 | |
| 191 | static void sync_barrier_handler (unsigned int nodeid, const void *msg) |
| 192 | { |
no test coverage detected