boards: Replace open/pread with file_open/file_pread
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
cafd3af160
commit
12fda1da1c
@ -137,17 +137,18 @@ static void systick_disable(void)
|
|||||||
int board_boot_image(const char *path, uint32_t hdr_size)
|
int board_boot_image(const char *path, uint32_t hdr_size)
|
||||||
{
|
{
|
||||||
static struct arm_vector_table vt;
|
static struct arm_vector_table vt;
|
||||||
int fd;
|
struct file file;
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
|
int ret;
|
||||||
|
|
||||||
fd = open(path, O_RDONLY | O_CLOEXEC);
|
ret = file_open(&file, path, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to open %s with: %d", path, fd);
|
syslog(LOG_ERR, "Failed to open %s with: %d", path, ret);
|
||||||
return fd;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = pread(fd, &vt, sizeof(vt), hdr_size);
|
bytes = file_pread(&file, &vt, sizeof(vt), hdr_size);
|
||||||
if (bytes != sizeof(vt))
|
if (bytes != sizeof(vt))
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to read ARM vector table: %d", bytes);
|
syslog(LOG_ERR, "Failed to read ARM vector table: %d", bytes);
|
||||||
|
@ -139,17 +139,18 @@ static void systick_disable(void)
|
|||||||
int board_boot_image(const char *path, uint32_t hdr_size)
|
int board_boot_image(const char *path, uint32_t hdr_size)
|
||||||
{
|
{
|
||||||
static struct arm_vector_table vt;
|
static struct arm_vector_table vt;
|
||||||
int fd;
|
struct file file;
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
|
int ret;
|
||||||
|
|
||||||
fd = open(path, O_RDONLY | O_CLOEXEC);
|
ret = file_open(&file, path, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to open %s with: %d", path, fd);
|
syslog(LOG_ERR, "Failed to open %s with: %d", path, ret);
|
||||||
return fd;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = pread(fd, &vt, sizeof(vt), hdr_size);
|
bytes = file_pread(&file, &vt, sizeof(vt), hdr_size);
|
||||||
if (bytes != sizeof(vt))
|
if (bytes != sizeof(vt))
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to read ARM vector table: %d", bytes);
|
syslog(LOG_ERR, "Failed to read ARM vector table: %d", bytes);
|
||||||
|
@ -137,17 +137,18 @@ static void systick_disable(void)
|
|||||||
int board_boot_image(const char *path, uint32_t hdr_size)
|
int board_boot_image(const char *path, uint32_t hdr_size)
|
||||||
{
|
{
|
||||||
static struct arm_vector_table vt;
|
static struct arm_vector_table vt;
|
||||||
int fd;
|
struct file file;
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
|
int ret;
|
||||||
|
|
||||||
fd = open(path, O_RDONLY | O_CLOEXEC);
|
ret = file_open(&file, path, O_RDONLY | O_CLOEXEC);
|
||||||
if (fd < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to open %s with: %d", path, fd);
|
syslog(LOG_ERR, "Failed to open %s with: %d", path, ret);
|
||||||
return fd;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = pread(fd, &vt, sizeof(vt), hdr_size);
|
bytes = file_pread(&file, &vt, sizeof(vt), hdr_size);
|
||||||
if (bytes != sizeof(vt))
|
if (bytes != sizeof(vt))
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "Failed to read ARM vector table: %d", bytes);
|
syslog(LOG_ERR, "Failed to read ARM vector table: %d", bytes);
|
||||||
|
Loading…
Reference in New Issue
Block a user