synology_apm_repo.sdk.units.content.disk_fs package¶
DiskFilesystem parses the partition table and filesystem(s)
inside a VM/PC/PS disk image via the Dissect framework (dissect.*
PyPI packages), giving units/device_disk_fs.py a read-only, per-file
browsing/export view as a sibling node of the whole-image leaf.
Covers partition tables (auto-detected MBR/GPT/Apple Partition Map/BSD
disklabel) plus NTFS/ext2-4/XFS/Btrfs/FAT/APFS content (HFS+/ISO9660
show the same “no filesystem recognized” diagnostic as any other
unsupported format). A disk with no recognized partition table (the
common case for a bare, unpartitioned APFS container) falls back to
treating the whole image as one filesystem candidate. Each format’s
detection/listing/sizing lives in its own sibling module (_ntfs,
_apfs, _posix_formats); _disk_filesystem.py holds the shared
partition-table/APFS-container wiring, _content_source.py the two
ContentSource classes every format reads through.
A node’s stable identifier is its absolute path string: every Dissect
filesystem object resolves get(path) from scratch, so a canonical ref
works in a new process.
dissect.* is a required dependency, imported lazily so a caller who
never browses into a disk’s filesystem doesn’t pay for importing seven
packages. See _base._Format.content_unavailable and
_disk_filesystem._build_bridge for this package’s content-availability
and async-threading contracts.
- class synology_apm_repo.sdk.units.content.disk_fs.DiskFilesystem(content, loop)¶
Bases:
objectOne disk image’s partition table and filesystem(s)/volume(s). Build with
open.Every partition/volume Dissect can open is kept; one it can’t (unsupported, encrypted without a key, not a filesystem) is skipped silently. Not a
UnitProvider:units/device_disk_fs.pybuilds nodes frompartitions/list_dir/open_file.- async classmethod open(content)¶
Parse
content’s partitions and filesystems.- Returns:
The parsed disk, or
Nonewhen no partition/volume yields anything Dissect can open.- Raises:
DiskFilesystemUnavailableError – No
dissect.*package is installed (checkdisk_fs_availablefirst).- Return type:
Self | None
- partitions()¶
(partition_addr, label)for every opened filesystem/volume, in partition-table order (an APFS container’s volumes in container order).
- async list_dir(partition_addr, path)¶
The entries of directory
path("/"is the volume root), containers first then by name, without./..(filesystem metadata such as NTFS’s$MFTis kept).file_stateisFileState.NORMALfor a directory or a format without that concept;mtimeisNonewhen there’s no reliable value.
- async open_file(partition_addr, path)¶
Opens
pathon the filesystem mounted atpartition_addr.- Raises:
ContentUnavailableError – The file is a cloud-sync placeholder without its complete data, or (NTFS only) is EFS-encrypted with no key material available.
Bases:
ExceptionRaised by
DiskFilesystem.openwhen nodissect.*package is installed. An environment problem, not a data one, hence not anUnsupportedDataFormatError.
- class synology_apm_repo.sdk.units.content.disk_fs.DissectFileContentSource(entry, size, open_stream)¶
Bases:
objectContentSourceover one resolved Dissect filesystem entry, read through the stream its format opens for it.- async read(offset=0, length=None)¶
- stream(block=8388608)¶
- async export_range(writer, start, end, *, sparse=True, progress=None, tuning=None)¶
- async planned_bytes(start, end)¶
- synology_apm_repo.sdk.units.content.disk_fs.disk_fs_available()¶
Whether any Dissect package is installed (found without importing it) — decides whether a “(filesystem)” sibling node is offered.