]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-id128: add helpers to check fo all-0xFF ids
authorLennart Poettering <lennart@poettering.net>
Fri, 14 Dec 2018 10:46:07 +0000 (11:46 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 15 Dec 2018 11:06:44 +0000 (12:06 +0100)
NEWS
src/systemd/sd-id128.h

diff --git a/NEWS b/NEWS
index 2430fa115cb0982a132b1d36618060fedf247915..da3ea1342a1770b2b501db547a322c553223417a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -379,6 +379,10 @@ CHANGES WITH 240 in spe:
           interface names even as systemd/udev are updated and the naming logic
           is improved.
 
+        * sd-id128.h learnt two new auxiliary helpers: sd_id128_is_allf() and
+          SD_ID128_ALLF to test if a 128bit ID is set to all 0xFF bytes, and to
+          initialize one to all 0xFF.
+
         Contributions from: afg, Alan Jenkins, Aleksei Timofeyev, Alexander
         Filippov, Alexander Kurtz, Alexey Bogdanenko, Andreas Henriksson,
         Andrew Jorgensen, Anita Zhang, apnix-uk, Arkan49, Arseny Maslennikov,
index 59f375bef55d910377e5952fca7661352fc3dadc..f4c05a36831409867fc517a195314fd579a9a39f 100644 (file)
@@ -110,7 +110,12 @@ _sd_pure_ static __inline__ int sd_id128_is_null(sd_id128_t a) {
         return a.qwords[0] == 0 && a.qwords[1] == 0;
 }
 
+_sd_pure_ static __inline__ int sd_id128_is_allf(sd_id128_t a) {
+        return a.qwords[0] == UINT64_C(0xFFFFFFFFFFFFFFFF) && a.qwords[1] == UINT64_C(0xFFFFFFFFFFFFFFFF);
+}
+
 #define SD_ID128_NULL ((const sd_id128_t) { .qwords = { 0, 0 }})
+#define SD_ID128_ALLF ((const sd_id128_t) { .qwords = { UINT64_C(0xFFFFFFFFFFFFFFFF), UINT64_C(0xFFFFFFFFFFFFFFFF) }})
 
 _SD_END_DECLARATIONS;