summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4912c1b)
raw | patch | inline | side by side (parent: 4912c1b)
author | Justin Sobota <jsobota@ti.com> | |
Wed, 29 Apr 2015 18:25:41 +0000 (14:25 -0400) | ||
committer | Justin Sobota <jsobota@ti.com> | |
Wed, 29 Apr 2015 18:25:41 +0000 (14:25 -0400) |
src/rm.c | patch | blob | history | |
src/rm_allocator.c | patch | blob | history | |
src/rm_nameserver.c | patch | blob | history | |
src/rm_policy.c | patch | blob | history | |
src/rm_transport.c | patch | blob | history |
diff --git a/src/rm.c b/src/rm.c
index f75e5d5f55f76b595ba18c3ce72e487801ad5584..9bc65269bd656ce6dd26c0076ed50cc8aa841cd0 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
case Rm_service_RESOURCE_UNMAP_NAME:
createNsResponsePkt(rmPkt, transaction);
break;
+ default:
+ transaction->state = RM_ERROR_INVALID_SERVICE_TYPE;
+ goto errorExit;
}
if (dstTransport->callouts.rmSendPkt(dstTransport->appTransportHandle, pktHandle) < RM_OK) {
transaction->state = RM_ERROR_TRANSPORT_SEND_ERROR;
case Rm_service_RESOURCE_UNMAP_NAME:
createNsRequestPkt(rmPkt, rmInst->instName, transaction);
break;
+ default:
+ transaction->state = RM_ERROR_INVALID_SERVICE_TYPE;
+ goto errorExit;
}
if (dstTransport->callouts.rmSendPkt(dstTransport->appTransportHandle, pktHandle) < RM_OK) {
@@ -429,8 +435,8 @@ static int32_t cdRequestServerResources(Rm_Inst *rmInst, Rm_Transaction *transac
resourceOffsetInPolicy = rmPolicyGetResourceOffset(policy, transaction->resourceInfo.name);
if (resourceOffsetInPolicy > 0) {
- if (allocSize = rmPolicyGetResourceCdAllocSize(policy, resourceOffsetInPolicy)) {
- if (newTrans = rmTransactionQueueAdd(rmInst)) {
+ if ((allocSize = rmPolicyGetResourceCdAllocSize(policy, resourceOffsetInPolicy))) {
+ if ((newTrans = rmTransactionQueueAdd(rmInst))) {
newTrans->type = transaction->type;
rm_strncpy(newTrans->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
newTrans->state = RM_SERVICE_PROCESSING;
@@ -448,8 +454,8 @@ static int32_t cdRequestServerResources(Rm_Inst *rmInst, Rm_Transaction *transac
retVal = RM_SERVICE_PENDING_SERVER_RESPONSE;
}
else {
- retVal = RM_ERROR_TRANS_REQ_TO_SERVER_NOT_CREATED;
- }
+ retVal = RM_ERROR_TRANS_REQ_TO_SERVER_NOT_CREATED;
+ }
}
else {
/* Forward request to Server for completion if policy has
@@ -482,10 +488,10 @@ static int32_t cdFreeResourcesToServer(Rm_Inst *rmInst, Rm_Transaction *transact
* so create transaction to Server to free localized resource node */
if (rmAllocatorGetNodeLocalization((Rm_Handle)rmInst, transaction->resourceInfo.name,
&baseToFree, &lenToFree)) {
- if (newTrans = rmTransactionQueueAdd(rmInst)) {
+ if ((newTrans = rmTransactionQueueAdd(rmInst))) {
newTrans->type = transaction->type;
rm_strncpy(newTrans->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
- newTrans->state = RM_SERVICE_PROCESSING;
+ newTrans->state = RM_SERVICE_PROCESSING;
rm_strncpy(newTrans->resourceInfo.name, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);
newTrans->resourceInfo.base = baseToFree;
newTrans->resourceInfo.length = lenToFree;
else if ((transaction->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
(transaction->type == Rm_service_RESOURCE_ALLOCATE_USE)) {
/* Add resources provided by Server to those managed by CD */
- if (allocator = rmAllocatorFind((Rm_Handle)rmInst, transaction->resourceInfo.name)) {
+ if ((allocator = rmAllocatorFind((Rm_Handle)rmInst, transaction->resourceInfo.name))) {
Rm_ResourceNode *treeNode = NULL;
treeNode = rmResourceNodeNew(transaction->resourceInfo.base, transaction->resourceInfo.length);
(strlen(transaction->resourceInfo.nameServerName) > 0)) {
/* Create and forward new transaction to Server to
* retrieve resource data mapped to name */
- if (newTrans = rmTransactionQueueAdd(rmInst)) {
+ if ((newTrans = rmTransactionQueueAdd(rmInst))) {
newTrans->type = Rm_service_RESOURCE_GET_BY_NAME;
rm_strncpy(newTrans->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
newTrans->state = RM_SERVICE_PROCESSING;
*/
static void serverProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
{
- Rm_NameServerObjCfg nameServerObjCfg;
+ Rm_NameServerObjCfg nameServerObjCfg;
switch (transaction->type) {
case Rm_service_RESOURCE_STATUS:
case Rm_service_RESOURCE_ALLOCATE_USE:
allocationHandler(rmInst, transaction);
break;
- case Rm_service_RESOURCE_FREE:
+ case Rm_service_RESOURCE_FREE:
freeHandler(rmInst, transaction);
break;
case Rm_service_RESOURCE_MAP_TO_NAME:
case Rm_service_RESOURCE_GET_BY_NAME:
- case Rm_service_RESOURCE_UNMAP_NAME:
+ case Rm_service_RESOURCE_UNMAP_NAME:
if (rmInst->u.server.nameServer) {
if (rmInst->instType == Rm_instType_SHARED_SERVER) {
rmNameServerTreeInv(rmInst->u.server.nameServer);
transaction->state = RM_ERROR_NAMESERVER_DOES_NOT_EXIST;
}
break;
+ default:
+ transaction->state = RM_ERROR_INVALID_SERVICE_TYPE;
+ break;
}
/* Source of shared server transaction will always be local. */
diff --git a/src/rm_allocator.c b/src/rm_allocator.c
index 7a7303dcc3dff594bb79743b562d615b78bc663f..77fca9f08bfd210aa7c3e8761cae85f5851197e5 100644 (file)
--- a/src/rm_allocator.c
+++ b/src/rm_allocator.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2015, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -603,7 +603,7 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
}
else {
/* Matching node allocated, move to next node */
- if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
+ if ((nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode))) {
findNode.base = nextNode->base;
}
else {
diff --git a/src/rm_nameserver.c b/src/rm_nameserver.c
index 9fa8d3b8abdbc6c39e9473b817c41c7537153065..d51cc2999ad211674a7077a9275972eed952a168 100644 (file)
--- a/src/rm_nameserver.c
+++ b/src/rm_nameserver.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2015, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
{
Rm_NameServerNode *newNode = NULL;
int32_t retVal = RM_SERVICE_APPROVED;
-
- if (newNode = rmNameServerNodeNew(&objCfg->nodeCfg)) {
+
+ if ((newNode = rmNameServerNodeNew(&objCfg->nodeCfg))) {
if (RB_INSERT(_Rm_NameServerTree, objCfg->nameServerTree, newNode)) {
/* Collision */
rmNameServerNodeFree(newNode);
else {
retVal = RM_ERROR_NAMESERVER_NAME_ADD_FAILED;
}
-
+
return(retVal);
}
memset((void *)&findNode, 0, sizeof(Rm_NameServerNode));
rm_strncpy(findNode.objName, objCfg->nodeCfg.objName, RM_NAME_MAX_CHARS);
- if (matchingNode = RB_FIND(_Rm_NameServerTree, objCfg->nameServerTree, &findNode)) {
+ if ((matchingNode = RB_FIND(_Rm_NameServerTree, objCfg->nameServerTree,
+ &findNode))) {
/* Found in NameServer */
objCfg->nodeCfg.resourceName = matchingNode->resourceName;
objCfg->nodeCfg.resourceBase = matchingNode->resourceBase;
memset((void *)&findNode, 0, sizeof(Rm_NameServerNode));
rm_strncpy(findNode.objName, objCfg->nodeCfg.objName, RM_NAME_MAX_CHARS);
- if (matchingNode = RB_FIND(_Rm_NameServerTree, objCfg->nameServerTree, &findNode)) {
+ if ((matchingNode = RB_FIND(_Rm_NameServerTree, objCfg->nameServerTree,
+ &findNode))) {
/* Remove from NameServer */
RB_REMOVE(_Rm_NameServerTree, objCfg->nameServerTree, matchingNode);
rmNameServerNodeFree(matchingNode);
diff --git a/src/rm_policy.c b/src/rm_policy.c
index bef56965848d97c520c3e152198e4787e2d49114..7d53195ee03b6ff7a4ed7733ae2d241cfb131210 100644 (file)
--- a/src/rm_policy.c
+++ b/src/rm_policy.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2015, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
return(result);
}
- if (result = policyCheckInstances(rmHandle, permissionList) != RM_OK) {
+ if ((result = policyCheckInstances(rmHandle, permissionList)) !=
+ RM_OK) {
policyFreeAssignmentPermissions(permissionList);
return(result);
}
diff --git a/src/rm_transport.c b/src/rm_transport.c
index 6c1847ead2da587de17baf72e82674b08bd27e13..c105a143a989ab87a19c39e05c8fdfc1cb641785 100644 (file)
--- a/src/rm_transport.c
+++ b/src/rm_transport.c
*\r
* \par\r
* ============================================================================\r
- * @n (C) Copyright 2012-2014, Texas Instruments, Inc.\r
+ * @n (C) Copyright 2012-2015, Texas Instruments, Inc.\r
* \r
* Redistribution and use in source and binary forms, with or without \r
* modification, are permitted provided that the following conditions \r
@@ -446,7 +446,7 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
{\r
Rm_ResourceResponsePkt *resourceRespPkt = (Rm_ResourceResponsePkt *)pkt->data;\r
\r
- if (transaction = rmTransactionQueueFind(rmInst,resourceRespPkt->responseId)) {\r
+ if ((transaction = rmTransactionQueueFind(rmInst,resourceRespPkt->responseId))) {\r
if ((transaction->state == RM_SERVICE_APPROVED_STATIC) &&\r
(resourceRespPkt->requestState != RM_SERVICE_APPROVED)) {\r
/* Lock the RM instance since service validated against static policy failed against \r
@@ -500,14 +500,14 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
{\r
Rm_NsResponsePkt *nsResponsePkt = (Rm_NsResponsePkt *)pkt->data;\r
\r
- if (transaction = rmTransactionQueueFind(rmInst, nsResponsePkt->responseId)) {\r
+ if ((transaction = rmTransactionQueueFind(rmInst, nsResponsePkt->responseId))) {\r
if ((transaction->state == RM_SERVICE_APPROVED_STATIC) &&\r
(nsResponsePkt->requestState != RM_SERVICE_APPROVED)) {\r
/* Lock the RM instance since service validated against static policy failed against \r
- * Server's global policy */ \r
+ * Server's global policy */\r
rmInst->isLocked = RM_TRUE;\r
- } \r
- transaction->state = nsResponsePkt->requestState; \r
+ }\r
+ transaction->state = nsResponsePkt->requestState;\r
}\r
else {\r
retVal = RM_ERROR_PKT_RESP_DOES_NOT_MATCH_ANY_REQ;\r