Fixed code style issues in tests source code mainly replaced
tabs with spaces.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 tests/testrunner.cc       |   2 +-
 tests/tst-eventfd.cc      |   2 +-
 tests/tst-fs-link.cc      |  20 +-
 tests/tst-libc-locking.cc | 145 ++++++------
 tests/tst-rename.cc       | 539 +++++++++++++++++++++---------------------
 tests/tst-symlink.cc      | 582 +++++++++++++++++++++++-----------------------
 tests/tst-syscall.cc      |   2 +-
 tests/tst-zfs-mount.cc    | 229 +++++++++---------
 8 files changed, 755 insertions(+), 766 deletions(-)

diff --git a/tests/testrunner.cc b/tests/testrunner.cc
index 273e01a..26a34ed 100644
--- a/tests/testrunner.cc
+++ b/tests/testrunner.cc
@@ -17,7 +17,7 @@
 #include <osv/run.hh>
 #include <osv/debug.hh>
 
-#define TESTDIR                "/tests"
+#define TESTDIR        "/tests"
 
 static unsigned nr_tests, nr_failures;
 
diff --git a/tests/tst-eventfd.cc b/tests/tst-eventfd.cc
index 27b28df..b673d0e 100644
--- a/tests/tst-eventfd.cc
+++ b/tests/tst-eventfd.cc
@@ -14,7 +14,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#define TMP_FILE       "/tmp/f1"
+#define TMP_FILE    "/tmp/f1"
 
 #define handle_perror(msg) \
    do { perror(msg); printf("\n"); exit(EXIT_FAILURE); } while (0)
diff --git a/tests/tst-fs-link.cc b/tests/tst-fs-link.cc
index c4dc041..4572e19 100644
--- a/tests/tst-fs-link.cc
+++ b/tests/tst-fs-link.cc
@@ -19,7 +19,7 @@
 
 static int tests = 0, fails = 0;
 
