Commit Graph

22 Commits

Author SHA1 Message Date
Corey Farrell 021ce938ca
astobj2: Remove legacy ao2_container_alloc routine.
Replace usage of ao2_container_alloc with ao2_container_alloc_hash or
ao2_container_alloc_list.  Remove ao2_container_alloc macro.

Change-Id: I0907d78bc66efc775672df37c8faad00f2f6c088
2018-11-21 09:56:16 -05:00
Corey Farrell 687ab7aeee
astobj2: Eliminate legacy container allocation macros.
These macros have been documented as legacy for a long time but are
still used in new code because they exist.  Remove all references to:
* ao2_container_alloc_options
* ao2_t_container_alloc_options
* ao2_t_container_alloc

These macro's are also removed.  Only ao2_container_alloc remains due to
it's use in over 100 places.

Change-Id: I1a26258b5bf3deb081aaeed11a0baa175c933c7a
2018-10-19 17:33:05 -04:00
Corey Farrell addfc93815 CI: Add support for coverage processing.
Enable coverage with `./tests/CI/buildAsterisk.sh --coverage`.  This
will cause Asterisk to be compiled with coverage support.  It also
initializes 'before' coverage data for all sources.  Accept
--tested-only to disable modules which are not run by any test.
Enabling coverage also sets tested-only true by default.  To build
everything with coverage enabled use `--coverage --tested-only=0`.

./tests/CI/processCoverage.sh is used to process the coverage and
generate HTML reports.

Fix utils/check_expr2 which failed to compiled with coverage enabled.

Add status output 5 times per stage of astobj2_test_perf to ensure
remote CLI does not timeout when compiled with coverage.  Remote CLI
disconnects if no output is received for 60 seconds.  When coverage is
enabled it takes about 70 seconds for my laptop to run the stages of
this test, so with the change a message is printed every 14 seconds.

Change-Id: I890f7d5665087426ad7d3e363187691b9afc2222
2018-08-08 10:59:16 -05:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00
George Joseph 62d1dba271 test_astobj2: Fix warning for missing trailing slash in category
This patch adds a trailing slash to the category for this test.
No more warning.

Tested-by: George Joseph

Review: https://reviewboard.asterisk.org/r/4295/
........

Merged revisions 430059 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-23 23:16:35 +00:00
Kinsey Moore 9056c23bbd Fix more dev-mode build issues
........

Merged revisions 419129 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 419162 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 419163 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-22 14:22:00 +00:00
George Joseph 577632dec9 astobj2: Additional refactoring to push impl specific code down into the impls.
Move some implementation specific code from astobj2_container.c into
astobj2_hash.c and astobj2_rbtree.c.  This completely removes the need for
astobj2_container to switch on RTTI and it no longer has any knowledge of
the implementation details.

Also adds AO2_DEBUG as a new compile option in menuselect which controls
astobj2 debugging independently of AST_DEVMODE and REF_DEBUG.

Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3593/
........

Merged revisions 416806 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20 15:27:43 +00:00
George Joseph 077c4187d9 Split astobj2.c into more maintainable components.
Split astobj2.c into the following files to improve maintainability.

astobj2.c - object primitives, object primitive misc and initialization code.
astobj2_private.h - internal object declarations needed by the containers.
astobj2_container.c - generic conainer and container misc code.
astobj2_container_hash.c - hash container specific code.
astobj2_container_rbtree.c - rbtree container specific code.
astobj2_container_private.h - generic container definitions and rtti prototypes.

https://reviewboard.asterisk.org/r/3576/
........

Merged revisions 415317 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-06 14:12:57 +00:00
Richard Mudgett 7c796593d3 astobj2: Remove OBJ_CONTINUE support.
OBJ_CONTINUE was a strange feature that came into the world under
suspicious circumstances to support an abuse of the ao2_container by
chan_iax2.  Since chan_iax2 no longer uses OBJ_CONTINUE, it is safe to
remove it.

The simplified code should help performance slightly and make
understanding the code easier.

Review: https://reviewboard.asterisk.org/r/2887/
........

Merged revisions 399937 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399938 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-27 17:11:22 +00:00
Richard Mudgett 4ccf2c7aa5 Add red-black tree container type to astobj2.
* Add red-black tree container type.

* Add CLI command "astobj2 container dump <name>"

* Added ao2_container_dump() so the container could be dumped by other
modules for debugging purposes.

* Changed ao2_container_stats() so it can be used by other modules like
ao2_container_check() for debugging purposes.

* Updated the unit tests to check red-black tree containers.

(closes issue ASTERISK-19970)
Reported by: rmudgett
Tested by: rmudgett

Review: https://reviewboard.asterisk.org/r/2110/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-21 18:33:16 +00:00
Matthew Jordan 7cf42e90b6 Fix uninitialized in this function error
With some versions of gcc, n_buckets will be flagged as being uninitialized
before use.  While its technically impossible (since the switch statement,
even without a default, accounts for all possibilities), we'll initialize the
variable to 0 anyway.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376457 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-19 02:14:54 +00:00
Richard Mudgett fb1d9a90a4 Enhance astobj2 to support other types of containers.
The new API allows for sorted containers, insertion options, duplicate
handling options, and traversal order options.

