mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-05 03:44:05 +00:00
Add check_size_lte
Add a _lte val boolean so that -EOVERFLOW is returned if the item is greater than the value vector. Signed-off-by: Zach Brown <zab@versity.com> Reviewed-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
@@ -151,6 +151,8 @@ static int copy_to_val(struct scoutfs_btree_val *val,
|
||||
/* XXX corruption */
|
||||
if (val->check_size_eq && val_len != scoutfs_btree_val_length(val))
|
||||
return -EIO;
|
||||
if (val->check_size_lte && val_len > scoutfs_btree_val_length(val))
|
||||
return -EOVERFLOW;
|
||||
|
||||
for (i = 0, off = 0; val_len > 0 && i < ARRAY_SIZE(val->vec); i++) {
|
||||
kv = &val->vec[i];
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
struct scoutfs_btree_val {
|
||||
struct kvec vec[3];
|
||||
unsigned int check_size_eq:1;
|
||||
unsigned int check_size_lte:1;
|
||||
};
|
||||
|
||||
static inline void __scoutfs_btree_init_val(struct scoutfs_btree_val *val,
|
||||
|
||||
Reference in New Issue
Block a user