MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2InitializeVcb

Function Ext2InitializeVcb

Ext4Fsd/memory.c:2281–2775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2279#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
2280
2281NTSTATUS
2282Ext2InitializeVcb( IN PEXT2_IRP_CONTEXT IrpContext,
2283 IN PEXT2_VCB Vcb,
2284 IN PEXT2_SUPER_BLOCK sb,
2285 IN PDEVICE_OBJECT TargetDevice,
2286 IN PDEVICE_OBJECT VolumeDevice,
2287 IN PVPB Vpb )
2288{
2289 NTSTATUS Status = STATUS_UNRECOGNIZED_VOLUME;
2290 ULONG IoctlSize;
2291 LONGLONG DiskSize;
2292 LONGLONG PartSize;
2293 UNICODE_STRING RootNode;
2294 USHORT Buffer[2];
2295 ULONG ChangeCount = 0, features;
2296 CC_FILE_SIZES FileSizes;
2297 int i, has_huge_files;
2298
2299 BOOLEAN VcbResourceInitialized = FALSE;
2300 BOOLEAN NotifySyncInitialized = FALSE;
2301 BOOLEAN ExtentsInitialized = FALSE;
2302 BOOLEAN InodeLookasideInitialized = FALSE;
2303 BOOLEAN GroupLoaded = FALSE;
2304
2305 __try {
2306
2307 if (Vpb == NULL) {
2308 Status = STATUS_DEVICE_NOT_READY;
2309 __leave;
2310 }
2311
2312 /* Reject mounting volume if we encounter unsupported incompat features */
2313 if (FlagOn(sb->s_feature_incompat, ~EXT4_FEATURE_INCOMPAT_SUPP)) {
2314 Status = STATUS_UNRECOGNIZED_VOLUME;
2315 __leave;
2316 }
2317
2318 /* Mount the volume RO if we encounter unsupported ro_compat features */
2319 if (FlagOn(sb->s_feature_ro_compat, ~EXT4_FEATURE_RO_COMPAT_SUPP)) {
2320 SetLongFlag(Vcb->Flags, VCB_RO_COMPAT_READ_ONLY);
2321 }
2322
2323 /* Recognize the filesystem as Ext3fs if it supports journalling */
2324 if (IsFlagOn(sb->s_feature_compat, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) {
2325 Vcb->IsExt3fs = TRUE;
2326 }
2327
2328 /* check block size */
2329 Vcb->BlockSize = (EXT2_MIN_BLOCK_SIZE << sb->s_log_block_size);
2330 /* we cannot handle volume with block size bigger than 64k */
2331 if (Vcb->BlockSize > EXT2_MAX_USER_BLKSIZE) {
2332 Status = STATUS_UNRECOGNIZED_VOLUME;
2333 __leave;
2334 }
2335
2336 if (Vcb->BlockSize >= PAGE_SIZE) {
2337 Vcb->IoUnitBits = PAGE_SHIFT;
2338 Vcb->IoUnitSize = PAGE_SIZE;

Callers 1

Ext2MountVolumeFunction · 0.85

Calls 15

Ext2Log2Function · 0.85
Ext2InitializeLabelFunction · 0.85
Ext2DiskIoControlFunction · 0.85
kmem_cache_createFunction · 0.85
ext4_has_metadata_csumFunction · 0.85
is_power_of_2Function · 0.85
ext3_max_sizeFunction · 0.85
ext3_max_bitmap_sizeFunction · 0.85
ext3_blocks_countFunction · 0.85
Ext2LoadGroupFunction · 0.85
Ext2RecoverJournalFunction · 0.85

Tested by

no test coverage detected