mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-21 18:30:20 +00:00
Add ext2 in libstream
This commit is contained in:
parent
fb689113dd
commit
5f7643e48b
@ -18,6 +18,7 @@ HEADERS = libstream.h
|
||||
|
||||
SCSI_FLAGS = -DSCSI_SUPPORT -I$(TOP)/../libscsi
|
||||
ISO9660_FLAGS = -DISO9660_SUPPORT -I$(TOP)/../libiso9660
|
||||
EXT2_FLAGS = -DEXT2_SUPPORT -I$(TOP)/../libext2
|
||||
CONTAINER_FLAGS = -DCONTAINER_SUPPORT -I$(TOP)/../libcontainer
|
||||
FLOPPY_FLAGS = -DFLOPPY_SUPPORT -I$(TOP)/../libfloppy
|
||||
BLOCK_FLAGS = -DBLOCK_SUPPORT -I$(TOP)/../libblock
|
||||
@ -28,8 +29,8 @@ all: $(LIBRARIES)
|
||||
scsi/libstream.a::
|
||||
test -e scsi || mkdir scsi
|
||||
$(MAKE) -C scsi -f $(TOP)/Makefile TOP=$(TOP) LIBRARY=libstream.a CPPFLAGS="$(CPPFLAGS) \
|
||||
$(SCSI_FLAGS) $(CONTAINER_FLAGS) $(BLOCK_FLAGS) $(ISO9660_FLAGS) $(MAP_FLAGS)" \
|
||||
libstream.a
|
||||
$(SCSI_FLAGS) $(CONTAINER_FLAGS) $(BLOCK_FLAGS) $(ISO9660_FLAGS) $(MAP_FLAGS) \
|
||||
$(EXT2_FLAGS)" libstream.a
|
||||
|
||||
floppy/libstream.a::
|
||||
test -e floppy || mkdir floppy
|
||||
@ -40,8 +41,8 @@ full/libstream.a::
|
||||
test -e full || mkdir full
|
||||
$(MAKE) -C full -f $(TOP)/Makefile TOP=$(TOP) LIBRARY=libstream.a \
|
||||
CPPFLAGS="$(CPPFLAGS) $(SCSI_FLAGS) $(CONTAINER_FLAGS) \
|
||||
$(ISO9660_FLAGS) $(FLOPPY_FLAGS) $(BLOCK_FLAGS) $(MAP_FLAGS)" \
|
||||
libstream.a
|
||||
$(ISO9660_FLAGS) $(FLOPPY_FLAGS) $(BLOCK_FLAGS) $(MAP_FLAGS) \
|
||||
$(EXT2_FLAGS)" libstream.a
|
||||
|
||||
include $(TOP)/../tools.mk
|
||||
include $(TOP)/../Rules.mk
|
||||
|
@ -18,6 +18,7 @@ typedef enum {
|
||||
fs_BLOCK,
|
||||
fs_CONTAINER,
|
||||
fs_ISO9660,
|
||||
fs_EXT2,
|
||||
} fs_t;
|
||||
|
||||
struct stream_stat {
|
||||
|
@ -24,6 +24,9 @@
|
||||
#ifdef ISO9660_SUPPORT
|
||||
#include <libiso9660.h>
|
||||
#endif
|
||||
#ifdef EXT2_SUPPORT
|
||||
#include <libext2.h>
|
||||
#endif
|
||||
#ifdef MAP_SUPPORT
|
||||
#include <libmap.h>
|
||||
#endif
|
||||
@ -45,6 +48,11 @@ static char* get_fs(char *path, fs_t *fs)
|
||||
*fs = fs_ISO9660;
|
||||
return path + 8;
|
||||
}
|
||||
if (strncmp("ext2:", path, 8) == 0)
|
||||
{
|
||||
*fs = fs_EXT2;
|
||||
return path + 8;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -258,6 +266,27 @@ stream_t *stream_open(char *dev)
|
||||
break;
|
||||
#endif /* ISO9660_SUPPORT */
|
||||
|
||||
#ifdef EXT2_SUPPORT
|
||||
case fs_EXT2:
|
||||
stream->fs.volume = ext2_mount(&stream->device);
|
||||
if (stream->fs.volume == NULL)
|
||||
{
|
||||
printf("Cannot mount volume ext2\n");
|
||||
goto outfs;
|
||||
}
|
||||
stream->fs.file = ext2_open(stream->fs.volume, current);
|
||||
if (stream->fs.file == NULL)
|
||||
{
|
||||
ext2_umount(stream->fs.volume);
|
||||
goto outfs;
|
||||
}
|
||||
stream->fs.read = (stream_read_t)ext2_read;
|
||||
stream->fs.lseek = (stream_lseek_t)ext2_lseek;
|
||||
stream->fs.close = (stream_close_t)ext2_close;
|
||||
stream->fs.umount = (stream_umount_t)ext2_umount;
|
||||
stream->fs.fstat = (stream_fstat_t)ext2_fstat;
|
||||
break;
|
||||
#endif /* EXT2_SUPPORT */
|
||||
default:
|
||||
outfs:
|
||||
stream->device.close(stream->device.data);
|
||||
|
@ -17,8 +17,10 @@ CPPFLAGS = -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) \
|
||||
# -O2 is needed to be able to inline functions from libmacos
|
||||
CFLAGS = $(OPT_CFLAGS) -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2
|
||||
ASFLAGS =
|
||||
LIBS = $(OPT_LIBS) -L$(TOP)/../libiso9660/m68k-linux \
|
||||
-liso9660 -L$(TOP)/../libunix -lunix \
|
||||
LIBS = $(OPT_LIBS) \
|
||||
-L$(TOP)/../libiso9660/m68k-linux -liso9660 \
|
||||
-L$(TOP)/../libext2/m68k-linux -lext2 \
|
||||
-L$(TOP)/../libunix -lunix \
|
||||
-L$(TOP)/../libmacos -lmacos -lunix \
|
||||
-L$(TOP)/../libgzip/m68k-linux -lgzip \
|
||||
-L$(TOP)/../libfloppy -lfloppy -L$(TOP)/../libscsi -lscsi \
|
||||
|
Loading…
Reference in New Issue
Block a user