Message ID | alpine.DEB.2.00.1203252234440.5527@eristoteles.iwoars.net |
---|---|
State | New, archived |
Headers | show |
On Sun, 2012-03-25 at 22:38 +0200, Joel Reardon wrote: > CRC computation now an inline header function which will be used in > multiple places in the future. > > -- This will make git-am ignore Signed-off-by. Also, please, subject UBIFS patches with an "UBIFS:" prefix. The good way to send a patch is to use git format-patch and then git send-email or just insert it to the message body as-is. The best way to make sure you send patches correctly is to send to yourself, then save, then try to apply with 'git am' and look at the results. > Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch> > > fs/ubifs/io.c | 4 +--- > fs/ubifs/misc.h | 15 +++++++++++++++ > 2 files changed, 16 insertions(+), 3 deletions(-) > +/** > + * ubifs_set_crc - computes and writes the crc for a ubifs node to the common > + * header. > + * @node: the data node > + */ The comment is not good. I've amended it and pushed the patch, thanks! > +static inline void ubifs_set_node_crc(void *node) ...
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 9228950..103532e 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c @@ -379,7 +379,6 @@ static unsigned long long next_sqnum(struct ubifs_info *c) */ void ubifs_prepare_node(struct ubifs_info *c, void *node, int len, int pad) { - uint32_t crc; struct ubifs_ch *ch = node; unsigned long long sqnum = next_sqnum(c); @@ -390,8 +389,7 @@ void ubifs_prepare_node(struct ubifs_info *c, void *node, int len, int pad) ch->group_type = UBIFS_NO_NODE_GROUP; ch->sqnum = cpu_to_le64(sqnum); ch->padding[0] = ch->padding[1] = 0; - crc = crc32(UBIFS_CRC32_INIT, node + 8, len - 8); - ch->crc = cpu_to_le32(crc); + ubifs_set_node_crc(node); if (pad) { len = ALIGN(len, 8); diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h index ee7cb5e..ffda6a5 100644 --- a/fs/ubifs/misc.h +++ b/fs/ubifs/misc.h @@ -27,6 +27,9 @@ #ifndef __UBIFS_MISC_H__ #define __UBIFS_MISC_H__ +#include <linux/crc32.h> +#include "ubifs-media.h" + /** * ubifs_zn_dirty - check if znode is dirty. * @znode: znode to check @@ -300,4 +303,16 @@ static inline int ubifs_next_log_lnum(const struct ubifs_info *c, int lnum) return lnum; } +/** + * ubifs_set_crc - computes and writes the crc for a ubifs node to the common + * header. + * @node: the data node + */ +static inline void ubifs_set_node_crc(void *node) +{ + struct ubifs_ch *ch = (struct ubifs_ch *) node; + int len = le32_to_cpu(ch->len); + ch->crc = cpu_to_le32(crc32(UBIFS_CRC32_INIT, node + 8, len - 8)); +} + #endif /* __UBIFS_MISC_H__ */
CRC computation now an inline header function which will be used in multiple places in the future. -- Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch> fs/ubifs/io.c | 4 +--- fs/ubifs/misc.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-)