Welcome to little lamb

Code » limb » commit ec84e45

Update siovec.h: complete doc & adjust interface

author Olivier Brunel
2023-07-02 11:58:47 UTC
committer Olivier Brunel
2023-07-24 10:16:41 UTC
parent 30f5a35790a0c81263a161af6dbd507323d15585

Update siovec.h: complete doc & adjust interface

That is, in addition to documenting all functions we either provide or
get from skalibs (or macro-out to re-order arguments), we also only
implement our interfaces, instead of having skalibs-like interface that
we need macros for.

Things will be simpler & clearer that way.

src/doc/siovec.h.0.md +31 -50
src/doc/siovec.h/siov_bytechr.3.md +58 -0
src/doc/siovec.h/siov_bytein.3.md +1 -0
src/doc/siovec.h/siov_deal.3.md +46 -0
src/doc/siovec.h/siov_gather.3.md +49 -0
src/doc/siovec.h/siov_gather0.3.md +1 -0
src/doc/siovec.h/siov_len.3.md +28 -0
src/doc/siovec.h/siov_memcmp.3.md +30 -0
src/doc/siovec.h/siov_off.3.md +35 -0
src/doc/siovec.h/siov_scatter.3.md +36 -0
src/doc/siovec.h/siov_search.3.md +33 -0
src/doc/siovec.h/siov_seek.3.md +36 -0
src/doc/siovec.h/siov_seek_bytechr.3.md +1 -0
src/doc/siovec.h/siov_seek_bytein.3.md +1 -0
src/doc/siovec.h/siov_seek_gather.3.md +1 -0
src/doc/siovec.h/siov_seek_gather0.3.md +1 -0
src/doc/siovec.h/siov_trunc.3.md +35 -0
src/doc/siovec.h/siovec_gather0.3.md +0 -41
src/doc/siovec.h/siovec_memcmp.3.md +0 -31
src/doc/siovec.h/siovec_off.3.md +0 -35
src/doc/siovec.h/siovec_seek_bytechr.3.md +0 -33
src/doc/siovec.h/siovec_seek_bytein.3.md +0 -35
src/doc/siovec.h/siovec_seek_gather.3.md +0 -32
src/doc/siovec.h/siovec_seek_gather0.3.md +0 -1
src/liblimb/include/limb/siovec.h +9 -23
src/liblimb/siovec.h/{siovec_gather0.c => siov_gather0.c} +6 -6
src/liblimb/siovec.h/{siovec_memcmp.c => siov_memcmp.c} +1 -1
src/liblimb/siovec.h/{siovec_off.c => siov_off.c} +1 -1
src/liblimb/siovec.h/{siovec_seek_bytechr.c => siov_seek_bytechr.c} +3 -3
src/liblimb/siovec.h/{siovec_seek_gather.c => siov_seek_bytein.c} +3 -3
src/liblimb/siovec.h/{siovec_seek_gather0.c => siov_seek_gather.c} +3 -3
src/liblimb/siovec.h/{siovec_seek_bytein.c => siov_seek_gather0.c} +3 -4

diff --git a/src/doc/siovec.h.0.md b/src/doc/siovec.h.0.md
index 0553cbe..34bcfd0 100644
--- a/src/doc/siovec.h.0.md
+++ b/src/doc/siovec.h.0.md
@@ -13,79 +13,60 @@ siovec.h - manipulating struct iovec
 
 # DESCRIPTION
 
-The header defines the needed functions to manipulate `struct iovec` containing
-range of bytes in similar manner as byte arrays.
+The header defines the needed functions to manipulate vectors (i.e. `struct
+iovec`) containing range of bytes in similar manner as byte arrays.
 
-It also defines macros offering a slightly different interface, to remain
-consistent within limb.
-
-! INFO: skalibs
-! This header is a complement to skalibs' own [skalibs/siovec.h](0) and thusly
-! includes said header.
+<inc skalibs.md>
 
 ## Functions
 
 The following functions/macros are defined :
 
-: [siov_len](3)
-:: Same as [siovec_len](3)
+: [siov_bytechr](3)
+:: Similar to [byte_chr](3) but for vectors.
 
-: [siov_memcmp](3)
-:: Same as [siovec_memcmp](3)
+: [siov_bytein](3)
+:: Similar to [byte_in](3) but for vectors.
 
-: [siov_off](3)
-:: Same as [siovec_off](3)
+: [siov_deal](3)
+:: Copy the data from an array of vectors into another. Think [memcpy](3) for
+:: vectors.
 
 : [siov_gather](3)
-:: Same as [siovec_gather](3) but with destination as first arguments
+:: Gather data in an array of vectors to the given memory location.
 
 : [siov_gather0](3)
-:: Same as [siovec_gather0](3)
+:: Similar to [siov_gather](3) but ensures the data gathered is NUL-terminated.
 
-: [siov_scatter](3)
-:: Same as [siovec_scatter](3)
-
-: [siov_deal](3)
-:: Same as [siovec_deal](3) but with destination as first arguments
-
-: [siov_seek](3)
-:: Same as [siovec_seek](3)
+: [siov_len](3)
+:: Return the length of data in an array of vectors.
 
-: [siov_trunc](3)
-:: Same as [siovec_trunc](3)
+: [siov_memcmp](3)
+:: Compare data in an array of vectors with a byte array.
 
