smb_open.c revision 516627f338a630bcf9806a91aa873bbbae9a2fac
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2015 Joyent, Inc.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/smbios_impl.h>
int _smb_debug = 0; /* default debug mode */
/*
* Strip out identification information for you privacy weenies. This is quite
* simple using our smbios_info_common() abstraction: we just locate any serial
* numbers and asset tags for each record, and then zero out those strings.
* Then we must handle two special cases: SMB_TYPE_SYSTEM holds a 16-byte UUID
* and SMB_TYPE_BATTERY stores a Smart Battery Data Spec 16-bit serial number.
* We use a literal '0' rather than '\0' for zeroing strings because \0\0 in
* the SMBIOS string table has a special meaning (denotes end-of-record).
*/
static void
{
uint_t i;
for (i = 0; i < shp->sh_nstructs; i++) {
char *p;
}
bp->smbbat_ssn = 0;
}
*p = '0';
*p = '0';
}
}
}
{
const uchar_t *p, *q, *s;
uint_t i, h;
switch (version) {
case SMB_VERSION_23:
case SMB_VERSION_24:
case SMB_VERSION_25:
case SMB_VERSION_26:
case SMB_VERSION_27:
case SMB_VERSION_28:
case SMB_VERSION_30:
break;
default:
}
if (_smb_debug)
if (!(flags & SMB_O_NOVERS)) {
}
if (len < sizeof (smb_header_t) ||
if (!(flags & SMB_O_NOCKSUM)) {
esum += *p;
isum += *p;
}
}
/*
* Copy the entry point into our handle. The underlying entry point
* may be larger than our structure definition, so reset smbe_elen
* to our internal size and recompute good checksums for our copy.
*/
shp->sh_nstructs = 0;
uint_t n = 0;
break;
}
break; /* ignore any entries beyond end-of-table */
break;
}
while (p <= q - 2 && (p[0] != '\0' || p[1] != '\0')) {
if (*p++ == '\0')
n++; /* count strings until \0\0 delimiter */
}
if (p > q - 2) {
break;
}
if (p > s)
n++; /* add one for final string in string table */
stp->smbst_strtablen = n;
nhp = (void *)(p + 2);
shp->sh_nstructs++;
for (n = 0, p = s; n < stp->smbst_strtablen; p++) {
if (*p == '\0') {
stp->smbst_strtab[n++] =
s = p + 1;
}
}
}
/* error out if we couldn't find any complete entries in the table */
if (flags & SMB_O_ZIDS)
return (shp);
}
void
{
uint_t i;
for (i = 0; i < shp->sh_nstructs; i++) {
}
}
/*
* Recompute the values of the entry point checksums based upon the content
* of the specified SMBIOS entry point. We don't need 'shp' but require it
* anyway in case future versioning requires variations in the algorithm.
*/
/*ARGSUSED*/
void
{
isum += *p;
esum += *p;
}
const void *
{
}
{
}
static smbios_struct_t *
{
return (sp);
}
int
{
return (-1); /* errno is set for us */
return (0);
}
int
{
return (-1); /* errno is set for us */
return (0);
}
int
{
int i, rv = 0;
break;
}
return (rv);
}
const smb_struct_t *
{
uint_t i;
for (i = 0; i < shp->sh_nstructs; i++) {
return (&shp->sh_structs[i]);
}
return (NULL);
}
const smb_struct_t *
{
switch (id) {
case SMB_ID_NOTSUP:
return (NULL);
case SMB_ID_NONE:
return (NULL);
}
break;
}
return (stp);
}
const char *
{
if (i == 0 || i > stp->smbst_strtablen)
return (_smb_emptystr);
else
}
int
{
}
{
}