]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Implement DB_OPEN_FLAGS control
authorAmitay Isaacs <amitay@gmail.com>
Wed, 14 Jun 2017 06:30:39 +0000 (16:30 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 26 Jun 2017 13:47:24 +0000 (15:47 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_control.c

index 9aa5e78433132a24036d36a6f0a4e44c09276fa3..7e66ba01d2f53c826a578710a81b94f73f3f31c6 100644 (file)
@@ -669,6 +669,30 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
                CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
                return ctdb_control_db_push_confirm(ctdb, indata, outdata);
 
+       case CTDB_CONTROL_DB_OPEN_FLAGS: {
+               uint32_t db_id;
+               struct ctdb_db_context *ctdb_db;
+               int tdb_flags;
+
+               CHECK_CONTROL_DATA_SIZE(sizeof(db_id));
+               db_id = *(uint32_t *)indata.dptr;
+               ctdb_db = find_ctdb_db(ctdb, db_id);
+               if (ctdb_db == NULL) {
+                       return -1;
+               }
+
+               tdb_flags = tdb_get_flags(ctdb_db->ltdb->tdb);
+
+               outdata->dptr = talloc_size(outdata, sizeof(tdb_flags));
+               if (outdata->dptr == NULL) {
+                       return -1;
+               }
+
+               outdata->dsize = sizeof(tdb_flags);
+               memcpy(outdata->dptr, &tdb_flags, outdata->dsize);
+               return 0;
+       }
+
        default:
                DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
                return -1;