1 #ifndef __dcapCommon_h__
2 #define __dcapCommon_h__
4 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
5 #define dcapStat stat64
21 template <
typename T,
typename ... Args>
inline void good0(T call,
const Args& ... args) {
22 if (__builtin_expect(call, 0)) {
23 std::ostringstream msg;
24 conCatString(msg,
"dcap error ", dc_errno,
" (", dc_strerror(dc_errno),
") ", args...);
25 throw std::runtime_error(msg.str());
28 template <
typename T,
typename t,
typename ... Args>
inline T
badval(T call, t badvalue,
const Args& ... args) {
29 if (__builtin_expect(call == badvalue,
false)) {
30 std::ostringstream msg;
31 conCatString(msg,
"dcap error ", dc_errno,
" (", dc_strerror(dc_errno),
") ", args...);
32 throw std::runtime_error(msg.str());
40 class dCapLock:
public std::unique_lock<std::mutex> {
49 dCapLock(
const char *aFunc = __builtin_FUNCTION(),
50 int aLine = __builtin_LINE(),
51 const char *aFile = __builtin_FILE()): std::unique_lock<std::mutex>(
extraOptionMutex) {
57 dc_resetExtraOption();
68 static std::string
fixPathUrl(
const std::string& path);
69 bool pathExists(
const std::string& path)
override;
70 std::unique_ptr<const genericStat>
getStat(
const std::string& path,
71 bool followLink)
override;
80 std::unique_ptr<const genericStat>
getStat()
override;