Skip to content

Support partition offset and size for linux file device #75

Open
@rick-masters

Description

@rick-masters

The lwext4 API for a linux file device does not support partition offsets. The code assumes the partition starts at the beginning of the file. This means a partitioned disk image with MBR cannot be created entirely with lwext4. lwext4 supports writing an MBR with partitions in a linux file but then does not allow creating file systems in those (offset) partitions, which is a confusing limitation.

Ideally, lwext4 would allow setting the partition offset and size for the file device like this:

https://github.com/rick-masters/live-bootstrap/blob/ebb9b941a781f6fea26deeb12d1f187c2c856315/sysa/lwext4-1.0.0-lb2/files/make_fiwix_initrd.c#L69-L74

This would allow creating an MBR at offset zero and then reconfiguring the file dev at the partition offset to create and use a partition.

Creating an MBR:
https://github.com/rick-masters/live-bootstrap/blob/kernel-bootstrap-fiwix-hd/sysa/lwext4-1.0.0-lb2/files/make_fiwix_initrd.c#L229-L240

Reopening a partition:
https://github.com/rick-masters/live-bootstrap/blob/ebb9b941a781f6fea26deeb12d1f187c2c856315/sysa/lwext4-1.0.0-lb2/files/make_fiwix_initrd.c#L242-L256

The forthcoming PR adds APIs to set the offset and size for the linux file device. Note that these APIs are optional and the library will behave exactly the same without them. They have been designed to be fully backward compatible with the existing API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions