[libvirt] [PATCH] C#Bindings patch, rename classes

?Hi, here is a new patch. It propose to separate types of function by classes. For example : all virConnect[*] (virConnectOpen, virConnectNumOfDomains, etc...) functions are in the virConnect class. all virDomain[*] (virDomainCreate, virDomainDestroy, etc...) function are in the virDomain class. so we have these classes now : virConnect virDomain virEvent virInterface virLibrary virNetwork virNode virSecret virStoragePool virStorageVol virStream and finally libvirtError I know, the name is not correct, but I can't use virError name because virError is also a structure name :S don't know how to name it. This patch also introduce the DllMap configuration directive in Mono project, with this, the binary library names are correclty automagically changed at runtime (libvirt-0.dll under windows become libvirt.so.0 under linux...) so it guarantee the correct work under windows or linux. Sample code have been updated also to deal with new classes names Regards, Arnaud

On Wed, Oct 20, 2010 at 01:44:56PM +0200, arnaud.champion@devatom.fr wrote:
?Hi,
here is a new patch. It propose to separate types of function by classes. For example :
all virConnect[*] (virConnectOpen, virConnectNumOfDomains, etc...) functions are in the virConnect class. all virDomain[*] (virDomainCreate, virDomainDestroy, etc...) function are in the virDomain class.
so we have these classes now :
virConnect virDomain virEvent virInterface virLibrary virNetwork virNode virSecret virStoragePool virStorageVol virStream
IMHO namespace LibvirtBindings { public class virDomain { .... Is somewhat redundant and better named namespace Libvirt { public class Domain { .... The 'vir' prefix on C library APIs/structs is just a hack because C does not have any concept of namespaces. It shouldn't be copied into languages which do have proper namespace support Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

?Okay, I'll make the change... Currently at naming level, my problem is around Error class. Do you have a suggestion ? -------------------------------------------------- From: "Daniel P. Berrange" <berrange@redhat.com> Sent: Wednesday, October 20, 2010 2:01 PM To: <arnaud.champion@devatom.fr> Cc: <libvir-list@redhat.com> Subject: Re: [libvirt] [PATCH] C#Bindings patch, rename classes
On Wed, Oct 20, 2010 at 01:44:56PM +0200, arnaud.champion@devatom.fr wrote:
?Hi,
here is a new patch. It propose to separate types of function by classes. For example :
all virConnect[*] (virConnectOpen, virConnectNumOfDomains, etc...) functions are in the virConnect class. all virDomain[*] (virDomainCreate, virDomainDestroy, etc...) function are in the virDomain class.
so we have these classes now :
virConnect virDomain virEvent virInterface virLibrary virNetwork virNode virSecret virStoragePool virStorageVol virStream
IMHO
namespace LibvirtBindings { public class virDomain { ....
Is somewhat redundant and better named
namespace Libvirt { public class Domain { ....
The 'vir' prefix on C library APIs/structs is just a hack because C does not have any concept of namespaces. It shouldn't be copied into languages which do have proper namespace support
Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Wed, Oct 20, 2010 at 02:07:45PM +0200, arnaud.champion@devatom.fr wrote:
?Okay, I'll make the change... Currently at naming level, my problem is around Error class. Do you have a suggestion ?
What's wrong with following the example I gave, eg namespace Libvirt [ public class Error { ...
IMHO
namespace LibvirtBindings { public class virDomain { ....
Is somewhat redundant and better named
namespace Libvirt { public class Domain { ....
The 'vir' prefix on C library APIs/structs is just a hack because C does not have any concept of namespaces. It shouldn't be copied into languages which do have proper namespace support
Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

?I just found "Error" too large for the person who will use C# bindings :S but... I can use Error, technically no problem. PS : I don't know exactly the english word, by too large I just want to avoid confusion -------------------------------------------------- From: "Daniel P. Berrange" <berrange@redhat.com> Sent: Wednesday, October 20, 2010 2:21 PM To: <arnaud.champion@devatom.fr> Cc: <libvir-list@redhat.com> Subject: Re: [libvirt] [PATCH] C#Bindings patch, rename classes
On Wed, Oct 20, 2010 at 02:07:45PM +0200, arnaud.champion@devatom.fr wrote:
?Okay, I'll make the change... Currently at naming level, my problem is around Error class. Do you have a suggestion ?
What's wrong with following the example I gave, eg
namespace Libvirt [
public class Error { ...
IMHO
namespace LibvirtBindings { public class virDomain { ....
Is somewhat redundant and better named
namespace Libvirt { public class Domain { ....
The 'vir' prefix on C library APIs/structs is just a hack because C does not have any concept of namespaces. It shouldn't be copied into languages which do have proper namespace support
Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

?virStream will expose problems also, as Stream is also a class in .Net framework -------------------------------------------------- From: <arnaud.champion@devatom.fr> Sent: Wednesday, October 20, 2010 2:26 PM To: "Daniel P. Berrange" <berrange@redhat.com> Cc: <libvir-list@redhat.com> Subject: Re: [libvirt] [PATCH] C#Bindings patch, rename classes
?I just found "Error" too large for the person who will use C# bindings :S but... I can use Error, technically no problem.
PS : I don't know exactly the english word, by too large I just want to avoid confusion
-------------------------------------------------- From: "Daniel P. Berrange" <berrange@redhat.com> Sent: Wednesday, October 20, 2010 2:21 PM To: <arnaud.champion@devatom.fr> Cc: <libvir-list@redhat.com> Subject: Re: [libvirt] [PATCH] C#Bindings patch, rename classes
On Wed, Oct 20, 2010 at 02:07:45PM +0200, arnaud.champion@devatom.fr wrote:
?Okay, I'll make the change... Currently at naming level, my problem is around Error class. Do you have a suggestion ?
What's wrong with following the example I gave, eg
namespace Libvirt [
public class Error { ...
IMHO
namespace LibvirtBindings { public class virDomain { ....
Is somewhat redundant and better named
namespace Libvirt { public class Domain { ....
The 'vir' prefix on C library APIs/structs is just a hack because C does not have any concept of namespaces. It shouldn't be copied into languages which do have proper namespace support
Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Wed, Oct 20, 2010 at 02:56:37PM +0200, arnaud.champion@devatom.fr wrote:
?virStream will expose problems also, as Stream is also a class in .Net framework
Why is that any problem ? Namespaces exist precisely to solve this problem. You only need name uniqueness within the namespace. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

?You're are right. I just reference my own experience. Anyway, I'm putting Stream. -------------------------------------------------- From: "Daniel P. Berrange" <berrange@redhat.com> Sent: Wednesday, October 20, 2010 2:59 PM To: <arnaud.champion@devatom.fr> Cc: <libvir-list@redhat.com> Subject: Re: [libvirt] [PATCH] C#Bindings patch, rename classes
On Wed, Oct 20, 2010 at 02:56:37PM +0200, arnaud.champion@devatom.fr wrote:
?virStream will expose problems also, as Stream is also a class in .Net framework
Why is that any problem ? Namespaces exist precisely to solve this problem. You only need name uniqueness within the namespace.
Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

2010/10/20 <arnaud.champion@devatom.fr>:
Hi,
here is a new patch. It propose to separate types of function by classes. For example :
all virConnect[*] (virConnectOpen, virConnectNumOfDomains, etc...) functions are in the virConnect class. all virDomain[*] (virDomainCreate, virDomainDestroy, etc...) function are in the virDomain class.
so we have these classes now :
virConnect virDomain virEvent virInterface virLibrary virNetwork virNode virSecret virStoragePool virStorageVol virStream
and finally
libvirtError
I know, the name is not correct, but I can't use virError name because virError is also a structure name :S don't know how to name it.
This patch also introduce the DllMap configuration directive in Mono project, with this, the binary library names are correclty automagically changed at runtime (libvirt-0.dll under windows become libvirt.so.0 under linux...) so it guarantee the correct work under windows or linux.
Sample code have been updated also to deal with new classes names
Regards,
Arnaud
I pushed this patch. You did the re-renaming suggested by Daniel in an additional patch that I also pushed. Matthias
participants (3)
-
arnaud.champion@devatom.fr
-
Daniel P. Berrange
-
Matthias Bolte