~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/os0file.h

  • Committer: Lee Bieber
  • Date: 2010-11-14 23:15:42 UTC
  • mfrom: (1929.1.42 warning-stack-frame)
  • Revision ID: kalebral@gmail.com-20101114231542-fnnu6ydd2p17n582
Merge Monty - fix bug 672372: some functions use > 32k stack

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***********************************************************************
2
2
 
3
 
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
4
 
Copyright (C) 2009, Percona Inc.
 
3
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
 
4
Copyright (c) 2009, Percona Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted
7
7
by Percona Inc.. Those modifications are
76
76
 
77
77
#ifdef __WIN__
78
78
/** File handle */
79
 
# define os_file_t      HANDLE
 
79
#define os_file_t       HANDLE
80
80
/** Convert a C file descriptor to a native file handle
81
81
@param fd       file descriptor
82
82
@return         native file handle */
83
 
# define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
 
83
#define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd)
84
84
#else
85
85
/** File handle */
86
86
typedef int     os_file_t;
87
87
/** Convert a C file descriptor to a native file handle
88
88
@param fd       file descriptor
89
89
@return         native file handle */
90
 
# define OS_FILE_FROM_FD(fd) fd
 
90
#define OS_FILE_FROM_FD(fd) fd
91
91
#endif
92
92
 
93
93
/** Umask for creating files */
94
94
extern ulint    os_innodb_umask;
95
95
 
 
96
/** If this flag is TRUE, then we will use the native aio of the
 
97
OS (provided we compiled Innobase with it in), otherwise we will
 
98
use simulated aio we build below with threads */
 
99
 
 
100
extern ibool    os_aio_use_native_aio;
 
101
 
96
102
/** The next value should be smaller or equal to the smallest sector size used
97
103
on any disk. A log block is required to be a portion of disk which is written
98
104
so that if the start and the end of a block get written to disk, then the
135
141
#define OS_FILE_SHARING_VIOLATION       76
136
142
#define OS_FILE_ERROR_NOT_SPECIFIED     77
137
143
#define OS_FILE_INSUFFICIENT_RESOURCE   78
138
 
#define OS_FILE_AIO_INTERRUPTED         79
139
 
#define OS_FILE_OPERATION_ABORTED       80
 
144
#define OS_FILE_OPERATION_ABORTED       79
140
145
/* @} */
141
146
 
142
147
/** Types for aio operations @{ */
177
182
#define OS_WIN95        2       /*!< Microsoft Windows 95 */
178
183
#define OS_WINNT        3       /*!< Microsoft Windows NT 3.x */
179
184
#define OS_WIN2000      4       /*!< Microsoft Windows 2000 */
180
 
#define OS_WINXP        5       /*!< Microsoft Windows XP
181
 
                                or Windows Server 2003 */
182
 
#define OS_WINVISTA     6       /*!< Microsoft Windows Vista
183
 
                                or Windows Server 2008 */
184
 
#define OS_WIN7         7       /*!< Microsoft Windows 7
185
 
                                or Windows Server 2008 R2 */
186
 
 
187
185
 
188
186
extern ulint    os_n_file_reads;
189
187
extern ulint    os_n_file_writes;
190
188
extern ulint    os_n_fsyncs;
191
189
 
192
 
#ifdef UNIV_PFS_IO
193
 
/* Keys to register InnoDB I/O with performance schema */
194
 
extern mysql_pfs_key_t  innodb_file_data_key;
195
 
extern mysql_pfs_key_t  innodb_file_log_key;
196
 
extern mysql_pfs_key_t  innodb_file_temp_key;
197
 
 
198
 
/* Following four macros are instumentations to register
199
 
various file I/O operations with performance schema.
200
 
1) register_pfs_file_open_begin() and register_pfs_file_open_end() are
201
 
used to register file creation, opening, closing and renaming.
202
 
2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
203
 
used to register actual file read, write and flush */
204
 
# define register_pfs_file_open_begin(state, locker, key, op, name,     \
205
 
                                      src_file, src_line)               \
206
 
