wbem::framework::UINT32
wbem::pmem_config::PersistentMemoryCapabilitiesFactory::getReturnCodeFromLibException(
		exception::NvmExceptionLibError e)
{
	wbem::framework::UINT32 rc = framework::MOF_ERR_SUCCESS;

	switch(e.getLibError())
	{
		case NVM_ERR_UNKNOWN:
			rc = PMCAP_ERR_UNKNOWN;
			break;
		case NVM_ERR_NOTSUPPORTED:
			rc = PMCAP_ERR_NOT_SUPPORTED;
			break;
		case NVM_ERR_INVALIDPARAMETER:
			rc = PMCAP_ERR_INVALID_PARAMETER;
			break;
		case NVM_ERR_NOMEMORY:
			rc = PMCAP_ERR_INSUFFICIENT_RESOURCES;
			break;
		default:
			rc = PMCAP_ERR_FAILED;
			break;
	}

	return rc;
}
wbem::framework::UINT32
wbem::erasure::ErasureServiceFactory::getReturnCodeFromLibException(
		const exception::NvmExceptionLibError &e)
{
	wbem::framework::UINT32 rc;

	switch(e.getLibError())
	{
	case NVM_ERR_INVALIDPERMISSIONS:
	case NVM_ERR_BADPASSPHRASE:
		rc = ERASURESERVICE_ERR_PERMISSION_FAILURE;
		break;
	case NVM_ERR_NOTMANAGEABLE:
	case NVM_ERR_SECURITYFROZEN:
	case NVM_ERR_SECURITYDISABLED:
	case NVM_ERR_LIMITPASSPHRASE:
	case NVM_ERR_DEVICEBUSY:
		rc = ERASURESERVICE_ERR_BAD_STATE;
		break;
	default:
		rc = ERASURESERVICE_ERR_FAILED;
		break;
	}

	return rc;
}
wbem::framework::UINT32
wbem::software::NVDIMMSoftwareInstallationServiceFactory::getReturnCodeFromLibException(
		exception::NvmExceptionLibError e)
{
	wbem::framework::UINT32 rc;

	// these are the errors that nvm_update_device_fw can return
	switch(e.getLibError())
	{
	case NVM_ERR_NOMEMORY:
		rc = SWINSTALLSERVICE_ERR_NOT_ENOUGH_MEMORY;
		break;
	case NVM_ERR_NOTMANAGEABLE:
		rc = SWINSTALLSERVICE_ERR_UNSUPPORTED_TARGET_TYPE;
		break;
	case NVM_ERR_BADDEVICE:
	case NVM_ERR_INVALIDPARAMETER:
		rc = SWINSTALLSERVICE_ERR_INVALID_PARAMETER;
		break;
	case NVM_ERR_BADFILE:
		rc = SWINSTALLSERVICE_ERR_URI_NOT_ACCESSIBLE;
		break;
	case NVM_ERR_REQUIRESFORCE:
		rc = SWINSTALLSERVICE_ERR_DOWNGRADE_NOT_SUPPORTED;
		break;
	case NVM_ERR_BADFIRMWARE:
		rc = SWINSTALLSERVICE_ERR_UNSUPPORTED_VERSION_TRANSITION;
		break;
	case NVM_ERR_UNKNOWN:
		rc = SWINSTALLSERVICE_ERR_UNKNOWN;
		break;
	default:
		rc = SWINSTALLSERVICE_ERR_FAILED;
		break;
	}

	return rc;
}