Repository navigation
Answer unknown ioctl commands quietly with -ENOTTY - #2
Merged
Merged
Conversation
dmdevfs now probes every node with the standard DMDRVI_IOCTL_BLOCK_GET_INFO (0x100) and DMDRVI_IOCTL_MONITOR_GET_POLICY (0x200) commands to classify it, so dmfmc logged an "Invalid ioctl command" error for every probe. Unknown commands are not an error for a driver: return -ENOTTY without logging, as dmdrvi documents. Also move dmfmc's private commands to DMDRVI_IOCTL_CUSTOM_BASE (0x1000): they started at 1, colliding with the standard DMDRVI_IOCTL_NET_* range (0x01..), so a generic network probe would have been misread as a dmfmc command. Callers using the enum names only need a rebuild. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016sVYVjrMNmMfPjWQkkGJTM
Number the private ioctl commands from the dmdrvi_ioctl.h constant itself rather than repeating its value, so they follow dmdrvi if the base ever moves. This makes the public header include dmdrvi_ioctl.h, so every in-repo target that includes it now also pulls in the dmdrvi module headers. The _Static_assert that guarded the copied value is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016sVYVjrMNmMfPjWQkkGJTM
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.
Problem
dmdevfs now probes every node with the standard
DMDRVI_IOCTL_BLOCK_GET_INFO(0x100) andDMDRVI_IOCTL_MONITOR_GET_POLICY(0x200) commands to classify it. dmfmc loggedInvalid ioctl command 256/512for every probe.Changes
-ENOTTY, no log. This is the dmdrvi convention for commands a driver does not implement, and dmdevfs reads any non-zero result as "not this class". Thedefault:branch of the switch changed the same way, and the range check now also rejects values below the first command.DMDRVI_IOCTL_CUSTOM_BASE. They used to start at 1, which collides with the standardDMDRVI_IOCTL_NET_*range (0x01..0x05).dmfmc_types.hnow includesdmdrvi_ioctl.h, sodmfmc_portalso links thedmdrvimodule headers.docs/api-reference.md: added a note about the numbering and the-ENOTTYbehaviour.dmfmc_ioctl_cmd_tchange. Callers that use the enum names only need a rebuild; hard-coded numbers must be updated. Out-of-repo code that includesdmfmc_types.h/dmfmc.hnow needs the dmdrvi headers on its include path.Testing
A syntax-only compile (
gcc -fsyntax-only -Wall) against the dmdrvi/dmod headers is clean. A full module build and a hardware run were not done here; CI checks the CMake changes.Same fix as choco-technologies/dmtty#4, choco-technologies/dmdma#4 and choco-technologies/dmclk#31.
🤖 Generated with Claude Code
https://claude.ai/code/session_016sVYVjrMNmMfPjWQkkGJTM