summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mikeioannina@gmail.com>2015-01-02 01:45:37 +0200
committerSteve Kondik <shade@chemlab.org>2015-11-07 01:16:04 -0800
commit66f43493f0a0a6ccfb9cf1731c00dadb4176d377 (patch)
treed2fcd52fc71dbcd2a925243b53e763f2f329b51d
parent1634ec8cc7f76e93c87f0c72662f7b037d13186c (diff)
downloadbootable_recovery-66f43493f0a0a6ccfb9cf1731c00dadb4176d377.zip
bootable_recovery-66f43493f0a0a6ccfb9cf1731c00dadb4176d377.tar.gz
bootable_recovery-66f43493f0a0a6ccfb9cf1731c00dadb4176d377.tar.bz2
mtdutils: Fix mounting partitions by-name
Devices that have yaffs2 partitions must adjust their fstab. Example: system /system yaffs2 ro wait becomes /dev/block/mtd/by-name/system /system yaffs2 ro wait Change-Id: I8314bb94bf5bcd9576995cd2ecdc5133c5f5ea11
-rw-r--r--mtdutils/mtdutils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mtdutils/mtdutils.c b/mtdutils/mtdutils.c
index cc30334..2f57aee 100644
--- a/mtdutils/mtdutils.c
+++ b/mtdutils/mtdutils.c
@@ -28,6 +28,9 @@
#include "mtdutils.h"
+static const char mtdprefix[] = "/dev/block/mtd/by-name/";
+#define MTD_BASENAME_OFFSET (sizeof(mtdprefix)-1+1)
+
struct MtdPartition {
int device_index;
unsigned int size;
@@ -144,7 +147,7 @@ mtd_scan_partitions()
p->device_index = mtdnum;
p->size = mtdsize;
p->erase_size = mtderasesize;
- p->name = strdup(mtdname);
+ asprintf(&p->name, "%s%s", mtdprefix, mtdname);
if (p->name == NULL) {
errno = ENOMEM;
goto bail;
@@ -183,6 +186,9 @@ mtd_find_partition_by_name(const char *name)
if (strcmp(p->name, name) == 0) {
return p;
}
+ if (strcmp(p->name+MTD_BASENAME_OFFSET, name) == 0) {
+ return p;
+ }
}
}
}