mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
[vfs] kernfs: cleanup/refactor.
PiperOrigin-RevId: 338728070
This commit is contained in:
@@ -145,8 +145,12 @@ func (fd *GenericDirectoryFD) filesystem() *vfs.Filesystem {
|
||||
return fd.vfsfd.VirtualDentry().Mount().Filesystem()
|
||||
}
|
||||
|
||||
func (fd *GenericDirectoryFD) dentry() *Dentry {
|
||||
return fd.vfsfd.Dentry().Impl().(*Dentry)
|
||||
}
|
||||
|
||||
func (fd *GenericDirectoryFD) inode() Inode {
|
||||
return fd.vfsfd.VirtualDentry().Dentry().Impl().(*Dentry).inode
|
||||
return fd.dentry().inode
|
||||
}
|
||||
|
||||
// IterDirents implements vfs.FileDescriptionImpl.IterDirents. IterDirents holds
|
||||
@@ -176,8 +180,7 @@ func (fd *GenericDirectoryFD) IterDirents(ctx context.Context, cb vfs.IterDirent
|
||||
|
||||
// Handle "..".
|
||||
if fd.off == 1 {
|
||||
vfsd := fd.vfsfd.VirtualDentry().Dentry()
|
||||
parentInode := genericParentOrSelf(vfsd.Impl().(*Dentry)).inode
|
||||
parentInode := genericParentOrSelf(fd.dentry()).inode
|
||||
stat, err := parentInode.Stat(ctx, fd.filesystem(), opts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -265,8 +268,7 @@ func (fd *GenericDirectoryFD) Stat(ctx context.Context, opts vfs.StatOptions) (l
|
||||
// SetStat implements vfs.FileDescriptionImpl.SetStat.
|
||||
func (fd *GenericDirectoryFD) SetStat(ctx context.Context, opts vfs.SetStatOptions) error {
|
||||
creds := auth.CredentialsFromContext(ctx)
|
||||
inode := fd.vfsfd.VirtualDentry().Dentry().Impl().(*Dentry).inode
|
||||
return inode.SetStat(ctx, fd.filesystem(), creds, opts)
|
||||
return fd.inode().SetStat(ctx, fd.filesystem(), creds, opts)
|
||||
}
|
||||
|
||||
// Allocate implements vfs.FileDescriptionImpl.Allocate.
|
||||
|
||||
Reference in New Issue
Block a user