Lines Matching refs:ce
755 static void clear_shm_cache_entry(struct thread_shm_cache_entry *ce) in clear_shm_cache_entry() argument
757 if (ce->mobj) { in clear_shm_cache_entry()
758 switch (ce->type) { in clear_shm_cache_entry()
760 thread_rpc_free_payload(ce->mobj); in clear_shm_cache_entry()
763 thread_rpc_free_kernel_payload(ce->mobj); in clear_shm_cache_entry()
766 thread_rpc_free_global_payload(ce->mobj); in clear_shm_cache_entry()
773 ce->mobj = NULL; in clear_shm_cache_entry()
774 ce->size = 0; in clear_shm_cache_entry()
781 struct thread_shm_cache_entry *ce = NULL; in get_shm_cache_entry() local
783 SLIST_FOREACH(ce, cache, link) in get_shm_cache_entry()
784 if (ce->user == user) in get_shm_cache_entry()
785 return ce; in get_shm_cache_entry()
787 ce = calloc(1, sizeof(*ce)); in get_shm_cache_entry()
788 if (ce) { in get_shm_cache_entry()
789 ce->user = user; in get_shm_cache_entry()
790 SLIST_INSERT_HEAD(cache, ce, link); in get_shm_cache_entry()
793 return ce; in get_shm_cache_entry()
800 struct thread_shm_cache_entry *ce = NULL; in thread_rpc_shm_cache_alloc() local
808 ce = get_shm_cache_entry(user); in thread_rpc_shm_cache_alloc()
809 if (!ce) in thread_rpc_shm_cache_alloc()
818 if (ce->type != shm_type || sz > ce->size) { in thread_rpc_shm_cache_alloc()
819 clear_shm_cache_entry(ce); in thread_rpc_shm_cache_alloc()
821 ce->mobj = alloc_shm(shm_type, sz); in thread_rpc_shm_cache_alloc()
822 if (!ce->mobj) in thread_rpc_shm_cache_alloc()
825 if (mobj_get_pa(ce->mobj, 0, 0, &p)) in thread_rpc_shm_cache_alloc()
831 va = mobj_get_va(ce->mobj, 0, sz); in thread_rpc_shm_cache_alloc()
835 ce->size = sz; in thread_rpc_shm_cache_alloc()
836 ce->type = shm_type; in thread_rpc_shm_cache_alloc()
838 va = mobj_get_va(ce->mobj, 0, sz); in thread_rpc_shm_cache_alloc()
842 *mobj = ce->mobj; in thread_rpc_shm_cache_alloc()
846 clear_shm_cache_entry(ce); in thread_rpc_shm_cache_alloc()
853 struct thread_shm_cache_entry *ce = SLIST_FIRST(cache); in thread_rpc_shm_cache_clear() local
855 if (!ce) in thread_rpc_shm_cache_clear()
858 clear_shm_cache_entry(ce); in thread_rpc_shm_cache_clear()
859 free(ce); in thread_rpc_shm_cache_clear()