Solaris_NFSMount.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_NFSMount.h"
#include "nfs_keys.h"
#include "nfs_providers_msgstrings.h"
#include "messageStrings.h"
#include "nfs_provider_names.h"
#include "libfsmgt.h"
#include "cmdgen.h"
#include "util.h"
#include "nfsprov_methods.h"
#include "mountprov_methods.h"
#include "createprop_methods.h"
#include <string.h>
#include <errno.h>
/*
* Constants
*/
#define DELETE_VFSTAB_ENT_METHOD "deleteVfstabEntry"
#define GET_DEF_SECMODE_METHOD "getDefaultNfsSecMode"
#define GET_NET_CFG_LIST_METHOD "getNetCfgList"
#define GET_NFS_SEC_LIST_METHOD "getNfsSecList"
#define SHOW_EXPORTS_METHOD "showExports"
/*
* Private method declarations
*/
int *errp);
static CCIMInstanceList * enumerate_mounts();
char *nameKeyValue);
cimchar **propValues);
/*
* Public methods
*/
/*
* Instance provider methods
*/
/*
* Method: cp_enumInstances_Solaris_NFSMount
*
* Description: Enumerates all of the nfs mounts on the host. NFS mounts with
* "ignore" in the option string are ignored.
*
* Parameters:
* - CCIMObjectPath* mountOP - The object path containing the name of the
* class to which the instance to be enumerated belongs.
*
* Returns:
* - A pointer to a list of Solaris_NFSMount instances.
* - NULL if an error occurred or if there are no NFS mounts on the host.
* In the case of an error, the error will be logged.
*/
int err = 0;
/*
* First check if the CCIMObjectPath passed in is null.
*/
"SOLARIS_NFSMOUNT::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
instList = enumerate_mounts();
return ((CCIMInstanceList *)NULL);
}
return (instList);
} /* cp_enumInstances_Solaris_NFSMount */
/*
* Method: cp_getInstance_Solaris_NFSMount
*
* Description: Gets the instance corresponding to the Solaris_NFSMount
* object path passed in.
*
* Parameters:
* - CCIMObjectPath* mountOP - An object path containing all the keys of
* the instance that is supposed to be returned.
*
* Returns:
* - A pointer to the Solaris_NFSMount instance corresponding to the object
* path parameter.
* - NULL if an error occurred or if the instance doesn't exist. In the
* case of an error, the error will be logged.
*/
int err;
util_handleError("SOLARIS_NFSMOUNT::GET_INSTANCE",
return ((CCIMInstance *)NULL);
}
util_handleError("SOLARIS_NFSMOUNT::GET_INSTANCE",
return ((CCIMInstance *)NULL);
}
/*
* Either an error occurred or we simply don't have any
* instances of Solaris_NFSMount on the system. In the case,
* that an error occurred, it will be handled in
* cp_enumInstances_Solaris_NFSMount.
*/
return ((CCIMInstance *)NULL);
}
return (inst);
} /* cp_getInstance_Solaris_NFSMount */
/*
* Method: cp_createInstance_Solaris_NFSMount
*
* Description:
* Creates an instance of the Solaris_NFSMount class.
* A create instance will actually mount a file system on the current host by
* calling the cmd interface's cmd_execute_command_and_retrieve_string function.
*
* Parameters:
* - CCIMObjectPath* nfsOP - An object path containing the information
* needed about the class of which to have an instance created.
* - CCIMInstance* nfsInst - The instance to be created.
*
* Returns:
* - A pointer to a Solaris_NFSMount CCIMObjectPath which corresponds to
* the mount that was created.
* - Upon error, NULL is returned and the error will be logged.
*/
CCIMInstance* nfsInst) {
char *cmd_return = NULL;
char *cmd;
char *resource;
char *mountp;
char *mntoptsParam, *timeParam;
int err = 0;
/*
* First check if the CCIMInstance or CCIMObjectPath is null.
*/
"SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
}
/*
* Get the properties from the instance parameter in order to create
* an instance as defined. The properties will be used to create a
* mount command to execute.
*/
/*
* The only properties required are resource and mount point.
* All other properties are not needed. The defaults will be used.
*/
err = 0;
propListParam, &err);
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
}
cim_logDebug("cp_createInstance_Solaris_NFSMount",
"cmd =%s", cmd);
err = 0;
if (err != 0) {
cim_logDebug("cp_createInstance_Solaris_NFSMount",
"cmd_return =%s", cmd_return);
/*
* An error occurred in executing the command.
*/
if (cmd_return != NULL) {
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
} else {
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
}
}
if (cmd_return != NULL) {
}
/*
* It should be certain that the mount got created if the
* cmd_execute_command_and_retrieve_string function succeded, but we
* will do a second check to make sure it did and to get the devid.
* We can determine if the mount exists by checking for a mount having
*/
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
}
}
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
}
}
err = 0;
mntoptsParam = NULL;
if (err != 0) {
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
}
cim_logDebug("cp_createInstance_Solaris_NFSMount",
/*
* There were no mounts found with the resource and mount point.
* We can assume that the mount wasn't created so return NULL.
*/
return ((CCIMObjectPath *)NULL);
}
if (nfsMountInstList == NULL) {
if (err != 0) {
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
}
return ((CCIMObjectPath *)NULL);
}
/*
* Ideally there is only one instance, but with being able to
* overlay file systems there is a possibility that there may
* If there are multiple instances in this list the last one
* returned will be used to create the return object path.
* That should be the most recently created mount.
*/
if (nfsMountOP != NULL) {
cim_logDebug("cp_createInstance_Solaris_NFSMount",
"More than one mount found.");
}
if (nfsMountOP == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::CREATE_INSTANCE",
return ((CCIMObjectPath *)NULL);
}
}
return (nfsMountOP);
} /* cp_createInstance_Solaris_NFSMount */
/*
* Method: cp_deleteInstance_Solaris_NFSMount
*
* Description: Deletes a Solaris_NFSMount instance.
* A delete instance will actually unmount a file system on the current host by
* calling the cmd interface's cmd_execute_command_and_retrieve_string function.
*
* Parameters:
* - CCIMObjectPath* nfsOP - The object path containing all information
* needed to delete the appropriate instance.
*
* Returns:
* - A CIMBool value corresponding to whether or not the instance was
* deleted. cim_true will be returned if the delete was successful,
* cim_false will be returned if the delete failed.
*/
char *cmd;
char *cmd_return = NULL;
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE",
return (cim_false);
}
/*
* Get the mount that is to be deleted and generate the command.
*/
propListParam, &err);
util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE",
return (cim_false);
}
/*
* Execute the umount command
*/
err = 0;
if (err != 0) {
/*
* The command execution failed.
*/
if (cmd_return != NULL) {
util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE",
return (cim_false);
} else {
util_handleError("SOLARIS_NFSMOUNT::DELETE_INSTANCE",
return (cim_false);
}
}
if (cmd_return != NULL)
return (cim_true);
} /* cp_deleteInstance_Solaris_NFSMount */
/*
* Method: cp_enumInstanceNames_Solaris_NFSMount
*
* Description: Enumerates all of the nfs mounts on the host. NFS mounts with
* "ignore" in the option string are ignored.
*
* Parameters:
* - CCIMObjectPath* mountOP - An object path containing the name of the
* class of which to enumerate instances of.
*
* Returns:
* - A pointer to a list of Solaris_NFSMount object paths.
* - NULL if an error occurred or if there are no NFS mounts 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_NFSMOUNT::ENUM_INSTANCENAMES",
return ((CCIMObjectPathList *)NULL);
}
{
/*
* Failure...or there are no NFS mount instances.
*/
return ((CCIMObjectPathList *)NULL);
}
/*
* If an error occurred in cim_createObjectPathList it will be handled
* there.
*/
return (OPList);
} /* cp_enumInstanceNames_Solaris_NFSMount */
/*
* Method: cp_execQuery_Solaris_NFSMount
*
* Description: Queries the nfs mounts on the host to find those that meet the
* search criteria.
*
* Parameters:
* - CCIMObjectPath *hostedShareOP - 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_NFSMount instances that match the
* criteria.
* - NULL if an error occurred or if there are no Solaris_NFSMount
* 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_NFSMOUNT::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
if (nfsMountInstList == NULL) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
if (nfsMountInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
return (nfsMountInstList);
} /* cp_execQuery_Solaris_NFSMount */
/*
* Method: cp_setInstance_Solaris_NFSMount
*
* Description: This method is not supported. This is not allowed because in
* order to change the properties of a mount on the host, the mount must be
* unmounted and mounted with the new properties. This behavior is not
* appropriate for the set instance. If the client wants to change the
* properties of a mount they must delete the old instance and create a
* new one with the desired properties.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of the class
* of which to set the instance.
* - CCIMInstance *pInst - Not used.
*
* Returns:
* - cim_false is returned every time since the method is not supported.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::SET_INSTANCE",
return (cim_false);
} /* cp_setInstance_Solaris_NFSMount */
/*
* Method: cp_setInstanceWithList_Solaris_NFSMount
*
* Description: This method is not supported. This is not allowed because in
* order to change the properties of a mount on the host, the mount must be
* unmounted and mounted with the new properties. This behavior is not
* appropriate for the set instance. If the client wants to change the
* properties of a mount they must delete the old instance and create a
* new one with the desired properties.
*
* Parameters:
* - CCIMObjectPath *hostedShareOP - The object path containing the name
* of the class of which to set the instance.
* - CCIMInstance *hostedShareInst - Not used.
* - char **props - Not used.
* - int num_props - Not used.
*
* Returns:
* - cim_false is returned every time since the method is not supported.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::SET_INSTANCE",
return (cim_false);
} /* cp_setInstanceWithList_Solaris_NFSMount */
/*
* Associator provider methods
*/
/*
* Method: cp_associators_Solaris_NFSMount
*
* Description: Returns the instances associated, via the Solaris_NFSMount
* 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 pointer to a list of Solaris_NFS (if pRole == Antecedent &&
* pObjectName is a Solaris_Directory object path) or Solaris_Directory
* (if pRole == DEPENDENT && pObjectName is a Solaris_NFS 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;
/*
* Check if the needed parameters are null.
*/
util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
/*
* The Name key property is the defining property for each the
* Antecedent (Solaris_Directory) and the Dependent (Solaris_NFS)
* so retrieve that property.
*/
util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
/*
* Determine whether pObjectName is the Antecedent or the Dependent
* of the association. Antecedent = Solaris_Directory,
* Dependent = Solaris_NFS
*/
/*
* If a value was passed in with pRole and it does not match
* the role that pObjectName actually is then log an invalid
* param error.
*/
util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
} else {
util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
}
return ((CCIMInstanceList *)NULL);
return (returnInstList);
} /* cp_associators_Solaris_NFSMount */
/*
* Method: cp_associatorNames_Solaris_NFSMount
*
* Description: Returns the object paths of the instances on the other side of
* the association which are associated via the Solaris_NFSMount 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 pointer to a list of Solaris_NFS (if pRole == Antecedent &&
* pObjectName is a Solaris_Directory object path) or Solaris_Directory
* (if pRole == DEPENDENT && pObjectName is a Solaris_NFS 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_NFSMOUNT::ASSOCIATOR_NAMES",
return ((CCIMObjectPathList *)NULL);
}
}
return (objPathList);
} /* cp_associatorNames_Solaris_NFSMount */
/*
* Method: cp_references_Solaris_NFSMount
*
* Description: Returns the Solaris_NFSMount 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_NFSMount instances.
* - NULL if an error occurred or if there are no Solaris_NFSMount
* instances having pObjectName as one of it's keys.
*/
/* ARGSUSED */
char *name;
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::REFERENCES",
return ((CCIMInstanceList *)NULL);
}
/*
* The Name key property is the defining property for each the
* Antecedent (Solaris_Directory) and the Dependent (Solaris_NFS)
* so retrieve that property.
*/
/*
* The object path passed in does not have the appropriate
* information.
*/
util_handleError("SOLARIS_NFSMOUNT::ASSOCIATORS",
return ((CCIMInstanceList *)NULL);
}
/*
* If a value was passed in with pRole and it does not match
* the role that pObjectName actually is then log an invalid
* param error.
*/
util_handleError("SOLARIS_NFSMOUNT::REFERENCES",
return ((CCIMInstanceList *)NULL);
}
} else {
util_handleError("SOLARIS_NFSMOUNT::REFERENCES",
return ((CCIMInstanceList *)NULL);
}
}
return ((CCIMInstanceList *)NULL);
return (instList);
} /* cp_references_Solaris_NFSMount */
/*
* Method: cp_referenceNames_Solaris_NFSMount
*
* Description: Returns the Solaris_NFSMount object paths of the 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_NFSMount object paths.
* - NULL if an error occurred or if there are no Solaris_NFSMount
* instances having pObjectName as one of it's keys.
*/
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::REFERENCES_NAMES",
return ((CCIMObjectPathList *)NULL);
}
pObjectName, pRole);
if (nfsMountInstList == NULL) {
return ((CCIMObjectPathList *)NULL);
}
if (nfsMountOPList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::REFERENCE_NAMES",
return ((CCIMObjectPathList *)NULL);
}
return (nfsMountOPList);
} /* cp_referenceNames_Solaris_NFSMount */
/*
* Property provider methods
*/
/*
* Method: cp_getProperty_Solaris_NFSMount
*
* Description: Retrieves a certain property from the instance of
* Solaris_NFSMount 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 in 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_NFSMOUNT::GET_PROPERTY",
return ((CCIMProperty *)NULL);
}
if (nfsMountInst == NULL) {
return ((CCIMProperty *)NULL);
}
/*
* If an error occurred in cim_getProperty it will be handled there.
*/
return (nfsMountProp);
} /* cp_getProperty_Solaris_NFSMount */
/*
* Method: cp_setProperty_Solaris_NFSMount
*
* Description: This method is not supported. This is not allowed because in
* order to change the properties of a mount on the host, the mount must be
* unmounted and mounted with the new properties. This behavior is not
* appropriate for the set property. If the client wants to change the
* properties of a mount they must delete the old instance and create a
* new one with the desired properties.
*
* Parameters:
* - CCIMObjectPath *pOP - Not used.
* - CCIMProperty *pProp - Not used.
*
* Returns:
* - cim_false is returned every time since the method is not supported.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::SET_PROPERTY",
return (cim_false);
} /* cp_setProperty_Solaris_NFSMount */
/*
* Method provider methods
*/
/*
* Method: cp_invokeMethod_Solaris_NFSMount
*
* Description: Routes the cp_invokeMethod_Solaris_NFSMount calls to the
* correct Solaris_NFSMount methods.
*
* Parameters:
* - CCIMObjectPath *pOP - The object path containing needed information
* about the class that is to getting methods invoked.
* - cimchar *functionName - The name of the function to be invoked.
* - CCIMPropertyList *inParams - The input parameters to the function.
* - CCIMPropertyList *outParams - The output parameters from the function.
*
* Returns:
* - A pointer to a property which indicates success or failure of the
* function. 1 for success, 0 for failure.
* - Upon error, NULL is returned and the error is logged.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_NFSMOUNT::INVOKE_METHOD",
return ((CCIMProperty *)NULL);
}
cim_logDebug("cp_invokeMethod_Solaris_NFSMount",
"Invoking %s", functionName);
/*
* Determine what method is being called.
*/
} else {
/*
* No such method name.
*/
util_handleError("SOLARIS_NFSMOUNT::INVOKE_METHOD",
return ((CCIMProperty *)NULL);
}
return (retVal);
} /* cp_invokeMethod_Solaris_NFSMount */
/*
* Private Methods
*/
/*
* Method: create_nfsMount_associations
*
* Description: Creates Solaris_NFSMount associations out of the information
* gathered from all the NFS mounts on the host.
*
* Parameters:
* - nfs_mntlist_t *mountList - The list of nfs mounts on the host.
* - int *errp - The error pointer. If an error occurs, this will be a
* non-zero number.
*
* Returns:
* - A pointer to a list of all the Solaris_NFSMount instances on the host.
* - NULL if an error occurred or if there aren't any NFS mounts on the
* host. In the case of an error, the error will be logged.
*/
static CCIMInstanceList *
if (nfsMountInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC",
errp);
return ((CCIMInstanceList *)NULL);
}
/*
* Create the Solaris_NFSMount instance and add the properties
* to the instance.
*/
if (nfsMountInst == NULL) {
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC",
return ((CCIMInstanceList *)NULL);
}
if (nfsMountPropList == NULL) {
/*
* An error was encountered, but it was logged in
* populate_property_list so just return null.
*/
return ((CCIMInstanceList *)NULL);
}
/*
* Add the returned property list to the instance.
*/
if (nfsMountInst == NULL) {
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC",
return ((CCIMInstanceList *)NULL);
}
/*
* Add the instance to the instance list.
*/
if (nfsMountInstList == NULL) {
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::CREATE_NFSMOUNT_ASSOC",
/*
* Freeing the instance will free the property list
* that was added to it. There is no need to free
* the property list separately.
*/
return ((CCIMInstanceList *)NULL);
}
}
return (nfsMountInstList);
} /* create_nfsMount_associations */
/*
* Method: enumerate_mounts
*
* Description: Enumerates the NFS mounts on the host by using the
* nfs_mntinfo nfs_get_mount_list method.
*
* Parameters:
* - NONE
*
* Returns:
* - A pointer to a list of all the Solaris_NFSMount instances on the host.
* - NULL if an error occurred or if there are no NFS mounts on the system.
* In the case of an error, the error will be logged.
*/
static CCIMInstanceList *
enumerate_mounts() {
int get_mntlist_err = 0;
int err = 0;
if (nfs_mount_list == NULL) {
/*
* Check whether an error was returned or if we simply don't
* have any nfs file systems on the system. If
* get_mntlist_err is not equal to 0, an error was encountered.
*/
if (get_mntlist_err != 0) {
/*
* Determine the error and log it.
*/
if (get_mntlist_err == ENOMEM ||
get_mntlist_err == EAGAIN) {
"SOLARIS_NFSMOUNT::ENUM_MOUNTS",
return ((CCIMInstanceList *)NULL);
} else {
/*
* If any other errors were encountered it
* can be handled as a general error. We may
* not know exactly what the error is.
*/
"SOLARIS_NFSMOUNT::ENUM_MOUNTS",
return ((CCIMInstanceList *)NULL);
}
}
/*
* We simply don't have any nfs mounts on the host.
*/
return ((CCIMInstanceList *)NULL);
} else {
/*
* At this point, one or more nfs mounts were found on the
* system, create the instance list from the nfs_mount_list.
*/
&err);
return (nfsMountInstList);
} /* if (nfs_mount_list == NULL) */
} /* enumerate_mounts */
/*
* Method: get_Antecedent
*
* Description: Creates the Antecedent object path of the Solaris_NFSMount
* class.
*
* Parameters:
* - cimchar *mount_point - the mount point of the nfs mount which is
* used as the Name Key property of the Antecedent, Solaris_Directory.
*
* Returns:
* - The corresponding Solaris_Directory CCIMObjectPath* is returned.
* - Upon error NULL is returned.
* The returned CCIMObjectPath* must be freed by the calling function.
*/
static CCIMObjectPath *
int err;
char *hostname;
if (solarisDirInst == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::GET_ANT",
return ((CCIMObjectPath *)NULL);
}
/*
* Create the key properties on the Solaris_Directory instance.
*
* The Solaris_Directory keys are as follows:
* CSCreationClassName = "Solaris_ComputerSystem"
* CSName = < hostname >
* FSCreationClassName = "Solaris_NFS"
* FSName = "NFS"
* CreationClassName = "Solaris_Directory"
* Name = < full pathname of mount point >
*/
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
if (solarisDirOP == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::GET_ANT",
return ((CCIMObjectPath *)NULL);
}
return (solarisDirOP);
} /* get_Antecedent */
/*
* Method: get_associated_instances
*
* Description: Gets instances associated to the mounts passed in with
* mountList.
*
* Parameters:
* - nfs_mntlist_t *mountList - The nfs mount list from which to get the
* associated instances.
* - boolean_t resultIsAnt - Whether or not the role that the instance
* returned plays in the association is the Antecedent.
*
* Returns:
* - A pointer to a list of Solaris_NFS or Solaris_Directory instances that
* are associated to the mount passed in with mountList.
* - NULL if an error occurred or if there are no instances that are
* associated to mountList.
*/
static CCIMInstanceList *
int err = 0;
if (returnInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::GET_ASSOC_INST",
return ((CCIMInstanceList *)NULL);
}
/*
* Determine if we are supposed to form the Antecedent or
* Dependent instances by checking the value of resultIsAnt.
*/
if (resultIsAnt == B_FALSE) {
/*
* An error occurred in get_Dependent and was
* handled there so just return NULL.
*/
return ((CCIMInstanceList *)NULL);
}
/*
* A NULL return value indicates an error, an empty
* list does not.
*/
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::GET_ASSOC_INST",
return ((CCIMInstanceList *)NULL);
}
return ((CCIMInstanceList *)NULL);
}
/*
* Add the Solaris_NFS instance to the instance
* list to be returned.
*/
nfsInst);
if (returnInstList == NULL) {
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::GET_ASSOC_INST",
return ((CCIMInstanceList *)NULL);
}
} else {
/*
* An error occurred in get_Antecedent and was
* handled there so just return NULL.
*/
return ((CCIMInstanceList *)NULL);
}
cim_logDebug("get_associated_instances",
/*
* A NULL return value means error, an empty list
* does not.
*/
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::GET_ASSOC_INST",
return ((CCIMInstanceList *)NULL);
}
return ((CCIMInstanceList *)NULL);
}
/*
* Work around for cimom bug 4649100.
*/
if (!set_dir_keyProperties_to_true(dirInst)) {
return ((CCIMInstanceList *)NULL);
}
/*
* Add the Solaris_Directory instance to the
* instance list to be returned.
*/
dirInst);
if (returnInstList == NULL) {
ex = cim_getLastError();
"SOLARIS_NFSMOUNT::GET_ASSOC_INST",
return ((CCIMInstanceList *)NULL);
}
}
}
return (returnInstList);
} /* get_associated_instances */
/*
* Method: get_associated_nfs_mntlist
*
* Description: Gets a list of mounts, including their information, that have
* the same value as nameKeyValue for the Name property.
*
* Parameters:
* - boolean_t isAntecedent - A boolean value representing whether the
* key value passed in with nameKeyVal is the Antecedent or not.
* - char *nameKeyVal - The value of the Name key.
*
* Returns:
* - A pointer to a list of nfs mounts.
* - NULL if an error occurred or if there are no mounts having the same
* information as passed in with nameKeyVal.
*/
static nfs_mntlist_t *
int err = 0;
if (isAntecedent) {
/*
* The nameKeyValue is that of the Antecedent,
* Solaris_Directory.
*/
/*
* The Name property is populated with the mount point of the
* nfs file system so we need to determine if the mount point
* exists.
*/
/*
* Check if an error occurred and if it did handle it.
*/
if (err != 0) {
"SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS",
return (NULL);
}
/*
* If no error occurred then we know that the mount
* point doesn't exist so return NULL.
*/
return (NULL);
}
} else {
char *resource;
char *devid;
char *devMntOpt = "dev=";
char *searchOpt;
int searchOptLen;
/*
* The nameKeyValue is that of the Dependent, Solaris_NFS.
*/
/*
* Get the resource and devid from the Name key property
* which should be in the form:
* "resource:=< resource > devid:=< devid >"
*/
err = 0;
"SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS",
return (NULL);
}
cim_logDebug("get_associated_nfs_mntlist",
"isDependent: devid =%s", devid);
err = 0;
"SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS",
&err);
return (NULL);
}
cim_logDebug("get_associated_nfs_mntlist",
"isDependent: resource =%s", resource);
/*
* The devid is unique per file system so we will search for
* the mount that has the corresponding devid. Obviously,
* we only expect to get one file system.
*/
(size_t)sizeof (char));
/*
* Out of memory
*/
return (NULL);
}
cim_logDebug("get_associated_nfs_mntlist",
"isDependent: searchOpt =%s", searchOpt);
if (err != 0) {
"SOLARIS_NFSMOUNT::GET_ASSOC_NFSMNTS",
return (NULL);
}
return (NULL);
}
/*
* Check that the resource from the pObjectName is the same as
* the one in the mountList. If it is not, return null.
*/
return (NULL);
}
}
return (mountList);
} /* get_associated_nfs_mntlist */
/*
* Method: get_Dependent
*
* Description: Creates the Dependent object path of the Solaris_NFSMount class
*
* Parameters:
* - nfs_mntlist_t *nfs_mount - The nfs mount to be used for filling in
* the properties of the Dependent, Solaris_NFS.
*
* Returns:
* - A Solaris_NFS CCIMObjectPath* is returned.
* - Upon error, NULL is returned.
*/
static CCIMObjectPath *
char *name_val;
char *devid;
char *resourceStr = "resource:=";
char *devidStr = "devid:=";
char *hostname;
int err = 0;
int name_val_len;
if (solarisNFSInst == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::GET_DEP",
return (NULL);
}
/*
* Create the key properties on the Solaris_NFS instance.
*
* The Solaris_Directory keys are as follows:
* CSCreationClassName = "Solaris_ComputerSystem"
* CSName = < hostname >
* CreationClassName = "Solaris_NFS"
* Name = resource:=< resource > devid:= < devid >
*/
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
solarisNFSInst) == cim_false) {
return ((CCIMObjectPath *)NULL);
}
return ((CCIMObjectPath *)NULL);
}
err = 0;
util_handleError("SOLARIS_NFSMOUNT::GET_DEP",
return ((CCIMObjectPath *)NULL);
}
(size_t)(sizeof (char)));
util_handleError("SOLARIS_NFSMOUNT::GET_DEP",
return ((CCIMObjectPath *)NULL);
}
}
return ((CCIMObjectPath *)NULL);
}
if (solarisNFSOp == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::GET_DEP",
return (NULL);
}
return (solarisNFSOp);
} /* get_Dependent */
/*
* Method: get_devid
*
* Description:
* Parses the Solaris_NFS.Name key property, which is in the
* "resource:=<resource> devid:=<devid>" format, for the devid.
*
* Parameters:
* - char *keyValue - The string which is in the
* "resource:=<resource> devid:=<devid>" format to parse the devid from.
* - int *errp - The error pointer. This will be set to a non-zero number
* if an error is encountered.
*
* Returns:
* - A pointer to a string which is the value of the devid.
* - NULL if the devid is not found or if an error occurred. In the case
* of an error, errp will be set to a non-zero number.
*
* NOTE:
* The caller must free the memory allocated for the return string.
*/
char *
char *devidMarker = "devid:=";
char *devidMarkerStart;
char *devidStart;
char *devid;
if (devidMarkerStart == NULL) {
return (NULL);
}
return (NULL);
}
return (devid);
} /* get_devid */
/*
* Method: get_resource
*
* Description:
* Parses the Solaris_NFS.Name key property, which is in the
* "resource:=<resource> devid:=<devid>" format, for the resource.
*
* Parameters:
* - char *keyValue - The string which is in the
* "resource:=<resource> devid:=<devid>" format to parse the resource from.
* - int *errp - The error pointer. This will be set to a non-zero number
* if an error is encountered.
*
* Returns:
* - A pointer to a string which is the value of the resource.
* - NULL if the resource is not for or if an error occurred. In the case
* of an error, errp will be set to a non-zero number.
* NOTE:
* The caller must free the memory allocated for the return string.
*/
static char *
char *devid;
char *devidStr = "devid:=";
char *resource;
char *resourceStr = "resource:=";
resourceStrLen = 0, i = 0;
int err = 0;
/*
* First we need to get the devid string portion of the Solaris_NFS.Name
* key value in order to figure out how long that portion is.
*/
return (NULL);
}
/*
* The length of the space character between the resource and devid
* is not taken out here for the fact that we will use that space in
* order to allocate enough space for the null terminating character.
*/
return (NULL);
}
for (i = 0; i < (resourceLen - 1); i++) {
}
/*
* Make sure to put the null terminating character at the end.
*/
return (resource);
} /* get_resource */
/*
* Method: populate_property_list
*
* Description: Populates all the properties of the passed in mount into a
* property list.
*
* Parameters:
* - nfs_mntlist_t *nfs_mount - The nfs mount to retrieve the properties
* from.
*
* Returns:
* - A pointer to a list of properties that correspond to the properties of
* nfs_mount.
* - Upon error, NULL is returned and the error is logged.
*/
static CCIMPropertyList *
int i = 0;
int err = 0;
if (nfsMountPropList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFSMOUNT::POPULATE_PROPLIST",
return ((CCIMPropertyList *)NULL);
}
/*
* Create the CCIMProperties for this instance
*/
/*
* Antecedent
*/
return ((CCIMPropertyList *)NULL);
}
/*
* Dependent
*/
return ((CCIMPropertyList *)NULL);
}
if (propValues == NULL) {
util_handleError("SOLARIS_NFSMOUNT::POPULATE_PROPLIST",
return ((CCIMPropertyList *)NULL);
}
return ((CCIMPropertyList *)NULL);
}
for (i = 0; i < PROPCOUNT; i++) {
continue;
}
if (nfsMountPropList == NULL) {
return ((CCIMPropertyList *)NULL);
}
}
return (nfsMountPropList);
} /* populate_property_list */
static CIMBool
cimchar **propValues) {
int defaultValue = 0;
int err = 0;
/*
* AttributeCaching
*/
return (cim_false);
}
/*
* AttributeCachingForDirectoriesMax
*/
return (cim_false);
}
/*
* AttributeCachingForDirectoriesMin
*/
return (cim_false);
}
/*
* AttributeCachingForRegularFilesMax
*/
return (cim_false);
}
/*
* AttributeCachingForRegularFilesMin
*/
return (cim_false);
}
/*
* EnableQuotaChecking
*/
if (enableQuota == NULL) {
return (cim_false);
}
return (cim_false);
}
/*
* FailoverList
*/
if (failoverList == NULL) {
return (cim_false);
}
return (cim_false);
}
/*
* ForceDirectIO
*/
return (cim_false);
}
/*
* FsType
*/
return (cim_false);
}
/*
* GroupId
*/
return (cim_false);
}
/*
* HardMount
*/
return (cim_false);
}
/*
* Interrupt
*/
return (cim_false);
}
/*
* MaxRetransmissionAttempts
*/
return (cim_false);
}
/*
* MountAtBootEntry - Deprecated
*/
err = 0;
/*
* The space allocated for the value returned by
* fs_get_filtered_mount_defaults is freed later in this function
* because it is needed to set the value of the VfstabEntry property.
*/
if (vfstab_entry == NULL) {
if (err != 0) {
util_handleError("SOLARIS_NFSMOUNT::POPULATE_PROPLIST",
&err);
return (cim_false);
}
} else {
/*
* The possible values in the mount at boot field are "yes",
* "no" and "-". The "-" character, although it is not likely
* to be used, will be interpretted as the mount is to not be
* mounted at boot. "-" is used when a field does not apply to
* the resource being mounted.
*/
B_TRUE);
} else {
B_FALSE);
}
}
return (cim_false);
}
/*
* MountOptions
*/
return (cim_false);
}
/*
* MountFailureRetries - This value is only valid upon creation of an
* instance of Solaris_NFSMount. This is actually a mount _process_
* option and not a mount option.
*/
/*
* NoCloseToOpenConsistency
*/
return (cim_false);
}
/*
* NoMnttabEntry - This will always be false for every nfs mount that
* programatically determine a file system that is mounted if it is not
* reason and is also an argument for not showing the existense of
* those file systems.
*/
return (cim_false);
}
/*
* NoSuid
*/
return (cim_false);
}
return (cim_false);
}
/*
* Overlay - This is a property which is only valid upon creation of a
* Solaris_NFSMount instance. It specifies that the file system to be
* mounted should be mounted on top of another existing mounted file
* system.
*/
/*
* Overlayed
*/
/*
* We must do some magic here with determining an overlayed file system.
* We must check for mounts with the same mount point and determine
* which is further down in the mnttab list to determine the top most
* file system. This is all done in the fs_mounts interface.
*/
return (cim_false);
}
/*
* Posix
*/
return (cim_false);
}
return (cim_false);
}
/*
* Protocol
*/
return (cim_false);
}
/*
* Public
*/
return (cim_false);
}
return (cim_false);
}
/*
* ReadBufferSize
*/
return (cim_false);
}
/*
* ReadOnly
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* ReplicatedResources - Deprecated.
*/
/*
* This is the same as the FailoverList so we can use the value used
* to create that property (failoverList).
*/
return (cim_false);
}
/*
* RetransmissionTimeout
*/
return (cim_false);
}
/*
* RetryInForeground - This value is only valid upon creation of an
* instance of Solaris_NFSMount. This is actually a mount _process_
* option and not a mount option.
*/
/*
* SecurityMode
*/
} else {
}
return (cim_false);
}
}
/*
* ServerCommunicationPort
*/
return (cim_false);
}
return (cim_false);
}
/*
* ServerName
*/
return (cim_false);
}
/*
* ServerPath
*/
return (cim_false);
}
/*
* Version
*/
return (cim_false);
}
/*
* VfstabEntry
*/
/*
* The vfstab_entry variable is retrieved from the
* fs_get_filtered_mount_defaults call when populating the
* MountAtBootEntry property.
*/
if (vfstab_entry == NULL) {
} else {
}
return (cim_false);
}
/*
* WriteBufferSize
*/
return (cim_false);
}
/*
* Xattr
*/
return (cim_false);
}
return (cim_true);
} /* populate_property_values */