This patch converts hdb_handle_t from unsigned long long to uint64_t and
provides a decimal and hex formatter for portability between 32/64 bit
operating systems.
To print out hdbs, you now do:
printf ("handle is "HDB_X_FORMAT" woohoo\n", handle);
Regards
-steve
Index: test/testconfdb.c
===================================================================
--- test/testconfdb.c (revision 2125)
+++ test/testconfdb.c (working copy)
@@ -71,7 +71,7 @@
/* 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 @@
/* 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 @@
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<depth; i++) printf(" ");
object_name[object_name_len] = '\0';
- printf("OBJECT: %s (%llu, parent: %llu)\n", object_name, object_handle, parent);
+ printf("OBJECT: %s ("HDB_X_FORMAT", parent: "HDB_X_FORMAT")\n", object_name, object_handle, parent);
/* Down we go ... */
print_config_tree(handle, object_handle, depth+1);
Index: include/corosync/hdb.h
===================================================================
--- include/corosync/hdb.h (revision 2125)
+++ include/corosync/hdb.h (working copy)
@@ -41,9 +41,17 @@
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
+#include <stdint.h>
+#include <inttypes.h>
-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,
HDB_HANDLE_STATE_PENDINGREMOVAL,
Index: tools/corosync-objctl.c
===================================================================
--- tools/corosync-objctl.c (revision 2125)
+++ tools/corosync-objctl.c (working copy)
@@ -114,7 +114,7 @@
/* Show the keys */
res = confdb_key_iter_start(handle, parent_object_handle);
if (res != CS_OK) {
- fprintf(stderr, "error resetting key iterator for object %llu: %d\n", parent_object_handle, res);
+ fprintf(stderr, "error resetting key iterator for object "HDB_X_FORMAT" %d\n", parent_object_handle, res);
exit(EXIT_FAILURE);
}
children_printed = 0;
@@ -138,7 +138,7 @@
/* Show sub-objects */
res = confdb_object_iter_start(handle, parent_object_handle);
if (res != CS_OK) {
- fprintf(stderr, "error resetting object iterator for object %llu: %d\n", parent_object_handle, res);
+ fprintf(stderr, "error resetting object iterator for object "HDB_X_FORMAT" %d\n", parent_object_handle, res);
exit(EXIT_FAILURE);
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais