mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-21 18:30:20 +00:00
Set more information in streamp_r, allows to retrieve unit id with stream_fstat()
This commit is contained in:
parent
47a16fe0c8
commit
b04a3d1638
@ -9,7 +9,19 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
typedef enum {
|
||||
device_FLOPPY,
|
||||
device_SCSI,
|
||||
} device_t;
|
||||
|
||||
typedef enum {
|
||||
fs_BLOCK,
|
||||
fs_CONTAINER,
|
||||
fs_ISO9660,
|
||||
} fs_t;
|
||||
|
||||
struct stream_stat {
|
||||
int st_dev;
|
||||
off_t st_size;
|
||||
};
|
||||
|
||||
@ -48,6 +60,13 @@ typedef struct {
|
||||
/* filesystem interface */
|
||||
|
||||
filesystem_io_t fs;
|
||||
|
||||
/* info */
|
||||
|
||||
fs_t fs_id;
|
||||
device_t device_id;
|
||||
int unit, partition;
|
||||
|
||||
} stream_t;
|
||||
|
||||
extern stream_t *stream_open(char *dev);
|
||||
|
@ -8,8 +8,13 @@
|
||||
|
||||
int stream_fstat(stream_t *stream, struct stream_stat *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (stream->fs.fstat == NULL)
|
||||
return -1;
|
||||
|
||||
return stream->fs.fstat(stream->fs.file, buf);
|
||||
ret = stream->fs.fstat(stream->fs.file, buf);
|
||||
buf->st_dev = stream->unit;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -28,17 +28,6 @@
|
||||
#include <libmap.h>
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
device_FLOPPY,
|
||||
device_SCSI,
|
||||
} device_t;
|
||||
|
||||
typedef enum {
|
||||
fs_BLOCK,
|
||||
fs_CONTAINER,
|
||||
fs_ISO9660,
|
||||
} fs_t;
|
||||
|
||||
static char* get_fs(char *path, fs_t *fs)
|
||||
{
|
||||
if (strncmp("block:", path, 6) == 0)
|
||||
@ -133,6 +122,11 @@ stream_t *stream_open(char *dev)
|
||||
|
||||
stream = (stream_t*)malloc(sizeof(stream_t));
|
||||
|
||||
stream->fs_id = fs,
|
||||
stream->device_id = device;
|
||||
stream->unit = unit;
|
||||
stream->partition = partition;
|
||||
|
||||
switch(device)
|
||||
{
|
||||
#ifdef FLOPPY_SUPPORT
|
||||
|
Loading…
Reference in New Issue
Block a user