/* * Check the CRC in a frame.
*/
u32 fc_frame_crc_check(struct fc_frame *fp)
{
u32 crc;
u32 error; const u8 *bp; unsignedint len;
WARN_ON(!fc_frame_is_linear(fp));
fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED;
len = (fr_len(fp) + 3) & ~3; /* round up length to include fill */
bp = (const u8 *) fr_hdr(fp);
crc = ~crc32(~0, bp, len);
error = crc ^ fr_crc(fp); return error;
}
EXPORT_SYMBOL(fc_frame_crc_check);
/* * Allocate a frame intended to be sent. * Get an sk_buff for the frame and set the length.
*/ struct fc_frame *_fc_frame_alloc(size_t len)
{ struct fc_frame *fp; struct sk_buff *skb;
fill = payload_len % 4; if (fill != 0)
fill = 4 - fill;
fp = _fc_frame_alloc(payload_len + fill); if (fp) {
memset((char *) fr_hdr(fp) + payload_len, 0, fill); /* trim is OK, we just allocated it so there are no fragments */
skb_trim(fp_skb(fp),
payload_len + sizeof(struct fc_frame_header));
} return fp;
}
EXPORT_SYMBOL(fc_frame_alloc_fill);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.