summaryrefslogtreecommitdiff
path: root/src/shared/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/include')
-rw-r--r--src/shared/include/camellia/fsutil.h13
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);