lib/libvarnishapi/vsl_dispatch.c
static void
chunk_shm_to_buf(struct VSLQ *vslq, struct chunk *chunk)
{
	struct vtx *vtx;
	struct chunk *buf;

	CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC);
	assert(chunk->type == chunk_t_shm);
	vtx = chunk->vtx;
	CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC);

	buf = VTAILQ_PREV(chunk, chunkhead, list);
	if (buf != NULL && buf->type == chunk_t_buf)
		/* Previous is a buf chunk, append to it */
		chunk_appendbuf(buf, chunk->shm.start.ptr, chunk->len);
	else {
		/* Create a new buf chunk and insert it before this */
		buf = chunk_newbuf(vtx, chunk->shm.start.ptr, chunk->len);
		AN(buf);
		VTAILQ_INSERT_BEFORE(chunk, buf, list);
	}

	/* Reset cursor chunk pointer, vslc_vtx_next will set it correctly */
	vtx->c.chunk = NULL;

	/* Remove from the shmref list and vtx, and put chunk back
	   on the free list */
	VTAILQ_REMOVE(&vslq->shmrefs, chunk, shm.shmref);
	VTAILQ_REMOVE(&vtx->chunks, chunk, list);
	VTAILQ_INSERT_HEAD(&vtx->shmchunks_free, chunk, list);
}
/* Transform a shm chunk to a buf chunk */
Transform a shm chunk to a buf chunk
Transform a shm chunk to a buf chunk
static void
chunk_shm_to_buf(struct VSLQ *vslq, struct chunk *chunk)
{
	struct vtx *vtx;
	struct chunk *buf;
	CHECK_OBJ_NOTNULL(chunk, CHUNK_MAGIC);
	assert(chunk->type == chunk_t_shm);
	vtx = chunk->vtx;
	CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC);
	buf = VTAILQ_PREV(chunk, chunkhead, list);
	if (buf != NULL && buf->type == chunk_t_buf)
		chunk_appendbuf(buf, chunk->shm.start.ptr, chunk->len);
	else {
		buf = chunk_newbuf(vtx, chunk->shm.start.ptr, chunk->len);
		AN(buf);
		VTAILQ_INSERT_BEFORE(chunk, buf, list);
	}
	vtx->c.chunk = NULL;
	VTAILQ_REMOVE(&vslq->shmrefs, chunk, shm.shmref);
	VTAILQ_REMOVE(&vtx->chunks, chunk, list);
	VTAILQ_INSERT_HEAD(&vtx->shmchunks_free, chunk, list);
}
static void chunk_shm_to_buf ( struct VSLQ * vslq , struct chunk * chunk ) { struct vtx * vtx ; struct chunk * buf ; CHECK_OBJ_NOTNULL ( chunk , CHUNK_MAGIC ) ; assert ( chunk -> type == chunk_t_shm ) ; vtx = chunk -> vtx ; CHECK_OBJ_NOTNULL ( vtx , VTX_MAGIC ) ; buf = VTAILQ_PREV ( chunk , chunkhead , list ) ; if ( buf != NULL && buf -> type == chunk_t_buf ) chunk_appendbuf ( buf , chunk -> shm . start . ptr , chunk -> len ) ; else { buf = chunk_newbuf ( vtx , chunk -> shm . start . ptr , chunk -> len ) ; AN ( buf ) ; VTAILQ_INSERT_BEFORE ( chunk , buf , list ) ; } vtx -> c . chunk = NULL ; VTAILQ_REMOVE ( & vslq -> shmrefs , chunk , shm . shmref ) ; VTAILQ_REMOVE ( & vtx -> chunks , chunk , list ) ; VTAILQ_INSERT_HEAD ( & vtx -> shmchunks_free , chunk , list ) ; }
Transform a shm chunk to a buf chunk
Transform a shm chunk to a buf chunk
/* Previous is a buf chunk, append to it */ /* Create a new buf chunk and insert it before this */ /* Reset cursor chunk pointer, vslc_vtx_next will set it correctly */ /* Remove from the shmref list and vtx, and put chunk back
	   on the free list */