summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-01-16 17:43:52 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-17 14:04:28 +0100
commit077589459c1c3ce4cb690447d82b75a46712f896 (patch)
tree1f8e9b2ba0bde33f7b45a7e22e8af6a525ad50fd
parenta1f5dfc202f831b5e1cac4fbec9c27ae897c069f (diff)
downloadguix-077589459c1c3ce4cb690447d82b75a46712f896.tar.gz
syscalls: 'device-in-use?' returns #f upon EINVAL.
This mirrors the behavior of the 'fdisk_device_is_used' function of
util-linux.

* guix/build/syscalls.scm (device-in-use?): Return #f upon EINVAL.
-rw-r--r--guix/build/syscalls.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 94d335b67c..66d63a2931 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -701,6 +701,11 @@ backend device."
       #f)
      ((= err EBUSY)
       #t)
+     ((= err EINVAL)
+      ;; We get EINVAL for devices that have the GENHD_FL_NO_PART_SCAN flag
+      ;; set in the kernel, in particular loopback devices, though we do seem
+      ;; to get it for SCSI storage (/dev/sr0) on QEMU.
+      #f)
      (else
       (throw 'system-error "ioctl" "~A"
              (list (strerror err))