stream.h

Go to the documentation of this file.
00001 #ifndef MTOOLS_STREAM_H
00002 #define MTOOLS_STREAM_H
00003 
00004 typedef struct Stream_t {
00005         struct Class_t *Class;
00006         int refs;
00007         struct Stream_t *Next;
00008         struct Stream_t *Buffer;
00009 } Stream_t;
00010 
00011 #include "mtools.h"
00012 #include "msdos.h"
00013 
00014 #include "llong.h"
00015 
00016 typedef struct Class_t {
00017         int (*read)(Stream_t *, char *, mt_off_t, size_t);
00018         int (*write)(Stream_t *, char *, mt_off_t, size_t);
00019         int (*flush)(Stream_t *);
00020         int (*freeFunc)(Stream_t *);
00021         int (*set_geom)(Stream_t *, device_t *, device_t *, int media,
00022                                         struct bootsector *);
00023         int (*get_data)(Stream_t *, time_t *, mt_size_t *, int *, int *);
00024         int (*pre_allocate)(Stream_t *, mt_size_t);
00025 } Class_t;
00026 
00027 #define READS(stream, buf, address, size) \
00028 (stream)->Class->read( (stream), (char *) (buf), (address), (size) )
00029 
00030 #define WRITES(stream, buf, address, size) \
00031 (stream)->Class->write( (stream), (char *) (buf), (address), (size) )
00032 
00033 #define SET_GEOM(stream, dev, orig_dev, media, boot) \
00034 (stream)->Class->set_geom( (stream), (dev), (orig_dev), (media), (boot) )
00035 
00036 #define GET_DATA(stream, date, size, type, address) \
00037 (stream)->Class->get_data( (stream), (date), (size), (type), (address) )
00038 
00039 #define PRE_ALLOCATE(stream, size) \
00040 (stream)->Class->pre_allocate((stream), (size))
00041 
00042 int flush_stream(Stream_t *Stream);
00043 Stream_t *copy_stream(Stream_t *Stream);
00044 int free_stream(Stream_t **Stream);
00045 
00046 #define FLUSH(stream) \
00047 flush_stream( (stream) )
00048 
00049 #define FREE(stream) \
00050 free_stream( (stream) )
00051 
00052 #define COPY(stream) \
00053 copy_stream( (stream) )
00054 
00055 
00056 #define DeclareThis(x) x *This = (x *) Stream
00057 
00058 int force_write(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
00059 int force_read(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
00060 
00061 extern struct Stream_t *default_drive;
00062 
00063 int get_data_pass_through(Stream_t *Stream, time_t *date, mt_size_t *size,
00064                                                   int *type, int *address);
00065 
00066 int read_pass_through(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
00067 int write_pass_through(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
00068 
00069 
00070 #endif
00071 

Generated on Fri Apr 14 22:56:56 2006 for minix by  doxygen 1.4.6