summaryrefslogtreecommitdiffhomepage
path: root/pkg/refs/refcounter.go
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2021-05-04 15:56:05 -0700
committergVisor bot <gvisor-bot@google.com>2021-05-04 15:58:43 -0700
commitd496c285aacff88bb858e4efd700aa1e0b2ebad1 (patch)
tree67b00752d65ba665ccf129fd3736d57e71251966 /pkg/refs/refcounter.go
parent95df852bf283bf5eb173cc92b14d487b2367a8a7 (diff)
Add TODOs to old reference counting utility.
PiperOrigin-RevId: 372012795
Diffstat (limited to 'pkg/refs/refcounter.go')
-rw-r--r--pkg/refs/refcounter.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/refs/refcounter.go b/pkg/refs/refcounter.go
index 6992e1de8..4aecb8007 100644
--- a/pkg/refs/refcounter.go
+++ b/pkg/refs/refcounter.go
@@ -30,6 +30,9 @@ import (
// RefCounter is the interface to be implemented by objects that are reference
// counted.
+//
+// TODO(gvisor.dev/issue/1624): Get rid of most of this package and replace it
+// with refsvfs2.
type RefCounter interface {
// IncRef increments the reference counter on the object.
IncRef()
@@ -181,6 +184,9 @@ func (w *WeakRef) zap() {
// AtomicRefCount keeps a reference count using atomic operations and calls the
// destructor when the count reaches zero.
//
+// Do not use AtomicRefCount for new ref-counted objects! It is deprecated in
+// favor of the refsvfs2 package.
+//
// N.B. To allow the zero-object to be initialized, the count is offset by
// 1, that is, when refCount is n, there are really n+1 references.
//
@@ -215,8 +221,8 @@ type AtomicRefCount struct {
// LeakMode configures the leak checker.
type LeakMode uint32
-// TODO(gvisor.dev/issue/1624): Simplify down to two modes once vfs1 ref
-// counting is gone.
+// TODO(gvisor.dev/issue/1624): Simplify down to two modes (on/off) once vfs1
+// ref counting is gone.
const (
// UninitializedLeakChecking indicates that the leak checker has not yet been initialized.
UninitializedLeakChecking LeakMode = iota