Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6441740imm; Mon, 27 Aug 2018 16:17:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYVUZCaBgN+91hBN6wpZ+TtD5v2cEa/NkIxfVqAg+C0Cl1TtuJBAUY0gjRJ0jbA/GZV3Me8 X-Received: by 2002:a17:902:8ec7:: with SMTP id x7-v6mr15168088plo.336.1535411822798; Mon, 27 Aug 2018 16:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535411822; cv=none; d=google.com; s=arc-20160816; b=mmneRc6IO4ELMUCkDWouZUK4E/ImnZtGh/4cNf5Ur9G+4YeFqgjXGYLJ2ybRuF8Krx 8b5/HD5J9UgI2MW+LAA8t8GoRyOssKqP6sqBgOCQrab7CdqXkT5SQ/Iz2eSnGil7WCSc vZbpxQSZRx/zAqG5XaGIRiUJcOy0LqMm/Oh+SwLXBdRX8kiMzOpiWk0pQDiq+id5O8/p akYB3VwQpAe77ftVnycbL0Kg86+D35cu4Tit6TQZPHMKglrsSFFpxEqAxNiU6SZvhmf8 MIMgCG/8Xc14yVkXqI3ESwWirguhEDIvVjwAMPZd2iYdF49/jtG0b86mH3sg2tP0JaXW CORw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tgDsHqthJUHVff+zw07Gpl4T3uKuQ3i1iMq6FEr0hO8=; b=WOqDl/Exf9DcV3edKVV0A+TyuBDCXyJpr8fD4Dcf+Wfdtemg3AMD2GnlDf5VhrbBmL eo7/ccvAdl5Ft9RaRD33R4FR4C4lNFNba13uPwfOiUBt8iya3fW/1bSa6OUPavqCmmL0 B/YeX7PJScuQI+kuRb/fF5OdQcsi0tZQ7bEbe2XTK66rM6vbBykNKeowbTrPVYt8lSvU sPM9GSSLNTlPk+YhtCtf9c0kcc7pM+PlcjZWPjL18OgtKGmix3k9qQty5+A2NcKP6dE7 8SbTqpGk7NcWGsAb+/x5Mrje4GNwM0EK0yd21ynt6S+f2iceFf6oFv82J1FtVjcWvwPH oVbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qG38GQPr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13-v6si508405pgh.627.2018.08.27.16.16.47; Mon, 27 Aug 2018 16:17:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qG38GQPr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbeH1DEX (ORCPT + 99 others); Mon, 27 Aug 2018 23:04:23 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:46708 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727459AbeH1DEW (ORCPT ); Mon, 27 Aug 2018 23:04:22 -0400 Received: by mail-ed1-f65.google.com with SMTP id k14-v6so421276edr.13 for ; Mon, 27 Aug 2018 16:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tgDsHqthJUHVff+zw07Gpl4T3uKuQ3i1iMq6FEr0hO8=; b=qG38GQPrdLDF/1RbNdLYPA2yIjEabmcSIaN8GiWIsKn+POJBSYUNPb9z49LT9BWNfP c7mQG/9j6VU92wROddZMpo6H+yuXj4Lp8MRDj2jCsr6kv4hXh+mjTjlKmdGXEGnen9VW hiWlY+X2PP6Z6Q6ScRVJLRM31DNG3EeCQx1Qt5fTZpORSPgg5z4zpmcM9WMNaykEE/rV Ty9M8smYqHXLvnArXRsmwRxBmjufFPPvZOWSW8Glpj79j/DZYKw00fp2vkmrVlXcM6im B3PRWz/JJBXvkbnS3FyodXk1xIxS/zYruK5qqDk8B9jWtcQ3epYmKpH9iDVyXGpx7oyW G0+A== 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=tgDsHqthJUHVff+zw07Gpl4T3uKuQ3i1iMq6FEr0hO8=; b=hDxKsvaUpmKeYitHsiNjAOl7Ga/vKogp+4PkhqObCCL9pheMazogpOWY/VhxYO/7rc q9cUltY2e9IgkfLRciiZw768eAjXjVwRAzrpJqT9Oh18Z8T+mNyy+Mrhh+XrPsag8WRy Pj0QLrFs57YvYfiL1trK/uwo4mLwsMuIoAj4EoP1zs2oj/MHKdv3byjvzgeRjKfq9aM+ 6GUNX0fYUAPEWRQBYkGQP0jxjts4biFzOqZMgC4vH94MECuu6zOADXrjH6lWHXopuaqy /ZC/BmoRvIGq2D8VGW/gUfU2tOyxmLjmDoYTO5NGNPYmWVakM3gzgIeWSXb1CyO8rPkZ Bx5Q== X-Gm-Message-State: APzg51Df3fSoyoT1owYWPz8DzO3NherNzIDuc8bCBSAfOMGds4Ifyqq2 vZdnDYYSCz3hihl8xXuh3Q== X-Received: by 2002:a50:eacb:: with SMTP id u11-v6mr19731049edp.7.1535411735423; Mon, 27 Aug 2018 16:15:35 -0700 (PDT) Received: from localhost.localdomain (nat4-minsk-pool-46-53-177-92.telecom.by. [46.53.177.92]) by smtp.gmail.com with ESMTPSA id u3-v6sm173918edo.44.2018.08.27.16.15.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 16:15:34 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan Subject: [PATCH 04/13] proc: rename "p" variable in proc_map_files_readdir() Date: Tue, 28 Aug 2018 02:14:54 +0300 Message-Id: <20180827231503.26899-4-adobriyan@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180827231503.26899-1-adobriyan@gmail.com> References: <20180827231503.26899-1-adobriyan@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use "mfi", add "const" and move structure definition closer while I'm at it. Note: moving "struct map_files_info info;" declaration to the scope where it is used bloats the code by ~90 bytes. I'm not sure what's going on. Signed-off-by: Alexey Dobriyan --- fs/proc/base.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index f96babf3cffc..17666bd61ac8 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2014,12 +2014,6 @@ static int map_files_get_link(struct dentry *dentry, struct path *path) return rc; } -struct map_files_info { - unsigned long start; - unsigned long end; - fmode_t mode; -}; - /* * Only allow CAP_SYS_ADMIN to follow the links, due to concerns about how the * symlinks may be used to bypass permissions on ancestor directories in the @@ -2119,6 +2113,12 @@ static const struct inode_operations proc_map_files_inode_operations = { .setattr = proc_setattr, }; +struct map_files_info { + unsigned long start; + unsigned long end; + fmode_t mode; +}; + static int proc_map_files_readdir(struct file *file, struct dir_context *ctx) { @@ -2128,7 +2128,6 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) unsigned long nr_files, pos, i; struct flex_array *fa = NULL; struct map_files_info info; - struct map_files_info *p; int ret; ret = -ENOENT; @@ -2196,16 +2195,17 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx) mmput(mm); for (i = 0; i < nr_files; i++) { + const struct map_files_info *mfi; char buf[4 * sizeof(long) + 2]; /* max: %lx-%lx\0 */ unsigned int len; - p = flex_array_get(fa, i); - len = snprintf(buf, sizeof(buf), "%lx-%lx", p->start, p->end); + mfi = flex_array_get(fa, i); + len = snprintf(buf, sizeof(buf), "%lx-%lx", mfi->start, mfi->end); if (!proc_fill_cache(file, ctx, buf, len, proc_map_files_instantiate, task, - (void *)(unsigned long)p->mode)) + (void *)(unsigned long)mfi->mode)) break; ctx->pos++; } -- 2.16.4