void *private_data),
void *private_data);
-NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
- uint64_t srvid, uint32_t flags, TDB_DATA data,
- TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
- int *cstatus);
+int ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
+ uint64_t srvid, uint32_t flags, TDB_DATA data,
+ TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
+ int *cstatus);
NTSTATUS ctdb_watch_us(struct ctdbd_connection *conn);
NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn);
/*
call a control on the local node
*/
-NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
- uint64_t srvid, uint32_t flags, TDB_DATA data,
- TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
- int *cstatus)
+int ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
+ uint64_t srvid, uint32_t flags, TDB_DATA data,
+ TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
+ int *cstatus)
{
- int ret;
-
- ret = ctdbd_control(conn, CTDB_CURRENT_NODE, opcode, srvid, flags, data,
- mem_ctx, outdata, cstatus);
- if (ret != 0) {
- return map_nt_error_from_unix(ret);
- }
- return NT_STATUS_OK;
+ return ctdbd_control(conn, CTDB_CURRENT_NODE, opcode, srvid, flags, data,
+ mem_ctx, outdata, cstatus);
}
NTSTATUS ctdb_watch_us(struct ctdbd_connection *conn)
{
struct ctdb_client_notify_register reg_data;
size_t struct_len;
- NTSTATUS status;
+ int ret;
int cstatus;
reg_data.srvid = CTDB_SRVID_SAMBA_NOTIFY;
struct_len = offsetof(struct ctdb_client_notify_register,
notify_data) + reg_data.len;
- status = ctdbd_control_local(
+ ret = ctdbd_control_local(
conn, CTDB_CONTROL_REGISTER_NOTIFY, conn->rand_srvid, 0,
make_tdb_data((uint8_t *)®_data, struct_len),
NULL, NULL, &cstatus);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
DEBUG(1, ("ctdbd_control_local failed: %s\n",
- nt_errstr(status)));
+ strerror(ret)));
+ return map_nt_error_from_unix(ret);
}
- return status;
+ return NT_STATUS_OK;
}
NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn)
{
struct ctdb_client_notify_deregister dereg_data;
- NTSTATUS status;
+ int ret;
int cstatus;
dereg_data.srvid = CTDB_SRVID_SAMBA_NOTIFY;
- status = ctdbd_control_local(
+ ret = ctdbd_control_local(
conn, CTDB_CONTROL_DEREGISTER_NOTIFY, conn->rand_srvid, 0,
make_tdb_data((uint8_t *)&dereg_data, sizeof(dereg_data)),
NULL, NULL, &cstatus);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
DEBUG(1, ("ctdbd_control_local failed: %s\n",
- nt_errstr(status)));
+ strerror(ret)));
+ return map_nt_error_from_unix(ret);
}
- return status;
+ return NT_STATUS_OK;
}
NTSTATUS ctdbd_probe(const char *sockname, int timeout)
again:
/* tell ctdbd to commit to the other nodes */
- rets = ctdbd_control_local(messaging_ctdbd_connection(),
- CTDB_CONTROL_TRANS3_COMMIT,
- h->ctx->db_id, 0,
- db_ctdb_marshall_finish(h->m_write),
- NULL, NULL, &status);
- if (!NT_STATUS_IS_OK(rets) || status != 0) {
+ ret = ctdbd_control_local(messaging_ctdbd_connection(),
+ CTDB_CONTROL_TRANS3_COMMIT,
+ h->ctx->db_id, 0,
+ db_ctdb_marshall_finish(h->m_write),
+ NULL, NULL, &status);
+ if ((ret != 0) || status != 0) {
/*
* The TRANS3_COMMIT control should only possibly fail when a
* recovery has been running concurrently. In any case, the db
static NTSTATUS db_ctdb_send_schedule_for_deletion(struct db_record *rec)
{
NTSTATUS status;
+ int ret;
struct ctdb_control_schedule_for_deletion *dd;
TDB_DATA indata;
int cstatus;
dd->keylen = rec->key.dsize;
memcpy(dd->key, rec->key.dptr, rec->key.dsize);
- status = ctdbd_control_local(messaging_ctdbd_connection(),
- CTDB_CONTROL_SCHEDULE_FOR_DELETION,
- crec->ctdb_ctx->db_id,
- CTDB_CTRL_FLAG_NOREPLY, /* flags */
- indata,
- NULL, /* outdata */
- NULL, /* errmsg */
- &cstatus);
+ ret = ctdbd_control_local(messaging_ctdbd_connection(),
+ CTDB_CONTROL_SCHEDULE_FOR_DELETION,
+ crec->ctdb_ctx->db_id,
+ CTDB_CTRL_FLAG_NOREPLY, /* flags */
+ indata,
+ NULL, /* outdata */
+ NULL, /* errmsg */
+ &cstatus);
talloc_free(indata.dptr);
- if (!NT_STATUS_IS_OK(status) || cstatus != 0) {
+ if ((ret != 0) || cstatus != 0) {
DEBUG(1, (__location__ " Error sending local control "
"SCHEDULE_FOR_DELETION: %s, cstatus = %d\n",
- nt_errstr(status), cstatus));
- if (NT_STATUS_IS_OK(status)) {
+ strerror(ret), cstatus));
+ if (ret != 0) {
status = NT_STATUS_UNSUCCESSFUL;
}
}
struct ctdbd_connection *conn;
struct loadparm_context *lp_ctx;
struct ctdb_db_priority prio;
- NTSTATUS status;
int cstatus;
int ret;
prio.db_id = db_ctdb->db_id;
prio.priority = lock_order;
- status = ctdbd_control_local(
+ ret = ctdbd_control_local(
conn, CTDB_CONTROL_SET_DB_PRIORITY, 0, 0,
make_tdb_data((uint8_t *)&prio, sizeof(prio)),
NULL, NULL, &cstatus);
- if (!NT_STATUS_IS_OK(status) || (cstatus != 0)) {
+ if ((ret != 0) || (cstatus != 0)) {
DEBUG(1, ("CTDB_CONTROL_SET_DB_PRIORITY failed: %s, %d\n",
- nt_errstr(status), cstatus));
+ strerror(ret), cstatus));
TALLOC_FREE(result);
return NULL;
}
indata = make_tdb_data((uint8_t *)&db_ctdb->db_id,
sizeof(db_ctdb->db_id));
- status = ctdbd_control_local(
+ ret = ctdbd_control_local(
conn, CTDB_CONTROL_SET_DB_READONLY, 0, 0, indata,
NULL, NULL, &cstatus);
- if (!NT_STATUS_IS_OK(status) || (cstatus != 0)) {
+ if ((ret != 0) || (cstatus != 0)) {
DEBUG(1, ("CTDB_CONTROL_SET_DB_READONLY failed: "
- "%s, %d\n", nt_errstr(status), cstatus));
+ "%s, %d\n", strerror(ret), cstatus));
TALLOC_FREE(result);
return NULL;
}