Merge ^/head r275759 through r275911.
This commit is contained in:
commit
e65720e1ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/clang350-import/; revision=275912
@ -113,6 +113,8 @@ _REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
|
||||
.for _DIR in ${LOCAL_LIB_DIRS}
|
||||
.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
|
||||
SUBDIR+= ${_DIR}
|
||||
.else
|
||||
.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
|
||||
.endif
|
||||
.endfor
|
||||
.endif
|
||||
@ -261,7 +263,8 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||
MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
|
||||
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
|
||||
MK_LLDB=no MK_TESTS=no
|
||||
|
||||
# build-tools stage
|
||||
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
@ -271,7 +274,9 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
SSP_CFLAGS= \
|
||||
-DNO_LINT \
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
|
||||
MK_LLDB=no MK_TESTS=no
|
||||
|
||||
# cross-tools stage
|
||||
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
|
||||
@ -524,8 +529,9 @@ _worldtmp:
|
||||
-p ${WORLDTMP}/usr/lib >/dev/null
|
||||
.endif
|
||||
.if ${MK_TESTS} != "no"
|
||||
mkdir -p ${WORLDTMP}${TESTSBASE}
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
|
||||
-p ${WORLDTMP}/usr >/dev/null
|
||||
-p ${WORLDTMP}${TESTSBASE} >/dev/null
|
||||
.endif
|
||||
.for _mtree in ${LOCAL_MTREE}
|
||||
mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
|
||||
@ -788,7 +794,7 @@ _zoneinfo= zic tzsetup
|
||||
ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
|
||||
date echo egrep find grep id install ${_install-info} \
|
||||
ln lockf make mkdir mtree mv pwd_mkdb \
|
||||
rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \
|
||||
rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \
|
||||
${LOCAL_ITOOLS}
|
||||
|
||||
# Needed for share/man
|
||||
@ -864,8 +870,9 @@ distributeworld installworld: _installcheck_world
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
|
||||
.endif
|
||||
.if ${MK_TESTS} != "no" && ${dist} == "tests"
|
||||
-mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE}
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null
|
||||
.endif
|
||||
.if defined(NO_ROOT)
|
||||
${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
|
||||
@ -1474,7 +1481,8 @@ NXBMAKE= ${NXBENV} ${MAKE} \
|
||||
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||
MK_CLANG_FULL=no MK_LLDB=no
|
||||
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
|
||||
MK_LLDB=no
|
||||
|
||||
native-xtools: .MAKE
|
||||
mkdir -p ${OBJTREE}/nxb-bin/bin
|
||||
@ -2083,8 +2091,9 @@ _xi-mtree:
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${XDDESTDIR}/usr/include >/dev/null
|
||||
.if ${MK_TESTS} != "no"
|
||||
mkdir -p ${XDDESTDIR}${TESTSBASE}
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
|
||||
-p ${XDDESTDIR}/usr >/dev/null
|
||||
-p ${XDDESTDIR}${TESTSBASE} >/dev/null
|
||||
.endif
|
||||
|
||||
.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
|
||||
|
8
UPDATING
8
UPDATING
@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20141121:
|
||||
The handling of LOCAL_LIB_DIRS has been altered to skip addition of
|
||||
directories to top level SUBDIR variable when their parent
|
||||
directory is included in LOCAL_DIRS. Users with build systems with
|
||||
such hierarchies and without SUBDIR entries in the parent
|
||||
directory Makefiles should add them or add the directories to
|
||||
LOCAL_DIRS.
|
||||
|
||||
20141109:
|
||||
faith(4) and faithd(8) has been removed from base system. It
|
||||
has been obsolete for a very long time.
|
||||
|
@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "syntax.h"
|
||||
@ -111,42 +113,86 @@ outstr(const char *p, struct output *file)
|
||||
outbin(p, strlen(p), file);
|
||||
}
|
||||
|
||||
static void
|
||||
byteseq(int ch, struct output *file)
|
||||
{
|
||||
char seq[4];
|
||||
|
||||
seq[0] = '\\';
|
||||
seq[1] = (ch >> 6 & 0x3) + '0';
|
||||
seq[2] = (ch >> 3 & 0x7) + '0';
|
||||
seq[3] = (ch & 0x7) + '0';
|
||||
outbin(seq, 4, file);
|
||||
}
|
||||
|
||||
static void
|
||||
outdqstr(const char *p, struct output *file)
|
||||
{
|
||||
const char *end;
|
||||
mbstate_t mbs;
|
||||
size_t clen;
|
||||
wchar_t wc;
|
||||
|
||||
memset(&mbs, '\0', sizeof(mbs));
|
||||
end = p + strlen(p);
|
||||
outstr("$'", file);
|
||||
while ((clen = mbrtowc(&wc, p, end - p + 1, &mbs)) != 0) {
|
||||
if (clen == (size_t)-2) {
|
||||
while (p < end)
|
||||
byteseq(*p++, file);
|
||||
break;
|
||||
}
|
||||
if (clen == (size_t)-1) {
|
||||
memset(&mbs, '\0', sizeof(mbs));
|
||||
byteseq(*p++, file);
|
||||
continue;
|
||||
}
|
||||
if (wc == L'\n')
|
||||
outcslow('\n', file), p++;
|
||||
else if (wc == L'\r')
|
||||
outstr("\\r", file), p++;
|
||||
else if (wc == L'\t')
|
||||
outstr("\\t", file), p++;
|
||||
else if (!iswprint(wc)) {
|
||||
for (; clen > 0; clen--)
|
||||
byteseq(*p++, file);
|
||||
} else {
|
||||
if (wc == L'\'' || wc == L'\\')
|
||||
outcslow('\\', file);
|
||||
outbin(p, clen, file);
|
||||
p += clen;
|
||||
}
|
||||
}
|
||||
outcslow('\'', file);
|
||||
}
|
||||
|
||||
/* Like outstr(), but quote for re-input into the shell. */
|
||||
void
|
||||
outqstr(const char *p, struct output *file)
|
||||
{
|
||||
char ch;
|
||||
int inquotes;
|
||||
int i;
|
||||
|
||||
if (p[0] == '\0') {
|
||||
outstr("''", file);
|
||||
return;
|
||||
}
|
||||
if (p[strcspn(p, "|&;<>()$`\\\"' \t\n*?[~#=")] == '\0' ||
|
||||
for (i = 0; p[i] != '\0'; i++) {
|
||||
if ((p[i] > '\0' && p[i] < ' ' && p[i] != '\n') ||
|
||||
(p[i] & 0x80) != 0 || p[i] == '\'') {
|
||||
outdqstr(p, file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (p[strcspn(p, "|&;<>()$`\\\" \n*?[~#=")] == '\0' ||
|
||||
strcmp(p, "[") == 0) {
|
||||
outstr(p, file);
|
||||
return;
|
||||
}
|
||||
|
||||
inquotes = 0;
|
||||
while ((ch = *p++) != '\0') {
|
||||
switch (ch) {
|
||||
case '\'':
|
||||
/* Can't quote single quotes inside single quotes. */
|
||||
if (inquotes)
|
||||
outcslow('\'', file);
|
||||
inquotes = 0;
|
||||
outstr("\\'", file);
|
||||
break;
|
||||
default:
|
||||
if (!inquotes)
|
||||
outcslow('\'', file);
|
||||
inquotes = 1;
|
||||
outc(ch, file);
|
||||
}
|
||||
}
|
||||
if (inquotes)
|
||||
outcslow('\'', file);
|
||||
outcslow('\'', file);
|
||||
outstr(p, file);
|
||||
outcslow('\'', file);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -44,6 +44,7 @@ FILES+= set-n4.0
|
||||
FILES+= set-x1.0
|
||||
FILES+= set-x2.0
|
||||
FILES+= set-x3.0
|
||||
FILES+= set-x4.0
|
||||
FILES+= shellproc1.0
|
||||
FILES+= subshell1.0 subshell1.0.stdout
|
||||
FILES+= subshell2.0
|
||||
|
7
bin/sh/tests/execution/set-x4.0
Normal file
7
bin/sh/tests/execution/set-x4.0
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
key=`printf '\r\t\001\200\300'`
|
||||
r=`{ set -x; : "$key"; } 2>&1 >/dev/null`
|
||||
case $r in
|
||||
*[![:print:]]*) echo fail; exit 3
|
||||
esac
|
@ -1184,7 +1184,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
|
||||
print_indirect(bp, zb, dnp);
|
||||
|
||||
if (BP_GET_LEVEL(bp) > 0 && !BP_IS_HOLE(bp)) {
|
||||
uint32_t flags = ARC_WAIT;
|
||||
arc_flags_t flags = ARC_FLAG_WAIT;
|
||||
int i;
|
||||
blkptr_t *cbp;
|
||||
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
|
||||
@ -1884,8 +1884,8 @@ dump_dir(objset_t *os)
|
||||
if (dds.dds_type == DMU_OST_META) {
|
||||
dds.dds_creation_txg = TXG_INITIAL;
|
||||
usedobjs = BP_GET_FILL(os->os_rootbp);
|
||||
refdbytes = os->os_spa->spa_dsl_pool->
|
||||
dp_mos_dir->dd_phys->dd_used_bytes;
|
||||
refdbytes = dsl_dir_phys(os->os_spa->spa_dsl_pool->dp_mos_dir)->
|
||||
dd_used_bytes;
|
||||
} else {
|
||||
dmu_objset_space(os, &refdbytes, &scratch, &usedobjs, &scratch);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ dtrace_dof_init(void)
|
||||
Elf32_Ehdr *elf;
|
||||
#endif
|
||||
dof_helper_t dh;
|
||||
Link_map *lmp;
|
||||
Link_map *lmp = NULL;
|
||||
#if defined(sun)
|
||||
Lmid_t lmid;
|
||||
#else
|
||||
|
@ -24,7 +24,7 @@
|
||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -193,9 +193,6 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
|
||||
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
|
||||
fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
|
||||
|
||||
/* Allocate an nvlist to hold the bookmarks. */
|
||||
bmarks = fnvlist_alloc();
|
||||
|
||||
if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
|
||||
goto out;
|
||||
|
||||
|
@ -2509,108 +2509,156 @@ md_assemble (char *str)
|
||||
(char *) NULL, 0);
|
||||
}
|
||||
#ifdef OBJ_ELF
|
||||
else if ((reloc = ppc_elf_suffix (&str, &ex)) != BFD_RELOC_UNUSED)
|
||||
else
|
||||
{
|
||||
/* Some TLS tweaks. */
|
||||
switch (reloc)
|
||||
if (ex.X_op == O_symbol && str[0] == '(')
|
||||
{
|
||||
default:
|
||||
break;
|
||||
case BFD_RELOC_PPC_TLS:
|
||||
insn = ppc_insert_operand (insn, operand, ppc_obj64 ? 13 : 2,
|
||||
(char *) NULL, 0);
|
||||
break;
|
||||
/* We'll only use the 32 (or 64) bit form of these relocations
|
||||
in constants. Instructions get the 16 bit form. */
|
||||
case BFD_RELOC_PPC_DTPREL:
|
||||
reloc = BFD_RELOC_PPC_DTPREL16;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TPREL:
|
||||
reloc = BFD_RELOC_PPC_TPREL16;
|
||||
break;
|
||||
}
|
||||
const char *sym_name = S_GET_NAME (ex.X_add_symbol);
|
||||
if (sym_name[0] == '.')
|
||||
++sym_name;
|
||||
|
||||
/* For the absolute forms of branches, convert the PC
|
||||
relative form back into the absolute. */
|
||||
if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
|
||||
{
|
||||
switch (reloc)
|
||||
if (strcasecmp (sym_name, "__tls_get_addr") == 0)
|
||||
{
|
||||
case BFD_RELOC_PPC_B26:
|
||||
reloc = BFD_RELOC_PPC_BA26;
|
||||
break;
|
||||
case BFD_RELOC_PPC_B16:
|
||||
reloc = BFD_RELOC_PPC_BA16;
|
||||
break;
|
||||
case BFD_RELOC_PPC_B16_BRTAKEN:
|
||||
reloc = BFD_RELOC_PPC_BA16_BRTAKEN;
|
||||
break;
|
||||
case BFD_RELOC_PPC_B16_BRNTAKEN:
|
||||
reloc = BFD_RELOC_PPC_BA16_BRNTAKEN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
expressionS tls_exp;
|
||||
|
||||
hold = input_line_pointer;
|
||||
input_line_pointer = str + 1;
|
||||
expression (&tls_exp);
|
||||
if (tls_exp.X_op == O_symbol)
|
||||
{
|
||||
reloc = BFD_RELOC_UNUSED;
|
||||
if (strncasecmp (input_line_pointer, "@tlsgd)", 7) == 0)
|
||||
{
|
||||
reloc = BFD_RELOC_PPC_TLSGD;
|
||||
input_line_pointer += 7;
|
||||
}
|
||||
else if (strncasecmp (input_line_pointer, "@tlsld)", 7) == 0)
|
||||
{
|
||||
reloc = BFD_RELOC_PPC_TLSLD;
|
||||
input_line_pointer += 7;
|
||||
}
|
||||
if (reloc != BFD_RELOC_UNUSED)
|
||||
{
|
||||
SKIP_WHITESPACE ();
|
||||
str = input_line_pointer;
|
||||
|
||||
if (fc >= MAX_INSN_FIXUPS)
|
||||
as_fatal (_("too many fixups"));
|
||||
fixups[fc].exp = tls_exp;
|
||||
fixups[fc].opindex = *opindex_ptr;
|
||||
fixups[fc].reloc = reloc;
|
||||
++fc;
|
||||
}
|
||||
}
|
||||
input_line_pointer = hold;
|
||||
}
|
||||
}
|
||||
|
||||
if (ppc_obj64
|
||||
&& (operand->flags & (PPC_OPERAND_DS | PPC_OPERAND_DQ)) != 0)
|
||||
if ((reloc = ppc_elf_suffix (&str, &ex)) != BFD_RELOC_UNUSED)
|
||||
{
|
||||
/* Some TLS tweaks. */
|
||||
switch (reloc)
|
||||
{
|
||||
case BFD_RELOC_16:
|
||||
reloc = BFD_RELOC_PPC64_ADDR16_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16:
|
||||
reloc = BFD_RELOC_PPC64_ADDR16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_16_GOTOFF:
|
||||
reloc = BFD_RELOC_PPC64_GOT16_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16_GOTOFF:
|
||||
reloc = BFD_RELOC_PPC64_GOT16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16_PLTOFF:
|
||||
reloc = BFD_RELOC_PPC64_PLT16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_16_BASEREL:
|
||||
reloc = BFD_RELOC_PPC64_SECTOFF_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16_BASEREL:
|
||||
reloc = BFD_RELOC_PPC64_SECTOFF_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TOC16:
|
||||
reloc = BFD_RELOC_PPC64_TOC16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC64_TOC16_LO:
|
||||
reloc = BFD_RELOC_PPC64_TOC16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC64_PLTGOT16:
|
||||
reloc = BFD_RELOC_PPC64_PLTGOT16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC64_PLTGOT16_LO:
|
||||
reloc = BFD_RELOC_PPC64_PLTGOT16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_DTPREL16:
|
||||
reloc = BFD_RELOC_PPC64_DTPREL16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_DTPREL16_LO:
|
||||
reloc = BFD_RELOC_PPC64_DTPREL16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TPREL16:
|
||||
reloc = BFD_RELOC_PPC64_TPREL16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TPREL16_LO:
|
||||
reloc = BFD_RELOC_PPC64_TPREL16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_GOT_DTPREL16:
|
||||
case BFD_RELOC_PPC_GOT_DTPREL16_LO:
|
||||
case BFD_RELOC_PPC_GOT_TPREL16:
|
||||
case BFD_RELOC_PPC_GOT_TPREL16_LO:
|
||||
break;
|
||||
default:
|
||||
as_bad (_("unsupported relocation for DS offset field"));
|
||||
break;
|
||||
|
||||
case BFD_RELOC_PPC_TLS:
|
||||
insn = ppc_insert_operand (insn, operand, ppc_obj64 ? 13 : 2,
|
||||
(char *) NULL, 0);
|
||||
break;
|
||||
|
||||
/* We'll only use the 32 (or 64) bit form of these relocations
|
||||
in constants. Instructions get the 16 bit form. */
|
||||
case BFD_RELOC_PPC_DTPREL:
|
||||
reloc = BFD_RELOC_PPC_DTPREL16;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TPREL:
|
||||
reloc = BFD_RELOC_PPC_TPREL16;
|
||||
break;
|
||||
}
|
||||
|
||||
/* For the absolute forms of branches, convert the PC
|
||||
relative form back into the absolute. */
|
||||
if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
|
||||
{
|
||||
switch (reloc)
|
||||
{
|
||||
case BFD_RELOC_PPC_B26:
|
||||
reloc = BFD_RELOC_PPC_BA26;
|
||||
break;
|
||||
case BFD_RELOC_PPC_B16:
|
||||
reloc = BFD_RELOC_PPC_BA16;
|
||||
break;
|
||||
case BFD_RELOC_PPC_B16_BRTAKEN:
|
||||
reloc = BFD_RELOC_PPC_BA16_BRTAKEN;
|
||||
break;
|
||||
case BFD_RELOC_PPC_B16_BRNTAKEN:
|
||||
reloc = BFD_RELOC_PPC_BA16_BRNTAKEN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ppc_obj64
|
||||
&& (operand->flags & (PPC_OPERAND_DS | PPC_OPERAND_DQ)) != 0)
|
||||
{
|
||||
switch (reloc)
|
||||
{
|
||||
case BFD_RELOC_16:
|
||||
reloc = BFD_RELOC_PPC64_ADDR16_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16:
|
||||
reloc = BFD_RELOC_PPC64_ADDR16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_16_GOTOFF:
|
||||
reloc = BFD_RELOC_PPC64_GOT16_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16_GOTOFF:
|
||||
reloc = BFD_RELOC_PPC64_GOT16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16_PLTOFF:
|
||||
reloc = BFD_RELOC_PPC64_PLT16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_16_BASEREL:
|
||||
reloc = BFD_RELOC_PPC64_SECTOFF_DS;
|
||||
break;
|
||||
case BFD_RELOC_LO16_BASEREL:
|
||||
reloc = BFD_RELOC_PPC64_SECTOFF_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TOC16:
|
||||
reloc = BFD_RELOC_PPC64_TOC16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC64_TOC16_LO:
|
||||
reloc = BFD_RELOC_PPC64_TOC16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC64_PLTGOT16:
|
||||
reloc = BFD_RELOC_PPC64_PLTGOT16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC64_PLTGOT16_LO:
|
||||
reloc = BFD_RELOC_PPC64_PLTGOT16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_DTPREL16:
|
||||
reloc = BFD_RELOC_PPC64_DTPREL16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_DTPREL16_LO:
|
||||
reloc = BFD_RELOC_PPC64_DTPREL16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TPREL16:
|
||||
reloc = BFD_RELOC_PPC64_TPREL16_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_TPREL16_LO:
|
||||
reloc = BFD_RELOC_PPC64_TPREL16_LO_DS;
|
||||
break;
|
||||
case BFD_RELOC_PPC_GOT_DTPREL16:
|
||||
case BFD_RELOC_PPC_GOT_DTPREL16_LO:
|
||||
case BFD_RELOC_PPC_GOT_TPREL16:
|
||||
case BFD_RELOC_PPC_GOT_TPREL16_LO:
|
||||
break;
|
||||
default:
|
||||
as_bad (_("unsupported relocation for DS offset field"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2618,12 +2666,11 @@ md_assemble (char *str)
|
||||
if (fc >= MAX_INSN_FIXUPS)
|
||||
as_fatal (_("too many fixups"));
|
||||
fixups[fc].exp = ex;
|
||||
fixups[fc].opindex = 0;
|
||||
fixups[fc].opindex = *opindex_ptr;
|
||||
fixups[fc].reloc = reloc;
|
||||
++fc;
|
||||
}
|
||||
#endif /* OBJ_ELF */
|
||||
|
||||
#else /* OBJ_ELF */
|
||||
else
|
||||
{
|
||||
/* We need to generate a fixup for this expression. */
|
||||
@ -2634,6 +2681,7 @@ md_assemble (char *str)
|
||||
fixups[fc].reloc = BFD_RELOC_UNUSED;
|
||||
++fc;
|
||||
}
|
||||
#endif /* OBJ_ELF */
|
||||
|
||||
if (need_paren)
|
||||
{
|
||||
@ -5908,6 +5956,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
|
||||
break;
|
||||
|
||||
case BFD_RELOC_PPC_TLS:
|
||||
case BFD_RELOC_PPC_TLSLD:
|
||||
case BFD_RELOC_PPC_TLSGD:
|
||||
break;
|
||||
|
||||
case BFD_RELOC_PPC_DTPMOD:
|
||||
|
@ -1109,7 +1109,8 @@ strip_main(struct elfcopy *ecp, int argc, char **argv)
|
||||
|
||||
if (ecp->strip == 0 &&
|
||||
((ecp->flags & DISCARD_LOCAL) == 0) &&
|
||||
((ecp->flags & DISCARD_LLABEL) == 0))
|
||||
((ecp->flags & DISCARD_LLABEL) == 0) &&
|
||||
lookup_symop_list(ecp, NULL, SYMOP_STRIP) == NULL)
|
||||
ecp->strip = STRIP_ALL;
|
||||
if (optind == argc)
|
||||
strip_usage();
|
||||
|
@ -439,7 +439,7 @@ copy_phdr(struct elfcopy *ecp)
|
||||
seg->fsz = seg->msz = 0;
|
||||
for (i = 0; i < seg->nsec; i++) {
|
||||
s = seg->v_sec[i];
|
||||
seg->msz = s->off + s->sz - seg->off;
|
||||
seg->msz = s->vma + s->sz - seg->addr;
|
||||
if (s->type != SHT_NOBITS)
|
||||
seg->fsz = seg->msz;
|
||||
}
|
||||
|
15
contrib/elftoolchain/readelf/Makefile
Normal file
15
contrib/elftoolchain/readelf/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
# $Id: Makefile 2076 2011-10-27 03:50:33Z jkoshy $
|
||||
|
||||
TOP= ..
|
||||
|
||||
PROG= readelf
|
||||
SRCS= readelf.c
|
||||
|
||||
WARNS?= 6
|
||||
|
||||
DPADD= ${LIBDWARF} ${LIBELF}
|
||||
LDADD= -ldwarf -lelftc -lelf
|
||||
|
||||
MAN1= readelf.1
|
||||
|
||||
.include "${TOP}/mk/elftoolchain.prog.mk"
|
197
contrib/elftoolchain/readelf/readelf.1
Normal file
197
contrib/elftoolchain/readelf/readelf.1
Normal file
@ -0,0 +1,197 @@
|
||||
.\" Copyright (c) 2009,2011 Joseph Koshy <jkoshy@users.sourceforge.net>
|
||||
.\" 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
|
||||
.\" in this position and unchanged.
|
||||
.\" 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 AUTHORS ``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.
|
||||
.\"
|
||||
.\" $Id: readelf.1 2577 2012-09-13 16:07:04Z jkoshy $
|
||||
.\"
|
||||
.Dd September 13, 2012
|
||||
.Os
|
||||
.Dt READELF 1
|
||||
.Sh NAME
|
||||
.Nm readelf
|
||||
.Nd display information about ELF objects
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl a | Fl -all
|
||||
.Op Fl c | Fl -archive-index
|
||||
.Op Fl d | Fl -dynamic
|
||||
.Op Fl e | Fl -headers
|
||||
.Op Fl g | Fl -section-groups
|
||||
.Op Fl h | Fl -file-header
|
||||
.Op Fl l | Fl -program-headers
|
||||
.Op Fl n | Fl -notes
|
||||
.Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section
|
||||
.Op Fl r | Fl -relocs
|
||||
.Op Fl t | Fl -section-details
|
||||
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
|
||||
.Op Fl v | Fl -version
|
||||
.Oo
|
||||
.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
|
||||
.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
|
||||
.Oc
|
||||
.Op Fl A | Fl -arch-specific
|
||||
.Op Fl D | Fl -use-dynamic
|
||||
.Op Fl H | Fl -help
|
||||
.Op Fl I | Fl -histogram
|
||||
.Op Fl N | -full-section-name
|
||||
.Op Fl S | Fl -sections | Fl -section-headers
|
||||
.Op Fl V | Fl -version-info
|
||||
.Op Fl W | Fl -wide
|
||||
.Ar file...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility displays information about ELF objects and
|
||||
.Xr ar 1
|
||||
archives.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility recognizes the following options:
|
||||
.Bl -tag -width indent
|
||||
.It Fl a | Fl -all
|
||||
Turn on the following flags:
|
||||
.Fl d ,
|
||||
.Fl h ,
|
||||
.Fl I ,
|
||||
.Fl l ,
|
||||
.Fl r ,
|
||||
.Fl s ,
|
||||
.Fl A ,
|
||||
.Fl S
|
||||
and
|
||||
.Fl V .
|
||||
.It Fl c | Fl -archive-index
|
||||
Print the archive symbol table for archives.
|
||||
.It Fl d | Fl -dynamic
|
||||
Print the contents of the
|
||||
.Li SHT_DYNAMIC
|
||||
sections in the ELF object.
|
||||
.It Fl e | Fl -headers
|
||||
Print all program, file and section headers in the ELF object.
|
||||
.It Fl g | Fl -section-groups
|
||||
This option is recognized, but is ignored.
|
||||
.It Fl h | Fl -file-header
|
||||
Print the file header of the ELF object.
|
||||
.It Fl l | Fl -program-headers
|
||||
Print the content of the program header table for the object.
|
||||
.It Fl n | Fl -notes
|
||||
Print the contents of
|
||||
.Li PT_NOTE
|
||||
segments or
|
||||
.Li SHT_NOTE
|
||||
sections present in the ELF object.
|
||||
.It Fl p Ar section | Fl -string-dump Ns = Ns Ar section
|
||||
Print the contents of the specified section as printable strings.
|
||||
The argument
|
||||
.Ar section
|
||||
should be the name of a section or a numeric section index.
|
||||
.It Fl r | Fl -relocs
|
||||
Print relocation information.
|
||||
.It Fl s | Fl -syms | Fl -symbols
|
||||
Print symbol tables.
|
||||
.It Fl t | Fl -section-details
|
||||
Print additional information about sections, such as the flags
|
||||
fields in section headers.
|
||||
.It Fl v | Fl -version
|
||||
Prints a version identifier for
|
||||
.Nm
|
||||
and exits.
|
||||
.It Fl w Ns Oo afilmoprsFLR Oc | Xo
|
||||
.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
|
||||
.Xc
|
||||
Display DWARF information.
|
||||
The
|
||||
.Fl w
|
||||
option is used with the short options in the following
|
||||
table; the
|
||||
.Fl -debug-dump
|
||||
option is used with a comma-separated list of the corresponding long
|
||||
option names:
|
||||
.Bl -column ".Em Short Option" "aranges|ranges"
|
||||
.It Em Short Option Ta Em Long Option Ta Em Description
|
||||
.It a Ta abbrev Ta Show abbreviation information.
|
||||
.It f Ta frames Ta Show frame information, displaying frame instructions.
|
||||
.It i Ta info Ta Show debugging information entries.
|
||||
.It l Ta rawline Ta Show line information in raw form.
|
||||
.It m Ta macro Ta Show macro information.
|
||||
.It o Ta loc Ta Show location list information.
|
||||
.It p Ta pubnames Ta Show global names.
|
||||
.It r Ta aranges|ranges Ta Show address range information.
|
||||
.It s Ta str Ta Show the debug string table.
|
||||
.It F Ta Ta Show frame information, displaying register rules.
|
||||
.It L Ta decodedline Ta Show line information in decoded form.
|
||||
.It R Ta Ranges Ta Show range lists.
|
||||
.El
|
||||
.Pp
|
||||
If no sub-options are specified, the default is to show information
|
||||
corresponding to the
|
||||
.Ar a , f , i, l , o , p , r , s
|
||||
and
|
||||
.Ar R
|
||||
short options.
|
||||
.It Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
|
||||
Display the contents of the specified section in hexadecimal.
|
||||
The argument
|
||||
.Ar section
|
||||
should be the name of a section or a numeric section index.
|
||||
.It Fl A | Fl -arch-specific
|
||||
This option is accepted but is currently unimplemented.
|
||||
.It Fl D | Fl -use-dynamic
|
||||
Print the symbol table specified by the
|
||||
.Li DT_SYMTAB
|
||||
entry in the
|
||||
.Dq Li .dynamic
|
||||
section.
|
||||
.It Fl H | Fl -help
|
||||
Print a help message.
|
||||
.It Fl I | Fl -histogram
|
||||
Print information on bucket list lengths for sections of type
|
||||
.Li SHT_HASH
|
||||
and
|
||||
.Li SHT_GNU_HASH .
|
||||
.It Fl N | Fl -full-section-name
|
||||
This option is accepted but is currently unimplemented.
|
||||
.It Fl S | Fl -sections | Fl -section-headers
|
||||
Print information in the section headers for each ELF object.
|
||||
.It Fl V | Fl -version-info
|
||||
Print symbol versioning information.
|
||||
.It Fl W | Fl -wide
|
||||
Print information about ELF structures using one long line per
|
||||
structure.
|
||||
If this option is not specified,
|
||||
.Nm
|
||||
will list information in the headers of 64 bit ELF objects on two
|
||||
separate lines.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr nm 1 ,
|
||||
.Xr addr2line 1 ,
|
||||
.Xr elfcopy 1 ,
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
|
6845
contrib/elftoolchain/readelf/readelf.c
Normal file
6845
contrib/elftoolchain/readelf/readelf.c
Normal file
File diff suppressed because it is too large
Load Diff
298
contrib/llvm/patches/patch-r275759-clang-r221170-ppc-vaarg.diff
Normal file
298
contrib/llvm/patches/patch-r275759-clang-r221170-ppc-vaarg.diff
Normal file
@ -0,0 +1,298 @@
|
||||
Pull in r221170 from upstream clang trunk (by Roman Divacky):
|
||||
|
||||
Implement vaarg lowering for ppc32. Lowering of scalars and
|
||||
aggregates is supported. Complex numbers are not.
|
||||
|
||||
Pull in r221174 from upstream clang trunk (by Roman Divacky):
|
||||
|
||||
Require asserts to unbreak the buildbots.
|
||||
|
||||
Pull in r221284 from upstream clang trunk (by Roman Divacky):
|
||||
|
||||
Rewrite the test to not require asserts.
|
||||
|
||||
Pull in r221285 from upstream clang trunk (by Roman Divacky):
|
||||
|
||||
Since the file has both ppc and ppc64 tests in it rename it.
|
||||
|
||||
This adds va_args support for PowerPC (32 bit) to clang.
|
||||
|
||||
Introduced here: http://svnweb.freebsd.org/changeset/base/275759
|
||||
|
||||
Index: tools/clang/lib/CodeGen/TargetInfo.cpp
|
||||
===================================================================
|
||||
--- tools/clang/lib/CodeGen/TargetInfo.cpp
|
||||
+++ tools/clang/lib/CodeGen/TargetInfo.cpp
|
||||
@@ -2733,12 +2733,20 @@ llvm::Value *NaClX86_64ABIInfo::EmitVAArg(llvm::Va
|
||||
|
||||
|
||||
// PowerPC-32
|
||||
-
|
||||
namespace {
|
||||
-class PPC32TargetCodeGenInfo : public DefaultTargetCodeGenInfo {
|
||||
+/// PPC32_SVR4_ABIInfo - The 32-bit PowerPC ELF (SVR4) ABI information.
|
||||
+class PPC32_SVR4_ABIInfo : public DefaultABIInfo {
|
||||
public:
|
||||
- PPC32TargetCodeGenInfo(CodeGenTypes &CGT) : DefaultTargetCodeGenInfo(CGT) {}
|
||||
+ PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT) : DefaultABIInfo(CGT) {}
|
||||
|
||||
+ llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
||||
+ CodeGenFunction &CGF) const;
|
||||
+};
|
||||
+
|
||||
+class PPC32TargetCodeGenInfo : public TargetCodeGenInfo {
|
||||
+public:
|
||||
+ PPC32TargetCodeGenInfo(CodeGenTypes &CGT) : TargetCodeGenInfo(new PPC32_SVR4_ABIInfo(CGT)) {}
|
||||
+
|
||||
int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const {
|
||||
// This is recovered from gcc output.
|
||||
return 1; // r1 is the dedicated stack pointer
|
||||
@@ -2750,6 +2758,96 @@ namespace {
|
||||
|
||||
}
|
||||
|
||||
+llvm::Value *PPC32_SVR4_ABIInfo::EmitVAArg(llvm::Value *VAListAddr,
|
||||
+ QualType Ty,
|
||||
+ CodeGenFunction &CGF) const {
|
||||
+ if (const ComplexType *CTy = Ty->getAs<ComplexType>()) {
|
||||
+ // TODO: Implement this. For now ignore.
|
||||
+ (void)CTy;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64;
|
||||
+ bool isInt = Ty->isIntegerType() || Ty->isPointerType() || Ty->isAggregateType();
|
||||
+ llvm::Type *CharPtr = CGF.Int8PtrTy;
|
||||
+ llvm::Type *CharPtrPtr = CGF.Int8PtrPtrTy;
|
||||
+
|
||||
+ CGBuilderTy &Builder = CGF.Builder;
|
||||
+ llvm::Value *GPRPtr = Builder.CreateBitCast(VAListAddr, CharPtr, "gprptr");
|
||||
+ llvm::Value *GPRPtrAsInt = Builder.CreatePtrToInt(GPRPtr, CGF.Int32Ty);
|
||||
+ llvm::Value *FPRPtrAsInt = Builder.CreateAdd(GPRPtrAsInt, Builder.getInt32(1));
|
||||
+ llvm::Value *FPRPtr = Builder.CreateIntToPtr(FPRPtrAsInt, CharPtr);
|
||||
+ llvm::Value *OverflowAreaPtrAsInt = Builder.CreateAdd(FPRPtrAsInt, Builder.getInt32(3));
|
||||
+ llvm::Value *OverflowAreaPtr = Builder.CreateIntToPtr(OverflowAreaPtrAsInt, CharPtrPtr);
|
||||
+ llvm::Value *RegsaveAreaPtrAsInt = Builder.CreateAdd(OverflowAreaPtrAsInt, Builder.getInt32(4));
|
||||
+ llvm::Value *RegsaveAreaPtr = Builder.CreateIntToPtr(RegsaveAreaPtrAsInt, CharPtrPtr);
|
||||
+ llvm::Value *GPR = Builder.CreateLoad(GPRPtr, false, "gpr");
|
||||
+ // Align GPR when TY is i64.
|
||||
+ if (isI64) {
|
||||
+ llvm::Value *GPRAnd = Builder.CreateAnd(GPR, Builder.getInt8(1));
|
||||
+ llvm::Value *CC64 = Builder.CreateICmpEQ(GPRAnd, Builder.getInt8(1));
|
||||
+ llvm::Value *GPRPlusOne = Builder.CreateAdd(GPR, Builder.getInt8(1));
|
||||
+ GPR = Builder.CreateSelect(CC64, GPRPlusOne, GPR);
|
||||
+ }
|
||||
+ llvm::Value *FPR = Builder.CreateLoad(FPRPtr, false, "fpr");
|
||||
+ llvm::Value *OverflowArea = Builder.CreateLoad(OverflowAreaPtr, false, "overflow_area");
|
||||
+ llvm::Value *OverflowAreaAsInt = Builder.CreatePtrToInt(OverflowArea, CGF.Int32Ty);
|
||||
+ llvm::Value *RegsaveArea = Builder.CreateLoad(RegsaveAreaPtr, false, "regsave_area");
|
||||
+ llvm::Value *RegsaveAreaAsInt = Builder.CreatePtrToInt(RegsaveArea, CGF.Int32Ty);
|
||||
+
|
||||
+ llvm::Value *CC = Builder.CreateICmpULT(isInt ? GPR : FPR,
|
||||
+ Builder.getInt8(8), "cond");
|
||||
+
|
||||
+ llvm::Value *RegConstant = Builder.CreateMul(isInt ? GPR : FPR,
|
||||
+ Builder.getInt8(isInt ? 4 : 8));
|
||||
+
|
||||
+ llvm::Value *OurReg = Builder.CreateAdd(RegsaveAreaAsInt, Builder.CreateSExt(RegConstant, CGF.Int32Ty));
|
||||
+
|
||||
+ if (Ty->isFloatingType())
|
||||
+ OurReg = Builder.CreateAdd(OurReg, Builder.getInt32(32));
|
||||
+
|
||||
+ llvm::BasicBlock *UsingRegs = CGF.createBasicBlock("using_regs");
|
||||
+ llvm::BasicBlock *UsingOverflow = CGF.createBasicBlock("using_overflow");
|
||||
+ llvm::BasicBlock *Cont = CGF.createBasicBlock("cont");
|
||||
+
|
||||
+ Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
|
||||
+
|
||||
+ CGF.EmitBlock(UsingRegs);
|
||||
+
|
||||
+ llvm::Type *PTy = llvm::PointerType::getUnqual(CGF.ConvertType(Ty));
|
||||
+ llvm::Value *Result1 = Builder.CreateIntToPtr(OurReg, PTy);
|
||||
+ // Increase the GPR/FPR indexes.
|
||||
+ if (isInt) {
|
||||
+ GPR = Builder.CreateAdd(GPR, Builder.getInt8(isI64 ? 2 : 1));
|
||||
+ Builder.CreateStore(GPR, GPRPtr);
|
||||
+ } else {
|
||||
+ FPR = Builder.CreateAdd(FPR, Builder.getInt8(1));
|
||||
+ Builder.CreateStore(FPR, FPRPtr);
|
||||
+ }
|
||||
+ CGF.EmitBranch(Cont);
|
||||
+
|
||||
+ CGF.EmitBlock(UsingOverflow);
|
||||
+
|
||||
+ // Increase the overflow area.
|
||||
+ llvm::Value *Result2 = Builder.CreateIntToPtr(OverflowAreaAsInt, PTy);
|
||||
+ OverflowAreaAsInt = Builder.CreateAdd(OverflowAreaAsInt, Builder.getInt32(isInt ? 4 : 8));
|
||||
+ Builder.CreateStore(Builder.CreateIntToPtr(OverflowAreaAsInt, CharPtr), OverflowAreaPtr);
|
||||
+ CGF.EmitBranch(Cont);
|
||||
+
|
||||
+ CGF.EmitBlock(Cont);
|
||||
+
|
||||
+ llvm::PHINode *Result = CGF.Builder.CreatePHI(PTy, 2, "vaarg.addr");
|
||||
+ Result->addIncoming(Result1, UsingRegs);
|
||||
+ Result->addIncoming(Result2, UsingOverflow);
|
||||
+
|
||||
+ if (Ty->isAggregateType()) {
|
||||
+ llvm::Value *AGGPtr = Builder.CreateBitCast(Result, CharPtrPtr, "aggrptr") ;
|
||||
+ return Builder.CreateLoad(AGGPtr, false, "aggr");
|
||||
+ }
|
||||
+
|
||||
+ return Result;
|
||||
+}
|
||||
+
|
||||
bool
|
||||
PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
|
||||
llvm::Value *Address) const {
|
||||
Index: tools/clang/test/CodeGen/ppc64-varargs-struct.c
|
||||
===================================================================
|
||||
--- tools/clang/test/CodeGen/ppc64-varargs-struct.c
|
||||
+++ tools/clang/test/CodeGen/ppc64-varargs-struct.c
|
||||
@@ -1,30 +0,0 @@
|
||||
-// REQUIRES: ppc64-registered-target
|
||||
-// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
||||
-
|
||||
-#include <stdarg.h>
|
||||
-
|
||||
-struct x {
|
||||
- long a;
|
||||
- double b;
|
||||
-};
|
||||
-
|
||||
-void testva (int n, ...)
|
||||
-{
|
||||
- va_list ap;
|
||||
-
|
||||
- struct x t = va_arg (ap, struct x);
|
||||
-// CHECK: bitcast i8* %{{[a-z.0-9]*}} to %struct.x*
|
||||
-// CHECK: bitcast %struct.x* %t to i8*
|
||||
-// CHECK: bitcast %struct.x* %{{[0-9]+}} to i8*
|
||||
-// CHECK: call void @llvm.memcpy
|
||||
-
|
||||
- int v = va_arg (ap, int);
|
||||
-// CHECK: ptrtoint i8* %{{[a-z.0-9]*}} to i64
|
||||
-// CHECK: add i64 %{{[0-9]+}}, 4
|
||||
-// CHECK: inttoptr i64 %{{[0-9]+}} to i8*
|
||||
-// CHECK: bitcast i8* %{{[0-9]+}} to i32*
|
||||
-
|
||||
- __int128_t u = va_arg (ap, __int128_t);
|
||||
-// CHECK: bitcast i8* %{{[a-z.0-9]+}} to i128*
|
||||
-// CHECK-NEXT: load i128* %{{[0-9]+}}
|
||||
-}
|
||||
Index: tools/clang/test/CodeGen/ppc-varargs-struct.c
|
||||
===================================================================
|
||||
--- tools/clang/test/CodeGen/ppc-varargs-struct.c
|
||||
+++ tools/clang/test/CodeGen/ppc-varargs-struct.c
|
||||
@@ -0,0 +1,112 @@
|
||||
+// REQUIRES: ppc64-registered-target
|
||||
+// REQUIRES: asserts
|
||||
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
||||
+// RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PPC
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+
|
||||
+struct x {
|
||||
+ long a;
|
||||
+ double b;
|
||||
+};
|
||||
+
|
||||
+void testva (int n, ...)
|
||||
+{
|
||||
+ va_list ap;
|
||||
+
|
||||
+ struct x t = va_arg (ap, struct x);
|
||||
+// CHECK: bitcast i8* %{{[a-z.0-9]*}} to %struct.x*
|
||||
+// CHECK: bitcast %struct.x* %t to i8*
|
||||
+// CHECK: bitcast %struct.x* %{{[0-9]+}} to i8*
|
||||
+// CHECK: call void @llvm.memcpy
|
||||
+// CHECK-PPC: [[ARRAYDECAY:%[a-z0-9]+]] = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i32 0, i32 0
|
||||
+// CHECK-PPC-NEXT: [[GPRPTR:%[a-z0-9]+]] = bitcast %struct.__va_list_tag* [[ARRAYDECAY]] to i8*
|
||||
+// CHECK-PPC-NEXT: [[ZERO:%[0-9]+]] = ptrtoint i8* [[GPRPTR]] to i32
|
||||
+// CHECK-PPC-NEXT: [[ONE:%[0-9]+]] = add i32 [[ZERO]], 1
|
||||
+// CHECK-PPC-NEXT: [[TWO:%[0-9]+]] = inttoptr i32 [[ONE]] to i8*
|
||||
+// CHECK-PPC-NEXT: [[THREE:%[0-9]+]] = add i32 [[ONE]], 3
|
||||
+// CHECK-PPC-NEXT: [[FOUR:%[0-9]+]] = inttoptr i32 [[THREE]] to i8**
|
||||
+// CHECK-PPC-NEXT: [[FIVE:%[0-9]+]] = add i32 [[THREE]], 4
|
||||
+// CHECK-PPC-NEXT: [[SIX:%[0-9]+]] = inttoptr i32 [[FIVE]] to i8**
|
||||
+// CHECK-PPC-NEXT: [[GPR:%[a-z0-9]+]] = load i8* [[GPRPTR]]
|
||||
+// CHECK-PPC-NEXT: [[FPR:%[a-z0-9]+]] = load i8* [[TWO]]
|
||||
+// CHECK-PPC-NEXT: [[OVERFLOW_AREA:%[a-z_0-9]+]] = load i8** [[FOUR]]
|
||||
+// CHECK-PPC-NEXT: [[SEVEN:%[0-9]+]] = ptrtoint i8* [[OVERFLOW_AREA]] to i32
|
||||
+// CHECK-PPC-NEXT: [[REGSAVE_AREA:%[a-z_0-9]+]] = load i8** [[SIX]]
|
||||
+// CHECK-PPC-NEXT: [[EIGHT:%[0-9]+]] = ptrtoint i8* [[REGSAVE_AREA]] to i32
|
||||
+// CHECK-PPC-NEXT: [[COND:%[a-z0-9]+]] = icmp ult i8 [[GPR]], 8
|
||||
+// CHECK-PPC-NEXT: [[NINE:%[0-9]+]] = mul i8 [[GPR]], 4
|
||||
+// CHECK-PPC-NEXT: [[TEN:%[0-9]+]] = sext i8 [[NINE]] to i32
|
||||
+// CHECK-PPC-NEXT: [[ELEVEN:%[0-9]+]] = add i32 [[EIGHT]], [[TEN]]
|
||||
+// CHECK-PPC-NEXT: br i1 [[COND]], label [[USING_REGS:%[a-z_0-9]+]], label [[USING_OVERFLOW:%[a-z_0-9]+]]
|
||||
+//
|
||||
+// CHECK-PPC1:[[USING_REGS]]
|
||||
+// CHECK-PPC: [[TWELVE:%[0-9]+]] = inttoptr i32 [[ELEVEN]] to %struct.x*
|
||||
+// CHECK-PPC-NEXT: [[THIRTEEN:%[0-9]+]] = add i8 [[GPR]], 1
|
||||
+// CHECK-PPC-NEXT: store i8 [[THIRTEEN]], i8* [[GPRPTR]]
|
||||
+// CHECK-PPC-NEXT: br label [[CONT:%[a-z0-9]+]]
|
||||
+//
|
||||
+// CHECK-PPC1:[[USING_OVERFLOW]]
|
||||
+// CHECK-PPC: [[FOURTEEN:%[0-9]+]] = inttoptr i32 [[SEVEN]] to %struct.x*
|
||||
+// CHECK-PPC-NEXT: [[FIFTEEN:%[0-9]+]] = add i32 [[SEVEN]], 4
|
||||
+// CHECK-PPC-NEXT: [[SIXTEEN:%[0-9]+]] = inttoptr i32 [[FIFTEEN]] to i8*
|
||||
+// CHECK-PPC-NEXT: store i8* [[SIXTEEN]], i8** [[FOUR]]
|
||||
+// CHECK-PPC-NEXT: br label [[CONT]]
|
||||
+//
|
||||
+// CHECK-PPC1:[[CONT]]
|
||||
+// CHECK-PPC: [[VAARG_ADDR:%[a-z.0-9]+]] = phi %struct.x* [ [[TWELVE]], [[USING_REGS]] ], [ [[FOURTEEN]], [[USING_OVERFLOW]] ]
|
||||
+// CHECK-PPC-NEXT: [[AGGRPTR:%[a-z0-9]+]] = bitcast %struct.x* [[VAARG_ADDR]] to i8**
|
||||
+// CHECK-PPC-NEXT: [[AGGR:%[a-z0-9]+]] = load i8** [[AGGRPTR]]
|
||||
+// CHECK-PPC-NEXT: [[SEVENTEEN:%[0-9]+]] = bitcast %struct.x* %t to i8*
|
||||
+// CHECK-PPC-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* [[SEVENTEEN]], i8* [[AGGR]], i32 16, i32 8, i1 false)
|
||||
+
|
||||
+ int v = va_arg (ap, int);
|
||||
+// CHECK: ptrtoint i8* %{{[a-z.0-9]*}} to i64
|
||||
+// CHECK: add i64 %{{[0-9]+}}, 4
|
||||
+// CHECK: inttoptr i64 %{{[0-9]+}} to i8*
|
||||
+// CHECK: bitcast i8* %{{[0-9]+}} to i32*
|
||||
+// CHECK-PPC: [[ARRAYDECAY1:%[a-z0-9]+]] = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i32 0, i32 0
|
||||
+// CHECK-PPC-NEXT: [[GPRPTR1:%[a-z0-9]+]] = bitcast %struct.__va_list_tag* [[ARRAYDECAY1]] to i8*
|
||||
+// CHECK-PPC-NEXT: [[EIGHTEEN:%[0-9]+]] = ptrtoint i8* [[GPRPTR1]] to i32
|
||||
+// CHECK-PPC-NEXT: [[NINETEEN:%[0-9]+]] = add i32 [[EIGHTEEN]], 1
|
||||
+// CHECK-PPC-NEXT: [[TWENTY:%[0-9]+]] = inttoptr i32 [[NINETEEN]] to i8*
|
||||
+// CHECK-PPC-NEXT: [[TWENTYONE:%[0-9]+]] = add i32 [[NINETEEN]], 3
|
||||
+// CHECK-PPC-NEXT: [[TWENTYTWO:%[0-9]+]] = inttoptr i32 [[TWENTYONE]] to i8**
|
||||
+// CHECK-PPC-NEXT: [[TWENTYTHREE:%[0-9]+]] = add i32 [[TWENTYONE]], 4
|
||||
+// CHECK-PPC-NEXT: [[TWENTYFOUR:%[0-9]+]] = inttoptr i32 [[TWENTYTHREE]] to i8**
|
||||
+// CHECK-PPC-NEXT: [[GPR1:%[a-z0-9]+]] = load i8* [[GPRPTR1]]
|
||||
+// CHECK-PPC-NEXT: [[FPR1:%[a-z0-9]+]] = load i8* [[TWENTY]]
|
||||
+// CHECK-PPC-NEXT: [[OVERFLOW_AREA1:%[a-z_0-9]+]] = load i8** [[TWENTYTWO]]
|
||||
+// CHECK-PPC-NEXT: [[TWENTYFIVE:%[0-9]+]] = ptrtoint i8* [[OVERFLOW_AREA1]] to i32
|
||||
+// CHECK-PPC-NEXT: [[REGSAVE_AREA1:%[a-z_0-9]+]] = load i8** [[TWENTYFOUR]]
|
||||
+// CHECK-PPC-NEXT: [[TWENTYSIX:%[0-9]+]] = ptrtoint i8* [[REGSAVE_AREA1]] to i32
|
||||
+// CHECK-PPC-NEXT: [[COND1:%[a-z0-9]+]] = icmp ult i8 [[GPR1]], 8
|
||||
+// CHECK-PPC-NEXT: [[TWENTYSEVEN:%[0-9]+]] = mul i8 [[GPR1]], 4
|
||||
+// CHECK-PPC-NEXT: [[TWENTYEIGHT:%[0-9]+]] = sext i8 [[TWENTYSEVEN]] to i32
|
||||
+// CHECK-PPC-NEXT: [[TWENTYNINE:%[0-9]+]] = add i32 [[TWENTYSIX]], [[TWENTYEIGHT]]
|
||||
+// CHECK-PPC-NEXT: br i1 [[COND1]], label [[USING_REGS1:%[a-z_0-9]+]], label [[USING_OVERFLOW1:%[a-z_0-9]+]]
|
||||
+//
|
||||
+// CHECK-PPC1:[[USING_REGS1]]:
|
||||
+// CHECK-PPC: [[THIRTY:%[0-9]+]] = inttoptr i32 [[TWENTYNINE]] to i32*
|
||||
+// CHECK-PPC-NEXT: [[THIRTYONE:%[0-9]+]] = add i8 [[GPR1]], 1
|
||||
+// CHECK-PPC-NEXT: store i8 [[THIRTYONE]], i8* [[GPRPTR1]]
|
||||
+// CHECK-PPC-NEXT: br label [[CONT1:%[a-z0-9]+]]
|
||||
+//
|
||||
+// CHECK-PPC1:[[USING_OVERFLOW1]]:
|
||||
+// CHECK-PPC: [[THIRTYTWO:%[0-9]+]] = inttoptr i32 [[TWENTYFIVE]] to i32*
|
||||
+// CHECK-PPC-NEXT: [[THIRTYTHREE:%[0-9]+]] = add i32 [[TWENTYFIVE]], 4
|
||||
+// CHECK-PPC-NEXT: [[THIRTYFOUR:%[0-9]+]] = inttoptr i32 [[THIRTYTHREE]] to i8*
|
||||
+// CHECK-PPC-NEXT: store i8* [[THIRTYFOUR]], i8** [[TWENTYTWO]]
|
||||
+// CHECK-PPC-NEXT: br label [[CONT1]]
|
||||
+//
|
||||
+// CHECK-PPC1:[[CONT1]]:
|
||||
+// CHECK-PPC: [[VAARG_ADDR1:%[a-z.0-9]+]] = phi i32* [ [[THIRTY]], [[USING_REGS1]] ], [ [[THIRTYTWO]], [[USING_OVERFLOW1]] ]
|
||||
+// CHECK-PPC-NEXT: [[THIRTYFIVE:%[0-9]+]] = load i32* [[VAARG_ADDR1]]
|
||||
+// CHECK-PPC-NEXT: store i32 [[THIRTYFIVE]], i32* %v, align 4
|
||||
+
|
||||
+#ifdef __powerpc64__
|
||||
+ __int128_t u = va_arg (ap, __int128_t);
|
||||
+#endif
|
||||
+// CHECK: bitcast i8* %{{[a-z.0-9]+}} to i128*
|
||||
+// CHECK-NEXT: load i128* %{{[0-9]+}}
|
||||
+}
|
@ -120,6 +120,7 @@ iter_new(struct module_qstate* qstate, int id)
|
||||
iq->query_restart_count = 0;
|
||||
iq->referral_count = 0;
|
||||
iq->sent_count = 0;
|
||||
iq->target_count = NULL;
|
||||
iq->wait_priming_stub = 0;
|
||||
iq->refetch_glue = 0;
|
||||
iq->dnssec_expected = 0;
|
||||
@ -445,6 +446,26 @@ handle_cname_response(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** create target count structure for this query */
|
||||
static void
|
||||
target_count_create(struct iter_qstate* iq)
|
||||
{
|
||||
if(!iq->target_count) {
|
||||
iq->target_count = (int*)calloc(2, sizeof(int));
|
||||
/* if calloc fails we simply do not track this number */
|
||||
if(iq->target_count)
|
||||
iq->target_count[0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
target_count_increase(struct iter_qstate* iq, int num)
|
||||
{
|
||||
target_count_create(iq);
|
||||
if(iq->target_count)
|
||||
iq->target_count[1] += num;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a subrequest.
|
||||
* Generate a local request event. Local events are tied to this module, and
|
||||
@ -516,6 +537,10 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
subiq = (struct iter_qstate*)subq->minfo[id];
|
||||
memset(subiq, 0, sizeof(*subiq));
|
||||
subiq->num_target_queries = 0;
|
||||
target_count_create(iq);
|
||||
subiq->target_count = iq->target_count;
|
||||
if(iq->target_count)
|
||||
iq->target_count[0] ++; /* extra reference */
|
||||
subiq->num_current_queries = 0;
|
||||
subiq->depth = iq->depth+1;
|
||||
outbound_list_init(&subiq->outlist);
|
||||
@ -1342,6 +1367,12 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
|
||||
if(iq->depth == ie->max_dependency_depth)
|
||||
return 0;
|
||||
if(iq->depth > 0 && iq->target_count &&
|
||||
iq->target_count[1] > MAX_TARGET_COUNT) {
|
||||
verbose(VERB_QUERY, "request has exceeded the maximum "
|
||||
"number of glue fetches %d", iq->target_count[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
iter_mark_cycle_targets(qstate, iq->dp);
|
||||
missing = (int)delegpt_count_missing_targets(iq->dp);
|
||||
@ -1524,6 +1555,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
iq->num_target_queries += qs;
|
||||
target_count_increase(iq, qs);
|
||||
if(qs != 0) {
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
return 0; /* and wait for them */
|
||||
@ -1533,6 +1565,12 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
verbose(VERB_QUERY, "maxdepth and need more nameservers, fail");
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
if(iq->depth > 0 && iq->target_count &&
|
||||
iq->target_count[1] > MAX_TARGET_COUNT) {
|
||||
verbose(VERB_QUERY, "request has exceeded the maximum "
|
||||
"number of glue fetches %d", iq->target_count[1]);
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
/* mark cycle targets for parent-side lookups */
|
||||
iter_mark_pside_cycle_targets(qstate, iq->dp);
|
||||
/* see if we can issue queries to get nameserver addresses */
|
||||
@ -1562,6 +1600,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
if(query_count != 0) { /* suspend to await results */
|
||||
verbose(VERB_ALGO, "try parent-side glue lookup");
|
||||
iq->num_target_queries += query_count;
|
||||
target_count_increase(iq, query_count);
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
return 0;
|
||||
}
|
||||
@ -1717,6 +1756,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
iq->num_target_queries += extra;
|
||||
target_count_increase(iq, extra);
|
||||
if(iq->num_target_queries > 0) {
|
||||
/* wait to get all targets, we want to try em */
|
||||
verbose(VERB_ALGO, "wait for all targets for fallback");
|
||||
@ -1757,6 +1797,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
/* errors ignored, these targets are not strictly necessary for
|
||||
* this result, we do not have to reply with SERVFAIL */
|
||||
iq->num_target_queries += extra;
|
||||
target_count_increase(iq, extra);
|
||||
}
|
||||
|
||||
/* Add the current set of unused targets to our queue. */
|
||||
@ -1802,6 +1843,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return 1;
|
||||
}
|
||||
iq->num_target_queries += qs;
|
||||
target_count_increase(iq, qs);
|
||||
}
|
||||
/* Since a target query might have been made, we
|
||||
* need to check again. */
|
||||
@ -2894,6 +2936,8 @@ iter_clear(struct module_qstate* qstate, int id)
|
||||
iq = (struct iter_qstate*)qstate->minfo[id];
|
||||
if(iq) {
|
||||
outbound_list_clear(&iq->outlist);
|
||||
if(iq->target_count && --iq->target_count[0] == 0)
|
||||
free(iq->target_count);
|
||||
iq->num_current_queries = 0;
|
||||
}
|
||||
qstate->minfo[id] = NULL;
|
||||
|
@ -52,6 +52,8 @@ struct iter_donotq;
|
||||
struct iter_prep_list;
|
||||
struct iter_priv;
|
||||
|
||||
/** max number of targets spawned for a query and its subqueries */
|
||||
#define MAX_TARGET_COUNT 32
|
||||
/** max number of query restarts. Determines max number of CNAME chain. */
|
||||
#define MAX_RESTART_COUNT 8
|
||||
/** max number of referrals. Makes sure resolver does not run away */
|
||||
@ -254,6 +256,10 @@ struct iter_qstate {
|
||||
|
||||
/** number of queries fired off */
|
||||
int sent_count;
|
||||
|
||||
/** number of target queries spawned in [1], for this query and its
|
||||
* subqueries, the malloced-array is shared, [0] refcount. */
|
||||
int* target_count;
|
||||
|
||||
/**
|
||||
* The query must store NS records from referrals as parentside RRs
|
||||
|
@ -333,7 +333,7 @@ MTREES+= mtree/BSD.debug.dist /usr/lib
|
||||
MTREES+= mtree/BSD.groff.dist /usr
|
||||
.endif
|
||||
.if ${MK_TESTS} != "no"
|
||||
MTREES+= mtree/BSD.tests.dist /usr
|
||||
MTREES+= mtree/BSD.tests.dist ${TESTSBASE}
|
||||
.endif
|
||||
.if ${MK_SENDMAIL} != "no"
|
||||
MTREES+= mtree/BSD.sendmail.dist /
|
||||
@ -349,6 +349,7 @@ distrib-dirs: ${MTREES:N/*}
|
||||
shift; \
|
||||
d=${DESTDIR}$$1; \
|
||||
shift; \
|
||||
test -d $$d || mkdir -p $$d; \
|
||||
${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
|
||||
-f $$m -p $$d; \
|
||||
${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
|
||||
@ -362,6 +363,7 @@ distrib-dirs: ${MTREES:N/*}
|
||||
test "$$d" == "/" && d=""; \
|
||||
d=${DISTBASE}$$d; \
|
||||
shift; \
|
||||
test -d $$d || mkdir -p $$d; \
|
||||
${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
|
||||
"sed s#^\.#.$$d# | ${METALOG.add}" ; \
|
||||
${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
|
||||
|
@ -1017,7 +1017,23 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x056e";
|
||||
match "product" "(0x200c|0x4002|0x4005|0x400b|0x4010)";
|
||||
match "product" "(0x200c|0x4002|0x4005)";
|
||||
action "kldload -n if_aue";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x056e";
|
||||
match "product" "0x4008";
|
||||
action "kldload -n if_urtwn";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x056e";
|
||||
match "product" "(0x400b|0x4010)";
|
||||
action "kldload -n if_aue";
|
||||
};
|
||||
|
||||
@ -1177,7 +1193,7 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x05c6";
|
||||
match "product" "(0x1000|0x6000|0x6613|0x9000|0x9204|0x9205)";
|
||||
match "product" "(0x1000|0x6000|0x6500|0x6613|0x9000|0x9204|0x9205)";
|
||||
action "kldload -n u3g";
|
||||
};
|
||||
|
||||
@ -2545,7 +2561,7 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x0bda";
|
||||
match "product" "(0x8176|0x8176|0x8177|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e)";
|
||||
match "product" "(0x8176|0x8176|0x8177|0x8178|0x8179|0x817a|0x817b|0x817c|0x817d|0x817e|0x817f)";
|
||||
action "kldload -n if_urtwn";
|
||||
};
|
||||
|
||||
@ -3617,7 +3633,7 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x12d1";
|
||||
match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1464|0x1465|0x14ac|0x14c9|0x14d1|0x14fe|0x1505|0x1506|0x1520|0x1521)";
|
||||
match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1464|0x1465|0x14ac|0x14c9|0x14cf|0x14d1|0x14fe|0x1505|0x1506|0x1520|0x1521|0x1526)";
|
||||
action "kldload -n u3g";
|
||||
};
|
||||
|
||||
@ -4489,7 +4505,15 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x19d2";
|
||||
match "product" "(0x0001|0x0002|0x0003|0x0004|0x0005|0x0006|0x0007|0x0008|0x0009|0x000a|0x000b|0x000c|0x000d|0x000e|0x000f|0x0010|0x0011|0x0012|0x0013|0x0014|0x0015|0x0016|0x0017|0x0018|0x0019|0x0020|0x0021|0x0022|0x0023|0x0024|0x0025|0x0026|0x0027|0x0028|0x0029|0x0030|0x0031|0x0032|0x0033|0x0037|0x0039|0x0042|0x0043|0x0048|0x0049|0x0051|0x0052|0x0053|0x0054|0x0055|0x0057|0x0058|0x0059|0x0060|0x0061|0x0062|0x0063|0x0064|0x0066|0x0069|0x0070|0x0073|0x0076|0x0078|0x0082|0x0086|0x0117|0x1179|0x2000|0x2002|0x2003|0xfff1|0xfff5|0xfffe)";
|
||||
match "product" "(0x0001|0x0002|0x0003|0x0004|0x0005|0x0006|0x0007|0x0008|0x0009|0x000a|0x000b|0x000c|0x000d|0x000e|0x000f|0x0010|0x0011|0x0012|0x0013|0x0014|0x0015|0x0016|0x0017|0x0018|0x0019|0x0020|0x0021|0x0022|0x0023|0x0024|0x0025|0x0026|0x0027|0x0028|0x0029|0x0030|0x0031|0x0032|0x0033|0x0037|0x0039|0x0042|0x0043|0x0048|0x0049|0x0051|0x0052|0x0053|0x0054|0x0055|0x0057|0x0058|0x0059|0x0060|0x0061|0x0062|0x0063|0x0064|0x0066|0x0069|0x0070|0x0073|0x0076|0x0078|0x0082|0x0086|0x0117|0x1179|0x1181|0x1514|0x1516|0x2000|0x2002|0x2003|0xffdd|0xffde|0xfff1|0xfff5|0xfffe)";
|
||||
action "kldload -n u3g";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x19f5";
|
||||
match "product" "0x9909";
|
||||
action "kldload -n u3g";
|
||||
};
|
||||
|
||||
@ -4609,7 +4633,7 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x1cf1";
|
||||
match "product" "(0x0001|0x0004|0x0022)";
|
||||
match "product" "(0x0001|0x0004|0x001c|0x0022)";
|
||||
action "kldload -n uftdi";
|
||||
};
|
||||
|
||||
@ -4697,7 +4721,7 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x2001";
|
||||
match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f)";
|
||||
match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310)";
|
||||
action "kldload -n if_urtwn";
|
||||
};
|
||||
|
||||
@ -4897,7 +4921,23 @@ nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x20f4";
|
||||
match "product" "(0x624d|0x648b)";
|
||||
match "product" "0x624d";
|
||||
action "kldload -n if_urtwn";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x20f4";
|
||||
match "product" "0x646b";
|
||||
action "kldload -n if_rsu";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x20f4";
|
||||
match "product" "0x648b";
|
||||
action "kldload -n if_urtwn";
|
||||
};
|
||||
|
||||
@ -5291,6 +5331,16 @@ nomatch 32 {
|
||||
action "kldload -n if_ipheth";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x0830";
|
||||
match "intclass" "0x02";
|
||||
match "intsubclass" "0x02";
|
||||
match "intprotocol" "0xff";
|
||||
action "kldload -n if_urndis";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
@ -5301,6 +5351,16 @@ nomatch 32 {
|
||||
action "kldload -n ng_ubt";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "vendor" "0x12d1";
|
||||
match "intclass" "0x02";
|
||||
match "intsubclass" "0x02";
|
||||
match "intprotocol" "0xff";
|
||||
action "kldload -n umodem";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
@ -5349,15 +5409,6 @@ nomatch 32 {
|
||||
action "kldload -n umodem";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
match "intclass" "0x02";
|
||||
match "intsubclass" "0x02";
|
||||
match "intprotocol" "0xff";
|
||||
action "kldload -n umodem";
|
||||
};
|
||||
|
||||
nomatch 32 {
|
||||
match "bus" "uhub[0-9]+";
|
||||
match "mode" "host";
|
||||
@ -5501,5 +5552,5 @@ nomatch 32 {
|
||||
action "kldload -n umass";
|
||||
};
|
||||
|
||||
# 2643 USB entries processed
|
||||
# 2658 USB entries processed
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
..
|
||||
arpa
|
||||
..
|
||||
atf-c
|
||||
..
|
||||
atf-c++
|
||||
..
|
||||
bsm
|
||||
..
|
||||
bsnmp
|
||||
|
@ -5,410 +5,392 @@
|
||||
|
||||
/set type=dir uname=root gname=wheel mode=0755
|
||||
.
|
||||
include
|
||||
atf-c
|
||||
bin
|
||||
chown
|
||||
..
|
||||
atf-c++
|
||||
date
|
||||
..
|
||||
mv
|
||||
..
|
||||
pax
|
||||
..
|
||||
pkill
|
||||
..
|
||||
sh
|
||||
builtins
|
||||
..
|
||||
errors
|
||||
..
|
||||
execution
|
||||
..
|
||||
expansion
|
||||
..
|
||||
parameters
|
||||
..
|
||||
parser
|
||||
..
|
||||
set-e
|
||||
..
|
||||
..
|
||||
sleep
|
||||
..
|
||||
test
|
||||
..
|
||||
..
|
||||
cddl
|
||||
lib
|
||||
..
|
||||
sbin
|
||||
..
|
||||
usr.bin
|
||||
..
|
||||
usr.sbin
|
||||
..
|
||||
..
|
||||
etc
|
||||
..
|
||||
games
|
||||
..
|
||||
gnu
|
||||
lib
|
||||
..
|
||||
usr.bin
|
||||
diff
|
||||
..
|
||||
..
|
||||
..
|
||||
lib
|
||||
atf
|
||||
libatf-c
|
||||
detail
|
||||
..
|
||||
..
|
||||
libatf-c++
|
||||
detail
|
||||
..
|
||||
..
|
||||
test-programs
|
||||
..
|
||||
..
|
||||
libc
|
||||
c063
|
||||
..
|
||||
db
|
||||
..
|
||||
gen
|
||||
execve
|
||||
..
|
||||
posix_spawn
|
||||
..
|
||||
..
|
||||
hash
|
||||
data
|
||||
..
|
||||
..
|
||||
inet
|
||||
..
|
||||
locale
|
||||
..
|
||||
net
|
||||
getaddrinfo
|
||||
data
|
||||
..
|
||||
..
|
||||
..
|
||||
regex
|
||||
data
|
||||
..
|
||||
..
|
||||
ssp
|
||||
..
|
||||
stdio
|
||||
..
|
||||
stdlib
|
||||
..
|
||||
string
|
||||
..
|
||||
sys
|
||||
..
|
||||
time
|
||||
..
|
||||
tls
|
||||
dso
|
||||
..
|
||||
..
|
||||
termios
|
||||
..
|
||||
ttyio
|
||||
..
|
||||
..
|
||||
libcrypt
|
||||
..
|
||||
libmp
|
||||
..
|
||||
libnv
|
||||
..
|
||||
libpam
|
||||
..
|
||||
libproc
|
||||
..
|
||||
librt
|
||||
..
|
||||
libthr
|
||||
dlopen
|
||||
..
|
||||
..
|
||||
libutil
|
||||
..
|
||||
msun
|
||||
..
|
||||
..
|
||||
libexec
|
||||
atf
|
||||
atf-check
|
||||
..
|
||||
atf-sh
|
||||
..
|
||||
..
|
||||
rtld-elf
|
||||
..
|
||||
..
|
||||
sbin
|
||||
dhclient
|
||||
..
|
||||
devd
|
||||
..
|
||||
growfs
|
||||
..
|
||||
mdconfig
|
||||
..
|
||||
..
|
||||
secure
|
||||
lib
|
||||
..
|
||||
libexec
|
||||
..
|
||||
usr.bin
|
||||
..
|
||||
usr.sbin
|
||||
..
|
||||
..
|
||||
share
|
||||
atf
|
||||
..
|
||||
doc
|
||||
atf
|
||||
..
|
||||
pjdfstest
|
||||
examples
|
||||
tests
|
||||
atf
|
||||
..
|
||||
plain
|
||||
..
|
||||
..
|
||||
..
|
||||
..
|
||||
tests
|
||||
bin
|
||||
sys
|
||||
kern
|
||||
..
|
||||
netinet
|
||||
..
|
||||
opencrypto
|
||||
..
|
||||
pjdfstest
|
||||
chflags
|
||||
..
|
||||
chmod
|
||||
..
|
||||
chown
|
||||
..
|
||||
date
|
||||
ftruncate
|
||||
..
|
||||
mv
|
||||
granular
|
||||
..
|
||||
pax
|
||||
link
|
||||
..
|
||||
pkill
|
||||
mkdir
|
||||
..
|
||||
sh
|
||||
builtins
|
||||
..
|
||||
errors
|
||||
..
|
||||
execution
|
||||
..
|
||||
expansion
|
||||
..
|
||||
parameters
|
||||
..
|
||||
parser
|
||||
..
|
||||
set-e
|
||||
..
|
||||
mkfifo
|
||||
..
|
||||
sleep
|
||||
mknod
|
||||
..
|
||||
test
|
||||
open
|
||||
..
|
||||
..
|
||||
cddl
|
||||
lib
|
||||
rename
|
||||
..
|
||||
sbin
|
||||
rmdir
|
||||
..
|
||||
usr.bin
|
||||
..
|
||||
usr.sbin
|
||||
..
|
||||
..
|
||||
etc
|
||||
..
|
||||
games
|
||||
..
|
||||
gnu
|
||||
lib
|
||||
..
|
||||
usr.bin
|
||||
diff
|
||||
..
|
||||
..
|
||||
..
|
||||
lib
|
||||
atf
|
||||
libatf-c
|
||||
detail
|
||||
..
|
||||
..
|
||||
libatf-c++
|
||||
detail
|
||||
..
|
||||
..
|
||||
test-programs
|
||||
..
|
||||
..
|
||||
libc
|
||||
c063
|
||||
..
|
||||
db
|
||||
..
|
||||
gen
|
||||
execve
|
||||
..
|
||||
posix_spawn
|
||||
..
|
||||
..
|
||||
hash
|
||||
data
|
||||
..
|
||||
..
|
||||
inet
|
||||
..
|
||||
locale
|
||||
..
|
||||
net
|
||||
getaddrinfo
|
||||
data
|
||||
..
|
||||
..
|
||||
..
|
||||
regex
|
||||
data
|
||||
..
|
||||
..
|
||||
ssp
|
||||
..
|
||||
stdio
|
||||
..
|
||||
stdlib
|
||||
..
|
||||
string
|
||||
..
|
||||
sys
|
||||
..
|
||||
time
|
||||
..
|
||||
tls
|
||||
dso
|
||||
..
|
||||
..
|
||||
termios
|
||||
..
|
||||
ttyio
|
||||
..
|
||||
..
|
||||
libcrypt
|
||||
..
|
||||
libmp
|
||||
..
|
||||
libnv
|
||||
..
|
||||
libpam
|
||||
..
|
||||
libproc
|
||||
..
|
||||
librt
|
||||
..
|
||||
libthr
|
||||
dlopen
|
||||
..
|
||||
..
|
||||
libutil
|
||||
..
|
||||
msun
|
||||
..
|
||||
..
|
||||
libexec
|
||||
atf
|
||||
atf-check
|
||||
..
|
||||
atf-sh
|
||||
..
|
||||
..
|
||||
rtld-elf
|
||||
..
|
||||
..
|
||||
sbin
|
||||
dhclient
|
||||
..
|
||||
devd
|
||||
..
|
||||
growfs
|
||||
..
|
||||
mdconfig
|
||||
..
|
||||
..
|
||||
secure
|
||||
lib
|
||||
..
|
||||
libexec
|
||||
..
|
||||
usr.bin
|
||||
..
|
||||
usr.sbin
|
||||
..
|
||||
..
|
||||
share
|
||||
examples
|
||||
tests
|
||||
atf
|
||||
..
|
||||
plain
|
||||
..
|
||||
..
|
||||
..
|
||||
..
|
||||
sys
|
||||
kern
|
||||
..
|
||||
netinet
|
||||
..
|
||||
opencrypto
|
||||
..
|
||||
pjdfstest
|
||||
chflags
|
||||
..
|
||||
chmod
|
||||
..
|
||||
chown
|
||||
..
|
||||
ftruncate
|
||||
..
|
||||
granular
|
||||
..
|
||||
link
|
||||
..
|
||||
mkdir
|
||||
..
|
||||
mkfifo
|
||||
..
|
||||
mknod
|
||||
..
|
||||
open
|
||||
..
|
||||
rename
|
||||
..
|
||||
rmdir
|
||||
..
|
||||
symlink
|
||||
..
|
||||
truncate
|
||||
..
|
||||
unlink
|
||||
..
|
||||
..
|
||||
..
|
||||
usr.bin
|
||||
apply
|
||||
..
|
||||
basename
|
||||
..
|
||||
bmake
|
||||
archives
|
||||
fmt_44bsd
|
||||
..
|
||||
fmt_44bsd_mod
|
||||
..
|
||||
fmt_oldbsd
|
||||
..
|
||||
..
|
||||
basic
|
||||
t0
|
||||
..
|
||||
t1
|
||||
..
|
||||
t2
|
||||
..
|
||||
t3
|
||||
..
|
||||
..
|
||||
execution
|
||||
ellipsis
|
||||
..
|
||||
empty
|
||||
..
|
||||
joberr
|
||||
..
|
||||
plus
|
||||
..
|
||||
..
|
||||
shell
|
||||
builtin
|
||||
..
|
||||
meta
|
||||
..
|
||||
path
|
||||
..
|
||||
path_select
|
||||
..
|
||||
replace
|
||||
..
|
||||
select
|
||||
..
|
||||
..
|
||||
suffixes
|
||||
basic
|
||||
..
|
||||
src_wild1
|
||||
..
|
||||
src_wild2
|
||||
..
|
||||
..
|
||||
syntax
|
||||
directive-t0
|
||||
..
|
||||
enl
|
||||
..
|
||||
funny-targets
|
||||
..
|
||||
semi
|
||||
..
|
||||
..
|
||||
sysmk
|
||||
t0
|
||||
2
|
||||
1
|
||||
..
|
||||
..
|
||||
mk
|
||||
..
|
||||
..
|
||||
t1
|
||||
2
|
||||
1
|
||||
..
|
||||
..
|
||||
mk
|
||||
..
|
||||
..
|
||||
t2
|
||||
2
|
||||
1
|
||||
..
|
||||
..
|
||||
mk
|
||||
..
|
||||
..
|
||||
..
|
||||
variables
|
||||
modifier_M
|
||||
..
|
||||
modifier_t
|
||||
..
|
||||
opt_V
|
||||
..
|
||||
t0
|
||||
..
|
||||
..
|
||||
..
|
||||
calendar
|
||||
..
|
||||
cmp
|
||||
..
|
||||
comm
|
||||
..
|
||||
cut
|
||||
..
|
||||
dirname
|
||||
..
|
||||
file2c
|
||||
..
|
||||
grep
|
||||
..
|
||||
gzip
|
||||
..
|
||||
join
|
||||
..
|
||||
jot
|
||||
..
|
||||
lastcomm
|
||||
..
|
||||
m4
|
||||
..
|
||||
mkimg
|
||||
..
|
||||
ncal
|
||||
..
|
||||
printf
|
||||
..
|
||||
sed
|
||||
regress.multitest.out
|
||||
..
|
||||
..
|
||||
timeout
|
||||
..
|
||||
tr
|
||||
symlink
|
||||
..
|
||||
truncate
|
||||
..
|
||||
units
|
||||
unlink
|
||||
..
|
||||
uudecode
|
||||
..
|
||||
..
|
||||
usr.bin
|
||||
apply
|
||||
..
|
||||
basename
|
||||
..
|
||||
bmake
|
||||
archives
|
||||
fmt_44bsd
|
||||
..
|
||||
fmt_44bsd_mod
|
||||
..
|
||||
fmt_oldbsd
|
||||
..
|
||||
..
|
||||
uuencode
|
||||
basic
|
||||
t0
|
||||
..
|
||||
t1
|
||||
..
|
||||
t2
|
||||
..
|
||||
t3
|
||||
..
|
||||
..
|
||||
xargs
|
||||
execution
|
||||
ellipsis
|
||||
..
|
||||
empty
|
||||
..
|
||||
joberr
|
||||
..
|
||||
plus
|
||||
..
|
||||
..
|
||||
yacc
|
||||
yacc
|
||||
shell
|
||||
builtin
|
||||
..
|
||||
meta
|
||||
..
|
||||
path
|
||||
..
|
||||
path_select
|
||||
..
|
||||
replace
|
||||
..
|
||||
select
|
||||
..
|
||||
..
|
||||
suffixes
|
||||
basic
|
||||
..
|
||||
src_wild1
|
||||
..
|
||||
src_wild2
|
||||
..
|
||||
..
|
||||
syntax
|
||||
directive-t0
|
||||
..
|
||||
enl
|
||||
..
|
||||
funny-targets
|
||||
..
|
||||
semi
|
||||
..
|
||||
..
|
||||
sysmk
|
||||
t0
|
||||
2
|
||||
1
|
||||
..
|
||||
..
|
||||
mk
|
||||
..
|
||||
..
|
||||
t1
|
||||
2
|
||||
1
|
||||
..
|
||||
..
|
||||
mk
|
||||
..
|
||||
..
|
||||
t2
|
||||
2
|
||||
1
|
||||
..
|
||||
..
|
||||
mk
|
||||
..
|
||||
..
|
||||
..
|
||||
variables
|
||||
modifier_M
|
||||
..
|
||||
modifier_t
|
||||
..
|
||||
opt_V
|
||||
..
|
||||
t0
|
||||
..
|
||||
..
|
||||
..
|
||||
usr.sbin
|
||||
etcupdate
|
||||
calendar
|
||||
..
|
||||
cmp
|
||||
..
|
||||
comm
|
||||
..
|
||||
cut
|
||||
..
|
||||
dirname
|
||||
..
|
||||
file2c
|
||||
..
|
||||
grep
|
||||
..
|
||||
gzip
|
||||
..
|
||||
join
|
||||
..
|
||||
jot
|
||||
..
|
||||
lastcomm
|
||||
..
|
||||
m4
|
||||
..
|
||||
mkimg
|
||||
..
|
||||
ncal
|
||||
..
|
||||
printf
|
||||
..
|
||||
sed
|
||||
regress.multitest.out
|
||||
..
|
||||
newsyslog
|
||||
..
|
||||
nmtree
|
||||
..
|
||||
pw
|
||||
..
|
||||
sa
|
||||
..
|
||||
timeout
|
||||
..
|
||||
tr
|
||||
..
|
||||
truncate
|
||||
..
|
||||
units
|
||||
..
|
||||
uudecode
|
||||
..
|
||||
uuencode
|
||||
..
|
||||
xargs
|
||||
..
|
||||
yacc
|
||||
yacc
|
||||
..
|
||||
..
|
||||
..
|
||||
usr.sbin
|
||||
etcupdate
|
||||
..
|
||||
newsyslog
|
||||
..
|
||||
nmtree
|
||||
..
|
||||
pw
|
||||
..
|
||||
sa
|
||||
..
|
||||
..
|
||||
..
|
||||
|
||||
# vim: set expandtab ts=4 sw=4:
|
||||
|
@ -126,6 +126,8 @@
|
||||
sbin
|
||||
..
|
||||
share
|
||||
atf
|
||||
..
|
||||
bsdconfig
|
||||
media
|
||||
..
|
||||
@ -169,6 +171,8 @@
|
||||
doc
|
||||
IPv6
|
||||
..
|
||||
atf
|
||||
..
|
||||
atm
|
||||
..
|
||||
legal
|
||||
@ -189,6 +193,8 @@
|
||||
..
|
||||
papers
|
||||
..
|
||||
pjdfstest
|
||||
..
|
||||
psd
|
||||
01.cacm
|
||||
..
|
||||
|
@ -30,7 +30,7 @@ LDADD= ${LIBBACKEND} ${LIBCPP} ${LIBDECNUMBER} ${LIBIBERTY}
|
||||
# C++ parser
|
||||
cfns.h: cfns.gperf
|
||||
gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
|
||||
${.ALLSRC} > ${.TARGET}
|
||||
${.ALLSRC} > ${.TARGET} || (rm -f ${.TARGET}; false)
|
||||
CLEANFILES= cfns.h
|
||||
|
||||
DOBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
|
@ -2,4 +2,8 @@
|
||||
|
||||
SUBDIR= contrib doc font man src tmac
|
||||
|
||||
.for subdir in ${SUBDIR:Nsrc}
|
||||
SUBDIR_DEPEND_${subdir}= src
|
||||
.endfor
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,4 +2,10 @@
|
||||
|
||||
SUBDIR= libs devices preproc roff utils
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.for subdir in ${SUBDIR:Nlibs}
|
||||
SUBDIR_DEPEND_${subdir}= libs
|
||||
.endfor
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
SUBDIR= grodvi grohtml grolbp grolj4 grops grotty
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
SUBDIR= libgroff libdriver libbib
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
SUBDIR= eqn grn html pic refer soelim tbl
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
SUBDIR= groff grog nroff psroff troff
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -2,4 +2,6 @@
|
||||
|
||||
SUBDIR= addftinfo afmtodit hpftodit indxbib lkbib lookbib pfbtops tfmtodit
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -48,7 +48,7 @@
|
||||
.Ft size_t
|
||||
.Fn iconv "iconv_t cd" "char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft"
|
||||
.Ft size_t
|
||||
.Fn __iconv "iconv_t cd" "const char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t invalids"
|
||||
.Fn __iconv "iconv_t cd" "const char ** restrict src" "size_t * restrict srcleft" "char ** restrict dst" "size_t * restrict dstleft" "uint32_t flags" "size_t * invalids"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn iconv_open
|
||||
|
@ -597,6 +597,7 @@ sctp_sendmsg(int s,
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = cmsgbuf;
|
||||
msg.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo));
|
||||
msg.msg_flags = 0;
|
||||
cmsg = (struct cmsghdr *)cmsgbuf;
|
||||
cmsg->cmsg_level = IPPROTO_SCTP;
|
||||
cmsg->cmsg_type = SCTP_SNDRCV;
|
||||
@ -663,6 +664,7 @@ sctp_send(int sd, const void *data, size_t len,
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = cmsgbuf;
|
||||
msg.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo));
|
||||
msg.msg_flags = 0;
|
||||
cmsg = (struct cmsghdr *)cmsgbuf;
|
||||
cmsg->cmsg_level = IPPROTO_SCTP;
|
||||
cmsg->cmsg_type = SCTP_SNDRCV;
|
||||
@ -820,7 +822,6 @@ sctp_recvmsg(int s,
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
msg.msg_flags = 0;
|
||||
iov.iov_base = dbuf;
|
||||
iov.iov_len = len;
|
||||
msg.msg_name = (caddr_t)from;
|
||||
@ -832,6 +833,7 @@ sctp_recvmsg(int s,
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control = cmsgbuf;
|
||||
msg.msg_controllen = sizeof(cmsgbuf);
|
||||
msg.msg_flags = 0;
|
||||
sz = recvmsg(s, &msg, *msg_flags);
|
||||
*msg_flags = msg.msg_flags;
|
||||
if (sz <= 0) {
|
||||
@ -905,6 +907,7 @@ sctp_recvv(int sd,
|
||||
msg.msg_iovlen = iovlen;
|
||||
msg.msg_control = cmsgbuf;
|
||||
msg.msg_controllen = sizeof(cmsgbuf);
|
||||
msg.msg_flags = 0;
|
||||
ret = recvmsg(sd, &msg, *flags);
|
||||
*flags = msg.msg_flags;
|
||||
if ((ret > 0) &&
|
||||
|
@ -162,56 +162,56 @@ struct kevent {
|
||||
The fields of
|
||||
.Fa struct kevent
|
||||
are:
|
||||
.Bl -tag -width XXXfilter
|
||||
.It ident
|
||||
.Bl -tag -width "Fa filter"
|
||||
.It Fa ident
|
||||
Value used to identify this event.
|
||||
The exact interpretation is determined by the attached filter,
|
||||
but often is a file descriptor.
|
||||
.It filter
|
||||
.It Fa filter
|
||||
Identifies the kernel filter used to process this event.
|
||||
The pre-defined
|
||||
system filters are described below.
|
||||
.It flags
|
||||
.It Fa flags
|
||||
Actions to perform on the event.
|
||||
.It fflags
|
||||
.It Fa fflags
|
||||
Filter-specific flags.
|
||||
.It data
|
||||
.It Fa data
|
||||
Filter-specific data value.
|
||||
.It udata
|
||||
.It Fa udata
|
||||
Opaque user-defined value passed through the kernel unchanged.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Va flags
|
||||
field can contain the following values:
|
||||
.Bl -tag -width XXXEV_ONESHOT
|
||||
.It EV_ADD
|
||||
.Bl -tag -width EV_DISPATCH
|
||||
.It Dv EV_ADD
|
||||
Adds the event to the kqueue.
|
||||
Re-adding an existing event
|
||||
will modify the parameters of the original event, and not result
|
||||
in a duplicate entry.
|
||||
Adding an event automatically enables it,
|
||||
unless overridden by the EV_DISABLE flag.
|
||||
.It EV_ENABLE
|
||||
.It Dv EV_ENABLE
|
||||
Permit
|
||||
.Fn kevent
|
||||
to return the event if it is triggered.
|
||||
.It EV_DISABLE
|
||||
.It Dv EV_DISABLE
|
||||
Disable the event so
|
||||
.Fn kevent
|
||||
will not return it.
|
||||
The filter itself is not disabled.
|
||||
.It EV_DISPATCH
|
||||
.It Dv EV_DISPATCH
|
||||
Disable the event source immediately after delivery of an event.
|
||||
See
|
||||
.Dv EV_DISABLE
|
||||
above.
|
||||
.It EV_DELETE
|
||||
.It Dv EV_DELETE
|
||||
Removes the event from the kqueue.
|
||||
Events which are attached to
|
||||
file descriptors are automatically deleted on the last close of
|
||||
the descriptor.
|
||||
.It EV_RECEIPT
|
||||
.It Dv EV_RECEIPT
|
||||
This flag is useful for making bulk changes to a kqueue without draining
|
||||
any pending events.
|
||||
When passed as input, it forces
|
||||
@ -220,20 +220,20 @@ to always be returned.
|
||||
When a filter is successfully added the
|
||||
.Va data
|
||||
field will be zero.
|
||||
.It EV_ONESHOT
|
||||
.It Dv EV_ONESHOT
|
||||
Causes the event to return only the first occurrence of the filter
|
||||
being triggered.
|
||||
After the user retrieves the event from the kqueue,
|
||||
it is deleted.
|
||||
.It EV_CLEAR
|
||||
.It Dv EV_CLEAR
|
||||
After the event is retrieved by the user, its state is reset.
|
||||
This is useful for filters which report state transitions
|
||||
instead of the current state.
|
||||
Note that some filters may automatically
|
||||
set this flag internally.
|
||||
.It EV_EOF
|
||||
.It Dv EV_EOF
|
||||
Filters may set this flag to indicate filter-specific EOF condition.
|
||||
.It EV_ERROR
|
||||
.It Dv EV_ERROR
|
||||
See
|
||||
.Sx RETURN VALUES
|
||||
below.
|
||||
@ -245,8 +245,8 @@ Arguments may be passed to and from the filter via the
|
||||
and
|
||||
.Va data
|
||||
fields in the kevent structure.
|
||||
.Bl -tag -width EVFILT_PROCDESC
|
||||
.It EVFILT_READ
|
||||
.Bl -tag -width "Dv EVFILT_PROCDESC"
|
||||
.It Dv EVFILT_READ
|
||||
Takes a descriptor as the identifier, and returns whenever
|
||||
there is data available to read.
|
||||
The behavior of the filter is slightly different depending
|
||||
@ -265,7 +265,7 @@ subject to the
|
||||
value of the socket buffer.
|
||||
This may be overridden with a per-filter low water mark at the
|
||||
time the filter is added by setting the
|
||||
NOTE_LOWAT
|
||||
.Dv NOTE_LOWAT
|
||||
flag in
|
||||
.Va fflags ,
|
||||
and specifying the new low water mark in
|
||||
@ -275,7 +275,9 @@ On return,
|
||||
contains the number of bytes of protocol data available to read.
|
||||
.Pp
|
||||
If the read direction of the socket has shutdown, then the filter
|
||||
also sets EV_EOF in
|
||||
also sets
|
||||
.Dv EV_EOF
|
||||
in
|
||||
.Va flags ,
|
||||
and returns the socket error (if any) in
|
||||
.Va fflags .
|
||||
@ -291,9 +293,13 @@ Returns when the there is data to read;
|
||||
.Va data
|
||||
contains the number of bytes available.
|
||||
.Pp
|
||||
When the last writer disconnects, the filter will set EV_EOF in
|
||||
When the last writer disconnects, the filter will set
|
||||
.Dv EV_EOF
|
||||
in
|
||||
.Va flags .
|
||||
This may be cleared by passing in EV_CLEAR, at which point the
|
||||
This may be cleared by passing in
|
||||
.Dv EV_CLEAR ,
|
||||
at which point the
|
||||
filter will resume waiting for data to become available before
|
||||
returning.
|
||||
.It "BPF devices"
|
||||
@ -304,7 +310,7 @@ enabled and there is any data to read;
|
||||
.Va data
|
||||
contains the number of bytes available.
|
||||
.El
|
||||
.It EVFILT_WRITE
|
||||
.It Dv EVFILT_WRITE
|
||||
Takes a descriptor as the identifier, and returns whenever
|
||||
it is possible to write to the descriptor.
|
||||
For sockets, pipes
|
||||
@ -312,23 +318,30 @@ and fifos,
|
||||
.Va data
|
||||
will contain the amount of space remaining in the write buffer.
|
||||
The filter will set EV_EOF when the reader disconnects, and for
|
||||
the fifo case, this may be cleared by use of EV_CLEAR.
|
||||
the fifo case, this may be cleared by use of
|
||||
.Dv EV_CLEAR .
|
||||
Note that this filter is not supported for vnodes or BPF devices.
|
||||
.Pp
|
||||
For sockets, the low water mark and socket error handling is
|
||||
identical to the EVFILT_READ case.
|
||||
.It EVFILT_AIO
|
||||
identical to the
|
||||
.Dv EVFILT_READ
|
||||
case.
|
||||
.It Dv EVFILT_AIO
|
||||
The sigevent portion of the AIO request is filled in, with
|
||||
.Va sigev_notify_kqueue
|
||||
containing the descriptor of the kqueue that the event should
|
||||
be attached to,
|
||||
.Va sigev_notify_kevent_flags
|
||||
containing the kevent flags which should be EV_ONESHOT, EV_CLEAR or
|
||||
EV_DISPATCH,
|
||||
containing the kevent flags which should be
|
||||
.Dv EV_ONESHOT ,
|
||||
.Dv EV_CLEAR
|
||||
or
|
||||
.Dv EV_DISPATCH ,
|
||||
.Va sigev_value
|
||||
containing the udata value, and
|
||||
.Va sigev_notify
|
||||
set to SIGEV_KEVENT.
|
||||
set to
|
||||
.Dv SIGEV_KEVENT .
|
||||
When the
|
||||
.Fn aio_*
|
||||
system call is made, the event will be registered
|
||||
@ -339,29 +352,30 @@ argument set to the
|
||||
returned by the
|
||||
.Fn aio_*
|
||||
system call.
|
||||
The filter returns under the same conditions as aio_error.
|
||||
.It EVFILT_VNODE
|
||||
The filter returns under the same conditions as
|
||||
.Fn aio_error .
|
||||
.It Dv EVFILT_VNODE
|
||||
Takes a file descriptor as the identifier and the events to watch for in
|
||||
.Va fflags ,
|
||||
and returns when one or more of the requested events occurs on the descriptor.
|
||||
The events to monitor are:
|
||||
.Bl -tag -width XXNOTE_RENAME
|
||||
.It NOTE_DELETE
|
||||
.Bl -tag -width "Dv NOTE_RENAME"
|
||||
.It Dv NOTE_DELETE
|
||||
The
|
||||
.Fn unlink
|
||||
system call
|
||||
was called on the file referenced by the descriptor.
|
||||
.It NOTE_WRITE
|
||||
.It Dv NOTE_WRITE
|
||||
A write occurred on the file referenced by the descriptor.
|
||||
.It NOTE_EXTEND
|
||||
.It Dv NOTE_EXTEND
|
||||
The file referenced by the descriptor was extended.
|
||||
.It NOTE_ATTRIB
|
||||
.It Dv NOTE_ATTRIB
|
||||
The file referenced by the descriptor had its attributes changed.
|
||||
.It NOTE_LINK
|
||||
.It Dv NOTE_LINK
|
||||
The link count on the file changed.
|
||||
.It NOTE_RENAME
|
||||
.It Dv NOTE_RENAME
|
||||
The file referenced by the descriptor was renamed.
|
||||
.It NOTE_REVOKE
|
||||
.It Dv NOTE_REVOKE
|
||||
Access to the file was revoked via
|
||||
.Xr revoke 2
|
||||
or the underlying file system was unmounted.
|
||||
@ -370,26 +384,26 @@ or the underlying file system was unmounted.
|
||||
On return,
|
||||
.Va fflags
|
||||
contains the events which triggered the filter.
|
||||
.It EVFILT_PROC
|
||||
.It Dv EVFILT_PROC
|
||||
Takes the process ID to monitor as the identifier and the events to watch for
|
||||
in
|
||||
.Va fflags ,
|
||||
and returns when the process performs one or more of the requested events.
|
||||
If a process can normally see another process, it can attach an event to it.
|
||||
The events to monitor are:
|
||||
.Bl -tag -width XXNOTE_TRACKERR
|
||||
.It NOTE_EXIT
|
||||
.Bl -tag -width "Dv NOTE_TRACKERR"
|
||||
.It Dv NOTE_EXIT
|
||||
The process has exited.
|
||||
The exit status will be stored in
|
||||
.Va data .
|
||||
.It NOTE_FORK
|
||||
.It Dv NOTE_FORK
|
||||
The process has called
|
||||
.Fn fork .
|
||||
.It NOTE_EXEC
|
||||
.It Dv NOTE_EXEC
|
||||
The process has executed a new process via
|
||||
.Xr execve 2
|
||||
or a similar call.
|
||||
.It NOTE_TRACK
|
||||
.It Dv NOTE_TRACK
|
||||
Follow a process across
|
||||
.Fn fork
|
||||
calls.
|
||||
@ -397,22 +411,28 @@ The parent process registers a new kevent to monitor the child process
|
||||
using the same
|
||||
.Va fflags
|
||||
as the original event.
|
||||
The child process will signal an event with NOTE_CHILD set in
|
||||
The child process will signal an event with
|
||||
.Dv NOTE_CHILD
|
||||
set in
|
||||
.Va fflags
|
||||
and the parent PID in
|
||||
.Va data .
|
||||
.Pp
|
||||
If the parent process fails to register a new kevent
|
||||
.Pq usually due to resource limitations ,
|
||||
it will signal an event with NOTE_TRACKERR set in
|
||||
it will signal an event with
|
||||
.Dv NOTE_TRACKERR
|
||||
set in
|
||||
.Va fflags ,
|
||||
and the child process will not signal a NOTE_CHILD event.
|
||||
and the child process will not signal a
|
||||
.Dv NOTE_CHILD
|
||||
event.
|
||||
.El
|
||||
.Pp
|
||||
On return,
|
||||
.Va fflags
|
||||
contains the events which triggered the filter.
|
||||
.It EVFILT_PROCDESC
|
||||
.It Dv EVFILT_PROCDESC
|
||||
Takes the process descriptor created by
|
||||
.Xr pdfork 2
|
||||
to monitor as the identifier and the events to watch for in
|
||||
@ -420,8 +440,8 @@ to monitor as the identifier and the events to watch for in
|
||||
and returns when the associated process performs one or more of the
|
||||
requested events.
|
||||
The events to monitor are:
|
||||
.Bl -tag -width XXNOTE_EXIT
|
||||
.It NOTE_EXIT
|
||||
.Bl -tag -width "Dv NOTE_EXIT"
|
||||
.It Dv NOTE_EXIT
|
||||
The process has exited.
|
||||
The exit status will be stored in
|
||||
.Va data .
|
||||
@ -430,7 +450,7 @@ The exit status will be stored in
|
||||
On return,
|
||||
.Va fflags
|
||||
contains the events which triggered the filter.
|
||||
.It EVFILT_SIGNAL
|
||||
.It Dv EVFILT_SIGNAL
|
||||
Takes the signal number to monitor as the identifier and returns
|
||||
when the given signal is delivered to the process.
|
||||
This coexists with the
|
||||
@ -440,7 +460,9 @@ and
|
||||
facilities, and has a lower precedence.
|
||||
The filter will record
|
||||
all attempts to deliver a signal to a process, even if the signal has
|
||||
been marked as SIG_IGN, except for the
|
||||
been marked as
|
||||
.Dv SIG_IGN ,
|
||||
except for the
|
||||
.Dv SIGCHLD
|
||||
signal, which, if ignored, won't be recorded by the filter.
|
||||
Event notification happens after normal
|
||||
@ -448,14 +470,18 @@ signal delivery processing.
|
||||
.Va data
|
||||
returns the number of times the signal has occurred since the last call to
|
||||
.Fn kevent .
|
||||
This filter automatically sets the EV_CLEAR flag internally.
|
||||
.It EVFILT_TIMER
|
||||
This filter automatically sets the
|
||||
.Dv EV_CLEAR
|
||||
flag internally.
|
||||
.It Dv EVFILT_TIMER
|
||||
Establishes an arbitrary timer identified by
|
||||
.Va ident .
|
||||
When adding a timer,
|
||||
.Va data
|
||||
specifies the timeout period.
|
||||
The timer will be periodic unless EV_ONESHOT is specified.
|
||||
The timer will be periodic unless
|
||||
.Dv EV_ONESHOT
|
||||
is specified.
|
||||
On return,
|
||||
.Va data
|
||||
contains the number of times the timeout has expired since the last call to
|
||||
@ -465,7 +491,7 @@ There is a system wide limit on the number of timers
|
||||
which is controlled by the
|
||||
.Va kern.kq_calloutmax
|
||||
sysctl.
|
||||
.Bl -tag -width XXNOTE_USECONDS
|
||||
.Bl -tag -width "Dv NOTE_USECONDS"
|
||||
.It Dv NOTE_SECONDS
|
||||
.Va data
|
||||
is in seconds.
|
||||
@ -493,7 +519,7 @@ user level code.
|
||||
The lower 24 bits of the
|
||||
.Va fflags
|
||||
may be used for user defined flags and manipulated using the following:
|
||||
.Bl -tag -width XXNOTE_FFLAGSMASK
|
||||
.Bl -tag -width "Dv NOTE_FFLAGSMASK"
|
||||
.It Dv NOTE_FFNOP
|
||||
Ignore the input
|
||||
.Va fflags .
|
||||
@ -515,7 +541,7 @@ User defined flag mask for
|
||||
.El
|
||||
.Pp
|
||||
A user event is triggered for output with the following:
|
||||
.Bl -tag -width XXNOTE_FFLAGSMASK
|
||||
.Bl -tag -width "Dv NOTE_FFLAGSMASK"
|
||||
.It Dv NOTE_TRIGGER
|
||||
Cause the event to be triggered.
|
||||
.El
|
||||
|
@ -2,6 +2,10 @@
|
||||
.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Copyright (c) 2014 The FreeBSD Foundation
|
||||
.\" Portions of this documentation were written by Konstantin Belousov
|
||||
.\" under sponsorship from the FreeBSD Foundation.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
@ -25,7 +29,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 19, 2013
|
||||
.Dd December 16, 2014
|
||||
.Dt PROCCTL 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -67,7 +71,7 @@ The control request to perform is specified by the
|
||||
.Fa cmd
|
||||
argument.
|
||||
The following commands are supported:
|
||||
.Bl -tag -width "Dv PROC_SPROTECT"
|
||||
.Bl -tag -width "Dv PROC_REAP_GETPIDS"
|
||||
.It Dv PROC_SPROTECT
|
||||
Set process protection state.
|
||||
This is used to mark a process as protected from being killed if the system
|
||||
@ -95,6 +99,182 @@ When used with
|
||||
mark all future child processes of each selected process as protected.
|
||||
Future child processes will also mark all of their future child processes.
|
||||
.El
|
||||
.It Dv PROC_REAP_ACQUIRE
|
||||
Acquires the reaper status for the current process.
|
||||
The status means that children orphaned by the reaper's descendants
|
||||
that were forked after the acquisition of the status are reparented to the
|
||||
reaper.
|
||||
After the system initialization,
|
||||
.Xr init 8
|
||||
is the default reaper.
|
||||
.Pp
|
||||
.It Dv PROC_REAP_RELEASE
|
||||
Releases the reaper state for the current process.
|
||||
The reaper of the current process becomes the new reaper of the
|
||||
current process's descendants.
|
||||
.It Dv PROC_REAP_STATUS
|
||||
Provides the information about the reaper of the specified process,
|
||||
or the process itself when it is a reaper.
|
||||
The
|
||||
.Fa data
|
||||
argument must point to a
|
||||
.Vt procctl_reaper_status
|
||||
structure which is filled in by the syscall on successful return.
|
||||
.Bd -literal
|
||||
struct procctl_reaper_status {
|
||||
u_int rs_flags;
|
||||
u_int rs_children;
|
||||
u_int rs_descendants;
|
||||
pid_t rs_reaper;
|
||||
pid_t rs_pid;
|
||||
};
|
||||
.Ed
|
||||
The
|
||||
.Fa rs_flags
|
||||
may have the following flags returned:
|
||||
.Bl -tag -width "Dv REAPER_STATUS_REALINIT"
|
||||
.It Dv REAPER_STATUS_OWNED
|
||||
The specified process has acquired the reaper status and has not
|
||||
released it.
|
||||
When the flag is returned, the specified process
|
||||
.Fa id ,
|
||||
pid, identifies the reaper, otherwise the
|
||||
.Fa rs_reaper
|
||||
field of the structure is set to the pid of the reaper
|
||||
for the specified process id.
|
||||
.It Dv REAPER_STATUS_REALINIT
|
||||
The specified process is the root of the reaper tree, i.e.
|
||||
.Xr init 8 .
|
||||
.El
|
||||
The
|
||||
.Fa rs_children
|
||||
field returns the number of children of the reaper.
|
||||
The
|
||||
.Fa rs_descendants
|
||||
field returns the total number of descendants of the reaper(s),
|
||||
not counting descendants of the reaper in the subtree.
|
||||
The
|
||||
.Fa rs_reaper
|
||||
field returns the reaper pid.
|
||||
The
|
||||
.Fa rs_pid
|
||||
returns the pid of one reaper child if there are any descendants.
|
||||
.It Dv PROC_REAP_GETPIDS
|
||||
Queries the list of descendants of the reaper of the specified process.
|
||||
The request takes a pointer to a
|
||||
.Vt procctl_reaper_pids
|
||||
structure in the
|
||||
.Fa data
|
||||
parameter.
|
||||
.Bd -literal
|
||||
struct procctl_reaper_pids {
|
||||
u_int rp_count;
|
||||
struct procctl_reaper_pidinfo *rp_pids;
|
||||
};
|
||||
.Ed
|
||||
When called, the
|
||||
.Fa rp_pids
|
||||
field must point to an array of
|
||||
.Vt procctl_reaper_pidinfo
|
||||
structures, to be filled in on return,
|
||||
and the
|
||||
.Fa rp_count
|
||||
field must specify the size of the array,
|
||||
into which no more than
|
||||
.Fa rp_count
|
||||
elements will be filled in by the kernel.
|
||||
.Pp
|
||||
The
|
||||
.Vt "struct procctl_reaper_pidinfo"
|
||||
structure provides some information about one of the reaper's descendants.
|
||||
Note that for a descendant that is not a child, it may be incorrectly
|
||||
identified because of a race in which the original child process exited
|
||||
and the exited process's pid was reused for an unrelated process.
|
||||
.Bd -literal
|
||||
struct procctl_reaper_pidinfo {
|
||||
pid_t pi_pid;
|
||||
pid_t pi_subtree;
|
||||
u_int pi_flags;
|
||||
};
|
||||
.Ed
|
||||
The
|
||||
.Fa pi_pid
|
||||
field is the process id of the descendant.
|
||||
The
|
||||
.Fa pi_subtree
|
||||
field provides the pid of the child of the reaper, which is the (grand-)parent
|
||||
of the process.
|
||||
The
|
||||
.Fa pi_flags
|
||||
field returns the following flags, further describing the descendant:
|
||||
.Bl -tag -width "Dv REAPER_PIDINFO_VALID"
|
||||
.It Dv REAPER_PIDINFO_VALID
|
||||
Set to indicate that the
|
||||
.Vt procctl_reaper_pidinfo
|
||||
structure was filled in by the kernel.
|
||||
Zero-filling the
|
||||
.Fa rp_pids
|
||||
array and testing the
|
||||
.Dv REAPER_PIDINFO_VALID
|
||||
flag allows the caller to detect the end
|
||||
of the returned array.
|
||||
.It Dv REAPER_PIDINFO_CHILD
|
||||
The
|
||||
.Fa pi_pid
|
||||
field identifies the direct child of the reaper.
|
||||
.El
|
||||
.It Dv PROC_REAP_KILL
|
||||
Request to deliver a signal to some subset of the descendants of the reaper.
|
||||
The
|
||||
.Fa data
|
||||
parameter must point to a
|
||||
.Vt procctl_reaper_kill
|
||||
structure, which is used both for parameters and status return.
|
||||
.Bd -literal
|
||||
struct procctl_reaper_kill {
|
||||
int rk_sig;
|
||||
u_int rk_flags;
|
||||
pid_t rk_subtree;
|
||||
u_int rk_killed;
|
||||
pid_t rk_fpid;
|
||||
};
|
||||
.Ed
|
||||
The
|
||||
.Fa rk_sig
|
||||
field specifies the signal to be delivered.
|
||||
Zero is not a valid signal number, unlike
|
||||
.Xr kill 2 .
|
||||
The
|
||||
.Fa rk_flags
|
||||
field further directs the operation.
|
||||
It is or-ed from the following flags:
|
||||
.Bl -tag -width "Dv REAPER_KILL_CHILDREN"
|
||||
.It Dv REAPER_KILL_CHILDREN
|
||||
Deliver the specified signal only to direct children of the reaper.
|
||||
.It Dv REAPER_KILL_SUBTREE
|
||||
Deliver the specified signal only to descendants that were forked by
|
||||
the direct child with pid specified in the
|
||||
.Fa rk_subtree
|
||||
field.
|
||||
.El
|
||||
If neither the
|
||||
.Dv REAPER_KILL_CHILDREN
|
||||
nor the
|
||||
.Dv REAPER_KILL_SUBTREE
|
||||
flags are specified, all current descendants of the reaper are signalled.
|
||||
.Pp
|
||||
If a signal was delivered to any process, the return value from the request
|
||||
is zero.
|
||||
In this case, the
|
||||
.Fa rk_killed
|
||||
field identifies the number of processes signalled.
|
||||
The
|
||||
.Fa rk_fpid
|
||||
field is set to the pid of the first process for which signal
|
||||
delivery failed, e.g. due to the permission problems.
|
||||
If no such process exist, the
|
||||
.Fa rk_fpid
|
||||
field is set to -1.
|
||||
.El
|
||||
.Sh RETURN VALUES
|
||||
If an error occurs, a value of -1 is returned and
|
||||
@ -109,7 +289,7 @@ will fail if:
|
||||
.It Bq Er EFAULT
|
||||
The
|
||||
.Fa arg
|
||||
points outside the process's allocated address space.
|
||||
parameter points outside the process's allocated address space.
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Fa cmd
|
||||
@ -132,11 +312,48 @@ An invalid operation or flag was passed in
|
||||
for a
|
||||
.Dv PROC_SPROTECT
|
||||
command.
|
||||
.It Bq Er EPERM
|
||||
The
|
||||
.Fa idtype
|
||||
argument is not equal to
|
||||
.Dv P_PID ,
|
||||
or
|
||||
.Fa id
|
||||
is not equal to the pid of the calling process, for
|
||||
.Dv PROC_REAP_ACQUIRE
|
||||
or
|
||||
.Dv PROC_REAP_RELEASE
|
||||
requests.
|
||||
.It Bq Er EINVAL
|
||||
Invalid or undefined flags were passed to a
|
||||
.Dv PROC_REAP_KILL
|
||||
request.
|
||||
.It Bq Er EINVAL
|
||||
An invalid or zero signal number was requested for a
|
||||
.Dv PROC_REAP_KILL
|
||||
request.
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Dv PROC_REAP_RELEASE
|
||||
request was issued by the
|
||||
.Xr init 8
|
||||
process.
|
||||
.It Bq Er EBUSY
|
||||
The
|
||||
.Dv PROC_REAP_ACQUIRE
|
||||
request was issued by a process that had already acquired reaper status
|
||||
and has not yet released it.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ptrace 2
|
||||
.Xr kill 2 ,
|
||||
.Xr ptrace 2 ,
|
||||
.Xr wait 2 ,
|
||||
.Xr init 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn procctl
|
||||
function appeared in
|
||||
.Fx 10.0 .
|
||||
The reaper facility is based on a similar feature of Linux and
|
||||
DragonflyBSD, and first appeared in
|
||||
.Fx 10.2 .
|
||||
|
@ -322,7 +322,7 @@ __ldexp_cexpl(long double complex z, int expt)
|
||||
scale2 = 1;
|
||||
SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt);
|
||||
|
||||
return (cpackl(cos(y) * exp_x * scale1 * scale2,
|
||||
return (CMPLXL(cos(y) * exp_x * scale1 * scale2,
|
||||
sinl(y) * exp_x * scale1 * scale2));
|
||||
}
|
||||
#endif /* _COMPLEX_H */
|
||||
|
@ -299,7 +299,7 @@ __ldexp_cexpl(long double complex z, int expt)
|
||||
scale2 = 1;
|
||||
SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt);
|
||||
|
||||
return (cpackl(cos(y) * exp_x * scale1 * scale2,
|
||||
return (CMPLXL(cos(y) * exp_x * scale1 * scale2,
|
||||
sinl(y) * exp_x * scale1 * scale2));
|
||||
}
|
||||
#endif /* _COMPLEX_H */
|
||||
|
@ -286,19 +286,19 @@ casinh(double complex z)
|
||||
if (isnan(x) || isnan(y)) {
|
||||
/* casinh(+-Inf + I*NaN) = +-Inf + I*NaN */
|
||||
if (isinf(x))
|
||||
return (cpack(x, y + y));
|
||||
return (CMPLX(x, y + y));
|
||||
/* casinh(NaN + I*+-Inf) = opt(+-)Inf + I*NaN */
|
||||
if (isinf(y))
|
||||
return (cpack(y, x + x));
|
||||
return (CMPLX(y, x + x));
|
||||
/* casinh(NaN + I*0) = NaN + I*0 */
|
||||
if (y == 0)
|
||||
return (cpack(x + x, y));
|
||||
return (CMPLX(x + x, y));
|
||||
/*
|
||||
* All other cases involving NaN return NaN + I*NaN.
|
||||
* C99 leaves it optional whether to raise invalid if one of
|
||||
* the arguments is not NaN, so we opt not to raise it.
|
||||
*/
|
||||
return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
return (CMPLX(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
}
|
||||
|
||||
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
||||
@ -307,7 +307,7 @@ casinh(double complex z)
|
||||
w = clog_for_large_values(z) + m_ln2;
|
||||
else
|
||||
w = clog_for_large_values(-z) + m_ln2;
|
||||
return (cpack(copysign(creal(w), x), copysign(cimag(w), y)));
|
||||
return (CMPLX(copysign(creal(w), x), copysign(cimag(w), y)));
|
||||
}
|
||||
|
||||
/* Avoid spuriously raising inexact for z = 0. */
|
||||
@ -325,7 +325,7 @@ casinh(double complex z)
|
||||
ry = asin(B);
|
||||
else
|
||||
ry = atan2(new_y, sqrt_A2my2);
|
||||
return (cpack(copysign(rx, x), copysign(ry, y)));
|
||||
return (CMPLX(copysign(rx, x), copysign(ry, y)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -335,9 +335,9 @@ casinh(double complex z)
|
||||
double complex
|
||||
casin(double complex z)
|
||||
{
|
||||
double complex w = casinh(cpack(cimag(z), creal(z)));
|
||||
double complex w = casinh(CMPLX(cimag(z), creal(z)));
|
||||
|
||||
return (cpack(cimag(w), creal(w)));
|
||||
return (CMPLX(cimag(w), creal(w)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -370,19 +370,19 @@ cacos(double complex z)
|
||||
if (isnan(x) || isnan(y)) {
|
||||
/* cacos(+-Inf + I*NaN) = NaN + I*opt(-)Inf */
|
||||
if (isinf(x))
|
||||
return (cpack(y + y, -INFINITY));
|
||||
return (CMPLX(y + y, -INFINITY));
|
||||
/* cacos(NaN + I*+-Inf) = NaN + I*-+Inf */
|
||||
if (isinf(y))
|
||||
return (cpack(x + x, -y));
|
||||
return (CMPLX(x + x, -y));
|
||||
/* cacos(0 + I*NaN) = PI/2 + I*NaN with inexact */
|
||||
if (x == 0)
|
||||
return (cpack(pio2_hi + pio2_lo, y + y));
|
||||
return (CMPLX(pio2_hi + pio2_lo, y + y));
|
||||
/*
|
||||
* All other cases involving NaN return NaN + I*NaN.
|
||||
* C99 leaves it optional whether to raise invalid if one of
|
||||
* the arguments is not NaN, so we opt not to raise it.
|
||||
*/
|
||||
return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
return (CMPLX(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
}
|
||||
|
||||
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
||||
@ -392,18 +392,18 @@ cacos(double complex z)
|
||||
ry = creal(w) + m_ln2;
|
||||
if (sy == 0)
|
||||
ry = -ry;
|
||||
return (cpack(rx, ry));
|
||||
return (CMPLX(rx, ry));
|
||||
}
|
||||
|
||||
/* Avoid spuriously raising inexact for z = 1. */
|
||||
if (x == 1 && y == 0)
|
||||
return (cpack(0, -y));
|
||||
return (CMPLX(0, -y));
|
||||
|
||||
/* All remaining cases are inexact. */
|
||||
raise_inexact();
|
||||
|
||||
if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
|
||||
return (cpack(pio2_hi - (x - pio2_lo), -y));
|
||||
return (CMPLX(pio2_hi - (x - pio2_lo), -y));
|
||||
|
||||
do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x);
|
||||
if (B_is_usable) {
|
||||
@ -419,7 +419,7 @@ cacos(double complex z)
|
||||
}
|
||||
if (sy == 0)
|
||||
ry = -ry;
|
||||
return (cpack(rx, ry));
|
||||
return (CMPLX(rx, ry));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -437,15 +437,15 @@ cacosh(double complex z)
|
||||
ry = cimag(w);
|
||||
/* cacosh(NaN + I*NaN) = NaN + I*NaN */
|
||||
if (isnan(rx) && isnan(ry))
|
||||
return (cpack(ry, rx));
|
||||
return (CMPLX(ry, rx));
|
||||
/* cacosh(NaN + I*+-Inf) = +Inf + I*NaN */
|
||||
/* cacosh(+-Inf + I*NaN) = +Inf + I*NaN */
|
||||
if (isnan(rx))
|
||||
return (cpack(fabs(ry), rx));
|
||||
return (CMPLX(fabs(ry), rx));
|
||||
/* cacosh(0 + I*NaN) = NaN + I*NaN */
|
||||
if (isnan(ry))
|
||||
return (cpack(ry, ry));
|
||||
return (cpack(fabs(ry), copysign(rx, cimag(z))));
|
||||
return (CMPLX(ry, ry));
|
||||
return (CMPLX(fabs(ry), copysign(rx, cimag(z))));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -475,16 +475,16 @@ clog_for_large_values(double complex z)
|
||||
* this method is still poor since it is uneccessarily slow.
|
||||
*/
|
||||
if (ax > DBL_MAX / 2)
|
||||
return (cpack(log(hypot(x / m_e, y / m_e)) + 1, atan2(y, x)));
|
||||
return (CMPLX(log(hypot(x / m_e, y / m_e)) + 1, atan2(y, x)));
|
||||
|
||||
/*
|
||||
* Avoid overflow when x or y is large. Avoid underflow when x or
|
||||
* y is small.
|
||||
*/
|
||||
if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN)
|
||||
return (cpack(log(hypot(x, y)), atan2(y, x)));
|
||||
return (CMPLX(log(hypot(x, y)), atan2(y, x)));
|
||||
|
||||
return (cpack(log(ax * ax + ay * ay) / 2, atan2(y, x)));
|
||||
return (CMPLX(log(ax * ax + ay * ay) / 2, atan2(y, x)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -575,30 +575,30 @@ catanh(double complex z)
|
||||
|
||||
/* This helps handle many cases. */
|
||||
if (y == 0 && ax <= 1)
|
||||
return (cpack(atanh(x), y));
|
||||
return (CMPLX(atanh(x), y));
|
||||
|
||||
/* To ensure the same accuracy as atan(), and to filter out z = 0. */
|
||||
if (x == 0)
|
||||
return (cpack(x, atan(y)));
|
||||
return (CMPLX(x, atan(y)));
|
||||
|
||||
if (isnan(x) || isnan(y)) {
|
||||
/* catanh(+-Inf + I*NaN) = +-0 + I*NaN */
|
||||
if (isinf(x))
|
||||
return (cpack(copysign(0, x), y + y));
|
||||
return (CMPLX(copysign(0, x), y + y));
|
||||
/* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */
|
||||
if (isinf(y))
|
||||
return (cpack(copysign(0, x),
|
||||
return (CMPLX(copysign(0, x),
|
||||
copysign(pio2_hi + pio2_lo, y)));
|
||||
/*
|
||||
* All other cases involving NaN return NaN + I*NaN.
|
||||
* C99 leaves it optional whether to raise invalid if one of
|
||||
* the arguments is not NaN, so we opt not to raise it.
|
||||
*/
|
||||
return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
return (CMPLX(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
}
|
||||
|
||||
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON)
|
||||
return (cpack(real_part_reciprocal(x, y),
|
||||
return (CMPLX(real_part_reciprocal(x, y),
|
||||
copysign(pio2_hi + pio2_lo, y)));
|
||||
|
||||
if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) {
|
||||
@ -623,7 +623,7 @@ catanh(double complex z)
|
||||
else
|
||||
ry = atan2(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2;
|
||||
|
||||
return (cpack(copysign(rx, x), copysign(ry, y)));
|
||||
return (CMPLX(copysign(rx, x), copysign(ry, y)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -633,7 +633,7 @@ catanh(double complex z)
|
||||
double complex
|
||||
catan(double complex z)
|
||||
{
|
||||
double complex w = catanh(cpack(cimag(z), creal(z)));
|
||||
double complex w = catanh(CMPLX(cimag(z), creal(z)));
|
||||
|
||||
return (cpack(cimag(w), creal(w)));
|
||||
return (CMPLX(cimag(w), creal(w)));
|
||||
}
|
||||
|
@ -156,12 +156,12 @@ casinhf(float complex z)
|
||||
|
||||
if (isnan(x) || isnan(y)) {
|
||||
if (isinf(x))
|
||||
return (cpackf(x, y + y));
|
||||
return (CMPLXF(x, y + y));
|
||||
if (isinf(y))
|
||||
return (cpackf(y, x + x));
|
||||
return (CMPLXF(y, x + x));
|
||||
if (y == 0)
|
||||
return (cpackf(x + x, y));
|
||||
return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
return (CMPLXF(x + x, y));
|
||||
return (CMPLXF(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
}
|
||||
|
||||
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
||||
@ -169,7 +169,7 @@ casinhf(float complex z)
|
||||
w = clog_for_large_values(z) + m_ln2;
|
||||
else
|
||||
w = clog_for_large_values(-z) + m_ln2;
|
||||
return (cpackf(copysignf(crealf(w), x),
|
||||
return (CMPLXF(copysignf(crealf(w), x),
|
||||
copysignf(cimagf(w), y)));
|
||||
}
|
||||
|
||||
@ -186,15 +186,15 @@ casinhf(float complex z)
|
||||
ry = asinf(B);
|
||||
else
|
||||
ry = atan2f(new_y, sqrt_A2my2);
|
||||
return (cpackf(copysignf(rx, x), copysignf(ry, y)));
|
||||
return (CMPLXF(copysignf(rx, x), copysignf(ry, y)));
|
||||
}
|
||||
|
||||
float complex
|
||||
casinf(float complex z)
|
||||
{
|
||||
float complex w = casinhf(cpackf(cimagf(z), crealf(z)));
|
||||
float complex w = casinhf(CMPLXF(cimagf(z), crealf(z)));
|
||||
|
||||
return (cpackf(cimagf(w), crealf(w)));
|
||||
return (CMPLXF(cimagf(w), crealf(w)));
|
||||
}
|
||||
|
||||
float complex
|
||||
@ -214,12 +214,12 @@ cacosf(float complex z)
|
||||
|
||||
if (isnan(x) || isnan(y)) {
|
||||
if (isinf(x))
|
||||
return (cpackf(y + y, -INFINITY));
|
||||
return (CMPLXF(y + y, -INFINITY));
|
||||
if (isinf(y))
|
||||
return (cpackf(x + x, -y));
|
||||
return (CMPLXF(x + x, -y));
|
||||
if (x == 0)
|
||||
return (cpackf(pio2_hi + pio2_lo, y + y));
|
||||
return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
return (CMPLXF(pio2_hi + pio2_lo, y + y));
|
||||
return (CMPLXF(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
}
|
||||
|
||||
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
|
||||
@ -228,16 +228,16 @@ cacosf(float complex z)
|
||||
ry = crealf(w) + m_ln2;
|
||||
if (sy == 0)
|
||||
ry = -ry;
|
||||
return (cpackf(rx, ry));
|
||||
return (CMPLXF(rx, ry));
|
||||
}
|
||||
|
||||
if (x == 1 && y == 0)
|
||||
return (cpackf(0, -y));
|
||||
return (CMPLXF(0, -y));
|
||||
|
||||
raise_inexact();
|
||||
|
||||
if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
|
||||
return (cpackf(pio2_hi - (x - pio2_lo), -y));
|
||||
return (CMPLXF(pio2_hi - (x - pio2_lo), -y));
|
||||
|
||||
do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x);
|
||||
if (B_is_usable) {
|
||||
@ -253,7 +253,7 @@ cacosf(float complex z)
|
||||
}
|
||||
if (sy == 0)
|
||||
ry = -ry;
|
||||
return (cpackf(rx, ry));
|
||||
return (CMPLXF(rx, ry));
|
||||
}
|
||||
|
||||
float complex
|
||||
@ -266,12 +266,12 @@ cacoshf(float complex z)
|
||||
rx = crealf(w);
|
||||
ry = cimagf(w);
|
||||
if (isnan(rx) && isnan(ry))
|
||||
return (cpackf(ry, rx));
|
||||
return (CMPLXF(ry, rx));
|
||||
if (isnan(rx))
|
||||
return (cpackf(fabsf(ry), rx));
|
||||
return (CMPLXF(fabsf(ry), rx));
|
||||
if (isnan(ry))
|
||||
return (cpackf(ry, ry));
|
||||
return (cpackf(fabsf(ry), copysignf(rx, cimagf(z))));
|
||||
return (CMPLXF(ry, ry));
|
||||
return (CMPLXF(fabsf(ry), copysignf(rx, cimagf(z))));
|
||||
}
|
||||
|
||||
static float complex
|
||||
@ -291,13 +291,13 @@ clog_for_large_values(float complex z)
|
||||
}
|
||||
|
||||
if (ax > FLT_MAX / 2)
|
||||
return (cpackf(logf(hypotf(x / m_e, y / m_e)) + 1,
|
||||
return (CMPLXF(logf(hypotf(x / m_e, y / m_e)) + 1,
|
||||
atan2f(y, x)));
|
||||
|
||||
if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN)
|
||||
return (cpackf(logf(hypotf(x, y)), atan2f(y, x)));
|
||||
return (CMPLXF(logf(hypotf(x, y)), atan2f(y, x)));
|
||||
|
||||
return (cpackf(logf(ax * ax + ay * ay) / 2, atan2f(y, x)));
|
||||
return (CMPLXF(logf(ax * ax + ay * ay) / 2, atan2f(y, x)));
|
||||
}
|
||||
|
||||
static inline float
|
||||
@ -346,22 +346,22 @@ catanhf(float complex z)
|
||||
ay = fabsf(y);
|
||||
|
||||
if (y == 0 && ax <= 1)
|
||||
return (cpackf(atanhf(x), y));
|
||||
return (CMPLXF(atanhf(x), y));
|
||||
|
||||
if (x == 0)
|
||||
return (cpackf(x, atanf(y)));
|
||||
return (CMPLXF(x, atanf(y)));
|
||||
|
||||
if (isnan(x) || isnan(y)) {
|
||||
if (isinf(x))
|
||||
return (cpackf(copysignf(0, x), y + y));
|
||||
return (CMPLXF(copysignf(0, x), y + y));
|
||||
if (isinf(y))
|
||||
return (cpackf(copysignf(0, x),
|
||||
return (CMPLXF(copysignf(0, x),
|
||||
copysignf(pio2_hi + pio2_lo, y)));
|
||||
return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
return (CMPLXF(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
|
||||
}
|
||||
|
||||
if (ax > RECIP_EPSILON || ay > RECIP_EPSILON)
|
||||
return (cpackf(real_part_reciprocal(x, y),
|
||||
return (CMPLXF(real_part_reciprocal(x, y),
|
||||
copysignf(pio2_hi + pio2_lo, y)));
|
||||
|
||||
if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) {
|
||||
@ -381,13 +381,13 @@ catanhf(float complex z)
|
||||
else
|
||||
ry = atan2f(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2;
|
||||
|
||||
return (cpackf(copysignf(rx, x), copysignf(ry, y)));
|
||||
return (CMPLXF(copysignf(rx, x), copysignf(ry, y)));
|
||||
}
|
||||
|
||||
float complex
|
||||
catanf(float complex z)
|
||||
{
|
||||
float complex w = catanhf(cpackf(cimagf(z), crealf(z)));
|
||||
float complex w = catanhf(CMPLXF(cimagf(z), crealf(z)));
|
||||
|
||||
return (cpackf(cimagf(w), crealf(w)));
|
||||
return (CMPLXF(cimagf(w), crealf(w)));
|
||||
}
|
||||
|
@ -103,6 +103,6 @@ __ldexp_cexp(double complex z, int expt)
|
||||
half_expt = expt - half_expt;
|
||||
INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0);
|
||||
|
||||
return (cpack(cos(y) * exp_x * scale1 * scale2,
|
||||
return (CMPLX(cos(y) * exp_x * scale1 * scale2,
|
||||
sin(y) * exp_x * scale1 * scale2));
|
||||
}
|
||||
|
@ -82,6 +82,6 @@ __ldexp_cexpf(float complex z, int expt)
|
||||
half_expt = expt - half_expt;
|
||||
SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
|
||||
|
||||
return (cpackf(cosf(y) * exp_x * scale1 * scale2,
|
||||
return (CMPLXF(cosf(y) * exp_x * scale1 * scale2,
|
||||
sinf(y) * exp_x * scale1 * scale2));
|
||||
}
|
||||
|
@ -454,9 +454,16 @@ typedef union {
|
||||
* (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
|
||||
* In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted
|
||||
* to -0.0+I*0.0.
|
||||
*
|
||||
* The C11 standard introduced the macros CMPLX(), CMPLXF() and CMPLXL()
|
||||
* to construct complex values. The functions below are modelled after
|
||||
* these macros, with the exception that they cannot be used to
|
||||
* construct compile-time complex values.
|
||||
*/
|
||||
|
||||
#ifndef CMPLXF
|
||||
static __inline float complex
|
||||
cpackf(float x, float y)
|
||||
CMPLXF(float x, float y)
|
||||
{
|
||||
float_complex z;
|
||||
|
||||
@ -464,9 +471,11 @@ cpackf(float x, float y)
|
||||
IMAGPART(z) = y;
|
||||
return (z.f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CMPLX
|
||||
static __inline double complex
|
||||
cpack(double x, double y)
|
||||
CMPLX(double x, double y)
|
||||
{
|
||||
double_complex z;
|
||||
|
||||
@ -474,9 +483,11 @@ cpack(double x, double y)
|
||||
IMAGPART(z) = y;
|
||||
return (z.f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef CMPLXL
|
||||
static __inline long double complex
|
||||
cpackl(long double x, long double y)
|
||||
CMPLXL(long double x, long double y)
|
||||
{
|
||||
long_double_complex z;
|
||||
|
||||
@ -484,6 +495,8 @@ cpackl(long double x, long double y)
|
||||
IMAGPART(z) = y;
|
||||
return (z.f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _COMPLEX_H */
|
||||
|
||||
#ifdef __GNUCLIKE_ASM
|
||||
|
@ -62,23 +62,23 @@ ccosh(double complex z)
|
||||
/* Handle the nearly-non-exceptional cases where x and y are finite. */
|
||||
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
|
||||
if ((iy | ly) == 0)
|
||||
return (cpack(cosh(x), x * y));
|
||||
return (CMPLX(cosh(x), x * y));
|
||||
if (ix < 0x40360000) /* small x: normal case */
|
||||
return (cpack(cosh(x) * cos(y), sinh(x) * sin(y)));
|
||||
return (CMPLX(cosh(x) * cos(y), sinh(x) * sin(y)));
|
||||
|
||||
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
|
||||
if (ix < 0x40862e42) {
|
||||
/* x < 710: exp(|x|) won't overflow */
|
||||
h = exp(fabs(x)) * 0.5;
|
||||
return (cpack(h * cos(y), copysign(h, x) * sin(y)));
|
||||
return (CMPLX(h * cos(y), copysign(h, x) * sin(y)));
|
||||
} else if (ix < 0x4096bbaa) {
|
||||
/* x < 1455: scale to avoid overflow */
|
||||
z = __ldexp_cexp(cpack(fabs(x), y), -1);
|
||||
return (cpack(creal(z), cimag(z) * copysign(1, x)));
|
||||
z = __ldexp_cexp(CMPLX(fabs(x), y), -1);
|
||||
return (CMPLX(creal(z), cimag(z) * copysign(1, x)));
|
||||
} else {
|
||||
/* x >= 1455: the result always overflows */
|
||||
h = huge * x;
|
||||
return (cpack(h * h * cos(y), h * sin(y)));
|
||||
return (CMPLX(h * h * cos(y), h * sin(y)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ ccosh(double complex z)
|
||||
* the same as d(NaN).
|
||||
*/
|
||||
if ((ix | lx) == 0 && iy >= 0x7ff00000)
|
||||
return (cpack(y - y, copysign(0, x * (y - y))));
|
||||
return (CMPLX(y - y, copysign(0, x * (y - y))));
|
||||
|
||||
/*
|
||||
* cosh(+-Inf +- I 0) = +Inf + I (+-)(+-)0.
|
||||
@ -102,8 +102,8 @@ ccosh(double complex z)
|
||||
*/
|
||||
if ((iy | ly) == 0 && ix >= 0x7ff00000) {
|
||||
if (((hx & 0xfffff) | lx) == 0)
|
||||
return (cpack(x * x, copysign(0, x) * y));
|
||||
return (cpack(x * x, copysign(0, (x + x) * y)));
|
||||
return (CMPLX(x * x, copysign(0, x) * y));
|
||||
return (CMPLX(x * x, copysign(0, (x + x) * y)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -115,7 +115,7 @@ ccosh(double complex z)
|
||||
* nonzero x. Choice = don't raise (except for signaling NaNs).
|
||||
*/
|
||||
if (ix < 0x7ff00000 && iy >= 0x7ff00000)
|
||||
return (cpack(y - y, x * (y - y)));
|
||||
return (CMPLX(y - y, x * (y - y)));
|
||||
|
||||
/*
|
||||
* cosh(+-Inf + I NaN) = +Inf + I d(NaN).
|
||||
@ -128,8 +128,8 @@ ccosh(double complex z)
|
||||
*/
|
||||
if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) {
|
||||
if (iy >= 0x7ff00000)
|
||||
return (cpack(x * x, x * (y - y)));
|
||||
return (cpack((x * x) * cos(y), x * sin(y)));
|
||||
return (CMPLX(x * x, x * (y - y)));
|
||||
return (CMPLX((x * x) * cos(y), x * sin(y)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -143,7 +143,7 @@ ccosh(double complex z)
|
||||
* Optionally raises the invalid floating-point exception for finite
|
||||
* nonzero y. Choice = don't raise (except for signaling NaNs).
|
||||
*/
|
||||
return (cpack((x * x) * (y - y), (x + x) * (y - y)));
|
||||
return (CMPLX((x * x) * (y - y), (x + x) * (y - y)));
|
||||
}
|
||||
|
||||
double complex
|
||||
@ -151,5 +151,5 @@ ccos(double complex z)
|
||||
{
|
||||
|
||||
/* ccos(z) = ccosh(I * z) */
|
||||
return (ccosh(cpack(-cimag(z), creal(z))));
|
||||
return (ccosh(CMPLX(-cimag(z), creal(z))));
|
||||
}
|
||||
|
@ -55,50 +55,50 @@ ccoshf(float complex z)
|
||||
|
||||
if (ix < 0x7f800000 && iy < 0x7f800000) {
|
||||
if (iy == 0)
|
||||
return (cpackf(coshf(x), x * y));
|
||||
return (CMPLXF(coshf(x), x * y));
|
||||
if (ix < 0x41100000) /* small x: normal case */
|
||||
return (cpackf(coshf(x) * cosf(y), sinhf(x) * sinf(y)));
|
||||
return (CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y)));
|
||||
|
||||
/* |x| >= 9, so cosh(x) ~= exp(|x|) */
|
||||
if (ix < 0x42b17218) {
|
||||
/* x < 88.7: expf(|x|) won't overflow */
|
||||
h = expf(fabsf(x)) * 0.5f;
|
||||
return (cpackf(h * cosf(y), copysignf(h, x) * sinf(y)));
|
||||
return (CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y)));
|
||||
} else if (ix < 0x4340b1e7) {
|
||||
/* x < 192.7: scale to avoid overflow */
|
||||
z = __ldexp_cexpf(cpackf(fabsf(x), y), -1);
|
||||
return (cpackf(crealf(z), cimagf(z) * copysignf(1, x)));
|
||||
z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1);
|
||||
return (CMPLXF(crealf(z), cimagf(z) * copysignf(1, x)));
|
||||
} else {
|
||||
/* x >= 192.7: the result always overflows */
|
||||
h = huge * x;
|
||||
return (cpackf(h * h * cosf(y), h * sinf(y)));
|
||||
return (CMPLXF(h * h * cosf(y), h * sinf(y)));
|
||||
}
|
||||
}
|
||||
|
||||
if (ix == 0 && iy >= 0x7f800000)
|
||||
return (cpackf(y - y, copysignf(0, x * (y - y))));
|
||||
return (CMPLXF(y - y, copysignf(0, x * (y - y))));
|
||||
|
||||
if (iy == 0 && ix >= 0x7f800000) {
|
||||
if ((hx & 0x7fffff) == 0)
|
||||
return (cpackf(x * x, copysignf(0, x) * y));
|
||||
return (cpackf(x * x, copysignf(0, (x + x) * y)));
|
||||
return (CMPLXF(x * x, copysignf(0, x) * y));
|
||||
return (CMPLXF(x * x, copysignf(0, (x + x) * y)));
|
||||
}
|
||||
|
||||
if (ix < 0x7f800000 && iy >= 0x7f800000)
|
||||
return (cpackf(y - y, x * (y - y)));
|
||||
return (CMPLXF(y - y, x * (y - y)));
|
||||
|
||||
if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) {
|
||||
if (iy >= 0x7f800000)
|
||||
return (cpackf(x * x, x * (y - y)));
|
||||
return (cpackf((x * x) * cosf(y), x * sinf(y)));
|
||||
return (CMPLXF(x * x, x * (y - y)));
|
||||
return (CMPLXF((x * x) * cosf(y), x * sinf(y)));
|
||||
}
|
||||
|
||||
return (cpackf((x * x) * (y - y), (x + x) * (y - y)));
|
||||
return (CMPLXF((x * x) * (y - y), (x + x) * (y - y)));
|
||||
}
|
||||
|
||||
float complex
|
||||
ccosf(float complex z)
|
||||
{
|
||||
|
||||
return (ccoshf(cpackf(-cimagf(z), crealf(z))));
|
||||
return (ccoshf(CMPLXF(-cimagf(z), crealf(z))));
|
||||
}
|
||||
|
@ -50,22 +50,22 @@ cexp(double complex z)
|
||||
|
||||
/* cexp(x + I 0) = exp(x) + I 0 */
|
||||
if ((hy | ly) == 0)
|
||||
return (cpack(exp(x), y));
|
||||
return (CMPLX(exp(x), y));
|
||||
EXTRACT_WORDS(hx, lx, x);
|
||||
/* cexp(0 + I y) = cos(y) + I sin(y) */
|
||||
if (((hx & 0x7fffffff) | lx) == 0)
|
||||
return (cpack(cos(y), sin(y)));
|
||||
return (CMPLX(cos(y), sin(y)));
|
||||
|
||||
if (hy >= 0x7ff00000) {
|
||||
if (lx != 0 || (hx & 0x7fffffff) != 0x7ff00000) {
|
||||
/* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */
|
||||
return (cpack(y - y, y - y));
|
||||
return (CMPLX(y - y, y - y));
|
||||
} else if (hx & 0x80000000) {
|
||||
/* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */
|
||||
return (cpack(0.0, 0.0));
|
||||
return (CMPLX(0.0, 0.0));
|
||||
} else {
|
||||
/* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */
|
||||
return (cpack(x, y - y));
|
||||
return (CMPLX(x, y - y));
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,6 @@ cexp(double complex z)
|
||||
* - x = NaN (spurious inexact exception from y)
|
||||
*/
|
||||
exp_x = exp(x);
|
||||
return (cpack(exp_x * cos(y), exp_x * sin(y)));
|
||||
return (CMPLX(exp_x * cos(y), exp_x * sin(y)));
|
||||
}
|
||||
}
|
||||
|
@ -50,22 +50,22 @@ cexpf(float complex z)
|
||||
|
||||
/* cexp(x + I 0) = exp(x) + I 0 */
|
||||
if (hy == 0)
|
||||
return (cpackf(expf(x), y));
|
||||
return (CMPLXF(expf(x), y));
|
||||
GET_FLOAT_WORD(hx, x);
|
||||
/* cexp(0 + I y) = cos(y) + I sin(y) */
|
||||
if ((hx & 0x7fffffff) == 0)
|
||||
return (cpackf(cosf(y), sinf(y)));
|
||||
return (CMPLXF(cosf(y), sinf(y)));
|
||||
|
||||
if (hy >= 0x7f800000) {
|
||||
if ((hx & 0x7fffffff) != 0x7f800000) {
|
||||
/* cexp(finite|NaN +- I Inf|NaN) = NaN + I NaN */
|
||||
return (cpackf(y - y, y - y));
|
||||
return (CMPLXF(y - y, y - y));
|
||||
} else if (hx & 0x80000000) {
|
||||
/* cexp(-Inf +- I Inf|NaN) = 0 + I 0 */
|
||||
return (cpackf(0.0, 0.0));
|
||||
return (CMPLXF(0.0, 0.0));
|
||||
} else {
|
||||
/* cexp(+Inf +- I Inf|NaN) = Inf + I NaN */
|
||||
return (cpackf(x, y - y));
|
||||
return (CMPLXF(x, y - y));
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,6 @@ cexpf(float complex z)
|
||||
* - x = NaN (spurious inexact exception from y)
|
||||
*/
|
||||
exp_x = expf(x);
|
||||
return (cpackf(exp_x * cosf(y), exp_x * sinf(y)));
|
||||
return (CMPLXF(exp_x * cosf(y), exp_x * sinf(y)));
|
||||
}
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ double complex
|
||||
conj(double complex z)
|
||||
{
|
||||
|
||||
return (cpack(creal(z), -cimag(z)));
|
||||
return (CMPLX(creal(z), -cimag(z)));
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ float complex
|
||||
conjf(float complex z)
|
||||
{
|
||||
|
||||
return (cpackf(crealf(z), -cimagf(z)));
|
||||
return (CMPLXF(crealf(z), -cimagf(z)));
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ long double complex
|
||||
conjl(long double complex z)
|
||||
{
|
||||
|
||||
return (cpackl(creall(z), -cimagl(z)));
|
||||
return (CMPLXL(creall(z), -cimagl(z)));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ cproj(double complex z)
|
||||
if (!isinf(creal(z)) && !isinf(cimag(z)))
|
||||
return (z);
|
||||
else
|
||||
return (cpack(INFINITY, copysign(0.0, cimag(z))));
|
||||
return (CMPLX(INFINITY, copysign(0.0, cimag(z))));
|
||||
}
|
||||
|
||||
#if LDBL_MANT_DIG == 53
|
||||
|
@ -39,5 +39,5 @@ cprojf(float complex z)
|
||||
if (!isinf(crealf(z)) && !isinf(cimagf(z)))
|
||||
return (z);
|
||||
else
|
||||
return (cpackf(INFINITY, copysignf(0.0, cimagf(z))));
|
||||
return (CMPLXF(INFINITY, copysignf(0.0, cimagf(z))));
|
||||
}
|
||||
|
@ -39,5 +39,5 @@ cprojl(long double complex z)
|
||||
if (!isinf(creall(z)) && !isinf(cimagl(z)))
|
||||
return (z);
|
||||
else
|
||||
return (cpackl(INFINITY, copysignl(0.0, cimagl(z))));
|
||||
return (CMPLXL(INFINITY, copysignl(0.0, cimagl(z))));
|
||||
}
|
||||
|
@ -62,23 +62,23 @@ csinh(double complex z)
|
||||
/* Handle the nearly-non-exceptional cases where x and y are finite. */
|
||||
if (ix < 0x7ff00000 && iy < 0x7ff00000) {
|
||||
if ((iy | ly) == 0)
|
||||
return (cpack(sinh(x), y));
|
||||
return (CMPLX(sinh(x), y));
|
||||
if (ix < 0x40360000) /* small x: normal case */
|
||||
return (cpack(sinh(x) * cos(y), cosh(x) * sin(y)));
|
||||
return (CMPLX(sinh(x) * cos(y), cosh(x) * sin(y)));
|
||||
|
||||
/* |x| >= 22, so cosh(x) ~= exp(|x|) */
|
||||
if (ix < 0x40862e42) {
|
||||
/* x < 710: exp(|x|) won't overflow */
|
||||
h = exp(fabs(x)) * 0.5;
|
||||
return (cpack(copysign(h, x) * cos(y), h * sin(y)));
|
||||
return (CMPLX(copysign(h, x) * cos(y), h * sin(y)));
|
||||
} else if (ix < 0x4096bbaa) {
|
||||
/* x < 1455: scale to avoid overflow */
|
||||
z = __ldexp_cexp(cpack(fabs(x), y), -1);
|
||||
return (cpack(creal(z) * copysign(1, x), cimag(z)));
|
||||
z = __ldexp_cexp(CMPLX(fabs(x), y), -1);
|
||||
return (CMPLX(creal(z) * copysign(1, x), cimag(z)));
|
||||
} else {
|
||||
/* x >= 1455: the result always overflows */
|
||||
h = huge * x;
|
||||
return (cpack(h * cos(y), h * h * sin(y)));
|
||||
return (CMPLX(h * cos(y), h * h * sin(y)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ csinh(double complex z)
|
||||
* the same as d(NaN).
|
||||
*/
|
||||
if ((ix | lx) == 0 && iy >= 0x7ff00000)
|
||||
return (cpack(copysign(0, x * (y - y)), y - y));
|
||||
return (CMPLX(copysign(0, x * (y - y)), y - y));
|
||||
|
||||
/*
|
||||
* sinh(+-Inf +- I 0) = +-Inf + I +-0.
|
||||
@ -101,8 +101,8 @@ csinh(double complex z)
|
||||
*/
|
||||
if ((iy | ly) == 0 && ix >= 0x7ff00000) {
|
||||
if (((hx & 0xfffff) | lx) == 0)
|
||||
return (cpack(x, y));
|
||||
return (cpack(x, copysign(0, y)));
|
||||
return (CMPLX(x, y));
|
||||
return (CMPLX(x, copysign(0, y)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -114,7 +114,7 @@ csinh(double complex z)
|
||||
* nonzero x. Choice = don't raise (except for signaling NaNs).
|
||||
*/
|
||||
if (ix < 0x7ff00000 && iy >= 0x7ff00000)
|
||||
return (cpack(y - y, x * (y - y)));
|
||||
return (CMPLX(y - y, x * (y - y)));
|
||||
|
||||
/*
|
||||
* sinh(+-Inf + I NaN) = +-Inf + I d(NaN).
|
||||
@ -129,8 +129,8 @@ csinh(double complex z)
|
||||
*/
|
||||
if (ix >= 0x7ff00000 && ((hx & 0xfffff) | lx) == 0) {
|
||||
if (iy >= 0x7ff00000)
|
||||
return (cpack(x * x, x * (y - y)));
|
||||
return (cpack(x * cos(y), INFINITY * sin(y)));
|
||||
return (CMPLX(x * x, x * (y - y)));
|
||||
return (CMPLX(x * cos(y), INFINITY * sin(y)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -144,7 +144,7 @@ csinh(double complex z)
|
||||
* Optionally raises the invalid floating-point exception for finite
|
||||
* nonzero y. Choice = don't raise (except for signaling NaNs).
|
||||
*/
|
||||
return (cpack((x * x) * (y - y), (x + x) * (y - y)));
|
||||
return (CMPLX((x * x) * (y - y), (x + x) * (y - y)));
|
||||
}
|
||||
|
||||
double complex
|
||||
@ -152,6 +152,6 @@ csin(double complex z)
|
||||
{
|
||||
|
||||
/* csin(z) = -I * csinh(I * z) */
|
||||
z = csinh(cpack(-cimag(z), creal(z)));
|
||||
return (cpack(cimag(z), -creal(z)));
|
||||
z = csinh(CMPLX(-cimag(z), creal(z)));
|
||||
return (CMPLX(cimag(z), -creal(z)));
|
||||
}
|
||||
|
@ -55,51 +55,51 @@ csinhf(float complex z)
|
||||
|
||||
if (ix < 0x7f800000 && iy < 0x7f800000) {
|
||||
if (iy == 0)
|
||||
return (cpackf(sinhf(x), y));
|
||||
return (CMPLXF(sinhf(x), y));
|
||||
if (ix < 0x41100000) /* small x: normal case */
|
||||
return (cpackf(sinhf(x) * cosf(y), coshf(x) * sinf(y)));
|
||||
return (CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y)));
|
||||
|
||||
/* |x| >= 9, so cosh(x) ~= exp(|x|) */
|
||||
if (ix < 0x42b17218) {
|
||||
/* x < 88.7: expf(|x|) won't overflow */
|
||||
h = expf(fabsf(x)) * 0.5f;
|
||||
return (cpackf(copysignf(h, x) * cosf(y), h * sinf(y)));
|
||||
return (CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y)));
|
||||
} else if (ix < 0x4340b1e7) {
|
||||
/* x < 192.7: scale to avoid overflow */
|
||||
z = __ldexp_cexpf(cpackf(fabsf(x), y), -1);
|
||||
return (cpackf(crealf(z) * copysignf(1, x), cimagf(z)));
|
||||
z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1);
|
||||
return (CMPLXF(crealf(z) * copysignf(1, x), cimagf(z)));
|
||||
} else {
|
||||
/* x >= 192.7: the result always overflows */
|
||||
h = huge * x;
|
||||
return (cpackf(h * cosf(y), h * h * sinf(y)));
|
||||
return (CMPLXF(h * cosf(y), h * h * sinf(y)));
|
||||
}
|
||||
}
|
||||
|
||||
if (ix == 0 && iy >= 0x7f800000)
|
||||
return (cpackf(copysignf(0, x * (y - y)), y - y));
|
||||
return (CMPLXF(copysignf(0, x * (y - y)), y - y));
|
||||
|
||||
if (iy == 0 && ix >= 0x7f800000) {
|
||||
if ((hx & 0x7fffff) == 0)
|
||||
return (cpackf(x, y));
|
||||
return (cpackf(x, copysignf(0, y)));
|
||||
return (CMPLXF(x, y));
|
||||
return (CMPLXF(x, copysignf(0, y)));
|
||||
}
|
||||
|
||||
if (ix < 0x7f800000 && iy >= 0x7f800000)
|
||||
return (cpackf(y - y, x * (y - y)));
|
||||
return (CMPLXF(y - y, x * (y - y)));
|
||||
|
||||
if (ix >= 0x7f800000 && (hx & 0x7fffff) == 0) {
|
||||
if (iy >= 0x7f800000)
|
||||
return (cpackf(x * x, x * (y - y)));
|
||||
return (cpackf(x * cosf(y), INFINITY * sinf(y)));
|
||||
return (CMPLXF(x * x, x * (y - y)));
|
||||
return (CMPLXF(x * cosf(y), INFINITY * sinf(y)));
|
||||
}
|
||||
|
||||
return (cpackf((x * x) * (y - y), (x + x) * (y - y)));
|
||||
return (CMPLXF((x * x) * (y - y), (x + x) * (y - y)));
|
||||
}
|
||||
|
||||
float complex
|
||||
csinf(float complex z)
|
||||
{
|
||||
|
||||
z = csinhf(cpackf(-cimagf(z), crealf(z)));
|
||||
return (cpackf(cimagf(z), -crealf(z)));
|
||||
z = csinhf(CMPLXF(-cimagf(z), crealf(z)));
|
||||
return (CMPLXF(cimagf(z), -crealf(z)));
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ csqrt(double complex z)
|
||||
|
||||
/* Handle special cases. */
|
||||
if (z == 0)
|
||||
return (cpack(0, b));
|
||||
return (CMPLX(0, b));
|
||||
if (isinf(b))
|
||||
return (cpack(INFINITY, b));
|
||||
return (CMPLX(INFINITY, b));
|
||||
if (isnan(a)) {
|
||||
t = (b - b) / (b - b); /* raise invalid if b is not a NaN */
|
||||
return (cpack(a, t)); /* return NaN + NaN i */
|
||||
return (CMPLX(a, t)); /* return NaN + NaN i */
|
||||
}
|
||||
if (isinf(a)) {
|
||||
/*
|
||||
@ -73,9 +73,9 @@ csqrt(double complex z)
|
||||
* csqrt(-inf + y i) = 0 + inf i
|
||||
*/
|
||||
if (signbit(a))
|
||||
return (cpack(fabs(b - b), copysign(a, b)));
|
||||
return (CMPLX(fabs(b - b), copysign(a, b)));
|
||||
else
|
||||
return (cpack(a, copysign(b - b, b)));
|
||||
return (CMPLX(a, copysign(b - b, b)));
|
||||
}
|
||||
/*
|
||||
* The remaining special case (b is NaN) is handled just fine by
|
||||
@ -94,10 +94,10 @@ csqrt(double complex z)
|
||||
/* Algorithm 312, CACM vol 10, Oct 1967. */
|
||||
if (a >= 0) {
|
||||
t = sqrt((a + hypot(a, b)) * 0.5);
|
||||
result = cpack(t, b / (2 * t));
|
||||
result = CMPLX(t, b / (2 * t));
|
||||
} else {
|
||||
t = sqrt((-a + hypot(a, b)) * 0.5);
|
||||
result = cpack(fabs(b) / (2 * t), copysign(t, b));
|
||||
result = CMPLX(fabs(b) / (2 * t), copysign(t, b));
|
||||
}
|
||||
|
||||
/* Rescale. */
|
||||
|
@ -49,12 +49,12 @@ csqrtf(float complex z)
|
||||
|
||||
/* Handle special cases. */
|
||||
if (z == 0)
|
||||
return (cpackf(0, b));
|
||||
return (CMPLXF(0, b));
|
||||
if (isinf(b))
|
||||
return (cpackf(INFINITY, b));
|
||||
return (CMPLXF(INFINITY, b));
|
||||
if (isnan(a)) {
|
||||
t = (b - b) / (b - b); /* raise invalid if b is not a NaN */
|
||||
return (cpackf(a, t)); /* return NaN + NaN i */
|
||||
return (CMPLXF(a, t)); /* return NaN + NaN i */
|
||||
}
|
||||
if (isinf(a)) {
|
||||
/*
|
||||
@ -64,9 +64,9 @@ csqrtf(float complex z)
|
||||
* csqrtf(-inf + y i) = 0 + inf i
|
||||
*/
|
||||
if (signbit(a))
|
||||
return (cpackf(fabsf(b - b), copysignf(a, b)));
|
||||
return (CMPLXF(fabsf(b - b), copysignf(a, b)));
|
||||
else
|
||||
return (cpackf(a, copysignf(b - b, b)));
|
||||
return (CMPLXF(a, copysignf(b - b, b)));
|
||||
}
|
||||
/*
|
||||
* The remaining special case (b is NaN) is handled just fine by
|
||||
@ -80,9 +80,9 @@ csqrtf(float complex z)
|
||||
*/
|
||||
if (a >= 0) {
|
||||
t = sqrt((a + hypot(a, b)) * 0.5);
|
||||
return (cpackf(t, b / (2.0 * t)));
|
||||
return (CMPLXF(t, b / (2.0 * t)));
|
||||
} else {
|
||||
t = sqrt((-a + hypot(a, b)) * 0.5);
|
||||
return (cpackf(fabsf(b) / (2.0 * t), copysignf(t, b)));
|
||||
return (CMPLXF(fabsf(b) / (2.0 * t), copysignf(t, b)));
|
||||
}
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ csqrtl(long double complex z)
|
||||
|
||||
/* Handle special cases. */
|
||||
if (z == 0)
|
||||
return (cpackl(0, b));
|
||||
return (CMPLXL(0, b));
|
||||
if (isinf(b))
|
||||
return (cpackl(INFINITY, b));
|
||||
return (CMPLXL(INFINITY, b));
|
||||
if (isnan(a)) {
|
||||
t = (b - b) / (b - b); /* raise invalid if b is not a NaN */
|
||||
return (cpackl(a, t)); /* return NaN + NaN i */
|
||||
return (CMPLXL(a, t)); /* return NaN + NaN i */
|
||||
}
|
||||
if (isinf(a)) {
|
||||
/*
|
||||
@ -73,9 +73,9 @@ csqrtl(long double complex z)
|
||||
* csqrt(-inf + y i) = 0 + inf i
|
||||
*/
|
||||
if (signbit(a))
|
||||
return (cpackl(fabsl(b - b), copysignl(a, b)));
|
||||
return (CMPLXL(fabsl(b - b), copysignl(a, b)));
|
||||
else
|
||||
return (cpackl(a, copysignl(b - b, b)));
|
||||
return (CMPLXL(a, copysignl(b - b, b)));
|
||||
}
|
||||
/*
|
||||
* The remaining special case (b is NaN) is handled just fine by
|
||||
@ -94,10 +94,10 @@ csqrtl(long double complex z)
|
||||
/* Algorithm 312, CACM vol 10, Oct 1967. */
|
||||
if (a >= 0) {
|
||||
t = sqrtl((a + hypotl(a, b)) * 0.5);
|
||||
result = cpackl(t, b / (2 * t));
|
||||
result = CMPLXL(t, b / (2 * t));
|
||||
} else {
|
||||
t = sqrtl((-a + hypotl(a, b)) * 0.5);
|
||||
result = cpackl(fabsl(b) / (2 * t), copysignl(t, b));
|
||||
result = CMPLXL(fabsl(b) / (2 * t), copysignl(t, b));
|
||||
}
|
||||
|
||||
/* Rescale. */
|
||||
|
@ -102,9 +102,9 @@ ctanh(double complex z)
|
||||
*/
|
||||
if (ix >= 0x7ff00000) {
|
||||
if ((ix & 0xfffff) | lx) /* x is NaN */
|
||||
return (cpack(x, (y == 0 ? y : x * y)));
|
||||
return (CMPLX(x, (y == 0 ? y : x * y)));
|
||||
SET_HIGH_WORD(x, hx - 0x40000000); /* x = copysign(1, x) */
|
||||
return (cpack(x, copysign(0, isinf(y) ? y : sin(y) * cos(y))));
|
||||
return (CMPLX(x, copysign(0, isinf(y) ? y : sin(y) * cos(y))));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -112,7 +112,7 @@ ctanh(double complex z)
|
||||
* ctanh(x +- i Inf) = NaN + i NaN
|
||||
*/
|
||||
if (!isfinite(y))
|
||||
return (cpack(y - y, y - y));
|
||||
return (CMPLX(y - y, y - y));
|
||||
|
||||
/*
|
||||
* ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the
|
||||
@ -121,7 +121,7 @@ ctanh(double complex z)
|
||||
*/
|
||||
if (ix >= 0x40360000) { /* x >= 22 */
|
||||
double exp_mx = exp(-fabs(x));
|
||||
return (cpack(copysign(1, x),
|
||||
return (CMPLX(copysign(1, x),
|
||||
4 * sin(y) * cos(y) * exp_mx * exp_mx));
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ ctanh(double complex z)
|
||||
s = sinh(x);
|
||||
rho = sqrt(1 + s * s); /* = cosh(x) */
|
||||
denom = 1 + beta * s * s;
|
||||
return (cpack((beta * rho * s) / denom, t / denom));
|
||||
return (CMPLX((beta * rho * s) / denom, t / denom));
|
||||
}
|
||||
|
||||
double complex
|
||||
@ -139,6 +139,6 @@ ctan(double complex z)
|
||||
{
|
||||
|
||||
/* ctan(z) = -I * ctanh(I * z) */
|
||||
z = ctanh(cpack(-cimag(z), creal(z)));
|
||||
return (cpack(cimag(z), -creal(z)));
|
||||
z = ctanh(CMPLX(-cimag(z), creal(z)));
|
||||
return (CMPLX(cimag(z), -creal(z)));
|
||||
}
|
||||
|
@ -51,18 +51,18 @@ ctanhf(float complex z)
|
||||
|
||||
if (ix >= 0x7f800000) {
|
||||
if (ix & 0x7fffff)
|
||||
return (cpackf(x, (y == 0 ? y : x * y)));
|
||||
return (CMPLXF(x, (y == 0 ? y : x * y)));
|
||||
SET_FLOAT_WORD(x, hx - 0x40000000);
|
||||
return (cpackf(x,
|
||||
return (CMPLXF(x,
|
||||
copysignf(0, isinf(y) ? y : sinf(y) * cosf(y))));
|
||||
}
|
||||
|
||||
if (!isfinite(y))
|
||||
return (cpackf(y - y, y - y));
|
||||
return (CMPLXF(y - y, y - y));
|
||||
|
||||
if (ix >= 0x41300000) { /* x >= 11 */
|
||||
float exp_mx = expf(-fabsf(x));
|
||||
return (cpackf(copysignf(1, x),
|
||||
return (CMPLXF(copysignf(1, x),
|
||||
4 * sinf(y) * cosf(y) * exp_mx * exp_mx));
|
||||
}
|
||||
|
||||
@ -71,14 +71,14 @@ ctanhf(float complex z)
|
||||
s = sinhf(x);
|
||||
rho = sqrtf(1 + s * s);
|
||||
denom = 1 + beta * s * s;
|
||||
return (cpackf((beta * rho * s) / denom, t / denom));
|
||||
return (CMPLXF((beta * rho * s) / denom, t / denom));
|
||||
}
|
||||
|
||||
float complex
|
||||
ctanf(float complex z)
|
||||
{
|
||||
|
||||
z = ctanhf(cpackf(-cimagf(z), crealf(z)));
|
||||
return (cpackf(cimagf(z), -crealf(z)));
|
||||
z = ctanhf(CMPLXF(-cimagf(z), crealf(z)));
|
||||
return (CMPLXF(cimagf(z), -crealf(z)));
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ static const char rcsid[] =
|
||||
#include <fcntl.h>
|
||||
#include <libufs.h>
|
||||
#include <paths.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -361,7 +362,7 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
/*
|
||||
* Dump the main inode structure.
|
||||
*/
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
|
||||
if (level & 0x100) {
|
||||
DBG_DUMP_INO(&sblock,
|
||||
comment,
|
||||
@ -385,8 +386,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
(size_t)sblock.fs_bsize) == -1) {
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0",
|
||||
inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
|
||||
(uintmax_t)inode);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i1blk,
|
||||
@ -401,8 +402,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
(size_t)sblock.fs_bsize) == -1) {
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1",
|
||||
inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
|
||||
(uintmax_t)inode);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i2blk,
|
||||
@ -416,7 +417,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment),
|
||||
"Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
|
||||
"Inode 0x%08jx: indirect 1->%d", (uintmax_t)inode,
|
||||
ind2ctr);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i1blk,
|
||||
@ -432,8 +434,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
(size_t)sblock.fs_bsize) == -1) {
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2",
|
||||
inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
|
||||
(uintmax_t)inode);
|
||||
#define SQUARE(a) ((a)*(a))
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
@ -450,7 +452,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment),
|
||||
"Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
|
||||
"Inode 0x%08jx: indirect 2->%d", (uintmax_t)inode,
|
||||
ind3ctr);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i2blk,
|
||||
@ -466,8 +469,8 @@ dump_whole_ufs1_inode(ino_t inode, int level)
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment),
|
||||
"Inode 0x%08x: indirect 2->%d->%d", inode,
|
||||
ind3ctr, ind3ctr);
|
||||
"Inode 0x%08jx: indirect 2->%d->%d",
|
||||
(uintmax_t)inode, ind3ctr, ind3ctr);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i1blk,
|
||||
@ -513,7 +516,7 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
/*
|
||||
* Dump the main inode structure.
|
||||
*/
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx", (uintmax_t)inode);
|
||||
if (level & 0x100) {
|
||||
DBG_DUMP_INO(&sblock, comment, ino);
|
||||
}
|
||||
@ -535,7 +538,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
(size_t)sblock.fs_bsize) == -1) {
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0", inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 0",
|
||||
(uintmax_t)inode);
|
||||
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
|
||||
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
|
||||
}
|
||||
@ -547,7 +551,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
(size_t)sblock.fs_bsize) == -1) {
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1", inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 1",
|
||||
(uintmax_t)inode);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i2blk,
|
||||
@ -561,7 +566,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment),
|
||||
"Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
|
||||
"Inode 0x%08jx: indirect 1->%d",
|
||||
(uintmax_t)inode, ind2ctr);
|
||||
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
|
||||
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
|
||||
}
|
||||
@ -574,7 +580,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
(size_t)sblock.fs_bsize) == -1) {
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2", inode);
|
||||
snprintf(comment, sizeof(comment), "Inode 0x%08jx: indirect 2",
|
||||
(uintmax_t)inode);
|
||||
#define SQUARE(a) ((a)*(a))
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
@ -591,7 +598,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment),
|
||||
"Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
|
||||
"Inode 0x%08jx: indirect 2->%d",
|
||||
(uintmax_t)inode, ind3ctr);
|
||||
DBG_DUMP_IBLK(&sblock,
|
||||
comment,
|
||||
i2blk,
|
||||
@ -605,8 +613,8 @@ dump_whole_ufs2_inode(ino_t inode, int level)
|
||||
err(1, "bread: %s", disk.d_error);
|
||||
}
|
||||
snprintf(comment, sizeof(comment),
|
||||
"Inode 0x%08x: indirect 2->%d->%d", inode,
|
||||
ind3ctr, ind3ctr);
|
||||
"Inode 0x%08jx: indirect 2->%d->%d",
|
||||
(uintmax_t)inode, ind3ctr, ind3ctr);
|
||||
DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
|
||||
rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ SRCS+= ifmac.c # MAC support
|
||||
SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support
|
||||
SRCS+= iffib.c # non-default FIB support
|
||||
SRCS+= ifvlan.c # SIOC[GS]ETVLAN support
|
||||
#SRCS+= ifvxlan.c # VXLAN support
|
||||
SRCS+= ifvxlan.c # VXLAN support
|
||||
SRCS+= ifgre.c # GRE keys etc
|
||||
SRCS+= ifgif.c # GIF reversed header workaround
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 20, 2014
|
||||
.Dd December 16, 2014
|
||||
.Dt IFCONFIG 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -2544,33 +2544,33 @@ The following parameters are used to configure
|
||||
.Xr vxlan 4
|
||||
interfaces.
|
||||
.Bl -tag -width indent
|
||||
.It Cm vni Ar identifier
|
||||
.It Cm vxlanid Ar identifier
|
||||
This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the
|
||||
virtual network segment membership of the interface.
|
||||
.It Cm local Ar address
|
||||
.It Cm vxlanlocal Ar address
|
||||
The source address used in the encapsulating IPv4/IPv6 header.
|
||||
The address should already be assigned to an existing interface.
|
||||
When the interface is configured in unicast mode, the listening socket
|
||||
is bound to this address.
|
||||
.It Cm remote Ar address
|
||||
.It Cm vxlanremote Ar address
|
||||
The interface can be configured in a unicast, or point-to-point, mode
|
||||
to create a tunnel between two hosts.
|
||||
This is the IP address of the remote end of the tunnel.
|
||||
.It Cm group Ar address
|
||||
.It Cm vxlangroup Ar address
|
||||
The interface can be configured in a multicast mode
|
||||
to create a virtual network of hosts.
|
||||
This is the IP multicast group address the interface will join.
|
||||
.It Cm localport Ar port
|
||||
.It Cm vxlanlocalport Ar port
|
||||
The port number the interface will listen on.
|
||||
The default port number is 4789.
|
||||
.It Cm remoteport Ar port
|
||||
.It Cm vxlanremoteport Ar port
|
||||
The destination port number used in the encapsulating IPv4/IPv6 header.
|
||||
The remote host should be listening on this port.
|
||||
The default port number is 4789.
|
||||
Note some other implementations, such as Linux,
|
||||
do not default to the IANA assigned port,
|
||||
but instead listen on port 8472.
|
||||
.It Cm portrange Ar low high
|
||||
.It Cm vxlanportrange Ar low high
|
||||
The range of source ports used in the encapsulating IPv4/IPv6 header.
|
||||
The port selected within the range is based on a hash of the inner frame.
|
||||
A range is useful to provide entropy within the outer IP header
|
||||
@ -2581,32 +2581,32 @@ variables
|
||||
.Va net.inet.ip.portrange.first
|
||||
and
|
||||
.Va net.inet.ip.portrange.last
|
||||
.It Cm timeout Ar timeout
|
||||
.It Cm vxlantimeout Ar timeout
|
||||
The maximum time, in seconds, before an entry in the forwarding table
|
||||
is pruned.
|
||||
The default is 1200 seconds (20 minutes).
|
||||
.It Cm maxaddr Ar max
|
||||
.It Cm vxlanmaxaddr Ar max
|
||||
The maximum number of entries in the forwarding table.
|
||||
The default is 2000.
|
||||
.It Cm vxlandev Ar dev
|
||||
When the interface is configured in multicast mode, the
|
||||
.Cm dev
|
||||
interface is used to transmit IP multicast packets.
|
||||
.It Cm ttl Ar ttl
|
||||
.It Cm vxlanttl Ar ttl
|
||||
The TTL used in the encapsulating IPv4/IPv6 header.
|
||||
The default is 64.
|
||||
.It Cm learn
|
||||
.It Cm vxlanlearn
|
||||
The source IP address and inner source Ethernet MAC address of
|
||||
received packets are used to dynamically populate the forwarding table.
|
||||
When in multicast mode, an entry in the forwarding table allows the
|
||||
interface to send the frame directly to the remote host instead of
|
||||
broadcasting the frame to the multicast group.
|
||||
This is the default.
|
||||
.It Fl learn
|
||||
.It Fl vxlanlearn
|
||||
The forwarding table is not populated by recevied packets.
|
||||
.It Cm flush
|
||||
.It Cm vxlanflush
|
||||
Delete all dynamically-learned addresses from the forwarding table.
|
||||
.It Cm flushall
|
||||
.It Cm vxlanflushall
|
||||
Delete all addresses, including static addresses, from the forwarding table.
|
||||
.El
|
||||
.Pp
|
||||
|
@ -595,36 +595,36 @@ setvxlan_flush(const char *val, int d, int s, const struct afswtch *afp)
|
||||
|
||||
static struct cmd vxlan_cmds[] = {
|
||||
|
||||
DEF_CLONE_CMD_ARG("vni", setvxlan_vni),
|
||||
DEF_CLONE_CMD_ARG("local", setvxlan_local),
|
||||
DEF_CLONE_CMD_ARG("remote", setvxlan_remote),
|
||||
DEF_CLONE_CMD_ARG("group", setvxlan_group),
|
||||
DEF_CLONE_CMD_ARG("localport", setvxlan_local_port),
|
||||
DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port),
|
||||
DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range),
|
||||
DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout),
|
||||
DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr),
|
||||
DEF_CLONE_CMD_ARG("vxlanid", setvxlan_vni),
|
||||
DEF_CLONE_CMD_ARG("vxlanlocal", setvxlan_local),
|
||||
DEF_CLONE_CMD_ARG("vxlanremote", setvxlan_remote),
|
||||
DEF_CLONE_CMD_ARG("vxlangroup", setvxlan_group),
|
||||
DEF_CLONE_CMD_ARG("vxlanlocalport", setvxlan_local_port),
|
||||
DEF_CLONE_CMD_ARG("vxlanremoteport", setvxlan_remote_port),
|
||||
DEF_CLONE_CMD_ARG2("vxlanportrange", setvxlan_port_range),
|
||||
DEF_CLONE_CMD_ARG("vxlantimeout", setvxlan_timeout),
|
||||
DEF_CLONE_CMD_ARG("vxlanmaxaddr", setvxlan_maxaddr),
|
||||
DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev),
|
||||
DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl),
|
||||
DEF_CLONE_CMD("learn", 1, setvxlan_learn),
|
||||
DEF_CLONE_CMD("-learn", 0, setvxlan_learn),
|
||||
DEF_CLONE_CMD_ARG("vxlanttl", setvxlan_ttl),
|
||||
DEF_CLONE_CMD("vxlanlearn", 1, setvxlan_learn),
|
||||
DEF_CLONE_CMD("-vxlanlearn", 0, setvxlan_learn),
|
||||
|
||||
DEF_CMD_ARG("vni", setvxlan_vni),
|
||||
DEF_CMD_ARG("local", setvxlan_local),
|
||||
DEF_CMD_ARG("remote", setvxlan_remote),
|
||||
DEF_CMD_ARG("group", setvxlan_group),
|
||||
DEF_CMD_ARG("localport", setvxlan_local_port),
|
||||
DEF_CMD_ARG("remoteport", setvxlan_remote_port),
|
||||
DEF_CMD_ARG2("portrange", setvxlan_port_range),
|
||||
DEF_CMD_ARG("timeout", setvxlan_timeout),
|
||||
DEF_CMD_ARG("maxaddr", setvxlan_maxaddr),
|
||||
DEF_CMD_ARG("vxlanvni", setvxlan_vni),
|
||||
DEF_CMD_ARG("vxlanlocal", setvxlan_local),
|
||||
DEF_CMD_ARG("vxlanremote", setvxlan_remote),
|
||||
DEF_CMD_ARG("vxlangroup", setvxlan_group),
|
||||
DEF_CMD_ARG("vxlanlocalport", setvxlan_local_port),
|
||||
DEF_CMD_ARG("vxlanremoteport", setvxlan_remote_port),
|
||||
DEF_CMD_ARG2("vxlanportrange", setvxlan_port_range),
|
||||
DEF_CMD_ARG("vxlantimeout", setvxlan_timeout),
|
||||
DEF_CMD_ARG("vxlanmaxaddr", setvxlan_maxaddr),
|
||||
DEF_CMD_ARG("vxlandev", setvxlan_dev),
|
||||
DEF_CMD_ARG("ttl", setvxlan_ttl),
|
||||
DEF_CMD("learn", 1, setvxlan_learn),
|
||||
DEF_CMD("-learn", 0, setvxlan_learn),
|
||||
DEF_CMD_ARG("vxlanttl", setvxlan_ttl),
|
||||
DEF_CMD("vxlanlearn", 1, setvxlan_learn),
|
||||
DEF_CMD("-vxlanlearn", 0, setvxlan_learn),
|
||||
|
||||
DEF_CMD("flush", 0, setvxlan_flush),
|
||||
DEF_CMD("flushall", 1, setvxlan_flush),
|
||||
DEF_CMD("vxlanflush", 0, setvxlan_flush),
|
||||
DEF_CMD("vxlanflushall", 1, setvxlan_flush),
|
||||
};
|
||||
|
||||
static struct afswtch af_vxlan = {
|
||||
|
@ -648,11 +648,20 @@ main(int argc, char *argv[])
|
||||
err(1, "socket");
|
||||
|
||||
/* set the source address if specified. */
|
||||
if ((options & F_SRCADDR) &&
|
||||
bind(s, (struct sockaddr *)&src, srclen) != 0) {
|
||||
err(1, "bind");
|
||||
if ((options & F_SRCADDR) != 0) {
|
||||
/* properly fill sin6_scope_id */
|
||||
if (IN6_IS_ADDR_LINKLOCAL(&src.sin6_addr) && (
|
||||
IN6_IS_ADDR_LINKLOCAL(&dst.sin6_addr) ||
|
||||
IN6_IS_ADDR_MC_LINKLOCAL(&dst.sin6_addr) ||
|
||||
IN6_IS_ADDR_MC_NODELOCAL(&dst.sin6_addr))) {
|
||||
if (src.sin6_scope_id == 0)
|
||||
src.sin6_scope_id = dst.sin6_scope_id;
|
||||
if (dst.sin6_scope_id == 0)
|
||||
dst.sin6_scope_id = src.sin6_scope_id;
|
||||
}
|
||||
if (bind(s, (struct sockaddr *)&src, srclen) != 0)
|
||||
err(1, "bind");
|
||||
}
|
||||
|
||||
/* set the gateway (next hop) if specified */
|
||||
if (gateway) {
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 19, 2013
|
||||
.Dd December 15, 2014
|
||||
.Dt SHUTDOWN 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -118,6 +118,15 @@ to the current system values.
|
||||
The first form brings the system down in
|
||||
.Ar number
|
||||
minutes and the second at the absolute time specified.
|
||||
.Ar +number
|
||||
may be specified in units other than minutes by appending the corresponding
|
||||
suffix:
|
||||
.Dq Li s ,
|
||||
.Dq Li sec ,
|
||||
.Dq Li m ,
|
||||
.Dq Li min .
|
||||
.Dq Li h ,
|
||||
.Dq Li hour .
|
||||
.It Ar warning-message
|
||||
Any other arguments comprise the warning message that is broadcast
|
||||
to users currently logged into the system.
|
||||
|
@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
@ -322,7 +323,8 @@ timewarn(int timeleft)
|
||||
(void)fprintf(pf, "System going down in %d minute%s\n\n",
|
||||
timeleft / 60, (timeleft > 60) ? "s" : "");
|
||||
else if (timeleft)
|
||||
(void)fprintf(pf, "System going down in 30 seconds\n\n");
|
||||
(void)fprintf(pf, "System going down in %s30 seconds\n\n",
|
||||
(offset > 0 && offset < 30 ? "less than " : ""));
|
||||
else
|
||||
(void)fprintf(pf, "System going down IMMEDIATELY\n\n");
|
||||
|
||||
@ -415,6 +417,7 @@ getoffset(char *timearg)
|
||||
char *p;
|
||||
time_t now;
|
||||
int this_year;
|
||||
char *timeunit;
|
||||
|
||||
(void)time(&now);
|
||||
|
||||
@ -427,8 +430,25 @@ getoffset(char *timearg)
|
||||
if (*timearg == '+') { /* +minutes */
|
||||
if (!isdigit(*++timearg))
|
||||
badtime();
|
||||
if ((offset = atoi(timearg) * 60) < 0)
|
||||
errno = 0;
|
||||
offset = strtol(timearg, &timeunit, 10);
|
||||
if (offset < 0 || offset == LONG_MAX || errno != 0)
|
||||
badtime();
|
||||
if (timeunit[0] == '\0' || strcasecmp(timeunit, "m") == 0 ||
|
||||
strcasecmp(timeunit, "min") == 0 ||
|
||||
strcasecmp(timeunit, "mins") == 0) {
|
||||
offset *= 60;
|
||||
} else if (strcasecmp(timeunit, "h") == 0 ||
|
||||
strcasecmp(timeunit, "hour") == 0 ||
|
||||
strcasecmp(timeunit, "hours") == 0) {
|
||||
offset *= 60 * 60;
|
||||
} else if (strcasecmp(timeunit, "s") == 0 ||
|
||||
strcasecmp(timeunit, "sec") == 0 ||
|
||||
strcasecmp(timeunit, "secs") == 0) {
|
||||
offset *= 1;
|
||||
} else {
|
||||
badtime();
|
||||
}
|
||||
shuttime = now + offset;
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 20, 2014
|
||||
.Dd December 16, 2014
|
||||
.Dt VXLAN 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -140,7 +140,7 @@ or VNI.
|
||||
.Pp
|
||||
When configured with the
|
||||
.Xr ifconfig 8
|
||||
.Cm learn
|
||||
.Cm vxlanlearn
|
||||
parameter, the interface dynamically creates forwarding table entries
|
||||
from received packets.
|
||||
An entry in the forwarding table maps the inner source MAC address
|
||||
@ -153,16 +153,16 @@ Otherwise, when configured in multicast mode,
|
||||
the interface must flood the frame to all hosts in the group.
|
||||
The maximum number of entries in the table is configurable with the
|
||||
.Xr ifconfig 8
|
||||
.Cm maxaddr
|
||||
.Cm vxlanmaxaddr
|
||||
command.
|
||||
Stale entries in the table periodically pruned.
|
||||
The timeout is configurable with the
|
||||
.Xr ifconfig 8
|
||||
.Cm timeout
|
||||
.Cm vxlantimeout
|
||||
command.
|
||||
The table may be viewed with the
|
||||
.Xr sysctl 8
|
||||
.Cm net.link.vlxan.N.ftable.dump
|
||||
.Cm net.link.vxlan.N.ftable.dump
|
||||
command.
|
||||
.Sh MTU
|
||||
Since the
|
||||
@ -187,13 +187,13 @@ Create a
|
||||
.Nm
|
||||
interface in unicast mode
|
||||
with the
|
||||
.Cm local
|
||||
.Cm vxlanlocal
|
||||
tunnel address of 192.168.100.1,
|
||||
and the
|
||||
.Cm remote
|
||||
.Cm vxlanremote
|
||||
tunnel address of 192.168.100.2.
|
||||
.Bd -literal -offset indent
|
||||
ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2
|
||||
ifconfig vxlan create vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2
|
||||
.Ed
|
||||
.Pp
|
||||
Create a
|
||||
@ -207,7 +207,7 @@ and the
|
||||
address of 224.0.2.6.
|
||||
The em0 interface will be used to transmit multicast packets.
|
||||
.Bd -literal -offset indent
|
||||
ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0
|
||||
ifconfig vxlan create vxlanid 42 vxlanlocal 192.168.10.95 vxlangroup 224.0.2.6 vxlandev em0
|
||||
.Ed
|
||||
.Pp
|
||||
Once created, the
|
||||
|
@ -445,6 +445,21 @@ process.
|
||||
.Bd -literal -offset indent
|
||||
make PORTS_MODULES=emulators/kqemu-kmod kernel
|
||||
.Ed
|
||||
.It Va STRIP_CMD
|
||||
Command to use at install time when stripping binaries.
|
||||
Be sure to add any additional tools required to run
|
||||
.Va STRIP_CMD
|
||||
to the
|
||||
.Va LOCAL_ITOOLS
|
||||
.Xr make 1
|
||||
variable before running the
|
||||
.Cm distributeworld
|
||||
or
|
||||
.Cm installworld
|
||||
targets.
|
||||
See
|
||||
.Xr install 1
|
||||
for more details.
|
||||
.It Va SUBDIR_OVERRIDE
|
||||
Override the default list of sub-directories and only build the
|
||||
sub-directory named in this variable.
|
||||
|
@ -289,8 +289,8 @@ Assert that the current thread does not hold a recursive lock of
|
||||
.Xr mutex 9 ,
|
||||
.Xr panic 9 ,
|
||||
.Xr rwlock 9 ,
|
||||
.Xr sleep 9 ,
|
||||
.Xr sema 9 ,
|
||||
.Xr sleep 9 ,
|
||||
.Xr sx 9
|
||||
.Sh HISTORY
|
||||
These
|
||||
|
@ -315,8 +315,8 @@ lock while another thread blocked on the same
|
||||
lock after acquiring a mutex, then the second thread would effectively
|
||||
end up sleeping while holding a mutex, which is not allowed.
|
||||
.Sh SEE ALSO
|
||||
.Xr locking 9 ,
|
||||
.Xr lock 9 ,
|
||||
.Xr locking 9 ,
|
||||
.Xr mutex 9 ,
|
||||
.Xr panic 9 ,
|
||||
.Xr rwlock 9 ,
|
||||
|
@ -153,9 +153,13 @@ IDTVEC(xmm)
|
||||
IDTVEC(tss)
|
||||
TRAP_ERR(T_TSSFLT)
|
||||
IDTVEC(missing)
|
||||
TRAP_ERR(T_SEGNPFLT)
|
||||
subq $TF_ERR,%rsp
|
||||
movl $T_SEGNPFLT,TF_TRAPNO(%rsp)
|
||||
jmp prot_addrf
|
||||
IDTVEC(stk)
|
||||
TRAP_ERR(T_STKFLT)
|
||||
subq $TF_ERR,%rsp
|
||||
movl $T_STKFLT,TF_TRAPNO(%rsp)
|
||||
jmp prot_addrf
|
||||
IDTVEC(align)
|
||||
TRAP_ERR(T_ALIGNFLT)
|
||||
|
||||
@ -318,6 +322,7 @@ IDTVEC(page)
|
||||
IDTVEC(prot)
|
||||
subq $TF_ERR,%rsp
|
||||
movl $T_PROTFLT,TF_TRAPNO(%rsp)
|
||||
prot_addrf:
|
||||
movq $0,TF_ADDR(%rsp)
|
||||
movq %rdi,TF_RDI(%rsp) /* free up a GP register */
|
||||
leaq doreti_iret(%rip),%rdi
|
||||
|
@ -75,7 +75,7 @@ struct atpic {
|
||||
uint8_t mask; /* Interrupt Mask Register (IMR) */
|
||||
|
||||
int acnt[8]; /* sum of pin asserts and deasserts */
|
||||
int priority; /* current pin priority */
|
||||
int lowprio; /* lowest priority irq */
|
||||
|
||||
bool intr_raised;
|
||||
};
|
||||
@ -102,6 +102,14 @@ struct vatpic {
|
||||
#define VATPIC_CTR4(vatpic, fmt, a1, a2, a3, a4) \
|
||||
VM_CTR4((vatpic)->vm, fmt, a1, a2, a3, a4)
|
||||
|
||||
/*
|
||||
* Loop over all the pins in priority order from highest to lowest.
|
||||
*/
|
||||
#define ATPIC_PIN_FOREACH(pinvar, atpic, tmpvar) \
|
||||
for (tmpvar = 0, pinvar = (atpic->lowprio + 1) & 0x7; \
|
||||
tmpvar < 8; \
|
||||
tmpvar++, pinvar = (pinvar + 1) & 0x7)
|
||||
|
||||
static void vatpic_set_pinstate(struct vatpic *vatpic, int pin, bool newstate);
|
||||
|
||||
static __inline int
|
||||
@ -110,8 +118,7 @@ vatpic_get_highest_isrpin(struct atpic *atpic)
|
||||
int bit, pin;
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= 7; i++) {
|
||||
pin = ((i + 7 - atpic->priority) & 0x7);
|
||||
ATPIC_PIN_FOREACH(pin, atpic, i) {
|
||||
bit = (1 << pin);
|
||||
|
||||
if (atpic->service & bit)
|
||||
@ -125,8 +132,7 @@ static __inline int
|
||||
vatpic_get_highest_irrpin(struct atpic *atpic)
|
||||
{
|
||||
int serviced;
|
||||
int bit, pin;
|
||||
int i, j;
|
||||
int bit, pin, tmp;
|
||||
|
||||
/*
|
||||
* In 'Special Fully-Nested Mode' when an interrupt request from
|
||||
@ -137,17 +143,21 @@ vatpic_get_highest_irrpin(struct atpic *atpic)
|
||||
if (atpic->sfn)
|
||||
serviced &= ~(1 << 2);
|
||||
|
||||
for (i = 0; i <= 7; i++) {
|
||||
pin = ((i + 7 - atpic->priority) & 0x7);
|
||||
bit = (1 << pin);
|
||||
if (serviced & bit)
|
||||
break;
|
||||
}
|
||||
ATPIC_PIN_FOREACH(pin, atpic, tmp) {
|
||||
bit = 1 << pin;
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
pin = ((j + 7 - atpic->priority) & 0x7);
|
||||
bit = (1 << pin);
|
||||
if (atpic->request & bit && (~atpic->mask & bit))
|
||||
/*
|
||||
* If there is already an interrupt in service at the same
|
||||
* or higher priority then bail.
|
||||
*/
|
||||
if ((serviced & bit) != 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* If an interrupt is asserted and not masked then return
|
||||
* the corresponding 'pin' to the caller.
|
||||
*/
|
||||
if ((atpic->request & bit) != 0 && (atpic->mask & bit) == 0)
|
||||
return (pin);
|
||||
}
|
||||
|
||||
@ -238,7 +248,7 @@ vatpic_icw1(struct vatpic *vatpic, struct atpic *atpic, uint8_t val)
|
||||
|
||||
atpic->icw_num = 1;
|
||||
atpic->mask = 0;
|
||||
atpic->priority = 0;
|
||||
atpic->lowprio = 7;
|
||||
atpic->rd_cmd_reg = 0;
|
||||
|
||||
if ((val & ICW1_SNGL) != 0) {
|
||||
@ -329,11 +339,11 @@ vatpic_ocw2(struct vatpic *vatpic, struct atpic *atpic, uint8_t val)
|
||||
atpic->service &= ~(1 << isr_bit);
|
||||
|
||||
if (atpic->rotate)
|
||||
atpic->priority = isr_bit;
|
||||
atpic->lowprio = isr_bit;
|
||||
}
|
||||
} else if ((val & OCW2_SL) != 0 && atpic->rotate == true) {
|
||||
/* specific priority */
|
||||
atpic->priority = val & 0x7;
|
||||
atpic->lowprio = val & 0x7;
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -388,6 +398,8 @@ vatpic_set_pinstate(struct vatpic *vatpic, int pin, bool newstate)
|
||||
} else if (oldcnt == 1 && newcnt == 0) {
|
||||
/* falling edge */
|
||||
VATPIC_CTR1(vatpic, "atpic pin%d: deasserted", pin);
|
||||
if (level)
|
||||
atpic->request &= ~(1 << (pin & 0x7));
|
||||
} else {
|
||||
VATPIC_CTR3(vatpic, "atpic pin%d: %s, ignored, acnt %d",
|
||||
pin, newstate ? "asserted" : "deasserted", newcnt);
|
||||
@ -528,7 +540,7 @@ vatpic_pin_accepted(struct atpic *atpic, int pin)
|
||||
|
||||
if (atpic->aeoi == true) {
|
||||
if (atpic->rotate == true)
|
||||
atpic->priority = pin;
|
||||
atpic->lowprio = pin;
|
||||
} else {
|
||||
atpic->service |= (1 << pin);
|
||||
}
|
||||
|
@ -1939,8 +1939,7 @@ fdt_get_ranges(const char *nodename, void *buf, int size, int *tuples,
|
||||
if (tuples_count <= 0)
|
||||
return (ERANGE);
|
||||
|
||||
if (fdt_ranges_verify(buf, tuples_count, par_addr_cells,
|
||||
addr_cells, size_cells) != 0)
|
||||
if (par_addr_cells > 2 || addr_cells > 2 || size_cells > 2)
|
||||
return (ERANGE);
|
||||
|
||||
*tuples = tuples_count;
|
||||
|
@ -180,8 +180,7 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_range *io_space,
|
||||
rangesptr += offset_cells;
|
||||
}
|
||||
|
||||
if (fdt_data_verify((void *)rangesptr, par_addr_cells -
|
||||
offset_cells)) {
|
||||
if ((par_addr_cells - offset_cells) > 2) {
|
||||
rv = ERANGE;
|
||||
goto out;
|
||||
}
|
||||
@ -189,7 +188,7 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_range *io_space,
|
||||
par_addr_cells - offset_cells);
|
||||
rangesptr += par_addr_cells - offset_cells;
|
||||
|
||||
if (fdt_data_verify((void *)rangesptr, size_cells)) {
|
||||
if (size_cells > 2) {
|
||||
rv = ERANGE;
|
||||
goto out;
|
||||
}
|
||||
|
@ -106,20 +106,36 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
pio2: pio@c0022000 {
|
||||
compatible = "altr,pio";
|
||||
reg = <0xc0022000 0x1000>; /* recv */
|
||||
interrupts = < 77 >;
|
||||
interrupt-parent = <&GIC>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
pio3: pio@c0023000 {
|
||||
compatible = "altr,pio";
|
||||
reg = <0xc0023000 0x1000>; /* send */
|
||||
interrupts = < 83 >; /* not in use on arm side */
|
||||
interrupt-parent = <&GIC>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
beri_vtblk: vtblk@00001000 {
|
||||
compatible = "sri-cambridge,beri-vtblk";
|
||||
reg = <0x00001000 0x1000>;
|
||||
pio-recv = <&pio0>;
|
||||
pio-send = <&pio1>;
|
||||
beri-mem = <&beri_mem0>;
|
||||
status = "disabled";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
beri_vtnet: vtnet@00002000 {
|
||||
compatible = "sri-cambridge,beri-vtnet";
|
||||
reg = <0x00002000 0x1000>;
|
||||
pio-recv = <&pio0>;
|
||||
pio-send = <&pio1>;
|
||||
pio-recv = <&pio2>;
|
||||
pio-send = <&pio3>;
|
||||
beri-mem = <&beri_mem0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -82,6 +82,11 @@
|
||||
*/
|
||||
};
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x0FFFFFFF>; // ~256M at 0x0
|
||||
};
|
||||
|
||||
soc {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
@ -94,11 +99,6 @@
|
||||
compatible = "simple-bus", "mips,mips4k";
|
||||
ranges = <>;
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x0FFFFFFF>; // ~256M at 0x0
|
||||
};
|
||||
|
||||
beripic: beripic@7f804000 {
|
||||
compatible = "sri-cambridge,beri-pic";
|
||||
interrupt-controller;
|
||||
|
@ -80,6 +80,11 @@
|
||||
*/
|
||||
};
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x4000000>; // 64M at 0x0
|
||||
};
|
||||
|
||||
soc {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
@ -92,11 +97,6 @@
|
||||
compatible = "simple-bus", "mips,mips4k";
|
||||
ranges = <>;
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x4000000>; // 64M at 0x0
|
||||
};
|
||||
|
||||
beripic0: beripic@7f804000 {
|
||||
compatible = "sri-cambridge,beri-pic";
|
||||
interrupt-controller;
|
||||
|
@ -80,6 +80,11 @@
|
||||
*/
|
||||
};
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x40000000>; // 1G at 0x0
|
||||
};
|
||||
|
||||
soc {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
@ -92,11 +97,6 @@
|
||||
compatible = "simple-bus", "mips,mips4k";
|
||||
ranges = <>;
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x40000000>; // 1G at 0x0
|
||||
};
|
||||
|
||||
beripic0: beripic@7f804000 {
|
||||
compatible = "sri-cambridge,beri-pic";
|
||||
interrupt-controller;
|
||||
|
219
sys/boot/fdt/dts/mips/beripad-sockit.dts
Normal file
219
sys/boot/fdt/dts/mips/beripad-sockit.dts
Normal file
@ -0,0 +1,219 @@
|
||||
/*-
|
||||
* Copyright (c) 2012-2013 Robert N. M. Watson
|
||||
* Copyright (c) 2013-2014 SRI International
|
||||
* Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by SRI International and the University of
|
||||
* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
|
||||
* ("CTSRD"), as part of the DARPA CRASH research programme.
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/*
|
||||
* Device names here have been largely made up on the spot, especially for the
|
||||
* "compatible" strings, and might want to be revised.
|
||||
*/
|
||||
|
||||
/ {
|
||||
model = "SRI/Cambridge BeriPad (SoCKit)";
|
||||
compatible = "sri-cambridge,beripad-sockit";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
cpus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/*
|
||||
* Secondary CPUs all start disabled and use the
|
||||
* spin-table enable method. cpu-release-addr must be
|
||||
* specified for each cpu other than cpu@0. Values of
|
||||
* cpu-release-addr grow down from 0x100000 (kernel).
|
||||
*/
|
||||
status = "disabled";
|
||||
enable-method = "spin-table";
|
||||
|
||||
cpu@0 {
|
||||
device-type = "cpu";
|
||||
compatible = "sri-cambridge,beri";
|
||||
|
||||
reg = <0 1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/*
|
||||
cpu@1 {
|
||||
device-type = "cpu";
|
||||
compatible = "sri-cambridge,beri";
|
||||
|
||||
reg = <1 1>;
|
||||
// XXX: should we need cached prefix?
|
||||
cpu-release-addr = <0xffffffff 0x800fffe0>;
|
||||
};
|
||||
*/
|
||||
};
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x0 0x10000000>; /* 256MB at 0x0 */
|
||||
};
|
||||
|
||||
soc {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
#interrupt-cells = <1>;
|
||||
|
||||
/*
|
||||
* Declare mips,mips4k since BERI doesn't (yet) have a PIC, so
|
||||
* we use mips4k coprocessor 0 interrupt management directly.
|
||||
*/
|
||||
compatible = "simple-bus", "mips,mips4k";
|
||||
/* ranges = <>; */
|
||||
|
||||
beripic0: beripic@7f804000 {
|
||||
compatible = "sri-cambridge,beri-pic";
|
||||
interrupt-controller;
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <1>;
|
||||
reg = <0x0 0x7f804000 0x0 0x400
|
||||
0x0 0x7f806000 0x0 0x10
|
||||
0x0 0x7f806080 0x0 0x10
|
||||
0x0 0x7f806100 0x0 0x10>;
|
||||
interrupts = <0 1 2 3 4>;
|
||||
hard-interrupt-sources = <64>;
|
||||
soft-interrupt-sources = <64>;
|
||||
};
|
||||
|
||||
pio0: pio@7f020000 {
|
||||
compatible = "altr,pio";
|
||||
reg = <0x0 0x7f020000 0x0 0x1000>; /* send */
|
||||
interrupts = <4>; /* not used */
|
||||
interrupt-parent = <&beripic0>;
|
||||
};
|
||||
|
||||
pio1: pio@7f021000 {
|
||||
compatible = "altr,pio";
|
||||
reg = <0x0 0x7f021000 0x0 0x1000>; /* recv */
|
||||
interrupts = <10>;
|
||||
interrupt-parent = <&beripic0>;
|
||||
};
|
||||
|
||||
pio2: pio@7f022000 {
|
||||
compatible = "altr,pio";
|
||||
reg = <0x0 0x7f022000 0x0 0x1000>; /* send */
|
||||
interrupts = <5>; /* not used */
|
||||
interrupt-parent = <&beripic0>;
|
||||
};
|
||||
|
||||
pio3: pio@7f023000 {
|
||||
compatible = "altr,pio";
|
||||
reg = <0x0 0x7f023000 0x0 0x1000>; /* recv */
|
||||
interrupts = <11>;
|
||||
interrupt-parent = <&beripic0>;
|
||||
};
|
||||
|
||||
virtio_mmio_platform0: virtio_mmio_platform@0 {
|
||||
compatible = "beri,virtio_mmio_platform";
|
||||
pio-send = <&pio0>;
|
||||
pio-recv = <&pio1>;
|
||||
};
|
||||
|
||||
virtio_mmio_platform1: virtio_mmio_platform@1 {
|
||||
compatible = "beri,virtio_mmio_platform";
|
||||
pio-send = <&pio2>;
|
||||
pio-recv = <&pio3>;
|
||||
};
|
||||
|
||||
virtio_block@200001000 {
|
||||
compatible = "virtio,mmio";
|
||||
reg = <0x2 0x1000 0x0 0x1000>;
|
||||
platform = <&virtio_mmio_platform0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
virtio_net@200002000 {
|
||||
compatible = "virtio,mmio";
|
||||
reg = <0x2 0x2000 0x0 0x1000>;
|
||||
platform = <&virtio_mmio_platform1>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
serial@7f000000 {
|
||||
compatible = "altera,jtag_uart-11_0";
|
||||
reg = <0x0 0x7f000000 0x0 0x40>;
|
||||
interrupts = <0>;
|
||||
interrupt-parent = <&beripic0>;
|
||||
};
|
||||
|
||||
/*
|
||||
serial@7f001000 {
|
||||
compatible = "altera,jtag_uart-11_0";
|
||||
reg = <0x7f001000 0x40>;
|
||||
};
|
||||
|
||||
serial@7f002000 {
|
||||
compatible = "altera,jtag_uart-11_0";
|
||||
reg = <0x7f002000 0x40>;
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
led@7f006000 {
|
||||
compatible = "sri-cambridge,de4led";
|
||||
reg = <0x7f006000 0x1>;
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
avgen@0x7f009000 {
|
||||
compatible = "sri-cambridge,avgen";
|
||||
reg = <0x7f009000 0x2>;
|
||||
sri-cambridge,width = <1>;
|
||||
sri-cambridge,fileio = "r";
|
||||
sri-cambridge,devname = "de4bsw";
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
berirom@0x7f00a000 {
|
||||
compatible = "sri-cambridge,berirom";
|
||||
reg = <0x7f00a000 0x1000>;
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
avgen@0x7f00c000 {
|
||||
compatible = "sri-cambridge,avgen";
|
||||
reg = <0x7f00c000 0x8>;
|
||||
sri-cambridge,width = <4>;
|
||||
sri-cambridge,fileio = "rw";
|
||||
sri-cambridge,devname = "de4tempfan";
|
||||
};
|
||||
*/
|
||||
};
|
||||
};
|
@ -3900,7 +3900,7 @@ ctl_copy_io(union ctl_io *src, union ctl_io *dest)
|
||||
dest->io_hdr.flags |= CTL_FLAG_INT_COPY;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
ctl_expand_number(const char *buf, uint64_t *num)
|
||||
{
|
||||
char *endptr;
|
||||
@ -10146,10 +10146,10 @@ ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len)
|
||||
if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) {
|
||||
scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt);
|
||||
scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt);
|
||||
if (lun->be_lun->pblockexp != 0) {
|
||||
scsi_ulto4b((1 << lun->be_lun->pblockexp),
|
||||
if (lun->be_lun->ublockexp != 0) {
|
||||
scsi_ulto4b((1 << lun->be_lun->ublockexp),
|
||||
bl_ptr->opt_unmap_grain);
|
||||
scsi_ulto4b(0x80000000 | lun->be_lun->pblockoff,
|
||||
scsi_ulto4b(0x80000000 | lun->be_lun->ublockoff,
|
||||
bl_ptr->unmap_grain_align);
|
||||
}
|
||||
}
|
||||
|
@ -206,6 +206,7 @@ struct ctl_be_arg;
|
||||
void ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args);
|
||||
void ctl_free_opts(ctl_options_t *opts);
|
||||
char * ctl_get_opt(ctl_options_t *opts, const char *name);
|
||||
int ctl_expand_number(const char *buf, uint64_t *num);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
@ -194,6 +194,8 @@ struct ctl_be_lun {
|
||||
uint32_t blocksize; /* passed to CTL */
|
||||
uint16_t pblockexp; /* passed to CTL */
|
||||
uint16_t pblockoff; /* passed to CTL */
|
||||
uint16_t ublockexp; /* passed to CTL */
|
||||
uint16_t ublockoff; /* passed to CTL */
|
||||
uint32_t atomicblock; /* passed to CTL */
|
||||
uint32_t req_lun_id; /* passed to CTL */
|
||||
uint32_t lun_id; /* returned from CTL */
|
||||
|
@ -173,6 +173,8 @@ struct ctl_be_block_lun {
|
||||
int blocksize_shift;
|
||||
uint16_t pblockexp;
|
||||
uint16_t pblockoff;
|
||||
uint16_t ublockexp;
|
||||
uint16_t ublockoff;
|
||||
struct ctl_be_block_softc *softc;
|
||||
struct devstat *disk_stats;
|
||||
ctl_be_block_lun_flags flags;
|
||||
@ -1739,8 +1741,9 @@ ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
||||
{
|
||||
struct ctl_be_block_filedata *file_data;
|
||||
struct ctl_lun_create_params *params;
|
||||
char *value;
|
||||
struct vattr vattr;
|
||||
off_t pss;
|
||||
off_t ps, pss, po, pos, us, uss, uo, uos;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
@ -1800,11 +1803,36 @@ ctl_be_block_open_file(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
||||
be_lun->blocksize = params->blocksize_bytes;
|
||||
else
|
||||
be_lun->blocksize = 512;
|
||||
pss = vattr.va_blocksize / be_lun->blocksize;
|
||||
if ((pss > 0) && (pss * be_lun->blocksize == vattr.va_blocksize) &&
|
||||
((pss & (pss - 1)) == 0)) {
|
||||
|
||||
us = ps = vattr.va_blocksize;
|
||||
uo = po = 0;
|
||||
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblocksize");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &ps);
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblockoffset");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &po);
|
||||
pss = ps / be_lun->blocksize;
|
||||
pos = po / be_lun->blocksize;
|
||||
if ((pss > 0) && (pss * be_lun->blocksize == ps) && (pss >= pos) &&
|
||||
((pss & (pss - 1)) == 0) && (pos * be_lun->blocksize == po)) {
|
||||
be_lun->pblockexp = fls(pss) - 1;
|
||||
be_lun->pblockoff = 0;
|
||||
be_lun->pblockoff = (pss - pos) % pss;
|
||||
}
|
||||
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublocksize");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &us);
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublockoffset");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &uo);
|
||||
uss = us / be_lun->blocksize;
|
||||
uos = uo / be_lun->blocksize;
|
||||
if ((uss > 0) && (uss * be_lun->blocksize == us) && (uss >= uos) &&
|
||||
((uss & (uss - 1)) == 0) && (uos * be_lun->blocksize == uo)) {
|
||||
be_lun->ublockexp = fls(uss) - 1;
|
||||
be_lun->ublockoff = (uss - uos) % uss;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1827,8 +1855,9 @@ ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
||||
struct vattr vattr;
|
||||
struct cdev *dev;
|
||||
struct cdevsw *devsw;
|
||||
char *value;
|
||||
int error;
|
||||
off_t ps, pss, po, pos;
|
||||
off_t ps, pss, po, pos, us, uss, uo, uos;
|
||||
|
||||
params = &be_lun->params;
|
||||
|
||||
@ -1942,6 +1971,15 @@ ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
||||
if (error)
|
||||
po = 0;
|
||||
}
|
||||
us = ps;
|
||||
uo = po;
|
||||
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblocksize");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &ps);
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "pblockoffset");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &po);
|
||||
pss = ps / be_lun->blocksize;
|
||||
pos = po / be_lun->blocksize;
|
||||
if ((pss > 0) && (pss * be_lun->blocksize == ps) && (pss >= pos) &&
|
||||
@ -1950,6 +1988,20 @@ ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
||||
be_lun->pblockoff = (pss - pos) % pss;
|
||||
}
|
||||
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublocksize");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &us);
|
||||
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "ublockoffset");
|
||||
if (value != NULL)
|
||||
ctl_expand_number(value, &uo);
|
||||
uss = us / be_lun->blocksize;
|
||||
uos = uo / be_lun->blocksize;
|
||||
if ((uss > 0) && (uss * be_lun->blocksize == us) && (uss >= uos) &&
|
||||
((uss & (uss - 1)) == 0) && (uos * be_lun->blocksize == uo)) {
|
||||
be_lun->ublockexp = fls(uss) - 1;
|
||||
be_lun->ublockoff = (uss - uos) % uss;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2162,6 +2214,8 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
|
||||
be_lun->blocksize = 0;
|
||||
be_lun->pblockexp = 0;
|
||||
be_lun->pblockoff = 0;
|
||||
be_lun->ublockexp = 0;
|
||||
be_lun->ublockoff = 0;
|
||||
be_lun->size_blocks = 0;
|
||||
be_lun->size_bytes = 0;
|
||||
be_lun->ctl_be_lun.maxlba = 0;
|
||||
@ -2212,6 +2266,8 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
|
||||
be_lun->ctl_be_lun.blocksize = be_lun->blocksize;
|
||||
be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp;
|
||||
be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff;
|
||||
be_lun->ctl_be_lun.ublockexp = be_lun->ublockexp;
|
||||
be_lun->ctl_be_lun.ublockoff = be_lun->ublockoff;
|
||||
if (be_lun->dispatch == ctl_be_block_dispatch_zvol &&
|
||||
be_lun->blocksize != 0)
|
||||
be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE /
|
||||
@ -2591,6 +2647,8 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
|
||||
be_lun->ctl_be_lun.blocksize = be_lun->blocksize;
|
||||
be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp;
|
||||
be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff;
|
||||
be_lun->ctl_be_lun.ublockexp = be_lun->ublockexp;
|
||||
be_lun->ctl_be_lun.ublockoff = be_lun->ublockoff;
|
||||
if (be_lun->dispatch == ctl_be_block_dispatch_zvol &&
|
||||
be_lun->blocksize != 0)
|
||||
be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE /
|
||||
|
@ -513,7 +513,7 @@ const struct ctl_cmd_entry ctl_cmd_table_a3[32] =
|
||||
CTL_FLAG_DATA_IN |
|
||||
CTL_CMD_FLAG_ALLOW_ON_PR_RESV,
|
||||
CTL_LUN_PAT_NONE,
|
||||
12, {0x0c, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
|
||||
12, {0x0c, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
|
||||
|
||||
/* 0D REPORT SUPPORTED_TASK MANAGEMENT FUNCTIONS */
|
||||
{ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH |
|
||||
|
@ -233,19 +233,34 @@ cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The target MUST silently ignore any non-immediate command outside
|
||||
* of this range.
|
||||
*/
|
||||
if (cmdsn < cs->cs_cmdsn || cmdsn > cs->cs_cmdsn + maxcmdsn_delta) {
|
||||
CFISCSI_SESSION_UNLOCK(cs);
|
||||
CFISCSI_SESSION_WARN(cs, "received PDU with CmdSN %d, "
|
||||
"while expected CmdSN was %d", cmdsn, cs->cs_cmdsn);
|
||||
return (true);
|
||||
}
|
||||
if ((request->ip_bhs->bhs_opcode & ISCSI_BHS_OPCODE_IMMEDIATE) == 0) {
|
||||
/*
|
||||
* The target MUST silently ignore any non-immediate command
|
||||
* outside of this range.
|
||||
*/
|
||||
if (ISCSI_SNLT(cmdsn, cs->cs_cmdsn) ||
|
||||
ISCSI_SNGT(cmdsn, cs->cs_cmdsn + maxcmdsn_delta)) {
|
||||
CFISCSI_SESSION_UNLOCK(cs);
|
||||
CFISCSI_SESSION_WARN(cs, "received PDU with CmdSN %u, "
|
||||
"while expected %u", cmdsn, cs->cs_cmdsn);
|
||||
return (true);
|
||||
}
|
||||
|
||||
if ((request->ip_bhs->bhs_opcode & ISCSI_BHS_OPCODE_IMMEDIATE) == 0)
|
||||
/*
|
||||
* We don't support multiple connections now, so any
|
||||
* discontinuity in CmdSN means lost PDUs. Since we don't
|
||||
* support PDU retransmission -- terminate the connection.
|
||||
*/
|
||||
if (cmdsn != cs->cs_cmdsn) {
|
||||
CFISCSI_SESSION_UNLOCK(cs);
|
||||
CFISCSI_SESSION_WARN(cs, "received PDU with CmdSN %u, "
|
||||
"while expected %u; dropping connection",
|
||||
cmdsn, cs->cs_cmdsn);
|
||||
cfiscsi_session_terminate(cs);
|
||||
return (true);
|
||||
}
|
||||
cs->cs_cmdsn++;
|
||||
}
|
||||
|
||||
CFISCSI_SESSION_UNLOCK(cs);
|
||||
|
||||
@ -892,6 +907,16 @@ cfiscsi_pdu_handle_data_out(struct icl_pdu *request)
|
||||
return;
|
||||
}
|
||||
|
||||
if (cdw->cdw_datasn != ntohl(bhsdo->bhsdo_datasn)) {
|
||||
CFISCSI_SESSION_WARN(cs, "received Data-Out PDU with "
|
||||
"DataSN %u, while expected %u; dropping connection",
|
||||
ntohl(bhsdo->bhsdo_datasn), cdw->cdw_datasn);
|
||||
icl_pdu_free(request);
|
||||
cfiscsi_session_terminate(cs);
|
||||
return;
|
||||
}
|
||||
cdw->cdw_datasn++;
|
||||
|
||||
io = cdw->cdw_ctl_io;
|
||||
KASSERT((io->io_hdr.flags & CTL_FLAG_DATA_MASK) != CTL_FLAG_DATA_IN,
|
||||
("CTL_FLAG_DATA_IN"));
|
||||
@ -2650,6 +2675,7 @@ cfiscsi_datamove_out(union ctl_io *io)
|
||||
cdw->cdw_target_transfer_tag = target_transfer_tag;
|
||||
cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag;
|
||||
cdw->cdw_r2t_end = io->scsiio.kern_data_len;
|
||||
cdw->cdw_datasn = 0;
|
||||
|
||||
/* Set initial data pointer for the CDW respecting ext_data_filled. */
|
||||
if (io->scsiio.kern_sg_entries > 0) {
|
||||
|
@ -58,6 +58,7 @@ struct cfiscsi_data_wait {
|
||||
char *cdw_sg_addr;
|
||||
size_t cdw_sg_len;
|
||||
uint32_t cdw_r2t_end;
|
||||
uint32_t cdw_datasn;
|
||||
};
|
||||
|
||||
#define CFISCSI_SESSION_STATE_INVALID 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -223,11 +223,8 @@ dbuf_evict_user(dmu_buf_impl_t *db)
|
||||
if (db->db_level != 0 || db->db_evict_func == NULL)
|
||||
return;
|
||||
|
||||
if (db->db_user_data_ptr_ptr)
|
||||
*db->db_user_data_ptr_ptr = db->db.db_data;
|
||||
db->db_evict_func(&db->db, db->db_user_ptr);
|
||||
db->db_user_ptr = NULL;
|
||||
db->db_user_data_ptr_ptr = NULL;
|
||||
db->db_evict_func = NULL;
|
||||
}
|
||||
|
||||
@ -417,16 +414,6 @@ dbuf_verify(dmu_buf_impl_t *db)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
dbuf_update_data(dmu_buf_impl_t *db)
|
||||
{
|
||||
ASSERT(MUTEX_HELD(&db->db_mtx));
|
||||
if (db->db_level == 0 && db->db_user_data_ptr_ptr) {
|
||||
ASSERT(!refcount_is_zero(&db->db_holds));
|
||||
*db->db_user_data_ptr_ptr = db->db.db_data;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf)
|
||||
{
|
||||
@ -437,7 +424,6 @@ dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf)
|
||||
db->db.db_data = buf->b_data;
|
||||
if (!arc_released(buf))
|
||||
arc_set_callback(buf, dbuf_do_evict, db);
|
||||
dbuf_update_data(db);
|
||||
} else {
|
||||
dbuf_evict_user(db);
|
||||
db->db.db_data = NULL;
|
||||
@ -521,7 +507,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags)
|
||||
{
|
||||
dnode_t *dn;
|
||||
zbookmark_phys_t zb;
|
||||
uint32_t aflags = ARC_NOWAIT;
|
||||
arc_flags_t aflags = ARC_FLAG_NOWAIT;
|
||||
|
||||
DB_DNODE_ENTER(db);
|
||||
dn = DB_DNODE(db);
|
||||
@ -543,7 +529,6 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags)
|
||||
if (bonuslen)
|
||||
bcopy(DN_BONUS(dn->dn_phys), db->db.db_data, bonuslen);
|
||||
DB_DNODE_EXIT(db);
|
||||
dbuf_update_data(db);
|
||||
db->db_state = DB_CACHED;
|
||||
mutex_exit(&db->db_mtx);
|
||||
return;
|
||||
@ -575,9 +560,9 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags)
|
||||
mutex_exit(&db->db_mtx);
|
||||
|
||||
if (DBUF_IS_L2CACHEABLE(db))
|
||||
aflags |= ARC_L2CACHE;
|
||||
aflags |= ARC_FLAG_L2CACHE;
|
||||
if (DBUF_IS_L2COMPRESSIBLE(db))
|
||||
aflags |= ARC_L2COMPRESS;
|
||||
aflags |= ARC_FLAG_L2COMPRESS;
|
||||
|
||||
SET_BOOKMARK(&zb, db->db_objset->os_dsl_dataset ?
|
||||
db->db_objset->os_dsl_dataset->ds_object : DMU_META_OBJSET,
|
||||
@ -589,7 +574,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags)
|
||||
dbuf_read_done, db, ZIO_PRIORITY_SYNC_READ,
|
||||
(*flags & DB_RF_CANFAIL) ? ZIO_FLAG_CANFAIL : ZIO_FLAG_MUSTSUCCEED,
|
||||
&aflags, &zb);
|
||||
if (aflags & ARC_CACHED)
|
||||
if (aflags & ARC_FLAG_CACHED)
|
||||
*flags |= DB_RF_CACHED;
|
||||
}
|
||||
|
||||
@ -1726,7 +1711,6 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid,
|
||||
db->db_blkptr = blkptr;
|
||||
|
||||
db->db_user_ptr = NULL;
|
||||
db->db_user_data_ptr_ptr = NULL;
|
||||
db->db_evict_func = NULL;
|
||||
db->db_immediate_evict = 0;
|
||||
db->db_freed_in_flight = 0;
|
||||
@ -1879,7 +1863,8 @@ dbuf_prefetch(dnode_t *dn, uint64_t blkid, zio_priority_t prio)
|
||||
if (dbuf_findbp(dn, 0, blkid, TRUE, &db, &bp) == 0) {
|
||||
if (bp && !BP_IS_HOLE(bp) && !BP_IS_EMBEDDED(bp)) {
|
||||
dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset;
|
||||
uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH;
|
||||
arc_flags_t aflags =
|
||||
ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH;
|
||||
zbookmark_phys_t zb;
|
||||
|
||||
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
|
||||
@ -1971,7 +1956,6 @@ dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid, int fail_sparse,
|
||||
}
|
||||
|
||||
(void) refcount_add(&db->db_holds, tag);
|
||||
dbuf_update_data(db);
|
||||
DBUF_VERIFY(db);
|
||||
mutex_exit(&db->db_mtx);
|
||||
|
||||
@ -2182,27 +2166,25 @@ dbuf_refcount(dmu_buf_impl_t *db)
|
||||
}
|
||||
|
||||
void *
|
||||
dmu_buf_set_user(dmu_buf_t *db_fake, void *user_ptr, void *user_data_ptr_ptr,
|
||||
dmu_buf_set_user(dmu_buf_t *db_fake, void *user_ptr,
|
||||
dmu_buf_evict_func_t *evict_func)
|
||||
{
|
||||
return (dmu_buf_update_user(db_fake, NULL, user_ptr,
|
||||
user_data_ptr_ptr, evict_func));
|
||||
return (dmu_buf_update_user(db_fake, NULL, user_ptr, evict_func));
|
||||
}
|
||||
|
||||
void *
|
||||
dmu_buf_set_user_ie(dmu_buf_t *db_fake, void *user_ptr, void *user_data_ptr_ptr,
|
||||
dmu_buf_set_user_ie(dmu_buf_t *db_fake, void *user_ptr,
|
||||
dmu_buf_evict_func_t *evict_func)
|
||||
{
|
||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake;
|
||||
|
||||
db->db_immediate_evict = TRUE;
|
||||
return (dmu_buf_update_user(db_fake, NULL, user_ptr,
|
||||
user_data_ptr_ptr, evict_func));
|
||||
return (dmu_buf_update_user(db_fake, NULL, user_ptr, evict_func));
|
||||
}
|
||||
|
||||
void *
|
||||
dmu_buf_update_user(dmu_buf_t *db_fake, void *old_user_ptr, void *user_ptr,
|
||||
void *user_data_ptr_ptr, dmu_buf_evict_func_t *evict_func)
|
||||
dmu_buf_evict_func_t *evict_func)
|
||||
{
|
||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake;
|
||||
ASSERT(db->db_level == 0);
|
||||
@ -2213,10 +2195,7 @@ dmu_buf_update_user(dmu_buf_t *db_fake, void *old_user_ptr, void *user_ptr,
|
||||
|
||||
if (db->db_user_ptr == old_user_ptr) {
|
||||
db->db_user_ptr = user_ptr;
|
||||
db->db_user_data_ptr_ptr = user_data_ptr_ptr;
|
||||
db->db_evict_func = evict_func;
|
||||
|
||||
dbuf_update_data(db);
|
||||
} else {
|
||||
old_user_ptr = db->db_user_ptr;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ diff_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
} else if (zb->zb_level == 0) {
|
||||
dnode_phys_t *blk;
|
||||
arc_buf_t *abuf;
|
||||
uint32_t aflags = ARC_WAIT;
|
||||
arc_flags_t aflags = ARC_FLAG_WAIT;
|
||||
int blksz = BP_GET_LSIZE(bp);
|
||||
int i;
|
||||
|
||||
@ -221,7 +221,7 @@ dmu_diff(const char *tosnap_name, const char *fromsnap_name,
|
||||
return (SET_ERROR(EXDEV));
|
||||
}
|
||||
|
||||
fromtxg = fromsnap->ds_phys->ds_creation_txg;
|
||||
fromtxg = dsl_dataset_phys(fromsnap)->ds_creation_txg;
|
||||
dsl_dataset_rele(fromsnap, FTAG);
|
||||
|
||||
dsl_dataset_long_hold(tosnap, FTAG);
|
||||
|
@ -293,15 +293,15 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
|
||||
os->os_spa = spa;
|
||||
os->os_rootbp = bp;
|
||||
if (!BP_IS_HOLE(os->os_rootbp)) {
|
||||
uint32_t aflags = ARC_WAIT;
|
||||
arc_flags_t aflags = ARC_FLAG_WAIT;
|
||||
zbookmark_phys_t zb;
|
||||
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
|
||||
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
|
||||
|
||||
if (DMU_OS_IS_L2CACHEABLE(os))
|
||||
aflags |= ARC_L2CACHE;
|
||||
aflags |= ARC_FLAG_L2CACHE;
|
||||
if (DMU_OS_IS_L2COMPRESSIBLE(os))
|
||||
aflags |= ARC_L2COMPRESS;
|
||||
aflags |= ARC_FLAG_L2COMPRESS;
|
||||
|
||||
dprintf_bp(os->os_rootbp, "reading %s", "");
|
||||
err = arc_read(NULL, spa, os->os_rootbp,
|
||||
@ -1479,12 +1479,12 @@ dmu_snapshot_realname(objset_t *os, char *name, char *real, int maxlen,
|
||||
dsl_dataset_t *ds = os->os_dsl_dataset;
|
||||
uint64_t ignored;
|
||||
|
||||
if (ds->ds_phys->ds_snapnames_zapobj == 0)
|
||||
if (dsl_dataset_phys(ds)->ds_snapnames_zapobj == 0)
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
return (zap_lookup_norm(ds->ds_dir->dd_pool->dp_meta_objset,
|
||||
ds->ds_phys->ds_snapnames_zapobj, name, 8, 1, &ignored, MT_FIRST,
|
||||
real, maxlen, conflict));
|
||||
dsl_dataset_phys(ds)->ds_snapnames_zapobj, name, 8, 1, &ignored,
|
||||
MT_FIRST, real, maxlen, conflict));
|
||||
}
|
||||
|
||||
int
|
||||
@ -1497,12 +1497,12 @@ dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
|
||||
|
||||
ASSERT(dsl_pool_config_held(dmu_objset_pool(os)));
|
||||
|
||||
if (ds->ds_phys->ds_snapnames_zapobj == 0)
|
||||
if (dsl_dataset_phys(ds)->ds_snapnames_zapobj == 0)
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
zap_cursor_init_serialized(&cursor,
|
||||
ds->ds_dir->dd_pool->dp_meta_objset,
|
||||
ds->ds_phys->ds_snapnames_zapobj, *offp);
|
||||
dsl_dataset_phys(ds)->ds_snapnames_zapobj, *offp);
|
||||
|
||||
if (zap_cursor_retrieve(&cursor, &attr) != 0) {
|
||||
zap_cursor_fini(&cursor);
|
||||
@ -1536,12 +1536,12 @@ dmu_dir_list_next(objset_t *os, int namelen, char *name,
|
||||
|
||||
/* there is no next dir on a snapshot! */
|
||||
if (os->os_dsl_dataset->ds_object !=
|
||||
dd->dd_phys->dd_head_dataset_obj)
|
||||
dsl_dir_phys(dd)->dd_head_dataset_obj)
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
zap_cursor_init_serialized(&cursor,
|
||||
dd->dd_pool->dp_meta_objset,
|
||||
dd->dd_phys->dd_child_dir_zapobj, *offp);
|
||||
dsl_dir_phys(dd)->dd_child_dir_zapobj, *offp);
|
||||
|
||||
if (zap_cursor_retrieve(&cursor, &attr) != 0) {
|
||||
zap_cursor_fini(&cursor);
|
||||
@ -1589,7 +1589,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj,
|
||||
return (0);
|
||||
}
|
||||
|
||||
thisobj = dd->dd_phys->dd_head_dataset_obj;
|
||||
thisobj = dsl_dir_phys(dd)->dd_head_dataset_obj;
|
||||
attr = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP);
|
||||
|
||||
/*
|
||||
@ -1597,7 +1597,7 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj,
|
||||
*/
|
||||
if (flags & DS_FIND_CHILDREN) {
|
||||
for (zap_cursor_init(&zc, dp->dp_meta_objset,
|
||||
dd->dd_phys->dd_child_dir_zapobj);
|
||||
dsl_dir_phys(dd)->dd_child_dir_zapobj);
|
||||
zap_cursor_retrieve(&zc, attr) == 0;
|
||||
(void) zap_cursor_advance(&zc)) {
|
||||
ASSERT3U(attr->za_integer_length, ==,
|
||||
@ -1626,7 +1626,9 @@ dmu_objset_find_dp(dsl_pool_t *dp, uint64_t ddobj,
|
||||
err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds);
|
||||
|
||||
if (err == 0) {
|
||||
uint64_t snapobj = ds->ds_phys->ds_snapnames_zapobj;
|
||||
uint64_t snapobj;
|
||||
|
||||
snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj;
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
|
||||
for (zap_cursor_init(&zc, dp->dp_meta_objset, snapobj);
|
||||
@ -1701,7 +1703,7 @@ dmu_objset_find_impl(spa_t *spa, const char *name,
|
||||
return (0);
|
||||
}
|
||||
|
||||
thisobj = dd->dd_phys->dd_head_dataset_obj;
|
||||
thisobj = dsl_dir_phys(dd)->dd_head_dataset_obj;
|
||||
attr = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP);
|
||||
|
||||
/*
|
||||
@ -1709,7 +1711,7 @@ dmu_objset_find_impl(spa_t *spa, const char *name,
|
||||
*/
|
||||
if (flags & DS_FIND_CHILDREN) {
|
||||
for (zap_cursor_init(&zc, dp->dp_meta_objset,
|
||||
dd->dd_phys->dd_child_dir_zapobj);
|
||||
dsl_dir_phys(dd)->dd_child_dir_zapobj);
|
||||
zap_cursor_retrieve(&zc, attr) == 0;
|
||||
(void) zap_cursor_advance(&zc)) {
|
||||
ASSERT3U(attr->za_integer_length, ==,
|
||||
@ -1742,7 +1744,9 @@ dmu_objset_find_impl(spa_t *spa, const char *name,
|
||||
err = dsl_dataset_hold_obj(dp, thisobj, FTAG, &ds);
|
||||
|
||||
if (err == 0) {
|
||||
uint64_t snapobj = ds->ds_phys->ds_snapnames_zapobj;
|
||||
uint64_t snapobj;
|
||||
|
||||
snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj;
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
|
||||
for (zap_cursor_init(&zc, dp->dp_meta_objset, snapobj);
|
||||
|
@ -479,7 +479,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
dnode_phys_t *blk;
|
||||
int i;
|
||||
int blksz = BP_GET_LSIZE(bp);
|
||||
uint32_t aflags = ARC_WAIT;
|
||||
arc_flags_t aflags = ARC_FLAG_WAIT;
|
||||
arc_buf_t *abuf;
|
||||
|
||||
if (arc_read(NULL, spa, bp, arc_getbuf_func, &abuf,
|
||||
@ -497,7 +497,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
}
|
||||
(void) arc_buf_remove_ref(abuf, &abuf);
|
||||
} else if (type == DMU_OT_SA) {
|
||||
uint32_t aflags = ARC_WAIT;
|
||||
arc_flags_t aflags = ARC_FLAG_WAIT;
|
||||
arc_buf_t *abuf;
|
||||
int blksz = BP_GET_LSIZE(bp);
|
||||
|
||||
@ -514,7 +514,7 @@ backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
err = dump_write_embedded(dsp, zb->zb_object,
|
||||
zb->zb_blkid * blksz, blksz, bp);
|
||||
} else { /* it's a level-0 block of a regular object */
|
||||
uint32_t aflags = ARC_WAIT;
|
||||
arc_flags_t aflags = ARC_FLAG_WAIT;
|
||||
arc_buf_t *abuf;
|
||||
int blksz = BP_GET_LSIZE(bp);
|
||||
uint64_t offset;
|
||||
@ -623,12 +623,12 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds,
|
||||
featureflags);
|
||||
|
||||
drr->drr_u.drr_begin.drr_creation_time =
|
||||
ds->ds_phys->ds_creation_time;
|
||||
dsl_dataset_phys(ds)->ds_creation_time;
|
||||
drr->drr_u.drr_begin.drr_type = dmu_objset_type(os);
|
||||
if (is_clone)
|
||||
drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CLONE;
|
||||
drr->drr_u.drr_begin.drr_toguid = ds->ds_phys->ds_guid;
|
||||
if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET)
|
||||
drr->drr_u.drr_begin.drr_toguid = dsl_dataset_phys(ds)->ds_guid;
|
||||
if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET)
|
||||
drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CI_DATA;
|
||||
|
||||
if (fromzb != NULL) {
|
||||
@ -650,7 +650,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp, dsl_dataset_t *ds,
|
||||
dsp->dsa_fp = fp;
|
||||
dsp->dsa_os = os;
|
||||
dsp->dsa_off = off;
|
||||
dsp->dsa_toguid = ds->ds_phys->ds_guid;
|
||||
dsp->dsa_toguid = dsl_dataset_phys(ds)->ds_guid;
|
||||
ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0);
|
||||
dsp->dsa_pending_op = PENDING_NONE;
|
||||
dsp->dsa_incremental = (fromzb != NULL);
|
||||
@ -740,9 +740,10 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
|
||||
}
|
||||
if (!dsl_dataset_is_before(ds, fromds, 0))
|
||||
err = SET_ERROR(EXDEV);
|
||||
zb.zbm_creation_time = fromds->ds_phys->ds_creation_time;
|
||||
zb.zbm_creation_txg = fromds->ds_phys->ds_creation_txg;
|
||||
zb.zbm_guid = fromds->ds_phys->ds_guid;
|
||||
zb.zbm_creation_time =
|
||||
dsl_dataset_phys(fromds)->ds_creation_time;
|
||||
zb.zbm_creation_txg = dsl_dataset_phys(fromds)->ds_creation_txg;
|
||||
zb.zbm_guid = dsl_dataset_phys(fromds)->ds_guid;
|
||||
is_clone = (fromds->ds_dir != ds->ds_dir);
|
||||
dsl_dataset_rele(fromds, FTAG);
|
||||
err = dmu_send_impl(FTAG, dp, ds, &zb, is_clone,
|
||||
@ -813,10 +814,10 @@ dmu_send(const char *tosnap, const char *fromsnap,
|
||||
if (!dsl_dataset_is_before(ds, fromds, 0))
|
||||
err = SET_ERROR(EXDEV);
|
||||
zb.zbm_creation_time =
|
||||
fromds->ds_phys->ds_creation_time;
|
||||
dsl_dataset_phys(fromds)->ds_creation_time;
|
||||
zb.zbm_creation_txg =
|
||||
fromds->ds_phys->ds_creation_txg;
|
||||
zb.zbm_guid = fromds->ds_phys->ds_guid;
|
||||
dsl_dataset_phys(fromds)->ds_creation_txg;
|
||||
zb.zbm_guid = dsl_dataset_phys(fromds)->ds_guid;
|
||||
is_clone = (ds->ds_dir != fromds->ds_dir);
|
||||
dsl_dataset_rele(fromds, FTAG);
|
||||
}
|
||||
@ -863,7 +864,7 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fromds, uint64_t *sizep)
|
||||
|
||||
/* Get uncompressed size estimate of changed data. */
|
||||
if (fromds == NULL) {
|
||||
size = ds->ds_phys->ds_uncompressed_bytes;
|
||||
size = dsl_dataset_phys(ds)->ds_uncompressed_bytes;
|
||||
} else {
|
||||
uint64_t used, comp;
|
||||
err = dsl_dataset_space_written(fromds, ds,
|
||||
@ -918,15 +919,15 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
|
||||
|
||||
/* temporary clone name must not exist */
|
||||
error = zap_lookup(dp->dp_meta_objset,
|
||||
ds->ds_dir->dd_phys->dd_child_dir_zapobj, recv_clone_name,
|
||||
dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, recv_clone_name,
|
||||
8, 1, &val);
|
||||
if (error != ENOENT)
|
||||
return (error == 0 ? EBUSY : error);
|
||||
|
||||
/* new snapshot name must not exist */
|
||||
error = zap_lookup(dp->dp_meta_objset,
|
||||
ds->ds_phys->ds_snapnames_zapobj, drba->drba_cookie->drc_tosnap,
|
||||
8, 1, &val);
|
||||
dsl_dataset_phys(ds)->ds_snapnames_zapobj,
|
||||
drba->drba_cookie->drc_tosnap, 8, 1, &val);
|
||||
if (error != ENOENT)
|
||||
return (error == 0 ? EEXIST : error);
|
||||
|
||||
@ -946,7 +947,7 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
|
||||
|
||||
if (fromguid != 0) {
|
||||
dsl_dataset_t *snap;
|
||||
uint64_t obj = ds->ds_phys->ds_prev_snap_obj;
|
||||
uint64_t obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
|
||||
/* Find snapshot in this dir that matches fromguid. */
|
||||
while (obj != 0) {
|
||||
@ -958,9 +959,9 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
|
||||
dsl_dataset_rele(snap, FTAG);
|
||||
return (SET_ERROR(ENODEV));
|
||||
}
|
||||
if (snap->ds_phys->ds_guid == fromguid)
|
||||
if (dsl_dataset_phys(snap)->ds_guid == fromguid)
|
||||
break;
|
||||
obj = snap->ds_phys->ds_prev_snap_obj;
|
||||
obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
|
||||
dsl_dataset_rele(snap, FTAG);
|
||||
}
|
||||
if (obj == 0)
|
||||
@ -983,9 +984,9 @@ recv_begin_check_existing_impl(dmu_recv_begin_arg_t *drba, dsl_dataset_t *ds,
|
||||
dsl_dataset_rele(snap, FTAG);
|
||||
} else {
|
||||
/* if full, most recent snapshot must be $ORIGIN */
|
||||
if (ds->ds_phys->ds_prev_snap_txg >= TXG_INITIAL)
|
||||
if (dsl_dataset_phys(ds)->ds_prev_snap_txg >= TXG_INITIAL)
|
||||
return (SET_ERROR(ENODEV));
|
||||
drba->drba_snapobj = ds->ds_phys->ds_prev_snap_obj;
|
||||
drba->drba_snapobj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -1103,7 +1104,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (SET_ERROR(EINVAL));
|
||||
}
|
||||
if (origin->ds_phys->ds_guid != fromguid) {
|
||||
if (dsl_dataset_phys(origin)->ds_guid != fromguid) {
|
||||
dsl_dataset_rele(origin, FTAG);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (SET_ERROR(ENODEV));
|
||||
@ -1174,7 +1175,7 @@ dmu_recv_begin_sync(void *arg, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
dmu_buf_will_dirty(newds->ds_dbuf, tx);
|
||||
newds->ds_phys->ds_flags |= DS_FLAG_INCONSISTENT;
|
||||
dsl_dataset_phys(newds)->ds_flags |= DS_FLAG_INCONSISTENT;
|
||||
|
||||
/*
|
||||
* If we actually created a non-clone, we need to create the
|
||||
@ -1837,7 +1838,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, struct file *fp, offset_t *voffp,
|
||||
*/
|
||||
VERIFY0(dmu_objset_from_ds(drc->drc_ds, &os));
|
||||
|
||||
ASSERT(drc->drc_ds->ds_phys->ds_flags & DS_FLAG_INCONSISTENT);
|
||||
ASSERT(dsl_dataset_phys(drc->drc_ds)->ds_flags & DS_FLAG_INCONSISTENT);
|
||||
|
||||
featureflags = DMU_GET_FEATUREFLAGS(drc->drc_drrb->drr_versioninfo);
|
||||
|
||||
@ -2000,8 +2001,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
|
||||
* the snap before drc_ds, because drc_ds can not
|
||||
* have any snaps of its own).
|
||||
*/
|
||||
uint64_t obj = origin_head->ds_phys->ds_prev_snap_obj;
|
||||
while (obj != drc->drc_ds->ds_phys->ds_prev_snap_obj) {
|
||||
uint64_t obj;
|
||||
|
||||
obj = dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
|
||||
while (obj !=
|
||||
dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj) {
|
||||
dsl_dataset_t *snap;
|
||||
error = dsl_dataset_hold_obj(dp, obj, FTAG,
|
||||
&snap);
|
||||
@ -2013,7 +2017,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
|
||||
error = dsl_destroy_snapshot_check_impl(
|
||||
snap, B_FALSE);
|
||||
}
|
||||
obj = snap->ds_phys->ds_prev_snap_obj;
|
||||
obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
|
||||
dsl_dataset_rele(snap, FTAG);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
@ -2059,13 +2063,16 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
|
||||
* Destroy any snapshots of drc_tofs (origin_head)
|
||||
* after the origin (the snap before drc_ds).
|
||||
*/
|
||||
uint64_t obj = origin_head->ds_phys->ds_prev_snap_obj;
|
||||
while (obj != drc->drc_ds->ds_phys->ds_prev_snap_obj) {
|
||||
uint64_t obj;
|
||||
|
||||
obj = dsl_dataset_phys(origin_head)->ds_prev_snap_obj;
|
||||
while (obj !=
|
||||
dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj) {
|
||||
dsl_dataset_t *snap;
|
||||
VERIFY0(dsl_dataset_hold_obj(dp, obj, FTAG,
|
||||
&snap));
|
||||
ASSERT3P(snap->ds_dir, ==, origin_head->ds_dir);
|
||||
obj = snap->ds_phys->ds_prev_snap_obj;
|
||||
obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
|
||||
dsl_destroy_snapshot_sync_impl(snap,
|
||||
B_FALSE, tx);
|
||||
dsl_dataset_rele(snap, FTAG);
|
||||
@ -2081,15 +2088,16 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
/* set snapshot's creation time and guid */
|
||||
dmu_buf_will_dirty(origin_head->ds_prev->ds_dbuf, tx);
|
||||
origin_head->ds_prev->ds_phys->ds_creation_time =
|
||||
dsl_dataset_phys(origin_head->ds_prev)->ds_creation_time =
|
||||
drc->drc_drrb->drr_creation_time;
|
||||
origin_head->ds_prev->ds_phys->ds_guid =
|
||||
dsl_dataset_phys(origin_head->ds_prev)->ds_guid =
|
||||
drc->drc_drrb->drr_toguid;
|
||||
origin_head->ds_prev->ds_phys->ds_flags &=
|
||||
dsl_dataset_phys(origin_head->ds_prev)->ds_flags &=
|
||||
~DS_FLAG_INCONSISTENT;
|
||||
|
||||
dmu_buf_will_dirty(origin_head->ds_dbuf, tx);
|
||||
origin_head->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT;
|
||||
dsl_dataset_phys(origin_head)->ds_flags &=
|
||||
~DS_FLAG_INCONSISTENT;
|
||||
|
||||
dsl_dataset_rele(origin_head, FTAG);
|
||||
dsl_destroy_head_sync_impl(drc->drc_ds, tx);
|
||||
@ -2103,15 +2111,17 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
/* set snapshot's creation time and guid */
|
||||
dmu_buf_will_dirty(ds->ds_prev->ds_dbuf, tx);
|
||||
ds->ds_prev->ds_phys->ds_creation_time =
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_creation_time =
|
||||
drc->drc_drrb->drr_creation_time;
|
||||
ds->ds_prev->ds_phys->ds_guid = drc->drc_drrb->drr_toguid;
|
||||
ds->ds_prev->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT;
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_guid =
|
||||
drc->drc_drrb->drr_toguid;
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_flags &=
|
||||
~DS_FLAG_INCONSISTENT;
|
||||
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
ds->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT;
|
||||
dsl_dataset_phys(ds)->ds_flags &= ~DS_FLAG_INCONSISTENT;
|
||||
}
|
||||
drc->drc_newsnapobj = drc->drc_ds->ds_phys->ds_prev_snap_obj;
|
||||
drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj;
|
||||
/*
|
||||
* Release the hold from dmu_recv_begin. This must be done before
|
||||
* we return to open context, so that when we free the dataset's dnode,
|
||||
@ -2137,7 +2147,7 @@ add_ds_to_guidmap(const char *name, avl_tree_t *guid_map, uint64_t snapobj)
|
||||
gmep = kmem_alloc(sizeof (*gmep), KM_SLEEP);
|
||||
err = dsl_dataset_hold_obj(dp, snapobj, gmep, &snapds);
|
||||
if (err == 0) {
|
||||
gmep->guid = snapds->ds_phys->ds_guid;
|
||||
gmep->guid = dsl_dataset_phys(snapds)->ds_guid;
|
||||
gmep->gme_ds = snapds;
|
||||
avl_add(guid_map, gmep);
|
||||
dsl_dataset_long_hold(snapds, gmep);
|
||||
|
@ -178,7 +178,7 @@ static void
|
||||
traverse_prefetch_metadata(traverse_data_t *td,
|
||||
const blkptr_t *bp, const zbookmark_phys_t *zb)
|
||||
{
|
||||
uint32_t flags = ARC_NOWAIT | ARC_PREFETCH;
|
||||
arc_flags_t flags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH;
|
||||
|
||||
if (!(td->td_flags & TRAVERSE_PREFETCH_METADATA))
|
||||
return;
|
||||
@ -275,7 +275,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
|
||||
}
|
||||
|
||||
if (BP_GET_LEVEL(bp) > 0) {
|
||||
uint32_t flags = ARC_WAIT;
|
||||
arc_flags_t flags = ARC_FLAG_WAIT;
|
||||
int i;
|
||||
blkptr_t *cbp;
|
||||
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
|
||||
@ -303,7 +303,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
|
||||
break;
|
||||
}
|
||||
} else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) {
|
||||
uint32_t flags = ARC_WAIT;
|
||||
arc_flags_t flags = ARC_FLAG_WAIT;
|
||||
int i;
|
||||
int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT;
|
||||
|
||||
@ -326,7 +326,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
|
||||
break;
|
||||
}
|
||||
} else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) {
|
||||
uint32_t flags = ARC_WAIT;
|
||||
arc_flags_t flags = ARC_FLAG_WAIT;
|
||||
objset_phys_t *osp;
|
||||
dnode_phys_t *dnp;
|
||||
|
||||
@ -442,7 +442,7 @@ traverse_prefetcher(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg)
|
||||
{
|
||||
prefetch_data_t *pfd = arg;
|
||||
uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH;
|
||||
arc_flags_t aflags = ARC_FLAG_NOWAIT | ARC_FLAG_PREFETCH;
|
||||
|
||||
ASSERT(pfd->pd_blks_fetched >= 0);
|
||||
if (pfd->pd_cancel)
|
||||
@ -533,7 +533,7 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp,
|
||||
|
||||
/* See comment on ZIL traversal in dsl_scan_visitds. */
|
||||
if (ds != NULL && !dsl_dataset_is_snapshot(ds) && !BP_IS_HOLE(rootbp)) {
|
||||
uint32_t flags = ARC_WAIT;
|
||||
arc_flags_t flags = ARC_FLAG_WAIT;
|
||||
objset_phys_t *osp;
|
||||
arc_buf_t *buf;
|
||||
|
||||
@ -579,7 +579,7 @@ traverse_dataset(dsl_dataset_t *ds, uint64_t txg_start, int flags,
|
||||
blkptr_cb_t func, void *arg)
|
||||
{
|
||||
return (traverse_impl(ds->ds_dir->dd_pool->dp_spa, ds, ds->ds_object,
|
||||
&ds->ds_phys->ds_bp, txg_start, NULL, flags, func, arg));
|
||||
&dsl_dataset_phys(ds)->ds_bp, txg_start, NULL, flags, func, arg));
|
||||
}
|
||||
|
||||
int
|
||||
@ -634,8 +634,8 @@ traverse_pool(spa_t *spa, uint64_t txg_start, int flags,
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (ds->ds_phys->ds_prev_snap_txg > txg)
|
||||
txg = ds->ds_phys->ds_prev_snap_txg;
|
||||
if (dsl_dataset_phys(ds)->ds_prev_snap_txg > txg)
|
||||
txg = dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
err = traverse_dataset(ds, txg, flags, func, arg);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
if (err != 0)
|
||||
|
@ -714,6 +714,7 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name)
|
||||
{
|
||||
dmu_tx_hold_t *txh;
|
||||
dnode_t *dn;
|
||||
dsl_dataset_phys_t *ds_phys;
|
||||
uint64_t nblocks;
|
||||
int epbs, err;
|
||||
|
||||
@ -788,8 +789,9 @@ dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name)
|
||||
* we'll have to modify an indirect twig for each.
|
||||
*/
|
||||
epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT;
|
||||
ds_phys = dsl_dataset_phys(dn->dn_objset->os_dsl_dataset);
|
||||
for (nblocks = dn->dn_maxblkid >> epbs; nblocks != 0; nblocks >>= epbs)
|
||||
if (dn->dn_objset->os_dsl_dataset->ds_phys->ds_prev_snap_obj)
|
||||
if (ds_phys->ds_prev_snap_obj)
|
||||
txh->txh_space_towrite += 3 << dn->dn_indblkshift;
|
||||
else
|
||||
txh->txh_space_tooverwrite += 3 << dn->dn_indblkshift;
|
||||
|
@ -1121,7 +1121,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
|
||||
zrl_init(&dnh[i].dnh_zrlock);
|
||||
dnh[i].dnh_dnode = NULL;
|
||||
}
|
||||
if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL,
|
||||
if (winner = dmu_buf_set_user(&db->db, children_dnodes,
|
||||
dnode_buf_pageout)) {
|
||||
|
||||
for (i = 0; i < epb; i++) {
|
||||
|
@ -65,7 +65,7 @@ dsl_dataset_bmark_lookup(dsl_dataset_t *ds, const char *shortname,
|
||||
if (bmark_zapobj == 0)
|
||||
return (SET_ERROR(ESRCH));
|
||||
|
||||
if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET)
|
||||
if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET)
|
||||
mt = MT_FIRST;
|
||||
else
|
||||
mt = MT_EXACT;
|
||||
@ -208,10 +208,11 @@ dsl_bookmark_create_sync(void *arg, dmu_tx_t *tx)
|
||||
&bmark_fs->ds_bookmarks, tx));
|
||||
}
|
||||
|
||||
bmark_phys.zbm_guid = snapds->ds_phys->ds_guid;
|
||||
bmark_phys.zbm_creation_txg = snapds->ds_phys->ds_creation_txg;
|
||||
bmark_phys.zbm_guid = dsl_dataset_phys(snapds)->ds_guid;
|
||||
bmark_phys.zbm_creation_txg =
|
||||
dsl_dataset_phys(snapds)->ds_creation_txg;
|
||||
bmark_phys.zbm_creation_time =
|
||||
snapds->ds_phys->ds_creation_time;
|
||||
dsl_dataset_phys(snapds)->ds_creation_time;
|
||||
|
||||
VERIFY0(zap_add(mos, bmark_fs->ds_bookmarks,
|
||||
shortname, sizeof (uint64_t),
|
||||
@ -340,7 +341,7 @@ dsl_dataset_bookmark_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx)
|
||||
uint64_t bmark_zapobj = ds->ds_bookmarks;
|
||||
matchtype_t mt;
|
||||
|
||||
if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET)
|
||||
if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET)
|
||||
mt = MT_FIRST;
|
||||
else
|
||||
mt = MT_EXACT;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -308,8 +308,9 @@ dsl_deadlist_regenerate(objset_t *os, uint64_t dlobj,
|
||||
while (mrs_obj != 0) {
|
||||
dsl_dataset_t *ds;
|
||||
VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, mrs_obj, FTAG, &ds));
|
||||
dsl_deadlist_add_key(&dl, ds->ds_phys->ds_prev_snap_txg, tx);
|
||||
mrs_obj = ds->ds_phys->ds_prev_snap_obj;
|
||||
dsl_deadlist_add_key(&dl,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg, tx);
|
||||
mrs_obj = dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
}
|
||||
dsl_deadlist_close(&dl);
|
||||
|
@ -164,10 +164,10 @@ dsl_deleg_set_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
VERIFY0(dsl_dir_hold(dp, dda->dda_name, FTAG, &dd, NULL));
|
||||
|
||||
zapobj = dd->dd_phys->dd_deleg_zapobj;
|
||||
zapobj = dsl_dir_phys(dd)->dd_deleg_zapobj;
|
||||
if (zapobj == 0) {
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
zapobj = dd->dd_phys->dd_deleg_zapobj = zap_create(mos,
|
||||
zapobj = dsl_dir_phys(dd)->dd_deleg_zapobj = zap_create(mos,
|
||||
DMU_OT_DSL_PERMS, DMU_OT_NONE, 0, tx);
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ dsl_deleg_unset_sync(void *arg, dmu_tx_t *tx)
|
||||
uint64_t zapobj;
|
||||
|
||||
VERIFY0(dsl_dir_hold(dp, dda->dda_name, FTAG, &dd, NULL));
|
||||
zapobj = dd->dd_phys->dd_deleg_zapobj;
|
||||
zapobj = dsl_dir_phys(dd)->dd_deleg_zapobj;
|
||||
if (zapobj == 0) {
|
||||
dsl_dir_rele(dd, FTAG);
|
||||
return;
|
||||
@ -332,14 +332,14 @@ dsl_deleg_get(const char *ddname, nvlist_t **nvp)
|
||||
uint64_t n;
|
||||
char source[MAXNAMELEN];
|
||||
|
||||
if (dd->dd_phys->dd_deleg_zapobj == 0 ||
|
||||
zap_count(mos, dd->dd_phys->dd_deleg_zapobj, &n) != 0 ||
|
||||
n == 0)
|
||||
if (dsl_dir_phys(dd)->dd_deleg_zapobj == 0 ||
|
||||
zap_count(mos,
|
||||
dsl_dir_phys(dd)->dd_deleg_zapobj, &n) != 0 || n == 0)
|
||||
continue;
|
||||
|
||||
sp_nvp = fnvlist_alloc();
|
||||
for (zap_cursor_init(&basezc, mos,
|
||||
dd->dd_phys->dd_deleg_zapobj);
|
||||
dsl_dir_phys(dd)->dd_deleg_zapobj);
|
||||
zap_cursor_retrieve(&basezc, &baseza) == 0;
|
||||
zap_cursor_advance(&basezc)) {
|
||||
zap_cursor_t zc;
|
||||
@ -594,7 +594,7 @@ dsl_deleg_access_impl(dsl_dataset_t *ds, const char *perm, cred_t *cr)
|
||||
if (!zoned)
|
||||
break;
|
||||
}
|
||||
zapobj = dd->dd_phys->dd_deleg_zapobj;
|
||||
zapobj = dsl_dir_phys(dd)->dd_deleg_zapobj;
|
||||
|
||||
if (zapobj == 0)
|
||||
continue;
|
||||
@ -673,7 +673,7 @@ copy_create_perms(dsl_dir_t *dd, uint64_t pzapobj,
|
||||
{
|
||||
objset_t *mos = dd->dd_pool->dp_meta_objset;
|
||||
uint64_t jumpobj, pjumpobj;
|
||||
uint64_t zapobj = dd->dd_phys->dd_deleg_zapobj;
|
||||
uint64_t zapobj = dsl_dir_phys(dd)->dd_deleg_zapobj;
|
||||
zap_cursor_t zc;
|
||||
zap_attribute_t za;
|
||||
char whokey[ZFS_MAX_DELEG_NAME];
|
||||
@ -686,7 +686,7 @@ copy_create_perms(dsl_dir_t *dd, uint64_t pzapobj,
|
||||
|
||||
if (zapobj == 0) {
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
zapobj = dd->dd_phys->dd_deleg_zapobj = zap_create(mos,
|
||||
zapobj = dsl_dir_phys(dd)->dd_deleg_zapobj = zap_create(mos,
|
||||
DMU_OT_DSL_PERMS, DMU_OT_NONE, 0, tx);
|
||||
}
|
||||
|
||||
@ -724,7 +724,7 @@ dsl_deleg_set_create_perms(dsl_dir_t *sdd, dmu_tx_t *tx, cred_t *cr)
|
||||
return;
|
||||
|
||||
for (dd = sdd->dd_parent; dd != NULL; dd = dd->dd_parent) {
|
||||
uint64_t pzapobj = dd->dd_phys->dd_deleg_zapobj;
|
||||
uint64_t pzapobj = dsl_dir_phys(dd)->dd_deleg_zapobj;
|
||||
|
||||
if (pzapobj == 0)
|
||||
continue;
|
||||
|
@ -78,7 +78,7 @@ dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boolean_t defer)
|
||||
/*
|
||||
* Can't delete a branch point.
|
||||
*/
|
||||
if (ds->ds_phys->ds_num_children > 1)
|
||||
if (dsl_dataset_phys(ds)->ds_num_children > 1)
|
||||
return (SET_ERROR(EEXIST));
|
||||
|
||||
return (0);
|
||||
@ -147,12 +147,12 @@ process_old_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
|
||||
ASSERT(!BP_IS_HOLE(bp));
|
||||
|
||||
if (bp->blk_birth <= poa->ds->ds_phys->ds_prev_snap_txg) {
|
||||
if (bp->blk_birth <= dsl_dataset_phys(poa->ds)->ds_prev_snap_txg) {
|
||||
dsl_deadlist_insert(&poa->ds->ds_deadlist, bp, tx);
|
||||
if (poa->ds_prev && !poa->after_branch_point &&
|
||||
bp->blk_birth >
|
||||
poa->ds_prev->ds_phys->ds_prev_snap_txg) {
|
||||
poa->ds_prev->ds_phys->ds_unique_bytes +=
|
||||
dsl_dataset_phys(poa->ds_prev)->ds_prev_snap_txg) {
|
||||
dsl_dataset_phys(poa->ds_prev)->ds_unique_bytes +=
|
||||
bp_get_dsize_sync(dp->dp_spa, bp);
|
||||
}
|
||||
} else {
|
||||
@ -183,7 +183,7 @@ process_old_deadlist(dsl_dataset_t *ds, dsl_dataset_t *ds_prev,
|
||||
VERIFY0(bpobj_iterate(&ds_next->ds_deadlist.dl_bpobj,
|
||||
process_old_cb, &poa, tx));
|
||||
VERIFY0(zio_wait(poa.pio));
|
||||
ASSERT3U(poa.used, ==, ds->ds_phys->ds_unique_bytes);
|
||||
ASSERT3U(poa.used, ==, dsl_dataset_phys(ds)->ds_unique_bytes);
|
||||
|
||||
/* change snapused */
|
||||
dsl_dir_diduse_space(ds->ds_dir, DD_USED_SNAP,
|
||||
@ -192,12 +192,14 @@ process_old_deadlist(dsl_dataset_t *ds, dsl_dataset_t *ds_prev,
|
||||
/* swap next's deadlist to our deadlist */
|
||||
dsl_deadlist_close(&ds->ds_deadlist);
|
||||
dsl_deadlist_close(&ds_next->ds_deadlist);
|
||||
deadlist_obj = ds->ds_phys->ds_deadlist_obj;
|
||||
ds->ds_phys->ds_deadlist_obj = ds_next->ds_phys->ds_deadlist_obj;
|
||||
ds_next->ds_phys->ds_deadlist_obj = deadlist_obj;
|
||||
dsl_deadlist_open(&ds->ds_deadlist, mos, ds->ds_phys->ds_deadlist_obj);
|
||||
deadlist_obj = dsl_dataset_phys(ds)->ds_deadlist_obj;
|
||||
dsl_dataset_phys(ds)->ds_deadlist_obj =
|
||||
dsl_dataset_phys(ds_next)->ds_deadlist_obj;
|
||||
dsl_dataset_phys(ds_next)->ds_deadlist_obj = deadlist_obj;
|
||||
dsl_deadlist_open(&ds->ds_deadlist, mos,
|
||||
dsl_dataset_phys(ds)->ds_deadlist_obj);
|
||||
dsl_deadlist_open(&ds_next->ds_deadlist, mos,
|
||||
ds_next->ds_phys->ds_deadlist_obj);
|
||||
dsl_dataset_phys(ds_next)->ds_deadlist_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -212,10 +214,10 @@ dsl_dataset_remove_clones_key(dsl_dataset_t *ds, uint64_t mintxg, dmu_tx_t *tx)
|
||||
* find the clones, but dsl_deadlist_remove_key() is a no-op so it
|
||||
* doesn't matter.
|
||||
*/
|
||||
if (ds->ds_dir->dd_phys->dd_clones == 0)
|
||||
if (dsl_dir_phys(ds->ds_dir)->dd_clones == 0)
|
||||
return;
|
||||
|
||||
for (zap_cursor_init(&zc, mos, ds->ds_dir->dd_phys->dd_clones);
|
||||
for (zap_cursor_init(&zc, mos, dsl_dir_phys(ds->ds_dir)->dd_clones);
|
||||
zap_cursor_retrieve(&zc, &za) == 0;
|
||||
zap_cursor_advance(&zc)) {
|
||||
dsl_dataset_t *clone;
|
||||
@ -243,19 +245,20 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
uint64_t obj;
|
||||
|
||||
ASSERT(RRW_WRITE_HELD(&dp->dp_config_rwlock));
|
||||
ASSERT3U(ds->ds_phys->ds_bp.blk_birth, <=, tx->tx_txg);
|
||||
ASSERT3U(dsl_dataset_phys(ds)->ds_bp.blk_birth, <=, tx->tx_txg);
|
||||
ASSERT(refcount_is_zero(&ds->ds_longholds));
|
||||
|
||||
if (defer &&
|
||||
(ds->ds_userrefs > 0 || ds->ds_phys->ds_num_children > 1)) {
|
||||
(ds->ds_userrefs > 0 ||
|
||||
dsl_dataset_phys(ds)->ds_num_children > 1)) {
|
||||
ASSERT(spa_version(dp->dp_spa) >= SPA_VERSION_USERREFS);
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
ds->ds_phys->ds_flags |= DS_FLAG_DEFER_DESTROY;
|
||||
dsl_dataset_phys(ds)->ds_flags |= DS_FLAG_DEFER_DESTROY;
|
||||
spa_history_log_internal_ds(ds, "defer_destroy", tx, "");
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT3U(ds->ds_phys->ds_num_children, <=, 1);
|
||||
ASSERT3U(dsl_dataset_phys(ds)->ds_num_children, <=, 1);
|
||||
|
||||
/* We need to log before removing it from the namespace. */
|
||||
spa_history_log_internal_ds(ds, "destroy", tx, "");
|
||||
@ -268,26 +271,28 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
ASSERT0(zap_contains(mos, obj, DS_FIELD_LARGE_BLOCKS));
|
||||
spa_feature_decr(dp->dp_spa, SPA_FEATURE_LARGE_BLOCKS, tx);
|
||||
}
|
||||
if (ds->ds_phys->ds_prev_snap_obj != 0) {
|
||||
if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) {
|
||||
ASSERT3P(ds->ds_prev, ==, NULL);
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_phys->ds_prev_snap_obj, FTAG, &ds_prev));
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj, FTAG, &ds_prev));
|
||||
after_branch_point =
|
||||
(ds_prev->ds_phys->ds_next_snap_obj != obj);
|
||||
(dsl_dataset_phys(ds_prev)->ds_next_snap_obj != obj);
|
||||
|
||||
dmu_buf_will_dirty(ds_prev->ds_dbuf, tx);
|
||||
if (after_branch_point &&
|
||||
ds_prev->ds_phys->ds_next_clones_obj != 0) {
|
||||
dsl_dataset_phys(ds_prev)->ds_next_clones_obj != 0) {
|
||||
dsl_dataset_remove_from_next_clones(ds_prev, obj, tx);
|
||||
if (ds->ds_phys->ds_next_snap_obj != 0) {
|
||||
if (dsl_dataset_phys(ds)->ds_next_snap_obj != 0) {
|
||||
VERIFY0(zap_add_int(mos,
|
||||
ds_prev->ds_phys->ds_next_clones_obj,
|
||||
ds->ds_phys->ds_next_snap_obj, tx));
|
||||
dsl_dataset_phys(ds_prev)->
|
||||
ds_next_clones_obj,
|
||||
dsl_dataset_phys(ds)->ds_next_snap_obj,
|
||||
tx));
|
||||
}
|
||||
}
|
||||
if (!after_branch_point) {
|
||||
ds_prev->ds_phys->ds_next_snap_obj =
|
||||
ds->ds_phys->ds_next_snap_obj;
|
||||
dsl_dataset_phys(ds_prev)->ds_next_snap_obj =
|
||||
dsl_dataset_phys(ds)->ds_next_snap_obj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,18 +301,18 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
uint64_t used = 0, comp = 0, uncomp = 0;
|
||||
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_phys->ds_next_snap_obj, FTAG, &ds_next));
|
||||
ASSERT3U(ds_next->ds_phys->ds_prev_snap_obj, ==, obj);
|
||||
dsl_dataset_phys(ds)->ds_next_snap_obj, FTAG, &ds_next));
|
||||
ASSERT3U(dsl_dataset_phys(ds_next)->ds_prev_snap_obj, ==, obj);
|
||||
|
||||
old_unique = ds_next->ds_phys->ds_unique_bytes;
|
||||
old_unique = dsl_dataset_phys(ds_next)->ds_unique_bytes;
|
||||
|
||||
dmu_buf_will_dirty(ds_next->ds_dbuf, tx);
|
||||
ds_next->ds_phys->ds_prev_snap_obj =
|
||||
ds->ds_phys->ds_prev_snap_obj;
|
||||
ds_next->ds_phys->ds_prev_snap_txg =
|
||||
ds->ds_phys->ds_prev_snap_txg;
|
||||
ASSERT3U(ds->ds_phys->ds_prev_snap_txg, ==,
|
||||
ds_prev ? ds_prev->ds_phys->ds_creation_txg : 0);
|
||||
dsl_dataset_phys(ds_next)->ds_prev_snap_obj =
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj;
|
||||
dsl_dataset_phys(ds_next)->ds_prev_snap_txg =
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg;
|
||||
ASSERT3U(dsl_dataset_phys(ds)->ds_prev_snap_txg, ==,
|
||||
ds_prev ? dsl_dataset_phys(ds_prev)->ds_creation_txg : 0);
|
||||
|
||||
if (ds_next->ds_deadlist.dl_oldfmt) {
|
||||
process_old_deadlist(ds, ds_prev, ds_next,
|
||||
@ -316,38 +321,38 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
/* Adjust prev's unique space. */
|
||||
if (ds_prev && !after_branch_point) {
|
||||
dsl_deadlist_space_range(&ds_next->ds_deadlist,
|
||||
ds_prev->ds_phys->ds_prev_snap_txg,
|
||||
ds->ds_phys->ds_prev_snap_txg,
|
||||
dsl_dataset_phys(ds_prev)->ds_prev_snap_txg,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg,
|
||||
&used, &comp, &uncomp);
|
||||
ds_prev->ds_phys->ds_unique_bytes += used;
|
||||
dsl_dataset_phys(ds_prev)->ds_unique_bytes += used;
|
||||
}
|
||||
|
||||
/* Adjust snapused. */
|
||||
dsl_deadlist_space_range(&ds_next->ds_deadlist,
|
||||
ds->ds_phys->ds_prev_snap_txg, UINT64_MAX,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg, UINT64_MAX,
|
||||
&used, &comp, &uncomp);
|
||||
dsl_dir_diduse_space(ds->ds_dir, DD_USED_SNAP,
|
||||
-used, -comp, -uncomp, tx);
|
||||
|
||||
/* Move blocks to be freed to pool's free list. */
|
||||
dsl_deadlist_move_bpobj(&ds_next->ds_deadlist,
|
||||
&dp->dp_free_bpobj, ds->ds_phys->ds_prev_snap_txg,
|
||||
&dp->dp_free_bpobj, dsl_dataset_phys(ds)->ds_prev_snap_txg,
|
||||
tx);
|
||||
dsl_dir_diduse_space(tx->tx_pool->dp_free_dir,
|
||||
DD_USED_HEAD, used, comp, uncomp, tx);
|
||||
|
||||
/* Merge our deadlist into next's and free it. */
|
||||
dsl_deadlist_merge(&ds_next->ds_deadlist,
|
||||
ds->ds_phys->ds_deadlist_obj, tx);
|
||||
dsl_dataset_phys(ds)->ds_deadlist_obj, tx);
|
||||
}
|
||||
dsl_deadlist_close(&ds->ds_deadlist);
|
||||
dsl_deadlist_free(mos, ds->ds_phys->ds_deadlist_obj, tx);
|
||||
dsl_deadlist_free(mos, dsl_dataset_phys(ds)->ds_deadlist_obj, tx);
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
ds->ds_phys->ds_deadlist_obj = 0;
|
||||
dsl_dataset_phys(ds)->ds_deadlist_obj = 0;
|
||||
|
||||
/* Collapse range in clone heads */
|
||||
dsl_dataset_remove_clones_key(ds,
|
||||
ds->ds_phys->ds_creation_txg, tx);
|
||||
dsl_dataset_phys(ds)->ds_creation_txg, tx);
|
||||
|
||||
if (dsl_dataset_is_snapshot(ds_next)) {
|
||||
dsl_dataset_t *ds_nextnext;
|
||||
@ -362,21 +367,22 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
* deadlist).
|
||||
*/
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds_next->ds_phys->ds_next_snap_obj, FTAG, &ds_nextnext));
|
||||
dsl_dataset_phys(ds_next)->ds_next_snap_obj,
|
||||
FTAG, &ds_nextnext));
|
||||
dsl_deadlist_space_range(&ds_nextnext->ds_deadlist,
|
||||
ds->ds_phys->ds_prev_snap_txg,
|
||||
ds->ds_phys->ds_creation_txg,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg,
|
||||
dsl_dataset_phys(ds)->ds_creation_txg,
|
||||
&used, &comp, &uncomp);
|
||||
ds_next->ds_phys->ds_unique_bytes += used;
|
||||
dsl_dataset_phys(ds_next)->ds_unique_bytes += used;
|
||||
dsl_dataset_rele(ds_nextnext, FTAG);
|
||||
ASSERT3P(ds_next->ds_prev, ==, NULL);
|
||||
|
||||
/* Collapse range in this head. */
|
||||
dsl_dataset_t *hds;
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_dir->dd_phys->dd_head_dataset_obj, FTAG, &hds));
|
||||
dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj, FTAG, &hds));
|
||||
dsl_deadlist_remove_key(&hds->ds_deadlist,
|
||||
ds->ds_phys->ds_creation_txg, tx);
|
||||
dsl_dataset_phys(ds)->ds_creation_txg, tx);
|
||||
dsl_dataset_rele(hds, FTAG);
|
||||
|
||||
} else {
|
||||
@ -385,7 +391,7 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
ds_next->ds_prev = NULL;
|
||||
if (ds_prev) {
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_phys->ds_prev_snap_obj,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj,
|
||||
ds_next, &ds_next->ds_prev));
|
||||
}
|
||||
|
||||
@ -399,7 +405,7 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
if (old_unique < ds_next->ds_reserved) {
|
||||
int64_t mrsdelta;
|
||||
uint64_t new_unique =
|
||||
ds_next->ds_phys->ds_unique_bytes;
|
||||
dsl_dataset_phys(ds_next)->ds_unique_bytes;
|
||||
|
||||
ASSERT(old_unique <= new_unique);
|
||||
mrsdelta = MIN(new_unique - old_unique,
|
||||
@ -421,9 +427,9 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
|
||||
/* remove from snapshot namespace */
|
||||
dsl_dataset_t *ds_head;
|
||||
ASSERT(ds->ds_phys->ds_snapnames_zapobj == 0);
|
||||
ASSERT(dsl_dataset_phys(ds)->ds_snapnames_zapobj == 0);
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_dir->dd_phys->dd_head_dataset_obj, FTAG, &ds_head));
|
||||
dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj, FTAG, &ds_head));
|
||||
VERIFY0(dsl_dataset_get_snapname(ds));
|
||||
#ifdef ZFS_DEBUG
|
||||
{
|
||||
@ -443,17 +449,20 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, boolean_t defer, dmu_tx_t *tx)
|
||||
|
||||
spa_prop_clear_bootfs(dp->dp_spa, ds->ds_object, tx);
|
||||
|
||||
if (ds->ds_phys->ds_next_clones_obj != 0) {
|
||||
if (dsl_dataset_phys(ds)->ds_next_clones_obj != 0) {
|
||||
uint64_t count;
|
||||
ASSERT0(zap_count(mos,
|
||||
ds->ds_phys->ds_next_clones_obj, &count) && count == 0);
|
||||
dsl_dataset_phys(ds)->ds_next_clones_obj, &count) &&
|
||||
count == 0);
|
||||
VERIFY0(dmu_object_free(mos,
|
||||
ds->ds_phys->ds_next_clones_obj, tx));
|
||||
dsl_dataset_phys(ds)->ds_next_clones_obj, tx));
|
||||
}
|
||||
if (ds->ds_phys->ds_props_obj != 0)
|
||||
VERIFY0(zap_destroy(mos, ds->ds_phys->ds_props_obj, tx));
|
||||
if (ds->ds_phys->ds_userrefs_obj != 0)
|
||||
VERIFY0(zap_destroy(mos, ds->ds_phys->ds_userrefs_obj, tx));
|
||||
if (dsl_dataset_phys(ds)->ds_props_obj != 0)
|
||||
VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_props_obj,
|
||||
tx));
|
||||
if (dsl_dataset_phys(ds)->ds_userrefs_obj != 0)
|
||||
VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_userrefs_obj,
|
||||
tx));
|
||||
dsl_dir_rele(ds->ds_dir, ds);
|
||||
ds->ds_dir = NULL;
|
||||
dmu_object_free_zapified(mos, obj, tx);
|
||||
@ -555,7 +564,8 @@ kill_blkptr(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
dsl_free(ka->tx->tx_pool, ka->tx->tx_txg, bp);
|
||||
} else {
|
||||
ASSERT(zilog == NULL);
|
||||
ASSERT3U(bp->blk_birth, >, ka->ds->ds_phys->ds_prev_snap_txg);
|
||||
ASSERT3U(bp->blk_birth, >,
|
||||
dsl_dataset_phys(ka->ds)->ds_prev_snap_txg);
|
||||
(void) dsl_dataset_block_kill(ka->ds, bp, tx, B_FALSE);
|
||||
}
|
||||
|
||||
@ -577,9 +587,10 @@ old_synchronous_dataset_destroy(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
ka.ds = ds;
|
||||
ka.tx = tx;
|
||||
VERIFY0(traverse_dataset(ds,
|
||||
ds->ds_phys->ds_prev_snap_txg, TRAVERSE_POST,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg, TRAVERSE_POST,
|
||||
kill_blkptr, &ka));
|
||||
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0);
|
||||
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) ||
|
||||
dsl_dataset_phys(ds)->ds_unique_bytes == 0);
|
||||
}
|
||||
|
||||
typedef struct dsl_destroy_head_arg {
|
||||
@ -608,21 +619,21 @@ dsl_destroy_head_check_impl(dsl_dataset_t *ds, int expected_holds)
|
||||
* from.)
|
||||
*/
|
||||
if (ds->ds_prev != NULL &&
|
||||
ds->ds_prev->ds_phys->ds_next_snap_obj == ds->ds_object)
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_next_snap_obj == ds->ds_object)
|
||||
return (SET_ERROR(EBUSY));
|
||||
|
||||
/*
|
||||
* Can't delete if there are children of this fs.
|
||||
*/
|
||||
error = zap_count(mos,
|
||||
ds->ds_dir->dd_phys->dd_child_dir_zapobj, &count);
|
||||
dsl_dir_phys(ds->ds_dir)->dd_child_dir_zapobj, &count);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
if (count != 0)
|
||||
return (SET_ERROR(EEXIST));
|
||||
|
||||
if (dsl_dir_is_clone(ds->ds_dir) && DS_IS_DEFER_DESTROY(ds->ds_prev) &&
|
||||
ds->ds_prev->ds_phys->ds_num_children == 2 &&
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_num_children == 2 &&
|
||||
ds->ds_prev->ds_userrefs == 0) {
|
||||
/* We need to remove the origin snapshot as well. */
|
||||
if (!refcount_is_zero(&ds->ds_prev->ds_longholds))
|
||||
@ -660,7 +671,7 @@ dsl_dir_destroy_sync(uint64_t ddobj, dmu_tx_t *tx)
|
||||
|
||||
VERIFY0(dsl_dir_hold_obj(dp, ddobj, NULL, FTAG, &dd));
|
||||
|
||||
ASSERT0(dd->dd_phys->dd_head_dataset_obj);
|
||||
ASSERT0(dsl_dir_phys(dd)->dd_head_dataset_obj);
|
||||
|
||||
/*
|
||||
* Decrement the filesystem count for all parent filesystems.
|
||||
@ -679,16 +690,17 @@ dsl_dir_destroy_sync(uint64_t ddobj, dmu_tx_t *tx)
|
||||
*/
|
||||
dsl_dir_set_reservation_sync_impl(dd, 0, tx);
|
||||
|
||||
ASSERT0(dd->dd_phys->dd_used_bytes);
|
||||
ASSERT0(dd->dd_phys->dd_reserved);
|
||||
ASSERT0(dsl_dir_phys(dd)->dd_used_bytes);
|
||||
ASSERT0(dsl_dir_phys(dd)->dd_reserved);
|
||||
for (t = 0; t < DD_USED_NUM; t++)
|
||||
ASSERT0(dd->dd_phys->dd_used_breakdown[t]);
|
||||
ASSERT0(dsl_dir_phys(dd)->dd_used_breakdown[t]);
|
||||
|
||||
VERIFY0(zap_destroy(mos, dd->dd_phys->dd_child_dir_zapobj, tx));
|
||||
VERIFY0(zap_destroy(mos, dd->dd_phys->dd_props_zapobj, tx));
|
||||
VERIFY0(dsl_deleg_destroy(mos, dd->dd_phys->dd_deleg_zapobj, tx));
|
||||
VERIFY0(zap_destroy(mos, dsl_dir_phys(dd)->dd_child_dir_zapobj, tx));
|
||||
VERIFY0(zap_destroy(mos, dsl_dir_phys(dd)->dd_props_zapobj, tx));
|
||||
VERIFY0(dsl_deleg_destroy(mos, dsl_dir_phys(dd)->dd_deleg_zapobj, tx));
|
||||
VERIFY0(zap_remove(mos,
|
||||
dd->dd_parent->dd_phys->dd_child_dir_zapobj, dd->dd_myname, tx));
|
||||
dsl_dir_phys(dd->dd_parent)->dd_child_dir_zapobj,
|
||||
dd->dd_myname, tx));
|
||||
|
||||
dsl_dir_rele(dd, FTAG);
|
||||
dmu_object_free_zapified(mos, ddobj, tx);
|
||||
@ -702,10 +714,10 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
uint64_t obj, ddobj, prevobj = 0;
|
||||
boolean_t rmorigin;
|
||||
|
||||
ASSERT3U(ds->ds_phys->ds_num_children, <=, 1);
|
||||
ASSERT3U(dsl_dataset_phys(ds)->ds_num_children, <=, 1);
|
||||
ASSERT(ds->ds_prev == NULL ||
|
||||
ds->ds_prev->ds_phys->ds_next_snap_obj != ds->ds_object);
|
||||
ASSERT3U(ds->ds_phys->ds_bp.blk_birth, <=, tx->tx_txg);
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_next_snap_obj != ds->ds_object);
|
||||
ASSERT3U(dsl_dataset_phys(ds)->ds_bp.blk_birth, <=, tx->tx_txg);
|
||||
ASSERT(RRW_WRITE_HELD(&dp->dp_config_rwlock));
|
||||
|
||||
/* We need to log before removing it from the namespace. */
|
||||
@ -713,7 +725,7 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
|
||||
rmorigin = (dsl_dir_is_clone(ds->ds_dir) &&
|
||||
DS_IS_DEFER_DESTROY(ds->ds_prev) &&
|
||||
ds->ds_prev->ds_phys->ds_num_children == 2 &&
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_num_children == 2 &&
|
||||
ds->ds_prev->ds_userrefs == 0);
|
||||
|
||||
/* Remove our reservation. */
|
||||
@ -731,20 +743,21 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
|
||||
obj = ds->ds_object;
|
||||
|
||||
if (ds->ds_phys->ds_prev_snap_obj != 0) {
|
||||
if (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) {
|
||||
/* This is a clone */
|
||||
ASSERT(ds->ds_prev != NULL);
|
||||
ASSERT3U(ds->ds_prev->ds_phys->ds_next_snap_obj, !=, obj);
|
||||
ASSERT0(ds->ds_phys->ds_next_snap_obj);
|
||||
ASSERT3U(dsl_dataset_phys(ds->ds_prev)->ds_next_snap_obj, !=,
|
||||
obj);
|
||||
ASSERT0(dsl_dataset_phys(ds)->ds_next_snap_obj);
|
||||
|
||||
dmu_buf_will_dirty(ds->ds_prev->ds_dbuf, tx);
|
||||
if (ds->ds_prev->ds_phys->ds_next_clones_obj != 0) {
|
||||
if (dsl_dataset_phys(ds->ds_prev)->ds_next_clones_obj != 0) {
|
||||
dsl_dataset_remove_from_next_clones(ds->ds_prev,
|
||||
obj, tx);
|
||||
}
|
||||
|
||||
ASSERT3U(ds->ds_prev->ds_phys->ds_num_children, >, 1);
|
||||
ds->ds_prev->ds_phys->ds_num_children--;
|
||||
ASSERT3U(dsl_dataset_phys(ds->ds_prev)->ds_num_children, >, 1);
|
||||
dsl_dataset_phys(ds->ds_prev)->ds_num_children--;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -753,9 +766,9 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
* safe to ignore the deadlist contents.)
|
||||
*/
|
||||
dsl_deadlist_close(&ds->ds_deadlist);
|
||||
dsl_deadlist_free(mos, ds->ds_phys->ds_deadlist_obj, tx);
|
||||
dsl_deadlist_free(mos, dsl_dataset_phys(ds)->ds_deadlist_obj, tx);
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
ds->ds_phys->ds_deadlist_obj = 0;
|
||||
dsl_dataset_phys(ds)->ds_deadlist_obj = 0;
|
||||
|
||||
objset_t *os;
|
||||
VERIFY0(dmu_objset_from_ds(ds, &os));
|
||||
@ -785,15 +798,16 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
scn->scn_async_destroying = B_TRUE;
|
||||
}
|
||||
|
||||
used = ds->ds_dir->dd_phys->dd_used_bytes;
|
||||
comp = ds->ds_dir->dd_phys->dd_compressed_bytes;
|
||||
uncomp = ds->ds_dir->dd_phys->dd_uncompressed_bytes;
|
||||
used = dsl_dir_phys(ds->ds_dir)->dd_used_bytes;
|
||||
comp = dsl_dir_phys(ds->ds_dir)->dd_compressed_bytes;
|
||||
uncomp = dsl_dir_phys(ds->ds_dir)->dd_uncompressed_bytes;
|
||||
|
||||
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) ||
|
||||
ds->ds_phys->ds_unique_bytes == used);
|
||||
dsl_dataset_phys(ds)->ds_unique_bytes == used);
|
||||
|
||||
bptree_add(mos, dp->dp_bptree_obj,
|
||||
&ds->ds_phys->ds_bp, ds->ds_phys->ds_prev_snap_txg,
|
||||
&dsl_dataset_phys(ds)->ds_bp,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg,
|
||||
used, comp, uncomp, tx);
|
||||
dsl_dir_diduse_space(ds->ds_dir, DD_USED_HEAD,
|
||||
-used, -comp, -uncomp, tx);
|
||||
@ -804,7 +818,7 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
if (ds->ds_prev != NULL) {
|
||||
if (spa_version(dp->dp_spa) >= SPA_VERSION_DIR_CLONES) {
|
||||
VERIFY0(zap_remove_int(mos,
|
||||
ds->ds_prev->ds_dir->dd_phys->dd_clones,
|
||||
dsl_dir_phys(ds->ds_prev->ds_dir)->dd_clones,
|
||||
ds->ds_object, tx));
|
||||
}
|
||||
prevobj = ds->ds_prev->ds_object;
|
||||
@ -823,22 +837,22 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
|
||||
/* Erase the link in the dir */
|
||||
dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
|
||||
ds->ds_dir->dd_phys->dd_head_dataset_obj = 0;
|
||||
dsl_dir_phys(ds->ds_dir)->dd_head_dataset_obj = 0;
|
||||
ddobj = ds->ds_dir->dd_object;
|
||||
ASSERT(ds->ds_phys->ds_snapnames_zapobj != 0);
|
||||
VERIFY0(zap_destroy(mos, ds->ds_phys->ds_snapnames_zapobj, tx));
|
||||
ASSERT(dsl_dataset_phys(ds)->ds_snapnames_zapobj != 0);
|
||||
VERIFY0(zap_destroy(mos,
|
||||
dsl_dataset_phys(ds)->ds_snapnames_zapobj, tx));
|
||||
|
||||
if (ds->ds_bookmarks != 0) {
|
||||
VERIFY0(zap_destroy(mos,
|
||||
ds->ds_bookmarks, tx));
|
||||
VERIFY0(zap_destroy(mos, ds->ds_bookmarks, tx));
|
||||
spa_feature_decr(dp->dp_spa, SPA_FEATURE_BOOKMARKS, tx);
|
||||
}
|
||||
|
||||
spa_prop_clear_bootfs(dp->dp_spa, ds->ds_object, tx);
|
||||
|
||||
ASSERT0(ds->ds_phys->ds_next_clones_obj);
|
||||
ASSERT0(ds->ds_phys->ds_props_obj);
|
||||
ASSERT0(ds->ds_phys->ds_userrefs_obj);
|
||||
ASSERT0(dsl_dataset_phys(ds)->ds_next_clones_obj);
|
||||
ASSERT0(dsl_dataset_phys(ds)->ds_props_obj);
|
||||
ASSERT0(dsl_dataset_phys(ds)->ds_userrefs_obj);
|
||||
dsl_dir_rele(ds->ds_dir, ds);
|
||||
ds->ds_dir = NULL;
|
||||
dmu_object_free_zapified(mos, obj, tx);
|
||||
@ -876,7 +890,7 @@ dsl_destroy_head_begin_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
/* Mark it as inconsistent on-disk, in case we crash */
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
ds->ds_phys->ds_flags |= DS_FLAG_INCONSISTENT;
|
||||
dsl_dataset_phys(ds)->ds_flags |= DS_FLAG_INCONSISTENT;
|
||||
|
||||
spa_history_log_internal_ds(ds, "destroy begin", tx, "");
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
@ -919,7 +933,8 @@ dsl_destroy_head(const char *name)
|
||||
error = dmu_objset_own(name, DMU_OST_ANY, B_FALSE, FTAG, &os);
|
||||
if (error == 0) {
|
||||
uint64_t prev_snap_txg =
|
||||
dmu_objset_ds(os)->ds_phys->ds_prev_snap_txg;
|
||||
dsl_dataset_phys(dmu_objset_ds(os))->
|
||||
ds_prev_snap_txg;
|
||||
for (uint64_t obj = 0; error == 0;
|
||||
error = dmu_object_next(os, &obj, FALSE,
|
||||
prev_snap_txg))
|
||||
|
@ -126,6 +126,8 @@
|
||||
* such as those created by zfs diff.
|
||||
*/
|
||||
|
||||
extern inline dsl_dir_phys_t *dsl_dir_phys(dsl_dir_t *dd);
|
||||
|
||||
static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd);
|
||||
|
||||
/* ARGSUSED */
|
||||
@ -185,7 +187,6 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
||||
dd->dd_object = ddobj;
|
||||
dd->dd_dbuf = dbuf;
|
||||
dd->dd_pool = dp;
|
||||
dd->dd_phys = dbuf->db_data;
|
||||
mutex_init(&dd->dd_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
|
||||
list_create(&dd->dd_prop_cbs, sizeof (dsl_prop_cb_record_t),
|
||||
@ -193,9 +194,10 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
||||
|
||||
dsl_dir_snap_cmtime_update(dd);
|
||||
|
||||
if (dd->dd_phys->dd_parent_obj) {
|
||||
err = dsl_dir_hold_obj(dp, dd->dd_phys->dd_parent_obj,
|
||||
NULL, dd, &dd->dd_parent);
|
||||
if (dsl_dir_phys(dd)->dd_parent_obj) {
|
||||
err = dsl_dir_hold_obj(dp,
|
||||
dsl_dir_phys(dd)->dd_parent_obj, NULL, dd,
|
||||
&dd->dd_parent);
|
||||
if (err != 0)
|
||||
goto errout;
|
||||
if (tail) {
|
||||
@ -203,14 +205,16 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
||||
uint64_t foundobj;
|
||||
|
||||
err = zap_lookup(dp->dp_meta_objset,
|
||||
dd->dd_parent->dd_phys->dd_child_dir_zapobj,
|
||||
tail, sizeof (foundobj), 1, &foundobj);
|
||||
dsl_dir_phys(dd->dd_parent)->
|
||||
dd_child_dir_zapobj, tail,
|
||||
sizeof (foundobj), 1, &foundobj);
|
||||
ASSERT(err || foundobj == ddobj);
|
||||
#endif
|
||||
(void) strcpy(dd->dd_myname, tail);
|
||||
} else {
|
||||
err = zap_value_search(dp->dp_meta_objset,
|
||||
dd->dd_parent->dd_phys->dd_child_dir_zapobj,
|
||||
dsl_dir_phys(dd->dd_parent)->
|
||||
dd_child_dir_zapobj,
|
||||
ddobj, 0, dd->dd_myname);
|
||||
}
|
||||
if (err != 0)
|
||||
@ -229,7 +233,8 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
||||
* Just look at its phys directly instead.
|
||||
*/
|
||||
err = dmu_bonus_hold(dp->dp_meta_objset,
|
||||
dd->dd_phys->dd_origin_obj, FTAG, &origin_bonus);
|
||||
dsl_dir_phys(dd)->dd_origin_obj, FTAG,
|
||||
&origin_bonus);
|
||||
if (err != 0)
|
||||
goto errout;
|
||||
origin_phys = origin_bonus->db_data;
|
||||
@ -238,8 +243,7 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
||||
dmu_buf_rele(origin_bonus, FTAG);
|
||||
}
|
||||
|
||||
winner = dmu_buf_set_user_ie(dbuf, dd, &dd->dd_phys,
|
||||
dsl_dir_evict);
|
||||
winner = dmu_buf_set_user_ie(dbuf, dd, dsl_dir_evict);
|
||||
if (winner) {
|
||||
if (dd->dd_parent)
|
||||
dsl_dir_rele(dd->dd_parent, dd);
|
||||
@ -422,10 +426,10 @@ dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
if (next[0] == '@')
|
||||
break;
|
||||
dprintf("looking up %s in obj%lld\n",
|
||||
buf, dd->dd_phys->dd_child_dir_zapobj);
|
||||
buf, dsl_dir_phys(dd)->dd_child_dir_zapobj);
|
||||
|
||||
err = zap_lookup(dp->dp_meta_objset,
|
||||
dd->dd_phys->dd_child_dir_zapobj,
|
||||
dsl_dir_phys(dd)->dd_child_dir_zapobj,
|
||||
buf, sizeof (ddobj), 1, &ddobj);
|
||||
if (err != 0) {
|
||||
if (err == ENOENT)
|
||||
@ -506,7 +510,7 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx)
|
||||
za = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP);
|
||||
|
||||
/* Iterate my child dirs */
|
||||
for (zap_cursor_init(zc, os, dd->dd_phys->dd_child_dir_zapobj);
|
||||
for (zap_cursor_init(zc, os, dsl_dir_phys(dd)->dd_child_dir_zapobj);
|
||||
zap_cursor_retrieve(zc, za) == 0; zap_cursor_advance(zc)) {
|
||||
dsl_dir_t *chld_dd;
|
||||
uint64_t count;
|
||||
@ -540,9 +544,9 @@ dsl_dir_init_fs_ss_count(dsl_dir_t *dd, dmu_tx_t *tx)
|
||||
zap_cursor_fini(zc);
|
||||
/* Count my snapshots (we counted children's snapshots above) */
|
||||
VERIFY0(dsl_dataset_hold_obj(dd->dd_pool,
|
||||
dd->dd_phys->dd_head_dataset_obj, FTAG, &ds));
|
||||
dsl_dir_phys(dd)->dd_head_dataset_obj, FTAG, &ds));
|
||||
|
||||
for (zap_cursor_init(zc, os, ds->ds_phys->ds_snapnames_zapobj);
|
||||
for (zap_cursor_init(zc, os, dsl_dataset_phys(ds)->ds_snapnames_zapobj);
|
||||
zap_cursor_retrieve(zc, za) == 0;
|
||||
zap_cursor_advance(zc)) {
|
||||
/* Don't count temporary snapshots */
|
||||
@ -695,7 +699,7 @@ dsl_enforce_ds_ss_limits(dsl_dir_t *dd, zfs_prop_t prop, cred_t *cr)
|
||||
return (ENFORCE_NEVER);
|
||||
#endif
|
||||
|
||||
if ((obj = dd->dd_phys->dd_head_dataset_obj) == 0)
|
||||
if ((obj = dsl_dir_phys(dd)->dd_head_dataset_obj) == 0)
|
||||
return (ENFORCE_ALWAYS);
|
||||
|
||||
ASSERT(dsl_pool_config_held(dd->dd_pool));
|
||||
@ -873,7 +877,7 @@ dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds, const char *name,
|
||||
ddobj = dmu_object_alloc(mos, DMU_OT_DSL_DIR, 0,
|
||||
DMU_OT_DSL_DIR, sizeof (dsl_dir_phys_t), tx);
|
||||
if (pds) {
|
||||
VERIFY(0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj,
|
||||
VERIFY(0 == zap_add(mos, dsl_dir_phys(pds)->dd_child_dir_zapobj,
|
||||
name, sizeof (uint64_t), 1, &ddobj, tx));
|
||||
} else {
|
||||
/* it's the root dir */
|
||||
@ -905,9 +909,9 @@ dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds, const char *name,
|
||||
boolean_t
|
||||
dsl_dir_is_clone(dsl_dir_t *dd)
|
||||
{
|
||||
return (dd->dd_phys->dd_origin_obj &&
|
||||
return (dsl_dir_phys(dd)->dd_origin_obj &&
|
||||
(dd->dd_pool->dp_origin_snap == NULL ||
|
||||
dd->dd_phys->dd_origin_obj !=
|
||||
dsl_dir_phys(dd)->dd_origin_obj !=
|
||||
dd->dd_pool->dp_origin_snap->ds_object));
|
||||
}
|
||||
|
||||
@ -916,26 +920,27 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
|
||||
{
|
||||
mutex_enter(&dd->dd_lock);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USED,
|
||||
dd->dd_phys->dd_used_bytes);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_QUOTA, dd->dd_phys->dd_quota);
|
||||
dsl_dir_phys(dd)->dd_used_bytes);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_QUOTA,
|
||||
dsl_dir_phys(dd)->dd_quota);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_RESERVATION,
|
||||
dd->dd_phys->dd_reserved);
|
||||
dsl_dir_phys(dd)->dd_reserved);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO,
|
||||
dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
|
||||
(dd->dd_phys->dd_uncompressed_bytes * 100 /
|
||||
dd->dd_phys->dd_compressed_bytes));
|
||||
dsl_dir_phys(dd)->dd_compressed_bytes == 0 ? 100 :
|
||||
(dsl_dir_phys(dd)->dd_uncompressed_bytes * 100 /
|
||||
dsl_dir_phys(dd)->dd_compressed_bytes));
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
|
||||
dd->dd_phys->dd_uncompressed_bytes);
|
||||
if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
|
||||
dsl_dir_phys(dd)->dd_uncompressed_bytes);
|
||||
if (dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN) {
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
|
||||
dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_SNAP]);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDDS,
|
||||
dd->dd_phys->dd_used_breakdown[DD_USED_HEAD]);
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_HEAD]);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDREFRESERV,
|
||||
dd->dd_phys->dd_used_breakdown[DD_USED_REFRSRV]);
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_REFRSRV]);
|
||||
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDCHILD,
|
||||
dd->dd_phys->dd_used_breakdown[DD_USED_CHILD] +
|
||||
dd->dd_phys->dd_used_breakdown[DD_USED_CHILD_RSRV]);
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_CHILD] +
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[DD_USED_CHILD_RSRV]);
|
||||
}
|
||||
mutex_exit(&dd->dd_lock);
|
||||
|
||||
@ -960,7 +965,7 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
|
||||
char buf[MAXNAMELEN];
|
||||
|
||||
VERIFY0(dsl_dataset_hold_obj(dd->dd_pool,
|
||||
dd->dd_phys->dd_origin_obj, FTAG, &ds));
|
||||
dsl_dir_phys(dd)->dd_origin_obj, FTAG, &ds));
|
||||
dsl_dataset_name(ds, buf);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
dsl_prop_nvlist_add_string(nv, ZFS_PROP_ORIGIN, buf);
|
||||
@ -972,7 +977,7 @@ dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx)
|
||||
{
|
||||
dsl_pool_t *dp = dd->dd_pool;
|
||||
|
||||
ASSERT(dd->dd_phys);
|
||||
ASSERT(dsl_dir_phys(dd));
|
||||
|
||||
if (txg_list_add(&dp->dp_dirty_dirs, dd, tx->tx_txg)) {
|
||||
/* up the hold count until we can be written out */
|
||||
@ -983,8 +988,9 @@ dsl_dir_dirty(dsl_dir_t *dd, dmu_tx_t *tx)
|
||||
static int64_t
|
||||
parent_delta(dsl_dir_t *dd, uint64_t used, int64_t delta)
|
||||
{
|
||||
uint64_t old_accounted = MAX(used, dd->dd_phys->dd_reserved);
|
||||
uint64_t new_accounted = MAX(used + delta, dd->dd_phys->dd_reserved);
|
||||
uint64_t old_accounted = MAX(used, dsl_dir_phys(dd)->dd_reserved);
|
||||
uint64_t new_accounted =
|
||||
MAX(used + delta, dsl_dir_phys(dd)->dd_reserved);
|
||||
return (new_accounted - old_accounted);
|
||||
}
|
||||
|
||||
@ -1043,9 +1049,9 @@ dsl_dir_space_available(dsl_dir_t *dd,
|
||||
}
|
||||
|
||||
mutex_enter(&dd->dd_lock);
|
||||
if (dd->dd_phys->dd_quota != 0)
|
||||
quota = dd->dd_phys->dd_quota;
|
||||
used = dd->dd_phys->dd_used_bytes;
|
||||
if (dsl_dir_phys(dd)->dd_quota != 0)
|
||||
quota = dsl_dir_phys(dd)->dd_quota;
|
||||
used = dsl_dir_phys(dd)->dd_used_bytes;
|
||||
if (!ondiskonly)
|
||||
used += dsl_dir_space_towrite(dd);
|
||||
|
||||
@ -1054,12 +1060,12 @@ dsl_dir_space_available(dsl_dir_t *dd,
|
||||
quota = MIN(quota, poolsize);
|
||||
}
|
||||
|
||||
if (dd->dd_phys->dd_reserved > used && parentspace != UINT64_MAX) {
|
||||
if (dsl_dir_phys(dd)->dd_reserved > used && parentspace != UINT64_MAX) {
|
||||
/*
|
||||
* We have some space reserved, in addition to what our
|
||||
* parent gave us.
|
||||
*/
|
||||
parentspace += dd->dd_phys->dd_reserved - used;
|
||||
parentspace += dsl_dir_phys(dd)->dd_reserved - used;
|
||||
}
|
||||
|
||||
if (dd == ancestor) {
|
||||
@ -1118,7 +1124,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
|
||||
est_inflight = dsl_dir_space_towrite(dd);
|
||||
for (i = 0; i < TXG_SIZE; i++)
|
||||
est_inflight += dd->dd_tempreserved[i];
|
||||
used_on_disk = dd->dd_phys->dd_used_bytes;
|
||||
used_on_disk = dsl_dir_phys(dd)->dd_used_bytes;
|
||||
|
||||
/*
|
||||
* On the first iteration, fetch the dataset's used-on-disk and
|
||||
@ -1141,10 +1147,10 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
|
||||
* If this transaction will result in a net free of space,
|
||||
* we want to let it through.
|
||||
*/
|
||||
if (ignorequota || netfree || dd->dd_phys->dd_quota == 0)
|
||||
if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0)
|
||||
quota = UINT64_MAX;
|
||||
else
|
||||
quota = dd->dd_phys->dd_quota;
|
||||
quota = dsl_dir_phys(dd)->dd_quota;
|
||||
|
||||
/*
|
||||
* Adjust the quota against the actual pool size at the root
|
||||
@ -1198,7 +1204,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
|
||||
|
||||
/* see if it's OK with our parent */
|
||||
if (dd->dd_parent && parent_rsrv) {
|
||||
boolean_t ismos = (dd->dd_phys->dd_head_dataset_obj == 0);
|
||||
boolean_t ismos = (dsl_dir_phys(dd)->dd_head_dataset_obj == 0);
|
||||
|
||||
return (dsl_dir_tempreserve_impl(dd->dd_parent,
|
||||
parent_rsrv, netfree, ismos, TRUE, tr_list, tx, FALSE));
|
||||
@ -1317,7 +1323,7 @@ dsl_dir_willuse_space(dsl_dir_t *dd, int64_t space, dmu_tx_t *tx)
|
||||
if (space > 0)
|
||||
dd->dd_space_towrite[tx->tx_txg & TXG_MASK] += space;
|
||||
|
||||
est_used = dsl_dir_space_towrite(dd) + dd->dd_phys->dd_used_bytes;
|
||||
est_used = dsl_dir_space_towrite(dd) + dsl_dir_phys(dd)->dd_used_bytes;
|
||||
parent_space = parent_delta(dd, est_used, space);
|
||||
mutex_exit(&dd->dd_lock);
|
||||
|
||||
@ -1352,26 +1358,27 @@ dsl_dir_diduse_space(dsl_dir_t *dd, dd_used_t type,
|
||||
|
||||
if (needlock)
|
||||
mutex_enter(&dd->dd_lock);
|
||||
accounted_delta = parent_delta(dd, dd->dd_phys->dd_used_bytes, used);
|
||||
ASSERT(used >= 0 || dd->dd_phys->dd_used_bytes >= -used);
|
||||
accounted_delta =
|
||||
parent_delta(dd, dsl_dir_phys(dd)->dd_used_bytes, used);
|
||||
ASSERT(used >= 0 || dsl_dir_phys(dd)->dd_used_bytes >= -used);
|
||||
ASSERT(compressed >= 0 ||
|
||||
dd->dd_phys->dd_compressed_bytes >= -compressed);
|
||||
dsl_dir_phys(dd)->dd_compressed_bytes >= -compressed);
|
||||
ASSERT(uncompressed >= 0 ||
|
||||
dd->dd_phys->dd_uncompressed_bytes >= -uncompressed);
|
||||
dd->dd_phys->dd_used_bytes += used;
|
||||
dd->dd_phys->dd_uncompressed_bytes += uncompressed;
|
||||
dd->dd_phys->dd_compressed_bytes += compressed;
|
||||
dsl_dir_phys(dd)->dd_uncompressed_bytes >= -uncompressed);
|
||||
dsl_dir_phys(dd)->dd_used_bytes += used;
|
||||
dsl_dir_phys(dd)->dd_uncompressed_bytes += uncompressed;
|
||||
dsl_dir_phys(dd)->dd_compressed_bytes += compressed;
|
||||
|
||||
if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
|
||||
if (dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN) {
|
||||
ASSERT(used > 0 ||
|
||||
dd->dd_phys->dd_used_breakdown[type] >= -used);
|
||||
dd->dd_phys->dd_used_breakdown[type] += used;
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[type] >= -used);
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[type] += used;
|
||||
#ifdef DEBUG
|
||||
dd_used_t t;
|
||||
uint64_t u = 0;
|
||||
for (t = 0; t < DD_USED_NUM; t++)
|
||||
u += dd->dd_phys->dd_used_breakdown[t];
|
||||
ASSERT3U(u, ==, dd->dd_phys->dd_used_bytes);
|
||||
u += dsl_dir_phys(dd)->dd_used_breakdown[t];
|
||||
ASSERT3U(u, ==, dsl_dir_phys(dd)->dd_used_bytes);
|
||||
#endif
|
||||
}
|
||||
if (needlock)
|
||||
@ -1394,17 +1401,18 @@ dsl_dir_transfer_space(dsl_dir_t *dd, int64_t delta,
|
||||
ASSERT(oldtype < DD_USED_NUM);
|
||||
ASSERT(newtype < DD_USED_NUM);
|
||||
|
||||
if (delta == 0 || !(dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN))
|
||||
if (delta == 0 ||
|
||||
!(dsl_dir_phys(dd)->dd_flags & DD_FLAG_USED_BREAKDOWN))
|
||||
return;
|
||||
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
mutex_enter(&dd->dd_lock);
|
||||
ASSERT(delta > 0 ?
|
||||
dd->dd_phys->dd_used_breakdown[oldtype] >= delta :
|
||||
dd->dd_phys->dd_used_breakdown[newtype] >= -delta);
|
||||
ASSERT(dd->dd_phys->dd_used_bytes >= ABS(delta));
|
||||
dd->dd_phys->dd_used_breakdown[oldtype] -= delta;
|
||||
dd->dd_phys->dd_used_breakdown[newtype] += delta;
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[oldtype] >= delta :
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[newtype] >= -delta);
|
||||
ASSERT(dsl_dir_phys(dd)->dd_used_bytes >= ABS(delta));
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[oldtype] -= delta;
|
||||
dsl_dir_phys(dd)->dd_used_breakdown[newtype] += delta;
|
||||
mutex_exit(&dd->dd_lock);
|
||||
}
|
||||
|
||||
@ -1448,8 +1456,8 @@ dsl_dir_set_quota_check(void *arg, dmu_tx_t *tx)
|
||||
*/
|
||||
towrite = dsl_dir_space_towrite(ds->ds_dir);
|
||||
if ((dmu_tx_is_syncing(tx) || towrite == 0) &&
|
||||
(newval < ds->ds_dir->dd_phys->dd_reserved ||
|
||||
newval < ds->ds_dir->dd_phys->dd_used_bytes + towrite)) {
|
||||
(newval < dsl_dir_phys(ds->ds_dir)->dd_reserved ||
|
||||
newval < dsl_dir_phys(ds->ds_dir)->dd_used_bytes + towrite)) {
|
||||
error = SET_ERROR(ENOSPC);
|
||||
}
|
||||
mutex_exit(&ds->ds_dir->dd_lock);
|
||||
@ -1482,7 +1490,7 @@ dsl_dir_set_quota_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
|
||||
mutex_enter(&ds->ds_dir->dd_lock);
|
||||
ds->ds_dir->dd_phys->dd_quota = newval;
|
||||
dsl_dir_phys(ds->ds_dir)->dd_quota = newval;
|
||||
mutex_exit(&ds->ds_dir->dd_lock);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
}
|
||||
@ -1533,7 +1541,7 @@ dsl_dir_set_reservation_check(void *arg, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
mutex_enter(&dd->dd_lock);
|
||||
used = dd->dd_phys->dd_used_bytes;
|
||||
used = dsl_dir_phys(dd)->dd_used_bytes;
|
||||
mutex_exit(&dd->dd_lock);
|
||||
|
||||
if (dd->dd_parent) {
|
||||
@ -1543,13 +1551,13 @@ dsl_dir_set_reservation_check(void *arg, dmu_tx_t *tx)
|
||||
avail = dsl_pool_adjustedsize(dd->dd_pool, B_FALSE) - used;
|
||||
}
|
||||
|
||||
if (MAX(used, newval) > MAX(used, dd->dd_phys->dd_reserved)) {
|
||||
if (MAX(used, newval) > MAX(used, dsl_dir_phys(dd)->dd_reserved)) {
|
||||
uint64_t delta = MAX(used, newval) -
|
||||
MAX(used, dd->dd_phys->dd_reserved);
|
||||
MAX(used, dsl_dir_phys(dd)->dd_reserved);
|
||||
|
||||
if (delta > avail ||
|
||||
(dd->dd_phys->dd_quota > 0 &&
|
||||
newval > dd->dd_phys->dd_quota))
|
||||
(dsl_dir_phys(dd)->dd_quota > 0 &&
|
||||
newval > dsl_dir_phys(dd)->dd_quota))
|
||||
error = SET_ERROR(ENOSPC);
|
||||
}
|
||||
|
||||
@ -1566,9 +1574,9 @@ dsl_dir_set_reservation_sync_impl(dsl_dir_t *dd, uint64_t value, dmu_tx_t *tx)
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
|
||||
mutex_enter(&dd->dd_lock);
|
||||
used = dd->dd_phys->dd_used_bytes;
|
||||
delta = MAX(used, value) - MAX(used, dd->dd_phys->dd_reserved);
|
||||
dd->dd_phys->dd_reserved = value;
|
||||
used = dsl_dir_phys(dd)->dd_used_bytes;
|
||||
delta = MAX(used, value) - MAX(used, dsl_dir_phys(dd)->dd_reserved);
|
||||
dsl_dir_phys(dd)->dd_reserved = value;
|
||||
|
||||
if (dd->dd_parent != NULL) {
|
||||
/* Roll up this additional usage into our ancestors */
|
||||
@ -1645,7 +1653,7 @@ would_change(dsl_dir_t *dd, int64_t delta, dsl_dir_t *ancestor)
|
||||
return (delta);
|
||||
|
||||
mutex_enter(&dd->dd_lock);
|
||||
delta = parent_delta(dd, dd->dd_phys->dd_used_bytes, delta);
|
||||
delta = parent_delta(dd, dsl_dir_phys(dd)->dd_used_bytes, delta);
|
||||
mutex_exit(&dd->dd_lock);
|
||||
return (would_change(dd->dd_parent, delta, ancestor));
|
||||
}
|
||||
@ -1736,7 +1744,8 @@ dsl_dir_rename_check(void *arg, dmu_tx_t *tx)
|
||||
if (newparent != dd->dd_parent) {
|
||||
/* is there enough space? */
|
||||
uint64_t myspace =
|
||||
MAX(dd->dd_phys->dd_used_bytes, dd->dd_phys->dd_reserved);
|
||||
MAX(dsl_dir_phys(dd)->dd_used_bytes,
|
||||
dsl_dir_phys(dd)->dd_reserved);
|
||||
objset_t *os = dd->dd_pool->dp_meta_objset;
|
||||
uint64_t fs_cnt = 0;
|
||||
uint64_t ss_cnt = 0;
|
||||
@ -1841,17 +1850,18 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx)
|
||||
DD_FIELD_SNAPSHOT_COUNT, tx);
|
||||
|
||||
dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD,
|
||||
-dd->dd_phys->dd_used_bytes,
|
||||
-dd->dd_phys->dd_compressed_bytes,
|
||||
-dd->dd_phys->dd_uncompressed_bytes, tx);
|
||||
-dsl_dir_phys(dd)->dd_used_bytes,
|
||||
-dsl_dir_phys(dd)->dd_compressed_bytes,
|
||||
-dsl_dir_phys(dd)->dd_uncompressed_bytes, tx);
|
||||
dsl_dir_diduse_space(newparent, DD_USED_CHILD,
|
||||
dd->dd_phys->dd_used_bytes,
|
||||
dd->dd_phys->dd_compressed_bytes,
|
||||
dd->dd_phys->dd_uncompressed_bytes, tx);
|
||||
dsl_dir_phys(dd)->dd_used_bytes,
|
||||
dsl_dir_phys(dd)->dd_compressed_bytes,
|
||||
dsl_dir_phys(dd)->dd_uncompressed_bytes, tx);
|
||||
|
||||
if (dd->dd_phys->dd_reserved > dd->dd_phys->dd_used_bytes) {
|
||||
uint64_t unused_rsrv = dd->dd_phys->dd_reserved -
|
||||
dd->dd_phys->dd_used_bytes;
|
||||
if (dsl_dir_phys(dd)->dd_reserved >
|
||||
dsl_dir_phys(dd)->dd_used_bytes) {
|
||||
uint64_t unused_rsrv = dsl_dir_phys(dd)->dd_reserved -
|
||||
dsl_dir_phys(dd)->dd_used_bytes;
|
||||
|
||||
dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD_RSRV,
|
||||
-unused_rsrv, 0, 0, tx);
|
||||
@ -1863,18 +1873,19 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx)
|
||||
dmu_buf_will_dirty(dd->dd_dbuf, tx);
|
||||
|
||||
/* remove from old parent zapobj */
|
||||
error = zap_remove(mos, dd->dd_parent->dd_phys->dd_child_dir_zapobj,
|
||||
error = zap_remove(mos,
|
||||
dsl_dir_phys(dd->dd_parent)->dd_child_dir_zapobj,
|
||||
dd->dd_myname, tx);
|
||||
ASSERT0(error);
|
||||
|
||||
(void) strcpy(dd->dd_myname, mynewname);
|
||||
dsl_dir_rele(dd->dd_parent, dd);
|
||||
dd->dd_phys->dd_parent_obj = newparent->dd_object;
|
||||
dsl_dir_phys(dd)->dd_parent_obj = newparent->dd_object;
|
||||
VERIFY0(dsl_dir_hold_obj(dp,
|
||||
newparent->dd_object, NULL, dd, &dd->dd_parent));
|
||||
|
||||
/* add to new parent zapobj */
|
||||
VERIFY0(zap_add(mos, newparent->dd_phys->dd_child_dir_zapobj,
|
||||
VERIFY0(zap_add(mos, dsl_dir_phys(newparent)->dd_child_dir_zapobj,
|
||||
dd->dd_myname, 8, 1, &dd->dd_object, tx));
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
@ -235,7 +235,7 @@ dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **ddp)
|
||||
int err;
|
||||
|
||||
err = zap_lookup(dp->dp_meta_objset,
|
||||
dp->dp_root_dir->dd_phys->dd_child_dir_zapobj,
|
||||
dsl_dir_phys(dp->dp_root_dir)->dd_child_dir_zapobj,
|
||||
name, sizeof (obj), 1, &obj);
|
||||
if (err)
|
||||
return (err);
|
||||
@ -317,11 +317,11 @@ dsl_pool_open(dsl_pool_t *dp)
|
||||
err = dsl_pool_open_special_dir(dp, ORIGIN_DIR_NAME, &dd);
|
||||
if (err)
|
||||
goto out;
|
||||
err = dsl_dataset_hold_obj(dp, dd->dd_phys->dd_head_dataset_obj,
|
||||
FTAG, &ds);
|
||||
err = dsl_dataset_hold_obj(dp,
|
||||
dsl_dir_phys(dd)->dd_head_dataset_obj, FTAG, &ds);
|
||||
if (err == 0) {
|
||||
err = dsl_dataset_hold_obj(dp,
|
||||
ds->ds_phys->ds_prev_snap_obj, dp,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj, dp,
|
||||
&dp->dp_origin_snap);
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
}
|
||||
@ -774,15 +774,15 @@ upgrade_clones_cb(dsl_pool_t *dp, dsl_dataset_t *hds, void *arg)
|
||||
if (err)
|
||||
return (err);
|
||||
|
||||
while (ds->ds_phys->ds_prev_snap_obj != 0) {
|
||||
err = dsl_dataset_hold_obj(dp, ds->ds_phys->ds_prev_snap_obj,
|
||||
FTAG, &prev);
|
||||
while (dsl_dataset_phys(ds)->ds_prev_snap_obj != 0) {
|
||||
err = dsl_dataset_hold_obj(dp,
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj, FTAG, &prev);
|
||||
if (err) {
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
return (err);
|
||||
}
|
||||
|
||||
if (prev->ds_phys->ds_next_snap_obj != ds->ds_object)
|
||||
if (dsl_dataset_phys(prev)->ds_next_snap_obj != ds->ds_object)
|
||||
break;
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
ds = prev;
|
||||
@ -796,7 +796,7 @@ upgrade_clones_cb(dsl_pool_t *dp, dsl_dataset_t *hds, void *arg)
|
||||
* The $ORIGIN can't have any data, or the accounting
|
||||
* will be wrong.
|
||||
*/
|
||||
ASSERT0(prev->ds_phys->ds_bp.blk_birth);
|
||||
ASSERT0(dsl_dataset_phys(prev)->ds_bp.blk_birth);
|
||||
|
||||
/* The origin doesn't get attached to itself */
|
||||
if (ds->ds_object == prev->ds_object) {
|
||||
@ -805,33 +805,35 @@ upgrade_clones_cb(dsl_pool_t *dp, dsl_dataset_t *hds, void *arg)
|
||||
}
|
||||
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
ds->ds_phys->ds_prev_snap_obj = prev->ds_object;
|
||||
ds->ds_phys->ds_prev_snap_txg = prev->ds_phys->ds_creation_txg;
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj = prev->ds_object;
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_txg =
|
||||
dsl_dataset_phys(prev)->ds_creation_txg;
|
||||
|
||||
dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
|
||||
ds->ds_dir->dd_phys->dd_origin_obj = prev->ds_object;
|
||||
dsl_dir_phys(ds->ds_dir)->dd_origin_obj = prev->ds_object;
|
||||
|
||||
dmu_buf_will_dirty(prev->ds_dbuf, tx);
|
||||
prev->ds_phys->ds_num_children++;
|
||||
dsl_dataset_phys(prev)->ds_num_children++;
|
||||
|
||||
if (ds->ds_phys->ds_next_snap_obj == 0) {
|
||||
if (dsl_dataset_phys(ds)->ds_next_snap_obj == 0) {
|
||||
ASSERT(ds->ds_prev == NULL);
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_phys->ds_prev_snap_obj, ds, &ds->ds_prev));
|
||||
dsl_dataset_phys(ds)->ds_prev_snap_obj,
|
||||
ds, &ds->ds_prev));
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT3U(ds->ds_dir->dd_phys->dd_origin_obj, ==, prev->ds_object);
|
||||
ASSERT3U(ds->ds_phys->ds_prev_snap_obj, ==, prev->ds_object);
|
||||
ASSERT3U(dsl_dir_phys(ds->ds_dir)->dd_origin_obj, ==, prev->ds_object);
|
||||
ASSERT3U(dsl_dataset_phys(ds)->ds_prev_snap_obj, ==, prev->ds_object);
|
||||
|
||||
if (prev->ds_phys->ds_next_clones_obj == 0) {
|
||||
if (dsl_dataset_phys(prev)->ds_next_clones_obj == 0) {
|
||||
dmu_buf_will_dirty(prev->ds_dbuf, tx);
|
||||
prev->ds_phys->ds_next_clones_obj =
|
||||
dsl_dataset_phys(prev)->ds_next_clones_obj =
|
||||
zap_create(dp->dp_meta_objset,
|
||||
DMU_OT_NEXT_CLONES, DMU_OT_NONE, 0, tx);
|
||||
}
|
||||
VERIFY0(zap_add_int(dp->dp_meta_objset,
|
||||
prev->ds_phys->ds_next_clones_obj, ds->ds_object, tx));
|
||||
dsl_dataset_phys(prev)->ds_next_clones_obj, ds->ds_object, tx));
|
||||
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
if (prev != dp->dp_origin_snap)
|
||||
@ -856,20 +858,22 @@ upgrade_dir_clones_cb(dsl_pool_t *dp, dsl_dataset_t *ds, void *arg)
|
||||
dmu_tx_t *tx = arg;
|
||||
objset_t *mos = dp->dp_meta_objset;
|
||||
|
||||
if (ds->ds_dir->dd_phys->dd_origin_obj != 0) {
|
||||
if (dsl_dir_phys(ds->ds_dir)->dd_origin_obj != 0) {
|
||||
dsl_dataset_t *origin;
|
||||
|
||||
VERIFY0(dsl_dataset_hold_obj(dp,
|
||||
ds->ds_dir->dd_phys->dd_origin_obj, FTAG, &origin));
|
||||
dsl_dir_phys(ds->ds_dir)->dd_origin_obj, FTAG, &origin));
|
||||
|
||||
if (origin->ds_dir->dd_phys->dd_clones == 0) {
|
||||
if (dsl_dir_phys(origin->ds_dir)->dd_clones == 0) {
|
||||
dmu_buf_will_dirty(origin->ds_dir->dd_dbuf, tx);
|
||||
origin->ds_dir->dd_phys->dd_clones = zap_create(mos,
|
||||
DMU_OT_DSL_CLONES, DMU_OT_NONE, 0, tx);
|
||||
dsl_dir_phys(origin->ds_dir)->dd_clones =
|
||||
zap_create(mos, DMU_OT_DSL_CLONES, DMU_OT_NONE,
|
||||
0, tx);
|
||||
}
|
||||
|
||||
VERIFY0(zap_add_int(dp->dp_meta_objset,
|
||||
origin->ds_dir->dd_phys->dd_clones, ds->ds_object, tx));
|
||||
dsl_dir_phys(origin->ds_dir)->dd_clones,
|
||||
ds->ds_object, tx));
|
||||
|
||||
dsl_dataset_rele(origin, FTAG);
|
||||
}
|
||||
@ -916,7 +920,7 @@ dsl_pool_create_origin(dsl_pool_t *dp, dmu_tx_t *tx)
|
||||
NULL, 0, kcred, tx);
|
||||
VERIFY0(dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
|
||||
dsl_dataset_snapshot_sync_impl(ds, ORIGIN_DIR_NAME, tx);
|
||||
VERIFY0(dsl_dataset_hold_obj(dp, ds->ds_phys->ds_prev_snap_obj,
|
||||
VERIFY0(dsl_dataset_hold_obj(dp, dsl_dataset_phys(ds)->ds_prev_snap_obj,
|
||||
dp, &dp->dp_origin_snap));
|
||||
dsl_dataset_rele(ds, FTAG);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user