From patchwork Sun May 22 09:22:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Dickinson X-Patchwork-Id: 624930 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 3rCGWb3qgcz9t3l for ; Sun, 22 May 2016 19:26:19 +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 1b4Pc2-0006YE-EP; Sun, 22 May 2016 09:23:54 +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 1b4Pc0-0006UF-P8 for lede-dev@lists.infradead.org; Sun, 22 May 2016 09:23:53 +0000 From: lede@daniel.thecshore.com To: lede-dev@lists.infradead.org Date: Sun, 22 May 2016 05:22:48 -0400 Message-Id: <1463908968-19424-3-git-send-email-lede@daniel.thecshore.com> In-Reply-To: <1463908968-19424-1-git-send-email-lede@daniel.thecshore.com> References: <1463908968-19424-1-git-send-email-lede@daniel.thecshore.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160522_022352_981698_54A62F1A X-CRM114-Status: UNSURE ( 8.76 ) 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/2] 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 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 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 71ffd0b..a6295a5 100644 --- a/block.c +++ b/block.c @@ -628,31 +628,37 @@ static void check_filesystem(struct blkid_struct_probe *pr) pid_t pid; struct stat statbuf; const char *e2fsck = "/usr/sbin/e2fsck"; + const char *dosfsck = "/usr/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) { - ULOG_ERR("check_filesystem: %s not found\n", e2fsck); + if (stat(ckfs, &statbuf) < 0) { + ULOG_ERR("check_filesystem: %s not found\n", ckfs); 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; waitpid(pid, &status, 0); if (WEXITSTATUS(status)) - ULOG_ERR("check_filesystem: %s returned %d\n", e2fsck, WEXITSTATUS(status)); + ULOG_ERR("check_filesystem: %s returned %d\n", ckfs, WEXITSTATUS(status)); } }