Skip to content

Commit

Permalink
Implemented sharing datasets via SMB using libshare
Browse files Browse the repository at this point in the history
Add the initial support for the 'smbshare' option using the
existing libshare infrastructure.  Because this implementation
relies on usershares samba version 3.0.23 is required.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#493
  • Loading branch information
FransUrbo authored and behlendorf committed Dec 3, 2012
1 parent 4588bf5 commit 645fb9c
Show file tree
Hide file tree
Showing 9 changed files with 731 additions and 13 deletions.
6 changes: 4 additions & 2 deletions lib/libshare/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ DEFAULT_INCLUDES += \
noinst_LTLIBRARIES = libshare.la

libshare_la_SOURCES = \
$(top_srcdir)/lib/libshare/libshare_impl.h \
$(top_srcdir)/lib/libshare/libshare.c \
$(top_srcdir)/lib/libshare/nfs.c \
$(top_srcdir)/lib/libshare/libshare_impl.h \
$(top_srcdir)/lib/libshare/nfs.h
$(top_srcdir)/lib/libshare/nfs.h \
$(top_srcdir)/lib/libshare/smb.c \
$(top_srcdir)/lib/libshare/smb.h
2 changes: 2 additions & 0 deletions lib/libshare/libshare.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <libshare.h>
#include "libshare_impl.h"
#include "nfs.h"
#include "smb.h"

static sa_share_impl_t find_share(sa_handle_impl_t handle,
const char *sharepath);
Expand Down Expand Up @@ -103,6 +104,7 @@ __attribute__((constructor)) static void
libshare_init(void)
{
libshare_nfs_init();
libshare_smb_init();

/*
* This bit causes /etc/dfs/sharetab to be updated before libzfs gets a
Expand Down
5 changes: 3 additions & 2 deletions lib/libshare/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ nfs_validate_shareopts(const char *shareopts)
* Checks whether a share is currently active.
*/
static boolean_t
is_share_active(sa_share_impl_t impl_share)
nfs_is_share_active(sa_share_impl_t impl_share)
{
char line[512];
char *tab, *cur;
Expand Down Expand Up @@ -587,7 +587,8 @@ nfs_update_shareopts(sa_share_impl_t impl_share, const char *resource,
boolean_t needs_reshare = B_FALSE;
char *old_shareopts;

FSINFO(impl_share, nfs_fstype)->active = is_share_active(impl_share);
FSINFO(impl_share, nfs_fstype)->active =
nfs_is_share_active(impl_share);

old_shareopts = FSINFO(impl_share, nfs_fstype)->shareopts;

Expand Down
Loading

0 comments on commit 645fb9c

Please sign in to comment.