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
This commit is contained in:
parent
d33d417e3a
commit
7c16502dbc
1 changed files with 2 additions and 2 deletions
4
Loop.cpp
4
Loop.cpp
|
@ -128,7 +128,7 @@ int Loop::create(const char *id, const char *loopFile, char *loopDeviceBuffer, s
|
||||||
char filename[256];
|
char filename[256];
|
||||||
|
|
||||||
for (i = 0; i < LOOP_MAX; i++) {
|
for (i = 0; i < LOOP_MAX; i++) {
|
||||||
struct loop_info li;
|
struct loop_info64 li;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
sprintf(filename, "/dev/block/loop%d", i);
|
sprintf(filename, "/dev/block/loop%d", i);
|
||||||
|
@ -151,7 +151,7 @@ int Loop::create(const char *id, const char *loopFile, char *loopDeviceBuffer, s
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ioctl(fd, LOOP_GET_STATUS, &li);
|
rc = ioctl(fd, LOOP_GET_STATUS64, &li);
|
||||||
if (rc < 0 && errno == ENXIO)
|
if (rc < 0 && errno == ENXIO)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue