mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Reduce warnings by 29%
git-svn-id: svn://coreboot.org/openbios/openbios-devel@273 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -308,7 +308,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
|
|||||||
Elf_phdr *phdr = NULL;
|
Elf_phdr *phdr = NULL;
|
||||||
unsigned long phdr_size;
|
unsigned long phdr_size;
|
||||||
unsigned long checksum_offset;
|
unsigned long checksum_offset;
|
||||||
unsigned short checksum;
|
unsigned short checksum = 0;
|
||||||
Elf_Bhdr *boot_notes = NULL;
|
Elf_Bhdr *boot_notes = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int image_retval;
|
int image_retval;
|
||||||
|
|||||||
@@ -265,9 +265,9 @@ static void obp_reboot(char *str)
|
|||||||
for (;;) {}
|
for (;;) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern volatile unsigned char *power_reg;
|
||||||
static void obp_abort(void)
|
static void obp_abort(void)
|
||||||
{
|
{
|
||||||
extern volatile unsigned char *power_reg;
|
|
||||||
|
|
||||||
printk("abort, power off\n");
|
printk("abort, power off\n");
|
||||||
*power_reg = 1;
|
*power_reg = 1;
|
||||||
@@ -277,8 +277,6 @@ static void obp_abort(void)
|
|||||||
|
|
||||||
static void obp_halt(void)
|
static void obp_halt(void)
|
||||||
{
|
{
|
||||||
extern volatile unsigned char *power_reg;
|
|
||||||
|
|
||||||
printk("halt, power off\n");
|
printk("halt, power off\n");
|
||||||
*power_reg = 1;
|
*power_reg = 1;
|
||||||
printk("power off failed\n");
|
printk("power off failed\n");
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
|
|||||||
Elf_phdr *phdr = NULL;
|
Elf_phdr *phdr = NULL;
|
||||||
unsigned long phdr_size;
|
unsigned long phdr_size;
|
||||||
unsigned long checksum_offset;
|
unsigned long checksum_offset;
|
||||||
unsigned short checksum;
|
unsigned short checksum = 0;
|
||||||
Elf_Bhdr *boot_notes = NULL;
|
Elf_Bhdr *boot_notes = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int image_retval;
|
int image_retval;
|
||||||
|
|||||||
@@ -58,14 +58,12 @@ struct hwdef {
|
|||||||
|
|
||||||
static const struct hwdef hwdefs[] = {
|
static const struct hwdef hwdefs[] = {
|
||||||
{
|
{
|
||||||
.pci.cfg_addr = PCI_CONFIG,
|
.pci = {
|
||||||
.pci.cfg_data = 0,
|
.cfg_addr = PCI_CONFIG,
|
||||||
.pci.cfg_base = 0x80000000ULL,
|
.cfg_data = 0,
|
||||||
.pci.cfg_len = 0,
|
.cfg_base = 0x80000000ULL,
|
||||||
.pci.mem_base = 0,
|
.cfg_len = 0,
|
||||||
.pci.mem_len = 0,
|
},
|
||||||
.pci.io_base = 0,
|
|
||||||
.pci.io_len = 0,
|
|
||||||
.machine_id_low = 0,
|
.machine_id_low = 0,
|
||||||
.machine_id_high = 255,
|
.machine_id_high = 255,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ static void show_floppy(void);
|
|||||||
static void floppy_reset(void);
|
static void floppy_reset(void);
|
||||||
|
|
||||||
|
|
||||||
static int set_dor(int fdc, char mask, char data)
|
static int set_dor(char mask, char data)
|
||||||
{
|
{
|
||||||
unsigned char newdor,olddor;
|
unsigned char newdor,olddor;
|
||||||
|
|
||||||
@@ -236,15 +236,6 @@ static int set_dor(int fdc, char mask, char data)
|
|||||||
return olddor;
|
return olddor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void bounce_motor(void)
|
|
||||||
{
|
|
||||||
/* Bounce the drive motor... */
|
|
||||||
outb(fdc_state.dor & ~(0x10<<FD_DRIVE), FD_DOR);
|
|
||||||
outb(fdc_state.dor, FD_DOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* waits until the fdc becomes ready */
|
/* waits until the fdc becomes ready */
|
||||||
static int wait_til_ready(void)
|
static int wait_til_ready(void)
|
||||||
{
|
{
|
||||||
@@ -408,7 +399,7 @@ static void set_drive(int drive)
|
|||||||
#endif
|
#endif
|
||||||
new_dor |= (1 << (drive + 4)); /* Spinup the selected drive */
|
new_dor |= (1 << (drive + 4)); /* Spinup the selected drive */
|
||||||
new_dor |= drive; /* Select the drive for commands as well */
|
new_dor |= drive; /* Select the drive for commands as well */
|
||||||
set_dor(fdc, 0xc, new_dor);
|
set_dor(0xc, new_dor);
|
||||||
|
|
||||||
mdelay(DRIVE_H1440_SPINUP);
|
mdelay(DRIVE_H1440_SPINUP);
|
||||||
|
|
||||||
@@ -432,7 +423,7 @@ static void floppy_motor_off(int drive)
|
|||||||
mask = 0xff;
|
mask = 0xff;
|
||||||
mask &= ~(1 << (drive +4));
|
mask &= ~(1 << (drive +4));
|
||||||
/* Now clear the bit in the Digital Output Register */
|
/* Now clear the bit in the Digital Output Register */
|
||||||
set_dor(0, mask, 0);
|
set_dor(mask, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the FDC's data transfer rate on behalf of the specified drive.
|
/* Set the FDC's data transfer rate on behalf of the specified drive.
|
||||||
@@ -523,7 +514,6 @@ static void fdc_specify(
|
|||||||
case 1:
|
case 1:
|
||||||
dtr = 300;
|
dtr = 300;
|
||||||
if (fdc_state.version >= FDC_82078) {
|
if (fdc_state.version >= FDC_82078) {
|
||||||
unsigned char cmd[3];
|
|
||||||
/* chose the default rate table, not the one
|
/* chose the default rate table, not the one
|
||||||
* where 1 = 2 Mbps */
|
* where 1 = 2 Mbps */
|
||||||
cmd[0] = FD_DRIVESPEC;
|
cmd[0] = FD_DRIVESPEC;
|
||||||
@@ -553,9 +543,6 @@ static void fdc_specify(
|
|||||||
if (srt > 0xf) {
|
if (srt > 0xf) {
|
||||||
srt = 0xf;
|
srt = 0xf;
|
||||||
}
|
}
|
||||||
if (srt < 0 ) {
|
|
||||||
srt = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
hlt = (head_load_time*scale_dtr/2 + NOMINAL_DTR - 1)/NOMINAL_DTR;
|
hlt = (head_load_time*scale_dtr/2 + NOMINAL_DTR - 1)/NOMINAL_DTR;
|
||||||
if (hlt < 0x01)
|
if (hlt < 0x01)
|
||||||
@@ -726,7 +713,6 @@ static int floppy_seek(unsigned track)
|
|||||||
if (success)
|
if (success)
|
||||||
drive_state[FD_DRIVE].track = track;
|
drive_state[FD_DRIVE].track = track;
|
||||||
else {
|
else {
|
||||||
int i;
|
|
||||||
printk_debug("seek failed\n");
|
printk_debug("seek failed\n");
|
||||||
printk_debug("nr = %d\n", nr);
|
printk_debug("nr = %d\n", nr);
|
||||||
printk_debug("ST0 = %02x\n", reply[0]);
|
printk_debug("ST0 = %02x\n", reply[0]);
|
||||||
@@ -906,21 +892,23 @@ static int __floppy_read(char *dest, unsigned long offset, unsigned long length)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int floppy_read(char *dest, unsigned long offset, unsigned long length)
|
static int floppy_read(char *dest, unsigned long offset, unsigned long length)
|
||||||
{
|
{
|
||||||
int result, bytes_read;;
|
int fr_result, bytes_read;;
|
||||||
|
|
||||||
printk_debug("floppy_read\n");
|
printk_debug("floppy_read\n");
|
||||||
bytes_read = 0;
|
bytes_read = 0;
|
||||||
do {
|
do {
|
||||||
int max_errors = 3;
|
int max_errors = 3;
|
||||||
do {
|
do {
|
||||||
result = __floppy_read(dest + bytes_read, offset, length - bytes_read);
|
fr_result = __floppy_read(dest + bytes_read, offset,
|
||||||
|
length - bytes_read);
|
||||||
if (max_errors-- == 0) {
|
if (max_errors-- == 0) {
|
||||||
return (bytes_read)?bytes_read: -1;
|
return (bytes_read)?bytes_read: -1;
|
||||||
}
|
}
|
||||||
} while (result <= 0);
|
} while (fr_result <= 0);
|
||||||
offset += result;
|
offset += fr_result;
|
||||||
bytes_read += result;
|
bytes_read += fr_result;
|
||||||
} while(bytes_read < length);
|
} while(bytes_read < length);
|
||||||
return bytes_read;
|
return bytes_read;
|
||||||
}
|
}
|
||||||
@@ -1005,7 +993,7 @@ static char get_fdc_version(void)
|
|||||||
} /* get_fdc_version */
|
} /* get_fdc_version */
|
||||||
|
|
||||||
|
|
||||||
int floppy_init(void)
|
static int floppy_init(void)
|
||||||
{
|
{
|
||||||
printk_debug("floppy_init\n");
|
printk_debug("floppy_init\n");
|
||||||
fdc_state.in_sync = 0;
|
fdc_state.in_sync = 0;
|
||||||
@@ -1041,13 +1029,6 @@ static void floppy_reset(void)
|
|||||||
fdc_state.in_sync = 1;
|
fdc_state.in_sync = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void floppy_fini(void)
|
|
||||||
{
|
|
||||||
/* Disable the floppy and the floppy drive controller */
|
|
||||||
set_dor(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ob_floppy_initialize(int *idx)
|
ob_floppy_initialize(int *idx)
|
||||||
{
|
{
|
||||||
@@ -1068,7 +1049,7 @@ ob_floppy_initialize(int *idx)
|
|||||||
static void
|
static void
|
||||||
ob_floppy_open(int *idx)
|
ob_floppy_open(int *idx)
|
||||||
{
|
{
|
||||||
int ret=1, len;
|
int ret = 1;
|
||||||
phandle_t ph;
|
phandle_t ph;
|
||||||
|
|
||||||
fword("my-unit");
|
fword("my-unit");
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
|
|||||||
|
|
||||||
ob_new_obio_device("eeprom", NULL);
|
ob_new_obio_device("eeprom", NULL);
|
||||||
|
|
||||||
nvram = (char *)ob_reg(base, offset, NVRAM_SIZE, 1);
|
nvram = (unsigned char *)ob_reg(base, offset, NVRAM_SIZE, 1);
|
||||||
|
|
||||||
PUSH((unsigned long)nvram);
|
PUSH((unsigned long)nvram);
|
||||||
fword("encode-int");
|
fword("encode-int");
|
||||||
|
|||||||
@@ -227,4 +227,8 @@ struct screeninfo {
|
|||||||
__u32 reserved[6]; /* Reserved for future compatibility */
|
__u32 reserved[6]; /* Reserved for future compatibility */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void vga_set_gmode (void);
|
||||||
|
void vga_set_amode (void);
|
||||||
|
void vga_font_load(unsigned char *vidmem, const unsigned char *font, int height,
|
||||||
|
int num_chars);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -137,11 +137,5 @@ DIR;
|
|||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
extern DIR *opendir ();
|
|
||||||
extern struct direct *readdir ();
|
|
||||||
extern int telldir ();
|
|
||||||
extern void seekdir ();
|
|
||||||
#define rewinddir(dirp) seekdir((dirp), (long)0)
|
|
||||||
extern void closedir ();
|
|
||||||
#endif /* not KERNEL */
|
#endif /* not KERNEL */
|
||||||
#endif /* _BOOT_UFS_DIR_H_ */
|
#endif /* _BOOT_UFS_DIR_H_ */
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ struct PartitionBlock
|
|||||||
unsigned long pb_Flags;
|
unsigned long pb_Flags;
|
||||||
unsigned long pb_Reserved1[2];
|
unsigned long pb_Reserved1[2];
|
||||||
unsigned long pb_DevFlags;
|
unsigned long pb_DevFlags;
|
||||||
unsigned char pb_DriveName[32];
|
char pb_DriveName[32];
|
||||||
unsigned long pb_Reserved2[15];
|
unsigned long pb_Reserved2[15];
|
||||||
unsigned long pb_Environment[20];
|
unsigned long pb_Environment[20];
|
||||||
unsigned long pb_EReserved[12];
|
unsigned long pb_EReserved[12];
|
||||||
@@ -201,7 +201,7 @@ struct ReadData {
|
|||||||
unsigned int filesize;
|
unsigned int filesize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#warning "Big vs. little endian for configure needed"
|
//#warning "Big vs. little endian for configure needed"
|
||||||
#define AROS_BE2LONG(l) \
|
#define AROS_BE2LONG(l) \
|
||||||
( \
|
( \
|
||||||
((((unsigned long)(l)) >> 24) & 0x000000FFUL) | \
|
((((unsigned long)(l)) >> 24) & 0x000000FFUL) | \
|
||||||
@@ -240,7 +240,8 @@ int blockoffset; /* offset if there is an embedded RDB partition */
|
|||||||
int rootb; /* block number of root block */
|
int rootb; /* block number of root block */
|
||||||
int rdbb; /* block number of rdb block */
|
int rdbb; /* block number of rdb block */
|
||||||
|
|
||||||
void initCache() {
|
static void initCache(void)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0;i<MAX_CACHE_BLOCKS;i++)
|
for (i=0;i<MAX_CACHE_BLOCKS;i++)
|
||||||
@@ -251,7 +252,8 @@ int i;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CacheBlock *getBlock(unsigned int block) {
|
static struct CacheBlock *getBlock(unsigned int block)
|
||||||
|
{
|
||||||
struct CacheBlock *freeblock;
|
struct CacheBlock *freeblock;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -278,7 +280,8 @@ int i;
|
|||||||
return freeblock;
|
return freeblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer) {
|
static unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer)
|
||||||
|
{
|
||||||
unsigned int sum=0,count=0;
|
unsigned int sum=0,count=0;
|
||||||
|
|
||||||
for (count=0;count<SizeBlock;count++)
|
for (count=0;count<SizeBlock;count++)
|
||||||
@@ -337,7 +340,8 @@ int i;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int seek(unsigned long offset) {
|
static int seek(unsigned long offset)
|
||||||
|
{
|
||||||
struct CacheBlock *cblock;
|
struct CacheBlock *cblock;
|
||||||
unsigned long block;
|
unsigned long block;
|
||||||
unsigned long togo;
|
unsigned long togo;
|
||||||
@@ -391,7 +395,7 @@ unsigned int readbytes = 0;
|
|||||||
{
|
{
|
||||||
cblock = getBlock(fsysb->file.current.block);
|
cblock = getBlock(fsysb->file.current.block);
|
||||||
}
|
}
|
||||||
#warning "else shouldn't occour"
|
//#warning "else shouldn't occour"
|
||||||
}
|
}
|
||||||
size = 512;
|
size = 512;
|
||||||
size -= fsysb->file.current.byte;
|
size -= fsysb->file.current.byte;
|
||||||
@@ -405,7 +409,7 @@ unsigned int readbytes = 0;
|
|||||||
extensionBlock(cblock)->filekey_table
|
extensionBlock(cblock)->filekey_table
|
||||||
[fsysb->file.current.filekey]
|
[fsysb->file.current.filekey]
|
||||||
)+blockoffset,
|
)+blockoffset,
|
||||||
fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
|
fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
|
||||||
);
|
);
|
||||||
fsysb->file.current.byte += size;
|
fsysb->file.current.byte += size;
|
||||||
}
|
}
|
||||||
@@ -418,7 +422,7 @@ unsigned int readbytes = 0;
|
|||||||
extensionBlock(cblock)->filekey_table
|
extensionBlock(cblock)->filekey_table
|
||||||
[fsysb->file.current.filekey]
|
[fsysb->file.current.filekey]
|
||||||
)+blockoffset,
|
)+blockoffset,
|
||||||
fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
|
fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
|
||||||
);
|
);
|
||||||
fsysb->file.current.byte = 0;
|
fsysb->file.current.byte = 0;
|
||||||
fsysb->file.current.filekey--;
|
fsysb->file.current.filekey--;
|
||||||
@@ -432,7 +436,8 @@ unsigned int readbytes = 0;
|
|||||||
return readbytes;
|
return readbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char capitalch(unsigned char ch, unsigned char flags) {
|
static unsigned char capitalch(unsigned char ch, unsigned char flags)
|
||||||
|
{
|
||||||
|
|
||||||
if ((flags==0) || (flags==1))
|
if ((flags==0) || (flags==1))
|
||||||
return (unsigned char)((ch>='a') && (ch<='z') ? ch-('a'-'A') : ch);
|
return (unsigned char)((ch>='a') && (ch<='z') ? ch-('a'-'A') : ch);
|
||||||
@@ -442,7 +447,8 @@ unsigned char capitalch(unsigned char ch, unsigned char flags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// str2 is a BCPL string
|
// str2 is a BCPL string
|
||||||
int noCaseStrCmp(char *str1, char *str2, unsigned char flags) {
|
static int noCaseStrCmp(char *str1, char *str2, unsigned char flags)
|
||||||
|
{
|
||||||
unsigned char length;
|
unsigned char length;
|
||||||
|
|
||||||
length=str2++[0];
|
length=str2++[0];
|
||||||
@@ -456,7 +462,8 @@ unsigned char length;
|
|||||||
return (*str1) ? 1 : -1;
|
return (*str1) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags) {
|
static unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags)
|
||||||
|
{
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
|
|
||||||
length=0;
|
length=0;
|
||||||
@@ -467,7 +474,8 @@ unsigned int length;
|
|||||||
return length%tablesize;
|
return length%tablesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh) {
|
static grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh)
|
||||||
|
{
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
key = getHashKey(name, 72, 1);
|
key = getHashKey(name, 72, 1);
|
||||||
@@ -501,8 +509,8 @@ printf("ghb2: %d\n", (*dirh)->blocknum);
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *copyPart(char *src, char *dst) {
|
static char *copyPart(char *src, char *dst)
|
||||||
|
{
|
||||||
while ((*src != '/') && (*src))
|
while ((*src != '/') && (*src))
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
if (*src == '/')
|
if (*src == '/')
|
||||||
@@ -514,7 +522,8 @@ char *copyPart(char *src, char *dst) {
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_error_t findBlock(char *name, struct CacheBlock **dirh) {
|
static grub_error_t findBlock(char *name, struct CacheBlock **dirh)
|
||||||
|
{
|
||||||
char dname[32];
|
char dname[32];
|
||||||
int block;
|
int block;
|
||||||
|
|
||||||
@@ -571,7 +580,8 @@ int block;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkPossibility(char *filename, char *bstr) {
|
static void checkPossibility(char *filename, char *bstr)
|
||||||
|
{
|
||||||
|
|
||||||
#ifndef STAGE1_5
|
#ifndef STAGE1_5
|
||||||
char cstr[32];
|
char cstr[32];
|
||||||
@@ -668,7 +678,7 @@ int affs_dir(char *dirname)
|
|||||||
fname = filename;
|
fname = filename;
|
||||||
while (*fname)
|
while (*fname)
|
||||||
*current++ = *fname++;
|
*current++ = *fname++;
|
||||||
#warning "TODO: add some more chars until posibilities differ"
|
//#warning "TODO: add some more chars until possibilities differ"
|
||||||
if (print_possibilities>0)
|
if (print_possibilities>0)
|
||||||
errnum = ERR_FILE_NOT_FOUND;
|
errnum = ERR_FILE_NOT_FOUND;
|
||||||
return (print_possibilities<0);
|
return (print_possibilities<0);
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ ext2fs_dir (char *dirname)
|
|||||||
log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
|
log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
|
||||||
printf ("ext2fs_dir: inode table fsblock=%d\n", ino_blk);
|
printf ("ext2fs_dir: inode table fsblock=%d\n", ino_blk);
|
||||||
#endif /* E2DEBUG */
|
#endif /* E2DEBUG */
|
||||||
if (!ext2_rdfsb (ino_blk, INODE))
|
if (!ext2_rdfsb (ino_blk, (char *)INODE))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ static struct dir_entry *vstafs_nextdir (void);
|
|||||||
|
|
||||||
|
|
||||||
#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF)
|
#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF)
|
||||||
#define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192)
|
#define FILE_INFO ((struct fs_file *) (long) FIRST_SECTOR + 8192)
|
||||||
#define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512)
|
#define DIRECTORY_BUF ((struct dir_entry *) (long) FILE_INFO + 512)
|
||||||
|
|
||||||
#define ROOT_SECTOR 1
|
#define ROOT_SECTOR 1
|
||||||
|
|
||||||
@@ -39,7 +39,6 @@ static struct dir_entry *vstafs_nextdir (void);
|
|||||||
* In f_sector we store the sector number in which the information about
|
* In f_sector we store the sector number in which the information about
|
||||||
* the found file is.
|
* the found file is.
|
||||||
*/
|
*/
|
||||||
extern int filepos;
|
|
||||||
static int f_sector;
|
static int f_sector;
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -63,7 +62,7 @@ get_file_info (int sector)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int curr_ext, current_direntry, current_blockpos;
|
static int curr_ext, current_direntry, current_blockpos;
|
||||||
static struct alloc *a;
|
static struct alloc *a1;
|
||||||
|
|
||||||
static struct dir_entry *
|
static struct dir_entry *
|
||||||
vstafs_readdir (long sector)
|
vstafs_readdir (long sector)
|
||||||
@@ -78,9 +77,9 @@ vstafs_readdir (long sector)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a = FILE_INFO->blocks;
|
a1 = FILE_INFO->blocks;
|
||||||
curr_ext = 0;
|
curr_ext = 0;
|
||||||
devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
|
devread (a1[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
|
||||||
current_direntry = 11;
|
current_direntry = 11;
|
||||||
current_blockpos = 0;
|
current_blockpos = 0;
|
||||||
|
|
||||||
@@ -93,7 +92,7 @@ vstafs_nextdir (void)
|
|||||||
if (current_direntry > 15)
|
if (current_direntry > 15)
|
||||||
{
|
{
|
||||||
current_direntry = 0;
|
current_direntry = 0;
|
||||||
if (++current_blockpos > (a[curr_ext].a_len - 1))
|
if (++current_blockpos > (a1[curr_ext].a_len - 1))
|
||||||
{
|
{
|
||||||
current_blockpos = 0;
|
current_blockpos = 0;
|
||||||
curr_ext++;
|
curr_ext++;
|
||||||
@@ -101,8 +100,8 @@ vstafs_nextdir (void)
|
|||||||
|
|
||||||
if (curr_ext < FILE_INFO->extents)
|
if (curr_ext < FILE_INFO->extents)
|
||||||
{
|
{
|
||||||
devread (a[curr_ext].a_start + current_blockpos, 0,
|
devread (a1[curr_ext].a_start + current_blockpos, 0,
|
||||||
512, (char *) DIRECTORY_BUF);
|
512, (char *) DIRECTORY_BUF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -188,35 +187,35 @@ vstafs_dir (char *dirname)
|
|||||||
int
|
int
|
||||||
vstafs_read (char *addr, int len)
|
vstafs_read (char *addr, int len)
|
||||||
{
|
{
|
||||||
struct alloc *a;
|
struct alloc *a2;
|
||||||
int size, ret = 0, offset, curr_len = 0;
|
int size, ret = 0, offset, curr_len = 0;
|
||||||
int curr_ext;
|
int curr_ext2;
|
||||||
char extent;
|
char extent;
|
||||||
int ext_size;
|
int ext_size;
|
||||||
char *curr_pos;
|
char *curr_pos;
|
||||||
|
|
||||||
get_file_info (f_sector);
|
get_file_info (f_sector);
|
||||||
size = FILE_INFO->len-VSTAFS_START_DATA;
|
size = FILE_INFO->len-VSTAFS_START_DATA;
|
||||||
a = FILE_INFO->blocks;
|
a2 = FILE_INFO->blocks;
|
||||||
|
|
||||||
if (filepos > 0)
|
if (filepos > 0)
|
||||||
{
|
{
|
||||||
if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA)
|
if (filepos < a2[0].a_len * 512 - VSTAFS_START_DATA)
|
||||||
{
|
{
|
||||||
offset = filepos + VSTAFS_START_DATA;
|
offset = filepos + VSTAFS_START_DATA;
|
||||||
extent = 0;
|
extent = 0;
|
||||||
curr_len = a[0].a_len * 512 - offset - filepos;
|
curr_len = a2[0].a_len * 512 - offset - filepos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ext_size = a[0].a_len * 512 - VSTAFS_START_DATA;
|
ext_size = a2[0].a_len * 512 - VSTAFS_START_DATA;
|
||||||
offset = filepos - ext_size;
|
offset = filepos - ext_size;
|
||||||
extent = 1;
|
extent = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
curr_len -= ext_size;
|
curr_len -= ext_size;
|
||||||
offset -= ext_size;
|
offset -= ext_size;
|
||||||
ext_size = a[extent+1].a_len * 512;
|
ext_size = a2[extent+1].a_len * 512;
|
||||||
}
|
}
|
||||||
while (extent < FILE_INFO->extents && offset>ext_size);
|
while (extent < FILE_INFO->extents && offset>ext_size);
|
||||||
}
|
}
|
||||||
@@ -225,16 +224,16 @@ vstafs_read (char *addr, int len)
|
|||||||
{
|
{
|
||||||
offset = VSTAFS_START_DATA;
|
offset = VSTAFS_START_DATA;
|
||||||
extent = 0;
|
extent = 0;
|
||||||
curr_len = a[0].a_len * 512 - offset;
|
curr_len = a2[0].a_len * 512 - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_pos = addr;
|
curr_pos = addr;
|
||||||
if (curr_len > len)
|
if (curr_len > len)
|
||||||
curr_len = len;
|
curr_len = len;
|
||||||
|
|
||||||
for (curr_ext=extent;
|
for (curr_ext2=extent;
|
||||||
curr_ext < FILE_INFO->extents;
|
curr_ext2 < FILE_INFO->extents;
|
||||||
curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++)
|
curr_len = a2[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext2++)
|
||||||
{
|
{
|
||||||
ret += curr_len;
|
ret += curr_len;
|
||||||
size -= curr_len;
|
size -= curr_len;
|
||||||
@@ -244,7 +243,7 @@ vstafs_read (char *addr, int len)
|
|||||||
curr_len += size;
|
curr_len += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
devread (a[curr_ext].a_start,offset, curr_len, curr_pos);
|
devread (a2[curr_ext2].a_start,offset, curr_len, curr_pos);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ ino2offset (xfs_ino_t ino)
|
|||||||
return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS);
|
return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline __const__ __uint16_t
|
static inline __uint16_t
|
||||||
le16 (__uint16_t x)
|
le16 (__uint16_t x)
|
||||||
{
|
{
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
@@ -110,7 +110,7 @@ le16 (__uint16_t x)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline __const__ __uint32_t
|
static inline __uint32_t
|
||||||
le32 (__uint32_t x)
|
le32 (__uint32_t x)
|
||||||
{
|
{
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
@@ -130,7 +130,7 @@ le32 (__uint32_t x)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline __const__ __uint64_t
|
static inline __uint64_t
|
||||||
le64 (__uint64_t x)
|
le64 (__uint64_t x)
|
||||||
{
|
{
|
||||||
__uint32_t h = x >> 32;
|
__uint32_t h = x >> 32;
|
||||||
@@ -195,7 +195,7 @@ fsb2daddr (xfs_fsblock_t fsbno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#undef offsetof
|
#undef offsetof
|
||||||
#define offsetof(t,m) ((int)&(((t *)0)->m))
|
#define offsetof(t,m) ((long)&(((t *)0)->m))
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
btroot_maxrecs (void)
|
btroot_maxrecs (void)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
*
|
*
|
||||||
* return pointer after reading the structure
|
* return pointer after reading the structure
|
||||||
*/
|
*/
|
||||||
static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
|
static void* btree_readnode(btree_node_desc* node, void *p)
|
||||||
{
|
{
|
||||||
node->next = bswabU32_inc(p);
|
node->next = bswabU32_inc(p);
|
||||||
node->prev = bswabU32_inc(p);
|
node->prev = bswabU32_inc(p);
|
||||||
@@ -53,7 +53,7 @@ static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
|
|||||||
*
|
*
|
||||||
* return pointer after reading the structure
|
* return pointer after reading the structure
|
||||||
*/
|
*/
|
||||||
static void* btree_readhead(btree* bt, btree_head* head, void *p)
|
static void* btree_readhead(btree_head* head, void *p)
|
||||||
{
|
{
|
||||||
UInt32 *q;
|
UInt32 *q;
|
||||||
head->depth = bswabU16_inc(p);
|
head->depth = bswabU16_inc(p);
|
||||||
@@ -153,7 +153,7 @@ static node_buf* node_cache_load_buf
|
|||||||
return NULL; // evil ...
|
return NULL; // evil ...
|
||||||
|
|
||||||
result->index = node_index;
|
result->index = node_index;
|
||||||
btree_readnode(bt, &result->desc, p);
|
btree_readnode(&result->desc, p);
|
||||||
|
|
||||||
e -> priority = result->desc.height * DEPTH_FACTOR;
|
e -> priority = result->desc.height * DEPTH_FACTOR;
|
||||||
e -> index = node_index;
|
e -> index = node_index;
|
||||||
@@ -229,10 +229,10 @@ static int btree_init(btree* bt, volume* vol, hfsp_fork_raw* fork)
|
|||||||
HFSP_EXTENT_DATA, bt->cnid);
|
HFSP_EXTENT_DATA, bt->cnid);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -1;
|
return -1;
|
||||||
p = btree_readnode(bt, &node, p);
|
p = btree_readnode(&node, p);
|
||||||
if (node.kind != HFSP_NODE_HEAD)
|
if (node.kind != HFSP_NODE_HEAD)
|
||||||
return -1; // should not happen ?
|
return -1; // should not happen ?
|
||||||
p = btree_readhead(bt, &bt->head, p);
|
p = btree_readhead(&bt->head, p);
|
||||||
|
|
||||||
node_size = bt->head.node_size;
|
node_size = bt->head.node_size;
|
||||||
bt->blkpernode = node_size / vol->blksize;
|
bt->blkpernode = node_size / vol->blksize;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ root_search_files( fs_ops_t *fs, int recursive, match_proc_t proc, const void *m
|
|||||||
static int
|
static int
|
||||||
match_file( record *r, record *parent, const void *match_data, hfsp_file_t *pt )
|
match_file( record *r, record *parent, const void *match_data, hfsp_file_t *pt )
|
||||||
{
|
{
|
||||||
unsigned char *p = (char*)match_data;
|
const char *p = (const char*)match_data;
|
||||||
char name[256];
|
char name[256];
|
||||||
int ret=1;
|
int ret=1;
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ file_read( file_desc_t *fd, void *buf, size_t count )
|
|||||||
max -= t->pos - curpos;
|
max -= t->pos - curpos;
|
||||||
}
|
}
|
||||||
size = (count-act_count > max)? max : count-act_count;
|
size = (count-act_count > max)? max : count-act_count;
|
||||||
memcpy( buf + act_count, &buf2[add], size );
|
memcpy( (char *)buf + act_count, &buf2[add], size );
|
||||||
|
|
||||||
curpos += blksize;
|
curpos += blksize;
|
||||||
act_count += size;
|
act_count += size;
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ SInt32 fast_unicode_compare ( const hfsp_unistr255 *ustr1,
|
|||||||
register UInt16 length1 = ustr1->strlen;
|
register UInt16 length1 = ustr1->strlen;
|
||||||
register UInt16 length2 = ustr2->strlen;
|
register UInt16 length2 = ustr2->strlen;
|
||||||
register const UInt16* lowerCaseTable = gLowerCaseTable;
|
register const UInt16* lowerCaseTable = gLowerCaseTable;
|
||||||
register UInt16* str1 = ustr1->name;
|
register const UInt16* str1 = ustr1->name;
|
||||||
register UInt16* str2 = ustr2->name;
|
register const UInt16* str2 = ustr2->name;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// Set default values for c1, c2 in case there are no more valid chars
|
// Set default values for c1, c2 in case there are no more valid chars
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ volume_readfork(void *p, hfsp_fork_raw* f)
|
|||||||
* ToDo: add more consitency checks.
|
* ToDo: add more consitency checks.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
|
volume_readbuf(volume * vol, hfsp_vh* vh, char * p)
|
||||||
{
|
{
|
||||||
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
|
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
|
||||||
HFSP_ERROR(-1, "This is not a HFS+ volume");
|
HFSP_ERROR(-1, "This is not a HFS+ volume");
|
||||||
@@ -168,7 +168,7 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
|
|||||||
{
|
{
|
||||||
UInt16 signature;
|
UInt16 signature;
|
||||||
char buf[vol->blksize];
|
char buf[vol->blksize];
|
||||||
void *p = buf;
|
char *p = buf;
|
||||||
|
|
||||||
if( volume_readinbuf(vol, buf, 2) ) // Wrapper or volume header starts here
|
if( volume_readinbuf(vol, buf, 2) ) // Wrapper or volume header starts here
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -29,10 +29,4 @@ extern int ofmem_map( ulong phys, ulong virt, ulong size, int mode );
|
|||||||
extern void ofmem_release( ulong virt, ulong size );
|
extern void ofmem_release( ulong virt, ulong size );
|
||||||
extern ulong ofmem_translate( ulong virt, ulong *ret_mode );
|
extern ulong ofmem_translate( ulong virt, ulong *ret_mode );
|
||||||
|
|
||||||
/* allocations from the private pool */
|
|
||||||
extern void *malloc( int size );
|
|
||||||
extern void free( void *ptr );
|
|
||||||
extern void *realloc( void *ptr, size_t size );
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _H_OFMEM */
|
#endif /* _H_OFMEM */
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ OpenBIOS_finish_partition(struct OpenBIOS_nvpart_v1 *header, uint32_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const unsigned char *str)
|
OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const char *str)
|
||||||
{
|
{
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ reopen( int fd, const char *filename )
|
|||||||
|
|
||||||
push_str( filename );
|
push_str( filename );
|
||||||
call_package( fdp->reopen_xt, fdp->ih );
|
call_package( fdp->reopen_xt, fdp->ih );
|
||||||
ret = (POP() == -1)? 0:-1;
|
ret = (POP() == (ucell)-1)? 0 : -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ reopen_nwrom( int fd )
|
|||||||
if( lookup_xt(fdp->ih, "open-nwrom", &fdp->open_nwrom_xt) )
|
if( lookup_xt(fdp->ih, "open-nwrom", &fdp->open_nwrom_xt) )
|
||||||
return -1;
|
return -1;
|
||||||
call_package( fdp->open_nwrom_xt, fdp->ih );
|
call_package( fdp->open_nwrom_xt, fdp->ih );
|
||||||
return (POP() == -1)? 0:-1;
|
return (POP() == (ucell)-1)? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ihandle_t
|
ihandle_t
|
||||||
|
|||||||
Reference in New Issue
Block a user