Lines Matching refs:fdp
64 static TEE_Result out_of_place_write(struct tee_fs_fd *fdp, size_t pos, in out_of_place_write() argument
75 struct tee_fs_htree_meta *meta = tee_fs_htree_get_meta(fdp->ht); in out_of_place_write()
98 res = tee_fs_htree_read_block(&fdp->ht, in out_of_place_write()
117 res = tee_fs_htree_write_block(&fdp->ht, start_block_num, in out_of_place_write()
133 tee_fs_htree_meta_set_dirty(fdp->ht); in out_of_place_write()
230 struct tee_fs_fd *fdp = aux; in ree_fs_rpc_read_init() local
239 return tee_fs_rpc_read_init(op, OPTEE_RPC_CMD_FS, fdp->fd, in ree_fs_rpc_read_init()
248 struct tee_fs_fd *fdp = aux; in ree_fs_rpc_write_init() local
257 return tee_fs_rpc_write_init(op, OPTEE_RPC_CMD_FS, fdp->fd, in ree_fs_rpc_write_init()
269 static TEE_Result ree_fs_ftruncate_internal(struct tee_fs_fd *fdp, in ree_fs_ftruncate_internal() argument
273 struct tee_fs_htree_meta *meta = tee_fs_htree_get_meta(fdp->ht); in ree_fs_ftruncate_internal()
278 res = out_of_place_write(fdp, meta->length, NULL, NULL, in ree_fs_ftruncate_internal()
292 res = tee_fs_htree_truncate(&fdp->ht, in ree_fs_ftruncate_internal()
297 res = tee_fs_rpc_truncate(OPTEE_RPC_CMD_FS, fdp->fd, in ree_fs_ftruncate_internal()
303 tee_fs_htree_meta_set_dirty(fdp->ht); in ree_fs_ftruncate_internal()
320 struct tee_fs_fd *fdp = (struct tee_fs_fd *)fh; in ree_fs_read_primitive() local
321 struct tee_fs_htree_meta *meta = tee_fs_htree_get_meta(fdp->ht); in ree_fs_read_primitive()
355 res = tee_fs_htree_read_block(&fdp->ht, start_block_num, block); in ree_fs_read_primitive()
399 struct tee_fs_fd *fdp = (struct tee_fs_fd *)fh; in ree_fs_write_primitive() local
408 file_size = tee_fs_htree_get_meta(fdp->ht)->length; in ree_fs_write_primitive()
414 res = ree_fs_ftruncate_internal(fdp, pos); in ree_fs_write_primitive()
419 return out_of_place_write(fdp, pos, buf_core, buf_user, len); in ree_fs_write_primitive()
429 struct tee_fs_fd *fdp; in ree_fs_open_primitive() local
431 fdp = calloc(1, sizeof(struct tee_fs_fd)); in ree_fs_open_primitive()
432 if (!fdp) in ree_fs_open_primitive()
434 fdp->fd = -1; in ree_fs_open_primitive()
435 fdp->uuid = uuid; in ree_fs_open_primitive()
439 dfh, &fdp->fd); in ree_fs_open_primitive()
441 res = tee_fs_rpc_open_dfh(OPTEE_RPC_CMD_FS, dfh, &fdp->fd); in ree_fs_open_primitive()
447 &ree_fs_storage_ops, fdp, &fdp->ht); in ree_fs_open_primitive()
451 fdp->dfh = *dfh; in ree_fs_open_primitive()
453 fdp->dfh.idx = -1; in ree_fs_open_primitive()
454 *fh = (struct tee_file_handle *)fdp; in ree_fs_open_primitive()
458 if (fdp->fd != -1) in ree_fs_open_primitive()
459 tee_fs_rpc_close(OPTEE_RPC_CMD_FS, fdp->fd); in ree_fs_open_primitive()
462 free(fdp); in ree_fs_open_primitive()
470 struct tee_fs_fd *fdp = (struct tee_fs_fd *)fh; in ree_fs_close_primitive() local
472 if (fdp) { in ree_fs_close_primitive()
473 tee_fs_htree_close(&fdp->ht); in ree_fs_close_primitive()
474 tee_fs_rpc_close(OPTEE_RPC_CMD_FS, fdp->fd); in ree_fs_close_primitive()
475 free(fdp); in ree_fs_close_primitive()
483 struct tee_fs_fd *fdp = (struct tee_fs_fd *)fh; in ree_dirf_commit_writes() local
485 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, counter); in ree_dirf_commit_writes()
488 memcpy(hash, fdp->dfh.hash, sizeof(fdp->dfh.hash)); in ree_dirf_commit_writes()
733 struct tee_fs_fd *fdp = (struct tee_fs_fd *)*fh; in ree_fs_open() local
735 *size = tee_fs_htree_get_meta(fdp->ht)->length; in ree_fs_open()
747 struct tee_fs_fd *fdp, struct tee_pobj *po, in set_name() argument
766 fdp->dfh.idx = old_dfh.idx; in set_name()
768 res = tee_fs_dirfile_rename(dirh, &po->uuid, &fdp->dfh, in set_name()
801 struct tee_fs_fd *fdp; in ree_fs_create() local
846 fdp = (struct tee_fs_fd *)*fh; in ree_fs_create()
847 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, NULL); in ree_fs_create()
851 res = set_name(dirh, fdp, po, overwrite); in ree_fs_create()
872 struct tee_fs_fd *fdp = (struct tee_fs_fd *)fh; in ree_fs_write() local
887 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, NULL); in ree_fs_write()
891 res = tee_fs_dirfile_update_hash(dirh, &fdp->dfh); in ree_fs_write()
995 struct tee_fs_fd *fdp = (struct tee_fs_fd *)fh; in ree_fs_truncate() local
1003 res = ree_fs_ftruncate_internal(fdp, len); in ree_fs_truncate()
1007 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, NULL); in ree_fs_truncate()
1011 res = tee_fs_dirfile_update_hash(dirh, &fdp->dfh); in ree_fs_truncate()