Lines Matching refs:pcp
187 static int pshm_cache_add(struct pshminfo *pshmp, struct pshmname *pnp, struct pshmcache *pcp);
188 static void pshm_cache_delete(struct pshmcache *pcp);
234 struct pshmcache *pcp, *nnp;
243 for (pcp = pcpp->lh_first; pcp != 0; pcp = nnp) {
244 nnp = pcp->pshm_hash.le_next;
245 if (pcp->pshm_nlen == pnp->pshm_namelen &&
246 !bcmp(pcp->pshm_name, pnp->pshm_nameptr, (u_int)pcp-> pshm_nlen))
250 if (pcp == 0) {
256 if (pcp->pshminfo) {
259 *pshmp = pcp->pshminfo;
260 *pcache = pcp;
262 pcp->pshminfo->pshm_usecount++;
279 pshm_cache_add(struct pshminfo *pshmp, struct pshmname *pnp, struct pshmcache *pcp)
303 pcp->pshminfo = pshmp;
304 pcp->pshm_nlen = pnp->pshm_namelen;
305 bcopy(pnp->pshm_nameptr, pcp->pshm_name, (unsigned)pcp->pshm_nlen);
312 if (p == pcp)
316 LIST_INSERT_HEAD(pcpp, pcp, pshm_hash);
341 struct pshmcache *pcp;
345 while ( (pcp = pcpp->lh_first) )
346 pshm_cache_delete(pcp);
352 pshm_cache_delete(struct pshmcache *pcp)
355 if (pcp->pshm_hash.le_prev == 0)
357 if (pcp->pshm_hash.le_next == pcp)
360 LIST_REMOVE(pcp, pshm_hash);
361 pcp->pshm_hash.le_prev = 0;
384 struct pshmcache *pcp = NULL;
456 MALLOC(pcp, struct pshmcache *, sizeof(struct pshmcache), M_SHM, M_WAITOK|M_ZERO);
457 if (pcp == NULL) {
577 /* if successful, this will consume the pcp */
578 if ( (error = pshm_cache_add(pinfo, &nd, pcp)) ) {
593 * if incache, we did not use the new pcp or new_pinfo and must
597 FREE(pcp, M_SHM);
635 if (pcp != NULL)
636 FREE(pcp, M_SHM);