Start linux-have-zpl layer
This commit is contained in:
parent
7403ce6856
commit
79491b69f4
19
.topmsg
19
.topmsg
|
@ -1,19 +1,8 @@
|
|||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Subject: [PATCH] zfs branch
|
||||
Subject: [PATCH] linux-have-zpl
|
||||
|
||||
Merged result of all changes which are relevant to both Solaris
|
||||
and Linux builds of the ZFS code. These are changes where there
|
||||
is a reasonable chance they will be accepted upstream.
|
||||
|
||||
Additionally, since this is effectively the root of the linux
|
||||
ZFS tree the core linux build system is added here. This
|
||||
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
|
||||
and makefiles for all the core ZFS components. Linux-only
|
||||
features which require tweaks to the build system should appear
|
||||
on the relevant topic branches. All autotools products which
|
||||
result from autogen.sh are commited to the linux-configure-branch.
|
||||
|
||||
This branch also contains the META, ChangeLog, AUTHORS,
|
||||
README, and GIT files.
|
||||
Changes required to build ZFS without the ZPL layer. Or
|
||||
better yet long term the changes required to integrate ZFS
|
||||
in to linux's VFS layer.
|
||||
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
|
|
|
@ -505,6 +505,7 @@ zfs_do_clone(int argc, char **argv)
|
|||
ret = zfs_clone(zhp, argv[1], props);
|
||||
|
||||
/* create the mountpoint if necessary */
|
||||
#ifdef HAVE_ZPL
|
||||
if (ret == 0) {
|
||||
zfs_handle_t *clone;
|
||||
|
||||
|
@ -515,6 +516,7 @@ zfs_do_clone(int argc, char **argv)
|
|||
zfs_close(clone);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
zfs_close(zhp);
|
||||
nvlist_free(props);
|
||||
|
@ -712,6 +714,7 @@ zfs_do_create(int argc, char **argv)
|
|||
* in fact created, even if we failed to mount or share it.
|
||||
*/
|
||||
ret = 0;
|
||||
#ifdef HAVE_ZPL
|
||||
if (canmount == ZFS_CANMOUNT_ON) {
|
||||
if (zfs_mount(zhp, NULL, 0) != 0) {
|
||||
(void) fprintf(stderr, gettext("filesystem "
|
||||
|
@ -723,6 +726,7 @@ zfs_do_create(int argc, char **argv)
|
|||
ret = 1;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
error:
|
||||
if (zhp)
|
||||
|
@ -832,6 +836,7 @@ destroy_callback(zfs_handle_t *zhp, void *data)
|
|||
return (0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
/*
|
||||
* Bail out on the first error.
|
||||
*/
|
||||
|
@ -840,6 +845,7 @@ destroy_callback(zfs_handle_t *zhp, void *data)
|
|||
zfs_close(zhp);
|
||||
return (-1);
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
zfs_close(zhp);
|
||||
return (0);
|
||||
|
@ -3006,6 +3012,7 @@ dataset_cmp(const void *a, const void *b)
|
|||
return (strcmp(zfs_get_name(a), zfs_get_name(b)));
|
||||
}
|
||||
|
||||
#if HAVE_ZPL
|
||||
/*
|
||||
* Generic callback for sharing or mounting filesystems. Because the code is so
|
||||
* similar, we have a common function with an extra parameter to determine which
|
||||
|
@ -3240,6 +3247,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
|
|||
|
||||
return (0);
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
/*
|
||||
* Reports progress in the form "(current/total)". Not thread-safe.
|
||||
|
@ -3295,6 +3303,7 @@ append_options(char *mntopts, char *newopts)
|
|||
(void) strcpy(&mntopts[len], newopts);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
static int
|
||||
share_mount(int op, int argc, char **argv)
|
||||
{
|
||||
|
@ -3443,6 +3452,7 @@ share_mount(int op, int argc, char **argv)
|
|||
|
||||
return (ret);
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
/*
|
||||
* zfs mount -a [nfs | iscsi]
|
||||
|
@ -3453,7 +3463,11 @@ share_mount(int op, int argc, char **argv)
|
|||
static int
|
||||
zfs_do_mount(int argc, char **argv)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
return (share_mount(OP_MOUNT, argc, argv));
|
||||
#else
|
||||
return ENOSYS;
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3465,9 +3479,14 @@ zfs_do_mount(int argc, char **argv)
|
|||
static int
|
||||
zfs_do_share(int argc, char **argv)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
return (share_mount(OP_SHARE, argc, argv));
|
||||
#else
|
||||
return ENOSYS;
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
typedef struct unshare_unmount_node {
|
||||
zfs_handle_t *un_zhp;
|
||||
char *un_mountp;
|
||||
|
@ -3920,6 +3939,7 @@ unshare_unmount(int op, int argc, char **argv)
|
|||
|
||||
return (ret);
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
/*
|
||||
* zfs unmount -a
|
||||
|
@ -3930,7 +3950,11 @@ unshare_unmount(int op, int argc, char **argv)
|
|||
static int
|
||||
zfs_do_unmount(int argc, char **argv)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
return (unshare_unmount(OP_MOUNT, argc, argv));
|
||||
#else
|
||||
return ENOSYS;
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3942,13 +3966,18 @@ zfs_do_unmount(int argc, char **argv)
|
|||
static int
|
||||
zfs_do_unshare(int argc, char **argv)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
return (unshare_unmount(OP_SHARE, argc, argv));
|
||||
#else
|
||||
return ENOSYS;
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when invoked as /etc/fs/zfs/mount. Do the mount if the mountpoint is
|
||||
* 'legacy'. Otherwise, complain that use should be using 'zfs mount'.
|
||||
*/
|
||||
#ifdef HAVE_ZPL
|
||||
static int
|
||||
manual_mount(int argc, char **argv)
|
||||
{
|
||||
|
@ -4079,6 +4108,7 @@ manual_unmount(int argc, char **argv)
|
|||
|
||||
return (unshare_unmount_path(OP_MOUNT, argv[0], flags, B_TRUE));
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
static int
|
||||
volcheck(zpool_handle_t *zhp, void *data)
|
||||
|
@ -4148,6 +4178,7 @@ main(int argc, char **argv)
|
|||
return (1);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
/*
|
||||
* This command also doubles as the /etc/fs mount and unmount program.
|
||||
* Determine if we should take this behavior based on argv[0].
|
||||
|
@ -4158,6 +4189,9 @@ main(int argc, char **argv)
|
|||
} else if (strcmp(progname, "umount") == 0) {
|
||||
ret = manual_unmount(argc, argv);
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif /* HAVE_ZPL */
|
||||
/*
|
||||
* Make sure the user has specified some command.
|
||||
*/
|
||||
|
|
|
@ -722,6 +722,7 @@ zpool_do_create(int argc, char **argv)
|
|||
mountpoint);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
|
||||
(void) fprintf(stderr, gettext("mountpoint '%s' : "
|
||||
"%s\n"), buf, strerror(errno));
|
||||
|
@ -744,6 +745,7 @@ zpool_do_create(int argc, char **argv)
|
|||
goto errout;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
if (dryrun) {
|
||||
|
@ -774,8 +776,12 @@ zpool_do_create(int argc, char **argv)
|
|||
zfs_prop_to_name(
|
||||
ZFS_PROP_MOUNTPOINT),
|
||||
mountpoint) == 0);
|
||||
#ifdef HAVE_ZPL
|
||||
if (zfs_mount(pool, NULL, 0) == 0)
|
||||
ret = zfs_shareall(pool);
|
||||
#else
|
||||
ret = 0;
|
||||
#endif /* HAVE_ZPL */
|
||||
zfs_close(pool);
|
||||
}
|
||||
} else if (libzfs_errno(g_zfs) == EZFS_INVALIDNAME) {
|
||||
|
@ -1315,10 +1321,12 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
|||
|
||||
verify((zhp = zpool_open_canfail(g_zfs, name)) != NULL);
|
||||
|
||||
#if HAVE_ZPL
|
||||
if (zpool_enable_datasets(zhp, mntopts, 0) != 0) {
|
||||
zpool_close(zhp);
|
||||
return (1);
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
zpool_close(zhp);
|
||||
return (error);
|
||||
|
|
|
@ -93,6 +93,7 @@ struct prop_changelist {
|
|||
int
|
||||
changelist_prefix(prop_changelist_t *clp)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
prop_changenode_t *cn;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -168,6 +169,9 @@ changelist_prefix(prop_changelist_t *clp)
|
|||
(void) changelist_postfix(clp);
|
||||
|
||||
return (ret);
|
||||
#else
|
||||
return 0;
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -182,6 +186,7 @@ changelist_prefix(prop_changelist_t *clp)
|
|||
int
|
||||
changelist_postfix(prop_changelist_t *clp)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
prop_changenode_t *cn;
|
||||
char shareopts[ZFS_MAXPROPLEN];
|
||||
int errors = 0;
|
||||
|
@ -296,6 +301,9 @@ changelist_postfix(prop_changelist_t *clp)
|
|||
}
|
||||
|
||||
return (errors ? -1 : 0);
|
||||
#else
|
||||
return 0;
|
||||
#endif /* HAVE_ZPL */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -358,6 +366,7 @@ changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
|
|||
int
|
||||
changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
|
||||
{
|
||||
#ifdef HAVE_ZPL
|
||||
prop_changenode_t *cn;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -372,6 +381,9 @@ changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
|
|||
}
|
||||
|
||||
return (ret);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -735,6 +735,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
|
|||
|
||||
/*FALLTHRU*/
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
case ZFS_PROP_SHARESMB:
|
||||
case ZFS_PROP_SHARENFS:
|
||||
/*
|
||||
|
@ -845,6 +846,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
|
|||
}
|
||||
|
||||
break;
|
||||
#endif /* HAVE_ZPL */
|
||||
case ZFS_PROP_UTF8ONLY:
|
||||
chosen_utf = (int)intval;
|
||||
break;
|
||||
|
@ -2873,6 +2875,7 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
|
|||
goto ancestorerr;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
if (zfs_mount(h, NULL, 0) != 0) {
|
||||
opname = dgettext(TEXT_DOMAIN, "mount");
|
||||
goto ancestorerr;
|
||||
|
@ -2882,6 +2885,7 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
|
|||
opname = dgettext(TEXT_DOMAIN, "share");
|
||||
goto ancestorerr;
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
zfs_close(h);
|
||||
}
|
||||
|
@ -3098,9 +3102,11 @@ zfs_destroy(zfs_handle_t *zhp)
|
|||
* abort the request. This would only happen for a
|
||||
* non-privileged user.
|
||||
*/
|
||||
#ifdef HAVE_ZPL
|
||||
if (zfs_unshare_iscsi(zhp) != 0) {
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (zvol_remove_link(zhp->zfs_hdl, zhp->zfs_name) != 0)
|
||||
return (-1);
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include <sys/systeminfo.h>
|
||||
#define MAXISALEN 257 /* based on sysinfo(2) man page */
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
static int zfs_share_proto(zfs_handle_t *, zfs_share_proto_t *);
|
||||
zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **,
|
||||
zfs_share_proto_t);
|
||||
|
@ -1234,7 +1235,6 @@ out:
|
|||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
zvol_cb(const char *dataset, void *data)
|
||||
{
|
||||
|
@ -1407,3 +1407,42 @@ out:
|
|||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else /* HAVE_ZPL */
|
||||
|
||||
void
|
||||
remove_mountpoint(zfs_handle_t *zhp) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean_t
|
||||
is_mounted(libzfs_handle_t *zfs_hdl, const char *special, char **where)
|
||||
{
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
boolean_t
|
||||
zfs_is_mounted(zfs_handle_t *zhp, char **where)
|
||||
{
|
||||
return is_mounted(zhp->zfs_hdl, zfs_get_name(zhp), where);
|
||||
}
|
||||
|
||||
boolean_t
|
||||
zfs_is_shared(zfs_handle_t *zhp)
|
||||
{
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
|
||||
{
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
|
||||
{
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
#endif /* HAVE_ZPL */
|
||||
|
|
|
@ -1930,6 +1930,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
|||
* created). Also mount any children of the target filesystem
|
||||
* if we did an incremental receive.
|
||||
*/
|
||||
#ifdef HAVE_ZPL
|
||||
cp = strchr(zc.zc_value, '@');
|
||||
if (cp && (ioctl_err == 0 || !newfs)) {
|
||||
zfs_handle_t *h;
|
||||
|
@ -1956,6 +1957,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
|||
}
|
||||
*cp = '@';
|
||||
}
|
||||
#endif /* HAVE_ZPL */
|
||||
|
||||
if (clp) {
|
||||
err |= changelist_postfix(clp);
|
||||
|
|
|
@ -587,7 +587,9 @@ libzfs_fini(libzfs_handle_t *hdl)
|
|||
(void) fclose(hdl->libzfs_mnttab);
|
||||
if (hdl->libzfs_sharetab)
|
||||
(void) fclose(hdl->libzfs_sharetab);
|
||||
#ifdef HAVE_ZPL
|
||||
zfs_uninit_libshare(hdl);
|
||||
#endif
|
||||
if (hdl->libzfs_log_str)
|
||||
(void) free(hdl->libzfs_log_str);
|
||||
zpool_free_handles(hdl);
|
||||
|
|
|
@ -1638,6 +1638,7 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
|
|||
return (error);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZPL
|
||||
static vfsdef_t vfw = {
|
||||
VFSDEF_VERSION,
|
||||
MNTTYPE_ZFS,
|
||||
|
@ -1650,3 +1651,4 @@ static vfsdef_t vfw = {
|
|||
struct modlfs zfs_modlfs = {
|
||||
&mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw
|
||||
};
|
||||
#endif /* HAVE_ZPL */
|
||||
|
|
Loading…
Reference in New Issue