Lines Matching refs:hsvcp

52 #define	HSVC_CHK_REFCNT(hsvcp)	\
53 if (hsvc_debug & DBG_HSVC_REFCNT) hsvc_chk_refcnt(hsvcp)
63 #define HSVC_CHK_REFCNT(hsvcp)
139 hsvc_t *hsvcp;
142 for (hsvcp = hsvc_groups; hsvcp != NULL; hsvcp = hsvcp->next) {
143 for (p = hsvcp->clients; p != NULL;
151 return (hsvcp);
160 hsvc_chk_refcnt(hsvc_t *hsvcp)
165 for (refcnt = 0, p = hsvcp->clients; p != NULL;
169 ASSERT(hsvcp->refcnt == refcnt);
178 hsvc_t *hsvcp;
186 for (hsvcp = hsvc_groups; hsvcp != NULL; hsvcp = hsvcp->next) {
187 prom_printf(" hsvcp: %p (0x%lx 0x%lx 0x%lx) ref: %ld clients: "
188 "%p\n", (void *)hsvcp, hsvcp->group, hsvcp->major,
189 hsvcp->minor, hsvcp->refcnt, (void *)hsvcp->clients);
191 for (p = hsvcp->clients; p != NULL;
213 hsvc_t *hsvcp;
218 hsvcp = hsvc_avail;
219 hsvc_avail = hsvcp->next;
221 hsvcp = kmem_zalloc(sizeof (hsvc_t), KM_SLEEP);
223 ("hsvc_alloc: hsvc_avail: %p kmem_zalloc hsvcp: %p\n",
224 (void *)hsvc_avail, (void *)hsvcp));
226 hsvcp = NULL;
227 return (hsvcp);
231 hsvc_free(hsvc_t *hsvcp)
233 ASSERT(hsvcp != NULL);
236 if (hsvcp >= hsvc_resv_bufs &&
237 hsvcp < &hsvc_resv_bufs[HSVC_RESV_BUFS_MAX]) {
238 hsvcp->next = hsvc_avail;
239 hsvc_avail = hsvcp;
242 ("hsvc_free: hsvc_avail: %p kmem_free hsvcp: %p\n",
243 (void *)hsvc_avail, (void *)hsvcp));
244 (void) kmem_free(hsvcp, sizeof (hsvc_t));
253 hsvc_link_client(hsvc_t *hsvcp, hsvc_info_t *hsvcinfop)
256 HSVC_CHK_REFCNT(hsvcp);
258 hsvcinfop->hsvc_private = hsvcp->clients;
259 hsvcp->clients = hsvcinfop;
260 hsvcp->refcnt++;
270 hsvc_unlink_client(hsvc_t *hsvcp, hsvc_info_t *hsvcinfop)
276 HSVC_CHK_REFCNT(hsvcp);
278 for (pp = &hsvcp->clients; (p = *pp) != NULL;
283 ASSERT(hsvcp->refcnt > 0);
284 hsvcp->refcnt--;
302 hsvc_t *hsvcp;
328 for (hsvcp = hsvc_groups; hsvcp != NULL; hsvcp = hsvcp->next)
329 if (hsvcp->group == api_group)
332 if (hsvcp) {
341 if (hsvcp->major != major) {
343 } else if (hsvcp->minor > minor) {
349 *supported_minor = hsvcp->minor;
356 *supported_minor = hsvcp->minor;
357 hsvc_link_client(hsvcp, hsvcinfop);
389 hsvcp = hsvc_alloc();
390 if (hsvcp == NULL) {
434 hsvcp->group = api_group;
435 hsvcp->major = major;
436 hsvcp->minor = *supported_minor;
437 hsvcp->refcnt = 0;
438 hsvcp->clients = NULL;
439 hsvcp->next = hsvc_groups;
440 hsvc_groups = hsvcp;
445 hsvc_link_client(hsvcp, hsvcinfop);
467 hsvc_free(hsvcp);
484 hsvc_t **hsvcpp, *hsvcp;
507 for (hsvcpp = &hsvc_groups; (hsvcp = *hsvcpp) != NULL;
508 hsvcpp = &hsvcp->next) {
509 if (hsvcp->group != api_group || hsvcp->major != major)
516 if (hsvc_unlink_client(hsvcp, hsvcinfop) < 0) {
527 if (hsvcp->refcnt == 0) {
530 ASSERT(hsvcp->clients == NULL);
545 *hsvcpp = hsvcp->next;
546 hsvc_free(hsvcp);
551 if (hsvcp == NULL)
571 hsvc_t *hsvcp;
580 for (hsvcp = hsvc_groups; hsvcp != NULL; hsvcp = hsvcp->next)
581 if (hsvcp->group == api_group)
584 if (hsvcp) {
585 *majorp = hsvcp->major;
586 *minorp = hsvcp->minor;
628 hsvc_t *hsvcp;
641 for (i = 0, hsvcp = &hsvc_resv_bufs[0];
642 i < HSVC_RESV_BUFS_MAX; i++, hsvcp++)
643 hsvc_free(hsvcp);