VirtualBox

source: vbox/trunk/include/iprt/fsvfs.h@ 93941

Last change on this file since 93941 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1/** @file
2 * IPRT - Filesystem, VFS implementations.
3 */
4
5/*
6 * Copyright (C) 2006-2022 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_fsvfs_h
27#define IPRT_INCLUDED_fsvfs_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <iprt/cdefs.h>
33#include <iprt/types.h>
34
35
36RT_C_DECLS_BEGIN
37
38/** @defgroup grp_rt_fs_vfs VFS File System Implementations
39 * @ingroup grp_rt_fs
40 * @{
41 */
42
43/**
44 * Opens a FAT file system volume.
45 *
46 * @returns IPRT status code.
47 * @param hVfsFileIn The file or device backing the volume.
48 * @param fReadOnly Whether to mount it read-only.
49 * @param offBootSector The offset of the boot sector relative to the start
50 * of @a hVfsFileIn. Pass 0 for floppies.
51 * @param phVfs Where to return the virtual file system handle.
52 * @param pErrInfo Where to return additional error information.
53 */
54RTDECL(int) RTFsFatVolOpen(RTVFSFILE hVfsFileIn, bool fReadOnly, uint64_t offBootSector, PRTVFS phVfs, PRTERRINFO pErrInfo);
55
56
57/**
58 * FAT type (format).
59 */
60typedef enum RTFSFATTYPE
61{
62 RTFSFATTYPE_INVALID = 0,
63 RTFSFATTYPE_FAT12,
64 RTFSFATTYPE_FAT16,
65 RTFSFATTYPE_FAT32,
66 RTFSFATTYPE_END
67} RTFSFATTYPE;
68
69
70/** @name RTFSFATVOL_FMT_F_XXX - RTFsFatVolFormat flags
71 * @{ */
72/** Perform a full format, filling unused sectors with 0xf6. */
73#define RTFSFATVOL_FMT_F_FULL UINT32_C(0)
74/** Perform a quick format.
75 * I.e. just write the boot sector, FATs and root directory. */
76#define RTFSFATVOL_FMT_F_QUICK RT_BIT_32(0)
77/** Mask containing all valid flags. */
78#define RTFSFATVOL_FMT_F_VALID_MASK UINT32_C(0x00000001)
79/** @} */
80
81/**
82 * Formats a FAT volume.
83 *
84 * @returns IRPT status code.
85 * @param hVfsFile The volume file.
86 * @param offVol The offset into @a hVfsFile of the file.
87 * Typically 0.
88 * @param cbVol The size of the volume. Pass 0 if the rest of
89 * hVfsFile should be used.
90 * @param fFlags See RTFSFATVOL_FMT_F_XXX.
91 * @param cbSector The logical sector size. Must be power of two.
92 * Optional, pass zero to use 512.
93 * @param cSectorsPerCluster Number of sectors per cluster. Power of two.
94 * Optional, pass zero to auto detect.
95 * @param enmFatType The FAT type (12, 16, 32) to use.
96 * Optional, pass RTFSFATTYPE_INVALID for default.
97 * @param cHeads The number of heads to report in the BPB.
98 * Optional, pass zero to auto detect.
99 * @param cSectorsPerTrack The number of sectors per track to put in the
100 * BPB. Optional, pass zero to auto detect.
101 * @param bMedia The media byte value and FAT ID to use.
102 * Optional, pass zero to auto detect.
103 * @param cRootDirEntries Number of root directory entries.
104 * Optional, pass zero to auto detect.
105 * @param cHiddenSectors Number of hidden sectors. Pass 0 for
106 * unpartitioned media.
107 * @param pErrInfo Additional error information, maybe. Optional.
108 */
109RTDECL(int) RTFsFatVolFormat(RTVFSFILE hVfsFile, uint64_t offVol, uint64_t cbVol, uint32_t fFlags, uint16_t cbSector,
110 uint16_t cSectorsPerCluster, RTFSFATTYPE enmFatType, uint32_t cHeads, uint32_t cSectorsPerTrack,
111 uint8_t bMedia, uint16_t cRootDirEntries, uint32_t cHiddenSectors, PRTERRINFO pErrInfo);
112
113/**
114 * Formats a 1.44MB floppy image.
115 *
116 * @returns IPRT status code.
117 * @param hVfsFile The image. Will be grown to 1.44MB if
118 * necessary.
119 * @param fQuick Whether to quick format the floppy or not.
120 */
121RTDECL(int) RTFsFatVolFormat144(RTVFSFILE hVfsFile, bool fQuick);
122
123/**
124 * Formats a 2.88MB floppy image.
125 *
126 * @returns IPRT status code.
127 * @param hVfsFile The image. Will be grown to 1.44MB if
128 * necessary.
129 * @param fQuick Whether to quick format the floppy or not.
130 */
131RTDECL(int) RTFsFatVolFormat288(RTVFSFILE hVfsFile, bool fQuick);
132
133
134/**
135 * Opens an EXT2/3/4 file system volume.
136 *
137 * @returns IPRT status code.
138 * @param hVfsFileIn The file or device backing the volume.
139 * @param fMntFlags RTVFSMNT_F_XXX.
140 * @param fExtFlags Reserved, MBZ.
141 * @param phVfs Where to return the virtual file system handle.
142 * @param pErrInfo Where to return additional error information.
143 */
144RTDECL(int) RTFsExtVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fExtFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
145
146
147
148/** @name RTFSISO9660_F_XXX - ISO 9660 mount flags.
149 * @{ */
150/** Do not use the UDF part if present. */
151#define RTFSISO9660_F_NO_UDF RT_BIT_32(0)
152/** Do not use the joliet part. */
153#define RTFSISO9660_F_NO_JOLIET RT_BIT_32(1)
154/** Do not use the rock ridge extensions if present. */
155#define RTFSISO9660_F_NO_ROCK RT_BIT_32(2)
156/** Valid ISO 9660 mount option mask. */
157#define RTFSISO9660_F_VALID_MASK UINT32_C(0x00000007)
158/** Checks if @a a_fNoType is the only acceptable volume type. */
159#define RTFSISO9660_F_IS_ONLY_TYPE(a_fFlags, a_fNoType) \
160 ( ((a_fFlags) & (RTFSISO9660_F_NO_UDF | RTFSISO9660_F_NO_JOLIET | RTFSISO9660_F_NO_ROCK)) \
161 == (~(a_fNoType) & (RTFSISO9660_F_NO_UDF | RTFSISO9660_F_NO_JOLIET | RTFSISO9660_F_NO_ROCK)) )
162/** @} */
163
164/**
165 * Opens an ISO 9660 file system volume.
166 *
167 * @returns IPRT status code.
168 * @param hVfsFileIn The file or device backing the volume.
169 * @param fFlags RTFSISO9660_F_XXX.
170 * @param phVfs Where to return the virtual file system handle.
171 * @param pErrInfo Where to return additional error information.
172 */
173RTDECL(int) RTFsIso9660VolOpen(RTVFSFILE hVfsFileIn, uint32_t fFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
174
175
176/**
177 * Opens an NTFS file system volume.
178 *
179 * @returns IPRT status code.
180 * @param hVfsFileIn The file or device backing the volume.
181 * @param fMntFlags RTVFSMNT_F_XXX.
182 * @param fNtfsFlags Reserved, MBZ.
183 * @param phVfs Where to return the virtual file system handle.
184 * @param pErrInfo Where to return additional error information.
185 */
186RTDECL(int) RTFsNtfsVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fNtfsFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
187
188
189/** @} */
190
191RT_C_DECLS_END
192
193#endif /* !IPRT_INCLUDED_fsvfs_h */
194
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