Author: pschweitzer
Date: Sat Mar 15 04:25:09 2008
New Revision: 32692
URL:
http://svn.reactos.org/svn/reactos?rev=3D32692&view=3Drev
Log:
[FORMATTING] Fix indentation (only for functional code)
Modified:
trunk/reactos/drivers/filesystems/ntfs/fcb.c
Modified: trunk/reactos/drivers/filesystems/ntfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/n=
tfs/fcb.c?rev=3D32692&r1=3D32691&r2=3D32692&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/drivers/filesystems/ntfs/fcb.c (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fcb.c Sat Mar 15 04:25:09 2008
@@ -46,14 +46,14 @@
NtfsGetNextPathElement(PWCHAR FileName)
{
if (*FileName =3D=3D L'\0')
- {
- return(NULL);
- }
+ {
+ return(NULL);
+ }
=
while (*FileName !=3D L'\0' && *FileName !=3D L'\\')
- {
- FileName++;
- }
+ {
+ FileName++;
+ }
=
return(FileName);
}
@@ -76,17 +76,17 @@
RtlZeroMemory(Fcb, sizeof(NTFS_FCB));
=
if (FileName)
- {
- wcscpy(Fcb->PathName, FileName);
- if (wcsrchr(Fcb->PathName, '\\') !=3D 0)
- {
- Fcb->ObjectName =3D wcsrchr(Fcb->PathName, '\\');
- }
- else
- {
- Fcb->ObjectName =3D Fcb->PathName;
- }
- }
+ {
+ wcscpy(Fcb->PathName, FileName);
+ if (wcsrchr(Fcb->PathName, '\\') !=3D 0)
+ {
+ Fcb->ObjectName =3D wcsrchr(Fcb->PathName, '\\');
+ }
+ else
+ {
+ Fcb->ObjectName =3D Fcb->PathName;
+ }
+ }
=
ExInitializeResourceLite(&Fcb->MainResource);
=
@@ -121,14 +121,14 @@
=
VOID
NtfsGrabFCB(PNTFS_VCB Vcb,
- PNTFS_FCB Fcb)
+ PNTFS_FCB Fcb)
{
KIRQL oldIrql;
=
DPRINT("grabbing FCB at %p: %S, refCount:%d\n",
- Fcb,
- Fcb->PathName,
- Fcb->RefCount);
+ Fcb,
+ Fcb->PathName,
+ Fcb->RefCount);
=
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
Fcb->RefCount++;
@@ -138,30 +138,30 @@
=
VOID
NtfsReleaseFCB(PNTFS_VCB Vcb,
- PNTFS_FCB Fcb)
+ PNTFS_FCB Fcb)
{
KIRQL oldIrql;
=
DPRINT("releasing FCB at %p: %S, refCount:%d\n",
- Fcb,
- Fcb->PathName,
- Fcb->RefCount);
+ Fcb,
+ Fcb->PathName,
+ Fcb->RefCount);
=
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
Fcb->RefCount--;
if (Fcb->RefCount <=3D 0 && !NtfsFCBIsDirectory(Fcb))
- {
- RemoveEntryList(&Fcb->FcbListEntry);
- CcUninitializeCacheMap (Fcb->FileObject, NULL, NULL);
- NtfsDestroyFCB(Fcb);
- }
+ {
+ RemoveEntryList(&Fcb->FcbListEntry);
+ CcUninitializeCacheMap (Fcb->FileObject, NULL, NULL);
+ NtfsDestroyFCB(Fcb);
+ }
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
}
=
=
VOID
NtfsAddFCBToTable(PNTFS_VCB Vcb,
- PNTFS_FCB Fcb)
+ PNTFS_FCB Fcb)
{
KIRQL oldIrql;
=
@@ -174,7 +174,7 @@
=
PNTFS_FCB
NtfsGrabFCBFromTable(PNTFS_VCB Vcb,
- PCWSTR FileName)
+ PCWSTR FileName)
{
KIRQL oldIrql;
PNTFS_FCB Fcb;
@@ -183,31 +183,31 @@
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
=
if (FileName =3D=3D NULL || *FileName =3D=3D 0)
- {
- DPRINT("Return FCB for stream file object\n");
- Fcb =3D Vcb->StreamFileObject->FsContext;
+ {
+ DPRINT("Return FCB for stream file object\n");
+ Fcb =3D Vcb->StreamFileObject->FsContext;
+ Fcb->RefCount++;
+ KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
+ return(Fcb);
+ }
+
+ current_entry =3D Vcb->FcbListHead.Flink;
+ while (current_entry !=3D &Vcb->FcbListHead)
+ {
+ Fcb =3D CONTAINING_RECORD(current_entry, NTFS_FCB, FcbListEntry);
+
+ DPRINT("Comparing '%S' and '%S'\n", FileName,
Fcb->PathName);
+ if (_wcsicmp(FileName, Fcb->PathName) =3D=3D 0)
+ {
Fcb->RefCount++;
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
return(Fcb);
}
=
- current_entry =3D Vcb->FcbListHead.Flink;
- while (current_entry !=3D &Vcb->FcbListHead)
- {
- Fcb =3D CONTAINING_RECORD(current_entry, NTFS_FCB, FcbListEntry);
-
- DPRINT("Comparing '%S' and '%S'\n", FileName,
Fcb->PathName);
- if (_wcsicmp(FileName, Fcb->PathName) =3D=3D 0)
- {
- Fcb->RefCount++;
- KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
- return(Fcb);
- }
-
//FIXME: need to compare against short name in FCB here
=
- current_entry =3D current_entry->Flink;
- }
+ current_entry =3D current_entry->Flink;
+ }
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
=
return(NULL);
@@ -216,7 +216,7 @@
=
NTSTATUS
NtfsFCBInitializeCache(PNTFS_VCB Vcb,
- PNTFS_FCB Fcb)
+ PNTFS_FCB Fcb)
{
PFILE_OBJECT FileObject;
NTSTATUS Status;
@@ -226,11 +226,10 @@
=
newCCB =3D ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_CCB), TAG_CCB=
);
if (newCCB =3D=3D NULL)
- {
+ {
return(STATUS_INSUFFICIENT_RESOURCES);
- }
- RtlZeroMemory(newCCB,
- sizeof(NTFS_CCB));
+ }
+ RtlZeroMemory(newCCB, sizeof(NTFS_CCB));
=
FileObject->SectionObjectPointer =3D &Fcb->SectionObjectPointers;
FileObject->FsContext =3D Fcb;
@@ -286,9 +285,9 @@
=
Fcb =3D NtfsGrabFCBFromTable(Vcb, L"\\");
if (Fcb =3D=3D NULL)
- {
- Fcb =3D NtfsMakeRootFCB(Vcb);
- }
+ {
+ Fcb =3D NtfsMakeRootFCB(Vcb);
+ }
=
return(Fcb);
}
@@ -387,16 +386,16 @@
=
NTSTATUS
NtfsAttachFCBToFileObject(PNTFS_VCB Vcb,
- PNTFS_FCB Fcb,
- PFILE_OBJECT FileObject)
+ PNTFS_FCB Fcb,
+ PFILE_OBJECT FileObject)
{
PNTFS_CCB newCCB;
=
newCCB =3D ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_CCB), TAG_CCB=
);
if (newCCB =3D=3D NULL)
- {
- return(STATUS_INSUFFICIENT_RESOURCES);
- }
+ {
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
memset(newCCB, 0, sizeof(NTFS_CCB));
=
FileObject->SectionObjectPointer =3D &Fcb->SectionObjectPointers;
@@ -406,15 +405,15 @@
Fcb->DevExt =3D Vcb;
=
if (!(Fcb->Flags & FCB_CACHE_INITIALIZED))
- {
- CcInitializeCacheMap(FileObject,
- (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
- FALSE,
- NULL,
- NULL);
-
- Fcb->Flags |=3D FCB_CACHE_INITIALIZED;
- }
+ {
+ CcInitializeCacheMap(FileObject,
+ (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+ FALSE,
+ NULL,
+ NULL);
+
+ Fcb->Flags |=3D FCB_CACHE_INITIALIZED;
+ }
=
//DPRINT("file open: fcb:%x file size: %d\n", Fcb, Fcb->Entry.DataLength=
L);
=
@@ -424,9 +423,9 @@
=
static NTSTATUS
NtfsDirFindFile(PNTFS_VCB Vcb,
- PNTFS_FCB DirectoryFcb,
- PWSTR FileToFind,
- PNTFS_FCB *FoundFCB)
+ PNTFS_FCB DirectoryFcb,
+ PWSTR FileToFind,
+ PNTFS_FCB *FoundFCB)
{
#if 0
WCHAR TempName[2];
@@ -535,9 +534,9 @@
=
NTSTATUS
NtfsGetFCBForFile(PNTFS_VCB Vcb,
- PNTFS_FCB *pParentFCB,
- PNTFS_FCB *pFCB,
- const PWSTR pFileName)
+ PNTFS_FCB *pParentFCB,
+ PNTFS_FCB *pFCB,
+ const PWSTR pFileName)
{
NTSTATUS Status;
WCHAR pathName [MAX_PATH];
@@ -547,10 +546,10 @@
PNTFS_FCB parentFCB;
=
DPRINT("NtfsGetFCBForFile(%p, %p, %p, '%S')\n",
- Vcb,
- pParentFCB,
- pFCB,
- pFileName);
+ Vcb,
+ pParentFCB,
+ pFCB,
+ pFileName);
=
/* Dummy code */
// FCB =3D NtfsOpenRootFCB(Vcb);
@@ -560,97 +559,97 @@
#if 1
/* Trivial case, open of the root directory on volume */
if (pFileName [0] =3D=3D L'\0' || wcscmp(pFileName, L"\\") =3D=3D 0)
- {
- DPRINT("returning root FCB\n");
-
- FCB =3D NtfsOpenRootFCB(Vcb);
- *pFCB =3D FCB;
- *pParentFCB =3D NULL;
-
- return((FCB !=3D NULL) ? STATUS_SUCCESS : STATUS_OBJECT_PATH_NOT_FOU=
ND);
- }
+ {
+ DPRINT("returning root FCB\n");
+
+ FCB =3D NtfsOpenRootFCB(Vcb);
+ *pFCB =3D FCB;
+ *pParentFCB =3D NULL;
+
+ return((FCB !=3D NULL) ? STATUS_SUCCESS : STATUS_OBJECT_PATH_NOT_FOUND=
);
+ }
else
- {
- currentElement =3D pFileName + 1;
- wcscpy (pathName, L"\\");
- FCB =3D NtfsOpenRootFCB (Vcb);
- }
+ {
+ currentElement =3D pFileName + 1;
+ wcscpy (pathName, L"\\");
+ FCB =3D NtfsOpenRootFCB (Vcb);
+ }
parentFCB =3D NULL;
=
/* Parse filename and check each path element for existance and access */
while (NtfsGetNextPathElement(currentElement) !=3D 0)
- {
- /* Skip blank directory levels */
- if ((NtfsGetNextPathElement(currentElement) - currentElement) =3D=3D=
0)
- {
- currentElement++;
- continue;
- }
-
- DPRINT("Parsing, currentElement:%S\n", currentElement);
- DPRINT(" parentFCB:%p FCB:%p\n", parentFCB, FCB);
-
- /* Descend to next directory level */
- if (parentFCB)
- {
- NtfsReleaseFCB(Vcb, parentFCB);
- parentFCB =3D NULL;
- }
-
- /* fail if element in FCB is not a directory */
- if (!NtfsFCBIsDirectory(FCB))
- {
- DPRINT("Element in requested path is not a directory\n");
-
- NtfsReleaseFCB(Vcb, FCB);
- FCB =3D 0;
- *pParentFCB =3D NULL;
- *pFCB =3D NULL;
-
- return(STATUS_OBJECT_PATH_NOT_FOUND);
- }
- parentFCB =3D FCB;
-
- /* Extract next directory level into dirName */
- NtfsWSubString(pathName,
- pFileName,
- NtfsGetNextPathElement(currentElement) - pFileName);
- DPRINT(" pathName:%S\n", pathName);
-
- FCB =3D NtfsGrabFCBFromTable(Vcb, pathName);
- if (FCB =3D=3D NULL)
- {
- NtfsWSubString(elementName,
- currentElement,
- NtfsGetNextPathElement(currentElement) - currentElement);
- DPRINT(" elementName:%S\n", elementName);
-
- Status =3D NtfsDirFindFile(Vcb, parentFCB, elementName, &FCB);
- if (Status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND)
- {
- *pParentFCB =3D parentFCB;
- *pFCB =3D NULL;
- currentElement =3D NtfsGetNextPathElement(currentElement);
- if (*currentElement =3D=3D L'\0' || NtfsGetNextPathElement(currentE=
lement + 1) =3D=3D 0)
- {
- return(STATUS_OBJECT_NAME_NOT_FOUND);
- }
- else
- {
- return(STATUS_OBJECT_PATH_NOT_FOUND);
- }
- }
- else if (!NT_SUCCESS(Status))
- {
- NtfsReleaseFCB(Vcb, parentFCB);
- *pParentFCB =3D NULL;
- *pFCB =3D NULL;
-
- return(Status);
- }
- }
- currentElement =3D NtfsGetNextPathElement(currentElement);
- }
+ {
+ /* Skip blank directory levels */
+ if ((NtfsGetNextPathElement(currentElement) - currentElement) =3D=3D 0)
+ {
+ currentElement++;
+ continue;
+ }
+
+ DPRINT("Parsing, currentElement:%S\n", currentElement);
+ DPRINT(" parentFCB:%p FCB:%p\n", parentFCB, FCB);
+
+ /* Descend to next directory level */
+ if (parentFCB)
+ {
+ NtfsReleaseFCB(Vcb, parentFCB);
+ parentFCB =3D NULL;
+ }
+
+ /* fail if element in FCB is not a directory */
+ if (!NtfsFCBIsDirectory(FCB))
+ {
+ DPRINT("Element in requested path is not a directory\n");
+
+ NtfsReleaseFCB(Vcb, FCB);
+ FCB =3D 0;
+ *pParentFCB =3D NULL;
+ *pFCB =3D NULL;
+
+ return(STATUS_OBJECT_PATH_NOT_FOUND);
+ }
+ parentFCB =3D FCB;
+
+ /* Extract next directory level into dirName */
+ NtfsWSubString(pathName,
+ pFileName,
+ NtfsGetNextPathElement(currentElement) - pFileName);
+ DPRINT(" pathName:%S\n", pathName);
+
+ FCB =3D NtfsGrabFCBFromTable(Vcb, pathName);
+ if (FCB =3D=3D NULL)
+ {
+ NtfsWSubString(elementName,
+ currentElement,
+ NtfsGetNextPathElement(currentElement) - currentEleme=
nt);
+ DPRINT(" elementName:%S\n", elementName);
+
+ Status =3D NtfsDirFindFile(Vcb, parentFCB, elementName, &FCB);
+ if (Status =3D=3D STATUS_OBJECT_NAME_NOT_FOUND)
+ {
+ *pParentFCB =3D parentFCB;
+ *pFCB =3D NULL;
+ currentElement =3D NtfsGetNextPathElement(currentElement);
+ if (*currentElement =3D=3D L'\0' || NtfsGetNextPathElement(current=
Element + 1) =3D=3D 0)
+ {
+ return(STATUS_OBJECT_NAME_NOT_FOUND);
+ }
+ else
+ {
+ return(STATUS_OBJECT_PATH_NOT_FOUND);
+ }
+ }
+ else if (!NT_SUCCESS(Status))
+ {
+ NtfsReleaseFCB(Vcb, parentFCB);
+ *pParentFCB =3D NULL;
+ *pFCB =3D NULL;
+
+ return(Status);
+ }
+ }
+ currentElement =3D NtfsGetNextPathElement(currentElement);
+ }
=
*pParentFCB =3D parentFCB;
*pFCB =3D FCB;