do {                                                                    \
207
 
        if (PSI_server) {                                               \
208
 
                locker = PSI_server->get_thread_file_name_locker(       \
209
 
                        state, key, op, name, &locker);                 \
210
 
                if (locker) {                                           \
211
 
                        PSI_server->start_file_open_wait(               \
212
 
                                locker, src_file, src_line);            \
213
 
                }                                                       \
214
 
        }                                                               \
215
 
} while (0)
216
 
 
217
 
# define register_pfs_file_open_end(locker, file)                       \
218
 
do {                                                                    \
219
 
        if (locker) {                                                   \
220
 
                PSI_server->end_file_open_wait_and_bind_to_descriptor(  \
221
 
                        locker, file);                                  \
222
 
        }                                                               \
223
 
} while (0)
224
 
 
225
 
# define register_pfs_file_io_begin(state, locker, file, count, op,     \
226
 
                                    src_file, src_line)                 \
227
 
do {                                                                    \
228
 
        if (PSI_server) {                                               \
229
 
                locker = PSI_server->get_thread_file_descriptor_locker( \
230
 
                        state, file, op);                               \
231
 
                if (locker) {                                           \
232
 
                        PSI_server->start_file_wait(                    \
233
 
                                locker, count, src_file, src_line);     \
234
 
                }                                                       \
235
 
        }                                                               \
236
 
} while (0)
237
 
 
238
 
# define register_pfs_file_io_end(locker, count)                        \
239
 
do {                                                                    \
240
 
        if (locker) {                                                   \
241
 
                PSI_server->end_file_wait(locker, count);               \
242
 
        }                                                               \
243
 
} while (0)
244
 
#endif /* UNIV_PFS_IO  */
245
 
 
246
 
/* Following macros/functions are file I/O APIs that would be performance
247
 
schema instrumented if "UNIV_PFS_IO" is defined. They would point to
248
 
wrapper functions with performance schema instrumentation in such case.
249
 
 
250
 
os_file_create
251
 
os_file_create_simple
252
 
os_file_create_simple_no_error_handling
253
 
os_file_close
254
 
os_file_rename
255
 
os_aio
256
 
os_file_read
257
 
os_file_read_no_error_handling
258
 
os_file_write
259
 
 
260
 
The wrapper functions have the prefix of "innodb_". */
261
 
 
262
 
#ifdef UNIV_PFS_IO
263
 
# define os_file_create(key, name, create, purpose, type, success)      \
264
 
        pfs_os_file_create_func(key, name, create, purpose,     type,   \
265
 
                                success, __FILE__, __LINE__)
266
 
 
267
 
# define os_file_create_simple(key, name, create, access, success)      \
268
 
        pfs_os_file_create_simple_func(key, name, create, access,       \
269
 
                                       success, __FILE__, __LINE__)
270
 
 
271
 
# define os_file_create_simple_no_error_handling(                       \
272
 
                key, name, create_mode, access, success)                \
273
 
        pfs_os_file_create_simple_no_error_handling_func(               \
274
 
                key, name, create_mode, access, success, __FILE__, __LINE__)
275
 
 
276
 
# define os_file_close(file)                                            \
277
 
        pfs_os_file_close_func(file, __FILE__, __LINE__)
278
 
 
279
 
# define os_aio(type, mode, name, file, buf, offset, offset_high,       \
280
 
                n, message1, message2)                                  \
281
 
        pfs_os_aio_func(type, mode, name, file, buf, offset,            \
282
 
                        offset_high, n, message1, message2,             \
283
 
                        __FILE__, __LINE__)
284
 
 
285
 
# define os_file_read(file, buf, offset, offset_high, n)                \
286
 
        pfs_os_file_read_func(file, buf, offset, offset_high, n,        \
287
 
                              __FILE__, __LINE__)
288
 
 
289
 
# define os_file_read_no_error_handling(file, buf, offset,              \
290
 
                                        offset_high, n)                 \
291
 
        pfs_os_file_read_no_error_handling_func(file, buf, offset,      \
292
 
                                                offset_high, n,         \
293
 
                                                __FILE__, __LINE__)
294
 
 
295
 
# define os_file_write(name, file, buf, offset, offset_high, n)         \
296
 
        pfs_os_file_write_func(name, file, buf, offset, offset_high,    \
297
 
                               n, __FILE__, __LINE__)
