ffi-vix_disk_lib 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/ffi-vix_disk_lib/api.rb +16 -36
- data/lib/ffi-vix_disk_lib/version.rb +1 -1
- data/spec/ext/.gitignore +3 -0
- data/spec/ext/Makefile +30 -0
- data/spec/ext/vixDiskLib.c +456 -0
- data/spec/ffi-vix_disk_lib/api_spec.rb +27 -15
- data/spec/spec_helper.rb +2 -13
- metadata +15 -12
- data/spec/ffi-vix_disk_lib/version_spec.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ac1c3cd0e843538159ebfd0eafd97daa38f110c2a23e40189a398cd186bda36f
|
4
|
+
data.tar.gz: fa9ff1758564340eba7ad155c227228456d0a1b6baa3465020131cfce39c57cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d5ae132b933ce99634f7889d9b1e741f7afefb81020ad431375dec9fe782aab6a6d6d5ef59cee00ef14a64c6fa80bbcc3bcd2fab20c63e9a3a00e6077b48831
|
7
|
+
data.tar.gz: f761743edd3559fbed1a797ff844703d660fb0ab396055c08c9862d58438f02eb3005587417d1db5b33f726e541bc1a654aa23abb5dc53cc0e255a751d745551
|
data/lib/ffi-vix_disk_lib/api.rb
CHANGED
@@ -5,44 +5,29 @@ module FFI
|
|
5
5
|
module API
|
6
6
|
extend FFI::Library
|
7
7
|
|
8
|
-
def attach_function(*args)
|
8
|
+
def self.attach_function(*args)
|
9
9
|
super
|
10
10
|
rescue FFI::NotFoundError
|
11
11
|
warn "unable to attach #{args.first}"
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
version_load_order.each do |version|
|
26
|
-
begin
|
27
|
-
loaded_library = ffi_lib ["vixDiskLib.so.#{version}"]
|
28
|
-
VERSION_MAJOR, VERSION_MINOR = loaded_library.first.name.split(".")[2, 2].collect(&:to_i)
|
29
|
-
VERSION = version
|
30
|
-
if bad_versions.keys.include?(version)
|
31
|
-
loaded_library = ""
|
32
|
-
@load_error = "VixDiskLib #{version} is not supported: #{bad_versions[version]}"
|
33
|
-
end
|
34
|
-
break
|
35
|
-
rescue LoadError => err
|
36
|
-
load_errors << "ffi-vix_disk_lib: failed to load #{version} version with error: #{err.message}."
|
37
|
-
next
|
14
|
+
candidate_versions = %w[6.7.0 6.5.0 6.0.0 5.5.4 5.5.2 5.5.1 5.5.0 5.1.3 5.1.2 5.1.1 5.1.0 5.0.4 5.0.0 1.2.0 1.1.2]
|
15
|
+
candidate_libraries = candidate_versions.map { |v| "vixDiskLib.so.#{v}" }
|
16
|
+
|
17
|
+
# LD_LIBRARY_PATH is not honored on Mac, so build our own rudimentary version
|
18
|
+
if RbConfig::CONFIG["host_os"] =~ /darwin/ && (env = ENV["LD_LIBRARY_PATH"] || ENV["DYLD_LIBRARY_PATH"])
|
19
|
+
candidate_libraries = candidate_libraries.product(env.split(":")).flat_map do |n, p|
|
20
|
+
[
|
21
|
+
File.join(p, n),
|
22
|
+
File.join(p, FFI.map_library_name(n).chomp(".dylib")),
|
23
|
+
File.join(p, FFI.map_library_name(n))
|
24
|
+
]
|
38
25
|
end
|
39
26
|
end
|
40
27
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
LOADED_LIBRARY = loaded_library
|
28
|
+
LOADED_LIBRARY = ffi_lib(candidate_libraries)
|
29
|
+
VERSION = LOADED_LIBRARY.first.name.chomp(".dylib").split(".").last(3).join(".")
|
30
|
+
VERSION_MAJOR, VERSION_MINOR, = VERSION.split(".").map(&:to_i)
|
46
31
|
|
47
32
|
# An error is a 64-bit value. If there is no error, then the value is
|
48
33
|
# set to VIX_OK. If there is an error, then the least significant bits
|
@@ -63,12 +48,7 @@ module FFI
|
|
63
48
|
end
|
64
49
|
|
65
50
|
def self.evaluate_versioned_connect_params
|
66
|
-
|
67
|
-
when "6.5.0"
|
68
|
-
ConnectParams_6_5_0
|
69
|
-
else
|
70
|
-
ConnectParams_1_0_0
|
71
|
-
end
|
51
|
+
Gem::Version.new(VERSION) >= Gem::Version.new("6.5.0") ? ConnectParams_6_5_0 : ConnectParams_1_0_0
|
72
52
|
end
|
73
53
|
|
74
54
|
ConnectParams = evaluate_versioned_connect_params
|
data/spec/ext/.gitignore
ADDED
data/spec/ext/Makefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
CC=gcc
|
2
|
+
CFLAGS=-I.
|
3
|
+
CFLAGS = -fPIC -O0 -g
|
4
|
+
LDFLAGS = -shared
|
5
|
+
LN = ln -sf
|
6
|
+
SRCS = vixDiskLib.c
|
7
|
+
OBJS = ${SRCS:.c=.o}
|
8
|
+
TARGET_LIB = libvixDiskLib.so
|
9
|
+
MAJOR_VERSION = $(shell echo ${VDDK_VERSION} | cut -f1 -d.)
|
10
|
+
VDDK_VERSION ?= 6.7.0
|
11
|
+
|
12
|
+
.PHONY: all
|
13
|
+
all: ${TARGET_LIB}.${VDDK_VERSION}
|
14
|
+
|
15
|
+
${SRCS:.c=.d}:%.d:%.c
|
16
|
+
${CC} ${CFLAGS} -MM $< >$@
|
17
|
+
|
18
|
+
${TARGET_LIB}.${MAJOR_VERSION}: ${TARGET_LIB}
|
19
|
+
${LN} $^ $@
|
20
|
+
${TARGET_LIB}.${VDDK_VERSION}: ${TARGET_LIB}.${MAJOR_VERSION}
|
21
|
+
${LN} $^ $@
|
22
|
+
|
23
|
+
${TARGET_LIB}: ${OBJS}
|
24
|
+
${CC} ${LDFLAGS} -o $@ $^
|
25
|
+
|
26
|
+
include ${SRCS:.c=.d}
|
27
|
+
|
28
|
+
.PHONY: clean
|
29
|
+
clean:
|
30
|
+
-${RM} ${TARGET_LIB} ${TARGET_LIB}.${MAJOR_VERSION} ${TARGET_LIB}.${VDDK_VERSION} ${OBJS} ${SRCS:.c=.d}
|
@@ -0,0 +1,456 @@
|
|
1
|
+
#include <stdlib.h>
|
2
|
+
#include <stddef.h>
|
3
|
+
#include <stdarg.h>
|
4
|
+
#include <stdint.h>
|
5
|
+
|
6
|
+
typedef uint64_t uint64;
|
7
|
+
typedef int64_t int64;
|
8
|
+
typedef uint32_t uint32;
|
9
|
+
typedef int32_t int32;
|
10
|
+
typedef uint16_t uint16;
|
11
|
+
typedef int16_t int16;
|
12
|
+
typedef uint8_t uint8;
|
13
|
+
typedef int8_t int8;
|
14
|
+
typedef char Bool;
|
15
|
+
typedef uint64 VixError;
|
16
|
+
|
17
|
+
enum {
|
18
|
+
VIX_OK = 0,
|
19
|
+
};
|
20
|
+
|
21
|
+
typedef struct VixDiskLibHandleStruct VixDiskLibHandleStruct;
|
22
|
+
typedef VixDiskLibHandleStruct *VixDiskLibHandle;
|
23
|
+
typedef void (VixDiskLibGenericLogFunc)(const char *fmt, va_list args);
|
24
|
+
struct VixDiskLibConnectParam;
|
25
|
+
typedef struct VixDiskLibConnectParam *VixDiskLibConnection;
|
26
|
+
typedef Bool (*VixDiskLibProgressFunc)(void *progressData,
|
27
|
+
int percentCompleted);
|
28
|
+
typedef void (*VixDiskLibCompletionCB)(void *cbData, VixError result);
|
29
|
+
typedef enum {
|
30
|
+
VIXDISKLIB_DISK_UNKNOWN = 256
|
31
|
+
} VixDiskLibDiskType;
|
32
|
+
|
33
|
+
typedef enum {
|
34
|
+
VIXDISKLIB_ADAPTER_UNKNOWN = 256
|
35
|
+
} VixDiskLibAdapterType;
|
36
|
+
|
37
|
+
typedef uint64 VixDiskLibSectorType;
|
38
|
+
|
39
|
+
typedef struct {
|
40
|
+
VixDiskLibDiskType diskType;
|
41
|
+
VixDiskLibAdapterType adapterType;
|
42
|
+
uint16 hwVersion;
|
43
|
+
VixDiskLibSectorType capacity;
|
44
|
+
} VixDiskLibCreateParams;
|
45
|
+
|
46
|
+
typedef enum {
|
47
|
+
VIXDISKLIB_CRED_UNKNOWN = 256
|
48
|
+
} VixDiskLibCredType;
|
49
|
+
|
50
|
+
typedef struct {
|
51
|
+
uint32 cylinders;
|
52
|
+
uint32 heads;
|
53
|
+
uint32 sectors;
|
54
|
+
} VixDiskLibGeometry;
|
55
|
+
|
56
|
+
typedef struct {
|
57
|
+
VixDiskLibGeometry biosGeo; // BIOS geometry for booting and partitioning
|
58
|
+
VixDiskLibGeometry physGeo; // physical geometry
|
59
|
+
VixDiskLibSectorType capacity; // total capacity in sectors
|
60
|
+
VixDiskLibAdapterType adapterType; // adapter type
|
61
|
+
int numLinks; // number of links (i.e. base disk + redo logs)
|
62
|
+
char *parentFileNameHint; // parent file for a redo log
|
63
|
+
char *uuid; // disk UUID
|
64
|
+
} VixDiskLibInfo;
|
65
|
+
|
66
|
+
typedef struct VixDiskLibConnectParamsState VixDiskLibConnectParamsState;
|
67
|
+
|
68
|
+
typedef struct {
|
69
|
+
VixDiskLibSectorType offset; // offset in sectors
|
70
|
+
VixDiskLibSectorType length;
|
71
|
+
} VixDiskLibBlock;
|
72
|
+
|
73
|
+
typedef struct {
|
74
|
+
uint32 numBlocks;
|
75
|
+
VixDiskLibBlock blocks[1];
|
76
|
+
} VixDiskLibBlockList;
|
77
|
+
|
78
|
+
typedef struct {
|
79
|
+
char *id;
|
80
|
+
char *datastoreMoRef;
|
81
|
+
char *ssId;
|
82
|
+
} VixDiskLibVStorageObjectSpec;
|
83
|
+
|
84
|
+
typedef enum {
|
85
|
+
VIXDISKLIB_SPEC_UNKNOWN = 2
|
86
|
+
} VixDiskLibSpecType;
|
87
|
+
|
88
|
+
typedef struct {
|
89
|
+
char *vmxSpec; // URL like spec of the VM.
|
90
|
+
char *serverName; // Name or IP address of VC / ESX.
|
91
|
+
char *thumbPrint; // SSL Certificate thumb print.
|
92
|
+
long privateUse; // This value is ignored.
|
93
|
+
VixDiskLibCredType credType;
|
94
|
+
|
95
|
+
union VixDiskLibCreds {
|
96
|
+
struct VixDiskLibUidPasswdCreds {
|
97
|
+
char *userName; // User id and password on the
|
98
|
+
char *password; // VC/ESX host.
|
99
|
+
} uid;
|
100
|
+
struct VixDiskLibSessionIdCreds { // Not supported in 1.0
|
101
|
+
char *cookie;
|
102
|
+
char *userName;
|
103
|
+
char *key;
|
104
|
+
} sessionId;
|
105
|
+
struct VixDiskLibTicketIdCreds *ticketId; // Internal use only.
|
106
|
+
} creds;
|
107
|
+
|
108
|
+
uint32 port; // port to use for authenticating with VC/ESXi host
|
109
|
+
uint32 nfcHostPort; // port to use for establishing NFC connection to ESXi host
|
110
|
+
|
111
|
+
char *vimApiVer; // not used
|
112
|
+
char reserved[8]; // internal use only
|
113
|
+
VixDiskLibConnectParamsState *state; // internal use only
|
114
|
+
|
115
|
+
union {
|
116
|
+
VixDiskLibVStorageObjectSpec vStorageObjSpec;
|
117
|
+
} spec;
|
118
|
+
VixDiskLibSpecType specType; // disk or VM spec
|
119
|
+
} VixDiskLibConnectParams;
|
120
|
+
|
121
|
+
VixError
|
122
|
+
VixDiskLib_InitEx(uint32 majorVersion,
|
123
|
+
uint32 minorVersion,
|
124
|
+
VixDiskLibGenericLogFunc *log,
|
125
|
+
VixDiskLibGenericLogFunc *warn,
|
126
|
+
VixDiskLibGenericLogFunc *panic,
|
127
|
+
const char* libDir,
|
128
|
+
const char* configFile)
|
129
|
+
{
|
130
|
+
return VIX_OK;
|
131
|
+
}
|
132
|
+
|
133
|
+
VixError
|
134
|
+
VixDiskLib_Init(uint32 majorVersion,
|
135
|
+
uint32 minorVersion,
|
136
|
+
VixDiskLibGenericLogFunc *log,
|
137
|
+
VixDiskLibGenericLogFunc *warn,
|
138
|
+
VixDiskLibGenericLogFunc *panic,
|
139
|
+
const char* libDir)
|
140
|
+
{
|
141
|
+
return VIX_OK;
|
142
|
+
}
|
143
|
+
|
144
|
+
void
|
145
|
+
VixDiskLib_Exit(void)
|
146
|
+
{
|
147
|
+
}
|
148
|
+
|
149
|
+
const char *
|
150
|
+
VixDiskLib_ListTransportModes(void)
|
151
|
+
{
|
152
|
+
return "";
|
153
|
+
}
|
154
|
+
|
155
|
+
VixError
|
156
|
+
VixDiskLib_Cleanup(const VixDiskLibConnectParams *connectParams,
|
157
|
+
uint32 *numCleanedUp, uint32 *numRemaining)
|
158
|
+
{
|
159
|
+
return VIX_OK;
|
160
|
+
}
|
161
|
+
|
162
|
+
VixError
|
163
|
+
VixDiskLib_Connect(const VixDiskLibConnectParams *connectParams,
|
164
|
+
VixDiskLibConnection *connection)
|
165
|
+
{
|
166
|
+
return VIX_OK;
|
167
|
+
}
|
168
|
+
|
169
|
+
VixError
|
170
|
+
VixDiskLib_PrepareForAccess(const VixDiskLibConnectParams *connectParams,
|
171
|
+
const char *identity)
|
172
|
+
{
|
173
|
+
return VIX_OK;
|
174
|
+
}
|
175
|
+
|
176
|
+
VixError
|
177
|
+
VixDiskLib_ConnectEx(const VixDiskLibConnectParams *connectParams,
|
178
|
+
Bool readOnly,
|
179
|
+
const char *snapshotRef,
|
180
|
+
const char *transportModes,
|
181
|
+
VixDiskLibConnection *connection)
|
182
|
+
{
|
183
|
+
return VIX_OK;
|
184
|
+
}
|
185
|
+
|
186
|
+
VixError
|
187
|
+
VixDiskLib_Disconnect(VixDiskLibConnection connection)
|
188
|
+
{
|
189
|
+
return VIX_OK;
|
190
|
+
}
|
191
|
+
|
192
|
+
VixError
|
193
|
+
VixDiskLib_EndAccess(const VixDiskLibConnectParams *connectParams,
|
194
|
+
const char *identity)
|
195
|
+
{
|
196
|
+
return VIX_OK;
|
197
|
+
}
|
198
|
+
|
199
|
+
VixError
|
200
|
+
VixDiskLib_Create(const VixDiskLibConnection connection,
|
201
|
+
const char *path,
|
202
|
+
const VixDiskLibCreateParams *createParams,
|
203
|
+
VixDiskLibProgressFunc progressFunc,
|
204
|
+
void *progressCallbackData)
|
205
|
+
{
|
206
|
+
return VIX_OK;
|
207
|
+
}
|
208
|
+
|
209
|
+
VixError
|
210
|
+
VixDiskLib_CreateChild(VixDiskLibHandle diskHandle,
|
211
|
+
const char *childPath,
|
212
|
+
VixDiskLibDiskType diskType,
|
213
|
+
VixDiskLibProgressFunc progressFunc,
|
214
|
+
void *progressCallbackData)
|
215
|
+
{
|
216
|
+
return VIX_OK;
|
217
|
+
}
|
218
|
+
|
219
|
+
VixError
|
220
|
+
VixDiskLib_Open(const VixDiskLibConnection connection,
|
221
|
+
const char *path,
|
222
|
+
uint32 flags,
|
223
|
+
VixDiskLibHandle *diskHandle)
|
224
|
+
{
|
225
|
+
return VIX_OK;
|
226
|
+
}
|
227
|
+
|
228
|
+
VixError
|
229
|
+
VixDiskLib_QueryAllocatedBlocks(VixDiskLibHandle diskHandle,
|
230
|
+
VixDiskLibSectorType startSector,
|
231
|
+
VixDiskLibSectorType numSectors,
|
232
|
+
VixDiskLibSectorType chunkSize,
|
233
|
+
VixDiskLibBlockList **blockList)
|
234
|
+
{
|
235
|
+
return VIX_OK;
|
236
|
+
}
|
237
|
+
|
238
|
+
VixError
|
239
|
+
VixDiskLib_FreeBlockList(VixDiskLibBlockList *blockList)
|
240
|
+
{
|
241
|
+
return VIX_OK;
|
242
|
+
}
|
243
|
+
|
244
|
+
VixError
|
245
|
+
VixDiskLib_GetInfo(VixDiskLibHandle diskHandle,
|
246
|
+
VixDiskLibInfo **info)
|
247
|
+
{
|
248
|
+
return VIX_OK;
|
249
|
+
}
|
250
|
+
|
251
|
+
void
|
252
|
+
VixDiskLib_FreeInfo(VixDiskLibInfo *info)
|
253
|
+
{
|
254
|
+
}
|
255
|
+
|
256
|
+
const char *
|
257
|
+
VixDiskLib_GetTransportMode(VixDiskLibHandle diskHandle)
|
258
|
+
{
|
259
|
+
return "";
|
260
|
+
}
|
261
|
+
|
262
|
+
VixError
|
263
|
+
VixDiskLib_Close(VixDiskLibHandle diskHandle)
|
264
|
+
{
|
265
|
+
return VIX_OK;
|
266
|
+
}
|
267
|
+
|
268
|
+
VixError
|
269
|
+
VixDiskLib_Read(VixDiskLibHandle diskHandle,
|
270
|
+
VixDiskLibSectorType startSector,
|
271
|
+
VixDiskLibSectorType numSectors,
|
272
|
+
uint8 *readBuffer)
|
273
|
+
{
|
274
|
+
return VIX_OK;
|
275
|
+
}
|
276
|
+
|
277
|
+
VixError
|
278
|
+
VixDiskLib_ReadAsync(VixDiskLibHandle diskHandle,
|
279
|
+
VixDiskLibSectorType startSector,
|
280
|
+
VixDiskLibSectorType numSectors,
|
281
|
+
uint8 *readBuffer,
|
282
|
+
VixDiskLibCompletionCB callback,
|
283
|
+
void *cbData)
|
284
|
+
{
|
285
|
+
return VIX_OK;
|
286
|
+
}
|
287
|
+
|
288
|
+
VixError
|
289
|
+
VixDiskLib_Write(VixDiskLibHandle diskHandle,
|
290
|
+
VixDiskLibSectorType startSector,
|
291
|
+
VixDiskLibSectorType numSectors,
|
292
|
+
const uint8 *writeBuffer)
|
293
|
+
{
|
294
|
+
return VIX_OK;
|
295
|
+
}
|
296
|
+
|
297
|
+
VixError
|
298
|
+
VixDiskLib_WriteAsync(VixDiskLibHandle diskHandle,
|
299
|
+
VixDiskLibSectorType startSector,
|
300
|
+
VixDiskLibSectorType numSectors,
|
301
|
+
const uint8 *writeBuffer,
|
302
|
+
VixDiskLibCompletionCB callback,
|
303
|
+
void *cbData)
|
304
|
+
{
|
305
|
+
return VIX_OK;
|
306
|
+
}
|
307
|
+
|
308
|
+
VixError
|
309
|
+
VixDiskLib_Flush(VixDiskLibHandle diskHandle)
|
310
|
+
{
|
311
|
+
return VIX_OK;
|
312
|
+
}
|
313
|
+
|
314
|
+
VixError
|
315
|
+
VixDiskLib_Wait(VixDiskLibHandle diskHandle)
|
316
|
+
{
|
317
|
+
return VIX_OK;
|
318
|
+
}
|
319
|
+
|
320
|
+
VixError
|
321
|
+
VixDiskLib_ReadMetadata(VixDiskLibHandle diskHandle,
|
322
|
+
const char *key,
|
323
|
+
char *buf,
|
324
|
+
size_t bufLen,
|
325
|
+
size_t *requiredLen)
|
326
|
+
{
|
327
|
+
return VIX_OK;
|
328
|
+
}
|
329
|
+
|
330
|
+
VixError
|
331
|
+
VixDiskLib_WriteMetadata(VixDiskLibHandle diskHandle,
|
332
|
+
const char *key,
|
333
|
+
const char *val)
|
334
|
+
{
|
335
|
+
return VIX_OK;
|
336
|
+
}
|
337
|
+
|
338
|
+
VixError
|
339
|
+
VixDiskLib_GetMetadataKeys(VixDiskLibHandle diskHandle,
|
340
|
+
char *keys,
|
341
|
+
size_t maxLen,
|
342
|
+
size_t *requiredLen)
|
343
|
+
{
|
344
|
+
return VIX_OK;
|
345
|
+
}
|
346
|
+
|
347
|
+
VixError
|
348
|
+
VixDiskLib_Unlink(VixDiskLibConnection connection,
|
349
|
+
const char *path)
|
350
|
+
{
|
351
|
+
return VIX_OK;
|
352
|
+
}
|
353
|
+
|
354
|
+
VixError
|
355
|
+
VixDiskLib_Grow(VixDiskLibConnection connection,
|
356
|
+
const char *path,
|
357
|
+
VixDiskLibSectorType capacity,
|
358
|
+
Bool updateGeometry,
|
359
|
+
VixDiskLibProgressFunc progressFunc,
|
360
|
+
void *progressCallbackData)
|
361
|
+
{
|
362
|
+
return VIX_OK;
|
363
|
+
}
|
364
|
+
|
365
|
+
VixError
|
366
|
+
VixDiskLib_Shrink(VixDiskLibHandle diskHandle,
|
367
|
+
VixDiskLibProgressFunc progressFunc,
|
368
|
+
void *progressCallbackData)
|
369
|
+
{
|
370
|
+
return VIX_OK;
|
371
|
+
}
|
372
|
+
|
373
|
+
VixError
|
374
|
+
VixDiskLib_Defragment(VixDiskLibHandle diskHandle,
|
375
|
+
VixDiskLibProgressFunc progressFunc,
|
376
|
+
void *progressCallbackData)
|
377
|
+
{
|
378
|
+
return VIX_OK;
|
379
|
+
}
|
380
|
+
|
381
|
+
VixError
|
382
|
+
VixDiskLib_Rename(const char *srcFileName,
|
383
|
+
const char *dstFileName)
|
384
|
+
{
|
385
|
+
return VIX_OK;
|
386
|
+
}
|
387
|
+
|
388
|
+
VixError
|
389
|
+
VixDiskLib_Clone(const VixDiskLibConnection dstConnection,
|
390
|
+
const char *dstPath,
|
391
|
+
const VixDiskLibConnection srcConnection,
|
392
|
+
const char *srcPath,
|
393
|
+
const VixDiskLibCreateParams *vixCreateParams,
|
394
|
+
VixDiskLibProgressFunc progressFunc,
|
395
|
+
void *progressCallbackData,
|
396
|
+
Bool overWrite)
|
397
|
+
{
|
398
|
+
return VIX_OK;
|
399
|
+
}
|
400
|
+
|
401
|
+
char *
|
402
|
+
VixDiskLib_GetErrorText(VixError err, const char *locale)
|
403
|
+
{
|
404
|
+
return NULL;
|
405
|
+
}
|
406
|
+
|
407
|
+
void
|
408
|
+
VixDiskLib_FreeErrorText(char* errMsg)
|
409
|
+
{
|
410
|
+
}
|
411
|
+
|
412
|
+
VixError
|
413
|
+
VixDiskLib_IsAttachPossible(VixDiskLibHandle parent, VixDiskLibHandle child)
|
414
|
+
{
|
415
|
+
return VIX_OK;
|
416
|
+
}
|
417
|
+
|
418
|
+
VixError
|
419
|
+
VixDiskLib_Attach(VixDiskLibHandle parent, VixDiskLibHandle child)
|
420
|
+
{
|
421
|
+
return VIX_OK;
|
422
|
+
}
|
423
|
+
|
424
|
+
VixError
|
425
|
+
VixDiskLib_SpaceNeededForClone(VixDiskLibHandle diskHandle,
|
426
|
+
VixDiskLibDiskType cloneDiskType,
|
427
|
+
uint64* spaceNeeded)
|
428
|
+
{
|
429
|
+
return VIX_OK;
|
430
|
+
}
|
431
|
+
|
432
|
+
VixError
|
433
|
+
VixDiskLib_CheckRepair(const VixDiskLibConnection connection,
|
434
|
+
const char *filename,
|
435
|
+
Bool repair)
|
436
|
+
{
|
437
|
+
return VIX_OK;
|
438
|
+
}
|
439
|
+
|
440
|
+
VixError
|
441
|
+
VixDiskLib_GetConnectParams(const VixDiskLibConnection connection,
|
442
|
+
VixDiskLibConnectParams** connectParams)
|
443
|
+
{
|
444
|
+
return VIX_OK;
|
445
|
+
}
|
446
|
+
|
447
|
+
void
|
448
|
+
VixDiskLib_FreeConnectParams(VixDiskLibConnectParams* connectParams)
|
449
|
+
{
|
450
|
+
}
|
451
|
+
|
452
|
+
VixDiskLibConnectParams *
|
453
|
+
VixDiskLib_AllocateConnectParams()
|
454
|
+
{
|
455
|
+
return NULL;
|
456
|
+
}
|
@@ -1,25 +1,37 @@
|
|
1
1
|
describe FFI::VixDiskLib::API do
|
2
|
-
let(:
|
3
|
-
let(:
|
4
|
-
let(:
|
5
|
-
let(:lib_dir) { nil }
|
2
|
+
let(:log) { lambda { |_string, _pointer| } }
|
3
|
+
let(:lib_dir) { nil }
|
4
|
+
let(:version) { ENV.fetch("VDDK_VERSION", "6.7.0") }
|
6
5
|
|
7
|
-
|
6
|
+
it "VERSION" do
|
7
|
+
expect(described_class::VERSION).to eq version
|
8
|
+
end
|
9
|
+
|
10
|
+
it "VERSION_MAJOR" do
|
11
|
+
expect(described_class::VERSION_MAJOR).to eq Gem::Version.new(version).segments[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
it "VERSION_MINOR" do
|
15
|
+
expect(described_class::VERSION_MINOR).to eq Gem::Version.new(version).segments[1]
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".init" do
|
8
19
|
it "initializes successfully" do
|
9
|
-
err = described_class.init(
|
20
|
+
err = described_class.init(described_class::VERSION_MAJOR, described_class::VERSION_MINOR, log, log, log, lib_dir)
|
10
21
|
expect(err).to eq(described_class::VixErrorType[:VIX_OK])
|
11
22
|
end
|
12
23
|
end
|
13
24
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
describe "ConnectParams" do
|
26
|
+
context "with #{described_class::VERSION}" do
|
27
|
+
if Gem::Version.new(described_class::VERSION) >= Gem::Version.new("6.5.0")
|
28
|
+
it "has vimApiVer" do
|
29
|
+
expect(described_class::ConnectParams.members).to include(:vimApiVer)
|
30
|
+
end
|
31
|
+
else
|
32
|
+
it "doesn't have vimApiVer" do
|
33
|
+
expect(described_class::ConnectParams.members).to_not include(:vimApiVer)
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
25
37
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,6 @@
|
|
1
|
-
|
2
|
-
require 'ffi-vix_disk_lib'
|
3
|
-
rescue LoadError
|
4
|
-
STDERR.puts <<-EOMSG
|
1
|
+
ENV["LD_LIBRARY_PATH"] ||= File.expand_path("ext", __dir__)
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
The VMware VDDK is not redistributable, and not available on MacOSX.
|
9
|
-
See https://www.vmware.com/support/developer/vddk/ for more information.
|
10
|
-
|
11
|
-
EOMSG
|
12
|
-
|
13
|
-
exit 1
|
14
|
-
end
|
3
|
+
require 'ffi-vix_disk_lib'
|
15
4
|
|
16
5
|
RSpec.configure do |config|
|
17
6
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-vix_disk_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry Keselman
|
@@ -10,22 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - "
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rake
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
44
|
+
name: rspec
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
@@ -91,13 +91,15 @@ files:
|
|
91
91
|
- lib/ffi-vix_disk_lib/safe_create_params.rb
|
92
92
|
- lib/ffi-vix_disk_lib/struct.rb
|
93
93
|
- lib/ffi-vix_disk_lib/version.rb
|
94
|
+
- spec/ext/.gitignore
|
95
|
+
- spec/ext/Makefile
|
96
|
+
- spec/ext/vixDiskLib.c
|
94
97
|
- spec/ffi-vix_disk_lib/api_spec.rb
|
95
98
|
- spec/ffi-vix_disk_lib/api_wrapper_spec.rb
|
96
|
-
- spec/ffi-vix_disk_lib/version_spec.rb
|
97
99
|
- spec/spec_helper.rb
|
98
100
|
homepage: http://github.com/ManageIQ/ffi-vix_disk_lib
|
99
101
|
licenses:
|
100
|
-
-
|
102
|
+
- Apache-2.0
|
101
103
|
metadata: {}
|
102
104
|
post_install_message:
|
103
105
|
rdoc_options: []
|
@@ -114,13 +116,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
116
|
- !ruby/object:Gem::Version
|
115
117
|
version: '0'
|
116
118
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.6.12
|
119
|
+
rubygems_version: 3.1.2
|
119
120
|
signing_key:
|
120
121
|
specification_version: 4
|
121
122
|
summary: Ruby FFI Binding to VMware VixDiskLib.
|
122
123
|
test_files:
|
124
|
+
- spec/ext/.gitignore
|
125
|
+
- spec/ext/Makefile
|
126
|
+
- spec/ext/vixDiskLib.c
|
123
127
|
- spec/ffi-vix_disk_lib/api_spec.rb
|
124
128
|
- spec/ffi-vix_disk_lib/api_wrapper_spec.rb
|
125
|
-
- spec/ffi-vix_disk_lib/version_spec.rb
|
126
129
|
- spec/spec_helper.rb
|