MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zap_leaf_array_create

Function zap_leaf_array_create

freebsd/contrib/openzfs/module/zfs/zap_leaf.c:222–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 */
221
222static uint16_t
223zap_leaf_array_create(zap_leaf_t *l, const char *buf,
224 int integer_size, int num_integers)
225{
226 uint16_t chunk_head;
227 uint16_t *chunkp = &chunk_head;
228 int byten = 0;
229 uint64_t value = 0;
230 int shift = (integer_size - 1) * 8;
231 int len = num_integers;
232
233 ASSERT3U(num_integers * integer_size, <=, ZAP_MAXVALUELEN);
234
235 while (len > 0) {
236 uint16_t chunk = zap_leaf_chunk_alloc(l);
237 struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, chunk).l_array;
238
239 la->la_type = ZAP_CHUNK_ARRAY;
240 for (int i = 0; i < ZAP_LEAF_ARRAY_BYTES; i++) {
241 if (byten == 0)
242 value = ldv(integer_size, buf);
243 la->la_array[i] = value >> shift;
244 value <<= 8;
245 if (++byten == integer_size) {
246 byten = 0;
247 buf += integer_size;
248 if (--len == 0)
249 break;
250 }
251 }
252
253 *chunkp = chunk;
254 chunkp = &la->la_next;
255 }
256 *chunkp = CHAIN_END;
257
258 return (chunk_head);
259}
260
261static void
262zap_leaf_array_free(zap_leaf_t *l, uint16_t *chunkp)

Callers 2

zap_entry_updateFunction · 0.85
zap_entry_createFunction · 0.85

Calls 2

zap_leaf_chunk_allocFunction · 0.85
ldvFunction · 0.85

Tested by

no test coverage detected