Skip to content

Commit 793db82

Browse files
Merge pull request #16 from stupendoussuperpowers/imfs-memcpy
Perf fix: use memcpy instead of debug mem_cpy
2 parents 48ab775 + 202f7ec commit 793db82

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/imfs-grate/src/imfs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static ssize_t __imfs_pipe_read(int cage_id, int fd, void *buf, size_t count,
492492
};
493493

494494
int to_read = _pipe->offset;
495-
mem_cpy(buf, _pipe->data, to_read);
495+
memcpy(buf, _pipe->data, to_read);
496496
_pipe->offset = 0;
497497

498498
return to_read;
@@ -532,7 +532,7 @@ static ssize_t imfs_new_read(int cage_id, int fd, void *buf, size_t count,
532532
to_copy = available;
533533
}
534534

535-
mem_cpy(buf + read, c->data + local_offset, to_copy);
535+
memcpy(buf + read, c->data + local_offset, to_copy);
536536

537537
read += to_copy;
538538
local_offset = 0;
@@ -564,7 +564,7 @@ static ssize_t __imfs_pipe_write(int cage_id, int fd, const void *buf,
564564
size_t count, int pread, off_t offset) {
565565
Pipe *_pipe = get_pipe(cage_id, fd);
566566

567-
mem_cpy(_pipe->data, buf, count);
567+
memcpy(_pipe->data, buf, count);
568568
_pipe->offset += count;
569569
LOG("[pipe] offset=%zd\n", count);
570570

@@ -620,7 +620,7 @@ static ssize_t imfs_new_write(int cage_id, int fd, const void *buf,
620620
memset(c->data + c->used, 0, local_offset - c->used);
621621
}
622622

623-
mem_cpy(c->data + local_offset, buf + written, to_copy);
623+
memcpy(c->data + local_offset, buf + written, to_copy);
624624

625625
if (local_offset + to_copy > c->used)
626626
c->used = local_offset + to_copy;
@@ -922,7 +922,7 @@ int imfs_openat(int cage_id, int dirfd, const char *path, int flags,
922922
}
923923
} else {
924924
// File Exists
925-
if (/*flags & O_EXCL ||*/ flags & O_CREAT) {
925+
if (flags & O_EXCL && flags & O_CREAT) {
926926
errno = EEXIST;
927927
return -EEXIST;
928928
}

0 commit comments

Comments
 (0)