[PVFS2-CVS]
commit by slang in pvfs2/src/common/misc: pvfs2-internal.h
mkspace.c mmap-ra-cache.c msgpairarray.sm pvfs2-util.c
server-config.c
CVS commit program
cvs at parl.clemson.edu
Fri Nov 11 16:31:02 EST 2005
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb:/tmp/cvs-serv32535/src/common/misc
Modified Files:
mkspace.c mmap-ra-cache.c msgpairarray.sm pvfs2-util.c
server-config.c
Added Files:
pvfs2-internal.h
Log Message:
moved the llu and lld macros to an internal header so that we don't have to include pvfs2-config.h in the installed pvfs2-types.h header.
--- /dev/null 2003-01-30 05:24:37.000000000 -0500
+++ pvfs2-internal.h 2005-11-11 16:31:02.000000000 -0500
@@ -0,0 +1,40 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+#ifndef PVFS2_INTERNAL_H
+#define PVFS2_INTERNAL_H
+
+#include "pvfs2-config.h"
+
+/* Printf wrappers for 32- and 64-bit compatibility. Imagine trying
+ * to print out a PVFS_handle, which is typedefed to a uint64_t. On
+ * a 32-bit machine, you use format "%llu", while a 64-bit machine wants
+ * the format "%lu", and each machine complains at the use of the opposite.
+ * This is only a problem on primitive types that are bigger than the
+ * smallest supported machine, i.e. bigger than 32 bits.
+ *
+ * Rather than changing the printf format string, which is the "right"
+ * thing to do, we instead cast the parameters to the printf(). But only
+ * on one of the architectures so the other one will complain if the format
+ * string really is incorrect.
+ *
+ * Here we choose 32-bit machines as the dominant type. If a format
+ * specifier and a parameter are mismatched, that machine will issue
+ * a warning, while 64-bit machines will silently perform the cast.
+ */
+#if SIZEOF_LONG_INT == 4
+# define llu(x) (x)
+# define lld(x) (x)
+# define SCANF_lld "%lld"
+#elif SIZEOF_LONG_INT == 8
+# define llu(x) (unsigned long long)(x)
+# define lld(x) (long long)(x)
+# define SCANF_lld "%ld"
+#else
+# error Unexpected sizeof(long int)
+#endif
+
+#endif /* PVFS2_INTERNAL_H */
Index: mkspace.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/mkspace.c,v
diff -p -u -r1.33 -r1.34
--- mkspace.c 10 Nov 2005 01:27:01 -0000 1.33
+++ mkspace.c 11 Nov 2005 21:31:02 -0000 1.34
@@ -22,6 +22,7 @@
#include "str-utils.h"
#include "extent-utils.h"
#include "pvfs2-util.h"
+#include "pvfs2-internal.h"
static char *dir_ent_string = "dir_ent";
static char *root_handle_string = "root_handle";
Index: mmap-ra-cache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/mmap-ra-cache.c,v
diff -p -u -r1.16 -r1.17
--- mmap-ra-cache.c 10 Nov 2005 01:27:01 -0000 1.16
+++ mmap-ra-cache.c 11 Nov 2005 21:31:02 -0000 1.17
@@ -16,6 +16,7 @@
#include "gossip.h"
#include "gen-locks.h"
#include "mmap-ra-cache.h"
+#include "pvfs2-internal.h"
static int hash_key(void *key, int table_size);
static int hash_key_compare(void *key, struct qlist_head *link);
Index: msgpairarray.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.sm,v
diff -p -u -r1.30 -r1.31
--- msgpairarray.sm 10 Nov 2005 01:27:01 -0000 1.30
+++ msgpairarray.sm 11 Nov 2005 21:31:02 -0000 1.31
@@ -43,6 +43,7 @@
#include "pvfs2-util.h"
#include "pint-util.h"
#include "server-config-mgr.h"
+#include "pvfs2-internal.h"
enum
{
Index: pvfs2-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pvfs2-util.c,v
diff -p -u -r1.82 -r1.83
--- pvfs2-util.c 10 Nov 2005 01:27:02 -0000 1.82
+++ pvfs2-util.c 11 Nov 2005 21:31:02 -0000 1.83
@@ -30,6 +30,7 @@
#include "gen-locks.h"
#include "realpath.h"
#include "pint-sysint-utils.h"
+#include "pvfs2-internal.h"
#ifdef HAVE_MNTENT_H
Index: server-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config.c,v
diff -p -u -r1.75 -r1.76
--- server-config.c 10 Nov 2005 01:27:02 -0000 1.75
+++ server-config.c 11 Nov 2005 21:31:02 -0000 1.76
@@ -24,6 +24,7 @@
#include "pint-distribution.h"
#include "pvfs2-config.h"
#include "pvfs2-server.h"
+#include "pvfs2-internal.h"
static DOTCONF_CB(get_pvfs_server_id);
static DOTCONF_CB(get_logstamp);
More information about the PVFS2-CVS
mailing list