Skip to content

libnvme: rename sysfs to attrs, move generated files to a subdir - #3787

Open
martin-belanger wants to merge 2 commits into
linux-nvme:masterfrom
martin-belanger:attr-accessors-rename
Open

libnvme: rename sysfs to attrs, move generated files to a subdir#3787
martin-belanger wants to merge 2 commits into
linux-nvme:masterfrom
martin-belanger:attr-accessors-rename

Conversation

@martin-belanger

Copy link
Copy Markdown

Renames the lazy-caching accessor mechanism from "sysfs" to "attrs" terminology, and moves every generator-owned file into a new src/nvme/generated/ subdirectory.

Most of this PR is purely a mechanical substitution of "sysfs" by "attrs". Not all sysfs were replaced by attrs though. I kept sysfs for things that really reference Linux's sysfs.

Two commits, in review order:

  • libnvme: rename sysfs to attrs and move generated files to a subdir -- the lazy ctrl/path/ns/subsystem accessor rename and move.
  • libnvme: move accessors.[ch] and accessors-fabrics.[ch] to generated subdir. Also fixes a real, non-obvious bug this move would otherwise cause: tid.c/tid.h, exclusion.c, and discoverd/src/tid.h all reference accessors-fabrics.h via the public nvme/accessors-fabrics.h path rather than a same-directory include, which was silently falling through to a stale copy in /usr/include from a previous install once the real file moved.

Martin Belanger added 2 commits August 7, 2026 16:27
"sysfs" is Linux-only terminology for a mechanism meant to work on
Windows too (and possibly others).

Also moves the generated .c/.h files into src/nvme/generated/

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
…subdir

keep generated files out of src/nvme/ so they're visually separate
from the hand-written files around them.

Also fixes stale-header fallback bugs this move would otherwise cause:
tid.c/tid.h, exclusion.c, and discoverd/src/tid.h all reference these
headers via the public "nvme/accessors-fabrics.h" path rather than a
same-directory include, which was silently resolving to a stale copy
in /usr/include from a previous install once the real file moved.

Also fixes a -Werror build break introduced by the generated/ subdir
move: nvme_incdir (added in the previous commit to let a quoted
#include "private.h" resolve from nvme/generated/*.c) put
-Ilibnvme/src/nvme on every compile command, which made
libnvme/src/nvme/endian.h's own #include <endian.h> resolve back to
itself instead of glibc's real header -- #pragma once silently
no-ops the self-reference, dropping the declarations for
htole64/htobe64/etc. Only visible as a warning locally; CI builds
with --werror, where it's fatal. Removes nvme_incdir and instead
makes both generators emit correct explicit relative includes
(../private.h, ../private-fabrics.h) for the headers they parsed,
now that their .c output lives one directory below. Verified with
--werror (default and -Dfabrics=disabled), full test suite, and a
live smoke test.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
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