* Adds the ability for containers to be sorted when they are created.

* Adds container creation options to handle duplicates when they are
inserted.

* Adds container creation option to insert objects at the beginning or end
of the container traversal order.

* Adds OBJ_PARTIAL_KEY to allow searching with a partial key.  The partial
key works similarly to the OBJ_KEY flag.  (The real search speed
improvement with this flag will come when red-black trees are added.)

* Adds container traversal and iteration order options: Ascending and
Descending.

* Adds an AST_DEVMODE compile feature to check the stats and integrity of
registered containers using the CLI "astobj2 container stats <name>" and
"astobj2 container check <name>".  The channels container is normally
registered since it is one of the most important containers in the system.

* Adds ao2_iterator_restart() to allow iteration to be restarted from the
beginning.

* Changes the generic container object to have a v_method table pointer to
support other types of containers.

* Changes the container nodes holding objects to be ref counted.

The ref counted nodes and v_method table pointer changes pave the way to
allow other types of containers.

* Includes a large astobj2 unit test enhancement that tests the new
features.

(closes issue ASTERISK-19969)
Reported by: rmudgett

Review: https://reviewboard.asterisk.org/r/2078/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-12 21:02:29 +00:00
Richard Mudgett d4fa095a64 Change ao2 global array to ao2 global object holder.
Review: https://reviewboard.asterisk.org/r/1921/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-16 16:34:42 +00:00
Richard Mudgett 38e892b370 Add global ao2 array container.
Global ao2 objects must always exist after initialization because there is
no access control to obtain another reference to the global object.

It is expected that module configuration could use these new API calls to
replace an active configuration parameter object with an updated
configuration parameter object.

With these new API calls, the global object could be replaced, removed, or
referenced without the risk of someone using a stale global object
pointer.

Review: https://reviewboard.asterisk.org/r/1824/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-27 17:13:32 +00:00
Richard Mudgett 50c8557f03 Add ability to clone ao2 containers.
Occasionally there is a need to put all objects in one container also into
another container.

Some reasons you might need to do this:

1) You need to reconfigure a container.  You would do this by creating a
new container with the new configuration and ao2_container_dup the old
container into it.  Then replace the old container with the new.  Then
destroy the old container.

2) You need the contents of a container to remain stable while operating
on all of the objects.  You would do this by creating a cloned container
of the original with ao2_container_clone.  The cloned container is a
snapshot of the objects at the time of the cloning.  When done, just
destroy the cloned container.

Review: https://reviewboard.asterisk.org/r/1746/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-28 00:42:38 +00:00
Paul Belanger 606ca8ee8c Merged revisions 332177 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r332177 | pabelanger | 2011-08-16 16:11:49 -0400 (Tue, 16 Aug 2011) | 11 lines
  
  Merged revisions 332176 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r332176 | pabelanger | 2011-08-16 16:10:13 -0400 (Tue, 16 Aug 2011) | 4 lines
    
    Flag test modules as 'core'
    
    Review: https://reviewboard.asterisk.org/r/1369/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332178 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-16 20:15:23 +00:00
Russell Bryant 6a15e95a32 astobj2: Avoid using temporary objects + ao2_find() with OBJ_POINTER.
There is a fairly common pattern making its way through the code base where we
put a temporary object on the stack so we can call ao2_find() with OBJ_POINTER.
The purpose is so that it can be passed into the object hash function.
However, this really seems like a hack and potentially error prone.  This patch
is a first stab at approach to avoid having to do that.

It adds a new flag, OBJ_KEY, which can be used instead of OBJ_POINTER in these
situations.  Then, the hash function can know whether it was given an object or
some custom data to hash.

The patch also changes some uses of ao2_find() for iax2_user and iax2_peer
objects to reflect how OBJ_KEY would be used.

So long, and thanks for all the fish.

Review: https://reviewboard.asterisk.org/r/1184/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@330273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-29 19:34:36 +00:00
Leif Madsen a525edea59 Merged revisions 328247 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10

................
  r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines
  
  Merged revisions 328209 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines
    
    Introduce <support_level> tags in MODULEINFO.
    This change introduces MODULEINFO into many modules in Asterisk in order to show
    the community support level for those modules. This is used by changes committed
    to menuselect by Russell Bryant recently (r917 in menuselect). More information about
    the support level types and what they mean is available on the wiki at
    https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14 20:28:54 +00:00
Russell Bryant 6357719a82 Fix some astobj2 iterator breakage, add another unit test.
Review: https://reviewboard.asterisk.org/r/1254/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@321752 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-06-03 18:25:11 +00:00
Tilghman Lesher da8450323f Kill some startup warnings and errors and make some messages more helpful in tracking down the source.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 17:00:22 +00:00
David Vossel 9478670527 astobj2 unit test and bug fix
A bug was discovered during the creation of the astobj2 unit test.
When OBJ_MULTIPLE | OBJ_UNLINK is used, the objects being returned
had a ref count issue.  This patch resolves that.

Review: https://reviewboard.asterisk.org/r/496/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-11 18:42:25 +00:00