298
 
 
299
 
# define os_file_flush(file)                                            \
300
 
        pfs_os_file_flush_func(file, __FILE__, __LINE__)
301
 
 
302
 
# define os_file_rename(key, oldpath, newpath)                          \
303
 
        pfs_os_file_rename_func(key, oldpath, newpath, __FILE__, __LINE__)
304
 
#else /* UNIV_PFS_IO */
305
 
 
306
 
/* If UNIV_PFS_IO is not defined, these I/O APIs point
307
 
to original un-instrumented file I/O APIs */
308
 
# define os_file_create(key, name, create, purpose, type, success)      \
309
 
        os_file_create_func(name, create, purpose, type, success)
310
 
 
311
 
# define os_file_create_simple(key, name, create, access, success)      \
312
 
        os_file_create_simple_func(name, create_mode, access, success)
313
 
 
314
 
# define os_file_create_simple_no_error_handling(                       \
315
 
                key, name, create_mode, access, success)                \
316
 
        os_file_create_simple_no_error_handling_func(                   \
317
 
                name, create_mode, access, success)
318
 
 
319
 
# define os_file_close(file)    os_file_close_func(file)
320
 
 
321
 
# define os_aio(type, mode, name, file, buf, offset, offset_high,       \
322
 
               n, message1, message2)                                   \
323
 
        os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\
324
 
                    message1, message2)
325
 
 
326
 
# define os_file_read(file, buf, offset, offset_high, n)                \
327
 
        os_file_read_func(file, buf, offset, offset_high, n)
328
 
 
329
 
# define os_file_read_no_error_handling(file, buf, offset,              \
330
 
                                       offset_high, n)                  \
331
 
        os_file_read_no_error_handling_func(file, buf, offset, offset_high, n)
332
 
 
333
 
# define os_file_write(name, file, buf, offset, offset_high, n)         \
334
 
        os_file_write_func(name, file, buf, offset, offset_high, n)
335
 
 
336
 
# define os_file_flush(file)    os_file_flush_func(file)
337
 
 
338
 
# define os_file_rename(key, oldpath, newpath)                          \
339
 
        os_file_rename_func(oldpath, newpath)
340
 
 
341
 
#endif /* UNIV_PFS_IO */
342
 
 
343
190
/* File types for directory entry data type */
344
191
 
345
192
enum os_file_type_enum{
375
222
 
376
223
/***********************************************************************//**
377
224
Gets the operating system version. Currently works only on Windows.
378
 
@return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000, OS_WINXP, OS_WINVISTA,
379
 
OS_WIN7. */
 
225
@return OS_WIN95, OS_WIN31, OS_WINNT, or OS_WIN2000 */
380
226
UNIV_INTERN
381
227
ulint
382
228
os_get_os_version(void);
391
237
/***********************************************************************//**
392
238
Creates a temporary file.  This function is like tmpfile(3), but
393
239
the temporary file is created in the MySQL temporary directory.
 
240
On Netware, this function is like tmpfile(3), because the C run-time
 
241
library of Netware does not expose the delete-on-close flag.
394
242
@return temporary file handle, or NULL on error */
395
243
 
396
244
FILE*
448
296
        ibool           fail_if_exists);/*!< in: if TRUE, pre-existing directory
449
297
                                        is treated as an error. */
450
298
/****************************************************************//**
451
 
NOTE! Use the corresponding macro os_file_create_simple(), not directly
452
 
this function!
453
299
A simple function to open or create a file.
454
300
@return own: handle to the file, not defined if error, error number
455
301
can be retrieved with os_file_get_last_error */
456
302
UNIV_INTERN
457
303
os_file_t
458
 
