+static int fio_binject_open_file(struct thread_data *td, struct fio_file *f)
+{
+ unsigned int bs;
+ int ret;
+
+ ret = generic_open_file(td, f);
+ if (ret)
+ return 1;
+
+ if (f->filetype != FIO_TYPE_BD) {
+ log_err("fio: binject only works with block devices\n");
+ return 1;
+ }
+ if (ioctl(f->fd, BLKSSZGET, &bs) < 0) {
+ td_verror(td, errno, "BLKSSZGET");
+ return 1;
+ }
+
+ f->file_data = bs;
+ return 0;
+}
+