Clarify seek behaviour for kernfs.GenericDirectoryFD.

- Remove comment about GenericDirectoryFD not being compatible with
  dynamic directories. It is currently being used to implement dynamic
  directories.

- Try to handle SEEK_END better than setting the offset to
  infinity. SEEK_END is poorly defined for dynamic directories
  anyways, so at least try make it work correctly for the static
  entries.

Updates #1193.

PiperOrigin-RevId: 327890128
This commit is contained in:
Rahat Mahmood
2020-08-21 16:05:43 -07:00
committed by gVisor bot
parent 5f33fdf37e
commit 0ea03f501b
12 changed files with 89 additions and 31 deletions
+3 -1
View File
@@ -185,7 +185,9 @@ func (i *rootInode) masterClose(t *Terminal) {
// Open implements kernfs.Inode.Open.
func (i *rootInode) Open(ctx context.Context, rp *vfs.ResolvingPath, vfsd *vfs.Dentry, opts vfs.OpenOptions) (*vfs.FileDescription, error) {
fd, err := kernfs.NewGenericDirectoryFD(rp.Mount(), vfsd, &i.OrderedChildren, &i.locks, &opts)
fd, err := kernfs.NewGenericDirectoryFD(rp.Mount(), vfsd, &i.OrderedChildren, &i.locks, &opts, kernfs.GenericDirectoryFDOptions{
SeekEnd: kernfs.SeekEndStaticEntries,
})
if err != nil {
return nil, err
}