Author: pschweitzer
Date: Sun Jun 29 03:33:47 2008
New Revision: 34175
URL: http://svn.reactos.org/svn/reactos?rev=34175&view=rev
Log:
fs_rec.sys is now able to recognize Ext2 partitions and so, to launch Ext2 driver.
Defines have been taken from Linux Kernel Source
Modified:
branches/pierre-fsd/drivers/filesystems/fs_rec/ext2.c
branches/pierre-fsd/drivers/filesystems/fs_rec/fs_rec.h
Modified: branches/pierre-fsd/drivers/filesystems/fs_rec/ext2.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/fs_rec/ext2.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/fs_rec/ext2.c [iso-8859-1] Sun Jun 29 03:33:47 2008
@@ -4,6 +4,7 @@
* FILE: drivers/filesystems/fs_rec/ext2.c
* PURPOSE: EXT2 Recognizer
* PROGRAMMER: Eric Kohl
+ * Pierre Schweitzer
*/
/* INCLUDES *****************************************************************/
@@ -16,10 +17,15 @@
BOOLEAN
NTAPI
-FsRecIsExt2Volume(IN PVOID PackedBootSector)
+FsRecIsExt2Volume(IN pext2_super_block SuperBlock)
{
- /* For now, always return failure... */
- return FALSE;
+ BOOLEAN Result = TRUE;
+ PAGED_CODE();
+
+ if (SuperBlock->s_magic != EXT2_SUPER_MAGIC)
+ Result = FALSE;
+
+ return Result;
}
NTSTATUS
@@ -30,9 +36,9 @@
PIO_STACK_LOCATION Stack;
NTSTATUS Status;
PDEVICE_OBJECT MountDevice;
- PVOID Bpb = NULL;
+ PVOID SuperBlock = NULL;
ULONG SectorSize;
- LARGE_INTEGER Offset = {{0}};
+ LARGE_INTEGER Offset = {{1024}};
BOOLEAN DeviceError = FALSE;
PAGED_CODE();
@@ -49,24 +55,24 @@
MountDevice = Stack->Parameters.MountVolume.DeviceObject;
if (FsRecGetDeviceSectorSize(MountDevice, &SectorSize))
{
- /* Try to read the BPB */
+ /* Try to read the Super Block */
if (FsRecReadBlock(MountDevice,
&Offset,
- 512,
+ 1024,
SectorSize,
- (PVOID)&Bpb,
+ (PVOID)&SuperBlock,
&DeviceError))
{
/* Check if it's an actual EXT2 volume */
- if (FsRecIsExt2Volume(Bpb))
+ if (FsRecIsExt2Volume(SuperBlock))
{
/* It is! */
Status = STATUS_FS_DRIVER_REQUIRED;
}
}
- /* Free the boot sector if we have one */
- ExFreePool(Bpb);
+ /* Free the Super Block if we have one */
+ ExFreePool(SuperBlock);
}
else
{
Modified: branches/pierre-fsd/drivers/filesystems/fs_rec/fs_rec.h
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/fs_rec/fs_rec.h [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/fs_rec/fs_rec.h [iso-8859-1] Sun Jun 29 03:33:47 2008
@@ -25,6 +25,12 @@
//
#define UDFS_VRS_START_SECTOR 16
#define UDFS_AVDP_SECTOR 256
+
+//
+// Ext2 Magic
+// Taken from Linux Kernel
+//
+#define EXT2_SUPER_MAGIC 0xEF53
//
// Conversion types and macros taken from internal ntifs headers
@@ -172,6 +178,73 @@
#include <poppack.h>
//
+// Ext2 Structure
+// Taken from Linux Kernel and adapted for ReactOS
+//
+/*
+ * Structure of the super block
+ */
+typedef struct _ext2_super_block
+{
+ ULONG s_inodes_count; /* Inodes count */
+ ULONG s_blocks_count; /* Blocks count */
+ ULONG s_r_blocks_count; /* Reserved blocks count */
+ ULONG s_free_blocks_count; /* Free blocks count */
+ ULONG s_free_inodes_count; /* Free inodes count */
+ ULONG s_first_data_block; /* First Data Block */
+ ULONG s_log_block_size; /* Block size */
+ LONG s_log_frag_size; /* Fragment size */
+ ULONG s_blocks_per_group; /* # Blocks per group */
+ ULONG s_frags_per_group; /* # Fragments per group */
+ ULONG s_inodes_per_group; /* # Inodes per group */
+ ULONG s_mtime; /* Mount time */
+ ULONG s_wtime; /* Write time */
+ USHORT s_mnt_count; /* Mount count */
+ SHORT s_max_mnt_count; /* Maximal mount count */
+ USHORT s_magic; /* Magic signature */
+ USHORT s_state; /* File system state */
+ USHORT s_errors; /* Behaviour when detecting errors */
+ USHORT s_minor_rev_level; /* minor revision level */
+ ULONG s_lastcheck; /* time of last check */
+ ULONG s_checkinterval; /* max. time between checks */
+ ULONG s_creator_os; /* OS */
+ ULONG s_rev_level; /* Revision level */
+ USHORT s_def_resuid; /* Default uid for reserved blocks */
+ USHORT s_def_resgid; /* Default gid for reserved blocks */
+ /*
+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
+ *
+ * Note: the difference between the compatible feature set and
+ * the incompatible feature set is that if there is a bit set
+ * in the incompatible feature set that the kernel doesn't
+ * know about, it should refuse to mount the filesystem.
+ *
+ * e2fsck's requirements are more strict; if it doesn't know
+ * about a feature in either the compatible or incompatible
+ * feature set, it must abort and not try to meddle with
+ * things it doesn't understand...
+ */
+ ULONG s_first_ino; /* First non-reserved inode */
+ USHORT s_inode_size; /* size of inode structure */
+ USHORT s_block_group_nr; /* block group # of this superblock */
+ ULONG s_feature_compat; /* compatible feature set */
+ ULONG s_feature_incompat; /* incompatible feature set */
+ ULONG s_feature_ro_compat; /* readonly-compatible feature set */
+ UCHAR s_uuid[16]; /* 128-bit uuid for volume */
+ char s_volume_name[16]; /* volume name */
+ char s_last_mounted[64]; /* directory where last mounted */
+ ULONG s_algorithm_usage_bitmap; /* For compression */
+ /*
+ * Performance hints. Directory preallocation should only
+ * happen if the EXT2_COMPAT_PREALLOC flag is on.
+ */
+ UCHAR s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
+ UCHAR s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
+ USHORT s_padding1;
+ ULONG s_reserved[204]; /* Padding to the end of the block */
+} ext2_super_block, *pext2_super_block;
+
+//
// Filesystem Types
//
typedef enum _FILE_SYSTEM_TYPE
Author: fireball
Date: Sun Jun 29 03:33:21 2008
New Revision: 34174
URL: http://svn.reactos.org/svn/reactos?rev=34174&view=rev
Log:
Roel Messiant <roelmessiant(a)gmail.com>
- Fix one of the oldest bugs: "ROS can not parse partition table corectly". The original macro that calculates the space casts the value to ULONG, while ULONGLONG math is required here.
See issue #950 for more details.
Modified:
trunk/reactos/base/setup/usetup/partlist.c
Modified: trunk/reactos/base/setup/usetup/partlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Sun Jun 29 03:33:21 2008
@@ -406,8 +406,8 @@
{
/* Round-down to cylinder size */
LastUnusedPartitionLength =
- ROUND_DOWN (DiskEntry->DiskSize - (LastStartingOffset + LastPartitionLength),
- DiskEntry->CylinderSize);
+ (DiskEntry->DiskSize - (LastStartingOffset + LastPartitionLength))
+ & ~(DiskEntry->CylinderSize - 1);
if (LastUnusedPartitionLength >= DiskEntry->CylinderSize)
{
Author: fireball
Date: Sun Jun 29 03:20:08 2008
New Revision: 34173
URL: http://svn.reactos.org/svn/reactos?rev=34173&view=rev
Log:
- Merge 34167,34171-34172.
Modified:
branches/ros-branch-0_3_5/reactos/dll/win32/kernel32/mem/procmem.c
branches/ros-branch-0_3_5/reactos/ntoskrnl/ke/apc.c
branches/ros-branch-0_3_5/reactos/ntoskrnl/mm/virtual.c
Modified: branches/ros-branch-0_3_5/reactos/dll/win32/kernel32/mem/procmem.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_5/reactos/dll/wi…
==============================================================================
--- branches/ros-branch-0_3_5/reactos/dll/win32/kernel32/mem/procmem.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_5/reactos/dll/win32/kernel32/mem/procmem.c [iso-8859-1] Sun Jun 29 03:20:08 2008
@@ -79,7 +79,7 @@
PAGE_WRITECOPY |
PAGE_EXECUTE_READWRITE |
PAGE_EXECUTE_WRITECOPY) ? FALSE : TRUE;
- if (UnProtect)
+ if (!UnProtect)
{
/* Set the new protection */
Status = NtProtectVirtualMemory(hProcess,
Modified: branches/ros-branch-0_3_5/reactos/ntoskrnl/ke/apc.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_5/reactos/ntoskr…
==============================================================================
--- branches/ros-branch-0_3_5/reactos/ntoskrnl/ke/apc.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_5/reactos/ntoskrnl/ke/apc.c [iso-8859-1] Sun Jun 29 03:20:08 2008
@@ -212,9 +212,24 @@
}
else if (Thread->State == GateWait)
{
- /* We were in a gate wait. FIXME: Handle this */
- DPRINT1("Not yet supported -- Report this to Alex\n");
- while (TRUE);
+ /* We were in a gate wait. Handle this. */
+ DPRINT1("A thread was in a gate wait\n");
+
+ /* Lock the gate */
+ KiAcquireDispatcherObject(&Thread->GateObject->Header);
+
+ /* Remove it from the waiters list */
+ RemoveEntryList(&Thread->WaitBlock[0].WaitListEntry);
+
+ /* Unlock the gate */
+ KiReleaseDispatcherObject(&Thread->GateObject->Header);
+
+ /* Increase the queue counter if needed */
+ if (Thread->Queue) Thread->Queue->CurrentCount++;
+
+ /* Put into deferred ready list with this status */
+ Status = STATUS_KERNEL_APC;
+ KiInsertDeferredReadyList(Thread);
}
}
else if ((Thread->State == Waiting) &&
@@ -867,7 +882,7 @@
/* Acquire the dispatcher lock and remove it from the list */
KiAcquireDispatcherLockAtDpcLevel();
- if (RemoveEntryList(&ApcState->ApcListHead[Apc->ApcMode]))
+ if (RemoveEntryList(&Apc->ApcListEntry))
{
/* Set the correct state based on the APC Mode */
if (Apc->ApcMode == KernelMode)
Modified: branches/ros-branch-0_3_5/reactos/ntoskrnl/mm/virtual.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_5/reactos/ntoskr…
==============================================================================
--- branches/ros-branch-0_3_5/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_5/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Sun Jun 29 03:20:08 2008
@@ -172,7 +172,7 @@
{
/* Exit */
Status = _SEH_GetExceptionCode();
- _SEH_YIELD();
+ _SEH_YIELD(return Status);
}
/* Otherwise, we failed probably during the move */
@@ -319,7 +319,7 @@
{
/* Exit */
Status = _SEH_GetExceptionCode();
- _SEH_YIELD();
+ _SEH_YIELD(return Status);
}
/* Otherwise, we failed probably during the move */
Author: fireball
Date: Sun Jun 29 03:03:25 2008
New Revision: 34171
URL: http://svn.reactos.org/svn/reactos?rev=34171&view=rev
Log:
- Fix a problem spotted by Juriy Sidorov in bug 3415. With this fix applied, GDB is able to work much better - be able to write in memory, set breakpoints, etc.
See issue #3415 for more details.
Modified:
trunk/reactos/dll/win32/kernel32/mem/procmem.c
Modified: trunk/reactos/dll/win32/kernel32/mem/procmem.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/mem/pro…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/mem/procmem.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/mem/procmem.c [iso-8859-1] Sun Jun 29 03:03:25 2008
@@ -79,7 +79,7 @@
PAGE_WRITECOPY |
PAGE_EXECUTE_READWRITE |
PAGE_EXECUTE_WRITECOPY) ? FALSE : TRUE;
- if (UnProtect)
+ if (!UnProtect)
{
/* Set the new protection */
Status = NtProtectVirtualMemory(hProcess,
Author: fireball
Date: Sat Jun 28 14:23:23 2008
New Revision: 34167
URL: http://svn.reactos.org/svn/reactos?rev=34167&view=rev
Log:
- Implement a gatewait case (was "tested" with a "Not yet supported" bug previously in the tree; DPRINT1 is left there for further testing).
- Fix a bug in KeRemoveQueueApc: the code was always removing the first entry in the APC queue
instead of the actual APC. This should fix weird user-mode timer bugs. (Spotted in bug 3354).
See issue #3354 for more details.
Modified:
trunk/reactos/ntoskrnl/ke/apc.c
Modified: trunk/reactos/ntoskrnl/ke/apc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/apc.c?rev=3416…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/apc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/apc.c [iso-8859-1] Sat Jun 28 14:23:23 2008
@@ -212,9 +212,24 @@
}
else if (Thread->State == GateWait)
{
- /* We were in a gate wait. FIXME: Handle this */
- DPRINT1("Not yet supported -- Report this to Alex\n");
- while (TRUE);
+ /* We were in a gate wait. Handle this. */
+ DPRINT1("A thread was in a gate wait\n");
+
+ /* Lock the gate */
+ KiAcquireDispatcherObject(&Thread->GateObject->Header);
+
+ /* Remove it from the waiters list */
+ RemoveEntryList(&Thread->WaitBlock[0].WaitListEntry);
+
+ /* Unlock the gate */
+ KiReleaseDispatcherObject(&Thread->GateObject->Header);
+
+ /* Increase the queue counter if needed */
+ if (Thread->Queue) Thread->Queue->CurrentCount++;
+
+ /* Put into deferred ready list with this status */
+ Status = STATUS_KERNEL_APC;
+ KiInsertDeferredReadyList(Thread);
}
}
else if ((Thread->State == Waiting) &&
@@ -867,7 +882,7 @@
/* Acquire the dispatcher lock and remove it from the list */
KiAcquireDispatcherLockAtDpcLevel();
- if (RemoveEntryList(&ApcState->ApcListHead[Apc->ApcMode]))
+ if (RemoveEntryList(&Apc->ApcListEntry))
{
/* Set the correct state based on the APC Mode */
if (Apc->ApcMode == KernelMode)