tree-wide: drop DLOPEN_FOO() macros

Since 4c0d8d9673, most dlopen notes are
set at the beginning of the executables. Let's manage all dlopen notes
there, rather than setting them where dlopen is called.

Note that the only exceptions are the LIBBPF_NOTE for networkd and
nsresource. Since dlopen_bpf() is wrapped in an `#if` guard, the notes
are instead set within the corresponding functionality.

As a result, the DLOPEN_FOO() wrapper macros are no longer needed and
can be dropped completely.
This commit is contained in:
Yu Watanabe
2026-07-18 04:56:32 +09:00
parent e056e2a707
commit 661ab8b6fd
94 changed files with 223 additions and 233 deletions
@@ -19,6 +19,7 @@
/* for libcryptsetup debug purpose */
_public_ const char* cryptsetup_token_version(void) {
LIBCRYPTSETUP_NOTE(required);
LIBFIDO2_NOTE(suggested);
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
@@ -40,7 +41,7 @@ _public_ int cryptsetup_token_open_pin(
assert(pin || pin_size == 0);
assert(token >= 0);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
r = dlopen_cryptsetup(LOG_DEBUG);
if (r < 0)
return r;
@@ -105,7 +106,7 @@ _public_ void cryptsetup_token_dump(
assert(json);
if (DLOPEN_CRYPTSETUP(LOG_DEBUG, required) < 0)
if (dlopen_cryptsetup(LOG_DEBUG) < 0)
return;
r = parse_luks2_fido2_data(cd, json, &rp_id, &salt, &salt_size, &cid, &cid_size, &required);
@@ -172,7 +173,7 @@ _public_ int cryptsetup_token_validate(
assert(json);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
r = dlopen_cryptsetup(LOG_DEBUG);
if (r < 0)
return r;
@@ -20,6 +20,7 @@
/* for libcryptsetup debug purpose */
_public_ const char* cryptsetup_token_version(void) {
LIBCRYPTO_NOTE(suggested);
LIBCRYPTSETUP_NOTE(required);
LIBP11KIT_NOTE(suggested);
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
@@ -40,7 +41,7 @@ _public_ int cryptsetup_token_open_pin(
assert(pin || pin_size == 0);
assert(token >= 0);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
r = dlopen_cryptsetup(LOG_DEBUG);
if (r < 0)
return r;
@@ -98,7 +99,7 @@ _public_ void cryptsetup_token_dump(
_cleanup_free_ void *pkcs11_key = NULL;
Pkcs11RsaPadding rsa_padding = PKCS11_RSA_PADDING_PKCS1V15;
if (DLOPEN_CRYPTSETUP(LOG_DEBUG, required) < 0)
if (dlopen_cryptsetup(LOG_DEBUG) < 0)
return;
r = parse_luks2_pkcs11_data(cd, json, &pkcs11_uri, &pkcs11_key, &pkcs11_key_size, &rsa_padding);
@@ -128,7 +129,7 @@ _public_ int cryptsetup_token_validate(
sd_json_variant *w;
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
r = dlopen_cryptsetup(LOG_DEBUG);
if (r < 0)
return r;
@@ -21,6 +21,7 @@
/* for libcryptsetup debug purpose */
_public_ const char* cryptsetup_token_version(void) {
LIBCRYPTO_NOTE(suggested);
LIBCRYPTSETUP_NOTE(required);
TPM2_NOTE(suggested);
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
@@ -73,7 +74,7 @@ _public_ int cryptsetup_token_open_pin(
assert(ret_password);
assert(ret_password_len);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
r = dlopen_cryptsetup(LOG_DEBUG);
if (r < 0)
return r;
@@ -217,7 +218,7 @@ _public_ void cryptsetup_token_dump(
assert(json);
if (DLOPEN_CRYPTSETUP(LOG_DEBUG, required) < 0)
if (dlopen_cryptsetup(LOG_DEBUG) < 0)
return;
r = sd_json_parse(json, SD_JSON_PARSE_MUST_BE_OBJECT, &v, /* reterr_line= */ NULL, /* reterr_column= */ NULL);
@@ -313,7 +314,7 @@ _public_ int cryptsetup_token_validate(
assert(json);
r = DLOPEN_CRYPTSETUP(LOG_DEBUG, required);
r = dlopen_cryptsetup(LOG_DEBUG);
if (r < 0)
return r;
+4 -2
View File
@@ -539,7 +539,7 @@ static int parse_one_option(const char *option) {
#if HAVE_OPENSSL
_cleanup_strv_free_ char **l = NULL;
r = DLOPEN_LIBCRYPTO(LOG_ERR, recommended);
r = dlopen_libcrypto(LOG_ERR);
if (r < 0)
return r;
@@ -2885,6 +2885,8 @@ static int run(int argc, char *argv[]) {
int r;
LIBBLKID_NOTE(recommended);
LIBCRYPTO_NOTE(recommended);
LIBCRYPTSETUP_NOTE(required);
LIBFIDO2_NOTE(suggested);
LIBMOUNT_NOTE(recommended);
LIBP11KIT_NOTE(suggested);
@@ -2899,7 +2901,7 @@ static int run(int argc, char *argv[]) {
if (r <= 0)
return r;
r = DLOPEN_CRYPTSETUP(LOG_ERR, required);
r = dlopen_cryptsetup(LOG_ERR);
if (r < 0)
return r;