[syslinux:master] pxe: add a "pxeretry" option to deal with 404's in web apps

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Thu Aug 26 14:48:22 PDT 2010


Commit-ID:  4f989f2478227c426401b27607f3f1bab7476c1c
Gitweb:     http://syslinux.zytor.com/commit/4f989f2478227c426401b27607f3f1bab7476c1c
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Thu, 26 Aug 2010 14:45:53 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Thu, 26 Aug 2010 14:45:53 -0700

pxe: add a "pxeretry" option to deal with 404's in web apps

For web downloads, sometimes a mirror site will not be fully synced.
Add an option to retry the open a specific number of times before
giving up.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 core/fs/pxe/pxe.c    |   14 ++++++++++++++
 core/keywords        |    1 +
 core/keywords.inc    |    1 +
 core/parseconfig.inc |    2 ++
 4 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 0238ed4..a1e4097 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -642,8 +642,22 @@ static uint32_t pxe_getfssec(struct file *file, char *buf,
  * @out: the lenght of this file, stores in file->file_len
  *
  */
+static void __pxe_searchdir(const char *filename, struct file *file);
+extern uint16_t PXERetry;
+
 static void pxe_searchdir(const char *filename, struct file *file)
 {
+    int i = PXERetry;
+
+    do {
+	dprintf("PXE: file = %p, retries left = %d: ", file, i);
+	__pxe_searchdir(filename, file);
+	dprintf("%s\n", file->inode ? "ok" : "failed");
+    } while (!file->inode && i--);
+}
+
+static void __pxe_searchdir(const char *filename, struct file *file)
+{
     struct fs_info *fs = file->fs;
     struct inode *inode;
     struct pxe_pvt_inode *socket;
diff --git a/core/keywords b/core/keywords
index c289ae2..7f585b4 100644
--- a/core/keywords
+++ b/core/keywords
@@ -16,6 +16,7 @@ linux
 boot
 bss
 pxe
+pxeretry
 fdimage
 comboot
 com32
diff --git a/core/keywords.inc b/core/keywords.inc
index d0f7db3..7f1404e 100644
--- a/core/keywords.inc
+++ b/core/keywords.inc
@@ -78,6 +78,7 @@ keywd_table:
 		keyword noescape,	pc_setint16,	NoEscape
 		keyword nocomplete,	pc_setint16,	NoComplete
 		keyword nohalt,		pc_setint16,	NoHalt
+		keyword pxeretry,	pc_setint16,	PXERetry
 		keyword f1,		pc_filename,	FKeyN(1)
 		keyword f2,		pc_filename,	FKeyN(2)
 		keyword f3,		pc_filename,	FKeyN(3)
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index e7b3108..69681d9 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -462,6 +462,8 @@ AllowImplicit   dw 1                    ; Allow implicit kernels
 AllowOptions	dw 1			; User-specified options allowed
 IncludeLevel	dw 1			; Nesting level
 DefaultLevel	dw 0			; The current level of default
+		global PXERetry
+PXERetry	dw 0			; Extra PXE retries
 VKernel		db 0			; Have we seen any "label" statements?
 
 %if IS_PXELINUX



More information about the Syslinux-commits mailing list