From e5e4ce07aafbe77e237c460efcbf38996dc9224d Mon Sep 17 00:00:00 2001 From: Ian Holsman Date: Mon, 4 Aug 2008 19:53:45 -0700 Subject: [PATCH] darwin changes --- src/client/Client.cc | 1 + src/client/SyntheticClient.cc | 1 + src/common/Clock.cc | 1 + src/ebofs/Allocator.cc | 1 + src/ebofs/BlockDevice.cc | 5 ++++- src/include/buffer.h | 15 +++++++++++++++ src/mds/LogEvent.cc | 1 + src/mds/journal.cc | 1 + src/os/FileJournal.cc | 2 +- src/os/FileStore.cc | 17 +++++++++++++++++ 10 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index d4d64014daa30..08a050e09f585 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -28,6 +28,7 @@ #include using namespace std; +#include "config.h" // ceph stuff #include "Client.h" diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index 0d654700ee254..9afd3cbee8fb5 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -17,6 +17,7 @@ using namespace std; +#include "config.h" #include "SyntheticClient.h" #include "osdc/Objecter.h" #include "osdc/Filer.h" diff --git a/src/common/Clock.cc b/src/common/Clock.cc index 8b07f6d9eb15f..a41fdc1c6859d 100644 --- a/src/common/Clock.cc +++ b/src/common/Clock.cc @@ -13,6 +13,7 @@ */ +#include "config.h" #include "Clock.h" // public diff --git a/src/ebofs/Allocator.cc b/src/ebofs/Allocator.cc index 7e4afea95dccf..641cb916ed845 100644 --- a/src/ebofs/Allocator.cc +++ b/src/ebofs/Allocator.cc @@ -14,6 +14,7 @@ +#include "config.h" #include "Allocator.h" #include "Ebofs.h" diff --git a/src/ebofs/BlockDevice.cc b/src/ebofs/BlockDevice.cc index aee22b2285310..7e6f250a03e54 100644 --- a/src/ebofs/BlockDevice.cc +++ b/src/ebofs/BlockDevice.cc @@ -12,9 +12,9 @@ * */ +#include "config.h" #include "BlockDevice.h" -#include "config.h" #include #include @@ -34,6 +34,9 @@ #ifndef __CYGWIN__ #ifndef DARWIN #include +#else +/* lseek works on 64-bit offsets on OS/X */ +#define lseek64 lseek #endif #endif diff --git a/src/include/buffer.h b/src/include/buffer.h index f8dba1b872f97..591037ce8e4df 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -17,7 +17,22 @@ #define _XOPEN_SOURCE 600 #include +#ifdef DARWIN + +#ifndef MAP_ANON +#define MAP_ANON 0x1000 +#endif +#ifndef O_DIRECTORY +#define O_DIRECTORY 0x100000 +void *valloc(size_t); +#endif + + + +#else + #include +#endif #include #include #include diff --git a/src/mds/LogEvent.cc b/src/mds/LogEvent.cc index 24920369d771a..d1ccb467c1397 100644 --- a/src/mds/LogEvent.cc +++ b/src/mds/LogEvent.cc @@ -12,6 +12,7 @@ * */ +#include "config.h" #include "LogEvent.h" #include "MDS.h" diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 06e7432f6dab5..1d257cdf0fee3 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -12,6 +12,7 @@ * */ +#include "config.h" #include "events/EString.h" #include "events/ESubtreeMap.h" #include "events/ESession.h" diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 225e57b555141..b6cfd1d03382b 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -12,6 +12,7 @@ * */ +#include "config.h" #include "FileJournal.h" #include @@ -20,7 +21,6 @@ #include -#include "config.h" #define dout(x) if (x <= g_conf.debug_journal) *_dout << dbeginl << g_clock.now() << " journal " #define derr(x) if (x <= g_conf.debug_journal) *_derr << dbeginl << g_clock.now() << " journal " diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index dfca55362a0c5..5241479e9d4fc 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -445,6 +445,9 @@ int FileStore::umount() int FileStore::transaction_start(int len) { +#ifdef DARWIN + return 0; +#else if (!btrfs || !btrfs_trans_start_end || !g_conf.filestore_btrfs_trans) return 0; @@ -478,10 +481,14 @@ int FileStore::transaction_start(int len) ::mknod(fn, 0644, 0); return fd; +#endif /* DARWIN */ } void FileStore::transaction_end(int fd) { +#ifdef DARWIN + return; +#else if (!btrfs || !btrfs_trans_start_end || !g_conf.filestore_btrfs_trans) return; @@ -500,10 +507,15 @@ void FileStore::transaction_end(int fd) _handle_signal(sig_pending); } sig_lock.Unlock(); +#endif /* DARWIN */ } unsigned FileStore::apply_transaction(Transaction &t, Context *onsafe) { +#ifdef DARWIN + return ObjectStore::apply_transaction(t, onsafe); +#else + // no btrfs transaction support? // or, use trans start/end ioctls? if (!btrfs || btrfs_trans_start_end) @@ -896,6 +908,7 @@ unsigned FileStore::apply_transaction(Transaction &t, Context *onsafe) delete onsafe; return r; +#endif /* DARWIN */ } @@ -1050,9 +1063,13 @@ int FileStore::clone(coll_t cid, pobject_t oldoid, pobject_t newoid) if (n < 0) return -errno; int r = 0; +#ifndef DARWIN if (btrfs) r = ::ioctl(n, BTRFS_IOC_CLONE, o); else { +#else + { +#endif /* DARWIN */ struct stat st; ::fstat(o, &st); -- 2.39.5