diff options
author | dzwdz | 2022-07-29 16:16:24 +0200 |
---|---|---|
committer | dzwdz | 2022-07-29 16:16:24 +0200 |
commit | c6424fbc55298399f133ca1ede11e1f0b4a5c824 (patch) | |
tree | d8dd1c160a7184a99ea3c72779dce95b4bbee692 /src/shared/include | |
parent | a0b16620e1699504e8d21a481e019dec40d7ee1b (diff) |
use a shared fs_normslice() function to handle offsets
Diffstat (limited to 'src/shared/include')
-rw-r--r-- | src/shared/include/camellia/fsutil.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/include/camellia/fsutil.h b/src/shared/include/camellia/fsutil.h new file mode 100644 index 0000000..eb2b23e --- /dev/null +++ b/src/shared/include/camellia/fsutil.h @@ -0,0 +1,13 @@ +#pragma once +#include <stdbool.h> +#include <stddef.h> + +/** Normalizes the offset and length passed to a fs into safe values. + * If returns *length == 0, *offset is meaningless. + * + * @param expand Can this operation expand the target file? + * true if writing to a file with an adjustable size + * false if reading any sort of file + * or writing to a file with static size + */ +void fs_normslice(long *restrict offset, size_t *restrict length, size_t max, bool expand); |