FYI I don't think this is all too useful.  Just about no one actually
uses file locking APIs on block devices.  If you want to provide
protection against mounting the image on the host or scribbling over it
using mkfs you need to open the block device node with O_EXCL on Linux
as that's the mechanisms most tools and the filesystem code us for
exclusion.

If you're primarily interested in protection against other qemu
instances you can add you code on top, but that seems like a rather
marginal use case.



Reply via email to