Solaris_MediaPresent.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include "util.h"
#include "cimKeys.h"
#include "providerNames.h"
#include "messageStrings.h"
#include "mediapresent_descriptors.h"
#include "drive_descriptors.h"
#include "logicaldisk_descriptors.h"
#include "Solaris_MediaPresent.h"
#define MEDIA_GETINSTANCE "MEDIA_PRESENT,GET_INSTANCE"
#define MEDIA_ENUMINSTANCES "MEDIA_PRESENT,ENUM_INSTANCES"
#define MEDIA_ENUMINSTANCENAMES "MEDIA_PRESENT,ENUM_INSTANCENAMES"
#define MEDIA_CREATEINSTANCE "MEDIA_PRESENT,CREATE_INSTANCE"
#define MEDIA_DELETEINSTANCE "MEDIA_PRESENT,DELETE_INSTANCE"
#define MEDIA_SETINSTANCE "MEDIA_PRESENT,SET_INSTANCE"
#define MEDIA_GETPROPERTY "MEDIA_PRESENT,GET_PROPERTY"
#define MEDIA_SETPROPERTY "MEDIA_PRESENT,SET_PROPERTY"
#define MEDIA_INVOKEMETHOD "MEDIA_PRESENT,INVOKE_METHOD"
#define MEDIA_EXECQUERY "MEDIA_PRESENT,EXEC_QUERY"
#define MEDIA_ASSOCIATORS "MEDIA_PRESENT,ASSOCIATORS"
#define MEDIA_ASSOCIATORNAMES "MEDIA_PRESENT,ASSOCIATOR_NAMES"
#define MEDIA_REFERENCES "MEDIA_PRESENT,REFERENCES"
#define MEDIA_REFERENCENAMES "MEDIA_PRESENT,REFERENCE_NAMES"
static CCIMInstanceList *createMediaPresRefList(
static CCIMInstance *createMediaPresRefInst(
/*
* Solaris_MediaPresent provider
*
* It is important to note that all memory allocated by these functions
* and passed to the CIMOM, is freed by the door process prior to
* sending a copy of the data to the CIMOM.
*/
/*
* Name: cp_getInstance_Solaris_MediaPresent
*
* Description: Returns an instance which matches the passed in object path
* if found.
*
* Parameters:
* pOP - An CCIMObjectPath * which contains the information on
* the class for which to find the instance.
* Returns:
* CCIMInstance * if matched instance is found. Otherwise, NULL.
*/
{
char *name;
int error;
return ((CCIMInstance *)NULL);
}
ANTECEDENT, &error);
if (error == 0) {
}
/*
* Make sure we have both keys. If not, this is an error.
*/
if (error != 0) {
return ((CCIMInstance*)NULL);
}
/*
* Now, get the name of the antecedent from the object path.
*/
return ((CCIMInstance *)NULL);
}
/*
* both of the objects have the deviceid as the key value.
*/
&error);
if (error != 0) {
return ((CCIMInstance *)NULL);
}
/*
* Not found. Return a null instance.
*/
return ((CCIMInstance *)NULL);
}
if (error != 0) {
return ((CCIMInstance*)NULL);
}
/*
* Only need the descriptor to verify the device still exists.
*/
/*
* Now, get the name of the dependent from the object path.
*/
&error);
if (error != 0) {
return ((CCIMInstance *)NULL);
}
/*
* Not found. Return a null instance.
*/
return ((CCIMInstance *)NULL);
}
if (error != 0) {
return ((CCIMInstance *)NULL);
}
/* Turn these descriptors in to a media present instance */
&error);
if (error != 0) {
return ((CCIMInstance *)NULL);
}
return (inst);
}
/*
* Name: cp_enumInstances_Solaris_MediaPresent
*
* Description: Returns a linked list of instances of associated objects
* if found.
*
* Parameters:
* pOP - An CCIMObjectPath * which contains the information on
* the class for which to find the instances.
* Returns:
* CCIMInstanceList * if istances are found. Otherwise NULL,
*/
/* ARGSUSED */
{
int error = 0;
int filter[2];
int i = 0;
int j = 0;
filter[0] = DM_DT_FIXED;
return ((CCIMInstanceList *)NULL);
}
if (dd_descriptorp == NULL) {
return ((CCIMInstanceList *)NULL);
}
if (dd_descriptorp[0] == NULL) {
return ((CCIMInstanceList *)NULL);
}
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
/*
* For each one of the drives found, get the associated media, if
* any.
*/
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
for (i = 0; dd_descriptorp[i] != NULL; i ++) {
/* If no media associated with this disk, continue */
if (ld_descriptorp == NULL) {
continue;
}
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
for (j = 0; ld_descriptorp[j] != NULL; j ++) {
dd_descriptorp[i], ld_descriptorp[j],
MEDIA_PRESENT, &error);
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
}
}
}
return (instList);
}
/*
* Name: cp_enumInstanceNames_Solaris_MediaPresent
*
* Description: Returns a linked list of CCIMObjectPath *
* of Solaris_MediaPresent if found.
*
* Parameters:
* pOP - An CCIMObjectPath * which contains the information on
* the class for which to find the instances.
* Returns:
* CCIMObjectPathList * if objects are found. Otherwise NULL.
*/
int error;
return ((CCIMObjectPathList *)NULL);
}
/*
* Call in to enumInstances and then convert the instance list in
* to an object list.
*/
}
return (objList);
}
/*
* Creating an instance of a Solaris_MediaPresent is not supported.
*/
/* ARGSUSED */
{
int error;
return ((CCIMObjectPath *)NULL);
}
/*
* Deleting an instance of a Solaris_MediaPresent is not supported.
*/
/* ARGSUSED */
{
int error;
return (cim_false);
}
/*
* Name: cp_getProperty_Solaris_MediaPresent
*
* Description: Returns the property requested, if found.
*
* Parameters:
* pOP - An CCIMObjectPath * which contains the information on
* the class for which to find the instances.
* Returns:
* CCIMProperty * if found.
*/
/* ARGSUSED */
char *pPropName)
{
int error = 0;
return ((CCIMProperty *)NULL);
}
return ((CCIMProperty *)NULL);
}
return (prop);
}
/*
* Setting an instance of a Solaris_MediaPresent is not supported.
*/
/* ARGSUSED */
{
int error;
return (cim_false);
}
/*
* Setting a property on a Solaris_MediaPresent is not supported.
*/
/* ARGSUSED */
{
int error;
return (cim_false);
}
/*
* No Methods for Solaris_MediaPresent.
*/
/* ARGSUSED */
{
return (retVal);
}
/*
* Name: cp_execQuery_Solaris_MediaPresent
*
* Description:
* Returns an instance list which matches the query if any are found.
*
* Parameters:
* CCIMObjectPath *op - An CCIMObjectPath * which contains the
* information on the class for which to find the instances.
*
* selectList - Not used
* nonJoinExp - Not used
*
* Returns:
* CCIMInstance * if matched instance is found. Otherwise, NULL.
*/
/*
* Currently, there is no WQL parser for the C providers. As a result,
* what is returned to the CIMOM is a list of instances with
* a NULL value at the beginning of the list. This NULL value indicates
* to the CIMOM that it must do the filtering for the client.
*/
/* ARGSUSED */
{
int error;
return ((CCIMInstanceList *)NULL);
}
return ((CCIMInstanceList *)NULL);
}
/*
* Create a null instance and add it to the beginning
* of the list to indicate to the CIMOM that no filtering
* was done.
*/
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
/*
* Since copying the original list to the new list will
* leave no way to free the original list, manually
* concatenate the original list to the new one.
*/
return (result);
}
/*
* Name: cp_associators_Solaris_MediaPresent
*
* Description:
* Returns a instances of objects associated with the passed in
* object if there are any.
*
* Parameters:
*
* CCIMObjectPath *pAssocName - The name of the association that
* the client wants information about.
*
* CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the
* information on the class for which to find the associated instances.
*
* cimchar *pResultClass - If specified, only return instances that
* are of this class type.
*
* cimchar *pRole - If specified, must be valid for the object path
* passed in requesting the associated instances.
*
* cimchar *pResultRole - If specified, only return instances that
* are playing this role in the association.
*
*
* Returns:
* CCIMInstanceList * if associated objects are found.
* NULL is returned on error and for an empty list.
*/
/* ARGSUSED */
{
char *name;
int error = 0;
int isAntecedent = 0;
int i;
return ((CCIMInstanceList *)NULL);
}
isAntecedent = 1;
}
if (isAntecedent != 1) {
return ((CCIMInstanceList *)NULL);
}
if (isAntecedent == 1) {
return ((CCIMInstanceList *)NULL);
}
}
}
/*
* Both logical disk and disk drive have deviceid as the
* key.
*/
&error);
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
if (isAntecedent) {
} else {
}
return ((CCIMInstanceList *)NULL);
}
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
if (isAntecedent) {
/* Get associated descriptors. */
if (assoc_descriptors == NULL) {
return ((CCIMInstanceList *)NULL);
}
if (assoc_descriptors[0] == NULL) {
return ((CCIMInstanceList *)NULL);
}
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
/* Traverse the list and create instances of associated objects. */
for (i = 0; assoc_descriptors[i] != NULL; i ++) {
if (error != 0) {
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
} /* End for */
} else {
/*
* This is the logical disk calling this function. Return the
* logical disk that this belongs to.
*/
if (assoc_descriptors == NULL) {
return ((CCIMInstanceList *)NULL);
}
if (assoc_descriptors[0] == NULL) {
return ((CCIMInstanceList *)NULL);
}
if (error != 0) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
for (i = 0; assoc_descriptors[i] != NULL; i ++) {
if (error != 0) {
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
} /* End for */
}
return (instList);
}
/*
* Name: cp_associatorNames_Solaris_MediaPresent
*
* Description:
* Returns a list of objects associated with the passed in
* object if there are any via the object CCIMObjectPath.
*
* Parameters:
*
* CCIMObjectPath *pAssocName - The name of the association that
* the client wants information about.
*
* CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the
* information on the class for which to find the associated instances.
*
* cimchar *pResultClass - If specified, only return instances that
* are of this class type.
*
* cimchar *pRole - If specified, must be valid for the object path
* passed in requesting the associated instances.
*
* cimchar *pResultRole - If specified, only return instances that
* are playing this role in the association.
*
*
* Returns:
* CCIMObjectPathList * if associated objects are found. NULL otherwise.
*/
/* ARGSUSED */
{
int error;
if (pObjectName == NULL) {
return ((CCIMObjectPathList *)NULL);
}
instList =
}
return (objList);
}
/*
* Name: cp_references_Solaris_MediaPresent
*
* Description:
* Returns a instances of objects that have references to the passed in
* object if there are any.
*
* Parameters:
*
* CCIMObjectPath *pAssocName - The name of the association that
* the client wants information about.
*
* CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the
* information on the class for which to find the associated instances.
*
* cimchar *pRole - If specified, must be valid for the object path
* passed in requesting the associated instances.
*
* Returns:
* CCIMObjectPathList * if associated objects are found. NULL otherwise.
*/
/* ARGSUSED */
{
int error;
if (pObjectName == NULL) {
return ((CCIMInstanceList *)NULL);
}
/*
* Get the list of those objects that are referred to by
* the calling object.
*/
objList =
/*
* Now generate the list of instances to return.
*/
} else {
}
return (instList);
}
/*
* Name: cp_referenceNames_Solaris_MediaPresent
*
* Description:
* Returns a instances of objects that have references to the passed in
* object if there are any.
*
* Parameters:
*
* CCIMObjectPath *pAssocName - The name of the association that
* the client wants information about.
*
* CCIMObjectPath *pObjectName - An CCIMObjectPath * which contains the
* information on the class for which to find the associated instances.
*
* cimchar *pRole - If specified, must be valid for the object path
* passed in requesting the associated instances.
*
*
* Returns:
* CCIMInstanceList * if associated objects are found. Thist list
* may be empty. NULL is returned on error.
*
*/
/* ARGSUSED */
{
int error;
if (pObjectName == NULL) {
return ((CCIMObjectPathList *)NULL);
}
instList =
}
return (objList);
}
/*
* Create the association class with the passed in attributes.
*/
static
{
*error = 0;
/*
* If no objects associated with this one, return NULL.
*/
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
if (*error != 0) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
return ((CCIMInstanceList *)NULL);
}
}
return (instList);
}
static
int *error)
{
*error = 0;
ex = cim_getLastError();
return ((CCIMInstance *)NULL);
}
if (*error != 0) {
ex = cim_getLastError();
return ((CCIMInstance *)NULL);
}
if (*error != 0) {
ex = cim_getLastError();
return ((CCIMInstance *)NULL);
}
if (*error != 0) {
ex = cim_getLastError();
return ((CCIMInstance *)NULL);
}
return (inst);
}