[openib-general] [PATCH] OpenSM/complib: Restore cl_mem* routines as deprecated rather than removing them altogether
Hal Rosenstock
halr at voltaire.com
Tue May 23 09:03:16 PDT 2006
OpenSM/complib: Restore cl_mem* routines as deprecated rather than
removing them altogether
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Note: If this approach is acceptable, I will be doing the same with
cl_malloc, cl_zalloc, cl_free, and friends.
Index: include/complib/cl_memory.h
===================================================================
--- include/complib/cl_memory.h (revision 7432)
+++ include/complib/cl_memory.h (working copy)
@@ -436,7 +436,7 @@ cl_malloc(
* environments.
*
* SEE ALSO
-* Memory Management, cl_free, cl_zalloc
+* Memory Management, cl_free, cl_zalloc, cl_memset, cl_memclr, cl_memcpy, cl_memcmp
**********/
@@ -467,7 +467,7 @@ cl_zalloc(
* environments.
*
* SEE ALSO
-* Memory Management, cl_free, cl_malloc
+* Memory Management, cl_free, cl_malloc, cl_memset, cl_memclr, cl_memcpy, cl_memcmp
**********/
@@ -502,6 +502,142 @@ cl_free(
**********/
+/****f* Public: Memory Management/cl_memset
+* NAME
+* cl_memset
+*
+* DESCRIPTION
+* The cl_memset function sets every byte in a memory range to a given value.
+*
+* SYNOPSIS
+*/
+void __attribute__((deprecated))
+cl_memset(
+ IN void* const p_memory,
+ IN const uint8_t fill,
+ IN const size_t count );
+/*
+* PARAMETERS
+* p_memory
+* [in] Pointer to a memory block.
+*
+* fill
+* [in] Byte value with which to fill the memory.
+*
+* count
+* [in] Number of bytes to set.
+*
+* RETURN VALUE
+* This function does not return a value.
+*
+* SEE ALSO
+* Memory Management, cl_memclr, cl_memcpy, cl_memcmp
+**********/
+
+
+/****f* Public: Memory Management/cl_memclr
+* NAME
+* cl_memclr
+*
+* DESCRIPTION
+* The cl_memclr function sets every byte in a memory range to zero.
+*
+* SYNOPSIS
+*/
+static inline void __attribute__((deprecated))
+cl_memclr(
+ IN void* const p_memory,
+ IN const size_t count )
+{
+ memset( p_memory, 0, count );
+}
+/*
+* PARAMETERS
+* p_memory
+* [in] Pointer to a memory block.
+*
+* count
+* [in] Number of bytes to set.
+*
+* RETURN VALUE
+* This function does not return a value.
+*
+* SEE ALSO
+* Memory Management, cl_memset, cl_memcpy, cl_memcmp
+**********/
+
+
+/****f* Public: Memory Management/cl_memcpy
+* NAME
+* cl_memcpy
+*
+* DESCRIPTION
+* The cl_memcpy function copies a given number of bytes from
+* one buffer to another.
+*
+* SYNOPSIS
+*/
+void __attribute__((deprecated)) *
+cl_memcpy(
+ IN void* const p_dest,
+ IN const void* const p_src,
+ IN const size_t count );
+/*
+* PARAMETERS
+* p_dest
+* [in] Pointer to the buffer being copied to.
+*
+* p_src
+* [in] Pointer to the buffer being copied from.
+*
+* count
+* [in] Number of bytes to copy from the source buffer to the
+* destination buffer.
+*
+* RETURN VALUE
+* This function does not return a value.
+*
+* SEE ALSO
+* Memory Management, cl_memset, cl_memclr, cl_memcmp
+**********/
+
+
+/****f* Public: Memory Management/cl_memcmp
+* NAME
+* cl_memcmp
+*
+* DESCRIPTION
+* The cl_memcmp function compares two memory buffers.
+*
+* SYNOPSIS
+*/
+int32_t __attribute__((deprecated))
+cl_memcmp(
+ IN const void* const p_mem,
+ IN const void* const p_ref,
+ IN const size_t count );
+/*
+* PARAMETERS
+* p_mem
+* [in] Pointer to a memory block being compared.
+*
+* p_ref
+* [in] Pointer to the reference memory block to compare against.
+*
+* count
+* [in] Number of bytes to compare.
+*
+* RETURN VALUES
+* Returns less than zero if p_mem is less than p_ref.
+*
+* Returns greater than zero if p_mem is greater than p_ref.
+*
+* Returns zero if the two memory regions are the identical.
+*
+* SEE ALSO
+* Memory Management, cl_memset, cl_memclr, cl_memcpy
+**********/
+
/****f* Public: Memory Management/cl_get_pagesize
* NAME
* cl_get_pagesize
Index: complib/cl_memory_osd.c
===================================================================
--- complib/cl_memory_osd.c (revision 7432)
+++ complib/cl_memory_osd.c (working copy)
@@ -69,3 +69,30 @@ __cl_free_priv(
free( p_memory );
}
+void
+cl_memset(
+ IN void* const p_memory,
+ IN const uint8_t fill,
+ IN const size_t count )
+{
+ memset( p_memory, fill, count );
+}
+
+void*
+cl_memcpy(
+ IN void* const p_dest,
+ IN const void* const p_src,
+ IN const size_t count )
+{
+ return( memcpy( p_dest, p_src, count ) );
+}
+
+int32_t
+cl_memcmp(
+ IN const void* const p_mem,
+ IN const void* const p_ref,
+ IN const size_t count )
+{
+ return( memcmp( p_mem, p_ref, count ) );
+}
+
Index: complib/libosmcomp.map
===================================================================
--- complib/libosmcomp.map (revision 7432)
+++ complib/libosmcomp.map (working copy)
@@ -1,4 +1,4 @@
-OSMCOMP_1.0 {
+OSMCOMP_1.1 {
global:
cl_async_proc_construct;
cl_async_proc_init;
@@ -87,6 +87,9 @@ OSMCOMP_1.0 {
__cl_find_mem;
__cl_free_trk;
__cl_free_ntrk;
+ cl_memset;
+ cl_memcpy;
+ cl_memcmp;
__cl_perf_run_calibration;
__cl_perf_construct;
__cl_perf_init;
Index: complib/libosmcomp.ver
===================================================================
--- complib/libosmcomp.ver (revision 7432)
+++ complib/libosmcomp.ver (working copy)
@@ -6,4 +6,4 @@
# API_REV - advance on any added API
# RUNNING_REV - advance any change to the vendor files
# AGE - number of backward versions the API still supports
-LIBVERSION=1:0:0
+LIBVERSION=1:1:0
More information about the general
mailing list