OpenZFS restructuring - libspl
Factor Linux specific pieces out of libspl. Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Reviewed-by: Sean Eric Fagan <sef@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9336
This commit is contained in:
parent
6360e2779e
commit
d31277abb1
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Ignore the prefix for the mount helper. It must be installed in /sbin/
|
# Ignore the prefix for the mount helper. It must be installed in /sbin/
|
||||||
# because this path is hardcoded in the mount(8) for security reasons.
|
# because this path is hardcoded in the mount(8) for security reasons.
|
||||||
|
|
|
@ -6,10 +6,6 @@ AM_CFLAGS += $(FRAME_LARGER_THAN)
|
||||||
# Unconditionally enable ASSERTs
|
# Unconditionally enable ASSERTs
|
||||||
AM_CPPFLAGS += -DDEBUG -UNDEBUG
|
AM_CPPFLAGS += -DDEBUG -UNDEBUG
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
bin_PROGRAMS = raidz_test
|
bin_PROGRAMS = raidz_test
|
||||||
|
|
||||||
raidz_test_SOURCES = \
|
raidz_test_SOURCES = \
|
||||||
|
|
|
@ -3,10 +3,6 @@ include $(top_srcdir)/config/Rules.am
|
||||||
# Unconditionally enable debugging for zdb
|
# Unconditionally enable debugging for zdb
|
||||||
AM_CPPFLAGS += -DDEBUG -UNDEBUG
|
AM_CPPFLAGS += -DDEBUG -UNDEBUG
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zdb
|
sbin_PROGRAMS = zdb
|
||||||
|
|
||||||
zdb_SOURCES = \
|
zdb_SOURCES = \
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
SUBDIRS = zed.d
|
|
||||||
|
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
SUBDIRS = zed.d
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zed
|
sbin_PROGRAMS = zed
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <devid.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <libnvpair.h>
|
#include <libnvpair.h>
|
||||||
#include <libzfs.h>
|
#include <libzfs.h>
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zfs
|
sbin_PROGRAMS = zfs
|
||||||
|
|
||||||
zfs_SOURCES = \
|
zfs_SOURCES = \
|
||||||
|
|
|
@ -6969,18 +6969,6 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
|
||||||
const char *cmdname = (op == OP_SHARE) ? "unshare" : "unmount";
|
const char *cmdname = (op == OP_SHARE) ? "unshare" : "unmount";
|
||||||
ino_t path_inode;
|
ino_t path_inode;
|
||||||
|
|
||||||
/*
|
|
||||||
* Search for the path in /proc/self/mounts. Rather than looking for the
|
|
||||||
* specific path, which can be fooled by non-standard paths (i.e. ".."
|
|
||||||
* or "//"), we stat() the path and search for the corresponding
|
|
||||||
* (major,minor) device pair.
|
|
||||||
*/
|
|
||||||
if (stat64(path, &statbuf) != 0) {
|
|
||||||
(void) fprintf(stderr, gettext("cannot %s '%s': %s\n"),
|
|
||||||
cmdname, path, strerror(errno));
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
path_inode = statbuf.st_ino;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search for the given (major,minor) pair in the mount table.
|
* Search for the given (major,minor) pair in the mount table.
|
||||||
|
@ -6990,12 +6978,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
|
||||||
if (freopen(MNTTAB, "r", mnttab_file) == NULL)
|
if (freopen(MNTTAB, "r", mnttab_file) == NULL)
|
||||||
return (ENOENT);
|
return (ENOENT);
|
||||||
|
|
||||||
while ((ret = getextmntent(mnttab_file, &entry, 0)) == 0) {
|
if (getextmntent(path, &entry, &statbuf) != 0) {
|
||||||
if (entry.mnt_major == major(statbuf.st_dev) &&
|
|
||||||
entry.mnt_minor == minor(statbuf.st_dev))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ret != 0) {
|
|
||||||
if (op == OP_SHARE) {
|
if (op == OP_SHARE) {
|
||||||
(void) fprintf(stderr, gettext("cannot %s '%s': not "
|
(void) fprintf(stderr, gettext("cannot %s '%s': not "
|
||||||
"currently mounted\n"), cmdname, path);
|
"currently mounted\n"), cmdname, path);
|
||||||
|
@ -7008,6 +6991,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return (ret != 0);
|
return (ret != 0);
|
||||||
}
|
}
|
||||||
|
path_inode = statbuf.st_ino;
|
||||||
|
|
||||||
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) {
|
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) {
|
||||||
(void) fprintf(stderr, gettext("cannot %s '%s': not a ZFS "
|
(void) fprintf(stderr, gettext("cannot %s '%s': not a ZFS "
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zhack
|
sbin_PROGRAMS = zhack
|
||||||
|
|
||||||
zhack_SOURCES = \
|
zhack_SOURCES = \
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zinject
|
sbin_PROGRAMS = zinject
|
||||||
|
|
||||||
zinject_SOURCES = \
|
zinject_SOURCES = \
|
||||||
|
|
|
@ -85,8 +85,6 @@ parse_pathname(const char *inpath, char *dataset, char *relpath,
|
||||||
struct stat64 *statbuf)
|
struct stat64 *statbuf)
|
||||||
{
|
{
|
||||||
struct extmnttab mp;
|
struct extmnttab mp;
|
||||||
FILE *fp;
|
|
||||||
int match;
|
|
||||||
const char *rel;
|
const char *rel;
|
||||||
char fullpath[MAXPATHLEN];
|
char fullpath[MAXPATHLEN];
|
||||||
|
|
||||||
|
@ -99,35 +97,7 @@ parse_pathname(const char *inpath, char *dataset, char *relpath,
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(fullpath) >= MAXPATHLEN) {
|
if (getextmntent(fullpath, &mp, statbuf) != 0) {
|
||||||
(void) fprintf(stderr, "invalid object; pathname too long\n");
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat64(fullpath, statbuf) != 0) {
|
|
||||||
(void) fprintf(stderr, "cannot open '%s': %s\n",
|
|
||||||
fullpath, strerror(errno));
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_SETMNTENT
|
|
||||||
if ((fp = setmntent(MNTTAB, "r")) == NULL) {
|
|
||||||
#else
|
|
||||||
if ((fp = fopen(MNTTAB, "r")) == NULL) {
|
|
||||||
#endif
|
|
||||||
(void) fprintf(stderr, "cannot open %s\n", MNTTAB);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
match = 0;
|
|
||||||
while (getextmntent(fp, &mp, sizeof (mp)) == 0) {
|
|
||||||
if (makedev(mp.mnt_major, mp.mnt_minor) == statbuf->st_dev) {
|
|
||||||
match = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
(void) fprintf(stderr, "cannot find mountpoint for '%s'\n",
|
(void) fprintf(stderr, "cannot find mountpoint for '%s'\n",
|
||||||
fullpath);
|
fullpath);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
DEFAULT_INCLUDES += -I.
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zpool
|
sbin_PROGRAMS = zpool
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <devid.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <devid.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = zstreamdump
|
sbin_PROGRAMS = zstreamdump
|
||||||
|
|
||||||
zstreamdump_SOURCES = \
|
zstreamdump_SOURCES = \
|
||||||
|
|
|
@ -9,10 +9,6 @@ AM_CFLAGS += $(FRAME_LARGER_THAN)
|
||||||
# Unconditionally enable ASSERTs
|
# Unconditionally enable ASSERTs
|
||||||
AM_CPPFLAGS += -DDEBUG -UNDEBUG
|
AM_CPPFLAGS += -DDEBUG -UNDEBUG
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
sbin_PROGRAMS = ztest
|
sbin_PROGRAMS = ztest
|
||||||
|
|
||||||
ztest_SOURCES = \
|
ztest_SOURCES = \
|
||||||
|
|
|
@ -4,10 +4,6 @@ include $(top_srcdir)/config/Rules.am
|
||||||
# removed once https://github.com/zfsonlinux/zfs/issues/569 is resolved.
|
# removed once https://github.com/zfsonlinux/zfs/issues/569 is resolved.
|
||||||
AM_CFLAGS += -fno-stack-protector
|
AM_CFLAGS += -fno-stack-protector
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
udev_PROGRAMS = zvol_id
|
udev_PROGRAMS = zvol_id
|
||||||
|
|
||||||
zvol_id_SOURCES = \
|
zvol_id_SOURCES = \
|
||||||
|
|
|
@ -3,7 +3,16 @@
|
||||||
# should include these rules and override or extend them as needed.
|
# should include these rules and override or extend them as needed.
|
||||||
#
|
#
|
||||||
|
|
||||||
DEFAULT_INCLUDES = -include ${top_builddir}/zfs_config.h
|
DEFAULT_INCLUDES = \
|
||||||
|
-include ${top_builddir}/zfs_config.h \
|
||||||
|
-I$(top_srcdir)/include \
|
||||||
|
-I$(top_srcdir)/module/icp/include \
|
||||||
|
-I$(top_srcdir)/lib/libspl/include
|
||||||
|
|
||||||
|
if BUILD_LINUX
|
||||||
|
DEFAULT_INCLUDES += \
|
||||||
|
-I$(top_srcdir)/lib/libspl/include/os/linux
|
||||||
|
endif
|
||||||
|
|
||||||
AM_LIBTOOLFLAGS = --silent
|
AM_LIBTOOLFLAGS = --silent
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,9 @@ AC_CONFIG_FILES([
|
||||||
lib/libspl/include/Makefile
|
lib/libspl/include/Makefile
|
||||||
lib/libspl/include/ia32/Makefile
|
lib/libspl/include/ia32/Makefile
|
||||||
lib/libspl/include/ia32/sys/Makefile
|
lib/libspl/include/ia32/sys/Makefile
|
||||||
|
lib/libspl/include/os/Makefile
|
||||||
|
lib/libspl/include/os/linux/Makefile
|
||||||
|
lib/libspl/include/os/linux/sys/Makefile
|
||||||
lib/libspl/include/rpc/Makefile
|
lib/libspl/include/rpc/Makefile
|
||||||
lib/libspl/include/sys/Makefile
|
lib/libspl/include/sys/Makefile
|
||||||
lib/libspl/include/sys/dktp/Makefile
|
lib/libspl/include/sys/dktp/Makefile
|
||||||
|
|
|
@ -5,10 +5,6 @@ VPATH = $(top_srcdir)/module/avl/
|
||||||
# Includes kernel code, generate warnings for large stack frames
|
# Includes kernel code, generate warnings for large stack frames
|
||||||
AM_CFLAGS += $(FRAME_LARGER_THAN)
|
AM_CFLAGS += $(FRAME_LARGER_THAN)
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libavl.la
|
noinst_LTLIBRARIES = libavl.la
|
||||||
|
|
||||||
USER_C =
|
USER_C =
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libefi.la
|
noinst_LTLIBRARIES = libefi.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -7,11 +7,6 @@ VPATH = \
|
||||||
# Includes kernel code, generate warnings for large stack frames
|
# Includes kernel code, generate warnings for large stack frames
|
||||||
AM_CFLAGS += $(FRAME_LARGER_THAN)
|
AM_CFLAGS += $(FRAME_LARGER_THAN)
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/module/icp/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libicp.la
|
noinst_LTLIBRARIES = libicp.la
|
||||||
|
|
||||||
if TARGET_ASM_X86_64
|
if TARGET_ASM_X86_64
|
||||||
|
|
|
@ -8,10 +8,6 @@ VPATH = \
|
||||||
# and required CFLAGS for libtirpc
|
# and required CFLAGS for libtirpc
|
||||||
AM_CFLAGS += $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS)
|
AM_CFLAGS += $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS)
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libnvpair.la
|
lib_LTLIBRARIES = libnvpair.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libshare.la
|
noinst_LTLIBRARIES = libshare.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -7,9 +7,6 @@ VPATH = \
|
||||||
SUBDIRS = include $(TARGET_ASM_DIR)
|
SUBDIRS = include $(TARGET_ASM_DIR)
|
||||||
DIST_SUBDIRS = include asm-generic asm-i386 asm-x86_64
|
DIST_SUBDIRS = include asm-generic asm-i386 asm-x86_64
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
AM_CFLAGS += $(LIBTIRPC_CFLAGS)
|
AM_CFLAGS += $(LIBTIRPC_CFLAGS)
|
||||||
|
|
||||||
AM_CCASFLAGS = \
|
AM_CCASFLAGS = \
|
||||||
|
@ -18,9 +15,6 @@ AM_CCASFLAGS = \
|
||||||
noinst_LTLIBRARIES = libspl.la
|
noinst_LTLIBRARIES = libspl.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
getexecname.c \
|
|
||||||
gethostid.c \
|
|
||||||
getmntany.c \
|
|
||||||
list.c \
|
list.c \
|
||||||
mkdirp.c \
|
mkdirp.c \
|
||||||
page.c \
|
page.c \
|
||||||
|
@ -31,6 +25,13 @@ USER_C = \
|
||||||
include/sys/list.h \
|
include/sys/list.h \
|
||||||
include/sys/list_impl.h
|
include/sys/list_impl.h
|
||||||
|
|
||||||
|
if BUILD_LINUX
|
||||||
|
USER_C += \
|
||||||
|
os/linux/getexecname.c \
|
||||||
|
os/linux/gethostid.c \
|
||||||
|
os/linux/getmntany.c
|
||||||
|
endif
|
||||||
|
|
||||||
USER_ASM = atomic.S
|
USER_ASM = atomic.S
|
||||||
|
|
||||||
nodist_libspl_la_SOURCES = \
|
nodist_libspl_la_SOURCES = \
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
atomic_SOURCE = atomic.c
|
atomic_SOURCE = atomic.c
|
||||||
atomic_ASM = atomic.S
|
atomic_ASM = atomic.S
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
SUBDIRS = ia32 rpc sys util
|
SUBDIRS = ia32 rpc sys util os
|
||||||
|
|
||||||
libspldir = $(includedir)/libspl
|
libspldir = $(includedir)/libspl
|
||||||
libspl_HEADERS = \
|
libspl_HEADERS = \
|
||||||
$(top_srcdir)/lib/libspl/include/assert.h \
|
$(top_srcdir)/lib/libspl/include/assert.h \
|
||||||
$(top_srcdir)/lib/libspl/include/atomic.h \
|
$(top_srcdir)/lib/libspl/include/atomic.h \
|
||||||
$(top_srcdir)/lib/libspl/include/devid.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/libdevinfo.h \
|
$(top_srcdir)/lib/libspl/include/libdevinfo.h \
|
||||||
$(top_srcdir)/lib/libspl/include/libgen.h \
|
$(top_srcdir)/lib/libspl/include/libgen.h \
|
||||||
$(top_srcdir)/lib/libspl/include/libshare.h \
|
$(top_srcdir)/lib/libspl/include/libshare.h \
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* CDDL HEADER START
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the terms of the
|
|
||||||
* Common Development and Distribution License, Version 1.0 only
|
|
||||||
* (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 http://www.opensolaris.org/os/licensing.
|
|
||||||
* 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 2006 Sun Microsystems, Inc. All rights reserved.
|
|
||||||
* Use is subject to license terms.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LIBSPL_DEVID_H
|
|
||||||
#define _LIBSPL_DEVID_H
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
if BUILD_LINUX
|
||||||
|
SUBDIRS = linux
|
||||||
|
endif
|
|
@ -0,0 +1 @@
|
||||||
|
SUBDIRS = sys
|
|
@ -0,0 +1,10 @@
|
||||||
|
libspldir = $(includedir)/libspl/sys
|
||||||
|
libspl_HEADERS = \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/byteorder.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/file.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/mnttab.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/mount.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/param.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/stat.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/sysmacros.h \
|
||||||
|
$(top_srcdir)/lib/libspl/include/os/linux/sys/uio.h
|
|
@ -67,10 +67,13 @@ struct extmnttab {
|
||||||
uint_t mnt_minor;
|
uint_t mnt_minor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct stat64;
|
||||||
|
struct statfs;
|
||||||
|
|
||||||
extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);
|
extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);
|
||||||
extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
|
extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
|
||||||
extern int getextmntent(FILE *fp, struct extmnttab *mp, int len);
|
extern int getextmntent(const char *path, struct extmnttab *mp,
|
||||||
|
struct stat64 *statbuf);
|
||||||
static inline char *_sol_hasmntopt(struct mnttab *mnt, char *opt)
|
static inline char *_sol_hasmntopt(struct mnttab *mnt, char *opt)
|
||||||
{
|
{
|
||||||
struct mntent mnt_new;
|
struct mntent mnt_new;
|
|
@ -40,8 +40,10 @@
|
||||||
#ifndef _LIBSPL_SYS_UIO_H
|
#ifndef _LIBSPL_SYS_UIO_H
|
||||||
#define _LIBSPL_SYS_UIO_H
|
#define _LIBSPL_SYS_UIO_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
#include_next <sys/uio.h>
|
#include_next <sys/uio.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
typedef struct iovec iovec_t;
|
typedef struct iovec iovec_t;
|
||||||
|
|
||||||
typedef enum uio_rw {
|
typedef enum uio_rw {
|
||||||
|
@ -58,11 +60,11 @@ typedef enum uio_seg {
|
||||||
typedef struct uio {
|
typedef struct uio {
|
||||||
struct iovec *uio_iov; /* pointer to array of iovecs */
|
struct iovec *uio_iov; /* pointer to array of iovecs */
|
||||||
int uio_iovcnt; /* number of iovecs */
|
int uio_iovcnt; /* number of iovecs */
|
||||||
offset_t uio_loffset; /* file offset */
|
loff_t uio_loffset; /* file offset */
|
||||||
uio_seg_t uio_segflg; /* address space (kernel or user) */
|
uio_seg_t uio_segflg; /* address space (kernel or user) */
|
||||||
uint16_t uio_fmode; /* file mode flags */
|
uint16_t uio_fmode; /* file mode flags */
|
||||||
uint16_t uio_extflg; /* extended flags */
|
uint16_t uio_extflg; /* extended flags */
|
||||||
offset_t uio_limit; /* u-limit (maximum byte offset) */
|
loff_t uio_limit; /* u-limit (maximum byte offset) */
|
||||||
ssize_t uio_resid; /* residual count */
|
ssize_t uio_resid; /* residual count */
|
||||||
} uio_t;
|
} uio_t;
|
||||||
|
|
|
@ -5,7 +5,6 @@ libspl_HEADERS = \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/acl.h \
|
$(top_srcdir)/lib/libspl/include/sys/acl.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/acl_impl.h \
|
$(top_srcdir)/lib/libspl/include/sys/acl_impl.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/bitmap.h \
|
$(top_srcdir)/lib/libspl/include/sys/bitmap.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/byteorder.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/callb.h \
|
$(top_srcdir)/lib/libspl/include/sys/callb.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/cmn_err.h \
|
$(top_srcdir)/lib/libspl/include/sys/cmn_err.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/cred.h \
|
$(top_srcdir)/lib/libspl/include/sys/cred.h \
|
||||||
|
@ -14,7 +13,6 @@ libspl_HEADERS = \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/dklabel.h \
|
$(top_srcdir)/lib/libspl/include/sys/dklabel.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/errno.h \
|
$(top_srcdir)/lib/libspl/include/sys/errno.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/feature_tests.h \
|
$(top_srcdir)/lib/libspl/include/sys/feature_tests.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/file.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/int_limits.h \
|
$(top_srcdir)/lib/libspl/include/sys/int_limits.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/int_types.h \
|
$(top_srcdir)/lib/libspl/include/sys/int_types.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/inttypes.h \
|
$(top_srcdir)/lib/libspl/include/sys/inttypes.h \
|
||||||
|
@ -25,29 +23,22 @@ libspl_HEADERS = \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/list_impl.h \
|
$(top_srcdir)/lib/libspl/include/sys/list_impl.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/mhd.h \
|
$(top_srcdir)/lib/libspl/include/sys/mhd.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/mkdev.h \
|
$(top_srcdir)/lib/libspl/include/sys/mkdev.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/mnttab.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/mount.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/param.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/policy.h \
|
$(top_srcdir)/lib/libspl/include/sys/policy.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/poll.h \
|
$(top_srcdir)/lib/libspl/include/sys/poll.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/priv.h \
|
$(top_srcdir)/lib/libspl/include/sys/priv.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/processor.h \
|
$(top_srcdir)/lib/libspl/include/sys/processor.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/signal.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/simd.h \
|
$(top_srcdir)/lib/libspl/include/sys/simd.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/stack.h \
|
$(top_srcdir)/lib/libspl/include/sys/stack.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/stat.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/stdtypes.h \
|
$(top_srcdir)/lib/libspl/include/sys/stdtypes.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/strings.h \
|
$(top_srcdir)/lib/libspl/include/sys/strings.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/stropts.h \
|
$(top_srcdir)/lib/libspl/include/sys/stropts.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/sunddi.h \
|
$(top_srcdir)/lib/libspl/include/sys/sunddi.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/sysmacros.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/systeminfo.h \
|
$(top_srcdir)/lib/libspl/include/sys/systeminfo.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/time.h \
|
$(top_srcdir)/lib/libspl/include/sys/time.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/trace_defs.h \
|
$(top_srcdir)/lib/libspl/include/sys/trace_defs.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/types32.h \
|
$(top_srcdir)/lib/libspl/include/sys/types32.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/types.h \
|
$(top_srcdir)/lib/libspl/include/sys/types.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/tzfile.h \
|
$(top_srcdir)/lib/libspl/include/sys/tzfile.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/uio.h \
|
|
||||||
$(top_srcdir)/lib/libspl/include/sys/va_list.h \
|
$(top_srcdir)/lib/libspl/include/sys/va_list.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/varargs.h \
|
$(top_srcdir)/lib/libspl/include/sys/varargs.h \
|
||||||
$(top_srcdir)/lib/libspl/include/sys/vnode.h \
|
$(top_srcdir)/lib/libspl/include/sys/vnode.h \
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
|
#include <sys/errno.h>
|
||||||
#include <sys/mnttab.h>
|
#include <sys/mnttab.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -81,8 +82,8 @@ _sol_getmntent(FILE *fp, struct mnttab *mgetp)
|
||||||
return (MNT_TOOLONG);
|
return (MNT_TOOLONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
getextmntent(FILE *fp, struct extmnttab *mp, int len)
|
getextmntent_impl(FILE *fp, struct extmnttab *mp, int len)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
|
@ -100,3 +101,65 @@ getextmntent(FILE *fp, struct extmnttab *mp, int len)
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
||||||
|
{
|
||||||
|
struct stat64 st;
|
||||||
|
FILE *fp;
|
||||||
|
int match;
|
||||||
|
|
||||||
|
if (strlen(path) >= MAXPATHLEN) {
|
||||||
|
(void) fprintf(stderr, "invalid object; pathname too long\n");
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search for the path in /proc/self/mounts. Rather than looking for the
|
||||||
|
* specific path, which can be fooled by non-standard paths (i.e. ".."
|
||||||
|
* or "//"), we stat() the path and search for the corresponding
|
||||||
|
* (major,minor) device pair.
|
||||||
|
*/
|
||||||
|
if (stat64(path, statbuf) != 0) {
|
||||||
|
(void) fprintf(stderr, "cannot open '%s': %s\n",
|
||||||
|
path, strerror(errno));
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_SETMNTENT
|
||||||
|
if ((fp = setmntent(MNTTAB, "r")) == NULL) {
|
||||||
|
#else
|
||||||
|
if ((fp = fopen(MNTTAB, "r")) == NULL) {
|
||||||
|
#endif
|
||||||
|
(void) fprintf(stderr, "cannot open %s\n", MNTTAB);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search for the given (major,minor) pair in the mount table.
|
||||||
|
*/
|
||||||
|
|
||||||
|
match = 0;
|
||||||
|
while (getextmntent_impl(fp, entry, sizeof (*entry)) == 0) {
|
||||||
|
if (makedev(entry->mnt_major, entry->mnt_minor) ==
|
||||||
|
statbuf->st_dev) {
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!match) {
|
||||||
|
(void) fprintf(stderr, "cannot find mountpoint for '%s'\n",
|
||||||
|
path);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stat64(entry->mnt_mountp, &st) != 0) {
|
||||||
|
entry->mnt_major = 0;
|
||||||
|
entry->mnt_minor = 0;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libtpool.la
|
noinst_LTLIBRARIES = libtpool.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -5,10 +5,6 @@ VPATH = $(top_srcdir)/module/unicode
|
||||||
# Includes kernel code, generate warnings for large stack frames
|
# Includes kernel code, generate warnings for large stack frames
|
||||||
AM_CFLAGS += $(FRAME_LARGER_THAN)
|
AM_CFLAGS += $(FRAME_LARGER_THAN)
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libunicode.la
|
noinst_LTLIBRARIES = libunicode.la
|
||||||
|
|
||||||
USER_C =
|
USER_C =
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libuutil.la
|
lib_LTLIBRARIES = libuutil.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -11,11 +11,6 @@ AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
|
||||||
libzfs_pcdir = $(datarootdir)/pkgconfig
|
libzfs_pcdir = $(datarootdir)/pkgconfig
|
||||||
libzfs_pc_DATA = libzfs.pc libzfs_core.pc
|
libzfs_pc_DATA = libzfs.pc libzfs_core.pc
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/module/icp/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libzfs.la
|
lib_LTLIBRARIES = libzfs.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
* Copyright (c) 2016, Intel Corporation.
|
* Copyright (c) 2016, Intel Corporation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <devid.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <devid.h>
|
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -3884,86 +3883,6 @@ zpool_sync_one(zpool_handle_t *zhp, void *data)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
/*
|
|
||||||
* Convert from a devid string to a path.
|
|
||||||
*/
|
|
||||||
static char *
|
|
||||||
devid_to_path(char *devid_str)
|
|
||||||
{
|
|
||||||
ddi_devid_t devid;
|
|
||||||
char *minor;
|
|
||||||
char *path;
|
|
||||||
devid_nmlist_t *list = NULL;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (devid_str_decode(devid_str, &devid, &minor) != 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
ret = devid_deviceid_to_nmlist("/dev", devid, minor, &list);
|
|
||||||
|
|
||||||
devid_str_free(minor);
|
|
||||||
devid_free(devid);
|
|
||||||
|
|
||||||
if (ret != 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In a case the strdup() fails, we will just return NULL below.
|
|
||||||
*/
|
|
||||||
path = strdup(list[0].devname);
|
|
||||||
|
|
||||||
devid_free_nmlist(list);
|
|
||||||
|
|
||||||
return (path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert from a path to a devid string.
|
|
||||||
*/
|
|
||||||
static char *
|
|
||||||
path_to_devid(const char *path)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
ddi_devid_t devid;
|
|
||||||
char *minor, *ret;
|
|
||||||
|
|
||||||
if ((fd = open(path, O_RDONLY)) < 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
minor = NULL;
|
|
||||||
ret = NULL;
|
|
||||||
if (devid_get(fd, &devid) == 0) {
|
|
||||||
if (devid_get_minor_name(fd, &minor) == 0)
|
|
||||||
ret = devid_str_encode(devid, minor);
|
|
||||||
if (minor != NULL)
|
|
||||||
devid_str_free(minor);
|
|
||||||
devid_free(devid);
|
|
||||||
}
|
|
||||||
(void) close(fd);
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Issue the necessary ioctl() to update the stored path value for the vdev. We
|
|
||||||
* ignore any failure here, since a common case is for an unprivileged user to
|
|
||||||
* type 'zpool status', and we'll display the correct information anyway.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
set_path(zpool_handle_t *zhp, nvlist_t *nv, const char *path)
|
|
||||||
{
|
|
||||||
zfs_cmd_t zc = {"\0"};
|
|
||||||
|
|
||||||
(void) strncpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
|
||||||
(void) strncpy(zc.zc_value, path, sizeof (zc.zc_value));
|
|
||||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID,
|
|
||||||
&zc.zc_guid) == 0);
|
|
||||||
|
|
||||||
(void) ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_VDEV_SETPATH, &zc);
|
|
||||||
}
|
|
||||||
#endif /* sun */
|
|
||||||
|
|
||||||
#define PATH_BUF_LEN 64
|
#define PATH_BUF_LEN 64
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4019,54 +3938,6 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||||
(void) snprintf(buf, sizeof (buf), "%llu", (u_longlong_t)value);
|
(void) snprintf(buf, sizeof (buf), "%llu", (u_longlong_t)value);
|
||||||
path = buf;
|
path = buf;
|
||||||
} else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) {
|
} else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) {
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
/*
|
|
||||||
* Live VDEV path updates to a kernel VDEV during a
|
|
||||||
* zpool_vdev_name lookup are not supported on Linux.
|
|
||||||
*/
|
|
||||||
char *devid;
|
|
||||||
vdev_stat_t *vs;
|
|
||||||
uint_t vsc;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the device is dead (faulted, offline, etc) then don't
|
|
||||||
* bother opening it. Otherwise we may be forcing the user to
|
|
||||||
* open a misbehaving device, which can have undesirable
|
|
||||||
* effects.
|
|
||||||
*/
|
|
||||||
if ((nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
|
|
||||||
(uint64_t **)&vs, &vsc) != 0 ||
|
|
||||||
vs->vs_state >= VDEV_STATE_DEGRADED) &&
|
|
||||||
zhp != NULL &&
|
|
||||||
nvlist_lookup_string(nv, ZPOOL_CONFIG_DEVID, &devid) == 0) {
|
|
||||||
/*
|
|
||||||
* Determine if the current path is correct.
|
|
||||||
*/
|
|
||||||
char *newdevid = path_to_devid(path);
|
|
||||||
|
|
||||||
if (newdevid == NULL ||
|
|
||||||
strcmp(devid, newdevid) != 0) {
|
|
||||||
char *newpath;
|
|
||||||
|
|
||||||
if ((newpath = devid_to_path(devid)) != NULL) {
|
|
||||||
/*
|
|
||||||
* Update the path appropriately.
|
|
||||||
*/
|
|
||||||
set_path(zhp, nv, newpath);
|
|
||||||
if (nvlist_add_string(nv,
|
|
||||||
ZPOOL_CONFIG_PATH, newpath) == 0)
|
|
||||||
verify(nvlist_lookup_string(nv,
|
|
||||||
ZPOOL_CONFIG_PATH,
|
|
||||||
&path) == 0);
|
|
||||||
free(newpath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newdevid)
|
|
||||||
devid_str_free(newdevid);
|
|
||||||
}
|
|
||||||
#endif /* sun */
|
|
||||||
|
|
||||||
if (name_flags & VDEV_NAME_FOLLOW_LINKS) {
|
if (name_flags & VDEV_NAME_FOLLOW_LINKS) {
|
||||||
char *rp = realpath(path, NULL);
|
char *rp = realpath(path, NULL);
|
||||||
if (rp) {
|
if (rp) {
|
||||||
|
|
|
@ -1095,7 +1095,6 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype)
|
||||||
{
|
{
|
||||||
struct stat64 statbuf;
|
struct stat64 statbuf;
|
||||||
struct extmnttab entry;
|
struct extmnttab entry;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (path[0] != '/' && strncmp(path, "./", strlen("./")) != 0) {
|
if (path[0] != '/' && strncmp(path, "./", strlen("./")) != 0) {
|
||||||
/*
|
/*
|
||||||
|
@ -1104,24 +1103,12 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype)
|
||||||
return (zfs_open(hdl, path, argtype));
|
return (zfs_open(hdl, path, argtype));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat64(path, &statbuf) != 0) {
|
|
||||||
(void) fprintf(stderr, "%s: %s\n", path, strerror(errno));
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||||
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
while ((ret = getextmntent(hdl->libzfs_mnttab, &entry, 0)) == 0) {
|
if (getextmntent(path, &entry, &statbuf) != 0)
|
||||||
if (makedevice(entry.mnt_major, entry.mnt_minor) ==
|
|
||||||
statbuf.st_dev) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret != 0) {
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) {
|
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) {
|
||||||
(void) fprintf(stderr, gettext("'%s': not a ZFS filesystem\n"),
|
(void) fprintf(stderr, gettext("'%s': not a ZFS filesystem\n"),
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libzfs_core.la
|
lib_LTLIBRARIES = libzfs_core.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -15,10 +15,6 @@ AM_CFLAGS += $(FRAME_LARGER_THAN)
|
||||||
|
|
||||||
AM_CFLAGS += -DLIB_ZPOOL_BUILD
|
AM_CFLAGS += -DLIB_ZPOOL_BUILD
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libzpool.la
|
lib_LTLIBRARIES = libzpool.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -504,60 +504,16 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
|
||||||
int dump_fd = -1;
|
int dump_fd = -1;
|
||||||
vnode_t *vp;
|
vnode_t *vp;
|
||||||
int old_umask = 0;
|
int old_umask = 0;
|
||||||
char *realpath;
|
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
realpath = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
if (!(flags & FCREAT) && stat64(path, &st) == -1) {
|
||||||
|
err = errno;
|
||||||
/*
|
return (err);
|
||||||
* If we're accessing a real disk from userland, we need to use
|
|
||||||
* the character interface to avoid caching. This is particularly
|
|
||||||
* important if we're trying to look at a real in-kernel storage
|
|
||||||
* pool from userland, e.g. via zdb, because otherwise we won't
|
|
||||||
* see the changes occurring under the segmap cache.
|
|
||||||
* On the other hand, the stupid character device returns zero
|
|
||||||
* for its size. So -- gag -- we open the block device to get
|
|
||||||
* its size, and remember it for subsequent VOP_GETATTR().
|
|
||||||
*/
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
if (strncmp(path, "/dev/", 5) == 0) {
|
|
||||||
#else
|
|
||||||
if (0) {
|
|
||||||
#endif
|
|
||||||
char *dsk;
|
|
||||||
fd = open64(path, O_RDONLY);
|
|
||||||
if (fd == -1) {
|
|
||||||
err = errno;
|
|
||||||
free(realpath);
|
|
||||||
return (err);
|
|
||||||
}
|
|
||||||
if (fstat64(fd, &st) == -1) {
|
|
||||||
err = errno;
|
|
||||||
close(fd);
|
|
||||||
free(realpath);
|
|
||||||
return (err);
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
(void) sprintf(realpath, "%s", path);
|
|
||||||
dsk = strstr(path, "/dsk/");
|
|
||||||
if (dsk != NULL)
|
|
||||||
(void) sprintf(realpath + (dsk - path) + 1, "r%s",
|
|
||||||
dsk + 1);
|
|
||||||
} else {
|
|
||||||
(void) sprintf(realpath, "%s", path);
|
|
||||||
if (!(flags & FCREAT) && stat64(realpath, &st) == -1) {
|
|
||||||
err = errno;
|
|
||||||
free(realpath);
|
|
||||||
return (err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & FCREAT) && S_ISBLK(st.st_mode)) {
|
if (!(flags & FCREAT) && S_ISBLK(st.st_mode))
|
||||||
#ifdef __linux__
|
|
||||||
flags |= O_DIRECT;
|
flags |= O_DIRECT;
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & FCREAT)
|
if (flags & FCREAT)
|
||||||
old_umask = umask(0);
|
old_umask = umask(0);
|
||||||
|
@ -566,10 +522,9 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
|
||||||
* The construct 'flags - FREAD' conveniently maps combinations of
|
* The construct 'flags - FREAD' conveniently maps combinations of
|
||||||
* FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR.
|
* FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR.
|
||||||
*/
|
*/
|
||||||
fd = open64(realpath, flags - FREAD, mode);
|
fd = open64(path, flags - FREAD, mode);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
err = errno;
|
err = errno;
|
||||||
free(realpath);
|
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,12 +534,11 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
|
||||||
if (vn_dumpdir != NULL) {
|
if (vn_dumpdir != NULL) {
|
||||||
char *dumppath = umem_zalloc(MAXPATHLEN, UMEM_NOFAIL);
|
char *dumppath = umem_zalloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
(void) snprintf(dumppath, MAXPATHLEN,
|
(void) snprintf(dumppath, MAXPATHLEN,
|
||||||
"%s/%s", vn_dumpdir, basename(realpath));
|
"%s/%s", vn_dumpdir, basename(path));
|
||||||
dump_fd = open64(dumppath, O_CREAT | O_WRONLY, 0666);
|
dump_fd = open64(dumppath, O_CREAT | O_WRONLY, 0666);
|
||||||
umem_free(dumppath, MAXPATHLEN);
|
umem_free(dumppath, MAXPATHLEN);
|
||||||
if (dump_fd == -1) {
|
if (dump_fd == -1) {
|
||||||
err = errno;
|
err = errno;
|
||||||
free(realpath);
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
@ -592,8 +546,6 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
|
||||||
dump_fd = -1;
|
dump_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(realpath);
|
|
||||||
|
|
||||||
if (fstat64_blk(fd, &st) == -1) {
|
if (fstat64_blk(fd, &st) == -1) {
|
||||||
err = errno;
|
err = errno;
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
@ -3,10 +3,6 @@ include $(top_srcdir)/config/Rules.am
|
||||||
# Suppress unused but set variable warnings often due to ASSERTs
|
# Suppress unused but set variable warnings often due to ASSERTs
|
||||||
AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
|
AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE)
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libzutil.la
|
noinst_LTLIBRARIES = libzutil.la
|
||||||
|
|
||||||
USER_C = \
|
USER_C = \
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <devid.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
|
@ -34,10 +34,6 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef unsigned char uchar_t;
|
|
||||||
typedef long long longlong_t;
|
|
||||||
typedef longlong_t offset_t;
|
|
||||||
|
|
||||||
static unsigned char bigbuffer[BIGBUFFERSIZE];
|
static unsigned char bigbuffer[BIGBUFFERSIZE];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -33,12 +33,9 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/stdtypes.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
typedef long long offset_t;
|
|
||||||
#define MAXOFFSET_T LLONG_MAX
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------
|
* --------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,10 +2,6 @@ include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
|
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
pkgexec_PROGRAMS = libzfs_input_check
|
pkgexec_PROGRAMS = libzfs_input_check
|
||||||
|
|
||||||
libzfs_input_check_SOURCES = libzfs_input_check.c
|
libzfs_input_check_SOURCES = libzfs_input_check.c
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(char *progname)
|
usage(char *progname)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,17 +35,13 @@
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define BLOCKSIZE 512 /* bytes */
|
||||||
|
|
||||||
#define BLOCK_SIZE 512 /* bytes */
|
|
||||||
#define KILOBYTE 1024
|
#define KILOBYTE 1024
|
||||||
#define MEGABYTE (KILOBYTE * KILOBYTE)
|
#define MEGABYTE (KILOBYTE * KILOBYTE)
|
||||||
#define GIGABYTE (KILOBYTE * MEGABYTE)
|
#define GIGABYTE (KILOBYTE * MEGABYTE)
|
||||||
|
|
||||||
#define FILE_MODE (S_ISVTX + S_IRUSR + S_IWUSR)
|
#define FILE_MODE (S_ISVTX + S_IRUSR + S_IWUSR)
|
||||||
|
|
||||||
typedef long long offset_t;
|
|
||||||
|
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -95,7 +91,7 @@ main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'B':
|
case 'B':
|
||||||
mult = BLOCK_SIZE;
|
mult = BLOCKSIZE;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
case 'M':
|
case 'M':
|
||||||
|
|
|
@ -2,10 +2,6 @@ include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
|
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
pkgexec_PROGRAMS = nvlist_to_lua
|
pkgexec_PROGRAMS = nvlist_to_lua
|
||||||
|
|
||||||
nvlist_to_lua_SOURCES = nvlist_to_lua.c
|
nvlist_to_lua_SOURCES = nvlist_to_lua.c
|
||||||
|
|
|
@ -38,9 +38,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/note.h>
|
#include <sys/note.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/stdtypes.h>
|
||||||
typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
|
|
||||||
typedef unsigned long long u_longlong_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test messages from:
|
* Test messages from:
|
||||||
|
|
|
@ -39,9 +39,8 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#define _SHA2_IMPL
|
#define _SHA2_IMPL
|
||||||
#include <sys/sha2.h>
|
#include <sys/sha2.h>
|
||||||
|
#include <sys/stdtypes.h>
|
||||||
#define NOTE(x)
|
#define NOTE(x)
|
||||||
typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
|
|
||||||
typedef unsigned long long u_longlong_t;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -37,11 +37,9 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/stdtypes.h>
|
||||||
#define NOTE(x)
|
#define NOTE(x)
|
||||||
|
|
||||||
typedef enum boolean { B_FALSE, B_TRUE } boolean_t;
|
|
||||||
typedef unsigned long long u_longlong_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skein test suite using values from the Skein V1.3 specification found at:
|
* Skein test suite using values from the Skein V1.3 specification found at:
|
||||||
* http://www.skein-hash.info/sites/default/files/skein1.3.pdf
|
* http://www.skein-hash.info/sites/default/files/skein1.3.pdf
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
include $(top_srcdir)/config/Rules.am
|
include $(top_srcdir)/config/Rules.am
|
||||||
|
|
||||||
AM_CPPFLAGS += -I$(top_srcdir)/include
|
|
||||||
AM_CPPFLAGS += -I$(top_srcdir)/lib/libspl/include
|
|
||||||
LDADD = $(top_builddir)/lib/libzpool/libzpool.la
|
LDADD = $(top_builddir)/lib/libzpool/libzpool.la
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
|
|
|
@ -9,10 +9,6 @@ dist_pkgdata_SCRIPTS = \
|
||||||
setup.ksh \
|
setup.ksh \
|
||||||
libzfs_input.ksh
|
libzfs_input.ksh
|
||||||
|
|
||||||
DEFAULT_INCLUDES += \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/lib/libspl/include
|
|
||||||
|
|
||||||
many_fds_LDADD = \
|
many_fds_LDADD = \
|
||||||
$(top_builddir)/lib/libzfs/libzfs.la
|
$(top_builddir)/lib/libzfs/libzfs.la
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue