ruby-libvirt 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/libvirt/domain.h CHANGED
@@ -1,9 +1,11 @@
1
1
  #ifndef DOMAIN_H
2
2
  #define DOMAIN_H
3
3
 
4
- VALUE domain_new(virDomainPtr d, VALUE conn);
5
- virDomainPtr domain_get(VALUE s);
4
+ void ruby_libvirt_domain_init(void);
6
5
 
7
- void init_domain();
6
+ VALUE ruby_libvirt_domain_new(virDomainPtr d, VALUE conn);
7
+ virDomainPtr ruby_libvirt_domain_get(VALUE s);
8
+
9
+ extern VALUE c_domain_security_label;
8
10
 
9
11
  #endif
@@ -1,14 +1,8 @@
1
1
  require 'mkmf'
2
2
 
3
3
  RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
4
-
5
- def have_libvirt_funcs(funcs)
6
- funcs.each { |f| have_func(f, "libvirt/libvirt.h") }
7
- end
8
-
9
- def have_libvirt_types(types)
10
- types.each { |t| have_type(t, "libvirt/libvirt.h") }
11
- end
4
+ RbConfig::MAKEFILE_CONFIG['CCDLFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
5
+ RbConfig::MAKEFILE_CONFIG['EXTDLDFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
12
6
 
13
7
  # older mkmf does not have checking_message, so implement our own here
14
8
  def libvirt_checking_message(target, place = nil, opt = nil)
@@ -42,10 +36,6 @@ SRC
42
36
  end
43
37
  end
44
38
 
45
- def have_libvirt_consts(consts)
46
- consts.each { |c| have_const(c, ["libvirt/libvirt.h", "libvirt/virterror.h"]) }
47
- end
48
-
49
39
  extension_name = '_libvirt'
50
40
 
51
41
  # this is a poor-man's dir_config, but is a bit more flexible. In particular,
@@ -98,6 +88,7 @@ libvirt_types = [ 'virNetworkPtr',
98
88
  'virNodeDevicePtr',
99
89
  'virStreamPtr',
100
90
  'virTypedParameterPtr',
91
+ 'virDomainBlockJobInfoPtr',
101
92
  ]
102
93
 
103
94
  libvirt_funcs = [ 'virStorageVolWipe',
@@ -148,8 +139,92 @@ libvirt_funcs = [ 'virStorageVolWipe',
148
139
  'virInterfaceChangeBegin',
149
140
  'virStorageVolDownload',
150
141
  'virDomainInjectNMI',
142
+ 'virDomainGetControlInfo',
143
+ 'virDomainMigrateGetMaxSpeed',
144
+ 'virNodeGetCPUStats',
145
+ 'virNodeGetMemoryStats',
146
+ 'virDomainDestroyFlags',
147
+ 'virDomainSaveFlags',
148
+ 'virDomainSaveImageGetXMLDesc',
149
+ 'virDomainSendKey',
150
+ 'virNetworkUpdate',
151
+ 'virNodeSuspendForDuration',
152
+ 'virNodeGetMemoryParameters',
153
+ 'virNodeGetCPUMap',
154
+ 'virDomainUndefineFlags',
155
+ 'virDomainPinVcpuFlags',
156
+ 'virDomainGetVcpuPinInfo',
157
+ 'virDomainSnapshotGetName',
158
+ 'virConnectSetKeepAlive',
159
+ 'virDomainReset',
160
+ 'virDomainShutdownFlags',
161
+ 'virDomainGetHostname',
162
+ 'virDomainGetMetadata',
163
+ 'virDomainSetMetadata',
164
+ 'virConnectListAllDomains',
165
+ 'virConnectListAllNetworks',
166
+ 'virConnectListAllInterfaces',
167
+ 'virConnectListAllSecrets',
168
+ 'virConnectListAllNodeDevices',
169
+ 'virConnectListAllStoragePools',
170
+ 'virConnectListAllNWFilters',
171
+ 'virConnectIsAlive',
172
+ 'virNodeDeviceDetachFlags',
173
+ 'virDomainSendProcessSignal',
174
+ 'virDomainListAllSnapshots',
175
+ 'virDomainSnapshotNumChildren',
176
+ 'virDomainSnapshotListChildrenNames',
177
+ 'virDomainSnapshotListAllChildren',
178
+ 'virDomainSnapshotGetParent',
179
+ 'virDomainSnapshotIsCurrent',
180
+ 'virDomainSnapshotHasMetadata',
181
+ 'virDomainSetMemoryStatsPeriod',
182
+ 'virDomainFSTrim',
183
+ 'virDomainBlockRebase',
184
+ 'virDomainOpenChannel',
185
+ 'virNodeDeviceLookupSCSIHostByWWN',
186
+ 'virStorageVolWipePattern',
187
+ 'virStoragePoolListAllVolumes',
188
+ 'virDomainCreateWithFiles',
189
+ 'virDomainCreateXMLWithFiles',
190
+ 'virDomainOpenGraphics',
191
+ 'virStorageVolResize',
192
+ 'virDomainPMWakeup',
193
+ 'virDomainBlockResize',
194
+ 'virDomainPMSuspendForDuration',
195
+ 'virDomainMigrateGetCompressionCache',
196
+ 'virDomainMigrateSetCompressionCache',
197
+ 'virDomainGetDiskErrors',
198
+ 'virDomainGetEmulatorPinInfo',
199
+ 'virDomainPinEmulator',
200
+ 'virDomainGetSecurityLabelList',
201
+ 'virDomainGetJobStats',
202
+ 'virDomainGetBlockIoTune',
203
+ 'virDomainSetBlockIoTune',
204
+ 'virDomainBlockCommit',
205
+ 'virDomainBlockPull',
206
+ 'virDomainBlockJobSetSpeed',
207
+ 'virDomainGetBlockJobInfo',
208
+ 'virDomainBlockJobAbort',
209
+ 'virDomainGetInterfaceParameters',
210
+ 'virDomainBlockStatsFlags',
211
+ 'virDomainGetNumaParameters',
212
+ 'virConnectGetCPUModelNames',
213
+ 'virDomainMigrate3',
214
+ 'virDomainGetCPUStats',
151
215
  ]
152
216
 
217
+ libvirt_qemu_funcs = [ 'virDomainQemuMonitorCommand',
218
+ 'virDomainQemuAttach',
219
+ 'virDomainQemuAgentCommand'
220
+ ]
221
+
222
+ libvirt_lxc_funcs = [
223
+ 'virDomainLxcOpenNamespace',
224
+ 'virDomainLxcEnterNamespace',
225
+ 'virDomainLxcEnterSecurityLabel',
226
+ ]
227
+
153
228
  libvirt_consts = [ 'VIR_MIGRATE_LIVE',
154
229
  'VIR_MIGRATE_PEER2PEER',
155
230
  'VIR_MIGRATE_TUNNELLED',
@@ -178,44 +253,203 @@ libvirt_consts = [ 'VIR_MIGRATE_LIVE',
178
253
  'VIR_DOMAIN_EVENT_ID_REBOOT',
179
254
  'VIR_DOMAIN_EVENT_ID_RTC_CHANGE',
180
255
  'VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON',
181
- 'VIR_FROM_VMWARE',
182
- 'VIR_FROM_AUDIT',
183
- 'VIR_FROM_SYSINFO',
184
- 'VIR_FROM_STREAMS',
185
- 'VIR_FROM_XENAPI',
186
- 'VIR_FROM_HOOK',
187
- 'VIR_ERR_HOOK_SCRIPT_FAILED',
188
- 'VIR_ERR_MIGRATE_PERSIST_FAILED',
189
- 'VIR_ERR_OPERATION_TIMEOUT',
190
- 'VIR_ERR_CONFIG_UNSUPPORTED',
191
- 'VIR_FROM_XENXM',
192
- 'VIR_ERR_OPERATION_INVALID',
193
- 'VIR_ERR_NO_SECURITY_MODEL',
194
- 'VIR_ERR_AUTH_FAILED',
195
- 'VIR_FROM_PHYP',
196
- 'VIR_FROM_ESX',
197
- 'VIR_FROM_ONE',
198
- 'VIR_FROM_VBOX',
199
- 'VIR_FROM_LXC',
200
- 'VIR_FROM_UML',
201
- 'VIR_FROM_NETWORK',
202
- 'VIR_FROM_DOMAIN',
203
- 'VIR_FROM_STATS_LINUX',
204
- 'VIR_FROM_XEN_INOTIFY',
205
- 'VIR_FROM_SECURITY',
206
256
  'VIR_DOMAIN_AFFECT_CURRENT',
207
257
  'VIR_DOMAIN_MEM_CURRENT',
208
258
  'VIR_DOMAIN_EVENT_ID_CONTROL_ERROR',
259
+ 'VIR_DOMAIN_PAUSED_SHUTTING_DOWN',
260
+ 'VIR_DOMAIN_START_AUTODESTROY',
261
+ 'VIR_DOMAIN_START_BYPASS_CACHE',
262
+ 'VIR_DOMAIN_START_FORCE_BOOT',
263
+ 'VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON',
264
+ 'VIR_DUMP_BYPASS_CACHE',
265
+ 'VIR_MIGRATE_CHANGE_PROTECTION',
266
+ 'VIR_DOMAIN_SAVE_BYPASS_CACHE',
267
+ 'VIR_DOMAIN_SAVE_RUNNING',
268
+ 'VIR_DOMAIN_SAVE_PAUSED',
269
+ 'VIR_NETWORK_UPDATE_COMMAND_NONE',
270
+ 'VIR_NETWORK_UPDATE_COMMAND_MODIFY',
271
+ 'VIR_NETWORK_UPDATE_COMMAND_DELETE',
272
+ 'VIR_NETWORK_UPDATE_COMMAND_ADD_LAST',
273
+ 'VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST',
274
+ 'VIR_NETWORK_SECTION_NONE',
275
+ 'VIR_NETWORK_SECTION_BRIDGE',
276
+ 'VIR_NETWORK_SECTION_DOMAIN',
277
+ 'VIR_NETWORK_SECTION_IP',
278
+ 'VIR_NETWORK_SECTION_IP_DHCP_HOST',
279
+ 'VIR_NETWORK_SECTION_IP_DHCP_RANGE',
280
+ 'VIR_NETWORK_SECTION_FORWARD',
281
+ 'VIR_NETWORK_SECTION_FORWARD_INTERFACE',
282
+ 'VIR_NETWORK_SECTION_FORWARD_PF',
283
+ 'VIR_NETWORK_SECTION_PORTGROUP',
284
+ 'VIR_NETWORK_SECTION_DNS_HOST',
285
+ 'VIR_NETWORK_SECTION_DNS_TXT',
286
+ 'VIR_NETWORK_SECTION_DNS_SRV',
287
+ 'VIR_NETWORK_UPDATE_AFFECT_CURRENT',
288
+ 'VIR_NETWORK_UPDATE_AFFECT_LIVE',
289
+ 'VIR_NETWORK_UPDATE_AFFECT_CONFIG',
290
+ 'VIR_DOMAIN_PMSUSPENDED',
291
+ 'VIR_DOMAIN_RUNNING_WAKEUP',
292
+ 'VIR_DOMAIN_PMSUSPENDED_UNKNOWN',
293
+ 'VIR_DOMAIN_UNDEFINE_MANAGED_SAVE',
294
+ 'VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA',
295
+ 'VIR_DOMAIN_PAUSED_SNAPSHOT',
296
+ 'VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN',
297
+ 'VIR_DUMP_RESET',
298
+ 'VIR_DUMP_MEMORY_ONLY',
299
+ 'VIR_DOMAIN_SHUTDOWN_DEFAULT',
300
+ 'VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN',
301
+ 'VIR_DOMAIN_SHUTDOWN_GUEST_AGENT',
302
+ 'VIR_DOMAIN_SHUTDOWN_INITCTL',
303
+ 'VIR_DOMAIN_SHUTDOWN_SIGNAL',
304
+ 'VIR_DOMAIN_REBOOT_DEFAULT',
305
+ 'VIR_DOMAIN_REBOOT_ACPI_POWER_BTN',
306
+ 'VIR_DOMAIN_REBOOT_GUEST_AGENT',
307
+ 'VIR_DOMAIN_REBOOT_INITCTL',
308
+ 'VIR_DOMAIN_REBOOT_SIGNAL',
309
+ 'VIR_DOMAIN_DESTROY_DEFAULT',
310
+ 'VIR_DOMAIN_DESTROY_GRACEFUL',
311
+ 'VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST',
312
+ 'VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE',
313
+ 'VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE',
314
+ 'VIR_DOMAIN_SNAPSHOT_CREATE_LIVE',
315
+ 'VIR_DOMAIN_BLOCK_REBASE_SHALLOW',
316
+ 'VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT',
317
+ 'VIR_DOMAIN_BLOCK_REBASE_COPY_RAW',
318
+ 'VIR_DOMAIN_BLOCK_REBASE_COPY',
319
+ 'VIR_DOMAIN_CHANNEL_FORCE',
320
+ 'VIR_DOMAIN_CONSOLE_FORCE',
321
+ 'VIR_DOMAIN_CONSOLE_SAFE',
322
+ 'VIR_STORAGE_VOL_WIPE_ALG_ZERO',
323
+ 'VIR_STORAGE_VOL_WIPE_ALG_NNSA',
324
+ 'VIR_STORAGE_VOL_WIPE_ALG_DOD',
325
+ 'VIR_STORAGE_VOL_WIPE_ALG_BSI',
326
+ 'VIR_STORAGE_VOL_WIPE_ALG_GUTMANN',
327
+ 'VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER',
328
+ 'VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7',
329
+ 'VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33',
330
+ 'VIR_STORAGE_VOL_WIPE_ALG_RANDOM',
331
+ 'VIR_DOMAIN_BLOCK_RESIZE_BYTES',
332
+ 'VIR_DOMAIN_MEMORY_STAT_RSS',
333
+ 'VIR_MIGRATE_UNSAFE',
334
+ 'VIR_MIGRATE_OFFLINE',
335
+ 'VIR_MIGRATE_COMPRESSED',
336
+ 'VIR_MIGRATE_ABORT_ON_ERROR',
337
+ 'VIR_CONNECT_NO_ALIASES',
338
+ 'VIR_DOMAIN_XML_MIGRATABLE',
339
+ 'VIR_NETWORK_XML_INACTIVE',
340
+ 'VIR_STORAGE_VOL_DIR',
341
+ 'VIR_STORAGE_VOL_NETWORK',
342
+ 'VIR_STORAGE_XML_INACTIVE',
343
+ 'VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA',
344
+ 'VIR_SECRET_USAGE_TYPE_CEPH',
345
+ 'VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING',
346
+ 'VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED',
347
+ 'VIR_DOMAIN_SNAPSHOT_REVERT_FORCE',
348
+ 'VIR_SECRET_USAGE_TYPE_ISCSI',
349
+ 'VIR_DOMAIN_NOSTATE_UNKNOWN',
350
+ 'VIR_DOMAIN_RUNNING_CRASHED',
351
+ 'VIR_DOMAIN_PAUSED_CRASHED',
352
+ 'VIR_DOMAIN_CRASHED_PANICKED',
353
+ 'VIR_NODE_CPU_STATS_ALL_CPUS',
354
+ 'VIR_NODE_MEMORY_STATS_ALL_CELLS',
355
+ 'VIR_DOMAIN_VCPU_CURRENT',
356
+ 'VIR_DOMAIN_VCPU_GUEST',
357
+ 'VIR_NETWORK_UPDATE_COMMAND_DELETE',
358
+ 'VIR_STORAGE_POOL_BUILD_NO_OVERWRITE',
359
+ 'VIR_STORAGE_POOL_BUILD_OVERWRITE',
360
+ 'VIR_KEYCODE_SET_LINUX',
361
+ 'VIR_KEYCODE_SET_XT',
362
+ 'VIR_KEYCODE_SET_ATSET1',
363
+ 'VIR_KEYCODE_SET_ATSET2',
364
+ 'VIR_KEYCODE_SET_ATSET3',
365
+ 'VIR_KEYCODE_SET_OSX',
366
+ 'VIR_KEYCODE_SET_XT_KBD',
367
+ 'VIR_KEYCODE_SET_USB',
368
+ 'VIR_KEYCODE_SET_WIN32',
369
+ 'VIR_KEYCODE_SET_RFB',
370
+ 'VIR_DOMAIN_EVENT_SHUTDOWN',
371
+ 'VIR_DOMAIN_EVENT_PMSUSPENDED',
372
+ 'VIR_DOMAIN_EVENT_CRASHED',
373
+ 'VIR_DOMAIN_EVENT_STARTED_WAKEUP',
374
+ 'VIR_DOMAIN_EVENT_SUSPENDED_RESTORED',
375
+ 'VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT',
376
+ 'VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR',
377
+ 'VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT',
378
+ 'VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED',
379
+ 'VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY',
380
+ 'VIR_DOMAIN_EVENT_PMSUSPENDED_DISK',
381
+ 'VIR_DOMAIN_EVENT_CRASHED_PANICKED',
382
+ 'VIR_SECRET_USAGE_TYPE_NONE',
383
+ 'VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES',
384
+ 'VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY',
385
+ 'VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY',
386
+ 'VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX',
387
+ 'VIR_DOMAIN_BLOCK_COMMIT_SHALLOW',
388
+ 'VIR_DOMAIN_BLOCK_COMMIT_DELETE',
389
+ 'VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN',
390
+ 'VIR_DOMAIN_BLOCK_JOB_TYPE_PULL',
391
+ 'VIR_DOMAIN_BLOCK_JOB_TYPE_COPY',
392
+ 'VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT',
393
+ 'VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC',
394
+ 'VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT',
395
+ 'VIR_DOMAIN_BLOCK_JOB_COMPLETED',
396
+ 'VIR_DOMAIN_BLOCK_JOB_FAILED',
397
+ 'VIR_DOMAIN_BLOCK_JOB_CANCELED',
398
+ 'VIR_DOMAIN_BLOCK_JOB_READY',
399
+ 'VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES',
400
+ 'VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC',
209
401
  ]
210
402
 
211
- have_libvirt_types(libvirt_types)
212
- have_libvirt_funcs(libvirt_funcs)
403
+ virterror_consts = [
404
+ 'VIR_FROM_VMWARE',
405
+ 'VIR_FROM_AUDIT',
406
+ 'VIR_FROM_SYSINFO',
407
+ 'VIR_FROM_STREAMS',
408
+ 'VIR_FROM_XENAPI',
409
+ 'VIR_FROM_HOOK',
410
+ 'VIR_ERR_HOOK_SCRIPT_FAILED',
411
+ 'VIR_ERR_MIGRATE_PERSIST_FAILED',
412
+ 'VIR_ERR_OPERATION_TIMEOUT',
413
+ 'VIR_ERR_CONFIG_UNSUPPORTED',
414
+ 'VIR_FROM_XENXM',
415
+ 'VIR_ERR_OPERATION_INVALID',
416
+ 'VIR_ERR_NO_SECURITY_MODEL',
417
+ 'VIR_ERR_AUTH_FAILED',
418
+ 'VIR_FROM_PHYP',
419
+ 'VIR_FROM_ESX',
420
+ 'VIR_FROM_ONE',
421
+ 'VIR_FROM_VBOX',
422
+ 'VIR_FROM_LXC',
423
+ 'VIR_FROM_UML',
424
+ 'VIR_FROM_NETWORK',
425
+ 'VIR_FROM_DOMAIN',
426
+ 'VIR_FROM_STATS_LINUX',
427
+ 'VIR_FROM_XEN_INOTIFY',
428
+ 'VIR_FROM_SECURITY',
429
+ ]
430
+
431
+ libvirt_qemu_consts = [
432
+ 'VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK',
433
+ 'VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT',
434
+ 'VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT',
435
+ 'VIR_DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT',
436
+ 'VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP',
437
+ ]
438
+
439
+ libvirt_types.each { |t| have_type(t, "libvirt/libvirt.h") }
440
+ libvirt_funcs.each { |f| have_func(f, "libvirt/libvirt.h") }
441
+ libvirt_consts.each { |c| have_const(c, ["libvirt/libvirt.h"]) }
442
+ virterror_consts.each { |c| have_const(c, ["libvirt/virterror.h"]) }
213
443
  if find_header("libvirt/libvirt-qemu.h")
214
444
  have_library("virt-qemu", "virDomainQemuMonitorCommand")
215
- have_func("virDomainQemuMonitorCommand", "libvirt/libvirt-qemu.h")
445
+ libvirt_qemu_funcs.each { |f| have_func(f, "libvirt/libvirt-qemu.h") }
446
+ libvirt_qemu_consts.each { |c| have_const(c, ["libvirt/libvirt-qemu.h"]) }
216
447
  end
217
448
 
218
- have_libvirt_consts(libvirt_consts)
449
+ if find_header("libvirt/libvirt-lxc.h")
450
+ have_library("virt-lxc", "virDomainLxcOpenNamespace")
451
+ libvirt_lxc_funcs.each{ |f| have_func(f, "libvirt/libvirt-lxc.h") }
452
+ end
219
453
 
220
454
  create_header
221
455
  create_makefile(extension_name)
@@ -2,6 +2,7 @@
2
2
  * interface.c: virInterface methods
3
3
  *
4
4
  * Copyright (C) 2010 Red Hat Inc.
5
+ * Copyright (C) 2013 Chris Lalancette <clalancette@gmail.com>
5
6
  *
6
7
  * This library is free software; you can redistribute it and/or
7
8
  * modify it under the terms of the GNU Lesser General Public
@@ -28,63 +29,71 @@
28
29
  #if HAVE_TYPE_VIRINTERFACEPTR
29
30
  static VALUE c_interface;
30
31
 
31
- static void interface_free(void *i) {
32
- generic_free(Interface, i);
32
+ static void interface_free(void *i)
33
+ {
34
+ ruby_libvirt_free_struct(Interface, i);
33
35
  }
34
36
 
35
- static virInterfacePtr interface_get(VALUE s) {
36
- generic_get(Interface, s);
37
+ static virInterfacePtr interface_get(VALUE i)
38
+ {
39
+ ruby_libvirt_get_struct(Interface, i);
37
40
  }
38
41
 
39
- VALUE interface_new(virInterfacePtr i, VALUE conn) {
40
- return generic_new(c_interface, i, conn, interface_free);
42
+ VALUE ruby_libvirt_interface_new(virInterfacePtr i, VALUE conn)
43
+ {
44
+ return ruby_libvirt_new_class(c_interface, i, conn, interface_free);
41
45
  }
42
46
 
43
47
  /*
44
48
  * call-seq:
45
49
  * interface.undefine -> nil
46
50
  *
47
- * Call +virInterfaceUndefine+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceUndefine]
51
+ * Call virInterfaceUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceUndefine]
48
52
  * to undefine this interface.
49
53
  */
50
- static VALUE libvirt_interface_undefine(VALUE s) {
51
- gen_call_void(virInterfaceUndefine, conn(s), interface_get(s));
54
+ static VALUE libvirt_interface_undefine(VALUE i)
55
+ {
56
+ ruby_libvirt_generate_call_nil(virInterfaceUndefine,
57
+ ruby_libvirt_connect_get(i),
58
+ interface_get(i));
52
59
  }
53
60
 
54
61
  /*
55
62
  * call-seq:
56
63
  * interface.create(flags=0) -> nil
57
64
  *
58
- * Call +virInterfaceCreate+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceCreate]
65
+ * Call virInterfaceCreate[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceCreate]
59
66
  * to start this interface.
60
67
  */
61
- static VALUE libvirt_interface_create(int argc, VALUE *argv, VALUE s) {
68
+ static VALUE libvirt_interface_create(int argc, VALUE *argv, VALUE i)
69
+ {
62
70
  VALUE flags;
63
71
 
64
72
  rb_scan_args(argc, argv, "01", &flags);
65
- if (NIL_P(flags))
66
- flags = INT2NUM(0);
67
73
 
68
- gen_call_void(virInterfaceCreate, conn(s), interface_get(s),
69
- NUM2UINT(flags));
74
+ ruby_libvirt_generate_call_nil(virInterfaceCreate,
75
+ ruby_libvirt_connect_get(i),
76
+ interface_get(i),
77
+ ruby_libvirt_value_to_uint(flags));
70
78
  }
71
79
 
72
80
  /*
73
81
  * call-seq:
74
82
  * interface.destroy(flags=0) -> nil
75
83
  *
76
- * Call +virInterfaceDestroy+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceDestroy]
84
+ * Call virInterfaceDestroy[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceDestroy]
77
85
  * to shutdown this interface.
78
86
  */
79
- static VALUE libvirt_interface_destroy(int argc, VALUE *argv, VALUE s) {
87
+ static VALUE libvirt_interface_destroy(int argc, VALUE *argv, VALUE i)
88
+ {
80
89
  VALUE flags;
81
90
 
82
91
  rb_scan_args(argc, argv, "01", &flags);
83
- if (NIL_P(flags))
84
- flags = INT2NUM(0);
85
92
 
86
- gen_call_void(virInterfaceDestroy, conn(s), interface_get(s),
87
- NUM2UINT(flags));
93
+ ruby_libvirt_generate_call_nil(virInterfaceDestroy,
94
+ ruby_libvirt_connect_get(i),
95
+ interface_get(i),
96
+ ruby_libvirt_value_to_uint(flags));
88
97
  }
89
98
 
90
99
  #if HAVE_VIRINTERFACEISACTIVE
@@ -92,11 +101,14 @@ static VALUE libvirt_interface_destroy(int argc, VALUE *argv, VALUE s) {
92
101
  * call-seq:
93
102
  * interface.active? -> [true|false]
94
103
  *
95
- * Call +virInterfaceIsActive+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceIsActive]
104
+ * Call virInterfaceIsActive[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceIsActive]
96
105
  * to determine if this interface is currently active.
97
106
  */
98
- static VALUE libvirt_interface_active_p(VALUE p) {
99
- gen_call_truefalse(virInterfaceIsActive, conn(p), interface_get(p));
107
+ static VALUE libvirt_interface_active_p(VALUE p)
108
+ {
109
+ ruby_libvirt_generate_call_truefalse(virInterfaceIsActive,
110
+ ruby_libvirt_connect_get(p),
111
+ interface_get(p));
100
112
  }
101
113
  #endif
102
114
 
@@ -104,59 +116,66 @@ static VALUE libvirt_interface_active_p(VALUE p) {
104
116
  * call-seq:
105
117
  * interface.name -> string
106
118
  *
107
- * Call +virInterfaceGetName+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetName]
119
+ * Call virInterfaceGetName[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetName]
108
120
  * to retrieve the name of this interface.
109
121
  */
110
- static VALUE libvirt_interface_name(VALUE s) {
111
- gen_call_string(virInterfaceGetName, conn(s), 0, interface_get(s));
122
+ static VALUE libvirt_interface_name(VALUE i)
123
+ {
124
+ ruby_libvirt_generate_call_string(virInterfaceGetName,
125
+ ruby_libvirt_connect_get(i), 0,
126
+ interface_get(i));
112
127
  }
113
128
 
114
129
  /*
115
130
  * call-seq:
116
131
  * interface.mac -> string
117
132
  *
118
- * Call +virInterfaceGetMACString+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetMACString]
133
+ * Call virInterfaceGetMACString[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetMACString]
119
134
  * to retrieve the MAC address of this interface.
120
135
  */
121
- static VALUE libvirt_interface_mac(VALUE s) {
122
- gen_call_string(virInterfaceGetMACString, conn(s), 0, interface_get(s));
136
+ static VALUE libvirt_interface_mac(VALUE i)
137
+ {
138
+ ruby_libvirt_generate_call_string(virInterfaceGetMACString,
139
+ ruby_libvirt_connect_get(i),
140
+ 0, interface_get(i));
123
141
  }
124
142
 
125
143
  /*
126
144
  * call-seq:
127
145
  * interface.xml_desc -> string
128
146
  *
129
- * Call +virInterfaceGetXMLDesc+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetXMLDesc]
147
+ * Call virInterfaceGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceGetXMLDesc]
130
148
  * to retrieve the XML of this interface.
131
149
  */
132
- static VALUE libvirt_interface_xml_desc(int argc, VALUE *argv, VALUE s) {
150
+ static VALUE libvirt_interface_xml_desc(int argc, VALUE *argv, VALUE i)
151
+ {
133
152
  VALUE flags;
134
153
 
135
154
  rb_scan_args(argc, argv, "01", &flags);
136
155
 
137
- if (NIL_P(flags))
138
- flags = INT2NUM(0);
139
-
140
- gen_call_string(virInterfaceGetXMLDesc, conn(s), 1, interface_get(s),
141
- NUM2UINT(flags));
156
+ ruby_libvirt_generate_call_string(virInterfaceGetXMLDesc,
157
+ ruby_libvirt_connect_get(i),
158
+ 1, interface_get(i),
159
+ ruby_libvirt_value_to_uint(flags));
142
160
  }
143
161
 
144
162
  /*
145
163
  * call-seq:
146
164
  * interface.free -> nil
147
165
  *
148
- * Call +virInterfaceFree+[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceFree]
166
+ * Call virInterfaceFree[http://www.libvirt.org/html/libvirt-libvirt.html#virInterfaceFree]
149
167
  * to free this interface. The object will no longer be valid after this call.
150
168
  */
151
- static VALUE libvirt_interface_free(VALUE s) {
152
- gen_call_free(Interface, s);
169
+ static VALUE libvirt_interface_free(VALUE i)
170
+ {
171
+ ruby_libvirt_generate_call_free(Interface, i);
153
172
  }
154
173
  #endif
155
174
 
156
175
  /*
157
176
  * Class Libvirt::Interface
158
177
  */
159
- void init_interface()
178
+ void ruby_libvirt_interface_init(void)
160
179
  {
161
180
  #if HAVE_TYPE_VIRINTERFACEPTR
162
181
  c_interface = rb_define_class_under(m_libvirt, "Interface", rb_cObject);