change fio_set_odirect() prototype not to use int fd
authorTomohiro Kusumi <tkusumi@tuxera.com>
Tue, 29 Aug 2017 21:12:15 +0000 (00:12 +0300)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 Aug 2017 21:14:52 +0000 (15:14 -0600)
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>
filesetup.c
os/os-mac.h
os/os-solaris.h

index 4ceaef6b376716b2ffa0b77aa308e1d741e2c18a..c4240d2a8c9bb457ee2c92c9d5a3375a27885795 100644 (file)
@@ -1862,7 +1862,7 @@ void filesetup_mem_free(void)
 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");
index a1536c70fabaf9e2de907eab9ffec0740f2bb3db..92a60ee98766f0fc1526cd440e38a687e6cc02ae 100644 (file)
@@ -41,9 +41,9 @@ typedef unsigned int clockid_t;
 #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;
 }
index 8f8f53b621c7de8fab15fc738e7591d35d3172fa..6af25d2aee69f2306875fd0c59a2af29b3ff512d 100644 (file)
@@ -85,9 +85,9 @@ static inline long os_random_long(os_random_state_t *rs)
 
 #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;