Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: support streaming a block index' content into a char device #227

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OnkelUlla
Copy link

Within RAUC (an updating solution for embedded systems) we want to apply casync to the usecase of updating UBI volumes whose interface to userspace consists of char devices: to do so the only working solution today without intermediate extraction to a temporary regular file would be to spawn casync mkdev <BLOB_INDEX> and then to copy the whole contents of the attached /dev/nbdX over to the UBI volume's char device /dev/ubiY_Z. This is inefficient as the data has to be moved around by casync first and a second time by the copying mechanism. It would definitively be resource saving if casync extract <BLOB_INDEX> /dev/ubiY_Z works which is what the pull request's commit finally permits.

As casync checks the output's file descriptor for belonging to a regular file or a block device several times in the code I am uncertain if there are implicit assumptions in casync's decoder that I am not aware of and that are breaking down now (that's why I put the RFC in front of the pull request's title). So the question is if my patch is valid at all?

Although what this pull request changes is enough for our usecase it would definitely be appreciated if casync extract <BLOB_INDEX> could cope with pipes as output, too. Having that feature would allow to manually do things like

# casync extract <BLOB_INDEX> | ubiupdatevol /dev/ubiY_Z --size=<bytes> -

on the commandline. It should be straight forward to extend this patch with S_ISFIFO(…) correspondingly.

A reasonable exemplary usecase for this is updating a UBI volume (its interface
to userspace is a char device): let a parent process open the device file and
prepare the resulting file descriptor for updating the UBI volume, then fork
'casync extract <BLOB_INDEX> -' with STDOUT being redirected to that file
descriptor.

Without this change the only working alternative today is to fork 'casync mkdev
<BLOB_INDEX>' and then to actively pipe the resulting block device's content
into the UBI volume's prepared character device which is uneconomic as the
whole data has to be shuffled around once by casync and a second time by the
parent process.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
OnkelUlla added a commit to OnkelUlla/rauc that referenced this pull request Oct 24, 2019
…bx" images

Note: for this to work successfully the utilized casync has to be augmented by
(the currently unmerged) pull request [1].

[1] systemd/casync#227

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
OnkelUlla added a commit to OnkelUlla/rauc that referenced this pull request Oct 25, 2019
…bx" images

Note: for this to work successfully the accompanying casync has to be augmented
by (the currently unmerged) casync pull request [1].

[1] systemd/casync#227

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
jluebbe added a commit to rauc/rauc that referenced this pull request Feb 10, 2020
Introduce casync based bundles to the update of UBI volumes

This still needs the systemd/casync#227 to work, but should not break existing cases.
@jluebbe
Copy link

jluebbe commented Oct 15, 2020

@poettering Is there something we could do to make this easier to merge? Is the general approach acceptable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants