-
Notifications
You must be signed in to change notification settings - Fork 698
nvme: make --opcode argument mandatory #2786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9123,6 +9123,11 @@ static int passthru(int argc, char **argv, bool admin, | |
| return err; | ||
| } | ||
|
|
||
| if (!argconfig_parse_seen(opts, "opcode")) { | ||
| nvme_show_error("%s: opcode parameter required", cmd->name); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| if (cfg.opcode & 0x01) { | ||
| cfg.write = true; | ||
| flags = O_RDONLY; | ||
|
|
@@ -10186,6 +10191,11 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc) | |
| if (err) | ||
| return err; | ||
|
|
||
| if (!argconfig_parse_seen(opts, "opcode")) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far I can tell, this was not enforced before, it would be a behavior change. @jk-ozlabs Also the documentation doesn't say it's mandatory. But I see why you added it. The help says: "opcode (required)".
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with the requirement; a default opcode of 0 maps to "Read NVMe-MI data structure", and it would be a bit odd to be relying on that as an implicit command to issue. I would agree with adding to the docs though.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the documentations to add the description. (And also rebased the PR branch.) Thank you. |
||
| nvme_show_error("%s: opcode parameter required", *argv); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| if (admin_opcode == nvme_admin_nvme_mi_send) { | ||
| flags = O_RDONLY; | ||
| fd = STDIN_FILENO; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also update the man pages. They don't mention this option is required, only the help text from above does so.