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>
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;
-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];
range[0] = start;
range[1] = len;
range[0] = start;
range[1] = len;
- if (!ioctl(fd, BLKDISCARD, range))
+ if (!ioctl(f->fd, BLKDISCARD, range))
-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];
range[0] = start;
range[1] = len;
range[0] = start;
range[1] = len;
- if (!ioctl(fd, IOCTLTRIM, range))
+ if (!ioctl(f->fd, IOCTLTRIM, range))
-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];
range[0] = start;
range[1] = len;
range[0] = start;
range[1] = len;
- if (!ioctl(fd, DIOCGDELETE, range))
+ if (!ioctl(f->fd, DIOCGDELETE, range))
-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];
range[0] = start;
range[1] = len;
range[0] = start;
range[1] = len;
- if (!ioctl(fd, BLKDISCARD, range))
+ if (!ioctl(f->fd, BLKDISCARD, range))