add xdr_alloc
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 2 Aug 2009 22:59:51 +0000 (18:59 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 6 Aug 2009 12:15:53 +0000 (05:15 -0700)
applications can allocate memory that must be deallocated by
the XDR package.  Add xdr_alloc to permit that.

Export from libafsrpc.

LICENSE BSD

Reviewed-on: http://gerrit.openafs.org/269
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_callback.c
src/libafsrpc/afsrpc.def
src/libafsrpc/afsrpc.exp
src/rx/xdr.c
src/rx/xdr_prototypes.h

index 9da08b8..a488c86 100644 (file)
@@ -1149,7 +1149,7 @@ GetCellCommon(afs_int32 a_cellnum, char **a_name, serverList *a_hosts)
           sn++, serverRefp = serverRefp->next);
 
     a_hosts->serverList_len = sn;
-    a_hosts->serverList_val = (afs_int32 *)osi_Alloc(sn * sizeof(afs_int32));
+    a_hosts->serverList_val = (afs_int32 *)xdr_alloc(sn * sizeof(afs_int32));
 
     for ( sn = 0, serverRefp = cellp->vlServersp; 
           sn < AFSMAXCELLHOSTS && serverRefp;
@@ -1246,7 +1246,7 @@ SRXAFSCB_TellMeAboutYourself( struct rx_call *callp,
     lock_ReleaseRead(&cm_syscfgLock);
 
     dataBytes = 1 * sizeof(afs_uint32);
-    dataBuffP = (afs_uint32 *) osi_Alloc(dataBytes);
+    dataBuffP = (afs_uint32 *) xdr_alloc(dataBytes);
     dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS;
     capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32);
     capabilities->Capabilities_val = dataBuffP;
index 0fe1c64..d721b3a 100755 (executable)
@@ -248,6 +248,7 @@ EXPORTS
         RXAFS_FsCmd                             @253
         rxi_CallError                           @254
         rx_GetLocalPeers                       @255
+        xdr_alloc                               @256
 
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
index 0b19b05..0355bc9 100755 (executable)
@@ -167,3 +167,5 @@ RXAFS_DFSSymlink
 RXAFSCB_function_names
 RXAFS_FsCmd
 rx_GetLocalPeers
+xdr_free
+xdr_alloc
index f11114b..de005d4 100644 (file)
@@ -582,7 +582,13 @@ xdr_wrapstring(XDR * xdrs, char **cpp)
 }
 #endif
 
-void 
+void *
+xdr_alloc(afs_int32 size)
+{
+    return osi_alloc(size);
+}
+
+void
 xdr_free(void *x, afs_int32 size)
 {
     osi_free(x, size);
index a24f928..769fe22 100644 (file)
@@ -58,6 +58,7 @@ extern bool_t xdr_union(XDR * xdrs, enum_t * dscmp, caddr_t unp,
                        struct xdr_discrim *choices, xdrproc_t dfault);
 extern bool_t xdr_string(XDR * xdrs, char **cpp, u_int maxsize);
 extern bool_t xdr_wrapstring(XDR * xdrs, char **cpp);
+extern void * xdr_alloc(afs_int32 size);
 extern void   xdr_free(void *x, afs_int32 size);