From 6f7530929538b28cb41c289ad9cbced51848fc02 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 May 2021 16:07:55 +0200 Subject: [PATCH] man: document that it is guaranteed that generated ID128 are never all-zero or all-one This is the case because the ID128 we generate are all marked as v4 UUID which requires that some bits are zero and others are one. Let's document this so that people can rely on SD_ID128_NULL being a special value for "uninitialized" that is always distinguishable from generated UUIDs. --- man/sd_id128_get_machine.xml | 16 ++++++++++------ man/sd_id128_randomize.xml | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/man/sd_id128_get_machine.xml b/man/sd_id128_get_machine.xml index 2df4496f192..7fa98608987 100644 --- a/man/sd_id128_get_machine.xml +++ b/man/sd_id128_get_machine.xml @@ -99,12 +99,16 @@ systemd.exec5 for details. The ID is cached internally. In future a different mechanism to determine the invocation ID may be added. - Note that sd_id128_get_machine_app_specific(), sd_id128_get_boot(), - sd_id128_get_boot_app_specific(), and sd_id128_get_invocation() always - return UUID v4 compatible IDs. sd_id128_get_machine() will also return a UUID v4-compatible - ID on new installations but might not on older. It is possible to convert the machine ID into a UUID v4-compatible - one. For more information, see - machine-id5. + Note that sd_id128_get_machine_app_specific(), + sd_id128_get_boot(), sd_id128_get_boot_app_specific(), and + sd_id128_get_invocation() always return UUID v4 compatible IDs. + sd_id128_get_machine() will also return a UUID v4-compatible ID on new installations + but might not on older. It is possible to convert the machine ID into a UUID v4-compatible one. For more + information, see + machine-id5. It is + hence guaranteed that thes functions will never return the ID consisting of all zero or all one bits + (SD_ID128_NULL, SD_ID128_ALLF) — with the possible exception of + sd_id128_get_machine(), as mentioned. For more information about the sd_id128_t type see diff --git a/man/sd_id128_randomize.xml b/man/sd_id128_randomize.xml index cf6ca7726f1..0bc1d0abd8f 100644 --- a/man/sd_id128_randomize.xml +++ b/man/sd_id128_randomize.xml @@ -42,8 +42,9 @@ /dev/urandom kernel random number generator. - Note that sd_id128_randomize() always - returns a UUID v4-compatible ID. + Note that sd_id128_randomize() always returns a UUID v4-compatible ID. It is + hence guaranteed that this function will never return the ID consisting of all zero or all one bits + (SD_ID128_NULL, SD_ID128_ALLF). For more information about the sd_id128_t type, see