Skip to content

Commit

Permalink
endian-fixes-20060802
Browse files Browse the repository at this point in the history
macos needs us to do weird stuff so -arch i386 -arch ppc works
  • Loading branch information
Derrick Brashear committed Aug 2, 2006
1 parent 62e6fc3 commit fd099b3
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 42 deletions.
27 changes: 21 additions & 6 deletions acconfig.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,15 +8,30 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
#undef HAVE_RES_SEARCH #undef HAVE_RES_SEARCH
#undef HAVE_SOCKET #undef HAVE_SOCKET
#undef STRUCT_SOCKADDR_HAS_SA_LEN #undef STRUCT_SOCKADDR_HAS_SA_LEN
#if ENDIANESS_IN_SYS_PARAM_H #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
# ifndef KERNEL # if ENDIANESS_IN_SYS_PARAM_H
# include <sys/types.h> # ifndef KERNEL
# include <sys/param.h> # include <sys/types.h>
# if BYTE_ORDER == BIG_ENDIAN # include <sys/param.h>
# define WORDS_BIGENDIAN 1 # if BYTE_ORDER == BIG_ENDIAN
# define WORDS_BIGENDIAN 1
# endif
# endif
# else
# if defined(AUTOCONF_FOUND_BIGENDIAN)
# define WORDS_BIGENDIAN 1
# else
# undef WORDS_BIGENDIAN
# endif # endif
# endif # endif
#else
#if defined(__BIG_ENDIAN__)
#define WORDS_BIGENDIAN 1
#else
#undef WORDS_BIGENDIAN
#endif
#endif #endif

#undef AFS_AFSDB_ENV #undef AFS_AFSDB_ENV
#undef AFS_LARGEFILE_ENV #undef AFS_LARGEFILE_ENV
#undef AFS_NAMEI_ENV #undef AFS_NAMEI_ENV
Expand Down
4 changes: 2 additions & 2 deletions configure.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ src/kauth/test/Makefile \
src/kopenafs/Makefile \ src/kopenafs/Makefile \
src/libacl/Makefile \ src/libacl/Makefile \
src/libacl/test/Makefile \ src/libacl/test/Makefile \
src/libadmin/adminutil/Makefile \
src/libadmin/Makefile \ src/libadmin/Makefile \
src/libadmin/adminutil/Makefile \
src/libadmin/bos/Makefile \ src/libadmin/bos/Makefile \
src/libadmin/cfg/Makefile \ src/libadmin/cfg/Makefile \
src/libadmin/cfg/test/Makefile \ src/libadmin/cfg/test/Makefile \
Expand Down Expand Up @@ -106,8 +106,8 @@ src/tviced/Makefile \
src/tvolser/Makefile \ src/tvolser/Makefile \
src/ubik/Makefile \ src/ubik/Makefile \
src/update/Makefile \ src/update/Makefile \
src/usd/test/Makefile \
src/usd/Makefile \ src/usd/Makefile \
src/usd/test/Makefile \
src/uss/Makefile \ src/uss/Makefile \
src/util/Makefile \ src/util/Makefile \
src/util/test/Makefile \ src/util/test/Makefile \
Expand Down
8 changes: 4 additions & 4 deletions src/afs/afs_icl.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
ICL_APPENDINT32(logp, ICL_APPENDINT32(logp,
(afs_int32) ((struct afs_hyper_t *)p1)->low); (afs_int32) ((struct afs_hyper_t *)p1)->low);
} else if (t1 == ICL_TYPE_INT64) { } else if (t1 == ICL_TYPE_INT64) {
#ifdef AFSLITTLE_ENDIAN #ifndef WORDS_BIGENDIAN
#ifdef AFS_64BIT_CLIENT #ifdef AFS_64BIT_CLIENT
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[1]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[1]);
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[0]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p1)[0]);
Expand Down Expand Up @@ -660,7 +660,7 @@ afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
ICL_APPENDINT32(logp, ICL_APPENDINT32(logp,
(afs_int32) ((struct afs_hyper_t *)p2)->low); (afs_int32) ((struct afs_hyper_t *)p2)->low);
} else if (t2 == ICL_TYPE_INT64) { } else if (t2 == ICL_TYPE_INT64) {
#ifdef AFSLITTLE_ENDIAN #ifndef WORDS_BIGENDIAN
#ifdef AFS_64BIT_CLIENT #ifdef AFS_64BIT_CLIENT
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[1]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[1]);
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[0]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p2)[0]);
Expand Down Expand Up @@ -700,7 +700,7 @@ afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
ICL_APPENDINT32(logp, ICL_APPENDINT32(logp,
(afs_int32) ((struct afs_hyper_t *)p3)->low); (afs_int32) ((struct afs_hyper_t *)p3)->low);
} else if (t3 == ICL_TYPE_INT64) { } else if (t3 == ICL_TYPE_INT64) {
#ifdef AFSLITTLE_ENDIAN #ifndef WORDS_BIGENDIAN
#ifdef AFS_64BIT_CLIENT #ifdef AFS_64BIT_CLIENT
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[1]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[1]);
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[0]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p3)[0]);
Expand Down Expand Up @@ -740,7 +740,7 @@ afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op,
ICL_APPENDINT32(logp, ICL_APPENDINT32(logp,
(afs_int32) ((struct afs_hyper_t *)p4)->low); (afs_int32) ((struct afs_hyper_t *)p4)->low);
} else if (t4 == ICL_TYPE_INT64) { } else if (t4 == ICL_TYPE_INT64) {
#ifdef AFSLITTLE_ENDIAN #ifndef WORDS_BIGENDIAN
#ifdef AFS_64BIT_CLIENT #ifdef AFS_64BIT_CLIENT
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[1]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[1]);
ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[0]); ICL_APPENDINT32(logp, (afs_int32) ((afs_int32 *) p4)[0]);
Expand Down
15 changes: 5 additions & 10 deletions src/afs/afs_md5.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@


