|
31 | 31 | #include <linux/smp_lock.h> |
32 | 32 | #include <linux/buffer_head.h> |
33 | 33 | #include <linux/sched.h> |
| 34 | +#include <linux/crc-itu-t.h> |
34 | 35 |
|
35 | 36 | static inline int udf_match(int len1, const char *name1, int len2, |
36 | 37 | const char *name2) |
@@ -97,25 +98,23 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi, |
97 | 98 | memset(fibh->ebh->b_data, 0x00, padlen + offset); |
98 | 99 | } |
99 | 100 |
|
100 | | - crc = udf_crc((uint8_t *)cfi + sizeof(tag), |
101 | | - sizeof(struct fileIdentDesc) - sizeof(tag), 0); |
| 101 | + crc = crc_itu_t(0, (uint8_t *)cfi + sizeof(tag), |
| 102 | + sizeof(struct fileIdentDesc) - sizeof(tag)); |
102 | 103 |
|
103 | 104 | if (fibh->sbh == fibh->ebh) { |
104 | | - crc = udf_crc((uint8_t *)sfi->impUse, |
| 105 | + crc = crc_itu_t(crc, (uint8_t *)sfi->impUse, |
105 | 106 | crclen + sizeof(tag) - |
106 | | - sizeof(struct fileIdentDesc), crc); |
| 107 | + sizeof(struct fileIdentDesc)); |
107 | 108 | } else if (sizeof(struct fileIdentDesc) >= -fibh->soffset) { |
108 | | - crc = udf_crc(fibh->ebh->b_data + |
| 109 | + crc = crc_itu_t(crc, fibh->ebh->b_data + |
109 | 110 | sizeof(struct fileIdentDesc) + |
110 | 111 | fibh->soffset, |
111 | 112 | crclen + sizeof(tag) - |
112 | | - sizeof(struct fileIdentDesc), |
113 | | - crc); |
| 113 | + sizeof(struct fileIdentDesc)); |
114 | 114 | } else { |
115 | | - crc = udf_crc((uint8_t *)sfi->impUse, |
116 | | - -fibh->soffset - sizeof(struct fileIdentDesc), |
117 | | - crc); |
118 | | - crc = udf_crc(fibh->ebh->b_data, fibh->eoffset, crc); |
| 115 | + crc = crc_itu_t(crc, (uint8_t *)sfi->impUse, |
| 116 | + -fibh->soffset - sizeof(struct fileIdentDesc)); |
| 117 | + crc = crc_itu_t(crc, fibh->ebh->b_data, fibh->eoffset); |
119 | 118 | } |
120 | 119 |
|
121 | 120 | cfi->descTag.descCRC = cpu_to_le16(crc); |
|
0 commit comments