[SCM] CTDB repository - branch master updated -
8e894d8baf20a455b50c5c1b1ac0540d9e766c5d
Ronnie Sahlberg
sahlberg at samba.org
Wed Apr 23 11:53:51 GMT 2008
The branch, master has been updated
via 8e894d8baf20a455b50c5c1b1ac0540d9e766c5d (commit)
from a63825e32658b36e0964584758b9a276c18056b8 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8e894d8baf20a455b50c5c1b1ac0540d9e766c5d
Author: Ronnie Sahlberg <sahlberg at samba.org>
Date: Wed Apr 23 21:49:52 2008 +1000
make 'ctdb catdb' produce output that resembles the output of tdbdump
-----------------------------------------------------------------------
Summary of changes:
client/ctdb_client.c | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index f852e5f..395d2d7 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -1839,19 +1839,33 @@ int ctdb_traverse(struct ctdb_db_context *ctdb_db, ctdb_traverse_func fn, void *
*/
static int dumpdb_fn(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data, void *p)
{
+ int i;
FILE *f = (FILE *)p;
- char *keystr, *datastr;
struct ctdb_ltdb_header *h = (struct ctdb_ltdb_header *)data.dptr;
- keystr = hex_encode_talloc(ctdb, key.dptr, key.dsize);
- datastr = hex_encode_talloc(ctdb, data.dptr+sizeof(*h), data.dsize-sizeof(*h));
-
fprintf(f, "dmaster: %u\n", h->dmaster);
fprintf(f, "rsn: %llu\n", (unsigned long long)h->rsn);
- fprintf(f, "key: %s\ndata: %s\n", keystr, datastr);
- talloc_free(keystr);
- talloc_free(datastr);
+ fprintf(f, "key(%d) = \"", key.dsize);
+ for (i=0;i<key.dsize;i++) {
+ if (isascii(key.dptr[i])) {
+ fprintf(f, "%c", key.dptr[i]);
+ } else {
+ fprintf(f, "\\%02X", key.dptr[i]);
+ }
+ }
+ fprintf(f, "\"\n");
+
+ fprintf(f, "data(%d) = \"", data.dsize);
+ for (i=sizeof(*h);i<data.dsize;i++) {
+ if (isascii(data.dptr[i])) {
+ fprintf(f, "%c", data.dptr[i]);
+ } else {
+ fprintf(f, "\\%02X", data.dptr[i]);
+ }
+ }
+ fprintf(f, "\"\n");
+
return 0;
}
--
CTDB repository
More information about the samba-cvs
mailing list