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:
Matthew Macy
2019-10-02 10:39:48 -07:00
committed by Brian Behlendorf
parent 6360e2779e
commit d31277abb1
65 changed files with 127 additions and 443 deletions
-4
View File
@@ -1,9 +1,5 @@
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/
# because this path is hardcoded in the mount(8) for security reasons.
-4
View File
@@ -6,10 +6,6 @@ AM_CFLAGS += $(FRAME_LARGER_THAN)
# Unconditionally enable ASSERTs
AM_CPPFLAGS += -DDEBUG -UNDEBUG
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
bin_PROGRAMS = raidz_test
raidz_test_SOURCES = \
-4
View File
@@ -3,10 +3,6 @@ include $(top_srcdir)/config/Rules.am
# Unconditionally enable debugging for zdb
AM_CPPFLAGS += -DDEBUG -UNDEBUG
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
sbin_PROGRAMS = zdb
zdb_SOURCES = \
+1 -5
View File
@@ -1,10 +1,6 @@
SUBDIRS = zed.d
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
SUBDIRS = zed.d
sbin_PROGRAMS = zed
-1
View File
@@ -69,7 +69,6 @@
*/
#include <ctype.h>
#include <devid.h>
#include <fcntl.h>
#include <libnvpair.h>
#include <libzfs.h>
-4
View File
@@ -1,9 +1,5 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
sbin_PROGRAMS = zfs
zfs_SOURCES = \
+2 -18
View File
@@ -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";
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.
@@ -6990,12 +6978,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
if (freopen(MNTTAB, "r", mnttab_file) == NULL)
return (ENOENT);
while ((ret = getextmntent(mnttab_file, &entry, 0)) == 0) {
if (entry.mnt_major == major(statbuf.st_dev) &&
entry.mnt_minor == minor(statbuf.st_dev))
break;
}
if (ret != 0) {
if (getextmntent(path, &entry, &statbuf) != 0) {
if (op == OP_SHARE) {
(void) fprintf(stderr, gettext("cannot %s '%s': not "
"currently mounted\n"), cmdname, path);
@@ -7008,6 +6991,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
strerror(errno));
return (ret != 0);
}
path_inode = statbuf.st_ino;
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) {
(void) fprintf(stderr, gettext("cannot %s '%s': not a ZFS "
-4
View File
@@ -1,9 +1,5 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
sbin_PROGRAMS = zhack
zhack_SOURCES = \
-4
View File
@@ -1,9 +1,5 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
sbin_PROGRAMS = zinject
zinject_SOURCES = \
+1 -31
View File
@@ -85,8 +85,6 @@ parse_pathname(const char *inpath, char *dataset, char *relpath,
struct stat64 *statbuf)
{
struct extmnttab mp;
FILE *fp;
int match;
const char *rel;
char fullpath[MAXPATHLEN];
@@ -99,35 +97,7 @@ parse_pathname(const char *inpath, char *dataset, char *relpath,
return (-1);
}
if (strlen(fullpath) >= MAXPATHLEN) {
(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) {
if (getextmntent(fullpath, &mp, statbuf) != 0) {
(void) fprintf(stderr, "cannot find mountpoint for '%s'\n",
fullpath);
return (-1);
+1 -4
View File
@@ -1,9 +1,6 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include \
-I.
DEFAULT_INCLUDES += -I.
sbin_PROGRAMS = zpool
-1
View File
@@ -64,7 +64,6 @@
#include <assert.h>
#include <ctype.h>
#include <devid.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
-1
View File
@@ -64,7 +64,6 @@
#include <assert.h>
#include <ctype.h>
#include <devid.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
-4
View File
@@ -1,9 +1,5 @@
include $(top_srcdir)/config/Rules.am
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
sbin_PROGRAMS = zstreamdump
zstreamdump_SOURCES = \
-4
View File
@@ -9,10 +9,6 @@ AM_CFLAGS += $(FRAME_LARGER_THAN)
# Unconditionally enable ASSERTs
AM_CPPFLAGS += -DDEBUG -UNDEBUG
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
sbin_PROGRAMS = ztest
ztest_SOURCES = \
-4
View File
@@ -4,10 +4,6 @@ include $(top_srcdir)/config/Rules.am
# removed once https://github.com/zfsonlinux/zfs/issues/569 is resolved.
AM_CFLAGS += -fno-stack-protector
DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include
udev_PROGRAMS = zvol_id
zvol_id_SOURCES = \