| 363 | /* internal utils */ |
| 364 | |
| 365 | int bp__tree_read_head(bp__writer_t *w, void *data) |
| 366 | { |
| 367 | int ret; |
| 368 | bp_db_t *t = (bp_db_t *) w; |
| 369 | bp__tree_head_t* head = (bp__tree_head_t *) data; |
| 370 | |
| 371 | t->head.offset = myntohll(head->offset); |
| 372 | t->head.config = myntohll(head->config); |
| 373 | t->head.page_size = myntohll(head->page_size); |
| 374 | t->head.hash = myntohll(head->hash); |
| 375 | |
| 376 | /* we've copied all data - free it */ |
| 377 | free(data); |
| 378 | |
| 379 | /* Check hash first */ |
| 380 | if (bp__compute_hashl(t->head.offset) != t->head.hash) return 1; |
| 381 | |
| 382 | ret = bp__page_load(t, t->head.offset, t->head.config, &t->head.page); |
| 383 | if (ret != BP_OK) return ret; |
| 384 | |
| 385 | t->head.page->is_head = 1; |
| 386 | |
| 387 | return ret; |
| 388 | } |
| 389 | |
| 390 | int bp__tree_write_head(bp__writer_t *w, void *data) |
| 391 | { |
nothing calls this directly
no test coverage detected