Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2018 18:57:43 +0000 (UTC)
From:      Mikhail Teterin <mi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r460623 - in head/sysutils/fusefs-smbnetfs: . files
Message-ID:  <201802011857.w11IvhMv001243@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mi
Date: Thu Feb  1 18:57:43 2018
New Revision: 460623
URL: https://svnweb.freebsd.org/changeset/ports/460623

Log:
  Allow building against fuse3. Off by default for there
  are no obvious advantages to it...

Added:
  head/sysutils/fusefs-smbnetfs/files/patch-fuse3   (contents, props changed)
Modified:
  head/sysutils/fusefs-smbnetfs/Makefile

Modified: head/sysutils/fusefs-smbnetfs/Makefile
==============================================================================
--- head/sysutils/fusefs-smbnetfs/Makefile	Thu Feb  1 18:22:43 2018	(r460622)
+++ head/sysutils/fusefs-smbnetfs/Makefile	Thu Feb  1 18:57:43 2018	(r460623)
@@ -27,7 +27,7 @@ USE_GNOME=	glib20:build
 GNU_CONFIGURE=	yes
 # A hack to disable gratuitous linking with -lglib-2.0
 CONFIGURE_ENV+=	GLIB_LIBS=-L/var/empty
-CFLAGS+=	-I${SAMBAINCLUDES}
+CFLAGS+=	-I${SAMBAINCLUDES} -DFUSE_USE_VERSION=${FUSE_VERSION}
 LDFLAGS+=	-L${SAMBALIBS}
 SUB_FILES=	pkg-message
 # configure just generated config.h -- we do not need to redo it:
@@ -39,5 +39,17 @@ MAKE_ARGS+=	AUTOHEADER=${TRUE}
 CONFIGURE_ENV+=	ac_cv_lib_iconv_iconv_open=yes
 CONFIGURE_ARGS+=--with-libiconv=native
 .endif
+
+# Uses/fuse.mk should be doing the below:
+.if ${LIBFUSE_VER} == 3
+CONFIGURE_ENV+=	FUSE_CFLAGS="-I${LOCALBASE}/include/fuse3" \
+		FUSE_LIBS="-L${LOCALBASE}/lib -lfuse3"
+FUSEPKG=	fuse3
+LDFLAGS+=	-lthr
+.else
+FUSEPKG=	fuse
+.endif
+FUSE_VERSION=	"`pkgconf --version ${FUSEPKG} |	\
+		    ${SED} -E 's,^([0-9]+)\.([0-9]+)\..*,\1\2,'`"
 
 .include <bsd.port.post.mk>

