[Asterisk-code-review] sorcery: Add ability to insert a wizard in an object type's ... (asterisk[13])

Joshua Colp asteriskteam at digium.com
Tue May 12 05:37:54 CDT 2015


Joshua Colp has posted comments on this change.

Change subject: sorcery: Add ability to insert a wizard in an object type's list
......................................................................


Patch Set 5: Code-Review-1

(3 comments)

https://gerrit.asterisk.org/#/c/394/5/include/asterisk/sorcery.h
File include/asterisk/sorcery.h:

Line 566: int __ast_sorcery_remove_wizard_mapping(struct ast_sorcery *sorcery,
        : 	const char *type, const char *module, int position);
Without locking this could be problematic. If something else goes and removes something the position may change, causing you to remove something you didn't expect.


Line 608:  * \warning The wizard will have its reference count bumped so you must
        :  * call ao2_cleanup when you're done with it.
So, after looking at things both the wizard and the data aren't ao2 and can't be reference counted. As a result we need to think about what we can do here.

I think our two options are to:

1. Rename the internal wizard structure to something not internal and provide it (in opaque fashion) along with accessors.
2. Create a different structure which hides the implementation detail but allows access to the wizard/data.


https://gerrit.asterisk.org/#/c/394/5/main/sorcery.c
File main/sorcery.c:

Line 916: 		*wizard = &(owizard->wizard->callbacks);
        : 		ao2_bump(*wizard);
Wizards aren't an ao2 allocated object... the internal wizard, yes, but the interface itself is usually defined as a static struct elsewhere when implemented.


-- 
To view, visit https://gerrit.asterisk.org/394
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I9d2469a9296b2698082c0989e25e6848dc403b57
Gerrit-PatchSet: 5
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list