From f6fa4a28d1ef3ff8f1ed84b64fc10d083a4b336c Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Fri, 31 Jul 2015 10:01:01 +0800 Subject: [PATCH] compat: move definitions in porting.h into include/compat.h Signed-off-by: Yan, Zheng --- src/Makefile.am | 3 +-- src/include/Makefile.am | 1 + src/include/compat.h | 15 ++++++++++++++ src/{porting.h => include/sock_compat.h} | 25 ++++-------------------- src/librbd/AsyncRequest.h | 2 +- src/msg/async/AsyncConnection.cc | 2 +- src/msg/simple/Pipe.cc | 2 +- src/rbd_fuse/rbd-fuse.cc | 6 +----- src/tools/ceph_objectstore_tool.cc | 1 - 9 files changed, 25 insertions(+), 32 deletions(-) rename src/{porting.h => include/sock_compat.h} (50%) diff --git a/src/Makefile.am b/src/Makefile.am index 5cf555707f3a..502f83a014fc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -211,8 +211,7 @@ noinst_HEADERS += \ bash_completion/radosgw-admin \ mount/canonicalize.c \ mount/mtab.c \ - objclass/objclass.h \ - porting.h + objclass/objclass.h # coverage diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 6369312d8e6f..a364b295d6c2 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -61,6 +61,7 @@ noinst_HEADERS += \ include/cmp.h \ include/color.h \ include/compat.h \ + include/sock_compat.h \ include/crc32c.h \ include/encoding.h \ include/err.h \ diff --git a/src/include/compat.h b/src/include/compat.h index caabe10df0e3..9cb4f61b5327 100644 --- a/src/include/compat.h +++ b/src/include/compat.h @@ -17,6 +17,21 @@ #define MSG_MORE 0 #endif /* !__FreeBSD__ */ +#if defined(__APPLE__) +/* PATH_MAX */ +#include + +/* O_LARGEFILE is not defined/required on OS X */ +#ifndef O_LARGEFILE +#define O_LARGEFILE 0 +#endif + +/* Could be relevant for other platforms */ +#ifndef ERESTART +#define ERESTART EINTR +#endif +#endif /* __APPLE__ */ + #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(expression) ({ \ typeof(expression) __result; \ diff --git a/src/porting.h b/src/include/sock_compat.h similarity index 50% rename from src/porting.h rename to src/include/sock_compat.h index 1528ffb0f020..5faacc343edc 100644 --- a/src/porting.h +++ b/src/include/sock_compat.h @@ -1,23 +1,7 @@ +#ifndef CEPH_SOCK_COMPAT_H +#define CEPH_SOCK_COMPAT_H -#ifndef PORTING_H -#define PORTING_H -#include "acconfig.h" - -/* TODO: move these into include/compat.h */ - -#if defined(DARWIN) -#include - -/* O_LARGEFILE is not defined/required on OS X */ -#define O_LARGEFILE 0 - -/* Wonder why this is missing */ -#define PATH_MAX 1024 - -/* Could be relevant for other platforms */ -#ifndef ERESTART -#define ERESTART EINTR -#endif +#include "include/compat.h" /* * This optimization may not be available on all platforms (e.g. OSX). @@ -39,5 +23,4 @@ # endif #endif -#endif /* DARWIN */ -#endif /* PORTING_H */ +#endif diff --git a/src/librbd/AsyncRequest.h b/src/librbd/AsyncRequest.h index b6594bf8898e..c0a60131106b 100644 --- a/src/librbd/AsyncRequest.h +++ b/src/librbd/AsyncRequest.h @@ -9,7 +9,7 @@ #include "include/xlist.h" /* DARWIN Missing ERESTART */ -#include "porting.h" +#include "include/compat.h" namespace librbd { diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index a8a47e568dca..97bb17ab20de 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -23,7 +23,7 @@ #include "AsyncMessenger.h" #include "AsyncConnection.h" -#include "porting.h" +#include "include/sock_compat.h" // Constant to limit starting sequence number to 2^31. Nothing special about it, just a big number. PLR #define SEQ_MASK 0x7fffffff diff --git a/src/msg/simple/Pipe.cc b/src/msg/simple/Pipe.cc index 42995840d45a..2292af9a54dd 100644 --- a/src/msg/simple/Pipe.cc +++ b/src/msg/simple/Pipe.cc @@ -32,7 +32,7 @@ #include "auth/cephx/CephxProtocol.h" #include "auth/AuthSessionHandler.h" -#include "porting.h" +#include "include/sock_compat.h" // Constant to limit starting sequence number to 2^31. Nothing special about it, just a big number. PLR #define SEQ_MASK 0x7fffffff diff --git a/src/rbd_fuse/rbd-fuse.cc b/src/rbd_fuse/rbd-fuse.cc index f7ac46c76778..5cc89002c4f9 100644 --- a/src/rbd_fuse/rbd-fuse.cc +++ b/src/rbd_fuse/rbd-fuse.cc @@ -11,12 +11,7 @@ #include #include #include -#if defined(DARWIN) #include -#include "porting.h" -#else -#include -#endif #include #include #include @@ -24,6 +19,7 @@ #include #include +#include "include/compat.h" #include "include/rbd/librbd.h" static int gotrados = 0; diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index dd29779fd7b8..a2dbccbc5fc2 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -36,7 +36,6 @@ #include "json_spirit/json_spirit_reader.h" #include "ceph_objectstore_tool.h" -#include "porting.h" namespace po = boost::program_options; using namespace std; -- 2.47.3