[Libguestfs] [PATCH 1/3] mllib: add checking for btrfs subvolume
Richard W.M. Jones
rjones at redhat.com
Thu Jul 7 16:36:51 UTC 2016
On Thu, Jul 07, 2016 at 06:04:04PM +0200, Pino Toscano wrote:
> On Thursday 07 July 2016 16:54:20 Richard W.M. Jones wrote:
> > How about this, which is type safe and a lot simpler:
> >
> > let is_btrfs_subvolume g fs =
> > let device = g#mountable_device fs in
> > try
> > ignore (g#mountable_subvolume fs); true
> > with Guestfs.Error msg as exn ->
> > if g#last_errno () = Guestfs.Errno.errno_EINVAL then false
> > else raise exn
>
> This is what I was writing too, but you were faster :)
> I think this will fail to build as "device" is unused, so the first
> line should be:
>
> (* Make sure we can determine the device of the mountable. *)
> ignore (g#mountable_device fs);
Actually I believe Maxim can just drop the 'let device = ...' line
completely.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list