Author: Pavel Roskin <proski@gnu.org>

Rewrite hfs_get_ushort() and hfs_get_uint() as inline functions so that
their arguments are checked.  Use __be16_to_cpu and __be32_to_cpu to
byte-swap the result as needed.



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@549 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Laurent Vivier
2009-08-11 20:31:50 +00:00
parent 6271aeb3ee
commit 95c05fe1ff

View File

@@ -15,12 +15,21 @@
#ifndef _H_HFS_MDB
#define _H_HFS_MDB
#include "libc/byteorder.h"
typedef unsigned char hfs_char_t;
typedef unsigned char hfs_ushort_t[2];
typedef unsigned char hfs_uint_t[4];
#define hfs_get_ushort(addr) (*((unsigned short*)(addr)))
#define hfs_get_uint(addr) (*((unsigned int*)(addr)))
static inline unsigned short hfs_get_ushort(hfs_ushort_t addr)
{
return __be16_to_cpu(*((unsigned short *)(addr)));
}
static inline unsigned int hfs_get_uint(hfs_uint_t addr)
{
return __be32_to_cpu(*((unsigned int *)(addr)));
}
/*
* The HFS Master Directory Block (MDB).