RCSID("$Id$"); RCSID("$Id$");


#undef WORDS_BIGENDIAN
#ifdef AFSBIG_ENDIAN
#define WORDS_BIGENDIAN 1
#endif

#include "afs_md5.h" #include "afs_md5.h"


#define A m->counter[0] #define A m->counter[0]
Expand Down Expand Up @@ -224,13 +219,13 @@ AFS_MD5_Update(struct afs_md5 *m, const void *v, size_t len)
if (offset == 64) { if (offset == 64) {
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
int i; int i;
afs_uint32 current[16]; afs_uint32 cur[16];
struct x32 *u = (struct x32 *)m->save; struct x32 *ui = (struct x32 *)m->save;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
current[2 * i + 0] = swap_afs_uint32(u[i].a); cur[2 * i + 0] = swap_afs_uint32(ui[i].a);
current[2 * i + 1] = swap_afs_uint32(u[i].b); cur[2 * i + 1] = swap_afs_uint32(ui[i].b);
} }
calc(m, current); calc(m, cur);
#else #else
calc(m, (afs_uint32 *) m->save); calc(m, (afs_uint32 *) m->save);
#endif #endif
Expand Down
4 changes: 2 additions & 2 deletions src/afs/afs_util.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ calc (struct afs_md5 *m, afs_uint32 *data)
* From `Performance analysis of MD5' by Joseph D. Touch <touch@isi.edu> * From `Performance analysis of MD5' by Joseph D. Touch <touch@isi.edu>
*/ */


#if defined(AFSBIG_ENDIAN) #if defined(WORDS_BIGENDIAN)
static inline afs_uint32 static inline afs_uint32
swap_u_int32_t (afs_uint32 t) swap_u_int32_t (afs_uint32 t)
{ {
Expand Down Expand Up @@ -599,7 +599,7 @@ AFS_MD5_Update (struct afs_md5 *m, const void *v, size_t len)
p += l; p += l;
len -= l; len -= l;
if(offset == 64){ if(offset == 64){
#if defined(AFSBIG_ENDIAN) #if defined(WORDS_BIGENDIAN)
int i; int i;
afs_uint32 temp[16]; afs_uint32 temp[16];
struct x32 *us = (struct x32*)m->save; struct x32 *us = (struct x32*)m->save;
Expand Down
2 changes: 1 addition & 1 deletion src/cf/bigendian.m4
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ AC_CACHE_CHECK(whether byte ordering is bigendian, openafs_cv_c_bigendian,[
fi fi
]) ])
if test "$openafs_cv_c_bigendian" = "yes"; then if test "$openafs_cv_c_bigendian" = "yes"; then
AC_DEFINE(WORDS_BIGENDIAN, 1, [define if target is big endian])dnl AC_DEFINE(AUTOCONF_FOUND_BIGENDIAN, 1, [define if target is big endian])dnl
fi fi
if test "$openafs_cv_c_bigendian_compile" = "yes"; then if test "$openafs_cv_c_bigendian_compile" = "yes"; then
AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness])dnl AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness])dnl
Expand Down
5 changes: 0 additions & 5 deletions src/rxkad/bg-fcrypt.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ RCSID
#include "private_data.h" #include "private_data.h"
#include <des/stats.h> #include <des/stats.h>


