ruby-libvirt 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9298c7723ec78226f314dc726eba72b89a2aecbb
4
- data.tar.gz: 7c34d1dfeafb9eebb3cc4543fc131bc240ae251b
3
+ metadata.gz: a3d8455cea04535a67a854a1668e65e697f8f5a9
4
+ data.tar.gz: d7f64cdb9354ca004ce37b6ca0a13b32e3d6f424
5
5
  SHA512:
6
- metadata.gz: 07c97eb6629972c30f1e001cfce9ae92e720dc96c34d4f688e560276ab61adda14c6795e5585a552e07b24581d72144522f8f2db1744545295174301553c8c24
7
- data.tar.gz: e6d8ff0575e44d17959b9ee81d7b9c908f0cfaf3e3e83bd857f2d1b2004040dd5a23f8d04c96a644e6c6075dd61baad3700c3280694c8e8b173f88840c2d3c8e
6
+ metadata.gz: 793d87e2aed2a20afa6de1ae61898c04875b0d4bcb706c5cdc53a73214ceba84019be1c4153f8a9a0e59b431fe5bf074927d51edbcdf7bbbfc9a6b28534ffe48
7
+ data.tar.gz: cffa8666d8784b85afcf6e4bfdf2cfb7fd90722bc789ba5a602a5d7fe4f15005fe309a44d193a1c4dcfe92db06c82df457c27589acb8a01035fa1d9ad9b91f82
data/NEWS CHANGED
@@ -1,3 +1,7 @@
1
+ 2013-12-15
2
+ * Fixes to compile against older libvirt
3
+ * Fixes to compile against ruby 1.8
4
+
1
5
  2013-12-09 0.5.0
2
6
  * Updated Network class, implementing almost all libvirt APIs
3
7
  * Updated Domain class, implementing almost all libvirt APIs
data/Rakefile CHANGED
@@ -11,13 +11,17 @@
11
11
 
12
12
  # Rakefile for ruby-rpm -*- ruby -*-
13
13
  require 'rake/clean'
14
- require 'rdoc/task'
14
+ begin
15
+ require 'rdoc/task'
16
+ rescue LoadError
17
+ require 'rake/rdoctask'
18
+ end
15
19
  require 'rake/testtask'
16
20
  require 'rubygems/package_task'
17
21
  require 'rbconfig'
18
22
 
19
23
  PKG_NAME='ruby-libvirt'
20
- PKG_VERSION='0.5.0'
24
+ PKG_VERSION='0.5.1'
21
25
 
22
26
  EXT_CONF='ext/libvirt/extconf.rb'
23
27
  MAKEFILE="ext/libvirt/Makefile"
@@ -51,7 +51,8 @@ VALUE e_Error;
51
51
  VALUE e_NoSupportError;
52
52
 
53
53
  /* custom error function to suppress libvirt printing to stderr */
54
- static void rubyLibvirtErrorFunc(void *userdata, virErrorPtr err)
54
+ static void rubyLibvirtErrorFunc(void *RUBY_LIBVIRT_UNUSED(userdata),
55
+ virErrorPtr RUBY_LIBVIRT_UNUSED(err))
55
56
  {
56
57
  }
57
58
 
