mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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:
13
fs/hfs_mdb.h
13
fs/hfs_mdb.h
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user