1 | /* $Id: vscsi.h 70688 2018-01-22 19:38:45Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox storage drivers - Virtual SCSI driver
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___VBox_vscsi_h
|
---|
28 | #define ___VBox_vscsi_h
|
---|
29 |
|
---|
30 | #include <VBox/cdefs.h>
|
---|
31 | #include <VBox/types.h>
|
---|
32 | #include <VBox/vdmedia.h>
|
---|
33 | #include <iprt/sg.h>
|
---|
34 |
|
---|
35 | RT_C_DECLS_BEGIN
|
---|
36 |
|
---|
37 | #ifdef IN_RING0
|
---|
38 | # error "There are no VBox VSCSI APIs available in Ring-0 Host Context!"
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | /** @defgroup grp_drv_vscsi Virtual VSCSI Driver
|
---|
42 | * @ingroup grp_devdrv
|
---|
43 | * @{
|
---|
44 | */
|
---|
45 | /** @todo figure better grouping. */
|
---|
46 |
|
---|
47 | /** A virtual SCSI device handle */
|
---|
48 | typedef struct VSCSIDEVICEINT *VSCSIDEVICE;
|
---|
49 | /** A pointer to a virtual SCSI device handle. */
|
---|
50 | typedef VSCSIDEVICE *PVSCSIDEVICE;
|
---|
51 | /** A virtual SCSI LUN handle. */
|
---|
52 | typedef struct VSCSILUNINT *VSCSILUN;
|
---|
53 | /** A pointer to a virtual SCSI LUN handle. */
|
---|
54 | typedef VSCSILUN *PVSCSILUN;
|
---|
55 | /** A virtual SCSI request handle. */
|
---|
56 | typedef struct VSCSIREQINT *VSCSIREQ;
|
---|
57 | /** A pointer to a virtual SCSI request handle. */
|
---|
58 | typedef VSCSIREQ *PVSCSIREQ;
|
---|
59 | /** A SCSI I/O request handle. */
|
---|
60 | typedef struct VSCSIIOREQINT *VSCSIIOREQ;
|
---|
61 | /** A pointer to a SCSI I/O request handle. */
|
---|
62 | typedef VSCSIIOREQ *PVSCSIIOREQ;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Virtual SCSI I/O request transfer direction.
|
---|
66 | */
|
---|
67 | typedef enum VSCSIIOREQTXDIR
|
---|
68 | {
|
---|
69 | /** Invalid direction */
|
---|
70 | VSCSIIOREQTXDIR_INVALID = 0,
|
---|
71 | /** Read */
|
---|
72 | VSCSIIOREQTXDIR_READ,
|
---|
73 | /** Write */
|
---|
74 | VSCSIIOREQTXDIR_WRITE,
|
---|
75 | /** Flush */
|
---|
76 | VSCSIIOREQTXDIR_FLUSH,
|
---|
77 | /** Unmap */
|
---|
78 | VSCSIIOREQTXDIR_UNMAP,
|
---|
79 | /** 32bit hack */
|
---|
80 | VSCSIIOREQTXDIR_32BIT_HACK = 0x7fffffff
|
---|
81 | } VSCSIIOREQTXDIR;
|
---|
82 | /** Pointer to a SCSI LUN type */
|
---|
83 | typedef VSCSIIOREQTXDIR *PVSCSIIOREQTXDIR;
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * LUN types we support
|
---|
87 | */
|
---|
88 | typedef enum VSCSILUNTYPE
|
---|
89 | {
|
---|
90 | /** Invalid type */
|
---|
91 | VSCSILUNTYPE_INVALID = 0,
|
---|
92 | /** Hard disk (SBC) */
|
---|
93 | VSCSILUNTYPE_SBC,
|
---|
94 | /** CD/DVD drive (MMC) */
|
---|
95 | VSCSILUNTYPE_MMC,
|
---|
96 | /** Tape drive (SSC) */
|
---|
97 | VSCSILUNTYPE_SSC,
|
---|
98 | /** Last value to indicate an invalid device */
|
---|
99 | VSCSILUNTYPE_LAST,
|
---|
100 | /** 32bit hack */
|
---|
101 | VSCSILUNTYPE_32BIT_HACK = 0x7fffffff
|
---|
102 | } VSCSILUNTYPE;
|
---|
103 | /** Pointer to a SCSI LUN type */
|
---|
104 | typedef VSCSILUNTYPE *PVSCSILUNTYPE;
|
---|
105 |
|
---|
106 | /** The LUN can handle the UNMAP command. */
|
---|
107 | #define VSCSI_LUN_FEATURE_UNMAP RT_BIT(0)
|
---|
108 | /** The LUN has a non rotational medium. */
|
---|
109 | #define VSCSI_LUN_FEATURE_NON_ROTATIONAL RT_BIT(1)
|
---|
110 | /** The medium of the LUN is readonly. */
|
---|
111 | #define VSCSI_LUN_FEATURE_READONLY RT_BIT(2)
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * Virtual SCSI LUN I/O Callback table.
|
---|
115 | */
|
---|
116 | typedef struct VSCSILUNIOCALLBACKS
|
---|
117 | {
|
---|
118 | /**
|
---|
119 | * Sets the size of the allocator specific memory for a I/O request.
|
---|
120 | *
|
---|
121 | * @returns VBox status code.
|
---|
122 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
123 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
124 | * medium.
|
---|
125 | * @param cbVScsiIoReqAlloc The size of the allocator specific memory in bytes.
|
---|
126 | * @thread EMT.
|
---|
127 | */
|
---|
128 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunReqAllocSizeSet, (VSCSILUN hVScsiLun, void *pvScsiLunUser,
|
---|
129 | size_t cbVScsiIoReqAlloc));
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * Allocates a new I/O request.
|
---|
133 | *
|
---|
134 | * @returns VBox status code.
|
---|
135 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
136 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
137 | * medium.
|
---|
138 | * @param u64Tag A tag to assign to the request handle for identification later on.
|
---|
139 | * @param phVScsiIoReq Where to store the handle to the allocated I/O request on success.
|
---|
140 | * @thread Any thread.
|
---|
141 | */
|
---|
142 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunReqAlloc, (VSCSILUN hVScsiLun, void *pvScsiLunUser,
|
---|
143 | uint64_t u64Tag, PVSCSIIOREQ phVScsiIoReq));
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * Frees a given I/O request.
|
---|
147 | *
|
---|
148 | * @returns VBox status code.
|
---|
149 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
150 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
151 | * medium.
|
---|
152 | * @param hVScsiIoReq The VSCSI I/O request to free.
|
---|
153 | * @thread Any thread.
|
---|
154 | */
|
---|
155 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunReqFree, (VSCSILUN hVScsiLun, void *pvScsiLunUser, VSCSIIOREQ hVScsiIoReq));
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Returns the number of regions for the medium.
|
---|
159 | *
|
---|
160 | * @returns Number of regions.
|
---|
161 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
162 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
163 | * medium.
|
---|
164 | */
|
---|
165 | DECLR3CALLBACKMEMBER(uint32_t, pfnVScsiLunMediumGetRegionCount,(VSCSILUN hVScsiLun, void *pvScsiLunUser));
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Queries the properties for the given region.
|
---|
169 | *
|
---|
170 | * @returns VBox status code.
|
---|
171 | * @retval VERR_NOT_FOUND if the region index is not known.
|
---|
172 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
173 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
174 | * medium.
|
---|
175 | * @param uRegion The region index to query the properties of.
|
---|
176 | * @param pu64LbaStart Where to store the starting LBA for the region on success.
|
---|
177 | * @param pcBlocks Where to store the number of blocks for the region on success.
|
---|
178 | * @param pcbBlock Where to store the size of one block in bytes on success.
|
---|
179 | * @param penmDataForm WHere to store the data form for the region on success.
|
---|
180 | */
|
---|
181 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunMediumQueryRegionProperties,(VSCSILUN hVScsiLun, void *pvScsiLunUser,
|
---|
182 | uint32_t uRegion, uint64_t *pu64LbaStart,
|
---|
183 | uint64_t *pcBlocks, uint64_t *pcbBlock,
|
---|
184 | PVDREGIONDATAFORM penmDataForm));
|
---|
185 |
|
---|
186 | /**
|
---|
187 | * Queries the properties for the region covering the given LBA.
|
---|
188 | *
|
---|
189 | * @returns VBox status code.
|
---|
190 | * @retval VERR_NOT_FOUND if the region index is not known.
|
---|
191 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
192 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
193 | * medium.
|
---|
194 | * @param u64LbaStart Where to store the starting LBA for the region on success.
|
---|
195 | * @param puRegion Where to store the region number on success.
|
---|
196 | * @param pcBlocks Where to store the number of blocks left in this region starting from the given LBA.
|
---|
197 | * @param pcbBlock Where to store the size of one block in bytes on success.
|
---|
198 | * @param penmDataForm WHere to store the data form for the region on success.
|
---|
199 | */
|
---|
200 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunMediumQueryRegionPropertiesForLba,(VSCSILUN hVScsiLun, void *pvScsiLunUser,
|
---|
201 | uint64_t u64LbaStart, uint32_t *puRegion,
|
---|
202 | uint64_t *pcBlocks, uint64_t *pcbBlock,
|
---|
203 | PVDREGIONDATAFORM penmDataForm));
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * Set the lock state of the underlying medium.
|
---|
207 | *
|
---|
208 | * @returns VBox status status code.
|
---|
209 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
210 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
211 | * medium.
|
---|
212 | * @param fLocked New lock state (locked/unlocked).
|
---|
213 | */
|
---|
214 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunMediumSetLock,(VSCSILUN hVScsiLun, void *pvScsiLunUser, bool fLocked));
|
---|
215 |
|
---|
216 | /**
|
---|
217 | * Eject the attached medium.
|
---|
218 | *
|
---|
219 | * @returns VBox status code.
|
---|
220 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
221 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
222 | * medium.
|
---|
223 | */
|
---|
224 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunMediumEject, (VSCSILUN hVScsiLun, void *pvScsiLunUser));
|
---|
225 |
|
---|
226 | /**
|
---|
227 | * Enqueue a read or write request from the medium.
|
---|
228 | *
|
---|
229 | * @returns VBox status status code.
|
---|
230 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
231 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
232 | * medium.
|
---|
233 | * @param hVScsiIoReq Virtual SCSI I/O request handle.
|
---|
234 | */
|
---|
235 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunReqTransferEnqueue,(VSCSILUN hVScsiLun, void *pvScsiLunUser, VSCSIIOREQ hVScsiIoReq));
|
---|
236 |
|
---|
237 | /**
|
---|
238 | * Returns flags of supported features.
|
---|
239 | *
|
---|
240 | * @returns VBox status status code.
|
---|
241 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
242 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
243 | * medium.
|
---|
244 | * @param pfFeatures Where to return the queried features.
|
---|
245 | */
|
---|
246 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunGetFeatureFlags,(VSCSILUN hVScsiLun, void *pvScsiLunUser, uint64_t *pfFeatures));
|
---|
247 |
|
---|
248 | /**
|
---|
249 | * Queries the vendor and product ID and revision to report for INQUIRY commands of the given LUN.
|
---|
250 | *
|
---|
251 | * @returns VBox status status code.
|
---|
252 | * @retval VERR_NOT_FOUND if the data is not available and some defaults should be sued instead.
|
---|
253 | * @param hVScsiLun Virtual SCSI LUN handle.
|
---|
254 | * @param pvScsiLunUser Opaque user data which may be used to identify the
|
---|
255 | * medium.
|
---|
256 | * @param ppszVendorId Where to store the pointer to the vendor ID string to report.
|
---|
257 | * @param ppszProductId Where to store the pointer to the product ID string to report.
|
---|
258 | * @param ppszProductLevel Where to store the pointer to the product level string to report.
|
---|
259 | */
|
---|
260 | DECLR3CALLBACKMEMBER(int, pfnVScsiLunQueryInqStrings, (VSCSILUN hVScsiLun, void *pvScsiLunUser, const char **ppszVendorId,
|
---|
261 | const char **ppszProductId, const char **ppszProductLevel));
|
---|
262 |
|
---|
263 | } VSCSILUNIOCALLBACKS;
|
---|
264 | /** Pointer to a virtual SCSI LUN I/O callback table. */
|
---|
265 | typedef VSCSILUNIOCALLBACKS *PVSCSILUNIOCALLBACKS;
|
---|
266 |
|
---|
267 | /**
|
---|
268 | * The virtual SCSI request completed callback.
|
---|
269 | */
|
---|
270 | typedef DECLCALLBACK(void) FNVSCSIREQCOMPLETED(VSCSIDEVICE hVScsiDevice,
|
---|
271 | void *pvVScsiDeviceUser,
|
---|
272 | void *pvVScsiReqUser,
|
---|
273 | int rcScsiCode,
|
---|
274 | bool fRedoPossible,
|
---|
275 | int rcReq,
|
---|
276 | size_t cbXfer);
|
---|
277 | /** Pointer to a virtual SCSI request completed callback. */
|
---|
278 | typedef FNVSCSIREQCOMPLETED *PFNVSCSIREQCOMPLETED;
|
---|
279 |
|
---|
280 | /**
|
---|
281 | * Create a new empty SCSI device instance.
|
---|
282 | *
|
---|
283 | * @returns VBox status code.
|
---|
284 | * @param phVScsiDevice Where to store the SCSI device handle.
|
---|
285 | * @param pfnVScsiReqCompleted The method call after a request completed.
|
---|
286 | * @param pvVScsiDeviceUser Opaque user data given in the completion callback.
|
---|
287 | */
|
---|
288 | VBOXDDU_DECL(int) VSCSIDeviceCreate(PVSCSIDEVICE phVScsiDevice,
|
---|
289 | PFNVSCSIREQCOMPLETED pfnVScsiReqCompleted,
|
---|
290 | void *pvVScsiDeviceUser);
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * Destroy a SCSI device instance.
|
---|
294 | *
|
---|
295 | * @returns VBox status code.
|
---|
296 | * @param hVScsiDevice The SCSI device handle to destroy.
|
---|
297 | */
|
---|
298 | VBOXDDU_DECL(int) VSCSIDeviceDestroy(VSCSIDEVICE hVScsiDevice);
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * Attach a LUN to the SCSI device.
|
---|
302 | *
|
---|
303 | * @returns VBox status code.
|
---|
304 | * @param hVScsiDevice The SCSI device handle to add the LUN to.
|
---|
305 | * @param hVScsiLun The LUN handle to add.
|
---|
306 | * @param iLun The LUN number.
|
---|
307 | */
|
---|
308 | VBOXDDU_DECL(int) VSCSIDeviceLunAttach(VSCSIDEVICE hVScsiDevice, VSCSILUN hVScsiLun, uint32_t iLun);
|
---|
309 |
|
---|
310 | /**
|
---|
311 | * Detach a LUN from the SCSI device.
|
---|
312 | *
|
---|
313 | * @returns VBox status code.
|
---|
314 | * @param hVScsiDevice The SCSI device handle to add the LUN to.
|
---|
315 | * @param iLun The LUN number to remove.
|
---|
316 | * @param phVScsiLun Where to store the detached LUN handle.
|
---|
317 | */
|
---|
318 | VBOXDDU_DECL(int) VSCSIDeviceLunDetach(VSCSIDEVICE hVScsiDevice, uint32_t iLun,
|
---|
319 | PVSCSILUN phVScsiLun);
|
---|
320 |
|
---|
321 | /**
|
---|
322 | * Query the SCSI LUN type.
|
---|
323 | *
|
---|
324 | * @returns VBox status code.
|
---|
325 | * @param hVScsiDevice The SCSI device handle.
|
---|
326 | * @param iLun The LUN number to get.
|
---|
327 | * @param pEnmLunType Where to store the LUN type.
|
---|
328 | */
|
---|
329 | VBOXDDU_DECL(int) VSCSIDeviceLunQueryType(VSCSIDEVICE hVScsiDevice, uint32_t iLun,
|
---|
330 | PVSCSILUNTYPE pEnmLunType);
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Enqueue a request to the SCSI device.
|
---|
334 | *
|
---|
335 | * @returns VBox status code.
|
---|
336 | * @param hVScsiDevice The SCSI device handle.
|
---|
337 | * @param hVScsiReq The SCSI request handle to enqueue.
|
---|
338 | */
|
---|
339 | VBOXDDU_DECL(int) VSCSIDeviceReqEnqueue(VSCSIDEVICE hVScsiDevice, VSCSIREQ hVScsiReq);
|
---|
340 |
|
---|
341 | /**
|
---|
342 | * Allocate a new request handle.
|
---|
343 | *
|
---|
344 | * @returns VBox status code.
|
---|
345 | * @param hVScsiDevice The SCSI device handle.
|
---|
346 | * @param phVScsiReq Where to SCSI request handle.
|
---|
347 | * @param iLun The LUN the request is for.
|
---|
348 | * @param pbCDB The CDB for the request.
|
---|
349 | * @param cbCDB The size of the CDB in bytes.
|
---|
350 | * @param cbSGList Number of bytes the S/G list describes.
|
---|
351 | * @param cSGListEntries Number of S/G list entries.
|
---|
352 | * @param paSGList Pointer to the S/G list.
|
---|
353 | * @param pbSense Pointer to the sense buffer.
|
---|
354 | * @param cbSense Size of the sense buffer.
|
---|
355 | * @param pvVScsiReqUser Opqaue user data returned when the request completes.
|
---|
356 | */
|
---|
357 | VBOXDDU_DECL(int) VSCSIDeviceReqCreate(VSCSIDEVICE hVScsiDevice, PVSCSIREQ phVScsiReq,
|
---|
358 | uint32_t iLun, uint8_t *pbCDB, size_t cbCDB,
|
---|
359 | size_t cbSGList, unsigned cSGListEntries,
|
---|
360 | PCRTSGSEG paSGList, uint8_t *pbSense,
|
---|
361 | size_t cbSense, void *pvVScsiReqUser);
|
---|
362 |
|
---|
363 | /**
|
---|
364 | * Create a new LUN.
|
---|
365 | *
|
---|
366 | * @returns VBox status code.
|
---|
367 | * @param phVScsiLun Where to store the SCSI LUN handle.
|
---|
368 | * @param enmLunType The Lun type.
|
---|
369 | * @param pVScsiLunIoCallbacks Pointer to the I/O callbacks to use for his LUN.
|
---|
370 | * @param pvVScsiLunUser Opaque user argument which
|
---|
371 | * is returned in the pvScsiLunUser parameter
|
---|
372 | * when the request completion callback is called.
|
---|
373 | */
|
---|
374 | VBOXDDU_DECL(int) VSCSILunCreate(PVSCSILUN phVScsiLun, VSCSILUNTYPE enmLunType,
|
---|
375 | PVSCSILUNIOCALLBACKS pVScsiLunIoCallbacks,
|
---|
376 | void *pvVScsiLunUser);
|
---|
377 |
|
---|
378 | /**
|
---|
379 | * Destroy virtual SCSI LUN.
|
---|
380 | *
|
---|
381 | * @returns VBox status code.
|
---|
382 | * @param hVScsiLun The virtual SCSI LUN handle to destroy.
|
---|
383 | */
|
---|
384 | VBOXDDU_DECL(int) VSCSILunDestroy(VSCSILUN hVScsiLun);
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * Notify virtual SCSI LUN of medium being mounted.
|
---|
388 | *
|
---|
389 | * @returns VBox status code.
|
---|
390 | * @param hVScsiLun The virtual SCSI LUN handle to destroy.
|
---|
391 | */
|
---|
392 | VBOXDDU_DECL(int) VSCSILunMountNotify(VSCSILUN hVScsiLun);
|
---|
393 |
|
---|
394 | /**
|
---|
395 | * Notify virtual SCSI LUN of medium being unmounted.
|
---|
396 | *
|
---|
397 | * @returns VBox status code.
|
---|
398 | * @param hVScsiLun The virtual SCSI LUN handle to destroy.
|
---|
399 | */
|
---|
400 | VBOXDDU_DECL(int) VSCSILunUnmountNotify(VSCSILUN hVScsiLun);
|
---|
401 |
|
---|
402 | /**
|
---|
403 | * Notify a that a I/O request completed.
|
---|
404 | *
|
---|
405 | * @returns VBox status code.
|
---|
406 | * @param hVScsiIoReq The I/O request handle that completed.
|
---|
407 | * This is given when a I/O callback for
|
---|
408 | * the LUN is called by the virtual SCSI layer.
|
---|
409 | * @param rcIoReq The status code the I/O request completed with.
|
---|
410 | * @param fRedoPossible Flag whether it is possible to redo the request.
|
---|
411 | * If true setting any sense code will be omitted
|
---|
412 | * in case of an error to not alter the device state.
|
---|
413 | */
|
---|
414 | VBOXDDU_DECL(int) VSCSIIoReqCompleted(VSCSIIOREQ hVScsiIoReq, int rcIoReq, bool fRedoPossible);
|
---|
415 |
|
---|
416 | /**
|
---|
417 | * Query the transfer direction of the I/O request.
|
---|
418 | *
|
---|
419 | * @returns Transfer direction.of the given I/O request
|
---|
420 | * @param hVScsiIoReq The SCSI I/O request handle.
|
---|
421 | */
|
---|
422 | VBOXDDU_DECL(VSCSIIOREQTXDIR) VSCSIIoReqTxDirGet(VSCSIIOREQ hVScsiIoReq);
|
---|
423 |
|
---|
424 | /**
|
---|
425 | * Query I/O parameters.
|
---|
426 | *
|
---|
427 | * @returns VBox status code.
|
---|
428 | * @param hVScsiIoReq The SCSI I/O request handle.
|
---|
429 | * @param puOffset Where to store the start offset.
|
---|
430 | * @param pcbTransfer Where to store the amount of bytes to transfer.
|
---|
431 | * @param pcSeg Where to store the number of segments in the S/G list.
|
---|
432 | * @param pcbSeg Where to store the number of bytes the S/G list describes.
|
---|
433 | * @param ppaSeg Where to store the pointer to the S/G list.
|
---|
434 | */
|
---|
435 | VBOXDDU_DECL(int) VSCSIIoReqParamsGet(VSCSIIOREQ hVScsiIoReq, uint64_t *puOffset,
|
---|
436 | size_t *pcbTransfer, unsigned *pcSeg,
|
---|
437 | size_t *pcbSeg, PCRTSGSEG *ppaSeg);
|
---|
438 |
|
---|
439 | /**
|
---|
440 | * Query unmap parameters.
|
---|
441 | *
|
---|
442 | * @returns VBox status code.
|
---|
443 | * @param hVScsiIoReq The SCSI I/O request handle.
|
---|
444 | * @param ppaRanges Where to store the pointer to the range array on success.
|
---|
445 | * @param pcRanges Where to store the number of ranges on success.
|
---|
446 | */
|
---|
447 | VBOXDDU_DECL(int) VSCSIIoReqUnmapParamsGet(VSCSIIOREQ hVScsiIoReq, PCRTRANGE *ppaRanges,
|
---|
448 | unsigned *pcRanges);
|
---|
449 |
|
---|
450 | /** @} */
|
---|
451 | RT_C_DECLS_END
|
---|
452 |
|
---|
453 | #endif /* ___VBox_vscsi_h */
|
---|
454 |
|
---|