Merge ^/head r336870 through r337285, and resolve conflicts.
This commit is contained in:
commit
bbd7a9298f
@ -126,10 +126,11 @@ LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
|
||||
MAKEOBJDIRPREFIX= \
|
||||
MK_MAN=no MK_HTML=no
|
||||
LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
|
||||
MK_TOOLCHAIN=no ${IMAKE_INSTALL} \
|
||||
${IMAKE_INSTALL} \
|
||||
-DLIBRARIES_ONLY
|
||||
|
||||
_LC_LIBDIRS.yes= lib gnu/lib
|
||||
_LC_LIBDIRS.yes= lib
|
||||
_LC_LIBDIRS.yes+= gnu/lib
|
||||
_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib
|
||||
_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib
|
||||
_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib
|
||||
|
17
UPDATING
17
UPDATING
@ -31,6 +31,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20180731:
|
||||
The jedec_ts(4) driver has been removed. A superset of its functionality
|
||||
is available in the jedec_dimm(4) driver, and the manpage for that
|
||||
driver includes migration instructions. If you have "device jedec_ts"
|
||||
in your kernel configuration file, it must be removed.
|
||||
|
||||
20180730:
|
||||
amd64/GENERIC now has EFI runtime services, EFIRT, enabled by default.
|
||||
This should have no effect if the kernel is booted via BIOS/legacy boot.
|
||||
EFIRT may be disabled via a loader tunable, efi.rt.disabled, if a system
|
||||
has a buggy firmware that prevents a successful boot due to use of
|
||||
runtime services.
|
||||
|
||||
20180727:
|
||||
Atmel AT91RM9200 and AT91SAM9, Cavium CNS 11xx and XScale
|
||||
support has been removed from the tree. These ports were
|
||||
@ -45,7 +58,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
|
||||
|
||||
20180720:
|
||||
zfsloader's functionality has now been folded into loader.
|
||||
zfsloader is no longer necesasary once you've updated your
|
||||
zfsloader is no longer necessary once you've updated your
|
||||
boot blocks. For a transition period, we will install a
|
||||
hardlink for zfsloader to loader to allow a smooth transition
|
||||
until the boot blocks can be updated (hard link because old
|
||||
@ -180,7 +193,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
|
||||
Support for FDDI networks has been removed. If you have device
|
||||
fddi or device fpa in your kernel config file they must be
|
||||
removed.
|
||||
|
||||
|
||||
20180406:
|
||||
In addition to supporting RFC 3164 formatted messages, the
|
||||
syslogd(8) service is now capable of parsing RFC 5424 formatted
|
||||
|
125
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudplite.ksh
Executable file
125
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localudplite.ksh
Executable file
@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env ksh
|
||||
#
|
||||
# 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 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 (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test {ip,udplite}:::{send,receive} of IPv4 UDP-Lite to a local address.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. No physical network interface is plumbed and up.
|
||||
# 3. No other hosts on this subnet are reachable and listening on rpcbind.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test sends a UDP-Lite message using perl and checks that at least the
|
||||
# following counts were traced:
|
||||
#
|
||||
# 1 x ip:::send (UDPLite sent to UDP-Lite port 33434)
|
||||
# 1 x udplite:::send (UDPLite sent to UDP-Lite port 33434)
|
||||
# 1 x ip:::receive (UDP-Lite received)
|
||||
# 1 x udplite:::receive (UDP-Lite received)
|
||||
#
|
||||
# A udplite:::receive event is expected even if the received UDP-Lite packet
|
||||
# elicits an ICMP PORT_UNREACHABLE message since there is no UDP-Lite
|
||||
# socket for receiving the packet.
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
local=127.0.0.1
|
||||
port=33434
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
Type => SOCK_DGRAM,
|
||||
Proto => "udplite",
|
||||
PeerAddr => "$local",
|
||||
PeerPort => $port);
|
||||
die "Could not create UDP-Lite socket $local port $port" unless \$s;
|
||||
send \$s, "Hello", 0;
|
||||
close \$s;
|
||||
sleep(2);
|
||||
EOPERL
|
||||
|
||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = udplitesend = ipreceive = udplitereceive = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_UDPLITE/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
udplite:::send
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
|
||||
{
|
||||
udplitesend++;
|
||||
}
|
||||
|
||||
ip:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_UDPLITE/
|
||||
{
|
||||
ipreceive++;
|
||||
}
|
||||
|
||||
udplite:::receive
|
||||
/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
|
||||
{
|
||||
udplitereceive++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum UDP-Lite events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
|
||||
printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no");
|
||||
printf("udplite:::send - %s\n", udplitesend >= 1 ? "yes" : "no");
|
||||
printf("udplite:::receive - %s\n", udplitereceive >= 1 ? "yes" : "no");
|
||||
}
|
||||
EODTRACE
|
||||
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -0,0 +1,7 @@
|
||||
Minimum UDP-Lite events seen
|
||||
|
||||
ip:::send - yes
|
||||
ip:::receive - yes
|
||||
udplite:::send - yes
|
||||
udplite:::receive - yes
|
||||
|
113
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudplite.ksh
Executable file
113
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudplite.ksh
Executable file
@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env ksh93
|
||||
#
|
||||
# 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 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 (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test {udplite,ip}:::{send,receive} of IPv4 UDP-Lite to a remote host.
|
||||
#
|
||||
# This may fail due to:
|
||||
#
|
||||
# 1. A change to the ip stack breaking expected probe behavior,
|
||||
# which is the reason we are testing.
|
||||
# 2. No physical network interface is plumbed and up.
|
||||
# 3. No other hosts on this subnet are reachable and listening on rpcbind.
|
||||
# 4. An unlikely race causes the unlocked global send/receive
|
||||
# variables to be corrupted.
|
||||
#
|
||||
# This test sends a UDP-Lite message using perl and checks that at least the
|
||||
# following counts were traced:
|
||||
#
|
||||
# 1 x ip:::send (UDP-Lite sent to UDP-Lite port 33434)
|
||||
# 1 x udplite:::send (UDP-Lite sent to UDP-Lite port 33434)
|
||||
#
|
||||
|
||||
if (( $# != 1 )); then
|
||||
print -u2 "expected one argument: <dtrace-path>"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
getaddr=./get.ipv4remote.pl
|
||||
port=33434
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
if [[ ! -x $getaddr ]]; then
|
||||
print -u2 "could not find or execute sub program: $getaddr"
|
||||
exit 3
|
||||
fi
|
||||
$getaddr | read source dest
|
||||
if (( $? != 0 )); then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
Type => SOCK_DGRAM,
|
||||
Proto => "udplite",
|
||||
PeerAddr => "$dest",
|
||||
PeerPort => $port);
|
||||
die "Could not create UDP-Lite socket $dest port $port" unless \$s;
|
||||
send \$s, "Hello", 0;
|
||||
close \$s;
|
||||
sleep(2);
|
||||
EOPERL
|
||||
|
||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = udplitesend = 0;
|
||||
}
|
||||
|
||||
ip:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
|
||||
args[4]->ipv4_protocol == IPPROTO_UDPLITE/
|
||||
{
|
||||
ipsend++;
|
||||
}
|
||||
|
||||
udplite:::send
|
||||
/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/
|
||||
{
|
||||
udplitesend++;
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
printf("Minimum UDPLite events seen\n\n");
|
||||
printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
|
||||
printf("udplite:::send - %s\n", udplitesend >= 1 ? "yes" : "no");
|
||||
}
|
||||
EODTRACE
|
||||
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
@ -0,0 +1,5 @@
|
||||
Minimum UDP-Lite events seen
|
||||
|
||||
ip:::send - yes
|
||||
udplite:::send - yes
|
||||
|
@ -108,6 +108,7 @@ static uint64_t *zopt_object = NULL;
|
||||
static unsigned zopt_objects = 0;
|
||||
static libzfs_handle_t *g_zfs;
|
||||
static uint64_t max_inflight = 1000;
|
||||
static int leaked_objects = 0;
|
||||
|
||||
static void snprintf_blkptr_compact(char *, size_t, const blkptr_t *);
|
||||
|
||||
@ -774,7 +775,6 @@ verify_spacemap_refcounts(spa_t *spa)
|
||||
static void
|
||||
dump_spacemap(objset_t *os, space_map_t *sm)
|
||||
{
|
||||
uint64_t alloc, offset, entry;
|
||||
char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID",
|
||||
"INVALID", "INVALID", "INVALID", "INVALID" };
|
||||
|
||||
@ -791,41 +791,73 @@ dump_spacemap(objset_t *os, space_map_t *sm)
|
||||
/*
|
||||
* Print out the freelist entries in both encoded and decoded form.
|
||||
*/
|
||||
alloc = 0;
|
||||
for (offset = 0; offset < space_map_length(sm);
|
||||
offset += sizeof (entry)) {
|
||||
uint8_t mapshift = sm->sm_shift;
|
||||
uint8_t mapshift = sm->sm_shift;
|
||||
int64_t alloc = 0;
|
||||
uint64_t word;
|
||||
for (uint64_t offset = 0; offset < space_map_length(sm);
|
||||
offset += sizeof (word)) {
|
||||
|
||||
VERIFY0(dmu_read(os, space_map_object(sm), offset,
|
||||
sizeof (entry), &entry, DMU_READ_PREFETCH));
|
||||
if (SM_DEBUG_DECODE(entry)) {
|
||||
sizeof (word), &word, DMU_READ_PREFETCH));
|
||||
|
||||
if (sm_entry_is_debug(word)) {
|
||||
(void) printf("\t [%6llu] %s: txg %llu, pass %llu\n",
|
||||
(u_longlong_t)(offset / sizeof (entry)),
|
||||
ddata[SM_DEBUG_ACTION_DECODE(entry)],
|
||||
(u_longlong_t)SM_DEBUG_TXG_DECODE(entry),
|
||||
(u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(entry));
|
||||
} else {
|
||||
(void) printf("\t [%6llu] %c range:"
|
||||
" %010llx-%010llx size: %06llx\n",
|
||||
(u_longlong_t)(offset / sizeof (entry)),
|
||||
SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F',
|
||||
(u_longlong_t)((SM_OFFSET_DECODE(entry) <<
|
||||
mapshift) + sm->sm_start),
|
||||
(u_longlong_t)((SM_OFFSET_DECODE(entry) <<
|
||||
mapshift) + sm->sm_start +
|
||||
(SM_RUN_DECODE(entry) << mapshift)),
|
||||
(u_longlong_t)(SM_RUN_DECODE(entry) << mapshift));
|
||||
if (SM_TYPE_DECODE(entry) == SM_ALLOC)
|
||||
alloc += SM_RUN_DECODE(entry) << mapshift;
|
||||
else
|
||||
alloc -= SM_RUN_DECODE(entry) << mapshift;
|
||||
(u_longlong_t)(offset / sizeof (word)),
|
||||
ddata[SM_DEBUG_ACTION_DECODE(word)],
|
||||
(u_longlong_t)SM_DEBUG_TXG_DECODE(word),
|
||||
(u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(word));
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t words;
|
||||
char entry_type;
|
||||
uint64_t entry_off, entry_run, entry_vdev = SM_NO_VDEVID;
|
||||
|
||||
if (sm_entry_is_single_word(word)) {
|
||||
entry_type = (SM_TYPE_DECODE(word) == SM_ALLOC) ?
|
||||
'A' : 'F';
|
||||
entry_off = (SM_OFFSET_DECODE(word) << mapshift) +
|
||||
sm->sm_start;
|
||||
entry_run = SM_RUN_DECODE(word) << mapshift;
|
||||
words = 1;
|
||||
} else {
|
||||
/* it is a two-word entry so we read another word */
|
||||
ASSERT(sm_entry_is_double_word(word));
|
||||
|
||||
uint64_t extra_word;
|
||||
offset += sizeof (extra_word);
|
||||
VERIFY0(dmu_read(os, space_map_object(sm), offset,
|
||||
sizeof (extra_word), &extra_word,
|
||||
DMU_READ_PREFETCH));
|
||||
|
||||
ASSERT3U(offset, <=, space_map_length(sm));
|
||||
|
||||
entry_run = SM2_RUN_DECODE(word) << mapshift;
|
||||
entry_vdev = SM2_VDEV_DECODE(word);
|
||||
entry_type = (SM2_TYPE_DECODE(extra_word) == SM_ALLOC) ?
|
||||
'A' : 'F';
|
||||
entry_off = (SM2_OFFSET_DECODE(extra_word) <<
|
||||
mapshift) + sm->sm_start;
|
||||
words = 2;
|
||||
}
|
||||
|
||||
(void) printf("\t [%6llu] %c range:"
|
||||
" %010llx-%010llx size: %06llx vdev: %06llu words: %u\n",
|
||||
(u_longlong_t)(offset / sizeof (word)),
|
||||
entry_type, (u_longlong_t)entry_off,
|
||||
(u_longlong_t)(entry_off + entry_run),
|
||||
(u_longlong_t)entry_run,
|
||||
(u_longlong_t)entry_vdev, words);
|
||||
|
||||
if (entry_type == 'A')
|
||||
alloc += entry_run;
|
||||
else
|
||||
alloc -= entry_run;
|
||||
}
|
||||
if (alloc != space_map_allocated(sm)) {
|
||||
(void) printf("space_map_object alloc (%llu) INCONSISTENT "
|
||||
"with space map summary (%llu)\n",
|
||||
(u_longlong_t)space_map_allocated(sm), (u_longlong_t)alloc);
|
||||
if ((uint64_t)alloc != space_map_allocated(sm)) {
|
||||
(void) printf("space_map_object alloc (%lld) INCONSISTENT "
|
||||
"with space map summary (%lld)\n",
|
||||
(longlong_t)space_map_allocated(sm), (longlong_t)alloc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1155,7 +1187,7 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_class class)
|
||||
while ((error = ddt_object_walk(ddt, type, class, &walk, &dde)) == 0)
|
||||
dump_dde(ddt, &dde, walk);
|
||||
|
||||
ASSERT(error == ENOENT);
|
||||
ASSERT3U(error, ==, ENOENT);
|
||||
|
||||
(void) printf("\n");
|
||||
}
|
||||
@ -1957,9 +1989,12 @@ dump_znode(objset_t *os, uint64_t object, void *data, size_t size)
|
||||
|
||||
if (dump_opt['d'] > 4) {
|
||||
error = zfs_obj_to_path(os, object, path, sizeof (path));
|
||||
if (error != 0) {
|
||||
if (error == ESTALE) {
|
||||
(void) snprintf(path, sizeof (path), "on delete queue");
|
||||
} else if (error != 0) {
|
||||
leaked_objects++;
|
||||
(void) snprintf(path, sizeof (path),
|
||||
"\?\?\?<object#%llu>", (u_longlong_t)object);
|
||||
"path not found, possibly leaked");
|
||||
}
|
||||
(void) printf("\tpath %s\n", path);
|
||||
}
|
||||
@ -2289,6 +2324,12 @@ dump_dir(objset_t *os)
|
||||
}
|
||||
|
||||
ASSERT3U(object_count, ==, usedobjs);
|
||||
|
||||
if (leaked_objects != 0) {
|
||||
(void) printf("%d potentially leaked objects detected\n",
|
||||
leaked_objects);
|
||||
leaked_objects = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3002,7 +3043,7 @@ zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb)
|
||||
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
|
||||
|
||||
spa_vdev_removal_t *svr = spa->spa_vdev_removal;
|
||||
vdev_t *vd = svr->svr_vdev;
|
||||
vdev_t *vd = vdev_lookup_top(spa, svr->svr_vdev_id);
|
||||
vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping;
|
||||
|
||||
for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) {
|
||||
@ -3018,13 +3059,17 @@ zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb)
|
||||
svr->svr_allocd_segs, SM_ALLOC));
|
||||
|
||||
/*
|
||||
* Clear everything past what has been synced,
|
||||
* because we have not allocated mappings for it yet.
|
||||
* Clear everything past what has been synced unless
|
||||
* it's past the spacemap, because we have not allocated
|
||||
* mappings for it yet.
|
||||
*/
|
||||
range_tree_clear(svr->svr_allocd_segs,
|
||||
vdev_indirect_mapping_max_offset(vim),
|
||||
msp->ms_sm->sm_start + msp->ms_sm->sm_size -
|
||||
vdev_indirect_mapping_max_offset(vim));
|
||||
uint64_t vim_max_offset =
|
||||
vdev_indirect_mapping_max_offset(vim);
|
||||
uint64_t sm_end = msp->ms_sm->sm_start +
|
||||
msp->ms_sm->sm_size;
|
||||
if (sm_end > vim_max_offset)
|
||||
range_tree_clear(svr->svr_allocd_segs,
|
||||
vim_max_offset, sm_end - vim_max_offset);
|
||||
}
|
||||
|
||||
zcb->zcb_removing_size +=
|
||||
@ -3097,15 +3142,14 @@ typedef struct checkpoint_sm_exclude_entry_arg {
|
||||
} checkpoint_sm_exclude_entry_arg_t;
|
||||
|
||||
static int
|
||||
checkpoint_sm_exclude_entry_cb(maptype_t type, uint64_t offset, uint64_t size,
|
||||
void *arg)
|
||||
checkpoint_sm_exclude_entry_cb(space_map_entry_t *sme, void *arg)
|
||||
{
|
||||
checkpoint_sm_exclude_entry_arg_t *cseea = arg;
|
||||
vdev_t *vd = cseea->cseea_vd;
|
||||
metaslab_t *ms = vd->vdev_ms[offset >> vd->vdev_ms_shift];
|
||||
uint64_t end = offset + size;
|
||||
metaslab_t *ms = vd->vdev_ms[sme->sme_offset >> vd->vdev_ms_shift];
|
||||
uint64_t end = sme->sme_offset + sme->sme_run;
|
||||
|
||||
ASSERT(type == SM_FREE);
|
||||
ASSERT(sme->sme_type == SM_FREE);
|
||||
|
||||
/*
|
||||
* Since the vdev_checkpoint_sm exists in the vdev level
|
||||
@ -3123,7 +3167,7 @@ checkpoint_sm_exclude_entry_cb(maptype_t type, uint64_t offset, uint64_t size,
|
||||
* metaslab boundaries. So if needed we could add code
|
||||
* that handles metaslab-crossing segments in the future.
|
||||
*/
|
||||
VERIFY3U(offset, >=, ms->ms_start);
|
||||
VERIFY3U(sme->sme_offset, >=, ms->ms_start);
|
||||
VERIFY3U(end, <=, ms->ms_start + ms->ms_size);
|
||||
|
||||
/*
|
||||
@ -3131,10 +3175,10 @@ checkpoint_sm_exclude_entry_cb(maptype_t type, uint64_t offset, uint64_t size,
|
||||
* also verify that the entry is there to begin with.
|
||||
*/
|
||||
mutex_enter(&ms->ms_lock);
|
||||
range_tree_remove(ms->ms_allocatable, offset, size);
|
||||
range_tree_remove(ms->ms_allocatable, sme->sme_offset, sme->sme_run);
|
||||
mutex_exit(&ms->ms_lock);
|
||||
|
||||
cseea->cseea_checkpoint_size += size;
|
||||
cseea->cseea_checkpoint_size += sme->sme_run;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -4109,15 +4153,14 @@ typedef struct verify_checkpoint_sm_entry_cb_arg {
|
||||
#define ENTRIES_PER_PROGRESS_UPDATE 10000
|
||||
|
||||
static int
|
||||
verify_checkpoint_sm_entry_cb(maptype_t type, uint64_t offset, uint64_t size,
|
||||
void *arg)
|
||||
verify_checkpoint_sm_entry_cb(space_map_entry_t *sme, void *arg)
|
||||
{
|
||||
verify_checkpoint_sm_entry_cb_arg_t *vcsec = arg;
|
||||
vdev_t *vd = vcsec->vcsec_vd;
|
||||
metaslab_t *ms = vd->vdev_ms[offset >> vd->vdev_ms_shift];
|
||||
uint64_t end = offset + size;
|
||||
metaslab_t *ms = vd->vdev_ms[sme->sme_offset >> vd->vdev_ms_shift];
|
||||
uint64_t end = sme->sme_offset + sme->sme_run;
|
||||
|
||||
ASSERT(type == SM_FREE);
|
||||
ASSERT(sme->sme_type == SM_FREE);
|
||||
|
||||
if ((vcsec->vcsec_entryid % ENTRIES_PER_PROGRESS_UPDATE) == 0) {
|
||||
(void) fprintf(stderr,
|
||||
@ -4131,7 +4174,7 @@ verify_checkpoint_sm_entry_cb(maptype_t type, uint64_t offset, uint64_t size,
|
||||
/*
|
||||
* See comment in checkpoint_sm_exclude_entry_cb()
|
||||
*/
|
||||
VERIFY3U(offset, >=, ms->ms_start);
|
||||
VERIFY3U(sme->sme_offset, >=, ms->ms_start);
|
||||
VERIFY3U(end, <=, ms->ms_start + ms->ms_size);
|
||||
|
||||
/*
|
||||
@ -4140,7 +4183,7 @@ verify_checkpoint_sm_entry_cb(maptype_t type, uint64_t offset, uint64_t size,
|
||||
* their respective ms_allocateable trees should not contain them.
|
||||
*/
|
||||
mutex_enter(&ms->ms_lock);
|
||||
range_tree_verify(ms->ms_allocatable, offset, size);
|
||||
range_tree_verify(ms->ms_allocatable, sme->sme_offset, sme->sme_run);
|
||||
mutex_exit(&ms->ms_lock);
|
||||
|
||||
return (0);
|
||||
@ -4386,7 +4429,7 @@ verify_checkpoint(spa_t *spa)
|
||||
DMU_POOL_ZPOOL_CHECKPOINT, sizeof (uint64_t),
|
||||
sizeof (uberblock_t) / sizeof (uint64_t), &checkpoint);
|
||||
|
||||
if (error == ENOENT) {
|
||||
if (error == ENOENT && !dump_opt['L']) {
|
||||
/*
|
||||
* If the feature is active but the uberblock is missing
|
||||
* then we must be in the middle of discarding the
|
||||
@ -4409,7 +4452,7 @@ verify_checkpoint(spa_t *spa)
|
||||
error = 3;
|
||||
}
|
||||
|
||||
if (error == 0)
|
||||
if (error == 0 && !dump_opt['L'])
|
||||
verify_checkpoint_blocks(spa);
|
||||
|
||||
return (error);
|
||||
@ -4514,7 +4557,7 @@ dump_zpool(spa_t *spa)
|
||||
if (dump_opt['h'])
|
||||
dump_history(spa);
|
||||
|
||||
if (rc == 0 && !dump_opt['L'])
|
||||
if (rc == 0)
|
||||
rc = verify_checkpoint(spa);
|
||||
|
||||
if (rc != 0) {
|
||||
@ -4907,19 +4950,18 @@ zdb_embedded_block(char *thing)
|
||||
words + 8, words + 9, words + 10, words + 11,
|
||||
words + 12, words + 13, words + 14, words + 15);
|
||||
if (err != 16) {
|
||||
(void) printf("invalid input format\n");
|
||||
(void) fprintf(stderr, "invalid input format\n");
|
||||
exit(1);
|
||||
}
|
||||
ASSERT3U(BPE_GET_LSIZE(&bp), <=, SPA_MAXBLOCKSIZE);
|
||||
buf = malloc(SPA_MAXBLOCKSIZE);
|
||||
if (buf == NULL) {
|
||||
(void) fprintf(stderr, "%s: failed to allocate %llu bytes\n",
|
||||
__func__, SPA_MAXBLOCKSIZE);
|
||||
(void) fprintf(stderr, "out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
err = decode_embedded_bp(&bp, buf, BPE_GET_LSIZE(&bp));
|
||||
if (err != 0) {
|
||||
(void) printf("decode failed: %u\n", err);
|
||||
(void) fprintf(stderr, "decode failed: %u\n", err);
|
||||
free(buf);
|
||||
exit(1);
|
||||
}
|
||||
@ -5372,5 +5414,5 @@ main(int argc, char **argv)
|
||||
libzfs_fini(g_zfs);
|
||||
kernel_fini();
|
||||
|
||||
return (0);
|
||||
return (error);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved.
|
||||
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
|
||||
.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
|
||||
.\" Copyright 2018 Joyent, Inc.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
@ -319,7 +320,8 @@ namespace. For example:
|
||||
.Pp
|
||||
where the maximum length of a dataset name is
|
||||
.Dv MAXNAMELEN
|
||||
(256 bytes).
|
||||
(256 bytes)
|
||||
and the maximum amount of nesting allowed in a path is 50 levels deep.
|
||||
.Pp
|
||||
A dataset can be one of the following:
|
||||
.Bl -hang -width 12n
|
||||
@ -546,6 +548,13 @@ property. Compression can be turned on by running:
|
||||
.Qq Nm Cm set compression=on Ar dataset
|
||||
The default value is
|
||||
.Cm off .
|
||||
.It Sy createtxg
|
||||
The transaction group (txg) in which the dataset was created.
|
||||
Bookmarks have the same
|
||||
.Sy createtxg
|
||||
as the snapshot they are initially tied to.
|
||||
This property is suitable for ordering a list of snapshots,
|
||||
e.g. for incremental send and receive.
|
||||
.It Sy creation
|
||||
The time this dataset was created.
|
||||
.It Sy clones
|
||||
@ -573,6 +582,14 @@ This value is only available when a
|
||||
.Sy filesystem_limit
|
||||
has
|
||||
been set somewhere in the tree under which the dataset resides.
|
||||
.It Sy guid
|
||||
The 64 bit GUID of this dataset or bookmark which does not change over its
|
||||
entire lifetime.
|
||||
When a snapshot is sent to another pool, the received snapshot has the same
|
||||
GUID.
|
||||
Thus, the
|
||||
.Sy guid
|
||||
is suitable to identify a snapshot across pools.
|
||||
.It Sy logicalreferenced
|
||||
The amount of space that is
|
||||
.Qq logically
|
||||
@ -1311,7 +1328,7 @@ The default value is
|
||||
Limits the amount of space a dataset can consume. This property enforces a hard
|
||||
limit on the amount of space used. This hard limit does not include space used
|
||||
by descendents, including file systems and snapshots.
|
||||
.It Sy refreservation Ns = Ns Ar size | Cm none
|
||||
.It Sy refreservation Ns = Ns Ar size | Cm none | Cm auto
|
||||
The minimum amount of space guaranteed to a dataset, not including its
|
||||
descendents. When the amount of space used is below this value, the dataset is
|
||||
treated as if it were taking up the amount of space specified by
|
||||
@ -1327,6 +1344,18 @@ is set, a snapshot is only allowed if there is enough free pool space outside
|
||||
of this reservation to accommodate the current number of "referenced" bytes in
|
||||
the dataset.
|
||||
.Pp
|
||||
If
|
||||
.Sy refreservation
|
||||
is set to
|
||||
.Sy auto ,
|
||||
a volume is thick provisioned or not sparse.
|
||||
.Sy refreservation Ns = Cm auto
|
||||
is only supported on volumes.
|
||||
See
|
||||
.Sy volsize
|
||||
in the Native Properties
|
||||
section for more information about sparse volumes.
|
||||
.Pp
|
||||
This property can also be referred to by its shortened column name,
|
||||
.Sy refreserv .
|
||||
.It Sy reservation Ns = Ns Ar size | Cm none
|
||||
@ -1459,18 +1488,33 @@ on how the volume is used. These effects can also occur when the volume size is
|
||||
changed while it is in use (particularly when shrinking the size). Extreme care
|
||||
should be used when adjusting the volume size.
|
||||
.Pp
|
||||
Though not recommended, a "sparse volume" (also known as "thin provisioning")
|
||||
Though not recommended, a "sparse volume" (also known as "thin provisioned")
|
||||
can be created by specifying the
|
||||
.Fl s
|
||||
option to the
|
||||
.Qq Nm Cm create Fl V
|
||||
command, or by changing the reservation after the volume has been created. A
|
||||
"sparse volume" is a volume where the reservation is less then the volume size.
|
||||
command, or by changing the value of the
|
||||
.Sy refreservation
|
||||
property, or
|
||||
.Sy reservation
|
||||
property on pool version 8 or earlier
|
||||
.Pc
|
||||
after the volume has been created.
|
||||
A "sparse volume" is a volume where the value of
|
||||
.Sy refreservation
|
||||
is less then the size of the volume plus the space required to store its
|
||||
metadata.
|
||||
Consequently, writes to a sparse volume can fail with
|
||||
.Sy ENOSPC
|
||||
when the pool is low on space. For a sparse volume, changes to
|
||||
.Sy volsize
|
||||
are not reflected in the reservation.
|
||||
are not reflected in the
|
||||
.Sy refreservation .
|
||||
A volume that is not sparse is said to be "thick provisioned".
|
||||
A sparse volume can become thick provisioned by setting
|
||||
.Sy refreservation
|
||||
to
|
||||
.Sy auto .
|
||||
.It Sy volmode Ns = Ns Cm default | geom | dev | none
|
||||
This property specifies how volumes should be exposed to the OS.
|
||||
Setting it to
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include <aclutils.h>
|
||||
#include <directory.h>
|
||||
#include <idmap.h>
|
||||
#include <libshare.h>
|
||||
#endif
|
||||
|
||||
#include "zfs_iter.h"
|
||||
@ -6221,6 +6222,17 @@ share_mount(int op, int argc, char **argv)
|
||||
return (0);
|
||||
|
||||
qsort(dslist, count, sizeof (void *), libzfs_dataset_cmp);
|
||||
#ifdef illumos
|
||||
sa_init_selective_arg_t sharearg;
|
||||
sharearg.zhandle_arr = dslist;
|
||||
sharearg.zhandle_len = count;
|
||||
if ((ret = zfs_init_libshare_arg(zfs_get_handle(dslist[0]),
|
||||
SA_INIT_SHARE_API_SELECTIVE, &sharearg)) != SA_OK) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("Could not initialize libshare, %d"), ret);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (verbose)
|
||||
@ -7026,11 +7038,28 @@ zfs_do_diff(int argc, char **argv)
|
||||
return (err != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* zfs remap <filesystem | volume>
|
||||
*
|
||||
* Remap the indirect blocks in the given fileystem or volume.
|
||||
*/
|
||||
static int
|
||||
zfs_do_remap(int argc, char **argv)
|
||||
{
|
||||
const char *fsname;
|
||||
int err = 0;
|
||||
int c;
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "")) != -1) {
|
||||
switch (c) {
|
||||
case '?':
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid option '%c'\n"), optopt);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc != 2) {
|
||||
(void) fprintf(stderr, gettext("wrong number of arguments\n"));
|
||||
usage(B_FALSE);
|
||||
|
@ -482,6 +482,24 @@ This feature becomes
|
||||
when the "zpool remove" command is
|
||||
used on a top-level vdev, and will never return to being
|
||||
.Sy enabled .
|
||||
.It Sy spacemap_v2
|
||||
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:spacemap_v2"
|
||||
.It GUID Ta com.delphix:spacemap_v2
|
||||
.It READ\-ONLY COMPATIBLE Ta yes
|
||||
.It DEPENDENCIES Ta none
|
||||
.El
|
||||
.Pp
|
||||
This feature enables the use of the new space map encoding which
|
||||
consists of two words (instead of one) whenever it is advantageous.
|
||||
The new encoding allows space maps to represent large regions of
|
||||
space more efficiently on-disk while also increasing their maximum
|
||||
addressable offset.
|
||||
.Pp
|
||||
This feature becomes
|
||||
.Sy active
|
||||
as soon as it is enabled and will
|
||||
never return to being
|
||||
.Sy enabled .
|
||||
.It Sy large_blocks
|
||||
.Bl -column "READ\-ONLY COMPATIBLE" "org.open-zfs:large_block"
|
||||
.It GUID Ta org.open-zfs:large_block
|
||||
|
@ -121,6 +121,11 @@
|
||||
.Ar pool | id
|
||||
.Op Ar newpool
|
||||
.Nm
|
||||
.Cm initialize
|
||||
.Op Fl cs
|
||||
.Ar pool
|
||||
.Op Ar device Ns ...
|
||||
.Nm
|
||||
.Cm iostat
|
||||
.Op Fl T Cm d Ns | Ns Cm u
|
||||
.Op Fl v
|
||||
@ -1437,6 +1442,32 @@ to fully rewind.
|
||||
.El
|
||||
.It Xo
|
||||
.Nm
|
||||
.Cm initialize
|
||||
.Op Fl cs
|
||||
.Ar pool
|
||||
.Op Ar device Ns ...
|
||||
.Xc
|
||||
Begins initializing by writing to all unallocated regions on the specified
|
||||
devices, or all eligible devices in the pool if no individual devices are
|
||||
specified.
|
||||
Only leaf data or log devices may be initialized.
|
||||
.Bl -tag -width Ds
|
||||
.It Fl c, -cancel
|
||||
Cancel initializing on the specified devices, or all eligible devices if none
|
||||
are specified.
|
||||
If one or more target devices are invalid or are not currently being
|
||||
initialized, the command will fail and no cancellation will occur on any device.
|
||||
.It Fl s -suspend
|
||||
Suspend initializing on the specified devices, or all eligible devices if none
|
||||
are specified.
|
||||
If one or more target devices are invalid or are not currently being
|
||||
initialized, the command will fail and no suspension will occur on any device.
|
||||
Initializing can then be resumed by running
|
||||
.Nm zpool Cm initialize
|
||||
with no flags on the relevant target devices.
|
||||
.El
|
||||
.It Xo
|
||||
.Nm
|
||||
.Cm iostat
|
||||
.Op Fl T Cm d Ns | Ns Cm u
|
||||
.Op Fl v
|
||||
|
@ -87,6 +87,7 @@ static int zpool_do_detach(int, char **);
|
||||
static int zpool_do_replace(int, char **);
|
||||
static int zpool_do_split(int, char **);
|
||||
|
||||
static int zpool_do_initialize(int, char **);
|
||||
static int zpool_do_scrub(int, char **);
|
||||
|
||||
static int zpool_do_import(int, char **);
|
||||
@ -136,6 +137,7 @@ typedef enum {
|
||||
HELP_ONLINE,
|
||||
HELP_REPLACE,
|
||||
HELP_REMOVE,
|
||||
HELP_INITIALIZE,
|
||||
HELP_SCRUB,
|
||||
HELP_STATUS,
|
||||
HELP_UPGRADE,
|
||||
@ -187,6 +189,7 @@ static zpool_command_t command_table[] = {
|
||||
{ "replace", zpool_do_replace, HELP_REPLACE },
|
||||
{ "split", zpool_do_split, HELP_SPLIT },
|
||||
{ NULL },
|
||||
{ "initialize", zpool_do_initialize, HELP_INITIALIZE },
|
||||
{ "scrub", zpool_do_scrub, HELP_SCRUB },
|
||||
{ NULL },
|
||||
{ "import", zpool_do_import, HELP_IMPORT },
|
||||
@ -261,6 +264,8 @@ get_usage(zpool_help_t idx)
|
||||
return (gettext("\tremove [-nps] <pool> <device> ...\n"));
|
||||
case HELP_REOPEN:
|
||||
return (gettext("\treopen <pool>\n"));
|
||||
case HELP_INITIALIZE:
|
||||
return (gettext("\tinitialize [-cs] <pool> [<device> ...]\n"));
|
||||
case HELP_SCRUB:
|
||||
return (gettext("\tscrub [-s | -p] <pool> ...\n"));
|
||||
case HELP_STATUS:
|
||||
@ -1650,6 +1655,43 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
"resilvering" : "repairing");
|
||||
}
|
||||
|
||||
if ((vs->vs_initialize_state == VDEV_INITIALIZE_ACTIVE ||
|
||||
vs->vs_initialize_state == VDEV_INITIALIZE_SUSPENDED ||
|
||||
vs->vs_initialize_state == VDEV_INITIALIZE_COMPLETE) &&
|
||||
!vs->vs_scan_removing) {
|
||||
char zbuf[1024];
|
||||
char tbuf[256];
|
||||
struct tm zaction_ts;
|
||||
|
||||
time_t t = vs->vs_initialize_action_time;
|
||||
int initialize_pct = 100;
|
||||
if (vs->vs_initialize_state != VDEV_INITIALIZE_COMPLETE) {
|
||||
initialize_pct = (vs->vs_initialize_bytes_done * 100 /
|
||||
(vs->vs_initialize_bytes_est + 1));
|
||||
}
|
||||
|
||||
(void) localtime_r(&t, &zaction_ts);
|
||||
(void) strftime(tbuf, sizeof (tbuf), "%c", &zaction_ts);
|
||||
|
||||
switch (vs->vs_initialize_state) {
|
||||
case VDEV_INITIALIZE_SUSPENDED:
|
||||
(void) snprintf(zbuf, sizeof (zbuf),
|
||||
", suspended, started at %s", tbuf);
|
||||
break;
|
||||
case VDEV_INITIALIZE_ACTIVE:
|
||||
(void) snprintf(zbuf, sizeof (zbuf),
|
||||
", started at %s", tbuf);
|
||||
break;
|
||||
case VDEV_INITIALIZE_COMPLETE:
|
||||
(void) snprintf(zbuf, sizeof (zbuf),
|
||||
", completed at %s", tbuf);
|
||||
break;
|
||||
}
|
||||
|
||||
(void) printf(gettext(" (%d%% initialized%s)"),
|
||||
initialize_pct, zbuf);
|
||||
}
|
||||
|
||||
(void) printf("\n");
|
||||
|
||||
for (c = 0; c < children; c++) {
|
||||
@ -4238,6 +4280,119 @@ zpool_do_scrub(int argc, char **argv)
|
||||
return (for_each_pool(argc, argv, B_TRUE, NULL, scrub_callback, &cb));
|
||||
}
|
||||
|
||||
static void
|
||||
zpool_collect_leaves(zpool_handle_t *zhp, nvlist_t *nvroot, nvlist_t *res)
|
||||
{
|
||||
uint_t children = 0;
|
||||
nvlist_t **child;
|
||||
uint_t i;
|
||||
|
||||
(void) nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
|
||||
&child, &children);
|
||||
|
||||
if (children == 0) {
|
||||
char *path = zpool_vdev_name(g_zfs, zhp, nvroot, B_FALSE);
|
||||
fnvlist_add_boolean(res, path);
|
||||
free(path);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < children; i++) {
|
||||
zpool_collect_leaves(zhp, child[i], res);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool initialize [-cs] <pool> [<vdev> ...]
|
||||
* Initialize all unused blocks in the specified vdevs, or all vdevs in the pool
|
||||
* if none specified.
|
||||
*
|
||||
* -c Cancel. Ends active initializing.
|
||||
* -s Suspend. Initializing can then be restarted with no flags.
|
||||
*/
|
||||
int
|
||||
zpool_do_initialize(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
char *poolname;
|
||||
zpool_handle_t *zhp;
|
||||
nvlist_t *vdevs;
|
||||
int err = 0;
|
||||
|
||||
struct option long_options[] = {
|
||||
{"cancel", no_argument, NULL, 'c'},
|
||||
{"suspend", no_argument, NULL, 's'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
pool_initialize_func_t cmd_type = POOL_INITIALIZE_DO;
|
||||
while ((c = getopt_long(argc, argv, "cs", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
if (cmd_type != POOL_INITIALIZE_DO) {
|
||||
(void) fprintf(stderr, gettext("-c cannot be "
|
||||
"combined with other options\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
cmd_type = POOL_INITIALIZE_CANCEL;
|
||||
break;
|
||||
case 's':
|
||||
if (cmd_type != POOL_INITIALIZE_DO) {
|
||||
(void) fprintf(stderr, gettext("-s cannot be "
|
||||
"combined with other options\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
cmd_type = POOL_INITIALIZE_SUSPEND;
|
||||
break;
|
||||
case '?':
|
||||
if (optopt != 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid option '%c'\n"), optopt);
|
||||
} else {
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid option '%s'\n"),
|
||||
argv[optind - 1]);
|
||||
}
|
||||
usage(B_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc < 1) {
|
||||
(void) fprintf(stderr, gettext("missing pool name argument\n"));
|
||||
usage(B_FALSE);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
poolname = argv[0];
|
||||
zhp = zpool_open(g_zfs, poolname);
|
||||
if (zhp == NULL)
|
||||
return (-1);
|
||||
|
||||
vdevs = fnvlist_alloc();
|
||||
if (argc == 1) {
|
||||
/* no individual leaf vdevs specified, so add them all */
|
||||
nvlist_t *config = zpool_get_config(zhp, NULL);
|
||||
nvlist_t *nvroot = fnvlist_lookup_nvlist(config,
|
||||
ZPOOL_CONFIG_VDEV_TREE);
|
||||
zpool_collect_leaves(zhp, nvroot, vdevs);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
fnvlist_add_boolean(vdevs, argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = zpool_initialize(zhp, cmd_type, vdevs);
|
||||
|
||||
fnvlist_free(vdevs);
|
||||
zpool_close(zhp);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
typedef struct status_cbdata {
|
||||
int cb_count;
|
||||
boolean_t cb_allpools;
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||
@ -104,6 +104,7 @@
|
||||
#include <sys/zil_impl.h>
|
||||
#include <sys/vdev_impl.h>
|
||||
#include <sys/vdev_file.h>
|
||||
#include <sys/vdev_initialize.h>
|
||||
#include <sys/spa_impl.h>
|
||||
#include <sys/metaslab_impl.h>
|
||||
#include <sys/dsl_prop.h>
|
||||
@ -195,6 +196,7 @@ extern uint64_t zfs_deadman_synctime_ms;
|
||||
extern int metaslab_preload_limit;
|
||||
extern boolean_t zfs_compressed_arc_enabled;
|
||||
extern boolean_t zfs_abd_scatter_enabled;
|
||||
extern boolean_t zfs_force_some_double_word_sm_entries;
|
||||
|
||||
static ztest_shared_opts_t *ztest_shared_opts;
|
||||
static ztest_shared_opts_t ztest_opts;
|
||||
@ -347,6 +349,7 @@ ztest_func_t ztest_spa_upgrade;
|
||||
ztest_func_t ztest_device_removal;
|
||||
ztest_func_t ztest_remap_blocks;
|
||||
ztest_func_t ztest_spa_checkpoint_create_discard;
|
||||
ztest_func_t ztest_initialize;
|
||||
|
||||
uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
|
||||
uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
|
||||
@ -390,7 +393,8 @@ ztest_info_t ztest_info[] = {
|
||||
&ztest_opts.zo_vdevtime },
|
||||
{ ztest_device_removal, 1, &zopt_sometimes },
|
||||
{ ztest_remap_blocks, 1, &zopt_sometimes },
|
||||
{ ztest_spa_checkpoint_create_discard, 1, &zopt_rarely }
|
||||
{ ztest_spa_checkpoint_create_discard, 1, &zopt_rarely },
|
||||
{ ztest_initialize, 1, &zopt_sometimes }
|
||||
};
|
||||
|
||||
#define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t))
|
||||
@ -437,6 +441,7 @@ static ztest_ds_t *ztest_ds;
|
||||
|
||||
static kmutex_t ztest_vdev_lock;
|
||||
static kmutex_t ztest_checkpoint_lock;
|
||||
static boolean_t ztest_device_removal_active = B_FALSE;
|
||||
|
||||
/*
|
||||
* The ztest_name_lock protects the pool and dataset namespace used by
|
||||
@ -2881,7 +2886,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||
* value. Don't bother trying to attach while we are in the middle
|
||||
* of removal.
|
||||
*/
|
||||
if (spa->spa_vdev_removal != NULL) {
|
||||
if (ztest_device_removal_active) {
|
||||
spa_config_exit(spa, SCL_ALL, FTAG);
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
return;
|
||||
@ -3056,16 +3061,49 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id)
|
||||
spa_t *spa = ztest_spa;
|
||||
vdev_t *vd;
|
||||
uint64_t guid;
|
||||
int error;
|
||||
|
||||
mutex_enter(&ztest_vdev_lock);
|
||||
|
||||
if (ztest_device_removal_active) {
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove a random top-level vdev and wait for removal to finish.
|
||||
*/
|
||||
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
|
||||
vd = vdev_lookup_top(spa, ztest_random_vdev_top(spa, B_FALSE));
|
||||
guid = vd->vdev_guid;
|
||||
spa_config_exit(spa, SCL_VDEV, FTAG);
|
||||
|
||||
(void) spa_vdev_remove(spa, guid, B_FALSE);
|
||||
error = spa_vdev_remove(spa, guid, B_FALSE);
|
||||
if (error == 0) {
|
||||
ztest_device_removal_active = B_TRUE;
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
|
||||
while (spa->spa_vdev_removal != NULL)
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
} else {
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The pool needs to be scrubbed after completing device removal.
|
||||
* Failure to do so may result in checksum errors due to the
|
||||
* strategy employed by ztest_fault_inject() when selecting which
|
||||
* offset are redundant and can be damaged.
|
||||
*/
|
||||
error = spa_scan(spa, POOL_SCAN_SCRUB);
|
||||
if (error == 0) {
|
||||
while (dsl_scan_scrubbing(spa_get_dsl(spa)))
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
}
|
||||
|
||||
mutex_enter(&ztest_vdev_lock);
|
||||
ztest_device_removal_active = B_FALSE;
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
}
|
||||
|
||||
@ -3204,7 +3242,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id)
|
||||
* that the metaslab_class space increased (because it decreases
|
||||
* when the device removal completes).
|
||||
*/
|
||||
if (spa->spa_vdev_removal != NULL) {
|
||||
if (ztest_device_removal_active) {
|
||||
spa_config_exit(spa, SCL_STATE, spa);
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
mutex_exit(&ztest_checkpoint_lock);
|
||||
@ -4985,6 +5023,18 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
boolean_t islog = B_FALSE;
|
||||
|
||||
mutex_enter(&ztest_vdev_lock);
|
||||
|
||||
/*
|
||||
* Device removal is in progress, fault injection must be disabled
|
||||
* until it completes and the pool is scrubbed. The fault injection
|
||||
* strategy for damaging blocks does not take in to account evacuated
|
||||
* blocks which may have already been damaged.
|
||||
*/
|
||||
if (ztest_device_removal_active) {
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
maxfaults = MAXFAULTS();
|
||||
leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz;
|
||||
mirror_save = zs->zs_mirrors;
|
||||
@ -5330,6 +5380,12 @@ ztest_scrub(ztest_ds_t *zd, uint64_t id)
|
||||
{
|
||||
spa_t *spa = ztest_spa;
|
||||
|
||||
/*
|
||||
* Scrub in progress by device removal.
|
||||
*/
|
||||
if (ztest_device_removal_active)
|
||||
return;
|
||||
|
||||
(void) spa_scan(spa, POOL_SCAN_SCRUB);
|
||||
(void) poll(NULL, 0, 100); /* wait a moment, then force a restart */
|
||||
(void) spa_scan(spa, POOL_SCAN_SCRUB);
|
||||
@ -5418,6 +5474,97 @@ ztest_spa_rename(ztest_ds_t *zd, uint64_t id)
|
||||
rw_exit(&ztest_name_lock);
|
||||
}
|
||||
|
||||
static vdev_t *
|
||||
ztest_random_concrete_vdev_leaf(vdev_t *vd)
|
||||
{
|
||||
if (vd == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (vd->vdev_children == 0)
|
||||
return (vd);
|
||||
|
||||
vdev_t *eligible[vd->vdev_children];
|
||||
int eligible_idx = 0, i;
|
||||
for (i = 0; i < vd->vdev_children; i++) {
|
||||
vdev_t *cvd = vd->vdev_child[i];
|
||||
if (cvd->vdev_top->vdev_removing)
|
||||
continue;
|
||||
if (cvd->vdev_children > 0 ||
|
||||
(vdev_is_concrete(cvd) && !cvd->vdev_detached)) {
|
||||
eligible[eligible_idx++] = cvd;
|
||||
}
|
||||
}
|
||||
VERIFY(eligible_idx > 0);
|
||||
|
||||
uint64_t child_no = ztest_random(eligible_idx);
|
||||
return (ztest_random_concrete_vdev_leaf(eligible[child_no]));
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
ztest_initialize(ztest_ds_t *zd, uint64_t id)
|
||||
{
|
||||
spa_t *spa = ztest_spa;
|
||||
int error = 0;
|
||||
|
||||
mutex_enter(&ztest_vdev_lock);
|
||||
|
||||
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
|
||||
|
||||
/* Random leaf vdev */
|
||||
vdev_t *rand_vd = ztest_random_concrete_vdev_leaf(spa->spa_root_vdev);
|
||||
if (rand_vd == NULL) {
|
||||
spa_config_exit(spa, SCL_VDEV, FTAG);
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The random vdev we've selected may change as soon as we
|
||||
* drop the spa_config_lock. We create local copies of things
|
||||
* we're interested in.
|
||||
*/
|
||||
uint64_t guid = rand_vd->vdev_guid;
|
||||
char *path = strdup(rand_vd->vdev_path);
|
||||
boolean_t active = rand_vd->vdev_initialize_thread != NULL;
|
||||
|
||||
zfs_dbgmsg("vd %p, guid %llu", rand_vd, guid);
|
||||
spa_config_exit(spa, SCL_VDEV, FTAG);
|
||||
|
||||
uint64_t cmd = ztest_random(POOL_INITIALIZE_FUNCS);
|
||||
error = spa_vdev_initialize(spa, guid, cmd);
|
||||
switch (cmd) {
|
||||
case POOL_INITIALIZE_CANCEL:
|
||||
if (ztest_opts.zo_verbose >= 4) {
|
||||
(void) printf("Cancel initialize %s", path);
|
||||
if (!active)
|
||||
(void) printf(" failed (no initialize active)");
|
||||
(void) printf("\n");
|
||||
}
|
||||
break;
|
||||
case POOL_INITIALIZE_DO:
|
||||
if (ztest_opts.zo_verbose >= 4) {
|
||||
(void) printf("Start initialize %s", path);
|
||||
if (active && error == 0)
|
||||
(void) printf(" failed (already active)");
|
||||
else if (error != 0)
|
||||
(void) printf(" failed (error %d)", error);
|
||||
(void) printf("\n");
|
||||
}
|
||||
break;
|
||||
case POOL_INITIALIZE_SUSPEND:
|
||||
if (ztest_opts.zo_verbose >= 4) {
|
||||
(void) printf("Suspend initialize %s", path);
|
||||
if (!active)
|
||||
(void) printf(" failed (no initialize active)");
|
||||
(void) printf("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
free(path);
|
||||
mutex_exit(&ztest_vdev_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify pool integrity by running zdb.
|
||||
*/
|
||||
@ -5868,7 +6015,6 @@ ztest_run(ztest_shared_t *zs)
|
||||
*/
|
||||
kernel_init(FREAD | FWRITE);
|
||||
VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG));
|
||||
spa->spa_debug = B_TRUE;
|
||||
metaslab_preload_limit = ztest_random(20) + 1;
|
||||
ztest_spa = spa;
|
||||
|
||||
@ -6025,7 +6171,6 @@ ztest_freeze(void)
|
||||
kernel_init(FREAD | FWRITE);
|
||||
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
|
||||
VERIFY3U(0, ==, ztest_dataset_open(0));
|
||||
spa->spa_debug = B_TRUE;
|
||||
ztest_spa = spa;
|
||||
|
||||
/*
|
||||
@ -6096,7 +6241,6 @@ ztest_freeze(void)
|
||||
VERIFY3U(0, ==, ztest_dataset_open(0));
|
||||
ztest_dataset_close(0);
|
||||
|
||||
spa->spa_debug = B_TRUE;
|
||||
ztest_spa = spa;
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
ztest_reguid(NULL, 0);
|
||||
@ -6397,6 +6541,12 @@ main(int argc, char **argv)
|
||||
|
||||
dprintf_setup(&argc, argv);
|
||||
zfs_deadman_synctime_ms = 300000;
|
||||
/*
|
||||
* As two-word space map entries may not come up often (especially
|
||||
* if pool and vdev sizes are small) we want to force at least some
|
||||
* of them so the feature get tested.
|
||||
*/
|
||||
zfs_force_some_double_word_sm_entries = B_TRUE;
|
||||
|
||||
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
|
||||
ASSERT3S(ztest_fd_rand, >=, 0);
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2014, Joyent, Inc.
|
||||
* Copyright (c) 2017 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -394,8 +395,10 @@ nvlist_print_json(FILE *fp, nvlist_t *nvl)
|
||||
}
|
||||
|
||||
case DATA_TYPE_UNKNOWN:
|
||||
case DATA_TYPE_DONTCARE:
|
||||
return (-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FPRINTF(fp, "}");
|
||||
|
@ -137,6 +137,9 @@ typedef enum zfs_error {
|
||||
EZFS_NO_CHECKPOINT, /* pool has no checkpoint */
|
||||
EZFS_DEVRM_IN_PROGRESS, /* a device is currently being removed */
|
||||
EZFS_VDEV_TOO_BIG, /* a device is too big to be used */
|
||||
EZFS_TOOMANY, /* argument list too long */
|
||||
EZFS_INITIALIZING, /* currently initializing */
|
||||
EZFS_NO_INITIALIZE, /* no active initialize */
|
||||
EZFS_UNKNOWN
|
||||
} zfs_error_t;
|
||||
|
||||
@ -262,6 +265,8 @@ typedef struct splitflags {
|
||||
* Functions to manipulate pool and vdev state
|
||||
*/
|
||||
extern int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t);
|
||||
extern int zpool_initialize(zpool_handle_t *, pool_initialize_func_t,
|
||||
nvlist_t *);
|
||||
extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
|
||||
extern int zpool_reguid(zpool_handle_t *);
|
||||
extern int zpool_reopen(zpool_handle_t *);
|
||||
@ -838,6 +843,17 @@ extern int zmount(const char *, const char *, int, char *, char *, int, char *,
|
||||
#endif
|
||||
extern int zfs_remap_indirects(libzfs_handle_t *hdl, const char *);
|
||||
|
||||
/* Allow consumers to initialize libshare externally for optimal performance */
|
||||
extern int zfs_init_libshare_arg(libzfs_handle_t *, int, void *);
|
||||
/*
|
||||
* For most consumers, zfs_init_libshare_arg is sufficient on its own, and
|
||||
* zfs_uninit_libshare is unnecessary. zfs_uninit_libshare should only be called
|
||||
* if the caller has already initialized libshare for one set of zfs handles,
|
||||
* and wishes to share or unshare filesystems outside of that set. In that case,
|
||||
* the caller should uninitialize libshare, and then re-initialize it with the
|
||||
* new handles being shared or unshared.
|
||||
*/
|
||||
extern void zfs_uninit_libshare(libzfs_handle_t *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
* Portions Copyright 2007 Ramprakash Jelari
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014, 2015 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2014, 2016 by Delphix. All rights reserved.
|
||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
||||
*/
|
||||
|
||||
@ -166,6 +166,11 @@ changelist_postfix(prop_changelist_t *clp)
|
||||
char shareopts[ZFS_MAXPROPLEN];
|
||||
int errors = 0;
|
||||
libzfs_handle_t *hdl;
|
||||
#ifdef illumos
|
||||
size_t num_datasets = 0, i;
|
||||
zfs_handle_t **zhandle_arr;
|
||||
sa_init_selective_arg_t sharearg;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we're changing the mountpoint, attempt to destroy the underlying
|
||||
@ -192,8 +197,33 @@ changelist_postfix(prop_changelist_t *clp)
|
||||
hdl = cn->cn_handle->zfs_hdl;
|
||||
assert(hdl != NULL);
|
||||
zfs_uninit_libshare(hdl);
|
||||
}
|
||||
|
||||
#ifdef illumos
|
||||
/*
|
||||
* For efficiencies sake, we initialize libshare for only a few
|
||||
* shares (the ones affected here). Future initializations in
|
||||
* this process should just use the cached initialization.
|
||||
*/
|
||||
for (cn = uu_list_last(clp->cl_list); cn != NULL;
|
||||
cn = uu_list_prev(clp->cl_list, cn)) {
|
||||
num_datasets++;
|
||||
}
|
||||
|
||||
zhandle_arr = zfs_alloc(hdl,
|
||||
num_datasets * sizeof (zfs_handle_t *));
|
||||
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL;
|
||||
cn = uu_list_prev(clp->cl_list, cn)) {
|
||||
zhandle_arr[i++] = cn->cn_handle;
|
||||
zfs_refresh_properties(cn->cn_handle);
|
||||
}
|
||||
assert(i == num_datasets);
|
||||
sharearg.zhandle_arr = zhandle_arr;
|
||||
sharearg.zhandle_len = num_datasets;
|
||||
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
|
||||
&sharearg);
|
||||
free(zhandle_arr);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* We walk the datasets in reverse, because we want to mount any parent
|
||||
* datasets before mounting the children. We walk all datasets even if
|
||||
@ -218,7 +248,9 @@ changelist_postfix(prop_changelist_t *clp)
|
||||
continue;
|
||||
cn->cn_needpost = B_FALSE;
|
||||
|
||||
#ifndef illumos
|
||||
zfs_refresh_properties(cn->cn_handle);
|
||||
#endif
|
||||
|
||||
if (ZFS_IS_VOLUME(cn->cn_handle))
|
||||
continue;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2018, Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
|
||||
@ -50,7 +50,9 @@
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <stddef.h>
|
||||
#ifdef illumos
|
||||
#include <idmap.h>
|
||||
#endif
|
||||
|
||||
#include <sys/dnode.h>
|
||||
#include <sys/spa.h>
|
||||
@ -1407,7 +1409,6 @@ badlabel:
|
||||
|
||||
switch (prop) {
|
||||
case ZFS_PROP_RESERVATION:
|
||||
case ZFS_PROP_REFRESERVATION:
|
||||
if (intval > volsize) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"'%s' is greater than current "
|
||||
@ -1418,6 +1419,17 @@ badlabel:
|
||||
}
|
||||
break;
|
||||
|
||||
case ZFS_PROP_REFRESERVATION:
|
||||
if (intval > volsize && intval != UINT64_MAX) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"'%s' is greater than current "
|
||||
"volume size"), propname);
|
||||
(void) zfs_error(hdl, EZFS_BADPROP,
|
||||
errbuf);
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZFS_PROP_VOLSIZE:
|
||||
if (intval % blocksize != 0) {
|
||||
zfs_nicenum(blocksize, buf,
|
||||
@ -1519,6 +1531,61 @@ zfs_add_synthetic_resv(zfs_handle_t *zhp, nvlist_t *nvl)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper for 'zfs {set|clone} refreservation=auto'. Must be called after
|
||||
* zfs_valid_proplist(), as it is what sets the UINT64_MAX sentinal value.
|
||||
* Return codes must match zfs_add_synthetic_resv().
|
||||
*/
|
||||
static int
|
||||
zfs_fix_auto_resv(zfs_handle_t *zhp, nvlist_t *nvl)
|
||||
{
|
||||
uint64_t volsize;
|
||||
uint64_t resvsize;
|
||||
zfs_prop_t prop;
|
||||
nvlist_t *props;
|
||||
|
||||
if (!ZFS_IS_VOLUME(zhp)) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (zfs_which_resv_prop(zhp, &prop) != 0) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (prop != ZFS_PROP_REFRESERVATION) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (nvlist_lookup_uint64(nvl, zfs_prop_to_name(prop), &resvsize) != 0) {
|
||||
/* No value being set, so it can't be "auto" */
|
||||
return (0);
|
||||
}
|
||||
if (resvsize != UINT64_MAX) {
|
||||
/* Being set to a value other than "auto" */
|
||||
return (0);
|
||||
}
|
||||
|
||||
props = fnvlist_alloc();
|
||||
|
||||
fnvlist_add_uint64(props, zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE),
|
||||
zfs_prop_get_int(zhp, ZFS_PROP_VOLBLOCKSIZE));
|
||||
|
||||
if (nvlist_lookup_uint64(nvl, zfs_prop_to_name(ZFS_PROP_VOLSIZE),
|
||||
&volsize) != 0) {
|
||||
volsize = zfs_prop_get_int(zhp, ZFS_PROP_VOLSIZE);
|
||||
}
|
||||
|
||||
resvsize = zvol_volsize_to_reservation(volsize, props);
|
||||
fnvlist_free(props);
|
||||
|
||||
(void) nvlist_remove_all(nvl, zfs_prop_to_name(prop));
|
||||
if (nvlist_add_uint64(nvl, zfs_prop_to_name(prop), resvsize) != 0) {
|
||||
(void) no_memory(zhp->zfs_hdl);
|
||||
return (-1);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err,
|
||||
char *errbuf)
|
||||
@ -1685,6 +1752,12 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (added_resv != 1 &&
|
||||
(added_resv = zfs_fix_auto_resv(zhp, nvl)) == -1) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check how many properties we're setting and allocate an array to
|
||||
* store changelist pointers for postfix().
|
||||
@ -2711,6 +2784,7 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
|
||||
break;
|
||||
|
||||
case ZFS_PROP_GUID:
|
||||
case ZFS_PROP_CREATETXG:
|
||||
/*
|
||||
* GUIDs are stored as numbers, but they are identifiers.
|
||||
* We don't want them to be pretty printed, because pretty
|
||||
@ -3376,8 +3450,22 @@ zfs_create_ancestors(libzfs_handle_t *hdl, const char *path)
|
||||
{
|
||||
int prefix;
|
||||
char *path_copy;
|
||||
char errbuf[1024];
|
||||
int rc = 0;
|
||||
|
||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||
"cannot create '%s'"), path);
|
||||
|
||||
/*
|
||||
* Check that we are not passing the nesting limit
|
||||
* before we start creating any ancestors.
|
||||
*/
|
||||
if (dataset_nestcheck(path) != 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"maximum name nesting depth exceeded"));
|
||||
return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
|
||||
}
|
||||
|
||||
if (check_parents(hdl, path, NULL, B_TRUE, &prefix) != 0)
|
||||
return (-1);
|
||||
|
||||
@ -3413,6 +3501,12 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
|
||||
if (!zfs_validate_name(hdl, path, type, B_TRUE))
|
||||
return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
|
||||
|
||||
if (dataset_nestcheck(path) != 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"maximum name nesting depth exceeded"));
|
||||
return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
|
||||
}
|
||||
|
||||
/* validate parents exist */
|
||||
if (check_parents(hdl, path, &zoned, B_FALSE, NULL) != 0)
|
||||
return (-1);
|
||||
@ -3715,6 +3809,7 @@ zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
|
||||
|
||||
if (props) {
|
||||
zfs_type_t type;
|
||||
|
||||
if (ZFS_IS_VOLUME(zhp)) {
|
||||
type = ZFS_TYPE_VOLUME;
|
||||
} else {
|
||||
@ -3723,6 +3818,10 @@ zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
|
||||
if ((props = zfs_valid_proplist(hdl, type, props, zoned,
|
||||
zhp, zhp->zpool_hdl, errbuf)) == NULL)
|
||||
return (-1);
|
||||
if (zfs_fix_auto_resv(zhp, props) == -1) {
|
||||
nvlist_free(props);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = lzc_clone(target, zhp->zfs_name, props);
|
||||
@ -3839,12 +3938,24 @@ zfs_remap_indirects(libzfs_handle_t *hdl, const char *fs)
|
||||
char errbuf[1024];
|
||||
|
||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||
"cannot remap filesystem '%s' "), fs);
|
||||
"cannot remap dataset '%s'"), fs);
|
||||
|
||||
err = lzc_remap(fs);
|
||||
|
||||
if (err != 0) {
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
switch (err) {
|
||||
case ENOTSUP:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"pool must be upgraded"));
|
||||
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
|
||||
break;
|
||||
case EINVAL:
|
||||
(void) zfs_error(hdl, EZFS_BADTYPE, errbuf);
|
||||
break;
|
||||
default:
|
||||
(void) zfs_standard_error(hdl, err, errbuf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (err);
|
||||
@ -4196,6 +4307,7 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target,
|
||||
errbuf));
|
||||
}
|
||||
}
|
||||
|
||||
if (!zfs_validate_name(hdl, target, zhp->zfs_type, B_TRUE))
|
||||
return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
|
||||
} else {
|
||||
|
@ -22,7 +22,7 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2015, 2017 by Delphix. All rights reserved.
|
||||
* Copyright 2016 Joyent, Inc.
|
||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
||||
*/
|
||||
@ -101,7 +101,10 @@ get_stats_for_obj(differ_info_t *di, const char *dsname, uint64_t obj,
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (di->zerr == EPERM) {
|
||||
if (di->zerr == ESTALE) {
|
||||
(void) snprintf(pn, maxlen, "(on_delete_queue)");
|
||||
return (0);
|
||||
} else if (di->zerr == EPERM) {
|
||||
(void) snprintf(di->errbuf, sizeof (di->errbuf),
|
||||
dgettext(TEXT_DOMAIN,
|
||||
"The sys_config privilege or diff delegated permission "
|
||||
|
@ -207,7 +207,6 @@ void namespace_clear(libzfs_handle_t *);
|
||||
*/
|
||||
|
||||
extern int zfs_init_libshare(libzfs_handle_t *, int);
|
||||
extern void zfs_uninit_libshare(libzfs_handle_t *);
|
||||
extern int zfs_parse_options(char *, zfs_share_proto_t);
|
||||
|
||||
extern int zfs_unshare_proto(zfs_handle_t *,
|
||||
|
@ -33,7 +33,7 @@
|
||||
* ZFS label of each device. If we successfully read the label, then we
|
||||
* organize the configuration information in the following hierarchy:
|
||||
*
|
||||
* pool guid -> toplevel vdev guid -> label txg
|
||||
* pool guid -> toplevel vdev guid -> label txg
|
||||
*
|
||||
* Duplicate entries matching this same tuple will be discarded. Once we have
|
||||
* examined every device, we pick the best label txg config for each toplevel
|
||||
@ -245,7 +245,6 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, const char *path,
|
||||
ne->ne_next = pl->names;
|
||||
pl->names = ne;
|
||||
|
||||
nvlist_free(config);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -265,7 +264,6 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, const char *path,
|
||||
&top_guid) != 0 ||
|
||||
nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG,
|
||||
&txg) != 0 || txg == 0) {
|
||||
nvlist_free(config);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -280,7 +278,6 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, const char *path,
|
||||
|
||||
if (pe == NULL) {
|
||||
if ((pe = zfs_alloc(hdl, sizeof (pool_entry_t))) == NULL) {
|
||||
nvlist_free(config);
|
||||
return (-1);
|
||||
}
|
||||
pe->pe_guid = pool_guid;
|
||||
@ -299,7 +296,6 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, const char *path,
|
||||
|
||||
if (ve == NULL) {
|
||||
if ((ve = zfs_alloc(hdl, sizeof (vdev_entry_t))) == NULL) {
|
||||
nvlist_free(config);
|
||||
return (-1);
|
||||
}
|
||||
ve->ve_guid = top_guid;
|
||||
@ -319,15 +315,12 @@ add_config(libzfs_handle_t *hdl, pool_list_t *pl, const char *path,
|
||||
|
||||
if (ce == NULL) {
|
||||
if ((ce = zfs_alloc(hdl, sizeof (config_entry_t))) == NULL) {
|
||||
nvlist_free(config);
|
||||
return (-1);
|
||||
}
|
||||
ce->ce_txg = txg;
|
||||
ce->ce_config = config;
|
||||
ce->ce_config = fnvlist_dup(config);
|
||||
ce->ce_next = ve->ve_configs;
|
||||
ve->ve_configs = ce;
|
||||
} else {
|
||||
nvlist_free(config);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1396,9 +1389,7 @@ skipdir:
|
||||
&this_guid) == 0 &&
|
||||
iarg->guid == this_guid;
|
||||
}
|
||||
if (!matched) {
|
||||
nvlist_free(config);
|
||||
} else {
|
||||
if (matched) {
|
||||
/*
|
||||
* use the non-raw path for the config
|
||||
*/
|
||||
@ -1408,6 +1399,7 @@ skipdir:
|
||||
config) != 0)
|
||||
config_failed = B_TRUE;
|
||||
}
|
||||
nvlist_free(config);
|
||||
}
|
||||
free(slice->rn_name);
|
||||
free(slice);
|
||||
|
@ -579,6 +579,7 @@ zfs_is_shared_smb(zfs_handle_t *zhp, char **where)
|
||||
|
||||
#ifdef illumos
|
||||
static sa_handle_t (*_sa_init)(int);
|
||||
static sa_handle_t (*_sa_init_arg)(int, void *);
|
||||
static void (*_sa_fini)(sa_handle_t);
|
||||
static sa_share_t (*_sa_find_share)(sa_handle_t, char *);
|
||||
static int (*_sa_enable_share)(sa_share_t, char *);
|
||||
@ -620,6 +621,8 @@ _zfs_init_libshare(void)
|
||||
|
||||
if ((libshare = dlopen(path, RTLD_LAZY | RTLD_GLOBAL)) != NULL) {
|
||||
_sa_init = (sa_handle_t (*)(int))dlsym(libshare, "sa_init");
|
||||
_sa_init_arg = (sa_handle_t (*)(int, void *))dlsym(libshare,
|
||||
"sa_init_arg");
|
||||
_sa_fini = (void (*)(sa_handle_t))dlsym(libshare, "sa_fini");
|
||||
_sa_find_share = (sa_share_t (*)(sa_handle_t, char *))
|
||||
dlsym(libshare, "sa_find_share");
|
||||
@ -639,14 +642,15 @@ _zfs_init_libshare(void)
|
||||
char *, char *))dlsym(libshare, "sa_zfs_process_share");
|
||||
_sa_update_sharetab_ts = (void (*)(sa_handle_t))
|
||||
dlsym(libshare, "sa_update_sharetab_ts");
|
||||
if (_sa_init == NULL || _sa_fini == NULL ||
|
||||
_sa_find_share == NULL || _sa_enable_share == NULL ||
|
||||
_sa_disable_share == NULL || _sa_errorstr == NULL ||
|
||||
_sa_parse_legacy_options == NULL ||
|
||||
if (_sa_init == NULL || _sa_init_arg == NULL ||
|
||||
_sa_fini == NULL || _sa_find_share == NULL ||
|
||||
_sa_enable_share == NULL || _sa_disable_share == NULL ||
|
||||
_sa_errorstr == NULL || _sa_parse_legacy_options == NULL ||
|
||||
_sa_needs_refresh == NULL || _sa_get_zfs_handle == NULL ||
|
||||
_sa_zfs_process_share == NULL ||
|
||||
_sa_update_sharetab_ts == NULL) {
|
||||
_sa_init = NULL;
|
||||
_sa_init_arg = NULL;
|
||||
_sa_fini = NULL;
|
||||
_sa_disable_share = NULL;
|
||||
_sa_enable_share = NULL;
|
||||
@ -670,8 +674,8 @@ _zfs_init_libshare(void)
|
||||
* service value is which part(s) of the API to initialize and is a
|
||||
* direct map to the libshare sa_init(service) interface.
|
||||
*/
|
||||
int
|
||||
zfs_init_libshare(libzfs_handle_t *zhandle, int service)
|
||||
static int
|
||||
zfs_init_libshare_impl(libzfs_handle_t *zhandle, int service, void *arg)
|
||||
{
|
||||
#ifdef illumos
|
||||
/*
|
||||
@ -694,11 +698,11 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int service)
|
||||
if (_sa_needs_refresh != NULL &&
|
||||
_sa_needs_refresh(zhandle->libzfs_sharehdl)) {
|
||||
zfs_uninit_libshare(zhandle);
|
||||
zhandle->libzfs_sharehdl = _sa_init(service);
|
||||
zhandle->libzfs_sharehdl = _sa_init_arg(service, arg);
|
||||
}
|
||||
|
||||
if (zhandle && zhandle->libzfs_sharehdl == NULL)
|
||||
zhandle->libzfs_sharehdl = _sa_init(service);
|
||||
zhandle->libzfs_sharehdl = _sa_init_arg(service, arg);
|
||||
|
||||
if (zhandle->libzfs_sharehdl == NULL)
|
||||
return (SA_NO_MEMORY);
|
||||
@ -706,6 +710,18 @@ zfs_init_libshare(libzfs_handle_t *zhandle, int service)
|
||||
|
||||
return (SA_OK);
|
||||
}
|
||||
int
|
||||
zfs_init_libshare(libzfs_handle_t *zhandle, int service)
|
||||
{
|
||||
return (zfs_init_libshare_impl(zhandle, service, NULL));
|
||||
}
|
||||
|
||||
int
|
||||
zfs_init_libshare_arg(libzfs_handle_t *zhandle, int service, void *arg)
|
||||
{
|
||||
return (zfs_init_libshare_impl(zhandle, service, arg));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* zfs_uninit_libshare(zhandle)
|
||||
@ -817,9 +833,9 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
|
||||
ZFS_MAXPROPLEN, B_FALSE) != 0 ||
|
||||
strcmp(shareopts, "off") == 0)
|
||||
continue;
|
||||
|
||||
#ifdef illumos
|
||||
ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API);
|
||||
ret = zfs_init_libshare_arg(hdl, SA_INIT_ONE_SHARE_FROM_HANDLE,
|
||||
zhp);
|
||||
if (ret != SA_OK) {
|
||||
(void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
|
||||
dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
|
||||
@ -930,6 +946,7 @@ unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
|
||||
sa_share_t share;
|
||||
int err;
|
||||
char *mntpt;
|
||||
|
||||
/*
|
||||
* Mountpoint could get trashed if libshare calls getmntany
|
||||
* which it does during API initialization, so strdup the
|
||||
@ -937,8 +954,14 @@ unshare_one(libzfs_handle_t *hdl, const char *name, const char *mountpoint,
|
||||
*/
|
||||
mntpt = zfs_strdup(hdl, mountpoint);
|
||||
|
||||
/* make sure libshare initialized */
|
||||
if ((err = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
|
||||
/*
|
||||
* make sure libshare initialized, initialize everything because we
|
||||
* don't know what other unsharing may happen later. Functions up the
|
||||
* stack are allowed to initialize instead a subset of shares at the
|
||||
* time the set is known.
|
||||
*/
|
||||
if ((err = zfs_init_libshare_arg(hdl, SA_INIT_ONE_SHARE_FROM_NAME,
|
||||
(void *)name)) != SA_OK) {
|
||||
free(mntpt); /* don't need the copy anymore */
|
||||
return (zfs_error_fmt(hdl, proto_table[proto].p_unshare_err,
|
||||
dgettext(TEXT_DOMAIN, "cannot unshare '%s': %s"),
|
||||
@ -1289,6 +1312,9 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
|
||||
int i;
|
||||
int ret = -1;
|
||||
int flags = (force ? MS_FORCE : 0);
|
||||
#ifdef illumos
|
||||
sa_init_selective_arg_t sharearg;
|
||||
#endif
|
||||
|
||||
namelen = strlen(zhp->zpool_name);
|
||||
|
||||
@ -1363,6 +1389,14 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
|
||||
* At this point, we have the entire list of filesystems, so sort it by
|
||||
* mountpoint.
|
||||
*/
|
||||
#ifdef illumos
|
||||
sharearg.zhandle_arr = datasets;
|
||||
sharearg.zhandle_len = used;
|
||||
ret = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
|
||||
&sharearg);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
#endif
|
||||
qsort(mountpoints, used, sizeof (char *), mountpoint_compare);
|
||||
|
||||
/*
|
||||
|
@ -1981,6 +1981,100 @@ zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func, pool_scrub_cmd_t cmd)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
xlate_init_err(int err)
|
||||
{
|
||||
switch (err) {
|
||||
case ENODEV:
|
||||
return (EZFS_NODEVICE);
|
||||
case EINVAL:
|
||||
case EROFS:
|
||||
return (EZFS_BADDEV);
|
||||
case EBUSY:
|
||||
return (EZFS_INITIALIZING);
|
||||
case ESRCH:
|
||||
return (EZFS_NO_INITIALIZE);
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
|
||||
/*
|
||||
* Begin, suspend, or cancel the initialization (initializing of all free
|
||||
* blocks) for the given vdevs in the given pool.
|
||||
*/
|
||||
int
|
||||
zpool_initialize(zpool_handle_t *zhp, pool_initialize_func_t cmd_type,
|
||||
nvlist_t *vds)
|
||||
{
|
||||
char msg[1024];
|
||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||
|
||||
nvlist_t *errlist;
|
||||
|
||||
/* translate vdev names to guids */
|
||||
nvlist_t *vdev_guids = fnvlist_alloc();
|
||||
nvlist_t *guids_to_paths = fnvlist_alloc();
|
||||
boolean_t spare, cache;
|
||||
nvlist_t *tgt;
|
||||
nvpair_t *elem;
|
||||
|
||||
for (elem = nvlist_next_nvpair(vds, NULL); elem != NULL;
|
||||
elem = nvlist_next_nvpair(vds, elem)) {
|
||||
char *vd_path = nvpair_name(elem);
|
||||
tgt = zpool_find_vdev(zhp, vd_path, &spare, &cache, NULL);
|
||||
|
||||
if ((tgt == NULL) || cache || spare) {
|
||||
(void) snprintf(msg, sizeof (msg),
|
||||
dgettext(TEXT_DOMAIN, "cannot initialize '%s'"),
|
||||
vd_path);
|
||||
int err = (tgt == NULL) ? EZFS_NODEVICE :
|
||||
(spare ? EZFS_ISSPARE : EZFS_ISL2CACHE);
|
||||
fnvlist_free(vdev_guids);
|
||||
fnvlist_free(guids_to_paths);
|
||||
return (zfs_error(hdl, err, msg));
|
||||
}
|
||||
|
||||
uint64_t guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
|
||||
fnvlist_add_uint64(vdev_guids, vd_path, guid);
|
||||
|
||||
(void) snprintf(msg, sizeof (msg), "%llu", guid);
|
||||
fnvlist_add_string(guids_to_paths, msg, vd_path);
|
||||
}
|
||||
|
||||
int err = lzc_initialize(zhp->zpool_name, cmd_type, vdev_guids,
|
||||
&errlist);
|
||||
fnvlist_free(vdev_guids);
|
||||
|
||||
if (err == 0) {
|
||||
fnvlist_free(guids_to_paths);
|
||||
return (0);
|
||||
}
|
||||
|
||||
nvlist_t *vd_errlist = NULL;
|
||||
if (errlist != NULL) {
|
||||
vd_errlist = fnvlist_lookup_nvlist(errlist,
|
||||
ZPOOL_INITIALIZE_VDEVS);
|
||||
}
|
||||
|
||||
(void) snprintf(msg, sizeof (msg),
|
||||
dgettext(TEXT_DOMAIN, "operation failed"));
|
||||
|
||||
for (elem = nvlist_next_nvpair(vd_errlist, NULL); elem != NULL;
|
||||
elem = nvlist_next_nvpair(vd_errlist, elem)) {
|
||||
int64_t vd_error = xlate_init_err(fnvpair_value_int64(elem));
|
||||
char *path = fnvlist_lookup_string(guids_to_paths,
|
||||
nvpair_name(elem));
|
||||
(void) zfs_error_fmt(hdl, vd_error, "cannot initialize '%s'",
|
||||
path);
|
||||
}
|
||||
|
||||
fnvlist_free(guids_to_paths);
|
||||
if (vd_errlist != NULL)
|
||||
return (-1);
|
||||
|
||||
return (zpool_standard_error(hdl, err, msg));
|
||||
}
|
||||
|
||||
#ifdef illumos
|
||||
/*
|
||||
* This provides a very minimal check whether a given string is likely a
|
||||
@ -2836,7 +2930,7 @@ zpool_vdev_attach(zpool_handle_t *zhp,
|
||||
|
||||
case EBUSY:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "%s is busy, "
|
||||
"or pool has removing/removed vdevs"),
|
||||
"or device removal is in progress"),
|
||||
new_disk);
|
||||
(void) zfs_error(hdl, EZFS_BADDEV, msg);
|
||||
break;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Joyent, Inc.
|
||||
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
|
||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
|
||||
* Copyright (c) 2017 Datto Inc.
|
||||
@ -254,6 +254,13 @@ libzfs_error_description(libzfs_handle_t *hdl)
|
||||
return (dgettext(TEXT_DOMAIN, "device removal in progress"));
|
||||
case EZFS_VDEV_TOO_BIG:
|
||||
return (dgettext(TEXT_DOMAIN, "device exceeds supported size"));
|
||||
case EZFS_TOOMANY:
|
||||
return (dgettext(TEXT_DOMAIN, "argument list too long"));
|
||||
case EZFS_INITIALIZING:
|
||||
return (dgettext(TEXT_DOMAIN, "currently initializing"));
|
||||
case EZFS_NO_INITIALIZE:
|
||||
return (dgettext(TEXT_DOMAIN, "there is no active "
|
||||
"initialization"));
|
||||
case EZFS_UNKNOWN:
|
||||
return (dgettext(TEXT_DOMAIN, "unknown error"));
|
||||
default:
|
||||
@ -1227,6 +1234,7 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
|
||||
const char *propname;
|
||||
char *value;
|
||||
boolean_t isnone = B_FALSE;
|
||||
boolean_t isauto = B_FALSE;
|
||||
|
||||
if (type == ZFS_TYPE_POOL) {
|
||||
proptype = zpool_prop_get_type(prop);
|
||||
@ -1262,8 +1270,9 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
|
||||
(void) nvpair_value_string(elem, &value);
|
||||
if (strcmp(value, "none") == 0) {
|
||||
isnone = B_TRUE;
|
||||
} else if (zfs_nicestrtonum(hdl, value, ivalp)
|
||||
!= 0) {
|
||||
} else if (strcmp(value, "auto") == 0) {
|
||||
isauto = B_TRUE;
|
||||
} else if (zfs_nicestrtonum(hdl, value, ivalp) != 0) {
|
||||
goto error;
|
||||
}
|
||||
} else if (datatype == DATA_TYPE_UINT64) {
|
||||
@ -1293,6 +1302,31 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
|
||||
prop == ZFS_PROP_SNAPSHOT_LIMIT)) {
|
||||
*ivalp = UINT64_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
* Special handling for setting 'refreservation' to 'auto'. Use
|
||||
* UINT64_MAX to tell the caller to use zfs_fix_auto_resv().
|
||||
* 'auto' is only allowed on volumes.
|
||||
*/
|
||||
if (isauto) {
|
||||
switch (prop) {
|
||||
case ZFS_PROP_REFRESERVATION:
|
||||
if ((type & ZFS_TYPE_VOLUME) == 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"'%s=auto' only allowed on "
|
||||
"volumes"), nvpair_name(elem));
|
||||
goto error;
|
||||
}
|
||||
*ivalp = UINT64_MAX;
|
||||
break;
|
||||
default:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"'auto' is invalid value for '%s'"),
|
||||
nvpair_name(elem));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PROP_TYPE_INDEX:
|
||||
|
@ -1085,3 +1085,40 @@ lzc_channel_program_nosync(const char *pool, const char *program,
|
||||
return (lzc_channel_program_impl(pool, program, B_FALSE, timeout,
|
||||
memlimit, argnvl, outnvl));
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes initializing state.
|
||||
*
|
||||
* vdevs should be a list of (<key>, guid) where guid is a uint64 vdev GUID.
|
||||
* The key is ignored.
|
||||
*
|
||||
* If there are errors related to vdev arguments, per-vdev errors are returned
|
||||
* in an nvlist with the key "vdevs". Each error is a (guid, errno) pair where
|
||||
* guid is stringified with PRIu64, and errno is one of the following as
|
||||
* an int64_t:
|
||||
* - ENODEV if the device was not found
|
||||
* - EINVAL if the devices is not a leaf or is not concrete (e.g. missing)
|
||||
* - EROFS if the device is not writeable
|
||||
* - EBUSY start requested but the device is already being initialized
|
||||
* - ESRCH cancel/suspend requested but device is not being initialized
|
||||
*
|
||||
* If the errlist is empty, then return value will be:
|
||||
* - EINVAL if one or more arguments was invalid
|
||||
* - Other spa_open failures
|
||||
* - 0 if the operation succeeded
|
||||
*/
|
||||
int
|
||||
lzc_initialize(const char *poolname, pool_initialize_func_t cmd_type,
|
||||
nvlist_t *vdevs, nvlist_t **errlist)
|
||||
{
|
||||
int error;
|
||||
nvlist_t *args = fnvlist_alloc();
|
||||
fnvlist_add_uint64(args, ZPOOL_INITIALIZE_COMMAND, (uint64_t)cmd_type);
|
||||
fnvlist_add_nvlist(args, ZPOOL_INITIALIZE_VDEVS, vdevs);
|
||||
|
||||
error = lzc_ioctl(ZFS_IOC_POOL_INITIALIZE, poolname, args, errlist);
|
||||
|
||||
fnvlist_free(args);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <libnvpair.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/fs/zfs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -56,6 +58,8 @@ int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **);
|
||||
int lzc_bookmark(nvlist_t *, nvlist_t **);
|
||||
int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **);
|
||||
int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **);
|
||||
int lzc_initialize(const char *, pool_initialize_func_t, nvlist_t *,
|
||||
nvlist_t **);
|
||||
|
||||
int lzc_snaprange_space(const char *, const char *, uint64_t *);
|
||||
|
||||
|
@ -56,6 +56,7 @@ DSRCS= errno.d \
|
||||
tcp.d \
|
||||
socket.d \
|
||||
udp.d \
|
||||
udplite.d \
|
||||
unistd.d
|
||||
|
||||
FILES= ${DSRCS}
|
||||
|
@ -167,6 +167,8 @@ inline short IPPROTO_IPCOMP = 108;
|
||||
inline short IPPROTO_SCTP = 132;
|
||||
#pragma D binding "1.5" IPPROTO_RAW
|
||||
inline short IPPROTO_RAW = 255;
|
||||
#pragma D binding "1.13" IPPROTO_UDPLITE
|
||||
inline short IPPROTO_UDPLITE = 136;
|
||||
|
||||
inline uint8_t INP_IPV4 = 0x01;
|
||||
inline uint8_t INP_IPV6 = 0x02;
|
||||
@ -193,6 +195,7 @@ inline string protocols[int proto] =
|
||||
proto == IPPROTO_PIM ? "PIM" :
|
||||
proto == IPPROTO_IPCOMP ? "IPCOMP" :
|
||||
proto == IPPROTO_SCTP ? "SCTP" :
|
||||
proto == IPPROTO_UDPLITE ? "UDPLITE" :
|
||||
proto == IPPROTO_RAW ? "RAW" :
|
||||
"<unknown>";
|
||||
|
||||
|
77
cddl/lib/libdtrace/udplite.d
Normal file
77
cddl/lib/libdtrace/udplite.d
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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 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
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013 Mark Johnston <markj@FreeBSD.org>
|
||||
* Copyright (c) 2018 Michael Tuexen <tuexen@FreeBSD.org>
|
||||
*/
|
||||
|
||||
#pragma D depends_on library ip.d
|
||||
#pragma D depends_on module kernel
|
||||
#pragma D depends_on provider udplite
|
||||
|
||||
/*
|
||||
* udplitesinfo contains stable UDPLite details.
|
||||
*/
|
||||
typedef struct udplitesinfo {
|
||||
uintptr_t udplites_addr;
|
||||
uint16_t udplites_lport; /* local port */
|
||||
uint16_t udplites_rport; /* remote port */
|
||||
string udplites_laddr; /* local address, as a string */
|
||||
string udplites_raddr; /* remote address, as a string */
|
||||
} udplitesinfo_t;
|
||||
|
||||
/*
|
||||
* udpliteinfo is the UDPLite header fields.
|
||||
*/
|
||||
typedef struct udpliteinfo {
|
||||
uint16_t udplite_sport; /* source port */
|
||||
uint16_t udplite_dport; /* destination port */
|
||||
uint16_t udplite_coverage; /* checksum coverage */
|
||||
uint16_t udplite_checksum; /* headers + data checksum */
|
||||
struct udplitehdr *udplite_hdr; /* raw UDPLite header */
|
||||
} udpliteinfo_t;
|
||||
|
||||
#pragma D binding "1.13" translator
|
||||
translator udplitesinfo_t < struct inpcb *p > {
|
||||
udplites_addr = (uintptr_t)p;
|
||||
udplites_lport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_lport);
|
||||
udplites_rport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_fport);
|
||||
udplites_laddr = p == NULL ? "<unknown>" :
|
||||
p->inp_vflag == INP_IPV4 ?
|
||||
inet_ntoa(&p->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) :
|
||||
inet_ntoa6(&p->inp_inc.inc_ie.ie_dependladdr.id6_addr);
|
||||
udplites_raddr = p == NULL ? "<unknown>" :
|
||||
p->inp_vflag == INP_IPV4 ?
|
||||
inet_ntoa(&p->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) :
|
||||
inet_ntoa6(&p->inp_inc.inc_ie.ie_dependfaddr.id6_addr);
|
||||
};
|
||||
|
||||
#pragma D binding "1.13" translator
|
||||
translator udpliteinfo_t < struct udphdr *p > {
|
||||
udplite_sport = p == NULL ? 0 : ntohs(p->uh_sport);
|
||||
udplite_dport = p == NULL ? 0 : ntohs(p->uh_dport);
|
||||
udplite_coverage = p == NULL ? 0 : ntohs(p->uh_ulen);
|
||||
udplite_checksum = p == NULL ? 0 : ntohs(p->uh_sum);
|
||||
udplite_hdr = (struct udplitehdr *)p;
|
||||
};
|
@ -50,7 +50,6 @@ CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
|
@ -25,7 +25,6 @@ CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
|
@ -47,7 +47,6 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
|
||||
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
|
||||
CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
|
@ -19,7 +19,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libumem/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
|
||||
LIBADD= jail nvpair uutil zfs_core zfs
|
||||
|
@ -23,7 +23,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/cmd/stat/common
|
||||
|
||||
|
@ -15,7 +15,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs/
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
|
@ -13,7 +13,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
|
||||
|
@ -14,7 +14,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
|
||||
|
@ -13,12 +13,16 @@ ${PACKAGE}FILES= \
|
||||
tst.ipv4localtcp.ksh.out \
|
||||
tst.ipv4localudp.ksh \
|
||||
tst.ipv4localudp.ksh.out \
|
||||
tst.ipv4localudplite.ksh \
|
||||
tst.ipv4localudplite.ksh.out \
|
||||
tst.ipv4remoteicmp.ksh \
|
||||
tst.ipv4remoteicmp.ksh.out \
|
||||
tst.ipv4remotetcp.ksh \
|
||||
tst.ipv4remotetcp.ksh.out \
|
||||
tst.ipv4remoteudp.ksh \
|
||||
tst.ipv4remoteudp.ksh.out \
|
||||
tst.ipv4remoteudplite.ksh \
|
||||
tst.ipv4remoteudplite.ksh.out \
|
||||
tst.ipv6localicmp.ksh \
|
||||
tst.ipv6localicmp.ksh.out \
|
||||
tst.ipv6remoteicmp.ksh \
|
||||
|
@ -119,6 +119,7 @@ exclude SKIP common/builtinvar/tst.ipl1.d
|
||||
# These tests rely on being able to find a host via broadcast pings.
|
||||
exclude EXFAIL common/ip/tst.ipv4remotetcp.ksh
|
||||
exclude EXFAIL common/ip/tst.ipv4remoteudp.ksh
|
||||
exclude EXFAIL common/ip/tst.ipv4remoteudplite.ksh
|
||||
exclude EXFAIL common/ip/tst.ipv6remoteicmp.ksh
|
||||
exclude EXFAIL common/ip/tst.ipv4remoteicmp.ksh
|
||||
exclude EXFAIL common/ip/tst.remotetcpstate.ksh
|
||||
|
@ -14,6 +14,7 @@ FILES= chmod \
|
||||
sendrecv \
|
||||
tcp \
|
||||
udp \
|
||||
udplite \
|
||||
vop_create \
|
||||
vop_readdir \
|
||||
vop_rename \
|
||||
@ -78,6 +79,8 @@ LINKS+= ${LIBEXECDIR}/dwatch/tcp ${LIBEXECDIR}/dwatch/tcp-state-change
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/tcp ${LIBEXECDIR}/dwatch/tcp-status
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/udp ${LIBEXECDIR}/dwatch/udp-receive
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/udp ${LIBEXECDIR}/dwatch/udp-send
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/udplite ${LIBEXECDIR}/dwatch/udplite-receive
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/udplite ${LIBEXECDIR}/dwatch/udplite-send
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/vop_create ${LIBEXECDIR}/dwatch/vop_lookup
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/vop_create ${LIBEXECDIR}/dwatch/vop_mkdir
|
||||
LINKS+= ${LIBEXECDIR}/dwatch/vop_create ${LIBEXECDIR}/dwatch/vop_mknod
|
||||
|
89
cddl/usr.sbin/dwatch/libexec/udplite
Normal file
89
cddl/usr.sbin/dwatch/libexec/udplite
Normal file
@ -0,0 +1,89 @@
|
||||
# -*- tab-width: 4 -*- ;; Emacs
|
||||
# vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM
|
||||
############################################################ IDENT(1)
|
||||
#
|
||||
# $Title: dwatch(8) module for dtrace_udplite(4) $
|
||||
# $Copyright: 2014-2018 Devin Teske. All rights reserved. $
|
||||
# $FreeBSD$
|
||||
#
|
||||
############################################################ DESCRIPTION
|
||||
#
|
||||
# Display local/remote UDP addresses/ports and bytes sent/received for UDP I/O
|
||||
#
|
||||
############################################################ PROBE
|
||||
|
||||
case "$PROFILE" in
|
||||
udplite) : ${PROBE:=udplite:::send, udplite:::receive} ;;
|
||||
*) : ${PROBE:=udplite:::${PROFILE#udplite-}}
|
||||
esac
|
||||
|
||||
############################################################ ACTIONS
|
||||
|
||||
exec 9<<EOF
|
||||
this string flow;
|
||||
this string local;
|
||||
this string remote;
|
||||
this u_char local6;
|
||||
this u_char recv;
|
||||
this u_char remote6;
|
||||
this uint16_t coverage;
|
||||
this uint16_t lport;
|
||||
this uint16_t rport;
|
||||
|
||||
$PROBE /* probe ID $ID */
|
||||
{${TRACE:+
|
||||
printf("<$ID>");
|
||||
}
|
||||
/*
|
||||
* dtrace_udplite(4)
|
||||
*/
|
||||
this->recv = probename == "receive" ? 1 : 0;
|
||||
this->flow = this->recv ? "<-" : "->";
|
||||
|
||||
/*
|
||||
* ipinfo_t *
|
||||
*/
|
||||
this->local = this->recv ? args[2]->ip_daddr : args[2]->ip_saddr;
|
||||
this->remote = this->recv ? args[2]->ip_saddr : args[2]->ip_daddr;
|
||||
|
||||
/*
|
||||
* udpliteinfo_t *
|
||||
*/
|
||||
this->coverage = (uint16_t)args[4]->udplite_coverage;
|
||||
this->lport = this->recv ? args[4]->udplite_dport : args[4]->udplite_sport;
|
||||
this->rport = this->recv ? args[4]->udplite_sport : args[4]->udplite_dport;
|
||||
|
||||
/*
|
||||
* IPv6 support
|
||||
*/
|
||||
this->local6 = strstr(this->local, ":") != NULL ? 1 : 0;
|
||||
this->remote6 = strstr(this->remote, ":") != NULL ? 1 : 0;
|
||||
this->local = strjoin(strjoin(this->local6 ? "[" : "",
|
||||
this->local), this->local6 ? "]" : "");
|
||||
this->remote = strjoin(strjoin(this->remote6 ? "[" : "",
|
||||
this->remote), this->remote6 ? "]" : "");
|
||||
}
|
||||
EOF
|
||||
ACTIONS=$( cat <&9 )
|
||||
ID=$(( $ID + 1 ))
|
||||
|
||||
############################################################ EVENT DETAILS
|
||||
|
||||
if [ ! "$CUSTOM_DETAILS" ]; then
|
||||
exec 9<<EOF
|
||||
/*
|
||||
* Print network I/O details
|
||||
*/
|
||||
printf("%s:%u %s %s:%u %d byte%s",
|
||||
this->local, this->lport,
|
||||
this->flow,
|
||||
this->remote, this->rport,
|
||||
this->coverage,
|
||||
this->coverage == 1 ? "" : "s");
|
||||
EOF
|
||||
EVENT_DETAILS=$( cat <&9 )
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# END
|
||||
################################################################################
|
@ -20,7 +20,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
|
||||
|
@ -28,7 +28,6 @@ INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
|
||||
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
|
||||
CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS}
|
||||
|
||||
|
@ -18,7 +18,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
|
||||
|
@ -1212,5 +1212,6 @@ elf_update(Elf *e, Elf_Cmd c)
|
||||
|
||||
done:
|
||||
_libelf_release_extents(&extents);
|
||||
e->e_flags &= ~LIBELF_F_SHDRS_LOADED;
|
||||
return (rc);
|
||||
}
|
||||
|
@ -66,6 +66,10 @@ AArch64::AArch64() {
|
||||
PltHeaderSize = 32;
|
||||
DefaultMaxPageSize = 65536;
|
||||
|
||||
// Align to the 2 MiB page size (known as a superpage or huge page).
|
||||
// FreeBSD automatically promotes 2 MiB-aligned allocations.
|
||||
DefaultImageBase = 0x200000;
|
||||
|
||||
// It doesn't seem to be documented anywhere, but tls on aarch64 uses variant
|
||||
// 1 of the tls structures and the tcb size is 16.
|
||||
TcbSize = 16;
|
||||
|
@ -60,6 +60,10 @@ X86::X86() {
|
||||
PltHeaderSize = 16;
|
||||
TlsGdRelaxSkip = 2;
|
||||
TrapInstr = 0xcccccccc; // 0xcc = INT3
|
||||
|
||||
// Align to the non-PAE large page size (known as a superpage or huge page).
|
||||
// FreeBSD automatically promotes large, superpage-aligned allocations.
|
||||
DefaultImageBase = 0x400000;
|
||||
}
|
||||
|
||||
static bool hasBaseReg(uint8_t ModRM) { return (ModRM & 0xc7) != 0x5; }
|
||||
|
@ -54,7 +54,7 @@ run(int n, ...)
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__amd64__) || defined(__sparc64__)
|
||||
for (i = 0; i < 5; i++) {
|
||||
#elif defined(__aarch64__) || defined(__riscv__)
|
||||
#elif defined(__aarch64__) || defined(__riscv)
|
||||
for (i = 0; i < 7; i++) {
|
||||
#else
|
||||
for (i = 0; i < 9; i++) {
|
||||
@ -126,7 +126,7 @@ ATF_TC_BODY(setcontext_link, tc)
|
||||
*/
|
||||
makecontext(&uc[i], (void *)run, 6, i,
|
||||
0, 1, 2, 3, 4);
|
||||
#elif defined(__aarch64__) || defined(__riscv__)
|
||||
#elif defined(__aarch64__) || defined(__riscv)
|
||||
/*
|
||||
* FreeBSD/arm64 and FreeBSD/riscv64 only permit up to
|
||||
* 8 arguments.
|
||||
|
@ -74,10 +74,6 @@ BIN1+= amd.map
|
||||
BIN1+= auto_master
|
||||
.endif
|
||||
|
||||
.if ${MK_BLACKLIST} != "no"
|
||||
BIN1+= blacklistd.conf
|
||||
.endif
|
||||
|
||||
.if ${MK_FREEBSD_UPDATE} != "no"
|
||||
BIN1+= freebsd-update.conf
|
||||
.endif
|
||||
@ -218,9 +214,6 @@ distribution:
|
||||
${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
|
||||
.endif
|
||||
${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
|
||||
.if ${MK_PKGBOOTSTRAP} != "no"
|
||||
${_+_}cd ${.CURDIR}/pkg; ${MAKE} install
|
||||
.endif
|
||||
${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
|
||||
${_+_}cd ${.CURDIR}/syslog.d; ${MAKE} install
|
||||
${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
|
||||
|
@ -1,10 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
NO_OBJ=
|
||||
|
||||
FILES= FreeBSD.conf
|
||||
|
||||
FILESDIR= /etc/pkg
|
||||
FILESMODE= 644
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -161,7 +161,7 @@ Login names are limited to
|
||||
.Dv MAXLOGNAME
|
||||
(from
|
||||
.In sys/param.h )
|
||||
characters, currently 17 including null.
|
||||
characters, currently 33 including null.
|
||||
.It Bq Er EPERM
|
||||
The caller tried to set the login name and was not the super-user.
|
||||
.It Bq Er ERANGE
|
||||
|
@ -80,7 +80,7 @@ Login class names are limited to
|
||||
.Dv MAXLOGNAME
|
||||
(from
|
||||
.In sys/param.h )
|
||||
characters, currently 17 including null.
|
||||
characters, currently 33 including null.
|
||||
.It Bq Er EPERM
|
||||
The caller tried to set the login class and was not the super-user.
|
||||
.It Bq Er ENAMETOOLONG
|
||||
|
@ -16,6 +16,7 @@ CRTSRC= ${SRCTOP}/contrib/compiler-rt
|
||||
|
||||
CLANGDIR= /usr/lib/clang/7.0.0
|
||||
LIBDIR= ${CLANGDIR}/lib/freebsd
|
||||
SHLIBDIR= ${LIBDIR}
|
||||
|
||||
NO_PIC=
|
||||
MK_PROFILE= no
|
||||
|
@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../sys/mips/include/cca.h"
|
||||
#define _KVM_MINIDUMP
|
||||
#include "../../sys/mips/include/cpuregs.h"
|
||||
#include "../../sys/mips/include/minidump.h"
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)time.h 8.5 (Berkeley) 5/4/95
|
||||
*/
|
||||
|
||||
#ifndef _LIBNETBSD_SYS_TIME_H_
|
||||
#define _LIBNETBSD_SYS_TIME_H_
|
||||
|
||||
#include_next <sys/time.h>
|
||||
|
||||
/* Operations on timespecs. */
|
||||
#define timespecclear(tsp) (tsp)->tv_sec = (time_t)((tsp)->tv_nsec = 0L)
|
||||
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
|
||||
#define timespeccmp(tsp, usp, cmp) \
|
||||
(((tsp)->tv_sec == (usp)->tv_sec) ? \
|
||||
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
|
||||
((tsp)->tv_sec cmp (usp)->tv_sec))
|
||||
#define timespecadd(tsp, usp, vsp) \
|
||||
do { \
|
||||
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
|
||||
(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
|
||||
if ((vsp)->tv_nsec >= 1000000000L) { \
|
||||
(vsp)->tv_sec++; \
|
||||
(vsp)->tv_nsec -= 1000000000L; \
|
||||
} \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
#define timespecsub(tsp, usp, vsp) \
|
||||
do { \
|
||||
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
|
||||
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
|
||||
if ((vsp)->tv_nsec < 0) { \
|
||||
(vsp)->tv_sec--; \
|
||||
(vsp)->tv_nsec += 1000000000L; \
|
||||
} \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
#endif
|
@ -13,7 +13,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
|
||||
CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys
|
||||
CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
|
||||
CFLAGS+= -I${.CURDIR:H}
|
||||
CFLAGS+= -DNEED_SOLARIS_BOOLEAN
|
||||
|
@ -80,15 +80,21 @@ pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r)
|
||||
void
|
||||
pt_fpreg_to_ucontext(const struct fpreg *r __unused, ucontext_t *uc __unused)
|
||||
{
|
||||
mcontext_t *mc = &uc->uc_mcontext;
|
||||
|
||||
/* RISCVTODO */
|
||||
memcpy(&mc->mc_fpregs, r, sizeof(*r));
|
||||
mc->mc_flags |= _MC_FP_VALID;
|
||||
}
|
||||
|
||||
void
|
||||
pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused)
|
||||
{
|
||||
const mcontext_t *mc = &uc->uc_mcontext;
|
||||
|
||||
/* RISCVTODO */
|
||||
if (mc->mc_flags & _MC_FP_VALID)
|
||||
memcpy(r, &mc->mc_fpregs, sizeof(*r));
|
||||
else
|
||||
memset(r, 0, sizeof(*r));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" from: @(#)ttys.5 8.1 (Berkeley) 6/4/93
|
||||
.\" $FreeBSD$
|
||||
.\" "
|
||||
.Dd March 2, 2018
|
||||
.Dd August 3, 2018
|
||||
.Dt TTYS 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -167,9 +167,8 @@ ttyv0 "/usr/local/bin/xterm -display :0" xterm on window="/usr/local/bin/X :0"
|
||||
.Xr termcap 5 ,
|
||||
.Xr getty 8 ,
|
||||
.Xr init 8 ,
|
||||
.Xr pam_securetty 8 ,
|
||||
.Xr pstat 8
|
||||
.\".Xr init 8 ,
|
||||
.\".Xr ttyflags 8
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
|
@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD$";
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@ -55,7 +56,9 @@ static char *rcsid = "$FreeBSD$";
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include "rtld.h"
|
||||
#include "rtld_printf.h"
|
||||
#include "paths.h"
|
||||
|
||||
static void morecore();
|
||||
static int findbucket();
|
||||
@ -472,9 +475,11 @@ int n;
|
||||
if (pagepool_end - pagepool_start > pagesz) {
|
||||
caddr_t addr = (caddr_t)
|
||||
(((long)pagepool_start + pagesz - 1) & ~(pagesz - 1));
|
||||
if (munmap(addr, pagepool_end - addr) != 0)
|
||||
rtld_fdprintf(STDERR_FILENO, "morepages: munmap %p",
|
||||
addr);
|
||||
if (munmap(addr, pagepool_end - addr) != 0) {
|
||||
rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": "
|
||||
"morepages: cannot munmap %p: %s\n",
|
||||
addr, rtld_strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
offset = (long)pagepool_start - ((long)pagepool_start & ~(pagesz - 1));
|
||||
@ -482,7 +487,9 @@ int n;
|
||||
if ((pagepool_start = mmap(0, n * pagesz,
|
||||
PROT_READ|PROT_WRITE,
|
||||
MAP_ANON|MAP_PRIVATE, fd, 0)) == (caddr_t)-1) {
|
||||
rtld_printf("Cannot map anonymous memory\n");
|
||||
rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": morepages: "
|
||||
"cannot mmap anonymous memory: %s\n",
|
||||
rtld_strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
pagepool_end = pagepool_start + n * pagesz;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifdef COMPAT_32BIT
|
||||
#define _PATH_ELF_HINTS "/var/run/ld-elf32.so.hints"
|
||||
#define _PATH_LIBMAP_CONF "/etc/libmap32.conf"
|
||||
#define _PATH_RTLD "/libexec/ld-elf32.so.1"
|
||||
#define _BASENAME_RTLD "ld-elf32.so.1"
|
||||
#define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32"
|
||||
#define LD_ "LD_32_"
|
||||
#endif
|
||||
@ -47,8 +47,12 @@
|
||||
#define _PATH_LIBMAP_CONF "/etc/libmap.conf"
|
||||
#endif
|
||||
|
||||
#ifndef _BASENAME_RTLD
|
||||
#define _BASENAME_RTLD "ld-elf.so.1"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_RTLD
|
||||
#define _PATH_RTLD "/libexec/ld-elf.so.1"
|
||||
#define _PATH_RTLD "/libexec/" _BASENAME_RTLD
|
||||
#endif
|
||||
|
||||
#ifndef STANDARD_LIBRARY_PATH
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
|
||||
* Copyright (c) 2015-2018 Ruslan Bukin <br@bsdpad.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by SRI International and the University of
|
||||
@ -64,7 +64,7 @@ END(.rtld_start)
|
||||
*/
|
||||
ENTRY(_rtld_bind_start)
|
||||
/* Save the arguments and ra */
|
||||
addi sp, sp, -(8 * 25)
|
||||
addi sp, sp, -(8 * 17)
|
||||
sd a0, (8 * 0)(sp)
|
||||
sd a1, (8 * 1)(sp)
|
||||
sd a2, (8 * 2)(sp)
|
||||
@ -74,17 +74,17 @@ ENTRY(_rtld_bind_start)
|
||||
sd a6, (8 * 6)(sp)
|
||||
sd a7, (8 * 7)(sp)
|
||||
sd ra, (8 * 8)(sp)
|
||||
#if 0
|
||||
/* RISCVTODO VFP */
|
||||
|
||||
#ifdef __riscv_float_abi_double
|
||||
/* Save any floating-point arguments */
|
||||
fsq fa0, (8 * 9)(sp)
|
||||
fsq fa1, (8 * 11)(sp)
|
||||
fsq fa2, (8 * 13)(sp)
|
||||
fsq fa3, (8 * 15)(sp)
|
||||
fsq fa4, (8 * 17)(sp)
|
||||
fsq fa5, (8 * 19)(sp)
|
||||
fsq fa6, (8 * 21)(sp)
|
||||
fsq fa7, (8 * 23)(sp)
|
||||
fsd fa0, (8 * 9)(sp)
|
||||
fsd fa1, (8 * 10)(sp)
|
||||
fsd fa2, (8 * 11)(sp)
|
||||
fsd fa3, (8 * 12)(sp)
|
||||
fsd fa4, (8 * 13)(sp)
|
||||
fsd fa5, (8 * 14)(sp)
|
||||
fsd fa6, (8 * 15)(sp)
|
||||
fsd fa7, (8 * 16)(sp)
|
||||
#endif
|
||||
|
||||
/* Reloc offset is 3x of the .got.plt offset */
|
||||
@ -110,19 +110,19 @@ ENTRY(_rtld_bind_start)
|
||||
ld a6, (8 * 6)(sp)
|
||||
ld a7, (8 * 7)(sp)
|
||||
ld ra, (8 * 8)(sp)
|
||||
#if 0
|
||||
/* RISCVTODO VFP */
|
||||
|
||||
#ifdef __riscv_float_abi_double
|
||||
/* Restore floating-point arguments */
|
||||
flq fa0, (8 * 9)(sp)
|
||||
flq fa1, (8 * 11)(sp)
|
||||
flq fa2, (8 * 13)(sp)
|
||||
flq fa3, (8 * 15)(sp)
|
||||
flq fa4, (8 * 17)(sp)
|
||||
flq fa5, (8 * 19)(sp)
|
||||
flq fa6, (8 * 21)(sp)
|
||||
flq fa7, (8 * 23)(sp)
|
||||
fld fa0, (8 * 9)(sp)
|
||||
fld fa1, (8 * 10)(sp)
|
||||
fld fa2, (8 * 11)(sp)
|
||||
fld fa3, (8 * 12)(sp)
|
||||
fld fa4, (8 * 13)(sp)
|
||||
fld fa5, (8 * 14)(sp)
|
||||
fld fa6, (8 * 15)(sp)
|
||||
fld fa7, (8 * 16)(sp)
|
||||
#endif
|
||||
addi sp, sp, (8 * 25)
|
||||
addi sp, sp, (8 * 17)
|
||||
|
||||
/* Call into the correct function */
|
||||
jr t0
|
||||
|
@ -408,8 +408,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr;
|
||||
if (phdr == obj_rtld.phdr) {
|
||||
if (!trust) {
|
||||
rtld_printf("Tainted process refusing to run binary %s\n",
|
||||
argv0);
|
||||
_rtld_error("Tainted process refusing to run binary %s",
|
||||
argv0);
|
||||
rtld_die();
|
||||
}
|
||||
dbg("opening main program in direct exec mode");
|
||||
@ -420,7 +420,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
if (!explicit_fd)
|
||||
fd = open_binary_fd(argv0, search_in_path);
|
||||
if (fstat(fd, &st) == -1) {
|
||||
_rtld_error("failed to fstat FD %d (%s): %s", fd,
|
||||
_rtld_error("Failed to fstat FD %d (%s): %s", fd,
|
||||
explicit_fd ? "user-provided descriptor" : argv0,
|
||||
rtld_strerror(errno));
|
||||
rtld_die();
|
||||
@ -447,8 +447,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
dir_enable = true;
|
||||
}
|
||||
if (!dir_enable) {
|
||||
rtld_printf("No execute permission for binary %s\n",
|
||||
argv0);
|
||||
_rtld_error("No execute permission for binary %s",
|
||||
argv0);
|
||||
rtld_die();
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
rtld_printf("no binary\n");
|
||||
_rtld_error("No binary");
|
||||
rtld_die();
|
||||
}
|
||||
}
|
||||
@ -962,6 +962,7 @@ rtld_die(void)
|
||||
|
||||
if (msg == NULL)
|
||||
msg = "Fatal error";
|
||||
rtld_fdputstr(STDERR_FILENO, _BASENAME_RTLD ": ");
|
||||
rtld_fdputstr(STDERR_FILENO, msg);
|
||||
rtld_fdputchar(STDERR_FILENO, '\n');
|
||||
_exit(1);
|
||||
@ -2441,7 +2442,7 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp,
|
||||
return NULL;
|
||||
}
|
||||
if (fs.f_flags & MNT_NOEXEC) {
|
||||
_rtld_error("Cannot execute objects on %s\n", fs.f_mntonname);
|
||||
_rtld_error("Cannot execute objects on %s", fs.f_mntonname);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -5317,12 +5318,12 @@ open_binary_fd(const char *argv0, bool search_in_path)
|
||||
if (search_in_path && strchr(argv0, '/') == NULL) {
|
||||
pathenv = getenv("PATH");
|
||||
if (pathenv == NULL) {
|
||||
rtld_printf("-p and no PATH environment variable\n");
|
||||
_rtld_error("-p and no PATH environment variable");
|
||||
rtld_die();
|
||||
}
|
||||
pathenv = strdup(pathenv);
|
||||
if (pathenv == NULL) {
|
||||
rtld_printf("Cannot allocate memory\n");
|
||||
_rtld_error("Cannot allocate memory");
|
||||
rtld_die();
|
||||
}
|
||||
fd = -1;
|
||||
@ -5348,8 +5349,7 @@ open_binary_fd(const char *argv0, bool search_in_path)
|
||||
}
|
||||
|
||||
if (fd == -1) {
|
||||
rtld_printf("Opening %s: %s\n", argv0,
|
||||
rtld_strerror(errno));
|
||||
_rtld_error("Cannot open %s: %s", argv0, rtld_strerror(errno));
|
||||
rtld_die();
|
||||
}
|
||||
return (fd);
|
||||
@ -5393,7 +5393,7 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp)
|
||||
opt = arg[j];
|
||||
if (opt == 'h') {
|
||||
print_usage(argv[0]);
|
||||
rtld_die();
|
||||
_exit(0);
|
||||
} else if (opt == 'f') {
|
||||
/*
|
||||
* -f XX can be used to specify a descriptor for the
|
||||
@ -5403,13 +5403,13 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp)
|
||||
*/
|
||||
if (j != arglen - 1) {
|
||||
/* -f must be the last option in, e.g., -abcf */
|
||||
_rtld_error("invalid options: %s", arg);
|
||||
_rtld_error("Invalid options: %s", arg);
|
||||
rtld_die();
|
||||
}
|
||||
i++;
|
||||
fd = parse_integer(argv[i]);
|
||||
if (fd == -1) {
|
||||
_rtld_error("invalid file descriptor: '%s'",
|
||||
_rtld_error("Invalid file descriptor: '%s'",
|
||||
argv[i]);
|
||||
rtld_die();
|
||||
}
|
||||
@ -5418,7 +5418,7 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp)
|
||||
} else if (opt == 'p') {
|
||||
*use_pathp = true;
|
||||
} else {
|
||||
rtld_printf("invalid argument: '%s'\n", arg);
|
||||
_rtld_error("Invalid argument: '%s'", arg);
|
||||
print_usage(argv[0]);
|
||||
rtld_die();
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ expect_missing_library(int binary, char *pathfds)
|
||||
{
|
||||
char * const env[] = { pathfds, NULL };
|
||||
try_to_run(binary, 1, env, "",
|
||||
"Shared object \"libpythagoras.so.0\" not found,"
|
||||
"ld-elf.so.1: Shared object \"libpythagoras.so.0\" not found,"
|
||||
" required by \"target\"\n");
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,6 @@ TLD?= ${FTPDIR}/releases
|
||||
|
||||
.if defined(EMBEDDED) && !empty(EMBEDDED)
|
||||
. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == "aarch64")
|
||||
. if !defined(BOARDNAME) && empty(BOARDNAME)
|
||||
BOARDNAME:= ${KERNCONF}
|
||||
. else
|
||||
OLDNAME:= ${KERNCONF}
|
||||
. endif
|
||||
. if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != ""
|
||||
SNAPSHOT= 1
|
||||
. endif
|
||||
@ -91,12 +86,6 @@ iso-images-stage:
|
||||
cd ${RELEASEDIR} && rm -f CHECKSUM.*
|
||||
. for IMAGE in ${IMAGES}
|
||||
. if defined(EMBEDDED) && !empty(EMBEDDED)
|
||||
. if defined(OLDNAME) && !empty(OLDNAME)
|
||||
@# arm/armv6 IMX6 -> WANDBOARD, for example.
|
||||
cd ${RELEASEDIR} && \
|
||||
mv ${OSRELEASE}-${OLDNAME}.${IMAGE}.xz \
|
||||
${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
|
||||
. endif
|
||||
cd ${RELEASEDIR} && \
|
||||
mv ${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \
|
||||
${OSRELEASE}-${BOARDNAME}-${SNAP_SUFFIX}.${IMAGE}.xz
|
||||
@ -150,12 +139,6 @@ iso-images-stage:
|
||||
.else # not snapshot
|
||||
. for IMAGE in ${IMAGES}
|
||||
. if defined(EMBEDDED) && !empty(EMBEDDED)
|
||||
. if defined(OLDNAME) && !empty(OLDNAME)
|
||||
@# arm/armv6 IMX6 -> WANDBOARD, for example.
|
||||
cd ${RELEASEDIR} && \
|
||||
mv ${OSRELEASE}-${OLDNAME}.${IMAGE}.xz \
|
||||
${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
|
||||
. endif
|
||||
cp -p ${RELEASEDIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz \
|
||||
${ISO_DIR}/${OSRELEASE}-${BOARDNAME}.${IMAGE}.xz
|
||||
cd ${TLD}/ISO-IMAGES/${REVISION} && \
|
||||
|
@ -21,6 +21,6 @@ arm_install_uboot() {
|
||||
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
|
||||
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
|
||||
of=/dev/${mddev} bs=1k seek=8 conv=sync
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -23,10 +23,9 @@ arm_install_uboot() {
|
||||
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO
|
||||
chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -19,22 +19,8 @@ export BOARDNAME="CUBIEBOARD"
|
||||
arm_install_uboot() {
|
||||
UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard"
|
||||
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
|
||||
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
|
||||
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
|
||||
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
|
||||
of=/dev/${mddev} bs=1k seek=8 conv=sync
|
||||
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
|
||||
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \
|
||||
${FATMOUNT}/ubldr.bin
|
||||
chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
umount_loop ${CHROOTDIR}/${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -19,22 +19,8 @@ export BOARDNAME="CUBIEBOARD2"
|
||||
arm_install_uboot() {
|
||||
UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard2"
|
||||
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
|
||||
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
|
||||
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
|
||||
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
|
||||
of=/dev/${mddev} bs=1k seek=8 conv=sync
|
||||
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
|
||||
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \
|
||||
${FATMOUNT}/ubldr.bin
|
||||
chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
umount_loop ${CHROOTDIR}/${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ EMBEDDEDPORTS="sysutils/u-boot-cubox-hummingboard"
|
||||
FAT_SIZE="50m -b 16384"
|
||||
FAT_TYPE="16"
|
||||
IMAGE_SIZE="3072M"
|
||||
KERNEL="IMX6"
|
||||
KERNEL="GENERIC"
|
||||
MD_ARGS="-x 63 -y 255"
|
||||
NODOC=1
|
||||
PART_SCHEME="MBR"
|
||||
@ -19,22 +19,8 @@ export BOARDNAME="CUBOX-HUMMINGBOARD"
|
||||
arm_install_uboot() {
|
||||
UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubox-hummingboard"
|
||||
UBOOT_FILES="u-boot.imx"
|
||||
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
|
||||
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
|
||||
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
|
||||
of=/dev/${mddev} bs=512 seek=2 conv=sync
|
||||
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
|
||||
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \
|
||||
${FATMOUNT}/ubldr.bin
|
||||
chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
umount_loop ${CHROOTDIR}/${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -19,21 +19,13 @@ export BOARDNAME="PANDABOARD"
|
||||
arm_install_uboot() {
|
||||
UBOOT_DIR="/usr/local/share/u-boot/u-boot-pandaboard"
|
||||
FATMOUNT="${DESTDIR%${KERNEL}}/fat"
|
||||
UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
|
||||
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
|
||||
chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}"
|
||||
chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO
|
||||
chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \
|
||||
${FATMOUNT}/ubldr.bin
|
||||
chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
umount_loop ${CHROOTDIR}/${UFSMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware"
|
||||
OL_DIR="${RPI_FIRMWARE_DIR}/overlays"
|
||||
OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo"
|
||||
PART_SCHEME="MBR"
|
||||
export BOARDNAME="RPI-B"
|
||||
|
||||
arm_install_uboot() {
|
||||
UBOOT_FILES="u-boot.bin"
|
||||
@ -42,7 +43,6 @@ arm_install_uboot() {
|
||||
chroot ${CHROOTDIR} cp -p ${OL_DIR}/${_OL} \
|
||||
${FATMOUNT}/overlays/${_OL}
|
||||
done
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
|
@ -42,7 +42,6 @@ arm_install_uboot() {
|
||||
chroot ${CHROOTDIR} cp -p ${OL_DIR}/${_OL} \
|
||||
${FATMOUNT}/overlays/${_OL}
|
||||
done
|
||||
chroot ${CHROOTDIR} cp ${UBOOT_DIR}/boot.scr ${FATMOUNT}/boot.scr
|
||||
sync
|
||||
umount_loop ${CHROOTDIR}/${FATMOUNT}
|
||||
chroot ${CHROOTDIR} rmdir ${FATMOUNT}
|
||||
|
@ -10,7 +10,7 @@ EMBEDDEDPORTS="sysutils/u-boot-wandboard"
|
||||
FAT_SIZE="50m -b 16384"
|
||||
FAT_TYPE="16"
|
||||
IMAGE_SIZE="3072M"
|
||||
KERNEL="IMX6"
|
||||
KERNEL="GENERIC"
|
||||
MD_ARGS="-x 63 -y 255"
|
||||
NODOC=1
|
||||
PART_SCHEME="MBR"
|
||||
@ -21,6 +21,6 @@ arm_install_uboot() {
|
||||
UBOOT_FILES="u-boot.imx"
|
||||
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
|
||||
of=/dev/${mddev} bs=512 seek=2 conv=sync
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
26
release/arm64/PINE64-LTS.conf
Normal file
26
release/arm64/PINE64-LTS.conf
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
EMBEDDED_TARGET_ARCH="aarch64"
|
||||
EMBEDDED_TARGET="arm64"
|
||||
EMBEDDEDBUILD=1
|
||||
EMBEDDEDPORTS="sysutils/u-boot-sopine"
|
||||
FAT_SIZE="54m -b 1m"
|
||||
FAT_TYPE="16"
|
||||
IMAGE_SIZE="2560M"
|
||||
KERNEL="GENERIC"
|
||||
MD_ARGS="-x 63 -y 255"
|
||||
NODOC=1
|
||||
PART_SCHEME="MBR"
|
||||
export BOARDNAME="PINE64-LTS"
|
||||
|
||||
arm_install_uboot() {
|
||||
UBOOT_DIR="/usr/local/share/u-boot/u-boot-sopine"
|
||||
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
|
||||
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
|
||||
of=/dev/${mddev} bs=1k seek=8 conv=sync
|
||||
|
||||
return 0
|
||||
}
|
@ -307,7 +307,7 @@ extra_chroot_setup() {
|
||||
for _PORT in ${EMBEDDEDPORTS}; do
|
||||
eval chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \
|
||||
/usr/ports/${_PORT} \
|
||||
FORCE_PKG_REGISTER=1 install clean distclean
|
||||
FORCE_PKG_REGISTER=1 deinstall install clean distclean
|
||||
done
|
||||
fi
|
||||
|
||||
@ -392,7 +392,7 @@ chroot_arm_build_release() {
|
||||
export WORLDDIR="$(eval chroot ${CHROOTDIR} make ${MAKE_FLAGS} -C /usr/src/release -V WORLDDIR)"
|
||||
export OBJDIR="$(eval chroot ${CHROOTDIR} env WITH_UNIFIED_OBJDIR=1 make ${MAKE_FLAGS} -C /usr/src/release -V .OBJDIR)"
|
||||
export DESTDIR="${OBJDIR}/${KERNEL}"
|
||||
export IMGBASE="${CHROOTDIR}/${OBJDIR}/${KERNEL}.img"
|
||||
export IMGBASE="${CHROOTDIR}/${OBJDIR}/${BOARDNAME}.img"
|
||||
export OSRELEASE="$(eval chroot ${CHROOTDIR} make ${MAKE_FLAGS} -C /usr/src/release \
|
||||
TARGET=${EMBEDDED_TARGET} TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \
|
||||
-V OSRELEASE)"
|
||||
@ -406,11 +406,11 @@ chroot_arm_build_release() {
|
||||
arm_install_uboot
|
||||
mdconfig -d -u ${mddev}
|
||||
chroot ${CHROOTDIR} rmdir ${DESTDIR}
|
||||
mv ${IMGBASE} ${CHROOTDIR}/${OBJDIR}/${OSRELEASE}-${KERNEL}.img
|
||||
mv ${IMGBASE} ${CHROOTDIR}/${OBJDIR}/${OSRELEASE}-${BOARDNAME}.img
|
||||
chroot ${CHROOTDIR} mkdir -p /R
|
||||
chroot ${CHROOTDIR} cp -p ${OBJDIR}/${OSRELEASE}-${KERNEL}.img \
|
||||
/R/${OSRELEASE}-${KERNEL}.img
|
||||
chroot ${CHROOTDIR} xz -T ${XZ_THREADS} /R/${OSRELEASE}-${KERNEL}.img
|
||||
chroot ${CHROOTDIR} cp -p ${OBJDIR}/${OSRELEASE}-${BOARDNAME}.img \
|
||||
/R/${OSRELEASE}-${BOARDNAME}.img
|
||||
chroot ${CHROOTDIR} xz -T ${XZ_THREADS} /R/${OSRELEASE}-${BOARDNAME}.img
|
||||
cd ${CHROOTDIR}/R && sha512 ${OSRELEASE}* \
|
||||
> CHECKSUM.SHA512
|
||||
cd ${CHROOTDIR}/R && sha256 ${OSRELEASE}* \
|
||||
|
@ -124,7 +124,20 @@ arm_setup_usb_otg() {
|
||||
echo 'hw.usb.template=3' \
|
||||
>> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
|
||||
echo 'umodem_load="YES"' \
|
||||
>> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
|
||||
}
|
||||
|
||||
arm64_setup_multicons() {
|
||||
if [ "${EMBEDDED_TARGET_ARCH}" != "aarch64" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo '# Multiple console (serial+efi gop) enabled.' \
|
||||
>> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
|
||||
echo 'boot_multicons="YES"' \
|
||||
>> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
|
||||
echo 'boot_serial="YES"' \
|
||||
>> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
|
||||
}
|
||||
|
||||
arm_install_base() {
|
||||
@ -138,6 +151,7 @@ arm_install_base() {
|
||||
|
||||
arm_create_user
|
||||
arm_setup_usb_otg
|
||||
arm64_setup_multicons
|
||||
|
||||
echo '# Custom /etc/fstab for FreeBSD embedded images' \
|
||||
> ${CHROOTDIR}/${DESTDIR}/etc/fstab
|
||||
|
@ -262,12 +262,12 @@ my_system(const char *command)
|
||||
*/
|
||||
cfg.close_pidfile();
|
||||
::closefrom(3);
|
||||
::execl(_PATH_BSHELL, "sh", "-c", command, nullptr);
|
||||
::execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
|
||||
::_exit(127);
|
||||
default: /* parent */
|
||||
savedpid = pid;
|
||||
do {
|
||||
pid = ::wait4(savedpid, &pstat, 0, nullptr);
|
||||
pid = ::wait4(savedpid, &pstat, 0, (struct rusage *)0);
|
||||
} while (pid == -1 && errno == EINTR);
|
||||
break;
|
||||
}
|
||||
@ -374,7 +374,7 @@ media::do_match(config &c)
|
||||
memset(&ifmr, 0, sizeof(ifmr));
|
||||
strlcpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name));
|
||||
|
||||
if (ioctl(s, SIOCGIFMEDIA, &ifmr) >= 0 &&
|
||||
if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0 &&
|
||||
ifmr.ifm_status & IFM_AVALID) {
|
||||
devdlog(LOG_DEBUG, "%s has media type 0x%x\n",
|
||||
value.c_str(), IFM_TYPE(ifmr.ifm_active));
|
||||
@ -527,7 +527,7 @@ config::open_pidfile()
|
||||
pfh = pidfile_open(_pidfile.c_str(), 0600, &otherpid);
|
||||
if (pfh == NULL) {
|
||||
if (errno == EEXIST)
|
||||
errx(1, "devd already running, pid: %d", static_cast<int>(otherpid));
|
||||
errx(1, "devd already running, pid: %d", (int)otherpid);
|
||||
warn("cannot open pid file");
|
||||
}
|
||||
}
|
||||
@ -854,7 +854,7 @@ process_event(char *buffer)
|
||||
// Save the time this happened (as approximated by when we got
|
||||
// around to processing it).
|
||||
gettimeofday(&tv, NULL);
|
||||
asprintf(×tr, "%jd.%06ld", static_cast<uintmax_t>(tv.tv_sec), tv.tv_usec);
|
||||
asprintf(×tr, "%jd.%06ld", (uintmax_t)tv.tv_sec, tv.tv_usec);
|
||||
cfg.set_variable("timestamp", timestr);
|
||||
free(timestr);
|
||||
|
||||
@ -919,7 +919,7 @@ create_socket(const char *name, int socktype)
|
||||
unlink(name);
|
||||
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
|
||||
err(1, "fcntl");
|
||||
if (::bind(fd, reinterpret_cast<struct sockaddr *>(&sun), slen) < 0)
|
||||
if (::bind(fd, (struct sockaddr *) & sun, slen) < 0)
|
||||
err(1, "bind");
|
||||
listen(fd, 4);
|
||||
if (chown(name, 0, 0)) /* XXX - root.wheel */
|
||||
|
@ -297,28 +297,6 @@ foundit:
|
||||
return (bp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Timespec operations (from <sys/time.h>).
|
||||
*/
|
||||
#define timespecsub(vvp, uvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec -= (uvp)->tv_sec; \
|
||||
(vvp)->tv_nsec -= (uvp)->tv_nsec; \
|
||||
if ((vvp)->tv_nsec < 0) { \
|
||||
(vvp)->tv_sec--; \
|
||||
(vvp)->tv_nsec += 1000000000; \
|
||||
} \
|
||||
} while (0)
|
||||
#define timespecadd(vvp, uvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec += (uvp)->tv_sec; \
|
||||
(vvp)->tv_nsec += (uvp)->tv_nsec; \
|
||||
if ((vvp)->tv_nsec >= 1000000000) { \
|
||||
(vvp)->tv_sec++; \
|
||||
(vvp)->tv_nsec -= 1000000000; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void
|
||||
getblk(struct bufarea *bp, ufs2_daddr_t blk, long size)
|
||||
{
|
||||
@ -337,8 +315,9 @@ getblk(struct bufarea *bp, ufs2_daddr_t blk, long size)
|
||||
bp->b_errs = blread(fsreadfd, bp->b_un.b_buf, dblk, size);
|
||||
if (debug) {
|
||||
clock_gettime(CLOCK_REALTIME_PRECISE, &finish);
|
||||
timespecsub(&finish, &start);
|
||||
timespecadd(&readtime[bp->b_type], &finish);
|
||||
timespecsub(&finish, &start, &finish);
|
||||
timespecadd(&readtime[bp->b_type], &finish,
|
||||
&readtime[bp->b_type]);
|
||||
}
|
||||
bp->b_bno = dblk;
|
||||
bp->b_size = size;
|
||||
@ -509,7 +488,7 @@ IOstats(char *what)
|
||||
totaldiskreads += diskreads;
|
||||
diskreads = 0;
|
||||
for (i = 0; i < BT_NUMBUFTYPES; i++) {
|
||||
timespecadd(&totalreadtime[i], &readtime[i]);
|
||||
timespecadd(&totalreadtime[i], &readtime[i], &totalreadtime[i]);
|
||||
totalreadcnt[i] += readcnt[i];
|
||||
readtime[i].tv_sec = readtime[i].tv_nsec = 0;
|
||||
readcnt[i] = 0;
|
||||
@ -529,7 +508,7 @@ finalIOstats(void)
|
||||
diskreads = totaldiskreads;
|
||||
startpass = startprog;
|
||||
for (i = 0; i < BT_NUMBUFTYPES; i++) {
|
||||
timespecadd(&totalreadtime[i], &readtime[i]);
|
||||
timespecadd(&totalreadtime[i], &readtime[i], &totalreadtime[i]);
|
||||
totalreadcnt[i] += readcnt[i];
|
||||
readtime[i] = totalreadtime[i];
|
||||
readcnt[i] = totalreadcnt[i];
|
||||
@ -543,7 +522,7 @@ static void printIOstats(void)
|
||||
int i;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass);
|
||||
timespecsub(&finishpass, &startpass);
|
||||
timespecsub(&finishpass, &startpass, &finishpass);
|
||||
printf("Running time: %jd.%03ld sec\n",
|
||||
(intmax_t)finishpass.tv_sec, finishpass.tv_nsec / 1000000);
|
||||
printf("buffer reads by type:\n");
|
||||
|
@ -164,7 +164,12 @@ MLINKS+= stdarg.3 va_arg.3 \
|
||||
MLINKS+= timeradd.3 timerclear.3 \
|
||||
timeradd.3 timercmp.3 \
|
||||
timeradd.3 timerisset.3 \
|
||||
timeradd.3 timersub.3
|
||||
timeradd.3 timersub.3 \
|
||||
timeradd.3 timespecadd.3 \
|
||||
timeradd.3 timespecsub.3 \
|
||||
timeradd.3 timespecclear.3 \
|
||||
timeradd.3 timespecisset.3 \
|
||||
timeradd.3 timespeccmp.3
|
||||
MLINKS+= tree.3 RB_EMPTY.3 \
|
||||
tree.3 RB_ENTRY.3 \
|
||||
tree.3 RB_FIND.3 \
|
||||
|
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 11, 1999
|
||||
.Dd July 30, 2018
|
||||
.Dt TIMERADD 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -35,8 +35,13 @@
|
||||
.Nm timersub ,
|
||||
.Nm timerclear ,
|
||||
.Nm timerisset ,
|
||||
.Nm timercmp
|
||||
.Nd operations on timevals
|
||||
.Nm timercmp ,
|
||||
.Nm timespecadd ,
|
||||
.Nm timespecsub ,
|
||||
.Nm timespecclear ,
|
||||
.Nm timespecisset ,
|
||||
.Nm timespeccmp
|
||||
.Nd operations on timevals and timespecs
|
||||
.Sh SYNOPSIS
|
||||
.In sys/time.h
|
||||
.Ft void
|
||||
@ -49,15 +54,31 @@
|
||||
.Fn timerisset "struct timeval *tvp"
|
||||
.Ft int
|
||||
.Fn timercmp "struct timeval *a" "struct timeval *b" CMP
|
||||
.Ft void
|
||||
.Fn timespecadd "struct timespec *a" "struct timespec *b" "struct timespec *res"
|
||||
.Ft void
|
||||
.Fn timespecsub "struct timespec *a" "struct timespec *b" "struct timespec *res"
|
||||
.Ft void
|
||||
.Fn timespecclear "struct timespec *ts"
|
||||
.Ft int
|
||||
.Fn timespecisset "struct timespec *ts"
|
||||
.Ft int
|
||||
.Fn timespeccmp "struct timespec *a" "struct timespec *b" CMP
|
||||
.Sh DESCRIPTION
|
||||
These macros are provided for manipulating
|
||||
.Fa timeval
|
||||
and
|
||||
.Fa timespec
|
||||
structures for use with the
|
||||
.Xr clock_gettime 2 ,
|
||||
.Xr clock_settime 2 ,
|
||||
.Xr gettimeofday 2
|
||||
and
|
||||
.Xr settimeofday 2
|
||||
calls.
|
||||
The structure is defined in
|
||||
The
|
||||
.Fa timeval
|
||||
structure is defined in
|
||||
.In sys/time.h
|
||||
as:
|
||||
.Bd -literal
|
||||
@ -66,50 +87,67 @@ struct timeval {
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
.Ed
|
||||
And the
|
||||
.Fa timespec
|
||||
structure is defined in
|
||||
.In time.h
|
||||
as:
|
||||
.Bd -literal
|
||||
struct timespec {
|
||||
time_t tv_nsec; /* seconds */
|
||||
long tv_nsec; /* and nanoseconds */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
.Fn timeradd
|
||||
adds the time information stored in
|
||||
and
|
||||
.Fn timespecadd
|
||||
add the time information stored in
|
||||
.Fa a
|
||||
to
|
||||
.Fa b
|
||||
and stores the resulting
|
||||
.Vt timeval
|
||||
in
|
||||
and store the result in
|
||||
.Fa res .
|
||||
The results are simplified such that the value of
|
||||
.Fa res->tv_usec
|
||||
is always less than 1,000,000 (1 second).
|
||||
or
|
||||
.Fa res->tv_nsec
|
||||
is always less than 1 second.
|
||||
.Pp
|
||||
.Fn timersub
|
||||
subtracts the time information stored in
|
||||
and
|
||||
.Fn timespecsub
|
||||
subtract the time information stored in
|
||||
.Fa b
|
||||
from
|
||||
.Fa a
|
||||
and stores the resulting
|
||||
.Vt timeval
|
||||
and store the result
|
||||
in
|
||||
.Fa res .
|
||||
.Pp
|
||||
.Fn timerclear
|
||||
initializes
|
||||
.Fa tvp
|
||||
to midnight (0 hour) January 1st, 1970 (the Epoch).
|
||||
and
|
||||
.Fn timespecclear
|
||||
initialize their argument to midnight (0 hour) January 1st, 1970 (the Epoch).
|
||||
.Pp
|
||||
.Fn timerisset
|
||||
returns true if
|
||||
.Fa tvp
|
||||
is set to any time value other than the Epoch.
|
||||
and
|
||||
.Fn timespecisset
|
||||
return true if their argument is set to any time value other than the Epoch.
|
||||
.Pp
|
||||
.Fn timercmp
|
||||
compares
|
||||
and
|
||||
.Fn timespeccmp
|
||||
compare
|
||||
.Fa a
|
||||
to
|
||||
.Fa b
|
||||
using the comparison operator given in
|
||||
.Fa CMP ,
|
||||
and returns the result of that comparison.
|
||||
and return the result of that comparison.
|
||||
.Sh SEE ALSO
|
||||
.Xr gettimeofday 2
|
||||
.Xr gettimeofday 2 ,
|
||||
.Xr clock_gettime 2
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn timeradd
|
||||
@ -117,3 +155,11 @@ family of macros were imported from
|
||||
.Nx 1.1 ,
|
||||
and appeared in
|
||||
.Fx 2.2.6 .
|
||||
The
|
||||
.Fn timespecadd
|
||||
family of macros were imported from
|
||||
.Nx 1.3
|
||||
into
|
||||
.Fx 3.0 ,
|
||||
though they were not exposed to userland until
|
||||
.Fx 12.0 .
|
||||
|
@ -241,7 +241,6 @@ MAN= aac.4 \
|
||||
ixl.4 \
|
||||
ixlv.4 \
|
||||
jedec_dimm.4 \
|
||||
jedec_ts.4 \
|
||||
jme.4 \
|
||||
joy.4 \
|
||||
kbdmux.4 \
|
||||
@ -897,7 +896,8 @@ _dtrace_provs= dtrace_io.4 \
|
||||
dtrace_sched.4 \
|
||||
dtrace_sctp.4 \
|
||||
dtrace_tcp.4 \
|
||||
dtrace_udp.4
|
||||
dtrace_udp.4 \
|
||||
dtrace_udplite.4
|
||||
.endif
|
||||
|
||||
.if ${MK_ISCSI} != "no"
|
||||
|
@ -23,7 +23,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 22, 2018
|
||||
.Dd August 1, 2018
|
||||
.Dt DTRACE_SCTP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -117,6 +117,7 @@ handshake.
|
||||
.Xr dtrace 1 ,
|
||||
.Xr dtrace_ip 4 ,
|
||||
.Xr dtrace_udp 4 ,
|
||||
.Xr dtrace_udplite 4 ,
|
||||
.Xr sctp 4 ,
|
||||
.Xr SDT 9
|
||||
.\" .Sh HISTORY
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 10, 2018
|
||||
.Dd August 1, 2018
|
||||
.Dt DTRACE_TCP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -374,7 +374,9 @@ provider in Solaris.
|
||||
.Sh SEE ALSO
|
||||
.Xr dtrace 1 ,
|
||||
.Xr dtrace_ip 4 ,
|
||||
.Xr dtrace_sctp 4 ,
|
||||
.Xr dtrace_udp 4 ,
|
||||
.Xr dtrace_udplite 4 ,
|
||||
.Xr tcp 4 ,
|
||||
.Xr SDT 9
|
||||
.Sh HISTORY
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 20, 2018
|
||||
.Dd August 1, 2018
|
||||
.Dt DTRACE_UDP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -189,7 +189,9 @@ provider in Solaris.
|
||||
.Sh SEE ALSO
|
||||
.Xr dtrace 1 ,
|
||||
.Xr dtrace_ip 4 ,
|
||||
.Xr dtrace_sctp 4 ,
|
||||
.Xr dtrace_tcp 4 ,
|
||||
.Xr dtrace_udplite 4 ,
|
||||
.Xr udp 4 ,
|
||||
.Xr SDT 9
|
||||
.Sh HISTORY
|
||||
|
204
share/man/man4/dtrace_udplite.4
Normal file
204
share/man/man4/dtrace_udplite.4
Normal file
@ -0,0 +1,204 @@
|
||||
.\" Copyright (c) 2015 Mark Johnston <markj@FreeBSD.org>
|
||||
.\" Copyright (c) 2018 Michael Tuexen <tuexen@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 1, 2018
|
||||
.Dt DTRACE_UDPLITE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm dtrace_udplite
|
||||
.Nd a DTrace provider for tracing events related to the UDP-Lite protocol
|
||||
.Sh SYNOPSIS
|
||||
.Fn udplite:::receive "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "udplitesinfo_t *" \
|
||||
"udpliteinfo_t *"
|
||||
.Fn udplite:::send "pktinfo_t *" "csinfo_t *" "ipinfo_t *" "udplitesinfo_t *" \
|
||||
"udpliteinfo_t *"
|
||||
.Sh DESCRIPTION
|
||||
The DTrace
|
||||
.Nm udplite
|
||||
provider allows users to trace events in the
|
||||
.Xr udplite 4
|
||||
protocol implementation.
|
||||
The
|
||||
.Fn udplite:::send
|
||||
probe fires whenever the kernel prepares to transmit a UDP-Lite packet, and the
|
||||
.Fn udplite:::receive
|
||||
probe fires whenever the kernel receives a UDP-Lite packet, unless
|
||||
the UDP-Lite header is incomplete,
|
||||
the destination port is 0,
|
||||
the length field is invalid,
|
||||
or the checksum is wrong.
|
||||
The arguments to these probes can be used to obtain detailed information about
|
||||
the IP and UDP-Lite headers of the corresponding packet.
|
||||
.Sh ARGUMENTS
|
||||
The
|
||||
.Vt pktinfo_t
|
||||
argument is currently unimplemented and is included for compatibility with other
|
||||
implementations of this provider.
|
||||
Its fields are:
|
||||
.Bl -tag -width "uintptr_t pkt_addr" -offset indent
|
||||
.It Vt uintptr_t pkt_addr
|
||||
Always set to 0.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Vt csinfo_t
|
||||
argument is currently unimplemented and is included for compatibility with other
|
||||
implementations of this provider.
|
||||
Its fields are:
|
||||
.Bl -tag -width "uintptr_t cs_addr" -offset indent
|
||||
.It Vt uintptr_t cs_addr
|
||||
Always set to 0.
|
||||
.It Vt uint64_t cs_cid
|
||||
A pointer to the
|
||||
.Vt struct inpcb
|
||||
for this packet, or
|
||||
.Dv NULL .
|
||||
.It Vt pid_t cs_pid
|
||||
Always set to 0.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Vt ipinfo_t
|
||||
argument contains IP fields common to both IPv4 and IPv6 packets.
|
||||
Its fields are:
|
||||
.Bl -tag -width "uint32_t ip_plength" -offset indent
|
||||
.It Vt uint8_t ip_ver
|
||||
IP version of the packet, 4 for IPv4 packets and 6 for IPv6 packets.
|
||||
.It Vt uint32_t ip_plength
|
||||
IP payload size.
|
||||
This does not include the size of the IP header or IPv6 option headers.
|
||||
.It Vt string ip_saddr
|
||||
IP source address.
|
||||
.It Vt string ip_daddr
|
||||
IP destination address.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Vt udplitesinfo_t
|
||||
argument contains the state of the UDP-Lite connection associated with the packet.
|
||||
Its fields are:
|
||||
.Bl -tag -width "uintptr_t udplites_addr" -offset indent
|
||||
.It Vt uintptr_t udplites_addr
|
||||
Pointer to the
|
||||
.Vt struct inpcb
|
||||
containing the IP state for the associated socket.
|
||||
.It Vt uint16_t udplites_lport
|
||||
Local UDP-Lite port.
|
||||
.It Vt uint16_t udplites_rport
|
||||
Remote UDP-Lite port.
|
||||
.It Vt string udplites_laddr
|
||||
Local IPv4 or IPv6 address.
|
||||
.It Vt string udplites_raddr
|
||||
Remote IPv4 or IPv6 address.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Vt udpliteinfo_t
|
||||
argument is the raw UDP-Lite header of the packet, with all fields in host order.
|
||||
Its fields are:
|
||||
.Bl -tag -width "struct udplitehdr *udplite_hdr" -offset indent
|
||||
.It Vt uint16_t udplite_sport
|
||||
Source UDP-Lite port.
|
||||
.It Vt uint16_t udplite_dport
|
||||
Destination UDP-Lite port.
|
||||
.It Vt uint16_t udplite_coverage
|
||||
Checksum coverage of the UDP-Lite header, in bytes, or 0 for full coverage.
|
||||
.It Vt uint16_t udplite_checksum
|
||||
A checksum of the UDP-Lite header and payload, or 0 if no checksum was calculated.
|
||||
.It Vt struct udplitehdr *udplite_hdr
|
||||
A pointer to the raw UDP-Lite header.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width "/usr/lib/dtrace/udplite.d" -compact
|
||||
.It Pa /usr/lib/dtrace/udplite.d
|
||||
DTrace type and translator definitions for the
|
||||
.Nm udplite
|
||||
provider.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
The following script counts transmitted packets by destination port.
|
||||
.Bd -literal -offset indent
|
||||
udplite:::send
|
||||
{
|
||||
@num[args[4]->udplite_dport] = count();
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
This script will print some details of each UDP-Lite packet as it is sent or received
|
||||
by the kernel:
|
||||
.Bd -literal -offset indent
|
||||
#pragma D option quiet
|
||||
#pragma D option switchrate=10Hz
|
||||
|
||||
dtrace:::BEGIN
|
||||
{
|
||||
printf(" %10s %36s %-36s %6s\\n", "DELTA(us)", "SOURCE",
|
||||
"DEST", "COV");
|
||||
last = timestamp;
|
||||
}
|
||||
|
||||
udplite:::send
|
||||
{
|
||||
this->elapsed = (timestamp - last) / 1000;
|
||||
self->dest = strjoin(strjoin(args[2]->ip_daddr, ":"),
|
||||
lltostr(args[4]->udplite_dport));
|
||||
printf(" %10d %30s:%-5d -> %-36s %6d\\n", this->elapsed,
|
||||
args[2]->ip_saddr, args[4]->udplite_sport,
|
||||
self->dest, args[4]->udplite_coverage);
|
||||
last = timestamp;
|
||||
}
|
||||
|
||||
udplite:::receive
|
||||
{
|
||||
this->elapsed = (timestamp - last) / 1000;
|
||||
self->dest = strjoin(strjoin(args[2]->ip_saddr, ":"),
|
||||
lltostr(args[4]->udplite_sport));
|
||||
printf(" %10d %30s:%-5d <- %-36s %6d\\n", this->elapsed,
|
||||
args[2]->ip_daddr, args[4]->udplite_dport,
|
||||
self->dest, args[4]->udplite_coverage);
|
||||
last = timestamp;
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr dtrace 1 ,
|
||||
.Xr dtrace_ip 4 ,
|
||||
.Xr dtrace_sctp 4 ,
|
||||
.Xr dtrace_tcp 4 ,
|
||||
.Xr dtrace_udp 4 ,
|
||||
.Xr udplite 4 ,
|
||||
.Xr SDT 9
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm udplite
|
||||
provider first appeared in
|
||||
.Fx
|
||||
12.0.
|
||||
.Sh AUTHORS
|
||||
This manual page was written by
|
||||
.An Mark Johnston Aq Mt markj@FreeBSD.org
|
||||
and
|
||||
.An Michael Tuexen Aq Mt tuexen@FreeBSD.org .
|
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 24, 2018
|
||||
.Dd July 31, 2018
|
||||
.Dt JEDEC_DIMM 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -164,7 +164,7 @@ dev.jedec_dimm.6.type: DDR4
|
||||
.Ed
|
||||
.Sh COMPATIBILITY
|
||||
.Nm
|
||||
implements a superset of the functionality of
|
||||
implements a superset of the functionality of the now-deleted
|
||||
.Xr jedec_ts 4 .
|
||||
Hints for
|
||||
.Xr jedec_ts 4
|
||||
@ -199,7 +199,6 @@ sed -i ".old" -e 's/jedec_ts/jedec_dimm/' \\
|
||||
.Sh SEE ALSO
|
||||
.Xr iicbus 4 ,
|
||||
.Xr iicsmb 4 ,
|
||||
.Xr jedec_ts 4 ,
|
||||
.Xr smbus 4 ,
|
||||
.Xr sysctl 8
|
||||
.Sh STANDARDS
|
||||
@ -237,7 +236,7 @@ The
|
||||
.Nm
|
||||
driver and this manual page were written by
|
||||
.An Ravi Pokala Aq Mt rpokala@freebsd.org .
|
||||
They are both based in part on the
|
||||
They are both based in part on the now-deleted
|
||||
.Xr jedec_ts 4
|
||||
driver and manual page, written by
|
||||
.An Andriy Gapon Aq Mt avg@FreeBSD.org .
|
||||
|
@ -1,142 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2016 Andriy Gapon <avg@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 24, 2018
|
||||
.Dt JEDEC_TS 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm jedec_ts
|
||||
.Nd driver for temperature sensors on memory modules
|
||||
.Sh SYNOPSIS
|
||||
.Bd -ragged -offset indent
|
||||
.Cd "device jedec_ts"
|
||||
.Cd "device smbus"
|
||||
.Ed
|
||||
.Pp
|
||||
Alternatively, to load the driver as a
|
||||
module at boot time, place the following line in
|
||||
.Xr loader.conf 5 :
|
||||
.Bd -literal -offset indent
|
||||
jedec_ts_load="YES"
|
||||
.Ed
|
||||
.Pp
|
||||
In
|
||||
.Pa /boot/device.hints :
|
||||
.Bd -literal -offset indent
|
||||
.Cd hint.jedec_ts.0.at="smbus0"
|
||||
.Cd hint.jedec_ts.0.addr="0x30"
|
||||
.Cd hint.jedec_ts.1.at="smbus0"
|
||||
.Cd hint.jedec_ts.1.addr="0x32"
|
||||
.Cd hint.jedec_ts.2.at="smbus0"
|
||||
.Cd hint.jedec_ts.2.addr="0x34"
|
||||
.Cd hint.jedec_ts.3.at="smbus0"
|
||||
.Cd hint.jedec_ts.3.addr="0x36"
|
||||
.Cd hint.jedec_ts.4.at="smbus0"
|
||||
.Cd hint.jedec_ts.4.addr="0x38"
|
||||
.Cd hint.jedec_ts.5.at="smbus0"
|
||||
.Cd hint.jedec_ts.5.addr="0x3A"
|
||||
.Cd hint.jedec_ts.6.at="smbus0"
|
||||
.Cd hint.jedec_ts.6.addr="0x3C"
|
||||
.Cd hint.jedec_ts.7.at="smbus0"
|
||||
.Cd hint.jedec_ts.7.addr="0x3E"
|
||||
.Ed
|
||||
.Sh DEPRECATION NOTICE
|
||||
The
|
||||
.Nm
|
||||
driver is not present in
|
||||
.Fx 12.0
|
||||
and later.
|
||||
A superset of its functionality is available in the
|
||||
.Xr jedec_dimm 4
|
||||
driver.
|
||||
That driver's manpage includes instructions on updating
|
||||
.Pa /boot/device.hints
|
||||
accordingly.
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides access to sensor data over the
|
||||
.Xr smbus 4 .
|
||||
The driver supports temperature sensors on memory modules that conform
|
||||
to JEDEC Standard 21-C, TSE2002 Specification.
|
||||
.Pp
|
||||
The access to
|
||||
.Nm
|
||||
data is made via the
|
||||
.Xr sysctl 8
|
||||
interface:
|
||||
.Bl -tag -width "dev.jedec_ts.%d.temp"
|
||||
.It Va dev.jedec_ts.%d.temp
|
||||
read-only value of the current temperature read by the sensor.
|
||||
.El
|
||||
.Pp
|
||||
On a system using
|
||||
.Xr device.hints 5 ,
|
||||
these values are configurable for
|
||||
.Nm :
|
||||
.Bl -tag -width "hint.jedec_ts.%d.addr"
|
||||
.It Va hint.jedec_ts.%d.at
|
||||
target
|
||||
.Xr smbus 4 .
|
||||
.It Va hint.jedec_ts.%d.addr
|
||||
.Nm
|
||||
SMBus address on the
|
||||
.Xr smbus 4 .
|
||||
.El
|
||||
.Pp
|
||||
.Nm
|
||||
temperature sensors can be wired to eight different addresses,
|
||||
allowing up to eight sensors on the same
|
||||
.Xr smbus 4 .
|
||||
.Pp
|
||||
If the sensors are on an I2C bus behind an
|
||||
.Xr iicbus 4
|
||||
controller, then the
|
||||
.Xr iicsmb 4
|
||||
bridge driver can be used to attach the
|
||||
.Xr smbus 4 .
|
||||
.Sh EXAMPLES
|
||||
.Ss Sensor read out for two memory modules:
|
||||
.Bd -literal
|
||||
dev.jedec_ts.0.temp: 40.2500C
|
||||
dev.jedec_ts.1.temp: 40.7500C
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr iicbus 4 ,
|
||||
.Xr iicsmb 4 ,
|
||||
.Xr smbus 4 ,
|
||||
.Xr sysctl 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Fx 11.1 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
driver and this manual page were written by
|
||||
.An Andriy Gapon Aq Mt avg@FreeBSD.org .
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 20, 2017
|
||||
.Dd June 14, 2018
|
||||
.Dt PCI 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -333,6 +333,72 @@ The limitations on data width described for
|
||||
reading registers, above, also apply to writing
|
||||
.Tn PCI
|
||||
configuration registers.
|
||||
.It PCIOCBARMMAP
|
||||
This
|
||||
.Xr ioctl 2
|
||||
command allows userspace processes to
|
||||
.Xr mmap 2
|
||||
the memory-mapped PCI BAR into its address space.
|
||||
The input parameters and results are passed in the
|
||||
.Va pci_bar_mmap
|
||||
structure, which has the following fields:
|
||||
.Bl -tag -width Vt struct pcise pbm_sel
|
||||
.It Vt uint64_t pbm_map_base
|
||||
Reports the established mapping base to the caller.
|
||||
If
|
||||
.Va PCIIO_BAR_MMAP_FIXED
|
||||
flag was specified, then this field must be filled before the call
|
||||
with the desired address for the mapping.
|
||||
.It Vt uint64_t pbm_map_length
|
||||
Reports the mapped length of the BAR, in bytes.
|
||||
Its .Vt uint64_t value is always multiple of machine pages.
|
||||
.It Vt int64_t pbm_bar_length
|
||||
Reports length of the bar as exposed by the device.
|
||||
.It Vt int pbm_bar_off
|
||||
Reports offset from the mapped base to the start of the
|
||||
first register in the bar.
|
||||
.It Vt struct pcisel pbm_sel
|
||||
Should be filled before the call.
|
||||
Describes the device to operate on.
|
||||
.It Vt int pbm_reg
|
||||
The BAR index to mmap.
|
||||
.It Vt int pbm_flags
|
||||
Flags which augments the operation.
|
||||
See below.
|
||||
.It Vt int pbm_memattr
|
||||
The caching attribute for the mapping.
|
||||
Typical values are
|
||||
.Dv VM_MEMATTR_UNCACHEABLE
|
||||
for control registers BARs, and
|
||||
.Dv VM_MEMATTR_WRITE_COMBINING
|
||||
for frame buffers.
|
||||
Regular memory-like BAR should be mapped with
|
||||
.Dv VM_MEMATTR_DEFAULT
|
||||
attribute.
|
||||
.El
|
||||
.Pp
|
||||
Currently defined flags are:
|
||||
.Bl -tag -width PCIIO_BAR_MMAP_ACTIVATE
|
||||
.It PCIIO_BAR_MMAP_FIXED
|
||||
The resulted mappings should be established at the address
|
||||
specified by the
|
||||
.Va pbm_map_base
|
||||
member, otherwise fail.
|
||||
.It PCIIO_BAR_MMAP_EXCL
|
||||
Must be used together with
|
||||
.Vd PCIIO_BAR_MMAP_FIXED
|
||||
If the specified base contains already established mappings, the
|
||||
operation fails instead of implicitly unmapping them.
|
||||
.It PCIIO_BAR_MMAP_RW
|
||||
The requested mapping allows both reading and writing.
|
||||
Without the flag, read-only mapping is established.
|
||||
Note that it is common for the device registers to have side-effects
|
||||
even on reads.
|
||||
.It PCIIO_BAR_MMAP_ACTIVATE
|
||||
(Unimplemented) If the BAR is not activated, activate it in the course
|
||||
of mapping.
|
||||
Currently attempt to mmap an inactive BAR results in error.
|
||||
.El
|
||||
.El
|
||||
.Sh LOADER TUNABLES
|
||||
Tunables can be set at the
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
|
||||
.\" $FreeBSD$
|
||||
.Dd July 25, 2018
|
||||
.Dd August 2, 2018
|
||||
.Dt SRC.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -1001,12 +1001,12 @@ To be able to build the system, either Binutils or LLD bootstrap must be
|
||||
enabled unless an alternate linker is provided via XLD.
|
||||
.Pp
|
||||
This is a default setting on
|
||||
arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64.
|
||||
arm/arm, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64.
|
||||
.It Va WITH_LLD_BOOTSTRAP
|
||||
Set to build the LLD linker during the bootstrap phase of the build.
|
||||
.Pp
|
||||
This is a default setting on
|
||||
amd64/amd64 and arm64/aarch64.
|
||||
amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386.
|
||||
.It Va WITHOUT_LLD_IS_LD
|
||||
Set to use GNU binutils ld as the system linker, instead of LLVM's LLD.
|
||||
.Pp
|
||||
|
157
share/man/man9/nvmem.9
Normal file
157
share/man/man9/nvmem.9
Normal file
@ -0,0 +1,157 @@
|
||||
.\" Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 24, 2018
|
||||
.Dt nvmem 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm nvmem
|
||||
.Nm nvmem_get_cell_len ,
|
||||
.Nm nvmem_read_cell_by_name ,
|
||||
.Nm nvmem_read_cell_by_idx ,
|
||||
.Nm nvmem_write_cell_by_name ,
|
||||
.Nm nvmem_write_cell_by_idx ,
|
||||
.Sh SYNOPSIS
|
||||
.Cd "options EXT_RESOURCES"
|
||||
.Cd "options FDT"
|
||||
.Cd "device nvmem"
|
||||
.In sys/extres/nvmem/nvmem.h
|
||||
.Ft int
|
||||
.Fn nvmem_get_cell_len "phandle_t node" "const char *name"
|
||||
.Ft int
|
||||
.Fn nvmem_read_cell_by_name "phandle_t node" "const char *name" "void *cell" "size_t buflen"
|
||||
.Ft int
|
||||
.Fn nvmem_read_cell_by_idx "phandle_t node" "int idx" "void *cell" "size_t buflen"
|
||||
.Ft int
|
||||
.Fn nvmem_write_cell_by_name "phandle_t node" "const char *name" "void *cell" "size_t buflen"
|
||||
.Ft int
|
||||
.Fn nvmem_write_cell_by_idx "phandle_t node" "int idx" "void *cell" "size_t buflen"
|
||||
.Sh DESCRIPTION
|
||||
On some embedded boards, the manufacturer stored some data on a NVMEM
|
||||
(Non-Volatile Memory), this is generally stored in some eeprom or fuses.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
API consist of helpers functions for consumer and device methods for
|
||||
providers.
|
||||
.Sh FUNCTIONS
|
||||
.Bl -tag -width indent
|
||||
.It Fn nvmem_get_cell_len "phandle_t node" "const char *name"
|
||||
Get the size of the cell base on the reg property on the node.
|
||||
Return the size or ENOENT if the cell name wasn't found
|
||||
.It Fn nvmem_read_cell_by_name "phandle_t node" "const char *name" "void *cell" "size_t buflen"
|
||||
Get the cell content based on the name.
|
||||
Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found,
|
||||
EINVAL if the size isn't correct.
|
||||
.It Fn nvmem_read_cell_by_idx "phandle_t node" "int idx" "void *cell" "size_t buflen"
|
||||
Get the cell content based on the id.
|
||||
Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found,
|
||||
EINVAL if the size isn't correct.
|
||||
.It Fn nvmem_write_cell_by_name "phandle_t node" "const char *name" "void *cell" "size_t buflen"
|
||||
Write the cell content based on the name.
|
||||
Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found,
|
||||
EINVAL if the size isn't correct.
|
||||
.It Fn nvmem_write_cell_by_idx "phandle_t node" "int idx" "void *cell" "size_t buflen"
|
||||
Write the cell content based on the id.
|
||||
Return 0 on sucess or ENOENT if the cell doesn't exists, ENXIO if no provider device was found,
|
||||
EINVAL if the size isn't correct.
|
||||
.El
|
||||
.Sh DEVICE METHODS
|
||||
.Bl -tag -width indent
|
||||
.It Fn nvmem_read "device_t dev" "uint32_t offset" "uint32_t size" "uint8_t *buffer"
|
||||
Provider device method to read a cell content.
|
||||
.It Fn nvmem_write "device_t dev" "uint32_t offset" "uint32_t size" "uint8_t *buffer"
|
||||
Provider device method to write a cell content.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Consider this DTS
|
||||
.Bd -literal
|
||||
/* Provider */
|
||||
eeprom: eeprom@20000 {
|
||||
board_id: id@0 {
|
||||
reg = <0x0 0x4>;
|
||||
};
|
||||
};
|
||||
/* Consumer */
|
||||
device@30000 {
|
||||
...
|
||||
|
||||
nvmem-cells = <&board_id>
|
||||
nvmem-cell-names = "boardid";
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The device driver for eeprom@20000 needs to expose itself as a provider
|
||||
.Bd -literal
|
||||
#include "nvmem_if.h"
|
||||
|
||||
int
|
||||
foo_nvmem_read(device_t dev, uint32_t offset, uint32_t size, uint8_t *buffer)
|
||||
{
|
||||
/* Read the data */
|
||||
}
|
||||
|
||||
int
|
||||
foo_attach(device_t dev)
|
||||
{
|
||||
phandle_t node;
|
||||
|
||||
node = ofw_bus_get_node(dev);
|
||||
...
|
||||
/* Registering the device so the consumers can find us */
|
||||
OF_device_register_xref(OF_xref_from_node(node), dev);
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
static device_method_t foo_methods[] = {
|
||||
...
|
||||
|
||||
/* nvmem interface */
|
||||
DEVMETHOD(nvmem_read, foo_nvmem_read),
|
||||
|
||||
/* Terminate method list */
|
||||
DEVMETHOD_END
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The consumer device driver for device@30000 can now read the nvmem data
|
||||
.Bd -literal
|
||||
int
|
||||
bar_attach(device_t dev)
|
||||
{
|
||||
phandle_t node;
|
||||
uint32_t boardid;
|
||||
|
||||
...
|
||||
node = ofw_bus_get_node(dev);
|
||||
nvmem_read_cell_by_name(node, "boardid", (void *)&boardid, sizeof(boardid));
|
||||
...
|
||||
}
|
||||
.Ed
|
||||
.Sh HISTORY
|
||||
The nvmem related function first appear in
|
||||
.Fx 12.0 .
|
||||
The nvmem interface and manual page was written by
|
||||
.An Emmanuel Vadot Aq Mt manu@FreeBSD.org .
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 9, 2011
|
||||
.Dd July 3, 2018
|
||||
.Dt VM_MAP 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -62,8 +62,7 @@ struct vm_map {
|
||||
vm_flags_t flags;
|
||||
vm_map_entry_t root;
|
||||
pmap_t pmap;
|
||||
#define min_offset header.start
|
||||
#define max_offset header.end
|
||||
int busy;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
@ -99,29 +98,16 @@ Root node of a binary search tree used for fast lookup of map entries.
|
||||
.It Va pmap
|
||||
Pointer to the underlying physical map with which this virtual map
|
||||
is associated.
|
||||
.It Va min_offset
|
||||
The minimum
|
||||
.Vt vm_offset_t
|
||||
in this map.
|
||||
Programs should never use
|
||||
.Va header.start
|
||||
or
|
||||
.Va header.end
|
||||
directly, use
|
||||
.Va min_offset
|
||||
and
|
||||
.Va max_offset
|
||||
instead.
|
||||
.It Va max_offset
|
||||
The maximum
|
||||
.Vt vm_offset_t
|
||||
in this map.
|
||||
.It Va busy
|
||||
Map busy counter, prevents forks.
|
||||
.El
|
||||
.Pp
|
||||
There is one possible map flag:
|
||||
Possible map flags:
|
||||
.Bl -tag -width ".Dv MAP_PREFAULT_MADVISE"
|
||||
.It Dv MAP_WIREFUTURE
|
||||
Wire all future pages in this map.
|
||||
.It Dv MAP_BUSY_WAKEUP
|
||||
There are waiters for the map busy status.
|
||||
.El
|
||||
.Pp
|
||||
The following flags can be passed to
|
||||
|
@ -57,6 +57,7 @@ FILES= \
|
||||
bsd.sys.mk \
|
||||
bsd.test.mk \
|
||||
dirdeps.mk \
|
||||
dirdeps-options.mk \
|
||||
gendirdeps.mk \
|
||||
install-new.mk \
|
||||
meta.autodep.mk \
|
||||
|
@ -120,8 +120,10 @@ realinstall: installfiles
|
||||
.if ${MK_STAGING} != "no"
|
||||
.if !empty(STAGE_SETS)
|
||||
buildfiles: stage_files
|
||||
STAGE_TARGETS+= stage_files
|
||||
.if !empty(STAGE_AS_SETS)
|
||||
buildfiles: stage_as
|
||||
STAGE_TARGETS+= stage_as
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
@ -340,7 +340,7 @@ STAGE_TARGETS+= $t
|
||||
STAGE_TARGETS+= stage_as
|
||||
.endif
|
||||
|
||||
.if !empty(_LIBS) || (${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG))
|
||||
.if !empty(STAGE_TARGETS) || (${MK_STAGING_PROG} != "no" && !defined(INTERNALPROG))
|
||||
|
||||
.if !empty(LINKS)
|
||||
STAGE_TARGETS+= stage_links
|
||||
|
73
share/mk/dirdeps-options.mk
Normal file
73
share/mk/dirdeps-options.mk
Normal file
@ -0,0 +1,73 @@
|
||||
# $FreeBSD$
|
||||
# $Id: dirdeps-options.mk,v 1.8 2018/05/29 22:31:21 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2018, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
# Permission to copy, redistribute or otherwise
|
||||
# use this file is hereby granted provided that
|
||||
# the above copyright notice and this notice are
|
||||
# left intact.
|
||||
#
|
||||
# Please send copies of changes and bug-fixes to:
|
||||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
##
|
||||
#
|
||||
# This makefile is used to deal with optional DIRDEPS.
|
||||
#
|
||||
# It is to be included by Makefile.depend.options in a
|
||||
# directory which has DIRDEPS affected by optional features.
|
||||
# Makefile.depend.options should set DIRDEPS_OPTIONS and
|
||||
# may also set specific DIRDEPS.* for those options.
|
||||
#
|
||||
# If a Makefile.depend.options file exists, it will be included by
|
||||
# dirdeps.mk and meta.autodep.mk
|
||||
#
|
||||
# We include local.dirdeps-options.mk which may also define DIRDEPS.*
|
||||
# for options.
|
||||
#
|
||||
# Thus a directory, that is affected by an option FOO would have
|
||||
# a Makefile.depend.options that sets
|
||||
# DIRDEPS_OPTIONS= FOO
|
||||
# It can also set either/both of
|
||||
# DIRDEPS.FOO.yes
|
||||
# DIRDEPS.FOO.no
|
||||
# to whatever applies for that dir, or it can rely on globals
|
||||
# set in local.dirdeps-options.mk
|
||||
# Either way, we will .undef DIRDEPS.* when done.
|
||||
|
||||
# This should have been set by Makefile.depend.options
|
||||
# before including us
|
||||
DIRDEPS_OPTIONS ?=
|
||||
|
||||
# pickup any DIRDEPS.* we need
|
||||
.-include <local.dirdeps-options.mk>
|
||||
|
||||
.if ${.MAKE.LEVEL} == 0
|
||||
# :U below avoids potential errors when we :=
|
||||
.for o in ${DIRDEPS_OPTIONS:tu}
|
||||
DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U}
|
||||
.endfor
|
||||
DIRDEPS := ${DIRDEPS:O:u}
|
||||
# avoid cross contamination
|
||||
.for o in ${DIRDEPS_OPTIONS:tu}
|
||||
.undef DIRDEPS.$o.yes DIRDEPS.$o.no
|
||||
.endfor
|
||||
.else
|
||||
# whether options are enabled or not,
|
||||
# we want to filter out the relevant DIRDEPS.*
|
||||
# we should only be included by meta.autodep.mk
|
||||
# if dependencies are to be updated
|
||||
.for o in ${DIRDEPS_OPTIONS:tu}
|
||||
.for d in ${DIRDEPS.$o.yes} ${DIRDEPS.$o.no}
|
||||
.if exists(${SRCTOP}/$d)
|
||||
GENDIRDEPS_FILTER += N$d*
|
||||
.elif exists(${SRCTOP}/${d:R})
|
||||
GENDIRDEPS_FILTER += N${d:R}*
|
||||
.endif
|
||||
.endfor
|
||||
.endfor
|
||||
.endif
|
@ -1,18 +1,18 @@
|
||||
# $FreeBSD$
|
||||
# $Id: dirdeps.mk,v 1.86 2017/03/01 20:26:51 sjg Exp $
|
||||
# $Id: dirdeps.mk,v 1.96 2018/06/20 22:26:39 sjg Exp $
|
||||
|
||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@ -23,7 +23,7 @@
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Much of the complexity here is for supporting cross-building.
|
||||
# If a tree does not support that, simply using plain Makefile.depend
|
||||
@ -57,7 +57,7 @@
|
||||
# .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to
|
||||
# distinguish them from others.
|
||||
#
|
||||
# Before each Makefile.depend file is read, we set
|
||||
# Before each Makefile.depend file is read, we set
|
||||
# DEP_RELDIR to be the RELDIR (path relative to SRCTOP) for
|
||||
# its directory, and DEP_MACHINE etc according to the .<target_spec>
|
||||
# represented by the suffix of the corresponding target.
|
||||
@ -90,7 +90,7 @@
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# # Always list MACHINE first,
|
||||
# # Always list MACHINE first,
|
||||
# # other variables might be optional.
|
||||
# TARGET_SPEC_VARS = MACHINE TARGET_OS
|
||||
# .if ${TARGET_SPEC:Uno:M*,*} != ""
|
||||
@ -102,7 +102,7 @@
|
||||
# # and deal with MACHINE=${TARGET_SPEC} in the environment.
|
||||
# TARGET_SPEC =
|
||||
# # export but do not track
|
||||
# .export-env TARGET_SPEC
|
||||
# .export-env TARGET_SPEC
|
||||
# .export ${TARGET_SPEC_VARS}
|
||||
# .for v in ${TARGET_SPEC_VARS:O:u}
|
||||
# .if empty($v)
|
||||
@ -138,6 +138,14 @@
|
||||
# built for.
|
||||
#
|
||||
|
||||
.if !target(bootstrap) && (make(bootstrap) || \
|
||||
make(bootstrap-this) || \
|
||||
make(bootstrap-recurse) || \
|
||||
make(bootstrap-empty))
|
||||
# disable most of below
|
||||
.MAKE.LEVEL = 1
|
||||
.endif
|
||||
|
||||
# touch this at your peril
|
||||
_DIRDEP_USE_LEVEL?= 0
|
||||
.if ${.MAKE.LEVEL} == ${_DIRDEP_USE_LEVEL}
|
||||
@ -321,7 +329,7 @@ _DEP_RELDIR := ${DEP_RELDIR}
|
||||
.endif
|
||||
|
||||
# DIRDEPS_CACHE can be very handy for debugging.
|
||||
# Also if repeatedly building the same target,
|
||||
# Also if repeatedly building the same target,
|
||||
# we can avoid the overhead of re-computing the tree dependencies.
|
||||
MK_DIRDEPS_CACHE ?= no
|
||||
BUILD_DIRDEPS_CACHE ?= no
|
||||
@ -434,7 +442,7 @@ _only_machines := ${_only_machines:O:u}
|
||||
|
||||
# make sure we have a starting place?
|
||||
DIRDEPS ?= ${RELDIR}
|
||||
.endif # target
|
||||
.endif # target
|
||||
|
||||
.if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW)
|
||||
.if ${MK_DIRDEPS_CACHE} == "yes"
|
||||
@ -444,7 +452,7 @@ build-dirdeps:
|
||||
|
||||
M_oneperline = @x@\\${.newline} $$x@
|
||||
|
||||
.if ${BUILD_DIRDEPS_CACHE} == "no"
|
||||
.if ${BUILD_DIRDEPS_CACHE} == "no"
|
||||
.if !target(dirdeps-cached)
|
||||
# we do this via sub-make
|
||||
BUILD_DIRDEPS = no
|
||||
@ -462,7 +470,7 @@ dirdeps-cached: ${DIRDEPS_CACHE} .MAKE
|
||||
BUILD_DIRDEPS_MAKEFILE ?= ${MAKEFILE}
|
||||
BUILD_DIRDEPS_TARGETS ?= ${.TARGETS}
|
||||
|
||||
# we need the .meta file to ensure we update if
|
||||
# we need the .meta file to ensure we update if
|
||||
# any of the Makefile.depend* changed.
|
||||
# We do not want to compare the command line though.
|
||||
${DIRDEPS_CACHE}: .META .NOMETA_CMP
|
||||
@ -521,6 +529,7 @@ _this_dir := ${SRCTOP}/${DEP_RELDIR}
|
||||
# on rare occasions, there can be a need for extra help
|
||||
_dep_hack := ${_this_dir}/${.MAKE.DEPENDFILE_PREFIX}.inc
|
||||
.-include <${_dep_hack}>
|
||||
.-include <${_dep_hack:R}.options>
|
||||
|
||||
.if ${DEP_RELDIR} != ${_DEP_RELDIR} || ${DEP_TARGET_SPEC} != ${TARGET_SPEC}
|
||||
# this should be all
|
||||
@ -529,10 +538,14 @@ _machines := ${DEP_MACHINE}
|
||||
# this is the machine list we actually use below
|
||||
_machines := ${_only_machines}
|
||||
|
||||
.if defined(HOSTPROG) || ${DEP_MACHINE} == "host"
|
||||
.if defined(HOSTPROG) || ${DEP_MACHINE:Nhost*} == ""
|
||||
# we need to build this guy's dependencies for host as well.
|
||||
.if ${DEP_MACHINE:Nhost*} == ""
|
||||
_machines += ${DEP_MACHINE}
|
||||
.else
|
||||
_machines += host
|
||||
.endif
|
||||
.endif
|
||||
|
||||
_machines := ${_machines:O:u}
|
||||
.endif
|
||||
@ -570,7 +583,7 @@ _build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
||||
|
||||
.if ${_debug_reldir}
|
||||
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: DIRDEPS='${DIRDEPS}'
|
||||
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _machines='${_machines}'
|
||||
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _machines='${_machines}'
|
||||
.endif
|
||||
|
||||
.if !empty(DIRDEPS)
|
||||
@ -578,7 +591,7 @@ _build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
||||
DEP_DIRDEPS_FILTER = \
|
||||
${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \
|
||||
${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \
|
||||
${DIRDEPS_FILTER:U}
|
||||
${DIRDEPS_FILTER:U}
|
||||
.if empty(DEP_DIRDEPS_FILTER)
|
||||
# something harmless
|
||||
DEP_DIRDEPS_FILTER = U
|
||||
@ -587,7 +600,7 @@ DEP_DIRDEPS_FILTER = U
|
||||
# this is what we start with
|
||||
__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@}
|
||||
|
||||
# some entries may be qualified with .<machine>
|
||||
# some entries may be qualified with .<machine>
|
||||
# the :M*/*/*.* just tries to limit the dirs we check to likely ones.
|
||||
# the ${d:E:M*/*} ensures we don't consider junos/usr.sbin/mgd
|
||||
__qual_depdirs := ${__depdirs:M*/*/*.*:@d@${exists($d):?:${"${d:E:M*/*}":?:${exists(${d:R}):?$d:}}}@}
|
||||
@ -595,7 +608,8 @@ __unqual_depdirs := ${__depdirs:${__qual_depdirs:Uno:${M_ListToSkip}}}
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# if it was called out - we likely need it.
|
||||
__hostdpadd := ${DPADD:U.:M${HOST_OBJTOP}/*:S,${HOST_OBJTOP}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host,:N.*:@d@${SRCTOP}/$d@}
|
||||
__hostdpadd := ${DPADD:U.:M${HOST_OBJTOP}/*:S,${HOST_OBJTOP}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host,:N.*:@d@${SRCTOP}/$d@} \
|
||||
${DPADD:U.:M${HOST_OBJTOP32:Uno}/*:S,${HOST_OBJTOP32:Uno}/,,:H:${NSkipDir}:${DIRDEPS_FILTER:ts:}:S,$,.host32,:N.*:@d@${SRCTOP}/$d@}
|
||||
__qual_depdirs += ${__hostdpadd}
|
||||
.endif
|
||||
|
||||
@ -629,6 +643,11 @@ _build_all_dirs := ${_build_all_dirs:O:u}
|
||||
x!= { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
|
||||
echo 'dirdeps: ${_build_all_dirs:${M_oneperline}}'; echo; } >&3; echo
|
||||
x!= { ${_build_all_dirs:@x@${target($x):?:echo '$x: _DIRDEP_USE';}@} echo; } >&3; echo
|
||||
.if !empty(DEP_EXPORT_VARS)
|
||||
# Discouraged, but there are always exceptions.
|
||||
# Handle it here rather than explain how.
|
||||
x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo
|
||||
.endif
|
||||
.else
|
||||
# this makes it all happen
|
||||
dirdeps: ${_build_all_dirs}
|
||||
@ -639,6 +658,11 @@ ${_build_all_dirs}: _DIRDEP_USE
|
||||
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: needs: ${_build_dirs}
|
||||
.endif
|
||||
|
||||
.if !empty(DEP_EXPORT_VARS)
|
||||
.export ${DEP_EXPORT_VARS}
|
||||
DEP_EXPORT_VARS=
|
||||
.endif
|
||||
|
||||
# this builds the dependency graph
|
||||
.for m in ${_machines}
|
||||
# it would be nice to do :N${.TARGET}
|
||||
@ -689,7 +713,7 @@ DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]}
|
||||
.else
|
||||
DEP_MACHINE := ${_DEP_MACHINE}
|
||||
.endif
|
||||
# Warning: there is an assumption here that MACHINE is always
|
||||
# Warning: there is an assumption here that MACHINE is always
|
||||
# the first entry in TARGET_SPEC_VARS.
|
||||
# If TARGET_SPEC and MACHINE are insufficient, you have a problem.
|
||||
_m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:S;${MACHINE};${d:E:C/,.*//};:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]}
|
||||
@ -699,7 +723,7 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
|
||||
.if ${_debug_search}
|
||||
.info Looking for ${_qm}
|
||||
.endif
|
||||
# set this "just in case"
|
||||
# set this "just in case"
|
||||
# we can skip :tA since we computed the path above
|
||||
DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,}
|
||||
# and reset this
|
||||
@ -708,6 +732,8 @@ DIRDEPS =
|
||||
.info loading ${_m} for ${d:E}
|
||||
.endif
|
||||
.include <${_m}>
|
||||
.else
|
||||
.-include <local.dirdeps-missing.mk>
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
@ -722,6 +748,10 @@ DIRDEPS =
|
||||
# we are building something
|
||||
DEP_RELDIR := ${RELDIR}
|
||||
_DEP_RELDIR := ${RELDIR}
|
||||
# Since we are/should be included by .MAKE.DEPENDFILE
|
||||
# This is a final opportunity to add/hook global rules.
|
||||
.-include <local.dirdeps-build.mk>
|
||||
|
||||
# pickup local dependencies
|
||||
.if ${MAKE_VERSION} < 20160220
|
||||
.-include <.depend>
|
||||
@ -758,7 +788,7 @@ bootstrap-this: .NOTMAIN
|
||||
@echo Bootstrapping ${RELDIR}/${_want:T} from ${_src:T}; \
|
||||
echo You need to build ${RELDIR} to correctly populate it.
|
||||
.if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T}
|
||||
(cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want})
|
||||
(cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want:T})
|
||||
.else
|
||||
cp ${.CURDIR}/${_src:T} ${_want}
|
||||
.endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
# $FreeBSD$
|
||||
# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $
|
||||
# $Id: gendirdeps.mk,v 1.39 2018/06/08 01:25:31 sjg Exp $
|
||||
|
||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||
# All rights reserved.
|
||||
@ -161,17 +161,39 @@ META2DEPS_CMD += -S ${SB_BACKING_SB}/src
|
||||
M2D_OBJROOTS += ${SB_BACKING_SB}/${SB_OBJPREFIX}
|
||||
.endif
|
||||
|
||||
GENDIRDEPS_SEDCMDS += \
|
||||
-e 's,//*$$,,;s,\.${HOST_TARGET:Uhost}$$,.host,' \
|
||||
-e 's,\.${HOST_TARGET32:Uhost32}$$,.host32,' \
|
||||
-e 's,\.${MACHINE}$$,,' \
|
||||
-e 's:\.${TARGET_SPEC:U${MACHINE}}$$::'
|
||||
|
||||
# we are only interested in the dirs
|
||||
# specifically those we read something from.
|
||||
# we canonicalize them to keep things simple
|
||||
# if we are using a split-fs sandbox, it gets a little messier.
|
||||
_objtop := ${_OBJTOP:tA}
|
||||
|
||||
# some people put *.meta in META_XTRAS to make sure we get here
|
||||
_meta_files := ${META_FILES:N\*.meta:O:u}
|
||||
# assume a big list
|
||||
_meta_files_arg= @meta.list
|
||||
.if empty(_meta_files) && ${META_FILES:M\*.meta} != ""
|
||||
# XXX this should be considered a bad idea,
|
||||
# since we cannot ignore stale .meta
|
||||
x != cd ${_OBJDIR} && find . -name '*.meta' -print -o \( -type d ! -name . -prune \) | sed 's,^./,,' > meta.list; echo
|
||||
.elif ${_meta_files:[#]} > 500
|
||||
.export _meta_files
|
||||
x != echo; for m in $$_meta_files; do echo $$m; done > meta.list
|
||||
.else
|
||||
_meta_files_arg:= ${_meta_files}
|
||||
.endif
|
||||
|
||||
dir_list != cd ${_OBJDIR} && \
|
||||
${META2DEPS_CMD} MACHINE=${MACHINE} \
|
||||
SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \
|
||||
${META2DEPS_ARGS} \
|
||||
${META_FILES:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \
|
||||
sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,'
|
||||
${_meta_files_arg} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \
|
||||
sed ${GENDIRDEPS_SEDCMDS}
|
||||
|
||||
.if ${dir_list:M*ERROR\:*} != ""
|
||||
.warning ${dir_list:tW:C,.*(ERROR),\1,}
|
||||
@ -195,7 +217,7 @@ dpadd_dir_list += ${f:H:tA}
|
||||
.endfor
|
||||
.if !empty(ddep_list)
|
||||
ddeps != cat ${ddep_list:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \
|
||||
sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,;s,\.${MACHINE}$$,,'
|
||||
sed ${GENDIRDEPS_SEDCMDS}
|
||||
|
||||
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
|
||||
.info ${RELDIR}: raw_dir_list='${dir_list}'
|
||||
@ -256,7 +278,9 @@ DIRDEPS += \
|
||||
${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \
|
||||
${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@}
|
||||
|
||||
DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u}
|
||||
# what modifiers do we allow in GENDIRDEPS_FILTER
|
||||
GENDIRDEPS_FILTER_MASK += @CMNS
|
||||
DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:M[${GENDIRDEPS_FILTER_MASK:O:u:ts}]*:ts:}:C,//+,/,g:O:u}
|
||||
|
||||
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
|
||||
.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
.if ${.MAKE.DEPENDFILE:M*.${MACHINE}} == ""
|
||||
# by default only MACHINE0 does updates
|
||||
UPDATE_DEPENDFILE_MACHINE?= ${MACHINE0}
|
||||
UPDATE_DEPENDFILE_MACHINE?= ${MACHINE0:U${MACHINE}}
|
||||
.if ${MACHINE} != ${UPDATE_DEPENDFILE_MACHINE}
|
||||
UPDATE_DEPENDFILE= no
|
||||
.endif
|
||||
|
@ -6,9 +6,6 @@
|
||||
.include "${SRCTOP}/share/mk/src.opts.mk"
|
||||
.endif
|
||||
|
||||
# DEP_MACHINE is set before we get here, this may not be.
|
||||
DEP_RELDIR ?= ${RELDIR}
|
||||
|
||||
# making universe is special
|
||||
.if defined(UNIVERSE_GUARD)
|
||||
# these should be done by now
|
||||
@ -39,6 +36,7 @@ DIRDEPS_FILTER.host = \
|
||||
${N_host_libs} \
|
||||
Ninclude* \
|
||||
Nlib/csu* \
|
||||
Nlib/libc \
|
||||
Nlib/[mn]* \
|
||||
Ngnu/lib/csu* \
|
||||
Ngnu/lib/lib[a-r]* \
|
||||
@ -93,7 +91,7 @@ DIRDEPS += \
|
||||
# Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed.
|
||||
# Add both gcc_s and gcc_eh as dependencies as the decision to build
|
||||
# -static or not is not known here.
|
||||
.if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:Mlib/libc}
|
||||
.if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:U:Mlib/libc} != ""
|
||||
.if ${MK_LLVM_LIBUNWIND} == "yes"
|
||||
DIRDEPS+= \
|
||||
lib/libgcc_eh \
|
||||
|
@ -13,6 +13,8 @@ GENDIRDEPS_FILTER+= \
|
||||
Ngnu/lib/libgcc \
|
||||
Nlib/libgcc_eh \
|
||||
Nlib/libgcc_s \
|
||||
Nstand/libsa/* \
|
||||
Nstand/libsa32/* \
|
||||
Ntargets/pseudo/stage* \
|
||||
Ntools/*
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
# we need this until there is an alternative
|
||||
MK_INSTALL_AS_USER= yes
|
||||
|
||||
.if !defined(HOST_TARGET)
|
||||
.if !defined(HOST_TARGET) || !defined(HOST_MACHINE)
|
||||
# we need HOST_TARGET etc below.
|
||||
.include <host-target.mk>
|
||||
.export HOST_TARGET
|
||||
@ -111,6 +111,7 @@ BUILD_AT_LEVEL0= no
|
||||
.error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
# we want to end up with a singe stage tree for all machines
|
||||
.if ${MK_STAGING} == "yes"
|
||||
@ -119,7 +120,6 @@ STAGE_ROOT?= ${OBJROOT}stage
|
||||
.export STAGE_ROOT
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MK_STAGING} == "yes"
|
||||
.if ${MACHINE} == "host"
|
||||
@ -149,7 +149,7 @@ STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include}
|
||||
# the target is usually an absolute path
|
||||
STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}
|
||||
|
||||
LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR}
|
||||
#LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR}
|
||||
.if ${MK_SYSROOT} == "yes"
|
||||
SYSROOT?= ${STAGE_OBJTOP}
|
||||
.else
|
||||
@ -158,6 +158,8 @@ LDFLAGS_LAST+= -L${STAGE_LIBDIR}
|
||||
|
||||
.endif # MK_STAGING
|
||||
|
||||
.-include "local.toolchain.mk"
|
||||
|
||||
# this is sufficient for most of the tree.
|
||||
.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user