Skip to content

Commit

Permalink
os/os-dragonfly: sync with header file changes in upstream
Browse files Browse the repository at this point in the history
IOCTLTRIM was moved and renamed to a different header file,
so conditionally include previous or current header depending on
__DragonFly_version.

Some details in below commit messages.
In short, they have had IOCTLTRIM in a wrong header, and they
decided to fix/change it since fio was the only application using
IOCTLTRIM within their userspace package collections.

<sys/ioctl_compat.h>: Add a reminder comment about IOCTLTRIM.
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7226e3530be4df743a5cfe61f602b0c4bd436ee9

Move the IOCTLTRIM ioctl to a better header and rename it to DAIOCTRIM.
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/32506cfa691f80faa47486d6f94a98ae12387eeb

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
kusumi authored and axboe committed Apr 10, 2018
1 parent cb73748 commit 4fe721a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions os/os-dragonfly.h
Expand Up @@ -10,10 +10,17 @@
#include <sys/sysctl.h>
#include <sys/statvfs.h>
#include <sys/diskslice.h>
#include <sys/ioctl_compat.h>
#include <sys/usched.h>
#include <sys/resource.h>

/* API changed during "5.3 development" */
#if __DragonFly_version < 500302
#include <sys/ioctl_compat.h>
#define DAIOCTRIM IOCTLTRIM
#else
#include <bus/cam/scsi/scsi_daio.h>
#endif

#include "../file.h"
#include "../lib/types.h"

Expand Down Expand Up @@ -222,7 +229,7 @@ static inline int os_trim(struct fio_file *f, unsigned long long start,
range[0] = start;
range[1] = len;

if (!ioctl(f->fd, IOCTLTRIM, range))
if (!ioctl(f->fd, DAIOCTRIM, range))
return 0;

return errno;
Expand Down

0 comments on commit 4fe721a

Please sign in to comment.