From a00170132c28eeea61033d820c22e8d48d35a0fd Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 6 Jun 2008 14:36:42 +0200 Subject: [PATCH] Inline para_fchdir(), move it to fsck.c and rename it. --- fd.c | 14 -------------- fd.h | 1 - fsck.c | 18 ++++++++++++++++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/fd.c b/fd.c index fd6ef7d..17d5665 100644 --- 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 7fdff91..45d08b3 100644 --- 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 574509f..b5e4fdb 100644 --- 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); -- 2.39.2