libnvme/nvme: clean up and order includes in src/nvme/ source files#9
Draft
libnvme/nvme: clean up and order includes in src/nvme/ source files#9
Conversation
- mi.c: remove duplicate #include <stdlib.h> - generate-accessors.c: remove duplicate #include <string.h> and #include <stdio.h> - ioctl.c: remove unused #include <inttypes.h> and #include <sys/time.h> - base64.c: remove unused #include <sys/types.h> - log.c: remove unused #include <sys/types.h> Co-authored-by: igaw <1050803+igaw@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review includes in nvme source files
libnvme/nvme: clean up includes in src/nvme/ source files
Mar 4, 2026
Owner
|
@copilot while at it also order header like it is commonly recommended |
Apply the commonly recommended include ordering across all files in libnvme/src/nvme/: 1. Standard/POSIX headers (alphabetical) 2. System headers with path prefix: sys/, arpa/, linux/, net/ (alphabetical) 3. Third-party library headers: ccan, dbus, json, keyutils, liburing, openssl (alphabetical) 4. Project public headers: libnvme.h, libnvme-mi.h, nvme/... 5. Local/private headers: "..." Notable structural fixes: - lib.c: system includes were below local "private.h" includes - no-json.c: <errno.h> was after <libnvme.h> - cmds.h: standard headers were after project <nvme/...> headers - private.h: ccan headers were before sys/ and poll.h/ifaddrs.h - generate-accessors.c: sys/ headers were interspersed among standard headers - ioctl.c: conditional <liburing.h> moved from inside standard-headers block to the third-party section - linux.c: <fcntl.h> and <unistd.h> were grouped inside sys/* instead of standard headers Co-authored-by: igaw <1050803+igaw@users.noreply.github.com>
Author
Done in 0c04705. Applied the commonly recommended ordering across all 22 affected files in
The most significant structural fixes were |
Copilot
AI
changed the title
libnvme/nvme: clean up includes in src/nvme/ source files
libnvme/nvme: clean up and order includes in src/nvme/ source files
Mar 4, 2026
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.
Review of
#includedirectives across all files inlibnvme/src/nvme/— removing duplicates and unused headers, and ordering all includes per the commonly recommended convention.Duplicate includes removed
mi.c:<stdlib.h>included twice consecutivelygenerate-accessors.c:<string.h>and<stdio.h>each included twice (once near the top, once mid-block)Unused includes removed
ioctl.c<inttypes.h><stdint.h>already included directly foruintptr_tioctl.c<sys/time.h>timeval/gettimeofdayusagebase64.c<sys/types.h>uint32_tused, covered by<stdint.h>log.c<sys/types.h>getpid()pulled in via<unistd.h>Include ordering applied across all files
The following ordering convention is now applied consistently across all 22 affected
.cand.hfiles:sys/,arpa/,linux/,net/(alphabetical)ccan,dbus,json,keyutils,liburing,openssl(alphabetical)<libnvme.h>,<nvme/...>"..."Notable structural fixes:
lib.c: system headers were placed after local"private.h"includesno-json.c: standard<errno.h>was placed after project<libnvme.h>cmds.h: standard headers were placed after project<nvme/...>headersprivate.h:ccanheaders appeared beforesys/and POSIX headersioctl.c: conditional<liburing.h>was embedded inside the standard headers blocklinux.c:<fcntl.h>and<unistd.h>were grouped withsys/*headers💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.