Skip to content

More API refactoring and cleanups#3188

Merged
igaw merged 9 commits intolinux-nvme:masterfrom
igaw:api
Mar 17, 2026
Merged

More API refactoring and cleanups#3188
igaw merged 9 commits intolinux-nvme:masterfrom
igaw:api

Conversation

@igaw
Copy link
Collaborator

@igaw igaw commented Mar 16, 2026

  • - make function naming more consistent
  • - move simple helper function to nvme-cli to avoid cluttering the libnvme API for no good reason
  • - refactore commands into cmds.c
  • - factor out liburing into uring.c and initialize the ring when the global context is created

@igaw igaw changed the title More API review and cleanups More API refactoring and cleanups Mar 16, 2026
@igaw igaw force-pushed the api branch 3 times, most recently from 82ee5df to c8db16e Compare March 17, 2026 10:59
igaw added 8 commits March 17, 2026 12:07
These helper functions wrap nvme_init_* and nvme_submit_*, which makes
it hard to keep the API stable. Move them to nvme-cli, where they are
used extensively.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
nvme-cli implements firmware download with additional checks, making it
more robust and safer to use. There are no users of this function, so
remove it.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Separate the nvme_init_* inline functions from the rest.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
These init functions were added to the .c file due to the use of the
cpu_to_* macros. Move them to the header and use the hto* functions,
since cmds.h already relies on them.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Move these trivial functions to nvme-cli. Since they had to be modified
recently due to the I/O Submission Handling (ISH) bit, it is better to
move them out of the library to simplify maintaining a stable API.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Factor out the io_uring code into a new file to make it easier to move
the nvme_get_log code as well.

While at it, initialize the ring lazily on the first transport handle
creation instead of creating and tearing it down for each nvme_get_log
call.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Group all generic command implementations into a single file.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Group the nvme_get* commands together.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Make the naming more consistent. Functions are grouped by common
prefixes. Generic top-level functions use the nvme_ prefix, while
functions operating on specific objects use the object type as a
prefix (e.g., nvme_ns_). The prefix is typically followed by a verb,
such as nvme_create_ctrl.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
@igaw igaw merged commit 07e0fb1 into linux-nvme:master Mar 17, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant