Author: mcayland Date: Wed Jun 23 22:41:34 2010 New Revision: 796 URL: http://tracker.coreboot.org/trac/openbios/changeset/796
Log: 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
Modified: trunk/openbios-devel/fs/ext2/ext2_fs.c trunk/openbios-devel/fs/hfs/hfs_fs.c trunk/openbios-devel/fs/hfsplus/hfsp_fs.c trunk/openbios-devel/fs/iso9660/iso9660_fs.c trunk/openbios-devel/fs/iso9660/iso9660_mount.c trunk/openbios-devel/fs/iso9660/libiso9660.h trunk/openbios-devel/include/fs/fs.h trunk/openbios-devel/packages/misc-files.c
Modified: trunk/openbios-devel/fs/ext2/ext2_fs.c ============================================================================== --- trunk/openbios-devel/fs/ext2/ext2_fs.c Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/fs/ext2/ext2_fs.c Wed Jun 23 22:41:34 2010 (r796) @@ -205,7 +205,7 @@ int fs_ext2_probe(int fd, llong offs) { if (ext2_probe(fd, offs)) - return -1; + return 0;
- return 0; + return -1; }
Modified: trunk/openbios-devel/fs/hfs/hfs_fs.c ============================================================================== --- trunk/openbios-devel/fs/hfs/hfs_fs.c Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/fs/hfs/hfs_fs.c Wed Jun 23 22:41:34 2010 (r796) @@ -463,7 +463,7 @@ fs_hfs_probe( int fd, llong offs ) { if (hfs_probe(fd, offs)) - return -1; + return 0;
- return 0; + return -1; }
Modified: trunk/openbios-devel/fs/hfsplus/hfsp_fs.c ============================================================================== --- trunk/openbios-devel/fs/hfsplus/hfsp_fs.c Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/fs/hfsplus/hfsp_fs.c Wed Jun 23 22:41:34 2010 (r796) @@ -402,7 +402,7 @@ fs_hfsp_probe(int fd, llong offs) { if (volume_probe(fd, offs)) - return -1; + return 0;
- return 0; + return -1; }
Modified: trunk/openbios-devel/fs/iso9660/iso9660_fs.c ============================================================================== --- trunk/openbios-devel/fs/iso9660/iso9660_fs.c Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/fs/iso9660/iso9660_fs.c Wed Jun 23 22:41:34 2010 (r796) @@ -152,6 +152,15 @@ .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) { iso9660_VOLUME *volume;
Modified: trunk/openbios-devel/fs/iso9660/iso9660_mount.c ============================================================================== --- trunk/openbios-devel/fs/iso9660/iso9660_mount.c Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/fs/iso9660/iso9660_mount.c Wed Jun 23 22:41:34 2010 (r796) @@ -189,6 +189,22 @@ 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) { return (struct iso_directory_record *)volume->descriptor->root_directory_record;
Modified: trunk/openbios-devel/fs/iso9660/libiso9660.h ============================================================================== --- trunk/openbios-devel/fs/iso9660/libiso9660.h Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/fs/iso9660/libiso9660.h Wed Jun 23 22:41:34 2010 (r796) @@ -14,6 +14,7 @@
extern iso9660_VOLUME* iso9660_mount(int fd); 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_FILE* iso9660_open(iso9660_VOLUME *, const char *pathname); extern int iso9660_closedir(iso9660_DIR *dir);
Modified: trunk/openbios-devel/include/fs/fs.h ============================================================================== --- trunk/openbios-devel/include/fs/fs.h Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/include/fs/fs.h Wed Jun 23 22:41:34 2010 (r796) @@ -69,8 +69,10 @@
#ifdef CONFIG_ISO9660 extern int fs_iso9660_open( int fd, fs_ops_t *fs ); +extern int fs_iso9660_probe( int fd, llong offs ); #else 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
#ifdef CONFIG_EXT2
Modified: trunk/openbios-devel/packages/misc-files.c ============================================================================== --- trunk/openbios-devel/packages/misc-files.c Tue Jun 15 21:59:47 2010 (r795) +++ trunk/openbios-devel/packages/misc-files.c Wed Jun 23 22:41:34 2010 (r796) @@ -359,12 +359,12 @@ err = fs_hfs_probe(fd, offs); DPRINTF("--- HFS returned %d\n", err); } -/* + if( err ) { - err = fs_iso9660_open(fd, fs); + err = fs_iso9660_probe(fd, offs); DPRINTF("--- ISO9660 returned %d\n", err); } -*/ + if( err ) { err = fs_ext2_probe(fd, offs); DPRINTF("--- ext2 returned %d\n", err);