[syslinux:pathbased] core: get rid of unmangle_name completely

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Feb 28 21:15:15 PST 2010


Commit-ID:  0fba01f4009b29ec9f2cdadafa33fd4699675542
Gitweb:     http://syslinux.zytor.com/commit/0fba01f4009b29ec9f2cdadafa33fd4699675542
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 28 Feb 2010 21:12:46 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 28 Feb 2010 21:12:46 -0800

core: get rid of unmangle_name completely

The notion of "mangle name" is now restricted to producing a canonical
representation, e.g. changing \ -> / for FAT filesystems.  However,
the resulting mangled name is now always human-readable, so there
never is any reason to unmangle a name.

Get rid of not just the mangling, but of the resulting unmangled-name
buffers and so on.

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


---
 core/com32.inc       |    2 +-
 core/comboot.inc     |    2 +-
 core/extern.inc      |    2 +-
 core/fs/fs.c         |   11 -----------
 core/fs/newconfig.c  |    2 +-
 core/include/core.h  |    1 -
 core/include/fs.h    |    2 --
 core/parsecmd.inc    |    6 +-----
 core/parseconfig.inc |    5 ++---
 core/runkernel.inc   |   13 ++++---------
 core/ui.inc          |   10 +---------
 11 files changed, 12 insertions(+), 44 deletions(-)

diff --git a/core/com32.inc b/core/com32.inc
index 6ef0784..9a29c95 100644
--- a/core/com32.inc
+++ b/core/com32.inc
@@ -103,7 +103,7 @@ com32_exit:
 		bits 16
 		section .text16
 not_com32r:
-		mov si,KernelCName
+		mov si,KernelName
 		call writestr
 		mov si,not_com32r_msg
 		call writestr
diff --git a/core/comboot.inc b/core/comboot.inc
index 9537fc0..13daf3e 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -312,7 +312,7 @@ comboot_exit_msg:
 		pm_call comboot_cleanup_lowmem
 		call adjust_screen	; The COMBOOT program might have changed the screen
 		jcxz .nomsg
-		mov si,KernelCName
+		mov si,KernelName
 		call writestr
 		mov si,cx
 		call writestr
diff --git a/core/extern.inc b/core/extern.inc
index 3e25226..fbc4759 100644
--- a/core/extern.inc
+++ b/core/extern.inc
@@ -14,7 +14,7 @@
 
 	; fs.c
 	extern fs_init, pm_searchdir, getfssec, pm_mangle_name, load_config
-        extern pm_unmangle_name, close_file
+        extern close_file
 
 	; chdir.c
 	extern pm_realpath
diff --git a/core/fs/fs.c b/core/fs/fs.c
index 9002fa6..865f398 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -88,17 +88,6 @@ void mangle_name(char *dst, const char *src)
     this_fs->fs_ops->mangle_name(dst, src);
 }
 
