Skip to content

Commit

Permalink
Fork off macfuse project as fuse4x
Browse files Browse the repository at this point in the history
  • Loading branch information
anatol committed Jun 3, 2011
1 parent 6d5fe85 commit 34a195c
Show file tree
Hide file tree
Showing 28 changed files with 3,545 additions and 39 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*.lo
m4/
fuse.pc
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.guess
config.log
config.status
config.sub
configure
depcomp
include/Makefile
include/Makefile.in
include/config.h
include/config.h.in
include/stamp-h1
install-sh
lib/.libs/
lib/Makefile
lib/Makefile.in
lib/libfuse.la
libtool
ltmain.sh
missing
util/Makefile
util/Makefile.in
2 changes: 0 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
## Process this file with automake to produce Makefile.in

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = @subdirs2@

EXTRA_DIST = \
Expand Down
3 changes: 3 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
autoreconf -f -i -Wall,no-obsolete
# TODO remove "-I../../kext/common"
CFLAGS="-D_POSIX_C_SOURCE=200112L -I../../kext/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=/opt/local/ --disable-dependency-tracking --disable-static
Empty file added config.rpath
Empty file.
10 changes: 6 additions & 4 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fi
case $target_os in
*linux*) arch=linux;;
*bsd*) arch=bsd;;
*darwin*) arch=darwin;;
*) arch=unknown;;
esac

Expand Down Expand Up @@ -47,9 +48,9 @@ fi
if test "$arch" = linux -a "$enable_util" != "no"; then
subdirs2="$subdirs2 util";
fi
if test "$enable_example" != "no"; then
subdirs2="$subdirs2 example";
fi
#if test "$enable_example" != "no"; then
# subdirs2="$subdirs2 example";
#fi
if test "$enable_mtab" = "no"; then
AC_DEFINE(IGNORE_MTAB, 1, [Don't update /etc/mtab])
fi
Expand Down Expand Up @@ -92,6 +93,7 @@ AC_SUBST(subdirs2)

AM_CONDITIONAL(LINUX, test "$arch" = linux)
AM_CONDITIONAL(BSD, test "$arch" = bsd)
AM_CONDITIONAL(DARWIN, test "$arch" = darwin)

AC_CONFIG_FILES([fuse.pc Makefile lib/Makefile util/Makefile example/Makefile include/Makefile])
AC_CONFIG_FILES([fuse.pc Makefile lib/Makefile util/Makefile include/Makefile])
AC_OUTPUT
27 changes: 19 additions & 8 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@

fuseincludedir=$(includedir)/fuse

fuseinclude_HEADERS = \
fuse.h \
fuse_compat.h \
fuse_common.h \
if DARWIN
darwin_headers = fuse_darwin.h
cuse_headers =
ulockmgr_headers =
else
darwin_headers =
cuse_headers = cuse_lowlevel.h
ulockmgr_headers = ulockmgr.h
endif

fuseinclude_HEADERS = \
$(darwin_headers) \
fuse.h \
fuse_compat.h \
fuse_common.h \
fuse_common_compat.h \
fuse_lowlevel.h \
fuse_lowlevel.h \
fuse_lowlevel_compat.h \
fuse_opt.h \
cuse_lowlevel.h
fuse_opt.h \
$(cuse_headers)

include_HEADERS = old/fuse.h ulockmgr.h
include_HEADERS = old/fuse.h $(ulockmgr_headers)

noinst_HEADERS = fuse_kernel.h
76 changes: 75 additions & 1 deletion include/fuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct fuse_operations {
*/
int (*mknod) (const char *, mode_t, dev_t);

/** Create a directory
/** Create a directory
*
* Note that the mode argument may not have the type specification
* bits set, i.e. S_ISDIR(mode) can be false. To obtain the
Expand Down Expand Up @@ -257,10 +257,18 @@ struct fuse_operations {
int (*fsync) (const char *, int, struct fuse_file_info *);

/** Set extended attributes */
#ifdef __APPLE__
int (*setxattr) (const char *, const char *, const char *, size_t, int, uint32_t);
#else
int (*setxattr) (const char *, const char *, const char *, size_t, int);
#endif /* __APPLE__ */

/** Get extended attributes */
#ifdef __APPLE__
int (*getxattr) (const char *, const char *, char *, size_t, uint32_t);
#else
int (*getxattr) (const char *, const char *, char *, size_t);
#endif /* __APPLE__ */

/** List extended attributes */
int (*listxattr) (const char *, char *, size_t);
Expand Down Expand Up @@ -496,6 +504,45 @@ struct fuse_operations {
*/
int (*poll) (const char *, struct fuse_file_info *,
struct fuse_pollhandle *ph, unsigned *reventsp);

#ifdef __APPLE__
int (*reserved00)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved01)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved02)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved03)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved04)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved05)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved06)(void *, void *, void *, void *, void *, void *,
void *, void *);
int (*reserved07)(void *, void *, void *, void *, void *, void *,
void *, void *);

