Commit Graph

8 Commits

Author SHA1 Message Date
Kir Kolyshkin 8b67934cbc pkg/mount: wrap mount/umount errors
The errors returned from Mount and Unmount functions are raw
syscall.Errno errors (like EPERM or EINVAL), which provides
no context about what has happened and why.

Similar to os.PathError type, introduce mount.Error type
with some context. The error messages will now look like this:

> mount /tmp/mount-tests/source:/tmp/mount-tests/target, flags: 0x1001: operation not permitted

or

> mount tmpfs:/tmp/mount-test-source-516297835: operation not permitted

Before this patch, it was just

> operation not permitted

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-10 06:41:39 -07:00
Kir Kolyshkin f64f234a52 pkg/mount: faster Umount(), unify code
1. There is absolutely no need to consult /proc/self/mountinfo
   before calling umount(2) -- it's easier to go ahead and ignore
   EINVAL.

Here, EINVAL can mean two things:
 - the path argument is not a mount point (i.e. it's not mounted)
 - the flags argument is invalid (i.e. bad flags)

We assume we never pass the wrong flags to umount(2), so
EINVAL means "not mounted" and can safely be ignored.

This should speed up Umount() a lot.

2. For every Unix, umount is implemented in the same way,
   so let's consolidate the umount code.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-07 19:49:00 -08:00
Sascha Grunert 24d793fc94
Revert API break due to lint fixes
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-29 11:46:52 +01:00
Sascha Grunert b66d5a5c12
Enable goconst linter and fix lints
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-28 15:59:15 +01:00
Daniel J Walsh f39066fe1b Update packages to match latest code in moby/pkg
Had to vendor in a new version of golang.org/x/net to build
Also had to make some changes to drivers to handle
archive.Reader -> io.Reader
archive.Archive -> io.ReadCloser

Also update .gitingore to ignore emacs files, containers-storage.*
and generated man pages.

Also no longer test travis against golang 1.7, cri-o, moby have also
done this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-12 18:00:29 +00:00
Tianon Gravi 89ec17d113 Replace "amd64" build tags with "cgo" as appropriate, and remove where unnecessary
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-08-06 17:20:21 -06:00
Tianon Gravi 065dd231dd Update/fix build tags, Dockerfile, and release.sh for proper building and releasing of linux/386 and linux/arm cross-compiled client binaries
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-01-31 03:16:42 -07:00
Paul Nasrat 2e094db639 Extract mount into pkg.
Mount is self contained and generic, it should be in pkg, to allow other pkg modules to use it.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
2014-01-20 13:59:29 -05:00