summaryrefslogtreecommitdiffstats
path: root/sys/boot/sparc64
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-04-24 02:24:32 +0000
committerjake <jake@FreeBSD.org>2002-04-24 02:24:32 +0000
commit3473cf4ec18d9caa2a7167a6fb9444ae26881641 (patch)
treecb1550f851d2b63a25790ac75e8a899e3f0b4aef /sys/boot/sparc64
parentab92bb92b738d7255e3276d12f41e592a2851548 (diff)
downloadFreeBSD-src-3473cf4ec18d9caa2a7167a6fb9444ae26881641.zip
FreeBSD-src-3473cf4ec18d9caa2a7167a6fb9444ae26881641.tar.gz
memcpy, memset -> bcopy, bzero.
Diffstat (limited to 'sys/boot/sparc64')
-rw-r--r--sys/boot/sparc64/boot1/boot1.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/sys/boot/sparc64/boot1/boot1.c b/sys/boot/sparc64/boot1/boot1.c
index 9f0a420..363831b 100644
--- a/sys/boot/sparc64/boot1/boot1.c
+++ b/sys/boot/sparc64/boot1/boot1.c
@@ -60,8 +60,8 @@ static int dskread(void *, u_int64_t, int);
static int printf(const char *, ...);
static int putchar(int);
-static void *memcpy(void *, const void *, size_t);
-static void *memset(void *, int, size_t);
+static void bcopy(const void *src, void *dst, size_t len);
+static void bzero(void *b, size_t len);
/*
* Open Firmware interface functions
@@ -244,6 +244,25 @@ ofw_seek(ofwh_t devh, u_int64_t off)
return (0);
}
+static void
+bcopy(const void *dst, void *src, size_t len)
+{
+ const char *d = dst;
+ char *s = src;
+
+ while (len-- != 0)
+ *s++ = *d++;
+}
+
+static void
+bzero(void *b, size_t len)
+{
+ char *p = b;
+
+ while (len-- != 0)
+ *p++ = 0;
+}
+
static int
strcmp(const char *s1, const char *s2)
{
@@ -252,19 +271,6 @@ strcmp(const char *s1, const char *s2)
return ((u_char)*s1 - (u_char)*s2);
}
-static void *
-memset(void *dst, int val, size_t len)
-{
- void *ret;
-
- ret = dst;
- while (len) {
- *((char *)dst)++ = val;
- len--;
- }
- return (ret);
-}
-
static int
fsfind(const char *name, ino_t * ino)
{
@@ -300,7 +306,7 @@ int
main(void)
{
if (bname[0] == '\0')
- memcpy(bname, _PATH_LOADER, sizeof(_PATH_LOADER));
+ bcopy(_PATH_LOADER, bname, sizeof(_PATH_LOADER));
printf(" \n>> FreeBSD/sparc64 boot block\n"
" Boot path: %s\n"
@@ -345,7 +351,7 @@ load(const char *fname)
return;
}
if (ph.p_filesz != ph.p_memsz)
- memset(p + ph.p_filesz, 0, ph.p_memsz - ph.p_filesz);
+ bzero(p + ph.p_filesz, ph.p_memsz - ph.p_filesz);
}
ofw_close(bootdevh);
(*(void (*)(int, int, int, int, ofwfp_t))eh.e_entry)(0, 0, 0, 0, ofw);
@@ -373,7 +379,7 @@ lookup(const char *path)
;
if ((n = s - path) > MAXNAMLEN)
return (0);
- memcpy(name, path, n);
+ bcopy(path, name, n);
name[n] = 0;
if (dt != DT_DIR) {
printf("%s: not a directory.\n", name);
@@ -404,7 +410,7 @@ fsread(ino_t inode, void *buf, size_t nbyte)
inomap = 0;
if (dskread(blkbuf, SBOFF / DEV_BSIZE, SBSIZE / DEV_BSIZE))
return (-1);
- memcpy(&fs, blkbuf, sizeof(fs));
+ bcopy(blkbuf, &fs, sizeof(fs));
if (fs.fs_magic != FS_MAGIC) {
printf("Not ufs\n");
return (-1);
@@ -418,7 +424,8 @@ fsread(ino_t inode, void *buf, size_t nbyte)
if (dskread(blkbuf, fsbtodb(&fs, ino_to_fsba(&fs, inode)),
fsblks))
return (-1);
- din = ((struct dinode *)blkbuf)[inode % INOPB(&fs)];
+ bcopy(blkbuf + ((inode % INOPB(&fs)) * sizeof(din)), &din,
+ sizeof(din));
inomap = inode;
fs_off = 0;
blkmap = indmap = 0;
@@ -452,7 +459,7 @@ fsread(ino_t inode, void *buf, size_t nbyte)
n -= off;
if (n > nb)
n = nb;
- memcpy(s, blkbuf + off, n);
+ bcopy(blkbuf + off, s, n);
s += n;
fs_off += n;
nb -= n;
@@ -544,14 +551,3 @@ putchar(int c)
putc(c);
return (c);
}
-
-static void *
-memcpy(void *dst, const void *src, size_t size)
-{
- const char *s;
- char *d;
-
- for (d = dst, s = src; size; size--)
- *d++ = *s++;
- return (dst);
-}
OpenPOWER on IntegriCloud