mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Updating the directory entries in VfatWrite only, if the allocation size has changed.
Added zeroing for files, if the write starts after the current end of the file. svn path=/trunk/; revision=3035
This commit is contained in:
parent
20a4914b89
commit
f3e094f2f0
1 changed files with 19 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
/* $Id: rw.c,v 1.41 2002/05/05 20:20:15 hbirr Exp $
|
/* $Id: rw.c,v 1.42 2002/06/10 21:17:57 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -786,15 +786,7 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
#ifdef __VFAT_NT__
|
|
||||||
if (IrpContext->MinorFunction & IRP_MN_DPC)
|
|
||||||
{
|
|
||||||
DPRINT("IRP_MN_DPC is set\n");
|
|
||||||
IrpContext->MinorFunction &= ~IRP_MN_DPC;
|
|
||||||
Status = STATUS_PENDING;
|
|
||||||
goto ByeBye;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (Fcb->Flags & FCB_IS_VOLUME)
|
if (Fcb->Flags & FCB_IS_VOLUME)
|
||||||
{
|
{
|
||||||
Resource = &IrpContext->DeviceExt->DirResource;
|
Resource = &IrpContext->DeviceExt->DirResource;
|
||||||
|
@ -914,7 +906,6 @@ ByeBye:
|
||||||
{
|
{
|
||||||
IrpContext->FileObject->CurrentByteOffset.QuadPart =
|
IrpContext->FileObject->CurrentByteOffset.QuadPart =
|
||||||
ByteOffset.QuadPart + IrpContext->Irp->IoStatus.Information;
|
ByteOffset.QuadPart + IrpContext->Irp->IoStatus.Information;
|
||||||
DPRINT("--> %d\n", IrpContext->Irp->IoStatus.Information);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IoCompleteRequest(IrpContext->Irp,
|
IoCompleteRequest(IrpContext->Irp,
|
||||||
|
@ -931,8 +922,10 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
PVFATFCB Fcb;
|
PVFATFCB Fcb;
|
||||||
PERESOURCE Resource = NULL;
|
PERESOURCE Resource = NULL;
|
||||||
LARGE_INTEGER ByteOffset;
|
LARGE_INTEGER ByteOffset;
|
||||||
|
LARGE_INTEGER OldFileSize;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
ULONG OldAllocationSize;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
|
|
||||||
assert (IrpContext);
|
assert (IrpContext);
|
||||||
|
@ -1057,6 +1050,9 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OldFileSize = Fcb->RFCB.FileSize;
|
||||||
|
OldAllocationSize = Fcb->RFCB.AllocationSize.u.LowPart;
|
||||||
|
|
||||||
if (!(Fcb->Flags & (FCB_IS_FAT|FCB_IS_VOLUME)) && !(IrpContext->Irp->Flags & IRP_PAGING_IO))
|
if (!(Fcb->Flags & (FCB_IS_FAT|FCB_IS_VOLUME)) && !(IrpContext->Irp->Flags & IRP_PAGING_IO))
|
||||||
{
|
{
|
||||||
Status = vfatExtendSpace(IrpContext->DeviceExt, IrpContext->FileObject,
|
Status = vfatExtendSpace(IrpContext->DeviceExt, IrpContext->FileObject,
|
||||||
|
@ -1069,6 +1065,11 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ByteOffset.QuadPart > OldFileSize.QuadPart)
|
||||||
|
{
|
||||||
|
CcZeroData(IrpContext->FileObject, &OldFileSize, &ByteOffset, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(IrpContext->Irp->Flags & (IRP_NOCACHE|IRP_PAGING_IO)) &&
|
if (!(IrpContext->Irp->Flags & (IRP_NOCACHE|IRP_PAGING_IO)) &&
|
||||||
!(Fcb->Flags & (FCB_IS_PAGE_FILE|FCB_IS_VOLUME)))
|
!(Fcb->Flags & (FCB_IS_PAGE_FILE|FCB_IS_VOLUME)))
|
||||||
{
|
{
|
||||||
|
@ -1129,7 +1130,13 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
&Fcb->entry.UpdateTime);
|
&Fcb->entry.UpdateTime);
|
||||||
Fcb->entry.AccessDate = Fcb->entry.UpdateDate;
|
Fcb->entry.AccessDate = Fcb->entry.UpdateDate;
|
||||||
// update dates/times and length
|
// update dates/times and length
|
||||||
updEntry (IrpContext->DeviceExt, IrpContext->FileObject);
|
if (OldAllocationSize != Fcb->RFCB.AllocationSize.u.LowPart)
|
||||||
|
{
|
||||||
|
updEntry (IrpContext->DeviceExt, IrpContext->FileObject);
|
||||||
|
Fcb->Flags &= ~FCB_UPDATE_DIRENTRY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Fcb->Flags |= FCB_UPDATE_DIRENTRY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue