Sync: merge r215396 through r215463 from ^/head.

This commit is contained in:
Dimitry Andric 2010-11-18 18:30:03 +00:00
commit 6b6403a102
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/binutils-2.17/; revision=215464
62 changed files with 553 additions and 1319 deletions

View File

@ -322,7 +322,7 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
-DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP}
-DWITHOUT_HTML -DNO_CTF -DNO_LINT DESTDIR=${LIB32TMP}
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
.endif

View File

@ -9,3 +9,8 @@ CFLAGS+= -DNEED_SOLARIS_BOOLEAN
WARNS?= 6
CSTD?= gnu89
# Do not lint the CDDL stuff. It is all externally maintained and
# lint output is wasteful noise here.
NO_LINT=

View File

@ -1536,8 +1536,6 @@ cgraph_optimize (void)
return;
}
process_pending_assemble_externals ();
/* Frontend may output common variables after the unit has been finalized.
It is safe to deal with them here as they are always zero initialized. */
cgraph_varpool_analyze_pending_decls ();

View File

@ -496,3 +496,13 @@ Boston, MA 02110-1301, USA. */
fprintf ((FILE), "\"\n"); \
} \
while (0)
/* A C statement (sans semicolon) to output to the stdio stream STREAM
any text necessary for declaring the name of an external symbol
named NAME whch is referenced in this compilation but not defined.
It is needed to properly support non-default visibility. */
#ifndef ASM_OUTPUT_EXTERNAL
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
default_elf_asm_output_external (FILE, DECL, NAME)
#endif

View File

@ -144,10 +144,6 @@ do { \
definitions, so do not use them in gthr-posix.h. */
#define GTHREAD_USE_WEAK 0
/* Put out the needed function declarations at the end. */
#define TARGET_ASM_FILE_END ia64_hpux_file_end
#undef CTORS_SECTION_ASM_OP
#define CTORS_SECTION_ASM_OP "\t.section\t.init_array,\t\"aw\",\"init_array\""

View File

@ -250,10 +250,6 @@ static section *ia64_select_rtx_section (enum machine_mode, rtx,
static void ia64_output_dwarf_dtprel (FILE *, int, rtx)
ATTRIBUTE_UNUSED;
static unsigned int ia64_section_type_flags (tree, const char *, int);
static void ia64_hpux_add_extern_decl (tree decl)
ATTRIBUTE_UNUSED;
static void ia64_hpux_file_end (void)
ATTRIBUTE_UNUSED;
static void ia64_init_libfuncs (void)
ATTRIBUTE_UNUSED;
static void ia64_hpux_init_libfuncs (void)
@ -5014,49 +5010,6 @@ ia64_secondary_reload_class (enum reg_class class,
return NO_REGS;
}
/* Emit text to declare externally defined variables and functions, because
the Intel assembler does not support undefined externals. */
void
ia64_asm_output_external (FILE *file, tree decl, const char *name)
{
int save_referenced;
/* GNU as does not need anything here, but the HP linker does need
something for external functions. */
if (TARGET_GNU_AS
&& (!TARGET_HPUX_LD
|| TREE_CODE (decl) != FUNCTION_DECL
|| strstr (name, "__builtin_") == name))
return;
/* ??? The Intel assembler creates a reference that needs to be satisfied by
the linker when we do this, so we need to be careful not to do this for
builtin functions which have no library equivalent. Unfortunately, we
can't tell here whether or not a function will actually be called by
expand_expr, so we pull in library functions even if we may not need
them later. */
if (! strcmp (name, "__builtin_next_arg")
|| ! strcmp (name, "alloca")
|| ! strcmp (name, "__builtin_constant_p")
|| ! strcmp (name, "__builtin_args_info"))
return;
if (TARGET_HPUX_LD)
ia64_hpux_add_extern_decl (decl);
else
{
/* assemble_name will set TREE_SYMBOL_REFERENCED, so we must save and
restore it. */
save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl));
if (TREE_CODE (decl) == FUNCTION_DECL)
ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
(*targetm.asm_out.globalize_label) (file, name);
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = save_referenced;
}
}
/* Parse the -mfixed-range= option string. */
@ -9223,55 +9176,33 @@ ia64_hpux_function_arg_padding (enum machine_mode mode, tree type)
return DEFAULT_FUNCTION_ARG_PADDING (mode, type);
}
/* Linked list of all external functions that are to be emitted by GCC.
We output the name if and only if TREE_SYMBOL_REFERENCED is set in
order to avoid putting out names that are never really used. */
/* Emit text to declare externally defined variables and functions, because
the Intel assembler does not support undefined externals. */
struct extern_func_list GTY(())
void
ia64_asm_output_external (FILE *file, tree decl, const char *name)
{
struct extern_func_list *next;
tree decl;
};
static GTY(()) struct extern_func_list *extern_func_head;
static void
ia64_hpux_add_extern_decl (tree decl)
{
struct extern_func_list *p = ggc_alloc (sizeof (struct extern_func_list));
p->decl = decl;
p->next = extern_func_head;
extern_func_head = p;
}
/* Print out the list of used global functions. */
static void
ia64_hpux_file_end (void)
{
struct extern_func_list *p;
for (p = extern_func_head; p; p = p->next)
/* We output the name if and only if TREE_SYMBOL_REFERENCED is
set in order to avoid putting out names that are never really
used. */
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
{
tree decl = p->decl;
tree id = DECL_ASSEMBLER_NAME (decl);
/* maybe_assemble_visibility will return 1 if the assembler
visibility directive is outputed. */
int need_visibility = ((*targetm.binds_local_p) (decl)
&& maybe_assemble_visibility (decl));
gcc_assert (id);
if (!TREE_ASM_WRITTEN (decl) && TREE_SYMBOL_REFERENCED (id))
{
const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
TREE_ASM_WRITTEN (decl) = 1;
(*targetm.asm_out.globalize_label) (asm_out_file, name);
fputs (TYPE_ASM_OP, asm_out_file);
assemble_name (asm_out_file, name);
fprintf (asm_out_file, "," TYPE_OPERAND_FMT "\n", "function");
}
/* GNU as does not need anything here, but the HP linker does
need something for external functions. */
if ((TARGET_HPUX_LD || !TARGET_GNU_AS)
&& TREE_CODE (decl) == FUNCTION_DECL)
{
ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
(*targetm.asm_out.globalize_label) (file, name);
}
else if (need_visibility && !TARGET_GNU_AS)
(*targetm.asm_out.globalize_label) (file, name);
}
extern_func_head = 0;
}
/* Set SImode div/mod functions, init_integral_libfuncs only initializes

View File

@ -200,9 +200,9 @@ extern void assemble_variable (tree, int, int, int);
DONT_OUTPUT_DATA is from assemble_variable. */
extern void align_variable (tree decl, bool dont_output_data);
/* Output something to declare an external symbol to the assembler.
(Most assemblers don't need this, so we normally output nothing.)
Do nothing if DECL is not external. */
/* Queue for outputing something to declare an external symbol to the
assembler. (Most assemblers don't need this, so we normally output
nothing.) Do nothing if DECL is not external. */
extern void assemble_external (tree);
/* Assemble code to leave SIZE bytes of zeros. */
@ -607,6 +607,10 @@ extern void default_file_start (void);
extern void file_end_indicate_exec_stack (void);
extern bool default_valid_pointer_mode (enum machine_mode);
extern void default_elf_asm_output_external (FILE *file, tree,
const char *);
extern int maybe_assemble_visibility (tree);
extern int default_address_cost (rtx);
/* dbxout helper functions */

View File

@ -1080,9 +1080,7 @@ compile_file (void)
dw2_output_indirect_constants ();
/* Flush any pending external directives. cgraph did this for
assemble_external calls from the front end, but the RTL
expander can also generate them. */
/* Flush any pending external directives. */
process_pending_assemble_externals ();
/* Attach a special .ident directive to the end of the file to identify

View File

@ -126,7 +126,6 @@ static unsigned HOST_WIDE_INT array_size_for_constructor (tree);
static unsigned min_align (unsigned, unsigned);
static void output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int);
static void globalize_decl (tree);
static void maybe_assemble_visibility (tree);
#ifdef BSS_SECTION_ASM_OP
#ifdef ASM_OUTPUT_BSS
static void asm_output_bss (FILE *, tree, const char *,
@ -1957,11 +1956,10 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
if (!DECL_P (decl) || !DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
return;
if (flag_unit_at_a_time)
pending_assemble_externals = tree_cons (0, decl,
pending_assemble_externals);
else
assemble_external_real (decl);
/* We want to output external symbols at very last to check if they
are references or not. */
pending_assemble_externals = tree_cons (0, decl,
pending_assemble_externals);
#endif
}
@ -5064,13 +5062,18 @@ default_assemble_visibility (tree decl, int vis)
/* A helper function to call assemble_visibility when needed for a decl. */
static void
int
maybe_assemble_visibility (tree decl)
{
enum symbol_visibility vis = DECL_VISIBILITY (decl);
if (vis != VISIBILITY_DEFAULT)
targetm.asm_out.visibility (decl, vis);
{
targetm.asm_out.visibility (decl, vis);
return 1;
}
else
return 0;
}
/* Returns 1 if the target configuration supports defining public symbols
@ -6224,4 +6227,19 @@ output_object_blocks (void)
htab_traverse (object_block_htab, output_object_block_htab, NULL);
}
/* Emit text to declare externally defined symbols. It is needed to
properly support non-default visibility. */
void
default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED,
tree decl,
const char *name ATTRIBUTE_UNUSED)
{
/* We output the name if and only if TREE_SYMBOL_REFERENCED is
set in order to avoid putting out names that are never really
used. */
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
&& targetm.binds_local_p (decl))
maybe_assemble_visibility (decl);
}
#include "gt-varasm.h"

View File

@ -66,6 +66,6 @@ and active rules/table entries.
.SH FILES
/dev/ipnat
.br
/usr/share/examples/ipf Directory with examples.
/usr/share/examples/ipfilter Directory with examples.
.SH SEE ALSO
ipnat(5), ipf(8), ipfstat(8)

View File

