[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] normal: Move common datetime functions out of the normal mod
From: |
Daniel Kiper |
Subject: |
Re: [PATCH] normal: Move common datetime functions out of the normal module |
Date: |
Tue, 18 Feb 2020 17:13:43 +0100 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Fri, Feb 14, 2020 at 12:44:14PM +0100, Javier Martinez Canillas wrote:
> The common datetime helper functions are currently included in the normal
> module, but this makes any other module that calls these functions to have
> a dependency with the normal module only for this reason.
>
> Since the normal module does a lot of stuff, it calls functions from other
> modules. But since other modules may depend on it for calling the datetime
> helpers, this could lead to circular dependencies between modules.
>
> As an example, when platform == xen the grub_get_datetime() function from
> the datetime module calls to the grub_unixtime2datetime() helper function
> from the normal module. Which leads to the following module dependency:
>
> datetime -> normal
>
> and send_dhcp_packet() from the net module calls the grub_get_datetime()
> function, which leads to the following module dependency:
>
> net -> datetime -> normal
>
> but that means that the normal module is not allowed to depend on net or
> any other module that depends on it due the transitive dependency caused
> by datetime. A recent patch attempted to add support to fetch the config
> file over the network, which leads to the following circular dependency:
>
> normal -> net -> datetime -> normal
>
> So having the datetime helpers in the normal module makes it quite fragile
> and easy to add circular dependencies like these, that break the build due
> the genmoddep.awk script catching the issues.
>
> Fix this by taking the datetime helper functions out of the normal module
> and instead add them to the datetime module itself. Besides fixing these
> issues, it makes more sense to have these helper functions there anyways.
>
> Reported-by: Daniel Kiper <address@hidden>
> Signed-off-by: Javier Martinez Canillas <address@hidden>
Reviewed-by: Daniel Kiper <address@hidden>
...and pushed with the rest of your patches...
Thank you for doing the work!
Daniel