1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

O_PATH: allow vfs_extattr syscalls

These calls do operate on vnodes only, not file contents.
This is useful for e.g. the xdg-document-portal fuse filesystem.

Reviewed by:	kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32438
This commit is contained in:
Greg V 2021-10-10 15:45:31 +03:00 committed by Konstantin Belousov
parent 8da2705253
commit 98dae405de
2 changed files with 10 additions and 5 deletions

View File

@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 7, 2020
.Dd October 11, 2021
.Dt EXTATTR 2
.Os
.Sh NAME
@ -149,6 +149,11 @@ functions take a file descriptor, while the
functions take a path.
Both arguments describe a file associated with the extended attribute
that should be manipulated.
The
.Qq Li _fd
functions can be used with file descriptors opened with the
.Dv O_PATH
flag.
.Pp
The following arguments are common to all the system calls described here:
.Bl -tag -width attrnamespace

View File

@ -242,7 +242,7 @@ sys_extattr_set_fd(struct thread *td, struct extattr_set_fd_args *uap)
return (error);
AUDIT_ARG_TEXT(attrname);
error = getvnode(td, uap->fd,
error = getvnode_path(td, uap->fd,
cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp);
if (error)
return (error);
@ -409,7 +409,7 @@ sys_extattr_get_fd(struct thread *td, struct extattr_get_fd_args *uap)
return (error);
AUDIT_ARG_TEXT(attrname);
error = getvnode(td, uap->fd,
error = getvnode_path(td, uap->fd,
cap_rights_init_one(&rights, CAP_EXTATTR_GET), &fp);
if (error)
return (error);
@ -544,7 +544,7 @@ sys_extattr_delete_fd(struct thread *td, struct extattr_delete_fd_args *uap)
return (error);
AUDIT_ARG_TEXT(attrname);
error = getvnode(td, uap->fd,
error = getvnode_path(td, uap->fd,
cap_rights_init_one(&rights, CAP_EXTATTR_DELETE), &fp);
if (error)
return (error);
@ -690,7 +690,7 @@ sys_extattr_list_fd(struct thread *td, struct extattr_list_fd_args *uap)
AUDIT_ARG_FD(uap->fd);
AUDIT_ARG_VALUE(uap->attrnamespace);
error = getvnode(td, uap->fd,
error = getvnode_path(td, uap->fd,
cap_rights_init_one(&rights, CAP_EXTATTR_LIST), &fp);
if (error)
return (error);