-: [siov_bytechr](3)
-:: Same as [siovec_bytechr](3)
+: [siov_off](3)
+:: Return the byte at a given offset in an array of vectors.
 
-: [siov_bytein](3)
-:: Same as [siovec_bytein](3)
+: [siov_scatter](3)
+:: Scatter data from a byte array into an array of vectors.
 
 : [siov_search](3)
-:: Same as [siovec_search](3)
+:: Search for a byte array inside an array of vectors.
 
-: [siov_seek_gather](3)
-:: Same as [siovec_seek_gather](3) but with destination as first arguments
+: [siov_seek](3)
+:: Seek into an array of vectors. Think `s += len` for vectors.
 
 : [siov_seek_bytechr](3)
-:: Same as [siovec_seek_bytechr](3)
+:: Similar to [siov_bytechr](3) but from an offset.
 
 : [siov_seek_bytein](3)
-:: Same a [siovec_seek_bytein](3)
-
-: [siovec_gather0](3)
-:: Same as [siovec_gather](3) but ensures the data gathered is NUL terminated
-
-: [siovec_memcmp](3)
-:: Compare byte array with data from array of *struct iovec*
+:: Similar to [siov_bytein](3) but from an offset.
 
-: [siovec_off](3)
-:: Return byte of data from a *struct iovec* at a given offset
-
-: [siovec_seek_gather](3)
-:: Same as [siovec_gather](3) but from a given offset
+: [siov_seek_gather](3)
+:: Similar to [siov_gather](3) but from an offset.
 
-: [siovec_seek_bytechr](3)
-:: Same as [siovec_bytechr](3) but from a given offset
+: [siov_seek_gather0](3)
+:: Similar to [siov_gather0](3) but from an offset.
 
