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