Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2016-04-13 02:04:09 +00:00
commit 9c831bbd69
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/release-pkg/; revision=297906
87 changed files with 29916 additions and 10433 deletions

View File

@ -153,7 +153,15 @@ BUILDENV_SHELL?=${SHELL}
BUILDENV_SHELL?=/bin/sh
.endif
SVN?= /usr/local/bin/svn
.if !defined(SVN) || empty(SVN)
. for _P in /usr/bin /usr/local/bin
. for _S in svn svnlite
. if exists(${_P}/${_S})
SVN= ${_P}/${_S}
. endif
. endfor
. endfor
.endif
SVNFLAGS?= -r HEAD
MAKEOBJDIRPREFIX?= /usr/obj
@ -1388,13 +1396,6 @@ doxygen: .PHONY
# latest copy.
#
update:
.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
@echo "--------------------------------------------------------------"
@echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
@echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
@echo "--------------------------------------------------------------"
@exit 1
.endif
.if defined(SVN_UPDATE)
@echo "--------------------------------------------------------------"
@echo ">>> Updating ${.CURDIR} using Subversion"

46
contrib/libxo/.gitignore vendored Normal file
View File

@ -0,0 +1,46 @@
# Object files
*.o
# Libraries
*.lib
*.a
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.app
*~
*.orig
aclocal.m4
ar-lib
autom4te.cache
build
compile
config.guess
config.h.in
config.sub
depcomp
install-sh
ltmain.sh
missing
m4
Makefile.in
configure
.DS_Store
xoconfig.h.in
xo_config.h.in
.gdbinit
.gdbinit.local
xtest
xtest.dSYM
tests/w

18
contrib/libxo/.svnignore Normal file
View File

@ -0,0 +1,18 @@
Makefile.in
aclocal.m4
ar-lib
autom4te.cache
bin*
build*
compile
configure
config.guess
config.sub
depcomp
doc/Makefile.in
info*
install-sh
ltmain.sh
m4
missing
patches*

View File

@ -12,7 +12,7 @@
#
AC_PREREQ(2.2)
AC_INIT([libxo], [0.4.5], [phil@juniper.net])
AC_INIT([libxo], [0.4.6], [phil@juniper.net])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
# Support silent build rules. Requires at least automake-1.11.

File diff suppressed because it is too large Load Diff

View File

@ -1,501 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -4341,7 +4341,7 @@ xo_colors_handle_text (xo_handle_t *xop UNUSED, xo_colors_t *newp)
char *cp = buf, *ep = buf + sizeof(buf);
unsigned i, bit;
xo_colors_t *oldp = &xop->xo_colors;
const char *code = NULL;
const char *code;
/*
* Start the buffer with an escape. We don't want to add the '['

View File

@ -121,7 +121,7 @@ traditional C strings can be used directly.
The close functions with the
.Dq _d
suffix are used in
.Dq \&Do The Right Thing
.Dq "Do The Right Thing"
mode, where the name of the open containers, lists, and
instances are maintained internally by
.Nm libxo
@ -151,7 +151,7 @@ Some users may find tracking the names of open containers, lists, and
instances inconvenient.
.Nm libxo
offers a
.Dq \&Do The Right Thing
.Dq "Do The Right Thing"
mode, where
.Nm libxo
will track the names of open containers, lists, and instances so

View File

@ -13,7 +13,7 @@
.Sh NAME
.Nm xo_open_list , xo_open_list_h , xo_open_list_hd , xo_open_list_d
.Nm xo_open_instance , xo_open_instance_h , xo_open_instance_hd , xo_open_instance_d
.Nm xo_close_instance , xo_close_instance_h , xo_close_instance_hd , xo_close_instnace_d
.Nm xo_close_instance , xo_close_instance_h , xo_close_instance_hd , xo_close_instance_d
.Nm xo_close_list , xo_close_list_h , xo_close_list_hd , xo_close_list_d
.Nd open and close lists and instances
.Sh LIBRARY

File diff suppressed because it is too large Load Diff

View File

@ -1,437 +0,0 @@
# Helper functions for option handling. -*- Autoconf -*-
#
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
# Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 8 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option '$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
[_LT_WITH_AIX_SONAME([aix])])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
_LT_DECL([], [AS], [1], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the 'shared' and
# 'disable-shared' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the 'static' and
# 'disable-static' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the 'fast-install'
# and 'disable-fast-install' LT_INIT options.
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for pkg in $enableval; do
IFS=$lt_save_ifs
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the 'disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_AIX_SONAME([DEFAULT])
# ----------------------------------
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
m4_define([_LT_WITH_AIX_SONAME],
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
shared_archive_member_spec=
case $host,$enable_shared in
power*-*-aix[[5-9]]*,yes)
AC_MSG_CHECKING([which variant of shared library versioning to provide])
AC_ARG_WITH([aix-soname],
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
[case $withval in
aix|svr4|both)
;;
*)
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
;;
esac
lt_cv_with_aix_soname=$with_aix_soname],
[AC_CACHE_VAL([lt_cv_with_aix_soname],
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
with_aix_soname=$lt_cv_with_aix_soname])
AC_MSG_RESULT([$with_aix_soname])
if test aix != "$with_aix_soname"; then
# For the AIX way of multilib, we name the shared archive member
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
# the AIX toolchain works better with OBJECT_MODE set (default 32).
if test 64 = "${OBJECT_MODE-32}"; then
shared_archive_member_spec=shr_64
else
shared_archive_member_spec=shr
fi
fi
;;
*)
with_aix_soname=aix
;;
esac
_LT_DECL([], [shared_archive_member_spec], [0],
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
])# _LT_WITH_AIX_SONAME
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
# LT_INIT options.
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
for lt_pkg in $withval; do
IFS=$lt_save_ifs
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS=$lt_save_ifs
;;
esac],
[pic_mode=m4_default([$1], [default])])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the 'pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])

View File

@ -1,123 +0,0 @@
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 6 ltsugar.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
# lt_join(SEP, ARG1, [ARG2...])
# -----------------------------
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
# associated separator.
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
# versions in m4sugar had bugs.
m4_define([lt_join],
[m4_if([$#], [1], [],
[$#], [2], [[$2]],
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
m4_define([_lt_join],
[m4_if([$#$2], [2], [],
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
# lt_car(LIST)
# lt_cdr(LIST)
# ------------
# Manipulate m4 lists.
# These macros are necessary as long as will still need to support
# Autoconf-2.59 which quotes differently.
m4_define([lt_car], [[$1]])
m4_define([lt_cdr],
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
[$#], 1, [],
[m4_dquote(m4_shift($@))])])
m4_define([lt_unquote], $1)
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
# ------------------------------------------
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
# Note that neither SEPARATOR nor STRING are expanded; they are appended
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
# than defined and empty).
#
# This macro is needed until we can rely on Autoconf 2.62, since earlier
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
m4_define([lt_append],
[m4_define([$1],
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
# ----------------------------------------------------------
# Produce a SEP delimited list of all paired combinations of elements of
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
# has the form PREFIXmINFIXSUFFIXn.
# Needed until we can rely on m4_combine added in Autoconf 2.62.
m4_define([lt_combine],
[m4_if(m4_eval([$# > 3]), [1],
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
[[m4_foreach([_Lt_prefix], [$2],
[m4_foreach([_Lt_suffix],
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
# -----------------------------------------------------------------------
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
m4_define([lt_if_append_uniq],
[m4_ifdef([$1],
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
[lt_append([$1], [$2], [$3])$4],
[$5])],
[lt_append([$1], [$2], [$3])$4])])
# lt_dict_add(DICT, KEY, VALUE)
# -----------------------------
m4_define([lt_dict_add],
[m4_define([$1($2)], [$3])])
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
# --------------------------------------------
m4_define([lt_dict_add_subkey],
[m4_define([$1($2:$3)], [$4])])
# lt_dict_fetch(DICT, KEY, [SUBKEY])
# ----------------------------------
m4_define([lt_dict_fetch],
[m4_ifval([$3],
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
# -----------------------------------------------------------------
m4_define([lt_if_dict_fetch],
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
[$5],
[$6])])
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
# --------------------------------------------------------------
m4_define([lt_dict_filter],
[m4_if([$5], [], [],
[lt_join(m4_quote(m4_default([$4], [[, ]])),
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
])

View File

@ -1,23 +0,0 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# @configure_input@
# serial 4179 ltversion.m4
# This file is part of GNU Libtool
m4_define([LT_PACKAGE_VERSION], [2.4.6])
m4_define([LT_PACKAGE_REVISION], [2.4.6])
AC_DEFUN([LTVERSION_VERSION],
[macro_version='2.4.6'
macro_revision='2.4.6'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])

View File

@ -1,98 +0,0 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])

View File

@ -134,7 +134,7 @@ setproctitle(const char *fmt, ...)
len = sizeof(ul_ps_strings);
if (sysctlbyname("kern.ps_strings", &ul_ps_strings, &len, NULL,
0) == -1)
ul_ps_strings = PS_STRINGS;
return;
ps_strings = (struct ps_strings *)ul_ps_strings;
}

View File

@ -1,11 +1,12 @@
.\" $FreeBSD$
.Sh ADDITIONAL DOCUMENTATION
.Fx
uses
.Nm libxo
version 0.4.3.
version 0.4.6.
Complete documentation can be found on github:
.Bd -literal -offset indent
http://juniper.github.io/libxo/0.4.3/libxo\-manual.html
http://juniper.github.io/libxo/0.4.6/libxo\-manual.html
.Ed
.Pp
.Nm libxo

View File

@ -1,3 +1,4 @@
/* $FreeBSD$ */
/* libxo/xo_config.h. Generated from xo_config.h.in by configure. */
/* libxo/xo_config.h.in. Generated from configure.ac by autoheader. */
@ -179,16 +180,16 @@
/* #undef LIBXO_TEXT_ONLY */
/* Version number as dotted value */
#define LIBXO_VERSION "0.4.3"
#define LIBXO_VERSION "0.4.6"
/* Version number extra information */
#define LIBXO_VERSION_EXTRA ""
/* Version number as a number */
#define LIBXO_VERSION_NUMBER 4003
#define LIBXO_VERSION_NUMBER 4006
/* Version number as string */
#define LIBXO_VERSION_STRING "4003"
#define LIBXO_VERSION_STRING "4006"
/* Enable local wcwidth implementation */
#define LIBXO_WCWIDTH 1
@ -206,7 +207,7 @@
#define PACKAGE_NAME "libxo"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libxo 0.4.3"
#define PACKAGE_STRING "libxo 0.4.6"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libxo"
@ -215,7 +216,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.4.3"
#define PACKAGE_VERSION "0.4.6"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
@ -229,7 +230,7 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.4.3"
#define VERSION "0.4.6"
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */

View File