-: [siovec_seek_bytein](3)
-:: Same as [siovec_bytein](3) but from a given offset
+: [siov_trunc](3)
+:: Truncate an array of vectors.
diff --git a/src/doc/siovec.h/siov_bytechr.3.md b/src/doc/siovec.h/siov_bytechr.3.md
new file mode 100644
index 0000000..22b9635
--- /dev/null
+++ b/src/doc/siovec.h/siov_bytechr.3.md
@@ -0,0 +1,58 @@
+% limb manual
+% siov_bytechr(3)
+
+# NAME
+
+siov_bytechr, siov_bytein - search for bytes in an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_bytechr(const struct iovec *<em>v</em>, unsigned int <em>n</em>, char <em>c</em>)
+size_t siov_bytein(const struct iovec *<em>v</em>, unsigned int <em>n</em>,
+                   const char *<em>sep</em>, size_t <em>len</em>)
+
+size_t siov_seek_bytechr(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>, char <em>c</em>)
+size_t siov_seek_bytein(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>,
+                        const char *<em>sep</em>, size_t <em>len</em>)
+```
+
+# DESCRIPTION
+
+These functions are meant to be vectors equivalent of what [byte_chr](3) and
+[byte_in](3) are for byte arrays.
+
+The `siov_bytechr`() function scans data pointed by the array `v` of `n` vectors
+for the first instance of `c`.
+
+The `siov_bytein`() function scans data pointed by the array `v` of `n` vectors
+for the first instance of any of the `len` bytes pointed by `sep`.
+
+The `siov_seek_bytechr`() function is similar to `siov_bytechr`() only skipping
+the first `offset` bytes of data.
+
+The `siov_seek_bytein`() function is similar to `siov_bytein`() only skipping
+the first `offset` bytes of data.
+
+# RETURN VALUE
+
+The `siov_bytechr`() and `siov_bytein`() functions return the position of the
+first occurence found in the data within the array `v` of `n` vectors, or the
+total length of said data otherwise.
+
+The `siov_seek_bytechr`() and `siov_seek_bytein`() functions return the same
+position, but counting from `offset`. As such, when not found, they return the
+total length of data minus `offset`.
+
+! WARN:
+! Be aware that, if `offset` is larger than the amount of data in the array `v`
+! of `n` vectors, they will return 0, as that amounts to the total length of
+! data minus the skipped data.
+! In other words, it is much simpler to never call those functions with an
+! invalid offset.
+
+# SEE ALSO
+
+[siov_seek](3), [byte_chr](3), [byte_in](3), [siov_search](3)
diff --git a/src/doc/siovec.h/siov_bytein.3.md b/src/doc/siovec.h/siov_bytein.3.md
new file mode 120000
index 0000000..894e684
--- /dev/null
+++ b/src/doc/siovec.h/siov_bytein.3.md
@@ -0,0 +1 @@
+siov_bytechr.3.md
\ No newline at end of file
diff --git a/src/doc/siovec.h/siov_deal.3.md b/src/doc/siovec.h/siov_deal.3.md
new file mode 100644
index 0000000..6759a69
--- /dev/null
+++ b/src/doc/siovec.h/siov_deal.3.md
@@ -0,0 +1,46 @@
+% limb manual
+% siov_deal(3)
+
+# NAME
+
+siov_deal - copy data from an array of vectors into another
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_deal(const struct iovec *<em>vdst</em>, unsigned <em>ndst</em>, const struct iovec *<em>vsce</em>, unsigned <em>nsce</em>)
+```
+
+# DESCRIPTION
+
+The `siov_deal`() function copies the data from the array `vsce` of `nsce`
+vectors into the memory pointed by the array `vdst` of `ndst` vectors.
+
+You can think of it as a [memcpy](3) for vectors.
+
+It is similar to [siov_scatter](3) only copying data from another array of
+vectors instead of a byte array.
+
+! NOTE:
+! The function only copies data from one location in memory to another, as
+! described by the two array of vectors. The arrays themselves are /not/
+! modified, which means that if the `vdst` array represents a larger space than
+! `vsce` does, the content of the data in `vdst` after the length of data
+! copied (from `vsce`) is left unchanged, as is the array itself.
+!
+! In other words, the length of data in `vdst` (i.e. as returned by
+! `siov_len(vdst, ndst)`) does not change upon calling this function, regardless
+! of how much data is actually copied.
+
+# RETURN VALUE
+
+The `siov_deal`() function returns the amount of data copied, which may be less
+than what `siov_len(vsce, nsce)` would return, if there wasn't enough space in
+the memory represented by the `vdst` array of `ndst` vectors, or less than what
+`siov_len(vdst, ndst)` would return, as noted above.
+
+# SEE ALSO
+
+[siov_scatter](3), [siov_gather](3)
diff --git a/src/doc/siovec.h/siov_gather.3.md b/src/doc/siovec.h/siov_gather.3.md
new file mode 100644
index 0000000..1e77110
--- /dev/null
+++ b/src/doc/siovec.h/siov_gather.3.md
@@ -0,0 +1,49 @@
+% limb manual
+% siov_gather(3)
+
+# NAME
+
+siov_gather, siov_gather0, siov_seek_gather, siov_seek_gather0 - gather data
+from an array of vectors into a byte array
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_gather(char *<em>dst</em>, size_t <em>dlen</em>, const struct iovec *<em>v</em>, unsigned int <em>n</em>)
+size_t siov_gather0(char *<em>dst</em>, size_t <em>dlen</em>, const struct iovec *<em>v</em>, unsigned int <em>n</em>)
+
+size_t siov_seek_gather(char *<em>dst</em>, size_t <em>dlen</em>, const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>)
+size_t siov_seek_gather0(char *<em>dst</em>, size_t <em>dlen</em>, const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>)
+```
+
+# DESCRIPTION
+
+The `siov_gather`() function gathers data scattered across the array `v` of `n`
+vectors into the byte array pointed by `dst` of `dlen` bytes.
+
+You can think of it as the opposite of [siov_scatter](3).
+
+The `siov_gather0`() function is similar to `siov_gather`() but ensures that the
+data placed into `s` is NUL-terminated, meaning that it /ends/ with a NUL byte
+(not checking whether there were in the middle of it).
+
+If a trailing NUL byte was already present, it does nothing more than
+`siov_gather`(), else it will add one - possibly overwriting the last character
+gathered if `dlen` was reached.
+
+The `siov_seek_gather`() function is similar to `siov_gather`() only skipping
+the first `offset` bytes of data.
+
+The `siov_seek_gather0`() function is similar to `siov_seek_gather`() but
+similarly ensures the data placed into `s` is NUL terminated.
+
+# RETURN VALUE
+
+These functions return the number of bytes copied into `dst` (including the
+added terminating NUL byte, if any).
+
+# SEE ALSO
+
+[siov_seek](3), [siov_scatter](3), [siov_deal](3)
diff --git a/src/doc/siovec.h/siov_gather0.3.md b/src/doc/siovec.h/siov_gather0.3.md
new file mode 120000
index 0000000..984a659
--- /dev/null
+++ b/src/doc/siovec.h/siov_gather0.3.md
@@ -0,0 +1 @@
+siov_gather.3.md
\ No newline at end of file
diff --git a/src/doc/siovec.h/siov_len.3.md b/src/doc/siovec.h/siov_len.3.md
new file mode 100644
index 0000000..ee649a2
--- /dev/null
+++ b/src/doc/siovec.h/siov_len.3.md
@@ -0,0 +1,28 @@
+% limb manual
+% siov_len(3)
+
+# NAME
+
+siov_len - return the length of an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_len(const struct iovec *<em>v</em>, unsigned int <em>n</em>)
+```
+
+# DESCRIPTION
+
+The `siov_len`() function returns the length of data scattered across the array
+`v` of `n` vectors.
+
+# RETURN VALUE
+
+The `siov_len`() function returns the length of data in the array `v` of `n`
+vectors.
+
+# SEE ALSO
+
+[siov_seek](3)
diff --git a/src/doc/siovec.h/siov_memcmp.3.md b/src/doc/siovec.h/siov_memcmp.3.md
new file mode 100644
index 0000000..3e0c3c0
--- /dev/null
+++ b/src/doc/siovec.h/siov_memcmp.3.md
@@ -0,0 +1,30 @@
+% limb manual
+% siov_memcmp(3)
+
+# NAME
+
+siov_memcmp - compare a byte array with an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+int siov_memcmp(const struct iovec *<em>v</em>, unsigned int <em>n</em>, const char *<em>s</em>, size_t <em>len</em>)
+```
+
+# DESCRIPTION
+
+The `siov_memcmp`() function compares the first `len` bytes of `s` and those
+scattered across given array `v` of `n` vectors (each interpreted as `unsigned
+char`).
+
+# RETURN VALUE
+
+The `siov_memcmp`() function returns an integer less than, equal to, or greater
+than zero if the first `len` bytes of scattered data are found, respectively, to
+be less than, to match, or be greater than the first `len` bytes of `s`.
+
+# SEE ALSO
+
+[memcmp](3)
diff --git a/src/doc/siovec.h/siov_off.3.md b/src/doc/siovec.h/siov_off.3.md
new file mode 100644
index 0000000..47e9bac
--- /dev/null
+++ b/src/doc/siovec.h/siov_off.3.md
@@ -0,0 +1,35 @@
+% limb manual
+% siov_off(3)
+
+# NAME
+
+siov_off - return the byte at the given offset in an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+int siov_off(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>off</em>)
+```
+
+# DESCRIPTION
+
+The `siov_off`() function returns the byte at offset `offset` from the data
+scattered across given array `v` of `n` vectors.
+
+# RETURN VALUE
+
+The `siov_off`() function returns the `offset`th byte of data scattered the
+specified array of vectors, or -1 and set `errno` to indicate the error.
+
+# ERRORS
+
+The function may fail if:
+
+: *EINVAL*
+:: The value `offset` is invalid
+
+# SEE ALSO
+
+[siov_seek](3), [siov_gather](3)
diff --git a/src/doc/siovec.h/siov_scatter.3.md b/src/doc/siovec.h/siov_scatter.3.md
new file mode 100644
index 0000000..3e36049
--- /dev/null
+++ b/src/doc/siovec.h/siov_scatter.3.md
@@ -0,0 +1,36 @@
+% limb manual
+% siov_scatter(3)
+
+# NAME
+
+siov_scatter - scatter data from a byte array into an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_scatter(const struct iovec *<em>v</em>, unsigned int <em>n</em>, const char *<em>data</em>, size_t <em>dlen</em>)
+```
+
+# DESCRIPTION
+
+The `siov_scatter`() function scatters data pointed by `data` of length `dlen`
+into the array `v` of `n` vectors.
+
+You can think of it as the opposite of [siov_gather](3).
+
+It is similar to [siov_deal](3) only copying data from a byte array instead of
+another array of vectors. As such, the note on [siov_deal](3) applies here as
+well.
+
+# RETURN VALUE
+
+The `siov_scatter`() function returns the amount of data copied, which may be
+less than `dlen`, if there wasn't enough space in the memory represented by the
+`v` array of `n` vectors, or less than what `siov_len(v, n)` would return, as
+explained in [siov_deal](3).
+
+# SEE ALSO
+
+[siov_deal](3), [siov_gather](3)
diff --git a/src/doc/siovec.h/siov_search.3.md b/src/doc/siovec.h/siov_search.3.md
new file mode 100644
index 0000000..8c8afc9
--- /dev/null
+++ b/src/doc/siovec.h/siov_search.3.md
@@ -0,0 +1,33 @@
+% limb manual
+% siov_search(3)
+
+# NAME
+
+siov_search - search for a byte array in an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_search(const struct iovec *<em>v</em>, unsigned int <em>n</em>, char *<em>s</em>, size_t <em>len</em>)
+```
+
+# DESCRIPTION
+
+The `siov_search`() function scans data pointed by the array `v` of `n` vectors
+for the first instance matching data pointed by `s` of `len` bytes.
+
+As such, it may contain any byte, including NUL bytes, and does not need to be
+NUL-terminated. The occurrence will be found even if scattered across multiple
+memory regions/vectors.
+
+# RETURN VALUE
+
+The `siov_search`() function returns the position of the first occurrence found
+in the data within the array `v` of `n` vectors, or the total length of said
+data otherwise.
+
+# SEE ALSO
+
+[siov_bytechr](3)
diff --git a/src/doc/siovec.h/siov_seek.3.md b/src/doc/siovec.h/siov_seek.3.md
new file mode 100644
index 0000000..d6839fc
--- /dev/null
+++ b/src/doc/siovec.h/siov_seek.3.md
@@ -0,0 +1,36 @@
+% limb manual
+% siov_seek(3)
+
+# NAME
+
+siov_seek - seek into an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+size_t siov_seek(struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>)
+```
+
+# DESCRIPTION
+
+The `siov_seek`() function updates the array `v` of `n` vectors so that the data
+it represents now start after `offset` byte.
+
+You can think of it as a way to perform `s += offset` for vectors.
+
+! NOTE:
+! Note that it is safe to have `offset` larger than the amount of data
+! represented by `v`, as that will simply set all vectors to 0 -- i.e. the array
+! `v` of `n` vectors will not represent any data anymore.
+! In other words, `siov_len(v, n)` will then return 0.
+
+# RETURN VALUE
+
+The `siov_seek`() function return the number of bytes "skipped over" which may
+be less than `offset` if there wasn't that much data, as noted above.
+
+# SEE ALSO
+
+[siov_len](3), [siov_trunc](3)
diff --git a/src/doc/siovec.h/siov_seek_bytechr.3.md b/src/doc/siovec.h/siov_seek_bytechr.3.md
new file mode 120000
index 0000000..894e684
--- /dev/null
+++ b/src/doc/siovec.h/siov_seek_bytechr.3.md
@@ -0,0 +1 @@
+siov_bytechr.3.md
\ No newline at end of file
diff --git a/src/doc/siovec.h/siov_seek_bytein.3.md b/src/doc/siovec.h/siov_seek_bytein.3.md
new file mode 120000
index 0000000..894e684
--- /dev/null
+++ b/src/doc/siovec.h/siov_seek_bytein.3.md
@@ -0,0 +1 @@
+siov_bytechr.3.md
\ No newline at end of file
diff --git a/src/doc/siovec.h/siov_seek_gather.3.md b/src/doc/siovec.h/siov_seek_gather.3.md
new file mode 120000
index 0000000..984a659
--- /dev/null
+++ b/src/doc/siovec.h/siov_seek_gather.3.md
@@ -0,0 +1 @@
+siov_gather.3.md
\ No newline at end of file
diff --git a/src/doc/siovec.h/siov_seek_gather0.3.md b/src/doc/siovec.h/siov_seek_gather0.3.md
new file mode 120000
index 0000000..984a659
--- /dev/null
+++ b/src/doc/siovec.h/siov_seek_gather0.3.md
@@ -0,0 +1 @@
+siov_gather.3.md
\ No newline at end of file
diff --git a/src/doc/siovec.h/siov_trunc.3.md b/src/doc/siovec.h/siov_trunc.3.md
new file mode 100644
index 0000000..76338cd
--- /dev/null
+++ b/src/doc/siovec.h/siov_trunc.3.md
@@ -0,0 +1,35 @@
+% limb manual
+% siov_trunc(3)
+
+# NAME
+
+siov_trunc - truncate an array of vectors
+
+# SYNOPSIS
+
+    #include <limb/siovec.h>
+
+```pre hl
+unsigned int siov_trunc(struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>len</em>)
+```
+
+# DESCRIPTION
+
+The `siov_trunc`() function updates the array `v` of `n` vectors so that it only
+contains `len` bytes of data.
+
+If `len` is larger than the amount of data within the array, nothing happens.
+Otherwise, as many vectors (from the end of the array) as needed will be
+updated. Only the array is modified, the data itself remains untouched.
+
+# RETURN VALUE
+
+The `siov_trunc`() function return the new number of vectors needed in the
+array.
+That is, ignoring any vector at the end of the array that doesn't represent any
+data (having been zeroed out, or already being empty in the first place) and can
+therefore be ignored.
+
+# SEE ALSO
+
+[siov_len](3), [siov_seek](3)
diff --git a/src/doc/siovec.h/siovec_gather0.3.md b/src/doc/siovec.h/siovec_gather0.3.md
deleted file mode 100644
index 560d247..0000000
--- a/src/doc/siovec.h/siovec_gather0.3.md
+++ /dev/null
@@ -1,41 +0,0 @@
-% limb manual
-% siovec_gather0(3)
-
-# NAME
-
-siovec\_gather0, siovec\_seek\_gather0 - gather data from struct iovec into a
-byte array
-
-# SYNOPSIS
-
-    #include <limb/siovec.h>
-
-```pre hl
-size_t siovec_gather0(const struct iovec *<em>v</em>, unsigned int <em>n</em>, char *<em>dst</em>, size_t <em>max</em>)
-
-size_t siovec_seek_gather0(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>,
-                           char *<em>dst</em>, size_t <em>max</em>)
-```
-
-# DESCRIPTION
-
-The `siovec_gather0`() function gathers data scattered across given array `v` of
-`n` *struct iovec* into the byte array pointer to by `s`, up to `max` bytes. It
-will ensure that the data placed into `s` are NUL-terminated, meaning that it
-/ends/ with a NUL byte (not checking whether there were in the middle of it).
-
-If a trailing NUL byte was already present, it does nothing more than
-`siovec_gather`(), else it will add one - possibly overwriting the last
-character gathered if `max` was reached.
-
-The `siovec_seek_gather0`() function is similar to [siovec_seek_gather](3) but
-will similarly ensure the data placed into `s` are NUL terminated.
-
-# RETURN VALUE
-
-These functions return the number of bytes copied into `s` (including the added
-terminating NUL byte, if any).
-
-# SEE ALSO
-
-[siovec_seek](3), [siovec_gather](3)
diff --git a/src/doc/siovec.h/siovec_memcmp.3.md b/src/doc/siovec.h/siovec_memcmp.3.md
deleted file mode 100644
index 46fa4e8..0000000
--- a/src/doc/siovec.h/siovec_memcmp.3.md
+++ /dev/null
@@ -1,31 +0,0 @@
-% limb manual
-% siovec_memcmp(3)
-
-# NAME
-
-siovec\_memcmp - compare a byte array with data from *struct iovec* array
-
-# SYNOPSIS
-
-    #include <limb/siovec.h>
-
-```pre hl
-int siovec_memcmp(const struct iovec *<em>v</em>, unsigned int <em>n</em>, const char *<em>s</em>, size_t <em>len</em>)
-```
-
-# DESCRIPTION
-
-The `siovec_memcmp`() function compares the first `len` bytes of `s` and those
-scattered across given array `v` of `n` *struct iovec* (each interpreted as
-`unsigned char`).
-
-# RETURN VALUE
-
-The `siovec_memcmp`() function returns an integer less than, equal to, or
-greater than zero if the first `len` bytes of scattared data are found,
-respectively, to be less than, to match, or be greater than the first `len`
-bytes of `s`.
-
-# SEE ALSO
-
-[memcmp](3)
diff --git a/src/doc/siovec.h/siovec_off.3.md b/src/doc/siovec.h/siovec_off.3.md
deleted file mode 100644
index f696f80..0000000
--- a/src/doc/siovec.h/siovec_off.3.md
+++ /dev/null
@@ -1,35 +0,0 @@
-% limb manual
-% siovec_off(3)
-
-# NAME
-
-siovec\_off - return the byte at the given offset in data from *struct iovec*
-
-# SYNOPSIS
-
-    #include <limb/siovec.h>
-
-```pre hl
-int siovec_off(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>off</em>)
-```
-
-# DESCRIPTION
-
-The `siovec_off`() function returns the byte at offset `offset` from the data
-scattered across given array `v` of `n` *struct iovec*.
-
-# RETURN VALUE
-
-The `siovec_off`() function returns the `offset`th byte of data scattered the
-specified array of *struct iovec*, or -1 and set `errno` to indicate the error.
-
-# ERRORS
-
-The function may fail if:
-
-: *EINVAL*
-:: The value `offset` is invalid
-
-# SEE ALSO
-
-[siovec_seek](3), [siovec_gather](3)
diff --git a/src/doc/siovec.h/siovec_seek_bytechr.3.md b/src/doc/siovec.h/siovec_seek_bytechr.3.md
deleted file mode 100644
index 74b3250..0000000
--- a/src/doc/siovec.h/siovec_seek_bytechr.3.md
+++ /dev/null
@@ -1,33 +0,0 @@
-% limb manual
-% siovec_seek_bytechr(3)
-
-# NAME
-
-siovec\_seek\_bytechr - scan data from *struct iovec* for a given byte
-
-# SYNOPSIS
-
-    #include <limb/siovec.h>
-
-```pre hl
-size_t siovec_seek_bytechr(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>, char <em>c</em>)
-```
-
-# DESCRIPTION
-
-The `siovec_seek_bytechr`() function scans data pointed by the array `v` of `n`
-*struct iovec* for the first instance of `c`, starting at byte `offset` within
-the data.
-
-This is the equivalent of [siovec_bytechr](3) but skipping the first `offset`
-bytes of data.
-
-# RETURN VALUE
-
-`siovec_seek_bytechr`() returns the position of the first occurrence of `c`
-within the data behind `v` if found. Otherwise it returns the total length of
-the data.
-
-# SEE ALSO
-
-[siovec_seek](3), [siovec_bytechr](3), [byte_chr](3)
diff --git a/src/doc/siovec.h/siovec_seek_bytein.3.md b/src/doc/siovec.h/siovec_seek_bytein.3.md
deleted file mode 100644
index 4d274ec..0000000
--- a/src/doc/siovec.h/siovec_seek_bytein.3.md
+++ /dev/null
@@ -1,35 +0,0 @@
-% limb manual
-% siovec_seek_bytein(3)
-
-# NAME
-
-siovec\_seek\_bytein - scan data from *struct iovec* for any of the byte from
-an array
-
-# SYNOPSIS
-
-    #include <limb/siovec.h>
-
-```pre hl
-size_t siovec_seek_bytein(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>,
-                          const char *<em>s</em>, size_t <em>l</em>)
-```
-
-# DESCRIPTION
-
-The `siovec_seek_bytein`() function scans data pointed by the array `v` of `n`
-*struct iovec* for the first instance of any of the `l` bytes pointed by `s`,
-starting at byte `offset` within the data.
-
-This is the equivalent of [siovec_bytein](3) but skipping the first `offset`
-bytes of data.
-
-# RETURN VALUE
-
-`siovec_seek_bytein`() returns the position of the first occurrence of any
-bytes from `s` within the data behind `v` if found. Otherwise it returns
-the total length of the data.
-
-# SEE ALSO
-
-[siovec_seek](3), [siovec_bytein](3), [byte_in](3)
diff --git a/src/doc/siovec.h/siovec_seek_gather.3.md b/src/doc/siovec.h/siovec_seek_gather.3.md
deleted file mode 100644
index 7d1edc8..0000000
--- a/src/doc/siovec.h/siovec_seek_gather.3.md
+++ /dev/null
@@ -1,32 +0,0 @@
-% limb manual
-% siovec_seek_gather(3)
-
-# NAME
-
-siovec\_seek\_gather - gather data from struct iovec into a byte array
-
-# SYNOPSIS
-
-    #include <limb/siovec.h>
-
-```pre hl
-size_t siovec_seek_gather(const struct iovec *<em>v</em>, unsigned int <em>n</em>, size_t <em>offset</em>,
-                          char *<em>s</em>, size_t <em>max</em>)
-```
-
-# DESCRIPTION
-
-The `siovec_seek_gather`() function gathers data scattered across given array
-`v` of `n` *struct iovec* into the byte array pointed to by `s`, up to `max`
-bytes, starting at offset `offset` within the data.
-
-This is the equivalent of [siovec_gather](3) but skipping the first `offset`
-bytes of data.
-
-# RETURN VALUE
-
-`siovec_seek_gather`() returns the number of bytes copied into `s`.
-
-# SEE ALSO
-
-[siovec_seek](3), [siovec_gather](3), [siovec_seek_gather0](3)
diff --git a/src/doc/siovec.h/siovec_seek_gather0.3.md b/src/doc/siovec.h/siovec_seek_gather0.3.md
deleted file mode 120000
index 7a7e075..0000000
--- a/src/doc/siovec.h/siovec_seek_gather0.3.md
+++ /dev/null
@@ -1 +0,0 @@
-siovec_gather0.3.md
\ No newline at end of file
diff --git a/src/liblimb/include/limb/siovec.h b/src/liblimb/include/limb/siovec.h
index 8f4e567..9d88174 100644
--- a/src/liblimb/include/limb/siovec.h
+++ b/src/liblimb/include/limb/siovec.h
@@ -6,38 +6,24 @@
 
 #include <skalibs/siovec.h>
 
-extern size_t siovec_gather0(const struct iovec *v, unsigned int n, char *dst, size_t max);
-extern int siovec_memcmp(const struct iovec *v, unsigned int n, const char *s, size_t len);
-extern int siovec_off(const struct iovec *v, unsigned int n, size_t off);
-
-extern size_t siovec_seek_gather(const struct iovec *v, unsigned int n, size_t offset,
-                                 char *dst, size_t max);
-extern size_t siovec_seek_gather0(const struct iovec *v, unsigned int n, size_t offset,
-                                  char *dst, size_t max);
-extern size_t siovec_seek_bytechr(const struct iovec *v, unsigned int n, size_t offset,
-                                  char c);
-extern size_t siovec_seek_bytein(const struct iovec *v, unsigned int n, size_t offset,
-                                 const char *sep, size_t len);
-
-/* from skalibs */
-extern size_t siovec_search(const struct iovec *v, unsigned int n, const char *str, size_t len);
-
 #define siov_len(v,n)                       siovec_len(v, n)
-#define siov_off(v,n,o)                     siovec_off(v, n, o)
-#define siov_memcmp(v,n,s,l)                siovec_memcmp(v, n, s, l)
 #define siov_gather(dst,max,v,n)            siovec_gather(v, n, dst, max)
-#define siov_gather0(dst,max,v,n)           siovec_gather0(v, n, dst, max)
 #define siov_scatter(v,n,sce,len)           siovec_scatter(v, n, sce, len)
 #define siov_deal(vdst,ndst,vsce,nsce)      siovec_deal(vdst, ndst, vsce, nsce)
 #define siov_seek(v,n,o)                    siovec_seek(v, n, o)
 #define siov_trunc(v,n,l)                   siovec_trunc(v, n, l)
+
 #define siov_bytechr(v,n,c)                 siovec_bytechr(v, n, c)
 #define siov_bytein(v,n,s,l)                siovec_bytein(v, n, s, l)
 #define siov_search(v,n,s,l)                siovec_search(v, n, s, l)
 
-#define siov_seek_gather(dst,max,v,n,o)     siovec_seek_gather(v, n, o, dst, max)
-#define siov_seek_gather0(dst,max,v,n,o)    siovec_seek_gather0(v, n, o, dst, max)
-#define siov_seek_bytechr(v,n,o,c)          siovec_seek_bytechr(v, n, o, c)
-#define siov_seek_bytein(v,n,o,s,l)         siovec_seek_bytein(v, n, o, s, l)
+extern size_t siov_gather0(char *dst, size_t max, const struct iovec *v, unsigned int n);
+extern int siov_memcmp(const struct iovec *v, unsigned int n, const char *s, size_t len);
+extern int siov_off(const struct iovec *v, unsigned int n, size_t off);
+
+extern size_t siov_seek_gather(char *dst, size_t max, const struct iovec *v, unsigned int n, size_t offset);
+extern size_t siov_seek_gather0(char *dst, size_t max, const struct iovec *v, unsigned int n, size_t offset);
+extern size_t siov_seek_bytechr(const struct iovec *v, unsigned int n, size_t offset, char c);
+extern size_t siov_seek_bytein(const struct iovec *v, unsigned int n, size_t offset, const char *sep, size_t len);
 
 #endif /* LIMB_SIOVEC_H */
diff --git a/src/liblimb/siovec.h/siovec_gather0.c b/src/liblimb/siovec.h/siov_gather0.c
similarity index 55%
rename from src/liblimb/siovec.h/siovec_gather0.c
rename to src/liblimb/siovec.h/siov_gather0.c
index dc47cf4..4f82243 100644
--- a/src/liblimb/siovec.h/siovec_gather0.c
+++ b/src/liblimb/siovec.h/siov_gather0.c
@@ -4,15 +4,15 @@
 #include <limb/siovec.h>
 
 size_t
-siovec_gather0(const struct iovec *v, unsigned int n, char *s, size_t max)
+siov_gather0(char *dst, size_t dlen, const struct iovec *v, unsigned int n)
 {
-    size_t w = siovec_gather(v, n, s, max);
+    size_t w = siov_gather(dst, dlen, v, n);
 
-    if (s[w - 1]) {
-        if (w < max)
-            s[w++] = 0;
+    if (dst[w - 1]) {
+        if (w < dlen)
+            dst[w++] = 0;
         else
-            s[w] = 0;
+            dst[w] = 0;
     }
 
     return w;
diff --git a/src/liblimb/siovec.h/siovec_memcmp.c b/src/liblimb/siovec.h/siov_memcmp.c
similarity index 87%
rename from src/liblimb/siovec.h/siovec_memcmp.c
rename to src/liblimb/siovec.h/siov_memcmp.c
index 6a3f8d5..ffdd6f6 100644
--- a/src/liblimb/siovec.h/siovec_memcmp.c
+++ b/src/liblimb/siovec.h/siov_memcmp.c
@@ -5,7 +5,7 @@
 #include <limb/siovec.h>
 
 int
-siovec_memcmp(const struct iovec *v, unsigned int n, const char *s, size_t len)
+siov_memcmp(const struct iovec *v, unsigned int n, const char *s, size_t len)
 {
     int r = (n) ? 0 : (len) ? -1 : 0;
 
diff --git a/src/liblimb/siovec.h/siovec_off.c b/src/liblimb/siovec.h/siov_off.c
similarity index 87%
rename from src/liblimb/siovec.h/siovec_off.c
rename to src/liblimb/siovec.h/siov_off.c
index f2cc01a..5e84f11 100644
--- a/src/liblimb/siovec.h/siovec_off.c
+++ b/src/liblimb/siovec.h/siov_off.c
@@ -5,7 +5,7 @@
 #include <limb/siovec.h>
 
 int
-siovec_off(const struct iovec *v, unsigned int n, size_t off)
+siov_off(const struct iovec *v, unsigned int n, size_t off)
 {
     for (unsigned int i = 0; i < n; ++i) {
         if (v[i].iov_len > off) return ((char *) v[i].iov_base)[off];
diff --git a/src/liblimb/siovec.h/siovec_seek_bytechr.c b/src/liblimb/siovec.h/siov_seek_bytechr.c
similarity index 68%
rename from src/liblimb/siovec.h/siovec_seek_bytechr.c
rename to src/liblimb/siovec.h/siov_seek_bytechr.c
index a81304b..b3661c8 100644
--- a/src/liblimb/siovec.h/siovec_seek_bytechr.c
+++ b/src/liblimb/siovec.h/siov_seek_bytechr.c
@@ -4,13 +4,13 @@
 #include <limb/siovec.h>
 
 size_t
-siovec_seek_bytechr(const struct iovec *v, unsigned int n, size_t offset, char c)
+siov_seek_bytechr(const struct iovec *v, unsigned int n, size_t offset, char c)
 {
     struct iovec vv[n];
 
     for (unsigned int i = 0; i < n; ++i)
         vv[i] = v[i];
 
-    siovec_seek(vv, n, offset);
-    return siovec_bytechr(vv, n, c);
+    siov_seek(vv, n, offset);
+    return siov_bytechr(vv, n, c);
 }
diff --git a/src/liblimb/siovec.h/siovec_seek_gather.c b/src/liblimb/siovec.h/siov_seek_bytein.c
similarity index 66%
rename from src/liblimb/siovec.h/siovec_seek_gather.c
rename to src/liblimb/siovec.h/siov_seek_bytein.c
index f51703a..772c96a 100644
--- a/src/liblimb/siovec.h/siovec_seek_gather.c
+++ b/src/liblimb/siovec.h/siov_seek_bytein.c
@@ -4,13 +4,13 @@
 #include <limb/siovec.h>
 
 size_t
-siovec_seek_gather(const struct iovec *v, unsigned int n, size_t offset, char *s, size_t max)
+siov_seek_bytein(const struct iovec *v, unsigned int n, size_t offset, const char *s, size_t l)
 {
     struct iovec vv[n];
 
     for (unsigned int i = 0; i < n; ++i)
         vv[i] = v[i];
 
-    siovec_seek(vv, n, offset);
-    return siovec_gather(vv, n, s, max);
+    siov_seek(vv, n, offset);
+    return siov_bytein(vv, n, s, l);
 }
diff --git a/src/liblimb/siovec.h/siovec_seek_gather0.c b/src/liblimb/siovec.h/siov_seek_gather.c
similarity index 65%
rename from src/liblimb/siovec.h/siovec_seek_gather0.c
rename to src/liblimb/siovec.h/siov_seek_gather.c
index 970cca4..48d697b 100644
--- a/src/liblimb/siovec.h/siovec_seek_gather0.c
+++ b/src/liblimb/siovec.h/siov_seek_gather.c
@@ -4,13 +4,13 @@
 #include <limb/siovec.h>
 
 size_t
-siovec_seek_gather0(const struct iovec *v, unsigned int n, size_t offset, char *s, size_t max)
+siov_seek_gather(char *dst, size_t dlen, const struct iovec *v, unsigned int n, size_t offset)
 {
     struct iovec vv[n];
 
     for (unsigned int i = 0; i < n; ++i)
         vv[i] = v[i];
 
-    siovec_seek(vv, n, offset);
-    return siovec_gather0(vv, n, s, max);
+    siov_seek(vv, n, offset);
+    return siov_gather(dst, dlen, vv, n);
 }
diff --git a/src/liblimb/siovec.h/siovec_seek_bytein.c b/src/liblimb/siovec.h/siov_seek_gather0.c
similarity index 63%
rename from src/liblimb/siovec.h/siovec_seek_bytein.c
rename to src/liblimb/siovec.h/siov_seek_gather0.c
index ad64b48..9c71f5c 100644
--- a/src/liblimb/siovec.h/siovec_seek_bytein.c
+++ b/src/liblimb/siovec.h/siov_seek_gather0.c
@@ -4,14 +4,13 @@
 #include <limb/siovec.h>
 
 size_t
-siovec_seek_bytein(const struct iovec *v, unsigned int n, size_t offset,
-                   const char *s, size_t l)
+siov_seek_gather0(char *dst, size_t dlen, const struct iovec *v, unsigned int n, size_t offset)
 {
     struct iovec vv[n];
 
     for (unsigned int i = 0; i < n; ++i)
         vv[i] = v[i];
 
-    siovec_seek(vv, n, offset);
-    return siovec_bytein(vv, n, s, l);
+    siov_seek(vv, n, offset);
+    return siov_gather0(dst, dlen, vv, n);
 }