Message ID | 20180911065922.19141-4-takahiro.akashi@linaro.org |
---|---|
State | Accepted |
Commit | b94b6be543c24ce8ce5debececb0af0708fbd97f |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3313619ljw; Tue, 11 Sep 2018 00:03:06 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb8pwil3/hamRTFUaE9bDJ67PSJmQP2jawSFzle6fVUCDfv+z4GGiIdg/U9o7sUML3lwpzq X-Received: by 2002:a50:d1c7:: with SMTP id i7-v6mr27542094edg.169.1536649386688; Tue, 11 Sep 2018 00:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536649386; cv=none; d=google.com; s=arc-20160816; b=xCNMyzEH9sAABb0nOFu/ZJILh3iOZotTetB7BXjb4hJWMqZ3daGCXepP3JpKDZzb6L tH16BVEYWYZgbpokhYRuKV3AMJBy7V1fLtOTlwaOgkiVcNP71eafoWx6PfmvJowASBEw k3Esrs6cexyCzMKzZN0XPD3qvpwPd34QNUL70UK6nQIEMElnOIf5PJ5hzWwhlHlyhmPv 8axFvhPmwsJHwpp7ZFK/obBNq8ulNpm2flDNOpjg9rUZOugJ4w4Cl5LvJA8QJhbVkO7F MUZsrTzVH3fkoeNiphxeNJRj9EMVV0VDJKFSdPSx465HTYGogjpBDNyuUIqaoi5dh5zC IczQ== 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; bh=y2jCVFB3wvNtehATQrN16ytmxpVCsNxdgLEjJm+DsDk=; b=NgZw8XhrWEmj/NR1rgFcu69DDTFtGM/4IW4rzLNkHYJIXmXUKGLEoZOJ4zNOmf9/gu 2ezpUgoLukOAtA/Slj+ruIhSBab3XyTsKjjEhb7kZVSS+BXcJS0xM2yE5kZRJW/SBp8V fqVQp2DT255o23xH8fHu+wLFObbTjorkWIhkL+jIZy0DqycV1pP8YJcVWNNLxzqZfECu 6dRLBELe95g6T/i8PeeXY8ymhLYcq/Hg+Bb/N3L6YvZiHs3RmZ/t/u1ran9r317BO6kG Az+Ds79R6nUpqLqE+cqSJyFJTJhiaLQTswrJuBptU+kO+I3HpJspdDOO0k53+ucD5yf/ dCLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VAjWGsTb; 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: <u-boot-bounces@lists.denx.de> Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id y13-v6si379342edv.448.2018.09.11.00.03.06; Tue, 11 Sep 2018 00:03:06 -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=VAjWGsTb; 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 35A82C21E7F; Tue, 11 Sep 2018 07:00:51 +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 B90DEC21EA6; Tue, 11 Sep 2018 06:59:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 21CA7C21E1E; Tue, 11 Sep 2018 06:59:22 +0000 (UTC) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by lists.denx.de (Postfix) with ESMTPS id 7DDFCC21EE3 for <u-boot@lists.denx.de>; Tue, 11 Sep 2018 06:59:14 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id x26-v6so11743729pge.12 for <u-boot@lists.denx.de>; Mon, 10 Sep 2018 23:59:14 -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=WgJhfpNw2FLc9WovSCz84LpLX5oEQMsN6Dnki2RwYPY=; b=VAjWGsTbp50KBssW45lZMBJj2z0OiA+qfrzaiBSxngvR2B4nqEM96cacPw+taxz+ZI 4v0+g779sUt+1QvHKoosQACsxMdNOjLYQP4P6ct9R4TeXpXEenjaFkksQCq9feEMW4C9 1YVj184kzXjzvA0+64qCxi60At6sEQ0/QplDQ= 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=WgJhfpNw2FLc9WovSCz84LpLX5oEQMsN6Dnki2RwYPY=; b=l4s3Tn+TvF1JFiVOVusTTz3V2YV03H9oGmCVS44H+wZmv3rDFgrsqcTmNHhSPF6Evt Ax+s4DXfhLk0u1iRhbn89EEO0jLubDQ90YqIDU/KXl1TjAZO4QnFCMcAZXOhVLRzkA2x TRxndoc715uZ5HFyHNi38H5w3b5zGrmd/bRpdxATB/R32dJFg4KhwGMIcY2zDKZbXhmi n1RL5RK9KfFoOuvvQBhrbF4J8jQ+DJfm78l0qeJh47ahdK5SLdRwwC94PFQCApPP0L1O 4iAvaGj5a7dcDz98KfJJxKIY5giIYwx4K45wDt5LiDEKQBRQwjbcdq9JWA81JpTv7pAY lGQQ== X-Gm-Message-State: APzg51DaWjk8Q3JkHmr3wJ5hNvur2nD/3cJLN0Ud724SRefi4lfldcbm Z17fzZaUkOPX2YHFvNOt10Itbg== X-Received: by 2002:a62:a65a:: with SMTP id t87-v6mr27509309pfe.225.1536649152983; Mon, 10 Sep 2018 23:59:12 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id b3-v6sm37210623pgm.74.2018.09.10.23.59.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 23:59:12 -0700 (PDT) From: "Akashi, Takahiro" <takahiro.akashi@linaro.org> To: trini@konsulko.com Date: Tue, 11 Sep 2018 15:58:59 +0900 Message-Id: <20180911065922.19141-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180911065922.19141-1-takahiro.akashi@linaro.org> References: <20180911065922.19141-1-takahiro.akashi@linaro.org> Cc: u-boot@lists.denx.de, xypron.glpk@gmx.de, agraf@suse.de Subject: [U-Boot] [PATCH v3 03/26] fs: fat: handle "." and ".." of root dir correctly with fat_itr_resolve() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <http://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> |
Series |
subject: fs: fat: extend FAT write operations
|
expand
|
diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 0576658dde09..eaea9300fd7f 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -931,6 +931,27 @@ static int fat_itr_resolve(fat_itr *itr, const char *path, unsigned type) while (next[0] && !ISDIRDELIM(next[0])) next++; + if (itr->is_root) { + /* root dir doesn't have "." nor ".." */ + if ((((next - path) == 1) && !strncmp(path, ".", 1)) || + (((next - path) == 2) && !strncmp(path, "..", 2))) { + /* point back to itself */ + itr->clust = itr->fsdata->root_cluster; + itr->dent = NULL; + itr->remaining = 0; + itr->last_cluster = 0; + + if (next[0] == 0) { + if (type & TYPE_DIR) + return 0; + else + return -ENOENT; + } + + return fat_itr_resolve(itr, next, type); + } + } + while (fat_itr_next(itr)) { int match = 0; unsigned n = max(strlen(itr->name), (size_t)(next - path));