Fixed type mismatch for ioctl(BLKGETSIZE)
ioctl(BLKGETSIZE) expects unsigned long
(8 bytes on 64 bit environment).
This is fixing fails in android.os.storage.StorageManagerIntegrationTest
(in FrameworkCoreTests).
To verify, install FrameworksCoreTests.apk and do:
adb shell am instrument -r -w -e class android.os.storage.\
StorageManagerIntegrationTest#testMountSingleEncryptedObb \
com.android.frameworks.coretests/android.test.InstrumentationTestRunner
Change-Id: Ib6d5c7490c02521c93f107c35ad0aac49f6a3f1a
diff --git a/VoldUtil.c b/VoldUtil.c
index b5f9946..e5bc912 100644
--- a/VoldUtil.c
+++ b/VoldUtil.c
@@ -17,13 +17,8 @@
#include <sys/ioctl.h>
#include <linux/fs.h>
-unsigned int get_blkdev_size(int fd)
-{
- unsigned int nr_sec;
-
- if ( (ioctl(fd, BLKGETSIZE, &nr_sec)) == -1) {
- nr_sec = 0;
+void get_blkdev_size(int fd, unsigned long* nr_sec) {
+ if ((ioctl(fd, BLKGETSIZE, nr_sec)) == -1) {
+ *nr_sec = 0;
}
-
- return nr_sec;
}