lib: Add new test library API

The main features are:

o The cleanup callback is not passed directly to various library functions but
  is set once globally in the structure that describes a test

   - this makes the test API easier to use

   - also fixes a few common mistakes such as passing cleanup callback
     to functions executed from a cleanup

o Most of the boilerplate code is moved to library

  - no more copying standard looping code around :)

o Various resources are initialized and freed automatically when requested

  - this means much less race conditions and ordering problems in cleanups

o The result reporting functions now use shared memory to propagate
  test results from child processes

  - writing tests in child processes is now easier than ever

+ The test-writing-guidelines.txt were updated

Many thanks to Jan who reviewed numerous respins of this patches and
provided valuable suggestions and also to Alexey who pointed out some
stupid mistakes of mine.

Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/tst_fs_link_count.c b/lib/tst_fs_link_count.c
index 45a3a1b..ca0c77e 100644
--- a/lib/tst_fs_link_count.c
+++ b/lib/tst_fs_link_count.c
@@ -24,7 +24,6 @@
 #include "test.h"
 #include "usctest.h"
 #include "safe_macros.h"
-#include "tst_fs_type.h"
 
 #define MAX_SANE_HARD_LINKS	65535
 
@@ -41,7 +40,7 @@
 	TST_F2FS_MAGIC,     TST_NILFS_MAGIC,  TST_EXOFS_MAGIC
 };
 
-int tst_fs_fill_hardlinks(void (*cleanup) (void), const char *dir)
+int tst_fs_fill_hardlinks_(void (*cleanup) (void), const char *dir)
 {
 	unsigned int i, j;
 	char base_filename[PATH_MAX], link_filename[PATH_MAX];
@@ -100,7 +99,7 @@
 	return 0;
 }
 
-int tst_fs_fill_subdirs(void (*cleanup) (void), const char *dir)
+int tst_fs_fill_subdirs_(void (*cleanup) (void), const char *dir)
 {
 	unsigned int i, j, whitelist_size;
 	char dirname[PATH_MAX];