Lines Matching refs:res

68 	TEE_Result res;  in out_of_place_write()  local
98 res = tee_fs_htree_read_block(&fdp->ht, in out_of_place_write()
100 if (res != TEE_SUCCESS) in out_of_place_write()
109 res = copy_from_user(block + offset, data_user_ptr, in out_of_place_write()
111 if (res) in out_of_place_write()
112 return res; in out_of_place_write()
117 res = tee_fs_htree_write_block(&fdp->ht, start_block_num, in out_of_place_write()
119 if (res != TEE_SUCCESS) in out_of_place_write()
139 return res; in out_of_place_write()
231 TEE_Result res; in ree_fs_rpc_read_init() local
235 res = get_offs_size(type, idx, vers, &offs, &size); in ree_fs_rpc_read_init()
236 if (res != TEE_SUCCESS) in ree_fs_rpc_read_init()
237 return res; in ree_fs_rpc_read_init()
249 TEE_Result res; in ree_fs_rpc_write_init() local
253 res = get_offs_size(type, idx, vers, &offs, &size); in ree_fs_rpc_write_init()
254 if (res != TEE_SUCCESS) in ree_fs_rpc_write_init()
255 return res; in ree_fs_rpc_write_init()
272 TEE_Result res; in ree_fs_ftruncate_internal() local
278 res = out_of_place_write(fdp, meta->length, NULL, NULL, in ree_fs_ftruncate_internal()
280 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
281 return res; in ree_fs_ftruncate_internal()
286 res = get_offs_size(TEE_FS_HTREE_TYPE_BLOCK, in ree_fs_ftruncate_internal()
289 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
290 return res; in ree_fs_ftruncate_internal()
292 res = tee_fs_htree_truncate(&fdp->ht, in ree_fs_ftruncate_internal()
294 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
295 return res; in ree_fs_ftruncate_internal()
297 res = tee_fs_rpc_truncate(OPTEE_RPC_CMD_FS, fdp->fd, in ree_fs_ftruncate_internal()
299 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
300 return res; in ree_fs_ftruncate_internal()
313 TEE_Result res; in ree_fs_read_primitive() local
335 res = TEE_SUCCESS; in ree_fs_read_primitive()
344 res = TEE_ERROR_OUT_OF_MEMORY; in ree_fs_read_primitive()
355 res = tee_fs_htree_read_block(&fdp->ht, start_block_num, block); in ree_fs_read_primitive()
356 if (res != TEE_SUCCESS) in ree_fs_read_primitive()
363 res = copy_to_user(data_user_ptr, block + offset, in ree_fs_read_primitive()
365 if (res) in ree_fs_read_primitive()
375 res = TEE_SUCCESS; in ree_fs_read_primitive()
379 return res; in ree_fs_read_primitive()
385 TEE_Result res; in ree_fs_read() local
388 res = ree_fs_read_primitive(fh, pos, buf_core, buf_user, len); in ree_fs_read()
391 return res; in ree_fs_read()
398 TEE_Result res; in ree_fs_write_primitive() local
414 res = ree_fs_ftruncate_internal(fdp, pos); in ree_fs_write_primitive()
415 if (res != TEE_SUCCESS) in ree_fs_write_primitive()
416 return res; in ree_fs_write_primitive()
428 TEE_Result res; in ree_fs_open_primitive() local
438 res = tee_fs_rpc_create_dfh(OPTEE_RPC_CMD_FS, in ree_fs_open_primitive()
441 res = tee_fs_rpc_open_dfh(OPTEE_RPC_CMD_FS, dfh, &fdp->fd); in ree_fs_open_primitive()
443 if (res != TEE_SUCCESS) in ree_fs_open_primitive()
446 res = tee_fs_htree_open(create, hash, min_counter, uuid, in ree_fs_open_primitive()
449 if (res == TEE_SUCCESS) { in ree_fs_open_primitive()
456 if (res == TEE_ERROR_SECURITY) in ree_fs_open_primitive()
465 return res; in ree_fs_open_primitive()
482 TEE_Result res; 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()
487 if (!res && hash) in ree_dirf_commit_writes()
490 return res; in ree_dirf_commit_writes()
529 TEE_Result res; in open_dirh() local
534 res = tee_rpmb_fs_raw_open(fname, false, &ree_fs_rpmb_fh); in open_dirh()
535 if (!res) { in open_dirh()
538 res = rpmb_fs_ops.read(ree_fs_rpmb_fh, 0, hash, NULL, &l); in open_dirh()
539 if (res) in open_dirh()
540 return res; in open_dirh()
543 } else if (res == TEE_ERROR_ITEM_NOT_FOUND) { in open_dirh()
544 res = tee_rpmb_fs_raw_open(fname, true, &ree_fs_rpmb_fh); in open_dirh()
546 if (res) in open_dirh()
547 return res; in open_dirh()
549 res = tee_fs_dirfile_open(false, hashp, 0, &ree_dirf_ops, dirh); in open_dirh()
551 if (res == TEE_ERROR_ITEM_NOT_FOUND) { in open_dirh()
555 res = rpmb_fs_ops.truncate(ree_fs_rpmb_fh, 0); in open_dirh()
556 if (res) { in open_dirh()
557 DMSG("Can't clear hash: %#"PRIx32, res); in open_dirh()
558 res = TEE_ERROR_SECURITY; in open_dirh()
563 res = TEE_ERROR_SECURITY; in open_dirh()
568 res = tee_fs_dirfile_open(true, NULL, 0, &ree_dirf_ops, dirh); in open_dirh()
572 if (res) in open_dirh()
575 return res; in open_dirh()
580 TEE_Result res; in commit_dirh_writes() local
583 res = tee_fs_dirfile_commit_writes(dirh, hash, NULL); in commit_dirh_writes()
584 if (res) in commit_dirh_writes()
585 return res; in commit_dirh_writes()
599 TEE_Result res = TEE_SUCCESS; in open_dirh() local
602 res = nv_counter_get_ree_fs(&min_counter); in open_dirh()
603 if (res) { in open_dirh()
606 if (res != TEE_ERROR_NOT_IMPLEMENTED || in open_dirh()
608 return res; in open_dirh()
616 res = tee_fs_dirfile_open(false, NULL, min_counter, &ree_dirf_ops, in open_dirh()
618 if (res == TEE_ERROR_ITEM_NOT_FOUND) { in open_dirh()
630 return res; in open_dirh()
635 TEE_Result res = TEE_SUCCESS; in commit_dirh_writes() local
638 res = tee_fs_dirfile_commit_writes(dirh, NULL, &counter); in commit_dirh_writes()
639 if (res) in commit_dirh_writes()
640 return res; in commit_dirh_writes()
641 res = nv_counter_incr_ree_fs_to(counter); in commit_dirh_writes()
642 if (res == TEE_ERROR_NOT_IMPLEMENTED && IS_ENABLED(CFG_INSECURE)) { in commit_dirh_writes()
651 return res; in commit_dirh_writes()
664 TEE_Result res = open_dirh(&ree_fs_dirh); in get_dirh() local
666 if (res) { in get_dirh()
668 return res; in get_dirh()
710 TEE_Result res; in ree_fs_open() local
716 res = get_dirh(&dirh); in ree_fs_open()
717 if (res != TEE_SUCCESS) in ree_fs_open()
720 res = tee_fs_dirfile_find(dirh, &po->uuid, po->obj_id, po->obj_id_len, in ree_fs_open()
722 if (res != TEE_SUCCESS) in ree_fs_open()
725 res = ree_fs_open_primitive(false, dfh.hash, 0, &po->uuid, &dfh, fh); in ree_fs_open()
726 if (res == TEE_ERROR_ITEM_NOT_FOUND) { in ree_fs_open()
731 res = TEE_ERROR_CORRUPT_OBJECT; in ree_fs_open()
732 } else if (!res && size) { in ree_fs_open()
739 if (res) in ree_fs_open()
743 return res; in ree_fs_open()
750 TEE_Result res; in set_name() local
754 res = tee_fs_dirfile_find(dirh, &po->uuid, po->obj_id, po->obj_id_len, in set_name()
756 if (!overwrite && !res) in set_name()
759 if (!res) in set_name()
768 res = tee_fs_dirfile_rename(dirh, &po->uuid, &fdp->dfh, in set_name()
770 if (res) in set_name()
771 return res; in set_name()
773 res = commit_dirh_writes(dirh); in set_name()
774 if (res) in set_name()
775 return res; in set_name()
804 TEE_Result res; in ree_fs_create() local
813 res = get_dirh(&dirh); in ree_fs_create()
814 if (res) in ree_fs_create()
817 res = tee_fs_dirfile_get_tmp(dirh, &dfh); in ree_fs_create()
818 if (res) in ree_fs_create()
821 res = ree_fs_open_primitive(true, dfh.hash, 0, &po->uuid, &dfh, fh); in ree_fs_create()
822 if (res) in ree_fs_create()
826 res = ree_fs_write_primitive(*fh, pos, head, NULL, head_size); in ree_fs_create()
827 if (res) in ree_fs_create()
833 res = ree_fs_write_primitive(*fh, pos, attr, NULL, attr_size); in ree_fs_create()
834 if (res) in ree_fs_create()
840 res = ree_fs_write_primitive(*fh, pos, data_core, data_user, in ree_fs_create()
842 if (res) in ree_fs_create()
847 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, NULL); in ree_fs_create()
848 if (res) in ree_fs_create()
851 res = set_name(dirh, fdp, po, overwrite); in ree_fs_create()
853 if (res) { in ree_fs_create()
863 return res; in ree_fs_create()
870 TEE_Result res; in ree_fs_write() local
879 res = get_dirh(&dirh); in ree_fs_write()
880 if (res) in ree_fs_write()
883 res = ree_fs_write_primitive(fh, pos, buf_core, buf_user, len); in ree_fs_write()
884 if (res) in ree_fs_write()
887 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, NULL); in ree_fs_write()
888 if (res) in ree_fs_write()
891 res = tee_fs_dirfile_update_hash(dirh, &fdp->dfh); in ree_fs_write()
892 if (res) in ree_fs_write()
894 res = commit_dirh_writes(dirh); in ree_fs_write()
896 put_dirh(dirh, res); in ree_fs_write()
899 return res; in ree_fs_write()
905 TEE_Result res; in ree_fs_rename() local
914 res = get_dirh(&dirh); in ree_fs_rename()
915 if (res) in ree_fs_rename()
918 res = tee_fs_dirfile_find(dirh, &new->uuid, new->obj_id, in ree_fs_rename()
920 if (!res && !overwrite) { in ree_fs_rename()
921 res = TEE_ERROR_ACCESS_CONFLICT; in ree_fs_rename()
925 res = tee_fs_dirfile_find(dirh, &old->uuid, old->obj_id, in ree_fs_rename()
927 if (res) in ree_fs_rename()
930 res = tee_fs_dirfile_rename(dirh, &new->uuid, &dfh, new->obj_id, in ree_fs_rename()
932 if (res) in ree_fs_rename()
936 res = tee_fs_dirfile_remove(dirh, &remove_dfh); in ree_fs_rename()
937 if (res) in ree_fs_rename()
941 res = commit_dirh_writes(dirh); in ree_fs_rename()
942 if (res) in ree_fs_rename()
949 put_dirh(dirh, res); in ree_fs_rename()
952 return res; in ree_fs_rename()
958 TEE_Result res; in ree_fs_remove() local
963 res = get_dirh(&dirh); in ree_fs_remove()
964 if (res) in ree_fs_remove()
967 res = tee_fs_dirfile_find(dirh, &po->uuid, po->obj_id, po->obj_id_len, in ree_fs_remove()
969 if (res) in ree_fs_remove()
972 res = tee_fs_dirfile_remove(dirh, &dfh); in ree_fs_remove()
973 if (res) in ree_fs_remove()
976 res = commit_dirh_writes(dirh); in ree_fs_remove()
977 if (res) in ree_fs_remove()
985 put_dirh(dirh, res); in ree_fs_remove()
988 return res; in ree_fs_remove()
993 TEE_Result res; in ree_fs_truncate() local
999 res = get_dirh(&dirh); in ree_fs_truncate()
1000 if (res) in ree_fs_truncate()
1003 res = ree_fs_ftruncate_internal(fdp, len); in ree_fs_truncate()
1004 if (res) in ree_fs_truncate()
1007 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash, NULL); in ree_fs_truncate()
1008 if (res) in ree_fs_truncate()
1011 res = tee_fs_dirfile_update_hash(dirh, &fdp->dfh); in ree_fs_truncate()
1012 if (res) in ree_fs_truncate()
1014 res = commit_dirh_writes(dirh); in ree_fs_truncate()
1016 put_dirh(dirh, res); in ree_fs_truncate()
1019 return res; in ree_fs_truncate()
1026 TEE_Result res = TEE_SUCCESS; in ree_fs_opendir_rpc() local
1037 res = get_dirh(&dirh); in ree_fs_opendir_rpc()
1038 if (res) in ree_fs_opendir_rpc()
1044 res = tee_fs_dirfile_get_next(dirh, d->uuid, &d->idx, d->d.oid, in ree_fs_opendir_rpc()
1049 if (!res) { in ree_fs_opendir_rpc()
1058 return res; in ree_fs_opendir_rpc()
1077 TEE_Result res = TEE_SUCCESS; in ree_fs_readdir_rpc() local
1081 res = get_dirh(&dirh); in ree_fs_readdir_rpc()
1082 if (res) in ree_fs_readdir_rpc()
1086 res = tee_fs_dirfile_get_next(dirh, d->uuid, &d->idx, d->d.oid, in ree_fs_readdir_rpc()
1088 if (res == TEE_SUCCESS) in ree_fs_readdir_rpc()
1091 put_dirh(dirh, res); in ree_fs_readdir_rpc()
1095 return res; in ree_fs_readdir_rpc()