#include <errno.h>
#include <assert.h>
#include <sys/poll.h>
-#include "fio.h"
-#include "os.h"
+
+#include "../fio.h"
+#include "../os.h"
#ifdef FIO_HAVE_SGIO
if (hdr->dxfer_direction != SG_DXFER_NONE) {
nr_blocks = io_u->buflen / sd->bs;
lba = io_u->offset / sd->bs;
- hdr->cmdp[2] = (lba >> 24) & 0xff;
- hdr->cmdp[3] = (lba >> 16) & 0xff;
- hdr->cmdp[4] = (lba >> 8) & 0xff;
- hdr->cmdp[5] = lba & 0xff;
- hdr->cmdp[7] = (nr_blocks >> 8) & 0xff;
- hdr->cmdp[8] = nr_blocks & 0xff;
+ hdr->cmdp[2] = (unsigned char) ((lba >> 24) & 0xff);
+ hdr->cmdp[3] = (unsigned char) ((lba >> 16) & 0xff);
+ hdr->cmdp[4] = (unsigned char) ((lba >> 8) & 0xff);
+ hdr->cmdp[5] = (unsigned char) (lba & 0xff);
+ hdr->cmdp[7] = (unsigned char) ((nr_blocks >> 8) & 0xff);
+ hdr->cmdp[8] = (unsigned char) (nr_blocks & 0xff);
}
return 0;
return 1;
}
-struct ioengine_ops ioengine = {
+static struct ioengine_ops ioengine = {
.name = "sg",
.version = FIO_IOOPS_VERSION,
.init = fio_sgio_init,
return 1;
}
-struct ioengine_ops ioengine = {
+static struct ioengine_ops ioengine = {
.name = "sgio",
.version = FIO_IOOPS_VERSION,
.init = fio_sgio_init,
};
#endif
+
+static void fio_init fio_sgio_register(void)
+{
+ register_ioengine(&ioengine);
+}
+
+static void fio_exit fio_sgio_unregister(void)
+{
+ unregister_ioengine(&ioengine);
+}