Commit Graph

16 Commits

Author SHA1 Message Date
Miloslav Trmač 35b3e0f41b Avoid unnecessary manually-coded loops
Use the "slices", "maps" standard library packages, or other
readily-available features.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-09-05 19:45:45 +02:00
Jan Rodák e73dbaaaf3
Fix errcheck: error return value of `driver.Put` is not checked
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-07-09 14:34:07 +02:00
Kir Kolyshkin a4d8f720a2 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
Nalin Dahyabhai d10c03bc3d Extend driver.ListLayers()
Implement ListLayers() for the aufs, btrfs, and devicemapper drivers,
along with a unit test for them.
Stop filtering out directories with names that aren't 64-hex chars in
vfs and overlay ListLayers() implementations, which is more a convention
than a hard rule.
Have layerStore.Wipe() try to remove remaining listed layers after it
removes the layers that the layerStore knew of.
Close() a dangling ReadCloser in NaiveCreateFromTemplate.
Switch from using plain defer to using t.Cleanup() to handle deleting
layers that tests create, have the addManyLayers() test function do so
as well.
Remove vfs.CopyDir, which near as I can tell isn't referenced anywhere.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-04-12 16:05:09 -04:00
Miloslav Trmač 26370118ed Exclude internal graphtest functions on platforms that don't call them
Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-14 17:17:53 +02:00
Miloslav Trmač 94f6ec89e6 Use bytes.Equal instead of bytes.Compare
Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-14 17:17:53 +02:00
Miloslav Trmač b8f4b5f2d3 Use os.ReadDir instead of ioutil.ReadDir
That is frequently an optimization, because it avoids
a per-item lstat().

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-09-12 16:31:38 +02:00
Miloslav Trmač a1ccc9d862 Use os.WriteFile instead of ioutil.WriteFile
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-09-12 16:31:34 +02:00
Miloslav Trmač 4b28197720 Use os.ReadFile instead of ioutil.ReadFile
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-09-12 16:30:43 +02:00
Miloslav Trmač 8e4495a3b5 Use math/rand.Rand.Read instead of a loop with Int63
This is simpler to read, and actually 30% faster.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-11-19 07:46:23 +01:00
Sascha Grunert d88ef6dc08
Enable goimports linter and fix lints
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-28 15:59:15 +01:00
Nalin Dahyabhai daad9091a9 graphtest: insulate against filesystems with low timestamp granularity
When we test for change detection on top of filesystems with low
timestamp granularity, we can end up updating a file without forcing a
change to its modification timestamp.  Check for that when we attempt to
modify the files, and just keep rewriting it until the timestamp
changes.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-12-04 18:13:08 -05:00
Daniel J Walsh b6ccc0acfa
Add MountOpts to stop adding fields to Get Interface
This patch adds a MountOpts field to the drivers so we can simplify
the interface to Get and allow additional options to be passed in the future.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-05 09:23:46 -04:00
Giuseppe Scrivano 1897396330
drivers: inform Mount of the mappings used by the container
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-26 06:12:42 +02:00
Daniel J Walsh 38e45fb8e2 Backport moby graphtest changes to containers/storage
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-26 20:45:15 +00:00
Nalin Dahyabhai 60ff079996 Rename: cow/cowman -> storage/oci-storage
Rename the library module and CLI wrapper.
Rename daemon/graphdriver to drivers.
Catch up vendoring to match modules we've pruned.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-07-18 17:35:50 -04:00