Commit 874bc00b authored by Ross Lagerwall's avatar Ross Lagerwall

Add an nfs backend based on libnfs

Add an nfs backend based on libnfs to make userspace mounting and usage
of nfs shares easier.  The backend is written in a single-threaded,
asynchronous style.  Performance measurements show around 60-70 MiB/s
throughput on 1GbE.

To make use of it, simply mount the share with gvfs-mount or Nautilus
with the following syntax:
nfs://host/export/path

Authentication is simple, based on UNIX uid.

Since this is a userspace nfs client, it comes with the caveat that the
mount needs to be exported with "insecure" on Linux (or some equivalent
for other NFS servers) so that it allows connections from port numbers
higher than 1023.  Alternatively, a special capability can be given to
the binary:
sudo setcap 'cap_net_bind_service=+ep' /path/to/executable

https://bugzilla.gnome.org/show_bug.cgi?id=738967
parent 2fc159a7
......@@ -738,6 +738,27 @@ if test "x$enable_afp" != "xno"; then
fi
AM_CONDITIONAL(USE_AFP, test "x$enable_afp" != "xno")
dnl *******************
dnl *** NFS backend ***
dnl *******************
AC_ARG_ENABLE(nfs, AS_HELP_STRING([--disable-nfs], [build without NFS support]))
msg_nfs="no"
NFS_CFLAGS=
NFS_LIBS=
if test "x$enable_nfs" != "xno"; then
PKG_CHECK_EXISTS([libnfs >= 1.9.7], msg_nfs=yes)
if test "x$msg_nfs" = "xyes"; then
PKG_CHECK_MODULES([NFS],[libnfs >= 1.9.7])
AC_DEFINE(HAVE_NFS, 1, [Define to 1 if nfs is going to be built])
fi
fi
AC_SUBST(NFS_CFLAGS)
AC_SUBST(NFS_LIBS)
AM_CONDITIONAL(HAVE_NFS, [test "$msg_nfs" = "yes"])
dnl ***************************************
dnl *** Check for nl_langinfo constants ***
dnl ***************************************
......@@ -949,6 +970,7 @@ echo "
archive support: $msg_archive
AFC support: $msg_afc
AFP support: $msg_afp
NFS support: $msg_nfs
DNS-SD support: $msg_avahi
Build HAL volume monitor: $msg_hal (with fast init path: $have_hal_fast_init)
Build GDU volume monitor: $msg_gdu
......
......@@ -14,6 +14,7 @@ gvfsd-http
gvfsd-localtest
gvfsd-network
gvfsd-mtp
gvfsd-nfs
gvfsd-obexftp
gvfsd-recent
gvfsd-sftp
......
......@@ -129,6 +129,12 @@ mount_DATA += afp-browse.mount afp.mount
libexec_PROGRAMS += gvfsd-afp-browse gvfsd-afp
endif
mount_in_files += nfs.mount.in
if HAVE_NFS
mount_DATA += nfs.mount
libexec_PROGRAMS += gvfsd-nfs
endif
noinst_DATA = $(mount_DATA:.mount=.localmount)
EXTRA_DIST = \
......@@ -608,6 +614,21 @@ gvfsd_afp_LDADD = \
$(libraries) \
$(LIBGCRYPT_LIBS)
gvfsd_nfs_SOURCES = \
gvfsbackendnfs.c gvfsbackendnfs.h \
daemon-main.c daemon-main.h \
daemon-main-generic.c
gvfsd_nfs_CPPFLAGS = \
$(flags) \
-DBACKEND_HEADER=gvfsbackendnfs.h \
-DDEFAULT_BACKEND_TYPE=nfs \
-DMAX_JOB_THREADS=1 \
-DBACKEND_TYPES='"nfs", G_VFS_TYPE_BACKEND_NFS,' \
$(NFS_CFLAGS)
gvfsd_nfs_LDADD = $(libraries) $(NFS_LIBS)
# GSettings stuff
gsettings_ENUM_NAMESPACE = org.gnome.system.gvfs
......
This diff is collapsed.
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2014 Ross Lagerwall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef __G_VFS_BACKEND_NFS_H__
#define __G_VFS_BACKEND_NFS_H__
#include <gvfsbackend.h>
#include <gmountspec.h>
G_BEGIN_DECLS
#define G_VFS_TYPE_BACKEND_NFS (g_vfs_backend_nfs_get_type ())
#define G_VFS_BACKEND_NFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_BACKEND_NFS, GVfsBackendNfs))
#define G_VFS_BACKEND_NFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_BACKEND_NFS, GVfsBackendNfsClass))
#define G_VFS_IS_BACKEND_NFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_BACKEND_NFS))
#define G_VFS_IS_BACKEND_NFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_BACKEND_NFS))
#define G_VFS_BACKEND_NFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_BACKEND_NFS, GVfsBackendNfsClass))
typedef struct _GVfsBackendNfs GVfsBackendNfs;
typedef struct _GVfsBackendNfsClass GVfsBackendNfsClass;
struct _GVfsBackendNfsClass
{
GVfsBackendClass parent_class;
};
GType g_vfs_backend_nfs_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __G_VFS_BACKEND_NFS_H__ */
[Mount]
Type=nfs
Exec=@libexecdir@/gvfsd-nfs
AutoMount=false
Scheme=nfs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment