+ if (ret < 0)
+ io_u->error = errno;
+
+ return ret;
+}
+
+int do_io_u_trim(const struct thread_data *td, struct io_u *io_u)
+{
+#ifndef FIO_HAVE_TRIM
+ io_u->error = EINVAL;
+ return 0;
+#else
+ struct fio_file *f = io_u->file;
+ int ret;
+
+ ret = os_trim(f->fd, io_u->offset, io_u->xfer_buflen);
+ if (!ret)
+ return io_u->xfer_buflen;
+
+ io_u->error = ret;
+ return 0;
+#endif
+}
+
+int fio_show_ioengine_help(const char *engine)
+{
+ struct flist_head *entry;
+ struct thread_data td;
+ char *sep;
+ int ret = 1;
+
+ if (!engine || !*engine) {
+ log_info("Available IO engines:\n");
+ flist_for_each(entry, &engine_list) {
+ td.io_ops = flist_entry(entry, struct ioengine_ops,
+ list);
+ log_info("\t%s\n", td.io_ops->name);
+ }
+ return 0;
+ }
+ sep = strchr(engine, ',');
+ if (sep) {
+ *sep = 0;
+ sep++;
+ }
+
+ memset(&td, 0, sizeof(td));
+
+ td.io_ops = load_ioengine(&td, engine);
+ if (!td.io_ops) {
+ log_info("IO engine %s not found\n", engine);
+ return 1;
+ }
+
+ if (td.io_ops->options)
+ ret = show_cmd_help(td.io_ops->options, sep);
+ else
+ log_info("IO engine %s has no options\n", td.io_ops->name);
+
+ free_ioengine(&td);
+