-static void report(bool ok, const char* msg)
+static void report(bool ok, const char *msg)
 {
     ++tests;
     fails += !ok;
@@ -39,7 +39,7 @@ static int check_vnode_duplicity(void)
     mktemp(oldpath);
     mktemp(newpath);
 
-    auto fd = open(oldpath, O_CREAT|O_TRUNC|O_RDWR, 0666);
+    auto fd = open(oldpath, O_CREAT | O_TRUNC | O_RDWR, 0666);
     close(fd);
 
     if (link(oldpath, newpath) != 0) {
@@ -68,11 +68,11 @@ static int check_vnode_duplicity(void)
         err = -1;
     }
     vn_unlock(olddp->d_vnode);
- err2:
+    err2:
     drele(newdp);
- err1:
+    err1:
     drele(olddp);
- err:
+    err:
     unlink(newpath);
     unlink(oldpath);
     return err;
@@ -83,18 +83,18 @@ int main(int argc, char *argv[])
     const char *oldpath, *newpath;
     char oldp[64], newp[64];
     struct stat st[2];
-    char buf[4] = { 0 };
-    char buf2[4] = { 0 };
+    char buf[4] = {0};
+    char buf2[4] = {0};
 
     if (argc > 2) {
         oldpath = argv[1];
         newpath = argv[2];
     } else {
 
-       strcpy(oldp, "/usr/tst-fs-linkXXXXXX");
+        strcpy(oldp, "/usr/tst-fs-linkXXXXXX");
         mktemp(oldp);
 
-       strcpy(newp, "/usr/tst-fs-linkXXXXXX");
+        strcpy(newp, "/usr/tst-fs-linkXXXXXX");
         mktemp(newp);
 
         oldpath = oldp;
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
     report(link(oldpath, newpath) < 0 && errno == ENOENT, "link returns ENOENT 
if source path does not exists");
 
     // Create a temporary file that's used in testing.
-    auto fd = open(oldpath, O_CREAT|O_TRUNC|O_RDWR, 0666);
+    auto fd = open(oldpath, O_CREAT | O_TRUNC | O_RDWR, 0666);
     write(fd, "test", 4);
     lseek(fd, 0, SEEK_SET);
     read(fd, buf, 4);
diff --git a/tests/tst-libc-locking.cc b/tests/tst-libc-locking.cc
index 64065d3..32128af 100644
--- a/tests/tst-libc-locking.cc
+++ b/tests/tst-libc-locking.cc
@@ -17,102 +17,101 @@
 /*
  * Coordinates simultaneous thread execution release.
  */
-class starting_line {
+class starting_line
+{
 private:
-       const int _n_threads;
-       std::atomic<int> n_arrived;
+    const int _n_threads;
+    std::atomic<int> n_arrived;
 
 public:
-       starting_line(int n_threads) : _n_threads(n_threads)
-       {
-               n_arrived.store(0);
-       }
-
-       void arrive()
-       {
-               ++n_arrived;
-               assert(n_arrived.load() <= _n_threads);
-
-               while (n_arrived.load() < _n_threads) {}
-       }
+    starting_line(int n_threads) : _n_threads(n_threads) {
+        n_arrived.store(0);
+    }
+
+    void arrive()
+    {
+        ++n_arrived;
+        assert(n_arrived.load() <= _n_threads);
+
+        while (n_arrived.load() < _n_threads) {}
+    }
 };
 
-class consumer {
+class consumer
+{
 private:
-       std::vector<int> consumed;
-       std::thread _thread;
+    std::vector<int> consumed;
+    std::thread _thread;
 public:
-       consumer(FILE* src, starting_line& start)
-               : _thread([this, src, &start] {
-                       start.arrive();
-
-                       int val;
-                       while (fread(&val, sizeof(val), 1, src) == 1) {
-                               consumed.push_back(val);
-                       }
-               })
-       {}
-
-       std::vector<int> get_consumed()
-       {
-               return consumed;
-       }
-
-       void join()
-       {
-               _thread.join();
-       }
+    consumer(FILE *src, starting_line &start)
+            : _thread([this, src, &start] {
+        start.arrive();
+
+        int val;
+        while (fread(&val, sizeof(val), 1, src) == 1) {
+            consumed.push_back(val);
+        }
+    }) {}
+
+    std::vector<int> get_consumed() {
+        return consumed;
+    }
+
+    void join() {
+        _thread.join();
+    }
 };
 
-void produce(FILE* dst, int count) {
-       for (int i = 0; i < count; i++) {
-               if (fwrite(&i, sizeof(i), 1, dst) == 0) {
-                       perror("fwrite");
-                       return;
-               }
-       }
-
-       fclose(dst);
+void produce(FILE *dst, int count)
+{
+    for (int i = 0; i < count; i++) {
+        if (fwrite(&i, sizeof(i), 1, dst) == 0) {
+            perror("fwrite");
+            return;
+        }
+    }
+
+    fclose(dst);
 }
 
 static std::vector<int> merge(std::vector<int> v1, std::vector<int> v2)
 {
-       std::vector<int> merged;
-       merged.insert(merged.end(), v1.begin(), v1.end());
-       merged.insert(merged.end(), v2.begin(), v2.end());
-       return merged;
+    std::vector<int> merged;
+    merged.insert(merged.end(), v1.begin(), v1.end());
+    merged.insert(merged.end(), v2.begin(), v2.end());
+    return merged;
 }
 
 BOOST_AUTO_TEST_CASE(test_locking_of_file_operations)
 {
-       const int n_to_produce = 1000000;
+    const int n_to_produce = 1000000;
 
-       int pipefd[2];
-       BOOST_REQUIRE(pipe(pipefd) == 0);
-       FILE* in = fdopen(pipefd[0], "r");
-       FILE* out = fdopen(pipefd[1], "w");
+    int pipefd[2];
+    BOOST_REQUIRE(pipe(pipefd) == 0);
+    FILE *in = fdopen(pipefd[0], "r");
+    FILE *out = fdopen(pipefd[1], "w");
 
-       starting_line starting_line(2);
+    starting_line starting_line(2);
 
-       auto consumer1 = consumer(in, starting_line);
-       auto consumer2 = consumer(in, starting_line);
-       produce(out, n_to_produce);
+    auto consumer1 = consumer(in, starting_line);
+    auto consumer2 = consumer(in, starting_line);
+    produce(out, n_to_produce);
 
-       consumer1.join();
-       consumer2.join();
-       fclose(in);
+    consumer1.join();
+    consumer2.join();
+    fclose(in);
 
-       auto values1 = consumer1.get_consumed();
-       auto values2 = consumer2.get_consumed();
+    auto values1 = consumer1.get_consumed();
+    auto values2 = consumer2.get_consumed();
 
-       BOOST_TEST_MESSAGE("Consumer 1 collected " + 
std::to_string(values1.size()));
-       BOOST_TEST_MESSAGE("Consumer 2 collected " + 
std::to_string(values2.size()));
+    BOOST_TEST_MESSAGE("Consumer 1 collected " + 
std::to_string(values1.size()));
+    BOOST_TEST_MESSAGE("Consumer 2 collected " + 
std::to_string(values2.size()));
 
-       auto merged = merge(values1, values2);
-       std::sort(merged.begin(), merged.end());
+    auto merged = merge(values1, values2);
+    std::sort(merged.begin(), merged.end());
 
-       BOOST_TEST_MESSAGE("Verifying collected data...");
-       for (int i = 0; i < n_to_produce; i++) {
-               BOOST_REQUIRE_EQUAL(merged[i], i);
-       }
+    BOOST_TEST_MESSAGE("Verifying collected data...");
+    for (int i = 0; i < n_to_produce; i++) {
+        BOOST_REQUIRE_EQUAL(merged[i], i);
+    }
 }
diff --git a/tests/tst-rename.cc b/tests/tst-rename.cc
index 648a190..722fdc4 100644
--- a/tests/tst-rename.cc
+++ b/tests/tst-rename.cc
@@ -26,460 +26,451 @@ namespace fs = boost::filesystem;
 static const char *SECRET = "Hello, world";
 
 
-static std::string read_line(const fs::path& path)
+static std::string read_line(const fs::path &path)
 {
-       std::string line;
-       fs::ifstream file(path);
-       std::getline(file, line);
-       return line;
+    std::string line;
+    fs::ifstream file(path);
+    std::getline(file, line);
+    return line;
 }
 
-static void prepare_file(const fs::path& path, const char *secret = SECRET)
+static void prepare_file(const fs::path &path, const char *secret = SECRET)
 {
-       BOOST_REQUIRE_MESSAGE(!fs::exists(path), "File should not exist");
+    BOOST_REQUIRE_MESSAGE(!fs::exists(path), "File should not exist");
 
-       BOOST_TEST_MESSAGE("Writing secret to " + path.string());
-       fs::ofstream file(path);
-       BOOST_REQUIRE_MESSAGE(file, "File should be open");
-       file << secret;
+    BOOST_TEST_MESSAGE("Writing secret to " + path.string());
+    fs::ofstream file(path);
+    BOOST_REQUIRE_MESSAGE(file, "File should be open");
+    file << secret;
 }
 
-static void check_file(const fs::path& path)
-{
-       BOOST_CHECK_EQUAL(SECRET, read_line(path));
+static void check_file(const fs::path &path) {
+    BOOST_CHECK_EQUAL(SECRET, read_line(path));
 }
 
 template<typename T>
-static bool contains(std::vector<T> values, T value)
-{
-       return std::find(values.begin(), values.end(), value) != values.end();
+static bool contains(std::vector<T> values, T value) {
+    return std::find(values.begin(), values.end(), value) != values.end();
 }
 
 template<typename Iter>
 static std::vector<std::string> to_strings(Iter values)
 {
-       std::vector<std::string> strings;
-       for (auto v : values)
-       {
-               strings.push_back(std::to_string(v));
-       }
-       return strings;
+    std::vector<std::string> strings;
+    for (auto v : values) {
+        strings.push_back(std::to_string(v));
+    }
+    return strings;
 }
 
-static void assert_one_of(int value, std::vector<int> values)
-{
-       BOOST_REQUIRE_MESSAGE(contains(values, value),
-               fmt("%s shound be in {%s}") % value % 
boost::algorithm::join(to_strings(values), ", "));
+static void assert_one_of(int value, std::vector<int> values) {
+    BOOST_REQUIRE_MESSAGE(contains(values, value),
+                          fmt("%s shound be in {%s}") % value % 
boost::algorithm::join(to_strings(values), ", "));
 }
 
-static void assert_rename_fails(const fs::path& src, const fs::path& dst, 
std::vector<int> errnos)
+static void assert_rename_fails(const fs::path &src, const fs::path &dst, 
std::vector<int> errnos)
 {
-       BOOST_TEST_MESSAGE("Renaming " + src.string() + " to " + dst.string());
-       BOOST_REQUIRE(rename(src.c_str(), dst.c_str()) == -1);
-       assert_one_of(errno, errnos);
+    BOOST_TEST_MESSAGE("Renaming " + src.string() + " to " + dst.string());
+    BOOST_REQUIRE(rename(src.c_str(), dst.c_str()) == -1);
+    assert_one_of(errno, errnos);
 }
 
 static void assert_renames(const fs::path src, const fs::path dst)
 {
-       BOOST_TEST_MESSAGE("Renaming " + src.string() + " to " + dst.string());
-       int result = rename(src.c_str(), dst.c_str());
-       BOOST_REQUIRE_MESSAGE(result == 0, fmt("Rename should succeed, 
errno=%d") % errno);
+    BOOST_TEST_MESSAGE("Renaming " + src.string() + " to " + dst.string());
+    int result = rename(src.c_str(), dst.c_str());
+    BOOST_REQUIRE_MESSAGE(result == 0, fmt("Rename should succeed, errno=%d") 
% errno);
 }
 
-static void test_rename(const fs::path& src, const fs::path& dst)
+static void test_rename(const fs::path &src, const fs::path &dst)
 {
-       prepare_file(src);
+    prepare_file(src);
 
-       assert_renames(src, dst);
+    assert_renames(src, dst);
 
-       check_file(dst);
-       BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
-       BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
+    check_file(dst);
+    BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
+    BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
 }
 
-static void test_rename_from_open_file(const fs::path& src, const fs::path& 
dst)
+static void test_rename_from_open_file(const fs::path &src, const fs::path 
&dst)
 {
-       prepare_file(src);
+    prepare_file(src);
 
     fs::ifstream file(src);
 
-       assert_renames(src, dst);
+    assert_renames(src, dst);
 
-       check_file(dst);
-       BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
-       BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
+    check_file(dst);
+    BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
+    BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
 }
 
-static void test_rename_to_open_file(const fs::path& src, const fs::path& dst)
+static void test_rename_to_open_file(const fs::path &src, const fs::path &dst)
 {
-       prepare_file(src);
-       prepare_file(dst, "old");
+    prepare_file(src);
+    prepare_file(dst, "old");
 
     fs::ifstream before(dst);
 
-       assert_renames(src, dst);
+    assert_renames(src, dst);
 
-       check_file(dst);
-       BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
-       BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
+    check_file(dst);
+    BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
+    BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
 }
 
-static void test_file_rename_fails(const fs::path& src, const fs::path& dst, 
std::vector<int> errnos)
+static void test_file_rename_fails(const fs::path &src, const fs::path &dst, 
std::vector<int> errnos)
 {
-       prepare_file(src);
-       assert_rename_fails(src, dst, errnos);
-       check_file(src);
-       BOOST_CHECK_MESSAGE(fs::remove(src), "Sould be possible to remove old 
file");
+    prepare_file(src);
+    assert_rename_fails(src, dst, errnos);
+    check_file(src);
+    BOOST_CHECK_MESSAGE(fs::remove(src), "Sould be possible to remove old 
file");
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_in_the_same_directory)
 {
-       TempDir dir;
+    TempDir dir;
 
-       test_rename(
-               dir / "file1",
-               dir / "file2");
+    test_rename(
+            dir / "file1",
+            dir / "file2");
 
-       test_rename_from_open_file(
-               dir / "file1",
-               dir / "file2");
+    test_rename_from_open_file(
+            dir / "file1",
+            dir / "file2");
 
-       test_rename_to_open_file(
-               dir / "file1",
-               dir / "file2");
+    test_rename_to_open_file(
+            dir / "file1",
+            dir / "file2");
 
-       test_rename(
-               dir / "a",
-               dir / "aaaaa");
+    test_rename(
+            dir / "a",
+            dir / "aaaaa");
 
-       test_rename(
-               dir / "aaaaaaaaa",
-               dir / "aa");
+    test_rename(
+            dir / "aaaaaaaaa",
+            dir / "aa");
 }
 
-BOOST_AUTO_TEST_CASE(test_renaming_to_child_path_should_fail)
-{
-       TempDir dir;
-       assert_rename_fails(dir, dir / "child", {EINVAL});
+BOOST_AUTO_TEST_CASE(test_renaming_to_child_path_should_fail) {
+    TempDir dir;
+    assert_rename_fails(dir, dir / "child", {EINVAL});
 }
 
 BOOST_AUTO_TEST_CASE(test_moving_file_to_another_directory)
 {
-       TempDir dir;
+    TempDir dir;
 
-       std::string sub("sub");
-       BOOST_REQUIRE(fs::create_directories(dir / sub));
+    std::string sub("sub");
+    BOOST_REQUIRE(fs::create_directories(dir / sub));
 
-       test_rename(
-               dir / "file",
-               dir / sub / "file");
+    test_rename(
+            dir / "file",
+            dir / sub / "file");
 
-       test_rename(
-               dir / sub / "file2",
-               dir / "file2");
+    test_rename(
+            dir / sub / "file2",
+            dir / "file2");
 
-       test_rename(
-               dir / sub / "a",
-               dir / "aaaa");
+    test_rename(
+            dir / sub / "a",
+            dir / "aaaa");
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_when_destination_is_substring)
 {
-       TempDir dir;
+    TempDir dir;
 
-       test_rename(
-               dir / "one_two",
-               dir / "one");
+    test_rename(
+            dir / "one_two",
+            dir / "one");
 
-       test_rename(
-               dir / "two",
-               dir / "two_one");
+    test_rename(
+            dir / "two",
+            dir / "two_one");
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_works_with_non_uniform_paths)
 {
-       TempDir dir;
-       std::string sub("sub");
-       fs::path file(dir / sub / "file");
+    TempDir dir;
+    std::string sub("sub");
+    fs::path file(dir / sub / "file");
 
-       BOOST_REQUIRE(fs::create_directories(dir / sub));
+    BOOST_REQUIRE(fs::create_directories(dir / sub));
 
-       test_rename(file, dir / "/file2");
-       test_rename(file, dir / "/sub///file2");
+    test_rename(file, dir / "/file2");
+    test_rename(file, dir / "/sub///file2");
 }
 
 
BOOST_AUTO_TEST_CASE(test_file_can_be_located_using_different_paths_after_rename)
 {
-       TempDir dir;
-       fs::path file(dir / "file");
-       fs::path subDir(dir / "sub");
-       fs::path dst(subDir / "//file2");
+    TempDir dir;
+    fs::path file(dir / "file");
+    fs::path subDir(dir / "sub");
+    fs::path dst(subDir / "//file2");
 
-       BOOST_REQUIRE(fs::create_directories(subDir));
-       prepare_file(file);
+    BOOST_REQUIRE(fs::create_directories(subDir));
+    prepare_file(file);
 
-       assert_renames(file, dst);
+    assert_renames(file, dst);
 
-       check_file(dst);
-       BOOST_CHECK(!fs::exists(file));
-       BOOST_CHECK(fs::exists(dst));
-       BOOST_CHECK(fs::exists(dir / "sub" / "file2"));
-       BOOST_CHECK(fs::exists(dir / "sub" / ".." / "sub//file2"));
-       BOOST_CHECK(fs::exists(dir / "sub" / "." / "file2"));
+    check_file(dst);
+    BOOST_CHECK(!fs::exists(file));
+    BOOST_CHECK(fs::exists(dst));
+    BOOST_CHECK(fs::exists(dir / "sub" / "file2"));
+    BOOST_CHECK(fs::exists(dir / "sub" / ".." / "sub//file2"));
+    BOOST_CHECK(fs::exists(dir / "sub" / "." / "file2"));
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_to_parent)
 {
-       TempDir dir;
-       std::string sub("sub");
-       fs::path file(dir / sub / "file");
+    TempDir dir;
+    std::string sub("sub");
+    fs::path file(dir / sub / "file");
 
-       BOOST_REQUIRE(fs::create_directories(dir / sub));
+    BOOST_REQUIRE(fs::create_directories(dir / sub));
 
-       test_file_rename_fails(file, dir, {ENOTEMPTY, EISDIR, EEXIST});
-       test_file_rename_fails(file, dir / sub, {ENOTEMPTY, EISDIR, EEXIST});
-       test_file_rename_fails(file, dir / "/sub", {ENOTEMPTY, EISDIR, EEXIST});
-       test_file_rename_fails(file, dir / "sub/", {ENOTDIR, EISDIR, EEXIST});
-       test_file_rename_fails(file, dir / "/", {ENOTDIR, EEXIST, EISDIR});
-       test_file_rename_fails(file, dir / "//", {ENOTDIR, EEXIST, EISDIR});
-       test_file_rename_fails(file, dir / "///", {ENOTDIR, EEXIST, EISDIR});
-       test_file_rename_fails(file, dir / "." / sub, {ENOTEMPTY, EEXIST, 
EISDIR});
-       test_file_rename_fails(file, dir / sub / ".." / sub, {ENOTEMPTY, 
EEXIST, EISDIR});
-       test_file_rename_fails(file, dir / sub / ".." / sub / "/", {ENOTDIR, 
EEXIST, EISDIR});
+    test_file_rename_fails(file, dir, {ENOTEMPTY, EISDIR, EEXIST});
+    test_file_rename_fails(file, dir / sub, {ENOTEMPTY, EISDIR, EEXIST});
+    test_file_rename_fails(file, dir / "/sub", {ENOTEMPTY, EISDIR, EEXIST});
+    test_file_rename_fails(file, dir / "sub/", {ENOTDIR, EISDIR, EEXIST});
+    test_file_rename_fails(file, dir / "/", {ENOTDIR, EEXIST, EISDIR});
+    test_file_rename_fails(file, dir / "//", {ENOTDIR, EEXIST, EISDIR});
+    test_file_rename_fails(file, dir / "///", {ENOTDIR, EEXIST, EISDIR});
+    test_file_rename_fails(file, dir / "." / sub, {ENOTEMPTY, EEXIST, EISDIR});
+    test_file_rename_fails(file, dir / sub / ".." / sub, {ENOTEMPTY, EEXIST, 
EISDIR});
+    test_file_rename_fails(file, dir / sub / ".." / sub / "/", {ENOTDIR, 
EEXIST, EISDIR});
 }
 
-static fs::path make_dir(const fs::path& path)
-{
-       BOOST_REQUIRE(fs::create_directories(path));
-       return path;
+static fs::path make_dir(const fs::path &path) {
+    BOOST_REQUIRE(fs::create_directories(path));
+    return path;
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_non_empty_directory)
 {
-       TempDir dir;
+    TempDir dir;
 
-       fs::path src = dir / "sub1";
-       fs::path dst = dir / "sub2";
+    fs::path src = dir / "sub1";
+    fs::path dst = dir / "sub2";
 
-       BOOST_REQUIRE(fs::create_directories(src));
-       BOOST_REQUIRE(fs::exists(src));
-       prepare_file(src / "file");
+    BOOST_REQUIRE(fs::create_directories(src));
+    BOOST_REQUIRE(fs::exists(src));
+    prepare_file(src / "file");
 
-       assert_renames(src, dst);
+    assert_renames(src, dst);
 
-       BOOST_CHECK(!fs::exists(src));
-       BOOST_CHECK(!fs::exists(src / "file"));
-       BOOST_CHECK(fs::exists(dst));
-       check_file(dst / "file");
+    BOOST_CHECK(!fs::exists(src));
+    BOOST_CHECK(!fs::exists(src / "file"));
+    BOOST_CHECK(fs::exists(dst));
+    check_file(dst / "file");
 
-       BOOST_CHECK_MESSAGE(fs::remove_all(dst), "Sould be possible to remove 
new directory");
+    BOOST_CHECK_MESSAGE(fs::remove_all(dst), "Sould be possible to remove new 
directory");
 }
 
 BOOST_AUTO_TEST_CASE(test_assert_old_child_will_not_exist)
 {
-       TempDir dir;
+    TempDir dir;
 
-       fs::path src = dir / "sub1";
-       fs::path dst = dir / "sub2";
+    fs::path src = dir / "sub1";
+    fs::path dst = dir / "sub2";
 
-       BOOST_REQUIRE(fs::create_directories(src));
-       BOOST_REQUIRE(fs::exists(src));
+    BOOST_REQUIRE(fs::create_directories(src));
+    BOOST_REQUIRE(fs::exists(src));
 
-       fs::path file = src / "file";
-       prepare_file(file);
+    fs::path file = src / "file";
+    prepare_file(file);
 
-       // Keep dentry underlying file in hash table.
-       auto fd = open(file.string().c_str(), O_RDONLY);
-       BOOST_CHECK(fd > 0);
+    // Keep dentry underlying file in hash table.
+    auto fd = open(file.string().c_str(), O_RDONLY);
+    BOOST_CHECK(fd > 0);
 
-       assert_renames(src, dst);
+    assert_renames(src, dst);
 
-       BOOST_CHECK(!fs::exists(src));
+    BOOST_CHECK(!fs::exists(src));
 
-       // Assure that file (src's child) will not be found.
-       BOOST_CHECK(!fs::exists(file));
+    // Assure that file (src's child) will not be found.
+    BOOST_CHECK(!fs::exists(file));
 
-       BOOST_CHECK(fs::exists(dst));
-       check_file(dst / "file");
+    BOOST_CHECK(fs::exists(dst));
+    check_file(dst / "file");
 
-       close(fd);
+    close(fd);
 
-       BOOST_CHECK_MESSAGE(fs::remove_all(dst), "Should be possible to remove 
new directory");
+    BOOST_CHECK_MESSAGE(fs::remove_all(dst), "Should be possible to remove new 
directory");
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_file_to_directory)
 {
-       TempDir tmp;
-       fs::path file(tmp / "file");
-       fs::path empty_dir = make_dir(tmp / "dir3");
+    TempDir tmp;
+    fs::path file(tmp / "file");
+    fs::path empty_dir = make_dir(tmp / "dir3");
 
-       fs::path dir = make_dir(tmp / "dir");
-       prepare_file(dir / "file2");
+    fs::path dir = make_dir(tmp / "dir");
+    prepare_file(dir / "file2");
 
-       test_file_rename_fails(file, dir, {EISDIR});
-       test_file_rename_fails(file, empty_dir, {EISDIR});
+    test_file_rename_fails(file, dir, {EISDIR});
+    test_file_rename_fails(file, empty_dir, {EISDIR});
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_directory_to_non_empty_directory)
 {
-       TempDir dir;
-       fs::path src = make_dir(dir / "dir1");
-       fs::path dst = make_dir(dir / "dir2");
+    TempDir dir;
+    fs::path src = make_dir(dir / "dir1");
+    fs::path dst = make_dir(dir / "dir2");
 
-       prepare_file(dst / "file2");
-       assert_rename_fails(src, dst, {ENOTEMPTY, EEXIST});
+    prepare_file(dst / "file2");
+    assert_rename_fails(src, dst, {ENOTEMPTY, EEXIST});
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_directory_to_empty_directory)
 {
-       TempDir dir;
-       fs::path src = make_dir(dir / "dir1");
-       fs::path dst = make_dir(dir / "dir2");
+    TempDir dir;
+    fs::path src = make_dir(dir / "dir1");
+    fs::path dst = make_dir(dir / "dir2");
 
-       assert_renames(src, dst);
-       BOOST_REQUIRE(fs::exists(dst));
-       BOOST_REQUIRE(!fs::exists(src));
+    assert_renames(src, dst);
+    BOOST_REQUIRE(fs::exists(dst));
+    BOOST_REQUIRE(!fs::exists(src));
 
-       assert_renames(dst, src / "/");
-       BOOST_REQUIRE(!fs::exists(dst));
-       BOOST_REQUIRE(fs::exists(src));
+    assert_renames(dst, src / "/");
+    BOOST_REQUIRE(!fs::exists(dst));
+    BOOST_REQUIRE(fs::exists(src));
 }
 
 
BOOST_AUTO_TEST_CASE(test_renaming_file_to_non_existing_path_with_trailing_slash)
 {
-       TempDir dir;
-       fs::path src(dir / "file");
-       fs::path dst(dir / "dir2");
+    TempDir dir;
+    fs::path src(dir / "file");
+    fs::path dst(dir / "dir2");
 
-       BOOST_REQUIRE(!fs::exists(dst));
-       prepare_file(src);
+    BOOST_REQUIRE(!fs::exists(dst));
+    prepare_file(src);
 
-       assert_rename_fails(src, dst / "/", {ENOTDIR});
-       assert_rename_fails(src, dst / "//", {ENOTDIR});
-       assert_rename_fails(src, dst / "///", {ENOTDIR});
+    assert_rename_fails(src, dst / "/", {ENOTDIR});
+    assert_rename_fails(src, dst / "//", {ENOTDIR});
+    assert_rename_fails(src, dst / "///", {ENOTDIR});
 
-       assert_rename_fails(dst / "/", src, {ENOENT});
+    assert_rename_fails(dst / "/", src, {ENOENT});
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_non_exising_file_should_fail)
 {
-       TempDir dir;
-       fs::path dst(dir / "dst");
+    TempDir dir;
+    fs::path dst(dir / "dst");
 
-       assert_rename_fails(dir / "file", dst, {ENOENT});
-       assert_rename_fails(dir / "file/", dst, {ENOENT});
+    assert_rename_fails(dir / "file", dst, {ENOENT});
+    assert_rename_fails(dir / "file/", dst, {ENOENT});
 }
 
 
BOOST_AUTO_TEST_CASE(test_renaming_exising_file_with_trailing_slash_to_non_existing_path_should_fail)
 {
-       TempDir dir;
-       fs::path src(dir / "file");
-       fs::path dst(dir / "file2");
+    TempDir dir;
+    fs::path src(dir / "file");
+    fs::path dst(dir / "file2");
 
-       prepare_file(src);
-       BOOST_REQUIRE(fs::exists(src));
+    prepare_file(src);
+    BOOST_REQUIRE(fs::exists(src));
 
-       assert_rename_fails(src / "/", dst, {ENOTDIR});
-       assert_rename_fails(src / "//", dst, {ENOTDIR});
-       assert_rename_fails(src / "///", dst, {ENOTDIR});
+    assert_rename_fails(src / "/", dst, {ENOTDIR});
+    assert_rename_fails(src / "//", dst, {ENOTDIR});
+    assert_rename_fails(src / "///", dst, {ENOTDIR});
 
-       assert_rename_fails(src / "/", src / "/", {ENOTDIR});
+    assert_rename_fails(src / "/", src / "/", {ENOTDIR});
 }
 
 
BOOST_AUTO_TEST_CASE(test_renaming_directory_to_existing_file_when_dst_ends_with_slash_should_fail)
 {
-       TempDir dir;
-       fs::path file(dir / "file");
+    TempDir dir;
+    fs::path file(dir / "file");
 
-       prepare_file(file);
+    prepare_file(file);
 
-       fs::path empty_dir = make_dir(dir / "empty_dir");
-       assert_rename_fails(empty_dir, file / "/", {ENOTDIR});
-       assert_rename_fails(empty_dir, file, {ENOTDIR});
+    fs::path empty_dir = make_dir(dir / "empty_dir");
+    assert_rename_fails(empty_dir, file / "/", {ENOTDIR});
+    assert_rename_fails(empty_dir, file, {ENOTDIR});
 }
 
-BOOST_AUTO_TEST_CASE(test_renaming_directory_to_nonexisting_file_ending_with_slash_succeeds)
-{
-       TempDir tmp;
-       fs::path dir = make_dir(tmp / "dir");
+BOOST_AUTO_TEST_CASE(test_renaming_directory_to_nonexisting_file_ending_with_slash_succeeds)
 {
+    TempDir tmp;
+    fs::path dir = make_dir(tmp / "dir");
 
-       assert_renames(dir, tmp / "dir2/");
+    assert_renames(dir, tmp / "dir2/");
 }
 
-BOOST_AUTO_TEST_CASE(test_renaming_root)
-{
-       TempDir dir;
-       assert_rename_fails("/", dir, {EBUSY, EINVAL, EXDEV});
-       assert_rename_fails(dir, "/", {EBUSY, EINVAL, EEXIST, EXDEV});
+BOOST_AUTO_TEST_CASE(test_renaming_root) {
+    TempDir dir;
+    assert_rename_fails("/", dir, {EBUSY, EINVAL, EXDEV});
+    assert_rename_fails(dir, "/", {EBUSY, EINVAL, EEXIST, EXDEV});
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_to_self_succeeds)
 {
-       TempDir dir;
-       fs::path file(dir / "file");
+    TempDir dir;
+    fs::path file(dir / "file");
 
-       prepare_file(file);
-       assert_renames(file, file);
-       check_file(file);
+    prepare_file(file);
+    assert_renames(file, file);
+    check_file(file);
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_dir_to_self_succeeds)
 {
-       TempDir dir;
+    TempDir dir;
 
-       assert_renames(dir, dir);
-       assert_renames(dir / "/", dir);
-       assert_renames(dir / "/", dir / "/");
-       assert_renames(dir, dir / "/");
+    assert_renames(dir, dir);
+    assert_renames(dir / "/", dir);
+    assert_renames(dir / "/", dir / "/");
+    assert_renames(dir, dir / "/");
 
-       BOOST_REQUIRE(fs::exists(dir));
+    BOOST_REQUIRE(fs::exists(dir));
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_file_to_self_fails_if_path_ends_with_slash)
 {
-       TempDir dir;
-       fs::path file(dir / "file");
-       prepare_file(file);
+    TempDir dir;
+    fs::path file(dir / "file");
+    prepare_file(file);
 
-       assert_rename_fails(file / "/", file / "/", {ENOTDIR});
-       assert_rename_fails(file / "/", file, {ENOTDIR});
-       assert_rename_fails(file, file / "/", {ENOTDIR});
+    assert_rename_fails(file / "/", file / "/", {ENOTDIR});
+    assert_rename_fails(file / "/", file, {ENOTDIR});
+    assert_rename_fails(file, file / "/", {ENOTDIR});
 }
 
 
BOOST_AUTO_TEST_CASE(test_renaming_with_last_coponent_as_dot_or_dot_dot_shall_fail)
 {
-       TempDir tmp;
-       fs::path dir = make_dir(tmp / "dir");
-       fs::path dir2 = make_dir(tmp / "sub" / "subsub");
-
-       assert_rename_fails(dir, dir2 / "..",  {EBUSY, EINVAL});
-       assert_rename_fails(dir, dir2 / "../", {EBUSY, EINVAL});
-       assert_rename_fails(dir, dir2 / "..//", {EBUSY, EINVAL});
-       assert_rename_fails(dir, dir2 / ".",   {EBUSY, EINVAL});
-       assert_rename_fails(dir, dir2 / "./",  {EBUSY, EINVAL});
-       assert_rename_fails(dir, dir2 / ".//",  {EBUSY, EINVAL});
-
-       fs::path empty_dir = make_dir(tmp / "empty");
-       assert_rename_fails(dir2 / "..",  empty_dir, {EBUSY, EINVAL});
-       assert_rename_fails(dir2 / "../", empty_dir, {EBUSY, EINVAL});
-       assert_rename_fails(dir2 / "..//", empty_dir, {EBUSY, EINVAL});
-       assert_rename_fails(dir2 / ".",   empty_dir, {EBUSY, EINVAL});
-       assert_rename_fails(dir2 / "./",  empty_dir, {EBUSY, EINVAL});
-       assert_rename_fails(dir2 / ".//",  empty_dir, {EBUSY, EINVAL});
-
-       assert_rename_fails(fs::path("."), empty_dir, {EBUSY, EINVAL, EXDEV});
-       assert_rename_fails(fs::path("./"), empty_dir, {EBUSY, EINVAL, EXDEV});
-       assert_rename_fails(fs::path(".//"), empty_dir, {EBUSY, EINVAL, EXDEV});
-       assert_rename_fails(fs::path(".."), empty_dir, {EBUSY, EINVAL, EXDEV});
-       assert_rename_fails(fs::path("../"), empty_dir, {EBUSY, EINVAL, EXDEV});
-       assert_rename_fails(fs::path("..//"), empty_dir, {EBUSY, EINVAL, 
EXDEV});
-}
-
-BOOST_AUTO_TEST_CASE(test_renaming_with_empty_paths_fails)
-{
-       TempDir dir;
-       assert_rename_fails("", dir, {ENOENT});
-       assert_rename_fails(dir, "", {ENOENT});
+    TempDir tmp;
+    fs::path dir = make_dir(tmp / "dir");
+    fs::path dir2 = make_dir(tmp / "sub" / "subsub");
+
+    assert_rename_fails(dir, dir2 / "..", {EBUSY, EINVAL});
+    assert_rename_fails(dir, dir2 / "../", {EBUSY, EINVAL});
+    assert_rename_fails(dir, dir2 / "..//", {EBUSY, EINVAL});
+    assert_rename_fails(dir, dir2 / ".", {EBUSY, EINVAL});
+    assert_rename_fails(dir, dir2 / "./", {EBUSY, EINVAL});
+    assert_rename_fails(dir, dir2 / ".//", {EBUSY, EINVAL});
+
+    fs::path empty_dir = make_dir(tmp / "empty");
+    assert_rename_fails(dir2 / "..", empty_dir, {EBUSY, EINVAL});
+    assert_rename_fails(dir2 / "../", empty_dir, {EBUSY, EINVAL});
+    assert_rename_fails(dir2 / "..//", empty_dir, {EBUSY, EINVAL});
+    assert_rename_fails(dir2 / ".", empty_dir, {EBUSY, EINVAL});
+    assert_rename_fails(dir2 / "./", empty_dir, {EBUSY, EINVAL});
+    assert_rename_fails(dir2 / ".//", empty_dir, {EBUSY, EINVAL});
+
+    assert_rename_fails(fs::path("."), empty_dir, {EBUSY, EINVAL, EXDEV});
+    assert_rename_fails(fs::path("./"), empty_dir, {EBUSY, EINVAL, EXDEV});
+    assert_rename_fails(fs::path(".//"), empty_dir, {EBUSY, EINVAL, EXDEV});
+    assert_rename_fails(fs::path(".."), empty_dir, {EBUSY, EINVAL, EXDEV});
+    assert_rename_fails(fs::path("../"), empty_dir, {EBUSY, EINVAL, EXDEV});
+    assert_rename_fails(fs::path("..//"), empty_dir, {EBUSY, EINVAL, EXDEV});
+}
+
+BOOST_AUTO_TEST_CASE(test_renaming_with_empty_paths_fails) {
+    TempDir dir;
+    assert_rename_fails("", dir, {ENOENT});
+    assert_rename_fails(dir, "", {ENOENT});
 }
 
 BOOST_AUTO_TEST_CASE(test_renaming_unwritable_file)
@@ -490,9 +481,9 @@ BOOST_AUTO_TEST_CASE(test_renaming_unwritable_file)
     fs::path src = dir / "sub1";
     fs::path dst = dir / "sub2";
     prepare_file(src);
-    BOOST_CHECK_MESSAGE(chmod(src.c_str(), 0) ==  0, "Remove permissions on 
old");
+    BOOST_CHECK_MESSAGE(chmod(src.c_str(), 0) == 0, "Remove permissions on 
old");
     assert_renames(src, dst);
-    BOOST_CHECK_MESSAGE(chmod(dst.c_str(), 777) ==  0, "Give permissions on 
new");
+    BOOST_CHECK_MESSAGE(chmod(dst.c_str(), 777) == 0, "Give permissions on 
new");
     check_file(dst);
     BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
     BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new 
file");
diff --git a/tests/tst-symlink.cc b/tests/tst-symlink.cc
index 0aa83d3..214044d 100644
--- a/tests/tst-symlink.cc
+++ b/tests/tst-symlink.cc
@@ -16,335 +16,335 @@
 
 #define debug printf
 
-#define TESTDIR        "/tmp"
-
-#define N1     "f1"
-#define N2     "f2_AAA"
-#define N3     "f3"
-#define N4     "f4"
-#define N5     "f5"
-#define D1     "d1"
-#define D2     "d2_AAA"
-#define D3     "d3"
-#define D4     "d4"
+#define TESTDIR    "/tmp"
+
+#define N1    "f1"
+#define N2    "f2_AAA"
+#define N3    "f3"
+#define N4    "f4"
+#define N5    "f5"
+#define D1    "d1"
+#define D2    "d2_AAA"
+#define D3    "d3"
+#define D4    "d4"
 
 int tests = 0, fails = 0;
 
-static void report(bool ok, const char* msg)
+static void report(bool ok, const char *msg)
 {
-       ++tests;
-       fails += !ok;
-       debug("%s: %s\n", (ok ? "PASS" : "FAIL"), msg);
-       if (fails)
-       exit(0);
+    ++tests;
+    fails += !ok;
+    debug("%s: %s\n", (ok ? "PASS" : "FAIL"), msg);
+    if (fails)
+        exit(0);
 }
 
 static void fill_buf(char *b, unsigned int no)
 {
-       memset(b, 'A', no - 1);
-       b[no - 1] = 0;
+    memset(b, 'A', no - 1);
+    b[no - 1] = 0;
 }
 
 static bool search_dir(const char *dir, const char *name)
 {
-       DIR             *d = opendir(dir);
-       struct dirent   *e;
+    DIR *d = opendir(dir);
+    struct dirent *e;
 
-       report(d != NULL, "opendir");
+    report(d != NULL, "opendir");
 
-       while ((e = readdir(d)) != NULL) {
-               if (strcmp(e->d_name, name) == 0) {
-                       closedir(d);
-                       return (true);
-               }
-       }
-       closedir(d);
+    while ((e = readdir(d)) != NULL) {
+        if (strcmp(e->d_name, name) == 0) {
+            closedir(d);
+            return (true);
+        }
+    }
+    closedir(d);
 
-       return (false);
+    return (false);
 }
 
 int main(int argc, char **argv)
 {
-       struct stat     buf;
-       int             rc;
-       int             error;
-       time_t          t1;
-       char            path[PATH_MAX];
-       int             fd;
-       int             fd1;
-       char            b1[4097];
-       char            b2[4097];
-       char            path1[PATH_MAX];
+    struct stat buf;
+    int rc;
+    int error;
+    time_t t1;
+    char path[PATH_MAX];
+    int fd;
+    int fd1;
+    char b1[4097];
+    char b2[4097];
+    char path1[PATH_MAX];
 
-       debug("Testing symlink() and related functions.\n");
+    debug("Testing symlink() and related functions.\n");
 
-       report(sizeof(path) >= 4096, "sizeof(PATH_MAX)");
+    report(sizeof(path) >= 4096, "sizeof(PATH_MAX)");
 
-       report(chdir(TESTDIR) == 0, "chdir");
+    report(chdir(TESTDIR) == 0, "chdir");
 
-       /*
-        * test to check
-        *      access to symlink
-        *      file type
-        */
-       fd = creat(N1, 0777);
-       report(fd >= 0, "creat");
-       report(search_dir(TESTDIR, N1) == true, "search dir");
+    /*
+     * test to check
+     * access to symlink
+     * file type
+     */
+    fd = creat(N1, 0777);
+    report(fd >= 0, "creat");
+    report(search_dir(TESTDIR, N1) == true, "search dir");
 
-       report(lstat(N1, &buf) == 0, "lstat");
-       report(S_ISREG(buf.st_mode) == 1, "file mode");
+    report(lstat(N1, &buf) == 0, "lstat");
+    report(S_ISREG(buf.st_mode) == 1, "file mode");
 
-       report(symlink(N1, N2) == 0, "symlink");
-       report(search_dir(TESTDIR, N2) == true, "search dir");
+    report(symlink(N1, N2) == 0, "symlink");
+    report(search_dir(TESTDIR, N2) == true, "search dir");
 
-       report(access(N1, R_OK | W_OK) == 0, "access");
-       report(access(N2, R_OK | W_OK) == 0, "access");
+    report(access(N1, R_OK | W_OK) == 0, "access");
+    report(access(N2, R_OK | W_OK) == 0, "access");
 
-       rc = readlink(N2, path, sizeof(path));
-       report(rc >= 0, "readlink");
-       path[rc] = 0;
-       report(strcmp(path, N1) == 0, "readlink path");
+    rc = readlink(N2, path, sizeof(path));
+    report(rc >= 0, "readlink");
+    path[rc] = 0;
+    report(strcmp(path, N1) == 0, "readlink path");
 
-       report(lstat(N2, &buf) == 0, "lstat");
-       report(S_ISLNK(buf.st_mode) == 1, "file mode");
+    report(lstat(N2, &buf) == 0, "lstat");
+    report(S_ISLNK(buf.st_mode) == 1, "file mode");
 
-       close(fd);
-       report(unlink(N1) == 0, "unlink");
-       report(lstat(N2, &buf) == 0, "lstat");
-       report(S_ISLNK(buf.st_mode) == 1, "file mode");
+    close(fd);
+    report(unlink(N1) == 0, "unlink");
+    report(lstat(N2, &buf) == 0, "lstat");
+    report(S_ISLNK(buf.st_mode) == 1, "file mode");
 
-       rc      = stat(N2, &buf);
-       error   = errno;
-       report(rc < 0, "stat");
-       report(error == ENOENT, "ENOENT expected");
+    rc = stat(N2, &buf);
+    error = errno;
+    report(rc < 0, "stat");
+    report(error == ENOENT, "ENOENT expected");
 
-       rc      = unlink(N1);
-       error   = errno;
-       report(rc < 0 && errno == ENOENT, "ENOENT expected");
-       report(unlink(N2) == 0, "unlink");
+    rc = unlink(N1);
+    error = errno;
+    report(rc < 0 && errno == ENOENT, "ENOENT expected");
+    report(unlink(N2) == 0, "unlink");
 
-       /*
-        * IO Tests 1: write(file), read(symlink), truncate(symlink)
-        */
-       fd = creat(N1, 0777);
-       report(fd >= 0, "creat");
-       report(symlink(N1, N2) == 0, "symlink");
+    /*
+     * IO Tests 1: write(file), read(symlink), truncate(symlink)
+     */
+    fd = creat(N1, 0777);
+    report(fd >= 0, "creat");
+    report(symlink(N1, N2) == 0, "symlink");
 
-       fd1 = open(N2, O_RDONLY);
-       report(fd1 >= 0, "symlink open");
+    fd1 = open(N2, O_RDONLY);
+    report(fd1 >= 0, "symlink open");
 
-       fill_buf(b1, sizeof(b1));
+    fill_buf(b1, sizeof(b1));
 
-       rc = write(fd, b1, sizeof(b1));
-       report(rc == sizeof(b1), "file write");
-       fsync(fd);
+    rc = write(fd, b1, sizeof(b1));
+    report(rc == sizeof(b1), "file write");
+    fsync(fd);
 
-       rc = read(fd1, b2, sizeof(b2));
-       report(rc == sizeof(b2), "symlink read");
+    rc = read(fd1, b2, sizeof(b2));
+    report(rc == sizeof(b2), "symlink read");
 
-       report(memcmp(b1, b2, sizeof(b1)) == 0, "data verification");
+    report(memcmp(b1, b2, sizeof(b1)) == 0, "data verification");
 
 #ifdef NOT_YET
-       rc = ftruncate(fd1, 0);
-       report(rc != 0 && errno == EINVAL, "symlink fd truncate");
+    rc = ftruncate(fd1, 0);
+    report(rc != 0 && errno == EINVAL, "symlink fd truncate");
 #endif
-       report(ftruncate(fd, 0) == 0, "file fd truncate");
-       report(fstat(fd, &buf) == 0, "fstat file");
-       report(buf.st_size == 0, "file size after truncate");
-
-       close(fd);
-       close(fd1);
-
-       /*
-        * IO Tests 2: write(symlink), read(file)
-        */
-       fd = open(N1, O_RDONLY);
-       report(fd >= 0, "file open");
-
-       fd1 = open(N2, O_WRONLY);
-       report(fd1 >= 0, "symlink open");
-
-       fill_buf(b1, sizeof(b1));
-
-       rc = write(fd1, b1, sizeof(b1));
-       report(rc == sizeof(b1), "file write");
-       fsync(fd1);
-       close(fd1);
-
-       rc = read(fd, b2, sizeof(b2));
-       report(rc == sizeof(b2), "symlink read");
-
-       report(memcmp(b1, b2, sizeof(b1)) == 0, "data verification");
-
-       /* truncate using symlink path */
-       report(truncate(N2, 0) == 0, "symlink truncate");
-       report(fstat(fd, &buf) == 0, "fstat file");
-       report(buf.st_size == 0, "file size after truncate");
-
-       close(fd);
-       report(unlink(N2) == 0, "unlink");
-       report(unlink(N1) == 0, "unlink");
-
-       /*
-        * creating a symlink inside directory must change time
-        */
-       fd = creat(N1, 0777);
-       report(fd >= 0, "creat");
-       report(mkdir(D1, 0777) == 0, "mkdir");
-       report(stat(D1, &buf) == 0, "stat");
-       t1 = buf.st_ctime;
-       sleep(1);
-
-       snprintf(path, sizeof(path), "%s/%s", D1, N2);
-       report(symlink(N1, path) == 0, "symlink");
-       report(stat(D1, &buf) == 0, "stat");
-
-       report(t1 < buf.st_ctime, "ctime");
-       report(t1 < buf.st_mtime, "mtime");
-
-       close(fd);
-       report(unlink(path) == 0, "unlink");
-       report(unlink(N1) == 0, "unlink");
-       report(rmdir(D1) == 0, "rmdir");
-
-       /* ENOTDIR test */
-       rc      = symlink(N1, path);
-       error   = errno;
-       report(rc < 0, "symlink");
-       report(error == ENOTDIR || error == ENOENT, "ENOTDIR or ENOENT 
expected");
-
-       /* name too long */
-       fd = creat(N1, 0777);
-       report(fd >= 0, "creat");
-
-       fill_buf(path, 255);
-       report(symlink(N1, path) == 0, "symlink");
-       report(unlink(path) == 0, "unlink");
-
-       fill_buf(path, 257);
-       rc      = symlink(N1, path);
-       error   = errno;
-       report(rc < 0, "symlink");
-       report(error == ENAMETOOLONG, "ENAMETOOLONG expected 1");
-
-       fill_buf(path, 4097);
-       unlink(N1);
-       rc      = symlink(path, N1);
-       error   = errno;
-       report(rc < 0, "symlink");
-       report(error == ENAMETOOLONG, "ENAMETOOLONG expected 2");
-
-       rc      = symlink(N1, path);
-       error   = errno;
-       report(rc < 0, "symlink");
-       report(error == ENAMETOOLONG, "ENAMETOOLONG expected 3");
-       close(fd);
-
-       /* O_NOFOLLOW test 1 */
-       fd = creat(N1, 0777);
-       report(fd >= 0, "creat");
-       report(symlink(N1, N2) == 0, "symlink");
-
-       rc = open(N2, O_RDONLY | O_NOFOLLOW);
-       report(rc < 0 && errno == ELOOP, "open(symlink, O_NOFOLLOW) must fail");
-       report(unlink(N2) == 0, "unlink");
-       report(unlink(N1) == 0, "unlink");
-
-       /* O_NOFOLLOW test 2 */
-       report(mkdir(D1, 0777) == 0, "mkdir"); /* create dir /tmp/d1 */
-       snprintf(path, sizeof(path), "%s/%s", D1, N1);
-       fd = creat(path, 0777);  /* create file /tmp/d1/f1 */
-       report(fd >= 0, "creat");
-       close(fd);
-
-       report(symlink(D1, N2) == 0, "symlink to directory");
-       rc = open(N2, O_RDONLY | O_NOFOLLOW);
-       report(rc < 0 && errno == ELOOP, "open(symlink, O_NOFOLLOW) must fail");
-
-       rc = open(path, O_RDONLY | O_NOFOLLOW);
-       report(rc >= 0, "open");
-       close(rc);
-       report(unlink(path) == 0, "unlink");
-       report(unlink(N2) == 0, "unlink");
-       report(rmdir(D1) == 0, "rmdir");
-
-       /* unlink test */
-       report(mkdir(D1, 0777) == 0, "mkdir"); /* create dir /tmp/d1 */
-       snprintf(path, sizeof(path), "%s/%s", D1, N1);
-       fd = creat(path, 0777);  /* create file /tmp/d1/f1 */
-       report(fd >= 0, "creat");
-       close(fd);
-
-       report(symlink(D1, N2) == 0, "symlink to directory");
-       report(search_dir(D1, N1) == true, "Directory search");
-       report(search_dir(N2, N1) == true, "Symlink search");
-
-       snprintf(path, sizeof(path), "%s/%s", N2, N1);
-       report(unlink(path) == 0, "Unlink file through symlink");
-       report(unlink(N2) == 0, "unlink");
-       report(rmdir(D1) == 0, "rmdir");
-
-       /* rename tests */
-       fd = creat(N1, 0777);
-       close(fd);
-       report(rename(N1, N2) == 0, "rename file");
-       report(unlink(N2) == 0, "unlink file");
-
-       report(mkdir(D1, 0777) == 0, "mkdir");
-       report(rename(D1, D2) == 0, "rename directory");
-       report(rmdir(D2) == 0, "rmdir");
-
-       report(mkdir(D1, 0777) == 0, "mkdir");          /* /tmp/d1 */
-       snprintf(path, sizeof(path), "%s/%s", D1, N1);  /* /tmp/d1/f1 */
-       fd = creat(path, 0777);
-       report(fd >= 0, "create file");
-       close(fd);
-
-       report(symlink(D1, D2) == 0, "symlink to directory"); /* /tmp/d2 -> 
/tmp/d1 */
-       snprintf(path1, sizeof(path1), "%s/%s", D1, N2);
-       report(rename(path, path1) == 0, "rename(f1,f2)");
-
-       snprintf(path, sizeof(path), "%s/%s", D1, N2);
-       snprintf(path1, sizeof(path1), "%s/%s", D2, N3);
-       report(rename(path, path1) == 0, "rename(d1/f2, d2/f3)");
-       report(search_dir(D1, N3) == true, "Directory search");
-       report(search_dir(D2, N3) == true, "Symlink search");
-
-       snprintf(path, sizeof(path), "%s/%s", D2, N3);
-       snprintf(path1, sizeof(path1), "%s/%s", D1, N4);
-       report(rename(path, path1) == 0, "rename(d2/f3, d1/f4)");
-       report(search_dir(D1, N4) == true, "Directory search");
-       report(search_dir(D2, N4) == true, "Symlink search");
-
-       snprintf(path, sizeof(path), "%s/%s", D2, N4);
-       snprintf(path1, sizeof(path1), "%s/%s", D2, N5);
-       report(rename(path, path1) == 0, "rename(d2/f4, d2/f5)");
-       report(search_dir(D1, N5) == true, "Directory search");
-       report(search_dir(D2, N5) == true, "Symlink search");
-
-       report(rename(D2, D3) == 0, "rename(d2, d3)");
-       rc = readlink(D3, path, sizeof(path));
-       report(rc >= 0, "readlink");
-       path[rc] = 0;
-       report(strcmp(path, D1) == 0, "readlink path");
-
-       report(rename(D1, D4) == 0, "rename(d1, d4)");
-       rc = readlink(D3, path, sizeof(path));
-       report(rc >= 0, "readlink");
-       path[rc] = 0;
-       report(strcmp(path, D1) == 0, "readlink path");
-       report(lstat(D3, &buf) == 0, "lstat");
-       report(S_ISLNK(buf.st_mode) == 1, "file mode");
-       rc      = stat(D3, &buf);
-       error   = errno;
-       report(rc < 0, "stat");
-       report(error == ENOENT, "ENOENT expected");
-
-       snprintf(path, sizeof(path), "%s/%s", D4, N5);
-       report(unlink(path) == 0, "unlink(d4/f5)");
-       report(unlink(D3) == 0, "unlink(d3)");
-       report(rmdir(D4) == 0, "rmdir");
-
-       debug("SUMMARY: %d tests, %d failures\n", tests, fails);
-       return (fails == 0 ? 0 : 1);
+    report(ftruncate(fd, 0) == 0, "file fd truncate");
+    report(fstat(fd, &buf) == 0, "fstat file");
+    report(buf.st_size == 0, "file size after truncate");
+
+    close(fd);
+    close(fd1);
+
+    /*
+     * IO Tests 2: write(symlink), read(file)
+     */
+    fd = open(N1, O_RDONLY);
+    report(fd >= 0, "file open");
+
+    fd1 = open(N2, O_WRONLY);
+    report(fd1 >= 0, "symlink open");
+
+    fill_buf(b1, sizeof(b1));
+
+    rc = write(fd1, b1, sizeof(b1));
+    report(rc == sizeof(b1), "file write");
+    fsync(fd1);
+    close(fd1);
+
+    rc = read(fd, b2, sizeof(b2));
+    report(rc == sizeof(b2), "symlink read");
+
+    report(memcmp(b1, b2, sizeof(b1)) == 0, "data verification");
+
+    /* truncate using symlink path */
+    report(truncate(N2, 0) == 0, "symlink truncate");
+    report(fstat(fd, &buf) == 0, "fstat file");
+    report(buf.st_size == 0, "file size after truncate");
+
+    close(fd);
+    report(unlink(N2) == 0, "unlink");
+    report(unlink(N1) == 0, "unlink");
+
+    /*
+     * creating a symlink inside directory must change time
+     */
+    fd = creat(N1, 0777);
+    report(fd >= 0, "creat");
+    report(mkdir(D1, 0777) == 0, "mkdir");
+    report(stat(D1, &buf) == 0, "stat");
+    t1 = buf.st_ctime;
+    sleep(1);
+
+    snprintf(path, sizeof(path), "%s/%s", D1, N2);
+    report(symlink(N1, path) == 0, "symlink");
+    report(stat(D1, &buf) == 0, "stat");
+
+    report(t1 < buf.st_ctime, "ctime");
+    report(t1 < buf.st_mtime, "mtime");
+
+    close(fd);
+    report(unlink(path) == 0, "unlink");
+    report(unlink(N1) == 0, "unlink");
+    report(rmdir(D1) == 0, "rmdir");
+
+    /* ENOTDIR test */
+    rc = symlink(N1, path);
+    error = errno;
+    report(rc < 0, "symlink");
+    report(error == ENOTDIR || error == ENOENT, "ENOTDIR or ENOENT expected");
+
+    /* name too long */
+    fd = creat(N1, 0777);
+    report(fd >= 0, "creat");
+
+    fill_buf(path, 255);
+    report(symlink(N1, path) == 0, "symlink");
+    report(unlink(path) == 0, "unlink");
+
+    fill_buf(path, 257);
+    rc = symlink(N1, path);
+    error = errno;
+    report(rc < 0, "symlink");
+    report(error == ENAMETOOLONG, "ENAMETOOLONG expected 1");
+
+    fill_buf(path, 4097);
+    unlink(N1);
+    rc = symlink(path, N1);
+    error = errno;
+    report(rc < 0, "symlink");
+    report(error == ENAMETOOLONG, "ENAMETOOLONG expected 2");
+
+    rc = symlink(N1, path);
+    error = errno;
+    report(rc < 0, "symlink");
+    report(error == ENAMETOOLONG, "ENAMETOOLONG expected 3");
+    close(fd);
+
+    /* O_NOFOLLOW test 1 */
+    fd = creat(N1, 0777);
+    report(fd >= 0, "creat");
+    report(symlink(N1, N2) == 0, "symlink");
+
+    rc = open(N2, O_RDONLY | O_NOFOLLOW);
+    report(rc < 0 && errno == ELOOP, "open(symlink, O_NOFOLLOW) must fail");
+    report(unlink(N2) == 0, "unlink");
+    report(unlink(N1) == 0, "unlink");
+
+    /* O_NOFOLLOW test 2 */
+    report(mkdir(D1, 0777) == 0, "mkdir"); /* create dir /tmp/d1 */
+    snprintf(path, sizeof(path), "%s/%s", D1, N1);
+    fd = creat(path, 0777);  /* create file /tmp/d1/f1 */
+    report(fd >= 0, "creat");
+    close(fd);
+
+    report(symlink(D1, N2) == 0, "symlink to directory");
+    rc = open(N2, O_RDONLY | O_NOFOLLOW);
+    report(rc < 0 && errno == ELOOP, "open(symlink, O_NOFOLLOW) must fail");
+
+    rc = open(path, O_RDONLY | O_NOFOLLOW);
+    report(rc >= 0, "open");
+    close(rc);
+    report(unlink(path) == 0, "unlink");
+    report(unlink(N2) == 0, "unlink");
+    report(rmdir(D1) == 0, "rmdir");
+
+    /* unlink test */
+    report(mkdir(D1, 0777) == 0, "mkdir"); /* create dir /tmp/d1 */
+    snprintf(path, sizeof(path), "%s/%s", D1, N1);
+    fd = creat(path, 0777);  /* create file /tmp/d1/f1 */
+    report(fd >= 0, "creat");
+    close(fd);
+
+    report(symlink(D1, N2) == 0, "symlink to directory");
+    report(search_dir(D1, N1) == true, "Directory search");
+    report(search_dir(N2, N1) == true, "Symlink search");
+
+    snprintf(path, sizeof(path), "%s/%s", N2, N1);
+    report(unlink(path) == 0, "Unlink file through symlink");
+    report(unlink(N2) == 0, "unlink");
+    report(rmdir(D1) == 0, "rmdir");
+
+    /* rename tests */
+    fd = creat(N1, 0777);
+    close(fd);
+    report(rename(N1, N2) == 0, "rename file");
+    report(unlink(N2) == 0, "unlink file");
+
+    report(mkdir(D1, 0777) == 0, "mkdir");
+    report(rename(D1, D2) == 0, "rename directory");
+    report(rmdir(D2) == 0, "rmdir");
+
+    report(mkdir(D1, 0777) == 0, "mkdir");        /* /tmp/d1 */
+    snprintf(path, sizeof(path), "%s/%s", D1, N1);    /* /tmp/d1/f1 */
+    fd = creat(path, 0777);
+    report(fd >= 0, "create file");
+    close(fd);
+
+    report(symlink(D1, D2) == 0, "symlink to directory"); /* /tmp/d2 -> 
/tmp/d1 */
+    snprintf(path1, sizeof(path1), "%s/%s", D1, N2);
+    report(rename(path, path1) == 0, "rename(f1,f2)");
+
+    snprintf(path, sizeof(path), "%s/%s", D1, N2);
+    snprintf(path1, sizeof(path1), "%s/%s", D2, N3);
+    report(rename(path, path1) == 0, "rename(d1/f2, d2/f3)");
+    report(search_dir(D1, N3) == true, "Directory search");
+    report(search_dir(D2, N3) == true, "Symlink search");
+
+    snprintf(path, sizeof(path), "%s/%s", D2, N3);
+    snprintf(path1, sizeof(path1), "%s/%s", D1, N4);
+    report(rename(path, path1) == 0, "rename(d2/f3, d1/f4)");
+    report(search_dir(D1, N4) == true, "Directory search");
+    report(search_dir(D2, N4) == true, "Symlink search");
+
+    snprintf(path, sizeof(path), "%s/%s", D2, N4);
+    snprintf(path1, sizeof(path1), "%s/%s", D2, N5);
+    report(rename(path, path1) == 0, "rename(d2/f4, d2/f5)");
+    report(search_dir(D1, N5) == true, "Directory search");
+    report(search_dir(D2, N5) == true, "Symlink search");
+
+    report(rename(D2, D3) == 0, "rename(d2, d3)");
+    rc = readlink(D3, path, sizeof(path));
+    report(rc >= 0, "readlink");
+    path[rc] = 0;
+    report(strcmp(path, D1) == 0, "readlink path");
+
+    report(rename(D1, D4) == 0, "rename(d1, d4)");
+    rc = readlink(D3, path, sizeof(path));
+    report(rc >= 0, "readlink");
+    path[rc] = 0;
+    report(strcmp(path, D1) == 0, "readlink path");
+    report(lstat(D3, &buf) == 0, "lstat");
+    report(S_ISLNK(buf.st_mode) == 1, "file mode");
+    rc = stat(D3, &buf);
+    error = errno;
+    report(rc < 0, "stat");
+    report(error == ENOENT, "ENOENT expected");
+
+    snprintf(path, sizeof(path), "%s/%s", D4, N5);
+    report(unlink(path) == 0, "unlink(d4/f5)");
+    report(unlink(D3) == 0, "unlink(d3)");
+    report(rmdir(D4) == 0, "rmdir");
+
+    debug("SUMMARY: %d tests, %d failures\n", tests, fails);
+    return (fails == 0 ? 0 : 1);
 }
diff --git a/tests/tst-syscall.cc b/tests/tst-syscall.cc
index 5e7ed4a..79332ad 100644
--- a/tests/tst-syscall.cc
+++ b/tests/tst-syscall.cc
@@ -48,7 +48,7 @@ int main(int argc, char **argv)
 
     asm ("movq %1, %%rax\n"
          "syscall\n"
-        "movq %%rax, %0\n"
+         "movq %%rax, %0\n"
          : "=m" (tid)
          : "m" (syscall_nr)
          : "rax", "rdi");
diff --git a/tests/tst-zfs-mount.cc b/tests/tst-zfs-mount.cc
index 9a4cf89..d181695 100644
--- a/tests/tst-zfs-mount.cc
+++ b/tests/tst-zfs-mount.cc
@@ -19,13 +19,13 @@
 #include <limits.h>
 #include <osv/mount.h>
 
-#define BUF_SIZE       4096
+#define BUF_SIZE    4096
 
-int     sys_mount(const char *dev, const char *dir, const char *fsname, int 
flags, void *data);
+int sys_mount(const char *dev, const char *dir, const char *fsname, int flags, 
void *data);
 
 static int tests = 0, fails = 0;
 
-static void report(bool ok, const char* msg)
+static void report(bool ok, const char *msg)
 {
     ++tests;
     fails += !ok;
@@ -106,124 +106,123 @@ int check_zfs_refcnt_behavior(void)
 
 int main(int argc, char **argv)
 {
-#define TESTDIR        "/usr"
-//     char rbuf[BUF_SIZE];
-       struct statfs st;
-       DIR *dir;
-       char path[PATH_MAX];
-       struct dirent *d;
-       struct stat s;
-       char foo[PATH_MAX] = { 0 };
-       int fd, ret;
-
-       report(statfs("/usr", &st) == 0, "stat /usr");
-
-       printf("f_type: %ld\n", st.f_type);
-       printf("f_bsize: %ld\n", st.f_bsize);
-       printf("f_blocks: %ld\n", st.f_blocks);
-       printf("f_bfree: %ld\n", st.f_bfree);
-       printf("f_bavail: %ld\n", st.f_bavail);
-       printf("f_files: %ld\n", st.f_files);
-       printf("f_ffree: %ld\n", st.f_ffree);
-       printf("f_namelen: %ld\n", st.f_namelen);
-       printf("f_fsid [0]: %ld\n", st.f_fsid.__val[0]);
-       printf("f_fsid [1]: %ld\n", st.f_fsid.__val[1]);
-
-       report((dir = opendir(TESTDIR)), "open testdir");
-
-       while ((d = readdir(dir))) {
-               if (strcmp(d->d_name, ".") == 0 ||
-                   strcmp(d->d_name, "..") == 0) {
-                       printf("found hidden entry %s\n", d->d_name);
-                       continue;
-               }
-
-               snprintf(path, PATH_MAX, "%s/%s", TESTDIR, d->d_name);
-               report((ret = stat(path, &s)) == 0, "stat file");
-               if (ret < 0) {
-                       printf("failed to stat %s\n", path);
-                       continue;
-               }
-
-               report((ret = (S_ISREG(s.st_mode) || S_ISDIR(s.st_mode))),
-                       "entry must be a regular file");
-               if (!ret) {
-                       printf("ignoring %s, not a regular file\n", path);
-                       continue;
-               }
-
-               printf("found %s\tsize: %ld\n", d->d_name, s.st_size);
-       }
-
-       report(closedir(dir) == 0, "close testdir");
-       report(mkdir("/usr/testdir", 0777) == 0, "mkdir /usr/testdir (0777)");
-       report(stat("/usr/testdir", &s) == 0, "stat /usr/testdir");
-
-       fd = open("/usr/foo", O_CREAT|O_TRUNC|O_WRONLY|O_SYNC, 0666);
-       report(fd > 0, "create /usr/foo");
-
-       report(write(fd, &foo, sizeof(foo)) == sizeof(foo), "write sizeof(foo) 
bytes to fd");
-       report(pwrite(fd, &foo, sizeof(foo), LONG_MAX) == -1 && errno == EFBIG, 
"check for maximum allowed offset");
-       report(fsync(fd) == 0, "fsync fd");
-       report(fstat(fd, &s) == 0, "fstat fd");
-
-       printf("file size = %lld\n", s.st_size);
-
-       report((((dev_t) st.f_fsid.__val[1] << 32) | st.f_fsid.__val[0]) == 
s.st_dev,
-               "st_dev must be equals to f_fsid");
-
-       report(close(fd) == 0, "close fd");
-
-       fd = creat("/usr/foo", 0666);
-       report(fd > 0, "possibly create /usr/foo again");
-
-       report(fstat(fd, &s) == 0, "fstat fd");
-       printf("file size = %lld (after O_TRUNC)\n", s.st_size);
-       report(close(fd) == 0, "close fd again");
-
-       report(rename("/usr/foo", "/usr/foo2") == 0,
-               "rename /usr/foo to /usr/foo2");
-
-       report(rename("/usr/foo2", "/usr/testdir/foo") == 0,
-               "rename /usr/foo2 to /usr/testdir/foo");
-
-       report(unlink("/usr/testdir/foo") == 0, "unlink /usr/testdir/foo");
-
-       report(rename("/usr/testdir", "/usr/testdir2") == 0,
-               "rename /usr/testdir to /usr/testdir2");
-
-       report(rmdir("/usr/testdir2") == 0, "rmdir /usr/testdir2");
+#define TESTDIR    "/usr"
+    struct statfs st;
+    DIR *dir;
+    char path[PATH_MAX];
+    struct dirent *d;
+    struct stat s;
+    char foo[PATH_MAX] = {0};
+    int fd, ret;
+
+    report(statfs("/usr", &st) == 0, "stat /usr");
+
+    printf("f_type: %ld\n", st.f_type);
+    printf("f_bsize: %ld\n", st.f_bsize);
+    printf("f_blocks: %ld\n", st.f_blocks);
+    printf("f_bfree: %ld\n", st.f_bfree);
+    printf("f_bavail: %ld\n", st.f_bavail);
+    printf("f_files: %ld\n", st.f_files);
+    printf("f_ffree: %ld\n", st.f_ffree);
+    printf("f_namelen: %ld\n", st.f_namelen);
+    printf("f_fsid [0]: %ld\n", st.f_fsid.__val[0]);
+    printf("f_fsid [1]: %ld\n", st.f_fsid.__val[1]);
+
+    report((dir = opendir(TESTDIR)), "open testdir");
+
+    while ((d = readdir(dir))) {
+        if (strcmp(d->d_name, ".") == 0 ||
+            strcmp(d->d_name, "..") == 0) {
+            printf("found hidden entry %s\n", d->d_name);
+            continue;
+        }
+
+        snprintf(path, PATH_MAX, "%s/%s", TESTDIR, d->d_name);
+        report((ret = stat(path, &s)) == 0, "stat file");
+        if (ret < 0) {
+            printf("failed to stat %s\n", path);
+            continue;
+        }
+
+        report((ret = (S_ISREG(s.st_mode) || S_ISDIR(s.st_mode))),
+               "entry must be a regular file");
+        if (!ret) {
+            printf("ignoring %s, not a regular file\n", path);
+            continue;
+        }
+
+        printf("found %s\tsize: %ld\n", d->d_name, s.st_size);
+    }
+
+    report(closedir(dir) == 0, "close testdir");
+    report(mkdir("/usr/testdir", 0777) == 0, "mkdir /usr/testdir (0777)");
+    report(stat("/usr/testdir", &s) == 0, "stat /usr/testdir");
+
+    fd = open("/usr/foo", O_CREAT | O_TRUNC | O_WRONLY | O_SYNC, 0666);
+    report(fd > 0, "create /usr/foo");
+
+    report(write(fd, &foo, sizeof(foo)) == sizeof(foo), "write sizeof(foo) 
bytes to fd");
+    report(pwrite(fd, &foo, sizeof(foo), LONG_MAX) == -1 && errno == EFBIG, 
"check for maximum allowed offset");
+    report(fsync(fd) == 0, "fsync fd");
+    report(fstat(fd, &s) == 0, "fstat fd");
+
+    printf("file size = %lld\n", s.st_size);
+
+    report((((dev_t) st.f_fsid.__val[1] << 32) | st.f_fsid.__val[0]) == 
s.st_dev,
+           "st_dev must be equals to f_fsid");
+
+    report(close(fd) == 0, "close fd");
+
+    fd = creat("/usr/foo", 0666);
+    report(fd > 0, "possibly create /usr/foo again");
+
+    report(fstat(fd, &s) == 0, "fstat fd");
+    printf("file size = %lld (after O_TRUNC)\n", s.st_size);
+    report(close(fd) == 0, "close fd again");
+
+    report(rename("/usr/foo", "/usr/foo2") == 0,
+           "rename /usr/foo to /usr/foo2");
+
+    report(rename("/usr/foo2", "/usr/testdir/foo") == 0,
+           "rename /usr/foo2 to /usr/testdir/foo");
+
+    report(unlink("/usr/testdir/foo") == 0, "unlink /usr/testdir/foo");
+
+    report(rename("/usr/testdir", "/usr/testdir2") == 0,
+           "rename /usr/testdir to /usr/testdir2");
+
+    report(rmdir("/usr/testdir2") == 0, "rmdir /usr/testdir2");
 #if 0
 #ifdef __OSV__
-       report(check_zfs_refcnt_behavior() == 0, "check zfs refcount 
consistency");
+    report(check_zfs_refcnt_behavior() == 0, "check zfs refcount consistency");
 #endif
 #endif
 
 #if 0
-       fd = open("/mnt/tests/tst-zfs-simple.c", O_RDONLY);
-       if (fd < 0) {
-               perror("open");
-               return 1;
-       }
-
-       memset(rbuf, 0, BUF_SIZE);
-       ret = pread(fd, rbuf, BUF_SIZE, 0);
-       if (ret < 0) {
-               perror("pread");
-               return 1;
-       }
-       if (ret < BUF_SIZE) {
-               fprintf(stderr, "short read\n");
-               return 1;
-       }
-
-       close(fd);
-
-//     rbuf[BUF_SIZE] = '\0';
-//     printf("%s\n", rbuf);
+    fd = open("/mnt/tests/tst-zfs-simple.c", O_RDONLY);
+    if (fd < 0) {
+        perror("open");
+        return 1;
+    }
+
+    memset(rbuf, 0, BUF_SIZE);
+    ret = pread(fd, rbuf, BUF_SIZE, 0);
+    if (ret < 0) {
+        perror("pread");
+        return 1;
+    }
+    if (ret < BUF_SIZE) {
+        fprintf(stderr, "short read\n");
+        return 1;
+    }
+
+    close(fd);
+
+//  rbuf[BUF_SIZE] = '\0';
+//  printf("%s\n", rbuf);
 #endif
 
-       // Report results.
-       printf("SUMMARY: %d tests, %d failures\n", tests, fails);
-       return 0;
+    // Report results.
+    printf("SUMMARY: %d tests, %d failures\n", tests, fails);
+    return 0;
 }
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to