Minor filesystem cleanups

- Update the remaining platform.File references in comments and
  documentation. platform.File has been moved in memmap by commit
  f347a578b7 ("Move platform.File in memmap").

- Remove redundant bit operations in statTo in tmpfs. STATX_SIZE and
  STATX_BLOCKS has been set at the beginning of the function, there
  is no need to do it again for regular files.

- Change "\tmp" to "/tmp" in pathname, as '\' is not a valid path
  delimiter in Linux. "/tmp" looks better.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
This commit is contained in:
Tiwei Bie
2023-09-21 13:23:40 +08:00
parent 1531147bf2
commit 944d4185e4
5 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -950,7 +950,7 @@ type dentry struct {
// tracks dirty segments in cache. dirty is protected by dataMu.
dirty fsutil.DirtySet
// pf implements platform.File for mappings of hostFD.
// pf implements memmap.File for mappings of hostFD.
pf dentryPlatformFile
// If this dentry represents a symbolic link, InteropModeShared is not in
-1
View File
@@ -642,7 +642,6 @@ func (i *inode) statTo(stat *linux.Statx) {
stat.DevMinor = i.fs.devMinor
switch impl := i.impl.(type) {
case *regularFile:
stat.Mask |= linux.STATX_SIZE | linux.STATX_BLOCKS
stat.Size = uint64(impl.size.Load())
// TODO(jamieliu): This should be impl.data.Span() / 512, but this is
// too expensive to compute here. Cache it in regularFile.
+1 -1
View File
@@ -265,7 +265,7 @@ In the sentry:
[`memmap.Mappable.AddMapping` and `memmap.Mappable.RemoveMapping`][memmap].
- Host files that may be mapped into host VMAs are represented by type
[`platform.File`][platform].
[`memmap.File`][memmap].
- Host VMAs are represented in the sentry by type [`mm.pma`][mm] ("platform
mapping area"), stored in `mm.MemoryManager.pmas`.
+1 -1
View File
@@ -26,7 +26,7 @@ import (
// There are two supported ways to copy data to/from application virtual
// memory:
//
// 1. Internally-mapped copying: Determine the platform.File that backs the
// 1. Internally-mapped copying: Determine the memmap.File that backs the
// copied-to/from virtual address, obtain a mapping of its pages, and read or
// write to the mapping.
//
+1 -1
View File
@@ -704,7 +704,7 @@ func (c *containerMounter) mountSubmounts(ctx context.Context, conf *config.Conf
}
if err := c.mountTmp(ctx, conf, creds, mns); err != nil {
return fmt.Errorf(`mount submount "\tmp": %w`, err)
return fmt.Errorf(`mount submount "/tmp": %w`, err)
}
return nil
}