Repository navigation
Migrate to dmdrvi 2.0 (64-bit I/O contract) - #3
Merged
Merged
Conversation
Bumps every DIF registration to the 2.0 interface version dmdrvi.h now requires. The functional changes are in _read/_write (offset -> dmdrvi_offset_t, return type -> dmdrvi_ssize_t, with explicit -EOVERFLOW/-EINVAL guards) and _stat (size -> dmdrvi_size_t). dmtty is a stream device (terminal) with no real byte-offset semantics, so offset is validated (must be non-negative) but otherwise ignored, same treatment dmclk gives its own non-seekable device. Internal size_t results from handle_read()/handle_write() and the canonical-mode line buffer are cast up to dmdrvi_ssize_t on return. _open already took the full (context, flags, dev_num) parameter list required by the contract, so no signature-drift fix was needed here. Part of choco-technologies/dmod-ecosystem#8.
JohnAmadis
approved these changes
Sep 26, 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.
Summary
src/dmtty.c(_create,_free,_open,_close,_read,_write,_ioctl,_flush,_stat,_path_ready) from version 1.0 to 2.0, matching the ecosystem-wide cutover in dmdrvi.h._read/_write:offsetchanged fromuint32_ttodmdrvi_offset_t(signed 64-bit), return type changed fromsize_ttodmdrvi_ssize_t(signed 64-bit). Added-EINVALfor negative offset and-EOVERFLOWforsize > INT64_MAXguards. dmtty is a stream/terminal device with no real seek semantics, sooffsetis validated but otherwise unused, same treatment as the dmclk reference migration. Internalsize_tresults (handle_read/handle_write, canonical-mode line buffer copy) are cast up todmdrvi_ssize_ton return._stat:stat->sizeassignment updated todmdrvi_size_t(was implicituint32_tliteral0)._open's signature character-for-character against the dmdrvi.h 2.0 declaration - dmtty's already took the full(context, flags, dev_num)triple (it actually relies ondev_numto pick the right node among several exposed by one context), so no drift/bug found there, unlike the pre-existing dmclk bug this cutover uncovered elsewhere.No pre-existing bugs found in dmtty beyond the version numbers and types themselves.
Part of choco-technologies/dmod-ecosystem#8.
Test plan
/tmp/build_dmtty_test/dmf/inc/dmdrvi/include/dmdrvi.hshows all DIFs atdmod_dmdrvi_dif(2.0, ...).cmake -S . -B /tmp/build_dmtty_test -DDMOD_TOOLS_NAME=arch/x86_64 -DDMOD_MODULE_VERSION=0.0.1 && cmake --build /tmp/build_dmtty_test --target dmttycompletes with[100%] Built target dmtty, no new compiler warnings.