diff options
author | Bob Copeland <me@bobcopeland.com> | 2008-04-17 03:47:48 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2008-04-17 08:29:56 -0400 |
commit | f845fced913b1437659bb5baf187698547697afe (patch) | |
tree | e23244018eeb8a57229ef0f12f69521a50881e14 /fs/udf/misc.c | |
parent | 706047a79725b585cf272fdefc234b31b6545c72 (diff) |
udf: use crc_itu_t from lib instead of udf_crc
As pointed out by Sergey Vlasov, UDF implements its own version of
the CRC ITU-T V.41. Convert it to use the one in the library.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Cc: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/misc.c')
-rw-r--r-- | fs/udf/misc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/udf/misc.c b/fs/udf/misc.c index 96996204d928..84bf0fd4a4f1 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | #include <linux/buffer_head.h> | 26 | #include <linux/buffer_head.h> |
27 | #include <linux/crc-itu-t.h> | ||
27 | 28 | ||
28 | #include "udf_i.h" | 29 | #include "udf_i.h" |
29 | #include "udf_sb.h" | 30 | #include "udf_sb.h" |
@@ -135,8 +136,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
135 | /* rewrite CRC + checksum of eahd */ | 136 | /* rewrite CRC + checksum of eahd */ |
136 | crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); | 137 | crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); |
137 | eahd->descTag.descCRCLength = cpu_to_le16(crclen); | 138 | eahd->descTag.descCRCLength = cpu_to_le16(crclen); |
138 | eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + | 139 | eahd->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)eahd + |
139 | sizeof(tag), crclen, 0)); | 140 | sizeof(tag), crclen)); |
140 | eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); | 141 | eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); |
141 | iinfo->i_lenEAttr += size; | 142 | iinfo->i_lenEAttr += size; |
142 | return (struct genericFormat *)&ea[offset]; | 143 | return (struct genericFormat *)&ea[offset]; |
@@ -241,8 +242,9 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, | |||
241 | 242 | ||
242 | /* Verify the descriptor CRC */ | 243 | /* Verify the descriptor CRC */ |
243 | if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || | 244 | if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || |
244 | le16_to_cpu(tag_p->descCRC) == udf_crc(bh->b_data + sizeof(tag), | 245 | le16_to_cpu(tag_p->descCRC) == crc_itu_t(0, |
245 | le16_to_cpu(tag_p->descCRCLength), 0)) | 246 | bh->b_data + sizeof(tag), |
247 | le16_to_cpu(tag_p->descCRCLength))) | ||
246 | return bh; | 248 | return bh; |
247 | 249 | ||
248 | udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", block, | 250 | udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", block, |
@@ -266,7 +268,7 @@ void udf_update_tag(char *data, int length) | |||
266 | length -= sizeof(tag); | 268 | length -= sizeof(tag); |
267 | 269 | ||
268 | tptr->descCRCLength = cpu_to_le16(length); | 270 | tptr->descCRCLength = cpu_to_le16(length); |
269 | tptr->descCRC = cpu_to_le16(udf_crc(data + sizeof(tag), length, 0)); | 271 | tptr->descCRC = cpu_to_le16(crc_itu_t(0, data + sizeof(tag), length)); |
270 | tptr->tagChecksum = udf_tag_checksum(tptr); | 272 | tptr->tagChecksum = udf_tag_checksum(tptr); |
271 | } | 273 | } |
272 | 274 | ||