Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp767282imm; Wed, 4 Jul 2018 05:45:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpes0MgBL8I8KUgrw3+SsP58YQ1B6PFz5l3F0QmlbDsLklOPjaFUE1mQU9x8Rard/v0iOUaB X-Received: by 2002:a63:375b:: with SMTP id g27-v6mr1822566pgn.59.1530708336203; Wed, 04 Jul 2018 05:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530708336; cv=none; d=google.com; s=arc-20160816; b=pVV3yc5ikFXrfZkrC3hAZ/WyxJ7bnbf7rn5fsGVM3IEaxCUGeCIg1UWnP3xvOi0olp 9alN9Xrzi+JN9HxRvk3+VnM5bt9sqTLBmNCgjVRQXDs6Fgk2iK9hPjYp50DFLH+dJOje z3QogNCTHRkvobXhqs6jvwkKkebUNWbYycvR/wYa0dQqVzWQfHwOHfPy+GjuP3CDi0On vadz92uIFya48iPxFWrGYZX0PpBNGXk7Yjs67rfwLb1yh6K2xTjddZ0KH+LxPh7y6RTd rPctFgcLbmB5n6i+sNCtqHD9xZ4SkTUYPfWwMCS/ArDsTyL2vRMnBOgqNdKgM0VpPjwD SYfQ== 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:arc-authentication-results; bh=8NO0N0H4WPFVbolLYc+JpaLLY3NlQ4mjr7CaY0VIdO4=; b=b2O2E5gY7QW/Z+ZWHd8dpLVa3erKNSpesqwJnTZ6RSyBr2VQjBE6e6j3GNZgyIkJWo crqnTjTdI8bPV9XeYinbYRG2/u9I/kuwShw/gWtN2Jje/ciKeHNlAbBBaRUcnHcLwccd Tz7xYSKt5/WXdzeVp+kWYqG/Y/BqOkRN5P3/IaNYUcqvnN7+fkk/k0pkzbbf5AkDPPJ3 EpGaaoDbKGubC9ThgLkKMQhkdup5BsCgXu8VFrjuLifopOrZgaaQYeFyRRIoCMPAqoOZ OZv+1KBq77lzFEJBrvOMiofDfkxIyJLbYgfrNq86B3s9jr4WsaczJ2x0iC4mygTdTNA6 tL6g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 142-v6si3175438pga.694.2018.07.04.05.45.21; Wed, 04 Jul 2018 05:45:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934864AbeGDMnc (ORCPT + 99 others); Wed, 4 Jul 2018 08:43:32 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:38047 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934716AbeGDMm0 (ORCPT ); Wed, 4 Jul 2018 08:42:26 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fah6m-0001dK-9P; Wed, 04 Jul 2018 14:42:08 +0200 Received: from sha by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1fah6l-0005YZ-DO; Wed, 04 Jul 2018 14:42:07 +0200 From: Sascha Hauer To: linux-mtd@lists.infradead.org Cc: David Gstir , Richard Weinberger , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Sascha Hauer Subject: [PATCH 02/25] ubifs: pass ubifs_zbranch to try_read_node() Date: Wed, 4 Jul 2018 14:41:14 +0200 Message-Id: <20180704124137.13396-3-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180704124137.13396-1-s.hauer@pengutronix.de> References: <20180704124137.13396-1-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org try_read_node() takes len, lnum and offs arguments which the caller all extracts from the same struct ubifs_zbranch *. When adding authentication support we would have to add a pointer to a hash to the arguments which is also part of struct ubifs_zbranch. Pass the ubifs_zbranch * instead so that we do not have to add another argument. Signed-off-by: Sascha Hauer --- fs/ubifs/tnc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 4a21e7f75e7a..2c42d1a1842a 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c @@ -35,7 +35,7 @@ #include "ubifs.h" static int try_read_node(const struct ubifs_info *c, void *buf, int type, - int len, int lnum, int offs); + struct ubifs_zbranch *zbr); static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, struct ubifs_zbranch *zbr, void *node); @@ -433,9 +433,7 @@ static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, * @c: UBIFS file-system description object * @buf: buffer to read to * @type: node type - * @len: node length (not aligned) - * @lnum: LEB number of node to read - * @offs: offset of node to read + * @zbr: the zbranch describing the node to read * * This function tries to read a node of known type and length, checks it and * stores it in @buf. This function returns %1 if a node is present and %0 if @@ -453,8 +451,11 @@ static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, * journal nodes may potentially be corrupted, so checking is required. */ static int try_read_node(const struct ubifs_info *c, void *buf, int type, - int len, int lnum, int offs) + struct ubifs_zbranch *zbr) { + int len = zbr->len; + int lnum = zbr->lnum; + int offs = zbr->offs; int err, node_len; struct ubifs_ch *ch = buf; uint32_t crc, node_crc; @@ -507,8 +508,7 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); - ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, - zbr->offs); + ret = try_read_node(c, node, key_type(c, key), zbr); if (ret == 1) { union ubifs_key node_key; struct ubifs_dent_node *dent = node; -- 2.18.0