@ -6,7 +6,7 @@ mkfilters \- generate a minimal firewall ruleset for ipfilter
.SH SYNOPSIS
.B mkfilters
.SH FILES
/usr/share/examples/ipf/mkfilters
/usr/share/examples/ipfilter/mkfilters
.SH DESCRIPTION
.PP
\fBmkfilters\fP is a perl script that generates a minimal filter rule set for

View File

@ -12,7 +12,7 @@ e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}
X86_EMULATION= elf_i386_fbsd
_i386_path= \"${TOOLS_PREFIX}/usr/lib/i386\"
_i386_path= \"${TOOLS_PREFIX}/usr/lib32\"
EMS+= ${X86_EMULATION}
.for ext in ${ELF_SCR_EXT}
LDSCRIPTS+= ${X86_EMULATION}.${ext}

View File

@ -307,7 +307,7 @@ GENSRCS+= gcov-iov.h
# Multilib config file
multilib.h:
.if ${TARGET_ARCH} == "powerpc64"
.if ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH} == "amd64"
echo 'static const char *const multilib_raw[] = { \
". !m64 !m32;", \
"64:../lib m64 !m32;", \

View File

@ -1,11 +0,0 @@
# $Id: Makefile,v 1.5 2004/09/08 08:12:21 bright Exp $
# $FreeBSD$
LIB= autofs
SHLIB_MAJOR= 3
SRCS= libautofs.c
INCS= libautofs.h
MAN= libautofs.3
.include <bsd.lib.mk>

View File

@ -1,265 +0,0 @@
.\" Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: libautofs.3,v 1.4 2004/09/08 08:12:21 bright Exp $
.\" $FreeBSD$
.Dd September 9, 2004
.Dt LIBAUTOFS 3
.Os
.Sh NAME
.Nm libautofs
.Nd "procedural interface to managing an autofs file system"
.Sh SYNOPSIS
.In libautofs.h
.Ft int
.Fn autoh_get "const char *path" "autoh_t *hndlp"
.Ft void
.Fn autoh_free "autoh_t hndl"
.Ft int
.Fn autoh_getall "autoh_t **hndlpp" "int *cnt"
.Ft void
.Fn autoh_freeall "autoh_t *hndlep"
.Ft int
.Fn autoh_fd "autoh_t hndl"
.Ft const char *
.Fn autoh_mp "autoh_t hndl"
.Ft int
.Fn autoreq_get "autoh_t hndl" "autoreq_t **reqpp" "int *cntp"
.Ft void
.Fn autoreq_free "autoh_t hndl" "autoreq_t *reqp"
.Ft int
.Fn autoreq_serv "autoh_t hndl" "autoreq_t req"
.Ft enum autoreq_op
.Fn autoreq_getop "autoreq_t req"
.Ft const char *
.Fn autoreq_getpath "autoreq_t req"
.Ft autoino_t
.Fn autoreq_getino "autoreq_t req"
.Ft autoino_t
.Fn autoreq_getdirino "autoreq_t req"
.Ft void
.Fn autoreq_getaux "autoreq_t req" "void **auxdatap" "size_t *auxsizep"
.Ft void
.Fn autoreq_getoffset "autoreq_t req" "off_t *offp"
.Ft void
.Fn autoreq_getxid "autoreq_t req" "int *xidp"
.Ft void
.Fn autoreq_setino "autoreq_t req" "autoino_t ino"
.Ft void
.Fn autoreq_seterrno "autoreq_t req" "int errno"
.Ft void
.Fn autoreq_setaux "autoreq_t req" "void *auxdata" "size_t auxsize"
.Ft void
.Fn autoreq_seteof "autoreq_t req" "int eof"
.Ft int
.Fn autoh_togglepath "autoh_t hndl" "int toggle" "pid_t pid" "const char *path"
.Ft int
.Fn autoh_togglefd "autoh_t hndl" "int toggle" "pid_t pid" "int fd"
.Sh DESCRIPTION
The
.Nm libautofs
library provides a "mostly" stable interface to the
.Xr autofs 9
file system.
.Pp
The interface to
.Xr autofs 9
is managed via handles of type
.Fa autoh_t
and
.Fa autoreq_t
which refer to handles to
.Xr autofs 9
mount points and requests respectively.
.Pp
The
.Fn autoh_get
function returns a handle to an
.Xr autofs 9
file system based on the
.Fa path
parameter.
The handle returned should be freed via the
.Fn autoh_free
function.
.Pp
The
.Fn autoh_getall
function returns an array of handles to all mounted
.Xr autofs 9
file systems, each of which should be released via the
.Fn autoh_free
function or released en-mass via the
.Fn autoh_freeall
function.
.Pp
The
.Fn autoh_fd
function returns a file descriptor that can be used with
.Xr select 2
or
.Xr poll 2
to check for "exceptional" data to detect an
.Xr autofs 9
event.
Users of
.Xr select 2
should set the fd in the
.Fa exceptfds
fd_set.
Users of
.Xr poll 2
should set POLLPRI in the pollfd
.Fa fds
argument.
.Pp
The
.Fn autoh_mp
function returns the path to the autofs file system that the
.Fa hndl
is derived from.
.Pp
The
.Fn autoreq_get
function returns an array of autofs requests in
.Fa reqpp ,
the number of requests is stored into
.Fa cntp .
Each request should be released using the
.Fn autoreq_free
function.
.Pp
Requests that are retrieved via the
.Fn autoreq_get
are served via the "autoreq_" functions.
.Pp
The following functions returns information about the request.
.Bl -tag -width indent
.It Fn autoreq_getop
return the operation type of the request, that would be one of
AUTOREQ_OP_UNKNOWN, AUTOREQ_OP_LOOKUP, AUTOREQ_OP_STAT, AUTOREQ_OP_READDIR
depending on the type of request that
.Xr autofs 9
requires service from.
.It Fn autoreq_getpath
return the path of the mountpoint associated with the request
.Fa req .
.It Fn autoreq_getino
return the inode associated with the request
.Fa req .
.It Fn autoreq_getdirno
return the directory inode associated with the request
.Fa req .
.It Fn autoreq_getaux
return the auxiliary data associated with the request
.Fa req .
.It Fn autoreq_getoffset
return the offset request associated with the request
.Fa req .
(used for readdir request)
.It Fn autoreq_getxid
return the transaction id associated with an autofs request, these
are unique per mount point, but not system wide.
They can be used
for debugging to ensure requests are being accepted by the kernel.
.El
.Pp
The following functions allow one to set the response sent to
.Xr autofs 9
to the requesting userland application.
.Bl -tag -width indent
.It Fn autoreq_setino
Set the request
.Fa req
inode to
.Fa ino ,
this is typically unused.
.It Fn autoreq_seterrno
set the error returned to the application sending the request, typically
this is left alone, or set to ENOENT if the request is for a non-existent
name.
The default error is no error.
Meaning the application will see
a successful return.
.It Fn autoreq_setaux
used to set the auxiliary data for a request, currently used to set
the dirent structures for serving a readdir request.
Default is no
auxiliary data.
.It Fn autoreq_seteof
used to set the eof flag for readdir requests (default is not eof.)
.El
.Pp
The functions
.Fn autoh_togglepath
and
.Fn autoh_togglefd
are used to set options on an
.Xr autofs 9
directory via
.Fa path
and
.Fa fd
respectively.
The
.Fa pid
argument should be set to the pid of the process serving
.Xr autofs 9
requests, or -1 to disable the option.
The options are
.Bl -tag -width AUTO_INDIRECT
.It Fa AUTO_MOUNTER
set this process as the one responsible for the
.Xr autofs 9
node, if this process exits, then requests into the autofs will begin to fail.
.It Fa AUTO_BROWSE
dispatch directory read requests for this node to the process identified by
.Fa pid .
Specifically, calls to
.Xr getdirentries 2
and
.Xr getdents 2
will be routed to userland after the current actual directory contents
are read into userland.
.It Fa AUTO_DIRECT
Set the directory as a mount trigger.
Any request to enter the directory
will trigger a callback into the process
.Fa pid .
.It Fa AUTO_INDIRECT
Set the directory as an indirect trigger.
Any request for an entry inside
the directory will be routed to the process identified by
.Fa pid .
.El
.Sh EXAMPLES
See /usr/share/examples/autofs/driver/
.Sh HISTORY
The
.Nm
utility first appeared in
.Fx 6.0 .
.Sh AUTHORS
This manual page and the autofs file system suite were written by
.An Alfred Perlstein .

View File

