diff options
Diffstat (limited to 'fs/ubifs/lpt.c')
-rw-r--r-- | fs/ubifs/lpt.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index 93c181c742f2..6d914160ec55 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -557,7 +557,7 @@ static int calc_nnode_num(int row, int col) | |||
557 | * This function calculates and returns the nnode number based on the parent's | 557 | * This function calculates and returns the nnode number based on the parent's |
558 | * nnode number and the index in parent. | 558 | * nnode number and the index in parent. |
559 | */ | 559 | */ |
560 | static int calc_nnode_num_from_parent(struct ubifs_info *c, | 560 | static int calc_nnode_num_from_parent(const struct ubifs_info *c, |
561 | struct ubifs_nnode *parent, int iip) | 561 | struct ubifs_nnode *parent, int iip) |
562 | { | 562 | { |
563 | int num, shft; | 563 | int num, shft; |
@@ -582,7 +582,7 @@ static int calc_nnode_num_from_parent(struct ubifs_info *c, | |||
582 | * This function calculates and returns the pnode number based on the parent's | 582 | * This function calculates and returns the pnode number based on the parent's |
583 | * nnode number and the index in parent. | 583 | * nnode number and the index in parent. |
584 | */ | 584 | */ |
585 | static int calc_pnode_num_from_parent(struct ubifs_info *c, | 585 | static int calc_pnode_num_from_parent(const struct ubifs_info *c, |
586 | struct ubifs_nnode *parent, int iip) | 586 | struct ubifs_nnode *parent, int iip) |
587 | { | 587 | { |
588 | int i, n = c->lpt_hght - 1, pnum = parent->num, num = 0; | 588 | int i, n = c->lpt_hght - 1, pnum = parent->num, num = 0; |
@@ -965,7 +965,7 @@ static int check_lpt_type(uint8_t **addr, int *pos, int type) | |||
965 | * | 965 | * |
966 | * This function returns %0 on success and a negative error code on failure. | 966 | * This function returns %0 on success and a negative error code on failure. |
967 | */ | 967 | */ |
968 | static int unpack_pnode(struct ubifs_info *c, void *buf, | 968 | static int unpack_pnode(const struct ubifs_info *c, void *buf, |
969 | struct ubifs_pnode *pnode) | 969 | struct ubifs_pnode *pnode) |
970 | { | 970 | { |
971 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 971 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
@@ -995,15 +995,15 @@ static int unpack_pnode(struct ubifs_info *c, void *buf, | |||
995 | } | 995 | } |
996 | 996 | ||
997 | /** | 997 | /** |
998 | * unpack_nnode - unpack a nnode. | 998 | * ubifs_unpack_nnode - unpack a nnode. |
999 | * @c: UBIFS file-system description object | 999 | * @c: UBIFS file-system description object |
1000 | * @buf: buffer containing packed nnode to unpack | 1000 | * @buf: buffer containing packed nnode to unpack |
1001 | * @nnode: nnode structure to fill | 1001 | * @nnode: nnode structure to fill |
1002 | * | 1002 | * |
1003 | * This function returns %0 on success and a negative error code on failure. | 1003 | * This function returns %0 on success and a negative error code on failure. |
1004 | */ | 1004 | */ |
1005 | static int unpack_nnode(struct ubifs_info *c, void *buf, | 1005 | int ubifs_unpack_nnode(const struct ubifs_info *c, void *buf, |
1006 | struct ubifs_nnode *nnode) | 1006 | struct ubifs_nnode *nnode) |
1007 | { | 1007 | { |
1008 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 1008 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
1009 | int i, pos = 0, err; | 1009 | int i, pos = 0, err; |
@@ -1035,7 +1035,7 @@ static int unpack_nnode(struct ubifs_info *c, void *buf, | |||
1035 | * | 1035 | * |
1036 | * This function returns %0 on success and a negative error code on failure. | 1036 | * This function returns %0 on success and a negative error code on failure. |
1037 | */ | 1037 | */ |
1038 | static int unpack_ltab(struct ubifs_info *c, void *buf) | 1038 | static int unpack_ltab(const struct ubifs_info *c, void *buf) |
1039 | { | 1039 | { |
1040 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 1040 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
1041 | int i, pos = 0, err; | 1041 | int i, pos = 0, err; |
@@ -1067,7 +1067,7 @@ static int unpack_ltab(struct ubifs_info *c, void *buf) | |||
1067 | * | 1067 | * |
1068 | * This function returns %0 on success and a negative error code on failure. | 1068 | * This function returns %0 on success and a negative error code on failure. |
1069 | */ | 1069 | */ |
1070 | static int unpack_lsave(struct ubifs_info *c, void *buf) | 1070 | static int unpack_lsave(const struct ubifs_info *c, void *buf) |
1071 | { | 1071 | { |
1072 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 1072 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
1073 | int i, pos = 0, err; | 1073 | int i, pos = 0, err; |
@@ -1095,7 +1095,7 @@ static int unpack_lsave(struct ubifs_info *c, void *buf) | |||
1095 | * | 1095 | * |
1096 | * This function returns %0 on success and a negative error code on failure. | 1096 | * This function returns %0 on success and a negative error code on failure. |
1097 | */ | 1097 | */ |
1098 | static int validate_nnode(struct ubifs_info *c, struct ubifs_nnode *nnode, | 1098 | static int validate_nnode(const struct ubifs_info *c, struct ubifs_nnode *nnode, |
1099 | struct ubifs_nnode *parent, int iip) | 1099 | struct ubifs_nnode *parent, int iip) |
1100 | { | 1100 | { |
1101 | int i, lvl, max_offs; | 1101 | int i, lvl, max_offs; |
@@ -1139,7 +1139,7 @@ static int validate_nnode(struct ubifs_info *c, struct ubifs_nnode *nnode, | |||
1139 | * | 1139 | * |
1140 | * This function returns %0 on success and a negative error code on failure. | 1140 | * This function returns %0 on success and a negative error code on failure. |
1141 | */ | 1141 | */ |
1142 | static int validate_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | 1142 | static int validate_pnode(const struct ubifs_info *c, struct ubifs_pnode *pnode, |
1143 | struct ubifs_nnode *parent, int iip) | 1143 | struct ubifs_nnode *parent, int iip) |
1144 | { | 1144 | { |
1145 | int i; | 1145 | int i; |
@@ -1173,7 +1173,8 @@ static int validate_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
1173 | * This function calculates the LEB numbers for the LEB properties it contains | 1173 | * This function calculates the LEB numbers for the LEB properties it contains |
1174 | * based on the pnode number. | 1174 | * based on the pnode number. |
1175 | */ | 1175 | */ |
1176 | static void set_pnode_lnum(struct ubifs_info *c, struct ubifs_pnode *pnode) | 1176 | static void set_pnode_lnum(const struct ubifs_info *c, |
1177 | struct ubifs_pnode *pnode) | ||
1177 | { | 1178 | { |
1178 | int i, lnum; | 1179 | int i, lnum; |
1179 | 1180 | ||
@@ -1226,7 +1227,7 @@ int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1226 | err = ubi_read(c->ubi, lnum, buf, offs, c->nnode_sz); | 1227 | err = ubi_read(c->ubi, lnum, buf, offs, c->nnode_sz); |
1227 | if (err) | 1228 | if (err) |
1228 | goto out; | 1229 | goto out; |
1229 | err = unpack_nnode(c, buf, nnode); | 1230 | err = ubifs_unpack_nnode(c, buf, nnode); |
1230 | if (err) | 1231 | if (err) |
1231 | goto out; | 1232 | goto out; |
1232 | } | 1233 | } |
@@ -1815,7 +1816,7 @@ static struct ubifs_nnode *scan_get_nnode(struct ubifs_info *c, | |||
1815 | c->nnode_sz); | 1816 | c->nnode_sz); |
1816 | if (err) | 1817 | if (err) |
1817 | return ERR_PTR(err); | 1818 | return ERR_PTR(err); |
1818 | err = unpack_nnode(c, buf, nnode); | 1819 | err = ubifs_unpack_nnode(c, buf, nnode); |
1819 | if (err) | 1820 | if (err) |
1820 | return ERR_PTR(err); | 1821 | return ERR_PTR(err); |
1821 | } | 1822 | } |