generically search for disk types

This commit is contained in:
Dave Vasilevsky 2013-02-24 15:43:54 -05:00
parent 3af3834b8e
commit 5c7af60f16

View File

@ -70,6 +70,11 @@
#define DEBUG 0
#include "debug.h"
static disk_factory *disk_factories[] = {
disk_sparsebundle_factory,
NULL
};
// File handles are pointers to these structures
struct mac_file_handle {
char *name; // Copy of device/file name
@ -619,8 +624,8 @@ void *Sys_open(const char *name, bool read_only)
}
#endif
// FIXME
disk_generic *generic = disk_sparsebundle_factory(name, read_only);
for (disk_factory **f = disk_factories; *f; ++f) {
disk_generic *generic = (*f)(name, read_only);
if (generic) {
mac_file_handle *fh = open_filehandle(name);
fh->generic_disk = generic;
@ -630,6 +635,7 @@ void *Sys_open(const char *name, bool read_only)
sys_add_mac_file_handle(fh);
return fh;
}
}
int open_flags = (read_only ? O_RDONLY : O_RDWR);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__MACOSX__)