os_file_create_simple_func(
459
 
/*=======================*/
 
304
os_file_create_simple(
 
305
/*==================*/
460
306
        const char*     name,   /*!< in: name of the file or path as a
461
307
                                null-terminated string */
462
308
        ulint           create_mode,/*!< in: OS_FILE_OPEN if an existing file is
470
316
                                OS_FILE_READ_WRITE */
471
317
        ibool*          success);/*!< out: TRUE if succeed, FALSE if error */
472
318
/****************************************************************//**
473
 
NOTE! Use the corresponding macro
474
 
os_file_create_simple_no_error_handling(), not directly this function!
475
319
A simple function to open or create a file.
476
320
@return own: handle to the file, not defined if error, error number
477
321
can be retrieved with os_file_get_last_error */
478
322
UNIV_INTERN
479
323
os_file_t
480
 
os_file_create_simple_no_error_handling_func(
481
 
/*=========================================*/
 
324
os_file_create_simple_no_error_handling(
 
325
/*====================================*/
482
326
        const char*     name,   /*!< in: name of the file or path as a
483
327
                                null-terminated string */
484
328
        ulint           create_mode,/*!< in: OS_FILE_OPEN if an existing file
502
346
        const char*     operation_name);/*!< in: "open" or "create"; used in the
503
347
                                        diagnostic message */
504
348
/****************************************************************//**
505
 
NOTE! Use the corresponding macro os_file_create(), not directly
506
 
this function!
507
349
Opens an existing file or creates a new.
508
350
@return own: handle to the file, not defined if error, error number
509
351
can be retrieved with os_file_get_last_error */
510
352
UNIV_INTERN
511
353
os_file_t
512
 
os_file_create_func(
513
 
/*================*/
 
354
os_file_create(
 
355
/*===========*/
514
356
        const char*     name,   /*!< in: name of the file or path as a
515
357
                                null-terminated string */
516
358
        ulint           create_mode,/*!< in: OS_FILE_OPEN if an existing file
548
390
/*=====================*/
549
391
        const char*     name);  /*!< in: file path as a null-terminated string */
550
392
/***********************************************************************//**
551
 
NOTE! Use the corresponding macro os_file_rename(), not directly
552
 
this function!
553
393
Renames a file (can also move it to another directory). It is safest that the
554
394
file is closed before calling this function.
555
395
@return TRUE if success */
556
396
UNIV_INTERN
557
397
ibool
558
 
os_file_rename_func(
559
 
/*================*/
 
398
os_file_rename(
 
399
/*===========*/
560
400
        const char*     oldpath,        /*!< in: old file path as a
561
401
                                        null-terminated string */
562
402
        const char*     newpath);       /*!< in: new file path */
563
403
/***********************************************************************//**
564
 
NOTE! Use the corresponding macro os_file_close(), not directly this
565
 
function!
566
404
Closes a file handle. In case of error, error number can be retrieved with
567
405
os_file_get_last_error.
568
406
@return TRUE if success */
569
407
UNIV_INTERN
570
408
ibool
571
 
os_file_close_func(
572
 
/*===============*/
 
409
os_file_close(
 
410
/*==========*/
573
411
        os_file_t       file);  /*!< in, own: handle to a file */
574
 
 
575
 
#ifdef UNIV_PFS_IO
576
 
/****************************************************************//**
577
 
NOTE! Please use the corresponding macro os_file_create_simple(),
578
 
not directly this function!
579
 
A performance schema instrumented wrapper function for
580
 
os_file_create_simple() which opens or creates a file.
581
 
@return own: handle to the file, not defined if error, error number
582
 
can be retrieved with os_file_get_last_error */
583
 
UNIV_INLINE
584
 
os_file_t
585
 
pfs_os_file_create_simple_func(
586
 
/*===========================*/
587
 
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
588
 
        const char*     name,   /*!< in: name of the file or path as a
589
 
                                null-terminated string */
590
 
        ulint           create_mode,/*!< in: OS_FILE_OPEN if an existing file is
591
 
                                opened (if does not exist, error), or
592
 
                                OS_FILE_CREATE if a new file is created
593
 
                                (if exists, error), or
594
 
                                OS_FILE_CREATE_PATH if new file
595
 
                                (if exists, error) and subdirectories along
596
 
                                its path are created (if needed)*/
597
 
        ulint           access_type,/*!< in: OS_FILE_READ_ONLY or
598
 
                                OS_FILE_READ_WRITE */
599
 
        ibool*          success,/*!< out: TRUE if succeed, FALSE if error */
600
 
        const char*     src_file,/*!< in: file name where func invoked */
601
 
        ulint           src_line);/*!< in: line where the func invoked */
602
 
 
603
 
/****************************************************************//**
604
 
NOTE! Please use the corresponding macro
605
 
os_file_create_simple_no_error_handling(), not directly this function!
606
 
A performance schema instrumented wrapper function for
607
 
os_file_create_simple_no_error_handling(). Add instrumentation to
608
 
monitor file creation/open.
609
 
@return own: handle to the file, not defined if error, error number
610
 
can be retrieved with os_file_get_last_error */
611
 
UNIV_INLINE
612
 
os_file_t
613
 
pfs_os_file_create_simple_no_error_handling_func(
614
 
/*=============================================*/
615
 
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
616
 
        const char*     name,   /*!< in: name of the file or path as a
617
 
                                null-terminated string */
618
 
        ulint           create_mode,/*!< in: OS_FILE_OPEN if an existing file
619
 
                                is opened (if does not exist, error), or
620
 
                                OS_FILE_CREATE if a new file is created
621
 
                                (if exists, error) */
622
 
        ulint           access_type,/*!< in: OS_FILE_READ_ONLY,
623
 
                                OS_FILE_READ_WRITE, or
624
 
                                OS_FILE_READ_ALLOW_DELETE; the last option is
625
 
                                used by a backup program reading the file */
626
 
        ibool*          success,/*!< out: TRUE if succeed, FALSE if error */
627
 
        const char*     src_file,/*!< in: file name where func invoked */
628
 
        ulint           src_line);/*!< in: line where the func invoked */
629
 
 
630
 
/****************************************************************//**
631
 
NOTE! Please use the corresponding macro os_file_create(), not directly
632
 
this function!
633
 
A performance schema wrapper function for os_file_create().
634
 
Add instrumentation to monitor file creation/open.
635
 
@return own: handle to the file, not defined if error, error number
636
 
can be retrieved with os_file_get_last_error */
637
 
UNIV_INLINE
638
 
os_file_t
639
 
pfs_os_file_create_func(
640
 
/*====================*/
641
 
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
642
 
        const char*     name,   /*!< in: name of the file or path as a
643
 
                                null-terminated string */
644
 
        ulint           create_mode,/*!< in: OS_FILE_OPEN if an existing file
645
 
                                is opened (if does not exist, error), or
646
 
                                OS_FILE_CREATE if a new file is created
647
 
                                (if exists, error),
648
 
                                OS_FILE_OVERWRITE if a new file is created
649
 
                                or an old overwritten;
650
 
                                OS_FILE_OPEN_RAW, if a raw device or disk
651
 
                                partition should be opened */
652
 
        ulint           purpose,/*!< in: OS_FILE_AIO, if asynchronous,
653
 
                                non-buffered i/o is desired,
654
 
                                OS_FILE_NORMAL, if any normal file;
655
 
                                NOTE that it also depends on type, os_aio_..
656
 
                                and srv_.. variables whether we really use
657
 
                                async i/o or unbuffered i/o: look in the
658
 
                                function source code for the exact rules */
659
 
        ulint           type,   /*!< in: OS_DATA_FILE or OS_LOG_FILE */
660
 
        ibool*          success,/*!< out: TRUE if succeed, FALSE if error */
661
 
        const char*     src_file,/*!< in: file name where func invoked */
662
 
        ulint           src_line);/*!< in: line where the func invoked */
663
 
 
664
 
/***********************************************************************//**
665
 
NOTE! Please use the corresponding macro os_file_close(), not directly
666
 
this function!
667
 
A performance schema instrumented wrapper function for os_file_close().
668
 
@return TRUE if success */
669
 
UNIV_INLINE
670
 
ibool
671
 
pfs_os_file_close_func(
672
 
/*===================*/
673
 
        os_file_t       file,   /*!< in, own: handle to a file */
674
 
        const char*     src_file,/*!< in: file name where func invoked */
675
 
        ulint           src_line);/*!< in: line where the func invoked */
676
 
/*******************************************************************//**
677
 
NOTE! Please use the corresponding macro os_file_read(), not directly
678
 
this function!
679
 
This is the performance schema instrumented wrapper function for
680
 
os_file_read() which requests a synchronous read operation.
681
 
@return TRUE if request was successful, FALSE if fail */
682
 
UNIV_INLINE
683
 
ibool
684
 
pfs_os_file_read_func(
685
 
/*==================*/
686
 
        os_file_t       file,   /*!< in: handle to a file */
687
 
        void*           buf,    /*!< in: buffer where to read */
688
 
        ulint           offset, /*!< in: least significant 32 bits of file
689
 
                                offset where to read */
690
 
        ulint           offset_high,/*!< in: most significant 32 bits of
691
 
                                offset */
692
 
        ulint           n,      /*!< in: number of bytes to read */
693
 
        const char*     src_file,/*!< in: file name where func invoked */
694
 
        ulint           src_line);/*!< in: line where the func invoked */
695
 
 
696
 
/*******************************************************************//**
697
 
NOTE! Please use the corresponding macro os_file_read_no_error_handling(),
698
 
not directly this function!
699
 
This is the performance schema instrumented wrapper function for
700
 
os_file_read_no_error_handling_func() which requests a synchronous
701
 
read operation.
702
 
@return TRUE if request was successful, FALSE if fail */
703
 
UNIV_INLINE
704
 
ibool
705
 
pfs_os_file_read_no_error_handling_func(
706
 
/*====================================*/
707
 
        os_file_t       file,   /*!< in: handle to a file */
708
 
        void*           buf,    /*!< in: buffer where to read */
709
 
        ulint           offset, /*!< in: least significant 32 bits of file
710
 
                                offset where to read */
711
 
        ulint           offset_high,/*!< in: most significant 32 bits of
712
 
                                offset */
713
 
        ulint           n,      /*!< in: number of bytes to read */
714
 
        const char*     src_file,/*!< in: file name where func invoked */
715
 
        ulint           src_line);/*!< in: line where the func invoked */
716
 
 
717
 
/*******************************************************************//**
718
 
NOTE! Please use the corresponding macro os_aio(), not directly this
719
 
function!
720
 
Performance schema wrapper function of os_aio() which requests
721
 
an asynchronous i/o operation.
722
 
@return TRUE if request was queued successfully, FALSE if fail */
723
 
UNIV_INLINE
724
 
ibool
725
 
pfs_os_aio_func(
726
 
/*============*/
727
 
        ulint           type,   /*!< in: OS_FILE_READ or OS_FILE_WRITE */
728
 
        ulint           mode,   /*!< in: OS_AIO_NORMAL etc. I/O mode */
729
 
        const char*     name,   /*!< in: name of the file or path as a
730
 
                                null-terminated string */
731
 
        os_file_t       file,   /*!< in: handle to a file */
732
 
        void*           buf,    /*!< in: buffer where to read or from which
733
 
                                to write */
734
 
        ulint           offset, /*!< in: least significant 32 bits of file
735
 
                                offset where to read or write */
736
 
        ulint           offset_high,/*!< in: most significant 32 bits of
737
 
                                offset */
738
 
        ulint           n,      /*!< in: number of bytes to read or write */
739
 
        fil_node_t*     message1,/*!< in: message for the aio handler
740
 
                                (can be used to identify a completed
741
 
                                aio operation); ignored if mode is
742
 
                                OS_AIO_SYNC */
743
 
        void*           message2,/*!< in: message for the aio handler
744
 
                                (can be used to identify a completed
745
 
                                aio operation); ignored if mode is
746
 
                                OS_AIO_SYNC */
747
 
        const char*     src_file,/*!< in: file name where func invoked */
748
 
        ulint           src_line);/*!< in: line where the func invoked */
749
 
/*******************************************************************//**
750
 
NOTE! Please use the corresponding macro os_file_write(), not directly
751
 
this function!
752
 
This is the performance schema instrumented wrapper function for
753
 
os_file_write() which requests a synchronous write operation.
754
 
@return TRUE if request was successful, FALSE if fail */
755
 
UNIV_INLINE
756
 
ibool
757
 
pfs_os_file_write_func(
758
 
/*===================*/
759
 
        const char*     name,   /*!< in: name of the file or path as a
760
 
                                null-terminated string */
761
 
        os_file_t       file,   /*!< in: handle to a file */
762
 
        const void*     buf,    /*!< in: buffer from which to write */
763
 
        ulint           offset, /*!< in: least significant 32 bits of file
764
 
                                offset where to write */
765
 
        ulint           offset_high,/*!< in: most significant 32 bits of
766
 
                                offset */
767
 
        ulint           n,      /*!< in: number of bytes to write */
768
 
        const char*     src_file,/*!< in: file name where func invoked */
769
 
        ulint           src_line);/*!< in: line where the func invoked */
770
 
/***********************************************************************//**
771
 
NOTE! Please use the corresponding macro os_file_flush(), not directly
772
 
this function!
773
 
This is the performance schema instrumented wrapper function for
774
 
os_file_flush() which flushes the write buffers of a given file to the disk.
775
 
Flushes the write buffers of a given file to the disk.
776
 
@return TRUE if success */
777
 
UNIV_INLINE
778
 
ibool
779
 
pfs_os_file_flush_func(
780
 
/*===================*/
781
 
        os_file_t       file,   /*!< in, own: handle to a file */
782
 
        const char*     src_file,/*!< in: file name where func invoked */
783
 
        ulint           src_line);/*!< in: line where the func invoked */
784
 
 
785
 
/***********************************************************************//**
786
 
NOTE! Please use the corresponding macro os_file_rename(), not directly
787
 
this function!
788
 
This is the performance schema instrumented wrapper function for
789
 
os_file_rename()
790
 
@return TRUE if success */
791
 
UNIV_INLINE
792
 
ibool
793
 
pfs_os_file_rename_func(
794
 
/*====================*/
795
 
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
796
 
        const char*     oldpath,/*!< in: old file path as a null-terminated
797
 
                                string */
798
 
        const char*     newpath,/*!< in: new file path */
799
 
        const char*     src_file,/*!< in: file name where func invoked */
800
 
        ulint           src_line);/*!< in: line where the func invoked */
801
 
#endif  /* UNIV_PFS_IO */
802
 
 
803
412
#ifdef UNIV_HOTBACKUP
804
413
/***********************************************************************//**
805
414
Closes a file handle.
851
460
/*============*/
852
461
        FILE*           file);  /*!< in: file to be truncated */
853
462
/***********************************************************************//**
854
 
NOTE! Use the corresponding macro os_file_flush(), not directly this function!
855
463
Flushes the write buffers of a given file to the disk.
856
464
@return TRUE if success */
857
465
UNIV_INTERN
858
466
ibool
859
 
os_file_flush_func(
860
 
/*===============*/
 
467
os_file_flush(
 
468
/*==========*/
861
469
        os_file_t       file);  /*!< in, own: handle to a file */
862
470
/***********************************************************************//**
863
471
Retrieves the last error number if an error occurs in a file io function.
872
480
        ibool   report_all_errors);     /*!< in: TRUE if we want an error message
873
481
                                        printed of all errors */
874
482
/*******************************************************************//**
875
 
NOTE! Use the corresponding macro os_file_read(), not directly this function!
876
483
Requests a synchronous read operation.
877
484
@return TRUE if request was successful, FALSE if fail */
878
485
UNIV_INTERN
879
486
ibool
880
 
os_file_read_func(
881
 
/*==============*/
 
487
os_file_read(
 
488
/*=========*/
882
489
        os_file_t       file,   /*!< in: handle to a file */
883
490
        void*           buf,    /*!< in: buffer where to read */
884
491
        ulint           offset, /*!< in: least significant 32 bits of file
898
505
        char*   str,    /*!< in: buffer where to read */
899
506
        ulint   size);  /*!< in: size of buffer */
900
507
/*******************************************************************//**
901
 
NOTE! Use the corresponding macro os_file_read_no_error_handling(),
902
 
not directly this function!
903
508
Requests a synchronous positioned read operation. This function does not do
904
509
any error handling. In case of error it returns FALSE.
905
510
@return TRUE if request was successful, FALSE if fail */
906
511
UNIV_INTERN
907
512
ibool
908
 
os_file_read_no_error_handling_func(
909
 
/*================================*/
 
513
os_file_read_no_error_handling(
 
514
/*===========================*/
910
515
        os_file_t       file,   /*!< in: handle to a file */
911
516
        void*           buf,    /*!< in: buffer where to read */
912
517
        ulint           offset, /*!< in: least significant 32 bits of file
916
521
        ulint           n);     /*!< in: number of bytes to read */
917
522
 
918
523
/*******************************************************************//**
919
 
NOTE! Use the corresponding macro os_file_write(), not directly this
920
 
function!
921
524
Requests a synchronous write operation.
922
525
@return TRUE if request was successful, FALSE if fail */
923
526
UNIV_INTERN
924
527
ibool
925
 
os_file_write_func(
926
 
/*===============*/
 
528
os_file_write(
 
529
/*==========*/
927
530
        const char*     name,   /*!< in: name of the file or path as a
928
531
                                null-terminated string */
929
532
        os_file_t       file,   /*!< in: handle to a file */
992
595
segment in these arrays. This function also creates the sync array.
993
596
No i/o handler thread needs to be created for that */
994
597
UNIV_INTERN
995
 
ibool
 
598
void
996
599
os_aio_init(
997
600
/*========*/
998
601
        ulint   n_per_seg,      /*<! in: maximum number of pending aio
1009
612
/*=============*/
1010
613
 
1011
614
/*******************************************************************//**
1012
 
NOTE! Use the corresponding macro os_aio(), not directly this function!
1013
615
Requests an asynchronous i/o operation.
1014
616
@return TRUE if request was queued successfully, FALSE if fail */
1015
617
UNIV_INTERN
1016
618
ibool
1017
 
os_aio_func(
1018
 
/*========*/
 
619
os_aio(
 
620
/*===*/
1019
621
        ulint           type,   /*!< in: OS_FILE_READ or OS_FILE_WRITE */
1020
622
        ulint           mode,   /*!< in: OS_AIO_NORMAL, ..., possibly ORed
1021
623
                                to OS_AIO_SIMULATED_WAKE_LATER: the
1172
774
        os_file_stat_t* stat_info);     /*!< information of a file in a
1173
775
                                        directory */
1174
776
 
1175
 
#if !defined(UNIV_HOTBACKUP)
 
777
#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
1176
778
/*********************************************************************//**
1177
779
Creates a temporary file that will be deleted on close.
1178
780
This function is defined in ha_innodb.cc.
1181
783
int
1182
784
innobase_mysql_tmpfile(void);
1183
785
/*========================*/
1184
 
#endif /* !UNIV_HOTBACKUP */
1185
 
 
1186
 
 
1187
 
#if defined(LINUX_NATIVE_AIO)
1188
 
/**************************************************************************
1189
 
This function is only used in Linux native asynchronous i/o.
1190
 
Waits for an aio operation to complete. This function is used to wait the
1191
 
for completed requests. The aio array of pending requests is divided
1192
 
into segments. The thread specifies which segment or slot it wants to wait
1193
 
for. NOTE: this function will also take care of freeing the aio slot,
1194
 
therefore no other thread is allowed to do the freeing!
1195
 
@return TRUE if the IO was successful */
1196
 
UNIV_INTERN
1197
 
ibool
1198
 
os_aio_linux_handle(
1199
 
/*================*/
1200
 
        ulint   global_seg,     /*!< in: segment number in the aio array
1201
 
                                to wait for; segment 0 is the ibuf
1202
 
                                i/o thread, segment 1 is log i/o thread,
1203
 
                                then follow the non-ibuf read threads,
1204
 
                                and the last are the non-ibuf write
1205
 
                                threads. */
1206
 
        fil_node_t**message1,   /*!< out: the messages passed with the */
1207
 
        void**  message2,       /*!< aio request; note that in case the
1208
 
                                aio operation failed, these output
1209
 
                                parameters are valid and can be used to
1210
 
                                restart the operation. */
1211
 
        ulint*  type);          /*!< out: OS_FILE_WRITE or ..._READ */
1212
 
#endif /* LINUX_NATIVE_AIO */
1213
 
 
1214
 
#ifndef UNIV_NONINL
1215
 
#include "os0file.ic"
1216
 
#endif
 
786
#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
1217
787
 
1218
788
#endif