summaryrefslogtreecommitdiffstats
path: root/fdisk/gpt.c
diff options
context:
space:
mode:
authorKarel Zak2007-12-17 13:26:38 +0100
committerKarel Zak2007-12-17 13:42:58 +0100
commit9eca9d0dd26eea526ea45647fd3c3085f008838b (patch)
treeb0a3826c6fb24f78660a8e533013ed163c5d7de3 /fdisk/gpt.c
parentinclude: add bitops.h with swab{16,32,64} macros (diff)
downloadkernel-qcow2-util-linux-9eca9d0dd26eea526ea45647fd3c3085f008838b.tar.gz
kernel-qcow2-util-linux-9eca9d0dd26eea526ea45647fd3c3085f008838b.tar.xz
kernel-qcow2-util-linux-9eca9d0dd26eea526ea45647fd3c3085f008838b.zip
fdisk: use swab macros from bitops.h
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisk/gpt.c')
-rw-r--r--fdisk/gpt.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/fdisk/gpt.c b/fdisk/gpt.c
index be7c0175a..2c96b0262 100644
--- a/fdisk/gpt.c
+++ b/fdisk/gpt.c
@@ -39,25 +39,7 @@
#include "gpt.h"
#include "blkdev.h"
-
-#define _GET_BYTE(x, n) ( ((x) >> (8 * (n))) & 0xff )
-
-#define _PED_SWAP64(x) ( (_GET_BYTE(x, 0) << 56) \
- + (_GET_BYTE(x, 1) << 48) \
- + (_GET_BYTE(x, 2) << 40) \
- + (_GET_BYTE(x, 3) << 32) \
- + (_GET_BYTE(x, 4) << 24) \
- + (_GET_BYTE(x, 5) << 16) \
- + (_GET_BYTE(x, 6) << 8) \
- + (_GET_BYTE(x, 7) << 0) )
-
-#define PED_SWAP64(x) ((uint64_t) _PED_SWAP64( (uint64_t) (x) ))
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define CPU_TO_LE64(x) (x)
-#else
-# define CPU_TO_LE64(x) PED_SWAP64(x)
-#endif
+#include "bitops.h"
#define GPT_HEADER_SIGNATURE 0x5452415020494645LL
#define GPT_PRIMARY_PARTITION_TABLE_LBA 1
@@ -211,7 +193,7 @@ gpt_check_signature(int fd, uint64_t lba)
if ((gpt = alloc_read_gpt_header(fd, lba)))
{
- if (gpt->Signature == CPU_TO_LE64(GPT_HEADER_SIGNATURE))
+ if (gpt->Signature == cpu_to_le64(GPT_HEADER_SIGNATURE))
res = 1;
free(gpt);
}