Use LOOP_GET_STATUS64 for checking loop devices
To determine whether a loop device was available, we use an ioctl call
to LOOP_GET_STATUS, but this fails on devices with large storage
partitions with errno = EOVERFLOW. Instead use LOOP_GET_STATUS64 which
succeeds.
Bug: 3412121
Change-Id: Ica3cb48885d3555f2d27073c00e31fc51a08c730
diff --git a/Loop.cpp b/Loop.cpp
index fdba249..e8f4048 100644
--- a/Loop.cpp
+++ b/Loop.cpp
@@ -128,7 +128,7 @@
char filename[256];
for (i = 0; i < LOOP_MAX; i++) {
- struct loop_info li;
+ struct loop_info64 li;
int rc;
sprintf(filename, "/dev/block/loop%d", i);
@@ -151,7 +151,7 @@
return -1;
}
- rc = ioctl(fd, LOOP_GET_STATUS, &li);
+ rc = ioctl(fd, LOOP_GET_STATUS64, &li);
if (rc < 0 && errno == ENXIO)
break;