Skip to content

Migrate to dmdrvi 2.0 (64-bit I/O contract) - #3

Merged
JohnAmadis merged 1 commit into
mainfrom
feature/dmdrvi-2.0-migration
Sep 26, 2026
Merged

JohnAmadis merged 1 commit into
mainfrom
feature/dmdrvi-2.0-migration

Conversation

@JaxCalder

Copy link
Copy Markdown
Contributor

Summary

  • Bumps every DMDRVI DIF registration in 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: offset changed from uint32_t to dmdrvi_offset_t (signed 64-bit), return type changed from size_t to dmdrvi_ssize_t (signed 64-bit). Added -EINVAL for negative offset and -EOVERFLOW for size > INT64_MAX guards. dmtty is a stream/terminal device with no real seek semantics, so offset is validated but otherwise unused, same treatment as the dmclk reference migration. Internal size_t results (handle_read/handle_write, canonical-mode line buffer copy) are cast up to dmdrvi_ssize_t on return.
  • _stat: stat->size assignment updated to dmdrvi_size_t (was implicit uint32_t literal 0).
  • Checked _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 on dev_num to 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

  • Cleared the local dmf-get manifest/package cache and reconfigured against a fresh dmdrvi fetch; confirmed /tmp/build_dmtty_test/dmf/inc/dmdrvi/include/dmdrvi.h shows all DIFs at dmod_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 dmtty completes with [100%] Built target dmtty, no new compiler warnings.
  • A maintainer should validate on real hardware / an actual dmtty deployment (serial console attach/detach, canonical vs raw mode, echo) since this environment only exercises an x86_64 host build.

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
JohnAmadis merged commit 2186673 into main Sep 26, 2026
1 check passed
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.

2 participants