Moved to atomicbitops and renamed files

This commit is contained in:
Kevin Krakauer
2021-05-06 13:04:59 -07:00
parent 4c9340fcbf
commit 1e2ba26661
8 changed files with 13 additions and 8 deletions
+2
View File
@@ -5,6 +5,8 @@ package(licenses = ["notice"])
go_library(
name = "atomicbitops",
srcs = [
"aligned_32bit_unsafe.go",
"aligned_64bit.go",
"atomicbitops.go",
"atomicbitops_amd64.s",
"atomicbitops_arm64.s",
@@ -14,7 +14,7 @@
// +build arm 386
package tcpip
package atomicbitops
import (
"sync/atomic"
@@ -14,7 +14,7 @@
// +build !arm,!386
package tcpip
package atomicbitops
import "sync/atomic"
+1 -2
View File
@@ -19,8 +19,6 @@ go_template_instance(
go_library(
name = "tcpip",
srcs = [
"aligned.go",
"aligned_unsafe.go",
"errors.go",
"sock_err_list.go",
"socketops.go",
@@ -31,6 +29,7 @@ go_library(
],
visibility = ["//visibility:public"],
deps = [
"//pkg/atomicbitops",
"//pkg/sync",
"//pkg/tcpip/buffer",
"//pkg/waiter",
+2 -1
View File
@@ -18,6 +18,7 @@ import (
"math"
"sync/atomic"
"gvisor.dev/gvisor/pkg/atomicbitops"
"gvisor.dev/gvisor/pkg/sync"
)
@@ -213,7 +214,7 @@ type SocketOptions struct {
getSendBufferLimits GetSendBufferLimits `state:"manual"`
// sendBufferSize determines the send buffer size for this socket.
sendBufferSize AlignedAtomicInt64
sendBufferSize atomicbitops.AlignedAtomicInt64
// getReceiveBufferLimits provides the handler to get the min, default and
// max size for receive buffer. It is initialized at the creation time and
+1
View File
@@ -73,6 +73,7 @@ go_library(
],
visibility = ["//visibility:public"],
deps = [
"//pkg/atomicbitops",
"//pkg/ilist",
"//pkg/log",
"//pkg/rand",
+3 -2
View File
@@ -29,6 +29,7 @@ import (
"time"
"golang.org/x/time/rate"
"gvisor.dev/gvisor/pkg/atomicbitops"
"gvisor.dev/gvisor/pkg/rand"
"gvisor.dev/gvisor/pkg/sync"
"gvisor.dev/gvisor/pkg/tcpip"
@@ -65,10 +66,10 @@ type ResumableEndpoint interface {
}
// uniqueIDGenerator is a default unique ID generator.
type uniqueIDGenerator uint64
type uniqueIDGenerator atomicbitops.AlignedAtomicUint64
func (u *uniqueIDGenerator) UniqueID() uint64 {
return atomic.AddUint64((*uint64)(u), 1)
return ((*atomicbitops.AlignedAtomicUint64)(u)).Add(1)
}
// Stack is a networking stack, with all supported protocols, NICs, and route
+2 -1
View File
@@ -40,6 +40,7 @@ import (
"sync/atomic"
"time"
"gvisor.dev/gvisor/pkg/atomicbitops"
"gvisor.dev/gvisor/pkg/sync"
"gvisor.dev/gvisor/pkg/waiter"
)
@@ -1220,7 +1221,7 @@ type NetworkProtocolNumber uint32
// A StatCounter keeps track of a statistic.
type StatCounter struct {
count AlignedAtomicUint64
count atomicbitops.AlignedAtomicUint64
}
// Increment adds one to the counter.