summaryrefslogtreecommitdiffstats
path: root/private/utils/ifsutil/inc/dcache.hxx
blob: f7ead408dd4de7594ef5b49ce44130081de132ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*++

Copyright (c) 1992 Microsoft Corporation

Module Name:

    dcache.hxx

Abstract:

    This class models a general cache for reading and writing.
    The actual implementation of this base class is to not have
    any cache at all.

Author:

    Norbert Kusters (norbertk) 23-Apr-92

--*/


#if !defined(_DRIVE_CACHE_DEFN_)

#define _DRIVE_CACHE_DEFN_


#include "bigint.hxx"
#include "drive.hxx"


DECLARE_CLASS(DRIVE_CACHE);


class DRIVE_CACHE : public OBJECT {

    public:

        DECLARE_CONSTRUCTOR( DRIVE_CACHE );

        VIRTUAL
        ~DRIVE_CACHE(
            );

        NONVIRTUAL
        BOOLEAN
        Initialize(
            IN OUT  PIO_DP_DRIVE    Drive
            );

        VIRTUAL
		BOOLEAN
		Read(
			IN  BIG_INT     StartingSector,
			IN  SECTORCOUNT NumberOfSectors,
			OUT PVOID       Buffer
			);

        VIRTUAL
		BOOLEAN
		Write(
			IN  BIG_INT     StartingSector,
			IN  SECTORCOUNT NumberOfSectors,
			IN  PVOID       Buffer
            );

        VIRTUAL
        BOOLEAN
        Flush(
            );

    protected:

        NONVIRTUAL
		BOOLEAN
        HardRead(
			IN  BIG_INT     StartingSector,
			IN  SECTORCOUNT NumberOfSectors,
			OUT PVOID       Buffer
			);

        NONVIRTUAL
		BOOLEAN
        HardWrite(
			IN  BIG_INT     StartingSector,
			IN  SECTORCOUNT NumberOfSectors,
			IN  PVOID       Buffer
            );

    private:

        NONVIRTUAL
		VOID
		Construct(
			);

        NONVIRTUAL
        VOID
        Destroy(
            );

        PIO_DP_DRIVE    _drive;

};


INLINE
BOOLEAN
DRIVE_CACHE::HardRead(
    IN  BIG_INT     StartingSector,
    IN  SECTORCOUNT NumberOfSectors,
    OUT PVOID       Buffer
    )
/*++

Routine Description:

    This routine reads the requested sectors directly from the disk.

Arguments:

    StartingSector      - Supplies the first sector to be read.
    NumberOfSectors     - Supplies the number of sectors to be read.
    Buffer              - Supplies the buffer to read the run of sectors to.

Return Value:

    FALSE   - Failure.
    TRUE    - Success.

--*/
{
    return DRIVE_CACHE::Read(StartingSector, NumberOfSectors, Buffer);
}


INLINE
BOOLEAN
DRIVE_CACHE::HardWrite(
    IN  BIG_INT     StartingSector,
    IN  SECTORCOUNT NumberOfSectors,
    IN  PVOID       Buffer
    )
/*++

Routine Description:

    This routine writes the requested sectors directly to the disk.

Arguments:

    StartingSector      - Supplies the first sector to be written.
    NumberOfSectors     - Supplies the number of sectors to be written.
    Buffer              - Supplies the buffer to write the run of sectors from.

Return Value:

    FALSE   - Failure.
    TRUE    - Success.

--*/
{
    return DRIVE_CACHE::Write(StartingSector, NumberOfSectors, Buffer);
}


#endif // _DRIVE_CACHE_DEFN_