@ -1,479 +0,0 @@
/*
* Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
* $Id: libautofs.c,v 1.5 2004/09/08 08:44:12 bright Exp $
*/
#include <err.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#ifdef AUTOFSSTANDALONE
#include "../autofs/autofs.h"
#else
#include <fs/autofs/autofs.h>
#endif
#include "libautofs.h"
struct auto_handle {
char ah_mp[MNAMELEN];
fsid_t ah_fsid;
int ah_fd;
};
static int autofs_sysctl(int, fsid_t *, void *, size_t *, void *, size_t);
static void safe_free(void *ptr);
static int getmntlst(struct statfs **sfsp, int *cntp);
static void
safe_free(void *ptr)
{
int saved_errno;
saved_errno = errno;
free(ptr);
errno = saved_errno;
}
int
getmntlst(struct statfs **sfsp, int *cntp)
{
int cnt;
long bufsize;
*sfsp = NULL;
cnt = getfsstat(NULL, 0, MNT_NOWAIT);
bufsize = cnt * sizeof(**sfsp);
/*fprintf(stderr, "getmntlst bufsize %ld, cnt %d\n", bufsize, cnt);*/
*sfsp = malloc(bufsize);
if (sfsp == NULL)
goto err;
cnt = getfsstat(*sfsp, bufsize, MNT_NOWAIT);
if (cnt == -1)
goto err;
*cntp = cnt;
/*fprintf(stderr, "getmntlst ok, cnt %d\n", cnt);*/
return (0);
err:
safe_free(sfsp);
*sfsp = NULL;
/*fprintf(stderr, "getmntlst bad\n");*/
return (-1);
}
/* get a handle based on a path. */
int
autoh_get(const char *path, autoh_t *ahp)
{
struct statfs *sfsp, *sp;
int cnt, fd, i;
autoh_t ret;
ret = NULL;
/*
* We use getfsstat to prevent avoid the lookups on the mountpoints
* that statfs(2) would do.
*/
if (getmntlst(&sfsp, &cnt))
goto err;
for (i = 0; i < cnt; i++) {
if (strcmp(sfsp[i].f_mntonname, path) == 0)
break;
}
if (i == cnt) {
/*fprintf(stderr, "autoh_get bad %d %d\n", i, cnt);*/
errno = ENOENT;
goto err;
}
sp = &sfsp[i];
if (strcmp(sp->f_fstypename, "autofs")) {
errno = ENOTTY;
goto err;
}
fd = open(sp->f_mntonname, O_RDONLY);
if (fd == -1)
goto err;
ret = malloc(sizeof(*ret));
if (ret == NULL)
goto err;
ret->ah_fsid = sp->f_fsid;
ret->ah_fd = fd;
strlcpy(ret->ah_mp, sp->f_mntonname, sizeof(ret->ah_mp));
safe_free(sfsp);
*ahp = ret;
return (0);
err:
safe_free(ret);
safe_free(sfsp);
return (-1);
}
/* release. */
void
autoh_free(autoh_t ah)
{
int saved_errno;
saved_errno = errno;
close(ah->ah_fd);
free(ah);
errno = saved_errno;
}
/*
* Get an array of pointers to all the currently mounted autofs
* instances.
*/
int
autoh_getall(autoh_t **arrayp, int *cntp)
{
struct statfs *sfsp;
int cnt, i, pos;
autoh_t *array;
array = NULL;
/*
* We use getfsstat to prevent avoid the lookups on the mountpoints
* that statfs(2) would do.
*/
if (getmntlst(&sfsp, &cnt))
goto err;
array = *arrayp = calloc(cnt + 1, sizeof(**arrayp));
if (array == NULL)
goto err;
for (i = 0, pos = 0; i < cnt; i++) {
if (autoh_get(sfsp[i].f_mntonname, &array[pos]) == -1) {
/* not an autofs entry, that's ok, otherwise bail */
if (errno == ENOTTY)
continue;
goto err;
}
pos++;
}
if (pos == 0) {
errno = ENOENT;
goto err;
}
*arrayp = array;
*cntp = pos;
safe_free(sfsp);
return (0);
err:
safe_free(sfsp);
if (array)
autoh_freeall(array);
return (-1);
}
/* release. */
void
autoh_freeall(autoh_t *ah)
{
autoh_t *ahp;
ahp = ah;
while (*ahp != NULL) {
autoh_free(*ahp);
ahp++;
}
safe_free(ah);
}
/* return fd to select on. */
int
autoh_fd(autoh_t ah)
{
return (ah->ah_fd);
}
const char *
autoh_mp(autoh_t ah)
{
return (ah->ah_mp);
}
static int do_autoreq_get(autoh_t ah, autoreq_t *reqp, int *cntp);
/* get an array of pending requests */
int
autoreq_get(autoh_t ah, autoreq_t **reqpp, int *cntp)
{
int cnt, i;
autoreq_t req, *reqp;
if (do_autoreq_get(ah, &req, &cnt))
return (-1);
reqp = calloc(cnt + 1, sizeof(*reqp));
if (reqp == NULL) {
safe_free(req);
return (-1);
}
for (i = 0; i < cnt; i++)
reqp[i] = &req[i];
*reqpp = reqp;
*cntp = cnt;
return (0);
}
int
do_autoreq_get(autoh_t ah, autoreq_t *reqp, int *cntp)
{
size_t olen;
struct autofs_userreq *reqs;
int cnt, error;
int vers;
vers = AUTOFS_PROTOVERS;
error = 0;
reqs = NULL;
olen = 0;
cnt = 0;
error = autofs_sysctl(AUTOFS_CTL_GETREQS, &ah->ah_fsid, NULL, &olen,
&vers, sizeof(vers));
if (error == -1)
goto out;
if (olen == 0)
goto out;
reqs = malloc(olen);
if (reqs == NULL)
goto out;
error = autofs_sysctl(AUTOFS_CTL_GETREQS, &ah->ah_fsid, reqs, &olen,
&vers, sizeof(vers));
if (error == -1)
goto out;
out:
if (error) {
safe_free(reqs);
return (-1);
}
cnt = olen / sizeof(*reqs);
*cntp = cnt;
*reqp = reqs;
return (0);
}
/* free an array of requests */
void
autoreq_free(autoh_t ah __unused, autoreq_t *req)
{
free(*req);
free(req);
}
/* serve a request */
int
autoreq_serv(autoh_t ah, autoreq_t req)
{
int error;
error = autofs_sysctl(AUTOFS_CTL_SERVREQ, &ah->ah_fsid, NULL, NULL,
req, sizeof(*req));
return (error);
}
enum autoreq_op
autoreq_getop(autoreq_t req)
{
switch (req->au_op) {
case AREQ_LOOKUP:
return (AUTOREQ_OP_LOOKUP);
case AREQ_STAT:
return (AUTOREQ_OP_STAT);
case AREQ_READDIR:
return (AUTOREQ_OP_READDIR);
default:
return (AUTOREQ_OP_UNKNOWN);
}
}
/* get a request's file name. */
const char *
autoreq_getpath(autoreq_t req)
{
return (req->au_name);
}
/* get a request's inode. a indirect mount may return AUTO_INODE_NONE. */
autoino_t
autoreq_getino(autoreq_t req)
{
return (req->au_ino);
}
void
autoreq_setino(autoreq_t req, autoino_t ino)
{
req->au_ino = ino;
}
/* get a request's directory inode. */
autoino_t
autoreq_getdirino(autoreq_t req)
{
return (req->au_dino);
}
void
autoreq_seterrno(autoreq_t req, int error)
{
req->au_errno = error;
}
void
autoreq_setaux(autoreq_t req, void *auxdata, size_t auxlen)
{
req->au_auxdata = auxdata;
req->au_auxlen = auxlen;
}
void
autoreq_getaux(autoreq_t req, void **auxdatap, size_t *auxlenp)
{
*auxdatap = req->au_auxdata;
*auxlenp = req->au_auxlen;
}
void
autoreq_seteof(autoreq_t req, int eof)
{
req->au_eofflag = eof;
}
void
autoreq_getoffset(autoreq_t req, off_t *offp)
{
*offp = req->au_offset - AUTOFS_USEROFF;
}
void
autoreq_getxid(autoreq_t req, int *xid)
{
*xid = req->au_xid;
}
/* toggle by path. args = handle, AUTO_?, pid (-1 to disable), path. */
int
autoh_togglepath(autoh_t ah, int op, pid_t pid, const char *path)
{
int fd, ret;
fd = open(path, O_RDONLY);
if (fd == -1)
return (-1);
ret = autoh_togglefd(ah, op, pid, fd);
close(fd);
return (ret);
}
/* toggle by fd. args = handle, AUTO_?, pid (-1 to disable), fd. */
int
autoh_togglefd(autoh_t ah, int op, pid_t pid, int fd)
{
struct stat sb;
struct autofs_mounterreq mr;
int error, realop;
switch (op) {
case AUTO_DIRECT:
realop = AUTOFS_CTL_TRIGGER;
break;
case AUTO_INDIRECT:
realop = AUTOFS_CTL_SUBTRIGGER;
break;
case AUTO_MOUNTER:
realop = AUTOFS_CTL_MOUNTER;
break;
case AUTO_BROWSE:
realop = AUTOFS_CTL_BROWSE;
break;
default:
errno = ENOTTY;
return (-1);
}
if (fstat(fd, &sb))
return (-1);
bzero(&mr, sizeof(mr));
mr.amu_ino = sb.st_ino;
mr.amu_pid = pid;
error = autofs_sysctl(realop, &ah->ah_fsid, NULL, NULL,
&mr, sizeof(mr));
return (error);
}
int
autofs_sysctl(op, fsid, oldp, oldlenp, newp, newlen)
int op;
fsid_t *fsid;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
{
struct vfsidctl vc;
bzero(&vc, sizeof(vc));
vc.vc_op = op;
strcpy(vc.vc_fstypename, "*");
vc.vc_vers = VFS_CTL_VERS1;
vc.vc_fsid = *fsid;
vc.vc_ptr = newp;
vc.vc_len = newlen;
return (sysctlbyname("vfs.autofs.ctl", oldp, oldlenp, &vc, sizeof(vc)));
}

View File

@ -1,104 +0,0 @@
/*
* Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
* $Id: libautofs.h,v 1.4 2004/09/08 08:12:21 bright Exp $
*/
#ifndef _LIBAUTOFS_H
#define _LIBAUTOFS_H
struct auto_handle;
typedef struct auto_handle * autoh_t;
struct autofs_userreq;
typedef struct autofs_userreq * autoreq_t;
typedef uint64_t autoino_t;
#define AUTO_INODE_NONE 0
#define AUTO_DIRECT 1
#define AUTO_INDIRECT 2
#define AUTO_MOUNTER 3
#define AUTO_BROWSE 4
enum autoreq_op {
AUTOREQ_OP_UNKNOWN = 0,
AUTOREQ_OP_LOOKUP,
AUTOREQ_OP_STAT,
AUTOREQ_OP_READDIR
};
/* get a handle based on a path. */
int autoh_get(const char *, autoh_t *);
/* release. */
void autoh_free(autoh_t);
/*
* Get an array of pointers to handles for all autofs mounts, returns count
* or -1
*/
int autoh_getall(autoh_t **, int *cnt);
/* free the array of pointers */
void autoh_freeall(autoh_t *);
/* return fd to select on. */
int autoh_fd(autoh_t);
/* returns the mount point of the autofs instance. */
const char *autoh_mp(autoh_t);
/* get an array of pending requests */
int autoreq_get(autoh_t, autoreq_t **, int *);
/* free an array of requests */
void autoreq_free(autoh_t, autoreq_t *);
/* serve a request */
int autoreq_serv(autoh_t, autoreq_t);
/* get the operation requested */
enum autoreq_op autoreq_getop(autoreq_t);
/* get a request's file name. */
const char *autoreq_getpath(autoreq_t);
/* get a request's inode. a indirect mount may return AUTO_INODE_NONE. */
autoino_t autoreq_getino(autoreq_t);
/*
* set a request's inode. an indirect mount may return AUTO_INODE_NONE,
* this is a fixup for indirect mounts.
*/
void autoreq_setino(autoreq_t, autoino_t);
/* get a request's directory inode. */
autoino_t autoreq_getdirino(autoreq_t);
void autoreq_seterrno(autoreq_t, int);
void autoreq_setaux(autoreq_t, void *, size_t);
void autoreq_getaux(autoreq_t, void **, size_t *);
void autoreq_seteof(autoreq_t, int);
void autoreq_getoffset(autoreq_t, off_t *);
void autoreq_getxid(autoreq_t, int *);
/* toggle by path. args = handle, AUTO_?, pid (-1 to disable), path. */
int autoh_togglepath(autoh_t, int, pid_t, const char *);
/* toggle by fd. args = handle, AUTO_?, pid (-1 to disable), fd. */
int autoh_togglefd(autoh_t, int, pid_t, int);
#endif

