mdesc_devinit.c revision 31e37bb439502e3f7c4c0a9a77d655ea5d56887a
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <strings.h>
#include <fm/fmd_fmri.h>
/*
* Initialize sun4v machine descriptor file for subsequent use.
* If the open fails (most likely because file doesn't exit), or if
* initialization fails, deallocate any storage and return NULL.
*
* If the open succeeds and initialization also succeeds, the returned value is
* a pointer to an md_impl_t, whose 1st element points to the buffer where
* the full mdesc has been read in. The size of this buffer is returned
* as 'bufsiz'. Caller is responsible for deallocating BOTH of these objects.
*/
#define MDESC_PATH "%s/devices/pseudo/mdesc@0:mdesc"
md_t *
{
int fh;
char mdescpath[MAXPATHLEN];
if (fh < 0)
return (NULL);
fmd_fmri_warn("cannot determine mdesc size\n");
return (NULL);
}
fmd_fmri_warn("failed reading machine description\n");
return (NULL);
}
}