VirtualBox

source: vbox/trunk/include/iprt/fsisomaker.h@ 67427

Last change on this file since 67427 was 67427, checked in by vboxsync, 7 years ago

IPRT: More ISO maker code (booting related).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.2 KB
Line 
1/** @file
2 * IPRT - ISO Image Maker.
3 */
4
5/*
6 * Copyright (C) 2017 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_fsisomaker_h
27#define ___iprt_fsisomaker_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31#include <iprt/time.h>
32
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_rt_fsisomaker RTFsIsoMaker - ISO Image Maker
37 * @ingroup grp_rt_fs
38 * @{
39 */
40
41
42/** @name RTFSISOMAKER_NAMESPACE_XXX - Namespace selector.
43 * @{
44 */
45#define RTFSISOMAKER_NAMESPACE_ISO_9660 RT_BIT_32(0) /**< The primary ISO-9660 namespace. */
46#define RTFSISOMAKER_NAMESPACE_JOLIET RT_BIT_32(1) /**< The joliet namespace. */
47#define RTFSISOMAKER_NAMESPACE_UDF RT_BIT_32(2) /**< The UDF namespace. */
48#define RTFSISOMAKER_NAMESPACE_HFS RT_BIT_32(3) /**< The HFS namespace */
49#define RTFSISOMAKER_NAMESPACE_ALL UINT32_C(0x0000000f) /**< All namespaces. */
50#define RTFSISOMAKER_NAMESPACE_VALID_MASK UINT32_C(0x0000000f) /**< Valid namespace bits. */
51/** @} */
52
53
54/**
55 * Creates an ISO maker instance.
56 *
57 * @returns IPRT status code.
58 * @param phIsoMaker Where to return the handle to the new ISO maker.
59 */
60RTDECL(int) RTFsIsoMakerCreate(PRTFSISOMAKER phIsoMaker);
61
62/**
63 * Retains a references to an ISO maker instance.
64 *
65 * @returns New reference count on success, UINT32_MAX if invalid handle.
66 * @param hIsoMaker The ISO maker handle.
67 */
68RTDECL(uint32_t) RTFsIsoMakerRetain(RTFSISOMAKER hIsoMaker);
69
70/**
71 * Releases a references to an ISO maker instance.
72 *
73 * @returns New reference count on success, UINT32_MAX if invalid handle.
74 * @param hIsoMaker The ISO maker handle. NIL is ignored.
75 */
76RTDECL(uint32_t) RTFsIsoMakerRelease(RTFSISOMAKER hIsoMaker);
77
78/**
79 * Sets the ISO-9660 level.
80 *
81 * @returns IPRT status code
82 * @param hIsoMaker The ISO maker handle.
83 * @param uIsoLevel The level, 1-3.
84 */
85RTDECL(int) RTFsIsoMakerSetIso9660Level(RTFSISOMAKER hIsoMaker, uint8_t uIsoLevel);
86
87/**
88 * Sets the joliet level.
89 *
90 * @returns IPRT status code
91 * @param hIsoMaker The ISO maker handle.
92 * @param uJolietLevel The joliet UCS-2 level 1-3, or 0 to disable
93 * joliet.
94 */
95RTDECL(int) RTFsIsoMakerSetJolietUcs2Level(RTFSISOMAKER hIsoMaker, uint8_t uJolietLevel);
96
97/**
98 * Sets the rock ridge support level (on the primary ISO-9660 namespace).
99 *
100 * @returns IPRT status code
101 * @param hIsoMaker The ISO maker handle.
102 * @param uLevel 0 if disabled, 1 to just enable, 2 to enable and
103 * write the ER tag.
104 */
105RTDECL(int) RTFsIsoMakerSetRockRidgeLevel(RTFSISOMAKER hIsoMaker, uint8_t uLevel);
106
107/**
108 * Sets the rock ridge support level on the joliet namespace (experimental).
109 *
110 * @returns IPRT status code
111 * @param hIsoMaker The ISO maker handle.
112 * @param uLevel 0 if disabled, 1 to just enable, 2 to enable and
113 * write the ER tag.
114 */
115RTDECL(int) RTFsIsoMakerSetJolietRockRidgeLevel(RTFSISOMAKER hIsoMaker, uint8_t uLevel);
116
117/**
118 * Sets the content of the system area, i.e. the first 32KB of the image.
119 *
120 * This can be used to put generic boot related stuff.
121 *
122 * @note Other settings may overwrite parts of the content (yet to be
123 * determined which).
124 *
125 * @returns IPRT status code
126 * @param hIsoMaker The ISO maker handle.
127 * @param pvContent The content to put in the system area.
128 * @param cbContent The size of the content.
129 * @param off The offset into the system area.
130 */
131RTDECL(int) RTFsIsoMakerSetSysAreaContent(RTFSISOMAKER hIsoMaker, void const *pvContent, size_t cbContent, uint32_t off);
132
133/**
134 * Resolves a path into a object ID.
135 *
136 * This will be doing the looking up using the specified object names rather
137 * than the version adjusted and mangled according to the namespace setup.
138 *
139 * @returns The object ID corresponding to @a pszPath, or UINT32_MAX if not
140 * found or invalid parameters.
141 * @param hIsoMaker The ISO maker instance.
142 * @param fNamespaces The namespace to resolve @a pszPath in. It's
143 * possible to specify multiple namespaces here, of
144 * course, but that's inefficient.
145 * @param pszPath The path to the object.
146 */
147RTDECL(uint32_t) RTFsIsoMakerGetObjIdxForPath(RTFSISOMAKER hIsoMaker, uint32_t fNamespaces, const char *pszPath);
148
149/**
150 * Removes the specified object from the image.
151 *
152 * @returns IPRT status code.
153 * @param hIsoMaker The ISO maker instance.
154 * @param idxObj The index of the object to remove.
155 */
156RTDECL(int) RTFsIsoMakerObjRemove(RTFSISOMAKER hIsoMaker, uint32_t idxObj);
157
158/**
159 * Sets the path (name) of an object in the selected namespaces.
160 *
161 * The name will be transformed as necessary.
162 *
163 * The initial implementation does not allow this function to be called more
164 * than once on an object.
165 *
166 * @returns IPRT status code.
167 * @param hIsoMaker The ISO maker handle.
168 * @param idxObj The configuration index of to name.
169 * @param fNamespaces The namespaces to apply the path to
170 * (RTFSISOMAKER_NAMESPACE_XXX).
171 * @param pszPath The path.
172 */
173RTDECL(int) RTFsIsoMakerObjSetPath(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t fNamespaces, const char *pszPath);
174
175/**
176 * Sets the name of an object in the selected namespaces, placing it under the
177 * given directory.
178 *
179 * The name will be transformed as necessary.
180 *
181 * @returns IPRT status code.
182 * @param hIsoMaker The ISO maker handle.
183 * @param idxObj The configuration index of to name.
184 * @param idxParentObj The parent directory object.
185 * @param fNamespaces The namespaces to apply the path to
186 * (RTFSISOMAKER_NAMESPACE_XXX).
187 * @param pszName The name.
188 */
189RTDECL(int) RTFsIsoMakerObjSetNameAndParent(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t idxParentObj,
190 uint32_t fNamespaces, const char *pszName);
191
192/**
193 * Adds an unnamed directory to the image.
194 *
195 * The directory must explictly be entered into the desired namespaces.
196 *
197 * @returns IPRT status code
198 * @param hIsoMaker The ISO maker handle.
199 * @param pidxObj Where to return the configuration index of the
200 * directory.
201 * @sa RTFsIsoMakerAddDir, RTFsIsoMakerObjSetPath
202 */
203RTDECL(int) RTFsIsoMakerAddUnnamedDir(RTFSISOMAKER hIsoMaker, uint32_t *pidxObj);
204
205/**
206 * Adds a directory to the image in all namespaces and default attributes.
207 *
208 * @returns IPRT status code
209 * @param hIsoMaker The ISO maker handle.
210 * @param pszDir The path (UTF-8) to the directory in the ISO.
211 *
212 * @param pidxObj Where to return the configuration index of the
213 * directory. Optional.
214 * @sa RTFsIsoMakerAddUnnamedDir, RTFsIsoMakerObjSetPath
215 */
216RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxObj);
217
218/**
219 * Adds an unnamed file to the image that's backed by a host file.
220 *
221 * The file must explictly be entered into the desired namespaces.
222 *
223 * @returns IPRT status code
224 * @param hIsoMaker The ISO maker handle.
225 * @param pszSrcFile The source file path. VFS chain spec allowed.
226 * @param pidxObj Where to return the configuration index of the
227 * directory.
228 * @sa RTFsIsoMakerAddFile, RTFsIsoMakerObjSetPath
229 */
230RTDECL(int) RTFsIsoMakerAddUnnamedFileWithSrcPath(RTFSISOMAKER hIsoMaker, const char *pszSrcFile, uint32_t *pidxObj);
231
232/**
233 * Adds an unnamed file to the image that's backed by a VFS file.
234 *
235 * The file must explictly be entered into the desired namespaces.
236 *
237 * @returns IPRT status code
238 * @param hIsoMaker The ISO maker handle.
239 * @param hVfsFileSrc The source file handle.
240 * @param pidxObj Where to return the configuration index of the
241 * directory.
242 * @sa RTFsIsoMakerAddUnnamedFileWithSrcPath, RTFsIsoMakerObjSetPath
243 */
244RTDECL(int) RTFsIsoMakerAddUnnamedFileWithVfsFile(RTFSISOMAKER hIsoMaker, RTVFSFILE hVfsFileSrc, uint32_t *pidxObj);
245
246/**
247 * Adds a file that's backed by a host file to the image in all namespaces and
248 * with attributes taken from the source file.
249 *
250 * @returns IPRT status code
251 * @param hIsoMaker The ISO maker handle.
252 * @param pszFile The path to the file in the image.
253 * @param pszSrcFile The source file path. VFS chain spec allowed.
254 * @param pidxObj Where to return the configuration index of the file.
255 * Optional
256 * @sa RTFsIsoMakerAddFileWithVfsFile,
257 * RTFsIsoMakerAddUnnamedFileWithSrcPath
258 */
259RTDECL(int) RTFsIsoMakerAddFileWithSrcPath(RTFSISOMAKER hIsoMaker, const char *pszFile, const char *pszSrcFile, uint32_t *pidxObj);
260
261/**
262 * Adds a file that's backed by a VFS file to the image in all namespaces and
263 * with attributes taken from the source file.
264 *
265 * @returns IPRT status code
266 * @param hIsoMaker The ISO maker handle.
267 * @param pszFile The path to the file in the image.
268 * @param hVfsFileSrc The source file handle.
269 * @param pidxObj Where to return the configuration index of the file.
270 * Optional.
271 * @sa RTFsIsoMakerAddUnnamedFileWithVfsFile,
272 * RTFsIsoMakerAddFileWithSrcPath
273 */
274RTDECL(int) RTFsIsoMakerAddFileWithVfsFile(RTFSISOMAKER hIsoMaker, const char *pszFile, RTVFSFILE hVfsFileSrc, uint32_t *pidxObj);
275
276/**
277 * Finalizes the image.
278 *
279 * @returns IPRT status code.
280 * @param hIsoMaker The ISO maker handle.
281 */
282RTDECL(int) RTFsIsoMakerFinalize(RTFSISOMAKER hIsoMaker);
283
284/**
285 * Creates a VFS file for a finalized ISO maker instanced.
286 *
287 * The file can be used to access the image. Both sequential and random access
288 * are supported, so that this could in theory be hooked up to a CD/DVD-ROM
289 * drive emulation and used as a virtual ISO image.
290 *
291 * @returns IRPT status code.
292 * @param hIsoMaker The ISO maker handle.
293 * @param phVfsFile Where to return the handle.
294 */
295RTDECL(int) RTFsIsoMakerCreateVfsOutputFile(RTFSISOMAKER hIsoMaker, PRTVFSFILE phVfsFile);
296
297
298
299/**
300 * ISO maker command (creates image file on disk).
301 *
302 * @returns IPRT status code
303 * @param cArgs Number of arguments.
304 * @param papszArgs Pointer to argument array.
305 */
306RTDECL(RTEXITCODE) RTFsIsoMakerCmd(unsigned cArgs, char **papszArgs);
307
308/**
309 * Extended ISO maker command.
310 *
311 * This can be used as a ISO maker command that produces a image file, or
312 * alternatively for setting up a virtual ISO in memory.
313 *
314 * @returns IPRT status code
315 * @param cArgs Number of arguments.
316 * @param papszArgs Pointer to argument array.
317 * @param phVfsFile Where to return the virtual ISO. Pass NULL to
318 * for normal operation (creates file on disk).
319 * @param pErrInfo Where to return extended error information in
320 * the virtual ISO mode.
321 */
322RTDECL(int) RTFsIsoMakerCmdEx(unsigned cArgs, char **papszArgs, PRTVFSFILE phVfsFile, PRTERRINFO pErrInfo);
323
324
325/** @} */
326
327RT_C_DECLS_END
328
329#endif
330
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