Lines Matching refs:mp

81 #define	MBLK_BAND_FLAG_WORD(mp)	(*((uint32_t *)&(mp)->b_band))  argument
100 static void dblk_lastfree(mblk_t *mp, dblk_t *dbp);
105 static void bcache_dblk_lastfree(mblk_t *mp, dblk_t *dbp);
300 mblk_t *mp; in allocb() local
307 mp = allocb_oversize(size, KM_NOSLEEP); in allocb()
314 mp = NULL; in allocb()
318 mp = dbp->db_mblk; in allocb()
320 mp->b_next = mp->b_prev = mp->b_cont = NULL; in allocb()
321 mp->b_rptr = mp->b_wptr = dbp->db_base; in allocb()
322 mp->b_queue = NULL; in allocb()
323 MBLK_BAND_FLAG_WORD(mp) = 0; in allocb()
326 FTRACE_1("allocb(): mp=0x%p", (uintptr_t)mp); in allocb()
328 return (mp); in allocb()
338 mblk_t *mp = allocb(size, 0); in allocb_tmpl() local
340 if (mp != NULL) { in allocb_tmpl()
342 dblk_t *dst = mp->b_datap; in allocb_tmpl()
352 return (mp); in allocb_tmpl()
358 mblk_t *mp = allocb(size, 0); in allocb_cred() local
361 if (mp != NULL) { in allocb_cred()
362 dblk_t *dbp = mp->b_datap; in allocb_cred()
367 return (mp); in allocb_cred()
373 mblk_t *mp = allocb_wait(size, 0, flags, error); in allocb_cred_wait() local
376 if (mp != NULL) { in allocb_cred_wait()
377 dblk_t *dbp = mp->b_datap; in allocb_cred_wait()
383 return (mp); in allocb_cred_wait()
393 msg_getcred(const mblk_t *mp, pid_t *cpidp) in msg_getcred() argument
397 while (mp != NULL) { in msg_getcred()
398 dblk_t *dbp = mp->b_datap; in msg_getcred()
402 mp = mp->b_cont; in msg_getcred()
428 msg_extractcred(mblk_t *mp, pid_t *cpidp) in msg_extractcred() argument
432 while (mp != NULL) { in msg_extractcred()
433 dblk_t *dbp = mp->b_datap; in msg_extractcred()
437 mp = mp->b_cont; in msg_extractcred()
454 freeb(mblk_t *mp) in freeb() argument
456 dblk_t *dbp = mp->b_datap; in freeb()
459 ASSERT(mp->b_next == NULL && mp->b_prev == NULL); in freeb()
460 FTRACE_1("freeb(): mp=0x%lx", (uintptr_t)mp); in freeb()
462 STR_FTEVENT_MBLK(mp, caller(), FTEV_FREEB, dbp->db_ref); in freeb()
464 dbp->db_free(mp, dbp); in freeb()
468 freemsg(mblk_t *mp) in freemsg() argument
470 FTRACE_1("freemsg(): mp=0x%lx", (uintptr_t)mp); in freemsg()
471 while (mp) { in freemsg()
472 dblk_t *dbp = mp->b_datap; in freemsg()
473 mblk_t *mp_cont = mp->b_cont; in freemsg()
476 ASSERT(mp->b_next == NULL && mp->b_prev == NULL); in freemsg()
478 STR_FTEVENT_MBLK(mp, caller(), FTEV_FREEB, dbp->db_ref); in freemsg()
480 dbp->db_free(mp, dbp); in freemsg()
481 mp = mp_cont; in freemsg()
493 reallocb(mblk_t *mp, size_t size, uint_t copy) in reallocb() argument
499 if (mp == NULL) in reallocb()
502 cur_size = mp->b_wptr - mp->b_rptr; in reallocb()
503 old_rptr = mp->b_rptr; in reallocb()
505 ASSERT(mp->b_datap->db_ref != 0); in reallocb()
507 if (mp->b_datap->db_ref == 1 && MBLKSIZE(mp) >= size) { in reallocb()
512 if (copy && mp->b_datap->db_lim - mp->b_rptr >= size) in reallocb()
513 return (mp); in reallocb()
515 mp->b_wptr = mp->b_rptr = mp->b_datap->db_base; in reallocb()
516 mp1 = mp; in reallocb()
517 } else if ((mp1 = allocb_tmpl(size, mp)) != NULL) { in reallocb()
519 mp1->b_cont = mp->b_cont; in reallocb()
529 if (mp != mp1) in reallocb()
530 freeb(mp); in reallocb()
536 dblk_lastfree(mblk_t *mp, dblk_t *dbp) in dblk_lastfree() argument
538 ASSERT(dbp->db_mblk == mp); in dblk_lastfree()
560 dblk_decref(mblk_t *mp, dblk_t *dbp) in dblk_decref() argument
575 kmem_cache_free(mblk_cache, mp); in dblk_decref()
579 dbp->db_mblk = mp; in dblk_decref()
581 dbp->db_lastfree(mp, dbp); in dblk_decref()
585 dupb(mblk_t *mp) in dupb() argument
587 dblk_t *dbp = mp->b_datap; in dupb()
595 new_mp->b_rptr = mp->b_rptr; in dupb()
596 new_mp->b_wptr = mp->b_wptr; in dupb()
599 MBLK_BAND_FLAG_WORD(new_mp) = MBLK_BAND_FLAG_WORD(mp); in dupb()
601 STR_FTEVENT_MBLK(mp, caller(), FTEV_DUPB, dbp->db_ref); in dupb()
639 mblk_t *mp; in gesballoc() local
644 mp = NULL; in gesballoc()
648 mp = dbp->db_mblk; in gesballoc()
654 mp->b_next = mp->b_prev = mp->b_cont = NULL; in gesballoc()
655 mp->b_rptr = mp->b_wptr = base; in gesballoc()
656 mp->b_queue = NULL; in gesballoc()
657 MBLK_BAND_FLAG_WORD(mp) = 0; in gesballoc()
660 FTRACE_1("gesballoc(): mp=0x%lx", (uintptr_t)mp); in gesballoc()
661 return (mp); in gesballoc()
665 bcache_dblk_lastfree(mblk_t *mp, dblk_t *dbp) in bcache_dblk_lastfree() argument
669 ASSERT(dbp->db_mblk == mp); in bcache_dblk_lastfree()
749 mblk_t *mp = NULL; in bcache_allocb() local
768 mp = dbp->db_mblk; in bcache_allocb()
770 mp->b_next = mp->b_prev = mp->b_cont = NULL; in bcache_allocb()
771 mp->b_rptr = mp->b_wptr = dbp->db_base; in bcache_allocb()
772 mp->b_queue = NULL; in bcache_allocb()
773 MBLK_BAND_FLAG_WORD(mp) = 0; in bcache_allocb()
776 FTRACE_1("bcache_allocb(): mp=0x%p", (uintptr_t)mp); in bcache_allocb()
778 return (mp); in bcache_allocb()
782 dblk_lastfree_oversize(mblk_t *mp, dblk_t *dbp) in dblk_lastfree_oversize() argument
784 ASSERT(dbp->db_mblk == mp); in dblk_lastfree_oversize()
804 mblk_t *mp; in allocb_oversize() local
810 if ((mp = gesballoc(buf, size, DBLK_RTFU(1, M_DATA, 0, 0), in allocb_oversize()
814 if (mp != NULL) in allocb_oversize()
815 STR_FTALLOC(&DB_FTHDR(mp), FTEV_ALLOCBIG, size); in allocb_oversize()
817 return (mp); in allocb_oversize()
845 mblk_t *mp; in allocb_wait() local
853 mp = allocb_oversize(size, KM_SLEEP); in allocb_wait()
855 (uintptr_t)mp); in allocb_wait()
856 return (mp); in allocb_wait()
862 mp = dbp->db_mblk; in allocb_wait()
864 mp->b_next = mp->b_prev = mp->b_cont = NULL; in allocb_wait()
865 mp->b_rptr = mp->b_wptr = dbp->db_base; in allocb_wait()
866 mp->b_queue = NULL; in allocb_wait()
867 MBLK_BAND_FLAG_WORD(mp) = 0; in allocb_wait()
868 STR_FTALLOC(&DB_FTHDR(mp), FTEV_ALLOCBW, size); in allocb_wait()
870 FTRACE_1("allocb_wait (NOSIG): mp=0x%lx", (uintptr_t)mp); in allocb_wait()
873 while ((mp = allocb(size, pri)) == NULL) { in allocb_wait()
879 return (mp); in allocb_wait()
901 mblk_t *mp; in mkiocb() local
906 if ((mp = allocb(sizeof (union ioctypes), BPRI_MED)) == NULL) in mkiocb()
909 bzero(mp->b_rptr, sizeof (union ioctypes)); in mkiocb()
914 mp->b_wptr += sizeof (struct iocblk); in mkiocb()
915 mp->b_datap->db_type = M_IOCTL; in mkiocb()
920 ioc = (struct iocblk *)mp->b_rptr; in mkiocb()
925 return (mp); in mkiocb()
1066 linkb(mblk_t *mp, mblk_t *bp) in linkb() argument
1068 ASSERT(mp && bp); in linkb()
1070 for (; mp->b_cont; mp = mp->b_cont) in linkb()
1072 mp->b_cont = bp; in linkb()
1097 rmvb(mblk_t *mp, mblk_t *bp) in rmvb() argument
1102 ASSERT(mp && bp); in rmvb()
1103 for (tmp = mp; tmp; tmp = tmp->b_cont) { in rmvb()
1108 mp = tmp->b_cont; in rmvb()
1110 return (mp); in rmvb()
1124 pullupmsg(mblk_t *mp, ssize_t len) in pullupmsg() argument
1130 ASSERT(mp->b_datap->db_ref > 0); in pullupmsg()
1131 ASSERT(mp->b_next == NULL && mp->b_prev == NULL); in pullupmsg()
1138 ASSERT(mp->b_datap->db_type != M_MULTIDATA); in pullupmsg()
1139 if (mp->b_datap->db_type == M_MULTIDATA) in pullupmsg()
1143 if (mp->b_cont == NULL && str_aligned(mp->b_rptr)) in pullupmsg()
1145 len = xmsgsize(mp); in pullupmsg()
1147 ssize_t first_mblk_len = mp->b_wptr - mp->b_rptr; in pullupmsg()
1155 if (str_aligned(mp->b_rptr)) in pullupmsg()
1158 } else if (xmsgsize(mp) < len) in pullupmsg()
1162 if ((bp = allocb_tmpl(len, mp)) == NULL) in pullupmsg()
1166 *bp = *mp; /* swap mblks so bp heads the old msg... */ in pullupmsg()
1167 mp->b_datap = dbp; /* ... and mp heads the new message */ in pullupmsg()
1168 mp->b_datap->db_mblk = mp; in pullupmsg()
1170 mp->b_rptr = mp->b_wptr = dbp->db_base; in pullupmsg()
1178 bcopy(bp->b_rptr, mp->b_wptr, (size_t)n); in pullupmsg()
1179 mp->b_wptr += n; in pullupmsg()
1189 mp->b_cont = bp; /* tack on whatever wasn't pulled up */ in pullupmsg()
1201 msgpullup(mblk_t *mp, ssize_t len) in msgpullup() argument
1212 ASSERT(mp->b_datap->db_type != M_MULTIDATA); in msgpullup()
1213 if (mp->b_datap->db_type == M_MULTIDATA) in msgpullup()
1216 totlen = xmsgsize(mp); in msgpullup()
1228 if ((newmp = allocb_tmpl(len, mp)) == NULL) in msgpullup()
1231 newmp->b_flag = mp->b_flag; in msgpullup()
1232 newmp->b_band = mp->b_band; in msgpullup()
1235 n = mp->b_wptr - mp->b_rptr; in msgpullup()
1238 bcopy(mp->b_rptr, newmp->b_wptr, n); in msgpullup()
1241 mp = mp->b_cont; in msgpullup()
1244 if (mp != NULL) { in msgpullup()
1245 newmp->b_cont = dupmsg(mp); in msgpullup()
1262 adjmsg(mblk_t *mp, ssize_t len) in adjmsg() argument
1273 ASSERT(mp != NULL); in adjmsg()
1279 ASSERT(mp->b_datap->db_type != M_MULTIDATA); in adjmsg()
1280 if (mp->b_datap->db_type == M_MULTIDATA) in adjmsg()
1290 if (xmsgsize(mp) < len) in adjmsg()
1296 ASSERT(mp->b_wptr >= mp->b_rptr); in adjmsg()
1297 n = MIN(mp->b_wptr - mp->b_rptr, len); in adjmsg()
1298 mp->b_rptr += n; in adjmsg()
1305 if (!first && (mp->b_wptr == mp->b_rptr)) { in adjmsg()
1306 bcont = mp->b_cont; in adjmsg()
1307 freeb(mp); in adjmsg()
1308 mp = save_bp->b_cont = bcont; in adjmsg()
1310 save_bp = mp; in adjmsg()
1311 mp = mp->b_cont; in adjmsg()
1316 type = mp->b_datap->db_type; in adjmsg()
1318 bp = mp; in adjmsg()
1342 if ((save_bp != mp) && in adjmsg()