From 65f84903509c9c50f35083abfae34bc5b019b31f Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 23 Apr 2009 10:03:01 +0000 Subject: [PATCH] use uint64_t for hdb_handle_t type and also specify some formatting strings for printing handles out of the handle database. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2126 fd59a12c-fef9-0310-b244-a6a79926bd2f --- include/corosync/hdb.h | 10 +++++++++- test/testconfdb.c | 8 ++++---- tools/corosync-objctl.c | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/corosync/hdb.h b/include/corosync/hdb.h index bf1d45d8..08bc20f8 100644 --- a/include/corosync/hdb.h +++ b/include/corosync/hdb.h @@ -41,8 +41,16 @@ #include #include #include +#include +#include -typedef unsigned long long hdb_handle_t; +typedef uint64_t hdb_handle_t; + +/* + * Formatting for string printing on 32/64 bit systems + */ +#define HDB_D_FORMAT "%"PRIu64 +#define HDB_X_FORMAT "%"PRIx64 enum HDB_HANDLE_STATE { HDB_HANDLE_STATE_EMPTY, diff --git a/test/testconfdb.c b/test/testconfdb.c index 874e0eed..f9a3daf6 100644 --- a/test/testconfdb.c +++ b/test/testconfdb.c @@ -71,7 +71,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object /* Show the keys */ res = confdb_key_iter_start(handle, parent_object_handle); if (res != CS_OK) { - printf( "error resetting key iterator for object %llu: %d\n", parent_object_handle, res); + printf( "error resetting key iterator for object "HDB_X_FORMAT": %d\n", parent_object_handle, res); return; } @@ -86,7 +86,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object /* Show sub-objects */ res = confdb_object_iter_start(handle, parent_object_handle); if (res != CS_OK) { - printf( "error resetting object iterator for object %llu: %d\n", parent_object_handle, res); + printf( "error resetting object iterator for object "HDB_X_FORMAT": %d\n", parent_object_handle, res); return; } @@ -95,14 +95,14 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object res = confdb_object_parent_get(handle, object_handle, &parent); if (res != CS_OK) { - printf( "error getting parent for object %lld: %d\n", object_handle, res); + printf( "error getting parent for object "HDB_X_FORMAT": %d\n", object_handle, res); return; } for (i=0; i