Fixed UNSPECIFIED alloc exclusion review feedback
authorJustin Sobota <jsobota@ti.com>
Thu, 2 Jul 2015 15:54:23 +0000 (11:54 -0400)
committerJustin Sobota <jsobota@ti.com>
Thu, 2 Jul 2015 15:54:23 +0000 (11:54 -0400)
include/rm_policyloc.h
src/rm.c
src/rm_allocator.c
src/rm_policy.c

index e1c209b09896b4cdc6bad3829e3de283ee062411..2482b7d131d32ead6e953209f2db55d681b8f581 100644 (file)
@@ -113,7 +113,7 @@ typedef struct {
     /* Negative check:
      * RM_FALSE (0) - Check if passes policy
      * RM_TRUE  (1) - Check if fails policy */
-    uint32_t                neg;
+    uint32_t                negCheck;
     /* Resource's policy tree used to validate permissions */
     Rm_PolicyTree          *polTree;
     /* Valid instance node having its permissions checked for the resource */
index b6ba7aaf5eb4134942c384d677ef825ea63b030d..6caf08b85a7abbfffbf3dad0d7b9e353aa468853 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -460,7 +460,7 @@ static void staticAllocationHandler(Rm_Handle rmHandle,
             } else {
                 privCheckCfg.type = Rm_policyCheck_USE;
             }
-            privCheckCfg.neg            = RM_FALSE;
+            privCheckCfg.negCheck       = RM_FALSE;
             privCheckCfg.validInstNode  = rmPolicyGetValidInstNode(rmHandle,
                                                               rmInst->instName);
             privCheckCfg.polTree        = allocNode->policyRoot;
index 83ffa3dda2238c1c22bfbba5891de2900a52b969..e803b65c4eb0a1113882ade56aa0cd7455d031fd 100644 (file)
@@ -508,7 +508,7 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle,
                 /* Attempt to preallocate from node only if not owned by anyone
                  * and sits within a matching node. */
                 policyCheckCfg.type           = policyCheckType;
-                policyCheckCfg.neg            = RM_FALSE;
+                policyCheckCfg.negCheck       = RM_FALSE;
                 policyCheckCfg.validInstNode  = opInfo->serviceInstNode;
                 policyCheckCfg.resourceBase   = findNode.base;
                 policyCheckCfg.resourceLength = findNode.length;
@@ -516,8 +516,8 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle,
 
                 if (nodePassesPolicy) {
                     /* Is range excluded from UNSPECIFIED allocations? */
-                    policyCheckCfg.type = Rm_policyCheck_UNSPEC_EXCLUSION;
-                    policyCheckCfg.neg  = RM_TRUE;
+                    policyCheckCfg.type     = Rm_policyCheck_UNSPEC_EXCLUSION;
+                    policyCheckCfg.negCheck = RM_TRUE;
                     nodePassesPolicy = rmPolicyCheckPrivilege(&policyCheckCfg);
                 }
 
@@ -627,7 +627,7 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle,
                 allocPassesPolicy = RM_TRUE;
             } else {
                 checkCfg.type           = policyCheckType;
-                checkCfg.neg            = RM_FALSE;
+                checkCfg.negCheck       = RM_FALSE;
                 checkCfg.polTree        = allocator->policyRoot;
                 checkCfg.validInstNode  = opInfo->serviceInstNode;
                 checkCfg.resourceBase   = findNode.base;
@@ -650,8 +650,8 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle,
                             /* Check if instance requesting resource has
                              * privileges to share a resource already reserved
                              * by Linux */
-                            checkCfg.type = Rm_policyCheck_SHARED_LINUX;
-                            checkCfg.neg = RM_FALSE;
+                            checkCfg.type          = Rm_policyCheck_SHARED_LINUX;
+                            checkCfg.negCheck      = RM_FALSE;
                             checkCfg.validInstNode = opInfo->serviceInstNode;
                             allocPassesPolicy = rmPolicyCheckPrivilege(&checkCfg);
                             if (!allocPassesPolicy) {
@@ -663,8 +663,8 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle,
                              * requesting resource.  Requesting instance with
                              * exclusive privileges can't reserve resource if
                              * already owned*/
-                            checkCfg.type = Rm_policyCheck_EXCLUSIVE;
-                            checkCfg.neg = RM_TRUE;
+                            checkCfg.type          = Rm_policyCheck_EXCLUSIVE;
+                            checkCfg.negCheck      = RM_TRUE;
                             checkCfg.validInstNode = opInfo->serviceInstNode;
                             allocPassesPolicy = rmPolicyCheckPrivilege(&checkCfg);
                             if (!allocPassesPolicy) {
@@ -676,8 +676,8 @@ static int32_t allocatorAllocate(Rm_Handle rmHandle,
                         (matchingNode->allocationCount == 1)) {
                         /* Check exclusive privileges of instance that
                          * currently owns resource */
-                        checkCfg.type = Rm_policyCheck_EXCLUSIVE;
-                        checkCfg.neg = RM_TRUE;
+                        checkCfg.type          = Rm_policyCheck_EXCLUSIVE;
+                        checkCfg.negCheck      = RM_TRUE;
                         checkCfg.validInstNode = matchingNode->ownerList->instNameNode;
                         allocPassesPolicy = rmPolicyCheckPrivilege(&checkCfg);
                         if (!allocPassesPolicy) {
index 2f0700581ab101c38addf3da4c6c3c31fc063e62..92d55d08f026c80da75b94a982319d4584d3e890 100644 (file)
@@ -716,7 +716,7 @@ int32_t rmPolicyCheckPrivilege(Rm_PolicyCheckCfg *privilegeCfg)
      * spans.  Assume approved until denial found */
     isApproved = RM_TRUE;
     while (matchNode) {
-        if (privilegeCfg->neg) {
+        if (privilegeCfg->negCheck) {
             /* Not approved if any matching node is assigned an exclusion
              * permission */
             if ((RM_policy_PERM_GET(matchNode->perms, globPermIdx,