Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/811976/?format=api
{ "id": 811976, "url": "http://patchwork.ozlabs.org/api/patches/811976/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170909171606.20029-10-robdclark@gmail.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170909171606.20029-10-robdclark@gmail.com>", "list_archive_url": null, "date": "2017-09-09T17:16:00", "name": "[U-Boot,v3,9/9] fs/fat: Clean up open-coded sector <-> cluster conversions", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "de78b054c5df7abd9b2f2b7e3c2825241021e464", "submitter": { "id": 18760, "url": "http://patchwork.ozlabs.org/api/people/18760/?format=api", "name": "Rob Clark", "email": "robdclark@gmail.com" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170909171606.20029-10-robdclark@gmail.com/mbox/", "series": [ { "id": 2355, "url": "http://patchwork.ozlabs.org/api/series/2355/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=2355", "date": "2017-09-09T17:15:51", "name": "fs/fat: cleanups + readdir implementation", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/2355/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811976/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811976/checks/", "tags": {}, "related": [], "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=gmail.com header.i=@gmail.com\n\theader.b=\"ZZW9V8zF\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xqLcK2YHhz9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 03:22:57 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 1FE12C21E8C; Sat, 9 Sep 2017 17:19:43 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 18ECBC21E8C;\n\tSat, 9 Sep 2017 17:18:57 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 6FDB4C21E7C; Sat, 9 Sep 2017 17:17:08 +0000 (UTC)", "from mail-qk0-f196.google.com (mail-qk0-f196.google.com\n\t[209.85.220.196])\n\tby lists.denx.de (Postfix) with ESMTPS id 779DBC21D04\n\tfor <u-boot@lists.denx.de>; Sat, 9 Sep 2017 17:17:02 +0000 (UTC)", "by mail-qk0-f196.google.com with SMTP id i14so3230435qke.3\n\tfor <u-boot@lists.denx.de>; Sat, 09 Sep 2017 10:17:02 -0700 (PDT)", "from localhost ([2601:184:4780:aac0:25f8:dd96:a084:785a])\n\tby smtp.gmail.com with ESMTPSA id\n\t20sm3233360qtu.77.2017.09.09.10.16.59\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSat, 09 Sep 2017 10:17:00 -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=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=jouUYn8AbqMaxmwkCld1nTQE8E82NXJX/dNooW9ErIs=;\n\tb=ZZW9V8zFnUvS/zTEclRCsnJqWNfuL100hYRlbNJ6oVszi5yMijUTDrsHEoTFhIEIDg\n\tANRbk47AKZFEjp5dGEl5UFUGrDVobNHCqTaGn4KGFmIm2b7v/uNrrL963Vn6uV8hOQQB\n\tiMBW88fU1A8AYZm8zX2r9DAJqI6Ty6pNGPqlErUewXmnD0d6LJNLx94afmRsuXItBYZH\n\tdFDn3IVLtUYpZe+pCXNoxxjgGkPzeb6Q+8NnxKWKSo3WwjY2I2ajfIaLWoaUAl4ob3Vl\n\tnwtRE/QPtJ3v4HRdUXFbTtRo/30JSF3Bl6IDm90O/MXB6NBv31fe+wEO3r/x4a7+ZeoA\n\t1aTA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=jouUYn8AbqMaxmwkCld1nTQE8E82NXJX/dNooW9ErIs=;\n\tb=BUfo7rzPWRRIKLT/8HLToErOS2RWpX5ssdjUC6lwEFEBPKVVS7wEFaAemnP0yxXUG3\n\t3+KXGrtxuJ1fENS+Fy5JWXly+2xxw4T+KSWz8hTGF+nZISlPiRiBiMuvdPYGrWnlpoeD\n\tQDxGB3RGRIUMdRVE9qbYN7qIiToIZGU2+AIQtFCgmMLgQJdY7eWYxFR+208uIIaYT754\n\tjR5DmSRhRuxVSe8gsAXLG+fL9PrI2xbvi+XgZ8CJwNUGRQr/piAQl4O3yzig2ruXUJ8H\n\tyV8U5Ohp4gdHDJYC6FcK7m9J1R6EmEURhW2eXdB1MNYO9ZSzg9BOsz9gxceE6KyyHxBD\n\t018g==", "X-Gm-Message-State": "AHPjjUhzqAsaGeg4JMYf9NV4wyrPLjA7bWaRKYeoi+69+zUUqHFSskWC\n\tN/FUStl05GgOBg+pwbY=", "X-Google-Smtp-Source": "AOwi7QBPQ3QjAhmBaUvwg5AV9caiWRYvXLBhKrE3tqgiTprYxZFTGzPhhsnLcCz/4h+D6qODC+SIqw==", "X-Received": "by 10.55.52.135 with SMTP id b129mr9259762qka.308.1504977421139; \n\tSat, 09 Sep 2017 10:17:01 -0700 (PDT)", "From": "Rob Clark <robdclark@gmail.com>", "To": "U-Boot Mailing List <u-boot@lists.denx.de>", "Date": "Sat, 9 Sep 2017 13:16:00 -0400", "Message-Id": "<20170909171606.20029-10-robdclark@gmail.com>", "X-Mailer": "git-send-email 2.13.5", "In-Reply-To": "<20170909171606.20029-1-robdclark@gmail.com>", "References": "<20170909171606.20029-1-robdclark@gmail.com>", "Cc": "Philipp Skadorov <philipp.skadorov@savoirfairelinux.com>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>,\n\tGenevieve Chan <ccheauya@altera.com>, Tien Fong Chee <tfchee@altera.com>", "Subject": "[U-Boot] [PATCH v3 9/9] fs/fat: Clean up open-coded sector <->\n\tcluster conversions", "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>", "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>" }, "content": "Use the clust_to_sect() helper that was introduced earlier, and add an\ninverse sect_to_clust(), plus update the various spots that open-coded\nthis conversion previously.\n\nSigned-off-by: Rob Clark <robdclark@gmail.com>\n---\n fs/fat/fat.c | 8 +++-----\n fs/fat/fat_write.c | 8 +++-----\n include/fat.h | 6 +++++-\n 3 files changed, 11 insertions(+), 11 deletions(-)", "diff": "diff --git a/fs/fat/fat.c b/fs/fat/fat.c\nindex 65873a2c2a..f5f74c12ff 100644\n--- a/fs/fat/fat.c\n+++ b/fs/fat/fat.c\n@@ -257,8 +257,7 @@ get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)\n \tint ret;\n \n \tif (clustnum > 0) {\n-\t\tstartsect = mydata->data_begin +\n-\t\t\t\tclustnum * mydata->clust_size;\n+\t\tstartsect = clust_to_sect(mydata, clustnum);\n \t} else {\n \t\tstartsect = mydata->rootdir_sect;\n \t}\n@@ -594,9 +593,8 @@ static int get_fs_info(fsdata *mydata)\n \t\tmydata->data_begin = mydata->rootdir_sect +\n \t\t\t\t\tmydata->rootdir_size -\n \t\t\t\t\t(mydata->clust_size * 2);\n-\t\tmydata->root_cluster = (mydata->rootdir_sect -\n-\t\t\t\t\tmydata->data_begin) /\n-\t\t\t\t\tmydata->clust_size;\n+\t\tmydata->root_cluster =\n+\t\t\tsect_to_clust(mydata, mydata->rootdir_sect);\n \t}\n \n \tmydata->fatbufnum = -1;\ndiff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c\nindex d0468baf8f..9d2e0ed74c 100644\n--- a/fs/fat/fat_write.c\n+++ b/fs/fat/fat_write.c\n@@ -502,8 +502,7 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,\n \tint ret;\n \n \tif (clustnum > 0)\n-\t\tstartsect = mydata->data_begin +\n-\t\t\t\tclustnum * mydata->clust_size;\n+\t\tstartsect = clust_to_sect(mydata, clustnum);\n \telse\n \t\tstartsect = mydata->rootdir_sect;\n \n@@ -751,8 +750,7 @@ static int check_overflow(fsdata *mydata, __u32 clustnum, loff_t size)\n \t__u32 startsect, sect_num, offset;\n \n \tif (clustnum > 0) {\n-\t\tstartsect = mydata->data_begin +\n-\t\t\t\tclustnum * mydata->clust_size;\n+\t\tstartsect = clust_to_sect(mydata, clustnum);\n \t} else {\n \t\tstartsect = mydata->rootdir_sect;\n \t}\n@@ -791,7 +789,7 @@ static dir_entry *empty_dentptr;\n static dir_entry *find_directory_entry(fsdata *mydata, int startsect,\n \tchar *filename, dir_entry *retdent, __u32 start)\n {\n-\t__u32 curclust = (startsect - mydata->data_begin) / mydata->clust_size;\n+\t__u32 curclust = sect_to_clust(mydata, startsect);\n \n \tdebug(\"get_dentfromdir: %s\\n\", filename);\n \ndiff --git a/include/fat.h b/include/fat.h\nindex 0f58939124..bdeda95e6d 100644\n--- a/include/fat.h\n+++ b/include/fat.h\n@@ -177,12 +177,16 @@ typedef struct {\n \t__u32\troot_cluster;\t/* First cluster of root dir for FAT32 */\n } fsdata;\n \n-/* TODO clean up places that are open-coding this: */\n static inline u32 clust_to_sect(fsdata *fsdata, u32 clust)\n {\n \treturn fsdata->data_begin + clust * fsdata->clust_size;\n }\n \n+static inline u32 sect_to_clust(fsdata *fsdata, u32 sect)\n+{\n+\treturn (sect - fsdata->data_begin) / fsdata->clust_size;\n+}\n+\n int file_fat_detectfs(void);\n int fat_exists(const char *filename);\n int fat_size(const char *filename, loff_t *size);\n", "prefixes": [ "U-Boot", "v3", "9/9" ] }