scoutfs: add zero key set and test functions

Add some quick functions to set a key to all zeros and to test if a key
is all zeros.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-09-14 14:33:38 -07:00
parent 3bb0c80686
commit d2a696f4bd

View File

@@ -100,4 +100,16 @@ static inline struct scoutfs_key *scoutfs_max_key(struct scoutfs_key *a,
return scoutfs_key_cmp(a, b) > 0 ? a : b;
}
static inline bool scoutfs_key_is_zero(struct scoutfs_key *key)
{
return key->inode == 0 && key->type == 0 && key->offset == 0;
}
static inline void scoutfs_key_set_zero(struct scoutfs_key *key)
{
key->inode = 0;
key->type = 0;
key->offset = 0;
}
#endif