Lines Matching refs:res

67 	TEE_Result res;  in out_of_place_write()  local
96 res = tee_fs_htree_read_block(&fdp->ht, in out_of_place_write()
98 if (res != TEE_SUCCESS) in out_of_place_write()
109 res = tee_fs_htree_write_block(&fdp->ht, start_block_num, in out_of_place_write()
111 if (res != TEE_SUCCESS) in out_of_place_write()
129 return res; in out_of_place_write()
221 TEE_Result res; in ree_fs_rpc_read_init() local
225 res = get_offs_size(type, idx, vers, &offs, &size); in ree_fs_rpc_read_init()
226 if (res != TEE_SUCCESS) in ree_fs_rpc_read_init()
227 return res; in ree_fs_rpc_read_init()
239 TEE_Result res; in ree_fs_rpc_write_init() local
243 res = get_offs_size(type, idx, vers, &offs, &size); in ree_fs_rpc_write_init()
244 if (res != TEE_SUCCESS) in ree_fs_rpc_write_init()
245 return res; in ree_fs_rpc_write_init()
262 TEE_Result res; in ree_fs_ftruncate_internal() local
268 res = out_of_place_write(fdp, meta->length, NULL, ext_len); in ree_fs_ftruncate_internal()
269 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
270 return res; in ree_fs_ftruncate_internal()
275 res = get_offs_size(TEE_FS_HTREE_TYPE_BLOCK, in ree_fs_ftruncate_internal()
278 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
279 return res; in ree_fs_ftruncate_internal()
281 res = tee_fs_htree_truncate(&fdp->ht, in ree_fs_ftruncate_internal()
283 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
284 return res; in ree_fs_ftruncate_internal()
286 res = tee_fs_rpc_truncate(OPTEE_RPC_CMD_FS, fdp->fd, in ree_fs_ftruncate_internal()
288 if (res != TEE_SUCCESS) in ree_fs_ftruncate_internal()
289 return res; in ree_fs_ftruncate_internal()
301 TEE_Result res; in ree_fs_read_primitive() local
319 res = TEE_SUCCESS; in ree_fs_read_primitive()
328 res = TEE_ERROR_OUT_OF_MEMORY; in ree_fs_read_primitive()
339 res = tee_fs_htree_read_block(&fdp->ht, start_block_num, block); in ree_fs_read_primitive()
340 if (res != TEE_SUCCESS) in ree_fs_read_primitive()
351 res = TEE_SUCCESS; in ree_fs_read_primitive()
355 return res; in ree_fs_read_primitive()
361 TEE_Result res; in ree_fs_read() local
364 res = ree_fs_read_primitive(fh, pos, buf, len); in ree_fs_read()
367 return res; in ree_fs_read()
373 TEE_Result res; in ree_fs_write_primitive() local
386 res = ree_fs_ftruncate_internal(fdp, pos); in ree_fs_write_primitive()
387 if (res != TEE_SUCCESS) in ree_fs_write_primitive()
388 return res; in ree_fs_write_primitive()
399 TEE_Result res; in ree_fs_open_primitive() local
409 res = tee_fs_rpc_create_dfh(OPTEE_RPC_CMD_FS, in ree_fs_open_primitive()
412 res = tee_fs_rpc_open_dfh(OPTEE_RPC_CMD_FS, dfh, &fdp->fd); in ree_fs_open_primitive()
414 if (res != TEE_SUCCESS) in ree_fs_open_primitive()
417 res = tee_fs_htree_open(create, hash, uuid, &ree_fs_storage_ops, in ree_fs_open_primitive()
420 if (res == TEE_SUCCESS) { in ree_fs_open_primitive()
427 if (res == TEE_ERROR_SECURITY) in ree_fs_open_primitive()
436 return res; in ree_fs_open_primitive()
453 TEE_Result res; in ree_dirf_commit_writes() local
456 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash); in ree_dirf_commit_writes()
458 if (!res && hash) in ree_dirf_commit_writes()
461 return res; in ree_dirf_commit_writes()
480 TEE_Result res; in open_dirh() local
485 res = tee_rpmb_fs_raw_open(fname, false, &ree_fs_rpmb_fh); in open_dirh()
486 if (!res) { in open_dirh()
489 res = rpmb_fs_ops.read(ree_fs_rpmb_fh, 0, hash, &l); in open_dirh()
490 if (res) in open_dirh()
491 return res; in open_dirh()
494 } else if (res == TEE_ERROR_ITEM_NOT_FOUND) { in open_dirh()
495 res = tee_rpmb_fs_raw_open(fname, true, &ree_fs_rpmb_fh); in open_dirh()
497 if (res) in open_dirh()
498 return res; in open_dirh()
500 res = tee_fs_dirfile_open(false, hashp, &ree_dirf_ops, dirh); in open_dirh()
502 if (res == TEE_ERROR_ITEM_NOT_FOUND) { in open_dirh()
506 res = rpmb_fs_ops.truncate(ree_fs_rpmb_fh, 0); in open_dirh()
507 if (res) { in open_dirh()
508 DMSG("Can't clear hash: %#"PRIx32, res); in open_dirh()
509 res = TEE_ERROR_SECURITY; in open_dirh()
514 res = TEE_ERROR_SECURITY; in open_dirh()
519 res = tee_fs_dirfile_open(true, NULL, &ree_dirf_ops, dirh); in open_dirh()
523 if (res) in open_dirh()
526 return res; in open_dirh()
531 TEE_Result res; in commit_dirh_writes() local
534 res = tee_fs_dirfile_commit_writes(dirh, hash); in commit_dirh_writes()
535 if (res) in commit_dirh_writes()
536 return res; in commit_dirh_writes()
550 TEE_Result res; in open_dirh() local
552 res = tee_fs_dirfile_open(false, NULL, &ree_dirf_ops, dirh); in open_dirh()
553 if (res == TEE_ERROR_ITEM_NOT_FOUND) in open_dirh()
556 return res; in open_dirh()
574 TEE_Result res = open_dirh(&ree_fs_dirh); in get_dirh() local
576 if (res) { in get_dirh()
578 return res; in get_dirh()
620 TEE_Result res; in ree_fs_open() local
626 res = get_dirh(&dirh); in ree_fs_open()
627 if (res != TEE_SUCCESS) in ree_fs_open()
630 res = tee_fs_dirfile_find(dirh, &po->uuid, po->obj_id, po->obj_id_len, in ree_fs_open()
632 if (res != TEE_SUCCESS) in ree_fs_open()
635 res = ree_fs_open_primitive(false, dfh.hash, &po->uuid, &dfh, fh); in ree_fs_open()
636 if (res == TEE_ERROR_ITEM_NOT_FOUND) { in ree_fs_open()
641 res = TEE_ERROR_CORRUPT_OBJECT; in ree_fs_open()
642 } else if (!res && size) { in ree_fs_open()
649 if (res) in ree_fs_open()
653 return res; in ree_fs_open()
660 TEE_Result res; in set_name() local
664 res = tee_fs_dirfile_find(dirh, &po->uuid, po->obj_id, po->obj_id_len, in set_name()
666 if (!overwrite && !res) in set_name()
669 if (!res) in set_name()
678 res = tee_fs_dirfile_rename(dirh, &po->uuid, &fdp->dfh, in set_name()
680 if (res) in set_name()
681 return res; in set_name()
683 res = commit_dirh_writes(dirh); in set_name()
684 if (res) in set_name()
685 return res; in set_name()
714 TEE_Result res; in ree_fs_create() local
720 res = get_dirh(&dirh); in ree_fs_create()
721 if (res) in ree_fs_create()
724 res = tee_fs_dirfile_get_tmp(dirh, &dfh); in ree_fs_create()
725 if (res) in ree_fs_create()
728 res = ree_fs_open_primitive(true, dfh.hash, &po->uuid, &dfh, fh); in ree_fs_create()
729 if (res) in ree_fs_create()
733 res = ree_fs_write_primitive(*fh, pos, head, head_size); in ree_fs_create()
734 if (res) in ree_fs_create()
740 res = ree_fs_write_primitive(*fh, pos, attr, attr_size); in ree_fs_create()
741 if (res) in ree_fs_create()
747 res = ree_fs_write_primitive(*fh, pos, data, data_size); in ree_fs_create()
748 if (res) in ree_fs_create()
753 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash); in ree_fs_create()
754 if (res) in ree_fs_create()
757 res = set_name(dirh, fdp, po, overwrite); in ree_fs_create()
759 if (res) { in ree_fs_create()
769 return res; in ree_fs_create()
775 TEE_Result res; in ree_fs_write() local
781 res = get_dirh(&dirh); in ree_fs_write()
782 if (res) in ree_fs_write()
785 res = ree_fs_write_primitive(fh, pos, buf, len); in ree_fs_write()
786 if (res) in ree_fs_write()
789 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash); in ree_fs_write()
790 if (res) in ree_fs_write()
793 res = tee_fs_dirfile_update_hash(dirh, &fdp->dfh); in ree_fs_write()
794 if (res) in ree_fs_write()
796 res = commit_dirh_writes(dirh); in ree_fs_write()
798 put_dirh(dirh, res); in ree_fs_write()
801 return res; in ree_fs_write()
807 TEE_Result res; in ree_fs_rename() local
816 res = get_dirh(&dirh); in ree_fs_rename()
817 if (res) in ree_fs_rename()
820 res = tee_fs_dirfile_find(dirh, &new->uuid, new->obj_id, in ree_fs_rename()
822 if (!res && !overwrite) { in ree_fs_rename()
823 res = TEE_ERROR_ACCESS_CONFLICT; in ree_fs_rename()
827 res = tee_fs_dirfile_find(dirh, &old->uuid, old->obj_id, in ree_fs_rename()
829 if (res) in ree_fs_rename()
832 res = tee_fs_dirfile_rename(dirh, &new->uuid, &dfh, new->obj_id, in ree_fs_rename()
834 if (res) in ree_fs_rename()
838 res = tee_fs_dirfile_remove(dirh, &remove_dfh); in ree_fs_rename()
839 if (res) in ree_fs_rename()
843 res = commit_dirh_writes(dirh); in ree_fs_rename()
844 if (res) in ree_fs_rename()
851 put_dirh(dirh, res); in ree_fs_rename()
854 return res; in ree_fs_rename()
860 TEE_Result res; in ree_fs_remove() local
865 res = get_dirh(&dirh); in ree_fs_remove()
866 if (res) in ree_fs_remove()
869 res = tee_fs_dirfile_find(dirh, &po->uuid, po->obj_id, po->obj_id_len, in ree_fs_remove()
871 if (res) in ree_fs_remove()
874 res = tee_fs_dirfile_remove(dirh, &dfh); in ree_fs_remove()
875 if (res) in ree_fs_remove()
878 res = commit_dirh_writes(dirh); in ree_fs_remove()
879 if (res) in ree_fs_remove()
887 put_dirh(dirh, res); in ree_fs_remove()
890 return res; in ree_fs_remove()
895 TEE_Result res; in ree_fs_truncate() local
901 res = get_dirh(&dirh); in ree_fs_truncate()
902 if (res) in ree_fs_truncate()
905 res = ree_fs_ftruncate_internal(fdp, len); in ree_fs_truncate()
906 if (res) in ree_fs_truncate()
909 res = tee_fs_htree_sync_to_storage(&fdp->ht, fdp->dfh.hash); in ree_fs_truncate()
910 if (res) in ree_fs_truncate()
913 res = tee_fs_dirfile_update_hash(dirh, &fdp->dfh); in ree_fs_truncate()
914 if (res) in ree_fs_truncate()
916 res = commit_dirh_writes(dirh); in ree_fs_truncate()
918 put_dirh(dirh, res); in ree_fs_truncate()
921 return res; in ree_fs_truncate()
928 TEE_Result res; in ree_fs_opendir_rpc() local
938 res = get_dirh(&d->dirh); in ree_fs_opendir_rpc()
939 if (res) in ree_fs_opendir_rpc()
945 res = tee_fs_dirfile_get_next(d->dirh, d->uuid, &d->idx, d->d.oid, in ree_fs_opendir_rpc()
950 if (!res) { in ree_fs_opendir_rpc()
959 return res; in ree_fs_opendir_rpc()
977 TEE_Result res; in ree_fs_readdir_rpc() local
982 res = tee_fs_dirfile_get_next(d->dirh, d->uuid, &d->idx, d->d.oid, in ree_fs_readdir_rpc()
984 if (res == TEE_SUCCESS) in ree_fs_readdir_rpc()
989 return res; in ree_fs_readdir_rpc()