summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2017-06-23 16:11:53 +1000
committerMartin Schwenke <martins@samba.org>2017-06-26 15:47:24 +0200
commit45ac7b357ae69abeafdfc0f92a8fddc87f65f264 (patch)
tree0d4f83ebf60b30c7ed4edd7d306a98ed5095f303
parent1b0cd3c280fe3c4d4bd9f75e801780fb332a7afe (diff)
downloadsamba-45ac7b357ae69abeafdfc0f92a8fddc87f65f264.tar.gz
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>
-rw-r--r--ctdb/client/ctdb_client.c33
-rw-r--r--ctdb/include/ctdb_client.h3
2 files changed, 36 insertions, 0 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 6adf87894ab..d80a04d33c7 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -2079,6 +2079,39 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode)
}
/*
+ * 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
*/
struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index 94b9be4d804..d4fd77142ec 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -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,