Skip to content

Introduce getter functions for host and subsystem objects with on-demand creation#3051

Merged
igaw merged 6 commits intolinux-nvme:masterfrom
igaw:move-config
Jan 20, 2026
Merged

Introduce getter functions for host and subsystem objects with on-demand creation#3051
igaw merged 6 commits intolinux-nvme:masterfrom
igaw:move-config

Conversation

@igaw
Copy link
Copy Markdown
Collaborator

@igaw igaw commented Jan 9, 2026

After moving the configuration update code into the library, the lookup functions can now be moved into the private section. It is still necessary to retrieve host and subsystem objects, so new getter functions are introduced.

These getters create the object on demand, providing the global context at creation time. While this could be added to the old lookup API, splitting the functionality is cleaner and avoids regressions.

This lays the groundwork for future refactoring while keeping the public API stable.

igaw added 6 commits January 20, 2026 18:01
Move configuration update code into the library. This completes the
migration. Afterward, nvme-cli depends only on higher-level APIs,
enabling internal library refactoring without breaking public
interfaces.

Signed-off-by: Daniel Wagner <[email protected]>
There is no user for this, thus remove it.

Signed-off-by: Daniel Wagner <[email protected]>
Replace nvme_default_host() with generic nvme_host_get(), which creates
the host object on demand. This enables retiring nvme_lookup_host() from
the public API.

Signed-off-by: Daniel Wagner <[email protected]>
Split host creation code into a separate function to explicitly document
on-demand object creation.

Signed-off-by: Daniel Wagner <[email protected]>
Replace the nvme_lookup_subsystem function with the nvme_subsystem_get
function, which creates the subsystem object if necessary. This allows
retiring the nvme_lookup_subsystem function from the public API.

Signed-off-by: Daniel Wagner <[email protected]>
There are no public users for these function. Make them private so we
can refactor them without breaking the API in future.

Signed-off-by: Daniel Wagner <[email protected]>
@igaw igaw changed the title Make the lookup code private Introduce getter functions for host and subsystem objects with on-demand creation Jan 20, 2026
@igaw igaw merged commit 9f84578 into linux-nvme:master Jan 20, 2026
19 of 20 checks passed
@igaw igaw deleted the move-config branch January 20, 2026 19:47
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