Re: [libvirt] libvirt-java storage support and refactoring

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

 



Tóth István wrote:
> I've found that libvirt for the most part has a very perdicitble and 
> repetitive API (great design!), and  as a result I've found myself  
> copying the same code over and over again.
> I've decided to make generic JNI functions, that can handle multiple 
> libvirt functions  with function pointers.
> The generic functions are in generic.c and they are used extensively in 
> the new Storage JNI implementation.
> 
> I'd like to have your input on this architecture, my current plan is to 
> refactor all trivial JNI functions to use these generics, unless there 
> are objections.

(I haven't really read your patches, but...)

It's definitely good to get rid of a lot of the duplicated code.  However, you
might want to take a look at the ruby-libvirt bindings as a different way to do
it.  Basically, there are a few macros which generate much of the "duplicated"
type code, and in my opinion, it's a little easier to read than lots of function
callbacks.  The downside is that it's harder to debug with something like gdb,
but I'm not sure that is something you do with JNI bindings anyway.

Just a thought.

Chris Lalancette

--
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]