Solaris_NFS.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_NFS.h"
#include "util.h" /* Error handling */
#include "nfs_provider_names.h"
#include "nfs_providers_msgstrings.h"
#include "messageStrings.h"
#include "libfsmgt.h"
#include "nfsprov_methods.h"
#include "createprop_methods.h"
#include <errno.h>
#include <string.h>
#define GET_DEF_SECMODE_METHOD "getDefaultNfsSecMode"
#define GET_NET_CFG_LIST_METHOD "getNetCfgList"
#define GET_NFS_SEC_LIST_METHOD "getNfsSecList"
#define UNKNOWN "Unknown"
/*
* Private method declarations
*/
static CCIMInstanceList* enumerate_nfs_mounts();
cimchar **propValues);
/*
* Instance provider methods
*/
/*
* Method: cp_createInstance_Solaris_NFS
*
* Description: This method is not supported. A Solaris_NFS instance is only
* created upon the creation of a corresponding NFS mount.
*
* Parameters:
* - CCIMObjectPath *nfsOP - An object path containing the name of
* the class of which to enumerate the instances of.
*
* Returns:
* - Always returns NULL because the method is not supported.
*/
/* ARGSUSED */
CCIMInstance *nfsInst) {
int err = 0;
return ((CCIMObjectPath *)NULL);
} /* cp_createInstance_Solaris_NFS */
/*
* Method: cp_deleteInstance_Solaris_NFS
*
* Description: This method is not supported. A Solaris_NFS instance is
* only deleted upon the deletion of the corresponding NFS mount.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the
* information about the class of which to delete the instance of.
*
* Returns:
* - Always returns cim_false because the method is not supported.
*/
/* ARGSUSED */
int err = 0;
return (cim_false);
} /* cp_deleteInstance_Solaris_NFS */
/*
* Method: cp_enumInstances_Solaris_NFS
*
* Description: Enumerates the instances of Solaris_NFS mount on the host.
*
* Parameters:
* - CCIMObjectPath *nfsOP - An object path containing the name of
* the class of which to enumerate the instances of.
*
* Returns:
* - A pointer to a list of Solaris_NFS instances.
* - NULL if an error occurred or if there aren't any instances of
* Solaris_NFS 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.
*/
util_handleError("SOLARIS_NFS::ENUM_INSTANCES",
return ((CCIMInstanceList *)NULL);
}
/*
* An nfs file system instance is equivalent to a nfs mount on the
* host.
*/
return (instList);
} /* cp_enumInstances_Solaris_NFS */
/*
* Method: cp_enumInstanceNames_Solaris_NFS
*
* Description: Enumerates the object paths of the instances of Solaris_NFS
* on the host.
*
* Parameters:
* - CCIMObjectPath *nfsOP - An object path containing the name of
* the class of which to enumerate the instance names of.
*
* Returns:
* - A pointer to a list of Solaris_NFS object paths.
* - NULL if an error occurred or if there aren't any instances of
* Solaris_NFS on the host. In the case of an error, the error will be
* logged.
*/
int err = 0;
/*
* First check if the object path is null.
*/
util_handleError("SOLARIS_NFS::ENUM_INSTANCENAMES",
return ((CCIMObjectPathList *)NULL);
}
return ((CCIMObjectPathList *)NULL);
}
/*
* If an error occurred in cim_createObjectPathList it will be handled
* there.
*/
return (objPathList);
} /* cp_enumInstanceNames_Solaris_NFS */
/*
* Method: cp_execQuery_Solaris_NFS
*
* Description: Queries the nfs instances on the host to find those that meet
* the search criteria.
*
* Parameters:
* - CCIMObjectPath *nfsOP - An object path containing the name of
* the class of which 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_NFS instances that match the criteria.
* - NULL if an error occurred or if there are no Solaris_NFS 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_NFS::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
if (nfsInstList == NULL) {
return ((CCIMInstanceList *)NULL);
}
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
if (nfsInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::EXEC_QUERY",
return ((CCIMInstanceList *)NULL);
}
return (nfsInstList);
} /* cp_execQuery_Solaris_NFS */
/*
* Method: cp_getInstance_Solaris_NFS
*
* Description: Gets the Solaris_NFS instance that corresponds to the object
* path passed in.
*
* Parameters:
* - CCIMObjectPath *nfsOP - The object path containing all the
* keys of the instance that is supposed to be returned.
*
* Returns:
* - A pointer to an instance of Solaris_NFS which corresponds to the
* object path passed in.
* - NULL if an error occurred or if there is no Solaris_NFS instance
* corresponding to the object path passed in. In the case of an error,
* the error will be logged.
*/
int err = 0;
/*
* First check to see if the object path is null.
*/
util_handleError("SOLARIS_NFS::GET_INSTANCE",
return ((CCIMInstance *)NULL);
}
/*
* Either an error occurred or we simply don't have any
* instances of Solaris_NFS on the system. In the case that
* an error occurred, it will be handled in
* cp_enumInstances_Solaris_NFS.
*/
return ((CCIMInstance *)NULL);
}
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::GET_INSTANCE",
return ((CCIMInstance *)NULL);
}
return (inst);
} /* cp_getInstance_Solaris_NFS */
/*
* Method: cp_setInstance_Solaris_NFS
*
* Description: This method is not supported. This is not allowed because in
* order to change the properties of a Solaris_NFS instance underlying file
* system or file system mount would have to be modified.
*
* Parameters:
* - CCIMObjectPath *pOP - An object path containing the name of the class
* of which to set the instance.
* - CCIMInstance *pInst - Not used.
*
* Returns:
* - Always returns cim_false since the method is not supported.
*/
/* ARGSUSED */
int err = 0;
return (cim_false);
} /* cp_setInstance_Solaris_NFS */
/*
* Method: cp_setInstanceWithList_Solaris_NFS
*
* Description: This method is not supported. This is not allowed because in
* order to change the properties of a Solaris_NFS instance underlying file
* system or file system mount would have to be modified.
*
* Parameters:
* - CCIMObjectPath *nfsOP - The object path containing the name
* of the class of which to set the instance.
* - CCIMInstance *nfsInst - Not used.
* - char **props - Not used.
* - int num_props - Not used.
*
* Returns:
* - Always returns cim_false since the method is not supported.
*/
/* ARGSUSED */
int err = 0;
return (cim_false);
} /* cp_setInstanceWithList_Solaris_NFS */
/*
* Property provider methods
*/
/*
* Method: cp_getProperty_Solaris_NFS
*
* Description: Retrieves the property with the name matching the passed in
* parameter, pPropName, along with the value and descriptive other information.
*
* Parameters:
* - CCIMObjectPath *nfsOP - 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 a the property corresponding to the property name passed
* in with pPropName.
* - NULL if an error occurred or if there is no property corresponding to
* pPropName. In the case of an error, the error will be logged.
*/
int err = 0;
util_handleError("SOLARIS_NFS::GET_PROPERTY",
return ((CCIMProperty *)NULL);
}
return ((CCIMProperty *)NULL);
}
/*
* If an error occurred in cim_getProperty it will be handled there.
*/
return (nfsProp);
} /* cp_getProperty_Solaris_NFS */
/*
* Method: cp_setProperty_Solaris_NFS
*
* Description: This method is not supported. This is not allowed because in
* order to change the properties of a Solaris_NFS instance underlying file
* system or file system mount would have to be modified.
*
* Parameters:
* - CCIMObjectPath *nfsOP - Not used.
* - CCIMProperty *pProp - Not used.
*
* Returns:
* - Always returns cim_false because the method is not supported.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_NFS::SET_PROPERTY",
return (cim_false);
} /* cp_setProperty_Solaris_NFS */
/*
* Method provider methods
*/
/*
* Method: cp_invokeMethod_Solaris_NFS
*
* Description: Routes the cp_invokeMethod_Solaris_NFS calls to the correct
* Solaris_NFS 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 property having a value which indicates success or failure of the
* function. 1 for success, 0 for failure.
* - Upon error, NULL is returned and the error is logged.
*
* NOTE: All methods of Solaris_NFS are deprecated, but are still to be
* supported until they are EOL'd. EOL date is to be determined.
*/
/* ARGSUSED */
int err = 0;
util_handleError("SOLARIS_NFS::INVOKE_METHOD",
return ((CCIMProperty *)NULL);
}
/*
* Determine what method is being called.
*/
} else {
/*
* No such method name.
*/
util_handleError("SOLARIS_NFS::INVOKE_METHOD",
return ((CCIMProperty *)NULL);
}
return (retVal);
} /* cp_invokeMethod_Solaris_NFS */
/*
* Private methods
*/
/*
* Method: enumerate_nfs_mounts
*
* Description: Enumerates all the NFS file systems on the host.
*
* Parameters:
* - NONE
*
* Returns:
* - A pointer to a list of Solaris_NFS instances on the host.
* - NULL if an error occurred or if there aren't any Solaris_NFS
* instances on the host. In the case of an error, the error will be
* logged.
*/
static CCIMInstanceList *
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 err is not
* equal to 0, an error was encountered.
*/
if (err != 0) {
/*
* Determine the error and log it.
*/
util_handleError("SOLARIS_NFS::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.
*/
util_handleError("SOLARIS_NFS::ENUM_MOUNTS",
return ((CCIMInstanceList *)NULL);
}
}
/*
* There are simply no 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.
*/
if (nfsInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::ENUM_MOUNTS",
return ((CCIMInstanceList *)NULL);
}
/*
* Loop through the nfs mounts to retrieve their properties
* and create an instance list containing all the nfs file
* systems and their properties.
*/
/*
* Create the Solaris_NFS CCIMInstance
*/
if (solarisNFSInstance == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::ENUM_MOUNTS",
return ((CCIMInstanceList *)NULL);
}
if (solarisNFSPropList == NULL) {
/*
* An error occurred in populate_property_list
* and was logged there.
*/
return ((CCIMInstanceList *)NULL);
}
if (solarisNFSInstance == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::ENUM_MOUNTS",
&err);
return ((CCIMInstanceList *)NULL);
}
if (nfsInstList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::ENUM_MOUNTS",
/*
* Freeing the instance will also free the
* property list added to the instance.
*/
return ((CCIMInstanceList *)NULL);
}
} /* end for */
return (nfsInstList);
}
} /* enumerate_nfs_mounts */
/*
* Method:populate_property_list
*
* Description: Populates a property list with the properties of the nfs mounted
* file system that is passed in with the nfs_mount parameter.
*
* Parameters:
* - The nfs mount from which to extract the properties from.
*
* Returns:
* - A pointer to a list of properties corresponding to the NFS mounted
* file system passed in with the nfs_mount parameter.
* - Upon error, NULL is returned and an error is logged.
*/
static CCIMPropertyList *
int err = 0, i = 0;
if (nfsPropList == NULL) {
ex = cim_getLastError();
util_handleError("SOLARIS_NFS::POPULATE_PROPLIST",
return ((CCIMPropertyList *)NULL);
}
if (propValues == NULL) {
util_handleError("SOLARIS_NFS::POPULATE_PROPLIST",
return ((CCIMPropertyList *)NULL);
}
return ((CCIMPropertyList *)NULL);
}
for (i = 0; i < PROPCOUNT; i++) {
if (nfsPropList == NULL) {
return ((CCIMPropertyList *)NULL);
}
}
return (nfsPropList);
} /* populate_property_list */
static CIMBool
cimchar **propValues) {
unsigned long long availablesize;
unsigned long long blocksize;
unsigned long long totalsize;
unsigned long long usedsize;
unsigned long maxfilenamelen;
unsigned long fragsize;
unsigned int codeSet[1] = { {0} };
char *hostname;
char *devid;
char *resourceStr = "resource:=";
char *devidStr = "devid:=";
/*
* AttributeCaching
*/
return (cim_false);
}
/*
* AttributeCachingForDirectoriesMax
*/
return (cim_false);
}
/*
* AttributeCachingForDirectoriesMin
*/
return (cim_false);
}
/*
* AttributeCachingForRegularFilesMax
*/
return (cim_false);
}
/*
* AttributeCachingForRegularFilesMin
*/
return (cim_false);
}
/*
* AvailableSpace
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* BlockSize
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* Caption - Nothing top populate here.
*/
/*
* CasePreserved - True
*/
return (cim_false);
}
/*
* CaseSensitive - True
*/
return (cim_false);
}
/*
* ClusterSize - As defined in CIM_FileSystem:
* The minimum file allocation size (an integral number of
* blocks), imposed by the FileSystem. (The size of a block is
* specified in the BlockSize property for the FileSystem.)
* Minimum allocation size is the smallest amount of storage
* allocated to a LogicalFile by the FileSystem. This is not a
* mandatory minimum allocation for all FileSystems. Under
* stress conditions, some FileSystems may allocate storage
* in amounts smaller than the ClusterSize.
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* CodeSet
*/
if (codeSetValue == NULL) {
return (cim_false);
}
return (cim_false);
}
/*
* CompressionMethod
*/
return (cim_false);
}
/*
* CSCreationClassName -- KEY
*/
return (cim_false);
}
/*
* CSName -- KEY
*/
util_handleError("SOLARIS_NFS::POPULATE_PROPVALUES",
return (cim_false);
}
return (cim_false);
}
/*
* CreationClassName -- KEY
*/
return (cim_false);
}
/*
* Description - Nothing to populate here.
*/
/*
* EncryptionMethod
*/
return (cim_false);
}
/*
* FileSystemSize
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* FileSystemType
*/
return (cim_false);
}
/*
* ForegroundMount - This property is not populated because it is only
* valid upon creation of a nfs mounted file system. This is actually
* a mount process option and not a mount option.
*/
/*
* Global - this doesn't really make sense for a nfs file system.
* An nfs file system can't be mounted globally on all nodes of a
* cluster so this will always be false.
*/
return (cim_false);
}
/*
* GrpId
*/
return (cim_false);
}
/*
* HardMount
*/
return (cim_false);
}
/*
* InstallDate - Nothing to populate here.
*/
/*
* Interrupt
*/
return (cim_false);
}
/*
* MaxFileNameLength
*/
if (err != 0) {
util_handleError("SOLARIS_NFS::POPULATE_PROPVALUES",
&err);
return (cim_false);
}
return (cim_false);
}
/*
* MountFailureRetries - This value is only valid upon creation of a
* nfs mount. This is actually a mount process option and not a mount
* option.
*/
/*
* Name -- KEY, Populated with the string:
* "resource:=<resource> devid:=<devid>" in order to create a unique
* yet readable key.
*/
"dev=", &err);
util_handleError("SOLARIS_NFS::POPULATE_PROPVALUES",
return (cim_false);
}
/*
* + 2 is for space and null terminating character.
*/
return (cim_false);
}
/*
* NoMnttabEntry - This will always be false for every file system
* to programatically determine a file system that is mounted if it
* that for a reason and is also an argument for not showing the
* existence 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
* nfs mount. It specifies that the file system is to be mounted on
* top of another existing mounted file system.
*/
/*
* Posix
*/
return (cim_false);
}
return (cim_false);
}
/*
* Proto
*/
return (cim_false);
}
/*
* Public
*/
return (cim_false);
}
return (cim_false);
}
/*
* Quota
*/
return (cim_false);
}
return (cim_false);
}
/*
* ReadBufferSize
*/
return (cim_false);
}
/*
* ReadOnly
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* Remount - This is a property that is only valid upon creation of a
* nfs file system mount. This should not be populated upon the
* enumeration of the Solaris_NFS class instances or instanceNames.
*/
/*
* RetransmissionAttempts
*/
return (cim_false);
}
/*
* RetransmissionTimeout
*/
return (cim_false);
}
/*
* Root
*/
return (cim_false);
}
/*
* SecurityMode
*/
return (cim_false);
}
}
/*
* ServerCommunicationPort
*/
return (cim_false);
}
return (cim_false);
}
/*
* Status - Nothing to populate here.
*/
/*
* UsedSpace
*/
if (err != 0) {
return (cim_false);
}
return (cim_false);
}
/*
* Version
*/
return (cim_false);
}
/*
* WriteBufferSize
*/
return (cim_false);
}
return (cim_true);
} /* populate_property_values */