Skip to content

Fix incorrect ioctl number field description#380

Open
ga13234624 wants to merge 1 commit into
sysprog21:masterfrom
ga13234624:fix-ioctl-typo
Open

Fix incorrect ioctl number field description#380
ga13234624 wants to merge 1 commit into
sysprog21:masterfrom
ga13234624:fix-ioctl-typo

Conversation

@ga13234624

@ga13234624 ga13234624 commented Jun 30, 2026

Copy link
Copy Markdown

The original text says the ioctl number encodes the "major device number", which is incorrect. The ioctl number does not encode the major device number.

As the following sentence notes, the number is created by the _IO/_IOR/_IOW/_IOWR macros, which encode the direction of data transfer, the type (magic number), the command, and the size of the parameter.

Changed "major device number" to "direction of data transfer" so the description matches what these macros actually encode.


Summary by cubic

Fixes the ioctl number description in the docs: it encodes the direction of data transfer, not the major device number. Aligns the text with the _IO, _IOR, _IOW, and _IOWR macros.

Written for commit 90f0d96. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lkmpg.tex">

<violation number="1" location="lkmpg.tex:1826">
P2: The sentence still incorrectly says the ioctl number encodes "the type of the parameter." The numeric ioctl value actually encodes the SIZE of the parameter (via `sizeof`), not the C type itself. Change "type of the parameter" to "size of the parameter" to match what the `_IO`/`_IOR`/`_IOW`/`_IOWR` macros actually encode.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread lkmpg.tex
You can see there is an argument called \cpp|cmd| in \cpp|test_ioctl_ioctl()| function.
It is the ioctl number.
The ioctl number encodes the major device number, the type of the ioctl, the command, and the type of the parameter.
The ioctl number encodes the direction of data transfer, the type of the ioctl, the command, and the type of the parameter.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The sentence still incorrectly says the ioctl number encodes "the type of the parameter." The numeric ioctl value actually encodes the SIZE of the parameter (via sizeof), not the C type itself. Change "type of the parameter" to "size of the parameter" to match what the _IO/_IOR/_IOW/_IOWR macros actually encode.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lkmpg.tex, line 1826:

<comment>The sentence still incorrectly says the ioctl number encodes "the type of the parameter." The numeric ioctl value actually encodes the SIZE of the parameter (via `sizeof`), not the C type itself. Change "type of the parameter" to "size of the parameter" to match what the `_IO`/`_IOR`/`_IOW`/`_IOWR` macros actually encode.</comment>

<file context>
@@ -1823,7 +1823,7 @@ \section{Talking To Device Files}
 You can see there is an argument called \cpp|cmd| in \cpp|test_ioctl_ioctl()| function.
 It is the ioctl number.
-The ioctl number encodes the major device number, the type of the ioctl, the command, and the type of the parameter.
+The ioctl number encodes the direction of data transfer, the type of the ioctl, the command, and the type of the parameter.
 This ioctl number is usually created by a macro call (\cpp|_IO|, \cpp|_IOR|, \cpp|_IOW| or \cpp|_IOWR| --- depending on the type) in a header file.
 This header file should then be included both by the programs which will use ioctl (so they can generate the appropriate ioctl operations) and by the kernel module (so it can understand it).
</file context>
Suggested change
The ioctl number encodes the direction of data transfer, the type of the ioctl, the command, and the type of the parameter.
+The ioctl number encodes the direction of data transfer, the type of the ioctl, the command, and the size of the parameter.

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