Lines Matching full:world
29 struct world { struct
46 static struct objagg_obj *world_obj_get(struct world *world, in world_obj_get() argument
60 if (!world->key_refs[key_id_index(key_id)]) { in world_obj_get()
61 world->objagg_objs[key_id_index(key_id)] = objagg_obj; in world_obj_get()
62 } else if (world->objagg_objs[key_id_index(key_id)] != objagg_obj) { in world_obj_get()
68 world->key_refs[key_id_index(key_id)]++; in world_obj_get()
76 static void world_obj_put(struct world *world, struct objagg *objagg, in world_obj_put() argument
81 if (!world->key_refs[key_id_index(key_id)]) in world_obj_put()
83 objagg_obj = world->objagg_objs[key_id_index(key_id)]; in world_obj_put()
85 world->key_refs[key_id_index(key_id)]--; in world_obj_put()
102 struct world *world = priv; in delta_create() local
114 world->delta_count++; in delta_create()
121 struct world *world = priv; in delta_destroy() local
123 world->delta_count--; in delta_destroy()
129 struct world *world = priv; in root_create() local
137 memcpy(root->buf, world->next_root_buf, sizeof(root->buf)); in root_create()
138 world->root_count++; in root_create()
145 struct world *world = priv; in root_destroy() local
147 world->root_count--; in root_destroy()
151 static int test_nodelta_obj_get(struct world *world, struct objagg *objagg, in test_nodelta_obj_get() argument
154 unsigned int orig_root_count = world->root_count; in test_nodelta_obj_get()
160 prandom_bytes(world->next_root_buf, in test_nodelta_obj_get()
161 sizeof(world->next_root_buf)); in test_nodelta_obj_get()
163 objagg_obj = world_obj_get(world, objagg, key_id); in test_nodelta_obj_get()
169 if (world->root_count != orig_root_count + 1) { in test_nodelta_obj_get()
175 if (world->root_count != orig_root_count) { in test_nodelta_obj_get()
189 memcmp(world->next_root_buf, root->buf, sizeof(root->buf))) { in test_nodelta_obj_get()
204 static int test_nodelta_obj_put(struct world *world, struct objagg *objagg, in test_nodelta_obj_put() argument
207 unsigned int orig_root_count = world->root_count; in test_nodelta_obj_put()
209 world_obj_put(world, objagg, key_id); in test_nodelta_obj_put()
212 if (world->root_count != orig_root_count - 1) { in test_nodelta_obj_put()
217 if (world->root_count != orig_root_count) { in test_nodelta_obj_put()
306 struct world world = {}; in test_nodelta() local
311 objagg = objagg_create(&nodelta_ops, NULL, &world); in test_nodelta()
321 err = test_nodelta_obj_get(&world, objagg, i, true); in test_nodelta()
330 err = test_nodelta_obj_get(&world, objagg, i, false); in test_nodelta()
340 err = test_nodelta_obj_put(&world, objagg, i, false); in test_nodelta()
345 err = test_nodelta_obj_put(&world, objagg, i, true); in test_nodelta()
361 world_obj_put(&world, objagg, i); in test_nodelta()
367 world_obj_put(&world, objagg, i); in test_nodelta()
561 static int check_expect(struct world *world, in check_expect() argument
570 if (orig_delta_count != world->delta_count) { in check_expect()
579 if (orig_delta_count + 1 != world->delta_count) { in check_expect()
588 if (orig_delta_count - 1 != world->delta_count) { in check_expect()
598 if (orig_root_count != world->root_count) { in check_expect()
607 if (orig_root_count + 1 != world->root_count) { in check_expect()
616 if (orig_root_count - 1 != world->root_count) { in check_expect()
757 static int test_delta_action_item(struct world *world, in test_delta_action_item() argument
762 unsigned int orig_delta_count = world->delta_count; in test_delta_action_item()
763 unsigned int orig_root_count = world->root_count; in test_delta_action_item()
775 objagg_obj = world_obj_get(world, objagg, key_id); in test_delta_action_item()
780 world_obj_put(world, objagg, key_id); in test_delta_action_item()
786 err = check_expect(world, action_item, in test_delta_action_item()
803 test_delta_action_item(world, objagg, action_item, true); in test_delta_action_item()
809 struct world world = {}; in test_delta() local
814 objagg = objagg_create(&delta_ops, NULL, &world); in test_delta()
819 err = test_delta_action_item(&world, objagg, in test_delta()
830 test_delta_action_item(&world, objagg, &action_items[i], true); in test_delta()
913 struct world world2 = {}; in test_hints_case()
914 struct world world = {}; in test_hints_case() local
921 objagg = objagg_create(&delta_ops, NULL, &world); in test_hints_case()
926 objagg_obj = world_obj_get(&world, objagg, in test_hints_case()
990 world_obj_put(&world, objagg, hints_case->key_ids[i]); in test_hints_case()