diff options
author | Dean Deng <deandeng@google.com> | 2020-05-19 13:45:23 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-19 13:46:42 -0700 |
commit | 05c89af6edde6158844d4debfe68bc598fec4418 (patch) | |
tree | 4b431d445b9cbde5a789620eb83ba35eb281ea9a /pkg/sentry/fsimpl/gofer/pagemath.go | |
parent | 064347afdf6206df73571684a3a75dde63584ad5 (diff) |
Implement mmap for host fs in vfs2.
In VFS1, both fs/host and fs/gofer used the same utils for host file mappings.
Refactor parts of fsimpl/gofer to create similar utils to share with
fsimpl/host (memory accounting code moved to fsutil, page rounding arithmetic
moved to usermem).
Updates #1476.
PiperOrigin-RevId: 312345090
Diffstat (limited to 'pkg/sentry/fsimpl/gofer/pagemath.go')
-rw-r--r-- | pkg/sentry/fsimpl/gofer/pagemath.go | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/pkg/sentry/fsimpl/gofer/pagemath.go b/pkg/sentry/fsimpl/gofer/pagemath.go deleted file mode 100644 index 847cb0784..000000000 --- a/pkg/sentry/fsimpl/gofer/pagemath.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2019 The gVisor Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package gofer - -import ( - "gvisor.dev/gvisor/pkg/usermem" -) - -// This are equivalent to usermem.Addr.RoundDown/Up, but without the -// potentially truncating conversion to usermem.Addr. This is necessary because -// there is no way to define generic "PageRoundDown/Up" functions in Go. - -func pageRoundDown(x uint64) uint64 { - return x &^ (usermem.PageSize - 1) -} - -func pageRoundUp(x uint64) uint64 { - return pageRoundDown(x + usermem.PageSize - 1) -} |