From 48c114c2f2161bcf39e2b4e4e89747e621f86e78 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Mon, 21 Nov 2005 22:05:14 +0000 Subject: [PATCH] first revision --- libstream/libstream.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 libstream/libstream.h diff --git a/libstream/libstream.h b/libstream/libstream.h new file mode 100644 index 0000000..af089a0 --- /dev/null +++ b/libstream/libstream.h @@ -0,0 +1,44 @@ +/* + * + * (c) 2005 Laurent Vivier + * + */ +#ifndef __LIBSTREAM_H__ +#define __LIBSTREAM_H__ + +#include +#include + +typedef int (*stream_read_sector_t)(void *data,off_t offset, void* buffer, size_t size); +typedef ssize_t (*stream_read_t)(void *data, void *buf, size_t count); +typedef int (*stream_seek_t)(void *data, long offset, int whence); +typedef int (*stream_close_t)(void *data); + +typedef struct { + void *data; + stream_read_sector_t read_sector; + stream_close_t close; +} device_io_t; + +typedef struct { + void *data; + stream_read_t read; + stream_seek_t seek; + stream_close_t close; +} filesystem_io_t; + +typedef struct { + /* device interface */ + + device_io_t device; + + /* filesystem interface */ + + filesystem_io_t fs; +} stream_t; + +extern stream_t *stream_open(char *dev); +extern int stream_read_sector(stream_t *stream, + off_t offset, void* buffer, size_t size); +extern int stream_close(stream_t *stream); +#endif /* __LIBSTREAM_H__ */