diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 01d93ed92..6e40e21ae 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -7339,15 +7339,14 @@ append_options(char *mntopts, char *newopts) static enum sa_protocol sa_protocol_decode(const char *protocol) { - for (enum sa_protocol i = 0; i < ARRAY_SIZE(sa_protocol_names); ++i) - if (strcmp(protocol, sa_protocol_names[i]) == 0) + for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) + if (strcmp(protocol, zfs_share_protocol_name(i)) == 0) return (i); (void) fputs(gettext("share type must be one of: "), stderr); - for (enum sa_protocol i = 0; - i < ARRAY_SIZE(sa_protocol_names); ++i) + for (enum sa_protocol i = 0; i < SA_PROTOCOL_COUNT; ++i) (void) fprintf(stderr, "%s%s", - i != 0 ? ", " : "", sa_protocol_names[i]); + i != 0 ? ", " : "", zfs_share_protocol_name(i)); (void) fputc('\n', stderr); usage(B_FALSE); } diff --git a/include/libzfs.h b/include/libzfs.h index 14930fb90..0ff3948e1 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -37,7 +37,6 @@ #define _LIBZFS_H extern __attribute__((visibility("default"))) #include -#include #include #include #include @@ -983,6 +982,15 @@ _LIBZFS_H void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint, */ #define SA_NO_PROTOCOL -1 +/* available protocols */ +enum sa_protocol { + SA_PROTOCOL_NFS, + SA_PROTOCOL_SMB, /* ABI: add before _COUNT */ + SA_PROTOCOL_COUNT, +}; + +_LIBZFS_H const char *zfs_share_protocol_name(enum sa_protocol); + _LIBZFS_H boolean_t zfs_is_shared(zfs_handle_t *zhp, char **where, const enum sa_protocol *proto); _LIBZFS_H int zfs_share(zfs_handle_t *zhp, const enum sa_protocol *proto); diff --git a/lib/Makefile.am b/lib/Makefile.am index bb7e4ada4..cd11b3ebd 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -16,12 +16,12 @@ # |--libzdb--zdb | | # | | | # libzpool libzfs* ----------------+ -# | | | \ / | | |\ -# libicp --/ | | \ / | \ | \----- libshare -# | | \ / | \ \ -# libzstd ---/ | \ / | \ \-------\ -# | \ / \ \ \ -# libunicode --/ \ / \ \-------\ \ +# | | \ / | | | +# libicp --/ | \ / | \ | +# | \ / | \ \ +# libzstd ---/ \ / | \ \-------\ +# \ / \ \ \ +# \ / \ \-------\ \ # \ / \ \ | # libzutil libzfs_core* | | # | | | \ | | | | @@ -56,7 +56,6 @@ pkgconfig_DATA = include $(srcdir)/%D%/libavl/Makefile.am include $(srcdir)/%D%/libicp/Makefile.am include $(srcdir)/%D%/libnvpair/Makefile.am -include $(srcdir)/%D%/libshare/Makefile.am include $(srcdir)/%D%/libspl/Makefile.am include $(srcdir)/%D%/libunicode/Makefile.am include $(srcdir)/%D%/libzdb/Makefile.am diff --git a/lib/libshare/Makefile.am b/lib/libshare/Makefile.am deleted file mode 100644 index 48d8cb832..000000000 --- a/lib/libshare/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -libshare_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) -libshare_la_CFLAGS += -fvisibility=hidden - -libshare_la_CPPFLAGS = $(AM_CPPFLAGS) -libshare_la_CPPFLAGS += -I$(srcdir)/%D% - -noinst_LTLIBRARIES += libshare.la -CPPCHECKTARGETS += libshare.la - -libshare_la_SOURCES = \ - %D%/libshare_impl.h \ - %D%/libshare.c \ - %D%/nfs.c \ - %D%/nfs.h \ - %D%/smb.h - -if BUILD_LINUX -libshare_la_SOURCES += \ - %D%/os/linux/nfs.c \ - %D%/os/linux/smb.c -endif - -if BUILD_FREEBSD -libshare_la_SOURCES += \ - %D%/os/freebsd/nfs.c \ - %D%/os/freebsd/smb.c -endif diff --git a/lib/libshare/libshare_impl.h b/lib/libshare/libshare_impl.h deleted file mode 100644 index 79f081bb8..000000000 --- a/lib/libshare/libshare_impl.h +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 Gunnar Beutner - * Copyright (c) 2019, 2022 by Delphix. All rights reserved. - */ -#ifndef _LIBSPL_LIBSHARE_IMPL_H -#define _LIBSPL_LIBSHARE_IMPL_H - -typedef const struct sa_share_impl { - const char *sa_zfsname; - const char *sa_mountpoint; - const char *sa_shareopts; -} *sa_share_impl_t; - -typedef struct { - int (*const enable_share)(sa_share_impl_t share); - int (*const disable_share)(sa_share_impl_t share); - boolean_t (*const is_shared)(sa_share_impl_t share); - int (*const validate_shareopts)(const char *shareopts); - int (*const commit_shares)(void); - void (*const truncate_shares)(void); -} sa_fstype_t; - -extern const sa_fstype_t libshare_nfs_type, libshare_smb_type; - -#endif /* _LIBSPL_LIBSHARE_IMPL_H */ diff --git a/lib/libshare/nfs.h b/lib/libshare/nfs.h deleted file mode 100644 index 1b8ed890d..000000000 --- a/lib/libshare/nfs.h +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 Gunnar Beutner - * Copyright (c) 2022 by Delphix. All rights reserved. - */ - -#include "libshare_impl.h" - -#define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n" - -int nfs_escape_mountpoint(const char *mp, char **out, boolean_t *need_free); -boolean_t nfs_is_shared_impl(const char *exports, sa_share_impl_t impl_share); -int nfs_toggle_share(const char *lockfile, const char *exports, - const char *expdir, sa_share_impl_t impl_share, - int(*cbk)(sa_share_impl_t impl_share, FILE *tmpfile)); -void nfs_reset_shares(const char *lockfile, const char *exports); diff --git a/lib/libshare/smb.h b/lib/libshare/smb.h deleted file mode 100644 index 79e67bd7c..000000000 --- a/lib/libshare/smb.h +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: CDDL-1.0 -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or https://opensource.org/licenses/CDDL-1.0. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 2011 Turbo Fredriksson . - */ - -/* - * The maximum SMB share name seems to be 254 characters, though good - * references are hard to find. - */ - -#define SMB_NAME_MAX 255 -#define SMB_COMMENT_MAX 255 - -#define SHARE_DIR "/var/lib/samba/usershares" -#define NET_CMD_PATH "/usr/bin/net" -#define NET_CMD_ARG_HOST "127.0.0.1" - -typedef struct smb_share_s { - char name[SMB_NAME_MAX]; /* Share name */ - char path[PATH_MAX]; /* Share path */ - char comment[SMB_COMMENT_MAX]; /* Share's comment */ - boolean_t guest_ok; /* 'y' or 'n' */ - - struct smb_share_s *next; -} smb_share_t; diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index e68742409..803067a35 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -3,7 +3,6 @@ libspl_HEADERS = \ %D%/assert.h \ %D%/atomic.h \ %D%/libgen.h \ - %D%/libshare.h \ %D%/libspl.h \ %D%/statcommon.h \ %D%/stdlib.h \ diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 999dccd71..caffe6cf4 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -7,6 +7,7 @@ CPPCHECKTARGETS += libzfs.la dist_libzfs_la_SOURCES = \ %D%/libzfs_impl.h \ + %D%/libzfs_share.h \ %D%/libzfs_changelist.c \ %D%/libzfs_config.c \ %D%/libzfs_crypto.c \ @@ -16,6 +17,8 @@ dist_libzfs_la_SOURCES = \ %D%/libzfs_iter.c \ %D%/libzfs_mount.c \ %D%/libzfs_pool.c \ + %D%/libzfs_share.c \ + %D%/libzfs_share_nfs.c \ %D%/libzfs_sendrecv.c \ %D%/libzfs_status.c \ %D%/libzfs_util.c @@ -23,6 +26,8 @@ dist_libzfs_la_SOURCES = \ if BUILD_FREEBSD dist_libzfs_la_SOURCES += \ %D%/os/freebsd/libzfs_compat.c \ + %D%/os/freebsd/libzfs_share_nfs.c \ + %D%/os/freebsd/libzfs_share_smb.c \ %D%/os/freebsd/libzfs_zmount.c endif @@ -30,6 +35,8 @@ if BUILD_LINUX dist_libzfs_la_SOURCES += \ %D%/os/linux/libzfs_mount_os.c \ %D%/os/linux/libzfs_pool_os.c \ + %D%/os/linux/libzfs_share_nfs.c \ + %D%/os/linux/libzfs_share_smb.c \ %D%/os/linux/libzfs_util_os.c endif @@ -52,7 +59,6 @@ nodist_libzfs_la_SOURCES = \ module/zcommon/zprop_common.c libzfs_la_LIBADD = \ - libshare.la \ libzfs_core.la \ libnvpair.la \ libzutil.la diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 7cb7e7087..5f27b9c6d 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -296,13 +296,6 @@ - - - - - - - @@ -496,6 +489,7 @@ + @@ -696,7 +690,6 @@ - @@ -726,147 +719,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1374,6 +1226,7 @@ + @@ -1571,14 +1424,13 @@ - - + - + @@ -1597,7 +1449,7 @@ - + @@ -1616,9 +1468,9 @@ - + - + @@ -2146,6 +1998,9 @@ + + + @@ -2260,6 +2115,12 @@ + + + + + + @@ -2481,12 +2342,6 @@ - - - - - - @@ -2908,10 +2763,6 @@ - - - - @@ -2955,6 +2806,10 @@ + + + + @@ -4825,11 +4680,6 @@ - - - - - @@ -5331,6 +5181,11 @@ + + + + + @@ -6106,31 +5961,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -6214,6 +6044,10 @@ + + + + @@ -6261,6 +6095,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8498,6 +8357,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9270,6 +9168,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9929,23 +9952,6 @@ - - - - - - - - - - - - - - - - - @@ -9958,16 +9964,11 @@ - - - - - @@ -10012,11 +10013,6 @@ - - - - - diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h index 5bcba3c8e..ef0524099 100644 --- a/lib/libzfs/libzfs_impl.h +++ b/lib/libzfs/libzfs_impl.h @@ -37,9 +37,10 @@ #include #include -#include #include +#include "libzfs_share.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 8d840dff7..a6287fbe2 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -79,7 +79,6 @@ #include "libzfs_impl.h" -#include #include #define MAXISALEN 257 /* based on sysinfo(2) man page */ @@ -98,7 +97,11 @@ static const enum sa_protocol share_all_proto[SA_PROTOCOL_COUNT + 1] = { SA_NO_PROTOCOL }; - +const char * +zfs_share_protocol_name(enum sa_protocol protocol) +{ + return (sa_protocol_names[protocol]); +} static boolean_t dir_is_empty_stat(const char *dirname) diff --git a/lib/libshare/libshare.c b/lib/libzfs/libzfs_share.c similarity index 99% rename from lib/libshare/libshare.c rename to lib/libzfs/libzfs_share.c index 3695207e6..bfac40f17 100644 --- a/lib/libshare/libshare.c +++ b/lib/libzfs/libzfs_share.c @@ -37,8 +37,7 @@ #include #include #include -#include -#include "libshare_impl.h" +#include "libzfs_impl.h" #define init_share(zfsname, path, shareopts) \ { \ diff --git a/lib/libspl/include/libshare.h b/lib/libzfs/libzfs_share.h similarity index 59% rename from lib/libspl/include/libshare.h rename to lib/libzfs/libzfs_share.h index bfa78bffd..9f8d2fddd 100644 --- a/lib/libspl/include/libshare.h +++ b/lib/libzfs/libzfs_share.h @@ -23,10 +23,13 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Gunnar Beutner * Copyright (c) 2019, 2022 by Delphix. All rights reserved. */ -#ifndef _LIBSPL_LIBSHARE_H -#define _LIBSPL_LIBSHARE_H extern __attribute__((visibility("default"))) + +#ifndef _LIBZFS_SHARE_H +#define _LIBZFS_SHARE_H #include @@ -71,27 +74,68 @@ #define SA_SHARE_EXISTS 33 /* path or file is already shared */ /* initialization */ -_LIBSPL_LIBSHARE_H const char *sa_errorstr(int); - -/* available protocols */ -enum sa_protocol { - SA_PROTOCOL_NFS, - SA_PROTOCOL_SMB, /* ABI: add before _COUNT */ - SA_PROTOCOL_COUNT, -}; +extern const char *sa_errorstr(int); /* lower-case */ -_LIBSPL_LIBSHARE_H const char *const sa_protocol_names[SA_PROTOCOL_COUNT]; +extern const char *const sa_protocol_names[SA_PROTOCOL_COUNT]; /* share control */ -_LIBSPL_LIBSHARE_H int sa_enable_share(const char *, const char *, const char *, +extern int sa_enable_share(const char *, const char *, const char *, enum sa_protocol); -_LIBSPL_LIBSHARE_H int sa_disable_share(const char *, enum sa_protocol); -_LIBSPL_LIBSHARE_H boolean_t sa_is_shared(const char *, enum sa_protocol); -_LIBSPL_LIBSHARE_H void sa_commit_shares(enum sa_protocol); -_LIBSPL_LIBSHARE_H void sa_truncate_shares(enum sa_protocol); +extern int sa_disable_share(const char *, enum sa_protocol); +extern boolean_t sa_is_shared(const char *, enum sa_protocol); +extern void sa_commit_shares(enum sa_protocol); +extern void sa_truncate_shares(enum sa_protocol); /* protocol specific interfaces */ -_LIBSPL_LIBSHARE_H int sa_validate_shareopts(const char *, enum sa_protocol); +extern int sa_validate_shareopts(const char *, enum sa_protocol); -#endif /* _LIBSPL_LIBSHARE_H */ + +/* internal definitions */ +typedef const struct sa_share_impl { + const char *sa_zfsname; + const char *sa_mountpoint; + const char *sa_shareopts; +} *sa_share_impl_t; + +typedef struct { + int (*const enable_share)(sa_share_impl_t share); + int (*const disable_share)(sa_share_impl_t share); + boolean_t (*const is_shared)(sa_share_impl_t share); + int (*const validate_shareopts)(const char *shareopts); + int (*const commit_shares)(void); + void (*const truncate_shares)(void); +} sa_fstype_t; + +extern const sa_fstype_t libshare_nfs_type, libshare_smb_type; + +/* internal NFS definitions */ +#define NFS_FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n" + +extern int nfs_escape_mountpoint(const char *mp, char **out, + boolean_t *need_free); +extern boolean_t nfs_is_shared_impl(const char *exports, + sa_share_impl_t impl_share); +extern int nfs_toggle_share(const char *lockfile, const char *exports, + const char *expdir, sa_share_impl_t impl_share, + int(*cbk)(sa_share_impl_t impl_share, FILE *tmpfile)); +extern void nfs_reset_shares(const char *lockfile, const char *exports); + +/* internal SMB definitions */ +#define SMB_NAME_MAX 255 +#define SMB_COMMENT_MAX 255 + +#define SMB_SHARE_DIR "/var/lib/samba/usershares" +#define SMB_NET_CMD_PATH "/usr/bin/net" +#define SMB_NET_CMD_ARG_HOST "127.0.0.1" + +typedef struct smb_share_s { + char name[SMB_NAME_MAX]; /* Share name */ + char path[PATH_MAX]; /* Share path */ + char comment[SMB_COMMENT_MAX]; /* Share's comment */ + boolean_t guest_ok; /* 'y' or 'n' */ + + struct smb_share_s *next; +} smb_share_t; + +#endif /* _LIBZFS_SHARE_H */ diff --git a/lib/libshare/nfs.c b/lib/libzfs/libzfs_share_nfs.c similarity index 99% rename from lib/libshare/nfs.c rename to lib/libzfs/libzfs_share_nfs.c index e4c5b904f..fca583f4d 100644 --- a/lib/libshare/nfs.c +++ b/lib/libzfs/libzfs_share_nfs.c @@ -28,10 +28,9 @@ #include #include #include -#include #include #include -#include "nfs.h" +#include "libzfs_impl.h" /* @@ -241,7 +240,7 @@ nfs_copy_entries_cb(void *userdata, char *line, boolean_t found_mountpoint) static int nfs_copy_entries(FILE *newfp, const char *exports, const char *mountpoint) { - fputs(FILE_HEADER, newfp); + fputs(NFS_FILE_HEADER, newfp); int error = nfs_process_exports( exports, mountpoint, nfs_copy_entries_cb, newfp); diff --git a/lib/libshare/os/freebsd/nfs.c b/lib/libzfs/os/freebsd/libzfs_share_nfs.c similarity index 99% rename from lib/libshare/os/freebsd/nfs.c rename to lib/libzfs/os/freebsd/libzfs_share_nfs.c index 969194f28..cad7a4267 100644 --- a/lib/libshare/os/freebsd/nfs.c +++ b/lib/libzfs/os/freebsd/libzfs_share_nfs.c @@ -40,9 +40,8 @@ #include #include -#include -#include "libshare_impl.h" -#include "nfs.h" +#include +#include "../../libzfs_share.h" #define _PATH_MOUNTDPID "/var/run/mountd.pid" #define ZFS_EXPORTS_FILE "/etc/zfs/exports" diff --git a/lib/libshare/os/freebsd/smb.c b/lib/libzfs/os/freebsd/libzfs_share_smb.c similarity index 97% rename from lib/libshare/os/freebsd/smb.c rename to lib/libzfs/os/freebsd/libzfs_share_smb.c index c6b8bdde2..e9b943270 100644 --- a/lib/libshare/os/freebsd/smb.c +++ b/lib/libzfs/os/freebsd/libzfs_share_smb.c @@ -25,8 +25,8 @@ */ #include -#include -#include "libshare_impl.h" +#include +#include "../../libzfs_share.h" /* * Enables SMB sharing for the specified share. diff --git a/lib/libshare/os/linux/nfs.c b/lib/libzfs/os/linux/libzfs_share_nfs.c similarity index 99% rename from lib/libshare/os/linux/nfs.c rename to lib/libzfs/os/linux/libzfs_share_nfs.c index 6a9bb3788..7644e9b89 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libzfs/os/linux/libzfs_share_nfs.c @@ -38,9 +38,7 @@ #include #include #include -#include -#include "libshare_impl.h" -#include "nfs.h" +#include "../../libzfs_impl.h" #define ZFS_EXPORTS_DIR "/etc/exports.d" #define ZFS_EXPORTS_FILE ZFS_EXPORTS_DIR"/zfs.exports" diff --git a/lib/libshare/os/linux/smb.c b/lib/libzfs/os/linux/libzfs_share_smb.c similarity index 95% rename from lib/libshare/os/linux/smb.c rename to lib/libzfs/os/linux/libzfs_share_smb.c index 40996ecc8..4d2961b83 100644 --- a/lib/libshare/os/linux/smb.c +++ b/lib/libzfs/os/linux/libzfs_share_smb.c @@ -58,9 +58,7 @@ #include #include #include -#include -#include "libshare_impl.h" -#include "smb.h" +#include "../../libzfs_share.h" static boolean_t smb_available(void); @@ -85,7 +83,7 @@ smb_retrieve_shares(void) smb_share_t *shares, *new_shares = NULL; /* opendir(), stat() */ - shares_dir = opendir(SHARE_DIR); + shares_dir = opendir(SMB_SHARE_DIR); if (shares_dir == NULL) return (SA_SYSTEM_ERR); @@ -97,7 +95,7 @@ smb_retrieve_shares(void) continue; snprintf(file_path, sizeof (file_path), - "%s/%s", SHARE_DIR, directory->d_name); + "%s/%s", SMB_SHARE_DIR, directory->d_name); if ((fd = open(file_path, O_RDONLY | O_CLOEXEC)) == -1) { rc = SA_SYSTEM_ERR; @@ -242,15 +240,15 @@ smb_enable_share_one(const char *sharename, const char *sharepath) } /* - * CMD: net -S NET_CMD_ARG_HOST usershare add Test1 /share/Test1 \ + * CMD: net -S SMB_NET_CMD_ARG_HOST usershare add Test1 /share/Test1 \ * "Comment" "Everyone:F" */ snprintf(comment, sizeof (comment), "Comment: %s", sharepath); char *argv[] = { - (char *)NET_CMD_PATH, + (char *)SMB_NET_CMD_PATH, (char *)"-S", - (char *)NET_CMD_ARG_HOST, + (char *)SMB_NET_CMD_ARG_HOST, (char *)"usershare", (char *)"add", name, @@ -298,11 +296,11 @@ smb_enable_share(sa_share_impl_t impl_share) static int smb_disable_share_one(const char *sharename) { - /* CMD: net -S NET_CMD_ARG_HOST usershare delete Test1 */ + /* CMD: net -S SMB_NET_CMD_ARG_HOST usershare delete Test1 */ char *argv[] = { - (char *)NET_CMD_PATH, + (char *)SMB_NET_CMD_PATH, (char *)"-S", - (char *)NET_CMD_ARG_HOST, + (char *)SMB_NET_CMD_ARG_HOST, (char *)"usershare", (char *)"delete", (char *)sharename, @@ -395,8 +393,8 @@ smb_available(void) if (!avail) { struct stat statbuf; - if (access(NET_CMD_PATH, F_OK) != 0 || - lstat(SHARE_DIR, &statbuf) != 0 || + if (access(SMB_NET_CMD_PATH, F_OK) != 0 || + lstat(SMB_SHARE_DIR, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) avail = -1; else diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index 893a87c7e..1cfd2a81d 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -1152,14 +1152,13 @@ - - + - + @@ -1178,7 +1177,7 @@ - + @@ -1197,9 +1196,9 @@ - + - +