Tinos3

feature: Disk and partition information helpers

Description

Add OS-level helper functions for discovering disks and retrieving detailed partition information. These helpers should provide a stable interface for shell utilities and applications to inspect storage devices without duplicating raw device probing or partition-table parsing logic.

Required functionality

Disk information

Provide a helper that enumerates available block devices and reports, at minimum:

  • Device identifier and stable device path
  • Device type (disk, removable media, optical device, loop device, etc.)
  • Total capacity in bytes
  • Sector size and logical/physical block size where available
  • Read-only/removable status
  • Device model, vendor, and serial/UUID when available

Partition information

Provide helpers that enumerate partitions for a selected disk and report:

  • Partition number and device path
  • Start and end offsets, sector count, and size in bytes
  • Partition-table type and partition type identifier
  • Bootable/active flag and other relevant partition flags
  • Filesystem type, label, and UUID when available
  • Mount point and mount/read-only status when mounted

The API should support disks with no partition table, disks with multiple partition-table formats, and unmounted or partially populated metadata. Missing metadata must be represented explicitly rather than causing the whole query to fail.

OS integration

  • Implement the discovery and parsing in the OS storage/filesystem layer.
  • Expose typed return values and consistent error reporting for invalid paths, unavailable devices, and unsupported partition tables.
  • Avoid requiring callers to parse command output or access hardware registers directly.
  • Ensure reads are safe and non-destructive; this feature must not modify partition tables, filesystems, or mount state.
  • Add shell/application-facing commands or bindings as appropriate so the helpers are usable by system tools.
  • Document the returned fields and units, especially that sizes and offsets are expressed in bytes.

Acceptance criteria

  • A caller can list disks and query all partitions for a selected disk through the OS API.
  • Results are correct for the supported virtual and physical storage devices and partition-table formats.
  • Unmounted partitions and unavailable optional metadata are handled without panics or misleading defaults.
  • Unit tests cover empty disks, single- and multi-partition disks, removable media, and malformed/unsupported metadata.
  • Existing mounting and filesystem behavior remains unchanged.

Comments

randomusert

Lua integration

Register the disk and partition information helpers on the Lua side as well. The Lua API should expose typed, documented functions for listing disks and querying partitions, including capacity, offsets, filesystem metadata, flags, mount state, and optional device metadata.

Lua bindings must preserve the OS layer's explicit error handling and missing-metadata behavior, avoid destructive operations, and include basic binding coverage for empty disks, unmounted partitions, and unsupported or unavailable metadata.

© 2026 Tinos3 Developers and Contributors. Licensed under the MIT License.