diff options
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/fs/dirent_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fs/event_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/fuse/request_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/gofer/dentry_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/kernfs/dentry_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/kernfs/slot_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/tmpfs/dentry_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/epoll/epoll_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/futex/waiter_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/pending_signals_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/process_group_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/semaphore/waiter_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/session_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/socket_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/task_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/mm/io_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/socket/unix/transport/transport_message_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/vfs/epoll_interest_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/vfs/event_list.go | 28 |
19 files changed, 532 insertions, 0 deletions
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 } |