Pass NULL if not needed.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
struct ctdb_context *ctdb;
cluster_mutex_handler_t handler;
void *private_data;
+ cluster_mutex_lost_handler_t lost_handler;
+ void *lost_data;
int fd[2];
struct tevent_timer *te;
struct tevent_fd *fde;
/* Don't call the handler more than once. It only exists to
* process the initial response from the helper. */
if (h->have_response) {
+ /* Only deal with EOF due to process exit. Silently
+ * ignore any other output. */
+ if (ret == 0) {
+ if (h->lost_handler != NULL) {
+ h->lost_handler(h->lost_data);
+ }
+ }
return;
}
h->have_response = true;
const char *argstring,
int timeout,
cluster_mutex_handler_t handler,
- void *private_data)
+ void *private_data,
+ cluster_mutex_lost_handler_t lost_handler,
+ void *lost_data)
{
struct ctdb_cluster_mutex_handle *h;
char **args;
h->ctdb = ctdb;
h->handler = handler;
h->private_data = private_data;
+ h->lost_handler = lost_handler;
+ h->lost_data = lost_data;
return h;
}
double latency,
void *private_data);
+typedef void (*cluster_mutex_lost_handler_t) (void *private_data);
+
struct ctdb_cluster_mutex_handle *
ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
const char *argstring,
int timeout,
cluster_mutex_handler_t handler,
- void *private_data);
+ void *private_data,
+ cluster_mutex_lost_handler_t lost_handler,
+ void *lost_data);
#endif /* __CTDB_IPALLOC_H__ */
state->c = NULL;
h = ctdb_cluster_mutex(state, ctdb, ctdb->recovery_lock, 5,
- set_recmode_handler, state);
+ set_recmode_handler, state, NULL, NULL);
if (h == NULL) {
talloc_free(state);
return -1;
};
h = ctdb_cluster_mutex(rec, ctdb, ctdb->recovery_lock, 0,
- hold_reclock_handler, &s);
+ hold_reclock_handler, &s, NULL, NULL);
if (h == NULL) {
return false;
}