Commit Graph

7 Commits

Author SHA1 Message Date
Miloslav Trmač d0d72245eb Use the new built-in min() and max() functions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-04-23 22:21:27 +02:00
Daniel J Walsh 13af77e5b6 Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-01-28 07:16:34 -05:00
Kir Kolyshkin fa414d963d Format sources with gofumpt
gofumpt is a superset of gofmt, enabling some more code formatting
rules.

This commit is brought to you by

	gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2023-05-26 16:17:31 -07:00
Miloslav Trmač 2839e5ce08 Misc. warning cleanups
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-01 02:53:06 +02:00
Miloslav Trmač cd0f93f8a9 Make *testing.T the first parameter of helper functions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-01 02:53:06 +02:00
Giuseppe Scrivano 7d41427411 containers: detect overlapping mappings
when the container specifies some mappings to be applied, verify that
they are not overlapping and give a clearer error message.

Closes: https://github.com/containers/storage/issues/1127

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-08 09:57:34 +01:00
Kan Li 15187b0bb8 Rework autons ID mapping generation.
This implements the algorithm proposed in
https://github.com/containers/storage/issues/852#issuecomment-798954173,
which is:
1. find available IDs from subuid/subgid file; by subtracting the used
   IDs (from other containers) as well as additional IDs, we get the IDs
   available to allocate;
2. target ID range is [0, requestedSize), subtract the additional IDs;
3. allocate IDs from range in step 1; the number to allocate is the
   number of IDs in step 2;
4. generate a mapping from IDs in step 3 to the ones in step 2.

Closes: https://github.com/containers/storage/issues/852

Signed-off-by: Kan Li <likan@google.com>
2021-04-03 13:22:23 -07:00