SDOCM00115428 Incorrect return status from NameServer_delete
authorRamsey Harris <ramsey@ti.com>
Thu, 26 Mar 2015 23:36:28 +0000 (16:36 -0700)
committerRobert Tivy <rtivy@ti.com>
Fri, 27 Mar 2015 22:27:13 +0000 (15:27 -0700)
Fix incorrect union references in both LAD command loop and
client API unmarshal code. Verified all references to 'status'.

linux/include/_lad.h
linux/src/api/NameServer.c
linux/src/daemon/lad.c

index 47684eabfabc178397b58ab9d18a43fc9f2a2891..166b9ce76adf69b98f63f7334e1a223dc8e6f77b 100644 (file)
@@ -200,7 +200,7 @@ struct LAD_CommandObj {
         } create;
         struct {
             NameServer_Handle handle;
-        } delete;
+        } nsdelete;
         struct {
             NameServer_Handle handle;
             Char name[LAD_MAXENTRYNAMELEN];
@@ -289,7 +289,7 @@ union LAD_ResponseObj {
     struct {
        Int status;
        NameServer_Handle handle;
-    } delete;
+    } nsdelete;
     struct {
        Int status;
        NameServer_Handle nameServerHandle;
index 4f0d6867da304d923d321e66fb313d948d32724d..73b43c266182335f37d1a99e91a2162cd2071c66 100644 (file)
@@ -312,7 +312,7 @@ Int NameServer_get(NameServer_Handle nsHandle, String name, Ptr buf,
         memcpy(buf, rsp.get.buf, *len);
     }
 
-    status = rsp.status;
+    status = rsp.get.status;
 
     PRINTVERBOSE1("NameServer_get: got LAD response for client %d\n",
                    clHandle)
@@ -406,7 +406,7 @@ Int NameServer_getUInt32(NameServer_Handle nsHandle, String name, Ptr buf,
 
     val = (UInt32 *)buf;
     *val = rsp.getUInt32.val;
-    status = rsp.status;
+    status = rsp.getUInt32.status;
 
     PRINTVERBOSE1("NameServer_getUInt32: got LAD response for client %d\n",
                    clHandle)
@@ -605,7 +605,7 @@ Int NameServer_delete(NameServer_Handle *nsHandle)
 
     cmd.cmd = LAD_NAMESERVER_DELETE;
     cmd.clientId = clHandle;
-    cmd.args.delete.handle = *nsHandle;
+    cmd.args.nsdelete.handle = *nsHandle;
 
     if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
         PRINTVERBOSE1(
@@ -619,8 +619,8 @@ Int NameServer_delete(NameServer_Handle *nsHandle)
         return NameServer_E_FAIL;
     }
 
-    *nsHandle = rsp.delete.handle;
-    status = rsp.status;
+    *nsHandle = rsp.nsdelete.handle;
+    status = rsp.nsdelete.status;
 
     PRINTVERBOSE1("NameServer_delete: got LAD response for client %d\n",
                    clHandle)
index 1cbd314253790d53b08a10ec846f19ba54c11db9..2bff2aced0dd04e6d77707b170a309c17ef7890a 100644 (file)
@@ -417,12 +417,13 @@ opencommandFIFO:
             break;
 
           case LAD_NAMESERVER_DELETE:
-            LOG1("LAD_NAMESERVER_DELETE: calling NameServer_delete(%p)...\n", cmd.args.delete.handle)
+            LOG1("LAD_NAMESERVER_DELETE: calling NameServer_delete(%p)...\n",
+                    cmd.args.nsdelete.handle)
 
-            rsp.delete.handle = cmd.args.delete.handle;
-            rsp.delete.status = NameServer_delete(&rsp.delete.handle);
+            rsp.nsdelete.handle = cmd.args.nsdelete.handle;
+            rsp.nsdelete.status = NameServer_delete(&rsp.nsdelete.handle);
 
-            LOG1("    status = %d\n", rsp.status)
+            LOG1("    status = %d\n", rsp.nsdelete.status)
             LOG0("DONE\n")
 
             break;
@@ -445,7 +446,7 @@ opencommandFIFO:
 
           case LAD_NAMESERVER_GET:
             LOG2("LAD_NAMESERVER_GET: calling NameServer_get(%p, '%s'",
-                cmd.args.get.handle, cmd.args.get.name)
+                    cmd.args.get.handle, cmd.args.get.name)
             LOG0(")...\n")
 
             if (cmd.args.get.procId[0] == (UInt16)-1) {
@@ -454,7 +455,7 @@ opencommandFIFO:
             else {
                 procIdPtr = cmd.args.get.procId;
             }
-            rsp.status = NameServer_get(
+            rsp.get.status = NameServer_get(
                 cmd.args.get.handle,
                 cmd.args.get.name,
                 rsp.get.buf,
@@ -463,14 +464,15 @@ opencommandFIFO:
             rsp.get.len = cmd.args.get.len;
 
             LOG1("    value = 0x%x\n", rsp.get.len)
-            LOG1("    status = %d\n", rsp.status)
+            LOG1("    status = %d\n", rsp.get.status)
             LOG0("DONE\n")
 
             break;
 
           case LAD_NAMESERVER_ADDUINT32:
-            LOG1("LAD_NAMESERVER_ADDUINT32: calling NameServer_addUInt32(%p, ", cmd.args.addUInt32.handle)
-            LOG2("'%s', 0x%x)...\n", cmd.args.addUInt32.name, cmd.args.addUInt32.val)
+            LOG3("LAD_NAMESERVER_ADDUINT32: calling NameServer_addUInt32"
+                    "(%p, '%s', 0x%x)...\n", cmd.args.addUInt32.handle,
+                    cmd.args.addUInt32.name, cmd.args.addUInt32.val)
 
             rsp.entryPtr = NameServer_addUInt32(
                 cmd.args.addUInt32.handle,
@@ -483,7 +485,9 @@ opencommandFIFO:
             break;
 
           case LAD_NAMESERVER_GETUINT32:
-            LOG2("LAD_NAMESERVER_GETUINT32: calling NameServer_getUInt32(%p, '%s')...\n", cmd.args.getUInt32.handle, cmd.args.getUInt32.name)
+            LOG2("LAD_NAMESERVER_GETUINT32: calling NameServer_getUInt32"
+                    "(%p, '%s')...\n", cmd.args.getUInt32.handle,
+                    cmd.args.getUInt32.name)
 
             if (cmd.args.getUInt32.procId[0] == (UInt16)-1) {
                 procIdPtr = NULL;
@@ -491,14 +495,14 @@ opencommandFIFO:
             else {
                 procIdPtr = cmd.args.getUInt32.procId;
             }
-            rsp.status = NameServer_getUInt32(
+            rsp.getUInt32.status = NameServer_getUInt32(
                 cmd.args.getUInt32.handle,
                 cmd.args.getUInt32.name,
                 &rsp.getUInt32.val,
                 procIdPtr);
 
             LOG1("    value = 0x%x\n", rsp.getUInt32.val)
-            LOG1("    status = %d\n", rsp.status)
+            LOG1("    status = %d\n", rsp.getUInt32.status)
             LOG0("DONE\n")
 
             break;