summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/buffer
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-13 20:11:56 +0000
committergVisor bot <gvisor-bot@google.com>2020-08-13 20:11:56 +0000
commitf8e003defed3b62890933a3d7eaaaee2529d413b (patch)
treeb9578ae0be7b08891f2acb7f90c87a93409a90c3 /pkg/tcpip/buffer
parent8b0712eb214705d5af3d2b726866e093d86d89fe (diff)
parent47515f475167ffa23267ca0b9d1b39e7907587d6 (diff)
Merge release-20200810.0-23-g47515f475 (automated)
Diffstat (limited to 'pkg/tcpip/buffer')
-rw-r--r--pkg/tcpip/buffer/view.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/tcpip/buffer/view.go b/pkg/tcpip/buffer/view.go
index 9a3c5d6c3..ea0c5413d 100644
--- a/pkg/tcpip/buffer/view.go
+++ b/pkg/tcpip/buffer/view.go
@@ -65,6 +65,16 @@ func (v View) ToVectorisedView() VectorisedView {
return NewVectorisedView(len(v), []View{v})
}
+// IsEmpty returns whether v is of length zero.
+func (v View) IsEmpty() bool {
+ return len(v) == 0
+}
+
+// Size returns the length of v.
+func (v View) Size() int {
+ return len(v)
+}
+
// VectorisedView is a vectorised version of View using non contiguous memory.
// It supports all the convenience methods supported by View.
//