mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
include: move qemu_msync() to osdep
The implementation depends on the OS. (and longer-term goal is to move cutils to a common subproject) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220420132624.2439741-21-marcandre.lureau@redhat.com>
This commit is contained in:
parent
8905770b27
commit
73991a9222
5 changed files with 41 additions and 39 deletions
|
@ -950,3 +950,21 @@ int fcntl_setfl(int fd, int flag)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qemu_msync(void *addr, size_t length, int fd)
|
||||
{
|
||||
size_t align_mask = ~(qemu_real_host_page_size() - 1);
|
||||
|
||||
/**
|
||||
* There are no strict reqs as per the length of mapping
|
||||
* to be synced. Still the length needs to follow the address
|
||||
* alignment changes. Additionally - round the size to the multiple
|
||||
* of PAGE_SIZE
|
||||
*/
|
||||
length += ((uintptr_t)addr & (qemu_real_host_page_size() - 1));
|
||||
length = (length + ~align_mask) & align_mask;
|
||||
|
||||
addr = (void *)((uintptr_t)addr & align_mask);
|
||||
|
||||
return msync(addr, length, MS_SYNC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue