MCPcopy
hub / github.com/google/gvisor / convertStatxToUserStat

Function convertStatxToUserStat

pkg/sentry/syscalls/linux/sys_stat_arm64.go:28–47  ·  view source on GitHub ↗

This takes both input and output as pointer arguments to avoid copying large structs.

(t *kernel.Task, statx *linux.Statx, stat *linux.Stat)

Source from the content-addressed store, hash-verified

26// This takes both input and output as pointer arguments to avoid copying large
27// structs.
28func convertStatxToUserStat(t *kernel.Task, statx *linux.Statx, stat *linux.Stat) {
29 // Linux just copies fields from struct kstat without regard to struct
30 // kstat::result_mask (fs/stat.c:cp_new_stat()), so we do too.
31 userns := t.UserNamespace()
32 *stat = linux.Stat{
33 Dev: uint64(linux.MakeDeviceID(uint16(statx.DevMajor), statx.DevMinor)),
34 Ino: statx.Ino,
35 Nlink: uint32(statx.Nlink),
36 Mode: uint32(statx.Mode),
37 UID: uint32(auth.KUID(statx.UID).In(userns).OrOverflow()),
38 GID: uint32(auth.KGID(statx.GID).In(userns).OrOverflow()),
39 Rdev: uint64(linux.MakeDeviceID(uint16(statx.RdevMajor), statx.RdevMinor)),
40 Size: int64(statx.Size),
41 Blksize: int32(statx.Blksize),
42 Blocks: int64(statx.Blocks),
43 ATime: timespecFromStatxTimestamp(statx.Atime),
44 MTime: timespecFromStatxTimestamp(statx.Mtime),
45 CTime: timespecFromStatxTimestamp(statx.Ctime),
46 }
47}

Callers

nothing calls this directly

Calls 7

MakeDeviceIDFunction · 0.92
KUIDTypeAlias · 0.92
KGIDTypeAlias · 0.92
UserNamespaceMethod · 0.65
OrOverflowMethod · 0.45
InMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…