View File

@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 14, 2010
.Dd November 18, 2010
.Dt LIBUSB 3
.Os
.Sh NAME
@ -380,10 +380,15 @@ LIBUSB_ERROR code on failure.
.Pp
.Ft int
.Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint8_t bRequest" "uint16_t wValue" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout"
Perform a USB control transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT
if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not
supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
LIBUSB_ERROR code on other failure.
Perform a USB control transfer. Returns the actual number of bytes
transferred on success in the range from and including zero until and
including
.Xa wLength .
On error a libusb error code is returned, for example
LIBUSB_ERROR_TIMEOUT if the transfer timeout, LIBUSB_ERROR_PIPE if the
control request was not supported, LIBUSB_ERROR_NO_DEVICE if the
device has been disconnected or another LIBUSB_ERROR code on other failures.
The libusb error codes are always negative.
.
.Pp
.Ft int

View File

@ -1,9 +0,0 @@
# $Id: Makefile,v 1.6 2004/09/08 08:27:12 bright Exp $
# $FreeBSD$
PROG=mount_autofs
MAN=mount_autofs.8
BINDIR?=/sbin
WARNS?= 2
.include <bsd.prog.mk>

View File

@ -1,71 +0,0 @@
.\" Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: mount_autofs.8,v 1.3 2004/09/08 08:12:21 bright Exp $
.\" $FreeBSD$
.Dd August 30, 2004
.Dt MOUNT_AUTOFS 8
.Os
.Sh NAME
.Nm mount_autofs
.Nd mount an autofs file system
.Sh SYNOPSIS
.Nm
.Op Fl o Ar options
.Ar dummy
.Ar node
.Sh DESCRIPTION
The
.Nm
utility attaches an autofs file system
device on to the file system tree at the point
.Ar node .
.Pp
This command is normally executed by
.Xr mount 8
at boot time.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl o
Options are specified with a
.Fl o
flag followed by a comma separated string of options.
See the
.Xr mount 8
man page for possible options and their meanings.
.El
.Sh SEE ALSO
.Xr mount 2 ,
.Xr unmount 2 ,
.Xr fstab 5 ,
.Xr mount 8
.Sh HISTORY
The
.Nm
utility first appeared in
.Fx 6.0 .
.Sh AUTHORS
This manual page and the autofs file system suite were written by
.An Alfred Perlstein .

View File

@ -1,113 +0,0 @@
/*
* Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mount_autofs.c,v 1.5 2004/09/08 08:12:21 bright Exp $
* $FreeBSD$
*/
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/uio.h>
void usage(void);
const char *progname;
void
usage(void) {
errx(1, "usage: %s node", progname);
}
int mymount(const char *type, const char *dir, int flags, void *data);
#if __FreeBSD_version < 600000
int
mymount(const char *type, const char *dir, int flags, void *data)
{
return (mount(type, dir, flags, data));
}
#else
void ioset(struct iovec *iovp, const char *str);
void
ioset(struct iovec *iovp, const char *str)
{
iovp->iov_base = __DECONST(char *, str);
iovp->iov_len = strlen(str) + 1;
}
int
mymount(
const char *type,
const char *dir,
int flags __unused,
void *data __unused
)
{
struct iovec iov[4], *iovp;
iovp = &iov[0];
ioset(iovp++, "fstype");
ioset(iovp++, type);
ioset(iovp++, "fspath");
ioset(iovp++, dir);
return (nmount(iov, 4, 0));
}
#endif
int
main(int argc, char **argv)
{
int error;
int ch;
progname = argv[0];
while ((ch = getopt(argc, argv, "o:")) != -1) {
/* just eat opts for now */
switch (ch) {
case '?':
usage();
}
}
argc -= optind;
argv += optind;
if (argc < 2) {
usage();
}
error = mymount("autofs", argv[1], 0, NULL);
if (error)
perror("mount");
return (error == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@ -183,7 +183,7 @@ SIS963, SIS964, SIS965.
.It VIA:
VT6410, VT6420, VT6421, VT82C586, VT82C586B, VT82C596, VT82C596B, VT82C686,
VT82C686A, VT82C686B, VT8231, VT8233, VT8233A, VT8233C, VT8235, VT8237,
VT8237A, VT8237S, VT8251, CX700, VX800, VX855.
VT8237A, VT8237S, VT8251, CX700, VX800, VX855, VX900.
.El
.Pp
Unknown ATA chipsets are supported in PIO modes, and if the standard

View File

@ -5,7 +5,7 @@ FILES= bsd.README
FILES+= bsd.arch.inc.mk
FILES+= bsd.compat.mk bsd.cpu.mk bsd.dep.mk bsd.doc.mk bsd.dtrace.mk
FILES+= bsd.endian.mk
FILES+= bsd.files.mk bsd.incs.mk bsd.info.mk bsd.init.mk
FILES+= bsd.files.mk bsd.crunchgen.mk bsd.incs.mk bsd.info.mk bsd.init.mk
FILES+= bsd.kmod.mk
FILES+= bsd.lib.mk bsd.libnames.mk bsd.links.mk bsd.man.mk bsd.nls.mk
FILES+= bsd.obj.mk bsd.own.mk

View File

@ -51,17 +51,14 @@ $(OUTPUTS): $(CRUNCH_SRCDIR_${P})/Makefile
.else
$(OUTPUTS): $(.CURDIR)/../../$(D)/$(P)/Makefile
.endif
# Disable building links for bsdbox - whatever is installing the binaries into
# the embedded system should (for now) do the linking there. This may change
# in the future. -adrian
#.ifndef CRUNCH_SUPPRESS_LINK_${P}
#LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P)
#.endif
#.for A in $(CRUNCH_ALIAS_$(P))
#.ifndef CRUNCH_SUPPRESS_LINK_${A}
#LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(A)
#.endif
#.endfor
.ifndef CRUNCH_SUPPRESS_LINK_${P}
LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P)
.endif
.for A in $(CRUNCH_ALIAS_$(P))
.ifndef CRUNCH_SUPPRESS_LINK_${A}
LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(A)
.endif
.endfor
.endfor
.endfor

View File

@ -307,20 +307,21 @@ amd64_mrstoreone(void *arg)
struct mem_range_desc *mrd;
u_int64_t omsrv, msrv;
int i, j, msr;
u_int cr4save;
u_long cr0, cr4;
mrd = sc->mr_desc;
/* Disable PGE. */
cr4save = rcr4();
if (cr4save & CR4_PGE)
load_cr4(cr4save & ~CR4_PGE);
cr4 = rcr4();
load_cr4(cr4 & ~CR4_PGE);
/* Disable caches (CD = 1, NW = 0). */
load_cr0((rcr0() & ~CR0_NW) | CR0_CD);
cr0 = rcr0();
load_cr0((cr0 & ~CR0_NW) | CR0_CD);
/* Flushes caches and TLBs. */
wbinvd();
invltlb();
/* Disable MTRRs (E = 0). */
wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) & ~MTRR_DEF_ENABLE);
@ -388,17 +389,16 @@ amd64_mrstoreone(void *arg)
wrmsr(msr + 1, msrv);
}
/* Flush caches, TLBs. */
/* Flush caches and TLBs. */
wbinvd();
invltlb();
/* Enable MTRRs. */
wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) | MTRR_DEF_ENABLE);
/* Enable caches (CD = 0, NW = 0). */
load_cr0(rcr0() & ~(CR0_CD | CR0_NW));
/* Restore PGE. */
load_cr4(cr4save);
/* Restore caches and PGE. */
load_cr0(cr0);
load_cr4(cr4);
}
/*

View File

@ -91,16 +91,22 @@ ofw_mapmem(vm_offset_t dest, const size_t len)
return (ENOMEM);
}
if (OF_call_method("claim", mmu, 3, 1, destp, dlen, 0, &addr) == -1) {
printf("ofw_mapmem: virtual claim failed\n");
return (ENOMEM);
}
if (OF_call_method("map", mmu, 4, 0, destp, destp, dlen, 0) == -1) {
printf("ofw_mapmem: map failed\n");
return (ENOMEM);
}
/*
* We only do virtual memory management when real_mode is false.
*/
if (real_mode == 0) {
if (OF_call_method("claim", mmu, 3, 1, destp, dlen, 0, &addr)
== -1) {
printf("ofw_mapmem: virtual claim failed\n");
return (ENOMEM);
}
if (OF_call_method("map", mmu, 4, 0, destp, destp, dlen, 0)
== -1) {
printf("ofw_mapmem: map failed\n");
return (ENOMEM);
}
}
last_dest = (vm_offset_t) destp;
last_len = dlen;

View File

