View Source DtsBuddy.Paths (dts_buddy v0.1.0)

Helper module to remove paths juggling out of DtsBuddy.Backend

Summary

Functions

Configfs directory.

DTBO directory for a given <name>

Location of the DTBO file to be written for the given <name>.

Location of the DTS file to be written for the given <name>.

Overlay directory for a given <name>

Overlays directory.

Status file path for a given <name>

Checks that an overlay name is safe to splice into filesystem paths.

Location of a writable directory for the given <name>. Should be configurable by the user as people maybe have configurations diverging from the common nerves convention to have /data writable ?

Functions

@spec config_dir() :: <<_::144>>

Configfs directory.

@spec dtbo_dir(binary()) :: binary()

DTBO directory for a given <name>

@spec dtbo_file_path(binary()) :: binary()

Location of the DTBO file to be written for the given <name>.

@spec dts_file_path(binary()) :: binary()

Location of the DTS file to be written for the given <name>.

@spec overlay_dir(binary()) :: binary()

Overlay directory for a given <name>

@spec overlays_dir() :: binary()

Overlays directory.

@spec status_dir(binary()) :: binary()

Status file path for a given <name>

@spec valid_name?(any()) :: boolean()

Checks that an overlay name is safe to splice into filesystem paths.

Names are used verbatim to build both writable file paths (under /data) and configfs directories (under /sys/kernel/config/device-tree/overlays). Allowing path separators or .. would let a caller escape those trees, so we restrict names to a conservative alphabet of letters, digits, _ and -.

Link to this function

writable_path(file_name)

View Source
@spec writable_path(binary()) :: binary()

Location of a writable directory for the given <name>. Should be configurable by the user as people maybe have configurations diverging from the common nerves convention to have /data writable ?