Kir Kolyshkin
cd146e5f0d
getSourceMount(): simplify
...
The flow of getSourceMount was:
1 get all entries from /proc/self/mountinfo
2 do a linear search for the `source` directory
3 if found, return its data
4 get the parent directory of `source`, goto 2
The repeated linear search through the whole mountinfo (which can have
thousands of records) is inefficient. Instead, let's just
1 collect all the relevant records (only those mount points
that can be a parent of `source`)
2 find the record with the longest mountpath, return its data
This was tested manually with something like
```go
func TestGetSourceMount(t *testing.T) {
mnt, flags, err := getSourceMount("/sys/devices/msr/")
assert.NoError(t, err)
t.Logf("mnt: %v, flags: %v", mnt, flags)
}
```
...but it relies on having a specific mount points on the system
being used for testing.
[v2: add unit tests for ParentsFilter]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com >
Upstream-commit: 871c957242df9f8c74faf751a2f14eb5178d4140
Component: engine
2018-04-19 14:49:17 -07:00
..
2018-02-05 16:51:57 -05:00
2018-04-13 00:14:20 +05:30
2018-03-28 16:54:43 -07:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-04-19 14:48:09 -07:00
2018-03-19 14:29:36 -07:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-04-13 13:56:38 -10:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-03-15 17:56:15 +01:00
2017-09-06 12:05:19 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-09 11:24:09 -08:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:48:29 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-16 11:25:14 -05:00
2018-02-05 16:51:57 -05:00
2018-04-10 15:14:34 -04:00
2018-02-26 16:49:37 -05:00
2018-03-28 14:16:31 -04:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:48:29 -05:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:49:37 -05:00
2018-04-19 14:48:25 -07:00
2018-04-19 14:48:25 -07:00
2018-04-17 14:07:08 -04:00
2018-04-17 14:06:53 -04:00
2018-02-14 11:59:18 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-04-17 14:06:53 -04:00
2018-04-17 14:07:08 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-03-16 11:03:43 -04:00
2018-02-26 16:49:37 -05:00
2018-02-05 16:51:57 -05:00
2018-04-17 14:06:53 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-21 18:26:16 -05:00
2018-03-02 14:05:36 +01:00
2018-03-02 14:05:36 +01:00
2018-02-05 16:51:57 -05:00
2018-03-22 09:38:59 -07:00
2018-03-13 21:24:43 -07:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-04-17 14:07:08 -04:00
2018-02-05 16:51:57 -05:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:48:29 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-19 11:19:19 +01:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:49:37 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-15 11:53:11 -05:00
2018-02-21 12:28:13 +01:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:49:37 -05:00
2018-02-27 08:48:31 -08:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-03-12 15:19:08 -04:00
2018-03-16 11:03:43 -04:00
2018-04-19 14:49:17 -07:00
2018-03-15 15:36:36 -07:00
2018-02-05 16:51:57 -05:00
2018-04-17 14:06:53 -04:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:49:37 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-26 16:49:37 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-03-16 11:03:43 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-07 14:27:09 -05:00
2018-02-07 14:27:09 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-04-17 14:06:53 -04:00
2018-02-15 12:57:25 +01:00
2018-04-17 14:06:53 -04:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00