change os_trim() prototype not to use int fd
authorTomohiro Kusumi <tkusumi@tuxera.com>
Tue, 29 Aug 2017 21:12:16 +0000 (00:12 +0300)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 Aug 2017 21:14:52 +0000 (15:14 -0600)
This is the same as the previous commit. The offset and length are
universal regardless of platforms, but int fd is not, thus it should
take struct fio_file*.

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>
io_u.c
os/os-android.h
os/os-dragonfly.h
os/os-freebsd.h
os/os-linux.h

diff --git a/io_u.c b/io_u.c
index ed8e84aba41f2a5c48e7d2cc66c79efd849a5c75..db043e4acce6a5c6b81a216caed5eba6ca2d587a 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -2188,7 +2188,7 @@ int do_io_u_trim(const struct thread_data *td, struct io_u *io_u)
        struct fio_file *f = io_u->file;
        int ret;
 
        struct fio_file *f = io_u->file;
        int ret;
 
-       ret = os_trim(f->fd, io_u->offset, io_u->xfer_buflen);
+       ret = os_trim(f, io_u->offset, io_u->xfer_buflen);
        if (!ret)
                return io_u->xfer_buflen;
 
        if (!ret)
                return io_u->xfer_buflen;
 
index b217daa9467314e3c9199a88634cccaf048f71c6..bb590e4786fe3f713ed7e1a1914963ecc9dc1276 100644 (file)
@@ -274,7 +274,7 @@ static inline unsigned long long get_fs_free_size(const char *path)
        return ret;
 }
 
        return ret;
 }
 
-static inline int os_trim(int fd, unsigned long long start,
+static inline int os_trim(struct fio_file *f, unsigned long long start,
                          unsigned long long len)
 {
        uint64_t range[2];
                          unsigned long long len)
 {
        uint64_t range[2];
@@ -282,7 +282,7 @@ static inline int os_trim(int fd, unsigned long long start,
        range[0] = start;
        range[1] = len;
 
        range[0] = start;
        range[1] = len;
 
-       if (!ioctl(fd, BLKDISCARD, range))
+       if (!ioctl(f->fd, BLKDISCARD, range))
                return 0;
 
        return errno;
                return 0;
 
        return errno;
index 8d15833562785ba4db31f1d31bd0e45c30587550..423b2369a071bd2de9096178ee2d3c118decabb2 100644 (file)
@@ -216,7 +216,7 @@ static inline unsigned long long get_fs_free_size(const char *path)
        return ret;
 }
 
        return ret;
 }
 
-static inline int os_trim(int fd, unsigned long long start,
+static inline int os_trim(struct fio_file *f, unsigned long long start,
                          unsigned long long len)
 {
        off_t range[2];
                          unsigned long long len)
 {
        off_t range[2];
@@ -224,7 +224,7 @@ static inline int os_trim(int fd, unsigned long long start,
        range[0] = start;
        range[1] = len;
 
        range[0] = start;
        range[1] = len;
 
-       if (!ioctl(fd, IOCTLTRIM, range))
+       if (!ioctl(f->fd, IOCTLTRIM, range))
                return 0;
 
        return errno;
                return 0;
 
        return errno;
index e6da286ea264f92fa2ed4e08d283c3bf0e4350c5..4a7cdeb7daaf2cef234c5a0c0ec551c7e72e4dad 100644 (file)
@@ -117,7 +117,7 @@ static inline unsigned long long get_fs_free_size(const char *path)
        return ret;
 }
 
        return ret;
 }
 
-static inline int os_trim(int fd, unsigned long long start,
+static inline int os_trim(struct fio_file *f, unsigned long long start,
                          unsigned long long len)
 {
        off_t range[2];
                          unsigned long long len)
 {
        off_t range[2];
@@ -125,7 +125,7 @@ static inline int os_trim(int fd, unsigned long long start,
        range[0] = start;
        range[1] = len;
 
        range[0] = start;
        range[1] = len;
 
-       if (!ioctl(fd, DIOCGDELETE, range))
+       if (!ioctl(f->fd, DIOCGDELETE, range))
                return 0;
 
        return errno;
                return 0;
 
        return errno;
index e7d600dd58cbb3f6ffd1e43f5516fdd6fc0bd18a..1ad6ebd28497e3257e52c58353881357b0c90f8e 100644 (file)
@@ -281,7 +281,7 @@ static inline unsigned long long get_fs_free_size(const char *path)
        return ret;
 }
 
        return ret;
 }
 
-static inline int os_trim(int fd, unsigned long long start,
+static inline int os_trim(struct fio_file *f, unsigned long long start,
                          unsigned long long len)
 {
        uint64_t range[2];
                          unsigned long long len)
 {
        uint64_t range[2];
@@ -289,7 +289,7 @@ static inline int os_trim(int fd, unsigned long long start,
        range[0] = start;
        range[1] = len;
 
        range[0] = start;
        range[1] = len;
 
-       if (!ioctl(fd, BLKDISCARD, range))
+       if (!ioctl(f->fd, BLKDISCARD, range))
                return 0;
 
        return errno;
                return 0;
 
        return errno;