diff options
author | Martin Schwenke <martin@meltin.net> | 2019-07-30 10:52:05 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2019-10-24 04:06:43 +0000 |
commit | 496204feb0e2b6eb2f3d9a74e45596a3e74ad9b1 (patch) | |
tree | fc4664de9fce57b2976ecfbda855f7f50a1706e7 /ctdb | |
parent | a896486b62bbcf9915727ba7bfc768fb5383f0c7 (diff) | |
download | samba-496204feb0e2b6eb2f3d9a74e45596a3e74ad9b1.tar.gz |
ctdb-protocol: Add marshalling for control DB_VACUUM
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/protocol/protocol_api.h | 4 | ||||
-rw-r--r-- | ctdb/protocol/protocol_client.c | 24 | ||||
-rw-r--r-- | ctdb/protocol/protocol_control.c | 25 | ||||
-rw-r--r-- | ctdb/protocol/protocol_debug.c | 1 | ||||
-rwxr-xr-x | ctdb/tests/UNIT/cunit/protocol_test_101.sh | 2 | ||||
-rw-r--r-- | ctdb/tests/src/protocol_common_ctdb.c | 15 | ||||
-rw-r--r-- | ctdb/tests/src/protocol_ctdb_test.c | 2 |
7 files changed, 71 insertions, 2 deletions
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h index cf4c4635dd4..c2cd4a76289 100644 --- a/ctdb/protocol/protocol_api.h +++ b/ctdb/protocol/protocol_api.h @@ -607,6 +607,10 @@ void ctdb_req_control_vacuum_fetch(struct ctdb_req_control *request, struct ctdb_rec_buffer *recbuf); int ctdb_reply_control_vacuum_fetch(struct ctdb_reply_control *reply); +void ctdb_req_control_db_vacuum(struct ctdb_req_control *request, + struct ctdb_db_vacuum *db_vacuum); +int ctdb_reply_control_db_vacuum(struct ctdb_reply_control *reply); + /* From protocol/protocol_debug.c */ void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp); diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c index 09909d39e58..6c5180d6d6d 100644 --- a/ctdb/protocol/protocol_client.c +++ b/ctdb/protocol/protocol_client.c @@ -2361,3 +2361,27 @@ int ctdb_reply_control_vacuum_fetch(struct ctdb_reply_control *reply) return reply->status; } + +/* CTDB_CONTROL_DB_VACUUM */ + +void ctdb_req_control_db_vacuum(struct ctdb_req_control *request, + struct ctdb_db_vacuum *db_vacuum) +{ + request->opcode = CTDB_CONTROL_DB_VACUUM; + request->pad = 0; + request->srvid = 0; + request->client_id = 0; + request->flags = 0; + + request->rdata.opcode = CTDB_CONTROL_DB_VACUUM; + request->rdata.data.db_vacuum = db_vacuum; +} + +int ctdb_reply_control_db_vacuum(struct ctdb_reply_control *reply) +{ + if (reply->rdata.opcode != CTDB_CONTROL_DB_VACUUM) { + return EPROTO; + } + + return reply->status; +} diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c index 1cc985a71a7..a25c9b1cfe0 100644 --- a/ctdb/protocol/protocol_control.c +++ b/ctdb/protocol/protocol_control.c @@ -411,6 +411,10 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd) case CTDB_CONTROL_VACUUM_FETCH: len = ctdb_rec_buffer_len(cd->data.recbuf); break; + + case CTDB_CONTROL_DB_VACUUM: + len = ctdb_db_vacuum_len(cd->data.db_vacuum); + break; } return len; @@ -690,6 +694,10 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd, case CTDB_CONTROL_VACUUM_FETCH: ctdb_rec_buffer_push(cd->data.recbuf, buf, &np); break; + + case CTDB_CONTROL_DB_VACUUM: + ctdb_db_vacuum_push(cd->data.db_vacuum, buf, &np); + break; } *npush = np; @@ -1019,6 +1027,14 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen, ret = ctdb_rec_buffer_pull(buf, buflen, mem_ctx, &cd->data.recbuf, &np); break; + + case CTDB_CONTROL_DB_VACUUM: + ret = ctdb_db_vacuum_pull(buf, + buflen, + mem_ctx, + &cd->data.db_vacuum, + &np); + break; } if (ret != 0) { @@ -1379,6 +1395,9 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd) case CTDB_CONTROL_VACUUM_FETCH: break; + + case CTDB_CONTROL_DB_VACUUM: + break; } return len; @@ -1536,6 +1555,9 @@ static void ctdb_reply_control_data_push(struct ctdb_reply_control_data *cd, case CTDB_CONTROL_VACUUM_FETCH: break; + + case CTDB_CONTROL_DB_VACUUM: + break; } *npush = np; @@ -1723,6 +1745,9 @@ static int ctdb_reply_control_data_pull(uint8_t *buf, size_t buflen, case CTDB_CONTROL_VACUUM_FETCH: break; + + case CTDB_CONTROL_DB_VACUUM: + break; } if (ret != 0) { diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c index 97903ea98f4..3fe78b13162 100644 --- a/ctdb/protocol/protocol_debug.c +++ b/ctdb/protocol/protocol_debug.c @@ -243,6 +243,7 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp) { CTDB_CONTROL_TUNNEL_REGISTER, "TUNNEL_REGISTER" }, { CTDB_CONTROL_TUNNEL_DEREGISTER, "TUNNEL_DEREGISTER" }, { CTDB_CONTROL_VACUUM_FETCH, "VACUUM_FETCH" }, + { CTDB_CONTROL_DB_VACUUM, "DB_VACUUM" }, { MAP_END, "" }, }; diff --git a/ctdb/tests/UNIT/cunit/protocol_test_101.sh b/ctdb/tests/UNIT/cunit/protocol_test_101.sh index a0bf9d08754..6b07dc017ba 100755 --- a/ctdb/tests/UNIT/cunit/protocol_test_101.sh +++ b/ctdb/tests/UNIT/cunit/protocol_test_101.sh @@ -2,7 +2,7 @@ . "${TEST_SCRIPTS_DIR}/unit.sh" -last_control=154 +last_control=155 generate_control_output () { diff --git a/ctdb/tests/src/protocol_common_ctdb.c b/ctdb/tests/src/protocol_common_ctdb.c index b02976b5d67..6989010cd6f 100644 --- a/ctdb/tests/src/protocol_common_ctdb.c +++ b/ctdb/tests/src/protocol_common_ctdb.c @@ -594,6 +594,12 @@ void fill_ctdb_req_control_data(TALLOC_CTX *mem_ctx, assert(cd->data.recbuf != NULL); fill_ctdb_rec_buffer(mem_ctx, cd->data.recbuf); break; + + case CTDB_CONTROL_DB_VACUUM: + cd->data.db_vacuum = talloc(mem_ctx, struct ctdb_db_vacuum); + assert(cd->data.db_vacuum != NULL); + fill_ctdb_db_vacuum(mem_ctx, cd->data.db_vacuum); + break; } } @@ -984,6 +990,10 @@ void verify_ctdb_req_control_data(struct ctdb_req_control_data *cd, case CTDB_CONTROL_VACUUM_FETCH: verify_ctdb_rec_buffer(cd->data.recbuf, cd2->data.recbuf); break; + + case CTDB_CONTROL_DB_VACUUM: + verify_ctdb_db_vacuum(cd->data.db_vacuum, cd2->data.db_vacuum); + break; } } @@ -1381,6 +1391,8 @@ void fill_ctdb_reply_control_data(TALLOC_CTX *mem_ctx, case CTDB_CONTROL_VACUUM_FETCH: break; + case CTDB_CONTROL_DB_VACUUM: + break; } } @@ -1718,6 +1730,9 @@ void verify_ctdb_reply_control_data(struct ctdb_reply_control_data *cd, case CTDB_CONTROL_VACUUM_FETCH: break; + + case CTDB_CONTROL_DB_VACUUM: + break; } } diff --git a/ctdb/tests/src/protocol_ctdb_test.c b/ctdb/tests/src/protocol_ctdb_test.c index 3ebf15dff6c..b13cd5491d1 100644 --- a/ctdb/tests/src/protocol_ctdb_test.c +++ b/ctdb/tests/src/protocol_ctdb_test.c @@ -284,7 +284,7 @@ PROTOCOL_CTDB4_TEST(struct ctdb_req_dmaster, ctdb_req_dmaster, PROTOCOL_CTDB4_TEST(struct ctdb_reply_dmaster, ctdb_reply_dmaster, CTDB_REPLY_DMASTER); -#define NUM_CONTROLS 155 +#define NUM_CONTROLS 156 PROTOCOL_CTDB2_TEST(struct ctdb_req_control_data, ctdb_req_control_data); PROTOCOL_CTDB2_TEST(struct ctdb_reply_control_data, ctdb_reply_control_data); |