@ -90,11 +90,11 @@ ofwn_probe(struct netif *nif, void *machdep_hint)
static int
ofwn_put(struct iodesc *desc, void *pkt, size_t len)
{
struct ether_header *eh;
size_t sendlen;
ssize_t rv;
#if defined(NETIF_DEBUG)
struct ether_header *eh;
printf("netif_put: desc=0x%x pkt=0x%x len=%d\n", desc, pkt, len);
eh = pkt;
printf("dst: %s ", ether_sprintf(eh->ether_dhost));

View File

@ -69,12 +69,15 @@ int (*openfirmware)(void *);
phandle_t chosen;
ihandle_t mmu;
ihandle_t memory;
int real_mode = 0;
/* Initialiser */
void
OF_init(int (*openfirm)(void *))
{
phandle_t options;
char mode[8];
openfirmware = openfirm;
@ -89,6 +92,15 @@ OF_init(int (*openfirm)(void *))
}
if (OF_getprop(chosen, "mmu", &mmu, sizeof(mmu)) == -1)
OF_exit();
/*
* Check if we run in real mode. If so, we do not need to map
* memory later on.
*/
options = OF_finddevice("/options");
OF_getprop(options, "real-mode?", mode, sizeof(mode));
if (strncmp(mode, "true", 4) == 0)
real_mode = 1;
}
/*

View File

@ -72,6 +72,7 @@ typedef unsigned long int cell_t;
extern int (*openfirmware)(void *);
extern phandle_t chosen;
extern ihandle_t memory, mmu;
extern int real_mode;
/*
* This isn't actually an Open Firmware function, but it seemed like the right

View File

@ -50,7 +50,20 @@ _start: \n\
addi %r1,%r1,stack@l \n\
addi %r1,%r1,8192 \n\
\n\
b startup \n\
/* Clear the .bss!!! */ \n\
li %r0,0 \n\
lis %r8,_edata@ha \n\
addi %r8,%r8,_edata@l\n\
lis %r9,_end@ha \n\
addi %r9,%r9,_end@l \n\
\n\
1: cmpw 0,%r8,%r9 \n\
bge 2f \n\
stw %r0,0(%r8) \n\
addi %r8,%r8,4 \n\
b 1b \n\
\n\
2: b startup \n\
");
void

View File

@ -963,6 +963,8 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
xpt_action((union ccb *)&cts);
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
caps &= cts.xport_specific.sata.caps;
else
caps = 0;
/* Store result to SIM. */
bzero(&cts, sizeof(cts));
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);
@ -1103,6 +1105,8 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
xpt_action((union ccb *)&cts);
if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
caps &= cts.xport_specific.sata.caps;
else
caps = 0;
/* Store result to SIM. */
bzero(&cts, sizeof(cts));
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE);

View File

@ -1557,7 +1557,7 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp)
int err;
/*
* zfs_zget() can't operate on virtual entires like .zfs/ or
* zfs_zget() can't operate on virtual entries like .zfs/ or
* .zfs/snapshot/ directories, that's why we return EOPNOTSUPP.
* This will make NFS to switch to LOOKUP instead of using VGET.
*/

View File

