1
10
13
14
20
21
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
88
89
90
91
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
140
141
142
143
144
145
146
147
148
149
150
156
157
158
159
160
161
162
163
164
165
166
167
169
170
178
179
180
181
184
185
186
187
188
189
...
...
...
#define FX_SOURCE_CODE
#include "fx_api.h"
#include "fx_system.h"
#include "fx_media.h"
#include "fx_file.h"
#include "fx_utility.h"
5 includes
...
...
UINT _fx_media_abort(FX_MEDIA *media_ptr)
{
FX_INT_SAVE_AREA
ULONG open_count;
FX_FILE *file_ptr;
#ifndef FX_MEDIA_STATISTICS_DISABLE
media_ptr -> fx_media_aborts++;/* ... */
#endif
if (media_ptr -> fx_media_id != FX_MEDIA_ID)
{
return(FX_MEDIA_NOT_OPEN);
}if (media_ptr -> fx_media_id != FX_MEDIA_ID) { ... }
FX_TRACE_IN_LINE_INSERT(FX_TRACE_MEDIA_ABORT, media_ptr, 0, 0, 0, FX_TRACE_MEDIA_EVENTS, 0, 0)
FX_PROTECT
open_count = media_ptr -> fx_media_opened_file_count;
file_ptr = media_ptr -> fx_media_opened_file_list;
while (open_count)
{
file_ptr -> fx_file_id = FX_FILE_ABORTED_ID;
file_ptr = file_ptr -> fx_file_opened_next;
open_count--;
}while (open_count) { ... }
media_ptr -> fx_media_driver_request = FX_DRIVER_ABORT;
media_ptr -> fx_media_driver_status = FX_IO_ERROR;
FX_TRACE_IN_LINE_INSERT(FX_TRACE_INTERNAL_IO_DRIVER_ABORT, media_ptr, 0, 0, 0, FX_TRACE_INTERNAL_EVENTS, 0, 0)
(media_ptr -> fx_media_driver_entry) (media_ptr);
FX_DISABLE_INTS
if (_fx_system_media_opened_count == ((ULONG) 1))
{
_fx_system_media_opened_ptr = FX_NULL;
}if (_fx_system_media_opened_count == ((ULONG) 1)) { ... }
else
{
(media_ptr -> fx_media_opened_next) -> fx_media_opened_previous =
media_ptr -> fx_media_opened_previous;
(media_ptr -> fx_media_opened_previous) -> fx_media_opened_next =
media_ptr -> fx_media_opened_next;
if (_fx_system_media_opened_ptr == media_ptr)
{
_fx_system_media_opened_ptr = media_ptr -> fx_media_opened_next;
}if (_fx_system_media_opened_ptr == media_ptr) { ... }
}else { ... }
_fx_system_media_opened_count--;
media_ptr -> fx_media_id = FX_MEDIA_ABORTED_ID;
FX_RESTORE_INTS
/* ... */
#ifndef FX_SINGLE_THREAD
#ifndef FX_DONT_CREATE_MUTEX
/* ... */
tx_mutex_delete(& (media_ptr -> fx_media_protect));/* ... */
#endif/* ... */
#endif
#ifdef FX_DONT_CREATE_MUTEX
FX_UNPROTECT/* ... */
#endif
return(FX_SUCCESS);
}{ ... }