[66689] | 1 | /** @file
|
---|
| 2 | * IPRT - Filesystem, VFS implementations.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[76553] | 6 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
[66689] | 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 |
|
---|
[76557] | 26 | #ifndef IPRT_INCLUDED_fsvfs_h
|
---|
| 27 | #define IPRT_INCLUDED_fsvfs_h
|
---|
[76507] | 28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 29 | # pragma once
|
---|
| 30 | #endif
|
---|
[66689] | 31 |
|
---|
| 32 | #include <iprt/cdefs.h>
|
---|
| 33 | #include <iprt/types.h>
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | RT_C_DECLS_BEGIN
|
---|
| 37 |
|
---|
[69840] | 38 | /** @defgroup grp_rt_fs_vfs VFS File System Implementations
|
---|
[66689] | 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 | */
|
---|
| 54 | RTDECL(int) RTFsFatVolOpen(RTVFSFILE hVfsFileIn, bool fReadOnly, uint64_t offBootSector, PRTVFS phVfs, PRTERRINFO pErrInfo);
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | /**
|
---|
| 58 | * FAT type (format).
|
---|
| 59 | */
|
---|
| 60 | typedef 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 | */
|
---|
| 109 | RTDECL(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.
|
---|
[66698] | 119 | * @param fQuick Whether to quick format the floppy or not.
|
---|
[66689] | 120 | */
|
---|
| 121 | RTDECL(int) RTFsFatVolFormat144(RTVFSFILE hVfsFile, bool fQuick);
|
---|
| 122 |
|
---|
[66735] | 123 |
|
---|
[69840] | 124 |
|
---|
| 125 | /**
|
---|
[76218] | 126 | * Opens an EXT2/3/4 file system volume.
|
---|
[69840] | 127 | *
|
---|
| 128 | * @returns IPRT status code.
|
---|
| 129 | * @param hVfsFileIn The file or device backing the volume.
|
---|
| 130 | * @param fMntFlags RTVFSMNT_F_XXX.
|
---|
[76218] | 131 | * @param fExtFlags Reserved, MBZ.
|
---|
[69840] | 132 | * @param phVfs Where to return the virtual file system handle.
|
---|
| 133 | * @param pErrInfo Where to return additional error information.
|
---|
| 134 | */
|
---|
[76218] | 135 | RTDECL(int) RTFsExtVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fExtFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
|
---|
[69840] | 136 |
|
---|
| 137 |
|
---|
| 138 |
|
---|
[66735] | 139 | /** @name RTFSISO9660_F_XXX - ISO 9660 mount flags.
|
---|
| 140 | * @{ */
|
---|
[68509] | 141 | /** Do not use the UDF part if present. */
|
---|
| 142 | #define RTFSISO9660_F_NO_UDF RT_BIT_32(0)
|
---|
[66735] | 143 | /** Do not use the joliet part. */
|
---|
[68509] | 144 | #define RTFSISO9660_F_NO_JOLIET RT_BIT_32(1)
|
---|
[66735] | 145 | /** Do not use the rock ridge extensions if present. */
|
---|
[68509] | 146 | #define RTFSISO9660_F_NO_ROCK RT_BIT_32(2)
|
---|
[66735] | 147 | /** Valid ISO 9660 mount option mask. */
|
---|
[68509] | 148 | #define RTFSISO9660_F_VALID_MASK UINT32_C(0x00000007)
|
---|
[69013] | 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)) )
|
---|
[66735] | 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 | */
|
---|
| 164 | RTDECL(int) RTFsIso9660VolOpen(RTVFSFILE hVfsFileIn, uint32_t fFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
|
---|
| 165 |
|
---|
| 166 |
|
---|
[69849] | 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 | */
|
---|
| 177 | RTDECL(int) RTFsNtfsVolOpen(RTVFSFILE hVfsFileIn, uint32_t fMntFlags, uint32_t fNtfsFlags, PRTVFS phVfs, PRTERRINFO pErrInfo);
|
---|
| 178 |
|
---|
| 179 |
|
---|
[66689] | 180 | /** @} */
|
---|
| 181 |
|
---|
| 182 | RT_C_DECLS_END
|
---|
| 183 |
|
---|
[76585] | 184 | #endif /* !IPRT_INCLUDED_fsvfs_h */
|
---|
[66689] | 185 |
|
---|