diff options
-rw-r--r-- | ctdb/client/ctdb_client.c | 38 | ||||
-rw-r--r-- | ctdb/common/ctdb_ltdb.c | 37 | ||||
-rw-r--r-- | ctdb/include/ctdb_private.h | 6 | ||||
-rw-r--r-- | ctdb/server/ctdb_ltdb_server.c | 39 |
4 files changed, 43 insertions, 77 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 870edaa582..9705c28858 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -1884,44 +1884,6 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode) } /* - this is the dummy null procedure that all databases support -*/ -static int ctdb_null_func(struct ctdb_call_info *call) -{ - return 0; -} - -/* - this is a plain fetch procedure that all databases support -*/ -static int ctdb_fetch_func(struct ctdb_call_info *call) -{ - call->reply_data = &call->record_data; - return 0; -} - -/* - this is a plain fetch procedure that all databases support - this returns the full record including the ltdb header -*/ -static int ctdb_fetch_with_header_func(struct ctdb_call_info *call) -{ - call->reply_data = talloc(call, TDB_DATA); - if (call->reply_data == NULL) { - return -1; - } - call->reply_data->dsize = sizeof(struct ctdb_ltdb_header) + call->record_data.dsize; - call->reply_data->dptr = talloc_size(call->reply_data, call->reply_data->dsize); - if (call->reply_data->dptr == NULL) { - return -1; - } - memcpy(call->reply_data->dptr, call->header, sizeof(struct ctdb_ltdb_header)); - memcpy(&call->reply_data->dptr[sizeof(struct ctdb_ltdb_header)], call->record_data.dptr, call->record_data.dsize); - - return 0; -} - -/* attach to a specific database - client call */ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index e4662ac37f..565a89986b 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -295,4 +295,41 @@ void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data, ctdb_tra } } +/* + this is the dummy null procedure that all databases support +*/ +int ctdb_null_func(struct ctdb_call_info *call) +{ + return 0; +} + +/* + this is a plain fetch procedure that all databases support +*/ +int ctdb_fetch_func(struct ctdb_call_info *call) +{ + call->reply_data = &call->record_data; + return 0; +} + +/* + this is a plain fetch procedure that all databases support + this returns the full record including the ltdb header +*/ +int ctdb_fetch_with_header_func(struct ctdb_call_info *call) +{ + call->reply_data = talloc(call, TDB_DATA); + if (call->reply_data == NULL) { + return -1; + } + call->reply_data->dsize = sizeof(struct ctdb_ltdb_header) + call->record_data.dsize; + call->reply_data->dptr = talloc_size(call->reply_data, call->reply_data->dsize); + if (call->reply_data->dptr == NULL) { + return -1; + } + memcpy(call->reply_data->dptr, call->header, sizeof(struct ctdb_ltdb_header)); + memcpy(&call->reply_data->dptr[sizeof(struct ctdb_ltdb_header)], call->record_data.dptr, call->record_data.dsize); + + return 0; +} diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index f1818b98de..5fbe81806c 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -1472,4 +1472,10 @@ int ctdb_add_revoke_deferred_call(struct ctdb_context *ctdb, struct ctdb_db_cont int ctdb_set_db_readonly(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db); +int ctdb_null_func(struct ctdb_call_info *call); + +int ctdb_fetch_func(struct ctdb_call_info *call); + +int ctdb_fetch_with_header_func(struct ctdb_call_info *call); + #endif diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index b1f29d77ec..8423388433 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -32,45 +32,6 @@ #define PERSISTENT_HEALTH_TDB "persistent_health.tdb" -/* - this is the dummy null procedure that all databases support -*/ -static int ctdb_null_func(struct ctdb_call_info *call) -{ - return 0; -} - -/* - this is a plain fetch procedure that all databases support -*/ -static int ctdb_fetch_func(struct ctdb_call_info *call) -{ - call->reply_data = &call->record_data; - return 0; -} - -/* - this is a plain fetch procedure that all databases support - this returns the full record including the ltdb header -*/ -static int ctdb_fetch_with_header_func(struct ctdb_call_info *call) -{ - call->reply_data = talloc(call, TDB_DATA); - if (call->reply_data == NULL) { - return -1; - } - call->reply_data->dsize = sizeof(struct ctdb_ltdb_header) + call->record_data.dsize; - call->reply_data->dptr = talloc_size(call->reply_data, call->reply_data->dsize); - if (call->reply_data->dptr == NULL) { - return -1; - } - memcpy(call->reply_data->dptr, call->header, sizeof(struct ctdb_ltdb_header)); - memcpy(&call->reply_data->dptr[sizeof(struct ctdb_ltdb_header)], call->record_data.dptr, call->record_data.dsize); - - return 0; -} - - /** * write a record to a normal database * |