diff options
25 files changed, 525 insertions, 300 deletions
diff --git a/pkg/buffer/buffer_list.go b/pkg/buffer/buffer_list.go index f3c27c42c..18dcf2608 100755 --- a/pkg/buffer/buffer_list.go +++ b/pkg/buffer/buffer_list.go @@ -54,8 +54,9 @@ func (l *bufferList) Back() *Buffer { // PushFront inserts the element e at the front of list l. func (l *bufferList) PushFront(e *Buffer) { - bufferElementMapper{}.linkerFor(e).SetNext(l.head) - bufferElementMapper{}.linkerFor(e).SetPrev(nil) + linker := bufferElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { bufferElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *bufferList) PushFront(e *Buffer) { // PushBack inserts the element e at the back of list l. func (l *bufferList) PushBack(e *Buffer) { - bufferElementMapper{}.linkerFor(e).SetNext(nil) - bufferElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := bufferElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { bufferElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *bufferList) PushBackList(m *bufferList) { // InsertAfter inserts e after b. func (l *bufferList) InsertAfter(b, e *Buffer) { - a := bufferElementMapper{}.linkerFor(b).Next() - bufferElementMapper{}.linkerFor(e).SetNext(a) - bufferElementMapper{}.linkerFor(e).SetPrev(b) - bufferElementMapper{}.linkerFor(b).SetNext(e) + bLinker := bufferElementMapper{}.linkerFor(b) + eLinker := bufferElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { bufferElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *bufferList) InsertAfter(b, e *Buffer) { // InsertBefore inserts e before a. func (l *bufferList) InsertBefore(a, e *Buffer) { - b := bufferElementMapper{}.linkerFor(a).Prev() - bufferElementMapper{}.linkerFor(e).SetNext(a) - bufferElementMapper{}.linkerFor(e).SetPrev(b) - bufferElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := bufferElementMapper{}.linkerFor(a) + eLinker := bufferElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { bufferElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/ilist/interface_list.go b/pkg/ilist/interface_list.go index 940c2d3f6..a69f736c6 100755 --- a/pkg/ilist/interface_list.go +++ b/pkg/ilist/interface_list.go @@ -73,8 +73,9 @@ func (l *List) Back() Element { // PushFront inserts the element e at the front of list l. func (l *List) PushFront(e Element) { - ElementMapper{}.linkerFor(e).SetNext(l.head) - ElementMapper{}.linkerFor(e).SetPrev(nil) + linker := ElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { ElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -87,8 +88,9 @@ func (l *List) PushFront(e Element) { // PushBack inserts the element e at the back of list l. func (l *List) PushBack(e Element) { - ElementMapper{}.linkerFor(e).SetNext(nil) - ElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := ElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { ElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -117,10 +119,14 @@ func (l *List) PushBackList(m *List) { // InsertAfter inserts e after b. func (l *List) InsertAfter(b, e Element) { - a := ElementMapper{}.linkerFor(b).Next() - ElementMapper{}.linkerFor(e).SetNext(a) - ElementMapper{}.linkerFor(e).SetPrev(b) - ElementMapper{}.linkerFor(b).SetNext(e) + bLinker := ElementMapper{}.linkerFor(b) + eLinker := ElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { ElementMapper{}.linkerFor(a).SetPrev(e) @@ -131,10 +137,13 @@ func (l *List) InsertAfter(b, e Element) { // InsertBefore inserts e before a. func (l *List) InsertBefore(a, e Element) { - b := ElementMapper{}.linkerFor(a).Prev() - ElementMapper{}.linkerFor(e).SetNext(a) - ElementMapper{}.linkerFor(e).SetPrev(b) - ElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := ElementMapper{}.linkerFor(a) + eLinker := ElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { ElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/refs/weak_ref_list.go b/pkg/refs/weak_ref_list.go index df8e98bf5..19daf9ab0 100755 --- a/pkg/refs/weak_ref_list.go +++ b/pkg/refs/weak_ref_list.go @@ -54,8 +54,9 @@ func (l *weakRefList) Back() *WeakRef { // PushFront inserts the element e at the front of list l. func (l *weakRefList) PushFront(e *WeakRef) { - weakRefElementMapper{}.linkerFor(e).SetNext(l.head) - weakRefElementMapper{}.linkerFor(e).SetPrev(nil) + linker := weakRefElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { weakRefElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *weakRefList) PushFront(e *WeakRef) { // PushBack inserts the element e at the back of list l. func (l *weakRefList) PushBack(e *WeakRef) { - weakRefElementMapper{}.linkerFor(e).SetNext(nil) - weakRefElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := weakRefElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { weakRefElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *weakRefList) PushBackList(m *weakRefList) { // InsertAfter inserts e after b. func (l *weakRefList) InsertAfter(b, e *WeakRef) { - a := weakRefElementMapper{}.linkerFor(b).Next() - weakRefElementMapper{}.linkerFor(e).SetNext(a) - weakRefElementMapper{}.linkerFor(e).SetPrev(b) - weakRefElementMapper{}.linkerFor(b).SetNext(e) + bLinker := weakRefElementMapper{}.linkerFor(b) + eLinker := weakRefElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { weakRefElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *weakRefList) InsertAfter(b, e *WeakRef) { // InsertBefore inserts e before a. func (l *weakRefList) InsertBefore(a, e *WeakRef) { - b := weakRefElementMapper{}.linkerFor(a).Prev() - weakRefElementMapper{}.linkerFor(e).SetNext(a) - weakRefElementMapper{}.linkerFor(e).SetPrev(b) - weakRefElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := weakRefElementMapper{}.linkerFor(a) + eLinker := weakRefElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { weakRefElementMapper{}.linkerFor(b).SetNext(e) 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) diff --git a/pkg/sentry/kernel/epoll/epoll_list.go b/pkg/sentry/kernel/epoll/epoll_list.go index 94d5c9e57..5ac854e38 100755 --- a/pkg/sentry/kernel/epoll/epoll_list.go +++ b/pkg/sentry/kernel/epoll/epoll_list.go @@ -54,8 +54,9 @@ func (l *pollEntryList) Back() *pollEntry { // PushFront inserts the element e at the front of list l. func (l *pollEntryList) PushFront(e *pollEntry) { - pollEntryElementMapper{}.linkerFor(e).SetNext(l.head) - pollEntryElementMapper{}.linkerFor(e).SetPrev(nil) + linker := pollEntryElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { pollEntryElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *pollEntryList) PushFront(e *pollEntry) { // PushBack inserts the element e at the back of list l. func (l *pollEntryList) PushBack(e *pollEntry) { - pollEntryElementMapper{}.linkerFor(e).SetNext(nil) - pollEntryElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := pollEntryElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { pollEntryElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *pollEntryList) PushBackList(m *pollEntryList) { // InsertAfter inserts e after b. func (l *pollEntryList) InsertAfter(b, e *pollEntry) { - a := pollEntryElementMapper{}.linkerFor(b).Next() - pollEntryElementMapper{}.linkerFor(e).SetNext(a) - pollEntryElementMapper{}.linkerFor(e).SetPrev(b) - pollEntryElementMapper{}.linkerFor(b).SetNext(e) + bLinker := pollEntryElementMapper{}.linkerFor(b) + eLinker := pollEntryElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { pollEntryElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *pollEntryList) InsertAfter(b, e *pollEntry) { // InsertBefore inserts e before a. func (l *pollEntryList) InsertBefore(a, e *pollEntry) { - b := pollEntryElementMapper{}.linkerFor(a).Prev() - pollEntryElementMapper{}.linkerFor(e).SetNext(a) - pollEntryElementMapper{}.linkerFor(e).SetPrev(b) - pollEntryElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := pollEntryElementMapper{}.linkerFor(a) + eLinker := pollEntryElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { pollEntryElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/futex/waiter_list.go b/pkg/sentry/kernel/futex/waiter_list.go index cca5c4721..b6baa1b5b 100755 --- a/pkg/sentry/kernel/futex/waiter_list.go +++ b/pkg/sentry/kernel/futex/waiter_list.go @@ -54,8 +54,9 @@ func (l *waiterList) Back() *Waiter { // PushFront inserts the element e at the front of list l. func (l *waiterList) PushFront(e *Waiter) { - waiterElementMapper{}.linkerFor(e).SetNext(l.head) - waiterElementMapper{}.linkerFor(e).SetPrev(nil) + linker := waiterElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { waiterElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *waiterList) PushFront(e *Waiter) { // PushBack inserts the element e at the back of list l. func (l *waiterList) PushBack(e *Waiter) { - waiterElementMapper{}.linkerFor(e).SetNext(nil) - waiterElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := waiterElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { waiterElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *waiterList) PushBackList(m *waiterList) { // InsertAfter inserts e after b. func (l *waiterList) InsertAfter(b, e *Waiter) { - a := waiterElementMapper{}.linkerFor(b).Next() - waiterElementMapper{}.linkerFor(e).SetNext(a) - waiterElementMapper{}.linkerFor(e).SetPrev(b) - waiterElementMapper{}.linkerFor(b).SetNext(e) + bLinker := waiterElementMapper{}.linkerFor(b) + eLinker := waiterElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { waiterElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *waiterList) InsertAfter(b, e *Waiter) { // InsertBefore inserts e before a. func (l *waiterList) InsertBefore(a, e *Waiter) { - b := waiterElementMapper{}.linkerFor(a).Prev() - waiterElementMapper{}.linkerFor(e).SetNext(a) - waiterElementMapper{}.linkerFor(e).SetPrev(b) - waiterElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := waiterElementMapper{}.linkerFor(a) + eLinker := waiterElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { waiterElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/pending_signals_list.go b/pkg/sentry/kernel/pending_signals_list.go index a3499371a..26b9ffd98 100755 --- a/pkg/sentry/kernel/pending_signals_list.go +++ b/pkg/sentry/kernel/pending_signals_list.go @@ -54,8 +54,9 @@ func (l *pendingSignalList) Back() *pendingSignal { // PushFront inserts the element e at the front of list l. func (l *pendingSignalList) PushFront(e *pendingSignal) { - pendingSignalElementMapper{}.linkerFor(e).SetNext(l.head) - pendingSignalElementMapper{}.linkerFor(e).SetPrev(nil) + linker := pendingSignalElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { pendingSignalElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *pendingSignalList) PushFront(e *pendingSignal) { // PushBack inserts the element e at the back of list l. func (l *pendingSignalList) PushBack(e *pendingSignal) { - pendingSignalElementMapper{}.linkerFor(e).SetNext(nil) - pendingSignalElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := pendingSignalElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { pendingSignalElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *pendingSignalList) PushBackList(m *pendingSignalList) { // InsertAfter inserts e after b. func (l *pendingSignalList) InsertAfter(b, e *pendingSignal) { - a := pendingSignalElementMapper{}.linkerFor(b).Next() - pendingSignalElementMapper{}.linkerFor(e).SetNext(a) - pendingSignalElementMapper{}.linkerFor(e).SetPrev(b) - pendingSignalElementMapper{}.linkerFor(b).SetNext(e) + bLinker := pendingSignalElementMapper{}.linkerFor(b) + eLinker := pendingSignalElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { pendingSignalElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *pendingSignalList) InsertAfter(b, e *pendingSignal) { // InsertBefore inserts e before a. func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) { - b := pendingSignalElementMapper{}.linkerFor(a).Prev() - pendingSignalElementMapper{}.linkerFor(e).SetNext(a) - pendingSignalElementMapper{}.linkerFor(e).SetPrev(b) - pendingSignalElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := pendingSignalElementMapper{}.linkerFor(a) + eLinker := pendingSignalElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { pendingSignalElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/process_group_list.go b/pkg/sentry/kernel/process_group_list.go index 853145237..2c5363c69 100755 --- a/pkg/sentry/kernel/process_group_list.go +++ b/pkg/sentry/kernel/process_group_list.go @@ -54,8 +54,9 @@ func (l *processGroupList) Back() *ProcessGroup { // PushFront inserts the element e at the front of list l. func (l *processGroupList) PushFront(e *ProcessGroup) { - processGroupElementMapper{}.linkerFor(e).SetNext(l.head) - processGroupElementMapper{}.linkerFor(e).SetPrev(nil) + linker := processGroupElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { processGroupElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *processGroupList) PushFront(e *ProcessGroup) { // PushBack inserts the element e at the back of list l. func (l *processGroupList) PushBack(e *ProcessGroup) { - processGroupElementMapper{}.linkerFor(e).SetNext(nil) - processGroupElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := processGroupElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { processGroupElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *processGroupList) PushBackList(m *processGroupList) { // InsertAfter inserts e after b. func (l *processGroupList) InsertAfter(b, e *ProcessGroup) { - a := processGroupElementMapper{}.linkerFor(b).Next() - processGroupElementMapper{}.linkerFor(e).SetNext(a) - processGroupElementMapper{}.linkerFor(e).SetPrev(b) - processGroupElementMapper{}.linkerFor(b).SetNext(e) + bLinker := processGroupElementMapper{}.linkerFor(b) + eLinker := processGroupElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { processGroupElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *processGroupList) InsertAfter(b, e *ProcessGroup) { // InsertBefore inserts e before a. func (l *processGroupList) InsertBefore(a, e *ProcessGroup) { - b := processGroupElementMapper{}.linkerFor(a).Prev() - processGroupElementMapper{}.linkerFor(e).SetNext(a) - processGroupElementMapper{}.linkerFor(e).SetPrev(b) - processGroupElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := processGroupElementMapper{}.linkerFor(a) + eLinker := processGroupElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { processGroupElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/semaphore/waiter_list.go b/pkg/sentry/kernel/semaphore/waiter_list.go index 33e29fb55..78d86900a 100755 --- a/pkg/sentry/kernel/semaphore/waiter_list.go +++ b/pkg/sentry/kernel/semaphore/waiter_list.go @@ -54,8 +54,9 @@ func (l *waiterList) Back() *waiter { // PushFront inserts the element e at the front of list l. func (l *waiterList) PushFront(e *waiter) { - waiterElementMapper{}.linkerFor(e).SetNext(l.head) - waiterElementMapper{}.linkerFor(e).SetPrev(nil) + linker := waiterElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { waiterElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *waiterList) PushFront(e *waiter) { // PushBack inserts the element e at the back of list l. func (l *waiterList) PushBack(e *waiter) { - waiterElementMapper{}.linkerFor(e).SetNext(nil) - waiterElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := waiterElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { waiterElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *waiterList) PushBackList(m *waiterList) { // InsertAfter inserts e after b. func (l *waiterList) InsertAfter(b, e *waiter) { - a := waiterElementMapper{}.linkerFor(b).Next() - waiterElementMapper{}.linkerFor(e).SetNext(a) - waiterElementMapper{}.linkerFor(e).SetPrev(b) - waiterElementMapper{}.linkerFor(b).SetNext(e) + bLinker := waiterElementMapper{}.linkerFor(b) + eLinker := waiterElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { waiterElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *waiterList) InsertAfter(b, e *waiter) { // InsertBefore inserts e before a. func (l *waiterList) InsertBefore(a, e *waiter) { - b := waiterElementMapper{}.linkerFor(a).Prev() - waiterElementMapper{}.linkerFor(e).SetNext(a) - waiterElementMapper{}.linkerFor(e).SetPrev(b) - waiterElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := waiterElementMapper{}.linkerFor(a) + eLinker := waiterElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { waiterElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/session_list.go b/pkg/sentry/kernel/session_list.go index 9ba27b164..e65688f53 100755 --- a/pkg/sentry/kernel/session_list.go +++ b/pkg/sentry/kernel/session_list.go @@ -54,8 +54,9 @@ func (l *sessionList) Back() *Session { // PushFront inserts the element e at the front of list l. func (l *sessionList) PushFront(e *Session) { - sessionElementMapper{}.linkerFor(e).SetNext(l.head) - sessionElementMapper{}.linkerFor(e).SetPrev(nil) + linker := sessionElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { sessionElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *sessionList) PushFront(e *Session) { // PushBack inserts the element e at the back of list l. func (l *sessionList) PushBack(e *Session) { - sessionElementMapper{}.linkerFor(e).SetNext(nil) - sessionElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := sessionElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { sessionElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *sessionList) PushBackList(m *sessionList) { // InsertAfter inserts e after b. func (l *sessionList) InsertAfter(b, e *Session) { - a := sessionElementMapper{}.linkerFor(b).Next() - sessionElementMapper{}.linkerFor(e).SetNext(a) - sessionElementMapper{}.linkerFor(e).SetPrev(b) - sessionElementMapper{}.linkerFor(b).SetNext(e) + bLinker := sessionElementMapper{}.linkerFor(b) + eLinker := sessionElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { sessionElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *sessionList) InsertAfter(b, e *Session) { // InsertBefore inserts e before a. func (l *sessionList) InsertBefore(a, e *Session) { - b := sessionElementMapper{}.linkerFor(a).Prev() - sessionElementMapper{}.linkerFor(e).SetNext(a) - sessionElementMapper{}.linkerFor(e).SetPrev(b) - sessionElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := sessionElementMapper{}.linkerFor(a) + eLinker := sessionElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { sessionElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/socket_list.go b/pkg/sentry/kernel/socket_list.go index aed0a555e..a3d47e381 100755 --- a/pkg/sentry/kernel/socket_list.go +++ b/pkg/sentry/kernel/socket_list.go @@ -54,8 +54,9 @@ func (l *socketList) Back() *SocketEntry { // PushFront inserts the element e at the front of list l. func (l *socketList) PushFront(e *SocketEntry) { - socketElementMapper{}.linkerFor(e).SetNext(l.head) - socketElementMapper{}.linkerFor(e).SetPrev(nil) + linker := socketElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { socketElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *socketList) PushFront(e *SocketEntry) { // PushBack inserts the element e at the back of list l. func (l *socketList) PushBack(e *SocketEntry) { - socketElementMapper{}.linkerFor(e).SetNext(nil) - socketElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := socketElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { socketElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *socketList) PushBackList(m *socketList) { // InsertAfter inserts e after b. func (l *socketList) InsertAfter(b, e *SocketEntry) { - a := socketElementMapper{}.linkerFor(b).Next() - socketElementMapper{}.linkerFor(e).SetNext(a) - socketElementMapper{}.linkerFor(e).SetPrev(b) - socketElementMapper{}.linkerFor(b).SetNext(e) + bLinker := socketElementMapper{}.linkerFor(b) + eLinker := socketElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { socketElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *socketList) InsertAfter(b, e *SocketEntry) { // InsertBefore inserts e before a. func (l *socketList) InsertBefore(a, e *SocketEntry) { - b := socketElementMapper{}.linkerFor(a).Prev() - socketElementMapper{}.linkerFor(e).SetNext(a) - socketElementMapper{}.linkerFor(e).SetPrev(b) - socketElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := socketElementMapper{}.linkerFor(a) + eLinker := socketElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { socketElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/kernel/task_list.go b/pkg/sentry/kernel/task_list.go index 57d3f098d..9b8f07b46 100755 --- a/pkg/sentry/kernel/task_list.go +++ b/pkg/sentry/kernel/task_list.go @@ -54,8 +54,9 @@ func (l *taskList) Back() *Task { // PushFront inserts the element e at the front of list l. func (l *taskList) PushFront(e *Task) { - taskElementMapper{}.linkerFor(e).SetNext(l.head) - taskElementMapper{}.linkerFor(e).SetPrev(nil) + linker := taskElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { taskElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *taskList) PushFront(e *Task) { // PushBack inserts the element e at the back of list l. func (l *taskList) PushBack(e *Task) { - taskElementMapper{}.linkerFor(e).SetNext(nil) - taskElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := taskElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { taskElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *taskList) PushBackList(m *taskList) { // InsertAfter inserts e after b. func (l *taskList) InsertAfter(b, e *Task) { - a := taskElementMapper{}.linkerFor(b).Next() - taskElementMapper{}.linkerFor(e).SetNext(a) - taskElementMapper{}.linkerFor(e).SetPrev(b) - taskElementMapper{}.linkerFor(b).SetNext(e) + bLinker := taskElementMapper{}.linkerFor(b) + eLinker := taskElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { taskElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *taskList) InsertAfter(b, e *Task) { // InsertBefore inserts e before a. func (l *taskList) InsertBefore(a, e *Task) { - b := taskElementMapper{}.linkerFor(a).Prev() - taskElementMapper{}.linkerFor(e).SetNext(a) - taskElementMapper{}.linkerFor(e).SetPrev(b) - taskElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := taskElementMapper{}.linkerFor(a) + eLinker := taskElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { taskElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/mm/io_list.go b/pkg/sentry/mm/io_list.go index 99c83c4b9..ecb9d4b04 100755 --- a/pkg/sentry/mm/io_list.go +++ b/pkg/sentry/mm/io_list.go @@ -54,8 +54,9 @@ func (l *ioList) Back() *ioResult { // PushFront inserts the element e at the front of list l. func (l *ioList) PushFront(e *ioResult) { - ioElementMapper{}.linkerFor(e).SetNext(l.head) - ioElementMapper{}.linkerFor(e).SetPrev(nil) + linker := ioElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { ioElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *ioList) PushFront(e *ioResult) { // PushBack inserts the element e at the back of list l. func (l *ioList) PushBack(e *ioResult) { - ioElementMapper{}.linkerFor(e).SetNext(nil) - ioElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := ioElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { ioElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *ioList) PushBackList(m *ioList) { // InsertAfter inserts e after b. func (l *ioList) InsertAfter(b, e *ioResult) { - a := ioElementMapper{}.linkerFor(b).Next() - ioElementMapper{}.linkerFor(e).SetNext(a) - ioElementMapper{}.linkerFor(e).SetPrev(b) - ioElementMapper{}.linkerFor(b).SetNext(e) + bLinker := ioElementMapper{}.linkerFor(b) + eLinker := ioElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { ioElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *ioList) InsertAfter(b, e *ioResult) { // InsertBefore inserts e before a. func (l *ioList) InsertBefore(a, e *ioResult) { - b := ioElementMapper{}.linkerFor(a).Prev() - ioElementMapper{}.linkerFor(e).SetNext(a) - ioElementMapper{}.linkerFor(e).SetPrev(b) - ioElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := ioElementMapper{}.linkerFor(a) + eLinker := ioElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { ioElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/socket/unix/transport/transport_message_list.go b/pkg/sentry/socket/unix/transport/transport_message_list.go index 6d394860c..565a821bd 100755 --- a/pkg/sentry/socket/unix/transport/transport_message_list.go +++ b/pkg/sentry/socket/unix/transport/transport_message_list.go @@ -54,8 +54,9 @@ func (l *messageList) Back() *message { // PushFront inserts the element e at the front of list l. func (l *messageList) PushFront(e *message) { - messageElementMapper{}.linkerFor(e).SetNext(l.head) - messageElementMapper{}.linkerFor(e).SetPrev(nil) + linker := messageElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { messageElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *messageList) PushFront(e *message) { // PushBack inserts the element e at the back of list l. func (l *messageList) PushBack(e *message) { - messageElementMapper{}.linkerFor(e).SetNext(nil) - messageElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := messageElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { messageElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *messageList) PushBackList(m *messageList) { // InsertAfter inserts e after b. func (l *messageList) InsertAfter(b, e *message) { - a := messageElementMapper{}.linkerFor(b).Next() - messageElementMapper{}.linkerFor(e).SetNext(a) - messageElementMapper{}.linkerFor(e).SetPrev(b) - messageElementMapper{}.linkerFor(b).SetNext(e) + bLinker := messageElementMapper{}.linkerFor(b) + eLinker := messageElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { messageElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *messageList) InsertAfter(b, e *message) { // InsertBefore inserts e before a. func (l *messageList) InsertBefore(a, e *message) { - b := messageElementMapper{}.linkerFor(a).Prev() - messageElementMapper{}.linkerFor(e).SetNext(a) - messageElementMapper{}.linkerFor(e).SetPrev(b) - messageElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := messageElementMapper{}.linkerFor(a) + eLinker := messageElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { messageElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/sentry/vfs/epoll_interest_list.go b/pkg/sentry/vfs/epoll_interest_list.go index 16cf878cd..011373f0f 100755 --- a/pkg/sentry/vfs/epoll_interest_list.go +++ b/pkg/sentry/vfs/epoll_interest_list.go @@ -54,8 +54,9 @@ func (l *epollInterestList) Back() *epollInterest { // PushFront inserts the element e at the front of list l. func (l *epollInterestList) PushFront(e *epollInterest) { - epollInterestElementMapper{}.linkerFor(e).SetNext(l.head) - epollInterestElementMapper{}.linkerFor(e).SetPrev(nil) + linker := epollInterestElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { epollInterestElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *epollInterestList) PushFront(e *epollInterest) { // PushBack inserts the element e at the back of list l. func (l *epollInterestList) PushBack(e *epollInterest) { - epollInterestElementMapper{}.linkerFor(e).SetNext(nil) - epollInterestElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := epollInterestElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { epollInterestElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *epollInterestList) PushBackList(m *epollInterestList) { // InsertAfter inserts e after b. func (l *epollInterestList) InsertAfter(b, e *epollInterest) { - a := epollInterestElementMapper{}.linkerFor(b).Next() - epollInterestElementMapper{}.linkerFor(e).SetNext(a) - epollInterestElementMapper{}.linkerFor(e).SetPrev(b) - epollInterestElementMapper{}.linkerFor(b).SetNext(e) + bLinker := epollInterestElementMapper{}.linkerFor(b) + eLinker := epollInterestElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { epollInterestElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *epollInterestList) InsertAfter(b, e *epollInterest) { // InsertBefore inserts e before a. func (l *epollInterestList) InsertBefore(a, e *epollInterest) { - b := epollInterestElementMapper{}.linkerFor(a).Prev() - epollInterestElementMapper{}.linkerFor(e).SetNext(a) - epollInterestElementMapper{}.linkerFor(e).SetPrev(b) - epollInterestElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := epollInterestElementMapper{}.linkerFor(a) + eLinker := epollInterestElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { epollInterestElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/network/fragmentation/reassembler_list.go b/pkg/tcpip/network/fragmentation/reassembler_list.go index 3189cae29..d571d7ae5 100755 --- a/pkg/tcpip/network/fragmentation/reassembler_list.go +++ b/pkg/tcpip/network/fragmentation/reassembler_list.go @@ -54,8 +54,9 @@ func (l *reassemblerList) Back() *reassembler { // PushFront inserts the element e at the front of list l. func (l *reassemblerList) PushFront(e *reassembler) { - reassemblerElementMapper{}.linkerFor(e).SetNext(l.head) - reassemblerElementMapper{}.linkerFor(e).SetPrev(nil) + linker := reassemblerElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { reassemblerElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *reassemblerList) PushFront(e *reassembler) { // PushBack inserts the element e at the back of list l. func (l *reassemblerList) PushBack(e *reassembler) { - reassemblerElementMapper{}.linkerFor(e).SetNext(nil) - reassemblerElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := reassemblerElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { reassemblerElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *reassemblerList) PushBackList(m *reassemblerList) { // InsertAfter inserts e after b. func (l *reassemblerList) InsertAfter(b, e *reassembler) { - a := reassemblerElementMapper{}.linkerFor(b).Next() - reassemblerElementMapper{}.linkerFor(e).SetNext(a) - reassemblerElementMapper{}.linkerFor(e).SetPrev(b) - reassemblerElementMapper{}.linkerFor(b).SetNext(e) + bLinker := reassemblerElementMapper{}.linkerFor(b) + eLinker := reassemblerElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { reassemblerElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *reassemblerList) InsertAfter(b, e *reassembler) { // InsertBefore inserts e before a. func (l *reassemblerList) InsertBefore(a, e *reassembler) { - b := reassemblerElementMapper{}.linkerFor(a).Prev() - reassemblerElementMapper{}.linkerFor(e).SetNext(a) - reassemblerElementMapper{}.linkerFor(e).SetPrev(b) - reassemblerElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := reassemblerElementMapper{}.linkerFor(a) + eLinker := reassemblerElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { reassemblerElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/stack/linkaddrentry_list.go b/pkg/tcpip/stack/linkaddrentry_list.go index 61a45ddcb..1494aeca1 100755 --- a/pkg/tcpip/stack/linkaddrentry_list.go +++ b/pkg/tcpip/stack/linkaddrentry_list.go @@ -54,8 +54,9 @@ func (l *linkAddrEntryList) Back() *linkAddrEntry { // PushFront inserts the element e at the front of list l. func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) { - linkAddrEntryElementMapper{}.linkerFor(e).SetNext(l.head) - linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(nil) + linker := linkAddrEntryElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { linkAddrEntryElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) { // PushBack inserts the element e at the back of list l. func (l *linkAddrEntryList) PushBack(e *linkAddrEntry) { - linkAddrEntryElementMapper{}.linkerFor(e).SetNext(nil) - linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := linkAddrEntryElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { linkAddrEntryElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *linkAddrEntryList) PushBackList(m *linkAddrEntryList) { // InsertAfter inserts e after b. func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) { - a := linkAddrEntryElementMapper{}.linkerFor(b).Next() - linkAddrEntryElementMapper{}.linkerFor(e).SetNext(a) - linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(b) - linkAddrEntryElementMapper{}.linkerFor(b).SetNext(e) + bLinker := linkAddrEntryElementMapper{}.linkerFor(b) + eLinker := linkAddrEntryElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { linkAddrEntryElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) { // InsertBefore inserts e before a. func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) { - b := linkAddrEntryElementMapper{}.linkerFor(a).Prev() - linkAddrEntryElementMapper{}.linkerFor(e).SetNext(a) - linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(b) - linkAddrEntryElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := linkAddrEntryElementMapper{}.linkerFor(a) + eLinker := linkAddrEntryElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { linkAddrEntryElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/transport/icmp/icmp_packet_list.go b/pkg/tcpip/transport/icmp/icmp_packet_list.go index 1b35e5b4a..deeab60ae 100755 --- a/pkg/tcpip/transport/icmp/icmp_packet_list.go +++ b/pkg/tcpip/transport/icmp/icmp_packet_list.go @@ -54,8 +54,9 @@ func (l *icmpPacketList) Back() *icmpPacket { // PushFront inserts the element e at the front of list l. func (l *icmpPacketList) PushFront(e *icmpPacket) { - icmpPacketElementMapper{}.linkerFor(e).SetNext(l.head) - icmpPacketElementMapper{}.linkerFor(e).SetPrev(nil) + linker := icmpPacketElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { icmpPacketElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *icmpPacketList) PushFront(e *icmpPacket) { // PushBack inserts the element e at the back of list l. func (l *icmpPacketList) PushBack(e *icmpPacket) { - icmpPacketElementMapper{}.linkerFor(e).SetNext(nil) - icmpPacketElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := icmpPacketElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { icmpPacketElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *icmpPacketList) PushBackList(m *icmpPacketList) { // InsertAfter inserts e after b. func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) { - a := icmpPacketElementMapper{}.linkerFor(b).Next() - icmpPacketElementMapper{}.linkerFor(e).SetNext(a) - icmpPacketElementMapper{}.linkerFor(e).SetPrev(b) - icmpPacketElementMapper{}.linkerFor(b).SetNext(e) + bLinker := icmpPacketElementMapper{}.linkerFor(b) + eLinker := icmpPacketElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { icmpPacketElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) { // InsertBefore inserts e before a. func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) { - b := icmpPacketElementMapper{}.linkerFor(a).Prev() - icmpPacketElementMapper{}.linkerFor(e).SetNext(a) - icmpPacketElementMapper{}.linkerFor(e).SetPrev(b) - icmpPacketElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := icmpPacketElementMapper{}.linkerFor(a) + eLinker := icmpPacketElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { icmpPacketElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/transport/packet/packet_list.go b/pkg/tcpip/transport/packet/packet_list.go index 0da0dfcb6..e8c4cba0d 100755 --- a/pkg/tcpip/transport/packet/packet_list.go +++ b/pkg/tcpip/transport/packet/packet_list.go @@ -54,8 +54,9 @@ func (l *packetList) Back() *packet { // PushFront inserts the element e at the front of list l. func (l *packetList) PushFront(e *packet) { - packetElementMapper{}.linkerFor(e).SetNext(l.head) - packetElementMapper{}.linkerFor(e).SetPrev(nil) + linker := packetElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { packetElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *packetList) PushFront(e *packet) { // PushBack inserts the element e at the back of list l. func (l *packetList) PushBack(e *packet) { - packetElementMapper{}.linkerFor(e).SetNext(nil) - packetElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := packetElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { packetElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *packetList) PushBackList(m *packetList) { // InsertAfter inserts e after b. func (l *packetList) InsertAfter(b, e *packet) { - a := packetElementMapper{}.linkerFor(b).Next() - packetElementMapper{}.linkerFor(e).SetNext(a) - packetElementMapper{}.linkerFor(e).SetPrev(b) - packetElementMapper{}.linkerFor(b).SetNext(e) + bLinker := packetElementMapper{}.linkerFor(b) + eLinker := packetElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { packetElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *packetList) InsertAfter(b, e *packet) { // InsertBefore inserts e before a. func (l *packetList) InsertBefore(a, e *packet) { - b := packetElementMapper{}.linkerFor(a).Prev() - packetElementMapper{}.linkerFor(e).SetNext(a) - packetElementMapper{}.linkerFor(e).SetPrev(b) - packetElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := packetElementMapper{}.linkerFor(a) + eLinker := packetElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { packetElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/transport/raw/raw_packet_list.go b/pkg/tcpip/transport/raw/raw_packet_list.go index 12edb4334..a0138e8cc 100755 --- a/pkg/tcpip/transport/raw/raw_packet_list.go +++ b/pkg/tcpip/transport/raw/raw_packet_list.go @@ -54,8 +54,9 @@ func (l *rawPacketList) Back() *rawPacket { // PushFront inserts the element e at the front of list l. func (l *rawPacketList) PushFront(e *rawPacket) { - rawPacketElementMapper{}.linkerFor(e).SetNext(l.head) - rawPacketElementMapper{}.linkerFor(e).SetPrev(nil) + linker := rawPacketElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { rawPacketElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *rawPacketList) PushFront(e *rawPacket) { // PushBack inserts the element e at the back of list l. func (l *rawPacketList) PushBack(e *rawPacket) { - rawPacketElementMapper{}.linkerFor(e).SetNext(nil) - rawPacketElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := rawPacketElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { rawPacketElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *rawPacketList) PushBackList(m *rawPacketList) { // InsertAfter inserts e after b. func (l *rawPacketList) InsertAfter(b, e *rawPacket) { - a := rawPacketElementMapper{}.linkerFor(b).Next() - rawPacketElementMapper{}.linkerFor(e).SetNext(a) - rawPacketElementMapper{}.linkerFor(e).SetPrev(b) - rawPacketElementMapper{}.linkerFor(b).SetNext(e) + bLinker := rawPacketElementMapper{}.linkerFor(b) + eLinker := rawPacketElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { rawPacketElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *rawPacketList) InsertAfter(b, e *rawPacket) { // InsertBefore inserts e before a. func (l *rawPacketList) InsertBefore(a, e *rawPacket) { - b := rawPacketElementMapper{}.linkerFor(a).Prev() - rawPacketElementMapper{}.linkerFor(e).SetNext(a) - rawPacketElementMapper{}.linkerFor(e).SetPrev(b) - rawPacketElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := rawPacketElementMapper{}.linkerFor(a) + eLinker := rawPacketElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { rawPacketElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go index 42e190060..32ac43dca 100755 --- a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go +++ b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go @@ -54,8 +54,9 @@ func (l *endpointList) Back() *endpoint { // PushFront inserts the element e at the front of list l. func (l *endpointList) PushFront(e *endpoint) { - endpointElementMapper{}.linkerFor(e).SetNext(l.head) - endpointElementMapper{}.linkerFor(e).SetPrev(nil) + linker := endpointElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { endpointElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *endpointList) PushFront(e *endpoint) { // PushBack inserts the element e at the back of list l. func (l *endpointList) PushBack(e *endpoint) { - endpointElementMapper{}.linkerFor(e).SetNext(nil) - endpointElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := endpointElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { endpointElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *endpointList) PushBackList(m *endpointList) { // InsertAfter inserts e after b. func (l *endpointList) InsertAfter(b, e *endpoint) { - a := endpointElementMapper{}.linkerFor(b).Next() - endpointElementMapper{}.linkerFor(e).SetNext(a) - endpointElementMapper{}.linkerFor(e).SetPrev(b) - endpointElementMapper{}.linkerFor(b).SetNext(e) + bLinker := endpointElementMapper{}.linkerFor(b) + eLinker := endpointElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { endpointElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *endpointList) InsertAfter(b, e *endpoint) { // InsertBefore inserts e before a. func (l *endpointList) InsertBefore(a, e *endpoint) { - b := endpointElementMapper{}.linkerFor(a).Prev() - endpointElementMapper{}.linkerFor(e).SetNext(a) - endpointElementMapper{}.linkerFor(e).SetPrev(b) - endpointElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := endpointElementMapper{}.linkerFor(a) + eLinker := endpointElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { endpointElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/transport/tcp/tcp_segment_list.go b/pkg/tcpip/transport/tcp/tcp_segment_list.go index 029f98a11..9b21b87ad 100755 --- a/pkg/tcpip/transport/tcp/tcp_segment_list.go +++ b/pkg/tcpip/transport/tcp/tcp_segment_list.go @@ -54,8 +54,9 @@ func (l *segmentList) Back() *segment { // PushFront inserts the element e at the front of list l. func (l *segmentList) PushFront(e *segment) { - segmentElementMapper{}.linkerFor(e).SetNext(l.head) - segmentElementMapper{}.linkerFor(e).SetPrev(nil) + linker := segmentElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { segmentElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *segmentList) PushFront(e *segment) { // PushBack inserts the element e at the back of list l. func (l *segmentList) PushBack(e *segment) { - segmentElementMapper{}.linkerFor(e).SetNext(nil) - segmentElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := segmentElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { segmentElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *segmentList) PushBackList(m *segmentList) { // InsertAfter inserts e after b. func (l *segmentList) InsertAfter(b, e *segment) { - a := segmentElementMapper{}.linkerFor(b).Next() - segmentElementMapper{}.linkerFor(e).SetNext(a) - segmentElementMapper{}.linkerFor(e).SetPrev(b) - segmentElementMapper{}.linkerFor(b).SetNext(e) + bLinker := segmentElementMapper{}.linkerFor(b) + eLinker := segmentElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { segmentElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *segmentList) InsertAfter(b, e *segment) { // InsertBefore inserts e before a. func (l *segmentList) InsertBefore(a, e *segment) { - b := segmentElementMapper{}.linkerFor(a).Prev() - segmentElementMapper{}.linkerFor(e).SetNext(a) - segmentElementMapper{}.linkerFor(e).SetPrev(b) - segmentElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := segmentElementMapper{}.linkerFor(a) + eLinker := segmentElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { segmentElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go index 673a9373b..00535d242 100755 --- a/pkg/tcpip/transport/udp/udp_packet_list.go +++ b/pkg/tcpip/transport/udp/udp_packet_list.go @@ -54,8 +54,9 @@ func (l *udpPacketList) Back() *udpPacket { // PushFront inserts the element e at the front of list l. func (l *udpPacketList) PushFront(e *udpPacket) { - udpPacketElementMapper{}.linkerFor(e).SetNext(l.head) - udpPacketElementMapper{}.linkerFor(e).SetPrev(nil) + linker := udpPacketElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { udpPacketElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *udpPacketList) PushFront(e *udpPacket) { // PushBack inserts the element e at the back of list l. func (l *udpPacketList) PushBack(e *udpPacket) { - udpPacketElementMapper{}.linkerFor(e).SetNext(nil) - udpPacketElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := udpPacketElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { udpPacketElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *udpPacketList) PushBackList(m *udpPacketList) { // InsertAfter inserts e after b. func (l *udpPacketList) InsertAfter(b, e *udpPacket) { - a := udpPacketElementMapper{}.linkerFor(b).Next() - udpPacketElementMapper{}.linkerFor(e).SetNext(a) - udpPacketElementMapper{}.linkerFor(e).SetPrev(b) - udpPacketElementMapper{}.linkerFor(b).SetNext(e) + bLinker := udpPacketElementMapper{}.linkerFor(b) + eLinker := udpPacketElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { udpPacketElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *udpPacketList) InsertAfter(b, e *udpPacket) { // InsertBefore inserts e before a. func (l *udpPacketList) InsertBefore(a, e *udpPacket) { - b := udpPacketElementMapper{}.linkerFor(a).Prev() - udpPacketElementMapper{}.linkerFor(e).SetNext(a) - udpPacketElementMapper{}.linkerFor(e).SetPrev(b) - udpPacketElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := udpPacketElementMapper{}.linkerFor(a) + eLinker := udpPacketElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { udpPacketElementMapper{}.linkerFor(b).SetNext(e) diff --git a/pkg/waiter/waiter_list.go b/pkg/waiter/waiter_list.go index 00b304a31..02fdb730d 100755 --- a/pkg/waiter/waiter_list.go +++ b/pkg/waiter/waiter_list.go @@ -54,8 +54,9 @@ func (l *waiterList) Back() *Entry { // PushFront inserts the element e at the front of list l. func (l *waiterList) PushFront(e *Entry) { - waiterElementMapper{}.linkerFor(e).SetNext(l.head) - waiterElementMapper{}.linkerFor(e).SetPrev(nil) + linker := waiterElementMapper{}.linkerFor(e) + linker.SetNext(l.head) + linker.SetPrev(nil) if l.head != nil { waiterElementMapper{}.linkerFor(l.head).SetPrev(e) @@ -68,8 +69,9 @@ func (l *waiterList) PushFront(e *Entry) { // PushBack inserts the element e at the back of list l. func (l *waiterList) PushBack(e *Entry) { - waiterElementMapper{}.linkerFor(e).SetNext(nil) - waiterElementMapper{}.linkerFor(e).SetPrev(l.tail) + linker := waiterElementMapper{}.linkerFor(e) + linker.SetNext(nil) + linker.SetPrev(l.tail) if l.tail != nil { waiterElementMapper{}.linkerFor(l.tail).SetNext(e) @@ -98,10 +100,14 @@ func (l *waiterList) PushBackList(m *waiterList) { // InsertAfter inserts e after b. func (l *waiterList) InsertAfter(b, e *Entry) { - a := waiterElementMapper{}.linkerFor(b).Next() - waiterElementMapper{}.linkerFor(e).SetNext(a) - waiterElementMapper{}.linkerFor(e).SetPrev(b) - waiterElementMapper{}.linkerFor(b).SetNext(e) + bLinker := waiterElementMapper{}.linkerFor(b) + eLinker := waiterElementMapper{}.linkerFor(e) + + a := bLinker.Next() + + eLinker.SetNext(a) + eLinker.SetPrev(b) + bLinker.SetNext(e) if a != nil { waiterElementMapper{}.linkerFor(a).SetPrev(e) @@ -112,10 +118,13 @@ func (l *waiterList) InsertAfter(b, e *Entry) { // InsertBefore inserts e before a. func (l *waiterList) InsertBefore(a, e *Entry) { - b := waiterElementMapper{}.linkerFor(a).Prev() - waiterElementMapper{}.linkerFor(e).SetNext(a) - waiterElementMapper{}.linkerFor(e).SetPrev(b) - waiterElementMapper{}.linkerFor(a).SetPrev(e) + aLinker := waiterElementMapper{}.linkerFor(a) + eLinker := waiterElementMapper{}.linkerFor(e) + + b := aLinker.Prev() + eLinker.SetNext(a) + eLinker.SetPrev(b) + aLinker.SetPrev(e) if b != nil { waiterElementMapper{}.linkerFor(b).SetNext(e) |