Skip to content

Commit 545bc8f

Browse files
saschahauerrichardweinberger
authored andcommitted
ubifs: Pass ubifs_zbranch to try_read_node()
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 <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent c4de6d7 commit 545bc8f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/ubifs/tnc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "ubifs.h"
3636

3737
static int try_read_node(const struct ubifs_info *c, void *buf, int type,
38-
int len, int lnum, int offs);
38+
struct ubifs_zbranch *zbr);
3939
static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
4040
struct ubifs_zbranch *zbr, void *node);
4141

@@ -433,9 +433,7 @@ static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr,
433433
* @c: UBIFS file-system description object
434434
* @buf: buffer to read to
435435
* @type: node type
436-
* @len: node length (not aligned)
437-
* @lnum: LEB number of node to read
438-
* @offs: offset of node to read
436+
* @zbr: the zbranch describing the node to read
439437
*
440438
* This function tries to read a node of known type and length, checks it and
441439
* 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,
453451
* journal nodes may potentially be corrupted, so checking is required.
454452
*/
455453
static int try_read_node(const struct ubifs_info *c, void *buf, int type,
456-
int len, int lnum, int offs)
454+
struct ubifs_zbranch *zbr)
457455
{
456+
int len = zbr->len;
457+
int lnum = zbr->lnum;
458+
int offs = zbr->offs;
458459
int err, node_len;
459460
struct ubifs_ch *ch = buf;
460461
uint32_t crc, node_crc;
@@ -507,8 +508,7 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
507508

508509
dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs);
509510

510-
ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum,
511-
zbr->offs);
511+
ret = try_read_node(c, node, key_type(c, key), zbr);
512512
if (ret == 1) {
513513
union ubifs_key node_key;
514514
struct ubifs_dent_node *dent = node;

0 commit comments

Comments
 (0)