dosfstools/dosfstools-2.11-unaligned.patch

33 lines
871 B
Diff
Raw Normal View History

--- dosfsck/boot.c
+++ dosfsck/boot.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
+#include <asm/unaligned.h>
#include "common.h"
#include "dosfsck.h"
@@ -35,18 +36,11 @@ static struct {
{ 0xff, "5.25\" 320k floppy 2s/40tr/8sec" },
};
-#if defined __alpha || defined __ia64__ || defined __s390x__ || defined __x86_64__ || defined __ppc64__
-/* Unaligned fields must first be copied byte-wise */
-#define GET_UNALIGNED_W(f) \
- ({ \
- unsigned short __v; \
- memcpy( &__v, &f, sizeof(__v) ); \
- CF_LE_W( *(unsigned short *)&f ); \
- })
-#else
-#define GET_UNALIGNED_W(f) CF_LE_W( *(unsigned short *)&f )
+#ifndef get_unaligned
+#define get_unaligned(ptr) (*(ptr))
#endif
+#define GET_UNALIGNED_W(f) CF_LE_W( get_unaligned ((unsigned short *)&f))
static char *get_media_descr( unsigned char media )
{