[libvirt] [PATCH RFC 1/9] conf: Modify gendispatch.pl to make ACL argument opaque

John Ferlan jferlan at redhat.com
Tue Feb 28 16:45:54 UTC 2017



On 02/28/2017 10:34 AM, Daniel P. Berrange wrote:
> On Sat, Feb 11, 2017 at 11:29:37AM -0500, John Ferlan wrote:
>> The various drivers each have vir*EnsureACL and vir*CheckACL API's
>> which are generated on the fly by gendispatch to include the driver
>> typed "def" name as the last argument based on the API being checked
>> and the driver name (e.g. Node, Interface, Secrets, etc.).
>>
>> Rather than having that name by typed, it's possible to generate the
>> API prototype using a "void *opaque" argument and then modify the first
>> line of the code to make the typed def argumment based off the opaque
>> data. This way we can generalize the ACL typedefs in object parsing
>> code to just be an opaque type. The next step in that generalization
>> is to remove the multiple typdef's and replace it with one general
>> typedef in order to further generalize the various drivers object
>> and object list handling functions.
> 
> I'm really not a fan of throwing away type safety like this.
> 

Understood... Now that I have some more "practical" experience with all
the drivers, maybe I can devise something that'll be more agreeable.

> I'm not sure how the code will even build after applying this patch
> since you've only changed the typedef and not any of the implementations
> 
> Regards,
> Daniel
> 

Well it surprised me as well how "simple" it was... Especially since
mucking with gendispatch.pl was one of the last places I wanted to
touch. Still having some generic argument for prototype made life a lot
easier while trying to adjust each of the drivers one at a time.

John




More information about the libvir-list mailing list