summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/tmpfs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-06-24 06:37:35 +0000
committergVisor bot <gvisor-bot@google.com>2020-06-24 06:37:35 +0000
commit9183888b520beeee8609170819a28bea89202909 (patch)
tree3cdcfa4de9ced4c539ab7c57e4cf58ffea980f6c /pkg/sentry/fsimpl/tmpfs
parentcab13958a54419262aba2a0cd7f1075ed02c8ee0 (diff)
parent364ac92baf83f2352f78b718090472639bd92a76 (diff)
Merge release-20200608.0-119-g364ac92ba (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/tmpfs')
-rw-r--r--pkg/sentry/fsimpl/tmpfs/dentry_list.go6
-rw-r--r--pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go54
2 files changed, 43 insertions, 17 deletions
diff --git a/pkg/sentry/fsimpl/tmpfs/dentry_list.go b/pkg/sentry/fsimpl/tmpfs/dentry_list.go
index 9af621dd3..95e3d13d5 100644
--- a/pkg/sentry/fsimpl/tmpfs/dentry_list.go
+++ b/pkg/sentry/fsimpl/tmpfs/dentry_list.go
@@ -56,7 +56,7 @@ func (l *dentryList) Back() *dentry {
//
// NOTE: This is an O(n) operation.
func (l *dentryList) Len() (count int) {
- for e := l.Front(); e != nil; e = e.Next() {
+ for e := l.Front(); e != nil; e = (dentryElementMapper{}.linkerFor(e)).Next() {
count++
}
return count
@@ -148,13 +148,13 @@ func (l *dentryList) Remove(e *dentry) {
if prev != nil {
dentryElementMapper{}.linkerFor(prev).SetNext(next)
- } else {
+ } else if l.head == e {
l.head = next
}
if next != nil {
dentryElementMapper{}.linkerFor(next).SetPrev(prev)
- } else {
+ } else if l.tail == e {
l.tail = prev
}
diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go b/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go
index 10d8b49a6..1b617bd35 100644
--- a/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go
+++ b/pkg/sentry/fsimpl/tmpfs/tmpfs_state_autogen.go
@@ -6,33 +6,59 @@ import (
"gvisor.dev/gvisor/pkg/state"
)
+func (x *dentryList) StateTypeName() string {
+ return "pkg/sentry/fsimpl/tmpfs.dentryList"
+}
+
+func (x *dentryList) StateFields() []string {
+ return []string{
+ "head",
+ "tail",
+ }
+}
+
func (x *dentryList) beforeSave() {}
-func (x *dentryList) save(m state.Map) {
+
+func (x *dentryList) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("head", &x.head)
- m.Save("tail", &x.tail)
+ m.Save(0, &x.head)
+ m.Save(1, &x.tail)
}
func (x *dentryList) afterLoad() {}
-func (x *dentryList) load(m state.Map) {
- m.Load("head", &x.head)
- m.Load("tail", &x.tail)
+
+func (x *dentryList) StateLoad(m state.Source) {
+ m.Load(0, &x.head)
+ m.Load(1, &x.tail)
+}
+
+func (x *dentryEntry) StateTypeName() string {
+ return "pkg/sentry/fsimpl/tmpfs.dentryEntry"
+}
+
+func (x *dentryEntry) StateFields() []string {
+ return []string{
+ "next",
+ "prev",
+ }
}
func (x *dentryEntry) beforeSave() {}
-func (x *dentryEntry) save(m state.Map) {
+
+func (x *dentryEntry) StateSave(m state.Sink) {
x.beforeSave()
- m.Save("next", &x.next)
- m.Save("prev", &x.prev)
+ m.Save(0, &x.next)
+ m.Save(1, &x.prev)
}
func (x *dentryEntry) afterLoad() {}
-func (x *dentryEntry) load(m state.Map) {
- m.Load("next", &x.next)
- m.Load("prev", &x.prev)
+
+func (x *dentryEntry) StateLoad(m state.Source) {
+ m.Load(0, &x.next)
+ m.Load(1, &x.prev)
}
func init() {
- state.Register("pkg/sentry/fsimpl/tmpfs.dentryList", (*dentryList)(nil), state.Fns{Save: (*dentryList).save, Load: (*dentryList).load})
- state.Register("pkg/sentry/fsimpl/tmpfs.dentryEntry", (*dentryEntry)(nil), state.Fns{Save: (*dentryEntry).save, Load: (*dentryEntry).load})
+ state.Register((*dentryList)(nil))
+ state.Register((*dentryEntry)(nil))
}