mllib: add checking for btrfs subvolume

This is needed to skip btrfs subvolumes from output
of list_filesystems where device is needed.
This commit is contained in:
Maxim Perevedentsev
2016-07-08 14:08:09 +03:00
committed by Richard W.M. Jones
parent abf85b050e
commit d6bba9bc42
2 changed files with 10 additions and 0 deletions

View File

@@ -942,3 +942,10 @@ let inspect_mount_root g ?mount_opts_fn root =
let inspect_mount_root_ro =
inspect_mount_root ~mount_opts_fn:(fun _ -> "ro")
let is_btrfs_subvolume g fs =
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

View File

@@ -368,3 +368,6 @@ val inspect_mount_root : Guestfs.guestfs -> ?mount_opts_fn:(string -> string) ->
val inspect_mount_root_ro : Guestfs.guestfs -> string -> unit
(** Like [inspect_mount_root], but mounting every mount point as
read-only. *)
val is_btrfs_subvolume : Guestfs.guestfs -> string -> bool
(** Checks if a filesystem is a btrfs subvolume. *)