mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Get rid of kernfs.Inode.Destroy.
This interface method is unneeded. PiperOrigin-RevId: 327370325
This commit is contained in:
@@ -432,17 +432,14 @@ func (i *inode) SetStat(ctx context.Context, fs *vfs.Filesystem, creds *auth.Cre
|
||||
|
||||
// DecRef implements kernfs.Inode.
|
||||
func (i *inode) DecRef(ctx context.Context) {
|
||||
i.AtomicRefCount.DecRefWithDestructor(ctx, i.Destroy)
|
||||
}
|
||||
|
||||
// Destroy implements kernfs.Inode.
|
||||
func (i *inode) Destroy(context.Context) {
|
||||
if i.wouldBlock {
|
||||
fdnotifier.RemoveFD(int32(i.hostFD))
|
||||
}
|
||||
if err := unix.Close(i.hostFD); err != nil {
|
||||
log.Warningf("failed to close host fd %d: %v", i.hostFD, err)
|
||||
}
|
||||
i.AtomicRefCount.DecRefWithDestructor(ctx, func(context.Context) {
|
||||
if i.wouldBlock {
|
||||
fdnotifier.RemoveFD(int32(i.hostFD))
|
||||
}
|
||||
if err := unix.Close(i.hostFD); err != nil {
|
||||
log.Warningf("failed to close host fd %d: %v", i.hostFD, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Open implements kernfs.Inode.
|
||||
|
||||
@@ -48,10 +48,6 @@ func (InodeNoopRefCount) TryIncRef() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Destroy implements Inode.Destroy.
|
||||
func (InodeNoopRefCount) Destroy(context.Context) {
|
||||
}
|
||||
|
||||
// InodeDirectoryNoNewChildren partially implements the Inode interface.
|
||||
// InodeDirectoryNoNewChildren represents a directory inode which does not
|
||||
// support creation of new children.
|
||||
@@ -367,15 +363,12 @@ func (o *OrderedChildren) Init(opts OrderedChildrenOptions) {
|
||||
|
||||
// DecRef implements Inode.DecRef.
|
||||
func (o *OrderedChildren) DecRef(ctx context.Context) {
|
||||
o.AtomicRefCount.DecRefWithDestructor(ctx, o.Destroy)
|
||||
}
|
||||
|
||||
// Destroy cleans up resources referenced by this OrderedChildren.
|
||||
func (o *OrderedChildren) Destroy(context.Context) {
|
||||
o.mu.Lock()
|
||||
defer o.mu.Unlock()
|
||||
o.order.Reset()
|
||||
o.set = nil
|
||||
o.AtomicRefCount.DecRefWithDestructor(ctx, func(context.Context) {
|
||||
o.mu.Lock()
|
||||
defer o.mu.Unlock()
|
||||
o.order.Reset()
|
||||
o.set = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Populate inserts children into this OrderedChildren, and d's dentry
|
||||
|
||||
@@ -328,10 +328,6 @@ type inodeRefs interface {
|
||||
IncRef()
|
||||
DecRef(ctx context.Context)
|
||||
TryIncRef() bool
|
||||
// Destroy is called when the inode reaches zero references. Destroy release
|
||||
// all resources (references) on objects referenced by the inode, including
|
||||
// any child dentries.
|
||||
Destroy(ctx context.Context)
|
||||
}
|
||||
|
||||
type inodeMetadata interface {
|
||||
|
||||
Reference in New Issue
Block a user