From patchwork Fri Jul 20 02:57:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 142408 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2435574ljj; Thu, 19 Jul 2018 19:57:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeB79EL/8OhUtZizmjvuAkXpFh+XmFD0z61QnK0uJ2XdOf+j2SGPx6slLNxEKNdMTmmvLcc X-Received: by 2002:aa7:c68b:: with SMTP id n11-v6mr538406edq.122.1532055434280; Thu, 19 Jul 2018 19:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532055434; cv=none; d=google.com; s=arc-20160816; b=uucwuATWPRnd4Jjt/Erp+qZ6CM7NRVHxVoFhtiu1f4w3T/VNh2M9ihYjznApWPRIiu DYsceiS/jgBP5d1Q9BC6bFXoK3oUuI5C0rfQJ95vOucBngZuSml2NChEAAATEecbBc3U Ti/OwJnlO4Hf5P8gZOAveevy+JlCwOOSXRjavOE8CkDfp/PeHDbDkiw3wpKce6nQ+B5O bkUt69/FCV8xkJYab+8inTfzqi1x/f6gpc08fMuZSht6IAaF9rUaWOTGpH73w+vfzAm8 HB/yyGdzxIrJFcfpUbHIjMWeBu/24LCIw3z7XYUK+/6oScBk3RnUYs8P44sORanLHoOr G8Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=5a3QemxdnCn+932RjlTubbMVKUitHDRdXaeMl7cnQWA=; b=RLEDnRCv7qcC6vE1uPGvT0njuNX0AdGvaG1qFozs+Z8wkwtblhu8DzQWBVkvexnsv3 mPKWOjZJimuPnepI7GLZbZJZAG/lZzvuwbopBehXc09zHnaJx5UrI9l4Jyi5ISDAt1Sk cVMifgQMvdUhfkLCn6ymvVESOPlFPBZiWuK8LghMnIQ8/cK/Wqrw+R/yEYxTlAFeU45g Dd0dlAfu2rBXcll9zgdc4oSUZ+3ppz9p/rUznnNu+bR8Z5Kh9Vh7v7ux7kOZUKSTXsea UddIkx5iIaSIgtpiJNZ/9t35hsIlR+fzs0+4x75mIHgUkPPWChkDXfLCTTjGhymujT3s ZAeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cTLNZoUf; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id z29-v6si783061edb.410.2018.07.19.19.57.14; Thu, 19 Jul 2018 19:57:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cTLNZoUf; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id C3D49C21D8E; Fri, 20 Jul 2018 02:56:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0C769C21D9A; Fri, 20 Jul 2018 02:56:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 893C2C21D8E; Fri, 20 Jul 2018 02:56:41 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by lists.denx.de (Postfix) with ESMTPS id 720B7C21E12 for ; Fri, 20 Jul 2018 02:56:40 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id r1-v6so5502651pgp.11 for ; Thu, 19 Jul 2018 19:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lrMaNz7y2TRbSj/lDOe3R42pAyczy7hESeQ3YgYYdNI=; b=cTLNZoUfTwBE40XwQgMVFHD4U0ai4SVP9kSCe7x93TIUTnEmPzDgiNr53v7xRan5LZ I0UY6OjmO90lr6DOPlg75FKUuNW1+Z48umPVjR3fXt8a/hsPEgEvU8rG4ZNXiy5KUN/P jS0+Vp2h5cutFwpO6oN/Dody+jab2MHqlY3Ec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lrMaNz7y2TRbSj/lDOe3R42pAyczy7hESeQ3YgYYdNI=; b=V6Avbnc8ID+kNgJC759SVJwRN8FTTmBDC9ejOGwf+P1IBoUf8MZNCshkFxftvTjCuU JFtVUvPSb/RDDDAuOZSLmd1q+hQPimz0fX5YOdHWaK3RB7M2LbBnC9NYYmhl3g+a5ePv lb8WyUI+n433XfmJ9yYB+tg9UJLV2WyOlDe0JEywP/L+wzgRBpR90wy8ifo0a3pSv+rr 0U72cfos9XpXv9X4uFvHEOobZ9zPjRqgM5/UJEkD20PsX9dmAd1xsHJ8+JXG5RRFz+QM J7KvT1eMwo80TLvuJeLNGNR058USFnKaCvvVCT4p096OHOHcrkI1obaPill8Dis7M6Sz CjrQ== X-Gm-Message-State: AOUpUlEGUnBv2xNmGVF+bAiayTISjFkUS2vx/pOrNpAd/3WbAVNILAXw NZX3HzN+bYxnoKUkuLPiKbttaw== X-Received: by 2002:a62:bd4:: with SMTP id 81-v6mr294151pfl.67.1532055398994; Thu, 19 Jul 2018 19:56:38 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id x25-v6sm477133pgv.63.2018.07.19.19.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 19:56:38 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com Date: Fri, 20 Jul 2018 11:57:07 +0900 Message-Id: <20180720025723.6736-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180720025723.6736-1-takahiro.akashi@linaro.org> References: <20180720025723.6736-1-takahiro.akashi@linaro.org> Cc: u-boot@lists.denx.de, xypron.glpk@gmx.de, agraf@suse.de Subject: [U-Boot] [PATCH 01/17] fs: fat: extend get_fs_info() for write use X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" get_fs_info() was introduced in major re-work of read operation by Rob. We want to reuse this function in write operation by extending it with additional members in fsdata structure. Signed-off-by: AKASHI Takahiro --- fs/fat/fat.c | 3 +++ include/fat.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 4efe8a3eda..b48f48a751 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -556,6 +556,9 @@ static int get_fs_info(fsdata *mydata) return ret; } + mydata->bs_total_sect = bs.total_sect; + mydata->bs_fats = bs.fats; + if (mydata->fatsize == 32) { mydata->fatlength = bs.fat32_length; } else { diff --git a/include/fat.h b/include/fat.h index 09e1423685..0c88b59a4a 100644 --- a/include/fat.h +++ b/include/fat.h @@ -173,6 +173,8 @@ typedef struct { int fatbufnum; /* Used by get_fatent, init to -1 */ int rootdir_size; /* Size of root dir for non-FAT32 */ __u32 root_cluster; /* First cluster of root dir for FAT32 */ + __u32 bs_total_sect; /* Boot sector's number of sectors */ + __u8 bs_fats; /* Boot sector's number of FATs */ } fsdata; static inline u32 clust_to_sect(fsdata *fsdata, u32 clust)