mount: Add helper to search for widest shared peer

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Add helper for path length calculations

The path lenght is zero for the "/" one and strlen(path)
for all the others. This is done so to make it possible
to use this length to get tail-paths: if path_1 starts
with path_2 and both are absolute, then

   path_1 + path_length(path_2)

would give the tail of the tail of path_1 relative to
path_2 even if the path_2 is just "/".

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Rename paths' lengths to reflect whose lengths they are

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Move some variables out of search loop

These are constant for given m, so calculate them outside
of the loop. Also rename them to reflect what they are.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Use issubpath() when checking for submount visibility

When we check whether a submount of a mount is visible in another
mount (shared peer of the latter), we can and should use the new
issubpath helper.

Should because the used strncmp may scan beyond ct_mpnt_rpath if
its length is smaller (no checks for this in the code).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Use pre-calculated ct->mountpoint + t_mpnt_l value

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Sanitize the path recalculation between submounts

Do paths conversions and checks step-by-step and add many comments
what we do in each step and why.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Add helper for searching for shared peer

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Remove the len variable

And use the expression for it, it's quite short. This
makes the amount of variables in the code fit into brains.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>