X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffstools.git;a=blobdiff_plain;f=block.c;h=d7a9c5fc9583d8e4b5fda2a4a1c842e36c7f4308;hp=3e4cfb5fb66d7b2716e5c1683093ba5ae83ab745;hb=8ab4fda66a136f5b0f1e5dff9d3649961ffc9158;hpb=0dfe61a86255b877dd67b2ba3479709ecf7632ae diff --git a/block.c b/block.c index 3e4cfb5..d7a9c5f 100644 --- a/block.c +++ b/block.c @@ -709,6 +709,7 @@ static void check_filesystem(struct probe_info *pr) const char *e2fsck = "/usr/sbin/e2fsck"; const char *f2fsck = "/usr/sbin/fsck.f2fs"; const char *dosfsck = "/usr/sbin/dosfsck"; + const char *btrfsck = "/usr/bin/btrfsck"; const char *ckfs; /* UBIFS does not need stuff like fsck */ @@ -721,6 +722,8 @@ static void check_filesystem(struct probe_info *pr) ckfs = f2fsck; } else if (!strncmp(pr->type, "ext", 3)) { ckfs = e2fsck; + } else if (!strncmp(pr->type, "btrfs", 5)) { + ckfs = btrfsck; } else { ULOG_ERR("check_filesystem: %s is not supported\n", pr->type); return; @@ -736,6 +739,9 @@ static void check_filesystem(struct probe_info *pr) if(!strncmp(pr->type, "f2fs", 4)) { execl(ckfs, ckfs, "-f", pr->dev, NULL); exit(-1); + } else if(!strncmp(pr->type, "btrfs", 5)) { + execl(ckfs, ckfs, "--repair", pr->dev, NULL); + exit(-1); } else { execl(ckfs, ckfs, "-p", pr->dev, NULL); exit(-1); @@ -1429,8 +1435,9 @@ static int mount_extroot(char *cfg) if (pr) { if (strncmp(pr->type, "ext", 3) && strncmp(pr->type, "f2fs", 4) && + strncmp(pr->type, "btrfs", 5) && strncmp(pr->type, "ubifs", 5)) { - ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs or ubifs\n", pr->type); + ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs or ubifs\n", pr->type); return -1; }