#include <sys/types.h>
#include <sys/param.h>
#include <sys/atomic.h>
#include <sys/stream.h>
#include <sys/strsubr.h>
#include <sys/cmn_err.h>
#include <sys/strft.h>
int str_ftnever = 0;
static void mblk_free(mblk_t *);
static void esballoc_mblk_free(mblk_t *);
int
strwaitbuf(size_t size, int pri)
{
return (0);
}
size_t
xmsgsize(mblk_t *bp)
{
unsigned char type;
size_t count = 0;
type = bp->b_datap->db_type;
for (; bp; bp = bp->b_cont) {
if (type != bp->b_datap->db_type)
break;
ASSERT(bp->b_wptr >= bp->b_rptr);
count += bp->b_wptr - bp->b_rptr;
}
return (count);
}
bufcall_id_t
bufcall(size_t size, uint_t pri, void (*func)(void *), void *arg)
{
cmn_err(CE_NOTE, "bufcall() called!");
return ("fake bufcall id");
}
void
unbufcall(bufcall_id_t id)
{
}
void
freebs_enqueue(mblk_t *mp, dblk_t *dbp)
{
esballoc_mblk_free(mp);
}
static void
esballoc_mblk_free(mblk_t *mp)
{
mblk_t *nextmp;
for (; mp != NULL; mp = nextmp) {
nextmp = mp->b_next;
mp->b_next = NULL;
mblk_free(mp);
}
}
static void
mblk_free(mblk_t *mp)
{
dblk_t *dbp = mp->b_datap;
frtn_t *frp = dbp->db_frtnp;
mp->b_next = NULL;
if (dbp->db_fthdr != NULL)
str_ftfree(dbp);
ASSERT(dbp->db_fthdr == NULL);
frp->free_func(frp->free_arg);
ASSERT(dbp->db_mblk == mp);
if (dbp->db_credp != NULL) {
crfree(dbp->db_credp);
dbp->db_credp = NULL;
}
dbp->db_cpid = -1;
dbp->db_struioflag = 0;
dbp->db_struioun.cksum.flags = 0;
kmem_cache_free(dbp->db_cache, dbp);
}
static volatile uint32_t ioc_id;
int
getiocseqno(void)
{
uint32_t i;
i = atomic_inc_32_nv(&ioc_id);
return ((int)i);
}