Files
RedBear-OS/local/docs/dbus-interfaces/redbear-udisks.md
T
vasilito 9f2de2a0b1 docs+build: correct version drift, mangled prose, and toolchain-version gaps
Docs:
- Baseline was stated as 0.3.1 across the canonical set while the branch,
  Cat 0/1 crates and every Cat 2 fork are 0.3.2. AGENTS.md also cited a
  sources/redbear-0.3.1/ archive that does not exist; the only archive
  present is sources/redbear-0.1.0/. Versioning examples now match the
  forks as they actually stand (redoxfs/syscall 0.9.1, libredox 0.1.19).
- Repaired 18 instances of 'immutable archived' across 8 documents, where
  a global find/replace had turned sync/synced/archived into that phrase
  and produced ungrammatical text ('never auto-immutable archived',
  '### Source immutable archived').
- Settled the apply-patches.sh contradiction empirically. Both sides were
  wrong: the GROSS WARNING blocks (x5) described it as routine
  patch-linking, and SCRIPT-BEHAVIOR-MATRIX.md said build-redbear.sh
  'never invokes' it. It is invoked at build-redbear.sh:487, but only to
  auto-repair a failed verify-overlay-integrity.sh check.
- Dropped the dangling reference to a local/AGENTS.md section
  'NO OVERLAY-STYLE PATCHES — SCOPED POLICY' that does not exist.

Build system:
- mk/prefix.mk hardcoded 13.2.0 in the limits.h removal, which silently
  no-ops after a toolchain upgrade and leaves the conflicting header.
  Version-globbed.
- Parameterized GCC_RECIPE so the from-source toolchain path is not
  pinned to gcc13.
- The three cstdlib strtold seds were not idempotent -- the shipped GCC
  13 toolchain carried that comment block 17 times from repeated
  'make prefix' runs. Each is now guarded.
2026-08-03 13:07:25 +03:00

104 lines
4.1 KiB
Markdown

# redbear-udisks — D-Bus Interface
**Bus:** system
**Well-known name:** `org.freedesktop.UDisks2`
**Object paths:**
- `/org/freedesktop/UDisks2` — ObjectManager root
- `/org/freedesktop/UDisks2/Manager` — Manager object
- `/org/freedesktop/UDisks2/drives/<id>` — Per-drive objects
- `/org/freedesktop/UDisks2/block_devices/<id>` — Per-block objects
## Interface: `org.freedesktop.DBus.ObjectManager`
At `/org/freedesktop/UDisks2`:
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetManagedObjects` | `() → (a{oa{sa{sv}}})` | Return all managed objects with their interfaces and properties |
| Signal | Signature | Description |
|--------|-----------|-------------|
| `InterfacesAdded` | `(o, a{sa{sv}})` | New interfaces appeared on an object path |
| `InterfacesRemoved` | `(o, as)` | Interfaces were removed from an object path |
## Interface: `org.freedesktop.UDisks2.Manager`
### Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetBlockDevices` | `(options: a{sv}) → (ao)` | List all block device object paths |
| `GetDrives` | `(options: a{sv}) → (ao)` | List all drive object paths |
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `Version` | `s` | Package version (from `CARGO_PKG_VERSION`) |
| `SupportedFilesystems` | `as` | Currently empty (filesystem support detects at mount time) |
| `SupportedEncryptionTypes` | `as` | Empty (encryption not supported) |
| `DefaultEncryptionType` | `s` | Empty |
## Interface: `org.freedesktop.UDisks2.Drive`
### Methods
None (property-only interface).
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `ConnectionBus` | `s` | Scheme identity string (e.g. `"scheme:ahci"`, `"scheme:nvme"`) |
| `Size` | `t` | Total drive size in bytes |
## Interface: `org.freedesktop.UDisks2.Block`
### Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `Mount` | `(options: a{sv}) → (s)` | Mount the block device. Accepts `fstype` option (`"ext4"` or `"vfat"`). Auto-detects ext4 (magic 0xEF53 at offset 0x438) and FAT (magic 0x4D44 at end of VBR). Returns mount point path. |
| `Unmount` | `(options: a{sv}) → ()` | Unmount a previously-mounted block device. Sends SIGTERM to the child filesystem daemon. |
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `Device` | `ay` | Device path as byte array |
| `PreferredDevice` | `ay` | Preferred device path (same as Device) |
| `Symlinks` | `aay` | Empty (no symlink tracking) |
| `Size` | `t` | Block device size in bytes |
| `ReadOnly` | `b` | Whether the device is read-only |
| `Drive` | `o` | Parent drive object path |
| `HintPartitionable` | `b` | Whether the block is a partitionable device |
| `MountPoints` | `aay` | Current mount points (empty when not mounted) |
| `IdType` | `s` | Detected filesystem type: `"ext4"`, `"vfat"`, or `""` (unknown) |
## Inventory Discovery
At startup, `Inventory::scan()` enumerates block devices from:
- `/scheme/diskd/` — disk aggregator scheme (BlockDev entries)
- `/scheme/ahci/` — AHCI scheme
- `/scheme/nvme/` — NVMe scheme
Each device is classified as a `DriveDevice` with associated `BlockDevice` entries. Object paths are stable (derived from the device name).
## Filesystem Detection
`detect_filesystem(device_path)` reads the block device:
1. Offset 0x438: ext4 magic (`0xEF53` at bytes 56-57 of superblock)
2. End of VBR: FAT magic (`0x4D44` signature at VBR tail)
If `fstype` is passed as a mount option, it takes precedence over detection.
## Connection
- System bus, same `DBUS_STARTER_ADDRESS` / `DBUS_SYSTEM_BUS_ADDRESS` env var resolution as other D-Bus daemons
- 3 retry attempts at 1 s intervals
- SIGTERM/Ctrl-C handler for clean shutdown
## References
- [UDisks2 D-Bus API](https://udisks.freedesktop.org/docs/latest/ref-dbus.html)
- Conformance: Subset implementation. Drive and Block objects with static properties. Mount/Unmount with ext4 and FAT support. ObjectManager for discovery. No ATA, partition table, filesystem size, or SMART interfaces. No encryption, RAID, or loop support.