+2010-08-27 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Add NetBSD support. Patch from Emmanuel Dreyfus
+
2010-07-12 Miklos Szeredi <miklos@szeredi.hu>
* libfuse: add buffer interface. Add a generic buffer interface
case $target_os in
*linux*) arch=linux;;
+ *netbsd*) arch=netbsd;;
*bsd*) arch=bsd;;
*) arch=unknown;;
esac
AC_SUBST(subdirs2)
AM_CONDITIONAL(LINUX, test "$arch" = linux)
+AM_CONDITIONAL(NETBSD, test "$arch" = netbsd)
AM_CONDITIONAL(BSD, test "$arch" = bsd)
AC_CONFIG_FILES([fuse.pc Makefile lib/Makefile util/Makefile example/Makefile include/Makefile])
void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint);
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
#include <sys/statfs.h>
struct fuse_operations_compat22 {
void fuse_main_compat1(int argc, char *argv[],
const struct fuse_operations_compat1 *op);
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ */
char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf,
off_t off);
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
#include <sys/statfs.h>
const struct fuse_lowlevel_ops_compat *op,
size_t op_size, void *userdata);
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ */
struct fuse_chan_ops_compat24 {
int (*receive)(struct fuse_chan *ch, char *buf, size_t size);
libfuse_la_LDFLAGS = @libfuse_libs@ -version-number 2:8:4 \
-Wl,--version-script,$(srcdir)/fuse_versionscript
+if NETBSD
+libfuse_la_LIBADD = -lperfuse -lpuffs
+endif
+
libulockmgr_la_SOURCES = ulockmgr.c
libulockmgr_la_LDFLAGS = -pthread -version-number 1:0:1
fuse_do_prepare_interrupt(req, d);
}
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
static int fuse_compat_open(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi)
return err;
}
-#else /* __FreeBSD__ */
+#else /* __FreeBSD__ || __NetBSD__ */
static inline int fuse_compat_open(struct fuse_fs *fs, char *path,
struct fuse_file_info *fi)
return fs->op.statfs(fs->compat == 25 ? "/" : path, buf);
}
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ */
int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf)
{
if (!f->conf.ac_attr_timeout_set)
f->conf.ac_attr_timeout = f->conf.attr_timeout;
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
/*
* In FreeBSD, we always use these settings as inode numbers
* are needed to make getcwd(3) work.
fuse_modules = mod;
}
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
static struct fuse *fuse_new_common_compat(int fd, const char *opts,
const struct fuse_operations *op,
FUSE_SYMVER(".symver fuse_new_compat2,fuse_new@");
FUSE_SYMVER(".symver fuse_new_compat22,fuse_new@FUSE_2.2");
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ */
struct fuse *fuse_new_compat25(int fd, struct fuse_args *args,
const struct fuse_operations_compat25 *op,
{
return fuse_req_ctx(req);
}
+#ifndef __NetBSD__
FUSE_SYMVER(".symver fuse_req_ctx_compat24,fuse_req_ctx@FUSE_2.4");
+#endif
void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func,
}
#endif
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
static void fill_open_compat(struct fuse_open_out *arg,
const struct fuse_file_info_compat *f)
FUSE_SYMVER(".symver fuse_reply_open_compat,fuse_reply_open@FUSE_2.4");
FUSE_SYMVER(".symver fuse_lowlevel_new_compat,fuse_lowlevel_new@FUSE_2.4");
-#else /* __FreeBSD__ */
+#else /* __FreeBSD__ || __NetBSD__ */
int fuse_sync_compat_args(struct fuse_args *args)
{
return 0;
}
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ */
struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args,
const struct fuse_lowlevel_ops_compat25 *op,
#include "fuse_compat.h"
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__)
struct fuse *fuse_setup_compat22(int argc, char *argv[],
const struct fuse_operations_compat22 *op,
FUSE_SYMVER(".symver fuse_main_compat2,fuse_main@");
FUSE_SYMVER(".symver fuse_main_real_compat22,fuse_main_real@FUSE_2.2");
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __NetBSD__ */
struct fuse *fuse_setup_compat25(int argc, char *argv[],
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
+#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/poll.h>
#include <sys/wait.h>
#include <sys/mount.h>
+#ifdef __NetBSD__
+#include <perfuse.h>
+
+#define MS_RDONLY MNT_RDONLY
+#define MS_NOSUID MNT_NOSUID
+#define MS_NODEV MNT_NODEV
+#define MS_NOEXEC MNT_NOEXEC
+#define MS_SYNCHRONOUS MNT_SYNCHRONOUS
+#define MS_NOATIME MNT_NOATIME
+
+#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
+#endif
+
#define FUSERMOUNT_PROG "fusermount"
#define FUSE_COMMFD_ENV "_FUSE_COMMFD"
{"sync", MS_SYNCHRONOUS, 1},
{"atime", MS_NOATIME, 0},
{"noatime", MS_NOATIME, 1},
+#ifndef __NetBSD__
{"dirsync", MS_DIRSYNC, 1},
+#endif
{NULL, 0, 0}
};
goto out_close;
}
+#ifndef __NetBSD__
if (geteuid() == 0) {
char *newmnt = fuse_mnt_resolve_path("fuse", mnt);
res = -1;
if (res == -1)
goto out_umount;
}
+#endif /* __NetBSD__ */
free(type);
free(source);
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <signal.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#ifndef __NetBSD__
#include <mntent.h>
+#endif
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mount.h>
#include <sys/param.h>
+#ifdef __NetBSD__
+#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
+#define mtab_needs_update(mnt) 0
+#else
static int mtab_needs_update(const char *mnt)
{
int res;
return 1;
}
+#endif /* __NetBSD__ */
static int add_mount_legacy(const char *progname, const char *fsname,
const char *mnt, const char *type, const char *opts)