Lines Matching refs:world

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