49 extern ibool os_has_said_disk_full;
70 #define UNIV_NON_BUFFERED_IO
78 # define os_file_t HANDLE
82 # define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
89 # define OS_FILE_FROM_FD(fd) fd
102 #define OS_FILE_LOG_BLOCK_SIZE 512
127 #define OS_FILE_READ_ONLY 333
128 #define OS_FILE_READ_WRITE 444
129 #define OS_FILE_READ_ALLOW_DELETE 555
132 #define OS_FILE_AIO 61
133 #define OS_FILE_NORMAL 62
137 #define OS_DATA_FILE 100
138 #define OS_LOG_FILE 101
142 #define OS_FILE_NOT_FOUND 71
143 #define OS_FILE_DISK_FULL 72
144 #define OS_FILE_ALREADY_EXISTS 73
145 #define OS_FILE_PATH_ERROR 74
146 #define OS_FILE_AIO_RESOURCES_RESERVED 75
148 #define OS_FILE_SHARING_VIOLATION 76
149 #define OS_FILE_ERROR_NOT_SPECIFIED 77
150 #define OS_FILE_INSUFFICIENT_RESOURCE 78
151 #define OS_FILE_AIO_INTERRUPTED 79
152 #define OS_FILE_OPERATION_ABORTED 80
156 #define OS_FILE_READ 10
157 #define OS_FILE_WRITE 11
159 #define OS_FILE_LOG 256
162 #define OS_AIO_N_PENDING_IOS_PER_THREAD 32
166 #define OS_AIO_NORMAL 21
168 #define OS_AIO_IBUF 22
170 #define OS_AIO_LOG 23
171 #define OS_AIO_SYNC 24
181 #define OS_AIO_SIMULATED_WAKE_LATER 512
195 #define OS_WINVISTA 6
201 extern ulint os_n_file_reads;
202 extern ulint os_n_file_writes;
203 extern ulint os_n_fsyncs;
207 extern mysql_pfs_key_t innodb_file_data_key;
208 extern mysql_pfs_key_t innodb_file_log_key;
209 extern mysql_pfs_key_t innodb_file_temp_key;
219 # define register_pfs_file_open_begin(state, locker, key, op, name, \
220 src_file, src_line) \
222 locker = PSI_FILE_CALL(get_thread_file_name_locker)( \
223 state, key, op, name, &locker); \
224 if (UNIV_LIKELY(locker != NULL)) { \
225 PSI_FILE_CALL(start_file_open_wait)( \
226 locker, src_file, src_line); \
230 # define register_pfs_file_open_end(locker, file) \
232 if (UNIV_LIKELY(locker != NULL)) { \
233 PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(\
238 # define register_pfs_file_close_begin(state, locker, key, op, name, \
239 src_file, src_line) \
241 locker = PSI_FILE_CALL(get_thread_file_name_locker)( \
242 state, key, op, name, &locker); \
243 if (UNIV_LIKELY(locker != NULL)) { \
244 PSI_FILE_CALL(start_file_close_wait)( \
245 locker, src_file, src_line); \
249 # define register_pfs_file_close_end(locker, result) \
251 if (UNIV_LIKELY(locker != NULL)) { \
252 PSI_FILE_CALL(end_file_close_wait)( \
257 # define register_pfs_file_io_begin(state, locker, file, count, op, \
258 src_file, src_line) \
260 locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)( \
262 if (UNIV_LIKELY(locker != NULL)) { \
263 PSI_FILE_CALL(start_file_wait)( \
264 locker, count, src_file, src_line); \
268 # define register_pfs_file_io_end(locker, count) \
270 if (UNIV_LIKELY(locker != NULL)) { \
271 PSI_FILE_CALL(end_file_wait)(locker, count); \
293 # define os_file_create(key, name, create, purpose, type, success) \
294 pfs_os_file_create_func(key, name, create, purpose, type, \
295 success, __FILE__, __LINE__)
297 # define os_file_create_simple(key, name, create, access, success) \
298 pfs_os_file_create_simple_func(key, name, create, access, \
299 success, __FILE__, __LINE__)
301 # define os_file_create_simple_no_error_handling( \
302 key, name, create_mode, access, success) \
303 pfs_os_file_create_simple_no_error_handling_func( \
304 key, name, create_mode, access, success, __FILE__, __LINE__)
306 # define os_file_close(file) \
307 pfs_os_file_close_func(file, __FILE__, __LINE__)
309 # define os_aio(type, mode, name, file, buf, offset, \
310 n, message1, message2) \
311 pfs_os_aio_func(type, mode, name, file, buf, offset, \
312 n, message1, message2, __FILE__, __LINE__)
314 # define os_file_read(file, buf, offset, n) \
315 pfs_os_file_read_func(file, buf, offset, n, __FILE__, __LINE__)
317 # define os_file_read_no_error_handling(file, buf, offset, n) \
318 pfs_os_file_read_no_error_handling_func(file, buf, offset, n, \
321 # define os_file_write(name, file, buf, offset, n) \
322 pfs_os_file_write_func(name, file, buf, offset, \
323 n, __FILE__, __LINE__)
325 # define os_file_flush(file) \
326 pfs_os_file_flush_func(file, __FILE__, __LINE__)
328 # define os_file_rename(key, oldpath, newpath) \
329 pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)
331 # define os_file_delete(key, name) \
332 pfs_os_file_delete_func(key, name, __FILE__, __LINE__)
334 # define os_file_delete_if_exists(key, name) \
335 pfs_os_file_delete_if_exists_func(key, name, __FILE__, __LINE__)
340 # define os_file_create(key, name, create, purpose, type, success) \
341 os_file_create_func(name, create, purpose, type, success)
343 # define os_file_create_simple(key, name, create_mode, access, success) \
344 os_file_create_simple_func(name, create_mode, access, success)
346 # define os_file_create_simple_no_error_handling( \
347 key, name, create_mode, access, success) \
348 os_file_create_simple_no_error_handling_func( \
349 name, create_mode, access, success)
351 # define os_file_close(file) os_file_close_func(file)
353 # define os_aio(type, mode, name, file, buf, offset, n, message1, message2) \
354 os_aio_func(type, mode, name, file, buf, offset, n, \
357 # define os_file_read(file, buf, offset, n) \
358 os_file_read_func(file, buf, offset, n)
360 # define os_file_read_no_error_handling(file, buf, offset, n) \
361 os_file_read_no_error_handling_func(file, buf, offset, n)
363 # define os_file_write(name, file, buf, offset, n) \
364 os_file_write_func(name, file, buf, offset, n)
366 # define os_file_flush(file) os_file_flush_func(file)
368 # define os_file_rename(key, oldpath, newpath) \
369 os_file_rename_func(oldpath, newpath)
371 # define os_file_delete(key, name) os_file_delete_func(name)
373 # define os_file_delete_if_exists(key, name) \
374 os_file_delete_if_exists_func(name)
380 enum os_file_type_t {
381 OS_FILE_TYPE_UNKNOWN = 0,
391 #define OS_FILE_MAX_PATH 4000
419 os_get_os_version(
void);
422 #ifndef UNIV_HOTBACKUP
450 ibool error_is_fatal);
484 const char* pathname,
486 ibool fail_if_exists);
522 __attribute__((nonnull, warn_unused_result));
530 const char* file_name,
532 const char* operation_name);
556 __attribute__((nonnull, warn_unused_result));
588 const char* newpath);
611 pfs_os_file_create_simple_func(
620 const char* src_file,
622 __attribute__((nonnull, warn_unused_result));
634 pfs_os_file_create_simple_no_error_handling_func(
645 const char* src_file,
647 __attribute__((nonnull, warn_unused_result));
658 pfs_os_file_create_func(
673 const char* src_file,
675 __attribute__((nonnull, warn_unused_result));
684 pfs_os_file_close_func(
687 const char* src_file,
697 pfs_os_file_read_func(
703 const char* src_file,
715 pfs_os_file_read_no_error_handling_func(
721 const char* src_file,
751 const char* src_file,
761 pfs_os_file_write_func(
769 const char* src_file,
780 pfs_os_file_flush_func(
783 const char* src_file,
794 pfs_os_file_rename_func(
800 const char* src_file,
811 pfs_os_file_delete_func(
816 const char* src_file,
827 pfs_os_file_delete_if_exists_func(
832 const char* src_file,
836 #ifdef UNIV_HOTBACKUP
842 os_file_close_no_error_handling(
854 __attribute__((warn_unused_result));
866 __attribute__((nonnull, warn_unused_result));
894 bool report_all_errors);
958 os_file_type_t*
type);
1007 const char* old_path,
1008 const char* new_name);
1026 const char* data_dir_path,
1027 const char* tablename,
1028 const char* extention);
1045 char* data_dir_path);
1069 ulint n_slots_sync);
1156 os_aio_windows_handle(
1224 os_aio_all_slots_free(
void);
1238 bool check_rw_perm);
1241 #if !defined(UNIV_HOTBACKUP)
1253 #if defined(LINUX_NATIVE_AIO)
1264 os_aio_linux_handle(
1281 #include "os0file.ic"