struct ctdb_req_message;
-NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
- int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
- uint64_t dst_srvid,
- const uint8_t *msg, size_t msglen,
- void *private_data),
- void *private_data);
+int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
+ int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+ uint64_t dst_srvid,
+ const uint8_t *msg, size_t msglen,
+ void *private_data),
+ void *private_data);
NTSTATUS ctdbd_probe(const char *sockname, int timeout);
#endif /* _CTDBD_CONN_H */
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
- int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
- uint64_t dst_srvid,
- const uint8_t *msg, size_t msglen,
- void *private_data),
- void *private_data)
+int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
+ int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+ uint64_t dst_srvid,
+ const uint8_t *msg, size_t msglen,
+ void *private_data),
+ void *private_data)
{
- return NT_STATUS_NOT_IMPLEMENTED;
+ return ENOSYS;
}
NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
/*
* Register a srvid with ctdbd
*/
-NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
- int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
- uint64_t dst_srvid,
- const uint8_t *msg, size_t msglen,
- void *private_data),
- void *private_data)
+int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
+ int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+ uint64_t dst_srvid,
+ const uint8_t *msg, size_t msglen,
+ void *private_data),
+ void *private_data)
{
int ret, cstatus;
CTDB_CONTROL_REGISTER_SRVID, srvid, 0,
tdb_null, NULL, NULL, &cstatus);
if (ret != 0) {
- return map_nt_error_from_unix(ret);
+ return ret;
}
num_callbacks = talloc_array_length(conn->callbacks);
tmp = talloc_realloc(conn, conn->callbacks, struct ctdbd_srvid_cb,
num_callbacks + 1);
if (tmp == NULL) {
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
conn->callbacks = tmp;
.srvid = srvid, .cb = cb, .private_data = private_data
};
- return NT_STATUS_OK;
+ return 0;
}
static int ctdbd_msg_call_back(struct ctdbd_connection *conn,
generate_random_buffer((unsigned char *)&conn->rand_srvid,
sizeof(conn->rand_srvid));
- status = register_with_ctdbd(conn, conn->rand_srvid, NULL, NULL);
+ ret = register_with_ctdbd(conn, conn->rand_srvid, NULL, NULL);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
DEBUG(5, ("Could not register random srvid: %s\n",
- nt_errstr(status)));
+ strerror(ret)));
+ status = map_nt_error_from_unix(ret);
goto fail;
}
{
struct ctdbd_connection *conn;
NTSTATUS status;
+ int ret;
status = ctdbd_init_connection(mem_ctx, sockname, timeout, &conn);
return status;
}
- status = register_with_ctdbd(conn, MSG_SRVID_SAMBA, NULL, NULL);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = register_with_ctdbd(conn, MSG_SRVID_SAMBA, NULL, NULL);
+ if (ret != 0) {
+ status = map_nt_error_from_unix(ret);
goto fail;
}
{
struct ctdb_control_tcp_addr p;
TDB_DATA data = { .dptr = (uint8_t *)&p, .dsize = sizeof(p) };
- NTSTATUS status;
int ret;
struct sockaddr_storage client;
struct sockaddr_storage server;
* We want to be told about IP releases
*/
- status = register_with_ctdbd(conn, CTDB_SRVID_RELEASE_IP,
- cb, private_data);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ret = register_with_ctdbd(conn, CTDB_SRVID_RELEASE_IP,
+ cb, private_data);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
}
/*
struct messaging_backend *result;
struct messaging_ctdbd_context *ctx;
NTSTATUS status;
+ int ret;
if (!(result = talloc(mem_ctx, struct messaging_backend))) {
DEBUG(0, ("talloc failed\n"));
return status;
}
- status = register_with_ctdbd(ctx->conn, getpid(),
- messaging_ctdb_recv, msg_ctx);
+ ret = register_with_ctdbd(ctx->conn, getpid(),
+ messaging_ctdb_recv, msg_ctx);
+ if (ret != 0) {
+ DEBUG(10, ("register_with_ctdbd failed: %s\n",
+ strerror(ret)));
+ TALLOC_FREE(result);
+ return map_nt_error_from_unix(ret);
+ }
global_ctdb_connection_pid = getpid();
global_ctdbd_connection = ctx->conn;
struct tevent_req *req, *subreq;
struct notifyd_state *state;
struct server_id_db *names_db;
- NTSTATUS status;
int ret;
req = tevent_req_create(mem_ctx, &state, struct notifyd_state);
tevent_req_set_callback(subreq, notifyd_clean_peers_finished,
req);
- status = register_with_ctdbd(ctdbd_conn, CTDB_SRVID_SAMBA_NOTIFY_PROXY,
- notifyd_snoop_broadcast, state);
- if (!NT_STATUS_IS_OK(status)) {
- tevent_req_error(req, map_errno_from_nt_status(status));
+ ret = register_with_ctdbd(ctdbd_conn, CTDB_SRVID_SAMBA_NOTIFY_PROXY,
+ notifyd_snoop_broadcast, state);
+ if (ret != 0) {
+ tevent_req_error(req, ret);
return tevent_req_post(req, ev);
}