[patch] samba4 - byteorder.h tweaks

Brad Hards bradh at frogmouth.net
Sun Jul 20 02:25:05 GMT 2008


G'day,

When compiling the Akonadi resource for openchange, which relies on samba4, I 
get this:
In file included from /usr/local/samba/include/util.h:46,
                 from /usr/local/samba/include/ndr.h:29,
                 from /usr/local/samba/include/dcerpc.h:32,
                 from /usr/local/samba/include/libmapi/libmapi.h:46,
/usr/local/samba/include/util/byteorder.h:150:5: warning: "HAVE_ASM_BYTEORDER" 
is not defined

util/byteorder.h line 150 looks like this:
#if HAVE_ASM_BYTEORDER

I'm assuming that users of samba4 libdcerpc don't need to set 
HAVE_ASM_BYTEORDER themselves, but rather that it is meant to be determined 
by other pre-processor symbols. In the current implementation: 
#if (defined(__powerpc__) && defined(__GNUC__))
....
#define HAVE_ASM_BYTEORDER 1
#endif

There are two potential solutions I can see - either make sure 
HAVE_ASM_BYTEORDER is always defined (which is what the patch below does), or 
use
#if defined(HAVE_ASM_BYTEORDER)
or 
#ifdef HAVE_ASM_BYTEORDER

I'm not sure which convention samba4 adopts, and I'm not fussed which way, I 
just want my KDE compilation to look nicer :-)

The patch below also makes a cosmetic fix to a the comments explaining the 
code, which I found a bit confusing. I'm not worried about that part - commit 
or omit as desired.

Brad

--- /usr/local/samba/include/util/byteorder.h   2008-07-19 20:34:56.000000000 
+1000
+++ byteorder.h 2008-07-20 12:01:59.000000000 +1000
@@ -126,6 +126,8 @@
        __asm__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
 }
 #define HAVE_ASM_BYTEORDER 1
+#else
+#define HAVE_ASM_BYTEORDER 0
 #endif


@@ -172,7 +174,7 @@
 #define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16_t)(val)))
 #define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32_t)(val)))

-#else /* CAREFUL_ALIGNMENT */
+#else /* not CAREFUL_ALIGNMENT */

 /* this handles things for architectures like the 386 that can handle
    alignment errors */
@@ -197,7 +199,7 @@
 #define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((int16_t)(val))
 #define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((int32_t)(val))

-#endif /* CAREFUL_ALIGNMENT */
+#endif /* not CAREFUL_ALIGNMENT */

 /* now the reverse routines - these are used in nmb packets (mostly) */
 #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))


More information about the samba-technical mailing list