diff --git a/.gitignore b/.gitignore index 9f1b0ab..d2be2f2 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,13 @@ config.* /osxfuse.pc /.pc /patches + +*.mode1 +*.mode1v3 +*.mode2v3 +*.perspective +*.perspectivev3 +*.pbxuser +project.xcworkspace/ +xcuserdata/ +build/ diff --git a/darwin_configure.sh b/darwin_configure.sh index 4226d55..758144c 100755 --- a/darwin_configure.sh +++ b/darwin_configure.sh @@ -4,4 +4,4 @@ OSXFUSE_SRCROOT=${OSXFUSE_SRCROOT:-$1} OSXFUSE_SRCROOT=${OSXFUSE_SRCROOT:?} ./makeconf.sh && \ -CFLAGS="-D__DARWIN_64_BIT_INO_T=0 -D__FreeBSD__=10 -D_POSIX_C_SOURCE=200112L -I$OSXFUSE_SRCROOT/common -O -gdwarf-2 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -arch x86_64 -framework CoreFoundation" ./configure --prefix=/usr/local --disable-dependency-tracking --disable-static +CFLAGS="-D__DARWIN_64_BIT_INO_T=0 -D__FreeBSD__=10 -DMACFUSE_MODE -D_POSIX_C_SOURCE=200112L -I$OSXFUSE_SRCROOT/common -O -gdwarf-2 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5" LDFLAGS="-arch i386 -arch x86_64 -framework CoreFoundation" ./configure --prefix=/usr/local --disable-dependency-tracking --disable-static diff --git a/darwin_configure_ino64.sh b/darwin_configure_ino64.sh index 20c12dc..4a09ca1 100755 --- a/darwin_configure_ino64.sh +++ b/darwin_configure_ino64.sh @@ -4,4 +4,4 @@ OSXFUSE_SRCROOT=${OSXFUSE_SRCROOT:-$1} OSXFUSE_SRCROOT=${OSXFUSE_SRCROOT:?} ./makeconf.sh && \ -CFLAGS="-D__DARWIN_64_BIT_INO_T=1 -D__FreeBSD__=10 -D_POSIX_C_SOURCE=200112L -I$OSXFUSE_SRCROOT/common -O -gdwarf-2 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" LDFLAGS="-arch i386 -arch x86_64 -framework CoreFoundation" ./configure --prefix=/usr/local --disable-dependency-tracking --disable-static +CFLAGS="-D__DARWIN_64_BIT_INO_T=1 -D__FreeBSD__=10 -DMACFUSE_MODE -D_POSIX_C_SOURCE=200112L -I$OSXFUSE_SRCROOT/common -O -gdwarf-2 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" LDFLAGS="-arch i386 -arch x86_64 -framework CoreFoundation" ./configure --prefix=/usr/local --disable-dependency-tracking --disable-static diff --git a/include/fuse_darwin.h b/include/fuse_darwin.h index 96c6e67..89dd84c 100644 --- a/include/fuse_darwin.h +++ b/include/fuse_darwin.h @@ -63,25 +63,6 @@ typedef fuse_sem_t sem_t; #endif /* DARWIN_SEMAPHORE_COMPAT */ -/* Notifications */ - -#define LIBOSXFUSE_BUNDLE_IDENTIFIER "com.github.osxfuse.libosxfuse" - -#define LIBOSXFUSE_UNOTIFICATIONS_OBJECT \ - LIBOSXFUSE_BUNDLE_IDENTIFIER ".unotifications" - -#define LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_OSISTOONEW \ - LIBOSXFUSE_BUNDLE_IDENTIFIER ".osistoonew" - -#define LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_OSISTOOOLD \ - LIBOSXFUSE_BUNDLE_IDENTIFIER ".osistooold" - -#define LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_RUNTIMEVERSIONMISMATCH \ - LIBOSXFUSE_BUNDLE_IDENTIFIER ".runtimeversionmismatch" - -#define LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_VERSIONMISMATCH \ - LIBOSXFUSE_BUNDLE_IDENTIFIER ".versionmismatch" - /* Versioning */ const char *osxfuse_version(void); long fuse_os_version_major_np(void); diff --git a/include/fuse_darwin_private.h b/include/fuse_darwin_private.h index 15fdc20..1903c2f 100644 --- a/include/fuse_darwin_private.h +++ b/include/fuse_darwin_private.h @@ -20,6 +20,7 @@ extern "C" { #include #include #include +#include #ifdef __cplusplus } @@ -43,6 +44,11 @@ void fuse_set_fuse_internal_np(int fd, struct fuse *f); void fuse_unset_fuse_internal_np(struct fuse *f); +#ifdef MACFUSE_MODE +void osxfuse_enable_macfuse_mode(bool arg); +bool osxfuse_is_macfuse_mode_enabled(); +#endif + /* * The mount_hash maps char* mountpoint -> struct mount_info. It is protected * by the mount_lock mutex, which is held across a mount operation. diff --git a/lib/fuse_darwin.c b/lib/fuse_darwin.c index ddab072..d4a17ab 100644 --- a/lib/fuse_darwin.c +++ b/lib/fuse_darwin.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "fuse_darwin_private.h" @@ -322,19 +323,11 @@ fuse_unset_fuse_internal_np(struct fuse *f) pthread_mutex_unlock(&mount_lock); } -#ifdef MACFUSE -const char * -macfuse_version(void) -{ - return OSXFUSE_VERSION; -} -#else /* !MACFUSE */ const char * osxfuse_version(void) { return OSXFUSE_VERSION; } -#endif /* !MACFUSE */ int fuse_device_fd_np(const char *mountpoint) @@ -423,6 +416,18 @@ fuse_knote_np(const char *mountpoint, const char *path, uint32_t note) /********************/ +#ifdef MACFUSE_MODE +static bool osxfuse_macfuse_mode = false; + +void osxfuse_enable_macfuse_mode(bool arg) { + osxfuse_macfuse_mode = arg; +} + +bool osxfuse_is_macfuse_mode_enabled() { + return osxfuse_macfuse_mode; +} +#endif + pthread_mutex_t mount_lock; hash_table *mount_hash; int mount_count; diff --git a/lib/mount_darwin.c b/lib/mount_darwin.c index 601f769..6326684 100644 --- a/lib/mount_darwin.c +++ b/lib/mount_darwin.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -116,70 +117,110 @@ loadkmod(void) return result; } -static int -post_notification(char *name, - char *udata_keys[], - char *udata_values[], - CFIndex nf_num) -{ - CFIndex i; - CFStringRef nf_name = NULL; - CFStringRef nf_object = NULL; - CFMutableDictionaryRef nf_udata = NULL; +/* OSXFUSE notifications */ - CFNotificationCenterRef distributedCenter; - CFStringEncoding encoding = kCFStringEncodingUTF8; +enum osxfuse_notification { + NOTIFICATION_OS_IS_TOO_NEW, + NOTIFICATION_OS_IS_TOO_OLD, + NOTIFICATION_RUNTIME_VERSION_MISMATCH, + NOTIFICATION_VERSION_MISMATCH +}; - distributedCenter = CFNotificationCenterGetDistributedCenter(); +typedef enum osxfuse_notification osxfuse_notification_t; - if (!distributedCenter) { - return -1; - } +const char * const osxfuse_notification_names[] = { + "kOSXFUSEOSIsTooNew", // NOTIFICATION_OS_IS_TOO_NEW + "kOSXFUSEOSIsTooOld", // NOTIFICATION_OS_IS_TOO_OLD + "kOSXFUSERuntimeVersionMismatch", // NOTIFICATION_RUNTIME_VERSION_MISMATCH + "kOSXFUSEVersionMismatch" // NOTIFICATION_VERSION_MISMATCH +}; - nf_name = CFStringCreateWithCString(kCFAllocatorDefault, name, encoding); - - nf_object = CFStringCreateWithCString(kCFAllocatorDefault, - LIBOSXFUSE_UNOTIFICATIONS_OBJECT, - encoding); - - nf_udata = CFDictionaryCreateMutable(kCFAllocatorDefault, - nf_num, - &kCFCopyStringDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); +const char * const osxfuse_notification_object = OSXFUSE_IDENTIFIER; - if (!nf_name || !nf_object || !nf_udata) { - goto out; - } +#ifdef MACFUSE_MODE +#define OSXFUSE_MACFUSE_MODE_ENV "OSXFUSE_MACFUSE_MODE" - for (i = 0; i < nf_num; i++) { - CFStringRef a_key = CFStringCreateWithCString(kCFAllocatorDefault, - udata_keys[i], - kCFStringEncodingUTF8); - CFStringRef a_value = CFStringCreateWithCString(kCFAllocatorDefault, - udata_values[i], - kCFStringEncodingUTF8); - CFDictionarySetValue(nf_udata, a_key, a_value); - CFRelease(a_key); - CFRelease(a_value); - } - - CFNotificationCenterPostNotification(distributedCenter, - nf_name, nf_object, nf_udata, false); +#define MACFUSE_NOTIFICATION_PREFIX "com.google.filesystems.libfuse" +#define MACFUSE_NOTIFICATION_OBJECT \ +MACFUSE_NOTIFICATION_PREFIX ".unotifications" -out: - if (nf_name) { - CFRelease(nf_name); - } +const char * const macfuse_notification_names[] = { + MACFUSE_NOTIFICATION_PREFIX ".osistoonew", // NOTIFICATION_OS_IS_TOO_NEW + MACFUSE_NOTIFICATION_PREFIX ".osistooold", // NOTIFICATION_OS_IS_TOO_OLD + MACFUSE_NOTIFICATION_PREFIX ".runtimeversionmismatch", // NOTIFICATION_RUNTIME_VERSION_MISMATCH + MACFUSE_NOTIFICATION_PREFIX ".versionmismatch" // NOTIFICATION_VERSION_MISMATCH +}; - if (nf_object) { - CFRelease(nf_object); - } +const char * const macfuse_notification_object = MACFUSE_NOTIFICATION_OBJECT; +#endif /* MACFUSE_MODE */ - if (nf_udata) { - CFRelease(nf_udata); +static void +post_notification(const osxfuse_notification_t notification, + const char *dict[][2], + const int dict_count) +{ + CFNotificationCenterRef notification_center = + CFNotificationCenterGetDistributedCenter(); + + CFStringRef name = NULL; + CFStringRef object = NULL; + CFMutableDictionaryRef user_info = NULL; + +#ifdef MACFUSE_MODE + if (osxfuse_is_macfuse_mode_enabled()) { + name = CFStringCreateWithCString(kCFAllocatorDefault, + macfuse_notification_names[notification], + kCFStringEncodingUTF8); + object = CFStringCreateWithCString(kCFAllocatorDefault, + macfuse_notification_object, + kCFStringEncodingUTF8); + } else { +#endif + name = CFStringCreateWithCString(kCFAllocatorDefault, + osxfuse_notification_names[notification], + kCFStringEncodingUTF8); + object = CFStringCreateWithCString(kCFAllocatorDefault, + osxfuse_notification_object, + kCFStringEncodingUTF8); +#ifdef MACFUSE_MODE + } +#endif + + if (!name || !object) goto out; + if (dict_count == 0) goto post; + + user_info = CFDictionaryCreateMutable(kCFAllocatorDefault, dict_count, + &kCFCopyStringDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + CFStringRef key; + CFStringRef value; + int i; + for (i = 0; i < dict_count; i++) { + key = CFStringCreateWithCString(kCFAllocatorDefault, dict[i][0], + kCFStringEncodingUTF8); + value = CFStringCreateWithCString(kCFAllocatorDefault, dict[i][1], + kCFStringEncodingUTF8); + + if (!key || !value) { + if (key) CFRelease(key); + if (value) CFRelease(value); + goto out; + } + + CFDictionarySetValue(user_info, key, value); + CFRelease(key); key = NULL; + CFRelease(value); value = NULL; } - - return 0; + +post: + CFNotificationCenterPostNotification(notification_center, name, object, + user_info, false); + +out: + if (name) CFRelease(name); + if (object) CFRelease(object); + if (user_info) CFRelease(user_info); } enum { @@ -502,8 +543,7 @@ fuse_mount_core(const char *mountpoint, const char *opts) CFSTR("OK") ); } - post_notification( - LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_OSISTOOOLD, NULL, NULL, 0); + post_notification(NOTIFICATION_OS_IS_TOO_OLD, NULL, 0); } else if (result == EBUSY) { if (!quiet_mode) { CFUserNotificationDisplayNotice( @@ -517,8 +557,8 @@ fuse_mount_core(const char *mountpoint, const char *opts) CFSTR("OK") ); } - post_notification(LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_VERSIONMISMATCH, - NULL, NULL, 0); + post_notification(NOTIFICATION_VERSION_MISMATCH, + NULL, 0); } fprintf(stderr, "the OSXFUSE file system is not available (%d)\n", result); @@ -557,8 +597,8 @@ fuse_mount_core(const char *mountpoint, const char *opts) CFSTR("OK") ); } - post_notification(LIBOSXFUSE_UNOTIFICATIONS_NOTIFY_RUNTIMEVERSIONMISMATCH, - NULL, NULL, 0); + post_notification(NOTIFICATION_RUNTIME_VERSION_MISMATCH, + NULL, 0); fprintf(stderr, "this OSXFUSE library version is incompatible with " "the OSXFUSE kernel extension\n"); @@ -684,6 +724,12 @@ fuse_kern_mount(const char *mountpoint, struct fuse_args *args) /* to notify mount_fusefs it's called from lib */ setenv("MOUNT_FUSEFS_CALL_BY_LIB", "1", 1); +#ifdef MACFUSE_MODE + if (osxfuse_is_macfuse_mode_enabled()) { + setenv(OSXFUSE_MACFUSE_MODE_ENV, "1", 1); + } +#endif + if (args && fuse_opt_parse(args, &mo, fuse_mount_opts, fuse_mount_opt_proc) == -1) { return -1; diff --git a/libmacfuse.xcodeproj/project.pbxproj b/libmacfuse.xcodeproj/project.pbxproj new file mode 100644 index 0000000..21ca445 --- /dev/null +++ b/libmacfuse.xcodeproj/project.pbxproj @@ -0,0 +1,420 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + 432B5FA213C36EB50066DFDA /* macfuse */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 432B5FA313C36EB50066DFDA /* Build configuration list for PBXAggregateTarget "macfuse" */; + buildPhases = ( + ); + dependencies = ( + 432B5FA713C36EBD0066DFDA /* PBXTargetDependency */, + 432B5FA913C36EBF0066DFDA /* PBXTargetDependency */, + ); + name = macfuse; + productName = macfuse; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 43A4068A13BCBEF00072E80A /* macfuse.c in Sources */ = {isa = PBXBuildFile; fileRef = 43A4068813BCBEF00072E80A /* macfuse.c */; }; + 43A4069313BCFB5F0072E80A /* macfuse.c in Sources */ = {isa = PBXBuildFile; fileRef = 43A4068813BCBEF00072E80A /* macfuse.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 432B5FA613C36EBD0066DFDA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 43A4067213BCBDAE0072E80A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 43A4069113BCFB5F0072E80A; + remoteInfo = macfuse_i32; + }; + 432B5FA813C36EBF0066DFDA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 43A4067213BCBDAE0072E80A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 43A4067A13BCBDAE0072E80A; + remoteInfo = macfuse_i64; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 43A4067B13BCBDAE0072E80A /* libmacfuse_i64.2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmacfuse_i64.2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 43A4068813BCBEF00072E80A /* macfuse.c */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = macfuse.c; path = libmacfuse/macfuse.c; sourceTree = ""; tabWidth = 4; }; + 43A4068913BCBEF00072E80A /* macfuse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macfuse.h; path = libmacfuse/macfuse.h; sourceTree = ""; }; + 43A4069A13BCFB5F0072E80A /* libmacfuse_i32.2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmacfuse_i32.2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 43A4067813BCBDAE0072E80A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 43A4069413BCFB5F0072E80A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 432B5F6713C2D5700066DFDA /* Source */ = { + isa = PBXGroup; + children = ( + 43A4068813BCBEF00072E80A /* macfuse.c */, + 43A4068913BCBEF00072E80A /* macfuse.h */, + ); + name = Source; + sourceTree = ""; + }; + 43A4067013BCBDAE0072E80A = { + isa = PBXGroup; + children = ( + 432B5F6713C2D5700066DFDA /* Source */, + 43A4067C13BCBDAE0072E80A /* Products */, + ); + sourceTree = ""; + }; + 43A4067C13BCBDAE0072E80A /* Products */ = { + isa = PBXGroup; + children = ( + 43A4067B13BCBDAE0072E80A /* libmacfuse_i64.2.dylib */, + 43A4069A13BCFB5F0072E80A /* libmacfuse_i32.2.dylib */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 43A4067913BCBDAE0072E80A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 43A4069513BCFB5F0072E80A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 43A4067A13BCBDAE0072E80A /* macfuse_i64 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 43A4067F13BCBDAE0072E80A /* Build configuration list for PBXNativeTarget "macfuse_i64" */; + buildPhases = ( + 43A4067713BCBDAE0072E80A /* Sources */, + 43A4067813BCBDAE0072E80A /* Frameworks */, + 43A4067913BCBDAE0072E80A /* Headers */, + 432B5EF413C24ADD0066DFDA /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = macfuse_i64; + productName = libmacfuse; + productReference = 43A4067B13BCBDAE0072E80A /* libmacfuse_i64.2.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 43A4069113BCFB5F0072E80A /* macfuse_i32 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 43A4069713BCFB5F0072E80A /* Build configuration list for PBXNativeTarget "macfuse_i32" */; + buildPhases = ( + 43A4069213BCFB5F0072E80A /* Sources */, + 43A4069413BCFB5F0072E80A /* Frameworks */, + 43A4069513BCFB5F0072E80A /* Headers */, + 432B5EF213C248010066DFDA /* Run Script */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = macfuse_i32; + productName = libmacfuse; + productReference = 43A4069A13BCFB5F0072E80A /* libmacfuse_i32.2.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 43A4067213BCBDAE0072E80A /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 43A4067513BCBDAE0072E80A /* Build configuration list for PBXProject "libmacfuse" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 43A4067013BCBDAE0072E80A; + productRefGroup = 43A4067C13BCBDAE0072E80A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 43A4069113BCFB5F0072E80A /* macfuse_i32 */, + 43A4067A13BCBDAE0072E80A /* macfuse_i64 */, + 432B5FA213C36EB50066DFDA /* macfuse */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + 432B5EF213C248010066DFDA /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "ln -fs \"${EXECUTABLE_PREFIX}${TARGET_NAME}.${DYLIB_CURRENT_VERSION}${EXECUTABLE_SUFFIX}\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PREFIX}${TARGET_NAME}${EXECUTABLE_SUFFIX}\""; + }; + 432B5EF413C24ADD0066DFDA /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "ln -fs \"${EXECUTABLE_PREFIX}${TARGET_NAME}.${DYLIB_CURRENT_VERSION}${EXECUTABLE_SUFFIX}\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PREFIX}${TARGET_NAME}${EXECUTABLE_SUFFIX}\""; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 43A4067713BCBDAE0072E80A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43A4068A13BCBEF00072E80A /* macfuse.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 43A4069213BCFB5F0072E80A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43A4069313BCFB5F0072E80A /* macfuse.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 432B5FA713C36EBD0066DFDA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 43A4069113BCFB5F0072E80A /* macfuse_i32 */; + targetProxy = 432B5FA613C36EBD0066DFDA /* PBXContainerItemProxy */; + }; + 432B5FA913C36EBF0066DFDA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 43A4067A13BCBDAE0072E80A /* macfuse_i64 */; + targetProxy = 432B5FA813C36EBF0066DFDA /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 432B5FA413C36EB50066DFDA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 432B5FA513C36EB50066DFDA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 43A4067D13BCBDAE0072E80A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_COMPATIBILITY_VERSION = 10; + DYLIB_CURRENT_VERSION = 2; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = 4.2; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.5; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = "-D__FreeBSD__=10"; + OTHER_LDFLAGS = ( + "-L/tmp/osxfuse-core-10.5-2.1.7/pkgroot/usr/local/lib", + "-L$(OSXFUSE_BUILD_ROOT)/usr/local/lib", + ); + SDKROOT = macosx10.6; + }; + name = Debug; + }; + 43A4067E13BCBDAE0072E80A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_COMPATIBILITY_VERSION = 10; + DYLIB_CURRENT_VERSION = 2; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = 4.2; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-D__FreeBSD__=10"; + OTHER_LDFLAGS = ( + "-L/tmp/osxfuse-core-10.5-2.1.7/pkgroot/usr/local/lib", + "-L$(OSXFUSE_BUILD_ROOT)/usr/local/lib", + ); + SDKROOT = macosx10.6; + }; + name = Release; + }; + 43A4068013BCBDAE0072E80A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-losxfuse_i64", + "-sub_library", + libosxfuse_i64, + ); + PRODUCT_NAME = "$(TARGET_NAME).$(DYLIB_CURRENT_VERSION)"; + }; + name = Debug; + }; + 43A4068113BCBDAE0072E80A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-losxfuse_i64", + "-sub_library", + libosxfuse_i64, + ); + PRODUCT_NAME = "$(TARGET_NAME).$(DYLIB_CURRENT_VERSION)"; + }; + name = Release; + }; + 43A4069813BCFB5F0072E80A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-losxfuse_i32", + "-sub_library", + libosxfuse_i32, + ); + PRODUCT_NAME = "$(TARGET_NAME).$(DYLIB_CURRENT_VERSION)"; + }; + name = Debug; + }; + 43A4069913BCFB5F0072E80A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = lib; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + OTHER_LDFLAGS = ( + "$(OTHER_LDFLAGS)", + "-losxfuse_i32", + "-sub_library", + libosxfuse_i32, + ); + PRODUCT_NAME = "$(TARGET_NAME).$(DYLIB_CURRENT_VERSION)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 432B5FA313C36EB50066DFDA /* Build configuration list for PBXAggregateTarget "macfuse" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 432B5FA413C36EB50066DFDA /* Debug */, + 432B5FA513C36EB50066DFDA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 43A4067513BCBDAE0072E80A /* Build configuration list for PBXProject "libmacfuse" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 43A4067D13BCBDAE0072E80A /* Debug */, + 43A4067E13BCBDAE0072E80A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 43A4067F13BCBDAE0072E80A /* Build configuration list for PBXNativeTarget "macfuse_i64" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 43A4068013BCBDAE0072E80A /* Debug */, + 43A4068113BCBDAE0072E80A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 43A4069713BCFB5F0072E80A /* Build configuration list for PBXNativeTarget "macfuse_i32" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 43A4069813BCFB5F0072E80A /* Debug */, + 43A4069913BCFB5F0072E80A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 43A4067213BCBDAE0072E80A /* Project object */; +} diff --git a/libmacfuse/macfuse.c b/libmacfuse/macfuse.c new file mode 100644 index 0000000..a4c2633 --- /dev/null +++ b/libmacfuse/macfuse.c @@ -0,0 +1,21 @@ +// +// macfuse.c +// libmacfuse +// +// Created by Benjamin Fleischer on 2011-06-30. +// Copyright 2011 OSXFUSE Project. All rights reserved. +// + +#include + +#include "macfuse.h" + +__attribute__((constructor)) static void lib_constructor(void); + +const char *macfuse_version(void) { + return MACFUSE_VERSION; +} + +static void lib_constructor(void) { + osxfuse_enable_macfuse_mode(true); +} diff --git a/libmacfuse/macfuse.h b/libmacfuse/macfuse.h new file mode 100644 index 0000000..54ee3e8 --- /dev/null +++ b/libmacfuse/macfuse.h @@ -0,0 +1,16 @@ +// +// macfuse.h +// libmacfuse +// +// Created by Benjamin Fleischer on 2011-06-30. +// Copyright 2011 OSXFUSE Project. All rights reserved. +// + +#include + +#define MACFUSE_VERSION "2.1.5" + +const char *macfuse_version(void); + +// Enable or disable the MacFUSE compatibility mode +void osxfuse_enable_macfuse_mode(bool); \ No newline at end of file