summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-03 22:13:29 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-03 22:13:29 +0000
commit5f5127ba9ddb8f52d43827b6ab96b8169af5075f (patch)
tree701124de37c5bf475ba6920641948d637da0ee8b /pkg/sentry/fs
parent56f91c540e938374a025c31cf23aa2e4d00cacec (diff)
parent844e4d284cddf9795a0db7c38f926fe7b49bb873 (diff)
Merge release-20200219.0-91-g844e4d2 (automated)
Diffstat (limited to 'pkg/sentry/fs')
-rwxr-xr-xpkg/sentry/fs/dirent_list.go33
-rwxr-xr-xpkg/sentry/fs/event_list.go33
2 files changed, 42 insertions, 24 deletions
diff --git a/pkg/sentry/fs/dirent_list.go b/pkg/sentry/fs/dirent_list.go
index 750961a48..49d25da6c 100755
--- a/pkg/sentry/fs/dirent_list.go
+++ b/pkg/sentry/fs/dirent_list.go
@@ -54,8 +54,9 @@ func (l *direntList) Back() *Dirent {
// PushFront inserts the element e at the front of list l.
func (l *direntList) PushFront(e *Dirent) {
- direntElementMapper{}.linkerFor(e).SetNext(l.head)
- direntElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := direntElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
direntElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *direntList) PushFront(e *Dirent) {
// PushBack inserts the element e at the back of list l.
func (l *direntList) PushBack(e *Dirent) {
- direntElementMapper{}.linkerFor(e).SetNext(nil)
- direntElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := direntElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
direntElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *direntList) PushBackList(m *direntList) {
// InsertAfter inserts e after b.
func (l *direntList) InsertAfter(b, e *Dirent) {
- a := direntElementMapper{}.linkerFor(b).Next()
- direntElementMapper{}.linkerFor(e).SetNext(a)
- direntElementMapper{}.linkerFor(e).SetPrev(b)
- direntElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := direntElementMapper{}.linkerFor(b)
+ eLinker := direntElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
direntElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *direntList) InsertAfter(b, e *Dirent) {
// InsertBefore inserts e before a.
func (l *direntList) InsertBefore(a, e *Dirent) {
- b := direntElementMapper{}.linkerFor(a).Prev()
- direntElementMapper{}.linkerFor(e).SetNext(a)
- direntElementMapper{}.linkerFor(e).SetPrev(b)
- direntElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := direntElementMapper{}.linkerFor(a)
+ eLinker := direntElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
direntElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/sentry/fs/event_list.go b/pkg/sentry/fs/event_list.go
index c94cb03e1..786686592 100755
--- a/pkg/sentry/fs/event_list.go
+++ b/pkg/sentry/fs/event_list.go
@@ -54,8 +54,9 @@ func (l *eventList) Back() *Event {
// PushFront inserts the element e at the front of list l.
func (l *eventList) PushFront(e *Event) {
- eventElementMapper{}.linkerFor(e).SetNext(l.head)
- eventElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := eventElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
eventElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *eventList) PushFront(e *Event) {
// PushBack inserts the element e at the back of list l.
func (l *eventList) PushBack(e *Event) {
- eventElementMapper{}.linkerFor(e).SetNext(nil)
- eventElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := eventElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
eventElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *eventList) PushBackList(m *eventList) {
// InsertAfter inserts e after b.
func (l *eventList) InsertAfter(b, e *Event) {
- a := eventElementMapper{}.linkerFor(b).Next()
- eventElementMapper{}.linkerFor(e).SetNext(a)
- eventElementMapper{}.linkerFor(e).SetPrev(b)
- eventElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := eventElementMapper{}.linkerFor(b)
+ eLinker := eventElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
eventElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *eventList) InsertAfter(b, e *Event) {
// InsertBefore inserts e before a.
func (l *eventList) InsertBefore(a, e *Event) {
- b := eventElementMapper{}.linkerFor(a).Prev()
- eventElementMapper{}.linkerFor(e).SetNext(a)
- eventElementMapper{}.linkerFor(e).SetPrev(b)
- eventElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := eventElementMapper{}.linkerFor(a)
+ eLinker := eventElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
eventElementMapper{}.linkerFor(b).SetNext(e)