Re: [RFC v2 06/16] luo: luo_subsystems: add subsystem registration

From: Pasha Tatashin
Date: Sat Jun 07 2025 - 19:42:56 EST


> > +struct liveupdate_subsystem {
> > + int (*prepare)(void *arg, u64 *data);
> > + int (*freeze)(void *arg, u64 *data);
> > + void (*cancel)(void *arg, u64 data);
> > + void (*finish)(void *arg, u64 data);
>
> What is the intended use of arg in all these?

It can be used when multiple instances of the same subsystem want to
register. For example, if there is a host device driver registered
with LUO directly (i.e. devices that are not referenced through FDs),
it might use argument to distinguish between multiple instances of the
devices.

> > + const char *name;
> > + void *arg;
> > + struct list_head list;
> > + u64 private_data;
> > +};
>
> I suggest to split callbacks into, say, liveupdate_ops so we could constify
> them.
> And then it seems that the data in liveupdate_subsystem can be private to
> LUO.

Let's keep it as is. I do not really see a big advantage, subsystems
can still globally declare and set static callbacks in struct
liveupdate_subsystem { }

>
> > +
> > #ifdef CONFIG_LIVEUPDATE
> >
> > /* Return true if live update orchestrator is enabled */
> > @@ -105,6 +138,10 @@ bool liveupdate_state_updated(void);
> > */
> > bool liveupdate_state_normal(void);
> >
> > +int liveupdate_register_subsystem(struct liveupdate_subsystem *h);
>
> int liveupdate_register_subsystem(name, ops, data) ?
>
> > +int liveupdate_unregister_subsystem(struct liveupdate_subsystem *h);
> > +int liveupdate_get_subsystem_data(struct liveupdate_subsystem *h, u64 *data);
> > +
> > #else /* CONFIG_LIVEUPDATE */
>
> --
> Sincerely yours,
> Mike.