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

Method GetXattrAt

pkg/sentry/fsimpl/kernfs/filesystem.go:1119–1142  ·  view source on GitHub ↗

GetXattrAt implements vfs.FilesystemImpl.GetXattrAt.

(ctx context.Context, rp *vfs.ResolvingPath, opts vfs.GetXattrOptions)

Source from the content-addressed store, hash-verified

1117
1118// GetXattrAt implements vfs.FilesystemImpl.GetXattrAt.
1119func (fs *Filesystem) GetXattrAt(ctx context.Context, rp *vfs.ResolvingPath, opts vfs.GetXattrOptions) (string, error) {
1120 fs.mu.RLock()
1121 defer fs.processDeferredDecRefs(ctx)
1122 defer fs.mu.RUnlock()
1123 d, err := fs.walkExistingLocked(ctx, rp)
1124 if err != nil {
1125 return "", err
1126 }
1127 if xi, ok := d.inode.(InodeWithXattrs); ok {
1128 creds := rp.Credentials()
1129 mode := d.inode.Mode()
1130 kuid := d.inode.UID()
1131 kgid := d.inode.GID()
1132 if err := vfs.GenericCheckPermissions(creds, vfs.MayRead, mode, kuid, kgid); err != nil {
1133 return "", err
1134 }
1135 if err := vfs.CheckXattrPermissions(creds, vfs.MayRead, mode, kuid, opts.Name); err != nil {
1136 return "", err
1137 }
1138 return xi.GetXattr(ctx, opts)
1139 }
1140 // kernfs currently does not support extended attributes.
1141 return "", linuxerr.ENOTSUP
1142}
1143
1144// SetXattrAt implements vfs.FilesystemImpl.SetXattrAt.
1145func (fs *Filesystem) SetXattrAt(ctx context.Context, rp *vfs.ResolvingPath, opts vfs.SetXattrOptions) error {

Callers

nothing calls this directly

Calls 11

walkExistingLockedMethod · 0.95
GenericCheckPermissionsFunction · 0.92
CheckXattrPermissionsFunction · 0.92
CredentialsMethod · 0.65
ModeMethod · 0.65
UIDMethod · 0.65
GIDMethod · 0.65
GetXattrMethod · 0.65
RLockMethod · 0.45
RUnlockMethod · 0.45

Tested by

no test coverage detected