diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-11 21:27:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-11 21:27:53 +0000 |
commit | e524c21569616484e3209be952dd90636209419e (patch) | |
tree | d425976e5c7d7499187b93feb31d97fbd11408bf | |
parent | 3ff3110fcdd696053e8cafc807f2409fe1269cce (diff) | |
parent | 4c4de66443174f2ed7f4fa533a1d09c709be9427 (diff) |
Merge release-20201216.0-82-g4c4de6644 (automated)
37 files changed, 1036 insertions, 0 deletions
diff --git a/pkg/buffer/buffer_list.go b/pkg/buffer/buffer_list.go index 891ea961a..6b5bea3fc 100644 --- a/pkg/buffer/buffer_list.go +++ b/pkg/buffer/buffer_list.go @@ -38,16 +38,22 @@ func (l *bufferList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *bufferList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *bufferList) Front() *buffer { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *bufferList) Back() *buffer { return l.tail } @@ -55,6 +61,8 @@ func (l *bufferList) Back() *buffer { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *bufferList) Len() (count int) { for e := l.Front(); e != nil; e = (bufferElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *bufferList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *bufferList) PushFront(e *buffer) { linker := bufferElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *bufferList) PushFront(e *buffer) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *bufferList) PushBack(e *buffer) { linker := bufferElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *bufferList) PushBack(e *buffer) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *bufferList) PushBackList(m *bufferList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *bufferList) PushBackList(m *bufferList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *bufferList) InsertAfter(b, e *buffer) { bLinker := bufferElementMapper{}.linkerFor(b) eLinker := bufferElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *bufferList) InsertAfter(b, e *buffer) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *bufferList) InsertBefore(a, e *buffer) { aLinker := bufferElementMapper{}.linkerFor(a) eLinker := bufferElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *bufferList) InsertBefore(a, e *buffer) { } // Remove removes e from l. +// +//go:nosplit func (l *bufferList) Remove(e *buffer) { linker := bufferElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type bufferEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *bufferEntry) Next() *buffer { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *bufferEntry) Prev() *buffer { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *bufferEntry) SetNext(elem *buffer) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *bufferEntry) SetPrev(elem *buffer) { e.prev = elem } diff --git a/pkg/ilist/interface_list.go b/pkg/ilist/interface_list.go index 80c655830..4d6062d7f 100644 --- a/pkg/ilist/interface_list.go +++ b/pkg/ilist/interface_list.go @@ -57,16 +57,22 @@ func (l *List) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *List) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *List) Front() Element { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *List) Back() Element { return l.tail } @@ -74,6 +80,8 @@ func (l *List) Back() Element { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *List) Len() (count int) { for e := l.Front(); e != nil; e = (ElementMapper{}.linkerFor(e)).Next() { count++ @@ -82,6 +90,8 @@ func (l *List) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *List) PushFront(e Element) { linker := ElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -96,6 +106,8 @@ func (l *List) PushFront(e Element) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *List) PushBack(e Element) { linker := ElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -110,6 +122,8 @@ func (l *List) PushBack(e Element) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *List) PushBackList(m *List) { if l.head == nil { l.head = m.head @@ -125,6 +139,8 @@ func (l *List) PushBackList(m *List) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *List) InsertAfter(b, e Element) { bLinker := ElementMapper{}.linkerFor(b) eLinker := ElementMapper{}.linkerFor(e) @@ -143,6 +159,8 @@ func (l *List) InsertAfter(b, e Element) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *List) InsertBefore(a, e Element) { aLinker := ElementMapper{}.linkerFor(a) eLinker := ElementMapper{}.linkerFor(e) @@ -160,6 +178,8 @@ func (l *List) InsertBefore(a, e Element) { } // Remove removes e from l. +// +//go:nosplit func (l *List) Remove(e Element) { linker := ElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -192,21 +212,29 @@ type Entry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *Entry) Next() Element { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *Entry) Prev() Element { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *Entry) SetNext(elem Element) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *Entry) SetPrev(elem Element) { e.prev = elem } diff --git a/pkg/refs/weak_ref_list.go b/pkg/refs/weak_ref_list.go index 31460bfc3..920e89eb3 100644 --- a/pkg/refs/weak_ref_list.go +++ b/pkg/refs/weak_ref_list.go @@ -38,16 +38,22 @@ func (l *weakRefList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *weakRefList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *weakRefList) Front() *WeakRef { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *weakRefList) Back() *WeakRef { return l.tail } @@ -55,6 +61,8 @@ func (l *weakRefList) Back() *WeakRef { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *weakRefList) Len() (count int) { for e := l.Front(); e != nil; e = (weakRefElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *weakRefList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *weakRefList) PushFront(e *WeakRef) { linker := weakRefElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *weakRefList) PushFront(e *WeakRef) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *weakRefList) PushBack(e *WeakRef) { linker := weakRefElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *weakRefList) PushBack(e *WeakRef) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *weakRefList) PushBackList(m *weakRefList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *weakRefList) PushBackList(m *weakRefList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *weakRefList) InsertAfter(b, e *WeakRef) { bLinker := weakRefElementMapper{}.linkerFor(b) eLinker := weakRefElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *weakRefList) InsertAfter(b, e *WeakRef) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *weakRefList) InsertBefore(a, e *WeakRef) { aLinker := weakRefElementMapper{}.linkerFor(a) eLinker := weakRefElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *weakRefList) InsertBefore(a, e *WeakRef) { } // Remove removes e from l. +// +//go:nosplit func (l *weakRefList) Remove(e *WeakRef) { linker := weakRefElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type weakRefEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *weakRefEntry) Next() *WeakRef { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *weakRefEntry) Prev() *WeakRef { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *weakRefEntry) SetNext(elem *WeakRef) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *weakRefEntry) SetPrev(elem *WeakRef) { e.prev = elem } diff --git a/pkg/sentry/fs/dirent_list.go b/pkg/sentry/fs/dirent_list.go index 357ea925d..00dd39146 100644 --- a/pkg/sentry/fs/dirent_list.go +++ b/pkg/sentry/fs/dirent_list.go @@ -38,16 +38,22 @@ func (l *direntList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *direntList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *direntList) Front() *Dirent { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *direntList) Back() *Dirent { return l.tail } @@ -55,6 +61,8 @@ func (l *direntList) Back() *Dirent { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *direntList) Len() (count int) { for e := l.Front(); e != nil; e = (direntElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *direntList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *direntList) PushFront(e *Dirent) { linker := direntElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *direntList) PushFront(e *Dirent) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *direntList) PushBack(e *Dirent) { linker := direntElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *direntList) PushBack(e *Dirent) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *direntList) PushBackList(m *direntList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *direntList) PushBackList(m *direntList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *direntList) InsertAfter(b, e *Dirent) { bLinker := direntElementMapper{}.linkerFor(b) eLinker := direntElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *direntList) InsertAfter(b, e *Dirent) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *direntList) InsertBefore(a, e *Dirent) { aLinker := direntElementMapper{}.linkerFor(a) eLinker := direntElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *direntList) InsertBefore(a, e *Dirent) { } // Remove removes e from l. +// +//go:nosplit func (l *direntList) Remove(e *Dirent) { linker := direntElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type direntEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *direntEntry) Next() *Dirent { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *direntEntry) Prev() *Dirent { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *direntEntry) SetNext(elem *Dirent) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *direntEntry) SetPrev(elem *Dirent) { e.prev = elem } diff --git a/pkg/sentry/fs/event_list.go b/pkg/sentry/fs/event_list.go index 277d8458e..ceb97b703 100644 --- a/pkg/sentry/fs/event_list.go +++ b/pkg/sentry/fs/event_list.go @@ -38,16 +38,22 @@ func (l *eventList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *eventList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *eventList) Front() *Event { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *eventList) Back() *Event { return l.tail } @@ -55,6 +61,8 @@ func (l *eventList) Back() *Event { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *eventList) Len() (count int) { for e := l.Front(); e != nil; e = (eventElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *eventList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *eventList) PushFront(e *Event) { linker := eventElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *eventList) PushFront(e *Event) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *eventList) PushBack(e *Event) { linker := eventElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *eventList) PushBack(e *Event) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *eventList) PushBackList(m *eventList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *eventList) PushBackList(m *eventList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *eventList) InsertAfter(b, e *Event) { bLinker := eventElementMapper{}.linkerFor(b) eLinker := eventElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *eventList) InsertAfter(b, e *Event) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *eventList) InsertBefore(a, e *Event) { aLinker := eventElementMapper{}.linkerFor(a) eLinker := eventElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *eventList) InsertBefore(a, e *Event) { } // Remove removes e from l. +// +//go:nosplit func (l *eventList) Remove(e *Event) { linker := eventElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type eventEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *eventEntry) Next() *Event { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *eventEntry) Prev() *Event { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *eventEntry) SetNext(elem *Event) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *eventEntry) SetPrev(elem *Event) { e.prev = elem } diff --git a/pkg/sentry/fsimpl/fuse/request_list.go b/pkg/sentry/fsimpl/fuse/request_list.go index 002262f23..060ac4a3f 100644 --- a/pkg/sentry/fsimpl/fuse/request_list.go +++ b/pkg/sentry/fsimpl/fuse/request_list.go @@ -38,16 +38,22 @@ func (l *requestList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *requestList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *requestList) Front() *Request { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *requestList) Back() *Request { return l.tail } @@ -55,6 +61,8 @@ func (l *requestList) Back() *Request { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *requestList) Len() (count int) { for e := l.Front(); e != nil; e = (requestElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *requestList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *requestList) PushFront(e *Request) { linker := requestElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *requestList) PushFront(e *Request) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *requestList) PushBack(e *Request) { linker := requestElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *requestList) PushBack(e *Request) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *requestList) PushBackList(m *requestList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *requestList) PushBackList(m *requestList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *requestList) InsertAfter(b, e *Request) { bLinker := requestElementMapper{}.linkerFor(b) eLinker := requestElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *requestList) InsertAfter(b, e *Request) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *requestList) InsertBefore(a, e *Request) { aLinker := requestElementMapper{}.linkerFor(a) eLinker := requestElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *requestList) InsertBefore(a, e *Request) { } // Remove removes e from l. +// +//go:nosplit func (l *requestList) Remove(e *Request) { linker := requestElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type requestEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *requestEntry) Next() *Request { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *requestEntry) Prev() *Request { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *requestEntry) SetNext(elem *Request) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *requestEntry) SetPrev(elem *Request) { e.prev = elem } diff --git a/pkg/sentry/fsimpl/gofer/dentry_list.go b/pkg/sentry/fsimpl/gofer/dentry_list.go index 84f839e3a..2e43b8e02 100644 --- a/pkg/sentry/fsimpl/gofer/dentry_list.go +++ b/pkg/sentry/fsimpl/gofer/dentry_list.go @@ -38,16 +38,22 @@ func (l *dentryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *dentryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *dentryList) Front() *dentry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *dentryList) Back() *dentry { return l.tail } @@ -55,6 +61,8 @@ func (l *dentryList) Back() *dentry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *dentryList) Len() (count int) { for e := l.Front(); e != nil; e = (dentryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *dentryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *dentryList) PushFront(e *dentry) { linker := dentryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *dentryList) PushFront(e *dentry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *dentryList) PushBack(e *dentry) { linker := dentryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *dentryList) PushBack(e *dentry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *dentryList) PushBackList(m *dentryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *dentryList) PushBackList(m *dentryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *dentryList) InsertAfter(b, e *dentry) { bLinker := dentryElementMapper{}.linkerFor(b) eLinker := dentryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *dentryList) InsertAfter(b, e *dentry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *dentryList) InsertBefore(a, e *dentry) { aLinker := dentryElementMapper{}.linkerFor(a) eLinker := dentryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *dentryList) InsertBefore(a, e *dentry) { } // Remove removes e from l. +// +//go:nosplit func (l *dentryList) Remove(e *dentry) { linker := dentryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type dentryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *dentryEntry) Next() *dentry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *dentryEntry) Prev() *dentry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *dentryEntry) SetNext(elem *dentry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *dentryEntry) SetPrev(elem *dentry) { e.prev = elem } diff --git a/pkg/sentry/fsimpl/kernfs/dentry_list.go b/pkg/sentry/fsimpl/kernfs/dentry_list.go index 06101fa32..e73cde1f1 100644 --- a/pkg/sentry/fsimpl/kernfs/dentry_list.go +++ b/pkg/sentry/fsimpl/kernfs/dentry_list.go @@ -38,16 +38,22 @@ func (l *dentryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *dentryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *dentryList) Front() *Dentry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *dentryList) Back() *Dentry { return l.tail } @@ -55,6 +61,8 @@ func (l *dentryList) Back() *Dentry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *dentryList) Len() (count int) { for e := l.Front(); e != nil; e = (dentryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *dentryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *dentryList) PushFront(e *Dentry) { linker := dentryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *dentryList) PushFront(e *Dentry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *dentryList) PushBack(e *Dentry) { linker := dentryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *dentryList) PushBack(e *Dentry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *dentryList) PushBackList(m *dentryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *dentryList) PushBackList(m *dentryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *dentryList) InsertAfter(b, e *Dentry) { bLinker := dentryElementMapper{}.linkerFor(b) eLinker := dentryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *dentryList) InsertAfter(b, e *Dentry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *dentryList) InsertBefore(a, e *Dentry) { aLinker := dentryElementMapper{}.linkerFor(a) eLinker := dentryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *dentryList) InsertBefore(a, e *Dentry) { } // Remove removes e from l. +// +//go:nosplit func (l *dentryList) Remove(e *Dentry) { linker := dentryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type dentryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *dentryEntry) Next() *Dentry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *dentryEntry) Prev() *Dentry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *dentryEntry) SetNext(elem *Dentry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *dentryEntry) SetPrev(elem *Dentry) { e.prev = elem } diff --git a/pkg/sentry/fsimpl/kernfs/slot_list.go b/pkg/sentry/fsimpl/kernfs/slot_list.go index c6cd74660..181fe7c8f 100644 --- a/pkg/sentry/fsimpl/kernfs/slot_list.go +++ b/pkg/sentry/fsimpl/kernfs/slot_list.go @@ -38,16 +38,22 @@ func (l *slotList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *slotList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *slotList) Front() *slot { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *slotList) Back() *slot { return l.tail } @@ -55,6 +61,8 @@ func (l *slotList) Back() *slot { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *slotList) Len() (count int) { for e := l.Front(); e != nil; e = (slotElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *slotList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *slotList) PushFront(e *slot) { linker := slotElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *slotList) PushFront(e *slot) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *slotList) PushBack(e *slot) { linker := slotElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *slotList) PushBack(e *slot) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *slotList) PushBackList(m *slotList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *slotList) PushBackList(m *slotList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *slotList) InsertAfter(b, e *slot) { bLinker := slotElementMapper{}.linkerFor(b) eLinker := slotElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *slotList) InsertAfter(b, e *slot) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *slotList) InsertBefore(a, e *slot) { aLinker := slotElementMapper{}.linkerFor(a) eLinker := slotElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *slotList) InsertBefore(a, e *slot) { } // Remove removes e from l. +// +//go:nosplit func (l *slotList) Remove(e *slot) { linker := slotElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type slotEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *slotEntry) Next() *slot { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *slotEntry) Prev() *slot { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *slotEntry) SetNext(elem *slot) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *slotEntry) SetPrev(elem *slot) { e.prev = elem } diff --git a/pkg/sentry/fsimpl/tmpfs/dentry_list.go b/pkg/sentry/fsimpl/tmpfs/dentry_list.go index 95e3d13d5..b95dd7101 100644 --- a/pkg/sentry/fsimpl/tmpfs/dentry_list.go +++ b/pkg/sentry/fsimpl/tmpfs/dentry_list.go @@ -38,16 +38,22 @@ func (l *dentryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *dentryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *dentryList) Front() *dentry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *dentryList) Back() *dentry { return l.tail } @@ -55,6 +61,8 @@ func (l *dentryList) Back() *dentry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *dentryList) Len() (count int) { for e := l.Front(); e != nil; e = (dentryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *dentryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *dentryList) PushFront(e *dentry) { linker := dentryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *dentryList) PushFront(e *dentry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *dentryList) PushBack(e *dentry) { linker := dentryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *dentryList) PushBack(e *dentry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *dentryList) PushBackList(m *dentryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *dentryList) PushBackList(m *dentryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *dentryList) InsertAfter(b, e *dentry) { bLinker := dentryElementMapper{}.linkerFor(b) eLinker := dentryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *dentryList) InsertAfter(b, e *dentry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *dentryList) InsertBefore(a, e *dentry) { aLinker := dentryElementMapper{}.linkerFor(a) eLinker := dentryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *dentryList) InsertBefore(a, e *dentry) { } // Remove removes e from l. +// +//go:nosplit func (l *dentryList) Remove(e *dentry) { linker := dentryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type dentryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *dentryEntry) Next() *dentry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *dentryEntry) Prev() *dentry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *dentryEntry) SetNext(elem *dentry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *dentryEntry) SetPrev(elem *dentry) { e.prev = elem } diff --git a/pkg/sentry/kernel/epoll/epoll_list.go b/pkg/sentry/kernel/epoll/epoll_list.go index 56d05c770..b6abe2de9 100644 --- a/pkg/sentry/kernel/epoll/epoll_list.go +++ b/pkg/sentry/kernel/epoll/epoll_list.go @@ -38,16 +38,22 @@ func (l *pollEntryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *pollEntryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *pollEntryList) Front() *pollEntry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *pollEntryList) Back() *pollEntry { return l.tail } @@ -55,6 +61,8 @@ func (l *pollEntryList) Back() *pollEntry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *pollEntryList) Len() (count int) { for e := l.Front(); e != nil; e = (pollEntryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *pollEntryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *pollEntryList) PushFront(e *pollEntry) { linker := pollEntryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *pollEntryList) PushFront(e *pollEntry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *pollEntryList) PushBack(e *pollEntry) { linker := pollEntryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *pollEntryList) PushBack(e *pollEntry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *pollEntryList) PushBackList(m *pollEntryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *pollEntryList) PushBackList(m *pollEntryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *pollEntryList) InsertAfter(b, e *pollEntry) { bLinker := pollEntryElementMapper{}.linkerFor(b) eLinker := pollEntryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *pollEntryList) InsertAfter(b, e *pollEntry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *pollEntryList) InsertBefore(a, e *pollEntry) { aLinker := pollEntryElementMapper{}.linkerFor(a) eLinker := pollEntryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *pollEntryList) InsertBefore(a, e *pollEntry) { } // Remove removes e from l. +// +//go:nosplit func (l *pollEntryList) Remove(e *pollEntry) { linker := pollEntryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type pollEntryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *pollEntryEntry) Next() *pollEntry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *pollEntryEntry) Prev() *pollEntry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *pollEntryEntry) SetNext(elem *pollEntry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *pollEntryEntry) SetPrev(elem *pollEntry) { e.prev = elem } diff --git a/pkg/sentry/kernel/futex/waiter_list.go b/pkg/sentry/kernel/futex/waiter_list.go index ab6997b26..24968ce4b 100644 --- a/pkg/sentry/kernel/futex/waiter_list.go +++ b/pkg/sentry/kernel/futex/waiter_list.go @@ -38,16 +38,22 @@ func (l *waiterList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *waiterList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *waiterList) Front() *Waiter { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *waiterList) Back() *Waiter { return l.tail } @@ -55,6 +61,8 @@ func (l *waiterList) Back() *Waiter { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *waiterList) Len() (count int) { for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *waiterList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *waiterList) PushFront(e *Waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *waiterList) PushFront(e *Waiter) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *waiterList) PushBack(e *Waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *waiterList) PushBack(e *Waiter) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *waiterList) PushBackList(m *waiterList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *waiterList) PushBackList(m *waiterList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *waiterList) InsertAfter(b, e *Waiter) { bLinker := waiterElementMapper{}.linkerFor(b) eLinker := waiterElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *waiterList) InsertAfter(b, e *Waiter) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *waiterList) InsertBefore(a, e *Waiter) { aLinker := waiterElementMapper{}.linkerFor(a) eLinker := waiterElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *waiterList) InsertBefore(a, e *Waiter) { } // Remove removes e from l. +// +//go:nosplit func (l *waiterList) Remove(e *Waiter) { linker := waiterElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type waiterEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) Next() *Waiter { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) Prev() *Waiter { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) SetNext(elem *Waiter) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) SetPrev(elem *Waiter) { e.prev = elem } diff --git a/pkg/sentry/kernel/pending_signals_list.go b/pkg/sentry/kernel/pending_signals_list.go index d0062087a..d5b483b3e 100644 --- a/pkg/sentry/kernel/pending_signals_list.go +++ b/pkg/sentry/kernel/pending_signals_list.go @@ -38,16 +38,22 @@ func (l *pendingSignalList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *pendingSignalList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *pendingSignalList) Front() *pendingSignal { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *pendingSignalList) Back() *pendingSignal { return l.tail } @@ -55,6 +61,8 @@ func (l *pendingSignalList) Back() *pendingSignal { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *pendingSignalList) Len() (count int) { for e := l.Front(); e != nil; e = (pendingSignalElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *pendingSignalList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *pendingSignalList) PushFront(e *pendingSignal) { linker := pendingSignalElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *pendingSignalList) PushFront(e *pendingSignal) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *pendingSignalList) PushBack(e *pendingSignal) { linker := pendingSignalElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *pendingSignalList) PushBack(e *pendingSignal) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *pendingSignalList) PushBackList(m *pendingSignalList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *pendingSignalList) PushBackList(m *pendingSignalList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *pendingSignalList) InsertAfter(b, e *pendingSignal) { bLinker := pendingSignalElementMapper{}.linkerFor(b) eLinker := pendingSignalElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *pendingSignalList) InsertAfter(b, e *pendingSignal) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) { aLinker := pendingSignalElementMapper{}.linkerFor(a) eLinker := pendingSignalElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) { } // Remove removes e from l. +// +//go:nosplit func (l *pendingSignalList) Remove(e *pendingSignal) { linker := pendingSignalElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type pendingSignalEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *pendingSignalEntry) Next() *pendingSignal { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *pendingSignalEntry) Prev() *pendingSignal { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *pendingSignalEntry) SetNext(elem *pendingSignal) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *pendingSignalEntry) SetPrev(elem *pendingSignal) { e.prev = elem } diff --git a/pkg/sentry/kernel/process_group_list.go b/pkg/sentry/kernel/process_group_list.go index bc2df5bce..9c493504d 100644 --- a/pkg/sentry/kernel/process_group_list.go +++ b/pkg/sentry/kernel/process_group_list.go @@ -38,16 +38,22 @@ func (l *processGroupList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *processGroupList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *processGroupList) Front() *ProcessGroup { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *processGroupList) Back() *ProcessGroup { return l.tail } @@ -55,6 +61,8 @@ func (l *processGroupList) Back() *ProcessGroup { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *processGroupList) Len() (count int) { for e := l.Front(); e != nil; e = (processGroupElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *processGroupList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *processGroupList) PushFront(e *ProcessGroup) { linker := processGroupElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *processGroupList) PushFront(e *ProcessGroup) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *processGroupList) PushBack(e *ProcessGroup) { linker := processGroupElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *processGroupList) PushBack(e *ProcessGroup) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *processGroupList) PushBackList(m *processGroupList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *processGroupList) PushBackList(m *processGroupList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *processGroupList) InsertAfter(b, e *ProcessGroup) { bLinker := processGroupElementMapper{}.linkerFor(b) eLinker := processGroupElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *processGroupList) InsertAfter(b, e *ProcessGroup) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *processGroupList) InsertBefore(a, e *ProcessGroup) { aLinker := processGroupElementMapper{}.linkerFor(a) eLinker := processGroupElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *processGroupList) InsertBefore(a, e *ProcessGroup) { } // Remove removes e from l. +// +//go:nosplit func (l *processGroupList) Remove(e *ProcessGroup) { linker := processGroupElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type processGroupEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *processGroupEntry) Next() *ProcessGroup { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *processGroupEntry) Prev() *ProcessGroup { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *processGroupEntry) SetNext(elem *ProcessGroup) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *processGroupEntry) SetPrev(elem *ProcessGroup) { e.prev = elem } diff --git a/pkg/sentry/kernel/semaphore/waiter_list.go b/pkg/sentry/kernel/semaphore/waiter_list.go index 007bf67b0..51586d43f 100644 --- a/pkg/sentry/kernel/semaphore/waiter_list.go +++ b/pkg/sentry/kernel/semaphore/waiter_list.go @@ -38,16 +38,22 @@ func (l *waiterList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *waiterList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *waiterList) Front() *waiter { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *waiterList) Back() *waiter { return l.tail } @@ -55,6 +61,8 @@ func (l *waiterList) Back() *waiter { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *waiterList) Len() (count int) { for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *waiterList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *waiterList) PushFront(e *waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *waiterList) PushFront(e *waiter) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *waiterList) PushBack(e *waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *waiterList) PushBack(e *waiter) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *waiterList) PushBackList(m *waiterList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *waiterList) PushBackList(m *waiterList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *waiterList) InsertAfter(b, e *waiter) { bLinker := waiterElementMapper{}.linkerFor(b) eLinker := waiterElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *waiterList) InsertAfter(b, e *waiter) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *waiterList) InsertBefore(a, e *waiter) { aLinker := waiterElementMapper{}.linkerFor(a) eLinker := waiterElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *waiterList) InsertBefore(a, e *waiter) { } // Remove removes e from l. +// +//go:nosplit func (l *waiterList) Remove(e *waiter) { linker := waiterElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type waiterEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) Next() *waiter { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) Prev() *waiter { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) SetNext(elem *waiter) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) SetPrev(elem *waiter) { e.prev = elem } diff --git a/pkg/sentry/kernel/session_list.go b/pkg/sentry/kernel/session_list.go index c328b2526..f53dea401 100644 --- a/pkg/sentry/kernel/session_list.go +++ b/pkg/sentry/kernel/session_list.go @@ -38,16 +38,22 @@ func (l *sessionList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *sessionList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *sessionList) Front() *Session { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *sessionList) Back() *Session { return l.tail } @@ -55,6 +61,8 @@ func (l *sessionList) Back() *Session { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *sessionList) Len() (count int) { for e := l.Front(); e != nil; e = (sessionElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *sessionList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *sessionList) PushFront(e *Session) { linker := sessionElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *sessionList) PushFront(e *Session) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *sessionList) PushBack(e *Session) { linker := sessionElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *sessionList) PushBack(e *Session) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *sessionList) PushBackList(m *sessionList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *sessionList) PushBackList(m *sessionList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *sessionList) InsertAfter(b, e *Session) { bLinker := sessionElementMapper{}.linkerFor(b) eLinker := sessionElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *sessionList) InsertAfter(b, e *Session) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *sessionList) InsertBefore(a, e *Session) { aLinker := sessionElementMapper{}.linkerFor(a) eLinker := sessionElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *sessionList) InsertBefore(a, e *Session) { } // Remove removes e from l. +// +//go:nosplit func (l *sessionList) Remove(e *Session) { linker := sessionElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type sessionEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *sessionEntry) Next() *Session { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *sessionEntry) Prev() *Session { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *sessionEntry) SetNext(elem *Session) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *sessionEntry) SetPrev(elem *Session) { e.prev = elem } diff --git a/pkg/sentry/kernel/socket_list.go b/pkg/sentry/kernel/socket_list.go index 246fba405..2b2f5055e 100644 --- a/pkg/sentry/kernel/socket_list.go +++ b/pkg/sentry/kernel/socket_list.go @@ -38,16 +38,22 @@ func (l *socketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *socketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *socketList) Front() *SocketRecordVFS1 { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *socketList) Back() *SocketRecordVFS1 { return l.tail } @@ -55,6 +61,8 @@ func (l *socketList) Back() *SocketRecordVFS1 { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *socketList) Len() (count int) { for e := l.Front(); e != nil; e = (socketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *socketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *socketList) PushFront(e *SocketRecordVFS1) { linker := socketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *socketList) PushFront(e *SocketRecordVFS1) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *socketList) PushBack(e *SocketRecordVFS1) { linker := socketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *socketList) PushBack(e *SocketRecordVFS1) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *socketList) PushBackList(m *socketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *socketList) PushBackList(m *socketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *socketList) InsertAfter(b, e *SocketRecordVFS1) { bLinker := socketElementMapper{}.linkerFor(b) eLinker := socketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *socketList) InsertAfter(b, e *SocketRecordVFS1) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *socketList) InsertBefore(a, e *SocketRecordVFS1) { aLinker := socketElementMapper{}.linkerFor(a) eLinker := socketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *socketList) InsertBefore(a, e *SocketRecordVFS1) { } // Remove removes e from l. +// +//go:nosplit func (l *socketList) Remove(e *SocketRecordVFS1) { linker := socketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type socketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *socketEntry) Next() *SocketRecordVFS1 { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *socketEntry) Prev() *SocketRecordVFS1 { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *socketEntry) SetNext(elem *SocketRecordVFS1) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *socketEntry) SetPrev(elem *SocketRecordVFS1) { e.prev = elem } diff --git a/pkg/sentry/kernel/task_list.go b/pkg/sentry/kernel/task_list.go index f0c501845..66df9ac45 100644 --- a/pkg/sentry/kernel/task_list.go +++ b/pkg/sentry/kernel/task_list.go @@ -38,16 +38,22 @@ func (l *taskList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *taskList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *taskList) Front() *Task { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *taskList) Back() *Task { return l.tail } @@ -55,6 +61,8 @@ func (l *taskList) Back() *Task { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *taskList) Len() (count int) { for e := l.Front(); e != nil; e = (taskElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *taskList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *taskList) PushFront(e *Task) { linker := taskElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *taskList) PushFront(e *Task) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *taskList) PushBack(e *Task) { linker := taskElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *taskList) PushBack(e *Task) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *taskList) PushBackList(m *taskList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *taskList) PushBackList(m *taskList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *taskList) InsertAfter(b, e *Task) { bLinker := taskElementMapper{}.linkerFor(b) eLinker := taskElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *taskList) InsertAfter(b, e *Task) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *taskList) InsertBefore(a, e *Task) { aLinker := taskElementMapper{}.linkerFor(a) eLinker := taskElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *taskList) InsertBefore(a, e *Task) { } // Remove removes e from l. +// +//go:nosplit func (l *taskList) Remove(e *Task) { linker := taskElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type taskEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *taskEntry) Next() *Task { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *taskEntry) Prev() *Task { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *taskEntry) SetNext(elem *Task) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *taskEntry) SetPrev(elem *Task) { e.prev = elem } diff --git a/pkg/sentry/mm/io_list.go b/pkg/sentry/mm/io_list.go index 7cb6a98ad..9a54e60be 100644 --- a/pkg/sentry/mm/io_list.go +++ b/pkg/sentry/mm/io_list.go @@ -38,16 +38,22 @@ func (l *ioList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *ioList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *ioList) Front() *ioResult { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *ioList) Back() *ioResult { return l.tail } @@ -55,6 +61,8 @@ func (l *ioList) Back() *ioResult { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *ioList) Len() (count int) { for e := l.Front(); e != nil; e = (ioElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *ioList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *ioList) PushFront(e *ioResult) { linker := ioElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *ioList) PushFront(e *ioResult) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *ioList) PushBack(e *ioResult) { linker := ioElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *ioList) PushBack(e *ioResult) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *ioList) PushBackList(m *ioList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *ioList) PushBackList(m *ioList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *ioList) InsertAfter(b, e *ioResult) { bLinker := ioElementMapper{}.linkerFor(b) eLinker := ioElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *ioList) InsertAfter(b, e *ioResult) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *ioList) InsertBefore(a, e *ioResult) { aLinker := ioElementMapper{}.linkerFor(a) eLinker := ioElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *ioList) InsertBefore(a, e *ioResult) { } // Remove removes e from l. +// +//go:nosplit func (l *ioList) Remove(e *ioResult) { linker := ioElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type ioEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *ioEntry) Next() *ioResult { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *ioEntry) Prev() *ioResult { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *ioEntry) SetNext(elem *ioResult) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *ioEntry) SetPrev(elem *ioResult) { e.prev = elem } diff --git a/pkg/sentry/socket/unix/transport/transport_message_list.go b/pkg/sentry/socket/unix/transport/transport_message_list.go index dda579c27..945163cc1 100644 --- a/pkg/sentry/socket/unix/transport/transport_message_list.go +++ b/pkg/sentry/socket/unix/transport/transport_message_list.go @@ -38,16 +38,22 @@ func (l *messageList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *messageList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *messageList) Front() *message { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *messageList) Back() *message { return l.tail } @@ -55,6 +61,8 @@ func (l *messageList) Back() *message { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *messageList) Len() (count int) { for e := l.Front(); e != nil; e = (messageElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *messageList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *messageList) PushFront(e *message) { linker := messageElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *messageList) PushFront(e *message) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *messageList) PushBack(e *message) { linker := messageElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *messageList) PushBack(e *message) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *messageList) PushBackList(m *messageList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *messageList) PushBackList(m *messageList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *messageList) InsertAfter(b, e *message) { bLinker := messageElementMapper{}.linkerFor(b) eLinker := messageElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *messageList) InsertAfter(b, e *message) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *messageList) InsertBefore(a, e *message) { aLinker := messageElementMapper{}.linkerFor(a) eLinker := messageElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *messageList) InsertBefore(a, e *message) { } // Remove removes e from l. +// +//go:nosplit func (l *messageList) Remove(e *message) { linker := messageElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type messageEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *messageEntry) Next() *message { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *messageEntry) Prev() *message { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *messageEntry) SetNext(elem *message) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *messageEntry) SetPrev(elem *message) { e.prev = elem } diff --git a/pkg/sentry/vfs/epoll_interest_list.go b/pkg/sentry/vfs/epoll_interest_list.go index ad8ae496a..e75ea361b 100644 --- a/pkg/sentry/vfs/epoll_interest_list.go +++ b/pkg/sentry/vfs/epoll_interest_list.go @@ -38,16 +38,22 @@ func (l *epollInterestList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *epollInterestList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *epollInterestList) Front() *epollInterest { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *epollInterestList) Back() *epollInterest { return l.tail } @@ -55,6 +61,8 @@ func (l *epollInterestList) Back() *epollInterest { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *epollInterestList) Len() (count int) { for e := l.Front(); e != nil; e = (epollInterestElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *epollInterestList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *epollInterestList) PushFront(e *epollInterest) { linker := epollInterestElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *epollInterestList) PushFront(e *epollInterest) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *epollInterestList) PushBack(e *epollInterest) { linker := epollInterestElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *epollInterestList) PushBack(e *epollInterest) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *epollInterestList) PushBackList(m *epollInterestList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *epollInterestList) PushBackList(m *epollInterestList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *epollInterestList) InsertAfter(b, e *epollInterest) { bLinker := epollInterestElementMapper{}.linkerFor(b) eLinker := epollInterestElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *epollInterestList) InsertAfter(b, e *epollInterest) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *epollInterestList) InsertBefore(a, e *epollInterest) { aLinker := epollInterestElementMapper{}.linkerFor(a) eLinker := epollInterestElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *epollInterestList) InsertBefore(a, e *epollInterest) { } // Remove removes e from l. +// +//go:nosplit func (l *epollInterestList) Remove(e *epollInterest) { linker := epollInterestElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type epollInterestEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *epollInterestEntry) Next() *epollInterest { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *epollInterestEntry) Prev() *epollInterest { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *epollInterestEntry) SetNext(elem *epollInterest) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *epollInterestEntry) SetPrev(elem *epollInterest) { e.prev = elem } diff --git a/pkg/sentry/vfs/event_list.go b/pkg/sentry/vfs/event_list.go index ebfb272fd..c0946b585 100644 --- a/pkg/sentry/vfs/event_list.go +++ b/pkg/sentry/vfs/event_list.go @@ -38,16 +38,22 @@ func (l *eventList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *eventList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *eventList) Front() *Event { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *eventList) Back() *Event { return l.tail } @@ -55,6 +61,8 @@ func (l *eventList) Back() *Event { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *eventList) Len() (count int) { for e := l.Front(); e != nil; e = (eventElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *eventList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *eventList) PushFront(e *Event) { linker := eventElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *eventList) PushFront(e *Event) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *eventList) PushBack(e *Event) { linker := eventElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *eventList) PushBack(e *Event) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *eventList) PushBackList(m *eventList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *eventList) PushBackList(m *eventList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *eventList) InsertAfter(b, e *Event) { bLinker := eventElementMapper{}.linkerFor(b) eLinker := eventElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *eventList) InsertAfter(b, e *Event) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *eventList) InsertBefore(a, e *Event) { aLinker := eventElementMapper{}.linkerFor(a) eLinker := eventElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *eventList) InsertBefore(a, e *Event) { } // Remove removes e from l. +// +//go:nosplit func (l *eventList) Remove(e *Event) { linker := eventElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type eventEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *eventEntry) Next() *Event { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *eventEntry) Prev() *Event { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *eventEntry) SetNext(elem *Event) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *eventEntry) SetPrev(elem *Event) { e.prev = elem } diff --git a/pkg/state/complete_list.go b/pkg/state/complete_list.go index decbad77b..4d340a1af 100644 --- a/pkg/state/complete_list.go +++ b/pkg/state/complete_list.go @@ -38,16 +38,22 @@ func (l *completeList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *completeList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *completeList) Front() *objectDecodeState { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *completeList) Back() *objectDecodeState { return l.tail } @@ -55,6 +61,8 @@ func (l *completeList) Back() *objectDecodeState { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *completeList) Len() (count int) { for e := l.Front(); e != nil; e = (completeElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *completeList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *completeList) PushFront(e *objectDecodeState) { linker := completeElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *completeList) PushFront(e *objectDecodeState) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *completeList) PushBack(e *objectDecodeState) { linker := completeElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *completeList) PushBack(e *objectDecodeState) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *completeList) PushBackList(m *completeList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *completeList) PushBackList(m *completeList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *completeList) InsertAfter(b, e *objectDecodeState) { bLinker := completeElementMapper{}.linkerFor(b) eLinker := completeElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *completeList) InsertAfter(b, e *objectDecodeState) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *completeList) InsertBefore(a, e *objectDecodeState) { aLinker := completeElementMapper{}.linkerFor(a) eLinker := completeElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *completeList) InsertBefore(a, e *objectDecodeState) { } // Remove removes e from l. +// +//go:nosplit func (l *completeList) Remove(e *objectDecodeState) { linker := completeElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type completeEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *completeEntry) Next() *objectDecodeState { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *completeEntry) Prev() *objectDecodeState { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *completeEntry) SetNext(elem *objectDecodeState) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *completeEntry) SetPrev(elem *objectDecodeState) { e.prev = elem } diff --git a/pkg/state/deferred_list.go b/pkg/state/deferred_list.go index 5aed02c95..2753ce4a2 100644 --- a/pkg/state/deferred_list.go +++ b/pkg/state/deferred_list.go @@ -23,16 +23,22 @@ func (l *deferredList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *deferredList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *deferredList) Front() *objectEncodeState { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *deferredList) Back() *objectEncodeState { return l.tail } @@ -40,6 +46,8 @@ func (l *deferredList) Back() *objectEncodeState { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *deferredList) Len() (count int) { for e := l.Front(); e != nil; e = (deferredMapper{}.linkerFor(e)).Next() { count++ @@ -48,6 +56,8 @@ func (l *deferredList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *deferredList) PushFront(e *objectEncodeState) { linker := deferredMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -62,6 +72,8 @@ func (l *deferredList) PushFront(e *objectEncodeState) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *deferredList) PushBack(e *objectEncodeState) { linker := deferredMapper{}.linkerFor(e) linker.SetNext(nil) @@ -76,6 +88,8 @@ func (l *deferredList) PushBack(e *objectEncodeState) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *deferredList) PushBackList(m *deferredList) { if l.head == nil { l.head = m.head @@ -91,6 +105,8 @@ func (l *deferredList) PushBackList(m *deferredList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *deferredList) InsertAfter(b, e *objectEncodeState) { bLinker := deferredMapper{}.linkerFor(b) eLinker := deferredMapper{}.linkerFor(e) @@ -109,6 +125,8 @@ func (l *deferredList) InsertAfter(b, e *objectEncodeState) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *deferredList) InsertBefore(a, e *objectEncodeState) { aLinker := deferredMapper{}.linkerFor(a) eLinker := deferredMapper{}.linkerFor(e) @@ -126,6 +144,8 @@ func (l *deferredList) InsertBefore(a, e *objectEncodeState) { } // Remove removes e from l. +// +//go:nosplit func (l *deferredList) Remove(e *objectEncodeState) { linker := deferredMapper{}.linkerFor(e) prev := linker.Prev() @@ -158,21 +178,29 @@ type deferredEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *deferredEntry) Next() *objectEncodeState { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *deferredEntry) Prev() *objectEncodeState { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *deferredEntry) SetNext(elem *objectEncodeState) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *deferredEntry) SetPrev(elem *objectEncodeState) { e.prev = elem } diff --git a/pkg/tcpip/network/fragmentation/reassembler_list.go b/pkg/tcpip/network/fragmentation/reassembler_list.go index bb5bd75c4..673bb11b0 100644 --- a/pkg/tcpip/network/fragmentation/reassembler_list.go +++ b/pkg/tcpip/network/fragmentation/reassembler_list.go @@ -38,16 +38,22 @@ func (l *reassemblerList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *reassemblerList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *reassemblerList) Front() *reassembler { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *reassemblerList) Back() *reassembler { return l.tail } @@ -55,6 +61,8 @@ func (l *reassemblerList) Back() *reassembler { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *reassemblerList) Len() (count int) { for e := l.Front(); e != nil; e = (reassemblerElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *reassemblerList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *reassemblerList) PushFront(e *reassembler) { linker := reassemblerElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *reassemblerList) PushFront(e *reassembler) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *reassemblerList) PushBack(e *reassembler) { linker := reassemblerElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *reassemblerList) PushBack(e *reassembler) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *reassemblerList) PushBackList(m *reassemblerList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *reassemblerList) PushBackList(m *reassemblerList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *reassemblerList) InsertAfter(b, e *reassembler) { bLinker := reassemblerElementMapper{}.linkerFor(b) eLinker := reassemblerElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *reassemblerList) InsertAfter(b, e *reassembler) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *reassemblerList) InsertBefore(a, e *reassembler) { aLinker := reassemblerElementMapper{}.linkerFor(a) eLinker := reassemblerElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *reassemblerList) InsertBefore(a, e *reassembler) { } // Remove removes e from l. +// +//go:nosplit func (l *reassemblerList) Remove(e *reassembler) { linker := reassemblerElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type reassemblerEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *reassemblerEntry) Next() *reassembler { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *reassemblerEntry) Prev() *reassembler { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *reassemblerEntry) SetNext(elem *reassembler) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *reassemblerEntry) SetPrev(elem *reassembler) { e.prev = elem } diff --git a/pkg/tcpip/sock_err_list.go b/pkg/tcpip/sock_err_list.go index 8935a8793..0be1993af 100644 --- a/pkg/tcpip/sock_err_list.go +++ b/pkg/tcpip/sock_err_list.go @@ -38,16 +38,22 @@ func (l *sockErrorList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *sockErrorList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *sockErrorList) Front() *SockError { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *sockErrorList) Back() *SockError { return l.tail } @@ -55,6 +61,8 @@ func (l *sockErrorList) Back() *SockError { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *sockErrorList) Len() (count int) { for e := l.Front(); e != nil; e = (sockErrorElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *sockErrorList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *sockErrorList) PushFront(e *SockError) { linker := sockErrorElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *sockErrorList) PushFront(e *SockError) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *sockErrorList) PushBack(e *SockError) { linker := sockErrorElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *sockErrorList) PushBack(e *SockError) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *sockErrorList) PushBackList(m *sockErrorList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *sockErrorList) PushBackList(m *sockErrorList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *sockErrorList) InsertAfter(b, e *SockError) { bLinker := sockErrorElementMapper{}.linkerFor(b) eLinker := sockErrorElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *sockErrorList) InsertAfter(b, e *SockError) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *sockErrorList) InsertBefore(a, e *SockError) { aLinker := sockErrorElementMapper{}.linkerFor(a) eLinker := sockErrorElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *sockErrorList) InsertBefore(a, e *SockError) { } // Remove removes e from l. +// +//go:nosplit func (l *sockErrorList) Remove(e *SockError) { linker := sockErrorElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type sockErrorEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *sockErrorEntry) Next() *SockError { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *sockErrorEntry) Prev() *SockError { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *sockErrorEntry) SetNext(elem *SockError) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *sockErrorEntry) SetPrev(elem *SockError) { e.prev = elem } diff --git a/pkg/tcpip/stack/linkaddrentry_list.go b/pkg/tcpip/stack/linkaddrentry_list.go index 1250b89f8..8ae2ff09c 100644 --- a/pkg/tcpip/stack/linkaddrentry_list.go +++ b/pkg/tcpip/stack/linkaddrentry_list.go @@ -38,16 +38,22 @@ func (l *linkAddrEntryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *linkAddrEntryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *linkAddrEntryList) Front() *linkAddrEntry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *linkAddrEntryList) Back() *linkAddrEntry { return l.tail } @@ -55,6 +61,8 @@ func (l *linkAddrEntryList) Back() *linkAddrEntry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *linkAddrEntryList) Len() (count int) { for e := l.Front(); e != nil; e = (linkAddrEntryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *linkAddrEntryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) { linker := linkAddrEntryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *linkAddrEntryList) PushBack(e *linkAddrEntry) { linker := linkAddrEntryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *linkAddrEntryList) PushBack(e *linkAddrEntry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *linkAddrEntryList) PushBackList(m *linkAddrEntryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *linkAddrEntryList) PushBackList(m *linkAddrEntryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) { bLinker := linkAddrEntryElementMapper{}.linkerFor(b) eLinker := linkAddrEntryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) { aLinker := linkAddrEntryElementMapper{}.linkerFor(a) eLinker := linkAddrEntryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) { } // Remove removes e from l. +// +//go:nosplit func (l *linkAddrEntryList) Remove(e *linkAddrEntry) { linker := linkAddrEntryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type linkAddrEntryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) Next() *linkAddrEntry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) Prev() *linkAddrEntry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) SetNext(elem *linkAddrEntry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *linkAddrEntryEntry) SetPrev(elem *linkAddrEntry) { e.prev = elem } diff --git a/pkg/tcpip/stack/neighbor_entry_list.go b/pkg/tcpip/stack/neighbor_entry_list.go index b732257d2..d78430080 100644 --- a/pkg/tcpip/stack/neighbor_entry_list.go +++ b/pkg/tcpip/stack/neighbor_entry_list.go @@ -38,16 +38,22 @@ func (l *neighborEntryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *neighborEntryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *neighborEntryList) Front() *neighborEntry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *neighborEntryList) Back() *neighborEntry { return l.tail } @@ -55,6 +61,8 @@ func (l *neighborEntryList) Back() *neighborEntry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *neighborEntryList) Len() (count int) { for e := l.Front(); e != nil; e = (neighborEntryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *neighborEntryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *neighborEntryList) PushFront(e *neighborEntry) { linker := neighborEntryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *neighborEntryList) PushFront(e *neighborEntry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *neighborEntryList) PushBack(e *neighborEntry) { linker := neighborEntryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *neighborEntryList) PushBack(e *neighborEntry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *neighborEntryList) PushBackList(m *neighborEntryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *neighborEntryList) PushBackList(m *neighborEntryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *neighborEntryList) InsertAfter(b, e *neighborEntry) { bLinker := neighborEntryElementMapper{}.linkerFor(b) eLinker := neighborEntryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *neighborEntryList) InsertAfter(b, e *neighborEntry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *neighborEntryList) InsertBefore(a, e *neighborEntry) { aLinker := neighborEntryElementMapper{}.linkerFor(a) eLinker := neighborEntryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *neighborEntryList) InsertBefore(a, e *neighborEntry) { } // Remove removes e from l. +// +//go:nosplit func (l *neighborEntryList) Remove(e *neighborEntry) { linker := neighborEntryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type neighborEntryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *neighborEntryEntry) Next() *neighborEntry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *neighborEntryEntry) Prev() *neighborEntry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *neighborEntryEntry) SetNext(elem *neighborEntry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *neighborEntryEntry) SetPrev(elem *neighborEntry) { e.prev = elem } diff --git a/pkg/tcpip/stack/packet_buffer_list.go b/pkg/tcpip/stack/packet_buffer_list.go index 27f15cb15..ce7057d6b 100644 --- a/pkg/tcpip/stack/packet_buffer_list.go +++ b/pkg/tcpip/stack/packet_buffer_list.go @@ -38,16 +38,22 @@ func (l *PacketBufferList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *PacketBufferList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *PacketBufferList) Front() *PacketBuffer { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *PacketBufferList) Back() *PacketBuffer { return l.tail } @@ -55,6 +61,8 @@ func (l *PacketBufferList) Back() *PacketBuffer { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *PacketBufferList) Len() (count int) { for e := l.Front(); e != nil; e = (PacketBufferElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *PacketBufferList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *PacketBufferList) PushFront(e *PacketBuffer) { linker := PacketBufferElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *PacketBufferList) PushFront(e *PacketBuffer) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *PacketBufferList) PushBack(e *PacketBuffer) { linker := PacketBufferElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *PacketBufferList) PushBack(e *PacketBuffer) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *PacketBufferList) PushBackList(m *PacketBufferList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *PacketBufferList) PushBackList(m *PacketBufferList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *PacketBufferList) InsertAfter(b, e *PacketBuffer) { bLinker := PacketBufferElementMapper{}.linkerFor(b) eLinker := PacketBufferElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *PacketBufferList) InsertAfter(b, e *PacketBuffer) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *PacketBufferList) InsertBefore(a, e *PacketBuffer) { aLinker := PacketBufferElementMapper{}.linkerFor(a) eLinker := PacketBufferElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *PacketBufferList) InsertBefore(a, e *PacketBuffer) { } // Remove removes e from l. +// +//go:nosplit func (l *PacketBufferList) Remove(e *PacketBuffer) { linker := PacketBufferElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type PacketBufferEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *PacketBufferEntry) Next() *PacketBuffer { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *PacketBufferEntry) Prev() *PacketBuffer { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *PacketBufferEntry) SetNext(elem *PacketBuffer) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *PacketBufferEntry) SetPrev(elem *PacketBuffer) { e.prev = elem } diff --git a/pkg/tcpip/stack/tuple_list.go b/pkg/tcpip/stack/tuple_list.go index 0d1b98874..31d0feefa 100644 --- a/pkg/tcpip/stack/tuple_list.go +++ b/pkg/tcpip/stack/tuple_list.go @@ -38,16 +38,22 @@ func (l *tupleList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *tupleList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *tupleList) Front() *tuple { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *tupleList) Back() *tuple { return l.tail } @@ -55,6 +61,8 @@ func (l *tupleList) Back() *tuple { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *tupleList) Len() (count int) { for e := l.Front(); e != nil; e = (tupleElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *tupleList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *tupleList) PushFront(e *tuple) { linker := tupleElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *tupleList) PushFront(e *tuple) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *tupleList) PushBack(e *tuple) { linker := tupleElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *tupleList) PushBack(e *tuple) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *tupleList) PushBackList(m *tupleList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *tupleList) PushBackList(m *tupleList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *tupleList) InsertAfter(b, e *tuple) { bLinker := tupleElementMapper{}.linkerFor(b) eLinker := tupleElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *tupleList) InsertAfter(b, e *tuple) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *tupleList) InsertBefore(a, e *tuple) { aLinker := tupleElementMapper{}.linkerFor(a) eLinker := tupleElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *tupleList) InsertBefore(a, e *tuple) { } // Remove removes e from l. +// +//go:nosplit func (l *tupleList) Remove(e *tuple) { linker := tupleElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type tupleEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *tupleEntry) Next() *tuple { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *tupleEntry) Prev() *tuple { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *tupleEntry) SetNext(elem *tuple) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *tupleEntry) SetPrev(elem *tuple) { e.prev = elem } diff --git a/pkg/tcpip/transport/icmp/icmp_packet_list.go b/pkg/tcpip/transport/icmp/icmp_packet_list.go index f69543bda..0aacdad3f 100644 --- a/pkg/tcpip/transport/icmp/icmp_packet_list.go +++ b/pkg/tcpip/transport/icmp/icmp_packet_list.go @@ -38,16 +38,22 @@ func (l *icmpPacketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *icmpPacketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *icmpPacketList) Front() *icmpPacket { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *icmpPacketList) Back() *icmpPacket { return l.tail } @@ -55,6 +61,8 @@ func (l *icmpPacketList) Back() *icmpPacket { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *icmpPacketList) Len() (count int) { for e := l.Front(); e != nil; e = (icmpPacketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *icmpPacketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *icmpPacketList) PushFront(e *icmpPacket) { linker := icmpPacketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *icmpPacketList) PushFront(e *icmpPacket) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *icmpPacketList) PushBack(e *icmpPacket) { linker := icmpPacketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *icmpPacketList) PushBack(e *icmpPacket) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *icmpPacketList) PushBackList(m *icmpPacketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *icmpPacketList) PushBackList(m *icmpPacketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) { bLinker := icmpPacketElementMapper{}.linkerFor(b) eLinker := icmpPacketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) { aLinker := icmpPacketElementMapper{}.linkerFor(a) eLinker := icmpPacketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) { } // Remove removes e from l. +// +//go:nosplit func (l *icmpPacketList) Remove(e *icmpPacket) { linker := icmpPacketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type icmpPacketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *icmpPacketEntry) Next() *icmpPacket { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *icmpPacketEntry) Prev() *icmpPacket { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *icmpPacketEntry) SetNext(elem *icmpPacket) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *icmpPacketEntry) SetPrev(elem *icmpPacket) { e.prev = elem } diff --git a/pkg/tcpip/transport/packet/packet_list.go b/pkg/tcpip/transport/packet/packet_list.go index 22a41872a..2c983aad0 100644 --- a/pkg/tcpip/transport/packet/packet_list.go +++ b/pkg/tcpip/transport/packet/packet_list.go @@ -38,16 +38,22 @@ func (l *packetList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *packetList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *packetList) Front() *packet { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *packetList) Back() *packet { return l.tail } @@ -55,6 +61,8 @@ func (l *packetList) Back() *packet { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *packetList) Len() (count int) { for e := l.Front(); e != nil; e = (packetElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *packetList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *packetList) PushFront(e *packet) { linker := packetElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *packetList) PushFront(e *packet) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *packetList) PushBack(e *packet) { linker := packetElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *packetList) PushBack(e *packet) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *packetList) PushBackList(m *packetList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *packetList) PushBackList(m *packetList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *packetList) InsertAfter(b, e *packet) { bLinker := packetElementMapper{}.linkerFor(b) eLinker := packetElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *packetList) InsertAfter(b, e *packet) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *packetList) InsertBefore(a, e *packet) { aLinker := packetElementMapper{}.linkerFor(a) eLinker := packetElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *packetList) InsertBefore(a, e *packet) { } // Remove removes e from l. +// +//go:nosplit func (l *packetList) Remove(e *packet) { linker := packetElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type packetEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *packetEntry) Next() *packet { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *packetEntry) Prev() *packet { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *packetEntry) SetNext(elem *packet) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *packetEntry) SetPrev(elem *packet) { e.prev = elem } diff --git a/pkg/tcpip/transport/raw/raw_packet_list.go b/pkg/tcpip/transport/raw/raw_packet_list.go index 5f955e86a..48804ff1b 100644 --- a/pkg/tcpip/transport/raw/raw_packet_list.go +++ b/pkg/tcpip/transport/raw/raw_packet_list.go @@ -38,16 +38,22 @@ func (l *rawPacketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *rawPacketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *rawPacketList) Front() *rawPacket { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *rawPacketList) Back() *rawPacket { return l.tail } @@ -55,6 +61,8 @@ func (l *rawPacketList) Back() *rawPacket { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *rawPacketList) Len() (count int) { for e := l.Front(); e != nil; e = (rawPacketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *rawPacketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *rawPacketList) PushFront(e *rawPacket) { linker := rawPacketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *rawPacketList) PushFront(e *rawPacket) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *rawPacketList) PushBack(e *rawPacket) { linker := rawPacketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *rawPacketList) PushBack(e *rawPacket) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *rawPacketList) PushBackList(m *rawPacketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *rawPacketList) PushBackList(m *rawPacketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *rawPacketList) InsertAfter(b, e *rawPacket) { bLinker := rawPacketElementMapper{}.linkerFor(b) eLinker := rawPacketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *rawPacketList) InsertAfter(b, e *rawPacket) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *rawPacketList) InsertBefore(a, e *rawPacket) { aLinker := rawPacketElementMapper{}.linkerFor(a) eLinker := rawPacketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *rawPacketList) InsertBefore(a, e *rawPacket) { } // Remove removes e from l. +// +//go:nosplit func (l *rawPacketList) Remove(e *rawPacket) { linker := rawPacketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type rawPacketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *rawPacketEntry) Next() *rawPacket { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *rawPacketEntry) Prev() *rawPacket { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *rawPacketEntry) SetNext(elem *rawPacket) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *rawPacketEntry) SetPrev(elem *rawPacket) { e.prev = elem } diff --git a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go index 71ae11c81..a7dc5df81 100644 --- a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go +++ b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go @@ -38,16 +38,22 @@ func (l *endpointList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *endpointList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *endpointList) Front() *endpoint { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *endpointList) Back() *endpoint { return l.tail } @@ -55,6 +61,8 @@ func (l *endpointList) Back() *endpoint { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *endpointList) Len() (count int) { for e := l.Front(); e != nil; e = (endpointElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *endpointList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *endpointList) PushFront(e *endpoint) { linker := endpointElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *endpointList) PushFront(e *endpoint) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *endpointList) PushBack(e *endpoint) { linker := endpointElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *endpointList) PushBack(e *endpoint) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *endpointList) PushBackList(m *endpointList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *endpointList) PushBackList(m *endpointList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *endpointList) InsertAfter(b, e *endpoint) { bLinker := endpointElementMapper{}.linkerFor(b) eLinker := endpointElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *endpointList) InsertAfter(b, e *endpoint) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *endpointList) InsertBefore(a, e *endpoint) { aLinker := endpointElementMapper{}.linkerFor(a) eLinker := endpointElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *endpointList) InsertBefore(a, e *endpoint) { } // Remove removes e from l. +// +//go:nosplit func (l *endpointList) Remove(e *endpoint) { linker := endpointElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type endpointEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *endpointEntry) Next() *endpoint { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *endpointEntry) Prev() *endpoint { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *endpointEntry) SetNext(elem *endpoint) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *endpointEntry) SetPrev(elem *endpoint) { e.prev = elem } diff --git a/pkg/tcpip/transport/tcp/tcp_segment_list.go b/pkg/tcpip/transport/tcp/tcp_segment_list.go index fcd0c7ec1..a14cff27e 100644 --- a/pkg/tcpip/transport/tcp/tcp_segment_list.go +++ b/pkg/tcpip/transport/tcp/tcp_segment_list.go @@ -38,16 +38,22 @@ func (l *segmentList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *segmentList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *segmentList) Front() *segment { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *segmentList) Back() *segment { return l.tail } @@ -55,6 +61,8 @@ func (l *segmentList) Back() *segment { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *segmentList) Len() (count int) { for e := l.Front(); e != nil; e = (segmentElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *segmentList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *segmentList) PushFront(e *segment) { linker := segmentElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *segmentList) PushFront(e *segment) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *segmentList) PushBack(e *segment) { linker := segmentElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *segmentList) PushBack(e *segment) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *segmentList) PushBackList(m *segmentList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *segmentList) PushBackList(m *segmentList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *segmentList) InsertAfter(b, e *segment) { bLinker := segmentElementMapper{}.linkerFor(b) eLinker := segmentElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *segmentList) InsertAfter(b, e *segment) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *segmentList) InsertBefore(a, e *segment) { aLinker := segmentElementMapper{}.linkerFor(a) eLinker := segmentElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *segmentList) InsertBefore(a, e *segment) { } // Remove removes e from l. +// +//go:nosplit func (l *segmentList) Remove(e *segment) { linker := segmentElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type segmentEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *segmentEntry) Next() *segment { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *segmentEntry) Prev() *segment { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *segmentEntry) SetNext(elem *segment) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *segmentEntry) SetPrev(elem *segment) { e.prev = elem } diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go index 5436b9de1..c396f77c9 100644 --- a/pkg/tcpip/transport/udp/udp_packet_list.go +++ b/pkg/tcpip/transport/udp/udp_packet_list.go @@ -38,16 +38,22 @@ func (l *udpPacketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *udpPacketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *udpPacketList) Front() *udpPacket { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *udpPacketList) Back() *udpPacket { return l.tail } @@ -55,6 +61,8 @@ func (l *udpPacketList) Back() *udpPacket { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *udpPacketList) Len() (count int) { for e := l.Front(); e != nil; e = (udpPacketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *udpPacketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *udpPacketList) PushFront(e *udpPacket) { linker := udpPacketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *udpPacketList) PushFront(e *udpPacket) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *udpPacketList) PushBack(e *udpPacket) { linker := udpPacketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *udpPacketList) PushBack(e *udpPacket) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *udpPacketList) PushBackList(m *udpPacketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *udpPacketList) PushBackList(m *udpPacketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *udpPacketList) InsertAfter(b, e *udpPacket) { bLinker := udpPacketElementMapper{}.linkerFor(b) eLinker := udpPacketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *udpPacketList) InsertAfter(b, e *udpPacket) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *udpPacketList) InsertBefore(a, e *udpPacket) { aLinker := udpPacketElementMapper{}.linkerFor(a) eLinker := udpPacketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *udpPacketList) InsertBefore(a, e *udpPacket) { } // Remove removes e from l. +// +//go:nosplit func (l *udpPacketList) Remove(e *udpPacket) { linker := udpPacketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type udpPacketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *udpPacketEntry) Next() *udpPacket { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *udpPacketEntry) Prev() *udpPacket { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *udpPacketEntry) SetNext(elem *udpPacket) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *udpPacketEntry) SetPrev(elem *udpPacket) { e.prev = elem } diff --git a/pkg/waiter/waiter_list.go b/pkg/waiter/waiter_list.go index a91063d9e..f83aeb49d 100644 --- a/pkg/waiter/waiter_list.go +++ b/pkg/waiter/waiter_list.go @@ -38,16 +38,22 @@ func (l *waiterList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *waiterList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *waiterList) Front() *Entry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *waiterList) Back() *Entry { return l.tail } @@ -55,6 +61,8 @@ func (l *waiterList) Back() *Entry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *waiterList) Len() (count int) { for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *waiterList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *waiterList) PushFront(e *Entry) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *waiterList) PushFront(e *Entry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *waiterList) PushBack(e *Entry) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *waiterList) PushBack(e *Entry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *waiterList) PushBackList(m *waiterList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *waiterList) PushBackList(m *waiterList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *waiterList) InsertAfter(b, e *Entry) { bLinker := waiterElementMapper{}.linkerFor(b) eLinker := waiterElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *waiterList) InsertAfter(b, e *Entry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *waiterList) InsertBefore(a, e *Entry) { aLinker := waiterElementMapper{}.linkerFor(a) eLinker := waiterElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *waiterList) InsertBefore(a, e *Entry) { } // Remove removes e from l. +// +//go:nosplit func (l *waiterList) Remove(e *Entry) { linker := waiterElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type waiterEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) Next() *Entry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) Prev() *Entry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) SetNext(elem *Entry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) SetPrev(elem *Entry) { e.prev = elem } |