On Fri, Jan 21, 2022 at 09:04:25PM +0000, David Carlier wrote:
> Second patch of the patchset concerning the update of the addon itself.

> From d541d8dfd8aa0290625b3824bd6b44d2861e997f Mon Sep 17 00:00:00 2001
> From: David Carlier <[email protected]>
> Date: Fri, 21 Jan 2022 20:51:20 +0000
> Subject: [PATCH 2/3] MEDIUM: deviceatlas update of the main module.
                               ^^^^^^^^^^^
                               da:

Also please avoid generic messages like "update the main module" because
an update is not the purpose of a commit, which by definition is an update.
Prefer more explanattory messages such as:

  "MEDIUM: da: support database runtime updates"

> The DeviceAtlas addon can optionally interacts with the new service
>  without change of configuration in the HAProxy part.
> Note that however it requires the DeviceAtlas Identification C API
> 2.4.0 minimum from this point.
> 
> Signed-off-by: David Carlier <[email protected]>

(...)
> +#ifdef USE_THREAD
> +__decl_spinlock(dadwsch_lock);
> +#endif

For this one you can do that:

  __decl_thread(HA_SPINLOCK_T dadwsch_lock);

It will only do it when USE_THREAD is set and save you an ifdef.

> @@ -163,6 +177,16 @@ static int init_deviceatlas(void)
>  
>               global_deviceatlas.useragentid = 
> da_atlas_header_evidence_id(&global_deviceatlas.atlas,
>                       "user-agent");
> +             if ((global_deviceatlas.atlasfd = shm_open(ATLASMAPNM, O_RDWR, 
> 0660)) != -1) {
> +                     global_deviceatlas.atlasmap = mmap(NULL, ATLASTOKSZ, 
> PROT_READ | PROT_WRITE, MAP_SHARED, global_deviceatlas.atlasfd, 0);
> +                     if (global_deviceatlas.atlasmap == MAP_FAILED) {
> +                             close(global_deviceatlas.atlasfd);
> +                             global_deviceatlas.atlasfd = -1;
> +                             global_deviceatlas.atlasmap = NULL;
> +                     } else {
> +                             fprintf(stdout, "deviceatlas : scheduling 
> support.\n");

This message is still confusing because it's unclear whether it reports
a detected feature or an anomaly. Think for example about someone facing
it on a machine exhibiting a problem and not having it on a machine that
works fine, it would then be understandable that it's taken for an error
message. Maybe "Deviceatlas: scheduling support enabled." would do it ?

OK for the rest of this patch at first glance, however now I'm getting
this build error:

addons/deviceatlas/da.c: In function 'da_haproxy_checkinst':
addons/deviceatlas/da.c:236:8: warning: implicit declaration of function 
'da_atlas_read_mapped' [-Wimplicit-function-declaration]
addons/deviceatlas/da.o: In function `da_haproxy_checkinst':
/g/public/haproxy/addons/deviceatlas/da.c:236: undefined reference to 
`da_atlas_read_mapped'
collect2: error: ld returned 1 exit status
distcc[12485] ERROR: compile (null) on localhost failed
make: *** [Makefile:952: haproxy] Error 1

So it seems to me that the dummy lib missed an update (I guess you tested
with the real lib only and forgot about that one).

Willy

Reply via email to