FreeBSD/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
/*
 * Create and initialize a new nv_alloc_t for a fixed buffer, buf.  A pointer
 * to the newly allocated nv_alloc_t structure is returned upon success or NULL
 * is returned to indicate that the nv_alloc structure could not be created.
 */
Create and initialize a new nv_alloc_t for a fixed buffer, buf.  A pointer
to the newly allocated nv_alloc_t structure is returned upon success or NULL
is returned to indicate that the nv_alloc structure could not be created.
Create and initialize a new nv_alloc_t for a fixed buffer buf . A pointer to the newly allocated nv_alloc_t structure is returned upon success or NULL is returned to indicate that the nv_alloc structure could not be created .
nv_alloc_t *
fm_nva_xcreate(char *buf, size_t bufsz)
{
	nv_alloc_t *nvhdl = kmem_zalloc(sizeof (nv_alloc_t), KM_SLEEP);
	if (bufsz == 0 || nv_alloc_init(nvhdl, nv_fixed_ops, buf, bufsz) != 0) {
		kmem_free(nvhdl, sizeof (nv_alloc_t));
		return (NULL);
	}
	return (nvhdl);
}
nv_alloc_t * fm_nva_xcreate ( char * buf , size_t bufsz ) { nv_alloc_t * nvhdl = kmem_zalloc ( sizeof ( nv_alloc_t ) , KM_SLEEP ) ; if ( bufsz == 0 || nv_alloc_init ( nvhdl , nv_fixed_ops , buf , bufsz ) != 0 ) { kmem_free ( nvhdl , sizeof ( nv_alloc_t ) ) ; return ( NULL ) ; } return ( nvhdl ) ; }
Create and initialize a new nv_alloc_t for a fixed buffer, buf.
Create and initialize a new nv_alloc_t for a fixed buffer buf .