@ -67,6 +67,7 @@
#include <sys/sf_buf.h>
#include <sys/sched.h>
#include <sys/acl.h>
#include <vm/vm_pageout.h>
/*
* Programming rules.
@ -481,7 +482,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio)
uiomove_fromphys(&m, off, bytes, uio);
VM_OBJECT_LOCK(obj);
vm_page_wakeup(m);
} else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) {
} else if (uio->uio_segflg == UIO_NOCOPY) {
/*
* The code below is here to make sendfile(2) work
* correctly with ZFS. As pointed out by ups@
@ -491,7 +492,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio)
*/
KASSERT(off == 0,
("unexpected offset in mappedread for sendfile"));
if ((m->oflags & VPO_BUSY) != 0) {
if (m != NULL && (m->oflags & VPO_BUSY) != 0) {
/*
* Reference the page before unlocking and
* sleeping so that the page daemon is less
@ -501,8 +502,17 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio)
vm_page_flag_set(m, PG_REFERENCED);
vm_page_sleep(m, "zfsmrb");
goto again;
} else if (m == NULL) {
m = vm_page_alloc(obj, OFF_TO_IDX(start),
VM_ALLOC_NOBUSY | VM_ALLOC_NORMAL);
if (m == NULL) {
VM_OBJECT_UNLOCK(obj);
VM_WAIT;
VM_OBJECT_LOCK(obj);
goto again;
}
}
vm_page_busy(m);
vm_page_io_start(m);
VM_OBJECT_UNLOCK(obj);
if (dirbytes > 0) {
error = dmu_read_uio(os, zp->z_id, uio,
@ -520,7 +530,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio)
VM_OBJECT_LOCK(obj);
if (error == 0)
m->valid = VM_PAGE_BITS_ALL;
vm_page_wakeup(m);
vm_page_io_finish(m);
if (error == 0) {
uio->uio_resid -= bytes;
uio->uio_offset += bytes;

View File

@ -162,6 +162,16 @@ typedef struct mdl mdl, ndis_buffer;
#define WDM_MINOR_WINXP 0x20
#define WDM_MINOR_WIN2003 0x30
enum nt_caching_type {
MmNonCached = 0,
MmCached = 1,
MmWriteCombined = 2,
MmHardwareCoherentCached = 3,
MmNonCachedUnordered = 4,
MmUSWCCached = 5,
MmMaximumCacheType = 6
};
/*-
* The ndis_kspin_lock type is called KSPIN_LOCK in MS-Windows.
* According to the Windows DDK header files, KSPIN_LOCK is defined like this:

View File

@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
#include <vm/vm_kern.h>
#include <vm/vm_map.h>
#include <vm/vm_extern.h>
#include <compat/ndis/pe_var.h>
#include <compat/ndis/cfg_var.h>
@ -197,9 +198,10 @@ static uint32_t InterlockedDecrement(volatile uint32_t *);
static void ExInterlockedAddLargeStatistic(uint64_t *, uint32_t);
static void *MmAllocateContiguousMemory(uint32_t, uint64_t);
static void *MmAllocateContiguousMemorySpecifyCache(uint32_t,
uint64_t, uint64_t, uint64_t, uint32_t);
uint64_t, uint64_t, uint64_t, enum nt_caching_type);
static void MmFreeContiguousMemory(void *);
static void MmFreeContiguousMemorySpecifyCache(void *, uint32_t, uint32_t);
static void MmFreeContiguousMemorySpecifyCache(void *, uint32_t,
enum nt_caching_type);
static uint32_t MmSizeOfMdl(void *, size_t);
static void *MmMapLockedPages(mdl *, uint8_t);
static void *MmMapLockedPagesSpecifyCache(mdl *,
@ -2424,11 +2426,34 @@ MmAllocateContiguousMemorySpecifyCache(size, lowest, highest,
uint64_t lowest;
uint64_t highest;
uint64_t boundary;
uint32_t cachetype;
enum nt_caching_type cachetype;
{
vm_memattr_t memattr;
void *ret;
return (contigmalloc(size, M_DEVBUF, M_ZERO|M_NOWAIT, lowest,
highest, PAGE_SIZE, boundary));
switch (cachetype) {
case MmNonCached:
memattr = VM_MEMATTR_UNCACHEABLE;
break;
case MmWriteCombined:
memattr = VM_MEMATTR_WRITE_COMBINING;
break;
case MmNonCachedUnordered:
memattr = VM_MEMATTR_UNCACHEABLE;
break;
case MmCached:
case MmHardwareCoherentCached:
case MmUSWCCached:
default:
memattr = VM_MEMATTR_DEFAULT;
break;
}
ret = (void *)kmem_alloc_contig(kernel_map, size, M_ZERO | M_NOWAIT,
lowest, highest, PAGE_SIZE, boundary, memattr);
if (ret != NULL)
malloc_type_allocated(M_DEVBUF, round_page(size));
return (ret);
}
static void
@ -2442,7 +2467,7 @@ static void
MmFreeContiguousMemorySpecifyCache(base, size, cachetype)
void *base;
uint32_t size;
uint32_t cachetype;
enum nt_caching_type cachetype;
{
contigfree(base, size, M_DEVBUF);
}
@ -4212,8 +4237,8 @@ image_patch_table ntoskrnl_functbl[] = {
IMPORT_FFUNC(ExInterlockedAddLargeStatistic, 2),
IMPORT_SFUNC(IoAllocateMdl, 5),
IMPORT_SFUNC(IoFreeMdl, 1),
IMPORT_SFUNC(MmAllocateContiguousMemory, 2),
IMPORT_SFUNC(MmAllocateContiguousMemorySpecifyCache, 5),
IMPORT_SFUNC(MmAllocateContiguousMemory, 2 + 1),
IMPORT_SFUNC(MmAllocateContiguousMemorySpecifyCache, 5 + 3),
IMPORT_SFUNC(MmFreeContiguousMemory, 1),
IMPORT_SFUNC(MmFreeContiguousMemorySpecifyCache, 3),
IMPORT_SFUNC_MAP(MmGetPhysicalAddress, pmap_kextract, 1),

View File

@ -246,14 +246,21 @@ int
aesni_cipher_setup(struct aesni_session *ses, struct cryptoini *encini)
{
struct thread *td;
int error;
int error, saved_ctx;
td = curthread;
error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL);
if (!is_fpu_kern_thread(0)) {
error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL);
saved_ctx = 1;
} else {
error = 0;
saved_ctx = 0;
}
if (error == 0) {
error = aesni_cipher_setup_common(ses, encini->cri_key,
encini->cri_klen);
fpu_kern_leave(td, &ses->fpu_ctx);
if (saved_ctx)
fpu_kern_leave(td, &ses->fpu_ctx);
}
return (error);
}
@ -264,16 +271,22 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptodesc *enccrd,
{
struct thread *td;
uint8_t *buf;
int error, allocated;
int error, allocated, saved_ctx;
buf = aesni_cipher_alloc(enccrd, crp, &allocated);
if (buf == NULL)
return (ENOMEM);
td = curthread;
error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL);
if (error != 0)
goto out;
if (!is_fpu_kern_thread(0)) {
error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL);
if (error != 0)
goto out;
saved_ctx = 1;
} else {
saved_ctx = 0;
error = 0;
}
if ((enccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) {
error = aesni_cipher_setup_common(ses, enccrd->crd_key,
@ -311,7 +324,8 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptodesc *enccrd,
ses->iv);
}
}
fpu_kern_leave(td, &ses->fpu_ctx);
if (saved_ctx)
fpu_kern_leave(td, &ses->fpu_ctx);
if (allocated)
crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_skip,
enccrd->crd_len, buf);

View File

@ -512,7 +512,10 @@ struct ata_pci_controller {
#define ATA_VIACX700 0x83241106
#define ATA_VIASATAIDE 0x53241106
#define ATA_VIAVX800 0x83531106
#define ATA_VIASATAIDE2 0xc4091106
#define ATA_VIAVX855 0x84091106
#define ATA_VIASATAIDE3 0x90011106
#define ATA_VIAVX900 0x84101106
/* global prototypes ata-pci.c */
int ata_pci_probe(device_t dev);

View File

@ -153,8 +153,12 @@ ata_sata_phy_reset(device_t dev, int port, int quick)
if (quick) {
if (ata_sata_scr_read(ch, port, ATA_SCONTROL, &val))
return (0);
if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_IDLE)
if ((val & ATA_SC_DET_MASK) == ATA_SC_DET_IDLE) {
ata_sata_scr_write(ch, port, ATA_SCONTROL,
ATA_SC_DET_IDLE | ((ch->pm_level > 0) ? 0 :
ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER));
return ata_sata_connect(ch, port, quick);
}
}
if (bootverbose) {

View File

@ -63,6 +63,12 @@ static int ata_via_new_setmode(device_t dev, int target, int mode);
static int ata_via_sata_ch_attach(device_t dev);
static int ata_via_sata_getrev(device_t dev, int target);
static int ata_via_sata_setmode(device_t dev, int target, int mode);
static void ata_via_sata_reset(device_t dev);
static int ata_via_sata_scr_read(device_t dev, int port, int reg,
u_int32_t *result);
static int ata_via_sata_scr_write(device_t dev, int port, int reg,
u_int32_t value);
static int ata_via_sata_status(device_t dev);
/* misc defines */
#define VIA33 0
@ -106,6 +112,7 @@ ata_via_probe(device_t dev)
{ ATA_VIACX700, 0x00, VIA133, VIASATA, ATA_SA150, "CX700" },
{ ATA_VIAVX800, 0x00, VIA133, VIASATA, ATA_SA150, "VX800" },
{ ATA_VIAVX855, 0x00, VIA133, 0x00, ATA_UDMA6, "VX855" },
{ ATA_VIAVX900, 0x00, VIA133, VIASATA, ATA_SA300, "VX900" },
{ 0, 0, 0, 0, 0, 0 }};
static struct ata_chip_id new_ids[] =
{{ ATA_VIA6410, 0x00, 0, 0x00, ATA_UDMA6, "6410" },
@ -123,7 +130,9 @@ ata_via_probe(device_t dev)
if (pci_get_devid(dev) == ATA_VIA82C571 ||
pci_get_devid(dev) == ATA_VIACX700IDE ||
pci_get_devid(dev) == ATA_VIASATAIDE) {
pci_get_devid(dev) == ATA_VIASATAIDE ||
pci_get_devid(dev) == ATA_VIASATAIDE2 ||
pci_get_devid(dev) == ATA_VIASATAIDE3) {
if (!(ctlr->chip = ata_find_chip(dev, ids, -99)))
return ENXIO;
}
@ -150,11 +159,12 @@ ata_via_chipinit(device_t dev)
if (ata_ahci_chipinit(dev) != ENXIO)
return (0);
}
/* 2 SATA without SATA registers on first channel + 1 PATA on second */
/* 2 SATA with "SATA registers" at PCI config space + PATA on secondary */
if (ctlr->chip->cfg2 & VIASATA) {
ctlr->ch_attach = ata_via_sata_ch_attach;
ctlr->setmode = ata_via_sata_setmode;
ctlr->getrev = ata_via_sata_getrev;
ctlr->reset = ata_via_sata_reset;
return 0;
}
/* Legacy SATA/SATA+PATA with SATA registers in BAR(5). */
@ -402,18 +412,30 @@ ata_via_sata_ch_attach(device_t dev)
if (ata_pci_ch_attach(dev))
return ENXIO;
if (ch->unit == 0)
if (ch->unit == 0) {
ch->hw.status = ata_via_sata_status;
ch->hw.pm_read = ata_via_sata_scr_read;
ch->hw.pm_write = ata_via_sata_scr_write;
ch->flags |= ATA_PERIODIC_POLL;
ch->flags |= ATA_SATA;
ata_sata_scr_write(ch, 0, ATA_SERROR, 0xffffffff);
ata_sata_scr_write(ch, 1, ATA_SERROR, 0xffffffff);
}
return (0);
}
static int
ata_via_sata_getrev(device_t dev, int target)
{
device_t parent = device_get_parent(dev);
struct ata_channel *ch = device_get_softc(dev);
if (ch->unit == 0)
return (1);
if (ch->unit == 0) {
if (pci_read_config(parent, 0xa0 + target, 1) & 0x10)
return (2);
else
return (1);
}
return (0);
}
@ -427,5 +449,112 @@ ata_via_sata_setmode(device_t dev, int target, int mode)
return (ata_via_old_setmode(dev, target, mode));
}
static void
ata_via_sata_reset(device_t dev)
{
struct ata_channel *ch = device_get_softc(dev);
int devs;
if (ch->unit == 0) {
devs = ata_sata_phy_reset(dev, 0, 0);
DELAY(10000);
devs += ata_sata_phy_reset(dev, 1, 0);
} else
devs = 1;
if (devs)
ata_generic_reset(dev);
else
ch->devices = 0;
}
static int
ata_via_sata_scr_read(device_t dev, int port, int reg, u_int32_t *result)
{
struct ata_channel *ch;
device_t parent;
uint32_t val;
parent = device_get_parent(dev);
ch = device_get_softc(dev);
port = (port == 1) ? 1 : 0;
switch (reg) {
case ATA_SSTATUS:
val = pci_read_config(parent, 0xa0 + port, 1);
*result = val & 0x03;
if (*result != ATA_SS_DET_NO_DEVICE) {
if (val & 0x04)
*result |= ATA_SS_IPM_PARTIAL;
else if (val & 0x08)
*result |= ATA_SS_IPM_SLUMBER;
else
*result |= ATA_SS_IPM_ACTIVE;
if (val & 0x10)
*result |= ATA_SS_SPD_GEN2;
else
*result |= ATA_SS_SPD_GEN1;
}
break;
case ATA_SERROR:
*result = pci_read_config(parent, 0xa8 + port * 4, 4);
break;
case ATA_SCONTROL:
val = pci_read_config(parent, 0xa4 + port, 1);
*result = 0;
if (val & 0x01)
*result |= ATA_SC_DET_RESET;
if (val & 0x02)
*result |= ATA_SC_DET_DISABLE;
if (val & 0x04)
*result |= ATA_SC_IPM_DIS_PARTIAL;
if (val & 0x08)
*result |= ATA_SC_IPM_DIS_SLUMBER;
break;
default:
return (EINVAL);
}
return (0);
}
static int
ata_via_sata_scr_write(device_t dev, int port, int reg, u_int32_t value)
{
struct ata_channel *ch;
device_t parent;
uint32_t val;
parent = device_get_parent(dev);
ch = device_get_softc(dev);
port = (port == 1) ? 1 : 0;
switch (reg) {
case ATA_SERROR:
pci_write_config(parent, 0xa8 + port * 4, value, 4);
break;
case ATA_SCONTROL:
val = 0;
if (value & ATA_SC_DET_RESET)
val |= 0x01;
if (value & ATA_SC_DET_DISABLE)
val |= 0x02;
if (value & ATA_SC_IPM_DIS_PARTIAL)
val |= 0x04;
if (value & ATA_SC_IPM_DIS_SLUMBER)
val |= 0x08;
pci_write_config(parent, 0xa4 + port, val, 1);
break;
default:
return (EINVAL);
}
return (0);
}
static int
ata_via_sata_status(device_t dev)
{
ata_sata_phy_check_events(dev, 0);
ata_sata_phy_check_events(dev, 1);
return (ata_pci_status(dev));
}
ATA_DECLARE_DRIVER(ata_via);
MODULE_DEPEND(ata_via, ata_ahci, 1, 1, 1);

View File

@ -317,6 +317,7 @@ atphy_status(struct mii_softc *sc)
static void
atphy_reset(struct mii_softc *sc)
{
struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur;
struct atphy_softc *asc;
uint32_t reg;
int i;
@ -339,7 +340,7 @@ atphy_reset(struct mii_softc *sc)
PHY_WRITE(sc, ATPHY_SCR, reg);
/* Workaround F1 bug to reset phy. */
atphy_setmedia(sc, sc->mii_pdata->mii_media.ifm_cur->ifm_media);
atphy_setmedia(sc, ife == NULL ? IFM_AUTO : ife->ifm_media);
for (i = 0; i < 1000; i++) {
DELAY(1);

View File

@ -593,7 +593,8 @@ nfe_attach(device_t dev)
if ((sc->nfe_flags & NFE_HW_VLAN) != 0) {
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
if ((ifp->if_capabilities & IFCAP_HWCSUM) != 0)
ifp->if_capabilities |= IFCAP_VLAN_HWCSUM;
ifp->if_capabilities |= IFCAP_VLAN_HWCSUM |
IFCAP_VLAN_HWTSO;
}
if (pci_find_extcap(dev, PCIY_PMG, &reg) == 0)
@ -1777,20 +1778,35 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((mask & IFCAP_WOL_MAGIC) != 0 &&
(ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0)
ifp->if_capenable ^= IFCAP_WOL_MAGIC;
if ((sc->nfe_flags & NFE_HW_CSUM) != 0 &&
(mask & IFCAP_HWCSUM) != 0) {
ifp->if_capenable ^= IFCAP_HWCSUM;
if ((IFCAP_TXCSUM & ifp->if_capenable) != 0 &&
(IFCAP_TXCSUM & ifp->if_capabilities) != 0)
if ((mask & IFCAP_TXCSUM) != 0 &&
(ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
ifp->if_capenable ^= IFCAP_TXCSUM;
if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
ifp->if_hwassist |= NFE_CSUM_FEATURES;
else
ifp->if_hwassist &= ~NFE_CSUM_FEATURES;
}
if ((mask & IFCAP_RXCSUM) != 0 &&
(ifp->if_capabilities & IFCAP_RXCSUM) != 0) {
ifp->if_capenable ^= IFCAP_RXCSUM;
init++;
}
if ((sc->nfe_flags & NFE_HW_VLAN) != 0 &&
(mask & IFCAP_VLAN_HWTAGGING) != 0) {
if ((mask & IFCAP_TSO4) != 0 &&
(ifp->if_capabilities & IFCAP_TSO4) != 0) {
ifp->if_capenable ^= IFCAP_TSO4;
if ((IFCAP_TSO4 & ifp->if_capenable) != 0)
ifp->if_hwassist |= CSUM_TSO;
else
ifp->if_hwassist &= ~CSUM_TSO;
}
if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
(ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
(ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
init++;
}
/*
@ -1800,28 +1816,17 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
* VLAN stripping. So when we know Rx checksum offload is
* disabled turn entire hardware VLAN assist off.
*/
if ((sc->nfe_flags & (NFE_HW_CSUM | NFE_HW_VLAN)) ==
(NFE_HW_CSUM | NFE_HW_VLAN)) {
if ((ifp->if_capenable & IFCAP_RXCSUM) == 0)
ifp->if_capenable &= ~IFCAP_VLAN_HWTAGGING;
if ((ifp->if_capenable & IFCAP_RXCSUM) == 0) {
if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0)
init++;
ifp->if_capenable &= ~(IFCAP_VLAN_HWTAGGING |
IFCAP_VLAN_HWTSO);
}
if ((sc->nfe_flags & NFE_HW_CSUM) != 0 &&
(mask & IFCAP_TSO4) != 0) {
ifp->if_capenable ^= IFCAP_TSO4;
if ((IFCAP_TSO4 & ifp->if_capenable) != 0 &&
(IFCAP_TSO4 & ifp->if_capabilities) != 0)
ifp->if_hwassist |= CSUM_TSO;
else
ifp->if_hwassist &= ~CSUM_TSO;
}
if (init > 0 && (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
nfe_init(sc);
}
if ((sc->nfe_flags & NFE_HW_VLAN) != 0)
VLAN_CAPABILITIES(ifp);
VLAN_CAPABILITIES(ifp);
break;
default:
error = ether_ioctl(ifp, cmd, data);

View File

@ -301,20 +301,21 @@ i686_mrstoreone(void *arg)
struct mem_range_desc *mrd;
u_int64_t omsrv, msrv;
int i, j, msr;
u_int cr4save;
u_long cr0, cr4;
mrd = sc->mr_desc;
/* Disable PGE. */
cr4save = rcr4();
if (cr4save & CR4_PGE)
load_cr4(cr4save & ~CR4_PGE);
cr4 = rcr4();
load_cr4(cr4 & ~CR4_PGE);
/* Disable caches (CD = 1, NW = 0). */
load_cr0((rcr0() & ~CR0_NW) | CR0_CD);
cr0 = rcr0();
load_cr0((cr0 & ~CR0_NW) | CR0_CD);
/* Flushes caches and TLBs. */
wbinvd();
invltlb();
/* Disable MTRRs (E = 0). */
wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) & ~MTRR_DEF_ENABLE);
@ -382,17 +383,16 @@ i686_mrstoreone(void *arg)
wrmsr(msr + 1, msrv);
}
/* Flush caches, TLBs. */
/* Flush caches and TLBs. */
wbinvd();
invltlb();
/* Enable MTRRs. */
wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) | MTRR_DEF_ENABLE);
/* Enable caches (CD = 0, NW = 0). */
load_cr0(rcr0() & ~(CR0_CD | CR0_NW));
/* Restore PGE. */
load_cr4(cr4save);
/* Restore caches and PGE. */
load_cr0(cr0);
load_cr4(cr4);
}
/*

View File

@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
#include <sys/rmlock.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/systm.h>
#include <sys/turnstile.h>
#include <sys/lock_profile.h>
#include <machine/cpu.h>

View File

@ -2933,6 +2933,30 @@ resource_list_busy(struct resource_list *rl, int type, int rid)
return (1);
}
/**
* @brief Determine if a resource entry is reserved.
*
* Returns true if a resource entry is reserved meaning that it has an
* associated "reserved" resource. The resource can either be
* allocated or unallocated.
*
* @param rl the resource list to search
* @param type the resource entry type (e.g. SYS_RES_MEMORY)
* @param rid the resource identifier
*
* @returns Non-zero if the entry is reserved, zero otherwise.
*/
int
resource_list_reserved(struct resource_list *rl, int type, int rid)
{
struct resource_list_entry *rle;
rle = resource_list_find(rl, type, rid);
if (rle != NULL && rle->flags & RLE_RESERVED)
return (1);
return (0);
}
/**
* @brief Find a resource entry by type and rid.
*

View File

@ -123,6 +123,7 @@ struct sctp_paramhdr {
#define SCTP_LOCAL_AUTH_CHUNKS 0x00000103
#define SCTP_GET_ASSOC_NUMBER 0x00000104 /* ro */
#define SCTP_GET_ASSOC_ID_LIST 0x00000105 /* ro */
#define SCTP_TIMEOUTS 0x00000106
/*
* user socket options: BSD implementation specific

View File

@ -563,6 +563,17 @@ struct sctp_sack_info {
uint32_t sack_freq;
};
struct sctp_timeouts {
sctp_assoc_t stimo_assoc_id;
uint32_t stimo_init;
uint32_t stimo_data;
uint32_t stimo_sack;
uint32_t stimo_shutdown;
uint32_t stimo_heartbeat;
uint32_t stimo_cookie;
uint32_t stimo_shutdownack;
};
struct sctp_cwnd_args {
struct sctp_nets *net; /* network to *//* FIXME: LP64 issue */
uint32_t cwnd_new_value;/* cwnd in k */

View File

@ -2441,6 +2441,29 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
*optsize = sizeof(*srto);
}
break;
case SCTP_TIMEOUTS:
{
struct sctp_timeouts *stimo;
SCTP_CHECK_AND_CAST(stimo, optval, struct sctp_timeouts, *optsize);
SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
if (stcb) {
stimo->stimo_init = stcb->asoc.timoinit;
stimo->stimo_data = stcb->asoc.timodata;
stimo->stimo_sack = stcb->asoc.timosack;
stimo->stimo_shutdown = stcb->asoc.timoshutdown;
stimo->stimo_heartbeat = stcb->asoc.timoheartbeat;
stimo->stimo_cookie = stcb->asoc.timocookie;
stimo->stimo_shutdownack = stcb->asoc.timoshutdownack;
SCTP_TCB_UNLOCK(stcb);
} else {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
error = EINVAL;
}
*optsize = sizeof(*stimo);
}
break;
case SCTP_ASSOCINFO:
{
struct sctp_assocparams *sasoc;

View File

@ -225,9 +225,12 @@ struct tcp_info {
u_int32_t tcpi_snd_nxt; /* Next egress seqno */
u_int32_t tcpi_rcv_nxt; /* Next ingress seqno */
u_int32_t tcpi_toe_tid; /* HWTID for TOE endpoints */
u_int32_t tcpi_snd_rexmitpack; /* Retransmitted packets */
u_int32_t tcpi_rcv_ooopack; /* Out-of-order packets */
u_int32_t tcpi_snd_zerowin; /* Zero-sized windows sent */
/* Padding to grow without breaking ABI. */
u_int32_t __tcpi_pad[29]; /* Padding. */
u_int32_t __tcpi_pad[26]; /* Padding. */
};
#endif

View File

@ -803,6 +803,7 @@ tcp_output(struct tcpcb *tp)
if ((tp->t_flags & TF_FORCEDATA) && len == 1)
TCPSTAT_INC(tcps_sndprobe);
else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) {
tp->t_sndrexmitpack++;
TCPSTAT_INC(tcps_sndrexmitpack);
TCPSTAT_ADD(tcps_sndrexmitbyte, len);
} else {
@ -1027,9 +1028,10 @@ tcp_output(struct tcpcb *tp)
* to read more data than can be buffered prior to transmitting on
* the connection.
*/
if (th->th_win == 0)
if (th->th_win == 0) {
tp->t_sndzerowin++;
tp->t_flags |= TF_RXWIN0SENT;
else
} else
tp->t_flags &= ~TF_RXWIN0SENT;
if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
th->th_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));

View File

@ -266,6 +266,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
th->th_seq += i;
}
}
tp->t_rcvoopack++;
TCPSTAT_INC(tcps_rcvoopack);
TCPSTAT_ADD(tcps_rcvoobyte, *tlenp);

View File

