[PATCH v2] Constify some parameters

Frediano Ziglio posted 1 patch 2 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20240214094734.13533-1-frediano.ziglio@cloud.com
xen/arch/x86/pv/callback.c | 4 ++--
xen/common/sched/compat.c  | 2 +-
xen/common/sched/core.c    | 2 +-
xen/xsm/flask/flask_op.c   | 8 ++++----
4 files changed, 8 insertions(+), 8 deletions(-)
[PATCH v2] Constify some parameters
Posted by Frediano Ziglio 2 months, 3 weeks ago
Make clear they are not changed in the functions.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
--
v2:
- fixed typo in commit message.
---
 xen/arch/x86/pv/callback.c | 4 ++--
 xen/common/sched/compat.c  | 2 +-
 xen/common/sched/core.c    | 2 +-
 xen/xsm/flask/flask_op.c   | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
index 17829304fe..caec4fb16f 100644
--- a/xen/arch/x86/pv/callback.c
+++ b/xen/arch/x86/pv/callback.c
@@ -48,7 +48,7 @@ static void unregister_guest_nmi_callback(void)
     memset(t, 0, sizeof(*t));
 }
 
-static long register_guest_callback(struct callback_register *reg)
+static long register_guest_callback(const struct callback_register *reg)
 {
     long ret = 0;
     struct vcpu *curr = current;
@@ -102,7 +102,7 @@ static long register_guest_callback(struct callback_register *reg)
     return ret;
 }
 
