From 082924df1a754a6f3e07cd93587dcfef3f304832 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 18 Dec 2020 09:26:32 -0800 Subject: [PATCH] Add scoutfs_key_is_ones() Add a quick inline for testing that a key is all ones. Signed-off-by: Zach Brown --- kmod/src/key.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kmod/src/key.h b/kmod/src/key.h index 5ea4dd4c..66a4c84a 100644 --- a/kmod/src/key.h +++ b/kmod/src/key.h @@ -108,6 +108,16 @@ static inline void scoutfs_key_set_ones(struct scoutfs_key *key) memset(key->__pad, 0, sizeof(key->__pad)); } +static inline bool scoutfs_key_is_ones(struct scoutfs_key *key) +{ + return key->sk_zone == U8_MAX && + key->_sk_first == cpu_to_le64(U64_MAX) && + key->sk_type == U8_MAX && + key->_sk_second == cpu_to_le64(U64_MAX) && + key->_sk_third == cpu_to_le64(U64_MAX) && + key->_sk_fourth == U8_MAX; +} + /* * Return a -1/0/1 comparison of keys. *