From patchwork Wed May 18 11:28:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Dickinson X-Patchwork-Id: 623523 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r8sSr4zyCz9t6B for ; Wed, 18 May 2016 21:30:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b2zf4-0005CC-MN; Wed, 18 May 2016 11:29:10 +0000 Received: from s2.neomailbox.net ([5.148.176.60]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b2zf1-0005BP-Tf for lede-dev@lists.infradead.org; Wed, 18 May 2016 11:29:08 +0000 From: lede@daniel.thecshore.com To: lede-dev@lists.infradead.org Date: Wed, 18 May 2016 07:28:33 -0400 Message-Id: <1463570913-6860-1-git-send-email-lede@daniel.thecshore.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160518_042908_139088_33276730 X-CRM114-Status: UNSURE ( 8.44 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 2/4] v2: block.c: Add support for checking vfat filesystems X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Dickinson MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Daniel Dickinson v2: Fix mixup of dosfsck checking ext* and e2fsck checking vfat. vfat is a common filesystem which users may want to mount on an OpenWrt/LEDE device, so support peforming filesystem checks before mount for vfat. Signed-off-by: Daniel Dickinson --- block.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 71ffd0b..5a584cb 100644 --- a/block.c +++ b/block.c @@ -628,24 +628,30 @@ static void check_filesystem(struct blkid_struct_probe *pr) pid_t pid; struct stat statbuf; const char *e2fsck = "/usr/sbin/e2fsck"; + const char *dosfsck = "/sbin/dosfsck"; + const char *ckfs; /* UBIFS does not need stuff like fsck */ if (!strncmp(pr->id->name, "ubifs", 5)) return; - if (strncmp(pr->id->name, "ext", 3)) { + if (!strncmp(pr->id->name, "vfat", 4)) { + ckfs = dosfsck; + } else if (!strncmp(pr->id->name, "ext", 3)) { + ckfs = e2fsck; + } else { ULOG_ERR("check_filesystem: %s is not supported\n", pr->id->name); return; } - if (stat(e2fsck, &statbuf) < 0) { + if (stat(ckfs, &statbuf) < 0) { ULOG_ERR("check_filesystem: %s not found\n", e2fsck); return; } pid = fork(); if (!pid) { - execl(e2fsck, e2fsck, "-p", pr->dev, NULL); + execl(ckfs, ckfs, "-p", pr->dev, NULL); exit(-1); } else if (pid > 0) { int status;