On 3/15/23 15:01, Eric Blake wrote:
[...]
Thanks for the thorough review; I'm glad all the fine points I sought to
put in the patch were received -- and well-received! :)
One question:
The only change I recommend is the addition of the __attribute__;
but
with or without it, I'm happy with:
Do we have general rules on attribute usage in libnbd vs. nbdkit?
The __sentinel__ (aka sentinel) attribute is used in nbdkit, but not yet
in libnbd. Now, that could be happenstance, but it rhymes with another
(obscure?) discrepancy in attribute usage.
Namely, when I was comparing the common/ subdirectories of both
projects, I noticed that nbdkit used the cleanup attribute, and libnbd
didn't. First I thought it was a mistake / oversight, but then I found a
porting note from Rich, in libnbd commit f306e231d294 ("common/utils:
Add extensible string, based on vector", 2022-03-12):
RWMJ: This removes the CLEANUP_FREE_STRING macro since libnbd does not
use __attribute__((cleanup)).
and then again in f3828bfd42be ("common/utils: Add new string vector
types", 2022-03-12):
RWMJ: Removed the CLEANUP_* macros.
So those comments (esp. the one on commit f306e231d294) at least confirm
that the difference is intentional. I still don't know the reason for
the difference. And now I wonder: does the same (unexplained) reason
underlie the "sentinel" attribute's absence too, in libnbd?
If there is a common reason for avoiding both "cleanup" and
"sentinel"
in libnbd, we should probably not start using "sentinel" now. If, on the
other hand, "sentinel" is not covered by the same argument as
"cleanup"
(not to mention if there isn't an actual reason for avoiding "cleanup"
in the first place!), then I can add the sentinel attribute when merging
this patch.
Reviewed-by: Eric Blake <eblake(a)redhat.com>
Thanks!
Laszlo