added QSE_FIO_NOCACHE.
map QSE_FIO_SEQUENTIAL and QSE_FIO_RANDOM to some posix_fadvise flags if available
This commit is contained in:
@ -155,6 +155,8 @@ int qse_fio_init (
|
||||
flag_and_attr |= FILE_FLAG_RANDOM_ACCESS;
|
||||
if (flags & QSE_FIO_SEQUENTIAL)
|
||||
flag_and_attr |= FILE_FLAG_SEQUENTIAL_SCAN;
|
||||
if (flags & QSE_FIO_NOCACHE)
|
||||
flag_and_attr |= FILE_FLAG_NO_BUFFERING;
|
||||
|
||||
handle = CreateFile (
|
||||
path, desired_access, share_mode,
|
||||
@ -369,6 +371,20 @@ int qse_fio_init (
|
||||
|
||||
if (handle == -1) return -1;
|
||||
|
||||
/* set some file access hints */
|
||||
#if defined(POSIX_FADV_RANDOM)
|
||||
if (flags & QSE_FIO_RANDOM)
|
||||
posix_fadvise (handle, 0, 0, POSIX_FADV_RANDOM);
|
||||
#endif
|
||||
#if defined(POSIX_FADV_SEQUENTIAL)
|
||||
if (flags & QSE_FIO_SEQUENTIAL)
|
||||
posix_fadvise (handle, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
#endif
|
||||
#if defined(POSIX_FADV_DONTNEED)
|
||||
if (flags & QSE_FIO_NOCACHE)
|
||||
posix_fadvise (handle, 0, 0, POSIX_FADV_DONTNEED);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (flags & QSE_FIO_TEXT)
|
||||
|
Reference in New Issue
Block a user