|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3] xsm: add a default policy to .init.data
On Fri, Jul 01, 2016 at 01:19:51AM -0600, Jan Beulich wrote:
> >>> On 30.06.16 at 17:13, <konrad.wilk@xxxxxxxxxx> wrote:
> > On Thu, Jun 30, 2016 at 10:01:18AM -0400, Daniel De Graaf wrote:
> >> On 06/30/2016 09:45 AM, Konrad Rzeszutek Wilk wrote:
> >> > On Wed, Jun 29, 2016 at 11:09:01AM -0400, Daniel De Graaf wrote:
> >> > > --- a/xen/xsm/xsm_core.c
> >> > > +++ b/xen/xsm/xsm_core.c
> >> > > @@ -36,6 +36,24 @@ static inline int verify(struct xsm_operations *ops)
> >> > > return 0;
> >> > > }
> >> > >
> >> > > +#ifdef CONFIG_XSM_POLICY
> >> > > +extern char xsm_init_policy[];
> >> >
> >> > > +extern int xsm_init_policy_size;
> >> > > +#else
> >> > > +#define xsm_init_policy 0
> >> > > +#endif
> >> > > +
> >> > > +static void __init xsm_policy_init(void)
> >> > > +{
> >> > > +#ifdef CONFIG_XSM_POLICY
> >> > > + if ( policy_size == 0 )
> >> > > + {
> >> > > + policy_buffer = xsm_init_policy;
> >> > > + policy_size = xsm_init_policy_size;
> >> > > + }
> >> > > +#endif
> >> > > +}
> >> > > +
> >> >
> >> > This all looks like it could go in a header file?
> >>
> >> Sure, I could move it to xsm.h. I thought it might be clearer to have the
> >> assignment and the xfree() check in the same file.
> >
> > You are the maintainer of that code, so it is your call.
> >
> > Having externs in C code is not that great (from my perspective),
> > so if you move all of this to a header file that should get easier?
>
> I agree, fwiw, for the extern-s to be moved to a header. That
> header should then also be included by the generated source
> file producing the symbols. I don't, however, see why the
> function should go to a header.
I was thinking that since the function is a nop under #CONFIG_XSM_POLICY
you could just make it an inline static function, like:
#ifdef CONFIG_XSM_POLICY
static inline void xsm_policy_init(void)
{...
}
#else
#define xsm_policy_init(void) ;
#endif
Or such.
But this is really minor, and pls ignore it if means doing more work than
neccessary.
>
> Jan
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |