Author: hbelusca Date: Sun Jan 4 16:43:42 2015 New Revision: 65973
URL: http://svn.reactos.org/svn/reactos?rev=65973&view=rev Log: [FREELDR]: Small code style fixes; add a comment about the extra PXE check case in PcDiskGetBootPath. Fix also its return value.
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c trunk/reactos/boot/freeldr/freeldr/fs/fs.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c [iso-8859-1] Sun Jan 4 16:43:42 2015 @@ -389,12 +389,19 @@ BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size) { - if (PxeInit()) - { - strcpy(BootPath, "net(0)"); - return 0; - } - return DiskGetBootPath(BootPath, Size); + // FIXME: Keep it there, or put it in DiskGetBootPath? + // Or, abstract the notion of network booting to make + // sense for other platforms than the PC (and this idea + // already exists), then we would need to check whether + // we were booting from network (and: PC --> PXE, etc...) + // and if so, set the correct ARC path. But then this new + // logic could be moved back to DiskGetBootPath... + if (PxeInit()) + { + strcpy(BootPath, "net(0)"); + return TRUE; + } + return DiskGetBootPath(BootPath, Size); }
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs.... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] Sun Jan 4 16:43:42 2015 @@ -102,10 +102,7 @@ // // Check for success // - if (ret == ESUCCESS) - return TRUE; - else - return FALSE; + return (ret == ESUCCESS); }
ULONG FsGetFileSize(PFILE FileHandle) @@ -156,10 +153,10 @@ */ ULONG FsGetNumPathParts(PCSTR Path) { - size_t i; - ULONG num; - - for (i=0,num=0; i<strlen(Path); i++) + size_t i; + ULONG num; + + for (i = 0, num = 0; i < strlen(Path); i++) { if ((Path[i] == '\') || (Path[i] == '/')) { @@ -181,12 +178,12 @@ */ VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path) { - size_t i; + size_t i;
// Copy all the characters up to the end of the // string or until we hit a '' character // and put them in Buffer - for (i=0; i<strlen(Path); i++) + for (i = 0; i < strlen(Path); i++) { if ((Path[i] == '\') || (Path[i] == '/')) { @@ -276,8 +273,10 @@ /* Count number of "()", which needs to be replaced by "(0)" */ Count = 0; for (p = Path; p != FileName; p++) + { if (*p == '(' && *(p + 1) == ')') Count++; + }
/* Duplicate device name, and replace "()" by "(0)" (if required) */ Length = FileName - Path + Count; @@ -294,14 +293,17 @@ } } else + { DeviceName = Path; + }
/* Search for the device */ - pEntry = DeviceListHead.Flink; if (OpenMode == OpenReadOnly || OpenMode == OpenWriteOnly) DeviceOpenMode = OpenMode; else DeviceOpenMode = OpenReadWrite; + + pEntry = DeviceListHead.Flink; while (pEntry != &DeviceListHead) { pDevice = CONTAINING_RECORD(pEntry, DEVICE, ListEntry); @@ -312,10 +314,13 @@ { /* Search some room for the device */ for (DeviceId = 0; DeviceId < MAX_FDS; DeviceId++) + { if (!FileData[DeviceId].FuncTable) break; + } if (DeviceId == MAX_FDS) return EMFILE; + /* Try to open the device */ FileData[DeviceId].FuncTable = pDevice->FuncTable; ret = pDevice->FuncTable->Open(pDevice->Prefix, DeviceOpenMode, &DeviceId); @@ -376,8 +381,10 @@
/* Search some room for the device */ for (i = 0; i < MAX_FDS; i++) + { if (!FileData[i].FuncTable) break; + } if (i == MAX_FDS) return EMFILE;
@@ -468,4 +475,8 @@ FileData[i].DeviceId = (ULONG)-1;
InitializeListHead(&DeviceListHead); -} + + // FIXME: Retrieve the current boot device with MachDiskGetBootPath + // and store it somewhere in order to not call again and again this + // function. +}