1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-client: Add a function to get db open flags

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2017-06-23 16:11:53 +10:00 committed by Martin Schwenke
parent 1b0cd3c280
commit 45ac7b357a
2 changed files with 36 additions and 0 deletions

View File

@ -2078,6 +2078,39 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode)
return 0;
}
/*
* Get db open flags
*/
int ctdb_ctrl_db_open_flags(struct ctdb_context *ctdb, uint32_t db_id,
int *tdb_flags)
{
TDB_DATA indata, outdata;
int ret;
int32_t res;
indata.dptr = (uint8_t *)&db_id;
indata.dsize = sizeof(db_id);
ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0,
CTDB_CONTROL_DB_OPEN_FLAGS, 0, indata,
ctdb, &outdata, &res, NULL, NULL);
if (ret != 0 || res != 0) {
D_ERR("ctdb control for db open flags failed\n");
return -1;
}
if (outdata.dsize != sizeof(int32_t)) {
D_ERR(__location__ " expected %zi bytes, received %zi bytes\n",
sizeof(int32_t), outdata.dsize);
talloc_free(outdata.dptr);
return -1;
}
*tdb_flags = *(int32_t *)outdata.dptr;
talloc_free(outdata.dptr);
return 0;
}
/*
attach to a specific database - client call
*/

View File

@ -270,6 +270,9 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode);
/*
attach to a ctdb database
*/
int ctdb_ctrl_db_open_flags(struct ctdb_context *ctdb, uint32_t db_id,
int *tdb_flags);
struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
struct timeval timeout,
const char *name,