VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/ATAPIPassthrough.h@ 68080

Last change on this file since 68080 was 65964, checked in by vboxsync, 8 years ago

Devices/Storage/ATAPIPassthrough: Add method to parse a CDB and return whether it is safe to pass it through to a host device along with some extracted information

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: ATAPIPassthrough.h 65964 2017-03-07 10:44:12Z vboxsync $ */
2/** @file
3 * VBox storage devices: ATAPI passthrough helpers (common code for DevATA and DevAHCI).
4 */
5
6/*
7 * Copyright (C) 2012-2016 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#ifndef __ATAPIPassthrough_h
18#define __ATAPIPassthrough_h
19
20#include <VBox/cdefs.h>
21#include <VBox/vmm/pdmifs.h>
22#include <VBox/vmm/pdmstorageifs.h>
23
24RT_C_DECLS_BEGIN
25
26/**
27 * Opaque media track list.
28 */
29typedef struct TRACKLIST *PTRACKLIST;
30
31/**
32 * Creates an empty track list handle.
33 *
34 * @returns VBox status code.
35 * @param ppTrackList Where to store the track list handle on success.
36 */
37DECLHIDDEN(int) ATAPIPassthroughTrackListCreateEmpty(PTRACKLIST *ppTrackList);
38
39/**
40 * Destroys the allocated task list handle.
41 *
42 * @returns nothing.
43 * @param pTrackList The track list handle to destroy.
44 */
45DECLHIDDEN(void) ATAPIPassthroughTrackListDestroy(PTRACKLIST pTrackList);
46
47/**
48 * Clears all tracks from the given task list.
49 *
50 * @returns nothing.
51 * @param pTrackList The track list to clear.
52 */
53DECLHIDDEN(void) ATAPIPassthroughTrackListClear(PTRACKLIST pTrackList);
54
55/**
56 * Updates the track list from the given CDB and data buffer.
57 *
58 * @returns VBox status code.
59 * @param pTrackList The track list to update.
60 * @param pCDB The CDB buffer.
61 * @param pvBuf The data buffer.
62 */
63DECLHIDDEN(int) ATAPIPassthroughTrackListUpdate(PTRACKLIST pTrackList, const uint8_t *pCDB, const void *pvBuf);
64
65/**
66 * Return the sector size from the track matching the LBA in the given track list.
67 *
68 * @returns Sector size.
69 * @param pTrackList The track list to use.
70 * @param iAtapiLba The start LBA to get the sector size for.
71 */
72DECLHIDDEN(uint32_t) ATAPIPassthroughTrackListGetSectorSizeFromLba(PTRACKLIST pTrackList, uint32_t iAtapiLba);
73
74/**
75 * Parses the given CDB and returns whether it is safe to pass it through to the host drive.
76 *
77 * @returns Flag whether passing the CDB through to the host drive is safe.
78 * @param pbCdb The CDB to parse.
79 * @param cbCdb Size of the CDB in bytes.
80 * @param cbBuf Size of the guest buffer.
81 * @param pTrackList The track list for the current medium if available (optional).
82 * @param pbSense Pointer to the sense buffer.
83 * @param cbSense Size of the sense buffer.
84 * @param penmTxDir Where to store the transfer direction (guest to host or vice versa).
85 * @param pcbXfer Where to store the transfer size encoded in the CDB.
86 * @param pcbSector Where to store the sector size used for the transfer.
87 * @param pu8ScsiSts Where to store the SCSI status code.
88 */
89DECLHIDDEN(bool) ATAPIPassthroughParseCdb(const uint8_t *pbCdb, size_t cbCdb, size_t cbBuf,
90 PTRACKLIST pTrackList, uint8_t *pbSense, size_t cbSense,
91 PDMMEDIATXDIR *penmTxDir, size_t *pcbXfer,
92 size_t *pcbSector, uint8_t *pu8ScsiSts);
93
94RT_C_DECLS_END
95
96#endif /* __ATAPIPassthrough_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette