From 44d4057d785a92ea94c03746535ad3a4fb824a0f Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 23 Oct 2015 09:16:46 -0700 Subject: [PATCH] Avoid some includes in io_posix.h Summary: IO Posix depends on too many .h files. Move most of them to .cc files. Test Plan: make all Reviewers: anthony, rven, IslamAbdelRahman, yhchiang, kradhakrishnan, igor Reviewed By: igor Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D49479 --- include/posix/io_posix.h | 35 ----------------------------------- util/env_posix.cc | 38 +++++++++++++++++++++++++++++++++++--- util/io_posix.cc | 23 +++++++++++++++++++++++ 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/include/posix/io_posix.h b/include/posix/io_posix.h index 65645b0ff..6e35e8939 100644 --- a/include/posix/io_posix.h +++ b/include/posix/io_posix.h @@ -7,43 +7,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#ifdef OS_LINUX -#include -#include -#endif -#if defined(OS_LINUX) -#include -#endif #include "rocksdb/env.h" -#include "util/sync_point.h" -#include "util/iostats_context_imp.h" -#include "util/coding.h" -#include "rocksdb/slice.h" -#include "port/port.h" -#include "util/logging.h" -#include "util/posix_logger.h" -#include "util/random.h" -#include "util/string_util.h" -#include "util/thread_status_updater.h" -#include "util/thread_status_util.h" // For non linux platform, the following macros are used only as place // holder. diff --git a/util/env_posix.cc b/util/env_posix.cc index 1e04ac63e..a434b8216 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -6,9 +6,28 @@ // Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. - -#include "posix/io_posix.h" - +#include +#include +#include +#if defined(OS_LINUX) +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef OS_LINUX +#include +#include +#endif +#include +#include +#include +#include // Get nano time includes #if defined(OS_LINUX) || defined(OS_FREEBSD) #elif defined(__MACH__) @@ -17,6 +36,19 @@ #else #include #endif +#include +#include +#include "port/port.h" +#include "posix/io_posix.h" +#include "rocksdb/slice.h" +#include "util/coding.h" +#include "util/iostats_context_imp.h" +#include "util/logging.h" +#include "util/posix_logger.h" +#include "util/string_util.h" +#include "util/sync_point.h" +#include "util/thread_status_updater.h" +#include "util/thread_status_util.h" #if !defined(TMPFS_MAGIC) #define TMPFS_MAGIC 0x01021994 diff --git a/util/io_posix.cc b/util/io_posix.cc index 4c33fee85..a8144324a 100644 --- a/util/io_posix.cc +++ b/util/io_posix.cc @@ -10,6 +10,29 @@ #ifdef ROCKSDB_LIB_IO_POSIX #include "posix/io_posix.h" +#include +#include +#if defined(OS_LINUX) +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#ifdef OS_LINUX +#include +#include +#endif +#include "port/port.h" +#include "rocksdb/slice.h" +#include "util/coding.h" +#include "util/iostats_context_imp.h" +#include "util/posix_logger.h" +#include "util/string_util.h" +#include "util/sync_point.h" namespace rocksdb {