mounts/ext: fix path to the test file

[root@avagin-fc19-cr ext]# bash run.sh
+ make
make: Nothing to be done for `all'.
+ criu=../../../criu
+ finf=finish
+ outf=run_output
+ pidfile=pid_wait
+ tempd=temp_dir
+ sfile=source_file
+ tdir=test_dir
+ dfile=dest_file
+ mesg=msg-35
+ export finf
+ export outf
+ export pidfile
+ export sfile
+ export dfile
+ export tempd
+ export mesg
+ export tdir
+ mkdir dump/
mkdir: cannot create directory ‘dump/’: File exists
+ mkdir test_dir
mkdir: cannot create directory ‘test_dir’: File exists
+ mount --bind / test_dir
+ mount --make-rprivate test_dir
+ unshare --mount ./run_ns.sh
+ set -e
+ odir=mexold
++ pwd
+ cur=/root/crtools/test/mounts/ext
+ mount --make-rprivate /
+ rm -rf temp_dir finish run_output /mexold
+ mkdir temp_dir
+ touch test_dir/dest_file
+ mount -t tmpfs none temp_dir
+ echo msg-35
+ mount --bind temp_dir/source_file
test_dir//root/crtools/test/mounts/ext/test_dir/dest_file
mount: mount point
test_dir//root/crtools/test/mounts/ext/test_dir/dest_file does not exist
+ fail 'Can'\''t unshare ns'
+ echo 'Can'\''t' unshare ns
Can't unshare ns
+ exit 1

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: Version 1.1-rc1

Two major changes so far -- libcriu.so (RPC wrapper) and plugins.
Both define some API and we want to check this API is good enough.
Thus we tag the -rc1 to let people try it. If things go smooth, we
will just go agead and tar the 1.1.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
check: Collect mount infos before checking

We might need to resolve socket paths, which
will require mount infos tree collected.

Reported-by: Neal Becker <ndbecker2@gmail.com>

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
service: On check req check for minimal kernel support

When RPC is being requested to check the kernel, it's
enough to check the minimal amount of kernel feature.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
rst: Error code got hidden by successful core read

The ret is overwritten by core read sub-routine. Need
to reset it to -1 to keep failing in case of e.g. last
pid sysctl write.

Reported-by: Neal Becker <ndbecker2@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test/zdtm/lib/Makefile: rm unused targets from PHONY

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test/*Makefile: add/append PHONY targets

...where they are missing.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test/zdtm/lib/Makefile: more PHONY targets

Forgot these ones

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make clean: fix

When running 'make clean' from the top dir, the following error happens:

 make[3]: Leaving directory `/vz/kir/git/criu/test/zdtm/live/static'
 make[2]: Leaving directory `/vz/kir/git/criu/test/zdtm/live'
 set -e; for d in lib live; do make -C $d cleanout; done
 make[2]: Entering directory `/vz/kir/git/criu/test/zdtm/lib'
 make[2]: *** No rule to make target `cleanout'.  Stop.
 make[2]: Leaving directory `/vz/kir/git/criu/test/zdtm/lib'
 make[1]: *** [cleanout] Error 2
 make[1]: Leaving directory `/vz/kir/git/criu/test/zdtm'
 make: *** [clean] Error 2

Fix by adding dummy cleanout target to test/zdtm/lib/Makefile

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
simplify dummy rules

Use true instead of echo >/dev/null -- same effect, less bytes.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
main(): don't dupe open_image_dir() error message

In case open_image_dir() fails, it prints an error why,
so there is no need to print it one more time.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: unify/improve bad argument messages

* Introduce a generic way to report that option argument is invalid
* Switch to using it from existing places
  (options --veth-pair, --port, -n)
* Check for invalid argument of -p and -t and report it.

Notes:

1) In order to correctly print long option name in case it was used
   instead of a short one, I had to move "struct option long_opts"
   to main() context, this is why the patch is so long.

2) pr_msg() (rather than pr_err()) is used to print errors, otherwise
   it is prefixed with that (crtools.c:123) prefix which makes it
   look weird.

3) Usage is not shown in case of error, otherwise an error message
   is lost in output.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: unify invalid usage error messages

* Make "invalid usage" type messages uniform
* Use pr_msg() not pr_err(), as we don't want to clutter output
  with useless information like (crtools.c:123).

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: don't show long usage in case of error

* Don't show long usage in case of usage error, otherwise an actual
  error message will be lost in long output.

* Print error if command is not specified.

* Return 0 if criu --help is used.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Doc/Makefile: make clean less greedy

Only remove the files which we explicitly generate.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Doc/Makefile: add ps and pdf generation

It can be handful to check how a man page looks in PDF or Postscript.
Use 'make ps' and 'make pdf' to generate one.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
log.c: fix a typo in a comment

This is just s/and/end/ to slightly improve readability.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu --help, Doc/criu.txt: fix -v option description

Current description of -v[vvv] was taken from criu-log.h comments
and describes specific log levels used by pr_* functions. The problem
is -vX includes all previous X-1, X-2... levels. Say, -vvvv description
says "debug only", while in fact it is not "only". Fix accordingly.

Also, removed -v0 description as it is useless. What -v0 in fact does is
it sets the log level to default -- same as if -vXXX is not used.

In addition, change a delimiter between option alternatives from comma
to a vertical bar in criu --help output, to be in line with the rest
of usage output.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
print_on_level(): simplify off setting code

This is a slight refactoring of commit 7de9652, which just simplifies
initialization of 'off' variable, and adds the comment why we do so.
Should make the next patch easier to read.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
log: only print timestamps when verbosity increased

While timestamps can be handy, they clutter output for normal users.
Let's print them only when verbosity (-v) is increased from default.
Currently, default is 2 (-vv) so for timestamps one should use -vvv
or -v3.

Alternatively, we could introduce a separate --timestamps option.
Personally, I find it more handy for timestamps to be tied to log level.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>