mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
[syserror] Split usermem package
Split usermem package to help remove syserror dependency in go_marshal. New hostarch package contains code not dependent on syserror. PiperOrigin-RevId: 365651233
This commit is contained in:
committed by
gVisor bot
parent
b125afba41
commit
8a2f7e716d
@@ -47,6 +47,7 @@ go_library(
|
||||
"//pkg/context",
|
||||
"//pkg/fdnotifier",
|
||||
"//pkg/fspath",
|
||||
"//pkg/hostarch",
|
||||
"//pkg/iovec",
|
||||
"//pkg/log",
|
||||
"//pkg/marshal/primitive",
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
"gvisor.dev/gvisor/pkg/context"
|
||||
"gvisor.dev/gvisor/pkg/fdnotifier"
|
||||
"gvisor.dev/gvisor/pkg/fspath"
|
||||
"gvisor.dev/gvisor/pkg/hostarch"
|
||||
"gvisor.dev/gvisor/pkg/log"
|
||||
"gvisor.dev/gvisor/pkg/sentry/fsimpl/kernfs"
|
||||
"gvisor.dev/gvisor/pkg/sentry/hostfd"
|
||||
@@ -431,8 +432,8 @@ func (i *inode) SetStat(ctx context.Context, fs *vfs.Filesystem, creds *auth.Cre
|
||||
}
|
||||
oldSize := uint64(hostStat.Size)
|
||||
if s.Size < oldSize {
|
||||
oldpgend, _ := usermem.PageRoundUp(oldSize)
|
||||
newpgend, _ := usermem.PageRoundUp(s.Size)
|
||||
oldpgend, _ := hostarch.PageRoundUp(oldSize)
|
||||
newpgend, _ := hostarch.PageRoundUp(s.Size)
|
||||
if oldpgend != newpgend {
|
||||
i.CachedMappable.InvalidateRange(memmap.MappableRange{newpgend, oldpgend})
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
"gvisor.dev/gvisor/pkg/fdnotifier"
|
||||
"gvisor.dev/gvisor/pkg/hostarch"
|
||||
"gvisor.dev/gvisor/pkg/safemem"
|
||||
"gvisor.dev/gvisor/pkg/sentry/hostfd"
|
||||
"gvisor.dev/gvisor/pkg/usermem"
|
||||
)
|
||||
|
||||
// beforeSave is invoked by stateify.
|
||||
@@ -38,7 +38,7 @@ func (i *inode) beforeSave() {
|
||||
// EBADF from the read.
|
||||
i.bufMu.Lock()
|
||||
defer i.bufMu.Unlock()
|
||||
var buf [usermem.PageSize]byte
|
||||
var buf [hostarch.PageSize]byte
|
||||
for {
|
||||
n, err := hostfd.Preadv2(int32(i.hostFD), safemem.BlockSeqOf(safemem.BlockFromSafeSlice(buf[:])), -1 /* offset */, 0 /* flags */)
|
||||
if n != 0 {
|
||||
|
||||
Reference in New Issue
Block a user