VirtualBox

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

Last change on this file since 67415 was 67370, checked in by vboxsync, 8 years ago

IPRT: ISO maker updates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.6 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 * Resolves a path into a object ID.
119 *
120 * This will be doing the looking up using the specified object names rather
121 * than the version adjusted and mangled according to the namespace setup.
122 *
123 * @returns The object ID corresponding to @a pszPath, or UINT32_MAX if not
124 * found or invalid parameters.
125 * @param hIsoMaker The ISO maker instance.
126 * @param fNamespaces The namespace to resolve @a pszPath in. It's
127 * possible to specify multiple namespaces here, of
128 * course, but that's inefficient.
129 * @param pszPath The path to the object.
130 */
131RTDECL(uint32_t) RTFsIsoMakerGetObjIdxForPath(RTFSISOMAKER hIsoMaker, uint32_t fNamespaces, const char *pszPath);
132
133/**
134 * Removes the specified object from the image.
135 *
136 * @returns IPRT status code.
137 * @param hIsoMaker The ISO maker instance.
138 * @param idxObj The index of the object to remove.
139 */
140RTDECL(int) RTFsIsoMakerObjRemove(RTFSISOMAKER hIsoMaker, uint32_t idxObj);
141
142/**
143 * Sets the path (name) of an object in the selected namespaces.
144 *
145 * The name will be transformed as necessary.
146 *
147 * The initial implementation does not allow this function to be called more
148 * than once on an object.
149 *
150 * @returns IPRT status code.
151 * @param hIsoMaker The ISO maker handle.
152 * @param idxObj The configuration index of to name.
153 * @param fNamespaces The namespaces to apply the path to
154 * (RTFSISOMAKER_NAMESPACE_XXX).
155 * @param pszPath The path.
156 */
157RTDECL(int) RTFsIsoMakerObjSetPath(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t fNamespaces, const char *pszPath);
158
159/**
160 * Sets the name of an object in the selected namespaces, placing it under the
161 * given directory.
162 *
163 * The name will be transformed as necessary.
164 *
165 * @returns IPRT status code.
166 * @param hIsoMaker The ISO maker handle.
167 * @param idxObj The configuration index of to name.
168 * @param idxParentObj The parent directory object.
169 * @param fNamespaces The namespaces to apply the path to
170 * (RTFSISOMAKER_NAMESPACE_XXX).
171 * @param pszName The name.
172 */
173RTDECL(int) RTFsIsoMakerObjSetNameAndParent(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t idxParentObj,
174 uint32_t fNamespaces, const char *pszName);
175
176/**
177 * Adds an unnamed directory to the image.
178 *
179 * The directory must explictly be entered into the desired namespaces.
180 *
181 * @returns IPRT status code
182 * @param hIsoMaker The ISO maker handle.
183 * @param pidxObj Where to return the configuration index of the
184 * directory.
185 * @sa RTFsIsoMakerAddDir, RTFsIsoMakerObjSetPath
186 */
187RTDECL(int) RTFsIsoMakerAddUnnamedDir(RTFSISOMAKER hIsoMaker, uint32_t *pidxObj);
188
189/**
190 * Adds a directory to the image in all namespaces and default attributes.
191 *
192 * @returns IPRT status code
193 * @param hIsoMaker The ISO maker handle.
194 * @param pszDir The path (UTF-8) to the directory in the ISO.
195 *
196 * @param pidxObj Where to return the configuration index of the
197 * directory. Optional.
198 * @sa RTFsIsoMakerAddUnnamedDir, RTFsIsoMakerObjSetPath
199 */
200RTDECL(int) RTFsIsoMakerAddDir(RTFSISOMAKER hIsoMaker, const char *pszDir, uint32_t *pidxObj);
201
202/**
203 * Adds an unnamed file to the image that's backed by a host file.
204 *
205 * The file must explictly be entered into the desired namespaces.
206 *
207 * @returns IPRT status code
208 * @param hIsoMaker The ISO maker handle.
209 * @param pszSrcFile The source file path. VFS chain spec allowed.
210 * @param pidxObj Where to return the configuration index of the
211 * directory.
212 * @sa RTFsIsoMakerAddFile, RTFsIsoMakerObjSetPath
213 */
214RTDECL(int) RTFsIsoMakerAddUnnamedFileWithSrcPath(RTFSISOMAKER hIsoMaker, const char *pszSrcFile, uint32_t *pidxObj);
215
216/**
217 * Adds an unnamed file to the image that's backed by a VFS file.
218 *
219 * The file must explictly be entered into the desired namespaces.
220 *
221 * @returns IPRT status code
222 * @param hIsoMaker The ISO maker handle.
223 * @param hVfsFileSrc The source file handle.
224 * @param pidxObj Where to return the configuration index of the
225 * directory.
226 * @sa RTFsIsoMakerAddUnnamedFileWithSrcPath, RTFsIsoMakerObjSetPath
227 */
228RTDECL(int) RTFsIsoMakerAddUnnamedFileWithVfsFile(RTFSISOMAKER hIsoMaker, RTVFSFILE hVfsFileSrc, uint32_t *pidxObj);
229
230/**
231 * Adds a file that's backed by a host file to the image in all namespaces and
232 * with attributes taken from the source file.
233 *
234 * @returns IPRT status code
235 * @param hIsoMaker The ISO maker handle.
236 * @param pszFile The path to the file in the image.
237 * @param pszSrcFile The source file path. VFS chain spec allowed.
238 * @param pidxObj Where to return the configuration index of the file.
239 * Optional
240 * @sa RTFsIsoMakerAddFileWithVfsFile,
241 * RTFsIsoMakerAddUnnamedFileWithSrcPath
242 */
243RTDECL(int) RTFsIsoMakerAddFileWithSrcPath(RTFSISOMAKER hIsoMaker, const char *pszFile, const char *pszSrcFile, uint32_t *pidxObj);
244
245/**
246 * Adds a file that's backed by a VFS file to the image in all namespaces and
247 * with attributes taken from the source file.
248 *
249 * @returns IPRT status code
250 * @param hIsoMaker The ISO maker handle.
251 * @param pszFile The path to the file in the image.
252 * @param hVfsFileSrc The source file handle.
253 * @param pidxObj Where to return the configuration index of the file.
254 * Optional.
255 * @sa RTFsIsoMakerAddUnnamedFileWithVfsFile,
256 * RTFsIsoMakerAddFileWithSrcPath
257 */
258RTDECL(int) RTFsIsoMakerAddFileWithVfsFile(RTFSISOMAKER hIsoMaker, const char *pszFile, RTVFSFILE hVfsFileSrc, uint32_t *pidxObj);
259
260/**
261 * Finalizes the image.
262 *
263 * @returns IPRT status code.
264 * @param hIsoMaker The ISO maker handle.
265 */
266RTDECL(int) RTFsIsoMakerFinalize(RTFSISOMAKER hIsoMaker);
267
268/**
269 * Creates a VFS file for a finalized ISO maker instanced.
270 *
271 * The file can be used to access the image. Both sequential and random access
272 * are supported, so that this could in theory be hooked up to a CD/DVD-ROM
273 * drive emulation and used as a virtual ISO image.
274 *
275 * @returns IRPT status code.
276 * @param hIsoMaker The ISO maker handle.
277 * @param phVfsFile Where to return the handle.
278 */
279RTDECL(int) RTFsIsoMakerCreateVfsOutputFile(RTFSISOMAKER hIsoMaker, PRTVFSFILE phVfsFile);
280
281
282
283/**
284 * ISO maker command (creates image file on disk).
285 *
286 * @returns IPRT status code
287 * @param cArgs Number of arguments.
288 * @param papszArgs Pointer to argument array.
289 */
290RTDECL(RTEXITCODE) RTFsIsoMakerCmd(unsigned cArgs, char **papszArgs);
291
292/**
293 * Extended ISO maker command.
294 *
295 * This can be used as a ISO maker command that produces a image file, or
296 * alternatively for setting up a virtual ISO in memory.
297 *
298 * @returns IPRT status code
299 * @param cArgs Number of arguments.
300 * @param papszArgs Pointer to argument array.
301 * @param phVfsFile Where to return the virtual ISO. Pass NULL to
302 * for normal operation (creates file on disk).
303 * @param pErrInfo Where to return extended error information in
304 * the virtual ISO mode.
305 */
306RTDECL(int) RTFsIsoMakerCmdEx(unsigned cArgs, char **papszArgs, PRTVFSFILE phVfsFile, PRTERRINFO pErrInfo);
307
308
309/** @} */
310
311RT_C_DECLS_END
312
313#endif
314
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