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 /pkg/sentry/fs | |
parent | 3ff3110fcdd696053e8cafc807f2409fe1269cce (diff) | |
parent | 4c4de66443174f2ed7f4fa533a1d09c709be9427 (diff) |
Merge release-20201216.0-82-g4c4de6644 (automated)
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/dirent_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/fs/event_list.go | 28 |
2 files changed, 56 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 } |