From 670d72620df47b896ca580a14b54f6e356dc8a67 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 15 Jan 2010 16:18:21 +0000 Subject: [PATCH] fix compilation on OS X (Erik Larsson) --- src/ntfs-3g.c | 31 ++++++++++++++----------------- src/usermap.c | 4 ++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 2877a797..dca9a93d 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -411,12 +411,6 @@ static void set_fuse_error(int *err) } #if defined(__APPLE__) || defined(__DARWIN__) -static void *ntfs_macfuse_init(struct fuse_conn_info *conn) -{ - FUSE_ENABLE_XTIMES(conn); - return NULL; -} - static int ntfs_macfuse_getxtimes(const char *org_path, struct timespec *bkuptime, struct timespec *crtime) { @@ -497,29 +491,34 @@ int ntfs_macfuse_setchgtime(const char *path, const struct timespec *tv) if (ntfs_fuse_is_named_data_stream(path)) return -EINVAL; /* n/a for named data streams. */ - ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) return -errno; if (tv) { - ni->last_mft_change_time = tv->tv_sec; + ni->last_mft_change_time = tv->tv_sec; ntfs_fuse_update_times(ni, 0); } if (ntfs_inode_close(ni)) - set_fuse_error(&res); + set_fuse_error(&res); return res; } -#else /* defined(__APPLE__) || defined(__DARWIN__) */ -#ifdef FUSE_CAP_DONT_MASK +#endif /* defined(__APPLE__) || defined(__DARWIN__) */ + +#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) static void *ntfs_init(struct fuse_conn_info *conn) { +#if defined(__APPLE__) || defined(__DARWIN__) + FUSE_ENABLE_XTIMES(conn); +#endif +#ifdef FUSE_CAP_DONT_MASK /* request umask not to be enforced by fuse */ conn->want |= FUSE_CAP_DONT_MASK; +#endif /* defined FUSE_CAP_DONT_MASK */ return NULL; } -#endif -#endif /* defined(__APPLE__) || defined(__DARWIN__) */ +#endif /* defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) */ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) { @@ -3197,17 +3196,15 @@ static struct fuse_operations ntfs_3g_ops = { .listxattr = ntfs_fuse_listxattr, #endif /* HAVE_SETXATTR */ #if defined(__APPLE__) || defined(__DARWIN__) - .init = ntfs_macfuse_init, /* MacFUSE extensions. */ .getxtimes = ntfs_macfuse_getxtimes, .setcrtime = ntfs_macfuse_setcrtime, .setbkuptime = ntfs_macfuse_setbkuptime, .setchgtime = ntfs_macfuse_setchgtime, -#else /* defined(__APPLE__) || defined(__DARWIN__) */ -#ifdef FUSE_CAP_DONT_MASK +#endif /* defined(__APPLE__) || defined(__DARWIN__) */ +#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) .init = ntfs_init #endif -#endif /* defined(__APPLE__) || defined(__DARWIN__) */ }; static int ntfs_fuse_init(void) diff --git a/src/usermap.c b/src/usermap.c index 847f6510..5026a174 100644 --- a/src/usermap.c +++ b/src/usermap.c @@ -130,7 +130,11 @@ typedef enum { false, true } boolean; #include #include +#if __bool_true_false_are_defined +typedef bool boolean, BOOL; +#else typedef enum { false, true } boolean, BOOL; +#endif typedef unsigned int DWORD; /* must be 32 bits whatever the platform */ typedef DWORD *LPDWORD;