51 extern ibool os_do_not_call_flush_at_each_write;
53 extern ibool os_has_said_disk_full;
74 #define UNIV_NON_BUFFERED_IO
80 # define os_file_t HANDLE
84 # define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
91 # define OS_FILE_FROM_FD(fd) fd
104 #define OS_FILE_LOG_BLOCK_SIZE srv_log_block_size
107 #define OS_FILE_OPEN 51
108 #define OS_FILE_CREATE 52
109 #define OS_FILE_OVERWRITE 53
110 #define OS_FILE_OPEN_RAW 54
111 #define OS_FILE_CREATE_PATH 55
112 #define OS_FILE_OPEN_RETRY 56
115 #define OS_FILE_READ_ONLY 333
116 #define OS_FILE_READ_WRITE 444
117 #define OS_FILE_READ_ALLOW_DELETE 555
120 #define OS_FILE_AIO 61
121 #define OS_FILE_NORMAL 62
125 #define OS_DATA_FILE 100
126 #define OS_LOG_FILE 101
130 #define OS_FILE_NOT_FOUND 71
131 #define OS_FILE_DISK_FULL 72
132 #define OS_FILE_ALREADY_EXISTS 73
133 #define OS_FILE_PATH_ERROR 74
134 #define OS_FILE_AIO_RESOURCES_RESERVED 75
136 #define OS_FILE_SHARING_VIOLATION 76
137 #define OS_FILE_ERROR_NOT_SPECIFIED 77
138 #define OS_FILE_INSUFFICIENT_RESOURCE 78
139 #define OS_FILE_AIO_INTERRUPTED 79
140 #define OS_FILE_OPERATION_ABORTED 80
144 #define OS_FILE_READ 10
145 #define OS_FILE_WRITE 11
147 #define OS_FILE_LOG 256
150 #define OS_AIO_N_PENDING_IOS_PER_THREAD 32
154 #define OS_AIO_NORMAL 21
156 #define OS_AIO_IBUF 22
158 #define OS_AIO_LOG 23
159 #define OS_AIO_SYNC 24
169 #define OS_AIO_SIMULATED_WAKE_LATER 512
183 #define OS_WINVISTA 6
189 extern ulint os_n_file_reads;
190 extern ulint os_n_file_writes;
191 extern ulint os_n_fsyncs;
193 extern uint32_t srv_log_block_size;
197 extern mysql_pfs_key_t innodb_file_data_key;
198 extern mysql_pfs_key_t innodb_file_log_key;
199 extern mysql_pfs_key_t innodb_file_temp_key;
207 # define register_pfs_file_open_begin(state, locker, key, op, name, \
208 src_file, src_line) \
211 locker = PSI_server->get_thread_file_name_locker( \
212 state, key, op, name, &locker); \
214 PSI_server->start_file_open_wait( \
215 locker, src_file, src_line); \
220 # define register_pfs_file_open_end(locker, file) \
223 PSI_server->end_file_open_wait_and_bind_to_descriptor( \
228 # define register_pfs_file_io_begin(state, locker, file, count, op, \
229 src_file, src_line) \
232 locker = PSI_server->get_thread_file_descriptor_locker( \
235 PSI_server->start_file_wait( \
236 locker, count, src_file, src_line); \
241 # define register_pfs_file_io_end(locker, count) \
244 PSI_server->end_file_wait(locker, count); \
266 # define os_file_create(key, name, create, purpose, type, success) \
267 pfs_os_file_create_func(key, name, create, purpose, type, \
268 success, __FILE__, __LINE__)
270 # define os_file_create_simple(key, name, create, access, success) \
271 pfs_os_file_create_simple_func(key, name, create, access, \
272 success, __FILE__, __LINE__)
274 # define os_file_create_simple_no_error_handling( \
275 key, name, create_mode, access, success) \
276 pfs_os_file_create_simple_no_error_handling_func( \
277 key, name, create_mode, access, success, __FILE__, __LINE__)
279 # define os_file_close(file) \
280 pfs_os_file_close_func(file, __FILE__, __LINE__)
282 # define os_aio(type, mode, name, file, buf, offset, offset_high, \
283 n, message1, message2) \
284 pfs_os_aio_func(type, mode, name, file, buf, offset, \
285 offset_high, n, message1, message2, \
288 # define os_file_read(file, buf, offset, offset_high, n) \
289 pfs_os_file_read_func(file, buf, offset, offset_high, n, \
292 # define os_file_read_no_error_handling(file, buf, offset, \
294 pfs_os_file_read_no_error_handling_func(file, buf, offset, \
298 # define os_file_write(name, file, buf, offset, offset_high, n) \
299 pfs_os_file_write_func(name, file, buf, offset, offset_high, \
300 n, __FILE__, __LINE__)
302 # define os_file_flush(file) \
303 pfs_os_file_flush_func(file, __FILE__, __LINE__)
305 # define os_file_rename(key, oldpath, newpath) \
306 pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)
311 # define os_file_create(key, name, create, purpose, type, success) \
312 os_file_create_func(name, create, purpose, type, success)
314 # define os_file_create_simple(key, name, create, access, success) \
315 os_file_create_simple_func(name, create_mode, access, success)
317 # define os_file_create_simple_no_error_handling( \
318 key, name, create_mode, access, success) \
319 os_file_create_simple_no_error_handling_func( \
320 name, create_mode, access, success)
322 # define os_file_close(file) os_file_close_func(file)
324 # define os_aio(type, mode, name, file, buf, offset, offset_high, \
325 n, message1, message2) \
326 os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\
329 # define os_file_read(file, buf, offset, offset_high, n) \
330 os_file_read_func(file, buf, offset, offset_high, n)
332 # define os_file_read_no_error_handling(file, buf, offset, \
334 os_file_read_no_error_handling_func(file, buf, offset, offset_high, n)
336 # define os_file_write(name, file, buf, offset, offset_high, n) \
337 os_file_write_func(name, file, buf, offset, offset_high, n)
339 # define os_file_flush(file) os_file_flush_func(file)
341 # define os_file_rename(key, oldpath, newpath) \
342 os_file_rename_func(oldpath, newpath)
348 enum os_file_type_enum{
349 OS_FILE_TYPE_UNKNOWN = 0,
354 typedef enum os_file_type_enum os_file_type_t;
360 #define OS_FILE_MAX_PATH 4000
364 char name[OS_FILE_MAX_PATH];
386 os_get_os_version(
void);
389 #ifndef UNIV_HOTBACKUP
417 ibool error_is_fatal);
451 const char* pathname,
453 ibool fail_if_exists);
505 const char* file_name,
507 const char* operation_name);
567 const char* newpath);
590 pfs_os_file_create_simple_func(
605 const char* src_file,
618 pfs_os_file_create_simple_no_error_handling_func(
632 const char* src_file,
644 pfs_os_file_create_func(
666 const char* src_file,
676 pfs_os_file_close_func(
679 const char* src_file,
689 pfs_os_file_read_func(
698 const char* src_file,
710 pfs_os_file_read_no_error_handling_func(
719 const char* src_file,
752 const char* src_file,
762 pfs_os_file_write_func(
773 const char* src_file,
784 pfs_os_file_flush_func(
787 const char* src_file,
798 pfs_os_file_rename_func(
804 const char* src_file,
808 #ifdef UNIV_HOTBACKUP
814 os_file_close_no_error_handling(
877 ibool report_all_errors);
950 os_file_type_t*
type);
1007 ulint n_slots_sync);
1097 os_aio_windows_handle(
1165 os_aio_all_slots_free(
void);
1180 #if !defined(UNIV_HOTBACKUP)
1192 #if defined(LINUX_NATIVE_AIO)
1203 os_aio_linux_handle(
1220 #include "os0file.ic"
UNIV_INTERN ibool os_file_close_func(os_file_t file)
FILE * os_file_create_tmpfile(void)
ulint os_file_n_pending_pwrites
UNIV_INTERN ibool os_file_create_directory(const char *pathname, ibool fail_if_exists)
UNIV_INTERN void os_aio_simulated_put_read_threads_to_sleep(void)
ulint os_file_n_pending_preads
UNIV_INTERN void os_file_set_nocache(int fd, const char *file_name, const char *operation_name)
UNIV_INTERN ib_int64_t os_file_get_size_as_iblonglong(os_file_t file)
UNIV_INTERN void os_io_init_simple(void)
UNIV_INTERN ibool os_file_get_size(os_file_t file, ulint *size, ulint *size_high)
UNIV_INTERN ibool os_file_read_no_error_handling_func(os_file_t file, void *buf, ulint offset, ulint offset_high, ulint n)
UNIV_INTERN ibool os_file_create_subdirs_if_needed(const char *path)
UNIV_INTERN ibool os_file_delete_if_exists(const char *name)
UNIV_INTERN void os_aio_wake_all_threads_at_shutdown(void)
UNIV_INTERN os_file_t os_file_create_simple_no_error_handling_func(const char *name, ulint create_mode, ulint access_type, ibool *success)
UNIV_INTERN ibool os_file_read_func(os_file_t file, void *buf, ulint offset, ulint offset_high, ulint n)
UNIV_INTERN void os_aio_print(FILE *file)
UNIV_INTERN int os_file_readdir_next_file(const char *dirname, os_file_dir_t dir, os_file_stat_t *info)
UNIV_INTERN char * os_file_dirname(const char *path)
UNIV_INTERN ibool os_file_rename_func(const char *oldpath, const char *newpath)
UNIV_INTERN os_file_dir_t os_file_opendir(const char *dirname, ibool error_is_fatal)
UNIV_INTERN ibool os_aio_simulated_handle(ulint segment, fil_node_t **message1, void **message2, ulint *type)
UNIV_INTERN ibool os_aio_validate(void)
UNIV_INTERN ibool os_file_write_func(const char *name, os_file_t file, const void *buf, ulint offset, ulint offset_high, ulint n)
UNIV_INTERN ibool os_file_get_status(const char *path, os_file_stat_t *stat_info)
UNIV_INTERN os_file_t os_file_create_simple_func(const char *name, ulint create_mode, ulint access_type, ibool *success)
UNIV_INTERN ibool os_file_set_eof(FILE *file)
UNIV_INTERN os_file_t os_file_create_func(const char *name, ulint create_mode, ulint purpose, ulint type, ibool *success)
UNIV_INTERN int os_file_closedir(os_file_dir_t dir)
UNIV_INTERN void os_file_read_string(FILE *file, char *str, ulint size)
UNIV_INTERN void os_aio_wait_until_no_pending_writes(void)
UNIV_INTERN ulint os_file_get_last_error(ibool report_all_errors)
UNIV_INTERN ibool os_file_delete(const char *name)
UNIV_INTERN ibool os_file_set_size(const char *name, os_file_t file, ulint size, ulint size_high)
UNIV_INTERN void os_aio_refresh_stats(void)
UNIV_INTERN ibool os_file_flush_func(os_file_t file)
UNIV_INTERN void os_aio_simulated_wake_handler_threads(void)
UNIV_INTERN int innobase_mysql_tmpfile(void)
UNIV_INTERN ibool os_file_status(const char *path, ibool *exists, os_file_type_t *type)
char name[OS_FILE_MAX_PATH]
UNIV_INTERN ibool os_aio_func(ulint type, ulint mode, const char *name, os_file_t file, void *buf, ulint offset, ulint offset_high, ulint n, fil_node_t *message1, void *message2)
ulint os_n_pending_writes