VirtualBox

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

Last change on this file since 67437 was 67437, checked in by vboxsync, 8 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: 13.4 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 * Queries the configuration index of the boot catalog file object.
151 *
152 * The boot catalog file is created as necessary, thus this have to be a query
153 * rather than a getter since object creation may fail.
154 *
155 * @returns IPRT status code.
156 * @param hIsoMaker The ISO maker handle.
157 * @param pidxObj Where to return the configuration index.
158 */
159RTDECL(int) RTFsIsoMakerQueryObjIdxForBootCatalog(RTFSISOMAKER hIsoMaker, uint32_t *pidxObj);
160
161/**
162 * Removes the specified object from the image.
163 *
164 * @returns IPRT status code.
165 * @param hIsoMaker The ISO maker instance.
166 * @param idxObj The index of the object to remove.
167 */
168RTDECL(int) RTFsIsoMakerObjRemove(RTFSISOMAKER hIsoMaker, uint32_t idxObj);
169
170/**
171 * Sets the path (name) of an object in the selected namespaces.
172 *
173 * The name will be transformed as necessary.
174 *
175 * The initial implementation does not allow this function to be called more
176 * than once on an object.
177 *
178 * @returns IPRT status code.
179 * @param hIsoMaker The ISO maker handle.
180 * @param idxObj The configuration index of to name.
181 * @param fNamespaces The namespaces to apply the path to
182 * (RTFSISOMAKER_NAMESPACE_XXX).
183 * @param pszPath The path.
184 */
185RTDECL(int) RTFsIsoMakerObjSetPath(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t fNamespaces, const char *pszPath);
186
187/**
188 * Sets the name of an object in the selected namespaces, placing it under the
189 * given directory.
190 *
191 * The name will be transformed as necessary.
192 *
193 * @returns IPRT status code.
194 * @param hIsoMaker The ISO maker handle.
195 * @param idxObj The configuration index of to name.
196 * @param idxParentObj The parent directory object.
197 * @param fNamespaces The namespaces to apply the path to
198 * (RTFSISOMAKER_NAMESPACE_XXX).
199 * @param pszName The name.
200 */
201RTDECL(int) RTFsIsoMakerObjSetNameAndParent(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t idxParentObj,
202 uint32_t fNamespaces, const char *pszName);
203
204/**
205 * Enables or disable syslinux boot info table patching of a file.
206 *
207 * @returns IPRT status code.
208 * @param hIsoMaker The ISO maker handle.
209 * @param idxObj The configuration index.
210 * @param fEnable Whether to enable or disable patching.
211 */
212RTDECL(int) RTFsIsoMakerObjEnableBootInfoTablePatching(RTFSISOMAKER hIsoMaker, uint32_t idxObj, bool fEnable);
213
214/**
215 * Gets the data size of an object.
216 *
217 * Currently only supported on file objects.
218 *
219 * @returns IPRT status code.
220 * @param hIsoMaker The ISO maker handle.
221 * @param idxObj The configuration index.
222 * @param pcbData Where to return the size.
223 */
224RTDECL(int) RTFsIsoMakerObjQueryDataSize(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint64_t *pcbData);
225
226/**
227 * Adds an unnamed directory to the image.
228 *
229 * The directory must explictly be entered into the desired namespaces.
230 *
231 * @returns IPRT status code
232 * @param hIsoMaker The ISO maker handle.
233 * @param pidxObj Where to return the configuration index of the
234 * directory.
235 * @sa RTFsIsoMakerAddDir, RTFsIsoMakerObjSetPath
236 */
237RTDECL(int) RTFsIsoMakerAddUnnamedDir(RTFSISOMAKER hIsoMaker, uint32_t *pidxObj);
238
239/**
240 * Adds a directory to the image in all namespaces and default attributes.
241 *
242 * @returns IPRT status code
243 * @param hIsoMaker The ISO maker handle.
244 * @param pszDir The path (UTF-8) to the directory in the ISO.
245 *
246 * @param pidxObj Where to return the configuration index of the
247 * directory. Optional.
248 * @sa RTFsIsoMakerAddUnnamedDir, RTFsIsoMakerObjSetPath
249 */
250RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxObj);
251
252/**
253 * Adds an unnamed file to the image that's backed by a host file.
254 *
255 * The file must explictly be entered into the desired namespaces.
256 *
257 * @returns IPRT status code
258 * @param hIsoMaker The ISO maker handle.
259 * @param pszSrcFile The source file path. VFS chain spec allowed.
260 * @param pidxObj Where to return the configuration index of the
261 * directory.
262 * @sa RTFsIsoMakerAddFile, RTFsIsoMakerObjSetPath
263 */
264RTDECL(int) RTFsIsoMakerAddUnnamedFileWithSrcPath(RTFSISOMAKER hIsoMaker, const char *pszSrcFile, uint32_t *pidxObj);
265
266/**
267 * Adds an unnamed file to the image that's backed by a VFS file.
268 *
269 * The file must explictly be entered into the desired namespaces.
270 *
271 * @returns IPRT status code
272 * @param hIsoMaker The ISO maker handle.
273 * @param hVfsFileSrc The source file handle.
274 * @param pidxObj Where to return the configuration index of the
275 * directory.
276 * @sa RTFsIsoMakerAddUnnamedFileWithSrcPath, RTFsIsoMakerObjSetPath
277 */
278RTDECL(int) RTFsIsoMakerAddUnnamedFileWithVfsFile(RTFSISOMAKER hIsoMaker, RTVFSFILE hVfsFileSrc, uint32_t *pidxObj);
279
280/**
281 * Adds a file that's backed by a host file to the image in all namespaces and
282 * with attributes taken from the source file.
283 *
284 * @returns IPRT status code
285 * @param hIsoMaker The ISO maker handle.
286 * @param pszFile The path to the file in the image.
287 * @param pszSrcFile The source file path. VFS chain spec allowed.
288 * @param pidxObj Where to return the configuration index of the file.
289 * Optional
290 * @sa RTFsIsoMakerAddFileWithVfsFile,
291 * RTFsIsoMakerAddUnnamedFileWithSrcPath
292 */
293RTDECL(int) RTFsIsoMakerAddFileWithSrcPath(RTFSISOMAKER hIsoMaker, const char *pszFile, const char *pszSrcFile, uint32_t *pidxObj);
294
295/**
296 * Adds a file that's backed by a VFS file to the image in all namespaces and
297 * with attributes taken from the source file.
298 *
299 * @returns IPRT status code
300 * @param hIsoMaker The ISO maker handle.
301 * @param pszFile The path to the file in the image.
302 * @param hVfsFileSrc The source file handle.
303 * @param pidxObj Where to return the configuration index of the file.
304 * Optional.
305 * @sa RTFsIsoMakerAddUnnamedFileWithVfsFile,
306 * RTFsIsoMakerAddFileWithSrcPath
307 */
308RTDECL(int) RTFsIsoMakerAddFileWithVfsFile(RTFSISOMAKER hIsoMaker, const char *pszFile, RTVFSFILE hVfsFileSrc, uint32_t *pidxObj);
309
310/**
311 * Finalizes the image.
312 *
313 * @returns IPRT status code.
314 * @param hIsoMaker The ISO maker handle.
315 */
316RTDECL(int) RTFsIsoMakerFinalize(RTFSISOMAKER hIsoMaker);
317
318/**
319 * Creates a VFS file for a finalized ISO maker instanced.
320 *
321 * The file can be used to access the image. Both sequential and random access
322 * are supported, so that this could in theory be hooked up to a CD/DVD-ROM
323 * drive emulation and used as a virtual ISO image.
324 *
325 * @returns IRPT status code.
326 * @param hIsoMaker The ISO maker handle.
327 * @param phVfsFile Where to return the handle.
328 */
329RTDECL(int) RTFsIsoMakerCreateVfsOutputFile(RTFSISOMAKER hIsoMaker, PRTVFSFILE phVfsFile);
330
331
332
333/**
334 * ISO maker command (creates image file on disk).
335 *
336 * @returns IPRT status code
337 * @param cArgs Number of arguments.
338 * @param papszArgs Pointer to argument array.
339 */
340RTDECL(RTEXITCODE) RTFsIsoMakerCmd(unsigned cArgs, char **papszArgs);
341
342/**
343 * Extended ISO maker command.
344 *
345 * This can be used as a ISO maker command that produces a image file, or
346 * alternatively for setting up a virtual ISO in memory.
347 *
348 * @returns IPRT status code
349 * @param cArgs Number of arguments.
350 * @param papszArgs Pointer to argument array.
351 * @param phVfsFile Where to return the virtual ISO. Pass NULL to
352 * for normal operation (creates file on disk).
353 * @param pErrInfo Where to return extended error information in
354 * the virtual ISO mode.
355 */
356RTDECL(int) RTFsIsoMakerCmdEx(unsigned cArgs, char **papszArgs, PRTVFSFILE phVfsFile, PRTERRINFO pErrInfo);
357
358
359/** @} */
360
361RT_C_DECLS_END
362
363#endif
364
Note: See TracBrowser for help on using the repository browser.

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