FreeBSD/sys/dev/netmap/netmap_pipe.c
/* allocate the pipe array in the parent adapter */
allocate the pipe array in the parent adapter
allocate the pipe array in the parent adapter
static int
nm_pipe_alloc(struct netmap_adapter *na, u_int npipes)
{
	size_t len;
	struct netmap_pipe_adapter **npa;
	if (npipes <= na->na_max_pipes)
		return 0;
	if (npipes < na->na_next_pipe || npipes > NM_MAXPIPES)
		return EINVAL;
        len = sizeof(struct netmap_pipe_adapter *) * npipes;
	npa = realloc(na->na_pipes, len, M_DEVBUF, M_NOWAIT | M_ZERO);
	if (npa == NULL)
		return ENOMEM;
	na->na_pipes = npa;
	na->na_max_pipes = npipes;
	return 0;
}
static int nm_pipe_alloc ( struct netmap_adapter * na , u_int npipes ) { size_t len ; struct netmap_pipe_adapter * * npa ; if ( npipes <= na -> na_max_pipes ) return 0 ; if ( npipes < na -> na_next_pipe || npipes > NM_MAXPIPES ) return EINVAL ; len = sizeof ( struct netmap_pipe_adapter * ) * npipes ; npa = realloc ( na -> na_pipes , len , M_DEVBUF , M_NOWAIT | M_ZERO ) ; if ( npa == NULL ) return ENOMEM ; na -> na_pipes = npa ; na -> na_max_pipes = npipes ; return 0 ; }
allocate the pipe array in the parent adapter
allocate the pipe array in the parent adapter
/* we already have more entries that requested */