VirtualBox

source: vbox/trunk/include/iprt/cdrom.h@ 85416

Last change on this file since 85416 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/** @file
2 * IPRT CD/DVD/BD-ROM Drive API.
3 */
4
5/*
6 * Copyright (C) 2012-2020 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef IPRT_INCLUDED_cdrom_h
27#define IPRT_INCLUDED_cdrom_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <iprt/types.h>
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_rt_cdrom IPRT CD/DVD/BD-ROM Drive API
37 * @ingroup grp_rt
38 *
39 * The user of the API is currently resposible for serializing calls to it.
40 *
41 * @{
42 */
43
44/** CD-ROM drive handle. */
45typedef struct RTCDROMINT *RTCDROM;
46/** Pointer to a CD-ROM handle. */
47typedef RTCDROM *PRTCDROM;
48/** NIL CD-ROM handle value. */
49#define NIL_RTCDROM ((RTCDROM)0)
50
51
52/** @name CD-ROM open flags.
53 * @{ */
54#define RTCDROM_O_READ RT_BIT(0)
55#define RTCDROM_O_WRITE RT_BIT(1)
56#define RTCDROM_O_CONTROL RT_BIT(2)
57#define RTCDROM_O_QUERY RT_BIT(3)
58#define RTCDROM_O_ALL_ACCESS (RTCDROM_O_READ | RTCDROM_O_WRITE | RTCDROM_O_CONTROL | RTCDROM_O_QUERY)
59/** @} */
60
61/**
62 * Opens the CD-ROM drive (by name).
63 *
64 * @returns IPRT status code.
65 * @param pszName The CD-ROM name (path).
66 * @param fFlags Open flags, see RTCDROM_O_XXX.
67 * @param phCdrom Where to return the CDROM handle.
68 */
69RTDECL(int) RTCdromOpen(const char *pszName, uint32_t fFlags, PRTCDROM phCdrom);
70
71/**
72 * Retains a reference to the CD-ROM handle.
73 *
74 * @returns New reference count, UINT32_MAX on invalid handle (asserted).
75 * @param hCdrom The CD-ROM handle to retain.
76 */
77RTDECL(uint32_t) RTCdromRetain(RTCDROM hCdrom);
78
79/**
80 * Releases a reference to the CD-ROM handle.
81 *
82 * When the reference count reaches zero, the CD-ROM handle is destroy.
83 *
84 * @returns New reference count, UINT32_MAX on invalid handle (asserted).
85 * @param hCdrom The CD-ROM handle to retain.
86 */
87RTDECL(uint32_t) RTCdromRelease(RTCDROM hCdrom);
88
89/**
90 * Query the primary mount point of the CD-ROM.
91 *
92 * @returns IPRT status code.
93 * @retval VERR_BUFFER_OVERFLOW if the buffer is too small. The buffer will be
94 * set to an empty string if possible.
95 *
96 * @param hCdrom The CD-ROM handle.
97 * @param pszMountPoint Where to return the mount point.
98 * @param cbMountPoint The size of the mount point buffer.
99 */
100RTDECL(int) RTCdromQueryMountPoint(RTCDROM hCdrom, char *pszMountPoint, size_t cbMountPoint);
101
102/**
103 * Unmounts all file-system mounts related to the CD-ROM.
104 *
105 * @returns IPRT status code.
106 * @param hCdrom The CD-ROM handle.
107 */
108RTDECL(int) RTCdromUnmount(RTCDROM hCdrom);
109
110/**
111 * Ejects the CD-ROM from the drive.
112 *
113 * @returns IPRT status code.
114 * @param hCdrom The CD-ROM handle.
115 * @param fForce If set, unmount and unlock will be performed.
116 */
117RTDECL(int) RTCdromEject(RTCDROM hCdrom, bool fForce);
118
119/**
120 * Locks the CD-ROM so it cannot be ejected by the user or system.
121 *
122 * @returns IPRT status code.
123 * @param hCdrom The CD-ROM handle.
124 */
125RTDECL(int) RTCdromLock(RTCDROM hCdrom);
126
127/**
128 * Unlocks the CD-ROM so it can be ejected by the user or system.
129 *
130 * @returns IPRT status code.
131 * @param hCdrom The CD-ROM handle.
132 */
133RTDECL(int) RTCdromUnlock(RTCDROM hCdrom);
134
135
136/** @name Ordinal / Enumeration
137 * @{ */
138/**
139 * Get the current number of CD-ROMs.
140 *
141 * This is handy for using RTCdromOpenByOrdinal() or RTCdromOrdinalToName() to
142 * perform some kind of enumeration of all drives.
143 *
144 * @returns Number of CD-ROM drivers in the system.
145 */
146RTDECL(unsigned) RTCdromCount(void);
147
148/**
149 * Translates an CD-ROM drive ordinal number to a path suitable for RTCdromOpen.
150 *
151 * @returns IRPT status code.
152 * @retval VINF_SUCCESS on success, with the name in the buffer.
153 * @retval VERR_BUFFER_OVERFLOW if the buffer is too small. The buffer will be
154 * set to an empty string if possible, in order to prevent trouble.
155 * @retval VERR_OUT_OF_RANGE if the ordinal number is higher than the current
156 * number of CD-ROM drives.
157 *
158 * @param iCdrom The CD-ROM drive ordinal. Starts at 0.
159 * @param pszName Where to return the name (path).
160 * @param cbName Size of the output buffer.
161 *
162 * @remarks The ordinals are volatile. They may change as drives are attached
163 * or detected from the host.
164 */
165RTDECL(int) RTCdromOrdinalToName(unsigned iCdrom, char *pszName, size_t cbName);
166
167/**
168 * Combination of RTCdromOrdinalToName() and RTCdromOpen().
169 *
170 * @returns IPRT status code.
171 * @param iCdrom The CD-ROM number.
172 * @param fFlags Open flags, see RTCDROM_O_XXX.
173 * @param phCdrom Where to return the CDROM handle .
174 * @remarks See remarks on RTCdromOrdinalToName().
175 */
176RTDECL(int) RTCdromOpenByOrdinal(unsigned iCdrom, uint32_t fFlags, PRTCDROM phCdrom);
177
178/** @} */
179
180/** @} */
181
182RT_C_DECLS_END
183
184#endif /* !IPRT_INCLUDED_cdrom_h */
185
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