mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 00:23:10 +00:00
[EXT2FS] Align with upstream and mark ReactOS diff (#5245)
NOTE: There are no new features in this PR, we stay with upstream version 0.69. CORE-18645 - Add ifdefs to distinguish ReactOS code/fixes from the upstream code; - If upstream code was overriden, reintroduce it in #else section; - Re-align .rc version info with upstream (0.69).
This commit is contained in:
parent
39d5f1bf54
commit
aaeb131bd4
21 changed files with 542 additions and 28 deletions
|
@ -10,7 +10,11 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include "ext2fs.h"
|
||||
#ifdef __REACTOS__
|
||||
#include "linux/ext4.h"
|
||||
#else
|
||||
#include "linux\ext4.h"
|
||||
#endif
|
||||
|
||||
/* GLOBALS ***************************************************************/
|
||||
|
||||
|
@ -858,6 +862,7 @@ Ext2ZeroBuffer( IN PEXT2_IRP_CONTEXT IrpContext,
|
|||
}
|
||||
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#define SIZE_256K 0x40000
|
||||
|
||||
BOOLEAN
|
||||
|
@ -917,6 +922,75 @@ Ext2SaveBuffer( IN PEXT2_IRP_CONTEXT IrpContext,
|
|||
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
|
||||
BOOLEAN
|
||||
Ext2SaveBuffer( IN PEXT2_IRP_CONTEXT IrpContext,
|
||||
IN PEXT2_VCB Vcb,
|
||||
IN LONGLONG offset,
|
||||
IN ULONG size,
|
||||
IN PVOID buf )
|
||||
{
|
||||
struct buffer_head *bh = NULL;
|
||||
BOOLEAN rc = 0;
|
||||
|
||||
__try {
|
||||
|
||||
while (size) {
|
||||
|
||||
sector_t block;
|
||||
ULONG len = 0, delta = 0;
|
||||
|
||||
block = (sector_t) (offset >> BLOCK_BITS);
|
||||
delta = (ULONG)offset & (BLOCK_SIZE - 1);
|
||||
len = BLOCK_SIZE - delta;
|
||||
if (size < len)
|
||||
len = size;
|
||||
|
||||
if (delta == 0 && len >= BLOCK_SIZE) {
|
||||
bh = sb_getblk_zero(&Vcb->sb, block);
|
||||
} else {
|
||||
bh = sb_getblk(&Vcb->sb, block);
|
||||
}
|
||||
|
||||
if (!bh) {
|
||||
DEBUG(DL_ERR, ("Ext2SaveBuffer: can't load block %I64u\n", block));
|
||||
DbgBreak();
|
||||
__leave;
|
||||
}
|
||||
|
||||
if (!buffer_uptodate(bh)) {
|
||||
int err = bh_submit_read(bh);
|
||||
if (err < 0) {
|
||||
DEBUG(DL_ERR, ("Ext2SaveBuffer: bh_submit_read failed: %d\n", err));
|
||||
__leave;
|
||||
}
|
||||
}
|
||||
|
||||
__try {
|
||||
RtlCopyMemory(bh->b_data + delta, buf, len);
|
||||
mark_buffer_dirty(bh);
|
||||
} __finally {
|
||||
fini_bh(&bh);
|
||||
}
|
||||
|
||||
buf = (PUCHAR)buf + len;
|
||||
offset = offset + len;
|
||||
size = size - len;
|
||||
}
|
||||
|
||||
rc = TRUE;
|
||||
|
||||
} __finally {
|
||||
|
||||
if (bh)
|
||||
fini_bh(&bh);
|
||||
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
VOID
|
||||
|
|
|
@ -219,7 +219,11 @@ Ext2GetBlock(
|
|||
BLOCK_SIZE,
|
||||
PIN_WAIT,
|
||||
&Bcb,
|
||||
#ifdef __REACTOS__
|
||||
(void **)&pData )) {
|
||||
#else
|
||||
&pData )) {
|
||||
#endif
|
||||
|
||||
DEBUG(DL_ERR, ( "Ext2GetBlock: Failed to PinLock block: %xh ...\n",
|
||||
BlockArray[0] ));
|
||||
|
@ -521,7 +525,11 @@ Ext2ExpandBlock(
|
|||
BLOCK_SIZE,
|
||||
PIN_WAIT,
|
||||
&Bcb,
|
||||
#ifdef __REACTOS__
|
||||
(void **)&pData )) {
|
||||
#else
|
||||
&pData )) {
|
||||
#endif
|
||||
|
||||
DEBUG(DL_ERR, ( "Ext2ExpandInode: failed to PinLock offset :%I64xh...\n",
|
||||
Offset.QuadPart));
|
||||
|
@ -726,7 +734,11 @@ Ext2TruncateBlock(
|
|||
BLOCK_SIZE,
|
||||
PIN_WAIT,
|
||||
&Bcb,
|
||||
#ifdef __REACTOS__
|
||||
(void **)&pData )) {
|
||||
#else
|
||||
&pData )) {
|
||||
#endif
|
||||
|
||||
DEBUG(DL_ERR, ( "Ext2TruncateBlock: PinLock failed on block %xh ...\n",
|
||||
BlockArray[SizeArray - i - 1]));
|
||||
|
@ -906,7 +918,11 @@ Ext2MapIndirect(
|
|||
Layer,
|
||||
Index,
|
||||
dwArray,
|
||||
#ifdef __REACTOS__
|
||||
(PULONG)&Mcb->Inode.i_block[Slot],
|
||||
#else
|
||||
&Mcb->Inode.i_block[Slot],
|
||||
#endif
|
||||
bAlloc,
|
||||
&dwHint,
|
||||
&dwRet,
|
||||
|
@ -987,7 +1003,11 @@ Ext2ExpandIndirect(
|
|||
Layer,
|
||||
Start,
|
||||
(Layer == 0) ? (Vcb->max_blocks_per_layer[Layer] - Start) : 1,
|
||||
#ifdef __REACTOS__
|
||||
(PULONG)&Mcb->Inode.i_block[Slot],
|
||||
#else
|
||||
&Mcb->Inode.i_block[Slot],
|
||||
#endif
|
||||
&Hint,
|
||||
&Extra
|
||||
);
|
||||
|
@ -1118,11 +1138,19 @@ Ext2TruncateIndirect(
|
|||
Base -= Vcb->max_blocks_per_layer[Layer - 1];
|
||||
|
||||
if (Layer - 1 == 0) {
|
||||
#ifdef __REACTOS__
|
||||
BlockArray = (PULONG)&Mcb->Inode.i_block[0];
|
||||
#else
|
||||
BlockArray = &Mcb->Inode.i_block[0];
|
||||
#endif
|
||||
SizeArray = End;
|
||||
ASSERT(End == EXT2_NDIR_BLOCKS && Base == 0);
|
||||
} else {
|
||||
#ifdef __REACTOS__
|
||||
BlockArray = (PULONG)&Mcb->Inode.i_block[EXT2_NDIR_BLOCKS - 1 + Layer - 1];
|
||||
#else
|
||||
BlockArray = &Mcb->Inode.i_block[EXT2_NDIR_BLOCKS - 1 + Layer - 1];
|
||||
#endif
|
||||
SizeArray = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue