mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
some filesystem fixes (mostly remainder from blueswirl's -15)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@31 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -19,10 +19,15 @@
|
||||
|
||||
#ifdef FSYS_EXT2FS
|
||||
|
||||
#include "openbios/config.h"
|
||||
#include "shared.h"
|
||||
#include "filesys.h"
|
||||
#include <libc/byteorder.h>
|
||||
|
||||
#ifdef CONFIG_DEBUG_EXT2FS
|
||||
#define E2DEBUG
|
||||
#endif
|
||||
|
||||
static int mapblock1, mapblock2;
|
||||
|
||||
/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */
|
||||
|
||||
@@ -303,7 +303,7 @@ file_read( void *buf, unsigned long len )
|
||||
{
|
||||
if (filepos < 0 || filepos > filemax)
|
||||
filepos = filemax;
|
||||
if (len < 0 || len > filemax-filepos)
|
||||
if (len > filemax-filepos)
|
||||
len = filemax - filepos;
|
||||
errnum = 0;
|
||||
return curfs->fsys->read_func( buf, len );
|
||||
|
||||
@@ -158,10 +158,13 @@ typedef union RR_ptr {
|
||||
|
||||
#define RRMAGIC(c1, c2) ((c1)|(c2) << 8)
|
||||
|
||||
#define CHECK2(ptr, c1, c2) \
|
||||
(*(unsigned short *)(ptr) == (((c1) | (c2) << 8) & 0xFFFF))
|
||||
#define CHECK4(ptr, c1, c2, c3, c4) \
|
||||
(*(unsigned long *)(ptr) == ((c1) | (c2)<<8 | (c3)<<16 | (c4)<<24))
|
||||
#define CHECK2(ptr, c1, c2) \
|
||||
(*(ptr) == (c1) && *(ptr + 1) == (c2))
|
||||
#define CHECK4(ptr, c1, c2, c3, c4) \
|
||||
(*(unsigned char *)(ptr) == (c1) && \
|
||||
*((unsigned char *)(ptr) + 1) == (c2) && \
|
||||
*((unsigned char *)(ptr) + 2) == (c3) && \
|
||||
*((unsigned char *)(ptr) + 3) == (c4))
|
||||
|
||||
#endif /* !ASM_FILE */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user