diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-07 08:36:24 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-10-23 07:48:10 -0400 |
commit | 545bc8f6b0c60eee789a91ac1f8c9a16467b2fc5 (patch) | |
tree | 740c2772487b6603de064eb7c1a13db3c98c2d6f | |
parent | c4de6d7e4319ffb52d6db3138057712749540191 (diff) |
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>
-rw-r--r-- | fs/ubifs/tnc.c | 14 |
1 files 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 @@ | |||
35 | #include "ubifs.h" | 35 | #include "ubifs.h" |
36 | 36 | ||
37 | static int try_read_node(const struct ubifs_info *c, void *buf, int type, | 37 | 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); |
39 | static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, | 39 | static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, |
40 | struct ubifs_zbranch *zbr, void *node); | 40 | struct ubifs_zbranch *zbr, void *node); |
41 | 41 | ||
@@ -433,9 +433,7 @@ static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
433 | * @c: UBIFS file-system description object | 433 | * @c: UBIFS file-system description object |
434 | * @buf: buffer to read to | 434 | * @buf: buffer to read to |
435 | * @type: node type | 435 | * @type: node type |
436 | * @len: node length (not aligned) | 436 | * @zbr: the zbranch describing the node to read |
437 | * @lnum: LEB number of node to read | ||
438 | * @offs: offset of node to read | ||
439 | * | 437 | * |
440 | * This function tries to read a node of known type and length, checks it and | 438 | * This function tries to read a node of known type and length, checks it and |
441 | * stores it in @buf. This function returns %1 if a node is present and %0 if | 439 | * 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, | |||
453 | * journal nodes may potentially be corrupted, so checking is required. | 451 | * journal nodes may potentially be corrupted, so checking is required. |
454 | */ | 452 | */ |
455 | static int try_read_node(const struct ubifs_info *c, void *buf, int type, | 453 | 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) |
457 | { | 455 | { |
456 | int len = zbr->len; | ||
457 | int lnum = zbr->lnum; | ||
458 | int offs = zbr->offs; | ||
458 | int err, node_len; | 459 | int err, node_len; |
459 | struct ubifs_ch *ch = buf; | 460 | struct ubifs_ch *ch = buf; |
460 | uint32_t crc, node_crc; | 461 | uint32_t crc, node_crc; |
@@ -507,8 +508,7 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, | |||
507 | 508 | ||
508 | dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); | 509 | dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); |
509 | 510 | ||
510 | ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, | 511 | ret = try_read_node(c, node, key_type(c, key), zbr); |
511 | zbr->offs); | ||
512 | if (ret == 1) { | 512 | if (ret == 1) { |
513 | union ubifs_key node_key; | 513 | union ubifs_key node_key; |
514 | struct ubifs_dent_node *dent = node; | 514 | struct ubifs_dent_node *dent = node; |