change find_mount_point parameter to match either all or only
jffs2 and ubifs, which are typically used on embedded mtd devices.
For now, find_mount_point was used without the fstype parameter
except for a single occurance in jffs2reset. There it is desireable
to apply the same logic as previously hard-coded to jffs2 also in the
case of a ubifs overlay, so firstboot aka. factory-reset works as
expected.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
- mp = find_mount_point(v->blk, "jffs2");
+ mp = find_mount_point(v->blk, 1);
if (mp) {
fprintf(stderr, "%s is mounted as %s, only erasing files\n", v->blk, mp);
foreachdir(mp, handle_rmdir);
if (mp) {
fprintf(stderr, "%s is mounted as %s, only erasing files\n", v->blk, mp);
foreachdir(mp, handle_rmdir);
-find_mount_point(char *block, char *fs)
+find_mount_point(char *block, int mtd_only)
{
FILE *fp = fopen("/proc/mounts", "r");
static char line[256];
{
FILE *fp = fopen("/proc/mounts", "r");
static char line[256];
- if (fs && strncmp(t, fs, strlen(fs))) {
+ if (mtd_only &&
+ strncmp(t, "jffs2", 6) &&
+ strncmp(t, "ubifs", 6)) {
fclose(fp);
fprintf(stderr, "block is mounted with wrong fs\n");
return NULL;
fclose(fp);
fprintf(stderr, "block is mounted with wrong fs\n");
return NULL;
}
v = volume_find("rootfs_data");
}
v = volume_find("rootfs_data");
- mp = find_mount_point(v->blk, NULL);
+ mp = find_mount_point(v->blk, 0);
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
- mp = find_mount_point(v->blk, NULL);
+ mp = find_mount_point(v->blk, 0);
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
extern int find_overlay_mount(char *overlay);
extern char* find_mount(char *mp);
extern int find_overlay_mount(char *overlay);
extern char* find_mount(char *mp);
-extern char* find_mount_point(char *block, char *fs);
+extern char* find_mount_point(char *block, int mtd_only);
extern int find_filesystem(char *fs);
extern int find_mtd_block(char *name, char *part, int plen);
extern int find_mtd_char(char *name, char *part, int plen);
extern int find_filesystem(char *fs);
extern int find_mtd_block(char *name, char *part, int plen);
extern int find_mtd_char(char *name, char *part, int plen);
}
v = volume_find("rootfs_data");
}
v = volume_find("rootfs_data");
- mp = find_mount_point(v->blk, NULL);
+ mp = find_mount_point(v->blk, 0);
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
- mp = find_mount_point(v->blk, NULL);
+ mp = find_mount_point(v->blk, 0);
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;
if (mp) {
fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp);
return -1;