Skip to content

Commit

Permalink
vfs: semihost driver bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Gramakov committed Apr 15, 2020
1 parent ef47839 commit 283026a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/vfs/vfs_semihost.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static ssize_t vfs_semihost_write(void* ctx, int fd, const void * data, size_t s
if (ret == -1) {
errno = host_err;
}
return (ssize_t)ret;
return size - (ssize_t)ret; /* Write syscall returns the number of bytes NOT written */
}

static ssize_t vfs_semihost_read(void* ctx, int fd, void* data, size_t size)
Expand All @@ -237,7 +237,7 @@ static ssize_t vfs_semihost_read(void* ctx, int fd, void* data, size_t size)
errno = host_err;
return ret;
}
return size - (ssize_t)ret; /* Write syscall returns the number of bytes NOT written */
return size - (ssize_t)ret; /* Read syscall returns the number of bytes NOT read */

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void app_main(void)
return;
}
// Increase file buffer to perform data transfers using larger chunks.
// Every read/write triggers breakpoint, so transfering of small chunks is quite inefficient.
// Every read/write triggers breakpoint, so transferring of small chunks is quite inefficient.
setvbuf(fout, (char *)s_buf, _IOFBF, sizeof(s_buf));

// this will be printed to the file on host
Expand Down

0 comments on commit 283026a

Please sign in to comment.