]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Allow bi-directional commands
authorKeith Busch <keith.busch@intel.com>
Tue, 6 Dec 2016 23:03:25 +0000 (18:03 -0500)
committerKeith Busch <keith.busch@intel.com>
Tue, 6 Dec 2016 23:05:12 +0000 (18:05 -0500)
The spec allows bi-directional commands so let's let a user submit
one. The kernel does not support this at the moment, but maybe it will
someday.

Signed-off-by: Keith Busch <keith.busch@intel.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 55b41f86e914e1b239a0b91111920b15aea71534..42c59c557e119c8af2265a3ebd57e507f0bcec49 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -2573,13 +2573,7 @@ static int passthru(int argc, char **argv, int ioctl_cmd, const char *desc, stru
                        fprintf(stderr, "data direction not given\n");
                        err = EINVAL;
                        goto free_and_return;
-               }
-               if (cfg.read && cfg.write) {
-                       fprintf(stderr, "command can't be both read and write\n");
-                       err = EINVAL;
-                       goto free_and_return;
-               }
-               if (cfg.write) {
+               } else if (cfg.write) {
                        if (read(wfd, data, cfg.data_len) < 0) {
                                fprintf(stderr, "failed to read write buffer\n");
                                err = EINVAL;