vasi / squashfuse

FUSE filesystem to mount squashfs archives
Other
286 stars 66 forks source link

Add a notification mechanism for signaling when the mountpoint is ready #110

Closed ariel-miculas closed 10 months ago

ariel-miculas commented 10 months ago

Add the notify_pipe option which allows the user to specify the path to a named pipe. When the mountpoint is ready, a message will be written to this pipe: 's' for success and 'f' for failure. To avoid blocking the fuse process until the pipe is read, a new process is spawned which performs a blocking operation on the pipe. In case of mount failure, no additional process is created and the main process blocks until the pipe is read.

An example of operation is provided below:

set -x
FIFO=$(mktemp -u)
mkfifo "$FIFO"
./squashfuse_ll -o notify_pipe="$FIFO" -f /path/to/squashfs/archive /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mountpoint contains:"
    ls /tmp/squash
else
    echo "Mounting squashfuse on /tmp/squash failed"
fi

Fixes #49

DrDaveD commented 10 months ago

Is there any reason why this can't be done with squashfuse as well as squashfuse_ll?

ariel-miculas commented 10 months ago

No, I'll add this to squashfuse also.

DrDaveD commented 10 months ago

The code looks pretty good to me now (although the CI checks are running at the moment). Please also add the new option to the squashfuse.1 man page and add an automated test or tests.

vasi commented 10 months ago

Added some comments, but overall looks great!

ariel-miculas commented 10 months ago

Thanks, @vasi. I've addressed your comments, updated the squashfuse.1 manpage and modified some tests in ll-smoke.sh.in to use this new notification mechanism.

DrDaveD commented 10 months ago

The new new smoke test unfortunately failed on the freebsd check. Look for FAIL:. It says

Image mounted successfully when it should have failed
ariel-miculas commented 10 months ago

Thanks, I was looking for this log but couldn't find it. So it's probably fine to overmount squashfuse on top of an existing squashfuse mountpoint on freebsd, I need to change the test to make it fail the mount in other ways.

ariel-miculas commented 10 months ago

I'm still awaiting approval for one workflow.

DrDaveD commented 10 months ago

Thanks for the reminder, I'm sorry I didn't notice the push. The good news was that freebsd passed. I now approved the workflow.

DrDaveD commented 10 months ago

This isn't fully working, see #112