Skip to content

Commit

Permalink
memory: Have memory_region_init_ram_from_file() handler return a boolean
Browse files Browse the repository at this point in the history
Following the example documented since commit e3fe398 ("error:
Document Error API usage rules"), have memory_region_init_ram_from_file
return a boolean indicating whether an error is set or not.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Message-Id: <20231120213301.24349-13-philmd@linaro.org>
  • Loading branch information
philmd committed Jan 5, 2024
1 parent f25a9fb commit 9b9d11a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/exec/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,10 @@ bool memory_region_init_resizeable_ram(MemoryRegion *mr,
*
* Note that this function does not do anything to cause the data in the
* RAM memory region to be migrated; that is the responsibility of the caller.
*
* Return: true on success, else false setting @errp with error.
*/
void memory_region_init_ram_from_file(MemoryRegion *mr,
bool memory_region_init_ram_from_file(MemoryRegion *mr,
Object *owner,
const char *name,
uint64_t size,
Expand Down
4 changes: 3 additions & 1 deletion system/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ bool memory_region_init_resizeable_ram(MemoryRegion *mr,
}

#ifdef CONFIG_POSIX
void memory_region_init_ram_from_file(MemoryRegion *mr,
bool memory_region_init_ram_from_file(MemoryRegion *mr,
Object *owner,
const char *name,
uint64_t size,
Expand All @@ -1628,7 +1628,9 @@ void memory_region_init_ram_from_file(MemoryRegion *mr,
mr->size = int128_zero();
object_unparent(OBJECT(mr));
error_propagate(errp, err);
return false;
}
return true;
}

void memory_region_init_ram_from_fd(MemoryRegion *mr,
Expand Down

0 comments on commit 9b9d11a

Please sign in to comment.