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:
Stefan Reinauer
2006-05-24 11:10:55 +00:00
parent 8f49c10b5f
commit 2e863bf2ce
4 changed files with 14 additions and 6 deletions

View File

@@ -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) */

View File

@@ -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 );

View File

@@ -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 */