crosvm/sys_util
Fletcher Woodruff 42bff13009 guest_memory: add fn to get memfd offset of addr
Add a function offset_from_base() which, given a GuestAddress, determines
the offset of that address within the backing memfd of the GuestMemory.

In other words, this lets you convert a GuestAddress into an offset that
can be understood by another process which has mapped the the memfd and
would like to read from that address.

BUG=chromium:968724
TEST=cargo test

Change-Id: I5b033ad29dd38090f74577c068cc62ee9c6effb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2015835
Tested-by: Fletcher Woodruff <fletcherw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Fletcher Woodruff <fletcherw@chromium.org>
2020-01-23 16:23:21 +00:00
..
poll_token_derive edition: Remove extern crate lines 2019-04-15 02:06:08 -07:00
src guest_memory: add fn to get memfd offset of addr 2020-01-23 16:23:21 +00:00
Cargo.toml tempfile: Unify the two tempdir implementations 2019-07-11 16:15:38 -07:00