-void pm_unmangle_name(com32sys_t *regs)
-{
-    const char *src = MK_PTR(regs->ds, regs->esi.w[0]);
-    char       *dst = MK_PTR(regs->es, regs->edi.w[0]);
-
-    dst = stpcpy(dst, src);
-
-    /* Update the di register to point to the last null char */
-    regs->edi.w[0] = OFFS_WRT(dst, regs->es);
-}
-
 void getfssec(com32sys_t *regs)
 {
     int sectors;
diff --git a/core/fs/newconfig.c b/core/fs/newconfig.c
index 08027a3..58c47a5 100644
--- a/core/fs/newconfig.c
+++ b/core/fs/newconfig.c
@@ -27,7 +27,7 @@ void pm_is_config_file(com32sys_t *regs)
     (void)regs;
 
     /* Save configuration file as an absolute path for posterity */
-    realpath(ConfigName, KernelCName, FILENAME_MAX);
+    realpath(ConfigName, KernelName, FILENAME_MAX);
 
     /* If we got anything on the command line, do a chdir */
     p = cmd_line;
diff --git a/core/include/core.h b/core/include/core.h
index 50e2be4..48df921 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -14,7 +14,6 @@ extern char ConfigName[];
 extern char KernelName[];
 extern char cmd_line[];
 extern char ConfigFile[];
-extern char KernelCName[];
 
 /* diskstart.inc isolinux.asm*/
 extern void getlinsec(void);
diff --git a/core/include/fs.h b/core/include/fs.h
index ed196ac..ef7eb8b 100644
--- a/core/include/fs.h
+++ b/core/include/fs.h
@@ -199,10 +199,8 @@ static inline struct file *handle_to_file(uint16_t handle)
 
 /* fs.c */
 void pm_mangle_name(com32sys_t *);
-void pm_unmangle_name(com32sys_t *);
 void pm_searchdir(com32sys_t *);
 void mangle_name(char *, const char *);
-char *unmangle_name(char *, const char *);
 int searchdir(const char *name);
 void _close_file(struct file *);
 size_t pmapi_read_file(uint16_t *handle, void *buf, size_t sectors);
diff --git a/core/parsecmd.inc b/core/parsecmd.inc
index b6a2c82..30cd67f 100644
--- a/core/parsecmd.inc
+++ b/core/parsecmd.inc
@@ -111,7 +111,6 @@ err_badcfg      db 'Unknown keyword in configuration file: ',0
 err_noparm      db 'Missing parameter in configuration file. Keyword: ',0
 
 		section .uibss
-                global KernelName
 		alignb 4
 vk_size		equ (vk_end + 3) & ~3
 VKernelBuf:	resb vk_size		; "Current" vkernel
@@ -122,11 +121,8 @@ Onerror		resb max_cmd_len+1	; onerror
 		section .bss16
 KbdMap		resb 256		; Keyboard map
 FKeyName	resb MAX_FKEYS*FILENAME_MAX	; File names for F-key help
-InitRDCNameLen	resw 1			; Length of unmangled initrd name
-		global KernelName, KernelCName
+                global KernelName
 KernelName      resb FILENAME_MAX	; Mangled name for kernel
-KernelCName     resb FILENAME_MAX	; Unmangled kernel name
-InitRDCName     resb FILENAME_MAX	; Unmangled initrd name
 MNameBuf        resb FILENAME_MAX
 InitRD          resb FILENAME_MAX
 
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index b30dbc2..e7b3108 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -409,9 +409,8 @@ commit_vk:
 		mov cx,7	; "initrd="
 		rep movsb
 		mov si,InitRD
-		pm_call pm_unmangle_name
-		mov al,' '
-		stosb
+		call strcpy
+		mov byte [es:di-1],' '
 
 		; For better compression, clean up the append field
 .noinitrd:
diff --git a/core/runkernel.inc b/core/runkernel.inc
index f4dc28e..bf67b11 100644
--- a/core/runkernel.inc
+++ b/core/runkernel.inc
@@ -77,7 +77,7 @@ construct_cmdline:
                 mov si,boot_image		; BOOT_IMAGE=
                 mov cx,boot_image_len
                 rep movsb
-                mov si,KernelCName		; Unmangled kernel name
+                mov si,KernelName		; Unmangled kernel name
 		call strcpy
 		mov byte [es:di-1],' '		; Follow by space
 
@@ -233,7 +233,7 @@ new_kernel:
 any_kernel:
 		mov si,loading_msg
                 call writestr_qchk
-                mov si,KernelCName		; Print kernel name part of
+                mov si,KernelName		; Print kernel name part of
                 call writestr_qchk		; "Loading" message
 
 ;
@@ -589,11 +589,6 @@ loadinitrd:
 		mov ds,ax
 		mov es,ax
 		push edi
-                mov si,InitRD
-                mov di,InitRDCName
-                pm_call pm_unmangle_name             ; Create human-readable name
-                sub di,InitRDCName
-                mov [InitRDCNameLen],di
                 mov di,InitRD
                 pm_call pm_searchdir                  ; Look for it in directory
 		pop edi
@@ -602,7 +597,7 @@ loadinitrd:
 		push si
 		mov si,crlfloading_msg		; Write "Loading "
 		call writestr_qchk
-                mov si,InitRDCName		; Write ramdisk name
+                mov si,InitRD			; Write ramdisk name
                 call writestr_qchk
                 mov si,dotdot_msg		; Write dots
                 call writestr_qchk
@@ -621,7 +616,7 @@ loadinitrd:
 .notthere:
                 mov si,err_noinitrd
                 call writestr
-                mov si,InitRDCName
+                mov si,InitRD
                 call writestr
                 mov si,crlf_msg
                 jmp abort_load
diff --git a/core/ui.inc b/core/ui.inc
index 5fe3e53..d60d5ca 100644
--- a/core/ui.inc
+++ b/core/ui.inc
@@ -486,13 +486,9 @@ bad_kernel:
 		and cx,cx
 		jnz on_error
 .really:
-		mov si,KernelName
-                mov di,KernelCName
-		push di
-                pm_call pm_unmangle_name              ; Get human form
 		mov si,err_notfound		; Complain about missing kernel
 		call writestr
-		pop si				; KernelCName
+		mov si,KernelName
                 call writestr
                 mov si,crlf_msg
                 jmp abort_load                  ; Ask user for clue
@@ -616,10 +612,6 @@ kernel_good:
 		mov [KeepPXE],al
 %endif
 
-		mov si,KernelName
-		mov di,KernelCName
-		pm_call pm_unmangle_name
-
 		; Default memory limit, can be overridden by image loaders
 		mov eax,[HighMemRsvd]
 		mov [MyHighMemSize],eax



More information about the Syslinux-commits mailing list