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

Method RemoveXattrAt

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

RemoveXattrAt implements vfs.FilesystemImpl.RemoveXattrAt.

(ctx context.Context, rp *vfs.ResolvingPath, name string)

Source from the content-addressed store, hash-verified

1169
1170// RemoveXattrAt implements vfs.FilesystemImpl.RemoveXattrAt.
1171func (fs *Filesystem) RemoveXattrAt(ctx context.Context, rp *vfs.ResolvingPath, name string) error {
1172 fs.mu.RLock()
1173 defer fs.processDeferredDecRefs(ctx)
1174 defer fs.mu.RUnlock()
1175 d, err := fs.walkExistingLocked(ctx, rp)
1176 if err != nil {
1177 return err
1178 }
1179 if xi, ok := d.inode.(InodeWithXattrs); ok {
1180 creds := rp.Credentials()
1181 mode := d.inode.Mode()
1182 kuid := d.inode.UID()
1183 kgid := d.inode.GID()
1184 if err := vfs.GenericCheckPermissions(creds, vfs.MayWrite, mode, kuid, kgid); err != nil {
1185 return err
1186 }
1187 if err := vfs.CheckXattrPermissions(creds, vfs.MayWrite, mode, kuid, name); err != nil {
1188 return err
1189 }
1190 return xi.RemoveXattr(ctx, name)
1191 }
1192 // kernfs currently does not support extended attributes.
1193 return linuxerr.ENOTSUP
1194}
1195
1196// PrependPath implements vfs.FilesystemImpl.PrependPath.
1197func (fs *Filesystem) PrependPath(ctx context.Context, vfsroot, vd vfs.VirtualDentry, b *fspath.Builder) 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
RemoveXattrMethod · 0.65
RLockMethod · 0.45
RUnlockMethod · 0.45

Tested by

no test coverage detected