Inline para_fchdir(), move it to fsck.c and rename it.
authorAndre Noll <maan@systemlinux.org>
Fri, 6 Jun 2008 12:36:42 +0000 (14:36 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 6 Jun 2008 12:36:42 +0000 (14:36 +0200)
fd.c
fd.h
fsck.c

diff --git a/fd.c b/fd.c
index fd6ef7dcbcac876dbf516a97cb9c0d5b25705cd1..17d56651a087bfe32c00d124eeb95d57458263dd 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -182,20 +182,6 @@ close_cwd:
        return ret;
 }
 
-/**
- * A wrapper for fchdir().
- *
- * \param fd An open file descriptor.
- *
- * \return Standard.
- */
-int para_fchdir(int fd)
-{
-       if (fchdir(fd) < 0)
-               return -ERRNO_TO_ERROR(errno);
-       return 1;
-}
-
 /**
  * Open a file and map it into memory.
  *
diff --git a/fd.h b/fd.h
index 7fdff916cec60425719772e55bc44027f1d54f86..45d08b3a3e327c17e2050cbee7382de7fabee75e 100644 (file)
--- a/fd.h
+++ b/fd.h
@@ -8,7 +8,6 @@
 
 int osl_open(const char *path, int flags, mode_t mode);
 int para_opendir(const char *dirname, DIR **dir, int *cwd);
-int para_fchdir(int fd);
 int mmap_full_file(const char *filename, int open_mode, void **map,
        size_t *size, int *fd_ptr);
 int osl_munmap(void *start, size_t length);
diff --git a/fsck.c b/fsck.c
index 574509fcebdda24c52a8a1e45d0f4c94f6c6eef3..b5e4fdbe16e0fc593e303de69de8e521b845ed31 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -208,6 +208,20 @@ static int uint32_compare(const struct osl_object *obj1, const struct osl_object
        return 0;
 }
 
+/**
+ * A wrapper for fchdir().
+ *
+ * \param fd An open file descriptor.
+ *
+ * \return Standard.
+ */
+static inline int __fchdir(int fd)
+{
+       if (fchdir(fd) < 0)
+               return -ERRNO_TO_ERROR(errno);
+       return 1;
+}
+
 /**
  * Traverse the given directory recursively.
  *
@@ -263,7 +277,7 @@ static int for_each_file_in_dir(const char *dirname,
        ret = 1;
 out:
        closedir(dir);
-       ret2 = para_fchdir(cwd_fd);
+       ret2 = __fchdir(cwd_fd);
        if (ret2 < 0 && ret >= 0)
                ret = ret2;
        close(cwd_fd);
@@ -1126,7 +1140,7 @@ static int check_all_tables(char *db_dir)
                        break;
        }
        closedir(dir);
-       ret2 = para_fchdir(cwd_fd);
+       ret2 = __fchdir(cwd_fd);
        if (ret2 < 0 && ret >= 0)
                ret = ret2;
        close(cwd_fd);