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
91
92
93
94
95
96
99
100
101
102
103
104
105
106
107
108
109
110
111
112
118
119
120
121
122
123
124
125
126
127
128
134
135
136
137
138
139
140
141
142
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
172
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
...
...
#define FX_SOURCE_CODE
#include "fx_api.h"
#include "fx_system.h"
#include "fx_file.h"
#include "fx_utility.h"
#include "fx_directory.h"
5 includes
...
...
UINT _fx_file_close(FX_FILE *file_ptr)
{
UINT status;
FX_MEDIA *media_ptr;
FX_INT_SAVE_AREA
if (file_ptr -> fx_file_id != FX_FILE_ID)
{
return(FX_NOT_OPEN);
}if (file_ptr -> fx_file_id != FX_FILE_ID) { ... }
media_ptr = file_ptr -> fx_file_media_ptr;
#ifndef FX_MEDIA_STATISTICS_DISABLE
media_ptr -> fx_media_file_closes++;/* ... */
#endif
FX_TRACE_IN_LINE_INSERT(FX_TRACE_FILE_CLOSE, file_ptr, file_ptr -> fx_file_current_file_size, 0, 0, FX_TRACE_FILE_EVENTS, 0, 0)
FX_PROTECT
FX_TRACE_OBJECT_UNREGISTER(file_ptr)
if (file_ptr == file_ptr -> fx_file_opened_next)
{
media_ptr -> fx_media_opened_file_list = FX_NULL;
}if (file_ptr == file_ptr -> fx_file_opened_next) { ... }
else
{
(file_ptr -> fx_file_opened_next) -> fx_file_opened_previous =
file_ptr -> fx_file_opened_previous;
(file_ptr -> fx_file_opened_previous) -> fx_file_opened_next =
file_ptr -> fx_file_opened_next;
if (media_ptr -> fx_media_opened_file_list == file_ptr)
{
media_ptr -> fx_media_opened_file_list = file_ptr -> fx_file_opened_next;
}if (media_ptr -> fx_media_opened_file_list == file_ptr) { ... }
}else { ... }
media_ptr -> fx_media_opened_file_count--;
file_ptr -> fx_file_id = FX_FILE_CLOSED_ID;
/* ... */
if ((file_ptr -> fx_file_open_mode == FX_OPEN_FOR_WRITE) &&
(file_ptr -> fx_file_modified))
{
FX_DISABLE_INTS
file_ptr -> fx_file_dir_entry.fx_dir_entry_time = _fx_system_time;
file_ptr -> fx_file_dir_entry.fx_dir_entry_date = _fx_system_date;
file_ptr -> fx_file_dir_entry.fx_dir_entry_last_accessed_date = _fx_system_date;
FX_RESTORE_INTS
file_ptr -> fx_file_dir_entry.fx_dir_entry_file_size =
file_ptr -> fx_file_current_file_size;
#ifdef FX_ENABLE_EXFAT
if (media_ptr -> fx_media_FAT_type == FX_exFAT)
{
status = _fx_directory_exFAT_entry_write(
media_ptr, &(file_ptr -> fx_file_dir_entry), UPDATE_STREAM);
}if (media_ptr -> fx_media_FAT_type == FX_exFAT) { ... }
else
{
#endif
status = _fx_directory_entry_write(media_ptr, &(file_ptr -> fx_file_dir_entry));
#ifdef FX_ENABLE_EXFAT
}else { ... }
#endif
if (status != FX_SUCCESS)
{
FX_UNPROTECT
return(status);
}if (status != FX_SUCCESS) { ... }
}if ((file_ptr -> fx_file_open_mode == FX_OPEN_FOR_WRITE) && (file_ptr -> fx_file_modified)) { ... }
FX_UNPROTECT
return(FX_SUCCESS);
}{ ... }