On Wed, 04 Sep 2019 at 19:54:51 +0200, Guilhem Moulin wrote:
>  $ qemu-system-x86_64 -display none \
>      -add-fd "fd=3,set=0" \
>      -drive "file=/dev/fdset/0,format=raw,media=disk" \
>      3<>/tmp/disk.img
>  qemu-system-x86_64: -drive file=/dev/fdset/0,format=raw,media=disk: Could 
> not open '/dev/fdset/0': Permission denied

Unsurprisingly it doesn't work if the file descriptor is read-only

    $ qemu-system-x86_64 -display none \
        -add-fd "fd=3,set=0" \
        -drive "file=/dev/fdset/0,format=raw,media=disk" \
        3</tmp/disk.img
    qemu-system-x86_64: Initialization of device ide-hd failed: Could not 
reopen file: Permission denied

but weirdly enough it does work when *another* read-only FD is added to
the FD set containing the read-write descriptor:

    $ qemu-system-x86_64 -display none \
        -add-fd "fd=3,set=0" -add-fd "fd=4,set=0" \
        -drive "file=/dev/fdset/0,format=raw,media=disk" \
        3<>/tmp/disk.img 4</tmp/disk.img

Reading again the documentation, it's not entirely clear to me that that
a single (read-write) descriptor per FD is in fact enough for a block
node, but I have hard time believing that wasting a descriptor per image
is intentional.

-- 
Guilhem.

Attachment: signature.asc
Description: PGP signature

Reply via email to