xref: /illumos-gate/usr/src/uts/common/os/smb_subr.c (revision d1580181)
184ab085aSmws /*
284ab085aSmws  * CDDL HEADER START
384ab085aSmws  *
484ab085aSmws  * The contents of this file are subject to the terms of the
584ab085aSmws  * Common Development and Distribution License, Version 1.0 only
684ab085aSmws  * (the "License").  You may not use this file except in compliance
784ab085aSmws  * with the License.
884ab085aSmws  *
984ab085aSmws  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1084ab085aSmws  * or http://www.opensolaris.org/os/licensing.
1184ab085aSmws  * See the License for the specific language governing permissions
1284ab085aSmws  * and limitations under the License.
1384ab085aSmws  *
1484ab085aSmws  * When distributing Covered Code, include this CDDL HEADER in each
1584ab085aSmws  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1684ab085aSmws  * If applicable, add the following below this CDDL HEADER, with the
1784ab085aSmws  * fields enclosed by brackets "[]" replaced with your own identifying
1884ab085aSmws  * information: Portions Copyright [yyyy] [name of copyright owner]
1984ab085aSmws  *
2084ab085aSmws  * CDDL HEADER END
2184ab085aSmws  */
2284ab085aSmws 
2384ab085aSmws /*
2484ab085aSmws  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
2584ab085aSmws  * Use is subject to license terms.
2684ab085aSmws  */
2784ab085aSmws 
28*d1580181SBryan Cantrill /*
29*d1580181SBryan Cantrill  * Copyright (c) 2015 Joyent, Inc.  All rights reserved.
30*d1580181SBryan Cantrill  */
3184ab085aSmws 
3284ab085aSmws #include <sys/smbios_impl.h>
3384ab085aSmws #include <sys/cmn_err.h>
3484ab085aSmws #include <sys/varargs.h>
3584ab085aSmws #include <sys/systm.h>
3684ab085aSmws #include <sys/kmem.h>
3784ab085aSmws 
3884ab085aSmws /*ARGSUSED*/
3984ab085aSmws const char *
smb_strerror(int err)4084ab085aSmws smb_strerror(int err)
4184ab085aSmws {
4284ab085aSmws 	return (NULL);
4384ab085aSmws }
4484ab085aSmws 
4584ab085aSmws void *
smb_alloc(size_t len)4684ab085aSmws smb_alloc(size_t len)
4784ab085aSmws {
48*d1580181SBryan Cantrill 	return (len > 0 ? kmem_alloc(len, KM_SLEEP) : NULL);
4984ab085aSmws }
5084ab085aSmws 
5184ab085aSmws void *
smb_zalloc(size_t len)5284ab085aSmws smb_zalloc(size_t len)
5384ab085aSmws {
54*d1580181SBryan Cantrill 	return (len > 0 ? kmem_zalloc(len, KM_SLEEP) : NULL);
5584ab085aSmws }
5684ab085aSmws 
5784ab085aSmws void
smb_free(void * buf,size_t len)5884ab085aSmws smb_free(void *buf, size_t len)
5984ab085aSmws {
6084ab085aSmws 	kmem_free(buf, len);
6184ab085aSmws }
6284ab085aSmws 
6384ab085aSmws /*PRINTFLIKE2*/
6484ab085aSmws void
smb_dprintf(smbios_hdl_t * shp,const char * format,...)6584ab085aSmws smb_dprintf(smbios_hdl_t *shp, const char *format, ...)
6684ab085aSmws {
6784ab085aSmws 	va_list ap;
6884ab085aSmws 
6984ab085aSmws 	if (!(shp->sh_flags & SMB_FL_DEBUG))
7084ab085aSmws 		return;
7184ab085aSmws 
7284ab085aSmws 	va_start(ap, format);
7384ab085aSmws 	vcmn_err(CE_CONT, format, ap);
7484ab085aSmws 	va_end(ap);
7584ab085aSmws }
76