[libvirt] [PATCH 11/35] util: file: Add helper to determine whether a path is a CDROM
John Ferlan
jferlan at redhat.com
Wed May 2 18:49:17 UTC 2018
On 04/25/2018 11:15 AM, Peter Krempa wrote:
> Add detection mechanism which will allow to check whether a path to a
> block device is a physical CDROM drive. This will be useful once we will
> need to pass it to hypervisors.
>
> The linux implementation uses an ioctl to do the detection, while the
> fallback uses a simple string prefix match.
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
> src/libvirt_private.syms | 1 +
> src/util/virfile.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++-
> src/util/virfile.h | 2 ++
> 3 files changed, 58 insertions(+), 1 deletion(-)
>
Because it's "easier" to find and it sticks out more, please consider
using CDROM instead Cdrom. You could also change @filename to be @path,
but that's just a nit.
I agree this is better than qemuDomainFilePathIsHostCDROM and should be
used instead. Since it's the same logic as qemu it's a fairly safe bet
for having no issues on all the various platforms w/r/t the ioctl -
famous last words though for all the variants we compile on...
Altering the existing code can be a followup - unless of course you have
the urge to post a followup after this patch or the next one.
Reviewed-by: John Ferlan <jferlan at redhat.com>
John
More information about the libvir-list
mailing list