diff options
author | Amitay Isaacs <amitay@gmail.com> | 2014-03-31 15:44:53 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2014-04-14 03:52:39 +0200 |
commit | ce18b3b00ba2db83daa71bf73e843732f05b8f6e (patch) | |
tree | 1328f1a7d805ea061f42e9367a104f2595ac6c15 /ctdb | |
parent | 1c72842217245fe99ddb6d26c29ae3f522db09c6 (diff) | |
download | samba-ce18b3b00ba2db83daa71bf73e843732f05b8f6e.tar.gz |
ctdb-client: Add client code to detach a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/client/ctdb_client.c | 19 | ||||
-rw-r--r-- | ctdb/include/ctdb_client.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 756011525db..51eec0e7fd4 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -2120,6 +2120,25 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, return ctdb_db; } +/* + * detach from a specific database - client call + */ +int ctdb_detach(struct ctdb_context *ctdb, uint32_t db_id) +{ + int ret; + int32_t status; + TDB_DATA data; + + data.dsize = sizeof(db_id); + data.dptr = (uint8_t *)&db_id; + + ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_DB_DETACH, + 0, data, NULL, NULL, &status, NULL, NULL); + if (ret != 0 || status != 0) { + return -1; + } + return 0; +} /* setup a call for a database diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index d3084273ea5..1370ce97504 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -97,6 +97,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, bool persistent, uint32_t tdb_flags); +int ctdb_detach(struct ctdb_context *ctdb, uint32_t db_id); /* find an attached ctdb_db handle given a name |