From 22716c0389768b2268c29161a0ac27b2f1197510 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 22 Apr 2020 17:51:56 -0700 Subject: [PATCH] scoutfs: add scoutfs_key_is_zeros() Add a little function for testing if a given scoutfs key is all zeros. Signed-off-by: Zach Brown --- kmod/src/key.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kmod/src/key.h b/kmod/src/key.h index 7709438d..9427f2e4 100644 --- a/kmod/src/key.h +++ b/kmod/src/key.h @@ -80,6 +80,13 @@ static inline void scoutfs_key_set_zeros(struct scoutfs_key *key) key->_sk_fourth = 0; } +static inline bool scoutfs_key_is_zeros(struct scoutfs_key *key) +{ + return key->sk_zone == 0 && key->_sk_first == 0 && key->sk_type == 0 && + key->_sk_second == 0 && key->_sk_third == 0 && + key->_sk_fourth == 0; +} + static inline void scoutfs_key_copy_or_zeros(struct scoutfs_key *dst, struct scoutfs_key *src) {