Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1779952imm; Fri, 7 Sep 2018 06:08:14 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbsjJbxQfxnv7jaPwakdE7bSiOfsqfi/EtYa/sqmRaBu/1CCa+UYdV+D+1fSjtwqgUxOGUD X-Received: by 2002:a17:902:b190:: with SMTP id s16-v6mr8047461plr.26.1536325694273; Fri, 07 Sep 2018 06:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536325694; cv=none; d=google.com; s=arc-20160816; b=meGj5FxC0336tmRU2NAWc6qYZn1oqaA34gNfaBe8pIsT2Wpo5lRMVLSJggRqfOg1Sm 0Q6pmUgXut/NY50rBPIEGK/ZztbPu88kCesor2nIZab/95Wzn0wCSilvvFHwoJ9rYHhT Deo9H85e/m+KLaWlJO/kyF0vKeTrWkG6Htk/GDrPa4uACc/fXO9smgFdJhv1UQg5P/3k P6fEdcbdMQgbrRl4Ju5br6bfmYmK34ycqmX5k+W+2UOzrNmt2/x6alR4SXvptSb0JW1Z nNYnDySl9eoHuJCXJ4LlapnG44O4qlzToVEFe8fxWuQZVh+CXodGuyFIDonUcPQa6Jqi CMFg== 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; bh=f5k5miZY2lmDJzFSHeHHG2ynctkygPe2KMJIyJlG308=; b=auUNkvTR4Ikw7XoTVbjQjWpI2DWGN8XhWIv5rbbzVSgYaiKwIY4Ej43/J5Z8w28aSk kxFB4bLDUTZ1ltW8zLbukJUYUbDkixPKEDNj0VsC6OaPz1qPRyw4/J7yoJBbetYECMqY xWqOyMqfIZ0GlG8Nr+BWq/4w8AkCkWfXm3yg7726W+/M7FV1RCSOqF/k8lgMIUKouJ/r MPuuUYaRnYooQVue3XDh42gFtsn7pnRIp2pZgoGH1XcKAgLmuSPiEwt5WijyKCONaNGZ S28hC0LLNaRzuAxegxL7tlfJY1pM7I0aFSy9gBRn8Kz2jjvV785aueC5EIP875HEMu2E EoMw== 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 i34-v6si8853686pgb.203.2018.09.07.06.07.59; Fri, 07 Sep 2018 06:08:14 -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 S1729511AbeIGRV4 (ORCPT + 99 others); Fri, 7 Sep 2018 13:21:56 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:39289 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727723AbeIGRTc (ORCPT ); Fri, 7 Sep 2018 13:19:32 -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 1fyG27-0007bo-79; Fri, 07 Sep 2018 14:38:43 +0200 Received: from sha by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1fyG26-00061k-BE; Fri, 07 Sep 2018 14:38:42 +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 03/25] ubifs: pass ubifs_zbranch to try_read_node() Date: Fri, 7 Sep 2018 14:36:24 +0200 Message-Id: <20180907123646.12688-4-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907123646.12688-1-s.hauer@pengutronix.de> References: <20180907123646.12688-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 bf416e512743..8502c07c1e0a 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