-static long unregister_guest_callback(struct callback_unregister *unreg)
+static long unregister_guest_callback(const struct callback_unregister *unreg)
 {
     long ret;
 
diff --git a/xen/common/sched/compat.c b/xen/common/sched/compat.c
index dd97593630..a02204ec9a 100644
--- a/xen/common/sched/compat.c
+++ b/xen/common/sched/compat.c
@@ -26,7 +26,7 @@ CHECK_sched_shutdown;
 CHECK_sched_remote_shutdown;
 #undef xen_sched_remote_shutdown
 
-static int compat_poll(struct compat_sched_poll *compat)
+static int compat_poll(const struct compat_sched_poll *compat)
 {
     struct sched_poll native;
 
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index d177c675c8..c5db373972 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1431,7 +1431,7 @@ static void vcpu_block_enable_events(void)
     vcpu_block();
 }
 
-static long do_poll(struct sched_poll *sched_poll)
+static long do_poll(const struct sched_poll *sched_poll)
 {
     struct vcpu   *v = current;
     struct domain *d = v->domain;
diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index b866e8d05f..ea7dd10dc8 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -469,7 +469,7 @@ static int flask_security_load(struct xen_flask_load *load)
     return ret;
 }
 
-static int flask_devicetree_label(struct xen_flask_devicetree_label *arg)
+static int flask_devicetree_label(const struct xen_flask_devicetree_label *arg)
 {
     int rv;
     char *buf;
@@ -492,7 +492,7 @@ static int flask_devicetree_label(struct xen_flask_devicetree_label *arg)
 
 #ifndef COMPAT
 
-static int flask_ocontext_del(struct xen_flask_ocontext *arg)
+static int flask_ocontext_del(const struct xen_flask_ocontext *arg)
 {
     int rv;
 
@@ -506,7 +506,7 @@ static int flask_ocontext_del(struct xen_flask_ocontext *arg)
     return security_ocontext_del(arg->ocon, arg->low, arg->high);
 }
 
-static int flask_ocontext_add(struct xen_flask_ocontext *arg)
+static int flask_ocontext_add(const struct xen_flask_ocontext *arg)
 {
     int rv;
 
@@ -550,7 +550,7 @@ static int flask_get_peer_sid(struct xen_flask_peersid *arg)
     return rv;
 }
 
-static int flask_relabel_domain(struct xen_flask_relabel *arg)
+static int flask_relabel_domain(const struct xen_flask_relabel *arg)
 {
     int rc;
     struct domain *d;
-- 
2.34.1
Re: [PATCH v2] Constify some parameters
Posted by George Dunlap 2 months, 2 weeks ago
On Wed, Feb 14, 2024 at 5:48 PM Frediano Ziglio
<frediano.ziglio@cloud.com> wrote:
>
> Make clear they are not changed in the functions.
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Sched bits:

Acked-by: George Dunlap <george.dunlap@cloud.com>
Re: [PATCH v2] Constify some parameters
Posted by Daniel P. Smith 2 months, 2 weeks ago
For XSM changes,

Ack-by: Daniel P. Smith <dpsmith@apertussolutions.com>

V/r,
Daniel P. Smith
Apertus Solutions, LLC

On 2/14/24 04:47, Frediano Ziglio wrote:
> Make clear they are not changed in the functions.
>
> Signed-off-by: Frediano Ziglio<frediano.ziglio@cloud.com>
> Reviewed-by: Jan Beulich<jbeulich@suse.com>
> --
> v2:
> - fixed typo in commit message.
> ---
>   xen/arch/x86/pv/callback.c | 4 ++--
>   xen/common/sched/compat.c  | 2 +-
>   xen/common/sched/core.c    | 2 +-
>   xen/xsm/flask/flask_op.c   | 8 ++++----
>   4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
> index 17829304fe..caec4fb16f 100644
> --- a/xen/arch/x86/pv/callback.c
> +++ b/xen/arch/x86/pv/callback.c
> @@ -48,7 +48,7 @@ static void unregister_guest_nmi_callback(void)
>       memset(t, 0, sizeof(*t));
>   }
>   
> -static long register_guest_callback(struct callback_register *reg)
> +static long register_guest_callback(const struct callback_register *reg)
>   {
>       long ret = 0;
>       struct vcpu *curr = current;
> @@ -102,7 +102,7 @@ static long register_guest_callback(struct callback_register *reg)
>       return ret;
>   }
>   
> -static long unregister_guest_callback(struct callback_unregister *unreg)
> +static long unregister_guest_callback(const struct callback_unregister *unreg)
>   {
>       long ret;
>   
> diff --git a/xen/common/sched/compat.c b/xen/common/sched/compat.c
> index dd97593630..a02204ec9a 100644
> --- a/xen/common/sched/compat.c
> +++ b/xen/common/sched/compat.c
> @@ -26,7 +26,7 @@ CHECK_sched_shutdown;
>   CHECK_sched_remote_shutdown;
>   #undef xen_sched_remote_shutdown
>   
> -static int compat_poll(struct compat_sched_poll *compat)
> +static int compat_poll(const struct compat_sched_poll *compat)
>   {
>       struct sched_poll native;
>   
> diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
> index d177c675c8..c5db373972 100644
> --- a/xen/common/sched/core.c
> +++ b/xen/common/sched/core.c
> @@ -1431,7 +1431,7 @@ static void vcpu_block_enable_events(void)
>       vcpu_block();
>   }
>   
> -static long do_poll(struct sched_poll *sched_poll)
> +static long do_poll(const struct sched_poll *sched_poll)
>   {
>       struct vcpu   *v = current;
>       struct domain *d = v->domain;
> diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
> index b866e8d05f..ea7dd10dc8 100644
> --- a/xen/xsm/flask/flask_op.c
> +++ b/xen/xsm/flask/flask_op.c
> @@ -469,7 +469,7 @@ static int flask_security_load(struct xen_flask_load *load)
>       return ret;
>   }
>   
> -static int flask_devicetree_label(struct xen_flask_devicetree_label *arg)
> +static int flask_devicetree_label(const struct xen_flask_devicetree_label *arg)
>   {
>       int rv;
>       char *buf;
> @@ -492,7 +492,7 @@ static int flask_devicetree_label(struct xen_flask_devicetree_label *arg)
>   
>   #ifndef COMPAT
>   
> -static int flask_ocontext_del(struct xen_flask_ocontext *arg)
> +static int flask_ocontext_del(const struct xen_flask_ocontext *arg)
>   {
>       int rv;
>   
> @@ -506,7 +506,7 @@ static int flask_ocontext_del(struct xen_flask_ocontext *arg)
>       return security_ocontext_del(arg->ocon, arg->low, arg->high);
>   }
>   
> -static int flask_ocontext_add(struct xen_flask_ocontext *arg)
> +static int flask_ocontext_add(const struct xen_flask_ocontext *arg)
>   {
>       int rv;
>   
> @@ -550,7 +550,7 @@ static int flask_get_peer_sid(struct xen_flask_peersid *arg)
>       return rv;
>   }
>   
> -static int flask_relabel_domain(struct xen_flask_relabel *arg)
> +static int flask_relabel_domain(const struct xen_flask_relabel *arg)
>   {
>       int rc;
>       struct domain *d;