Home | History | Annotate | Line # | Download | only in libnvpair
      1  1.1  haad /*
      2  1.1  haad  * CDDL HEADER START
      3  1.1  haad  *
      4  1.1  haad  * The contents of this file are subject to the terms of the
      5  1.1  haad  * Common Development and Distribution License, Version 1.0 only
      6  1.1  haad  * (the "License").  You may not use this file except in compliance
      7  1.1  haad  * with the License.
      8  1.1  haad  *
      9  1.1  haad  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10  1.1  haad  * or http://www.opensolaris.org/os/licensing.
     11  1.1  haad  * See the License for the specific language governing permissions
     12  1.1  haad  * and limitations under the License.
     13  1.1  haad  *
     14  1.1  haad  * When distributing Covered Code, include this CDDL HEADER in each
     15  1.1  haad  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16  1.1  haad  * If applicable, add the following below this CDDL HEADER, with the
     17  1.1  haad  * fields enclosed by brackets "[]" replaced with your own identifying
     18  1.1  haad  * information: Portions Copyright [yyyy] [name of copyright owner]
     19  1.1  haad  *
     20  1.1  haad  * CDDL HEADER END
     21  1.1  haad  */
     22  1.1  haad /*
     23  1.1  haad  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
     24  1.1  haad  * Use is subject to license terms.
     25  1.1  haad  */
     26  1.1  haad 
     27  1.1  haad #pragma ident	"%Z%%M%	%I%	%E% SMI"
     28  1.1  haad 
     29  1.1  haad #include <sys/nvpair.h>
     30  1.1  haad #include <stdlib.h>
     31  1.1  haad 
     32  1.1  haad /*ARGSUSED*/
     33  1.1  haad static void *
     34  1.1  haad nv_alloc_sys(nv_alloc_t *nva, size_t size)
     35  1.1  haad {
     36  1.1  haad 	return (malloc(size));
     37  1.1  haad }
     38  1.1  haad 
     39  1.1  haad /*ARGSUSED*/
     40  1.1  haad static void
     41  1.1  haad nv_free_sys(nv_alloc_t *nva, void *buf, size_t size)
     42  1.1  haad {
     43  1.1  haad 	free(buf);
     44  1.1  haad }
     45  1.1  haad 
     46  1.1  haad const nv_alloc_ops_t system_ops_def = {
     47  1.1  haad 	NULL,			/* nv_ao_init() */
     48  1.1  haad 	NULL,			/* nv_ao_fini() */
     49  1.1  haad 	nv_alloc_sys,		/* nv_ao_alloc() */
     50  1.1  haad 	nv_free_sys,		/* nv_ao_free() */
     51  1.1  haad 	NULL			/* nv_ao_reset() */
     52  1.1  haad };
     53  1.1  haad 
     54  1.1  haad nv_alloc_t nv_alloc_nosleep_def = {
     55  1.1  haad 	&system_ops_def,
     56  1.1  haad 	NULL
     57  1.1  haad };
     58  1.1  haad 
     59  1.1  haad nv_alloc_t *nv_alloc_nosleep = &nv_alloc_nosleep_def;
     60