Re: PATCH: 5/10: public auth callback API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 04, 2007 at 10:46:50AM -0500, Daniel Veillard wrote:
> On Tue, Dec 04, 2007 at 12:57:39PM +0000, Richard W.M. Jones wrote:
> > Daniel P. Berrange wrote:
> > > virConnectPtr           virConnectOpenAuth      (const char *name,
> > > 						 virConnectAuthPtr auth,
> > > 						 int flags);
> > 
> > I'm a fan of callers passing in the size of the structure (as they see 
> > it).  Allows the structure to be expanded in future, and if done right 
> > can allow both forwards and backwards compatibility.
> > 
> > cf: http://www.libvirt.org/html/libvirt-libvirt.html#virDomainInterfaceStats
> 
>   Hum, honnestly, that's not my preferred way. If you really think there
> should be room for expansion, I would either:
>    - add a version number to the structure and allocator/destructor
>      functions as part of the API (prefered)

This adds more complexity and the single sizeof(*auth) param IMHO.

>    - add padding at tyhe end of the structure which could allow 
>      a future growth

> adding the size of the structure as the argument moves the complexity away
> from the library implementor to the library user, 

It doesn't really - the user just has to add  sizeof(*auth) as an arg and
all the rest of the complexity is in the library internals.

In fact it doesn't need to add any complexity, because we could make it a
compile time macro

  #define virConnectOpenAuth(name,auth,flags) virConnectOpenAuth(name,auth,sizeof(*auth),flags)

Dan
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]