diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-06 16:16:32 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-13 21:10:24 -0400 |
commit | 844721635c1c8e7e43fb546052a659bfc92ed99d (patch) | |
tree | 5007b56b87df050e6b5a05a3049826680705b0ed /include/linux/string_helpers.h | |
parent | ad3875d1d9907bab0430c45ffa3b2dd39107106b (diff) |
Update bcachefs sources to 2f9361370129 bcachefs: Improve opts.degraded
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'include/linux/string_helpers.h')
-rw-r--r-- | include/linux/string_helpers.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index af587706..d4b2f4d3 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -17,4 +17,15 @@ enum string_size_units { int string_get_size(u64 size, u64 blk_size, enum string_size_units units, char *buf, int len); +static inline void memcpy_and_pad(void *dest, size_t dest_len, const void *src, + size_t count, int pad) +{ + if (dest_len > count) { + memcpy(dest, src, count); + memset(dest + count, pad, dest_len - count); + } else { + memcpy(dest, src, dest_len); + } +} + #endif |