diff options
author | Ting-Yu Wang <anivia@google.com> | 2021-04-29 11:41:12 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-29 11:43:26 -0700 |
commit | a41c5fe217e6c40e563669e0a888b33bc125fa88 (patch) | |
tree | 7876a246a2b9a763db23c9f946cc59c84080f7dd /pkg/tcpip/stack/packet_buffer.go | |
parent | 2e442f908142d175e95226e3ad5892902921f8fd (diff) |
netstack: Rename pkt.Data().TrimFront() to DeleteFront(), and ...
... it may now invalidate backing slice references
This is currently safe because TrimFront() in VectorisedView only shrinks the
view. This may not hold under the a different buffer implementation.
Reordering method calls order to allow this.
PiperOrigin-RevId: 371167610
Diffstat (limited to 'pkg/tcpip/stack/packet_buffer.go')
-rw-r--r-- | pkg/tcpip/stack/packet_buffer.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/tcpip/stack/packet_buffer.go b/pkg/tcpip/stack/packet_buffer.go index 646979d1e..9527416cf 100644 --- a/pkg/tcpip/stack/packet_buffer.go +++ b/pkg/tcpip/stack/packet_buffer.go @@ -364,9 +364,10 @@ func (d PacketData) PullUp(size int) (buffer.View, bool) { return d.pk.data.PullUp(size) } -// TrimFront removes count from the beginning of d. It panics if count > -// d.Size(). -func (d PacketData) TrimFront(count int) { +// DeleteFront removes count from the beginning of d. It panics if count > +// d.Size(). All backing storage references after the front of the d are +// invalidated. +func (d PacketData) DeleteFront(count int) { d.pk.data.TrimFront(count) } |