vold: fix warnings for 64-bit
Replace MINOR(dev_t) and MAJOR(dev_t) with minor and major,
which cast to int.
Cast int to uintptr_t before casting to pointer
Change-Id: I59375518f15d27f400fcd4f8a8dfe5ebdd8350e6
diff --git a/Volume.cpp b/Volume.cpp
index 6dd1cc0..c290200 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -260,7 +260,7 @@
// Only initialize the MBR if we are formatting the entire device
if (formatEntireDevice) {
sprintf(devicePath, "/dev/block/vold/%d:%d",
- MAJOR(diskNode), MINOR(diskNode));
+ major(diskNode), minor(diskNode));
if (initializeMbr(devicePath)) {
SLOGE("Failed to initialize MBR (%s)", strerror(errno));
@@ -269,7 +269,7 @@
}
sprintf(devicePath, "/dev/block/vold/%d:%d",
- MAJOR(partNode), MINOR(partNode));
+ major(partNode), minor(partNode));
if (mDebug) {
SLOGI("Formatting volume %s (%s)", getLabel(), devicePath);
@@ -415,8 +415,8 @@
for (i = 0; i < n; i++) {
char devicePath[255];
- sprintf(devicePath, "/dev/block/vold/%d:%d", MAJOR(deviceNodes[i]),
- MINOR(deviceNodes[i]));
+ sprintf(devicePath, "/dev/block/vold/%d:%d", major(deviceNodes[i]),
+ minor(deviceNodes[i]));
SLOGI("%s being considered for volume %s\n", devicePath, getLabel());
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 2a9cd20..117eee0 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -1293,7 +1293,7 @@
char nodepath[255];
int written = snprintf(nodepath,
sizeof(nodepath), "/dev/block/vold/%d:%d",
- MAJOR(d), MINOR(d));
+ major(d), minor(d));
if ((written < 0) || (size_t(written) >= sizeof(nodepath))) {
SLOGE("shareVolume failed: couldn't construct nodepath");
@@ -1415,7 +1415,7 @@
if ((d=(*i)->getShareDevice()) != (dev_t)0) {
(*i)->getVolInfo(&vol_list[n]);
snprintf(vol_list[n].blk_dev, sizeof(vol_list[n].blk_dev),
- "/dev/block/vold/%d:%d",MAJOR(d), MINOR(d));
+ "/dev/block/vold/%d:%d", major(d), minor(d));
n++;
}
}
diff --git a/fstrim.c b/fstrim.c
index 73705f9..2bd0577 100644
--- a/fstrim.c
+++ b/fstrim.c
@@ -116,7 +116,7 @@
/* Release the wakelock that let us work */
release_wake_lock(FSTRIM_WAKELOCK);
- return (void *)ret;
+ return (void *)(uintptr_t)ret;
}
int fstrim_filesystems(void)