Re: PATCH v6 3/6] livepatch: Initial support for dynamic structures

From: Petr Mladek
Date: Mon Feb 05 2018 - 05:33:31 EST


On Wed 2018-01-31 16:39:04, Miroslav Benes wrote:
> On Thu, 25 Jan 2018, Petr Mladek wrote:
>
> > From: Jason Baron <jbaron@xxxxxxxxxx>
> >
> > We are going to add a feature called atomic replace. It will allow to
> > create a patch that would replace all already registered patches.
> > For this, we will need to dynamically create funcs' and objects'
> > for functions that are not longer patched.
> >
> > This patch adds basic framework to handle such dynamic structures.
> >
> > diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> > index e5db2ba7e2a5..21cad200f949 100644
> > --- a/include/linux/livepatch.h
> > +++ b/include/linux/livepatch.h
> > @@ -35,12 +35,22 @@
> > #define KLP_UNPATCHED 0
> > #define KLP_PATCHED 1
> >
> > +/*
> > + * Function type is used to distinguish dynamically allocated structures
> > + * and limit some operations.
> > + */
> > +enum klp_func_type {
> > + KLP_FUNC_ANY = -1, /* Substitute any type */
> > + KLP_FUNC_ORIGINAL = 0, /* Original statically defined structure */
>
> Wouldn't KLP_FUNC_STATIC be better? KLP_FUNC_ORIGINAL confused me couple
> of times.

OK, I am going to use KLP_FUNC_STATIC in v7.

Best Regards,
Petr