Fix up non-grub iso9660 filesystem, plus correct a thinko where the sense of the existing hfs/ext2 probe functions was inverted

by default.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@796 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Mark Cave-Ayland
2010-06-23 20:41:34 +00:00
committed by Mark Cave-Ayland
parent c6a9039103
commit 0dddb61de8
8 changed files with 37 additions and 9 deletions

View File

@@ -205,7 +205,7 @@ int fs_ext2_open(int fd, fs_ops_t *fs)
int fs_ext2_probe(int fd, llong offs) int fs_ext2_probe(int fd, llong offs)
{ {
if (ext2_probe(fd, offs)) if (ext2_probe(fd, offs))
return -1; return 0;
return 0; return -1;
} }

View File

@@ -463,7 +463,7 @@ int
fs_hfs_probe( int fd, llong offs ) fs_hfs_probe( int fd, llong offs )
{ {
if (hfs_probe(fd, offs)) if (hfs_probe(fd, offs))
return -1; return 0;
return 0; return -1;
} }

View File

@@ -402,7 +402,7 @@ int
fs_hfsp_probe(int fd, llong offs) fs_hfsp_probe(int fd, llong offs)
{ {
if (volume_probe(fd, offs)) if (volume_probe(fd, offs))
return -1; return 0;
return 0; return -1;
} }

View File

@@ -152,6 +152,15 @@ static const fs_ops_t iso9660_ops = {
.get_fstype = get_fstype, .get_fstype = get_fstype,
}; };
int
fs_iso9660_probe( int fd, llong offs )
{
if (iso9660_probe(fd, offs))
return 0;
return -1;
}
int fs_iso9660_open(int fd, fs_ops_t *fs) int fs_iso9660_open(int fd, fs_ops_t *fs)
{ {
iso9660_VOLUME *volume; iso9660_VOLUME *volume;

View File

@@ -189,6 +189,22 @@ int iso9660_umount(iso9660_VOLUME* volume)
return 0; return 0;
} }
int iso9660_probe(int fd, llong offset)
{
struct iso_primary_descriptor ipd;
seek_io(fd, 16 * ISOFS_BLOCK_SIZE + offset);
read_io(fd, &ipd, sizeof (ipd));
if ((ipd.type[0] != ISO_VD_PRIMARY) ||
(strncmp(ipd.id, ISO_STANDARD_ID, sizeof (ipd.id)) != 0) ||
(ipd.version[0] != 1)) {
return 0;
}
return -1;
}
struct iso_directory_record *iso9660_get_root_node(iso9660_VOLUME* volume) struct iso_directory_record *iso9660_get_root_node(iso9660_VOLUME* volume)
{ {
return (struct iso_directory_record *)volume->descriptor->root_directory_record; return (struct iso_directory_record *)volume->descriptor->root_directory_record;

View File

@@ -14,6 +14,7 @@
extern iso9660_VOLUME* iso9660_mount(int fd); extern iso9660_VOLUME* iso9660_mount(int fd);
extern int iso9660_umount(iso9660_VOLUME *volume); extern int iso9660_umount(iso9660_VOLUME *volume);
extern int iso9660_probe(int fd, llong offs);
extern iso9660_DIR* iso9660_opendir(iso9660_VOLUME *, const char *name); extern iso9660_DIR* iso9660_opendir(iso9660_VOLUME *, const char *name);
extern iso9660_FILE* iso9660_open(iso9660_VOLUME *, const char *pathname); extern iso9660_FILE* iso9660_open(iso9660_VOLUME *, const char *pathname);
extern int iso9660_closedir(iso9660_DIR *dir); extern int iso9660_closedir(iso9660_DIR *dir);

View File

@@ -69,8 +69,10 @@ static inline int fs_hfs_probe( int fd, llong offs ) { return -1; }
#ifdef CONFIG_ISO9660 #ifdef CONFIG_ISO9660
extern int fs_iso9660_open( int fd, fs_ops_t *fs ); extern int fs_iso9660_open( int fd, fs_ops_t *fs );
extern int fs_iso9660_probe( int fd, llong offs );
#else #else
static inline int fs_iso9660_open( int fd, fs_ops_t *fs ) { return -1; } static inline int fs_iso9660_open( int fd, fs_ops_t *fs ) { return -1; }
static inline int fs_iso9660_probe( int fd, llong offs ) { return -1; }
#endif #endif
#ifdef CONFIG_EXT2 #ifdef CONFIG_EXT2

View File

@@ -359,12 +359,12 @@ files_probe( files_info_t *mi )
err = fs_hfs_probe(fd, offs); err = fs_hfs_probe(fd, offs);
DPRINTF("--- HFS returned %d\n", err); DPRINTF("--- HFS returned %d\n", err);
} }
/*
if( err ) { if( err ) {
err = fs_iso9660_open(fd, fs); err = fs_iso9660_probe(fd, offs);
DPRINTF("--- ISO9660 returned %d\n", err); DPRINTF("--- ISO9660 returned %d\n", err);
} }
*/
if( err ) { if( err ) {
err = fs_ext2_probe(fd, offs); err = fs_ext2_probe(fd, offs);
DPRINTF("--- ext2 returned %d\n", err); DPRINTF("--- ext2 returned %d\n", err);