/* INCLUDES **************************************************************/
#include "Mke2fs.h"
+
+#include <fmifs/fmifs.h>
#include <debug.h>
/* GLOBALS ***************************************************************/
BOOLEAN bLocked = FALSE;
+/* This is needed for the ext2fs driver to mount the volume */
+#define ZAP_BOOTBLOCK
+
/* FUNCTIONS *************************************************************/
int int_log2(int arg)
bool zero_blocks(PEXT2_FILESYS fs, ULONG blk, ULONG num,
ULONG *ret_blk, ULONG *ret_count)
{
- ULONG j, count, next_update, next_update_incr;
+ ULONG j, count;
static unsigned char *buf;
bool retval;
}
/* OK, do the write loop */
- next_update = 0;
- next_update_incr = num / 100;
- if (next_update_incr < 1)
- next_update_incr = 1;
-
for (j=0; j < num; j += STRIDE_LENGTH, blk += STRIDE_LENGTH)
{
if (num-j > STRIDE_LENGTH)
sect, sect + nsect - 1);
return false;
}
-
- memset(buf, 0, (ULONG)nsect * SECTOR_SIZE);
#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
#define BSD_MAGICDISK (0x57455682UL) /* The disk magic number reversed */
goto clean_up;
}
+ memset(buf, 0, (ULONG)nsect * SECTOR_SIZE);
+
// Write buf to disk
Ext2WriteDisk( Ext2Sys,
(LONGLONG)(sect * SECTOR_SIZE),
ULONG ret_blk;
- Callback(PROGRESS, 0, (PVOID)&Percent);
+ if (Callback != NULL)
+ {
+ Callback(PROGRESS, 0, (PVOID)&Percent);
+ }
RtlZeroMemory(&Ext2Sb, sizeof(EXT2_SUPER_BLOCK));
blocks = Ext2Sb.s_blocks_count;
#ifdef ZAP_BOOTBLOCK
+ DPRINT1("Mke2fs: zeroing volume boot record\n");
zap_sector(&FileSys, 0, 2);
#endif
Ext2CloseDevice(&FileSys);
- Callback(DONE, 0, (PVOID)&bRet);
+ if (Callback != NULL)
+ {
+ Callback(DONE, 0, (PVOID)&bRet);
+ }
return Status;
}