[{"id":1762283,"web_url":"http://patchwork.ozlabs.org/comment/1762283/","msgid":"<d0904aa5-17cf-ee7e-1bd1-b041d9f8eed8@denx.de>","list_archive_url":null,"date":"2017-09-03T15:17:25","subject":"Re: [U-Boot] [PATCH v2 5/8] fs/fat: implement\n\topendir/readdir/closedir","submitter":{"id":70701,"url":"http://patchwork.ozlabs.org/api/people/70701/","name":"Lukasz Majewski","email":"lukma@denx.de"},"content":"On 09/02/2017 06:38 PM, Rob Clark wrote:\n> Implement the readdir interface using the directory iterators.\n> \n\nReviewed-by: Łukasz Majewski <lukma@denx.de>\n\n> Signed-off-by: Rob Clark <robdclark@gmail.com>\n> ---\n>   fs/fat/fat.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>   1 file changed, 56 insertions(+)\n> \n> diff --git a/fs/fat/fat.c b/fs/fat/fat.c\n> index 3193290434..d30ef3903b 100644\n> --- a/fs/fat/fat.c\n> +++ b/fs/fat/fat.c\n> @@ -14,6 +14,7 @@\n>   #include <config.h>\n>   #include <exports.h>\n>   #include <fat.h>\n> +#include <fs.h>\n>   #include <asm/byteorder.h>\n>   #include <part.h>\n>   #include <malloc.h>\n> @@ -1119,6 +1120,61 @@ int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len,\n>   \treturn ret;\n>   }\n>   \n> +typedef struct {\n> +\tFS_DIR parent;\n> +\tfsdata fsdata;\n> +\tfat_itr itr;\n> +} fat_dir;\n> +\n> +int fat_opendir(const char *filename, FS_DIR **dirp)\n> +{\n> +\tfat_dir *dir = malloc(sizeof(*dir));\n> +\tint ret;\n> +\n> +\tif (!dir)\n> +\t\treturn -ENOMEM;\n> +\n> +\tret = fat_itr_root(&dir->itr, &dir->fsdata);\n> +\tif (ret)\n> +\t\tgoto fail;\n> +\n> +\tret = fat_itr_resolve(&dir->itr, filename, TYPE_DIR);\n> +\tif (ret)\n> +\t\tgoto fail;\n> +\n> +\t*dirp = (FS_DIR *)dir;\n> +\treturn 0;\n> +\n> +fail:\n> +\tfree(dir);\n> +\treturn ret;\n> +}\n> +\n> +int fat_readdir(FS_DIR *dirp)\n> +{\n> +\tfat_dir *dir = (fat_dir *)dirp;\n> +\tstruct fs_dirent *dent = &dirp->dirent;\n> +\n> +\tif (!fat_itr_next(&dir->itr))\n> +\t\treturn -ENOENT;\n> +\n> +\tstrcpy(dent->name, dir->itr.name);\n> +\tif (fat_itr_isdir(&dir->itr)) {\n> +\t\tdent->type = FS_DT_DIR;\n> +\t} else {\n> +\t\tdent->type = FS_DT_REG;\n> +\t\tdent->size = FAT2CPU32(dir->itr.dent->size);\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +void fat_closedir(FS_DIR *dirp)\n> +{\n> +\tfat_dir *dir = (fat_dir *)dirp;\n> +\tfree(dir);\n> +}\n> +\n>   void fat_close(void)\n>   {\n>   }\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlc6V0Cpgz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 01:17:37 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid B5811C21EE1; Sun,  3 Sep 2017 15:17:30 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id A96FBC21DBD;\n\tSun,  3 Sep 2017 15:17:28 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid BCB66C21DBD; Sun,  3 Sep 2017 15:17:27 +0000 (UTC)","from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10])\n\tby lists.denx.de (Postfix) with ESMTPS id 6A2F5C21D79\n\tfor <u-boot@lists.denx.de>; Sun,  3 Sep 2017 15:17:27 +0000 (UTC)","from frontend01.mail.m-online.net (unknown [192.168.8.182])\n\tby mail-out.m-online.net (Postfix) with ESMTP id 3xlc6H1sZ5z1qw7c;\n\tSun,  3 Sep 2017 17:17:27 +0200 (CEST)","from localhost (dynscan1.mnet-online.de [192.168.6.70])\n\tby mail.m-online.net (Postfix) with ESMTP id 3xlc6H1XpRz3hjl3;\n\tSun,  3 Sep 2017 17:17:27 +0200 (CEST)","from mail.mnet-online.de ([192.168.8.182])\n\tby localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id oHADYTnJZj7Y; Sun,  3 Sep 2017 17:17:26 +0200 (CEST)","from [192.168.2.222] (89-77-92-62.dynamic.chello.pl [89.77.92.62])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mail.mnet-online.de (Postfix) with ESMTPSA;\n\tSun,  3 Sep 2017 17:17:26 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","X-Virus-Scanned":"amavisd-new at mnet-online.de","X-Auth-Info":"1iBGyKHjwbmfQDOP19wgZLk++LB81hQFjjD+Qtre4fQ=","To":"Rob Clark <robdclark@gmail.com>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","References":"<20170902163806.27265-1-robdclark@gmail.com>\n\t<20170902163806.27265-6-robdclark@gmail.com>","From":"=?utf-8?q?=C5=81ukasz_Majewski?= <lukma@denx.de>","Organization":"DENX","Message-ID":"<d0904aa5-17cf-ee7e-1bd1-b041d9f8eed8@denx.de>","Date":"Sun, 3 Sep 2017 17:17:25 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170902163806.27265-6-robdclark@gmail.com>","Content-Language":"en-US","Subject":"Re: [U-Boot] [PATCH v2 5/8] fs/fat: implement\n\topendir/readdir/closedir","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>,\n\t<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>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1763098,"web_url":"http://patchwork.ozlabs.org/comment/1763098/","msgid":"<CAPnjgZ2ozTXMzVa2PXoBSt2J+v+zG0DrjvvJCYez3y-W1H1sXA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-05T08:56:28","subject":"Re: [U-Boot] [PATCH v2 5/8] fs/fat: implement\n\topendir/readdir/closedir","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"On 3 September 2017 at 00:38, Rob Clark <robdclark@gmail.com> wrote:\n> Implement the readdir interface using the directory iterators.\n>\n> Signed-off-by: Rob Clark <robdclark@gmail.com>\n> ---\n>  fs/fat/fat.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 56 insertions(+)\n>\n> diff --git a/fs/fat/fat.c b/fs/fat/fat.c\n> index 3193290434..d30ef3903b 100644\n> --- a/fs/fat/fat.c\n> +++ b/fs/fat/fat.c\n> @@ -14,6 +14,7 @@\n>  #include <config.h>\n>  #include <exports.h>\n>  #include <fat.h>\n> +#include <fs.h>\n>  #include <asm/byteorder.h>\n>  #include <part.h>\n>  #include <malloc.h>\n> @@ -1119,6 +1120,61 @@ int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len,\n>         return ret;\n>  }\n>\n> +typedef struct {\n> +       FS_DIR parent;\n> +       fsdata fsdata;\n> +       fat_itr itr;\n> +} fat_dir;\n> +\n\nPlease drop the typedef.\n\nThis is a really nice implementation now.","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"hCGzWUc5\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"fmZ9X8zU\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmgml3wRCz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 19:05:59 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 383BCC21F90; Tue,  5 Sep 2017 08:59:10 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 399CBC21EE2;\n\tTue,  5 Sep 2017 08:58:54 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid A8672C21DC5; Tue,  5 Sep 2017 08:56:56 +0000 (UTC)","from mail-qk0-f177.google.com (mail-qk0-f177.google.com\n\t[209.85.220.177])\n\tby lists.denx.de (Postfix) with ESMTPS id 0F169C21ECF\n\tfor <u-boot@lists.denx.de>; Tue,  5 Sep 2017 08:56:50 +0000 (UTC)","by mail-qk0-f177.google.com with SMTP id z143so9538844qkb.3\n\tfor <u-boot@lists.denx.de>; Tue, 05 Sep 2017 01:56:50 -0700 (PDT)","by 10.200.28.108 with HTTP; Tue, 5 Sep 2017 01:56:28 -0700 (PDT)"],"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_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=HT62Syy2Zjli1l+u8KDCa00sG4mktieOJacShTaHMkg=;\n\tb=hCGzWUc5r2TEFIeYUZn4irYNGyYcWGQWgVlpmkizEc3+3tjZ2kvgVLgo+LFoTiMtqb\n\tUqOWUu2joj8y1kS+bpGRtsDoUZW/AF1L2elLz6PqcyaonwfG5vaNx3yvkqvniJb+eRfu\n\taDTDh8j6r4qB/kllNDtbExf2tdnm5jK/kWm75jEJZk2AEMr0h1C+KKIZ82QG2QXwaRdR\n\tK/zlDr+Z6pyL1GsOoNI/clu1dAyOOncaypinchXrRQeWje5qkikjSHz3Ps2jZufEE4Fc\n\ti/flzA6JSZHY7meFszBhT8Mt8+zBEIIytcHgHAhZjmdQQv0UFyjlRxIviL0v0R1az7VZ\n\t89VA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc;\n\tbh=HT62Syy2Zjli1l+u8KDCa00sG4mktieOJacShTaHMkg=;\n\tb=fmZ9X8zU2/cMQpIpAoxNT5A9y+QqdMqj8aAK0aNJONhDM2fIi6B0yveIDx75eCg+XV\n\t8O4hArxtC4okfXYE5WI/3BcyYX9GRVyi+3kHOFo21OHaq6ZE385ldm9Z5SJaCtdS3+fF\n\txol0rr8RulcU/g3TAtfP3fwm0UCF6pTOumKiQ="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc;\n\tbh=HT62Syy2Zjli1l+u8KDCa00sG4mktieOJacShTaHMkg=;\n\tb=dR8m/m4ZeB145R/DDMMS/76rPp6lpLxE6+G/ccndAOXdhbMv87wW/+E2nzU+HAG9Sr\n\t1YHLoWLj2ylZ/FU09TZMH7Lwu22Sw2rrYKCauBSyIeRVQFznXuUhgDoZPvyFrfNtruZP\n\tjRiNdfIKnoH02rhfiTsJ4IHJfeDWvMA1EDGxexqoJQDK4LCZlJivl88Qbgn5auBysG3F\n\tLEKQrMDwzeKxb848v2ySZI5mC8MEcS73acgzsPYFxHWYDWfr0/BGTo4MNgeraOHt65EY\n\tKp0NGLS2VvNdfYCsrDoweJAEz8/veGRcGk5QHJq5mTplqWuc94jruEfbEuirJovNVN+6\n\txERA==","X-Gm-Message-State":"AHPjjUgCNFiKmfO3tr/2tXIfnlytgZSgUhK9vSvBU8QnEF+ViUDVxnJ7\n\tldali8XEoUJlfWE7GfPrGcT0uQwbwhS+","X-Google-Smtp-Source":"ADKCNb5w+o1l9K0jCZ7jskly3xWpFWRJRWdpNu5YUfW59RfslS2S9yoE00zd4bELR+gQjmzpkKYK3Cd+dtilia8phMg=","X-Received":"by 10.55.136.134 with SMTP id k128mr4510889qkd.38.1504601808806; \n\tTue, 05 Sep 2017 01:56:48 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170902163806.27265-6-robdclark@gmail.com>","References":"<20170902163806.27265-1-robdclark@gmail.com>\n\t<20170902163806.27265-6-robdclark@gmail.com>","From":"Simon Glass <sjg@chromium.org>","Date":"Tue, 5 Sep 2017 16:56:28 +0800","X-Google-Sender-Auth":"k2EAabEwIZ2QUOO65RZktaaz2nk","Message-ID":"<CAPnjgZ2ozTXMzVa2PXoBSt2J+v+zG0DrjvvJCYez3y-W1H1sXA@mail.gmail.com>","To":"Rob Clark <robdclark@gmail.com>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>","Subject":"Re: [U-Boot] [PATCH v2 5/8] fs/fat: implement\n\topendir/readdir/closedir","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>,\n\t<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>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","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>"}}]