core: Add AO2_ALLOC_OPT_NO_REF_DEBUG option.

Previous to this patch passing a NULL tag to ao2_alloc or ao2_ref based
functions would result in the reference not being logged under
REF_DEBUG.  This could sometimes cause inaccurate logging if NULL was
accidentally passed to a reference action.  Now reference logging is
only disabled by option passed to the allocation method.

Change-Id: I3c17d867d901d53f9fcd512bef4d52e342637b54
This commit is contained in:
Corey Farrell
2019-09-22 17:59:54 -04:00
parent a687c7919d
commit fec6e1bd87
5 changed files with 43 additions and 42 deletions

View File

@@ -376,6 +376,8 @@ enum ao2_alloc_opts {
* should never be passed directly to ao2_alloc.
*/
AO2_ALLOC_OPT_LOCK_OBJ = AO2_ALLOC_OPT_LOCK_MASK,
/*! The ao2 object will not record any REF_DEBUG entries */
AO2_ALLOC_OPT_NO_REF_DEBUG = (1 << 2),
};
/*!
@@ -396,8 +398,6 @@ enum ao2_alloc_opts {
* - the returned pointer cannot be free()'d or realloc()'ed;
* rather, we just call ao2_ref(o, -1);
*
* \note refdebug logging is skipped if debug_msg is NULL
*
* @{
*/
@@ -457,7 +457,6 @@ void *__ao2_alloc_with_lockobj(size_t data_size, ao2_destructor_fn destructor_fn
* can go away is when we release our reference, and it is
* the last one in existence.
*
* \note refdebug logging is skipped if tag is NULL
* @{
*/