Added: head/sysutils/fusefs-smbnetfs/files/patch-fuse3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/fusefs-smbnetfs/files/patch-fuse3	Thu Feb  1 18:57:43 2018	(r460623)
@@ -0,0 +1,216 @@
+Allow use of either libfuse3 or libfuse...
+
+	-mi
+
+--- src/event.c	2018-01-04 15:59:38 -0500
++++ src/event.c	2018-02-01 11:12:59 -0500
+@@ -5,5 +5,5 @@
+ #include <pthread.h>
+ #include <libsmbclient.h>
+-#include <fuse/fuse.h>
++#include <fuse.h>
+ #include <glib.h>
+ 
+--- configure	2018-01-04 16:00:23 -0500
++++ configure	2018-02-01 11:16:43 -0500
+@@ -4059,5 +4059,5 @@
+ fi
+ LIBS="$LIBS $FUSE_LIBS"
+-CFLAGS="$CFLAGS -D_REENTRANT -D_GNU_SOURCE -DFUSE_USE_VERSION=26 $FUSE_CFLAGS"
++CFLAGS="$CFLAGS -D_REENTRANT -D_GNU_SOURCE $FUSE_CFLAGS"
+ 
+ 
+--- src/event.h	2018-01-04 15:59:38.000000000 -0500
++++ src/event.h	2018-02-01 11:20:21.779895000 -0500
+@@ -2,5 +2,5 @@
+ #define __EVENT_H__
+ 
+-#include <fuse/fuse.h>
++#include <fuse.h>
+ 
+ int  event_set_query_browser_flag(int flag);
+--- src/function.h	2018-01-04 15:59:38.000000000 -0500
++++ src/function.h	2018-02-01 11:21:10.116105000 -0500
+@@ -2,5 +2,5 @@
+ #define __FUNCTION_H__
+ 
+-#include <fuse/fuse.h>
++#include <fuse.h>
+ 
+ extern	struct fuse_operations	smb_oper;
+--- src/function.c	2018-01-04 20:59:38.000000000 +0000
++++ src/function.c	2018-02-01 18:28:01.664078000 +0000
+@@ -149,5 +151,13 @@
+ }
+ 
+-static int function_rename(const char *from, const char *to){
++static int function_rename(const char *from, const char *to
++#if FUSE_USE_VERSION > 29
++    , unsigned int flags __unused
++#endif
++){
++    /*
++     * XXX Maybe, we should check the flags-argument to better
++     * XXX manage the caller's expectations?
++     */
+     DPRINTF(5, "(%s, %s)\n", from, to);
+     if (smbitem_what_is(from) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
+@@ -188,6 +198,15 @@
+ }
+ 
++
+ static int function_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
+-			off_t offset, struct fuse_file_info *fi){
++			off_t offset, struct fuse_file_info *fi
++#if FUSE_USE_VERSION > 29
++			, enum fuse_readdir_flags flags __unused
++#define CALL_FILLER(buf, path, st, offset)	\
++	filler(buf, path, st, offset, 0)
++#else
++#define CALL_FILLER	filler
++#endif
++){
+     samba_fd		fd;
+     int			error, rec_cnt;
+@@ -208,6 +227,6 @@
+ 	error = EINVAL;
+ 	st.st_mode = S_IFDIR;
+-	if (filler(buf, ".",  &st, 0)) goto error0;
+-	if (filler(buf, "..", &st, 0)) goto error0;
++	if (CALL_FILLER(buf, ".",  &st, 0)) goto error0;
++	if (CALL_FILLER(buf, "..", &st, 0)) goto error0;
+ 
+ 	show_hidden_hosts = function_get_hidden_hosts_visibility();
+@@ -227,5 +246,5 @@
+ 		    goto error0;
+ 	    }
+-	    if (filler(buf, dir->childs[i]->name,  &st, 0)) goto end;
++	    if (CALL_FILLER(buf, dir->childs[i]->name,  &st, 0)) goto end;
+ 	}
+ 	error = 0;
+@@ -299,9 +318,9 @@
+ 		memset(&st, 0, sizeof(st));
+ 		st.st_mode = S_IFDIR;
+-		if (filler(buf, ".",  &st, 0)) goto end;
+-		if (filler(buf, "..", &st, 0)) goto end;
++		if (CALL_FILLER(buf, ".",  &st, 0)) goto end;
++		if (CALL_FILLER(buf, "..", &st, 0)) goto end;
+ 		rec_cnt += 2;
+ 	    }
+-	    if (filler(buf, rec->d_name, &st, 0)){
++	    if (CALL_FILLER(buf, rec->d_name, &st, 0)){
+ 		error = EINVAL;
+ 		goto end;
+@@ -317,6 +336,6 @@
+ 	error = EINVAL;
+ 	st.st_mode = S_IFDIR;
+-	if (filler(buf, ".",  &st, 0)) goto end;
+-	if (filler(buf, "..", &st, 0)) goto end;
++	if (CALL_FILLER(buf, ".",  &st, 0)) goto end;
++	if (CALL_FILLER(buf, "..", &st, 0)) goto end;
+ 	rec_cnt += 2;
+     }
+@@ -341,5 +360,11 @@
+ }
+ 
+-static int function_stat(const char *path, struct stat *stbuf){
++static int function_fstat(const char *path, struct stat *stbuf,
++			struct fuse_file_info *fi);
++static int function_stat(const char *path, struct stat *stbuf
++#if FUSE_USE_VERSION > 29
++    , struct fuse_file_info *fi
++#endif
++){
+     int			i, count;
+     size_t		len;
+@@ -347,4 +372,8 @@
+     char		buf[2048];
+ 
++#if FUSE_USE_VERSION > 29
++    if (fi != NULL)
++	return function_fstat(path, stbuf, fi);
++#endif
+     DPRINTF(5, "(%s)\n", path);
+     if (stat_workaround_is_name_ignored(path)) return -ENOENT;
+@@ -462,5 +491,9 @@
+ }
+ 
+-static int function_chmod(const char *path, mode_t mode){
++static int function_chmod(const char *path, mode_t mode
++#if FUSE_USE_VERSION > 29
++    , struct fuse_file_info *fi __unused /* XXX make some use of it? */
++#endif
++){
+     DPRINTF(5, "(%s, %o)\n", path, mode);
+     if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
+@@ -469,4 +502,5 @@
+ }
+ 
++#if FUSE_USE_VERSION < 30
+ static int function_utimes(const char *path, struct utimbuf *buffer){
+     struct timeval	tbuf[2];
+@@ -483,4 +517,21 @@
+     return 0;
+ }
++#else
++static int function_utimens(const char *path, const struct timespec tv[2],
++    struct fuse_file_info *fi __unused)
++{
++    struct timeval	tbuf[2];
++
++    DPRINTF(5, "(%s, %lu)\n", path, (unsigned long)tv[0].tv_sec);
++    if (smbitem_what_is(path) != SMBITEM_SMB_SHARE_ITEM) return -EINVAL;
++
++    tbuf[0].tv_sec = tv[0].tv_sec;
++    tbuf[0].tv_usec = tv[0].tv_nsec / 1000;
++    tbuf[1].tv_sec = tv[1].tv_sec;
++    tbuf[1].tv_usec = tv[1].tv_nsec / 1000;
++    if (samba_utimes(path, tbuf) != 0) return -errno;
++    return 0;
++}
++#endif
+ 
+ /* libfuse does not support lsetxattr() and fsetxattr(), but samba does */
+@@ -542,5 +593,9 @@
+ }
+ 
+-static int function_chown(const char *path, uid_t uid, gid_t gid){
++static int function_chown(const char *path, uid_t uid, gid_t gid
++#if FUSE_USE_VERSION > 29
++    , struct fuse_file_info *fi __unused
++#endif
++){
+     (void) path;
+     (void) uid;
+@@ -552,7 +607,15 @@
+ }
+ 
+-static int function_truncate(const char *path, off_t size){
++static int function_truncate(const char *path, off_t size
++#if FUSE_USE_VERSION > 29
++    , struct fuse_file_info *fi
++#endif
++){
+     samba_fd	fd;
+ 
++#if FUSE_USE_VERSION > 29
++    if (fi != NULL)
++	return function_ftruncate(path, size, fi);
++#endif
+     DPRINTF(5, "(%s, %lld)\n", path, (long long) size);
+     if (size < 0) return -EINVAL;
+@@ -602,8 +665,14 @@
+     .rmdir	= function_rmdir,
+     .getattr	= function_stat,
++#if FUSE_USE_VERSION < 30
+     .fgetattr	= function_fstat,
+     .ftruncate	= function_ftruncate,
++#endif
+     .chmod	= function_chmod,
++#if FUSE_USE_VERSION < 30
+     .utime	= function_utimes,
++#else
++    .utimens	= function_utimens,
++#endif
+     .setxattr	= function_setxattr,
+     .getxattr	= function_getxattr,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802011857.w11IvhMv001243>