@@ -62,7 +63,8 @@ static void rubyLibvirtErrorFunc(void *userdata, virErrorPtr err)
62
63
  * Call virGetVersion[http://www.libvirt.org/html/libvirt-libvirt.html#virGetVersion]
63
64
  * to get the version of libvirt and of the hypervisor TYPE.
64
65
  */
65
- static VALUE libvirt_version(int argc, VALUE *argv, VALUE m)
66
+ static VALUE libvirt_version(int argc, VALUE *argv,
67
+ VALUE RUBY_LIBVIRT_UNUSED(m))
66
68
  {
67
69
  unsigned long libVer, typeVer;
68
70
  VALUE type, result, rargv[2];
@@ -91,7 +93,7 @@ static VALUE libvirt_version(int argc, VALUE *argv, VALUE m)
91
93
  * Call virConnectOpen[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectOpen]
92
94
  * to open a connection to a URL.
93
95
  */
94
- static VALUE libvirt_open(int argc, VALUE *argv, VALUE m)
96
+ static VALUE libvirt_open(int argc, VALUE *argv, VALUE RUBY_LIBVIRT_UNUSED(m))
95
97
  {
96
98
  VALUE uri;
97
99
  virConnectPtr conn;
@@ -112,7 +114,8 @@ static VALUE libvirt_open(int argc, VALUE *argv, VALUE m)
112
114
  * Call virConnectOpenReadOnly[http://www.libvirt.org/html/libvirt-libvirt.html#virConnectOpenReadOnly]
113
115
  * to open a read-only connection to a URL.
114
116
  */
115
- static VALUE libvirt_open_read_only(int argc, VALUE *argv, VALUE m)
117
+ static VALUE libvirt_open_read_only(int argc, VALUE *argv,
118
+ VALUE RUBY_LIBVIRT_UNUSED(m))
116
119
  {
117
120
  VALUE uri;
118
121
  virConnectPtr conn;
@@ -132,7 +135,7 @@ static int libvirt_auth_callback_wrapper(virConnectCredentialPtr cred,
132
135
  unsigned int ncred, void *cbdata)
133
136
  {
134
137
  VALUE userdata, newcred, result;
135
- int i;
138
+ unsigned int i;
136
139
 
137
140
  userdata = (VALUE)cbdata;
138
141
 
@@ -211,12 +214,13 @@ static int libvirt_auth_callback_wrapper(virConnectCredentialPtr cred,
211
214
  * The authentication block should return the result of collecting the
212
215
  * information; these results will then be sent to libvirt for authentication.
213
216
  */
214
- static VALUE libvirt_open_auth(int argc, VALUE *argv, VALUE m)
217
+ static VALUE libvirt_open_auth(int argc, VALUE *argv,
218
+ VALUE RUBY_LIBVIRT_UNUSED(m))
215
219
  {
216
220
  virConnectAuthPtr auth;
217
221
  VALUE uri, credlist, userdata, flags, tmp;
218
222
  virConnectPtr conn;
219
- int i;
223
+ unsigned int i;
220
224
 
221
225
  rb_scan_args(argc, argv, "04", &uri, &credlist, &userdata, &flags);
222
226
 
@@ -287,9 +291,9 @@ static VALUE add_timeout, update_timeout, remove_timeout;
287
291
  *
288
292
  * opaque - the opaque data passed from libvirt during the Libvirt::event_register_impl add_handle callback. To ensure proper operation this data must be passed through to event_invoke_handle_callback without modification.
289
293
  */
290
- static VALUE libvirt_event_invoke_handle_callback(VALUE m, VALUE handle,
291
- VALUE fd, VALUE events,
292
- VALUE opaque)
294
+ static VALUE libvirt_event_invoke_handle_callback(VALUE RUBY_LIBVIRT_UNUSED(m),
295
+ VALUE handle, VALUE fd,
296
+ VALUE events, VALUE opaque)
293
297
  {
294
298
  virEventHandleCallback cb;
295
299
  void *op;
@@ -332,8 +336,8 @@ static VALUE libvirt_event_invoke_handle_callback(VALUE m, VALUE handle,
332
336
  *
333
337
  * opaque - the opaque data passed from libvirt during the Libvirt::event_register_impl add_handle callback. To ensure proper operation this data must be passed through to event_invoke_handle_callback without modification.
334
338
  */
335
- static VALUE libvirt_event_invoke_timeout_callback(VALUE m, VALUE timer,
336
- VALUE opaque)
339
+ static VALUE libvirt_event_invoke_timeout_callback(VALUE RUBY_LIBVIRT_UNUSED(m),
340
+ VALUE timer, VALUE opaque)
337
341
  {
338
342
  virEventTimeoutCallback cb;
339
343
  void *op;
@@ -599,7 +603,8 @@ static int is_symbol_proc_or_nil(VALUE handle)
599
603
  * passed to the event_invoke_handle_callback and event_invoke_timeout_callback
600
604
  * module methods; see the documentation for those methods for more details.
601
605
  */
602
- static VALUE libvirt_conn_event_register_impl(int argc, VALUE *argv, VALUE c)
606
+ static VALUE libvirt_conn_event_register_impl(int argc, VALUE *argv,
607
+ VALUE RUBY_LIBVIRT_UNUSED(c))
603
608
  {
604
609
  virEventAddHandleFunc add_handle_temp;
605
610
  virEventUpdateHandleFunc update_handle_temp;
@@ -653,7 +658,7 @@ static VALUE libvirt_conn_event_register_impl(int argc, VALUE *argv, VALUE c)
653
658
  * which may be able to be used to move back to the previous label.
654
659
  */
655
660
  static VALUE libvirt_domain_lxc_enter_security_label(int argc, VALUE *argv,
656
- VALUE c)
661
+ VALUE RUBY_LIBVIRT_UNUSED(c))
657
662
  {
658
663
  VALUE model, label, flags, result, modiv, doiiv, labiv;
659
664
  virSecurityModel mod;
data/ext/libvirt/common.c CHANGED
@@ -24,6 +24,7 @@
24
24
  #endif
25
25
  #include <stdio.h>
26
26
  #include <ruby.h>
27
+ #include <st.h>
27
28
  #include <libvirt/libvirt.h>
28
29
  #include <libvirt/virterror.h>
29
30
  #include "common.h"
@@ -256,20 +257,22 @@ void ruby_libvirt_typed_params_to_hash(void *voidparams, int i, VALUE hash)
256
257
 
257
258
  VALUE ruby_libvirt_get_parameters(VALUE d, unsigned int flags, void *opaque,
258
259
  unsigned int typesize,
259
- char *(*nparams_cb)(VALUE d,
260
- unsigned int flags,
261
- void *opaque,
262
- int *nparams),
263
- char *(*get_cb)(VALUE d, unsigned int flags,
264
- void *voidparams,
265
- int *nparams, void *opaque),
260
+ const char *(*nparams_cb)(VALUE d,
261
+ unsigned int flags,
262
+ void *opaque,
263
+ int *nparams),
264
+ const char *(*get_cb)(VALUE d,
265
+ unsigned int flags,
266
+ void *voidparams,
267
+ int *nparams,
268
+ void *opaque),
266
269
  void (*hash_set)(void *voidparams, int i,
267
270
  VALUE result))
268
271
  {
269
272
  int nparams = 0;
270
273
  void *params;
271
274
  VALUE result;
272
- char *errname;
275
+ const char *errname;
273
276
  int i;
274
277
 
275
278
  errname = nparams_cb(d, flags, opaque, &nparams);
@@ -297,15 +300,15 @@ VALUE ruby_libvirt_get_parameters(VALUE d, unsigned int flags, void *opaque,
297
300
 
298
301
  VALUE ruby_libvirt_get_typed_parameters(VALUE d, unsigned int flags,
299
302
  void *opaque,
300
- char *(*nparams_cb)(VALUE d,
301
- unsigned int flags,
302
- void *opaque,
303
- int *nparams),
304
- char *(*get_cb)(VALUE d,
305
- unsigned int flags,
306
- void *params,
307
- int *nparams,
308
- void *opaque))
303
+ const char *(*nparams_cb)(VALUE d,
304
+ unsigned int flags,
305
+ void *opaque,
306
+ int *nparams),
307
+ const char *(*get_cb)(VALUE d,
308
+ unsigned int flags,
309
+ void *params,
310
+ int *nparams,
311
+ void *opaque))
309
312
  {
310
313
  return ruby_libvirt_get_parameters(d, flags, opaque,
311
314
  sizeof(virTypedParameter), nparams_cb,
@@ -389,13 +392,13 @@ VALUE ruby_libvirt_set_typed_parameters(VALUE d, VALUE input,
389
392
  unsigned int flags, void *opaque,
390
393
  struct ruby_libvirt_typed_param *allowed,
391
394
  unsigned int num_allowed,
392
- char *(*set_cb)(VALUE d,
393
- unsigned int flags,
394
- virTypedParameterPtr params,
395
- int nparams,
396
- void *opaque))
395
+ const char *(*set_cb)(VALUE d,
396
+ unsigned int flags,
397
+ virTypedParameterPtr params,
398
+ int nparams,
399
+ void *opaque))
397
400
  {
398
- char *errname;
401
+ const char *errname;
399
402
  struct ruby_libvirt_parameter_assign_args args;
400
403
  unsigned long hashsize;
401
404
 
data/ext/libvirt/common.h CHANGED
@@ -5,6 +5,8 @@
5
5
  VALUE ruby_libvirt_new_class(VALUE klass, void *ptr, VALUE conn,
6
6
  RUBY_DATA_FUNC free_func);
7
7
 
8
+ #define RUBY_LIBVIRT_UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
9
+
8
10
  #define ruby_libvirt_get_struct(kind, v) \
9
11
  do { \
10
12
  vir##kind##Ptr ptr; \
@@ -123,7 +125,7 @@ void ruby_libvirt_raise_error_if(const int condition, VALUE error,
123
125
  do { \
124
126
  VALUE flags; \
125
127
  type *list; \
126
- size_t i; \
128
+ int i; \
127
129
  int ret; \
128
130
  VALUE result; \
129
131
  int exception = 0; \
@@ -175,28 +177,30 @@ VALUE ruby_libvirt_generate_list(int num, char **list);
175
177
 
176
178
  VALUE ruby_libvirt_get_parameters(VALUE d, unsigned int flags, void *opaque,
177
179
  unsigned int typesize,
178
- char *(*nparams_cb)(VALUE d,
179
- unsigned int flags,
180
- void *opaque,
181
- int *nparams),
182
- char *(*get_cb)(VALUE d, unsigned int flags,
183
- void *voidparams,
184
- int *nparams, void *opaque),
185
- void (*hash_set)(void *voidparams, int i,
186
- VALUE result));
187
- VALUE ruby_libvirt_get_typed_parameters(VALUE d, unsigned int flags,
188
- void *opaque,
189
- char *(*nparams_cb)(VALUE d,
180
+ const char *(*nparams_cb)(VALUE d,
190
181
  unsigned int flags,
191
182
  void *opaque,
192
183
  int *nparams),
193
- char *(*get_cb)(VALUE d,
184
+ const char *(*get_cb)(VALUE d,
194
185
  unsigned int flags,
195
- void *params,
186
+ void *voidparams,
196
187
  int *nparams,
197
- void *opaque));
188
+ void *opaque),
189
+ void (*hash_set)(void *voidparams, int i,
190
+ VALUE result));
191
+ VALUE ruby_libvirt_get_typed_parameters(VALUE d, unsigned int flags,
192
+ void *opaque,
193
+ const char *(*nparams_cb)(VALUE d,
194
+ unsigned int flags,
195
+ void *opaque,
196
+ int *nparams),
197
+ const char *(*get_cb)(VALUE d,
198
+ unsigned int flags,
199
+ void *params,
200
+ int *nparams,
201
+ void *opaque));
198
202
  struct ruby_libvirt_typed_param {
199
- char *name;
203
+ const char *name;
200
204
  int type;
201
205
  };
202
206
  struct ruby_libvirt_parameter_assign_args {
@@ -211,11 +215,11 @@ VALUE ruby_libvirt_set_typed_parameters(VALUE d, VALUE input,
211
215
  unsigned int flags, void *opaque,
212
216
  struct ruby_libvirt_typed_param *allowed,
213
217
  unsigned int num_allowed,
214
- char *(*set_cb)(VALUE d,
215
- unsigned int flags,
216
- virTypedParameterPtr params,
217
- int nparams,
218
- void *opaque));
218
+ const char *(*set_cb)(VALUE d,
219
+ unsigned int flags,
220
+ virTypedParameterPtr params,
221
+ int nparams,
222
+ void *opaque));
219
223
 
220
224
  int ruby_libvirt_get_maxcpus(virConnectPtr conn);
221
225
 
@@ -249,7 +253,7 @@ VALUE ruby_libvirt_str_new_wrap(VALUE arg);
249
253
 
250
254
  struct ruby_libvirt_hash_aset_arg {
251
255
  VALUE hash;
252
- char *name;
256
+ const char *name;
253
257
  VALUE val;
254
258
  };
255
259
  VALUE ruby_libvirt_hash_aset_wrap(VALUE arg);
@@ -460,7 +460,8 @@ static VALUE libvirt_connect_baseline_cpu(int argc, VALUE *argv, VALUE c)
460
460
  char *r;
461
461
  unsigned int ncpus;
462
462
  const char **xmllist;
463
- int i, exception = 0;
463
+ int exception = 0;
464
+ unsigned int i;
464
465
 
465
466
  rb_scan_args(argc, argv, "11", &xmlcpus, &flags);
466
467
 
@@ -2023,8 +2024,8 @@ static void cpu_stats_set(void *voidparams, int i, VALUE result)
2023
2024
  ULL2NUM(params[i].value));
2024
2025
  }
2025
2026
 
2026
- static char *cpu_stats_nparams(VALUE d, unsigned int flags, void *opaque,
2027
- int *nparams)
2027
+ static const char *cpu_stats_nparams(VALUE d, unsigned int flags, void *opaque,
2028
+ int *nparams)
2028
2029
  {
2029
2030
  int intparam = *((int *)opaque);
2030
2031
 
@@ -2036,8 +2037,8 @@ static char *cpu_stats_nparams(VALUE d, unsigned int flags, void *opaque,
2036
2037
  return NULL;
2037
2038
  }
2038
2039
 
2039
- static char *cpu_stats_get(VALUE d, unsigned int flags, void *voidparams,
2040
- int *nparams, void *opaque)
2040
+ static const char *cpu_stats_get(VALUE d, unsigned int flags, void *voidparams,
2041
+ int *nparams, void *opaque)
2041
2042
  {
2042
2043
  int intparam = *((int *)opaque);
2043
2044
  virNodeCPUStatsPtr params = (virNodeCPUStatsPtr)voidparams;
@@ -2082,8 +2083,8 @@ static void memory_stats_set(void *voidparams, int i, VALUE result)
2082
2083
  ULL2NUM(params[i].value));
2083
2084
  }
2084
2085
 
2085
- static char *memory_stats_nparams(VALUE d, unsigned int flags, void *opaque,
2086
- int *nparams)
2086
+ static const char *memory_stats_nparams(VALUE d, unsigned int flags,
2087
+ void *opaque, int *nparams)
2087
2088
  {
2088
2089
  int intparam = *((int *)opaque);
2089
2090
 
@@ -2095,8 +2096,9 @@ static char *memory_stats_nparams(VALUE d, unsigned int flags, void *opaque,
2095
2096
  return NULL;
2096
2097
  }
2097
2098
 
2098
- static char *memory_stats_get(VALUE d, unsigned int flags, void *voidparams,
2099
- int *nparams, void *opaque)
2099
+ static const char *memory_stats_get(VALUE d, unsigned int flags,
2100
+ void *voidparams, int *nparams,
2101
+ void *opaque)
2100
2102
  {
2101
2103
  int intparam = *((int *)opaque);
2102
2104
  virNodeMemoryStatsPtr params = (virNodeMemoryStatsPtr)voidparams;
@@ -2200,8 +2202,9 @@ static VALUE libvirt_connect_node_suspend_for_duration(int argc, VALUE *argv,
2200
2202
  #endif
2201
2203
 
2202
2204
  #if HAVE_VIRNODEGETMEMORYPARAMETERS
2203
- static char *node_memory_nparams(VALUE d, unsigned int flags, void *opaque,
2204
- int *nparams)
2205
+ static const char *node_memory_nparams(VALUE d, unsigned int flags,
2206
+ void *RUBY_LIBVIRT_UNUSED(opaque),
2207
+ int *nparams)
2205
2208
  {
2206
2209
  if (virNodeGetMemoryParameters(ruby_libvirt_connect_get(d), NULL, nparams,
2207
2210
  flags) < 0) {
@@ -2211,8 +2214,9 @@ static char *node_memory_nparams(VALUE d, unsigned int flags, void *opaque,
2211
2214
  return NULL;
2212
2215
  }
2213
2216
 
2214
- static char *node_memory_get(VALUE d, unsigned int flags, void *voidparams,
2215
- int *nparams, void *opaque)
2217
+ static const char *node_memory_get(VALUE d, unsigned int flags,
2218
+ void *voidparams, int *nparams,
2219
+ void *RUBY_LIBVIRT_UNUSED(opaque))
2216
2220
  {
2217
2221
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
2218
2222
 
@@ -2223,9 +2227,9 @@ static char *node_memory_get(VALUE d, unsigned int flags, void *voidparams,
2223
2227
  return NULL;
2224
2228
  }
2225
2229
 
2226
- static char *node_memory_set(VALUE d, unsigned int flags,
2227
- virTypedParameterPtr params, int nparams,
2228
- void *opauqe)
2230
+ static const char *node_memory_set(VALUE d, unsigned int flags,
2231
+ virTypedParameterPtr params, int nparams,
2232
+ void *RUBY_LIBVIRT_UNUSED(opaque))
2229
2233
  {
2230
2234
  if (virNodeSetMemoryParameters(ruby_libvirt_connect_get(d), params, nparams,
2231
2235
  flags) < 0) {
data/ext/libvirt/domain.c CHANGED
@@ -22,7 +22,8 @@
22
22
  #include <stdint.h>
23
23
  #include <unistd.h>
24
24
  #include <ruby.h>
25
- #include <ruby/st.h>
25
+ /* we need to include st.h since ruby 1.8 needs it for RHash */
26
+ #include <st.h>
26
27
  #include <libvirt/libvirt.h>
27
28
  #if HAVE_VIRDOMAINQEMUMONITORCOMMAND
28
29
  #include <libvirt/libvirt-qemu.h>
@@ -548,7 +549,8 @@ static VALUE libvirt_domain_core_dump(int argc, VALUE *argv, VALUE d)
548
549
  * Call virDomainRestore[http://www.libvirt.org/html/libvirt-libvirt.html#virDomainRestore]
549
550
  * to restore the domain from the filename.
550
551
  */
551
- static VALUE libvirt_domain_s_restore(VALUE klass, VALUE c, VALUE from)
552
+ static VALUE libvirt_domain_s_restore(VALUE RUBY_LIBVIRT_UNUSED(klass), VALUE c,
553
+ VALUE from)
552
554
  {
553
555
  ruby_libvirt_generate_call_nil(virDomainRestore,
554
556
  ruby_libvirt_connect_get(c),
@@ -1853,8 +1855,10 @@ static VALUE libvirt_domain_is_updated(VALUE d)
1853
1855
  }
1854
1856
  #endif
1855
1857
 
1856
- static char *scheduler_nparams(VALUE d, unsigned int flags, void *opaque,
1857
- int *nparams)
1858
+ static const char *scheduler_nparams(VALUE d,
1859
+ unsigned int RUBY_LIBVIRT_UNUSED(flags),
1860
+ void *RUBY_LIBVIRT_UNUSED(opaque),
1861
+ int *nparams)
1858
1862
  {
1859
1863
  char *type;
1860
1864
 
@@ -1868,8 +1872,9 @@ static char *scheduler_nparams(VALUE d, unsigned int flags, void *opaque,
1868
1872
  return NULL;
1869
1873
  }
1870
1874
 
1871
- static char *scheduler_get(VALUE d, unsigned int flags, void *voidparams,
1872
- int *nparams, void *opaque)
1875
+ static const char *scheduler_get(VALUE d, unsigned int flags, void *voidparams,
1876
+ int *nparams,
1877
+ void *RUBY_LIBVIRT_UNUSED(opaque))
1873
1878
  {
1874
1879
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
1875
1880
 
@@ -1892,9 +1897,9 @@ static char *scheduler_get(VALUE d, unsigned int flags, void *voidparams,
1892
1897
  return NULL;
1893
1898
  }
1894
1899
 
1895
- static char *scheduler_set(VALUE d, unsigned int flags,
1896
- virTypedParameterPtr params, int nparams,
1897
- void *opaque)
1900
+ static const char *scheduler_set(VALUE d, unsigned int flags,
1901
+ virTypedParameterPtr params, int nparams,
1902
+ void *RUBY_LIBVIRT_UNUSED(opaque))
1898
1903
  {
1899
1904
  #if HAVE_TYPE_VIRTYPEDPARAMETERPTR
1900
1905
  if (virDomainSetSchedulerParametersFlags(ruby_libvirt_domain_get(d), params,
@@ -1939,8 +1944,12 @@ static struct ruby_libvirt_typed_param domain_scheduler_allowed[] = {
1939
1944
  {VIR_DOMAIN_SCHEDULER_CPU_SHARES, VIR_TYPED_PARAM_ULLONG},
1940
1945
  {VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, VIR_TYPED_PARAM_ULLONG},
1941
1946
  {VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, VIR_TYPED_PARAM_LLONG},
1947
+ #if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD
1942
1948
  {VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, VIR_TYPED_PARAM_ULLONG},
1949
+ #endif
1950
+ #if HAVE_CONST_VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA
1943
1951
  {VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, VIR_TYPED_PARAM_LLONG},
1952
+ #endif
1944
1953
  {VIR_DOMAIN_SCHEDULER_WEIGHT, VIR_TYPED_PARAM_UINT},
1945
1954
  {VIR_DOMAIN_SCHEDULER_CAP, VIR_TYPED_PARAM_UINT},
1946
1955
  {VIR_DOMAIN_SCHEDULER_RESERVATION, VIR_TYPED_PARAM_LLONG},
@@ -1970,8 +1979,9 @@ static VALUE libvirt_domain_scheduler_parameters_equal(VALUE d, VALUE input)
1970
1979
  }
1971
1980
 
1972
1981
  #if HAVE_VIRDOMAINSETMEMORYPARAMETERS
1973
- static char *memory_nparams(VALUE d, unsigned int flags, void *opaque,
1974
- int *nparams)
1982
+ static const char *memory_nparams(VALUE d, unsigned int flags,
1983
+ void *RUBY_LIBVIRT_UNUSED(opaque),
1984
+ int *nparams)
1975
1985
  {
1976
1986
  if (virDomainGetMemoryParameters(ruby_libvirt_domain_get(d), NULL, nparams,
1977
1987
  flags) < 0) {
@@ -1981,8 +1991,8 @@ static char *memory_nparams(VALUE d, unsigned int flags, void *opaque,
1981
1991
  return NULL;
1982
1992
  }
1983
1993
 
1984
- static char *memory_get(VALUE d, unsigned int flags, void *voidparams,
1985
- int *nparams, void *opaque)
1994
+ static const char *memory_get(VALUE d, unsigned int flags, void *voidparams,
1995
+ int *nparams, void *RUBY_LIBVIRT_UNUSED(opaque))
1986
1996
  {
1987
1997
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
1988
1998
 
@@ -2000,8 +2010,9 @@ static char *memory_get(VALUE d, unsigned int flags, void *voidparams,
2000
2010
  return NULL;
2001
2011
  }
2002
2012
 
2003
- static char *memory_set(VALUE d, unsigned int flags,
2004
- virTypedParameterPtr params, int nparams, void *opaque)
2013
+ static const char *memory_set(VALUE d, unsigned int flags,
2014
+ virTypedParameterPtr params, int nparams,
2015
+ void *RUBY_LIBVIRT_UNUSED(opaque))
2005
2016
  {
2006
2017
  #ifdef HAVE_TYPE_VIRTYPEDPARAMETERPTR
2007
2018
  if (virDomainSetMemoryParameters(ruby_libvirt_domain_get(d), params,
@@ -2065,8 +2076,9 @@ static VALUE libvirt_domain_memory_parameters_equal(VALUE d, VALUE in)
2065
2076
  #endif
2066
2077
 
2067
2078
  #if HAVE_VIRDOMAINSETBLKIOPARAMETERS
2068
- static char *blkio_nparams(VALUE d, unsigned int flags, void *opaque,
2069
- int *nparams)
2079
+ static const char *blkio_nparams(VALUE d, unsigned int flags,
2080
+ void *RUBY_LIBVIRT_UNUSED(opaque),
2081
+ int *nparams)
2070
2082
  {
2071
2083
  if (virDomainGetBlkioParameters(ruby_libvirt_domain_get(d), NULL, nparams,
2072
2084
  flags) < 0) {
@@ -2076,8 +2088,8 @@ static char *blkio_nparams(VALUE d, unsigned int flags, void *opaque,
2076
2088
  return NULL;
2077
2089
  }
2078
2090
 
2079
- static char *blkio_get(VALUE d, unsigned int flags, void *voidparams,
2080
- int *nparams, void *opaque)
2091
+ static const char *blkio_get(VALUE d, unsigned int flags, void *voidparams,
2092
+ int *nparams, void *RUBY_LIBVIRT_UNUSED(opaque))
2081
2093
  {
2082
2094
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
2083
2095
 
@@ -2095,8 +2107,9 @@ static char *blkio_get(VALUE d, unsigned int flags, void *voidparams,
2095
2107
  return NULL;
2096
2108
  }
2097
2109
 
2098
- static char *blkio_set(VALUE d, unsigned int flags, virTypedParameterPtr params,
2099
- int nparams, void *opaque)
2110
+ static const char *blkio_set(VALUE d, unsigned int flags,
2111
+ virTypedParameterPtr params, int nparams,
2112
+ void *RUBY_LIBVIRT_UNUSED(opaque))
2100
2113
  {
2101
2114
  #ifdef HAVE_TYPE_VIRTYPEDPARAMETERPTR
2102
2115
  if (virDomainSetBlkioParameters(ruby_libvirt_domain_get(d), params, nparams,
@@ -3178,8 +3191,8 @@ static VALUE libvirt_domain_job_stats(int argc, VALUE *argv, VALUE d)
3178
3191
  #endif
3179
3192
 
3180
3193
  #if HAVE_VIRDOMAINGETBLOCKIOTUNE
3181
- static char *iotune_nparams(VALUE d, unsigned int flags, void *opaque,
3182
- int *nparams)
3194
+ static const char *iotune_nparams(VALUE d, unsigned int flags, void *opaque,
3195
+ int *nparams)
3183
3196
  {
3184
3197
  VALUE disk = (VALUE)opaque;
3185
3198
 
@@ -3192,8 +3205,8 @@ static char *iotune_nparams(VALUE d, unsigned int flags, void *opaque,
3192
3205
  return NULL;
3193
3206
  }
3194
3207
 
3195
- static char *iotune_get(VALUE d, unsigned int flags, void *voidparams,
3196
- int *nparams, void *opaque)
3208
+ static const char *iotune_get(VALUE d, unsigned int flags, void *voidparams,
3209
+ int *nparams, void *opaque)
3197
3210
  {
3198
3211
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
3199
3212
  VALUE disk = (VALUE)opaque;
@@ -3206,9 +3219,9 @@ static char *iotune_get(VALUE d, unsigned int flags, void *voidparams,
3206
3219
  return NULL;
3207
3220
  }
3208
3221
 
3209
- static char *iotune_set(VALUE d, unsigned int flags,
3210
- virTypedParameterPtr params, int nparams,
3211
- void *opaque)
3222
+ static const char *iotune_set(VALUE d, unsigned int flags,
3223
+ virTypedParameterPtr params, int nparams,
3224
+ void *opaque)
3212
3225
  {
3213
3226
  VALUE disk = (VALUE)opaque;
3214
3227
 
@@ -3440,8 +3453,8 @@ static VALUE libvirt_domain_block_job_abort(int argc, VALUE *argv, VALUE d)
3440
3453
  #endif
3441
3454
 
3442
3455
  #if HAVE_VIRDOMAINGETINTERFACEPARAMETERS
3443
- static char *interface_nparams(VALUE d, unsigned int flags, void *opaque,
3444
- int *nparams)
3456
+ static const char *interface_nparams(VALUE d, unsigned int flags, void *opaque,
3457
+ int *nparams)
3445
3458
  {
3446
3459
  VALUE device = (VALUE)opaque;
3447
3460
 
@@ -3454,8 +3467,8 @@ static char *interface_nparams(VALUE d, unsigned int flags, void *opaque,
3454
3467
  return NULL;
3455
3468
  }
3456
3469
 
3457
- static char *interface_get(VALUE d, unsigned int flags, void *voidparams,
3458
- int *nparams, void *opaque)
3470
+ static const char *interface_get(VALUE d, unsigned int flags, void *voidparams,
3471
+ int *nparams, void *opaque)
3459
3472
  {
3460
3473
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
3461
3474
  VALUE interface = (VALUE)opaque;
@@ -3468,9 +3481,9 @@ static char *interface_get(VALUE d, unsigned int flags, void *voidparams,
3468
3481
  return NULL;
3469
3482
  }
3470
3483
 
3471
- static char *interface_set(VALUE d, unsigned int flags,
3472
- virTypedParameterPtr params, int nparams,
3473
- void *opaque)
3484
+ static const char *interface_set(VALUE d, unsigned int flags,
3485
+ virTypedParameterPtr params, int nparams,
3486
+ void *opaque)
3474
3487
  {
3475
3488
  VALUE device = (VALUE)opaque;
3476
3489
 
@@ -3552,8 +3565,8 @@ static VALUE libvirt_domain_interface_parameters_equal(VALUE d, VALUE in)
3552
3565
  #endif
3553
3566
 
3554
3567
  #if HAVE_VIRDOMAINBLOCKSTATSFLAGS
3555
- static char *block_stats_nparams(VALUE d, unsigned int flags, void *opaque,
3556
- int *nparams)
3568
+ static const char *block_stats_nparams(VALUE d, unsigned int flags,
3569
+ void *opaque, int *nparams)
3557
3570
  {
3558
3571
  VALUE disk = (VALUE)opaque;
3559
3572
 
@@ -3566,8 +3579,8 @@ static char *block_stats_nparams(VALUE d, unsigned int flags, void *opaque,
3566
3579
  return NULL;
3567
3580
  }
3568
3581
 
3569
- static char *block_stats_get(VALUE d, unsigned int flags, void *voidparams,
3570
- int *nparams, void *opaque)
3582
+ static const char *block_stats_get(VALUE d, unsigned int flags,
3583
+ void *voidparams, int *nparams, void *opaque)
3571
3584
  {
3572
3585
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
3573
3586
  VALUE disk = (VALUE)opaque;
@@ -3605,8 +3618,9 @@ static VALUE libvirt_domain_block_stats_flags(int argc, VALUE *argv, VALUE d)
3605
3618
  #endif
3606
3619
 
3607
3620
  #if HAVE_VIRDOMAINGETNUMAPARAMETERS
3608
- static char *numa_nparams(VALUE d, unsigned int flags, void *opaque,
3609
- int *nparams)
3621
+ static const char *numa_nparams(VALUE d, unsigned int flags,
3622
+ void *RUBY_LIBVIRT_UNUSED(opaque),
3623
+ int *nparams)
3610
3624
  {
3611
3625
  if (virDomainGetNumaParameters(ruby_libvirt_domain_get(d), NULL, nparams,
3612
3626
  flags) < 0) {
@@ -3616,8 +3630,8 @@ static char *numa_nparams(VALUE d, unsigned int flags, void *opaque,
3616
3630
  return NULL;
3617
3631
  }
3618
3632
 
3619
- static char *numa_get(VALUE d, unsigned int flags, void *voidparams,
3620
- int *nparams, void *opaque)
3633
+ static const char *numa_get(VALUE d, unsigned int flags, void *voidparams,
3634
+ int *nparams, void *RUBY_LIBVIRT_UNUSED(opaque))
3621
3635
  {
3622
3636
  virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
3623
3637
 
@@ -3628,8 +3642,9 @@ static char *numa_get(VALUE d, unsigned int flags, void *voidparams,
3628
3642
  return NULL;
3629
3643
  }
3630
3644
 
3631
- static char *numa_set(VALUE d, unsigned int flags, virTypedParameterPtr params,
3632
- int nparams, void *opaque)
3645
+ static const char *numa_set(VALUE d, unsigned int flags,
3646
+ virTypedParameterPtr params, int nparams,
3647
+ void *RUBY_LIBVIRT_UNUSED(opaque))
3633
3648
  {
3634
3649
  if (virDomainSetNumaParameters(ruby_libvirt_domain_get(d), params,
3635
3650
  nparams, flags) < 0) {
@@ -3792,9 +3807,9 @@ static VALUE libvirt_domain_lxc_enter_namespace(int argc, VALUE *argv, VALUE d)
3792
3807
  {
3793
3808
  VALUE fds, flags, result;
3794
3809
  int *fdlist;
3795
- int i, ret, exception = 0;
3810
+ int ret, exception = 0;
3796
3811
  int *oldfdlist;
3797
- unsigned int noldfdlist;
3812
+ unsigned int noldfdlist, i;
3798
3813
  struct ruby_libvirt_ary_store_arg args;
3799
3814
 
3800
3815
  rb_scan_args(argc, argv, "11", &fds, &flags);
@@ -3849,7 +3864,9 @@ static struct ruby_libvirt_typed_param migrate3_allowed[] = {
3849
3864
  {VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_STRING},
3850
3865
  {VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_ULLONG},
3851
3866
  {VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_STRING},
3867
+ #if HAVE_CONST_VIR_MIGRATE_PARAM_LISTEN_ADDRESS
3852
3868
  {VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_STRING},
3869
+ #endif
3853
3870
  };
3854
3871
 
3855
3872
  /*
@@ -5186,10 +5203,16 @@ void ruby_libvirt_domain_init(void)
5186
5203
  INT2NUM(VIR_DOMAIN_SNAPSHOT_CREATE_HALT));
5187
5204
  rb_define_const(c_domain_snapshot, "CREATE_DISK_ONLY",
5188
5205
  INT2NUM(VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY));
5206
+ #endif
5207
+ #if HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT
5189
5208
  rb_define_const(c_domain_snapshot, "CREATE_REUSE_EXT",
5190
5209
  INT2NUM(VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT));
5210
+ #endif
5211
+ #if HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE
5191
5212
  rb_define_const(c_domain_snapshot, "CREATE_QUIESCE",
5192
5213
  INT2NUM(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE));
5214
+ #endif
5215
+ #if HAVE_CONST_VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC
5193
5216
  rb_define_const(c_domain_snapshot, "CREATE_ATOMIC",
5194
5217
  INT2NUM(VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC));
5195
5218
  #endif
@@ -59,7 +59,7 @@ include = with_config("libvirt-include")
59
59
  lib = with_config("libvirt-lib")
60
60
  if include and lib
61
61
  $LIBPATH = [lib] | $LIBPATH
62
- $CPPFLAGS += "-I" + include
62
+ $CPPFLAGS += " -I" + include
63
63
  have_library("virt", "virConnectOpen", "libvirt/libvirt.h")
64
64
 
65
65
  # if we are using custom libvirt libraries, we have to suppress the default
@@ -398,6 +398,12 @@ libvirt_consts = [ 'VIR_MIGRATE_LIVE',
398
398
  'VIR_DOMAIN_BLOCK_JOB_READY',
399
399
  'VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES',
400
400
  'VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC',
401
+ 'VIR_MIGRATE_PARAM_LISTEN_ADDRESS',
402
+ 'VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD',
403
+ 'VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA',
404
+ 'VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT',
405
+ 'VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE',
406
+ 'VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC',
401
407
  ]
402
408
 
403
409
  virterror_consts = [
data/ext/libvirt/stream.c CHANGED
@@ -99,8 +99,8 @@ static VALUE libvirt_stream_recv(VALUE s, VALUE bytes)
99
99
  return result;
100
100
  }
101
101
 
102
- static int internal_sendall(virStreamPtr st, char *data, size_t nbytes,
103
- void *opaque)
102
+ static int internal_sendall(virStreamPtr RUBY_LIBVIRT_UNUSED(st), char *data,
103
+ size_t nbytes, void *opaque)
104
104
  {
105
105
  VALUE result, retcode, buffer;
106
106
 
@@ -124,7 +124,7 @@ static int internal_sendall(virStreamPtr st, char *data, size_t nbytes,
124
124
 
125
125
  StringValue(buffer);
126
126
 
127
- if (RSTRING_LEN(buffer) > nbytes) {
127
+ if (RSTRING_LEN(buffer) > (int)nbytes) {
128
128
  rb_raise(rb_eArgError, "asked for %zd bytes, block returned %ld",
129
129
  nbytes, RSTRING_LEN(buffer));
130
130
  }
@@ -166,8 +166,8 @@ static VALUE libvirt_stream_sendall(int argc, VALUE *argv, VALUE s)
166
166
  return Qnil;
167
167
  }
168
168
 
169
- static int internal_recvall(virStreamPtr st, const char *buf, size_t nbytes,
170
- void *opaque)
169
+ static int internal_recvall(virStreamPtr RUBY_LIBVIRT_UNUSED(st),
170
+ const char *buf, size_t nbytes, void *opaque)
171
171
  {
172
172
  VALUE result;
173
173
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lutterkort, Chris Lalancette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2013-12-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby bindings for libvirt.
14
14
  email: libvir-list@redhat.com