]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-id128: add SD_ID128_MAKE_UUID_STR
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 11 Jun 2021 16:17:00 +0000 (18:17 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 15 Jun 2021 20:01:39 +0000 (22:01 +0200)
It's like SD_ID128_MAKE_STR, but with hyphens.

man/rules/meson.build
man/sd-id128.xml
src/systemd/sd-id128.h

index 1cfb54723aeccb03f4be53b8b2eb92dcc644bdb8..0f6519106a44ab51b3137dbba388487ca442122c 100644 (file)
@@ -125,6 +125,7 @@ manpages = [
    'SD_ID128_FORMAT_VAL',
    'SD_ID128_MAKE',
    'SD_ID128_MAKE_STR',
+   'SD_ID128_MAKE_UUID_STR',
    'SD_ID128_NULL',
    'SD_ID128_UUID_FORMAT_STR',
    'sd_id128_equal',
index 716c62522ddd05f752e28fa789c0cb56c186ab10..891a4585c619e92bc0d0843feda5c6d640f7f8fc 100644 (file)
@@ -24,6 +24,7 @@
     <refname>SD_ID128_FORMAT_VAL</refname>
     <refname>SD_ID128_MAKE</refname>
     <refname>SD_ID128_MAKE_STR</refname>
+    <refname>SD_ID128_MAKE_UUID_STR</refname>
     <refname>SD_ID128_NULL</refname>
     <refname>SD_ID128_UUID_FORMAT_STR</refname>
     <refname>sd_id128_equal</refname>
@@ -121,10 +122,12 @@ int main(int argc, char **argv) {
   return 0;
 }</programlisting>
 
-    <para><constant>SD_ID128_UUID_FORMAT_STR</constant> is similar to
-    <constant>SD_ID128_FORMAT_STR</constant> but includes separating hyphens to conform to the "<ulink
-    url="https://en.wikipedia.org/wiki/Universally_unique_identifier#Format">canonical
-    representation</ulink>". This formats the string based on <ulink
+    <para><constant>SD_ID128_UUID_FORMAT_STR</constant> and <function>SD_ID128_MAKE_UUID_STR()</function>
+    are similar to
+    <constant>SD_ID128_FORMAT_STR</constant> and <function>SD_ID128_MAKE_STR()</function>,
+    but include separating hyphens to conform to the
+    "<ulink url="https://en.wikipedia.org/wiki/Universally_unique_identifier#Format">canonical representation</ulink>".
+    They format the string based on <ulink
     url="https://tools.ietf.org/html/rfc4122">RFC4122</ulink> Variant 1 rules, i.e. converting from Big
     Endian byte order. This matches behaviour of most other Linux userspace infrastructure. It's probably
     best to avoid UUIDs of other variants, in order to avoid unnecessary ambiguities. All 128-bit IDs
index 90d4bbf14ef60b8f334dfd80bca927875c808945..f2dd7357f863dcfa9085e4b057d208f99f6238f9 100644 (file)
@@ -107,6 +107,9 @@ int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret);
 #define SD_ID128_MAKE_STR(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
         #a #b #c #d #e #f #g #h #i #j #k #l #m #n #o #p
 
+#define SD_ID128_MAKE_UUID_STR(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
+        #a #b #c #d "-" #e #f "-" #g #h "-" #i #j "-" #k #l #m #n #o #p
+
 _sd_pure_ static __inline__ int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
         return memcmp(&a, &b, 16) == 0;
 }