VirtualBox

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

Last change on this file since 80957 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.1 KB
Line 
1/** @file
2 * IPRT - Filesystem, VFS implementations.
3 */
4
5/*
6 * Copyright (C) 2006-2019 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
125/**
126 * Opens an EXT2/3/4 file system volume.
127 *
128 * @returns IPRT status code.
129 * @param hVfsFileIn The file or device backing the volume.
130 * @param fMntFlags RTVFSMNT_F_XXX.
131 * @param fExtFlags Reserved, MBZ.
132 * @param phVfs Where to return the virtual file system handle.
133 * @param pErrInfo Where to return additional error information.
134 */
135RTDECL(int) RTFsExtVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fExtFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
136
137
138
139/** @name RTFSISO9660_F_XXX - ISO 9660 mount flags.
140 * @{ */
141/** Do not use the UDF part if present. */
142#define RTFSISO9660_F_NO_UDF RT_BIT_32(0)
143/** Do not use the joliet part. */
144#define RTFSISO9660_F_NO_JOLIET RT_BIT_32(1)
145/** Do not use the rock ridge extensions if present. */
146#define RTFSISO9660_F_NO_ROCK RT_BIT_32(2)
147/** Valid ISO 9660 mount option mask. */
148#define RTFSISO9660_F_VALID_MASK UINT32_C(0x00000007)
149/** Checks if @a a_fNoType is the only acceptable volume type. */
150#define RTFSISO9660_F_IS_ONLY_TYPE(a_fFlags, a_fNoType) \
151 ( ((a_fFlags) & (RTFSISO9660_F_NO_UDF | RTFSISO9660_F_NO_JOLIET | RTFSISO9660_F_NO_ROCK)) \
152 == (~(a_fNoType) & (RTFSISO9660_F_NO_UDF | RTFSISO9660_F_NO_JOLIET | RTFSISO9660_F_NO_ROCK)) )
153/** @} */
154
155/**
156 * Opens an ISO 9660 file system volume.
157 *
158 * @returns IPRT status code.
159 * @param hVfsFileIn The file or device backing the volume.
160 * @param fFlags RTFSISO9660_F_XXX.
161 * @param phVfs Where to return the virtual file system handle.
162 * @param pErrInfo Where to return additional error information.
163 */
164RTDECL(int) RTFsIso9660VolOpen(RTVFSFILE hVfsFileIn, uint32_t fFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
165
166
167/**
168 * Opens an NTFS file system volume.
169 *
170 * @returns IPRT status code.
171 * @param hVfsFileIn The file or device backing the volume.
172 * @param fMntFlags RTVFSMNT_F_XXX.
173 * @param fNtfsFlags Reserved, MBZ.
174 * @param phVfs Where to return the virtual file system handle.
175 * @param pErrInfo Where to return additional error information.
176 */
177RTDECL(int) RTFsNtfsVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fNtfsFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
178
179
180/** @} */
181
182RT_C_DECLS_END
183
184#endif /* !IPRT_INCLUDED_fsvfs_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