@ -1218,6 +1218,9 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
ti->tcpi_rcv_mss = tp->t_maxseg;
if (tp->t_flags & TF_TOE)
ti->tcpi_options |= TCPI_OPT_TOE;
ti->tcpi_snd_rexmitpack = tp->t_sndrexmitpack;
ti->tcpi_rcv_ooopack = tp->t_rcvoopack;
ti->tcpi_snd_zerowin = tp->t_sndzerowin;
}
/*

View File

@ -177,6 +177,7 @@ struct tcpcb {
u_long snd_cwnd_prev; /* cwnd prior to retransmit */
u_long snd_ssthresh_prev; /* ssthresh prior to retransmit */
tcp_seq snd_recover_prev; /* snd_recover prior to retransmit */
int t_sndzerowin; /* zero-window updates sent */
u_int t_badrxtwin; /* window for retransmit recovery */
u_char snd_limited; /* segments limited transmitted */
/* SACK related state */
@ -193,6 +194,8 @@ struct tcpcb {
u_int32_t rfbuf_ts; /* recv buffer autoscaling timestamp */
int rfbuf_cnt; /* recv buffer autoscaling byte count */
struct toe_usrreqs *t_tu; /* offload operations vector */
int t_sndrexmitpack; /* retransmit packets sent */
int t_rcvoopack; /* out-of-order packets received */
void *t_toe; /* TOE pcb pointer */
int t_bytes_acked; /* # bytes acked during current RTT */
struct cc_algo *cc_algo; /* congestion control algorithm */

View File

@ -836,7 +836,7 @@ nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp)
{
struct sockaddr_in6 sin6;
struct llentry *ln;
int llflags = 0;
int llflags;
bzero(&sin6, sizeof(sin6));
sin6.sin6_len = sizeof(struct sockaddr_in6);
@ -845,16 +845,15 @@ nd6_lookup(struct in6_addr *addr6, int flags, struct ifnet *ifp)
IF_AFDATA_LOCK_ASSERT(ifp);
llflags = 0;
if (flags & ND6_CREATE)
llflags |= LLE_CREATE;
if (flags & ND6_EXCLUSIVE)
llflags |= LLE_EXCLUSIVE;
ln = lla_lookup(LLTABLE6(ifp), llflags, (struct sockaddr *)&sin6);
if ((ln != NULL) && (flags & LLE_CREATE)) {
if ((ln != NULL) && (llflags & LLE_CREATE))
ln->ln_state = ND6_LLINFO_NOSTATE;
callout_init(&ln->ln_timer_ch, 0);
}
return (ln);
}
@ -1453,7 +1452,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
int do_update;
int olladdr;
int llchange;
int flags = 0;
int flags;
int newstate = 0;
uint16_t router = 0;
struct sockaddr_in6 sin6;
@ -1480,13 +1479,13 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
* Spec says nothing in sections for RA, RS and NA. There's small
* description on it in NS section (RFC 2461 7.2.3).
*/
flags |= lladdr ? ND6_EXCLUSIVE : 0;
flags = lladdr ? ND6_EXCLUSIVE : 0;
IF_AFDATA_LOCK(ifp);
ln = nd6_lookup(from, flags, ifp);
if (ln == NULL) {
flags |= LLE_EXCLUSIVE;
ln = nd6_lookup(from, flags |ND6_CREATE, ifp);
flags |= ND6_EXCLUSIVE;
ln = nd6_lookup(from, flags | ND6_CREATE, ifp);
IF_AFDATA_UNLOCK(ifp);
is_newentry = 1;
} else {

View File

@ -256,6 +256,7 @@ int resource_list_add_next(struct resource_list *rl,
u_long start, u_long end, u_long count);
int resource_list_busy(struct resource_list *rl,
int type, int rid);
int resource_list_reserved(struct resource_list *rl, int type, int rid);
struct resource_list_entry*
resource_list_find(struct resource_list *rl,
int type, int rid);

View File

@ -157,7 +157,6 @@ DRIVER_MODULE(hwpstate, cpu, hwpstate_driver, hwpstate_devclass, 0, 0);
static int
hwpstate_goto_pstate(device_t dev, int pstate)
{
struct pcpu *pc;
int i;
uint64_t msr;
int j;
@ -171,18 +170,15 @@ hwpstate_goto_pstate(device_t dev, int pstate)
if(limit > id)
id = limit;
error = 0;
/*
* We are going to the same Px-state on all cpus.
* Probably should take _PSD into account.
*/
for (i = 0; i < mp_ncpus; i++) {
/* Find each cpu. */
pc = pcpu_find(i);
if (pc == NULL)
return (ENXIO);
thread_lock(curthread);
error = 0;
CPU_FOREACH(i) {
/* Bind to each cpu. */
sched_bind(curthread, pc->pc_cpuid);
thread_lock(curthread);
sched_bind(curthread, i);
thread_unlock(curthread);
HWPSTATE_DEBUG(dev, "setting P%d-state on cpu%d\n",
id, PCPU_GET(cpuid));
@ -204,10 +200,10 @@ hwpstate_goto_pstate(device_t dev, int pstate)
HWPSTATE_DEBUG(dev, "error: loop is not enough.\n");
error = ENXIO;
}
thread_lock(curthread);
sched_unbind(curthread);
thread_unlock(curthread);
}
thread_lock(curthread);
sched_unbind(curthread);
thread_unlock(curthread);
return (error);
}

View File

@ -419,7 +419,7 @@ int source(char *interface, struct in_addr *group, int pkt_size,
// cout << "sec: " << result.tv_sec;
// cout << " usecs: " << result.tv_usec << endl;
}
cout << "comparing %lu deltas" << long(deltas.size()) << endl;
cout << "comparing " << long(deltas.size()) << " deltas" << endl;
cout << "number represents usecs of round-trip time" << endl;
sort(deltas.begin(), deltas.end());
for (int i = 0; idx[i] != 0; ++i) {

View File

@ -411,25 +411,30 @@ protopr(u_long off, const char *name, int af1, int proto)
if (Lflag)
printf("%-5.5s %-14.14s %-22.22s\n",
"Proto", "Listen", "Local Address");
else {
if (Tflag)
printf((Aflag && !Wflag) ?
"%-5.5s %-6.6s %-6.6s %-6.6s %-18.18s %s\n" :
"%-5.5s %-6.6s %-6.6s %-6.6s %-22.22s %s\n",
"Proto", "Rexmit", "OOORcv", "0-win",
"Local Address", "Foreign Address");
if (xflag) {
printf("%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s ",
"R-MBUF", "S-MBUF", "R-CLUS",
"S-CLUS", "R-HIWA", "S-HIWA",
"R-LOWA", "S-LOWA", "R-BCNT",
"S-BCNT", "R-BMAX", "S-BMAX");
printf("%7.7s %7.7s %7.7s %7.7s %7.7s %7.7s %s\n",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime",
"(state)");
}
if (!xflag && !Tflag)
printf((Aflag && !Wflag) ?
"%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" :
"%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s",
"Proto", "Recv-Q", "Send-Q",
"Local Address", "Foreign Address");
if (xflag) {
printf("%-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s %-6.6s ",
"R-MBUF", "S-MBUF", "R-CLUS",
"S-CLUS", "R-HIWA", "S-HIWA",
"R-LOWA", "S-LOWA", "R-BCNT",
"S-BCNT", "R-BMAX", "S-BMAX");
printf("%7.7s %7.7s %7.7s %7.7s %7.7s %7.7s %s\n",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime",
"(state)");
} else
printf("(state)\n");
}
first = 0;
}
if (Lflag && so->so_qlimit == 0)
@ -455,6 +460,10 @@ protopr(u_long off, const char *name, int af1, int proto)
snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
so->so_incqlen, so->so_qlimit);
printf("%-14.14s ", buf1);
} else if (Tflag) {
if (istcp)
printf("%6u %6u %6u ", tp->t_sndrexmitpack,
tp->t_rcvoopack, tp->t_sndzerowin);
} else {
printf("%6u %6u ", so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
@ -540,7 +549,7 @@ protopr(u_long off, const char *name, int af1, int proto)
timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
}
if (istcp && !Lflag) {
if (istcp && !Lflag && !xflag && !Tflag) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
printf("%d", tp->t_state);
else {

View File

@ -342,6 +342,7 @@ int Qflag; /* show netisr information */
int rflag; /* show routing tables (or routing stats) */
int sflag; /* show protocol statistics */
int Wflag; /* wide display */
int Tflag; /* TCP Information */
int xflag; /* extra information, includes all socket buffer info */
int zflag; /* zero stats */
@ -361,7 +362,7 @@ main(int argc, char *argv[])
af = AF_UNSPEC;
while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:Qq:rSsuWw:xz"))
while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
!= -1)
switch(ch) {
case 'A':
@ -476,6 +477,9 @@ main(int argc, char *argv[])
interval = atoi(optarg);
iflag = 1;
break;
case 'T':
Tflag = 1;
break;
case 'x':
xflag = 1;
break;
@ -515,6 +519,9 @@ main(int argc, char *argv[])
if (!live)
setgid(getgid());
if (xflag && Tflag)
errx(1, "-x and -T are incompatible, pick one.");
if (Bflag) {
if (!live)
usage();
@ -794,7 +801,7 @@ static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: netstat [-AaLnSWx] [-f protocol_family | -p protocol]\n"
"usage: netstat [-AaLnSTWx] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
" netstat -i | -I interface [-abdhnW] [-f address_family]\n"
" [-M core] [-N system]",

View File

@ -49,7 +49,7 @@ depending on the options for the information presented.
.It Xo
.Bk -words
.Nm
.Op Fl AaLnSWx
.Op Fl AaLnSTWx
.Op Fl f Ar protocol_family | Fl p Ar protocol
.Op Fl M Ar core
.Op Fl N Ar system
@ -88,6 +88,10 @@ but show ports symbolically.
If
.Fl x
is present, display socket buffer and tcp timer statistics for each internet socket.
When
.Fl T
is present, display information from the TCP control block, including
retransmits, out-of-order packets received, and zero-sized windows advertised.
.It Xo
.Bk -words
.Nm

View File

@ -50,6 +50,7 @@ extern int numeric_addr; /* show addresses numerically */
extern int numeric_port; /* show ports numerically */
extern int rflag; /* show routing tables (or routing stats) */
extern int sflag; /* show protocol statistics */
extern int Tflag; /* show TCP control block info */
extern int Wflag; /* wide display */
extern int xflag; /* extended display, includes all socket buffer info */
extern int zflag; /* zero stats */

View File

@ -348,7 +348,7 @@ write operations per second
kilobytes read per second
.It kw/s
kilobytes write per second
.It wait
.It qlen
transactions queue length
.It svc_t
average duration of transactions, in milliseconds

View File

@ -750,11 +750,11 @@ devstats(int perf_select, long double etime, int havelast)
printf("\n");
if (Iflag == 0)
printf(
"device r/s w/s kr/s kw/s wait svc_t %%b "
"device r/s w/s kr/s kw/s qlen svc_t %%b "
);
else
printf(
"device r/i w/i kr/i kw/i wait svc_t %%b "
"device r/i w/i kr/i kw/i qlen svc_t %%b "
);
if (Tflag > 0)
printf("tin tout ");