You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
476 lines
12 KiB
476 lines
12 KiB
Taken from FreeBSD Ports
|
|
|
|
cat sysutils/fusefs-kmod/files/patch-* > fuse4bsd-0.3.9_pre20080208-ports.patch
|
|
|
|
|
|
--- fuse_module/Makefile.orig 2008-02-05 08:25:57.000000000 +0300
|
|
+++ fuse_module/Makefile 2009-01-14 00:29:13.000000000 +0300
|
|
@@ -1,3 +1,5 @@
|
|
+.undef KERNCONF
|
|
+
|
|
.include "../Makefile.common"
|
|
|
|
SRCS = fuse_main.c \
|
|
@@ -22,7 +24,8 @@
|
|
|
|
.if defined(KERNCONF)
|
|
KERNCONF1!= echo ${KERNCONF} | sed -e 's/ .*//g'
|
|
-KERNCONFDIR= /usr/obj/usr/src/sys/${KERNCONF1}
|
|
+KRNLOBJDIR!= make -C /usr/src -f /usr/src/Makefile.inc1 -V KRNLOBJDIR
|
|
+KERNCONFDIR= ${KRNLOBJDIR}/${KERNCONF1}
|
|
.endif
|
|
|
|
.if defined(KERNCONFDIR)
|
|
--- fuse_module/fuse.h.orig 2008-02-05 00:25:57.000000000 -0500
|
|
+++ fuse_module/fuse.h 2009-05-13 18:40:19.000000000 -0400
|
|
@@ -25,6 +25,22 @@
|
|
#endif
|
|
#endif
|
|
|
|
+#ifndef VFSOPS_TAKES_THREAD
|
|
+#if __FreeBSD_version >= 800087
|
|
+#define VFSOPS_TAKES_THREAD 0
|
|
+#else
|
|
+#define VFSOPS_TAKES_THREAD 1
|
|
+#endif
|
|
+#endif
|
|
+
|
|
+#ifndef VOP_ACCESS_TAKES_ACCMODE_T
|
|
+#if __FreeBSD_version >= 800052
|
|
+#define VOP_ACCESS_TAKES_ACCMODE_T 1
|
|
+#else
|
|
+#define VOP_ACCESS_TAKES_ACCMODE_T 0
|
|
+#endif
|
|
+#endif
|
|
+
|
|
#ifndef VOP_OPEN_TAKES_FP
|
|
#if __FreeBSD_version >= 700044
|
|
#define VOP_OPEN_TAKES_FP 1
|
|
@@ -49,6 +65,14 @@
|
|
#endif
|
|
#endif
|
|
|
|
+#ifndef VOP_GETATTR_TAKES_THREAD
|
|
+#if __FreeBSD_version >= 800046
|
|
+#define VOP_GETATTR_TAKES_THREAD 0
|
|
+#else
|
|
+#define VOP_GETATTR_TAKES_THREAD 1
|
|
+#endif
|
|
+#endif
|
|
+
|
|
#ifndef USE_PRIVILEGE_API
|
|
/*
|
|
* __FreeBSD_version bump was omitted for introduction of
|
|
--- fuse_module/fuse_dev.c
|
|
+++ fuse_module/fuse_dev.c
|
|
@@ -52,8 +52,13 @@
|
|
.d_read = fusedev_read,
|
|
.d_write = fusedev_write,
|
|
.d_version = D_VERSION,
|
|
+#ifndef D_NEEDMINOR
|
|
+#define D_NEEDMINOR 0
|
|
+#endif
|
|
#if ! DO_GIANT_MANUALLY
|
|
- .d_flags = D_NEEDGIANT,
|
|
+ .d_flags = D_NEEDMINOR|D_NEEDGIANT,
|
|
+#else
|
|
+ .d_flags = D_NEEDMINOR,
|
|
#endif
|
|
};
|
|
|
|
@@ -548,7 +553,12 @@
|
|
/* find any existing device, or allocate new unit number */
|
|
i = clone_create(&fuseclones, &fuse_cdevsw, &unit, dev, 0);
|
|
if (i) {
|
|
- *dev = make_dev(&fuse_cdevsw, unit2minor(unit),
|
|
+ *dev = make_dev(&fuse_cdevsw,
|
|
+#if __FreeBSD_version < 800062
|
|
+ unit2minor(unit),
|
|
+#else /* __FreeBSD_version >= 800062 */
|
|
+ unit,
|
|
+#endif /* __FreeBSD_version < 800062 */
|
|
UID_ROOT, GID_OPERATOR,
|
|
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP,
|
|
"fuse%d", unit);
|
|
--- fuse_module/fuse_io.c.orig 2008-02-05 00:25:57.000000000 -0500
|
|
+++ fuse_module/fuse_io.c 2009-07-13 09:31:24.000000000 -0400
|
|
@@ -35,6 +35,10 @@
|
|
#include <vm/vnode_pager.h>
|
|
#include <vm/vm_object.h>
|
|
|
|
+#if (__FreeBSD_version >= 800000)
|
|
+#define vfs_bio_set_validclean vfs_bio_set_valid
|
|
+#endif
|
|
+
|
|
#include "fuse.h"
|
|
#include "fuse_session.h"
|
|
#include "fuse_vnode.h"
|
|
@@ -157,7 +161,11 @@
|
|
goto out;
|
|
|
|
if (uio->uio_rw == UIO_WRITE && fp->f_flag & O_APPEND) {
|
|
- if ((err = VOP_GETATTR(vp, &va, cred, td)))
|
|
+ if ((err = VOP_GETATTR(vp, &va, cred
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
+ , td
|
|
+#endif
|
|
+ )))
|
|
goto out;
|
|
uio->uio_offset = va.va_size;
|
|
} else if ((flags & FOF_OFFSET) == 0)
|
|
@@ -227,7 +235,7 @@
|
|
return (0);
|
|
|
|
biosize = vp->v_mount->mnt_stat.f_iosize;
|
|
- bcount = min(MAXBSIZE, biosize);
|
|
+ bcount = MIN(MAXBSIZE, biosize);
|
|
|
|
DEBUG2G("entering loop\n");
|
|
do {
|
|
@@ -352,7 +360,7 @@
|
|
fri = fdi.indata;
|
|
fri->fh = fufh->fh_id;
|
|
fri->offset = uio->uio_offset;
|
|
- fri->size = min(uio->uio_resid,
|
|
+ fri->size = MIN(uio->uio_resid,
|
|
fusefs_get_data(vp->v_mount)->max_read);
|
|
|
|
DEBUG2G("fri->fh %llu, fri->offset %d, fri->size %d\n",
|
|
@@ -399,7 +407,7 @@
|
|
while (uio->uio_resid > 0) {
|
|
int transfersize;
|
|
|
|
- chunksize = min(iov->iov_len, nmax);
|
|
+ chunksize = MIN(iov->iov_len, nmax);
|
|
|
|
if (uio->uio_rw == UIO_READ) {
|
|
struct fuse_read_in *fri;
|
|
@@ -464,7 +472,7 @@
|
|
{
|
|
int err;
|
|
|
|
- if ((err = uiomove(buf, min(reqsize, bufsize), uio)))
|
|
+ if ((err = uiomove(buf, MIN(reqsize, bufsize), uio)))
|
|
return (err);
|
|
|
|
if (bufsize < reqsize)
|
|
@@ -502,7 +510,7 @@
|
|
}
|
|
|
|
while (uio->uio_resid > 0) {
|
|
- chunksize = min(uio->uio_resid,
|
|
+ chunksize = MIN(uio->uio_resid,
|
|
fusefs_get_data(vp->v_mount)->max_write);
|
|
|
|
fdi.iosize = sizeof(*fwi) + chunksize;
|
|
@@ -569,7 +577,7 @@
|
|
do {
|
|
lbn = uio->uio_offset / biosize;
|
|
on = uio->uio_offset & (biosize-1);
|
|
- n = min((unsigned)(biosize - on), uio->uio_resid);
|
|
+ n = MIN((unsigned)(biosize - on), uio->uio_resid);
|
|
|
|
DEBUG2G("lbn %d, on %d, n %d, uio offset %d, uio resid %d\n",
|
|
(int)lbn, on, n, (int)uio->uio_offset, uio->uio_resid);
|
|
@@ -739,8 +747,8 @@
|
|
*/
|
|
if (n) {
|
|
if (bp->b_dirtyend > 0) {
|
|
- bp->b_dirtyoff = min(on, bp->b_dirtyoff);
|
|
- bp->b_dirtyend = max((on + n), bp->b_dirtyend);
|
|
+ bp->b_dirtyoff = MIN(on, bp->b_dirtyoff);
|
|
+ bp->b_dirtyend = MAX((on + n), bp->b_dirtyend);
|
|
} else {
|
|
bp->b_dirtyoff = on;
|
|
bp->b_dirtyend = on + n;
|
|
@@ -823,7 +831,11 @@
|
|
#if FUSELIB_CONFORM_BIOREAD
|
|
struct vattr va;
|
|
|
|
- if ((err = VOP_GETATTR(vp, &va, cred, curthread)))
|
|
+ if ((err = VOP_GETATTR(vp, &va, cred
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
+ , curthread
|
|
+#endif
|
|
+ )))
|
|
goto out;
|
|
#endif
|
|
|
|
@@ -831,7 +843,7 @@
|
|
bp->b_resid = bp->b_bcount;
|
|
while (bp->b_resid > 0) {
|
|
DEBUG2G("starting bio with resid %ld\n", bp->b_resid);
|
|
- chunksize = min(bp->b_resid,
|
|
+ chunksize = MIN(bp->b_resid,
|
|
fusefs_get_data(vp->v_mount)->max_read);
|
|
fdi.iosize = sizeof(*fri);
|
|
if (! op)
|
|
@@ -842,8 +854,8 @@
|
|
fri->fh = fufh->fh_id;
|
|
fri->offset = ((off_t)bp->b_blkno) * biosize + ioff;
|
|
#if FUSELIB_CONFORM_BIOREAD
|
|
- chunksize = min(chunksize,
|
|
- min(fri->offset + bp->b_resid,
|
|
+ chunksize = MIN(chunksize,
|
|
+ MIN(fri->offset + bp->b_resid,
|
|
va.va_size) - fri->offset);
|
|
if (chunksize == 0) {
|
|
respsize = -1;
|
|
@@ -901,7 +913,7 @@
|
|
|
|
bufdat = bp->b_data + bp->b_dirtyoff;
|
|
while (bp->b_dirtyend > bp->b_dirtyoff) {
|
|
- chunksize = min(bp->b_dirtyend - bp->b_dirtyoff,
|
|
+ chunksize = MIN(bp->b_dirtyend - bp->b_dirtyoff,
|
|
fusefs_get_data(vp->v_mount)->max_write);
|
|
|
|
fdi.iosize = sizeof(*fwi);
|
|
--- fuse_module/fuse_main.c.00 2010-08-15 14:40:29.000000000 +0400
|
|
+++ fuse_module/fuse_main.c 2010-08-15 15:56:56.000000000 +0400
|
|
@@ -108,6 +108,9 @@
|
|
switch (what) {
|
|
case MOD_LOAD: /* kldload */
|
|
|
|
+#if __FreeBSD_version > 800009
|
|
+ fuse_fileops.fo_truncate = vnops.fo_truncate;
|
|
+#endif
|
|
fuse_fileops.fo_ioctl = vnops.fo_ioctl;
|
|
fuse_fileops.fo_poll = vnops.fo_poll;
|
|
fuse_fileops.fo_kqfilter = vnops.fo_kqfilter;
|
|
|
|
|
|
--- fuse_module/fuse_vfsops.c.orig 2008-02-05 00:25:57.000000000 -0500
|
|
+++ fuse_module/fuse_vfsops.c 2009-05-13 18:54:01.000000000 -0400
|
|
@@ -18,6 +18,7 @@
|
|
#include <sys/namei.h>
|
|
#include <sys/mount.h>
|
|
#include <sys/sysctl.h>
|
|
+#include <sys/fcntl.h>
|
|
|
|
#include "fuse.h"
|
|
#include "fuse_session.h"
|
|
@@ -213,8 +214,14 @@
|
|
* Mount system call
|
|
*/
|
|
static int
|
|
+#if VFSOPS_TAKES_THREAD
|
|
fuse_mount(struct mount *mp, struct thread *td)
|
|
{
|
|
+#else
|
|
+fuse_mount(struct mount *mp)
|
|
+{
|
|
+ struct thread *td = curthread;
|
|
+#endif
|
|
int err = 0;
|
|
size_t len;
|
|
char *fspec, *subtype = NULL;
|
|
@@ -529,8 +536,14 @@
|
|
* Unmount system call
|
|
*/
|
|
static int
|
|
+#if VFSOPS_TAKES_THREAD
|
|
fuse_unmount(struct mount *mp, int mntflags, struct thread *td)
|
|
{
|
|
+#else
|
|
+fuse_unmount(struct mount *mp, int mntflags)
|
|
+{
|
|
+ struct thread *td = curthread;
|
|
+#endif
|
|
int flags = 0, err = 0;
|
|
struct fuse_data *data;
|
|
struct fuse_secondary_data *fsdat = NULL;
|
|
@@ -633,8 +646,14 @@
|
|
|
|
/* stolen from portalfs */
|
|
static int
|
|
+#if VFSOPS_TAKES_THREAD
|
|
fuse_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td)
|
|
{
|
|
+#else
|
|
+fuse_root(struct mount *mp, int flags, struct vnode **vpp)
|
|
+{
|
|
+ struct thread *td = curthread;
|
|
+#endif
|
|
/*
|
|
* Return locked reference to root.
|
|
*/
|
|
@@ -650,7 +669,11 @@
|
|
data = fsdat->master;
|
|
sx_slock(&data->mhierlock);
|
|
if (data->mpri == FM_PRIMARY)
|
|
- err = fuse_root(data->mp, flags, vpp, td);
|
|
+ err = fuse_root(data->mp, flags, vpp
|
|
+#if VFSOPS_TAKES_THREAD
|
|
+ , td
|
|
+#endif
|
|
+ );
|
|
else
|
|
err = ENXIO;
|
|
sx_sunlock(&data->mhierlock);
|
|
@@ -667,7 +690,11 @@
|
|
if (vp->v_type == VNON) {
|
|
struct vattr va;
|
|
|
|
- (void)VOP_GETATTR(vp, &va, td->td_ucred, td);
|
|
+ (void)VOP_GETATTR(vp, &va, td->td_ucred
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
+ , td
|
|
+#endif
|
|
+ );
|
|
}
|
|
*vpp = vp;
|
|
#if _DEBUG2G
|
|
@@ -678,8 +705,14 @@
|
|
}
|
|
|
|
static int
|
|
+#if VFSOPS_TAKES_THREAD
|
|
fuse_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
|
|
{
|
|
+#else
|
|
+fuse_statfs(struct mount *mp, struct statfs *sbp)
|
|
+{
|
|
+ struct thread *td = curthread;
|
|
+#endif
|
|
struct fuse_dispatcher fdi;
|
|
struct fuse_statfs_out *fsfo;
|
|
struct fuse_data *data;
|
|
@@ -696,7 +729,11 @@
|
|
|
|
sx_slock(&data->mhierlock);
|
|
if (data->mpri == FM_PRIMARY)
|
|
- err = fuse_statfs(data->mp, sbp, td);
|
|
+ err = fuse_statfs(data->mp, sbp
|
|
+#if VFSOPS_TAKES_THREAD
|
|
+ , td
|
|
+#endif
|
|
+ );
|
|
else
|
|
err = ENXIO;
|
|
sx_sunlock(&data->mhierlock);
|
|
@@ -794,7 +831,11 @@
|
|
if (nodeid == FUSE_ROOT_ID) {
|
|
if (parentid != FUSE_NULL_ID)
|
|
return (ENOENT);
|
|
- err = VFS_ROOT(mp, myflags, vpp, td);
|
|
+ err = VFS_ROOT(mp, myflags, vpp
|
|
+#if VFSOPS_TAKES_THREAD
|
|
+ , td
|
|
+#endif
|
|
+ );
|
|
if (err)
|
|
return (err);
|
|
KASSERT(*vpp, ("we neither err'd nor found the root node"));
|
|
--- ./fuse_module/fuse_vnops.c.orig 2012-09-19 06:04:10.512413490 +0200
|
|
+++ ./fuse_module/fuse_vnops.c 2012-09-19 06:20:44.949613892 +0200
|
|
@@ -799,8 +799,11 @@
|
|
struct vnode *vp = ap->a_vp;
|
|
struct vattr *vap = ap->a_vap;
|
|
struct ucred *cred = ap->a_cred;
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
struct thread *td = ap->a_td;
|
|
-
|
|
+#else
|
|
+ struct thread *td = curthread;
|
|
+#endif
|
|
struct fuse_dispatcher fdi;
|
|
struct timespec uptsp;
|
|
int err = 0;
|
|
@@ -871,7 +874,11 @@
|
|
fuse_access(ap)
|
|
struct vop_access_args /* {
|
|
struct vnode *a_vp;
|
|
+#if VOP_ACCESS_TAKES_ACCMODE_T
|
|
+ accmode_t a_accmode;
|
|
+#else
|
|
int a_mode;
|
|
+#endif
|
|
struct ucred *a_cred;
|
|
struct thread *a_td;
|
|
} */ *ap;
|
|
@@ -886,7 +893,13 @@
|
|
else
|
|
facp.facc_flags |= FACCESS_DO_ACCESS;
|
|
|
|
- return fuse_access_i(vp, ap->a_mode, ap->a_cred, ap->a_td, &facp);
|
|
+ return fuse_access_i(vp,
|
|
+#if VOP_ACCESS_TAKES_ACCMODE_T
|
|
+ ap->a_accmode,
|
|
+#else
|
|
+ ap->a_mode,
|
|
+#endif
|
|
+ ap->a_cred, ap->a_td, &facp);
|
|
}
|
|
|
|
/*
|
|
@@ -946,7 +959,11 @@
|
|
/* We are to do the check in-kernel */
|
|
|
|
if (! (facp->facc_flags & FACCESS_VA_VALID)) {
|
|
- err = VOP_GETATTR(vp, VTOVA(vp), cred, td);
|
|
+ err = VOP_GETATTR(vp, VTOVA(vp), cred
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
+ , td
|
|
+#endif
|
|
+ );
|
|
if (err)
|
|
return (err);
|
|
facp->facc_flags |= FACCESS_VA_VALID;
|
|
@@ -1544,7 +1561,7 @@
|
|
struct fuse_vnode_data *fvdat = VTOFUD(vp);
|
|
uint64_t parentid = fvdat->parent_nid;
|
|
struct componentname *cnp = fvdat->germcnp;
|
|
- struct fuse_open_in *foi;
|
|
+ struct fuse_create_in *foi;
|
|
struct fuse_entry_out *feo;
|
|
struct fuse_mknod_in fmni;
|
|
int err;
|
|
@@ -1929,7 +1946,11 @@
|
|
* It will not invalidate pages which are dirty, locked, under
|
|
* writeback or mapped into pagetables.")
|
|
*/
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
err = vinvalbuf(vp, 0, td, PCATCH, 0);
|
|
+#else
|
|
+ err = vinvalbuf(vp, 0, PCATCH, 0);
|
|
+#endif
|
|
fufh->flags |= FOPEN_KEEP_CACHE;
|
|
}
|
|
|
|
@@ -3005,8 +3026,11 @@
|
|
struct vattr *vap = ap->a_vap;
|
|
struct vnode *vp = ap->a_vp;
|
|
struct ucred *cred = ap->a_cred;
|
|
+#if VOP_GETATTR_TAKES_THREAD
|
|
struct thread *td = ap->a_td;
|
|
-
|
|
+#else
|
|
+ struct thread *td = curthread;
|
|
+#endif
|
|
int err = 0;
|
|
struct fuse_dispatcher fdi;
|
|
struct fuse_setattr_in *fsai;
|
|
--- mount_fusefs/mount_fusefs.c 2008-02-05 07:25:57.000000000 +0200
|
|
+++ mount_fusefs/mount_fusefs.c 2012-01-07 21:07:35.000000000 +0200
|
|
@@ -44,6 +44,7 @@
|
|
#include <getopt.h>
|
|
#include <libgen.h>
|
|
#include <limits.h>
|
|
+#include <osreldate.h>
|
|
#include <paths.h>
|
|
|
|
#include "fuse4bsd.h"
|
|
@@ -312,7 +313,12 @@
|
|
* Resolve the mountpoint with realpath(3) and remove unnecessary
|
|
* slashes from the devicename if there are any.
|
|
*/
|
|
+#if __FreeBSD_version >= 1000005
|
|
+ if (checkpath(dir, mntpath) != 0)
|
|
+ err(1, "%s", mntpath);
|
|
+#else
|
|
(void)checkpath(dir, mntpath);
|
|
+#endif
|
|
(void)rmslashes(dev, dev);
|
|
|
|
if (strcmp(dev, "auto") == 0)
|