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

Function rangeset_copy

freebsd/kern/subr_rangeset.c:279–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279int
280rangeset_copy(struct rangeset *dst_rs, struct rangeset *src_rs)
281{
282 struct rs_el *src_r, *dst_r;
283 uint64_t cursor, *r1;
284 int error;
285
286 MPASS(pctrie_is_empty(&dst_rs->rs_trie));
287 rangeset_check(src_rs);
288 MPASS(dst_rs->rs_dup_data == src_rs->rs_dup_data);
289
290 error = 0;
291 for (cursor = 0;; cursor = src_r->re_start + 1) {
292 r1 = pctrie_lookup_ge(&src_rs->rs_trie, cursor);
293 if (r1 == NULL)
294 break;
295 src_r = __containerof(r1, struct rs_el, re_start);
296 dst_r = dst_rs->rs_dup_data(dst_rs->rs_data_ctx, src_r);
297 if (dst_r == NULL) {
298 error = ENOMEM;
299 break;
300 }
301 error = pctrie_insert(&dst_rs->rs_trie, &dst_r->re_start,
302 rs_node_alloc);
303 if (error != 0)
304 break;
305 }
306 if (error != 0)
307 rangeset_remove_all(dst_rs);
308 return (error);
309}
310
311#ifdef DIAGNOSTIC
312static void

Callers 1

pmap_pkru_copyFunction · 0.85

Calls 5

pctrie_is_emptyFunction · 0.85
rangeset_checkFunction · 0.85
pctrie_lookup_geFunction · 0.85
pctrie_insertFunction · 0.85
rangeset_remove_allFunction · 0.85

Tested by

no test coverage detected