typedef long long afs_int64;
typedef unsigned long long afs_uint64;
#endif
-#define ZeroInt64(a) (a = 0)
+#define ZeroInt64(a) ((a) = 0)
#define AssignInt64(a, b) *(b) = (a)
-#define IncInt64(a) (*(a))++
-#define IncUInt64(a) (*(a))++
-#define DecInt64(a) (*(a))--
-#define DecUInt64(a) (*(a))--
+#define IncInt64(a) ((*(a))++)
+#define IncUInt64(a) ((*(a))++)
+#define DecInt64(a) ((*(a))--)
+#define DecUInt64(a) ((*(a))--)
#define GTInt64(a,b) ((a) > (b))
#define GEInt64(a,b) ((a) >= (b))
#define LEInt64(a,b) ((a) <= (b))
#define AddUInt64(a,b,c) *(c) = (afs_uint64)(a) + (afs_uint64)(b)
#define SubtractInt64(a,b,c) *(c) = (afs_int64)(a) - (afs_int64)(b)
#define SubtractUInt64(a,b,c) *(c) = (afs_uint64)(a) - (afs_uint64)(b)
-#define CompareInt64(a,b) (afs_int64)(a) - (afs_int64)(b)
-#define CompareUInt64(a,b) (afs_uint64)(a) - (afs_uint64)(b)
+#define CompareInt64(a,b) ((afs_int64)(a) - (afs_int64)(b))
+#define CompareUInt64(a,b) ((afs_uint64)(a) - (afs_uint64)(b))
#define NonZeroInt64(a) (a)
-#define Int64ToInt32(a) (a) & MAX_AFS_UINT32
-#define FillInt64(t,h,l) (t) = ((afs_int64)(h) << 32) | (l);
-#define SplitInt64(t,h,l) (h) = ((afs_int64)t) >> 32; (l) = (t) & MAX_AFS_UINT32;
-#define RoundInt64ToInt32(a) (a > MAX_AFS_UINT32) ? MAX_AFS_UINT32 : a;
-#define RoundInt64ToInt31(a) (a > MAX_AFS_INT32) ? MAX_AFS_INT32 : a;
+#ifndef HAVE_INT64TOINT32
+#define Int64ToInt32(a) ((a) & MAX_AFS_UINT32)
+#endif
+#define FillInt64(t,h,l) (t) = ((afs_int64)(h) << 32) | (l)
+#define SplitInt64(t,h,l) (h) = ((afs_int64)(t)) >> 32; (l) = (t) & MAX_AFS_UINT32
+#define RoundInt64ToInt32(a) (((a) > MAX_AFS_UINT32) ? MAX_AFS_UINT32 : (a))
+#define RoundInt64ToInt31(a) (((a) > MAX_AFS_INT32) ? MAX_AFS_INT32 : (a))
#ifdef AFS_64BIT_CLIENT
typedef afs_int64 afs_size_t;
* some assistence in this matter. The hyper type is supposed to be compatible
* with the afsHyper type: the same macros will work on both. */
-#if 0
-
-typedef unsigned long afs_hyper_t;
-
-#define hcmp(a,b) ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0))
-#define hsame(a,b) ((a) == (b))
-#define hiszero(a) ((a) == 0)
-#define hfitsin32(a) ((a) & 0xffffffff00000000) == 0)
-#define hset(a,b) ((a) = (b))
-#define hzero(a) ((a) = 0)
-#define hones(a) ((a) = ~((unsigned long)0))
-#define hget32(i,a) ((i) = (unsigned int)(a))
-#define hget64(hi,lo,a) ((lo) = ((unsigned int)(a)), (hi) = ((a) & (0xffffffff00000000)))
-#define hset32(a,i) ((a) = ((unsigned int)(i)))
-#define hset64(a,hi,lo) ((a) = (((hi) << 32) | (lo)))
-#define hgetlo(a) ((a) & 0xffffffff)
-#define hgethi(a) (((unsigned int)(a)) >> 32)
-#define hadd(a,b) ((a) += (b))
-/* XXX */
-#define hadd32(a,b) ((a) += (b))
-#define hshlft(a,n) ((a)<<(n))
-
-#else /* 0*/
-
typedef struct afs_hyper_t { /* unsigned 64 bit integers */
unsigned int high;
unsigned int low;
} else if ((n) >= 2*s) { /*Shift off all bits*/ \
(a).high = (a).low = 0; \
} else if ((n) < s) { /*Part of low shifted into high*/ \
- (a).high = ((a).high<<(n)) | (((a).low>>(s-(n))) & (1<<(n))-1); \
+ (a).high = ((a).high<<(n)) | (((a).low>>(s-(n))) & ((1<<(n))-1)); \
(a).low = (a).low << (n); \
} else if ((n) >= s) { /*All of low shifted into high plus some*/ \
(a).high = (a).low << ((n)-s); \
(a).low += (int)(i))
#define hadd(a,b) (hadd32(a,(b).low), (a).high += (b).high)
-#endif /* 0 */
#if !defined(KERNEL) || defined(UKERNEL)
#ifndef AFS_NT40_ENV
#define AFS_DEMAND_ATTACH_FS 1
#endif
+#if defined(BUILD_RXGK) && defined(AFS_PTHREAD_ENV) && !defined(KERNEL)
+/* Only build GSS bits of code on non-kernel pthread builds */
+# define AFS_RXGK_GSS_ENV 1
+#endif
+
+#if defined(ENABLE_RXGK) && !defined(UKERNEL) && (defined(AFS_PTHREAD_ENV) || defined(KERNEL))
+/* Only enable RXGK bits for userspace pthread or non-ukernel kernel code */
+# define AFS_RXGK_ENV 1
+#endif
+
/* A macro that can be used when printf'ing 64 bit integers, as Unix and
* windows use a different format string
*/
#ifdef AFS_NT40_ENV
# define AFS_INT64_FMT "I64d"
# define AFS_UINT64_FMT "I64u"
-# define AFS_PTR_FMT "p"
# define AFS_SIZET_FMT "Iu"
#else
# define AFS_INT64_FMT "lld"
# define AFS_UINT64_FMT "llu"
-# define AFS_PTR_FMT "p"
# ifdef PRINTF_TAKES_Z_LEN
# define AFS_SIZET_FMT "zu"
# else
# define AFS_SIZET_FMT "lu"
# endif /* PRINTF_TAKES_Z_LEN */
#endif /* AFS_NT40_ENV */
+#define AFS_VOLID_FMT "lu"
/* Functions to safely cast afs_int32 and afs_uint32 so they can be used in
* printf statemements with %ld and %lu
#elif defined(AFS_SGI_ENV) || defined(AFS_USR_SGI_ENV)
#define static_inline static
#define hdr_static_inline(x) x
-#elif defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV)
+#elif defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV) \
+ && defined(HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE)
#define static_inline static __inline __attribute__((always_inline))
#define hdr_static_inline(x) static __inline __attribute__((always_inline)) x
#else
hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return (unsigned long) d; }
+hdr_static_inline(long long) afs_printable_int64_ld(afs_int64 d) { return (long long) d; }
+
+hdr_static_inline(unsigned long long) afs_printable_uint64_lu(afs_uint64 d) { return (unsigned long long) d; }
+
#ifdef AFS_64BITUSERPOINTER_ENV
#define afs_pointer_to_int(p) ((afs_uint32) (afs_uint64) (p))
#define afs_int_to_pointer(i) ((void *) (afs_uint64) (i))
#define afs_int_to_pointer(i) ((void *) (i))
#endif
-#if defined(__GNUC__) && __GNUC__ > 2
-#define AFS_UNUSED __attribute__((unused))
-#define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y)))
-#define AFS_NORETURN __attribute__((__noreturn__))
-#elif defined (__clang__)
-#define AFS_UNUSED __attribute__((unused))
-#define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y)))
-#define AFS_NORETURN __attribute__((__noreturn__))
+#ifdef HAVE_FUNC_ATTRIBUTE_UNUSED
+# define AFS_UNUSED __attribute__((unused))
+#else
+# define AFS_UNUSED
+#endif
+
+#ifdef HAVE_FUNC_ATTRIBUTE_FORMAT
+# define AFS_ATTRIBUTE_FORMAT(style,x,y) __attribute__((format(style, x, y)))
+#else
+# define AFS_ATTRIBUTE_FORMAT(style,x,y)
+#endif
+
+#ifdef HAVE_FUNC_ATTRIBUTE_NORETURN
+# define AFS_NORETURN __attribute__((__noreturn__))
+#else
+# define AFS_NORETURN
+#endif
+
+#ifdef HAVE_FUNC_ATTRIBUTE_NONNULL
+# define AFS_NONNULL(x) __attribute__((__nonnull__ x))
+#else
+# define AFS_NONNULL(x)
+#endif
+
+#if defined(AFS_LINUX26_ENV) && defined(fallthrough)
+# define AFS_FALLTHROUGH fallthrough
+#elif defined(HAVE_FUNC_ATTRIBUTE_FALLTHROUGH)
+# define AFS_FALLTHROUGH __attribute__((fallthrough))
+#else
+# define AFS_FALLTHROUGH do {} while(0)
+#endif
+
+/*
+ * Conditionally remove unreached statements under Solaris Studio.
+ */
+#if defined(__SUNPRO_C)
+# define AFS_UNREACHED(x)
#else
-#define AFS_UNUSED
-#define AFS_ATTRIBUTE_FORMAT(style,x,y)
-#define AFS_NORETURN
+# define AFS_UNREACHED(x) x
#endif
#endif /* OPENAFS_CONFIG_AFS_STDS_H */