@ -124,10 +124,10 @@ getether(ifname, eap)
char *eap; /* Ether address (output) */
{
int fd, rc = -1;
register int n;
int n;
struct ifreq ibuf[16];
struct ifconf ifc;
register struct ifreq *ifrp, *ifend;
struct ifreq *ifrp, *ifend;
/* Fetch the interface configuration */
fd = socket(AF_INET, SOCK_DGRAM, 0);

View File

@ -79,8 +79,8 @@ hash_tbl *
hash_Init(tablesize)
unsigned tablesize;
{
register hash_tbl *hashtblptr;
register unsigned totalsize;
hash_tbl *hashtblptr;
unsigned totalsize;
if (tablesize > 0) {
totalsize = sizeof(hash_tbl)
@ -169,9 +169,9 @@ hash_Reset(hashtable, free_data)
unsigned
hash_HashFunction(string, len)
unsigned char *string;
register unsigned len;
unsigned len;
{
register unsigned accum;
unsigned accum;
accum = 0;
for (; len > 0; len--) {
@ -195,7 +195,7 @@ hash_Exists(hashtable, hashcode, compare, key)
hash_cmpfp compare;
hash_datum *key;
{
register hash_member *memberptr;
hash_member *memberptr;
memberptr = (hashtable->table)[hashcode % (hashtable->size)];
while (memberptr) {
@ -345,8 +345,8 @@ hash_datum *
hash_NextEntry(hashtable)
hash_tbl *hashtable;
{
register unsigned bucket;
register hash_member *memberptr;
unsigned bucket;
hash_member *memberptr;
/*
* First try to pick up where we left off.

View File

@ -295,7 +295,7 @@ static u_char conv802table[256] =
void
haddr_conv802(addr_in, addr_out, len)
register u_char *addr_in, *addr_out;
u_char *addr_in, *addr_out;
int len;
{
u_char *lim;

View File

@ -1305,7 +1305,7 @@ process_generic(src, dest, tagvalue)
PRIVATE boolean
goodname(hostname)
register char *hostname;
char *hostname;
{
do {
if (!isalpha(*hostname++)) { /* First character must be a letter */
@ -1524,7 +1524,7 @@ PRIVATE void
adjust(s)
char **s;
{
register char *t;
char *t;
t = *s;
while (*t && (*t != ':')) {
@ -1549,7 +1549,7 @@ PRIVATE void
eat_whitespace(s)
char **s;
{
register char *t;
char *t;
t = *s;
while (*t && isspace(*t)) {
@ -1668,7 +1668,7 @@ prs_inetaddr(src, result)
u_int32 *result;
{
char tmpstr[MAXSTRINGLEN];
register u_int32 value;
u_int32 value;
u_int32 parts[4], *pp;
int n;
char *s, *t;
@ -1853,7 +1853,7 @@ PRIVATE u_int32
get_u_long(src)
char **src;
{
register u_int32 value, base;
u_int32 value, base;
char c;
/*

View File

@ -118,9 +118,9 @@ int bsd_arp_set(ia, eaddr, len)
char *eaddr;
int len;
{
register struct sockaddr_in *sin = &sin_m;
register struct sockaddr_dl *sdl;
register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
struct sockaddr_in *sin = &sin_m;
struct sockaddr_dl *sdl;
struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
u_char *ea;
struct timespec tp;
int op = RTM_ADD;
@ -179,9 +179,9 @@ static int rtmsg(cmd)
{
static int seq;
int rlen;
register struct rt_msghdr *rtm = &m_rtmsg.m_rtm;
register char *cp = m_rtmsg.m_space;
register int l;
struct rt_msghdr *rtm = &m_rtmsg.m_rtm;
char *cp = m_rtmsg.m_space;
int l;
errno = 0;
bzero((char *)&m_rtmsg, sizeof(m_rtmsg));

View File

@ -466,9 +466,9 @@ send_request(s)
*/
int
printfn(s, ep)
register u_char *s, *ep;
u_char *s, *ep;
{
register u_char c;
u_char c;
putchar('"');
while ((c = *s++) != '\0') {

View File

@ -100,8 +100,8 @@ bootp_print(bp, length, sport, dport)
/* Client's Hardware address */
if (bp->bp_hlen) {
register struct ether_header *eh;
register char *e;
struct ether_header *eh;
char *e;
TCHECK(bp->bp_chaddr[0], 6);
eh = (struct ether_header *) packetp;
@ -110,8 +110,8 @@ bootp_print(bp, length, sport, dport)
else if (bp->bp_op == BOOTREPLY)
e = (char *) EDST(eh);
else
e = 0;
if (e == 0 || bcmp((char *) bp->bp_chaddr, e, 6))
e = NULL;
if (e == NULL || bcmp((char *) bp->bp_chaddr, e, 6))
dump_hex(bp->bp_chaddr, bp->bp_hlen);
}
/* Only print interesting fields */
@ -274,12 +274,12 @@ rfc1048_opts[] = {
static void
rfc1048_print(bp, length)
register u_char *bp;
u_char *bp;
int length;
{
u_char tag;
u_char *ep;
register int len;
int len;
u_int32 ul;
u_short us;
struct in_addr ia;
@ -376,11 +376,10 @@ rfc1048_print(bp, length)
static void
cmu_print(bp, length)
register u_char *bp;
u_char *bp;
int length;
{
struct cmu_vend *v;
u_char *ep;
printf("-cmu");
@ -389,8 +388,6 @@ cmu_print(bp, length)
printf(" |L=%d", length);
return;
}
/* Setup end pointer */
ep = bp + length;
/* Subnet mask */
if (v->v_flags & VF_SMASK) {
@ -427,7 +424,7 @@ cmu_print(bp, length)
static void
other_print(bp, length)
register u_char *bp;
u_char *bp;
int length;
{
u_char *ep; /* end pointer */

View File

@ -702,7 +702,7 @@ static struct bufarea *
getdirblk(ufs2_daddr_t blkno, long size)
{
if (pdirbp != 0)
if (pdirbp != NULL)
pdirbp->b_flags &= ~B_INUSE;
pdirbp = getdatablk(blkno, size, BT_DIRDATA);
return (pdirbp);

View File

@ -184,7 +184,7 @@ bufinit(void)
pbp = pdirbp = (struct bufarea *)0;
bufp = Malloc((unsigned int)sblock.fs_bsize);
if (bufp == 0)
if (bufp == NULL)
errx(EEXIT, "cannot allocate buffer pool");
cgblk.b_un.b_buf = bufp;
initbarea(&cgblk, BT_CYLGRP);

View File

@ -290,7 +290,7 @@ ginode(ino_t inumber)
if (startinum == 0 ||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
iblk = ino_to_fsba(&sblock, inumber);
if (pbp != 0)
if (pbp != NULL)
pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
@ -608,7 +608,7 @@ pinode(ino_t ino)
return;
dp = ginode(ino);
printf(" OWNER=");
if ((pw = getpwuid((int)DIP(dp, di_uid))) != 0)
if ((pw = getpwuid((int)DIP(dp, di_uid))) != NULL)
printf("%s ", pw->pw_name);
else
printf("%u ", (unsigned)DIP(dp, di_uid));

View File

@ -349,10 +349,10 @@ checkfilesys(char *filesys)
pfatal(
"CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
snapname, strerror(errno));
} else if ((grp = getgrnam("operator")) == 0 ||
mkdir(snapname, 0770) < 0 ||
chown(snapname, -1, grp->gr_gid) < 0 ||
chmod(snapname, 0770) < 0) {
} else if ((grp = getgrnam("operator")) == NULL ||
mkdir(snapname, 0770) < 0 ||
chown(snapname, -1, grp->gr_gid) < 0 ||
chmod(snapname, 0770) < 0) {
bkgrdflag = 0;
pfatal(
"CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",

View File

@ -151,7 +151,7 @@ pass1(void)
*/
inostathead[c].il_numalloced = inosused;
if (inosused == 0) {
inostathead[c].il_stat = 0;
inostathead[c].il_stat = NULL;
continue;
}
info = Calloc((unsigned)inosused, sizeof(struct inostat));
@ -221,7 +221,7 @@ pass1(void)
inostathead[c].il_numalloced = inosused;
if (inosused == 0) {
free(inostathead[c].il_stat);
inostathead[c].il_stat = 0;
inostathead[c].il_stat = NULL;
continue;
}
info = Calloc((unsigned)inosused, sizeof(struct inostat));
@ -500,9 +500,9 @@ pass1check(struct inodesc *idesc)
return (STOP);
}
new->dup = blkno;
if (muldup == 0) {
if (muldup == NULL) {
duplist = muldup = new;
new->next = 0;
new->next = NULL;
} else {
new->next = muldup->next;
muldup->next = new;

View File

@ -108,7 +108,7 @@ pass1bcheck(struct inodesc *idesc)
if (dlp == muldup)
break;
}
if (muldup == 0 || duphead == muldup->next) {
if (muldup == NULL || duphead == muldup->next) {
rerun = 1;
return (STOP);
}

View File

@ -143,7 +143,7 @@ pass4check(struct inodesc *idesc)
free((char *)dlp);
break;
}
if (dlp == 0) {
if (dlp == NULL) {
clrbmap(blkno);
n_blks--;
}

View File

@ -82,7 +82,7 @@ pass5(void)
}
}
if (fs->fs_maxcontig > 1) {
const char *doit = 0;
const char *doit = NULL;
if (fs->fs_contigsumsize < 1) {
doit = "CREAT";

View File

@ -68,7 +68,7 @@ blockcheck(char *origname)
newname = origname;
if (stat(newname, &stblock) < 0) {
cp = strrchr(newname, '/');
if (cp == 0) {
if (cp == NULL) {
(void)snprintf(device, sizeof(device), "%s%s",
_PATH_DEV, newname);
newname = device;

View File

@ -93,6 +93,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
# Make an SMP-capable kernel by default
options SMP # Symmetric MultiProcessor Kernel
options DEVICE_NUMA # I/O Device Affinity
# CPU frequency control
device cpufreq

View File

@ -92,6 +92,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
# Make an SMP-capable kernel by default
options SMP # Symmetric MultiProcessor Kernel
options DEVICE_NUMA # I/O Device Affinity
# CPU frequency control
device cpufreq

View File

@ -72,7 +72,7 @@
#endif
#ifndef MAXMEMDOM
#define MAXMEMDOM 1
#define MAXMEMDOM 8
#endif
#define ALIGNBYTES _ALIGNBYTES

View File

@ -1,3 +1,4 @@
# This file autogenerated by generate-fat.sh - DO NOT EDIT
# $FreeBSD$
BOOT1_OFFSET=0x2d
BOOT1_MAXSIZE=131072

View File

@ -2,25 +2,25 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-amd64.tmpl.bz2
M0EIH.3%!62936;D*A>0`&T#_____ZZKJ[_^N_^O^Z_Z[OJ_NJ^JK^KZNKNNJ
MZ^KNZOJ^P`+\&$`!D#0T:`80&@T#`@`-`:9`:`P"`R::```:8)II@@,FC(-&
M$`!D,(:9`E5%&3_]*J?ZHC(--&@::#3)HQ#0`&C330,"9,F$::9!D#`F30#3
M3)H9-&1DTR`R:,3"`&0-#1H!A`:#0,"``T!ID!H#`(#)IH``!I@FFF"`R:,@
MT80`&0PAID!5)$)Y0@R&HQ#3U-I--,@-&0R-&@T-`&FF@9-!IIIH-&1ILHTT
M&ADQ#-$\B;1-/2-H93$\4\34Q9ZDM*M:U49"2K6F0C'21$(GD$1$085)7RB(
M00A7Q'^3"!"&CM$T+&UM5A49]7/"3^:EK7GMDVS9MRWK=+E>.(OG-?ZZMDA:
MR74C/HR\T0"$,Y+,YBA.JO&6C*K-DV26*@S24I%*E-2I4J5*JH43)*%"A0H4
M*5-"E)2E2I4J5+!RPP]&&&&&&,P(9X]&&&&&&.IMKISQPX<.'#AP@0A"$(0A
M"$(0A"(MX]&&&&&&&$(0A"$(0(0A"$(?ME2N'#APX<.'"+EZ,,,,,,,($(0A
M"$0>NEGIM!8-(Y6FM$:.>9*3D219:RJKD^H2><E'K)-B^-<-VW[]G'7J_835
MV`;*SC5&G@`GJ:N1`"ME+C<;GOI5H@!F'<0==<-#$2A&BJ%];5)UFHN9,G4?
M]G6ARV-EJBOU_NY'021>1%9\LD8<E236-:]ILVV?0M6\<%=N2Y;G.DQ&<9G;
MYJUNKRLLL]6X.TJQ;DFP1"P)D;"2W:]/XKP9*EC5W57(SUF^DRDD9N1\+:MN
MLGV-ZX"Y<5R'+7S`832.Y=383)I.'I9>O.X4EIVM=.HDTT1'B:J=8;[A9NLU
M"OX%C.X>0U/WZ^E74T&IHJ3EG))(^U[S\6_?HX;B.,Y*]7SGN@PV*_(O+^9#
M+^Q,N_S1'42+=METV+CK9;+US'.8#H,%B,9Y*RD-/)TYXB8XQHI(RLF')')<
MI>OZ<QW[FL!T6"X+#8C:LZZ5O?(VDD<W&Y\YA<5&NDFDA@-2Z#HNDWC!83#;
MMB/W8SIL=EC%D8\FXDOI':7&/BN`UTRVDB;11`(0E`!CSIY+M)?HOW^+N2*<
'*$A<A4+R````
M0EIH.3%!62936?$)3$,`&U9_____Z^KJZ_^N_^O^Z_^[ON_NK^JJ^KZNKNNJ
MZNKNZOJ^P`+\#$!0$#1D-,@#)DT#1B&AIDQ,AD:#1HTR`-#)D80Q!D:,)D``
M#1@F30```&@`$JJ9!_HU4:",3!,F0&C(83`F30T`T!B&!,F`(P3`"#0,@`/2
M::`#0!D`,C1`T9#3(`R9-`T8AH:9,3(9&@T:-,@#0R9&$,09&C"9```T8)DT
M```!H``JBD@_2B:FF9)IHQ/1#:@-`:`R#(T`&@:-`!H8FAH:::'J::-`9&1Z
MFF!'HAB8U/1/*8---3EV+*<ZL\S9BXEC[6I",BE$0BDA$1$%G66TH6PF$0(0
MXDA!"&<HJ,=-W=K>PZ5:L^\19>>T2K3OA>TUS8M>VJ_;9P7"8;&7&8R51N>F
M1E%A#6+F9*H@$(9J<K2V7=DH[YSK)LDN618]0S$3"M6JK5JU:M9J*5)44444
M45JU%:5::U:M6K<:T42HHHHHHYI:J)44444,+B;R5>%%%%%%%$>!!!!!!!!!
M!!!!!!!#76C@<C1HT:-&C1!!!!!!!!!TX&#!@P8,&#J8Y*BBBBBBBB'@<#!@
MP8,&#"$4*******.?ZO)U59NW9Y_5RB9=SGK%AO91D/,RW:JUEWJ7CICT$M,
M]]>OM;-N%^W[!<=H[<-1<QY)W<`%BRT<D`+3375[\FOS\YBD0`RSL8,UV51>
MRR"SVLL>LG*Z1G+K%N;);>IIYL-7L*D<B5U+2/2:5J6K7K+ON7S<-ZW[`8;$
M9ESS6Y>[Q-SH;5D;RU_+ZK.+TEMX%K(QQ813V:GS1ZT;"R\!H$K/Z:=%386M
MPJL.<K?C*J6@DI)\#6KU=,@V3:-JW3>.`X;BN0SS2,I;U*I;;.]O5ZMI9CMV
MY(;8*\CXX-SPW(^Z5WIWPW0V@?7DLGZ@QJQHC6!J-\U[>@T$2F)3"7UM2V+:
M+YMFW;MO6^<-@L)R7+<WLVJEO,&HNI+>XU0JB(L,KI:F[OD%ZUC=-0WB\7C?
M."P'%83CL1BM$RLHD):&7,DOSLY1=2Y,H_EOG`<%YS0,!Q&$XS]')8CXEXP_
MFX2-7*,#%P;!Q]V)E#BO"83#?\V3C..Y#E,1?L5S&,NC%DQI>;+`DS>NQL5?
?+6IF915V$0"$)@`M+"Q)@(_9+!?^+N2*<*$AXA*8A@``
`
end

View File

@ -2,24 +2,25 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-arm.tmpl.bz2
M0EIH.3%!629368U&4)@`&T#_____^ZKJ[_ZN_^O^J_[[OJ_NJ^JK^KZNKN^J
MZNKNZOJ^P`+\```"!H:-`,(#0:!@0`&@-,@-`8!`9--```-,$TTP0&31D&C"
M``R&$-,A`T-&@&$!H-`P(`#0&F0&@,`@,FF@``&F"::8(#)HR#1A``9#"&F0
M@:&C0#"`T&@8$`!H#3(#0&`0&330``#3!--,$!DT9!HP@`,AA#3("J**'Y%(
M1D]&IH`]3(#0``T-`-``&@&F@#0``9``-`:-&"--!H;4T]1HPF:GJ;VW`G0L
M;"P1EY8.%8A&4E$0BV0B(B#=7%\Q$((0OB/ZL$"$.9SBR&6QL9AX#0*.D6]>
MGO'8M.]!X[V'QO:?6V;6L=^[<.#;YP\P:^3CD9VR(!"&?G@>`JM8+J&<8C--
M];XRRIPJ9DN7++ERY<N8*JMB5555555RZJY*Y-RY<N7-SA*I5555559=16)5
M55555>7SNPOB]>O7KUZ]0HHHHHHHHHHHHHHHHY&)5555555444444444****
M***,/F?'O7KUZ]>O7J-;*JJJJJJJA1111111B\A/&6:##:%^>;:*3FK;$R_"
M49GMN<56Z-+L4QW:7AO-:E[[YFN;)^C(;II,,-/FH[0Z.`"W`TDD`/"Q-3ZO
ML:*<*(`<"YB#/:ER\1,(YK`,_;8S*FLEB8#_>+<MF\G$P%_BV#=RS$NU=T[Y
MIWFO5<$^%JVN;-M&V?XWCAF*]'?M#*-K$<'PNNV5S$XG"^G58,:@EX*(9@L/
M9EX4M2TRW1NB2P,O@TP;,QA/DD8DGDO.>FWU[;5/F:QL'WOT8[^6Z<VXABX=
MBR7U\Y.EM9&LL8O*5M72X*(CI.RM9;Y=9C83I5_SY:U]F7ZCX=-<I=4ZFN!:
M9J4I/=>,U3YVK?8UK[7X-H_=D-NW;>OD/OR+$,[IK&Q^A$8LFH>@V#PVR9YG
MFT;5MG].4;EO&2ZIF9'12_Z38G,2C$ENY1LWXMH_5^S1,=D-NW#Z6[;QY[BG
M]^GM3.Q$O,EW$F/D[:TW.P$RAD.J;=[[^WP-PW+=/];QL62_YE,0WLF5+)EC
ER<EJ,K>OH:6QGY19C1`(0F`#*M6RUZ60C(?^+N2*<*$A&HRA,```
M0EIH.3%!62936>#67)H`&U9_____Z^KJZ_ZN_^O^J_^[OJ[NK^JJ^KZNKNNJ
MZNKNZOJ^P`+\```"``:`T::-`:8@P@&1D-!H:808)B:#0`T``,$T#!,@PC09
M#33"9,0`T(`!H#1IHT!IB#"`9&0T&AIA!@F)H-`#0``P30,$R#"-!D--,)DQ
M`#0@`&@-&FC0&F(,(!D9#0:&F$&"8F@T`-``#!-`P3(,(T&0TTPF3$`-`522
M$_(H2-DT0T:8C(T!H!ZC30R-&@-`,@&C1H:`:#1M3(T,@:::/1#331FII@)@
M)Z:)RK5N6<7,O<%[)S4ZD(ODD1"*2"(B(+E99)"P2A$"$.#(((0Z^BHO)97*
MKNTS2;//!6_,:)5IVI>LPGUM8_)MV&_QO'$<Q>Y;`J/TETR.=50:\2B`0AF9
M<_.ME;:;0N<9%D%\Q['*&6B4*U:JM6K5JUQ12I)1111116K45I*TJU:M6K<:
MZ424444448Y-1)111111[F<_6R+%BQ8L6+$X3333333333333333=7Z\E2M6
MK5JU:M--------->R44444447N#[%BQ8L6+%BQ-M)*******,!0HHHHHHHY[
M-RR5757;.MS?HE)GL[:M-Q)&/TG09Q6MZ%)XJ4><D]5[S5M>^]M6W8C@..T=
MV&HOX\@T$`%JWHY$`-/ZV!A?)K>YEEZ1`#*,&#,]G484F/7/RDR%Y<?]FG8X
M&-?VUWJ*AR)+Z32//:9[#4M6R;8-FVK<,1OG$8K*LE&JR>4Q?U[J:^S$]EPK
MD81)^D"<A>%H^>2OU:FLC31KK??,_$ES74S%+)U7JU5D:VQD)R-2U3"7[FWW
M-DPVV;ANV^9-R&"T;G,A>6EJ3:=EVE6ENKC#PZG.]=9:75*G=>-4N\OA]'=-
M`L[RN\MM/>Z'8:6Q.RAWU+=HOHDCZ6H?8_!^+:-JVS^6Z;UP'#<ERG-[$W'`
MJ+^19>>T*HB+3GM+4VVS(NQ)&K?`_9IW\,PS#$;QOG"<-QV*QFB8^2)!)H).
M7(_@P9(R$G)DC<L1NV\;UGV_<)Q'&?FY+%?$Z1Q?DWR/?DC@8W"M'(_<RTBJ
M2'#=^XK8.,U[CN0Q'_,5MV,Y;F,`QI',DW7EU-_(S>MYF,_-.IT<D58,0"$)
60`75I:D;]&V2<%_XNY(IPH2'!K+DT```
`
end

View File

@ -2,25 +2,25 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-arm64.tmpl.bz2
M0EIH.3%!629360E-\T``&T#_____ZZKJ[__N_^O^J_Z[OJ_NJ^JK^KZNKNNJ
MZNKNZOJ^P`+<#$``@`-#(T9!IIIH:-&F@&)D--,C0T#$,3(--````:-#$TT&
MC1@@:9#(!HQ,1II@E532,_]2J?ZH!!IIH:,1HQ-#$T-!HTQ,1B#`"`R8C)DR
M`:8(T9-&3$--&$P$&F$&0:8@`-#(T9!IIIH:-&F@&)D--,C0T#$,3(--````
M:-#$TT&C1@@:9#(!HQ,1II@511(>21,:&D:`])Z0-`T&FC30:&1D`R:!IDT:
M#30&FC1ZFC1H::8FF3$VB,(TTT])@38C)J85-B<VNK6T&+E:6M"$8B41"*9"
M(B(,"LLS$0@A"S$<J@0(0S-RHABKJZ6]AEEL\13YB=*T+W'R/=:]M'V-VX+>
M+YQG-=.Q@NI[!'1T;V8B`A#*STN3J4K5GURR"X8UC&+5'4IF2M6HK5JU:M:*
ME5"52I4J5*E:NI6E6FM6K5JU_:JDJE2I4J5,6ME42J5*E2I4^'O-]9BRLK*R
MLFC1`A"$(0A"$(0A"$;QR<#!@P8,&#!"$(0A"$"$(0A"';?U+1HT:-&C1HB^
M<#!@P8,&#!`A"$(0C7[MQ"N?8V[-.'W]RCNJ:$RX4HQWHVBV4YY+0IC2I>VU
M;7-BVR]<!Q'(8#1VX:JXC1&<@`IL:.2`&/UUYK^^FTB`&3=Q!E-<[>(F$9BP
M=730QJVW4L?8<[K';9##R%A9U.GI9677RQN6E'U1%+!E3+1M(]9JFL:Y=-DW
M"]<)Q'^O^<]E5STS6]5E-YO[9<7=KN-9:1>$M0B%N4(U$KQIE.=8Z5C+VGUV
ME&,M6TD7<GO-6UK&M@V;\FY;UP'$7SDL!WKN62MZ%$MUFYTM+(Q&YH49>VI5
M2V,1&=T5*WVNYREJSRSML52\#%Y_8Z:M;5U&@JL4EQ*4FP:ELFU?FW3=M\X+
MAKYQW+8+";,W_'H0Z33T+W;(C)2?.^->O:?NNUVX;BN,Y+EK]SV&\=CI&<ET
M)-\9B49"6#*."_AFG$<5WZ^<ARW-;=@N>UCK7,O.*CXI1_F'QM)8+^]$RAQV
M@<IRW,;)S5^P'.<]^##=!B,B84F)+#E?2=I]&)A-NTU"[E%&9B`0A,`&)2IE
0O4N0CD/_%W)%.%"0"4WS0```
M0EIH.3%!629364C65#T`&U;_____Z^KJZ_^N_^O^J_^[OJ[NK^JJ^KZNKNNJ
MZNKNZOJ^P`+\#0``0`#0#)D&@TR8AD`,0!D--&`@:!H&@`!B#)IHR:--#(9,
MAA`8F@Q,0,#52`_U4?J@`&AH```:`:``````T-`T&@R&@T``````````$``T
M`R9!H-,F(9`#$`9#31@(&@:!H``8@R::,FC30R&3(80&)H,3$#`521(]I1I)
MF*:8C1Z`F0:`TR,@:&C30:`R!HTT,$!DTT-J:&@R&C)IA,:F33(S4]-3`--$
MZ--B6=6F1M!<28FJA"+E)$0B<@B(B"TK+:2%L)0B!"'(D$$(9F:@LRO+Q;TL
MNJ9YY2QZK1*-0US5+UM6R;E?-T_QQG*=-<9#J:#>R[!&-40;(2B`0AE9=956
MO+"IH&,8M=KEBF(3,A$H5JU%:M6K5K1-.A)------6K35I*TJU:M6K<RU323
M333338A4FDFFFFFFMX;;,<,#`P,#`P,".`@0($"!`@0($"!`@0J5,OJY*%:M
M6K5JU:I4J5*E2I4J*E2I4J5*EQ<9OW>[LK*RLK*RLK*INY)IIIIIIL6F3333
M333=7VLL91VEN[UP[M$I,5X--+@R1:XKTL?G%LL>,D\Y*-*DU+6MB^YMF\7S
MB,!S6CMPUEU'H'B0`4V-'(@!JKN]^?Z<]*UB`&/9J#*9N@O9.H6FYDN5AT,L
MS-UAW-A;:O3J61R=".=)EY-(TK3M8US8NM;1N&\<%Q%^Y3"9%=8Z-AUMYA;W
MPYKK)5;?@6D;$DWL"J0LE*.Q]RA>Q[,;.QH%VDM/KGE)[.JBX4T=56_.0JD:
MUL&Q73$OR;=NF^?PXKCL%SF=:1FKO&W%A1)O,YWU&FM;1N]W0QW=6U*UDS]Q
M0M\CN\G:L^KT%O2U%G0;335JJYFAG8I,5$D?:UC\'Z/U;QO7`<)_3CL!R7/=
M%B=L<+`H+J1;6??%$1%*H8[34M_N$+V0O6O;YJ7!95E7%<9?L%R7-83#:)BY
M(D$F?DZ4B^,W)%W)SY(X;B/[<9?L\P'_-*YC<N>PGRLLY=[?HU\D?[A\BDOL
MP)20P6A<ERG+;5S'-<YT&$OF&Z3IKLPY'3DPI,"1F-ET\-^SUZ&2DBC-1`(0
6E`!:TJ9&`C?I,%_XNY(IPH2"1K*AZ```
`
end

View File

@ -2,24 +2,25 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-i386.tmpl.bz2
M0EIH.3%!629363V[U-``&T#_____^ZKJ[_ZN_^O^J_Z[OJ_NK^JO^KZNKNNJ
MZNKNZOJ^P`+\&$`!(&AHT`P@-!H&!``:`TR`T!@$!DTT```TP333!`9-&0:,
M(`#(80TR!*J:B:?_I5/]51H9!D:`80&C"8(&@--,$`!H#30R,@P$R:`T`9`:
M-`T`T``:`:(&AHT`P@-!H&!``:`TR`T!@$!DTT```TP333!`9-&0:,(`#(80
MTR`JBIJ9-JF28Q31Z1ZFFTU&0T!H:#0::`TT#0:!B`&@#)H8C330TTTTTR:>
MAHF"/4]33TFT:38F)J8U%A.A7-:J,G*K6J(1D)1$(HD(B(@PZ3)3$0@A#)1'
M+J"!"&@RZI"SN;E96#/+%WZCR4ZAIFK:Y[S9MPVC>N*WZ_<AS5PRF:F#@2ZQ
M%O4A`0AU$])F*ZA5>(RZV6C*LHLU<S*9DI4JE*E2I4JJNKU$JZNKJZNKJ5-=
M2E2FE2I4J6%6,0######$4(:%`,,,,,,<//>!X3CCCCCCB!"$(0A"$(0A"$(
MS<*`88888880A"$(0A`A"$(0C!3?!<<<<<<<<1=P#######"!"$(0A$;FH,M
M4SUDT*]Z%WLG;45$RXTHRWG]PKJ/#2TR8U"7MOD;%M7Z+QQ%\P&&T]D'NVD>
M::.`"BPT\D`+78Z_9=Y-6(`9AVD&;V+LXB81H+`NJ*C*K&[E:V#G9QG[;'MM
M5=5EG[E08DLK+SGIJ[5M8V"X?@W:\<9?/]?\Q6:9VWUUQF=]P[%:=76W7"JQ
MKR7KHA<:*4;Z(Z`RE9'L2V#5*/!9R5AV-79U;6BLW$C)R?`UCYUJVC;MR_9P
M'$7R_<IANY7#HK*HJ2N]#.IM;!O)9?/UZ%,M'$1X'E4+/<;RYK/"9+<V="[R
M>DVNJI6--<TM>PH+24I-HU;;/S;I=MZX+BKU?N2P6(QFW.'R:@M8B5OZE1>;
MDBWE6DU[6M^\APETNEZX[D.4P6$Q6.TK+2-'+GR<`[646TL24<1QEZOG':)?
ML!@N:W;$8KYF=<S8<=&ME'^8_(H,*\$RAR6D<M@N8VSFL)AN<Q7!8[GLA;&-
J)D2QY7\G7;+(QGZM349N45-!$`A"8`,BA1*\2P$8!_Q=R13A0D#V[U-`
M0EIH.3%!629361/"1&$`&U;_____Z^KJZ_ZN_^O^J_^[OJ[NK^JJ^KZNKNNJ
MZNKNZOJ^P`+\#0``0`#0&C31H#3$&$`R,AH-#3"#!,30:`&@`!@F@8)D&$:#
M(::83)B`&@:J0:?ZJ/U30`,@```-`,F@``````R-```R``````````$``T!H
MTT:`TQ!A`,C(:#0TP@P3$T&@!H``8)H&"9!A&@R&FF$R8@!H"JB(GM*:(3VI
MJ:;29-DF)ZC1H#)IA&0,C1H`R`VH#3$#(#R(R#(T8FFR$P(R8&AHQ3TTU.M/
M4CH56XJBSBR%$R"%HBA""$HA"$(0*M)8Q06(C!"`@@OXA`@@[^28LHY?+JTZ
MY4-*\Q4]=JDWP-DUR\;EM6^<1OW+<Q@,99V]K,<"*#>(;UG$,HJ0@""#-QRL
MK%;U%@U#)LDM5=:+-(N(1@I4IJ5*E2I54DID4DDDDDE*E)2BI1I4J5*EU;!)
M%))))))CE"2*222222VAMLQPP,#`P,#`P(X"!`@0($"!`@0($"!"A0[?7Q3*
M5*E2I4J5"A0H4*%"A04*%"A0H4+.ST&QK*RLK*RLK*RA>Q22222226J1))))
M)))E.[CDIL[6:1_==<1)HM-I)YW&BA1::S+:)65-0B]%&'M(M<V2\;ANU\XC
MDN@P6KK!L*\/4/(@`3U-7$@`^+([2[^_Q8V$(`,J\&!FM!,;2+'JN_BM,?5?
M]<L]7Q:]TM\Q0QVOF&%%<Q:Q[:EL&S7C+-RWS@N,Y+G,!B+A<VSZ\M;XG"\:
M2OF*-[X56%V1<"`HB+(LZB&<]^9>0NH;>IIW;(JNVEFI;>C')YXV5+]XBB)\
M[ZEVKL@W3>-^_IQW*<UT6$T3U7N9.RG317VA\.:ZL*J]MKV=;9^M.HBT^EF6
M68O<S8-.I\NM.KV7E;C6TJ*9&IE4G.PA%#\6O?HW;^%\X#AN0Y3FN@Z;#=9D
M/V./M9BO$L;+8B:$(3K:ZF<+>(%VV;@O/<5F69<ES'/=%TV"Q&*U3*10B$7C
MQ3(=>*8X9GXH9&+#BAR'^.4Y;FM,Y[HL!@OY8;$?8S;J7G.0^F*'/Q;^<WV%
MPQ&*#I-2P'4=5NF"PF&_UB.*Q778RU,6)C18D5_$SNVQL5?-;,[6*$V>A`$$
7$8`%A.GB7Z'$1=)_XNY(IPH2`GA(C"``
`
end

View File

@ -44,6 +44,8 @@ mkdir -p stub/efi/boot
# Make a dummy file for boot1
echo 'Boot1 START' | dd of=stub/efi/boot/$FILENAME cbs=$BOOT1_SIZE count=1 conv=block
# Provide a fallback startup.nsh
echo $FILENAME > stub/efi/boot/startup.nsh
umount stub
mdconfig -d -u $DEVICE

View File

@ -115,27 +115,14 @@ vdev_geom_attrchanged(struct g_consumer *cp, const char *attr)
if (error == 0) {
char *old_physpath;
/* g_topology lock ensures that vdev has not been closed */
g_topology_assert();
old_physpath = vd->vdev_physpath;
vd->vdev_physpath = spa_strdup(physpath);
spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
if (old_physpath != NULL) {
int held_lock;
held_lock = spa_config_held(spa, SCL_STATE, RW_WRITER);
if (held_lock == 0) {
g_topology_unlock();
spa_config_enter(spa, SCL_STATE, FTAG,
RW_WRITER);
}
if (old_physpath != NULL)
spa_strfree(old_physpath);
if (held_lock == 0) {
spa_config_exit(spa, SCL_STATE, FTAG);
g_topology_lock();
}
}
}
g_free(physpath);
}

File diff suppressed because it is too large Load Diff

View File

@ -487,7 +487,9 @@ static const struct {
{ STATS_OFFSET32(mbuf_alloc_sge),
4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"},
{ STATS_OFFSET32(mbuf_alloc_tpa),
4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}
4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"},
{ STATS_OFFSET32(tx_queue_full_return),
4, STATS_FLAGS_FUNC, "tx_queue_full_return"}
};
static const struct {
@ -598,7 +600,9 @@ static const struct {
{ Q_STATS_OFFSET32(mbuf_alloc_sge),
4, "mbuf_alloc_sge"},
{ Q_STATS_OFFSET32(mbuf_alloc_tpa),
4, "mbuf_alloc_tpa"}
4, "mbuf_alloc_tpa"},
{ Q_STATS_OFFSET32(tx_queue_full_return),
4, "tx_queue_full_return"}
};
#define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr)
@ -668,7 +672,6 @@ static void bxe_handle_fp_tq(void *context, int pending);
static int bxe_add_cdev(struct bxe_softc *sc);
static void bxe_del_cdev(struct bxe_softc *sc);
static int bxe_grc_dump(struct bxe_softc *sc);
static int bxe_alloc_buf_rings(struct bxe_softc *sc);
static void bxe_free_buf_rings(struct bxe_softc *sc);
@ -3445,6 +3448,10 @@ bxe_watchdog(struct bxe_softc *sc,
}
BLOGE(sc, "TX watchdog timeout on fp[%02d], resetting!\n", fp->index);
if(sc->trigger_grcdump) {
/* taking grcdump */
bxe_grc_dump(sc);
}
BXE_FP_TX_UNLOCK(fp);
@ -4619,7 +4626,7 @@ bxe_ioctl(if_t ifp,
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
/* set the receive mode flags */
bxe_set_rx_mode(sc);
} else {
} else if(sc->state != BXE_STATE_DISABLED) {
bxe_init_locked(sc);
}
} else {
@ -5723,11 +5730,6 @@ bxe_tx_start(if_t ifp)
return;
}
if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE) {
BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n");
return;
}
if (!sc->link_vars.link_up) {
BLOGW(sc, "Interface link is down, ignoring transmit request\n");
return;
@ -5735,6 +5737,11 @@ bxe_tx_start(if_t ifp)
fp = &sc->fp[0];
if (ifp->if_drv_flags & IFF_DRV_OACTIVE) {
fp->eth_q_stats.tx_queue_full_return++;
return;
}
BXE_FP_TX_LOCK(fp);
bxe_tx_start_locked(sc, ifp, fp);
BXE_FP_TX_UNLOCK(fp);
@ -9936,21 +9943,6 @@ bxe_init_internal_common(struct bxe_softc *sc)
{
int i;
if (IS_MF_SI(sc)) {
/*
* In switch independent mode, the TSTORM needs to accept
* packets that failed classification, since approximate match
* mac addresses aren't written to NIG LLH.
*/
REG_WR8(sc,
(BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET),
2);
} else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */
REG_WR8(sc,
(BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET),
0);
}
/*
* Zero this manually as its initialization is currently missing
* in the initTool.
@ -12269,6 +12261,8 @@ static void
bxe_periodic_callout_func(void *xsc)
{
struct bxe_softc *sc = (struct bxe_softc *)xsc;
struct bxe_fastpath *fp;
uint16_t tx_bd_avail;
int i;
if (!BXE_CORE_TRYLOCK(sc)) {
@ -12291,6 +12285,48 @@ bxe_periodic_callout_func(void *xsc)
return;
}
#if __FreeBSD_version >= 800000
FOR_EACH_QUEUE(sc, i) {
fp = &sc->fp[i];
if (BXE_FP_TX_TRYLOCK(fp)) {
if_t ifp = sc->ifp;
/*
* If interface was stopped due to unavailable
* bds, try to process some tx completions
*/
(void) bxe_txeof(sc, fp);
tx_bd_avail = bxe_tx_avail(sc, fp);
if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) {
bxe_tx_mq_start_locked(sc, ifp, fp, NULL);
}
BXE_FP_TX_UNLOCK(fp);
}
}
#else
fp = &sc->fp[0];
if (BXE_FP_TX_TRYLOCK(fp)) {
struct ifnet *ifp = sc->ifnet;
/*
* If interface was stopped due to unavailable
* bds, try to process some tx completions
*/
(void) bxe_txeof(sc, fp);
tx_bd_avail = bxe_tx_avail(sc, fp);
if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) {
bxe_tx_start_locked(sc, ifp, fp);
}
BXE_FP_TX_UNLOCK(fp);
}
#endif /* #if __FreeBSD_version >= 800000 */
/* Check for TX timeouts on any fastpath. */
FOR_EACH_QUEUE(sc, i) {
if (bxe_watchdog(sc, &sc->fp[i]) != 0) {
@ -13620,49 +13656,60 @@ bxe_get_tunable_params(struct bxe_softc *sc)
sc->udp_rss);
}
static void
static int
bxe_media_detect(struct bxe_softc *sc)
{
int port_type;
uint32_t phy_idx = bxe_get_cur_phy_idx(sc);
switch (sc->link_params.phy[phy_idx].media_type) {
case ELINK_ETH_PHY_SFPP_10G_FIBER:
case ELINK_ETH_PHY_XFP_FIBER:
BLOGI(sc, "Found 10Gb Fiber media.\n");
sc->media = IFM_10G_SR;
port_type = PORT_FIBRE;
break;
case ELINK_ETH_PHY_SFP_1G_FIBER:
BLOGI(sc, "Found 1Gb Fiber media.\n");
sc->media = IFM_1000_SX;
port_type = PORT_FIBRE;
break;
case ELINK_ETH_PHY_KR:
case ELINK_ETH_PHY_CX4:
BLOGI(sc, "Found 10GBase-CX4 media.\n");
sc->media = IFM_10G_CX4;
port_type = PORT_FIBRE;
break;
case ELINK_ETH_PHY_DA_TWINAX:
BLOGI(sc, "Found 10Gb Twinax media.\n");
sc->media = IFM_10G_TWINAX;
port_type = PORT_DA;
break;
case ELINK_ETH_PHY_BASE_T:
if (sc->link_params.speed_cap_mask[0] &
PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) {
BLOGI(sc, "Found 10GBase-T media.\n");
sc->media = IFM_10G_T;
port_type = PORT_TP;
} else {
BLOGI(sc, "Found 1000Base-T media.\n");
sc->media = IFM_1000_T;
port_type = PORT_TP;
}
break;
case ELINK_ETH_PHY_NOT_PRESENT:
BLOGI(sc, "Media not present.\n");
sc->media = 0;
port_type = PORT_OTHER;
break;
case ELINK_ETH_PHY_UNSPECIFIED:
default:
BLOGI(sc, "Unknown media!\n");
sc->media = 0;
port_type = PORT_OTHER;
break;
}
return port_type;
}
#define GET_FIELD(value, fname) \
@ -15592,30 +15639,6 @@ bxe_sysctl_state(SYSCTL_HANDLER_ARGS)
return (error);
}
static int
bxe_sysctl_trigger_grcdump(SYSCTL_HANDLER_ARGS)
{
struct bxe_softc *sc;
int error, result;
result = 0;
error = sysctl_handle_int(oidp, &result, 0, req);
if (error || !req->newptr) {
return (error);
}
if (result == 1) {
sc = (struct bxe_softc *)arg1;
BLOGI(sc, "... grcdump start ...\n");
bxe_grc_dump(sc);
BLOGI(sc, "... grcdump done ...\n");
}
return (error);
}
static int
bxe_sysctl_eth_stat(SYSCTL_HANDLER_ARGS)
{
@ -15767,14 +15790,16 @@ bxe_add_sysctls(struct bxe_softc *sc)
"debug logging mode");
#endif /* #if __FreeBSD_version >= 900000 */
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "trigger_grcdump",
CTLTYPE_UINT | CTLFLAG_RW, sc, 0,
bxe_sysctl_trigger_grcdump, "IU",
"set by driver when a grcdump is needed");
sc->trigger_grcdump = 0;
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "trigger_grcdump",
CTLFLAG_RW, &sc->trigger_grcdump, 0,
"trigger grcdump should be invoked"
" before collecting grcdump");
sc->grcdump_started = 0;
sc->grcdump_done = 0;
SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "grcdump_done",
CTLFLAG_RW, &sc->grcdump_done, 0,
CTLFLAG_RD, &sc->grcdump_done, 0,
"set by driver when grcdump is done");
sc->rx_budget = bxe_rx_budget;
@ -16137,6 +16162,7 @@ bxe_detach(device_t dev)
if (sc->state != BXE_STATE_CLOSED) {
BXE_CORE_LOCK(sc);
bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE);
sc->state = BXE_STATE_DISABLED;
BXE_CORE_UNLOCK(sc);
}
@ -18605,7 +18631,7 @@ bxe_get_preset_regs(struct bxe_softc *sc, uint32_t *p, uint32_t preset)
return 0;
}
static int
int
bxe_grc_dump(struct bxe_softc *sc)
{
int rval = 0;
@ -18613,12 +18639,53 @@ bxe_grc_dump(struct bxe_softc *sc)
uint8_t *buf;
uint32_t size;
struct dump_header *d_hdr;
uint32_t i;
uint32_t reg_val;
uint32_t reg_addr;
uint32_t cmd_offset;
int context_size;
int allocated;
struct ecore_ilt *ilt = SC_ILT(sc);
struct bxe_fastpath *fp;
struct ilt_client_info *ilt_cli;
int grc_dump_size;
if (sc->grcdump_done)
if (sc->grcdump_done || sc->grcdump_started)
return (rval);
sc->grcdump_started = 1;
BLOGI(sc, "Started collecting grcdump\n");
grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) +
sizeof(struct dump_header);
sc->grc_dump = malloc(grc_dump_size, M_DEVBUF, M_NOWAIT);
if (sc->grc_dump == NULL) {
BLOGW(sc, "Unable to allocate memory for grcdump collection\n");
return(ENOMEM);
}
/* Disable parity attentions as long as following dump may
* cause false alarms by reading never written registers. We
* will re-enable parity attentions right after the dump.
*/
/* Disable parity on path 0 */
bxe_pretend_func(sc, 0);
ecore_disable_blocks_parity(sc);
/* Disable parity on path 1 */
bxe_pretend_func(sc, 1);
ecore_disable_blocks_parity(sc);
/* Return to current function */
bxe_pretend_func(sc, SC_ABS_FUNC(sc));
buf = sc->grc_dump;
d_hdr = sc->grc_dump;
@ -18650,7 +18717,7 @@ bxe_grc_dump(struct bxe_softc *sc)
(preset_idx == 11))
continue;
rval = bxe_get_preset_regs(sc, sc->grc_dump, preset_idx);
rval = bxe_get_preset_regs(sc, (uint32_t *)buf, preset_idx);
if (rval)
break;
@ -18660,9 +18727,78 @@ bxe_grc_dump(struct bxe_softc *sc)
buf += size;
}
bxe_pretend_func(sc, 0);
ecore_clear_blocks_parity(sc);
ecore_enable_blocks_parity(sc);
bxe_pretend_func(sc, 1);
ecore_clear_blocks_parity(sc);
ecore_enable_blocks_parity(sc);
/* Return to current function */
bxe_pretend_func(sc, SC_ABS_FUNC(sc));
context_size = (sizeof(union cdu_context) * BXE_L2_CID_COUNT(sc));
for (i = 0, allocated = 0; allocated < context_size; i++) {
BLOGI(sc, "cdu_context i %d paddr %#jx vaddr %p size 0x%zx\n", i,
sc->context[i].vcxt_dma.paddr, sc->context[i].vcxt_dma.vaddr,
sc->context[i].size);
allocated += sc->context[i].size;
}
BLOGI(sc, "fw stats start_paddr %#jx end_paddr %#jx vaddr %p size 0x%x\n",
(uintmax_t)sc->fw_stats_req_mapping,
(uintmax_t)sc->fw_stats_data_mapping,
sc->fw_stats_req, (sc->fw_stats_req_size + sc->fw_stats_data_size));
BLOGI(sc, "def_status_block paddr %p vaddr %p size 0x%lx\n",
(void *)sc->def_sb_dma.paddr, sc->def_sb,
sizeof(struct host_sp_status_block));
BLOGI(sc, "event_queue paddr %#jx vaddr %p size 0x%x\n",
sc->eq_dma.paddr, sc->eq_dma.vaddr, BCM_PAGE_SIZE);
BLOGI(sc, "slow path paddr %#jx vaddr %p size 0x%lx\n",
sc->sp_dma.paddr, sc->sp_dma.vaddr, sizeof(struct bxe_slowpath));
BLOGI(sc, "slow path queue paddr %#jx vaddr %p size 0x%x\n",
sc->spq_dma.paddr, sc->spq_dma.vaddr, BCM_PAGE_SIZE);
BLOGI(sc, "fw_buf paddr %#jx vaddr %p size 0x%x\n",
sc->gz_buf_dma.paddr, sc->gz_buf_dma.vaddr, FW_BUF_SIZE);
for (i = 0; i < sc->num_queues; i++) {
fp = &sc->fp[i];
BLOGI(sc, "FP status block fp %d paddr %#jx vaddr %p size 0x%lx\n", i,
fp->sb_dma.paddr, fp->sb_dma.vaddr,
sizeof(union bxe_host_hc_status_block));
BLOGI(sc, "TX BD CHAIN fp %d paddr %#jx vaddr %p size 0x%x\n", i,
fp->tx_dma.paddr, fp->tx_dma.vaddr,
(BCM_PAGE_SIZE * TX_BD_NUM_PAGES));
BLOGI(sc, "RX BD CHAIN fp %d paddr %#jx vaddr %p size 0x%x\n", i,
fp->rx_dma.paddr, fp->rx_dma.vaddr,
(BCM_PAGE_SIZE * RX_BD_NUM_PAGES));
BLOGI(sc, "RX RCQ CHAIN fp %d paddr %#jx vaddr %p size 0x%lx\n", i,
fp->rcq_dma.paddr, fp->rcq_dma.vaddr,
(BCM_PAGE_SIZE * RCQ_NUM_PAGES));
BLOGI(sc, "RX SGE CHAIN fp %d paddr %#jx vaddr %p size 0x%x\n", i,
fp->rx_sge_dma.paddr, fp->rx_sge_dma.vaddr,
(BCM_PAGE_SIZE * RX_SGE_NUM_PAGES));
}
ilt_cli = &ilt->clients[1];
for (i = ilt_cli->start; i <= ilt_cli->end; i++) {
BLOGI(sc, "ECORE_ILT paddr %#jx vaddr %p size 0x%x\n",
((struct bxe_dma *)((&ilt->lines[i])->page))->paddr,
((struct bxe_dma *)((&ilt->lines[i])->page))->vaddr, BCM_PAGE_SIZE);
}
cmd_offset = DMAE_REG_CMD_MEM;
for (i = 0; i < 224; i++) {
reg_addr = (cmd_offset +(i * 4));
reg_val = REG_RD(sc, reg_addr);
BLOGI(sc, "DMAE_REG_CMD_MEM i=%d reg_addr 0x%x reg_val 0x%08x\n",i,
reg_addr, reg_val);
}
BLOGI(sc, "Collection of grcdump done\n");
sc->grcdump_done = 1;
return(rval);
}
@ -18670,15 +18806,12 @@ bxe_grc_dump(struct bxe_softc *sc)
static int
bxe_add_cdev(struct bxe_softc *sc)
{
int grc_dump_size;
sc->eeprom = malloc(BXE_EEPROM_MAX_DATA_LEN, M_DEVBUF, M_NOWAIT);
grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) +
sizeof(struct dump_header);
sc->grc_dump = malloc(grc_dump_size, M_DEVBUF, M_NOWAIT);
if (sc->grc_dump == NULL)
if (sc->eeprom == NULL) {
BLOGW(sc, "Unable to alloc for eeprom size buffer\n");
return (-1);
}
sc->ioctl_dev = make_dev(&bxe_cdevsw,
sc->ifp->if_dunit,
@ -18689,9 +18822,8 @@ bxe_add_cdev(struct bxe_softc *sc)
if_name(sc->ifp));
if (sc->ioctl_dev == NULL) {
free(sc->grc_dump, M_DEVBUF);
free(sc->eeprom, M_DEVBUF);
sc->eeprom = NULL;
return (-1);
}
@ -18706,12 +18838,150 @@ bxe_del_cdev(struct bxe_softc *sc)
if (sc->ioctl_dev != NULL)
destroy_dev(sc->ioctl_dev);
if (sc->grc_dump == NULL)
free(sc->grc_dump, M_DEVBUF);
if (sc->eeprom != NULL) {
free(sc->eeprom, M_DEVBUF);
sc->eeprom = NULL;
}
sc->ioctl_dev = NULL;
return;
}
static bool bxe_is_nvram_accessible(struct bxe_softc *sc)
{
if ((if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) == 0)
return FALSE;
return TRUE;
}
static int
bxe_wr_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len)
{
int rval = 0;
if(!bxe_is_nvram_accessible(sc)) {
BLOGW(sc, "Cannot access eeprom when interface is down\n");
return (-EAGAIN);
}
rval = bxe_nvram_write(sc, offset, (uint8_t *)data, len);
return (rval);
}
static int
bxe_rd_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len)
{
int rval = 0;
if(!bxe_is_nvram_accessible(sc)) {
BLOGW(sc, "Cannot access eeprom when interface is down\n");
return (-EAGAIN);
}
rval = bxe_nvram_read(sc, offset, (uint8_t *)data, len);
return (rval);
}
static int
bxe_eeprom_rd_wr(struct bxe_softc *sc, bxe_eeprom_t *eeprom)
{
int rval = 0;
switch (eeprom->eeprom_cmd) {
case BXE_EEPROM_CMD_SET_EEPROM:
rval = copyin(eeprom->eeprom_data, sc->eeprom,
eeprom->eeprom_data_len);
if (rval)
break;
rval = bxe_wr_eeprom(sc, sc->eeprom, eeprom->eeprom_offset,
eeprom->eeprom_data_len);
break;
case BXE_EEPROM_CMD_GET_EEPROM:
rval = bxe_rd_eeprom(sc, sc->eeprom, eeprom->eeprom_offset,
eeprom->eeprom_data_len);
if (rval) {
break;
}
rval = copyout(sc->eeprom, eeprom->eeprom_data,
eeprom->eeprom_data_len);
break;
default:
rval = EINVAL;
break;
}
if (rval) {
BLOGW(sc, "ioctl cmd %d failed rval %d\n", eeprom->eeprom_cmd, rval);
}
return (rval);
}
static int
bxe_get_settings(struct bxe_softc *sc, bxe_dev_setting_t *dev_p)
{
uint32_t ext_phy_config;
int port = SC_PORT(sc);
int cfg_idx = bxe_get_link_cfg_idx(sc);
dev_p->supported = sc->port.supported[cfg_idx] |
(sc->port.supported[cfg_idx ^ 1] &
(ELINK_SUPPORTED_TP | ELINK_SUPPORTED_FIBRE));
dev_p->advertising = sc->port.advertising[cfg_idx];
if(sc->link_params.phy[bxe_get_cur_phy_idx(sc)].media_type ==
ELINK_ETH_PHY_SFP_1G_FIBER) {
dev_p->supported = ~(ELINK_SUPPORTED_10000baseT_Full);
dev_p->advertising &= ~(ADVERTISED_10000baseT_Full);
}
if ((sc->state == BXE_STATE_OPEN) && sc->link_vars.link_up &&
!(sc->flags & BXE_MF_FUNC_DIS)) {
dev_p->duplex = sc->link_vars.duplex;
if (IS_MF(sc) && !BXE_NOMCP(sc))
dev_p->speed = bxe_get_mf_speed(sc);
else
dev_p->speed = sc->link_vars.line_speed;
} else {
dev_p->duplex = DUPLEX_UNKNOWN;
dev_p->speed = SPEED_UNKNOWN;
}
dev_p->port = bxe_media_detect(sc);
ext_phy_config = SHMEM_RD(sc,
dev_info.port_hw_config[port].external_phy_config);
if((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) ==
PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT)
dev_p->phy_address = sc->port.phy_addr;
else if(((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) !=
PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) &&
((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) !=
PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN))
dev_p->phy_address = ELINK_XGXS_EXT_PHY_ADDR(ext_phy_config);
else
dev_p->phy_address = 0;
if(sc->link_params.req_line_speed[cfg_idx] == ELINK_SPEED_AUTO_NEG)
dev_p->autoneg = AUTONEG_ENABLE;
else
dev_p->autoneg = AUTONEG_DISABLE;
return 0;
}
static int
bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
struct thread *td)
@ -18721,6 +18991,14 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
device_t pci_dev;
bxe_grcdump_t *dump = NULL;
int grc_dump_size;
bxe_drvinfo_t *drv_infop = NULL;
bxe_dev_setting_t *dev_p;
bxe_dev_setting_t dev_set;
bxe_get_regs_t *reg_p;
bxe_reg_rdw_t *reg_rdw_p;
bxe_pcicfg_rdw_t *cfg_rdw_p;
bxe_perm_mac_addr_t *mac_addr_p;
if ((sc = (struct bxe_softc *)dev->si_drv1) == NULL)
return ENXIO;
@ -18733,26 +19011,125 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
case BXE_GRC_DUMP_SIZE:
dump->pci_func = sc->pcie_func;
dump->grcdump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) +
sizeof(struct dump_header);
dump->grcdump_size =
(bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) +
sizeof(struct dump_header);
break;
case BXE_GRC_DUMP:
grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) +
sizeof(struct dump_header);
if ((sc->grc_dump == NULL) || (dump->grcdump == NULL) ||
(dump->grcdump_size < grc_dump_size) || (!sc->grcdump_done)) {
sizeof(struct dump_header);
if ((!sc->trigger_grcdump) || (dump->grcdump == NULL) ||
(dump->grcdump_size < grc_dump_size)) {
rval = EINVAL;
break;
}
dump->grcdump_dwords = grc_dump_size >> 2;
rval = copyout(sc->grc_dump, dump->grcdump, grc_dump_size);
sc->grcdump_done = 0;
if((sc->trigger_grcdump) && (!sc->grcdump_done) &&
(!sc->grcdump_started)) {
rval = bxe_grc_dump(sc);
}
if((!rval) && (sc->grcdump_done) && (sc->grcdump_started) &&
(sc->grc_dump != NULL)) {
dump->grcdump_dwords = grc_dump_size >> 2;
rval = copyout(sc->grc_dump, dump->grcdump, grc_dump_size);
free(sc->grc_dump, M_DEVBUF);
sc->grc_dump = NULL;
sc->grcdump_started = 0;
sc->grcdump_done = 0;
}
break;
case BXE_DRV_INFO:
drv_infop = (bxe_drvinfo_t *)data;
snprintf(drv_infop->drv_name, BXE_DRV_NAME_LENGTH, "%s", "bxe");
snprintf(drv_infop->drv_version, BXE_DRV_VERSION_LENGTH, "v:%s",
BXE_DRIVER_VERSION);
snprintf(drv_infop->mfw_version, BXE_MFW_VERSION_LENGTH, "%s",
sc->devinfo.bc_ver_str);
snprintf(drv_infop->stormfw_version, BXE_STORMFW_VERSION_LENGTH,
"%s", sc->fw_ver_str);
drv_infop->eeprom_dump_len = sc->devinfo.flash_size;
drv_infop->reg_dump_len =
(bxe_get_total_regs_len32(sc) * sizeof(uint32_t))
+ sizeof(struct dump_header);
snprintf(drv_infop->bus_info, BXE_BUS_INFO_LENGTH, "%d:%d:%d",
sc->pcie_bus, sc->pcie_device, sc->pcie_func);
break;
case BXE_DEV_SETTING:
dev_p = (bxe_dev_setting_t *)data;
bxe_get_settings(sc, &dev_set);
dev_p->supported = dev_set.supported;
dev_p->advertising = dev_set.advertising;
dev_p->speed = dev_set.speed;
dev_p->duplex = dev_set.duplex;
dev_p->port = dev_set.port;
dev_p->phy_address = dev_set.phy_address;
dev_p->autoneg = dev_set.autoneg;
break;
case BXE_GET_REGS:
reg_p = (bxe_get_regs_t *)data;
grc_dump_size = reg_p->reg_buf_len;
if((!sc->grcdump_done) && (!sc->grcdump_started)) {
bxe_grc_dump(sc);
}
if((sc->grcdump_done) && (sc->grcdump_started) &&
(sc->grc_dump != NULL)) {
rval = copyout(sc->grc_dump, reg_p->reg_buf, grc_dump_size);
free(sc->grc_dump, M_DEVBUF);
sc->grc_dump = NULL;
sc->grcdump_started = 0;
sc->grcdump_done = 0;
}
break;
case BXE_RDW_REG:
reg_rdw_p = (bxe_reg_rdw_t *)data;
if((reg_rdw_p->reg_cmd == BXE_READ_REG_CMD) &&
(reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT))
reg_rdw_p->reg_val = REG_RD(sc, reg_rdw_p->reg_id);
if((reg_rdw_p->reg_cmd == BXE_WRITE_REG_CMD) &&
(reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT))
REG_WR(sc, reg_rdw_p->reg_id, reg_rdw_p->reg_val);
break;
case BXE_RDW_PCICFG:
cfg_rdw_p = (bxe_pcicfg_rdw_t *)data;
if(cfg_rdw_p->cfg_cmd == BXE_READ_PCICFG) {
cfg_rdw_p->cfg_val = pci_read_config(sc->dev, cfg_rdw_p->cfg_id,
cfg_rdw_p->cfg_width);
} else if(cfg_rdw_p->cfg_cmd == BXE_WRITE_PCICFG) {
pci_write_config(sc->dev, cfg_rdw_p->cfg_id, cfg_rdw_p->cfg_val,
cfg_rdw_p->cfg_width);
} else {
BLOGW(sc, "BXE_RDW_PCICFG ioctl wrong cmd passed\n");
}
break;
case BXE_MAC_ADDR:
mac_addr_p = (bxe_perm_mac_addr_t *)data;
snprintf(mac_addr_p->mac_addr_str, sizeof(sc->mac_addr_str), "%s",
sc->mac_addr_str);
break;
case BXE_EEPROM:
rval = bxe_eeprom_rd_wr(sc, (bxe_eeprom_t *)data);
break;
default:
break;
}

View File

@ -1786,8 +1786,13 @@ struct bxe_softc {
int panic;
struct cdev *ioctl_dev;
void *grc_dump;
int grcdump_done;
unsigned int trigger_grcdump;
unsigned int grcdump_done;
unsigned int grcdump_started;
void *eeprom;
}; /* struct bxe_softc */
/* IOCTL sub-commands for edebug and firmware upgrade */
@ -2109,6 +2114,28 @@ static const uint32_t dmae_reg_go_c[] = {
#define PCI_PM_D0 1
#define PCI_PM_D3hot 2
#ifndef DUPLEX_UNKNOWN
#define DUPLEX_UNKNOWN (0xff)
#endif
#ifndef SPEED_UNKNOWN
#define SPEED_UNKNOWN (-1)
#endif
/* Enable or disable autonegotiation. */
#define AUTONEG_DISABLE 0x00
#define AUTONEG_ENABLE 0x01
/* Which connector port. */
#define PORT_TP 0x00
#define PORT_AUI 0x01
#define PORT_MII 0x02
#define PORT_FIBRE 0x03
#define PORT_BNC 0x04
#define PORT_DA 0x05
#define PORT_NONE 0xef
#define PORT_OTHER 0xff
int bxe_test_bit(int nr, volatile unsigned long * addr);
void bxe_set_bit(unsigned int nr, volatile unsigned long * addr);
void bxe_clear_bit(int nr, volatile unsigned long * addr);
@ -2270,7 +2297,7 @@ void bxe_dump_mem(struct bxe_softc *sc, char *tag,
uint8_t *mem, uint32_t len);
void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag,
struct mbuf *m, uint8_t contents);
extern int bxe_grc_dump(struct bxe_softc *sc);
#if __FreeBSD_version >= 800000
#if __FreeBSD_version >= 1000000

View File

@ -42,6 +42,86 @@ struct bxe_grcdump {
};
typedef struct bxe_grcdump bxe_grcdump_t;
#define BXE_DRV_NAME_LENGTH 32
#define BXE_DRV_VERSION_LENGTH 32
#define BXE_MFW_VERSION_LENGTH 32
#define BXE_STORMFW_VERSION_LENGTH 32
#define BXE_BUS_INFO_LENGTH 32
struct bxe_drvinfo {
char drv_name[BXE_DRV_NAME_LENGTH];
char drv_version[BXE_DRV_VERSION_LENGTH];
char mfw_version[BXE_MFW_VERSION_LENGTH];
char stormfw_version[BXE_STORMFW_VERSION_LENGTH];
uint32_t eeprom_dump_len; /* in bytes */
uint32_t reg_dump_len; /* in bytes */
char bus_info[BXE_BUS_INFO_LENGTH];
};
typedef struct bxe_drvinfo bxe_drvinfo_t;
struct bxe_dev_setting {
uint32_t supported; /* Features this interface supports */
uint32_t advertising;/* Features this interface advertises */
uint32_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */
uint32_t duplex; /* Duplex, half or full */
uint32_t port; /* Which connector port */
uint32_t phy_address;/* port number*/
uint32_t autoneg; /* Enable or disable autonegotiation */
};
typedef struct bxe_dev_setting bxe_dev_setting_t;
struct bxe_get_regs {
void *reg_buf;
uint32_t reg_buf_len;
};
typedef struct bxe_get_regs bxe_get_regs_t;
#define BXE_EEPROM_MAX_DATA_LEN 524288
struct bxe_eeprom {
uint32_t eeprom_cmd;
#define BXE_EEPROM_CMD_SET_EEPROM 0x01
#define BXE_EEPROM_CMD_GET_EEPROM 0x02
void *eeprom_data;
uint32_t eeprom_offset;
uint32_t eeprom_data_len;
uint32_t eeprom_magic;
};
typedef struct bxe_eeprom bxe_eeprom_t;
struct bxe_reg_rdw {
uint32_t reg_cmd;
#define BXE_READ_REG_CMD 0x01
#define BXE_WRITE_REG_CMD 0x02
uint32_t reg_id;
uint32_t reg_val;
uint32_t reg_access_type;
#define BXE_REG_ACCESS_DIRECT 0x01
#define BXE_REG_ACCESS_INDIRECT 0x02
};
typedef struct bxe_reg_rdw bxe_reg_rdw_t;
struct bxe_pcicfg_rdw {
uint32_t cfg_cmd;
#define BXE_READ_PCICFG 0x01
#define BXE_WRITE_PCICFG 0x01
uint32_t cfg_id;
uint32_t cfg_val;
uint32_t cfg_width;
};
typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t;
struct bxe_perm_mac_addr {
char mac_addr_str[32];
};
typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t;
/*
* Read grcdump size
@ -53,5 +133,41 @@ typedef struct bxe_grcdump bxe_grcdump_t;
*/
#define BXE_GRC_DUMP _IOWR('e', 2, bxe_grcdump_t)
/*
* Read driver info
*/
#define BXE_DRV_INFO _IOR('e', 3, bxe_drvinfo_t)
/*
* Read Device Setting
*/
#define BXE_DEV_SETTING _IOR('e', 4, bxe_dev_setting_t)
/*
* Get Registers
*/
#define BXE_GET_REGS _IOR('e', 5, bxe_get_regs_t)
/*
* Get/Set EEPROM
*/
#define BXE_EEPROM _IOWR('e', 6, bxe_eeprom_t)
/*
* read/write a register
*/
#define BXE_RDW_REG _IOWR('e', 7, bxe_reg_rdw_t)
/*
* read/write PCIcfg
*/
#define BXE_RDW_PCICFG _IOWR('e', 8, bxe_reg_rdw_t)
/*
* get permanent mac address
*/
#define BXE_MAC_ADDR _IOWR('e', 9, bxe_perm_mac_addr_t)
#endif /* #ifndef _QLNX_IOCTL_H_ */

View File

@ -234,6 +234,10 @@ bxe_stats_comp(struct bxe_softc *sc)
while (*stats_comp != DMAE_COMP_VAL) {
if (!cnt) {
BLOGE(sc, "Timeout waiting for stats finished\n");
if(sc->trigger_grcdump) {
/* taking grcdump */
bxe_grc_dump(sc);
}
break;
}
@ -1310,8 +1314,12 @@ bxe_stats_update(struct bxe_softc *sc)
if (bxe_storm_stats_update(sc)) {
if (sc->stats_pending++ == 3) {
if (if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) {
atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT);
taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task);
if(sc->trigger_grcdump) {
/* taking grcdump */
bxe_grc_dump(sc);
}
atomic_store_rel_long(&sc->chip_tq_flags, CHIP_TQ_REINIT);
taskqueue_enqueue(sc->chip_tq, &sc->chip_tq_task);
}
}
return;

View File

@ -263,6 +263,9 @@ struct bxe_eth_stats {
uint32_t mbuf_alloc_rx;
uint32_t mbuf_alloc_sge;
uint32_t mbuf_alloc_tpa;
/* num. of times tx queue full occured */
uint32_t tx_queue_full_return;
};
@ -366,6 +369,9 @@ struct bxe_eth_q_stats {
uint32_t mbuf_alloc_rx;
uint32_t mbuf_alloc_sge;
uint32_t mbuf_alloc_tpa;
/* num. of times tx queue full occured */
uint32_t tx_queue_full_return;
};
struct bxe_eth_stats_old {

View File

@ -381,7 +381,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
/*
* Retrieve the command reply and release the mailbox.
*/
get_mbox_rpl(adap, cmd_rpl, size/8, data_reg);
get_mbox_rpl(adap, cmd_rpl, MBOX_LEN/8, data_reg);
t4_write_reg(adap, ctl_reg, V_MBOWNER(X_MBOWNER_NONE));
CH_DUMP_MBOX(adap, mbox, data_reg);

View File

@ -47301,9 +47301,9 @@
#define A_MAC_PORT_PTP_OFFSET_ADJUST_FINE 0x9a4
#define S_B 16
#define M_B 0xffffU
#define CXGBE_M_B 0xffffU
#define V_B(x) ((x) << S_B)
#define G_B(x) (((x) >> S_B) & M_B)
#define G_B(x) (((x) >> S_B) & CXGBE_M_B)
#define S_A 0
#define M_A 0xffffU

View File

@ -1726,7 +1726,8 @@ drain_wrq_wr_list(struct adapter *sc, struct sge_wrq *wrq)
MPASS(TAILQ_EMPTY(&wrq->incomplete_wrs));
wr = STAILQ_FIRST(&wrq->wr_list);
MPASS(wr != NULL); /* Must be called with something useful to do */
dbdiff = IDXDIFF(eq->pidx, eq->dbidx, eq->sidx);
MPASS(eq->pidx == eq->dbidx);
dbdiff = 0;
do {
eq->cidx = read_hw_cidx(eq);
@ -1738,7 +1739,7 @@ drain_wrq_wr_list(struct adapter *sc, struct sge_wrq *wrq)
MPASS(wr->wrq == wrq);
n = howmany(wr->wr_len, EQ_ESIZE);
if (available < n)
return;
break;
dst = (void *)&eq->desc[eq->pidx];
if (__predict_true(eq->sidx - eq->pidx > n)) {

View File

@ -3078,20 +3078,31 @@ isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay)
fcp->isp_fabric_params = mbs.param[7];
fcp->isp_sns_hdl = NPH_SNS_ID;
r = isp_register_fc4_type_24xx(isp, chan);
if (r == 0)
isp_register_fc4_features_24xx(isp, chan);
isp_register_port_name_24xx(isp, chan);
if (fcp->isp_loopstate < LOOP_TESTING_LINK)
goto abort;
if (r != 0)
goto not_on_fabric;
r = isp_register_fc4_features_24xx(isp, chan);
if (fcp->isp_loopstate < LOOP_TESTING_LINK)
goto abort;
if (r != 0)
goto not_on_fabric;
r = isp_register_port_name_24xx(isp, chan);
if (fcp->isp_loopstate < LOOP_TESTING_LINK)
goto abort;
if (r != 0)
goto not_on_fabric;
isp_register_node_name_24xx(isp, chan);
if (fcp->isp_loopstate < LOOP_TESTING_LINK)
goto abort;
} else {
fcp->isp_sns_hdl = SNS_ID;
r = isp_register_fc4_type(isp, chan);
if (r == 0 && fcp->role == ISP_ROLE_TARGET)
if (r != 0)
goto not_on_fabric;
if (fcp->role == ISP_ROLE_TARGET)
isp_send_change_request(isp, chan);
}
if (r) {
isp_prt(isp, ISP_LOGWARN|ISP_LOG_SANCFG, "%s: register fc4 type failed", __func__);
return (-1);
}
}
not_on_fabric:
@ -3505,65 +3516,66 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan)
static int
isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt)
{
mbreg_t mbs;
fcparam *fcp = FCPARAM(isp, chan);
union {
isp_ct_pt_t plocal;
uint8_t q[QENTRY_LEN];
} un;
isp_ct_pt_t *pt;
uint8_t *scp = fcp->isp_scratch;
isp_ct_pt_t pt;
void *reqp;
uint8_t resp[QENTRY_LEN];
/*
* Build a Passthrough IOCB in memory.
*/
pt = &un.plocal;
ISP_MEMZERO(un.q, QENTRY_LEN);
pt->ctp_header.rqs_entry_count = 1;
pt->ctp_header.rqs_entry_type = RQSTYPE_CT_PASSTHRU;
pt->ctp_handle = 0xffffffff;
pt->ctp_nphdl = fcp->isp_sns_hdl;
pt->ctp_cmd_cnt = 1;
pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan);
pt->ctp_time = 10;
pt->ctp_rsp_cnt = 1;
pt->ctp_rsp_bcnt = rsp_bcnt;
pt->ctp_cmd_bcnt = cmd_bcnt;
pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF);
pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF);
pt->ctp_dataseg[0].ds_count = cmd_bcnt;
pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma);
pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma);
pt->ctp_dataseg[1].ds_count = rsp_bcnt;
isp_put_ct_pt(isp, pt, (isp_ct_pt_t *)&scp[CTXOFF]);
if (isp->isp_dblev & ISP_LOGDEBUG1)
isp_print_bytes(isp, "CT IOCB request", QENTRY_LEN, &scp[CTXOFF]);
ISP_MEMZERO(&pt, sizeof(pt));
pt.ctp_header.rqs_entry_count = 1;
pt.ctp_header.rqs_entry_type = RQSTYPE_CT_PASSTHRU;
pt.ctp_nphdl = fcp->isp_sns_hdl;
pt.ctp_cmd_cnt = 1;
pt.ctp_vpidx = ISP_GET_VPIDX(isp, chan);
pt.ctp_time = 10;
pt.ctp_rsp_cnt = 1;
pt.ctp_rsp_bcnt = rsp_bcnt;
pt.ctp_cmd_bcnt = cmd_bcnt;
pt.ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF);
pt.ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF);
pt.ctp_dataseg[0].ds_count = cmd_bcnt;
pt.ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma);
pt.ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma);
pt.ctp_dataseg[1].ds_count = rsp_bcnt;
/*
* Execute the Passthrough IOCB.
*/
ISP_MEMZERO(&scp[ZTXOFF], QENTRY_LEN);
MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL,
MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000);
mbs.param[1] = QENTRY_LEN;
mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF);
mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
/* Prepare space for response in memory */
memset(resp, 0xff, sizeof(resp));
pt.ctp_handle = isp_allocate_handle(isp, resp, ISP_HANDLE_CTRL);
if (pt.ctp_handle == 0) {
isp_prt(isp, ISP_LOGERR,
"%s: CTP of Chan %d out of handles", __func__, chan);
return (-1);
}
MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan);
/* Send request and wait for response. */
reqp = isp_getrqentry(isp);
if (reqp == NULL) {
isp_prt(isp, ISP_LOGERR,
"%s: CTP of Chan %d out of rqent", __func__, chan);
isp_destroy_handle(isp, pt.ctp_handle);
return (-1);
}
isp_put_ct_pt(isp, &pt, (isp_ct_pt_t *)reqp);
if (isp->isp_dblev & ISP_LOGDEBUG1)
isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, &scp[ZTXOFF]);
pt = &un.plocal;
isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt);
if (pt->ctp_status && pt->ctp_status != RQCS_DATA_UNDERRUN) {
isp_print_bytes(isp, "CT IOCB request", QENTRY_LEN, reqp);
ISP_SYNC_REQUEST(isp);
if (msleep(resp, &isp->isp_lock, 0, "CTP", pt.ctp_time*hz) == EWOULDBLOCK) {
isp_prt(isp, ISP_LOGERR,
"%s: CTP of Chan %d timed out", __func__, chan);
isp_destroy_handle(isp, pt.ctp_handle);
return (-1);
}
if (isp->isp_dblev & ISP_LOGDEBUG1)
isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, resp);
isp_get_ct_pt(isp, (isp_ct_pt_t *)resp, &pt);
if (pt.ctp_status && pt.ctp_status != RQCS_DATA_UNDERRUN) {
isp_prt(isp, ISP_LOGWARN,
"Chan %d GID_FT CT Passthrough returned 0x%x",
chan, pt->ctp_status);
chan, pt.ctp_status);
return (-1);
}
@ -3931,7 +3943,13 @@ isp_send_change_request(ispsoftc_t *isp, int chan)
mbs.param[1] = 0x03;
mbs.param[9] = chan;
isp_mboxcmd(isp, &mbs);
return (mbs.param[0] == MBOX_COMMAND_COMPLETE ? 0 : -1);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
return (0);
} else {
isp_prt(isp, ISP_LOGWARN, "Chan %d Send Change Request: 0x%x",
chan, mbs.param[0]);
return (-1);
}
}
static int
@ -3970,6 +3988,8 @@ isp_register_fc4_type(ispsoftc_t *isp, int chan)
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
return (0);
} else {
isp_prt(isp, ISP_LOGWARN, "Chan %d Register FC4 Type: 0x%x",
chan, mbs.param[0]);
return (-1);
}
}
@ -6140,6 +6160,7 @@ isp_handle_other_response(ispsoftc_t *isp, int type, isphdr_t *hp, uint32_t *opt
}
}
return (1);
case RQSTYPE_CT_PASSTHRU:
case RQSTYPE_VP_MODIFY:
case RQSTYPE_VP_CTRL:
case RQSTYPE_LOGIN:

View File

@ -617,7 +617,7 @@ ngmn_rcvdata(hook_p hook, item_p item)
mn_free_desc(dp);
dp = dp2;
}
sc->ch[chan]->xl->vnext = 0;
sc->ch[chan]->xl->vnext = NULL;
break;
}
dp->data = vtophys(m2->m_data);
@ -625,7 +625,7 @@ ngmn_rcvdata(hook_p hook, item_p item)
dp->flags += 1;
len -= m2->m_len;
dp->next = vtophys(dp);
dp->vnext = 0;
dp->vnext = NULL;
sc->ch[chan]->xl->next = vtophys(dp);
sc->ch[chan]->xl->vnext = dp;
sc->ch[chan]->xl = dp;
@ -634,7 +634,7 @@ ngmn_rcvdata(hook_p hook, item_p item)
dp->flags |= 0xc0000000;
dp2->flags &= ~0x40000000;
} else {
dp->m = 0;
dp->m = NULL;
m2 = m2->m_next;
}
}
@ -698,7 +698,7 @@ ngmn_connect(hook_p hook)
dp->m = m;
dp->flags = 0xc0000000 + (1 << 16);
dp->next = vtophys(dp);
dp->vnext = 0;
dp->vnext = NULL;
dp->data = vtophys(sc->name);
sc->m32_mem.cs[chan].tdesc = vtophys(dp);
sc->ch[chan]->x1 = dp;
@ -715,7 +715,7 @@ ngmn_connect(hook_p hook)
dp->flags = 0x40000000;
dp->flags += 1600 << 16;
dp->next = vtophys(dp);
dp->vnext = 0;
dp->vnext = NULL;
sc->ch[chan]->rl = dp;
for (i = 0; i < (nts + 10); i++) {
@ -1127,7 +1127,7 @@ mn_rx_intr(struct mn_softc *sc, u_int32_t vector)
if (vtophys(dp) == sc->m32_mem.crxd[chan])
return;
m = dp->m;
dp->m = 0;
dp->m = NULL;
m->m_pkthdr.len = m->m_len = (dp->status >> 16) & 0x1fff;
err = (dp->status >> 8) & 0xff;
if (!err) {
@ -1176,7 +1176,7 @@ mn_rx_intr(struct mn_softc *sc, u_int32_t vector)
dp->flags = 0x40000000;
dp->flags += 1600 << 16;
dp->next = vtophys(dp);
dp->vnext = 0;
dp->vnext = NULL;
sc->ch[chan]->rl->next = vtophys(dp);
sc->ch[chan]->rl->vnext = dp;
sc->ch[chan]->rl->flags &= ~0x40000000;

View File

@ -595,7 +595,7 @@ mpt_issue_raid_req(struct mpt_softc *mpt, struct mpt_raid_volume *vol,
rap->Function = MPI_FUNCTION_RAID_ACTION;
rap->VolumeID = vol->config_page->VolumeID;
rap->VolumeBus = vol->config_page->VolumeBus;
if (disk != 0)
if (disk != NULL)
rap->PhysDiskNum = disk->config_page.PhysDiskNum;
else
rap->PhysDiskNum = 0xFF;

View File

@ -86,7 +86,7 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd)
bus_addr_t ioctl_data_phys_addr[MAX_IOCTL_SGE];
bus_dma_tag_t ioctl_sense_tag = 0;
bus_dmamap_t ioctl_sense_dmamap = 0;
void *ioctl_sense_mem = 0;
void *ioctl_sense_mem = NULL;
bus_addr_t ioctl_sense_phys_addr = 0;
int i, ioctl_data_size = 0, ioctl_sense_size, ret = 0;
struct mrsas_sge32 *kern_sge32;

View File

@ -316,7 +316,7 @@ mvs_setup_interrupt(device_t dev)
device_printf(dev, "unable to setup interrupt\n");
bus_release_resource(dev, SYS_RES_IRQ,
ctlr->irq.r_irq_rid, ctlr->irq.r_irq);
ctlr->irq.r_irq = 0;
ctlr->irq.r_irq = NULL;
return (ENXIO);
}
return (0);

View File

@ -287,7 +287,7 @@ mvs_setup_interrupt(device_t dev)
device_printf(dev, "unable to setup interrupt\n");
bus_release_resource(dev, SYS_RES_IRQ,
ctlr->irq.r_irq_rid, ctlr->irq.r_irq);
ctlr->irq.r_irq = 0;
ctlr->irq.r_irq = NULL;
return (ENXIO);
}
return (0);

View File

@ -5571,7 +5571,7 @@ __hal_device_get_vpd_data(xge_hal_device_t *hldev)
xge_os_strcpy((char *) hldev->vpd_data.serial_num, "not available");
vpd_data = ( u8*) xge_os_malloc(hldev->pdev, XGE_HAL_VPD_BUFFER_SIZE + 16);
if ( vpd_data == 0 )
if ( vpd_data == NULL )
return;
for (index = 0; index < XGE_HAL_VPD_BUFFER_SIZE; index +=4 ) {

View File

@ -490,21 +490,21 @@ ad1816_release_resources(struct ad1816_info *ad1816, device_t dev)
if (ad1816->ih)
bus_teardown_intr(dev, ad1816->irq, ad1816->ih);
bus_release_resource(dev, SYS_RES_IRQ, ad1816->irq_rid, ad1816->irq);
ad1816->irq = 0;
ad1816->irq = NULL;
}
if (ad1816->drq1) {
isa_dma_release(rman_get_start(ad1816->drq1));
bus_release_resource(dev, SYS_RES_DRQ, ad1816->drq1_rid, ad1816->drq1);
ad1816->drq1 = 0;
ad1816->drq1 = NULL;
}
if (ad1816->drq2) {
isa_dma_release(rman_get_start(ad1816->drq2));
bus_release_resource(dev, SYS_RES_DRQ, ad1816->drq2_rid, ad1816->drq2);
ad1816->drq2 = 0;
ad1816->drq2 = NULL;
}
if (ad1816->io_base) {
bus_release_resource(dev, SYS_RES_IOPORT, ad1816->io_rid, ad1816->io_base);
ad1816->io_base = 0;
ad1816->io_base = NULL;
}
if (ad1816->parent_dmat) {
bus_dma_tag_destroy(ad1816->parent_dmat);

View File

@ -291,21 +291,21 @@ ess_release_resources(struct ess_info *sc, device_t dev)
if (sc->ih)
bus_teardown_intr(dev, sc->irq, sc->ih);
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
sc->irq = 0;
sc->irq = NULL;
}
if (sc->drq1) {
isa_dma_release(rman_get_start(sc->drq1));
bus_release_resource(dev, SYS_RES_DRQ, 0, sc->drq1);
sc->drq1 = 0;
sc->drq1 = NULL;
}
if (sc->drq2) {
isa_dma_release(rman_get_start(sc->drq2));
bus_release_resource(dev, SYS_RES_DRQ, 1, sc->drq2);
sc->drq2 = 0;
sc->drq2 = NULL;
}
if (sc->io_base) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->io_base);
sc->io_base = 0;
sc->io_base = NULL;
}
if (sc->parent_dmat) {
bus_dma_tag_destroy(sc->parent_dmat);

View File

@ -277,7 +277,7 @@ mss_release_resources(struct mss_info *mss, device_t dev)
bus_teardown_intr(dev, mss->irq, mss->ih);
bus_release_resource(dev, SYS_RES_IRQ, mss->irq_rid,
mss->irq);
mss->irq = 0;
mss->irq = NULL;
}
if (mss->drq2) {
if (mss->drq2 != mss->drq1) {
@ -285,28 +285,28 @@ mss_release_resources(struct mss_info *mss, device_t dev)
bus_release_resource(dev, SYS_RES_DRQ, mss->drq2_rid,
mss->drq2);
}
mss->drq2 = 0;
mss->drq2 = NULL;
}
if (mss->drq1) {
isa_dma_release(rman_get_start(mss->drq1));
bus_release_resource(dev, SYS_RES_DRQ, mss->drq1_rid,
mss->drq1);
mss->drq1 = 0;
mss->drq1 = NULL;
}
if (mss->io_base) {
bus_release_resource(dev, SYS_RES_IOPORT, mss->io_rid,
mss->io_base);
mss->io_base = 0;
mss->io_base = NULL;
}
if (mss->conf_base) {
bus_release_resource(dev, SYS_RES_IOPORT, mss->conf_rid,
mss->conf_base);
mss->conf_base = 0;
mss->conf_base = NULL;
}
if (mss->indir) {
bus_release_resource(dev, SYS_RES_IOPORT, mss->indir_rid,
mss->indir);
mss->indir = 0;
mss->indir = NULL;
}
if (mss->parent_dmat) {
bus_dma_tag_destroy(mss->parent_dmat);
@ -1686,7 +1686,7 @@ ymf_test(device_t dev, struct mss_info *mss)
/* PC98 need this. I don't know reason why. */
bus_delete_resource(dev, SYS_RES_IOPORT, mss->conf_rid);
#endif
mss->conf_base = 0;
mss->conf_base = NULL;
continue;
}
version = conf_rd(mss, OPL3SAx_MISC) & 0x07;

View File

@ -435,23 +435,23 @@ sb16_release_resources(struct sb_info *sb, device_t dev)
if (sb->ih)
bus_teardown_intr(dev, sb->irq, sb->ih);
bus_release_resource(dev, SYS_RES_IRQ, 0, sb->irq);
sb->irq = 0;
sb->irq = NULL;
}
if (sb->drq2) {
if (sb->drq2 != sb->drq1) {
isa_dma_release(rman_get_start(sb->drq2));
bus_release_resource(dev, SYS_RES_DRQ, 1, sb->drq2);
}
sb->drq2 = 0;
sb->drq2 = NULL;
}
if (sb->drq1) {
isa_dma_release(rman_get_start(sb->drq1));
bus_release_resource(dev, SYS_RES_DRQ, 0, sb->drq1);
sb->drq1 = 0;
sb->drq1 = NULL;
}
if (sb->io_base) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, sb->io_base);
sb->io_base = 0;
sb->io_base = NULL;
}
if (sb->parent_dmat) {
bus_dma_tag_destroy(sb->parent_dmat);

View File

@ -265,16 +265,16 @@ sb_release_resources(struct sb_info *sb, device_t dev)
if (sb->ih)
bus_teardown_intr(dev, sb->irq, sb->ih);
bus_release_resource(dev, SYS_RES_IRQ, 0, sb->irq);
sb->irq = 0;
sb->irq = NULL;
}
if (sb->drq) {
isa_dma_release(rman_get_start(sb->drq));
bus_release_resource(dev, SYS_RES_DRQ, 0, sb->drq);
sb->drq = 0;
sb->drq = NULL;
}
if (sb->io_base) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, sb->io_base);
sb->io_base = 0;
sb->io_base = NULL;
}
if (sb->parent_dmat) {
bus_dma_tag_destroy(sb->parent_dmat);

View File

@ -1489,7 +1489,7 @@ midi_modevent(module_t mod, int type, void *data)
kobj_t
midimapper_addseq(void *arg1, int *unit, void **cookie)
{
unit = 0;
unit = NULL;
return (kobj_t)arg1;
}

View File

@ -736,15 +736,15 @@ als_resource_free(device_t dev, struct sc_info *sc)
{
if (sc->reg) {
bus_release_resource(dev, SYS_RES_IOPORT, sc->regid, sc->reg);
sc->reg = 0;
sc->reg = NULL;
}
if (sc->ih) {
bus_teardown_intr(dev, sc->irq, sc->ih);
sc->ih = 0;
sc->ih = NULL;
}
if (sc->irq) {
bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irq);
sc->irq = 0;
sc->irq = NULL;
}
if (sc->parent_dmat) {
bus_dma_tag_destroy(sc->parent_dmat);
@ -762,7 +762,7 @@ als_resource_grab(device_t dev, struct sc_info *sc)
sc->regid = PCIR_BAR(0);
sc->reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->regid,
RF_ACTIVE);
if (sc->reg == 0) {
if (sc->reg == NULL) {
device_printf(dev, "unable to allocate register space\n");
goto bad;
}
@ -771,7 +771,7 @@ als_resource_grab(device_t dev, struct sc_info *sc)
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid,
RF_ACTIVE | RF_SHAREABLE);
if (sc->irq == 0) {
if (sc->irq == NULL) {
device_printf(dev, "unable to allocate interrupt\n");
goto bad;
}

View File

@ -556,8 +556,8 @@ au_pci_attach(device_t dev)
struct resource *reg[10];
int i, j, mapped = 0;
int irqid;
struct resource *irq = 0;
void *ih = 0;
struct resource *irq;
void *ih;
struct ac97_info *codec;
char status[SND_STATUSLEN];
@ -566,6 +566,8 @@ au_pci_attach(device_t dev)
pci_enable_busmaster(dev);
irq = NULL;
ih = NULL;
j=0;
/* XXX dfr: is this strictly necessary? */
for (i=0; i<PCI_MAXMAPS_0; i++) {

View File

@ -803,8 +803,8 @@ cmi_muninit(struct mpu401 *arg, void *cookie)
struct sc_info *sc = cookie;
snd_mtxlock(sc->lock);
sc->mpu_intr = 0;
sc->mpu = 0;
sc->mpu_intr = NULL;
sc->mpu = NULL;
snd_mtxunlock(sc->lock);
return 0;
@ -902,7 +902,7 @@ cmi_uninit(struct sc_info *sc)
cmi_clr4(sc, CMPCI_REG_FUNC_1, CMPCI_REG_UART_ENABLE);
if( sc->mpu )
sc->mpu_intr = 0;
sc->mpu_intr = NULL;
}
/* ------------------------------------------------------------------------- */

View File

@ -1178,7 +1178,7 @@ emu_muninit(struct mpu401 *arg, void *cookie)
struct sc_info *sc = cookie;
snd_mtxlock(sc->lock);
sc->mpu_intr = 0;
sc->mpu_intr = NULL;
snd_mtxunlock(sc->lock);
return 0;

View File

@ -2351,7 +2351,7 @@ emu10kx_dev_uninit(struct emu_sc_info *sc)
}
if (sc->cdev)
destroy_dev(sc->cdev);
sc->cdev = 0;
sc->cdev = NULL;
mtx_destroy(&sc->emu10kx_lock);
return (0);

View File

@ -573,7 +573,7 @@ fm801_init(struct fm801_info *fm801)
static int
fm801_pci_attach(device_t dev)
{
struct ac97_info *codec = 0;
struct ac97_info *codec = NULL;
struct fm801_info *fm801;
int i;
int mapped = 0;
@ -622,7 +622,8 @@ fm801_pci_attach(device_t dev)
fm801->irqid = 0;
fm801->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &fm801->irqid,
RF_ACTIVE | RF_SHAREABLE);
if (!fm801->irq || snd_setup_intr(dev, fm801->irq, 0, fm801_intr, fm801, &fm801->ih)) {
if (!fm801->irq ||
snd_setup_intr(dev, fm801->irq, 0, fm801_intr, fm801, &fm801->ih)) {
device_printf(dev, "unable to map interrupt\n");
goto oops;
}

View File

@ -664,7 +664,7 @@ static int
nm_pci_attach(device_t dev)
{
struct sc_info *sc;
struct ac97_info *codec = 0;
struct ac97_info *codec = NULL;
char status[SND_STATUSLEN];
sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);

View File

@ -836,31 +836,31 @@ ess_release_resources(struct ess_info *sc, device_t dev)
if (sc->ih)
bus_teardown_intr(dev, sc->irq, sc->ih);
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
sc->irq = 0;
sc->irq = NULL;
}
if (sc->io) {
bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->io);
sc->io = 0;
sc->io = NULL;
}
if (sc->sb) {
bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(1), sc->sb);
sc->sb = 0;
sc->sb = NULL;
}
if (sc->vc) {
bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(2), sc->vc);
sc->vc = 0;
sc->vc = NULL;
}
if (sc->mpu) {
bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(3), sc->mpu);
sc->mpu = 0;
sc->mpu = NULL;
}
if (sc->gp) {
bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(4), sc->gp);
sc->gp = 0;
sc->gp = NULL;
}
if (sc->parent_dmat) {

View File

@ -823,7 +823,7 @@ static int
tr_pci_attach(device_t dev)
{
struct tr_info *tr;
struct ac97_info *codec = 0;
struct ac97_info *codec = NULL;
bus_addr_t lowaddr;
int i, dacn;
char status[SND_STATUSLEN];

View File

@ -1164,7 +1164,7 @@ via_chip_init(device_t dev)
static int
via_attach(device_t dev)
{
struct via_info *via = 0;
struct via_info *via = NULL;
char status[SND_STATUSLEN];
int i, via_dxs_disabled, via_dxs_src, via_dxs_chnum, via_sgd_chnum;
int nsegs;

View File

@ -477,7 +477,7 @@ dma_cb(void *p, bus_dma_segment_t *bds, int a, int b)
static int
via_attach(device_t dev)
{
struct via_info *via = 0;
struct via_info *via = NULL;
char status[SND_STATUSLEN];
u_int32_t data, cnt;
@ -618,7 +618,7 @@ static int
via_detach(device_t dev)
{
int r;
struct via_info *via = 0;
struct via_info *via = NULL;
r = pcm_unregister(dev);
if (r)

View File

@ -1030,7 +1030,7 @@ vxge_hal_fifo_txdl_buffer_set_aligned(
ptrdiff_t prev_boff;
vxge_assert((vpath_handle != NULL) && (txdlh != NULL) &&
(vaddr != 0) && (dma_pointer != 0) &&
(vaddr != NULL) && (dma_pointer != 0) &&
(size != 0) && (misaligned_size != 0));
hldev = vp->vpath->hldev;
@ -1145,8 +1145,8 @@ vxge_hal_fifo_txdl_buffer_append(
__hal_fifo_txdl_priv_t *txdl_priv;
ptrdiff_t used;
vxge_assert((vpath_handle != NULL) && (txdlh != NULL) && (vaddr != 0) &&
(size == 0));
vxge_assert((vpath_handle != NULL) && (txdlh != NULL) &&
(vaddr != NULL) && (size == 0));
hldev = vp->vpath->hldev;

View File

@ -5613,7 +5613,7 @@ __hal_mrpcim_get_vpd_data(__hal_device_t *hldev)
}
vpd_data = (u8 *) vxge_os_malloc(hldev->header.pdev,
VXGE_HAL_VPD_BUFFER_SIZE + 16);
if (vpd_data == 0)
if (vpd_data == NULL)
return;
for (i = 0; i < VXGE_HAL_VPD_BUFFER_SIZE; i += 4) {

View File

@ -794,6 +794,11 @@ nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
nvap->na_atime.tv_nsec = cverf[1];
error = VOP_SETATTR(ndp->ni_vp,
&nvap->na_vattr, nd->nd_cred);
if (error != 0) {
vput(ndp->ni_vp);
ndp->ni_vp = NULL;
error = NFSERR_NOTSUPP;
}
}
}
/*
@ -1422,6 +1427,11 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
nvap->na_atime.tv_nsec = cverf[1];
nd->nd_repstat = VOP_SETATTR(ndp->ni_vp,
&nvap->na_vattr, cred);
if (nd->nd_repstat != 0) {
vput(ndp->ni_vp);
ndp->ni_vp = NULL;
nd->nd_repstat = NFSERR_NOTSUPP;
}
} else {
nfsrv_fixattr(nd, ndp->ni_vp, nvap,
aclp, p, attrbitp, exp);

View File

@ -495,17 +495,11 @@ xadd(uint64_t a, uint64_t b)
static uint64_t
xmul(uint64_t a, uint64_t b)
{
uint64_t c;
if (a == 0 || b == 0)
return (0);
c = a * b;
if (c < a || c < b)
if (b != 0 && a > UINT64_MAX / b)
return (UINT64_MAX);
return (c);
return (a * b);
}
/*

View File

@ -144,102 +144,33 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_t nxtsz)
#ifdef INET
static void
sctp_notify_mbuf(struct sctp_inpcb *inp,
sctp_notify(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
struct sctp_nets *net,
struct ip *ip)
{
struct icmp *icmph;
int totsz, tmr_stopped = 0;
uint16_t nxtsz;
/* protection */
if ((inp == NULL) || (stcb == NULL) || (net == NULL) || (ip == NULL)) {
if (stcb != NULL) {
SCTP_TCB_UNLOCK(stcb);
}
return;
}
icmph = (struct icmp *)((caddr_t)ip - (sizeof(struct icmp) -
sizeof(struct ip)));
if (icmph->icmp_type != ICMP_UNREACH) {
/* We only care about unreachable */
SCTP_TCB_UNLOCK(stcb);
return;
}
if (icmph->icmp_code != ICMP_UNREACH_NEEDFRAG) {
/* not a unreachable message due to frag. */
SCTP_TCB_UNLOCK(stcb);
return;
}
totsz = ntohs(ip->ip_len);
nxtsz = ntohs(icmph->icmp_nextmtu);
if (nxtsz == 0) {
/*
* old type router that does not tell us what the next size
* mtu is. Rats we will have to guess (in a educated fashion
* of course)
*/
nxtsz = sctp_get_prev_mtu(totsz);
}
/* Stop any PMTU timer */
if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) {
tmr_stopped = 1;
sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
SCTP_FROM_SCTP_USRREQ + SCTP_LOC_1);
}
/* Adjust destination size limit */
if (net->mtu > nxtsz) {
net->mtu = nxtsz;
if (net->port) {
net->mtu -= sizeof(struct udphdr);
}
}
/* now what about the ep? */
if (stcb->asoc.smallest_mtu > nxtsz) {
sctp_pathmtu_adjustment(stcb, nxtsz);
}
if (tmr_stopped)
sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
SCTP_TCB_UNLOCK(stcb);
}
static void
sctp_notify(struct sctp_inpcb *inp,
struct ip *ip,
struct sockaddr *to,
struct sctp_tcb *stcb,
struct sctp_nets *net)
uint8_t icmp_type,
uint8_t icmp_code,
uint16_t ip_len,
uint16_t next_mtu)
{
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
#endif
struct icmp *icmph;
int timer_stopped;
/* protection */
if ((inp == NULL) || (stcb == NULL) || (net == NULL) || (to == NULL)) {
if (stcb)
SCTP_TCB_UNLOCK(stcb);
return;
}
icmph = (struct icmp *)((caddr_t)ip - (sizeof(struct icmp) -
sizeof(struct ip)));
if (icmph->icmp_type != ICMP_UNREACH) {
if (icmp_type != ICMP_UNREACH) {
/* We only care about unreachable */
SCTP_TCB_UNLOCK(stcb);
return;
}
if ((icmph->icmp_code == ICMP_UNREACH_NET) ||
(icmph->icmp_code == ICMP_UNREACH_HOST) ||
(icmph->icmp_code == ICMP_UNREACH_NET_UNKNOWN) ||
(icmph->icmp_code == ICMP_UNREACH_HOST_UNKNOWN) ||
(icmph->icmp_code == ICMP_UNREACH_ISOLATED) ||
(icmph->icmp_code == ICMP_UNREACH_NET_PROHIB) ||
(icmph->icmp_code == ICMP_UNREACH_HOST_PROHIB) ||
(icmph->icmp_code == ICMP_UNREACH_FILTER_PROHIB)) {
if ((icmp_code == ICMP_UNREACH_NET) ||
(icmp_code == ICMP_UNREACH_HOST) ||
(icmp_code == ICMP_UNREACH_NET_UNKNOWN) ||
(icmp_code == ICMP_UNREACH_HOST_UNKNOWN) ||
(icmp_code == ICMP_UNREACH_ISOLATED) ||
(icmp_code == ICMP_UNREACH_NET_PROHIB) ||
(icmp_code == ICMP_UNREACH_HOST_PROHIB) ||
(icmp_code == ICMP_UNREACH_FILTER_PROHIB)) {
/*
* Hmm reachablity problems we must examine closely. If its
@ -248,7 +179,7 @@ sctp_notify(struct sctp_inpcb *inp,
* it a OOTB abort.
*/
if (net->dest_state & SCTP_ADDR_REACHABLE) {
/* Ok that destination is NOT reachable */
/* OK, that destination is NOT reachable. */
net->dest_state &= ~SCTP_ADDR_REACHABLE;
net->dest_state &= ~SCTP_ADDR_PF;
sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN,
@ -256,8 +187,8 @@ sctp_notify(struct sctp_inpcb *inp,
(void *)net, SCTP_SO_NOT_LOCKED);
}
SCTP_TCB_UNLOCK(stcb);
} else if ((icmph->icmp_code == ICMP_UNREACH_PROTOCOL) ||
(icmph->icmp_code == ICMP_UNREACH_PORT)) {
} else if ((icmp_code == ICMP_UNREACH_PROTOCOL) ||
(icmp_code == ICMP_UNREACH_PORT)) {
/*
* Here the peer is either playing tricks on us, including
* an address that belongs to someone who does not support
@ -281,19 +212,51 @@ sctp_notify(struct sctp_inpcb *inp,
/* SCTP_TCB_UNLOCK(stcb); MT: I think this is not needed. */
#endif
/* no need to unlock here, since the TCB is gone */
} else if (icmp_code == ICMP_UNREACH_NEEDFRAG) {
/* Find the next (smaller) MTU */
if (next_mtu == 0) {
/*
* Old type router that does not tell us what the
* next MTU is. Rats we will have to guess (in a
* educated fashion of course).
*/
next_mtu = sctp_get_prev_mtu(ip_len);
}
/* Stop the PMTU timer. */
if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) {
timer_stopped = 1;
sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
SCTP_FROM_SCTP_USRREQ + SCTP_LOC_1);
} else {
timer_stopped = 0;
}
/* Update the path MTU. */
if (net->mtu > next_mtu) {
net->mtu = next_mtu;
if (net->port) {
net->mtu -= sizeof(struct udphdr);
}
}
/* Update the association MTU */
if (stcb->asoc.smallest_mtu > next_mtu) {
sctp_pathmtu_adjustment(stcb, next_mtu);
}
/* Finally, start the PMTU timer if it was running before. */
if (timer_stopped) {
sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
}
SCTP_TCB_UNLOCK(stcb);
} else {
SCTP_TCB_UNLOCK(stcb);
}
}
#endif
#ifdef INET
void
sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
{
struct ip *ip = vip;
struct sctphdr *sh;
struct icmp *icmph;
uint32_t vrf_id;
/* FIX, for non-bsd is this right? */
@ -313,6 +276,9 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
struct sctp_nets *net = NULL;
struct sockaddr_in to, from;
icmph = (struct icmp *)((caddr_t)ip - (sizeof(struct icmp) -
sizeof(struct ip)));
sh = (struct sctphdr *)((caddr_t)ip + (ip->ip_hl << 2));
bzero(&to, sizeof(to));
bzero(&from, sizeof(from));
@ -322,7 +288,6 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
from.sin_addr = ip->ip_src;
to.sin_port = sh->dest_port;
to.sin_addr = ip->ip_dst;
/*
* 'to' holds the dest of the packet that failed to be sent.
* 'from' holds our local endpoint address. Thus we reverse
@ -332,6 +297,7 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
(struct sockaddr *)&from,
&inp, &net, 1, vrf_id);
if ((stcb != NULL) &&
(net != NULL) &&
(inp != NULL) &&
(inp->sctp_socket != NULL)) {
/* Check the verification tag */
@ -342,7 +308,7 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
* consider packets reflecting the
* verification tag.
*/
if (ntohl(sh->v_tag) != (stcb->asoc.peer_vtag)) {
if (ntohl(sh->v_tag) != stcb->asoc.peer_vtag) {
SCTP_TCB_UNLOCK(stcb);
return;
}
@ -355,14 +321,11 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
SCTP_TCB_UNLOCK(stcb);
return;
}
if (cmd != PRC_MSGSIZE) {
sctp_notify(inp, ip,
(struct sockaddr *)&to, stcb,
net);
} else {
/* handle possible ICMP size messages */
sctp_notify_mbuf(inp, stcb, net, ip);
}
sctp_notify(inp, stcb, net,
icmph->icmp_type,
icmph->icmp_code,
ntohs(ip->ip_len),
ntohs(icmph->icmp_nextmtu));
} else {
if ((stcb == NULL) && (inp != NULL)) {
/* reduce ref-count */

View File

@ -125,6 +125,7 @@ SUBDIR= alias \
protect \
rctl \
renice \
resizewin \
rev \
revoke \
rpcinfo \

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fmt.c,v 1.16 2000/06/25 15:35:42 pjanzen Exp $ */
/* $OpenBSD: fmt.c,v 1.21 2004/04/01 23:14:19 tedu Exp $ */
/* Sensible version of fmt
*
@ -170,8 +170,8 @@
#ifndef lint
static const char copyright[] =
"Copyright (c) 1997 Gareth McCaughan. All rights reserved.\n";
#endif /* not lint */
"Copyright (c) 1997 Gareth McCaughan. All rights reserved.\n";
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@ -198,57 +198,74 @@ __FBSDID("$FreeBSD$");
* (returning 0 instead), but we do complain about bad numbers.
*/
static size_t
get_positive(const char *s, const char *err_mess, int fussyP) {
char *t;
long result = strtol(s,&t,0);
if (*t) { if (fussyP) goto Lose; else return 0; }
if (result<=0) { Lose: errx(EX_USAGE, "%s", err_mess); }
return (size_t) result;
get_positive(const char *s, const char *err_mess, int fussyP)
{
char *t;
long result = strtol(s, &t, 0);
if (*t) {
if (fussyP)
goto Lose;
else
return 0;
}
if (result <= 0) {
Lose: errx(EX_USAGE, "%s", err_mess);
}
return (size_t)result;
}
static size_t
get_nonnegative(const char *s, const char *err_mess, int fussyP) {
char *t;
long result = strtol(s,&t,0);
if (*t) { if (fussyP) goto Lose; else return 0; }
if (result<0) { Lose: errx(EX_USAGE, "%s", err_mess); }
return (size_t) result;
get_nonnegative(const char *s, const char *err_mess, int fussyP)
{
char *t;
long result = strtol(s, &t, 0);
if (*t) {
if (fussyP)
goto Lose;
else
return 0;
}
if (result < 0) {
Lose: errx(EX_USAGE, "%s", err_mess);
}
return (size_t)result;
}
/* Global variables */
static int centerP=0; /* Try to center lines? */
static size_t goal_length=0; /* Target length for output lines */
static size_t max_length=0; /* Maximum length for output lines */
static int coalesce_spaces_P=0; /* Coalesce multiple whitespace -> ' ' ? */
static int allow_indented_paragraphs=0; /* Can first line have diff. ind.? */
static int tab_width=8; /* Number of spaces per tab stop */
static size_t output_tab_width=8; /* Ditto, when squashing leading spaces */
static const wchar_t *sentence_enders=L".?!"; /* Double-space after these */
static int grok_mail_headers=0; /* treat embedded mail headers magically? */
static int format_troff=0; /* Format troff? */
static int centerP = 0; /* Try to center lines? */
static size_t goal_length = 0; /* Target length for output lines */
static size_t max_length = 0; /* Maximum length for output lines */
static int coalesce_spaces_P = 0; /* Coalesce multiple whitespace -> ' ' ? */
static int allow_indented_paragraphs = 0; /* Can first line have diff. ind.? */
static int tab_width = 8; /* Number of spaces per tab stop */
static size_t output_tab_width = 8; /* Ditto, when squashing leading spaces */
static const wchar_t *sentence_enders = L".?!"; /* Double-space after these */
static int grok_mail_headers = 0; /* treat embedded mail headers magically? */
static int format_troff = 0; /* Format troff? */
static int n_errors=0; /* Number of failed files. Return on exit. */
static wchar_t *output_buffer=0; /* Output line will be built here */
static size_t x; /* Horizontal position in output line */
static size_t x0; /* Ditto, ignoring leading whitespace */
static int n_errors = 0; /* Number of failed files. Return on exit. */
static wchar_t *output_buffer = NULL; /* Output line will be built here */
static size_t x; /* Horizontal position in output line */
static size_t x0; /* Ditto, ignoring leading whitespace */
static size_t output_buffer_length = 0;
static size_t pending_spaces; /* Spaces to add before next word */
static int output_in_paragraph=0; /* Any of current para written out yet? */
static size_t pending_spaces; /* Spaces to add before next word */
static int output_in_paragraph = 0; /* Any of current para written out yet? */
/* Prototypes */
static void process_named_file (const char *);
static void process_stream (FILE *, const char *);
static size_t indent_length (const wchar_t *, size_t);
static int might_be_header (const wchar_t *);
static void new_paragraph (size_t, size_t);
static void output_word (size_t, size_t, const wchar_t *, size_t,
size_t);
static void output_indent (size_t);
static void center_stream (FILE *, const char *);
static wchar_t * get_line (FILE *, size_t *);
static void * xrealloc (void *, size_t);
static void process_named_file(const char *);
static void process_stream(FILE *, const char *);
static size_t indent_length(const wchar_t *, size_t);
static int might_be_header(const wchar_t *);
static void new_paragraph(size_t, size_t);
static void output_word(size_t, size_t, const wchar_t *, size_t, size_t);
static void output_indent(size_t);
static void center_stream(FILE *, const char *);
static wchar_t *get_line(FILE *, size_t *);
static void *xrealloc(void *, size_t);
#define XMALLOC(x) xrealloc(0,x)
@ -256,234 +273,277 @@ static void * xrealloc (void *, size_t);
* all in top-down order. Hence, |main| comes first.
*/
int
main(int argc, char *argv[]) {
int ch; /* used for |getopt| processing */
wchar_t *tmp;
size_t len;
const char *src;
main(int argc, char *argv[])
{
int ch; /* used for |getopt| processing */
wchar_t *tmp;
size_t len;
const char *src;
(void) setlocale(LC_CTYPE, "");
(void)setlocale(LC_CTYPE, "");
/* 1. Grok parameters. */
/* 1. Grok parameters. */
while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1)
switch(ch) {
case 'c':
centerP = 1;
format_troff = 1;
continue;
case 'd':
src = optarg;
len = mbsrtowcs(NULL, &src, 0, NULL);
if (len == (size_t)-1)
err(EX_USAGE, "bad sentence-ending character set");
tmp = XMALLOC((len + 1) * sizeof(wchar_t));
mbsrtowcs(tmp, &src, len + 1, NULL);
sentence_enders = tmp;
continue;
case 'l':
output_tab_width
= get_nonnegative(optarg, "output tab width must be non-negative", 1);
continue;
case 'm':
grok_mail_headers = 1;
continue;
case 'n':
format_troff = 1;
continue;
case 'p':
allow_indented_paragraphs = 1;
continue;
case 's':
coalesce_spaces_P = 1;
continue;
case 't':
tab_width = get_positive(optarg, "tab width must be positive", 1);
continue;
case 'w':
goal_length = get_positive(optarg, "width must be positive", 1);
max_length = goal_length;
continue;
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
/* XXX this is not a stylistically approved use of getopt() */
if (goal_length==0) {
char *p;
p = argv[optind - 1];
if (p[0] == '-' && p[1] == ch && !p[2])
goal_length = get_positive(++p, "width must be nonzero", 1);
else
goal_length = get_positive(argv[optind]+1,
"width must be nonzero", 1);
max_length = goal_length;
}
continue;
case 'h': default:
fprintf(stderr,
"usage: fmt [-cmps] [-d chars] [-l num] [-t num]\n"
" [-w width | -width | goal [maximum]] [file ...]\n"
"Options: -c center each line instead of formatting\n"
" -d <chars> double-space after <chars> at line end\n"
" -l <n> turn each <n> spaces at start of line into a tab\n"
" -m try to make sure mail header lines stay separate\n"
" -n format lines beginning with a dot\n"
" -p allow indented paragraphs\n"
" -s coalesce whitespace inside lines\n"
" -t <n> have tabs every <n> columns\n"
" -w <n> set maximum width to <n>\n"
" goal set target width to goal\n");
exit(ch=='h' ? 0 : EX_USAGE);
}
argc -= optind; argv += optind;
while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1)
switch (ch) {
case 'c':
centerP = 1;
format_troff = 1;
continue;
case 'd':
src = optarg;
len = mbsrtowcs(NULL, &src, 0, NULL);
if (len == (size_t)-1)
err(EX_USAGE, "bad sentence-ending character set");
tmp = XMALLOC((len + 1) * sizeof(wchar_t));
mbsrtowcs(tmp, &src, len + 1, NULL);
sentence_enders = tmp;
continue;
case 'l':
output_tab_width
= get_nonnegative(optarg, "output tab width must be non-negative", 1);
continue;
case 'm':
grok_mail_headers = 1;
continue;
case 'n':
format_troff = 1;
continue;
case 'p':
allow_indented_paragraphs = 1;
continue;
case 's':
coalesce_spaces_P = 1;
continue;
case 't':
tab_width = get_positive(optarg, "tab width must be positive", 1);
continue;
case 'w':
goal_length = get_positive(optarg, "width must be positive", 1);
max_length = goal_length;
continue;
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
/*
* XXX this is not a stylistically approved use of
* getopt()
*/
if (goal_length == 0) {
char *p;
/* [ goal [ maximum ] ] */
p = argv[optind - 1];
if (p[0] == '-' && p[1] == ch && !p[2])
goal_length = get_positive(++p, "width must be nonzero", 1);
else
goal_length = get_positive(argv[optind] + 1,
"width must be nonzero", 1);
max_length = goal_length;
}
continue;
case 'h':
default:
fprintf(stderr,
"usage: fmt [-cmps] [-d chars] [-l num] [-t num]\n"
" [-w width | -width | goal [maximum]] [file ...]\n"
"Options: -c center each line instead of formatting\n"
" -d <chars> double-space after <chars> at line end\n"
" -l <n> turn each <n> spaces at start of line into a tab\n"
" -m try to make sure mail header lines stay separate\n"
" -n format lines beginning with a dot\n"
" -p allow indented paragraphs\n"
" -s coalesce whitespace inside lines\n"
" -t <n> have tabs every <n> columns\n"
" -w <n> set maximum width to <n>\n"
" goal set target width to goal\n");
exit(ch == 'h' ? 0 : EX_USAGE);
}
argc -= optind;
argv += optind;
if (argc>0 && goal_length==0
&& (goal_length=get_positive(*argv,"goal length must be positive", 0))
!= 0) {
--argc; ++argv;
if (argc>0
&& (max_length=get_positive(*argv,"max length must be positive", 0))
!= 0) {
--argc; ++argv;
if (max_length<goal_length)
errx(EX_USAGE, "max length must be >= goal length");
}
}
if (goal_length==0) goal_length = 65;
if (max_length==0) max_length = goal_length+10;
if (max_length >= SIZE_T_MAX / sizeof (wchar_t)) errx(EX_USAGE, "max length too large");
/* really needn't be longer */
output_buffer = XMALLOC((max_length+1) * sizeof(wchar_t));
/* [ goal [ maximum ] ] */
/* 2. Process files. */
if (argc > 0 && goal_length == 0
&& (goal_length = get_positive(*argv, "goal length must be positive", 0))
!= 0) {
--argc;
++argv;
if (argc > 0
&& (max_length = get_positive(*argv, "max length must be positive", 0))
!= 0) {
--argc;
++argv;
if (max_length < goal_length)
errx(EX_USAGE, "max length must be >= goal length");
}
}
if (goal_length == 0)
goal_length = 65;
if (max_length == 0)
max_length = goal_length + 10;
if (max_length >= SIZE_T_MAX / sizeof(wchar_t))
errx(EX_USAGE, "max length too large");
/* really needn't be longer */
output_buffer = XMALLOC((max_length + 1) * sizeof(wchar_t));
if (argc>0) {
while (argc-->0) process_named_file(*argv++);
}
else {
process_stream(stdin, "standard input");
}
/* 2. Process files. */
/* We're done. */
if (argc > 0) {
while (argc-- > 0)
process_named_file(*argv++);
} else {
process_stream(stdin, "standard input");
}
return n_errors ? EX_NOINPUT : 0;
/* We're done. */
return n_errors ? EX_NOINPUT : 0;
}
/* Process a single file, given its name.
*/
static void
process_named_file(const char *name) {
FILE *f=fopen(name, "r");
if (!f) { warn("%s", name); ++n_errors; }
else {
process_stream(f, name);
if (ferror(f)) { warn("%s", name); ++n_errors; }
fclose(f);
}
process_named_file(const char *name)
{
FILE *f = fopen(name, "r");
if (!f) {
warn("%s", name);
++n_errors;
} else {
process_stream(f, name);
if (ferror(f)) {
warn("%s", name);
++n_errors;
}
fclose(f);
}
}
/* Types of mail header continuation lines:
*/
typedef enum {
hdr_ParagraphStart = -1,
hdr_NonHeader = 0,
hdr_Header = 1,
hdr_Continuation = 2
hdr_ParagraphStart = -1,
hdr_NonHeader = 0,
hdr_Header = 1,
hdr_Continuation = 2
} HdrType;
/* Process a stream. This is where the real work happens,
* except that centering is handled separately.
*/
static void
process_stream(FILE *stream, const char *name) {
size_t last_indent=SILLY; /* how many spaces in last indent? */
size_t para_line_number=0; /* how many lines already read in this para? */
size_t first_indent=SILLY; /* indentation of line 0 of paragraph */
HdrType prev_header_type=hdr_ParagraphStart;
process_stream(FILE *stream, const char *name)
{
size_t last_indent = SILLY; /* how many spaces in last indent? */
size_t para_line_number = 0; /* how many lines already read in this para? */
size_t first_indent = SILLY; /* indentation of line 0 of paragraph */
HdrType prev_header_type = hdr_ParagraphStart;
/* ^-- header_type of previous line; -1 at para start */
wchar_t *line;
size_t length;
wchar_t *line;
size_t length;
if (centerP) { center_stream(stream, name); return; }
while ((line=get_line(stream,&length)) != NULL) {
size_t np=indent_length(line, length);
{ HdrType header_type=hdr_NonHeader;
if (grok_mail_headers && prev_header_type!=hdr_NonHeader) {
if (np==0 && might_be_header(line))
header_type = hdr_Header;
else if (np>0 && prev_header_type>hdr_NonHeader)
header_type = hdr_Continuation;
}
/* We need a new paragraph if and only if:
* this line is blank,
* OR it's a troff request (and we don't format troff),
* OR it's a mail header,
* OR it's not a mail header AND the last line was one,
* OR the indentation has changed
* AND the line isn't a mail header continuation line
* AND this isn't the second line of an indented paragraph.
*/
if ( length==0
|| (line[0]=='.' && !format_troff)
|| header_type==hdr_Header
|| (header_type==hdr_NonHeader && prev_header_type>hdr_NonHeader)
|| (np!=last_indent
&& header_type != hdr_Continuation
&& (!allow_indented_paragraphs || para_line_number != 1)) ) {
new_paragraph(output_in_paragraph ? last_indent : first_indent, np);
para_line_number = 0;
first_indent = np;
last_indent = np;
if (header_type==hdr_Header) last_indent=2; /* for cont. lines */
if (length==0 || (line[0]=='.' && !format_troff)) {
if (length==0)
putwchar('\n');
else
wprintf(L"%.*ls\n", (int)length, line);
prev_header_type=hdr_ParagraphStart;
continue;
}
}
else {
/* If this is an indented paragraph other than a mail header
* continuation, set |last_indent|.
*/
if (np != last_indent && header_type != hdr_Continuation)
last_indent=np;
}
prev_header_type = header_type;
}
if (centerP) {
center_stream(stream, name);
return;
}
while ((line = get_line(stream, &length)) != NULL) {
size_t np = indent_length(line, length);
{ size_t n=np;
while (n<length) {
/* Find word end and count spaces after it */
size_t word_length=0, space_length=0;
while (n+word_length < length && line[n+word_length] != ' ')
++word_length;
space_length = word_length;
while (n+space_length < length && line[n+space_length] == ' ')
++space_length;
/* Send the word to the output machinery. */
output_word(first_indent, last_indent,
line+n, word_length, space_length-word_length);
n += space_length;
}
}
++para_line_number;
}
new_paragraph(output_in_paragraph ? last_indent : first_indent, 0);
if (ferror(stream)) { warn("%s", name); ++n_errors; }
{
HdrType header_type = hdr_NonHeader;
if (grok_mail_headers && prev_header_type != hdr_NonHeader) {
if (np == 0 && might_be_header(line))
header_type = hdr_Header;
else if (np > 0 && prev_header_type > hdr_NonHeader)
header_type = hdr_Continuation;
}
/*
* We need a new paragraph if and only if: this line
* is blank, OR it's a troff request (and we don't
* format troff), OR it's a mail header, OR it's not
* a mail header AND the last line was one, OR the
* indentation has changed AND the line isn't a mail
* header continuation line AND this isn't the
* second line of an indented paragraph.
*/
if (length == 0
|| (line[0] == '.' && !format_troff)
|| header_type == hdr_Header
|| (header_type == hdr_NonHeader && prev_header_type > hdr_NonHeader)
|| (np != last_indent
&& header_type != hdr_Continuation
&& (!allow_indented_paragraphs || para_line_number != 1))) {
new_paragraph(output_in_paragraph ? last_indent : first_indent, np);
para_line_number = 0;
first_indent = np;
last_indent = np;
if (header_type == hdr_Header)
last_indent = 2; /* for cont. lines */
if (length == 0 || (line[0] == '.' && !format_troff)) {
if (length == 0)
putwchar('\n');
else
wprintf(L"%.*ls\n", (int)length,
line);
prev_header_type = hdr_ParagraphStart;
continue;
}
} else {
/*
* If this is an indented paragraph other
* than a mail header continuation, set
* |last_indent|.
*/
if (np != last_indent &&
header_type != hdr_Continuation)
last_indent = np;
}
prev_header_type = header_type;
}
{
size_t n = np;
while (n < length) {
/* Find word end and count spaces after it */
size_t word_length = 0, space_length = 0;
while (n + word_length < length &&
line[n + word_length] != ' ')
++word_length;
space_length = word_length;
while (n + space_length < length &&
line[n + space_length] == ' ')
++space_length;
/* Send the word to the output machinery. */
output_word(first_indent, last_indent,
line + n, word_length,
space_length - word_length);
n += space_length;
}
}
++para_line_number;
}
new_paragraph(output_in_paragraph ? last_indent : first_indent, 0);
if (ferror(stream)) {
warn("%s", name);
++n_errors;
}
}
/* How long is the indent on this line?
*/
static size_t
indent_length(const wchar_t *line, size_t length) {
size_t n=0;
while (n<length && *line++ == ' ') ++n;
return n;
indent_length(const wchar_t *line, size_t length)
{
size_t n = 0;
while (n < length && *line++ == ' ')
++n;
return n;
}
/* Might this line be a mail header?
@ -493,35 +553,45 @@ indent_length(const wchar_t *line, size_t length) {
* conservative to avoid mangling ordinary civilised text.
*/
static int
might_be_header(const wchar_t *line) {
if (!iswupper(*line++)) return 0;
while (*line && (iswalnum(*line) || *line=='-')) ++line;
return (*line==':' && iswspace(line[1]));
might_be_header(const wchar_t *line)
{
if (!iswupper(*line++))
return 0;
while (*line && (iswalnum(*line) || *line == '-'))
++line;
return (*line == ':' && iswspace(line[1]));
}
/* Begin a new paragraph with an indent of |indent| spaces.
*/
static void
new_paragraph(size_t old_indent, size_t indent) {
if (output_buffer_length) {
if (old_indent>0) output_indent(old_indent);
wprintf(L"%.*ls\n", (int)output_buffer_length, output_buffer);
}
x=indent; x0=0; output_buffer_length=0; pending_spaces=0;
output_in_paragraph = 0;
new_paragraph(size_t old_indent, size_t indent)
{
if (output_buffer_length) {
if (old_indent > 0)
output_indent(old_indent);
wprintf(L"%.*ls\n", (int)output_buffer_length, output_buffer);
}
x = indent;
x0 = 0;
output_buffer_length = 0;
pending_spaces = 0;
output_in_paragraph = 0;
}
/* Output spaces or tabs for leading indentation.
*/
static void
output_indent(size_t n_spaces) {
if (output_tab_width) {
while (n_spaces >= output_tab_width) {
putwchar('\t');
n_spaces -= output_tab_width;
}
}
while (n_spaces-- > 0) putwchar(' ');
output_indent(size_t n_spaces)
{
if (output_tab_width) {
while (n_spaces >= output_tab_width) {
putwchar('\t');
n_spaces -= output_tab_width;
}
}
while (n_spaces-- > 0)
putwchar(' ');
}
/* Output a single word, or add it to the buffer.
@ -529,93 +599,120 @@ output_indent(size_t n_spaces) {
* lines of a paragraph. They'll often be the same, of course.
*/
static void
output_word(size_t indent0, size_t indent1, const wchar_t *word, size_t length, size_t spaces) {
size_t new_x;
size_t indent = output_in_paragraph ? indent1 : indent0;
size_t width;
const wchar_t *p;
int cwidth;
output_word(size_t indent0, size_t indent1, const wchar_t *word, size_t length, size_t spaces)
{
size_t new_x;
size_t indent = output_in_paragraph ? indent1 : indent0;
size_t width;
const wchar_t *p;
int cwidth;
for (p = word, width = 0; p < &word[length]; p++)
width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
for (p = word, width = 0; p < &word[length]; p++)
width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
new_x = x + pending_spaces + width;
new_x = x + pending_spaces + width;
/* If either |spaces==0| (at end of line) or |coalesce_spaces_P|
* (squashing internal whitespace), then add just one space;
* except that if the last character was a sentence-ender we
* actually add two spaces.
*/
if (coalesce_spaces_P || spaces==0)
spaces = wcschr(sentence_enders, word[length-1]) ? 2 : 1;
/*
* If either |spaces==0| (at end of line) or |coalesce_spaces_P|
* (squashing internal whitespace), then add just one space; except
* that if the last character was a sentence-ender we actually add
* two spaces.
*/
if (coalesce_spaces_P || spaces == 0)
spaces = wcschr(sentence_enders, word[length - 1]) ? 2 : 1;
if (new_x<=goal_length) {
/* After adding the word we still aren't at the goal length,
* so clearly we add it to the buffer rather than outputing it.
*/
wmemset(output_buffer+output_buffer_length, L' ', pending_spaces);
x0 += pending_spaces; x += pending_spaces;
output_buffer_length += pending_spaces;
wmemcpy(output_buffer+output_buffer_length, word, length);
x0 += width; x += width; output_buffer_length += length;
pending_spaces = spaces;
}
else {
/* Adding the word takes us past the goal. Print the line-so-far,
* and the word too iff either (1) the lsf is empty or (2) that
* makes us nearer the goal but doesn't take us over the limit,
* or (3) the word on its own takes us over the limit.
* In case (3) we put a newline in between.
*/
if (indent>0) output_indent(indent);
wprintf(L"%.*ls", (int)output_buffer_length, output_buffer);
if (x0==0 || (new_x <= max_length && new_x-goal_length <= goal_length-x)) {
wprintf(L"%*ls", (int)pending_spaces, L"");
goto write_out_word;
}
else {
/* If the word takes us over the limit on its own, just
* spit it out and don't bother buffering it.
*/
if (indent+width > max_length) {
putwchar('\n');
if (indent>0) output_indent(indent);
write_out_word:
wprintf(L"%.*ls", (int)length, word);
x0 = 0; x = indent1; pending_spaces = 0;
output_buffer_length = 0;
}
else {
wmemcpy(output_buffer, word, length);
x0 = width; x = width+indent1; pending_spaces = spaces;
output_buffer_length = length;
}
}
putwchar('\n');
output_in_paragraph = 1;
}
if (new_x <= goal_length) {
/*
* After adding the word we still aren't at the goal length,
* so clearly we add it to the buffer rather than outputing
* it.
*/
wmemset(output_buffer + output_buffer_length, L' ',
pending_spaces);
x0 += pending_spaces;
x += pending_spaces;
output_buffer_length += pending_spaces;
wmemcpy(output_buffer + output_buffer_length, word, length);
x0 += width;
x += width;
output_buffer_length += length;
pending_spaces = spaces;
} else {
/*
* Adding the word takes us past the goal. Print the
* line-so-far, and the word too iff either (1) the lsf is
* empty or (2) that makes us nearer the goal but doesn't
* take us over the limit, or (3) the word on its own takes
* us over the limit. In case (3) we put a newline in
* between.
*/
if (indent > 0)
output_indent(indent);
wprintf(L"%.*ls", (int)output_buffer_length, output_buffer);
if (x0 == 0 || (new_x <= max_length &&
new_x - goal_length <= goal_length - x)) {
wprintf(L"%*ls", (int)pending_spaces, L"");
goto write_out_word;
} else {
/*
* If the word takes us over the limit on its own,
* just spit it out and don't bother buffering it.
*/
if (indent + width > max_length) {
putwchar('\n');
if (indent > 0)
output_indent(indent);
write_out_word:
wprintf(L"%.*ls", (int)length, word);
x0 = 0;
x = indent1;
pending_spaces = 0;
output_buffer_length = 0;
} else {
wmemcpy(output_buffer, word, length);
x0 = width;
x = width + indent1;
pending_spaces = spaces;
output_buffer_length = length;
}
}
putwchar('\n');
output_in_paragraph = 1;
}
}
/* Process a stream, but just center its lines rather than trying to
* format them neatly.
*/
static void
center_stream(FILE *stream, const char *name) {
wchar_t *line, *p;
size_t length;
size_t width;
int cwidth;
while ((line=get_line(stream, &length)) != 0) {
size_t l=length;
while (l>0 && iswspace(*line)) { ++line; --l; }
length=l;
for (p = line, width = 0; p < &line[length]; p++)
width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
l = width;
while (l<goal_length) { putwchar(' '); l+=2; }
wprintf(L"%.*ls\n", (int)length, line);
}
if (ferror(stream)) { warn("%s", name); ++n_errors; }
center_stream(FILE *stream, const char *name)
{
wchar_t *line, *p;
size_t length;
size_t width;
int cwidth;
while ((line = get_line(stream, &length)) != NULL) {
size_t l = length;
while (l > 0 && iswspace(*line)) {
++line;
--l;
}
length = l;
for (p = line, width = 0; p < &line[length]; p++)
width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
l = width;
while (l < goal_length) {
putwchar(' ');
l += 2;
}
wprintf(L"%.*ls\n", (int)length, line);
}
if (ferror(stream)) {
warn("%s", name);
++n_errors;
}
}
/* Get a single line from a stream. Expand tabs, strip control
@ -630,41 +727,60 @@ center_stream(FILE *stream, const char *name) {
* |pending_spaces|.
*/
static wchar_t *
get_line(FILE *stream, size_t *lengthp) {
static wchar_t *buf=NULL;
static size_t length=0;
size_t len=0;
wint_t ch;
size_t spaces_pending=0;
int troff=0;
size_t col=0;
int cwidth;
get_line(FILE *stream, size_t *lengthp)
{
static wchar_t *buf = NULL;
static size_t length = 0;
size_t len = 0;
wint_t ch;
size_t spaces_pending = 0;
int troff = 0;
size_t col = 0;
int cwidth;
if (buf==NULL) { length=100; buf=XMALLOC(length * sizeof(wchar_t)); }
while ((ch=getwc(stream)) != '\n' && ch != WEOF) {
if (len+spaces_pending==0 && ch=='.' && !format_troff) troff=1;
if (ch==' ') ++spaces_pending;
else if (troff || iswprint(ch)) {
while (len+spaces_pending >= length) {
length*=2; buf=xrealloc(buf, length * sizeof(wchar_t));
}
while (spaces_pending > 0) { --spaces_pending; buf[len++]=' '; col++; }
buf[len++] = ch;
col += (cwidth = wcwidth(ch)) > 0 ? cwidth : 1;
}
else if (ch=='\t')
spaces_pending += tab_width - (col+spaces_pending)%tab_width;
else if (ch=='\b') { if (len) --len; if (col) --col; }
}
*lengthp=len;
return (len>0 || ch!=WEOF) ? buf : 0;
if (buf == NULL) {
length = 100;
buf = XMALLOC(length * sizeof(wchar_t));
}
while ((ch = getwc(stream)) != '\n' && ch != WEOF) {
if (len + spaces_pending == 0 && ch == '.' && !format_troff)
troff = 1;
if (ch == ' ')
++spaces_pending;
else if (troff || iswprint(ch)) {
while (len + spaces_pending >= length) {
length *= 2;
buf = xrealloc(buf, length * sizeof(wchar_t));
}
while (spaces_pending > 0) {
--spaces_pending;
buf[len++] = ' ';
col++;
}
buf[len++] = ch;
col += (cwidth = wcwidth(ch)) > 0 ? cwidth : 1;
} else if (ch == '\t')
spaces_pending += tab_width -
(col + spaces_pending) % tab_width;
else if (ch == '\b') {
if (len)
--len;
if (col)
--col;
}
}
*lengthp = len;
return (len > 0 || ch != WEOF) ? buf : 0;
}
/* (Re)allocate some memory, exiting with an error if we can't.
*/
static void *
xrealloc(void *ptr, size_t nbytes) {
void *p = realloc(ptr, nbytes);
if (p == NULL) errx(EX_OSERR, "out of memory");
return p;
xrealloc(void *ptr, size_t nbytes)
{
void *p = realloc(ptr, nbytes);
if (p == NULL)
errx(EX_OSERR, "out of memory");
return p;
}

View File

@ -0,0 +1,6 @@
# $FreeBSD$
PROG= resizewin
.include <bsd.prog.mk>

View File

@ -0,0 +1,64 @@
.\" resizewin
.\"
.\" Query terminal for size and inform the kernel
.\"
.\" Copyright 2015 EMC / Isilon Storage Division
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\" $FreeBSD$
.\"
.Dd March 17, 2016
.Dt RESIZEWIN 1
.Os
.Sh NAME
.Nm resizewin
.Nd update the kernel window size for the current TTY
.Sh DESCRIPTION
Query the terminal emulator window size with the
.Dv TIOCSWINSZ
ioctl and set the window size known by the kernel to the new values.
The terminal is assumed to be VT100/ANSI compatible.
.Nm
is functionally similar to
.Xr resize 1 ,
which is part of the
.Xr xterm 1
distribution.
However,
.Nm
only works with VT100/ANSI-compatible terminals and does
not emit commands to set environment variables.
.Pp
After a terminal window has been resized, running
.Nm
updates the kernel's window size to match the new size.
.Pp
Note that virtually all modern terninals support VT100/ANSI escape
sequences, including xterm, konsole, gnome-terminal iTerm,
Terminal.app, and puTTY.
.Sh SEE ALSO
.Xr resize 1 ,
.Xr stty 1
.Sh HISTORY
.Nm
appeared in FreeBSD 11.

View File

@ -0,0 +1,129 @@
/*
* resizewin
*
* Query terminal for size and inform the kernel
*
* Copyright 2015 EMC / Isilon Storage Division
*
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/ioctl.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <termios.h>
#include <unistd.h>
/* screen doesn't support ESC[18t (return terminal size) so do it the hard way */
static const char query[] =
"\0337" /* Save cursor position */
"\033[r" /* Scroll whole screen */
"\033[999;999H" /* Move cursor */
"\033[6n" /* Get cursor position */
"\0338"; /* Restore cursor position */
int
main(__unused int argc, __unused char **argv)
{
struct termios old, new;
struct winsize w;
int ret, fd, cnt, err;
char data[20];
struct timeval then, now;
err = 0;
if ((fd = open("/dev/tty", O_RDWR | O_NONBLOCK)) == -1)
exit(1);
/* Disable echo */
if (tcgetattr(fd, &old) == -1)
exit(1);
new = old;
new.c_cflag |= (CLOCAL | CREAD);
new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
if (tcsetattr(fd, TCSANOW, &new) == -1)
exit(1);
if (write(fd, query, sizeof(query)) != sizeof(query)) {
err = 1;
goto out;
}
/* Read the response */
bzero(data, sizeof(data));
gettimeofday(&then, NULL);
cnt = 0;
while (1) {
ret = read(fd, data + cnt, 1);
if (ret == -1) {
if (errno == EAGAIN) {
gettimeofday(&now, NULL);
timersub(&now, &then, &now);
if (now.tv_sec >= 2) {
fprintf(stderr, "\n\n\nTimeout reading from terminal\n");
fprintf(stderr, "Read %d bytes, %s\n", cnt, data);
err = 1;
goto out;
}
usleep(20000);
continue;
}
err = 1;
goto out;
}
if (data[cnt] == 'R')
break;
cnt++;
if (cnt == sizeof(data) - 2) {
fprintf(stderr, "Response too long\n");
err = 1;
goto out;
}
}
/* Parse */
if (sscanf(data, "\033[%hu;%huR", &w.ws_row, &w.ws_col) != 2) {
err = 1;
fprintf(stderr, "Unable to parse response\n");
goto out;
}
/* Finally, what we want */
if (ioctl(fd, TIOCSWINSZ, &w) == -1)
err = 1;
out:
/* Restore echo */
tcsetattr(fd, TCSANOW, &old);
close(fd);
exit(err);
}

View File

@ -1083,6 +1083,15 @@ ber_read_element(struct ber *ber, struct ber_element *elm)
DPRINTF("ber read element size %zd\n", len);
totlen += r + len;
/*
* If using an external buffer and the total size of the element
* is larger, then the external buffer don't bother to continue.
*/
if (ber->fd == -1 && len > ber->br_rend - ber->br_rptr) {
errno = ECANCELED;
return -1;
}
elm->be_type = type;
elm->be_len = len;
elm->be_class = class;