source: trunk/minix/commands/i386/mtools-3.9.7/stream.h@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.9 KB
Line 
1#ifndef MTOOLS_STREAM_H
2#define MTOOLS_STREAM_H
3
4typedef struct Stream_t {
5 struct Class_t *Class;
6 int refs;
7 struct Stream_t *Next;
8 struct Stream_t *Buffer;
9} Stream_t;
10
11#include "mtools.h"
12#include "msdos.h"
13
14#include "llong.h"
15
16typedef struct Class_t {
17 int (*read)(Stream_t *, char *, mt_off_t, size_t);
18 int (*write)(Stream_t *, char *, mt_off_t, size_t);
19 int (*flush)(Stream_t *);
20 int (*freeFunc)(Stream_t *);
21 int (*set_geom)(Stream_t *, device_t *, device_t *, int media,
22 struct bootsector *);
23 int (*get_data)(Stream_t *, time_t *, mt_size_t *, int *, int *);
24 int (*pre_allocate)(Stream_t *, mt_size_t);
25} Class_t;
26
27#define READS(stream, buf, address, size) \
28(stream)->Class->read( (stream), (char *) (buf), (address), (size) )
29
30#define WRITES(stream, buf, address, size) \
31(stream)->Class->write( (stream), (char *) (buf), (address), (size) )
32
33#define SET_GEOM(stream, dev, orig_dev, media, boot) \
34(stream)->Class->set_geom( (stream), (dev), (orig_dev), (media), (boot) )
35
36#define GET_DATA(stream, date, size, type, address) \
37(stream)->Class->get_data( (stream), (date), (size), (type), (address) )
38
39#define PRE_ALLOCATE(stream, size) \
40(stream)->Class->pre_allocate((stream), (size))
41
42int flush_stream(Stream_t *Stream);
43Stream_t *copy_stream(Stream_t *Stream);
44int free_stream(Stream_t **Stream);
45
46#define FLUSH(stream) \
47flush_stream( (stream) )
48
49#define FREE(stream) \
50free_stream( (stream) )
51
52#define COPY(stream) \
53copy_stream( (stream) )
54
55
56#define DeclareThis(x) x *This = (x *) Stream
57
58int force_write(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
59int force_read(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
60
61extern struct Stream_t *default_drive;
62
63int get_data_pass_through(Stream_t *Stream, time_t *date, mt_size_t *size,
64 int *type, int *address);
65
66int read_pass_through(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
67int write_pass_through(Stream_t *Stream, char *buf, mt_off_t start, size_t len);
68
69
70#endif
71
Note: See TracBrowser for help on using the repository browser.