On 05.12.2025 21:36, Milan Djokic wrote:
> Return -EOPNOTSUPP when XEN_DOMCTL_set_access_required command is invoked
> while VM events and monitoring support is disabled.
This is more bounded than the pretty wide subject. Taking the subject and
considering there are other VM_EVENT related domctl-s, is this one really
the only one in need of adjustment?
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -787,19 +787,22 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t)
> u_domctl)
> copyback = true;
> break;
>
> -#ifdef CONFIG_VM_EVENT
> case XEN_DOMCTL_set_access_required:
> - if ( unlikely(current->domain == d) ) /* no domain_pause() */
> - ret = -EPERM;
> + if ( !IS_ENABLED(CONFIG_VM_EVENT) )
> + ret = -EOPNOTSUPP;
> else
If you convert this to
else if ( unlikely(current->domain == d) ) /* no domain_pause() */
then ...
> {
> - domain_pause(d);
> - arch_p2m_set_access_required(d,
> - op->u.access_required.access_required);
> - domain_unpause(d);
> + if ( unlikely(current->domain == d) ) /* no domain_pause() */
> + ret = -EPERM;
> + else
> + {
> + domain_pause(d);
> + arch_p2m_set_access_required(d,
> + op->u.access_required.access_required);
> + domain_unpause(d);
> + }
... the need for re-indenting disappears, and we get away with less churn.
Jan