From 227c74af84f6612559bfb3dceeac324c8ef30870 Mon Sep 17 00:00:00 2001 From: Ben Winslow Date: Sat, 15 Aug 2009 09:52:10 -0400 Subject: [PATCH 1/2] vold: Check partitions 1-4 instead of 0-3 In mmc_bootstrap_mmcblk, bootstrap partitions 1-4 instead of 0-3, since that's how the kernel labels them. Additionally, use the NDOSPART constant from diskmbr.h instead of hardcoding 4 when scanning partitions. --- vold/blkdev.c | 4 ++-- vold/mmc.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vold/blkdev.c b/vold/blkdev.c index 1482a1ac0..0a15a7326 100644 --- a/vold/blkdev.c +++ b/vold/blkdev.c @@ -112,7 +112,7 @@ int blkdev_refresh(blkdev_t *blk) goto out; } - for (i = 0; i < 4; i++) { + for (i = 0; i < NDOSPART; i++) { struct dos_partition part; dos_partition_dec(block + DOSPARTOFF + i * sizeof(struct dos_partition), &part); @@ -134,7 +134,7 @@ int blkdev_refresh(blkdev_t *blk) struct dos_partition part; int part_no = blk->minor -1; - if (part_no < 4) { + if (part_no < NDOSPART) { dos_partition_dec(block + DOSPARTOFF + part_no * sizeof(struct dos_partition), &part); blk->part_type = part.dp_typ; } else { diff --git a/vold/mmc.c b/vold/mmc.c index cbddb9223..fcf7c2f9e 100644 --- a/vold/mmc.c +++ b/vold/mmc.c @@ -25,6 +25,7 @@ #include "vold.h" #include "mmc.h" #include "media.h" +#include "diskmbr.h" /* for NDOSPART */ #define DEBUG_BOOTSTRAP 0 @@ -233,7 +234,7 @@ static int mmc_bootstrap_mmcblk(char *devpath) *mmcblk_devname != '/'; mmcblk_devname--); mmcblk_devname++; - for (part_no = 0; part_no < 4; part_no++) { + for (part_no = 1; part_no <= NDOSPART; part_no++) { char part_file[255]; sprintf(part_file, "/sys%s/%sp%d", devpath, mmcblk_devname, part_no); if (!access(part_file, F_OK)) { From e36c153e25ceb2640967b8fc2ad9864b2b430b48 Mon Sep 17 00:00:00 2001 From: San Mehat Date: Fri, 21 Aug 2009 08:16:56 -0700 Subject: [PATCH 2/2] system/core: vold: Change permission of external storage device nodes Signed-off-by: San Mehat --- vold/blkdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vold/blkdev.c b/vold/blkdev.c index 0a15a7326..2c5681acb 100644 --- a/vold/blkdev.c +++ b/vold/blkdev.c @@ -219,7 +219,7 @@ static blkdev_t *_blkdev_create(blkdev_t *disk, char *devpath, int major, /* Create device nodes */ char nodepath[255]; - mode_t mode = 0666 | S_IFBLK; + mode_t mode = 0660 | S_IFBLK; dev_t dev = (major << 8) | minor; sprintf(nodepath, "%s/vold/%d:%d", DEVPATH, major, minor);