summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-08-12 21:31:49 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-08-12 21:31:49 -0700
commita1fc1f47b4e6080edabb517a070e3c1918c1b3a1 (patch)
tree356ba41f6458b48d80b8ec4c95eac618acf30917
parent43c00b21090c396f92502a6b6fc9c2bd35f59684 (diff)
downloadsyslinux-a1fc1f47b4e6080edabb517a070e3c1918c1b3a1.tar.gz
core: use stpcpy() as generic_unmangle_name()
We can use stpcpy() as generic_unmangle_name(); this also gives us the pointer to the end that the assembly code wants and expects. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/fs.c6
-rw-r--r--core/fs/ext2/ext2.c2
-rw-r--r--core/fs/fat/fat.c2
-rw-r--r--core/fs/iso9660/iso9660.c2
-rw-r--r--core/fs/pxe/pxe.c6
-rw-r--r--core/include/fs.h4
6 files changed, 10 insertions, 12 deletions
diff --git a/core/fs.c b/core/fs.c
index ad6659b2..2804468b 100644
--- a/core/fs.c
+++ b/core/fs.c
@@ -73,13 +73,9 @@ void 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]);
- if (this_fs->fs_ops->unmangle_name)
- this_fs->fs_ops->unmangle_name(dst, src);
- else
- strcpy(dst, src);
+ dst = this_fs->fs_ops->unmangle_name(dst, src);
/* Update the di register to point to the last null char */
- dst = strchr(dst, '\0');
regs->edi.w[0] = OFFS_WRT(dst, regs->es);
}
diff --git a/core/fs/ext2/ext2.c b/core/fs/ext2/ext2.c
index 546a127a..34aba24f 100644
--- a/core/fs/ext2/ext2.c
+++ b/core/fs/ext2/ext2.c
@@ -757,6 +757,6 @@ const struct fs_ops ext2_fs_ops = {
.getfssec = ext2_getfssec,
.close_file = ext2_close_file,
.mangle_name = generic_mangle_name,
- .unmangle_name = NULL,
+ .unmangle_name = generic_unmangle_name,
.load_config = ext2_load_config
};
diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c
index 1b1c532e..0611caec 100644
--- a/core/fs/fat/fat.c
+++ b/core/fs/fat/fat.c
@@ -948,6 +948,6 @@ const struct fs_ops vfat_fs_ops = {
.getfssec = vfat_getfssec,
.close_file = vfat_close_file,
.mangle_name = vfat_mangle_name,
- .unmangle_name = NULL,
+ .unmangle_name = generic_unmangle_name,
.load_config = vfat_load_config
};
diff --git a/core/fs/iso9660/iso9660.c b/core/fs/iso9660/iso9660.c
index ec84dc50..1d08805b 100644
--- a/core/fs/iso9660/iso9660.c
+++ b/core/fs/iso9660/iso9660.c
@@ -543,6 +543,6 @@ const struct fs_ops iso_fs_ops = {
.getfssec = iso_getfssec,
.close_file = iso_close_file,
.mangle_name = iso_mangle_name,
- .unmangle_name = NULL,
+ .unmangle_name = generic_unmangle_name,
.load_config = iso_load_config
};
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 38f6dffb..ceb12102 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -513,7 +513,7 @@ static void pxe_mangle_name(char *dst, const char *src)
* filename to the conventional representation. This is
* needed for the BOOT_IMAGE= parameter for the kernel.
*/
-static void pxe_unmangle_name(char *dst, const char *src)
+static char *pxe_unmangle_name(char *dst, const char *src)
{
uint32_t ip = *(uint32_t *)src;
int ip_len = 0;
@@ -523,9 +523,9 @@ static void pxe_unmangle_name(char *dst, const char *src)
dst += ip_len;
}
src += 4;
- strcpy(dst, src);
+ return stpcpy(dst, src);
}
-
+
/*
*
;
diff --git a/core/include/fs.h b/core/include/fs.h
index 2840edb0..04e85ef8 100644
--- a/core/include/fs.h
+++ b/core/include/fs.h
@@ -3,6 +3,7 @@
#include <stddef.h>
#include <stdbool.h>
+#include <string.h>
#include <com32.h>
#include "core.h"
#include "disk.h"
@@ -46,7 +47,7 @@ struct fs_ops {
uint32_t (*getfssec)(struct file *, char *, int, bool *);
void (*close_file)(struct file *);
void (*mangle_name)(char *, const char *);
- void (*unmangle_name)(char *, const char *);
+ char * (*unmangle_name)(char *, const char *);
void (*load_config)(com32sys_t *);
};
@@ -56,6 +57,7 @@ enum dev_type {CHS, EDD};
* Generic functions that filesystem drivers may choose to use
*/
void generic_mangle_name(char *, const char *);
+#define generic_unmangle_name stpcpy
/*
* Struct device contains: