Lines Matching refs:idx
143 static TEE_Result maybe_grow_files(struct tee_tadb_dir *db, int idx) in maybe_grow_files() argument
147 if (idx < db->nbits) in maybe_grow_files()
150 p = realloc(db->files, bitstr_size(idx + 1)); in maybe_grow_files()
155 bit_nclear(db->files, db->nbits, idx); in maybe_grow_files()
156 db->nbits = idx + 1; in maybe_grow_files()
161 static TEE_Result set_file(struct tee_tadb_dir *db, int idx) in set_file() argument
163 TEE_Result res = maybe_grow_files(db, idx); in set_file()
166 bit_set(db->files, idx); in set_file()
171 static void clear_file(struct tee_tadb_dir *db, int idx) in clear_file() argument
177 if (idx < db->nbits) in clear_file()
178 bit_clear(db->files, idx); in clear_file()
181 static bool test_file(struct tee_tadb_dir *db, int idx) in test_file() argument
187 if (idx < db->nbits) in test_file()
188 return bit_test(db->files, idx); in test_file()
193 static TEE_Result read_ent(struct tee_tadb_dir *db, size_t idx, in read_ent() argument
197 TEE_Result res = db->ops->read(db->fh, idx * l, entry, &l); in read_ent()
205 static TEE_Result write_ent(struct tee_tadb_dir *db, size_t idx, in write_ent() argument
210 return db->ops->write(db->fh, idx * l, entry, l); in write_ent()
316 size_t idx; in populate_files() local
336 for (idx = 0;; idx++) { in populate_files()
339 res = read_ent(db, idx, &entry); in populate_files()
353 res = write_ent(db, idx, &entry); in populate_files()
499 size_t idx; in find_ent() local
508 for (idx = 0;; idx++) { in find_ent()
511 res = read_ent(db, idx, &entry); in find_ent()
525 *idx_ret = idx; in find_ent()
529 static TEE_Result find_free_ent_idx(struct tee_tadb_dir *db, size_t *idx) in find_free_ent_idx() argument
532 TEE_Result res = find_ent(db, &null_uuid, idx, NULL); in find_free_ent_idx()
548 size_t idx; in tee_tadb_ta_close_and_commit() local
567 res = find_ent(ta->db, &ta->entry.prop.uuid, &idx, &old_ent); in tee_tadb_ta_close_and_commit()
571 res = find_free_ent_idx(ta->db, &idx); in tee_tadb_ta_close_and_commit()
575 res = write_ent(ta->db, idx, &ta->entry); in tee_tadb_ta_close_and_commit()
602 size_t idx; in tee_tadb_ta_delete() local
613 res = find_ent(db, uuid, &idx, &entry); in tee_tadb_ta_delete()
621 res = write_ent(db, idx, &null_entry); in tee_tadb_ta_delete()
636 size_t idx = 0; in tee_tadb_ta_open() local
651 res = find_ent(ta->db, uuid, &idx, &ta->entry); in tee_tadb_ta_open()