This function should take struct fio_file*, since the idea of integer
fd in unix likes isn't necessarily usable on other platforms (Windows).
In fact, other fd related functions under os/ don't take int fd for
portability even if some of them work fine with int fd at the moment.
(OS headers basically (should)have no dependencies on fio functions
and structures, but struct fio_file is the only exception.)
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
int fio_set_directio(struct thread_data *td, struct fio_file *f)
{
#ifdef FIO_OS_DIRECTIO
- int ret = fio_set_odirect(f->fd);
+ int ret = fio_set_odirect(f);
if (ret) {
td_verror(td, ret, "fio_set_directio");
#endif
#define FIO_OS_DIRECTIO
-static inline int fio_set_odirect(int fd)
+static inline int fio_set_odirect(struct fio_file *f)
{
- if (fcntl(fd, F_NOCACHE, 1) == -1)
+ if (fcntl(f->fd, F_NOCACHE, 1) == -1)
return errno;
return 0;
}
#define FIO_OS_DIRECTIO
extern int directio(int, int);
-static inline int fio_set_odirect(int fd)
+static inline int fio_set_odirect(struct fio_file *f)
{
- if (directio(fd, DIRECTIO_ON) < 0)
+ if (directio(f->fd, DIRECTIO_ON) < 0)
return errno;
return 0;