Skip to content

Commit 5030184

Browse files
Arnaud Championphotron
Arnaud Champion
authored andcommitted
Add and cleanup comments
1 parent 17c96a8 commit 5030184

14 files changed

+103
-113
lines changed

Connect.cs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Libvirt
1313
{
14+
/// <summary>
15+
/// The Connect class expose all connection related methods
16+
/// </summary>
1417
public class Connect
1518
{
1619
private const int MaxStringLength = 1024;

Domain.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Libvirt
1313
{
14+
/// <summary>
15+
/// The Domain class expose the domains related methods
16+
/// </summary>
1417
public class Domain
1518
{
1619
/// <summary>
@@ -314,7 +317,7 @@ public class Domain
314317
/// Path to the interface.
315318
/// </param>
316319
/// <param name="stats">
317-
/// A <see cref="virDomainInterfaceStatsStruct"/>network interface stats (returned).
320+
/// A <see cref="DomainInterfaceStatsStruct"/>network interface stats (returned).
318321
/// </param>
319322
/// <param name="size">
320323
/// Size of stats structure.

Errors.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class Errors
3838
/// A <see cref="IntPtr"/>pointer to the user data provided in the handler callback.
3939
/// </param>
4040
/// <param name="handler">
41-
/// A <see cref="virErrorFunc"/>function to get called in case of error or NULL
41+
/// A <see cref="ErrorFunc"/>function to get called in case of error or NULL
4242
/// </param>
4343
[DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virConnSetErrorFunc")]
4444
public static extern void ConnSetErrorFunc(IntPtr conn, IntPtr userData, [MarshalAs(UnmanagedType.FunctionPtr)] ErrorFunc handler);
@@ -49,7 +49,7 @@ public class Errors
4949
/// One will need to free the result with virResetError().
5050
/// </summary>
5151
/// <param name="to">
52-
/// A <see cref="virError"/> target to receive the copy.
52+
/// A <see cref="Error"/> target to receive the copy.
5353
/// </param>
5454
/// <returns>
5555
/// 0 if no error was found and the error code otherwise and -1 in case of parameter error.
@@ -61,7 +61,7 @@ public class Errors
6161
/// Default routine reporting an error to stderr.
6262
/// </summary>
6363
/// <param name="err">
64-
/// A <see cref="virError"/> pointer to the error.
64+
/// A <see cref="Error"/> pointer to the error.
6565
/// </param>
6666
[DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virDefaultErrorFunc")]
6767
public static extern void DefaultErrorFunc([In] Error err);
@@ -70,7 +70,7 @@ public class Errors
7070
/// Resets and frees the given error.
7171
/// </summary>
7272
/// <param name="err">
73-
/// A <see cref="virError"/> error to free.
73+
/// A <see cref="Error"/> error to free.
7474
/// </param>
7575
[DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virFreeError")]
7676
public static extern void FreeError(Error err); // Does not work, anybody know why?
@@ -89,7 +89,7 @@ public class Errors
8989
/// Reset the error being pointed to.
9090
/// </summary>
9191
/// <param name="err">
92-
/// A <see cref="virError"/> pointer to the to clean up.
92+
/// A <see cref="Error"/> pointer to the to clean up.
9393
/// </param>
9494
[DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virResetError")]
9595
public static extern void ResetError(Error err);
@@ -105,7 +105,7 @@ public class Errors
105105
/// Save the last error into a new error object.
106106
/// </summary>
107107
/// <returns>
108-
/// A <see cref="virError"/> pointer to the copied error or NULL if allocation failed.
108+
/// A <see cref="Error"/> pointer to the copied error or NULL if allocation failed.
109109
/// It is the caller's responsibility to free the error with virFreeError().
110110
/// </returns>
111111
[DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virSaveLastError")]
@@ -119,7 +119,7 @@ public class Errors
119119
/// A <see cref="IntPtr"/>pointer to the user data provided in the handler callback.
120120
/// </param>
121121
/// <param name="handler">
122-
/// A <see cref="virErrorFunc"/>function to get called in case of error or NULL.
122+
/// A <see cref="ErrorFunc"/>function to get called in case of error or NULL.
123123
/// </param>
124124
[DllImport("libvirt-0.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "virSetErrorFunc")]
125125
public static extern void SetErrorFunc(IntPtr userData, [MarshalAs(UnmanagedType.FunctionPtr)] ErrorFunc handler);

Event.cs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace Libvirt
1212
{
13+
/// <summary>
14+
/// The Event class expose all the event related methods
15+
/// </summary>
1316
public class Event
1417
{
1518
///<summary>

Interface.cs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Libvirt
1010
{
11+
/// <summary>
12+
/// The Interface class expose all interface related methods
13+
/// </summary>
1114
public class Interface
1215
{
1316
// TODO virInterfaceCreate

Library.cs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace Libvirt
1212
{
13+
/// <summary>
14+
/// The Library class expose all libvirt library related methods
15+
/// </summary>
1316
public class Library
1417
{
1518
/// <summary>

MarshalHelper.cs

+20-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@
1111

1212
namespace Libvirt
1313
{
14+
/// <summary>
15+
/// The MarshalHelper class provide some methods that simplify marshaling
16+
/// </summary>
1417
public class MarshalHelper
1518
{
19+
/// <summary>
20+
/// Convert an IntPtr to a string array
21+
/// </summary>
22+
/// <param name="stringPtr">The pointer to the first element of the array</param>
23+
/// <param name="stringCount">The number of elements in the array</param>
24+
/// <returns>The string array</returns>
1625
public static string[] ptrToStringArray(IntPtr stringPtr, int stringCount)
1726
{
1827
string[] members = new string[stringCount];
@@ -23,13 +32,22 @@ public static string[] ptrToStringArray(IntPtr stringPtr, int stringCount)
2332
}
2433
return members;
2534
}
26-
35+
/// <summary>
36+
/// Convert an IntPtr to a string
37+
/// </summary>
38+
/// <param name="stringPtr">The pointer</param>
39+
/// <returns>The string</returns>
2740
public static string ptrToString(IntPtr stringPtr)
2841
{
2942
IntPtr s = Marshal.ReadIntPtr(stringPtr, IntPtr.Size);
3043
return Marshal.PtrToStringAnsi(s);
3144
}
32-
45+
/// <summary>
46+
/// Shift a pointer by offset (32 or 64 bits pointer)
47+
/// </summary>
48+
/// <param name="src">The pointer</param>
49+
/// <param name="offset">The offset in bytes</param>
50+
/// <returns>the shifted pointer</returns>
3351
public static IntPtr IntPtrOffset(IntPtr src, int offset)
3452
{
3553
switch (IntPtr.Size)

NativeFunctions.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
*/
88

99
using System;
10-
using System.Collections.Generic;
11-
using System.Linq;
1210
using System.Runtime.InteropServices;
13-
using System.Text;
1411

1512
namespace Libvirt
1613
{
14+
/// <summary>
15+
/// The class expose some useful native functions
16+
/// </summary>
1717
public class NativeFunctions
1818
{
1919
// TODO : this is a temporary workaround for virConnectOpenAuth callback, this should be removed
20+
/// <summary>
21+
/// duplicate a string. The strdup function shall return a pointer to a new string, which is a duplicate of the string pointed to by s1.
22+
/// </summary>
23+
/// <param name="strSource">Pointer to the string that should be duplicated</param>
24+
/// <returns>a pointer to a new string on success. Otherwise, it shall return a null pointer</returns>
2025
[DllImport("msvcrt.dll", EntryPoint = "_strdup", CallingConvention = CallingConvention.Cdecl)]
2126
public static extern IntPtr StrDup(IntPtr strSource);
2227

Network.cs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Libvirt
1313
{
14+
/// <summary>
15+
/// The Network clas expose all libvirt network related functions
16+
/// </summary>
1417
public class Network
1518
{
1619
/// <summary>

Node.cs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Libvirt
1313
{
14+
/// <summary>
15+
/// The Node class expose all libvirt node related functions
16+
/// </summary>
1417
public class Node
1518
{
1619
private const int MaxStringLength = 1024;

Secret.cs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
namespace Libvirt
1010
{
11+
/// <summary>
12+
/// The Secret class expose all libvirt secret related functions
13+
/// </summary>
1114
public class Secret
1215
{
1316
// TODO virSecretDefineXML

StoragePool.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Libvirt
1313
{
14+
/// <summary>
15+
/// The StoragePool class expose all libvirt storage pool related functions
16+
/// </summary>
1417
public class StoragePool
1518
{
1619
private const int MaxStringLength = 1024;
@@ -90,7 +93,7 @@ public class StoragePool
9093
/// A <see cref="IntPtr"/>pointer to storage pool.
9194
/// </param>
9295
/// <param name="flags">
93-
/// A <see cref="virStoragePoolDeleteFlags"/>flags for obliteration process.
96+
/// A <see cref="StoragePoolDeleteFlags"/>flags for obliteration process.
9497
/// </param>
9598
/// <returns>
9699
/// 0 on success, or -1 if it could not be obliterate.

0 commit comments

Comments
 (0)