Lines Matching refs:hdr
36 kvshdr_t hdr;
37 if (buflen < sizeof(hdr)) {
41 memcpy(&hdr, buffer, sizeof(hdr));
42 if ((hdr.version != KVSTORE_VERSION) || (hdr.length < sizeof(hdr))) {
45 if (hdr.length > buflen) {
48 if (hdr.flags != 0) {
51 if (hdr.reserved != 0) {
55 uint32_t crc = crc32(0, buffer, sizeof(hdr) - sizeof(uint32_t));
56 crc = crc32(crc, buffer + sizeof(hdr), hdr.length - sizeof(hdr));
57 if (crc != hdr.crc) {
62 uint8_t *kv = buffer + sizeof(hdr);
64 size_t avail = hdr.length - sizeof(hdr);
87 kvs->datalen = sizeof(hdr) + (rec - kv);
95 kvshdr_t hdr;
96 hdr.version = KVSTORE_VERSION;
97 hdr.flags = 0;
98 hdr.length = kvs->datalen;
99 hdr.reserved = 0;
100 hdr.crc = crc32(0, (const void*) &hdr, sizeof(hdr) - sizeof(uint32_t));
101 hdr.crc = crc32(hdr.crc, kvs->data + sizeof(hdr), hdr.length - sizeof(hdr));
102 memcpy(kvs->data, &hdr, sizeof(hdr));