int (*setvolname) (const char *);

int (*exchange) (const char *, const char *, unsigned long);

int (*getxtimes) (const char *, struct timespec *bkuptime,
struct timespec *crtime);

int (*setbkuptime) (const char *, const struct timespec *tv);

int (*setchgtime) (const char *, const struct timespec *tv);

int (*setcrtime) (const char *, const struct timespec *tv);

int (*chflags) (const char *, uint32_t);

int (*setattr_x) (const char *, struct setattr_x *);

int (*fsetattr_x) (const char *, struct setattr_x *,
struct fuse_file_info *);
#endif /* __APPLE__ */
};

/** Extra context that may be needed by some filesystems
Expand Down Expand Up @@ -696,6 +743,15 @@ int fuse_fs_fgetattr(struct fuse_fs *fs, const char *path, struct stat *buf,
struct fuse_file_info *fi);
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
const char *newpath);
#ifdef __APPLE__
int fuse_fs_setvolname(struct fuse_fs *fs, const char *volname);
int fuse_fs_exchange(struct fuse_fs *fs, const char *oldpath,
const char *newpath, unsigned long flags);
int fuse_fs_setattr_x(struct fuse_fs *fs, const char *path,
struct setattr_x *attr);
int fuse_fs_fsetattr_x(struct fuse_fs *fs, const char *path,
struct setattr_x *attr, struct fuse_file_info *fi);
#endif /* __APPLE__ */
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
Expand Down Expand Up @@ -727,6 +783,17 @@ int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode,
struct fuse_file_info *fi);
int fuse_fs_lock(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi, int cmd, struct flock *lock);
#ifdef __APPLE__
int fuse_fs_chflags(struct fuse_fs *fs, const char *path, uint32_t flags);
int fuse_fs_getxtimes(struct fuse_fs *fs, const char *path,
struct timespec *bkuptime, struct timespec *crtime);
int fuse_fs_setbkuptime(struct fuse_fs *fs, const char *path,
const struct timespec *tv);
int fuse_fs_setchgtime(struct fuse_fs *fs, const char *path,
const struct timespec *tv);
int fuse_fs_setcrtime(struct fuse_fs *fs, const char *path,
const struct timespec *tv);
#endif /* __APPLE__ */
int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode);
int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid);
int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size);
Expand All @@ -740,10 +807,17 @@ int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode,
dev_t rdev);
int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode);
#ifdef __APPLE__
int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
const char *value, size_t size, int flags, uint32_t position);
int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
char *value, size_t size, uint32_t position);
#else
int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
const char *value, size_t size, int flags);
int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
char *value, size_t size);
#endif /* __APPLE__ */
int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
size_t size);
int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
Expand Down
59 changes: 58 additions & 1 deletion include/fuse_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,39 @@
extern "C" {
#endif

#ifdef __APPLE__

#include <sys/stat.h>

/* The following bits must be in lockstep with those in fuse_lowlevel.h */

#define SETATTR_WANTS_MODE(attr) ((attr)->valid & (1 << 0))
#define SETATTR_WANTS_UID(attr) ((attr)->valid & (1 << 1))
#define SETATTR_WANTS_GID(attr) ((attr)->valid & (1 << 2))
#define SETATTR_WANTS_SIZE(attr) ((attr)->valid & (1 << 3))
#define SETATTR_WANTS_ACCTIME(attr) ((attr)->valid & (1 << 4))
#define SETATTR_WANTS_MODTIME(attr) ((attr)->valid & (1 << 5))
#define SETATTR_WANTS_CRTIME(attr) ((attr)->valid & (1 << 28))
#define SETATTR_WANTS_CHGTIME(attr) ((attr)->valid & (1 << 29))
#define SETATTR_WANTS_BKUPTIME(attr) ((attr)->valid & (1 << 30))
#define SETATTR_WANTS_FLAGS(attr) ((attr)->valid & (1 << 31))

struct setattr_x {
int32_t valid;
mode_t mode;
uid_t uid;
gid_t gid;
off_t size;
struct timespec acctime;
struct timespec modtime;
struct timespec crtime;
struct timespec chgtime;
struct timespec bkuptime;
uint32_t flags;
};

#endif /* __APPLE__ */

/**
* Information about open files
*
Expand Down Expand Up @@ -69,8 +102,15 @@ struct fuse_file_info {
seekable. Introduced in version 2.8 */
unsigned int nonseekable : 1;

#ifdef __APPLE__
/** Padding. Do not use*/
unsigned int padding : 26;
unsigned int purge_attr : 1;
unsigned int purge_ubc : 1;
#else
/** Padding. Do not use*/
unsigned int padding : 28;
#endif

/** File handle. May be filled in by filesystem in open().
Available in all other file operations */
Expand Down Expand Up @@ -145,6 +185,14 @@ struct fuse_conn_info {
*/
unsigned max_readahead;

#ifdef __APPLE__
struct {
unsigned case_insensitive :1;
unsigned setvolname :1;
unsigned xtimes :1;
} enable;
#endif /* __APPLE__ */

/**
* Capability flags, that the kernel supports
*/
Expand All @@ -158,9 +206,18 @@ struct fuse_conn_info {
/**
* For future use.
*/
#ifdef __APPLE__
unsigned reserved[24];
#else
unsigned reserved[25];
#endif /* __APPLE__ */
};

#ifdef __APPLE__
#define FUSE_ENABLE_SETVOLNAME(i) (i)->enable.setvolname = 1
#define FUSE_ENABLE_XTIMES(i) (i)->enable.xtimes = 1
#endif /* __APPLE__ */

struct fuse_session;
struct fuse_chan;
struct fuse_pollhandle;
Expand Down Expand Up @@ -261,7 +318,7 @@ void fuse_remove_signal_handlers(struct fuse_session *se);
* ----------------------------------------------------------- */

#if FUSE_USE_VERSION < 26
# ifdef __FreeBSD__
# if ( __FreeBSD__ || __APPLE__ )
# if FUSE_USE_VERSION < 25
# error On FreeBSD API version 25 or greater must be used
# endif
Expand Down
4 changes: 2 additions & 2 deletions include/fuse_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct fuse *fuse_setup_compat25(int argc, char *argv[],

void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint);

#ifndef __FreeBSD__
#if (!__FreeBSD__ && !__APPLE__)
#include <sys/statfs.h>

struct fuse_operations_compat22 {
Expand Down Expand Up @@ -198,4 +198,4 @@ struct fuse *fuse_new_compat1(int fd, int flags,
void fuse_main_compat1(int argc, char *argv[],
const struct fuse_operations_compat1 *op);

#endif /* __FreeBSD__ */
#endif /* !__FreeBSD__ && !__APPLE__ */
45 changes: 45 additions & 0 deletions include/fuse_darwin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2006-2008 Google. All Rights Reserved.
* Amit Singh <singh@>
*/

#ifdef __APPLE__

#ifndef _FUSE_DARWIN_H_
#define _FUSE_DARWIN_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <fuse_param.h>
#include <fuse_ioctl.h>
#include <fuse_version.h>


/* Notifications */

#define LIBFUSE_BUNDLE_IDENTIFIER "com.google.filesystems.libfuse"

#define LIBFUSE_UNOTIFICATIONS_OBJECT \
LIBFUSE_BUNDLE_IDENTIFIER ".unotifications"

#define LIBFUSE_UNOTIFICATIONS_NOTIFY_OSISTOONEW \
LIBFUSE_BUNDLE_IDENTIFIER ".osistoonew"

#define LIBFUSE_UNOTIFICATIONS_NOTIFY_OSISTOOOLD \
LIBFUSE_BUNDLE_IDENTIFIER ".osistooold"

#define LIBFUSE_UNOTIFICATIONS_NOTIFY_RUNTIMEVERSIONMISMATCH \
LIBFUSE_BUNDLE_IDENTIFIER ".runtimeversionmismatch"

#define LIBFUSE_UNOTIFICATIONS_NOTIFY_VERSIONMISMATCH \
LIBFUSE_BUNDLE_IDENTIFIER ".versionmismatch"

#ifdef __cplusplus
}
#endif

#endif /* _FUSE_DARWIN_H_ */

#endif /* __APPLE__ */
Loading

0 comments on commit 34a195c

Please sign in to comment.