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
This commit is contained in:
sdong 2015-10-23 09:16:46 -07:00
parent 138876a62c
commit 44d4057d78
3 changed files with 58 additions and 38 deletions

View File

@ -7,43 +7,8 @@
// Use of this source code is governed by a BSD-style license that can be // 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. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#pragma once #pragma once
#include <deque>
#include <set>
#include <dirent.h>
#include <pthread.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <signal.h>
#include <algorithm>
#include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
#ifdef OS_LINUX
#include <sys/statfs.h>
#include <sys/syscall.h>
#endif
#if defined(OS_LINUX)
#include <linux/fs.h>
#endif
#include "rocksdb/env.h" #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 // For non linux platform, the following macros are used only as place
// holder. // holder.

View File

@ -6,9 +6,28 @@
// Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // 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. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <dirent.h>
#include "posix/io_posix.h" #include <errno.h>
#include <fcntl.h>
#if defined(OS_LINUX)
#include <linux/fs.h>
#endif
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#ifdef OS_LINUX
#include <sys/statfs.h>
#include <sys/syscall.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <algorithm>
// Get nano time includes // Get nano time includes
#if defined(OS_LINUX) || defined(OS_FREEBSD) #if defined(OS_LINUX) || defined(OS_FREEBSD)
#elif defined(__MACH__) #elif defined(__MACH__)
@ -17,6 +36,19 @@
#else #else
#include <chrono> #include <chrono>
#endif #endif
#include <deque>
#include <set>
#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) #if !defined(TMPFS_MAGIC)
#define TMPFS_MAGIC 0x01021994 #define TMPFS_MAGIC 0x01021994

View File

@ -10,6 +10,29 @@
#ifdef ROCKSDB_LIB_IO_POSIX #ifdef ROCKSDB_LIB_IO_POSIX
#include "posix/io_posix.h" #include "posix/io_posix.h"
#include <errno.h>
#include <fcntl.h>
#if defined(OS_LINUX)
#include <linux/fs.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef OS_LINUX
#include <sys/statfs.h>
#include <sys/syscall.h>
#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 { namespace rocksdb {