nvme-cli: clean up and order includes across all source files#9
nvme-cli: clean up and order includes across all 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 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>
Done in 0c04705. Applied the commonly recommended ordering across all 22 affected files in
The most significant structural fixes were |
|
@copilot rebase and also check all other source code files, e.g. tests |
Extend the include ordering cleanup to all C source and header files
across the whole repository, covering:
- libnvme/src/nvme/: remaining issues in util.c, cleanup.h, linux.c
- libnvme/test/: all test files (mi.c, mi-mctp.c, mock-ifaddrs.c,
psk.c, register.c, test.c, test-util.c, tree.c, uriparser.c,
uuid.c, zns.c, hkdf_add1.c, config/*, ioctl/misc.c, ioctl/mock.c,
ioctl/zns.c, nbft/nbft-dump.c)
- libnvme/examples/: discover-loop.c, mi-conf.c, mi-mctp.c,
mi-mctp-ae.c, mi-mctp-csi-test.c, telemetry-listen.c
- nvme-cli top-level: fabrics.c, logging.c, nvme-models.c,
nvme-print.c, nvme-print-stdout.c, nvme-print.h, nvme-rpmb.c,
nvme.c, nvme.h, plugin.c
- util/: argconfig.c, base64.c, suffix.c, argconfig.h, cleanup.h,
crc32.h
- unit/: test-argconfig-parse.c, test-suffix-*.c, test-uint128*.c
- plugins/: feat, lm, ocp, solidigm (including telemetry/),
seagate, sed, ymtc, sandisk/wdc utils headers
Convention applied consistently:
1. Standard/POSIX headers (alphabetical)
2. System headers (sys/, arpa/, linux/, net/, asm/) (alphabetical)
3. Third-party headers (ccan, dbus, json, openssl, ...) (alphabetical)
4. Project public headers (<libnvme.h>, <nvme/...>)
5. Local/private headers ("...")
Also removes duplicate <unistd.h> in sandisk-utils.h and wdc-utils.h.
Co-authored-by: igaw <1050803+igaw@users.noreply.github.com>
Done in 69436b5. Applied the include ordering convention to all source files across the entire repository:
Also removes duplicate |
Review of
#includedirectives across all.cand.hfiles in the entire repository — 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>sandisk-utils.h/wdc-utils.h<unistd.h>(second copy)Include ordering applied across all files
The following ordering convention is now applied consistently across all affected
.cand.hfiles:sys/,arpa/,linux/,net/,asm/(alphabetical)ccan,dbus,json,keyutils,liburing,openssl(alphabetical)<libnvme.h>,<libnvme-mi.h>,<nvme/...>"..."Files covered
libnvme/src/nvme/(22 files): Notable fixes includelib.c(system headers after local includes),no-json.c(<errno.h>after<libnvme.h>),cmds.h(standard headers after project headers),private.h(ccan before sys/),ioctl.c(conditional<liburing.h>inside standard block),linux.c(<fcntl.h>and<unistd.h>grouped withsys/*).libnvme/test/: Fixed group violations (project/local headers before standard) intest.c,zns.c; ordering fixes acrossmi.c,mi-mctp.c,mock-ifaddrs.c,psk.c,register.c,test-util.c,tree.c,uriparser.c,uuid.c, and allconfig/,ioctl/,nbft/test files.libnvme/examples/: Fixed group violations (ccan/dbus after project headers) in all 6 example files.Top-level nvme-cli: Major structural fix in
nvme.c(project headers before standard); group and ordering fixes infabrics.c,logging.c,nvme-models.c,nvme-print.c,nvme-print-stdout.c,nvme-print.h,nvme-rpmb.c,nvme.h,plugin.c.util/:argconfig.c,base64.c,suffix.c,argconfig.h,cleanup.h,crc32.h.unit/: All 5 unit test files.plugins/:feat,lm,ocp(fw-activation-history, smart-extended-log, utils),solidigm(workload-tracker, log-page-dir, alltelemetry/files),seagate,sed,ymtc,sandisk/wdcutils 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.