Solaris_PersistentShareForSystem.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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "Solaris_PersistentShareForSystem.h"
#include "nfs_keys.h"
#include "nfs_providers_msgstrings.h"
#include "messageStrings.h"
#include "nfs_provider_names.h"
#include "util.h"
#include "common_functions.h"
#include "createprop_methods.h"
#include "libfsmgt.h"
/*
* Private methods
*/
static CCIMProperty *get_Antecedent();
/*
* Public methods
*/
/*
* Instance provider methods
*/
/*
* Method: cp_createInstance_Solaris_PersistentShareForSystem
*
* Description: This method is not supported. It is not supported because in
* order for a Solaris_PersistentShareForSystem association to exist a
* corresponding Solaris_PersistentShare and Solaris_ComputerSystem must exist.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of
* the class for which to create an instance.
* - CCIMInstance *pInst - Not used.
*
* Returns:
* - Always returns NULL because the method is not supported.
*/
/* ARGSUSED */
CCIMInstance *pInst) {
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
} /* cp_createInstance_Solaris_PersistentShareForSystem */
/*
* Method: cp_deleteInstance_Solaris_PersistentShareForSystem
*
* Description: This method is not supported. It is not supported because in
* order for it to be actually deleted the corresponding
* Solaris_PersistentShare would need to be deleted. That action is not
* appropriate for this provider.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the
* information about the class for which to delete the instance.
*
* Returns:
* - Always returns cim_false because the method is not supported.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::DELETE_INSTANCE",
return (cim_false);
} /* cp_deleteInstance_Solaris_PersistentShareForSystem */
/*
* Method: cp_enumInstances_Solaris_PersistentShareForSystem
*
* Description: Enumerates the instances of Solaris_PersistentShareForSystem on
* a host.
* An instance of Solaris_PersistentShareForSystem is an association that links
* a persistent share to the hosting machine.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of
* the class for which to enumerate the instances.
*
* Returns:
* - A pointer to a list of Solaris_PersistentShareForSystem instances.
* - NULL if an error occurred or if there are no instances of
* Solaris_PersistentShareForSystem on the host. In the case of an error,
* the error will be logged.
*/
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
if (persistShareOP == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
/*
* A NULL return value indicates an error, an empty list does not.
*/
if (persistShareOPList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
return ((CCIMInstanceList *)NULL);
}
/*
* Retrieve the Antecedent property. The Antecedent property is the
* same for every instance of Solaris_PersistentShareForSystem because
* it is the Solaris_ComputerSystem upon which the
* Solaris_PersistentShare resides.
*/
antProp = get_Antecedent();
/*
* An error was encountered and it was handled in
* get_Antecedent.
*/
return ((CCIMInstanceList *)NULL);
}
if (persistShareForSysInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
if (persistShareForSysInst == NULL) {
ex = cim_getLastError();
"SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
&err);
return ((CCIMInstanceList *)NULL);
}
/*
* Create a reference property out of the current
* Solaris_PersistentShare object path.
*/
persistShareForSysInst) == cim_false) {
return ((CCIMInstanceList *)NULL);
}
/*
* Add the Antecedent (Solaris_ComputerSystem) property to the
* instance.
*/
if (returned_val == cim_false) {
ex = cim_getLastError();
"SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
/*
* Add the Solaris_PersistentShareForSystem instance to the
* instance list.
*/
if (persistShareForSysInstList == NULL) {
ex = cim_getLastError();
"SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
}
return (persistShareForSysInstList);
} /* cp_enumInstances_Solaris_PersistentShareForSystem */
/*
* Method: cp_enumInstanceNames_Solaris_PersistentShareForSystem
*
* Description: Enumerates the object paths corresponding to the instances of
* Solaris_PersistentShareForSystem on a host.
* An instance of Solaris_PersistentShareForSystem is an association that links
* a persistent share to the hosting machine.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of
* the class for which to enumerate the instances.
*
* Returns:
* - A pointer to a list of Solaris_PersistentShareForSystem object paths.
* - NULL if an error occurred or if there are no instances of
* Solaris_PersistentShareForSystem on the host. In the case of an error,
* the error will be logged.
*/
int err = 0;
/*
* First check if the CCIMObjectPath parameter is null.
*/
util_handleError("SOLARIS_SYSPERSISTSHARE::ENUM_INSTANCE_NAMES",
return ((CCIMObjectPathList *)NULL);
}
if (persistShareForSysInstList == NULL) {
/*
* An error occurred in enumInstances or there are simply no
* Solaris_PersistentShareForSystem instances to enumerate. In
* the case of an error, the error would have been handled in
* the cp_enumInstances_Solaris_PersistentShareForSystem
* function.
*/
return ((CCIMObjectPathList *)NULL);
}
return (persistShareForSysOPList);
} /* cp_enumInstanceNames_Solaris_PersistentShareForSystem */
/*
* Method: cp_execQuery_Solaris_PersistentShareForSystem
*
* Description: Queries the host to find those Solaris_PersistentShareForSystem
* instances that meet the search criteria.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of
* the class to query.
* - char *selectClause - Not used.
* - char *nonJoinExp - Not used.
* - char *queryExp - Not used.
* - char *queryLang - Not used.
*
* Returns:
* - A pointer to a list of Solaris_PersistentShareForSystem instances
* that match the criteria.
* - NULL if an error occurred or if there are no
* Solaris_PersistentShareForSystem instances that match the criteria.
* In the case of an error, the error will be logged.
*
* NOTE: 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 err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
if (persistShareForSysInstList == NULL) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
if (persistShareForSysInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
return (persistShareForSysInstList);
} /* cp_execQuery_Solaris_PersistentShareForSystem */
/*
* Method: cp_getInstance_Solaris_PersistentShareForSystem
*
* Description: Gets the instance corresponding to the passed in object path.
*
* Parameters:
* - CCIMObjectPath *pOP - The object path containing all the
* keys of the instance that is to be returned.
*
* Returns:
* - A pointer to the instance of Solaris_PersistentShareForSystem
* corresponding to pOP.
* - NULL if an error occurred or if the instance doesn't exist on the
* host. In the case of an error, the error will be logged.
*/
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_INSTANCE",
return ((CCIMInstance *)NULL);
}
/*
* Get the Dependent and Antecedent properties.
*/
/*
* Check if we have the Antecedent and Dependent properties.
*/
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_INSTANCE",
return ((CCIMInstance *)NULL);
}
return ((CCIMInstance *)NULL);
}
return (persistShareForSysInst);
} /* cp_getInstance_Solaris_PersistentShareForSystem */
/*
* Method: cp_setInstance_Solaris_PersistentShareForSystem
*
* Description: This method is not supported. It is not supported because in
* order to change a Solaris_PersistentShareForSystem instance the underlying
* persistent share and computer system must be modified. Those actions must
* done on the appropriate persistent share and computer system objects, not
* here.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of the class
* for which to set the instance.
* - CCIMInstance *pInst - Not used.
*
* Returns:
* - Always returns cim_false, because the method is not supported.
*/
/* ARGSUSED */
CCIMInstance *pInst) {
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::SET_INSTANCE",
return (cim_false);
} /* cp_setInstance_Solaris_PersistentShareForSystem */
/*
* Method: cp_setInstanceWithList_Solaris_PersistentShareForSystem
*
* Description: This method is not supported. It is not supported because in
* order to change a Solaris_PersistentShareForSystem instance the underlying
* persistent share and computer system must be modified. Those actions must
* done on the appropriate persistent share and computer system objects, not
* here.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of the class
* for which to set the instance.
* - CCIMInstance *pInst - Not used.
*
* Returns:
* - Always returns cim_false, because the method is not supported.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::SET_INSTANCE",
return (cim_false);
} /* cp_setInstanceWithList_Solaris_PersistentShareForSystem */
/*
* Associator provider methods
*/
/*
* Method: cp_associators_Solaris_PersistentShareForSystem
*
* Description: Returns the instances associated, via the
* Solaris_PersistentShareForSystem association, to the pObjectName parameter.
*
* Parameters:
* - CCIMObjectPath *pAssocName - An object path containing the name of
* the association that the caller is trying to reach.
* - CCIMObjectPath *pObjectName - The object path containing information
* (Class Name, Key Properties) about the object whose associated objects
* are to be returned.
* - char *pResultClass - If specified, only return instances that are of
* this class type.
* - char *pRole - If specified, this is the role of the pObjectName
* object path passed in. If this is not valid, NULL is returned.
* - char *pResultRole - If specified, only return instances that are
* playing this role in the association.
*
* Returns:
* - A list of Solaris_PersistentShare (if pRole == Antecedent &&
* pObjectName is a Solaris_ComputerSystem object path) or
* Solaris_ComputerSystem (if pRole == Dependent && pObjectName is a
* Solaris_PersistentShare object path) instances which are associated
* to the pObjectName parameter.
* - NULL if an error occurred or if there are no instances associated to
* the pObjectName passed in. In the case of an error, the error will be
* logged.
*/
/* ARGSUSED */
char *pResultRole) {
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
/*
* Determine whether the pObjectName is the Antecedent or the Dependent
* of the association. Antecedent == Solaris_ComputerSystem,
* Dependent = Solaris_PersistentShare
*/
char *name;
char *hostname;
/*
* If a value was passed in with pRole and it does not match
* the role that the pObjectName actually is then log an
* invalid param error.
*/
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
/*
* Retrieve the Name key property from the pObjectName object
* path. This is expected to be populated with the host name.
* If the Name key value is not the same as that of the current
* host, return null.
*/
&err);
/*
* We don't have the appropriate information.
*/
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS",
&err);
return ((CCIMInstanceList *)NULL);
}
/*
* We can only determine shares on the current host.
* The providers are not distributed.
*/
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
if (persistShareExists == cim_false) {
cim_logDebug("cp_associators",
"persistShareExists == cim_false");
util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
} else {
util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
/*
* A NULL return value indicates error, an empty list does not.
*/
if (returnInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE:ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
return ((CCIMInstanceList *)NULL);
}
return (returnInstList);
} /* cp_associators_Solaris_PersistentShareForSystem */
/*
* Method: cp_associatorNames_Solaris_PersistentShareForSystem
*
* Description: Returns the object paths corresponding to the instances on the
* other side of the association which are associated via the
* Solaris_PersistentShareForSystem association and having the passed in
* parameter, pObjectName, as the opposite key.
*
* Parameters:
* - CCIMObjectPath *pAssocName - An object path containing information
* about the association that the caller is trying to reach.
* - CCIMObjectPath *pObjectName - The object path which contains the
* information on whose associated objects are to be returned.
* - char *pResultClass - If specified, only return instances that are of
* this class type.
* - char *pRole - If specified, this is the role of the pObjectName
* object path passed in. If this is not valid, NULL is returned.
* - char *pResultRole - If specified, only return instances that are
* playing this role in the association.
*
* Returns:
* - A list of Solaris_PersistentShare (if pRole == Antecedent &&
* pObjectName is a Solaris_ComputerSystem object path) or
* Solaris_ComputerSystem (if pRole == Dependent && pObjectName is a
* Solaris_PersistentShare object path) object paths which are associated
* to the pObjectName parameter.
* - NULL if an error occurred or if there are no instances associated to
* the pObjectName passed in. In the case of an error, the error will be
* logged.
*/
char *pResultRole) {
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::ASSOCIATOR_NAMES",
return ((CCIMObjectPathList *)NULL);
}
return ((CCIMObjectPathList *)NULL);
}
return (objPathList);
} /* cp_associatorNames_Solaris_PersistentShareForSystem */
/*
* Method: cp_references_Solaris_PersistentShareForSystem
*
* Description: Returns the Solaris_PersistentShareForSystem instances that
* have the passed in parameter, pObjectName, as one of it's keys.
*
* Parameters:
* - CCIMObjectPath *pAssocName - An object path containing information
* about the association that the caller is trying to reach.
* - CCIMObjectPath *pObjectName - The object path which contains the
* information on whose associated objects are to be returned.
* - char *pRole - If specified, this is the role of the pObjectName
* object path passed in. If this is not valid, NULL is returned.
*
* Returns:
* - A pointer to a list of Solaris_PersistentShareForSystem instances.
* - NULL if an error occurred or if there are no
* Solaris_PersistentShareForSystem instances having pObjectName as one of
* it's keys.
*/
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::REFERENCES",
return ((CCIMInstanceList *)NULL);
}
/*
* Get everything that is related to the pObjectName passed in.
*/
if (objPathList == NULL) {
return ((CCIMInstanceList *)NULL);
}
/*
* Now use the object paths in the object path list and the pObjectName
* variable to create the association instances.
*/
/*
* pObjectName is the Dependent
*/
} else {
/*
* pObjectName is the Antecedent
*/
}
return (instList);
} /* cp_references_Solaris_PersistentShareForSystem */
/*
* Method: cp_referenceNames_Solaris_PersistentShareForSystem
*
* Description: Returns the object paths corresponding to the
* Solaris_PersistentShareForSystem instances that have the passed in parameter,
* pObjectName, as one of it's keys.
*
* Parameters:
* - CCIMObjectPath *pAssocName - An object path containing information
* about the association that the caller is trying to reach.
* - CCIMObjectPath *pObjectName - The object path which contains the
* information on whose associated objects are to be returned.
* - char *pRole - If specified, this is the role of the pObjectName
* object path passed in. If this is not valid, NULL is returned.
*
* Returns:
* - A pointer to a list of Solaris_PersistentShareForSystem object paths.
* - NULL if an error occurred or if there are no
* Solaris_PersistentShareForSystem instances having pObjectName as one of
* it's keys.
*/
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::REFERENCE_NAMES",
return ((CCIMObjectPathList *)NULL);
}
pObjectName, pRole);
if (persistShareForSysInstList == NULL) {
return ((CCIMObjectPathList *)NULL);
}
return (persistShareForSysOPList);
} /* cp_referenceNames_Solaris_PersistentShareForSystem */
/*
* Property provider methods
*/
/*
* Method: cp_getProperty_Solaris_PersistentShareForSystem
*
* Description: Retrieves a certain property from the instance of
* Solaris_PersistentShareForSystem on the host that is described by the
* parameter pOP.
*
* Parameters:
* - CCIMObjectPath *pOP - The object path containing all the
* information needed to find the instance for which the property is to
* be returned.
* - cimchar *pPropName - The name of the property to be found.
*
* Returns:
* - A pointer to the property corresponding to the name passed in with
* pPropName.
* - NULL if an error occurred or if the property doesn't exist. In the
* case of an error, the error will be logged.
*/
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_PROPERTY",
return ((CCIMProperty *)NULL);
}
if (persistShareForSysInst == NULL) {
return ((CCIMProperty *)NULL);
}
return (persistShareForSysProp);
} /* cp_getProperty_Solaris_PersistentShareForSystem */
/*
* Method: cp_setProperty_Solaris_PersistentShareForSystem
*
* Description: This method is not supported. It is not supported because in
* order to change a Solaris_PersistentShareForSystem instance the underlying
* persistent share and computer system must be modified. Those actions must
* done on the appropriate persistent share and computer system objects, not
* here.
*
* Parameters:
* - CCIMObjectPath *pOP - Not used.
* - CCIMProperty *pProp - Not used.
*
* Returns:
* - Always returns cim_false because the method is not supported.
*/
/* ARGSUSED */
CCIMProperty *pProp) {
int err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::SET_PROPERTY",
return (cim_false);
} /* cp_setProperty_Solaris_PersistentShareForSystem */
/*
* Method provider methods
*/
/*
* Method: cp_invokeMethod_Solaris_PersistentShareForSystem
*
* Description: This method is not supported because the provider doesn't have
* any methods.
*
* Parameters:
* - CCIMObjectPath* op - Not used.
* - cimchar* methodName - Not used.
* - CCIMPropertyList* inParams - Not used.
* - CCIMPropertyList* outParams - Not used.
*
* Returns:
* - Always returns null because the method is not supported.
*/
/* ARGSUSED */
return ((CCIMProperty *)NULL);
} /* cp_invokeMethod_Solaris_PersistentShareForSystem */
/*
* Private Methods
*/
/*
* Method: does_persistent_share_exist
*
* Description: Determines from the Solaris_PersistentShare object path whether
* or not the dfstab entry actually exists.
*
* Parameters:
* - CCIMObjectPath *persShareOP - The object path used (by retrieving
* the SettingId property) to determine whether or not the dfstab entry
* exists.
*
* Returns:
* - cim_true or cim_false representing whether or not the entry was
* found.
*/
static CIMBool
char *settingId;
int err = 0;
return (cim_false);
}
char *path;
}
}
return (foundEntry);
} /* does_persistent_share_exist */
/*
* Method: get_Antecedent
*
* Description: Retrieves the antecedent, Solaris_ComputerSystem, reference
* property for the association.
*
* Parameters:
* - NONE
*
* Returns:
* - A pointer to a Solaris_ComputerSystem reference property.
* - Upon error, NULL is returned and the error is logged.
*/
static CCIMProperty *
get_Antecedent() {
char *hostname;
int err = 0;
if (compSysInst == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT",
return ((CCIMProperty *)NULL);
}
/*
* Create the key properties on the Solaris_ComputerSystem instance.
*
* The Solaris_ComputerSystem keys are as follows:
* CreationClassName = "Solaris_ComputerSystem"
* Name = < host name >
*/
return ((CCIMProperty *)NULL);
}
err = 0;
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT",
return ((CCIMProperty *)NULL);
}
return ((CCIMProperty *)NULL);
}
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT",
return ((CCIMProperty *)NULL);
}
if (compSysRefProp == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_SYSPERSISTSHARE::GET_ANT",
return ((CCIMProperty *)NULL);
}
return (compSysRefProp);
} /* get_Antecedent */