diff mbox

[Xen-devel,RFC,07/14] xen/xsm: flask: Fix compilation when CONFIG_COMPAT=y

Message ID 1394640969-25583-8-git-send-email-julien.grall@linaro.org
State RFC, archived
Headers show

Commit Message

Julien Grall March 12, 2014, 4:16 p.m. UTC
The commit f7d29f7b "flask: add compat mode guest support" introduces
build breakage on ARM when XSM is enabled. It's because ARM doesn't use
compat mode.

flask_op.c:794:34: fatal error: compat/event_channel.h: No such file or directory
 #include <compat/event_channel.h>

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
 xen/xsm/flask/flask_op.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel De Graaf March 13, 2014, 2:26 p.m. UTC | #1
On 03/12/2014 12:16 PM, Julien Grall wrote:
> The commit f7d29f7b "flask: add compat mode guest support" introduces
> build breakage on ARM when XSM is enabled. It's because ARM doesn't use
> compat mode.
>
> flask_op.c:794:34: fatal error: compat/event_channel.h: No such file or directory
>   #include <compat/event_channel.h>
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>

Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

> ---
>   xen/xsm/flask/flask_op.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
> index 3b84679..3eb3a01 100644
> --- a/xen/xsm/flask/flask_op.c
> +++ b/xen/xsm/flask/flask_op.c
> @@ -785,7 +785,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op)
>       return rv;
>   }
>
> -#ifndef COMPAT
> +#if !defined(COMPAT) && defined(CONFIG_COMPAT)
>   #undef _copy_to_guest
>   #define _copy_to_guest copy_to_compat
>   #undef _copy_from_guest
>
Ian Campbell March 14, 2014, 5:23 p.m. UTC | #2
On Thu, 2014-03-13 at 10:26 -0400, Daniel De Graaf wrote:
> On 03/12/2014 12:16 PM, Julien Grall wrote:

Julien, Did you mean =n in the subject?

> > The commit f7d29f7b "flask: add compat mode guest support" introduces
> > build breakage on ARM when XSM is enabled. It's because ARM doesn't use
> > compat mode.
> >
> > flask_op.c:794:34: fatal error: compat/event_channel.h: No such file or directory
> >   #include <compat/event_channel.h>
> >
> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> > Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> 
> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> 
> > ---
> >   xen/xsm/flask/flask_op.c |    2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
> > index 3b84679..3eb3a01 100644
> > --- a/xen/xsm/flask/flask_op.c
> > +++ b/xen/xsm/flask/flask_op.c
> > @@ -785,7 +785,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op)
> >       return rv;
> >   }
> >
> > -#ifndef COMPAT
> > +#if !defined(COMPAT) && defined(CONFIG_COMPAT)

I don't see this construct very much in the existing code. It looks like
the common idiom is just #ifdef CONFIG_COMPAT.

Jan, what's the right thing to do here?

Ian.
Julien Grall March 14, 2014, 6:08 p.m. UTC | #3
Hi Ian,

On 03/14/2014 05:23 PM, Ian Campbell wrote:
> On Thu, 2014-03-13 at 10:26 -0400, Daniel De Graaf wrote:
>> On 03/12/2014 12:16 PM, Julien Grall wrote:
> 
> Julien, Did you mean =n in the subject?

Oops, right. I will fix it in the next version.

Regards,
Jan Beulich March 17, 2014, 7:22 a.m. UTC | #4
>>> On 14.03.14 at 18:23, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Thu, 2014-03-13 at 10:26 -0400, Daniel De Graaf wrote:
>> On 03/12/2014 12:16 PM, Julien Grall wrote:
> 
> Julien, Did you mean =n in the subject?
> 
>> > The commit f7d29f7b "flask: add compat mode guest support" introduces
>> > build breakage on ARM when XSM is enabled. It's because ARM doesn't use
>> > compat mode.
>> >
>> > flask_op.c:794:34: fatal error: compat/event_channel.h: No such file or 
> directory
>> >   #include <compat/event_channel.h>
>> >
>> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> > Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
>> 
>> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
>> 
>> > ---
>> >   xen/xsm/flask/flask_op.c |    2 +-
>> >   1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
>> > index 3b84679..3eb3a01 100644
>> > --- a/xen/xsm/flask/flask_op.c
>> > +++ b/xen/xsm/flask/flask_op.c
>> > @@ -785,7 +785,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) 
> u_flask_op)
>> >       return rv;
>> >   }
>> >
>> > -#ifndef COMPAT
>> > +#if !defined(COMPAT) && defined(CONFIG_COMPAT)
> 
> I don't see this construct very much in the existing code. It looks like
> the common idiom is just #ifdef CONFIG_COMPAT.
> 
> Jan, what's the right thing to do here?

The construct is appropriate here (albeit I'd switch the operands
of &&) - elsewhere inclusion goes indirectly, with the two checks
in distinct places. It didn't seem worthwhile introducing a separate
file here for the compat mode wrapping, so the check can validly
be done in a single conditional.

Jan
Ian Campbell March 17, 2014, 10:15 a.m. UTC | #5
On Mon, 2014-03-17 at 07:22 +0000, Jan Beulich wrote:
> >>> On 14.03.14 at 18:23, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> > On Thu, 2014-03-13 at 10:26 -0400, Daniel De Graaf wrote:
> >> On 03/12/2014 12:16 PM, Julien Grall wrote:
> > 
> > Julien, Did you mean =n in the subject?
> > 
> >> > The commit f7d29f7b "flask: add compat mode guest support" introduces
> >> > build breakage on ARM when XSM is enabled. It's because ARM doesn't use
> >> > compat mode.
> >> >
> >> > flask_op.c:794:34: fatal error: compat/event_channel.h: No such file or 
> > directory
> >> >   #include <compat/event_channel.h>
> >> >
> >> > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> >> > Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> >> 
> >> Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> >> 
> >> > ---
> >> >   xen/xsm/flask/flask_op.c |    2 +-
> >> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >> > diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
> >> > index 3b84679..3eb3a01 100644
> >> > --- a/xen/xsm/flask/flask_op.c
> >> > +++ b/xen/xsm/flask/flask_op.c
> >> > @@ -785,7 +785,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) 
> > u_flask_op)
> >> >       return rv;
> >> >   }
> >> >
> >> > -#ifndef COMPAT
> >> > +#if !defined(COMPAT) && defined(CONFIG_COMPAT)
> > 
> > I don't see this construct very much in the existing code. It looks like
> > the common idiom is just #ifdef CONFIG_COMPAT.
> > 
> > Jan, what's the right thing to do here?
> 
> The construct is appropriate here (albeit I'd switch the operands
> of &&) - elsewhere inclusion goes indirectly, with the two checks
> in distinct places. It didn't seem worthwhile introducing a separate
> file here for the compat mode wrapping, so the check can validly
> be done in a single conditional.

Makes sense, thanks.

Ian.
Julien Grall March 17, 2014, 11:57 a.m. UTC | #6
Hi Jan,

On 03/17/2014 07:22 AM, Jan Beulich wrote:
> The construct is appropriate here (albeit I'd switch the operands
> of &&) - elsewhere inclusion goes indirectly, with the two checks
> in distinct places. It didn't seem worthwhile introducing a separate
> file here for the compat mode wrapping, so the check can validly
> be done in a single conditional.

I will switch the operand in the next version.

Regards,
diff mbox

Patch

diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index 3b84679..3eb3a01 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -785,7 +785,7 @@  ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op)
     return rv;
 }
 
-#ifndef COMPAT
+#if !defined(COMPAT) && defined(CONFIG_COMPAT)
 #undef _copy_to_guest
 #define _copy_to_guest copy_to_compat
 #undef _copy_from_guest