You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/04/01 15:03:37 UTC
[GitHub] [nuttx] xiaoxiang781216 opened a new pull request, #8942: boards: Replace open/pread with file_open/file_pread
xiaoxiang781216 opened a new pull request, #8942:
URL: https://github.com/apache/nuttx/pull/8942
## Summary
## Impact
Code refactor only
## Testing
CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] pkarashchenko commented on pull request #8942: boards: Replace open/pread with file_open/file_pread
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #8942:
URL: https://github.com/apache/nuttx/pull/8942#issuecomment-1493194874
What is the motivation for this change?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] pkarashchenko merged pull request #8942: boards: Replace open/pread with file_open/file_pread
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko merged PR #8942:
URL: https://github.com/apache/nuttx/pull/8942
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8942: boards: Replace open/pread with file_open/file_pread
Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #8942:
URL: https://github.com/apache/nuttx/pull/8942#discussion_r1155245379
##########
boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot_image.c:
##########
@@ -137,17 +137,18 @@ static void systick_disable(void)
int board_boot_image(const char *path, uint32_t hdr_size)
{
static struct arm_vector_table vt;
- int fd;
+ struct file file;
ssize_t bytes;
+ int ret;
- fd = open(path, O_RDONLY | O_CLOEXEC);
- if (fd < 0)
+ ret = file_open(&file, path, O_RDONLY | O_CLOEXEC);
+ if (ret < 0)
{
- syslog(LOG_ERR, "Failed to open %s with: %d", path, fd);
- return fd;
+ syslog(LOG_ERR, "Failed to open %s with: %d", path, ret);
+ return ret;
}
- bytes = pread(fd, &vt, sizeof(vt), hdr_size);
+ bytes = file_pread(&file, &vt, sizeof(vt), hdr_size);
Review Comment:
I think file_close is missing, but that does not really matter since we jump to application coee
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8942: boards: Replace open/pread with file_open/file_pread
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8942:
URL: https://github.com/apache/nuttx/pull/8942#discussion_r1155252516
##########
boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot_image.c:
##########
@@ -137,17 +137,18 @@ static void systick_disable(void)
int board_boot_image(const char *path, uint32_t hdr_size)
{
static struct arm_vector_table vt;
- int fd;
+ struct file file;
ssize_t bytes;
+ int ret;
- fd = open(path, O_RDONLY | O_CLOEXEC);
- if (fd < 0)
+ ret = file_open(&file, path, O_RDONLY | O_CLOEXEC);
+ if (ret < 0)
{
- syslog(LOG_ERR, "Failed to open %s with: %d", path, fd);
- return fd;
+ syslog(LOG_ERR, "Failed to open %s with: %d", path, ret);
+ return ret;
}
- bytes = pread(fd, &vt, sizeof(vt), hdr_size);
+ bytes = file_pread(&file, &vt, sizeof(vt), hdr_size);
Review Comment:
Yes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on pull request #8942: boards: Replace open/pread with file_open/file_pread
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #8942:
URL: https://github.com/apache/nuttx/pull/8942#issuecomment-1493222977
> What is the motivation for this change?
kernel code shouldn't call the functions which depends on per-task file handle table.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org