nvme: standardize nvme_strerror() usage#3093
Open
martin-gpy wants to merge 1 commit intolinux-nvme:masterfrom
Open
nvme: standardize nvme_strerror() usage#3093martin-gpy wants to merge 1 commit intolinux-nvme:masterfrom
martin-gpy wants to merge 1 commit intolinux-nvme:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Standardizes error string formatting across nvme-cli, plugins, and libnvme by switching from strerror() to nvme_strerror(), enabling consistent messaging for both errno values and libnvme-specific error codes.
Changes:
- Replace
strerror(...)calls withnvme_strerror(...)across CLI, plugins, and libnvme. - Update JSON/perror-style helpers to emit
nvme_strerror(errno)-based strings. - Add missing include in
nvme-models.cto accessnvme_strerror().
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| util/argconfig.c | Switch allocation failure message to nvme_strerror(errno). |
| unit/test-argconfig-parse.c | Switch stderr reopen failure message to nvme_strerror(errno). |
| plugins/wdc/wdc-nvme.c | Replace many strerror(errno) log strings with nvme_strerror(errno). |
| plugins/sandisk/sandisk-utils.c | Replace allocation error strings with nvme_strerror(errno). |
| plugins/sandisk/sandisk-nvme.c | Replace file/alloc/fsync error strings with nvme_strerror(errno). |
| plugins/ocp/ocp-smart-extended-log.c | Replace malloc error string with nvme_strerror(errno). |
| plugins/ocp/ocp-nvme.c | Replace multiple malloc/open/read error strings with nvme_strerror(...). |
| plugins/ocp/ocp-hardware-component-log.c | Replace calloc error string with nvme_strerror(errno). |
| plugins/netapp/netapp-nvme.c | Use nvme_strerror(-err) for negative error codes. |
| plugins/lm/lm-nvme.c | Replace several strerror(errno) uses with nvme_strerror(errno). |
| plugins/huawei/huawei-nvme.c | Replace open error string with nvme_strerror(-ret). |
| plugins/feat/feat-nvme.c | Replace file open/read error strings with nvme_strerror(errno). |
| nvme.c | Replace multiple file I/O/keyring error strings with nvme_strerror(...). |
| nvme-rpmb.c | Replace file open/read error strings with nvme_strerror(errno). |
| nvme-print-json.c | Use nvme_strerror(errno) for JSON “perror” output. |
| nvme-models.c | Add nvme.h include and switch to nvme_strerror(errno) for sysfs/malloc errors. |
| logging.c | Replace debug retry message to use nvme_strerror(errnum). |
| libnvme/src/nvme/tree.c | Replace scan failure strings with nvme_strerror(...). |
| libnvme/src/nvme/nbft.c | Replace fopen/fseek/fread error strings with nvme_strerror(errno). |
| libnvme/src/nvme/json.c | Replace config open error string with nvme_strerror(errno). |
| libnvme/src/nvme/fabrics.c | Replace fabrics device open/read/write error strings with nvme_strerror(errno). |
| fabrics.c | Replace discovery log save/retry error strings with nvme_strerror(...). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
56b5f7c to
0ba023c
Compare
nvme_strerror() is a useful wrapper function for printing proper error messages corresponding to error codes including library specific error codes too. So it would be helpful to standardize the use of the same here across the codebase. Signed-off-by: Martin George <[email protected]>
0ba023c to
22a8987
Compare
Contributor
Author
|
@igaw - Are you fine with the responses I posted above? Let me know your thoughts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
nvme_strerror() is a useful wrapper function for printing proper error messages corresponding to error codes including library specific error codes too. So it would be helpful to standardize the use of the same here across the codebase.