#undef WORDS_BIGENDIAN
#ifdef AFSBIG_ENDIAN
#define WORDS_BIGENDIAN 1
#endif

/* /*
* Unrolling of the inner loops helps the most on pentium chips * Unrolling of the inner loops helps the most on pentium chips
* (ca 18%). On risc machines only expect a modest improvement (ca 5%). * (ca 18%). On risc machines only expect a modest improvement (ca 5%).
Expand Down
2 changes: 1 addition & 1 deletion src/rxkad/domestic/fcrypt.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fc_ecb_encrypt(void * clear, void * cipher,
volatile unsigned char *Schar = (unsigned char *)&S; volatile unsigned char *Schar = (unsigned char *)&S;
int i; int i;


#if defined(vax) || (defined(mips) && defined(MIPSEL)) || defined(AFSLITTLE_ENDIAN) #ifndef WORDS_BIGENDIAN
#define Byte0 3 #define Byte0 3
#define Byte1 2 #define Byte1 2
#define Byte2 1 #define Byte2 1
Expand Down
8 changes: 4 additions & 4 deletions src/rxkad/md4.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@


RCSID("$Id$"); RCSID("$Id$");


#undef WORDS_BIGENDIAN
#ifdef AFSBIG_ENDIAN
#define WORDS_BIGENDIAN 1
#endif


#include "md4.h" #include "md4.h"
#include "hash.h" #include "hash.h"
Expand Down
8 changes: 4 additions & 4 deletions src/rxkad/md5.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@


RCSID("$Id$"); RCSID("$Id$");


#undef WORDS_BIGENDIAN
#ifdef AFSBIG_ENDIAN
#define WORDS_BIGENDIAN 1
#endif


#include "md5.h" #include "md5.h"
#include "hash.h" #include "hash.h"
Expand Down
4 changes: 2 additions & 2 deletions src/tviced/serialize_state.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ fs_stateFillHeader(struct fs_state_header * hdr)
hdr->timestamp = FT_ApproxTime(); hdr->timestamp = FT_ApproxTime();
hdr->server_uuid = FS_HostUUID; hdr->server_uuid = FS_HostUUID;
hdr->valid = 1; hdr->valid = 1;
#ifdef AFSBIG_ENDIAN #ifdef WORDS_BIGENDIAN
hdr->endianness = 1; hdr->endianness = 1;
#else #else
hdr->endianness = 0; hdr->endianness = 0;
Expand All @@ -1016,7 +1016,7 @@ fs_stateCheckHeader(struct fs_state_header * hdr)
ViceLog(0, ("fs_stateCheckHeader: dump was previously flagged invalid\n")); ViceLog(0, ("fs_stateCheckHeader: dump was previously flagged invalid\n"));
ret = 1; ret = 1;
} }
#ifdef AFSBIG_ENDIAN #ifdef WORDS_BIGENDIAN
else if (!hdr->endianness) { else if (!hdr->endianness) {
ViceLog(0, ("fs_stateCheckHeader: wrong endianness\n")); ViceLog(0, ("fs_stateCheckHeader: wrong endianness\n"));
ret = 1; ret = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/venus/kdump.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ typedef struct timeval {
int tv_usec; int tv_usec;
} timeval_t; /* Needed here since KERNEL defined. */ } timeval_t; /* Needed here since KERNEL defined. */
#endif /*AFS_ALPHA_LINUX20_ENV */ #endif /*AFS_ALPHA_LINUX20_ENV */
#if defined(AFSBIG_ENDIAN) #if defined(WORDS_BIGENDIAN)
#define _LINUX_BYTEORDER_BIG_ENDIAN_H #define _LINUX_BYTEORDER_BIG_ENDIAN_H
#else #else
#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
Expand Down

0 comments on commit fd099b3

Please sign in to comment.