[libvirt] [libvirt-csharp][PATCH] Make examples works on monocompiled in 64 bits, simply the ConnectOpenAuth process, and finalise renaming

arnaud.champion at devatom.fr arnaud.champion at devatom.fr
Wed Oct 27 12:05:17 UTC 2010


?Oops, I have made a little mistake that make the example not compiling. This patch make it works, sorry :S


From: arnaud.champion at devatom.fr 
Sent: Wednesday, October 27, 2010 1:50 PM
To: libvir-list at redhat.com 
Subject: [libvirt] [libvirt-csharp][PATCH] Make examples works on monocompiled in 64 bits, simply the ConnectOpenAuth process,and finalise renaming


Hi,

I have finally find the problem with examples on mono compiled in 64 bits. The problem was the "ToInt32" method of an IntPtr which failed on mono 64 bits (have to use ToInt64 instead).
This path solve this problem.
Also, I have put marshaling complexity of the ConnectOpenAuth callback in bindings, this make the callback of ConnectOpenAuth more simple to achieve the authentification. In the example, the callback is treated like this :

private static int AuthCallback(ref ConnectCredential[] creds, IntPtr cbdata)
        {
            AuthData authData = (AuthData)Marshal.PtrToStructure(cbdata, typeof(AuthData));
            foreach (ConnectCredential cred in creds)
            {
                switch (cred.type)
                {
                    case ConnectCredentialType.VIR_CRED_AUTHNAME:
                        // Fill the user name
                        cred.Result = authData.user_name;
                        break;
                    case ConnectCredentialType.VIR_CRED_PASSPHRASE:
                        // Fill the password
                        cred.Result = authData.password;
                        break;
                    default:
                        return -1;
                }
            }
            return 0;
        }

The bindings user has no marshaling to do, and believe me, it's simpler.

Finally, this patch finalize renaming.

Best regards,

Arnaud Champion


--------------------------------------------------------------------------------


--
libvir-list mailing list
libvir-list at redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101027/bf1f52fe/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Oops-a-little-thing-that-make-example-not-compile-un.patch
Type: application/octet-stream
Size: 1796 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101027/bf1f52fe/attachment-0001.obj>


More information about the libvir-list mailing list