Merge ^/head r304885 through r304954.
This commit is contained in:
commit
aeb74474a8
@ -94,7 +94,7 @@ struct speed {
|
||||
int sp; /* the actual speed */
|
||||
};
|
||||
|
||||
#define DATA(number) { B##number, number }
|
||||
#define DATA(number) { (NCURSES_OSPEED)B##number, number }
|
||||
|
||||
static struct speed const speeds[] =
|
||||
{
|
||||
|
@ -38,14 +38,26 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.globl CNAME(__error)
|
||||
.type CNAME(__error),@function
|
||||
|
||||
ENTRY(ptrace)
|
||||
xorl %eax,%eax
|
||||
pushq %rdi /* align stack */
|
||||
pushq %rdi
|
||||
pushq %rsi
|
||||
pushq %rdx
|
||||
pushq %rcx
|
||||
#ifdef PIC
|
||||
movq PIC_GOT(CNAME(errno)),%r8
|
||||
movl %eax,(%r8)
|
||||
callq PIC_PLT(CNAME(__error))
|
||||
#else
|
||||
movl %eax,CNAME(errno)(%rip)
|
||||
callq CNAME(__error)
|
||||
#endif
|
||||
popq %rcx
|
||||
popq %rdx
|
||||
popq %rsi
|
||||
popq %rdi
|
||||
popq %rdi
|
||||
movl $0,(%rax)
|
||||
mov $SYS_ptrace,%eax
|
||||
KERNCALL
|
||||
jb HIDENAME(cerror)
|
||||
|
@ -38,16 +38,18 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.globl CNAME(__error)
|
||||
.type CNAME(__error),@function
|
||||
|
||||
ENTRY(ptrace)
|
||||
xorl %eax,%eax
|
||||
#ifdef PIC
|
||||
PIC_PROLOGUE
|
||||
movl PIC_GOT(CNAME(errno)),%edx
|
||||
movl %eax,(%edx)
|
||||
PIC_EPILOGUE
|
||||
PIC_PROLOGUE
|
||||
call PIC_PLT(CNAME(__error))
|
||||
PIC_EPILOGUE
|
||||
#else
|
||||
movl %eax,CNAME(errno)
|
||||
call CNAME(__error)
|
||||
#endif
|
||||
movl $0,(%eax)
|
||||
mov $SYS_ptrace,%eax
|
||||
KERNCALL
|
||||
jb HIDENAME(cerror)
|
||||
|
@ -224,6 +224,7 @@ struct ai_order {
|
||||
struct policyqueue *aio_dstpolicy;
|
||||
struct addrinfo *aio_ai;
|
||||
int aio_matchlen;
|
||||
int aio_initial_sequence;
|
||||
};
|
||||
|
||||
static const ns_src default_dns_files[] = {
|
||||
@ -708,6 +709,7 @@ reorder(struct addrinfo *sentinel)
|
||||
aio[i].aio_dstpolicy = match_addrselectpolicy(ai->ai_addr,
|
||||
&policyhead);
|
||||
set_source(&aio[i], &policyhead);
|
||||
aio[i].aio_initial_sequence = i;
|
||||
}
|
||||
|
||||
/* perform sorting. */
|
||||
@ -1066,6 +1068,23 @@ comp_dst(const void *arg1, const void *arg2)
|
||||
}
|
||||
|
||||
/* Rule 10: Otherwise, leave the order unchanged. */
|
||||
|
||||
/*
|
||||
* Note that qsort is unstable; so, we can't return zero and
|
||||
* expect the order to be unchanged.
|
||||
* That also means we can't depend on the current position of
|
||||
* dst2 being after dst1. We must enforce the initial order
|
||||
* with an explicit compare on the original position.
|
||||
* The qsort specification requires that "When the same objects
|
||||
* (consisting of width bytes, irrespective of their current
|
||||
* positions in the array) are passed more than once to the
|
||||
* comparison function, the results shall be consistent with one
|
||||
* another."
|
||||
* In other words, If A < B, then we must also return B > A.
|
||||
*/
|
||||
if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
|
||||
return(1);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
.\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
|
||||
.\"
|
||||
.\" This file is in the public domain.
|
||||
.Dd July 28, 2016
|
||||
.Dd August 28, 2016
|
||||
.Dt PTRACE 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -906,7 +906,13 @@ to return
|
||||
\-1
|
||||
as a non-error value; to disambiguate,
|
||||
.Va errno
|
||||
can be set to 0 before the call and checked afterwards.
|
||||
is set to 0 in the libc wrapper for the
|
||||
.Fn ptrace
|
||||
system call and
|
||||
.Fn ptrace
|
||||
callers can reliably check
|
||||
.Va errno
|
||||
for non-zero value afterwards.
|
||||
.Sh ERRORS
|
||||
The
|
||||
.Fn ptrace
|
||||
|
@ -11,7 +11,8 @@ SHLIB_MAJOR= 0
|
||||
.PATH: ${.CURDIR}/../../sys/contrib/libnv ${.CURDIR}/../../sys/sys
|
||||
CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR}
|
||||
|
||||
SRCS= dnvlist.c
|
||||
SRCS= cnvlist.c
|
||||
SRCS+= dnvlist.c
|
||||
SRCS+= msgio.c
|
||||
SRCS+= nvlist.c
|
||||
SRCS+= nvpair.c
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ATF_TESTS_CXX= \
|
||||
cnv_tests \
|
||||
dnv_tests \
|
||||
nv_array_tests \
|
||||
nv_tests \
|
||||
|
1508
lib/libnv/tests/cnv_tests.cc
Normal file
1508
lib/libnv/tests/cnv_tests.cc
Normal file
File diff suppressed because it is too large
Load Diff
@ -57,6 +57,7 @@ MAN= accept_filter.9 \
|
||||
byteorder.9 \
|
||||
casuword.9 \
|
||||
cd.9 \
|
||||
cnv.9 \
|
||||
condvar.9 \
|
||||
config_intrhook.9 \
|
||||
contigmalloc.9 \
|
||||
@ -617,6 +618,41 @@ MLINKS+=byteorder.9 be16dec.9 \
|
||||
byteorder.9 le64dec.9 \
|
||||
byteorder.9 le64enc.9 \
|
||||
byteorder.9 le64toh.9
|
||||
MLINKS+=cnv.9 cnvlist.9 \
|
||||
cnv.9 cnvlist_free_binary.9 \
|
||||
cnv.9 cnvlist_free_bool.9 \
|
||||
cnv.9 cnvlist_free_bool_array.9 \
|
||||
cnv.9 cnvlist_free_descriptor.9 \
|
||||
cnv.9 cnvlist_free_descriptor_array.9 \
|
||||
cnv.9 cnvlist_free_null.9 \
|
||||
cnv.9 cnvlist_free_number.9 \
|
||||
cnv.9 cnvlist_free_number_array.9 \
|
||||
cnv.9 cnvlist_free_nvlist.9 \
|
||||
cnv.9 cnvlist_free_nvlist_array.9 \
|
||||
cnv.9 cnvlist_free_string.9 \
|
||||
cnv.9 cnvlist_free_string_array.9 \
|
||||
cnv.9 cnvlist_get_binary.9 \
|
||||
cnv.9 cnvlist_get_bool.9 \
|
||||
cnv.9 cnvlist_get_bool_array.9 \
|
||||
cnv.9 cnvlist_get_descriptor.9 \
|
||||
cnv.9 cnvlist_get_descriptor_array.9 \
|
||||
cnv.9 cnvlist_get_number.9 \
|
||||
cnv.9 cnvlist_get_number_array.9 \
|
||||
cnv.9 cnvlist_get_nvlist.9 \
|
||||
cnv.9 cnvlist_get_nvlist_array.9 \
|
||||
cnv.9 cnvlist_get_string.9 \
|
||||
cnv.9 cnvlist_get_string_array.9 \
|
||||
cnv.9 cnvlist_take_binary.9 \
|
||||
cnv.9 cnvlist_take_bool.9 \
|
||||
cnv.9 cnvlist_take_bool_array.9 \
|
||||
cnv.9 cnvlist_take_descriptor.9 \
|
||||
cnv.9 cnvlist_take_descriptor_array.9 \
|
||||
cnv.9 cnvlist_take_number.9 \
|
||||
cnv.9 cnvlist_take_number_array.9 \
|
||||
cnv.9 cnvlist_take_nvlist.9 \
|
||||
cnv.9 cnvlist_take_nvlist_array.9 \
|
||||
cnv.9 cnvlist_take_string.9 \
|
||||
cnv.9 cnvlist_take_string_array.9
|
||||
MLINKS+=condvar.9 cv_broadcast.9 \
|
||||
condvar.9 cv_broadcastpri.9 \
|
||||
condvar.9 cv_destroy.9 \
|
||||
|
199
share/man/man9/cnv.9
Normal file
199
share/man/man9/cnv.9
Normal file
@ -0,0 +1,199 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2016 Adam Starak <starak.adam@gmail.com>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 27, 2016
|
||||
.Dt CNV 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm cnvlist_get,
|
||||
.Nm cnvlist_take,
|
||||
.Nm cnvlist_free,
|
||||
.Nd "API for managing name/value pairs by cookie."
|
||||
.Sh LIBRARY
|
||||
.Lb libnv
|
||||
.Sh SYNOPSIS
|
||||
.In sys/cnv.h
|
||||
.Ft bool
|
||||
.Fn cnvlist_get_bool "void *cookiep"
|
||||
.Ft uint64_t
|
||||
.Fn cnvlist_get_number "void *cookiep"
|
||||
.Ft "const char *"
|
||||
.Fn cnvlist_get_string "void *cookiep"
|
||||
.Ft "const nvlist_t *"
|
||||
.Fn cnvlist_get_nvlist "void *cookiep"
|
||||
.Ft "const void *"
|
||||
.Fn cnvlist_get_binary "void *cookiep" "size_t *sizep"
|
||||
.Ft "const bool *"
|
||||
.Fn cnvlist_get_bool_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft "const uint64_t *"
|
||||
.Fn cnvlist_get_number_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft "const char * const *"
|
||||
.Fn cnvlist_get_string_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft "const nvlist_t * const *"
|
||||
.Fn cnvlist_get_nvlist_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft int
|
||||
.Fn cnvlist_get_descriptor "void *cookiep"
|
||||
.Ft "const int *"
|
||||
.Fn cnvlist_get_descriptor_array "void *cookiep" "size_t *nitemsp"
|
||||
.\"
|
||||
.Ft bool
|
||||
.Fn cnvlist_take_bool "void *cookiep"
|
||||
.Ft uint64_t
|
||||
.Fn cnvlist_take_number "void *cookiep"
|
||||
.Ft "const char *"
|
||||
.Fn cnvlist_take_string "void *cookiep"
|
||||
.Ft "const nvlist_t *"
|
||||
.Fn cnvlist_take_nvlist "void *cookiep"
|
||||
.Ft "const void *"
|
||||
.Fn cnvlist_take_binary "void *cookiep" "size_t *sizep"
|
||||
.Ft "const bool *"
|
||||
.Fn cnvlist_take_bool_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft "const uint64_t *"
|
||||
.Fn cnvlist_take_number_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft "const char * const *"
|
||||
.Fn cnvlist_take_string_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft "const nvlist_t * const *"
|
||||
.Fn cnvlist_take_nvlist_array "void *cookiep" "size_t *nitemsp"
|
||||
.Ft int
|
||||
.Fn cnvlist_take_descriptor "void *cookiep"
|
||||
.Ft "const int *'
|
||||
.Fn cnvlist_take_descriptor_array "void *cookiep" "size_t *nitemsp"
|
||||
.\"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_null "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_bool "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_number "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_string "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_nvlist "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_descriptor "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_binary "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_bool_array "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_number_array "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_string_array "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_nvlist_array "nvlist_t *nvl" "void *cookiep"
|
||||
.Ft void
|
||||
.Fn cnvlist_free_descriptor_array "nvlist_t *nvl" "void *cookiep"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm libnv
|
||||
library permits easy management of name/value pairs and can send and receive
|
||||
them over sockets.
|
||||
For more information, also see
|
||||
.Xr nv 9 .
|
||||
.Pp
|
||||
The concept of cookies is explained in
|
||||
.Fn nvlist_next ,
|
||||
.Fn nvlist_get_parent ,
|
||||
and
|
||||
.Fn nvlist_get_pararr
|
||||
from
|
||||
.Xr nv 9 .
|
||||
.Pp
|
||||
The
|
||||
.Nm cnvlist_get
|
||||
family of functions obtains the value associated with the given cookie.
|
||||
Returned strings, nvlists, descriptors, binaries, or arrays must not be modified
|
||||
by the user, since they still belong to the nvlist.
|
||||
The nvlist must not be in an error state.
|
||||
.Pp
|
||||
The
|
||||
.Nm cnvlist_take
|
||||
family of functions returns the value associated with the given cookie and
|
||||
removes the element from the nvlist.
|
||||
When the value is a string, binary, or array value, the caller is responsible
|
||||
for freeing the returned memory with
|
||||
.Fn free 3 .
|
||||
When the value is an nvlist, the caller is responsible for destroying the
|
||||
returned nvlist with
|
||||
.Fn nvlist_destroy .
|
||||
When the value is a descriptor, the caller is responsible for closing the
|
||||
returned descriptor with the
|
||||
.Fn close 2 .
|
||||
.Pp
|
||||
The
|
||||
.Nm cnvlist_free
|
||||
family of functions removes an element of the supplied cookie and frees all
|
||||
resources.
|
||||
If an element of the given cookie has the wrong type or does not exist, the
|
||||
program
|
||||
is aborted.
|
||||
.Sh EXAMPLE
|
||||
The following example demonstrates how to deal with cnvlist API.
|
||||
.Bd -literal
|
||||
int type;
|
||||
void *cookie, *scookie, *bcookie;
|
||||
nvlist_t *nvl;
|
||||
char *name;
|
||||
|
||||
nvl = nvlist_create(0);
|
||||
nvlist_add_bool(nvl, "test", 1 == 2);
|
||||
nvlist_add_string(nvl, "test2", "cnvlist");
|
||||
cookie = NULL;
|
||||
|
||||
while (nvlist_next(nvl, &type, &cookie) != NULL) {
|
||||
switch (type) {
|
||||
case NV_TYPE_BOOL:
|
||||
printf("test: %d\\n", cnvlist_get_bool(cookie));
|
||||
bcookie = cookie;
|
||||
break;
|
||||
case NV_TYPE_STRING:
|
||||
printf("test2: %s\\n", cnvlist_get_string(cookie));
|
||||
scookie = cookie;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
name = cnvlist_take_string(nvl, scookie);
|
||||
cnvlist_free_bool(nvl, bcookie);
|
||||
|
||||
printf("test2: %s\\n", name);
|
||||
free(name);
|
||||
|
||||
printf("nvlist_empty = %d\\n", nvlist_empty(nvl));
|
||||
nvlist_destroy(nvl);
|
||||
|
||||
return (0);
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr nv 9 ,
|
||||
.Xr close 2 ,
|
||||
.Xr free 3
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm cnv
|
||||
API was created during the Google Summer Of Code 2016 by
|
@ -1089,7 +1089,9 @@ DB_SHOW_COMMAND(vtop, db_show_vtop)
|
||||
|
||||
if (have_addr) {
|
||||
phys = arm64_address_translate_s1e1r(addr);
|
||||
db_printf("Physical address reg: 0x%016lx\n", phys);
|
||||
db_printf("Physical address reg (read): 0x%016lx\n", phys);
|
||||
phys = arm64_address_translate_s1e1w(addr);
|
||||
db_printf("Physical address reg (write): 0x%016lx\n", phys);
|
||||
} else
|
||||
db_printf("show vtop <virt_addr>\n");
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ ata_op_string(struct ata_cmd *cmd)
|
||||
}
|
||||
return "DSM";
|
||||
case 0x08: return ("DEVICE_RESET");
|
||||
case 0x0b: return ("REQUEST_SENSE_DATA_EXT");
|
||||
case 0x20: return ("READ");
|
||||
case 0x24: return ("READ48");
|
||||
case 0x25: return ("READ_DMA48");
|
||||
@ -120,6 +121,12 @@ ata_op_string(struct ata_cmd *cmd)
|
||||
case 0x47: return ("READ_LOG_DMA_EXT");
|
||||
case 0x4a: return ("ZAC_MANAGEMENT_IN");
|
||||
case 0x51: return ("CONFIGURE_STREAM");
|
||||
case 0x57: return ("WRITE_LOG_DMA_EXT");
|
||||
case 0x5b: return ("TRUSTED_NON_DATA");
|
||||
case 0x5c: return ("TRUSTED_RECEIVE");
|
||||
case 0x5d: return ("TRUSTED_RECEIVE_DMA");
|
||||
case 0x5e: return ("TRUSTED_SEND");
|
||||
case 0x5f: return ("TRUSTED_SEND_DMA");
|
||||
case 0x60: return ("READ_FPDMA_QUEUED");
|
||||
case 0x61: return ("WRITE_FPDMA_QUEUED");
|
||||
case 0x63:
|
||||
@ -160,9 +167,12 @@ ata_op_string(struct ata_cmd *cmd)
|
||||
}
|
||||
return ("SEP_ATTN");
|
||||
case 0x70: return ("SEEK");
|
||||
case 0x77: return ("SET_DATE_TIME_EXT");
|
||||
case 0x78: return ("ACCESSIBLE_MAX_ADDRESS_CONFIGURATION");
|
||||
case 0x87: return ("CFA_TRANSLATE_SECTOR");
|
||||
case 0x90: return ("EXECUTE_DEVICE_DIAGNOSTIC");
|
||||
case 0x92: return ("DOWNLOAD_MICROCODE");
|
||||
case 0x93: return ("DOWNLOAD_MICROCODE_DMA");
|
||||
case 0x9a: return ("ZAC_MANAGEMENT_OUT");
|
||||
case 0xa0: return ("PACKET");
|
||||
case 0xa1: return ("ATAPI_IDENTIFY");
|
||||
@ -180,6 +190,7 @@ ata_op_string(struct ata_cmd *cmd)
|
||||
}
|
||||
return ("SMART");
|
||||
case 0xb1: return ("DEVICE CONFIGURATION");
|
||||
case 0xb4: return ("SANITIZE_DEVICE");
|
||||
case 0xc0: return ("CFA_ERASE");
|
||||
case 0xc4: return ("READ_MUL");
|
||||
case 0xc5: return ("WRITE_MUL");
|
||||
|
@ -526,6 +526,7 @@ contrib/libfdt/fdt_rw.c optional fdt
|
||||
contrib/libfdt/fdt_strerror.c optional fdt
|
||||
contrib/libfdt/fdt_sw.c optional fdt
|
||||
contrib/libfdt/fdt_wip.c optional fdt
|
||||
contrib/libnv/cnvlist.c standard
|
||||
contrib/libnv/dnvlist.c standard
|
||||
contrib/libnv/nvlist.c standard
|
||||
contrib/libnv/nvpair.c standard
|
||||
|
@ -1882,6 +1882,12 @@
|
||||
#define AR_PHY_PLL_BB_DPLL3 AR_PHY_65NM(overlay_0x16180.Osprey.ch0_bb_dpll3)
|
||||
#define AR_PHY_PLL_BB_DPLL4 AR_PHY_65NM(overlay_0x16180.Osprey.ch0_bb_dpll4)
|
||||
|
||||
/*
|
||||
* Wasp/Hornet PHY USB PLL control
|
||||
*/
|
||||
#define AR_PHY_USB_CTRL1 0x16c84
|
||||
#define AR_PHY_USB_CTRL2 0x16c88
|
||||
|
||||
/*
|
||||
* PMU Register Map
|
||||
*/
|
||||
|
@ -32,7 +32,11 @@
|
||||
# define __KERNEL__
|
||||
#endif
|
||||
|
||||
#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
|
||||
#if defined(sun) && (defined(__svr4__) || defined(__SVR4))
|
||||
# define SOLARIS 1
|
||||
#else
|
||||
# define SOLARIS 0
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
|
||||
|
197
sys/contrib/libnv/cnvlist.c
Normal file
197
sys/contrib/libnv/cnvlist.c
Normal file
@ -0,0 +1,197 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Adam Starak <starak.adam@gmail.com>
|
||||
* 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 AUTHORS 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 AUTHORS 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$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <sys/cnv.h>
|
||||
#include <sys/nv.h>
|
||||
|
||||
#include "nv_impl.h"
|
||||
#include "nvlist_impl.h"
|
||||
#include "nvpair_impl.h"
|
||||
|
||||
#define CNVLIST_GET(ftype, type, NVTYPE) \
|
||||
ftype \
|
||||
cnvlist_get_##type(void *cookiep) \
|
||||
{ \
|
||||
\
|
||||
if (nvpair_type(cookiep) != NV_TYPE_##NVTYPE) { \
|
||||
nvlist_report_missing(NV_TYPE_##NVTYPE, \
|
||||
nvpair_name(cookiep)); \
|
||||
} \
|
||||
return (nvpair_get_##type(cookiep)); \
|
||||
}
|
||||
|
||||
CNVLIST_GET(bool, bool, BOOL)
|
||||
CNVLIST_GET(uint64_t, number, NUMBER)
|
||||
CNVLIST_GET(const char *, string, STRING)
|
||||
CNVLIST_GET(const nvlist_t *, nvlist, NVLIST)
|
||||
#ifndef _KERNEL
|
||||
CNVLIST_GET(int, descriptor, DESCRIPTOR)
|
||||
#endif
|
||||
|
||||
#undef CNVLIST_GET
|
||||
|
||||
#define CNVLIST_GET_ARRAY(ftype, type, NVTYPE) \
|
||||
ftype \
|
||||
cnvlist_get_##type(void *cookiep, size_t *nitemsp) \
|
||||
{ \
|
||||
\
|
||||
if (nvpair_type(cookiep) != NV_TYPE_##NVTYPE) { \
|
||||
nvlist_report_missing(NV_TYPE_##NVTYPE, \
|
||||
nvpair_name(cookiep)); \
|
||||
} \
|
||||
return (nvpair_get_##type(cookiep, nitemsp)); \
|
||||
}
|
||||
|
||||
CNVLIST_GET_ARRAY(const bool *, bool_array, BOOL_ARRAY)
|
||||
CNVLIST_GET_ARRAY(const uint64_t *, number_array, NUMBER_ARRAY)
|
||||
CNVLIST_GET_ARRAY(const char * const *, string_array, STRING_ARRAY)
|
||||
CNVLIST_GET_ARRAY(const nvlist_t * const *, nvlist_array, NVLIST_ARRAY)
|
||||
#ifndef _KERNEL
|
||||
CNVLIST_GET_ARRAY(const int *, descriptor_array, DESCRIPTOR_ARRAY)
|
||||
#endif
|
||||
|
||||
#undef CNVLIST_GET_ARRAY
|
||||
|
||||
const void *
|
||||
cnvlist_get_binary(void *cookiep, size_t *sizep)
|
||||
{
|
||||
|
||||
if (nvpair_type(cookiep) != NV_TYPE_BINARY)
|
||||
nvlist_report_missing(NV_TYPE_BINARY, nvpair_name(cookiep));
|
||||
return (nvpair_get_binary(cookiep, sizep));
|
||||
}
|
||||
|
||||
#define CNVLIST_TAKE(ftype, type, NVTYPE) \
|
||||
ftype \
|
||||
cnvlist_take_##type(nvlist_t *nvl, void *cookiep) \
|
||||
{ \
|
||||
ftype value; \
|
||||
\
|
||||
if (nvpair_type(cookiep) != NV_TYPE_##NVTYPE) { \
|
||||
nvlist_report_missing(NV_TYPE_##NVTYPE, \
|
||||
nvpair_name(cookiep)); \
|
||||
} \
|
||||
value = (ftype)(intptr_t)nvpair_get_##type(cookiep); \
|
||||
nvlist_remove_nvpair(nvl, cookiep); \
|
||||
nvpair_free_structure(cookiep); \
|
||||
return (value); \
|
||||
}
|
||||
|
||||
CNVLIST_TAKE(bool, bool, BOOL)
|
||||
CNVLIST_TAKE(uint64_t, number, NUMBER)
|
||||
CNVLIST_TAKE(char *, string, STRING)
|
||||
CNVLIST_TAKE(nvlist_t *, nvlist, NVLIST)
|
||||
#ifndef _KERNEL
|
||||
CNVLIST_TAKE(int, descriptor, DESCRIPTOR)
|
||||
#endif
|
||||
|
||||
#undef CNVLIST_TAKE
|
||||
|
||||
#define CNVLIST_TAKE_ARRAY(ftype, type, NVTYPE) \
|
||||
ftype \
|
||||
cnvlist_take_##type(nvlist_t *nvl, void *cookiep, size_t *nitemsp) \
|
||||
{ \
|
||||
ftype value; \
|
||||
\
|
||||
if (nvpair_type(cookiep) != NV_TYPE_##NVTYPE) { \
|
||||
nvlist_report_missing(NV_TYPE_##NVTYPE, \
|
||||
nvpair_name(cookiep)); \
|
||||
} \
|
||||
value = (ftype)(intptr_t)nvpair_get_##type(cookiep, nitemsp); \
|
||||
nvlist_remove_nvpair(nvl, cookiep); \
|
||||
nvpair_free_structure(cookiep); \
|
||||
return (value); \
|
||||
}
|
||||
|
||||
CNVLIST_TAKE_ARRAY(bool *, bool_array, BOOL_ARRAY)
|
||||
CNVLIST_TAKE_ARRAY(uint64_t *, number_array, NUMBER_ARRAY)
|
||||
CNVLIST_TAKE_ARRAY(char **, string_array, STRING_ARRAY)
|
||||
CNVLIST_TAKE_ARRAY(nvlist_t **, nvlist_array, NVLIST_ARRAY)
|
||||
#ifndef _KERNEL
|
||||
CNVLIST_TAKE_ARRAY(int *, descriptor_array, DESCRIPTOR_ARRAY);
|
||||
#endif
|
||||
|
||||
#undef CNVLIST_TAKE_ARRAY
|
||||
|
||||
void *
|
||||
cnvlist_take_binary(nvlist_t *nvl, void *cookiep, size_t *sizep)
|
||||
{
|
||||
void *value;
|
||||
|
||||
if (nvpair_type(cookiep) != NV_TYPE_BINARY)
|
||||
nvlist_report_missing(NV_TYPE_BINARY, nvpair_name(cookiep));
|
||||
value = (void *)(intptr_t)nvpair_get_binary(cookiep, sizep);
|
||||
nvlist_remove_nvpair(nvl, cookiep);
|
||||
nvpair_free_structure(cookiep);
|
||||
return (value);
|
||||
}
|
||||
|
||||
|
||||
#define CNVLIST_FREE(type) \
|
||||
void \
|
||||
cnvlist_free_##type(nvlist_t *nvl, void *cookiep) \
|
||||
{ \
|
||||
\
|
||||
nvlist_free_nvpair(nvl, cookiep); \
|
||||
}
|
||||
|
||||
CNVLIST_FREE(bool)
|
||||
CNVLIST_FREE(number)
|
||||
CNVLIST_FREE(string)
|
||||
CNVLIST_FREE(nvlist)
|
||||
CNVLIST_FREE(binary);
|
||||
CNVLIST_FREE(bool_array)
|
||||
CNVLIST_FREE(number_array)
|
||||
CNVLIST_FREE(string_array)
|
||||
CNVLIST_FREE(nvlist_array)
|
||||
#ifndef _KERNEL
|
||||
CNVLIST_FREE(descriptor)
|
||||
CNVLIST_FREE(descriptor_array)
|
||||
#endif
|
||||
|
||||
#undef CNVLIST_FREE
|
@ -314,7 +314,7 @@ nvlist_set_flags(nvlist_t *nvl, int flags)
|
||||
nvl->nvl_flags = flags;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
nvlist_report_missing(int type, const char *name)
|
||||
{
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
void nvlist_report_missing(int type, const char *name);
|
||||
nvpair_t *nvlist_get_nvpair_parent(const nvlist_t *nvl);
|
||||
const unsigned char *nvlist_unpack_header(nvlist_t *nvl,
|
||||
const unsigned char *ptr, size_t nfds, bool *isbep, size_t *leftp);
|
||||
|
@ -3219,7 +3219,7 @@ enum iwm_sf_scenario {
|
||||
#define IWM_SF_SINGLE_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
|
||||
#define IWM_SF_AGG_UNICAST_IDLE_TIMER_DEF 160 /* 150 uSec */
|
||||
#define IWM_SF_AGG_UNICAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
|
||||
#define IWM_SF_MCAST_IDLE_TIMER_DEF 160 /* 150 mSec */
|
||||
#define IWM_SF_MCAST_IDLE_TIMER_DEF 160 /* 150 uSec */
|
||||
#define IWM_SF_MCAST_AGING_TIMER_DEF 400 /* 0.4 mSec */
|
||||
#define IWM_SF_BA_IDLE_TIMER_DEF 160 /* 150 uSec */
|
||||
#define IWM_SF_BA_AGING_TIMER_DEF 400 /* 0.4 mSec */
|
||||
@ -3244,7 +3244,7 @@ enum iwm_sf_scenario {
|
||||
|
||||
/**
|
||||
* Smart Fifo configuration command.
|
||||
* @state: smart fifo state, types listed in iwm_sf_sate.
|
||||
* @state: smart fifo state, types listed in iwm_sf_state.
|
||||
* @watermark: Minimum allowed available free space in RXF for transient state.
|
||||
* @long_delay_timeouts: aging and idle timer values for each scenario
|
||||
* in long delay state.
|
||||
|
@ -97,15 +97,19 @@ uart_pps_print_mode(struct uart_softc *sc)
|
||||
{
|
||||
|
||||
device_printf(sc->sc_dev, "PPS capture mode: ");
|
||||
switch(sc->sc_pps_mode) {
|
||||
switch(sc->sc_pps_mode & UART_PPS_SIGNAL_MASK) {
|
||||
case UART_PPS_DISABLED:
|
||||
printf("disabled");
|
||||
break;
|
||||
case UART_PPS_CTS:
|
||||
printf("CTS");
|
||||
break;
|
||||
case UART_PPS_DCD:
|
||||
printf("DCD");
|
||||
break;
|
||||
default:
|
||||
printf("invalid");
|
||||
break;
|
||||
}
|
||||
if (sc->sc_pps_mode & UART_PPS_INVERT_PULSE)
|
||||
printf("-Inverted");
|
||||
|
@ -295,21 +295,15 @@ namei(struct nameidata *ndp)
|
||||
if (error != 0) {
|
||||
if (dp != NULL)
|
||||
vrele(dp);
|
||||
vrele(ndp->ni_rootdir);
|
||||
namei_cleanup_cnp(cnp);
|
||||
return (error);
|
||||
goto out;
|
||||
}
|
||||
SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf,
|
||||
cnp->cn_flags);
|
||||
for (;;) {
|
||||
ndp->ni_startdir = dp;
|
||||
error = lookup(ndp);
|
||||
if (error != 0) {
|
||||
vrele(ndp->ni_rootdir);
|
||||
namei_cleanup_cnp(cnp);
|
||||
SDT_PROBE2(vfs, namei, lookup, return, error, NULL);
|
||||
return (error);
|
||||
}
|
||||
if (error != 0)
|
||||
goto out;
|
||||
/*
|
||||
* If not a symbolic link, we're done.
|
||||
*/
|
||||
@ -383,18 +377,16 @@ namei(struct nameidata *ndp)
|
||||
if (*(cnp->cn_nameptr) == '/') {
|
||||
vrele(dp);
|
||||
error = namei_handle_root(ndp, &dp);
|
||||
if (error != 0) {
|
||||
vrele(ndp->ni_rootdir);
|
||||
namei_cleanup_cnp(cnp);
|
||||
return (error);
|
||||
}
|
||||
if (error != 0)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
vrele(ndp->ni_rootdir);
|
||||
namei_cleanup_cnp(cnp);
|
||||
vput(ndp->ni_vp);
|
||||
ndp->ni_vp = NULL;
|
||||
vrele(ndp->ni_dvp);
|
||||
out:
|
||||
vrele(ndp->ni_rootdir);
|
||||
namei_cleanup_cnp(cnp);
|
||||
SDT_PROBE2(vfs, namei, lookup, return, error, NULL);
|
||||
return (error);
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ vop_islocked {
|
||||
IN struct vnode *vp;
|
||||
};
|
||||
|
||||
|
||||
%% lookup dvp L L L
|
||||
%% lookup vpp - L -
|
||||
|
||||
@ -72,6 +73,7 @@ vop_lookup {
|
||||
IN struct componentname *cnp;
|
||||
};
|
||||
|
||||
|
||||
%% cachedlookup dvp L L L
|
||||
%% cachedlookup vpp - L -
|
||||
|
||||
@ -83,6 +85,7 @@ vop_cachedlookup {
|
||||
IN struct componentname *cnp;
|
||||
};
|
||||
|
||||
|
||||
%% create dvp E E E
|
||||
%% create vpp - L -
|
||||
%! create post vop_create_post
|
||||
@ -177,12 +180,14 @@ vop_setattr {
|
||||
IN struct ucred *cred;
|
||||
};
|
||||
|
||||
|
||||
%% markatime vp L L L
|
||||
|
||||
vop_markatime {
|
||||
IN struct vnode *vp;
|
||||
};
|
||||
|
||||
|
||||
%% read vp L L L
|
||||
%! read post vop_read_post
|
||||
|
||||
@ -642,6 +647,7 @@ vop_allocate {
|
||||
INOUT off_t *len;
|
||||
};
|
||||
|
||||
|
||||
%% advise vp U U U
|
||||
|
||||
vop_advise {
|
||||
@ -651,6 +657,7 @@ vop_advise {
|
||||
IN int advice;
|
||||
};
|
||||
|
||||
|
||||
%% unp_bind vp E E E
|
||||
|
||||
vop_unp_bind {
|
||||
@ -658,6 +665,7 @@ vop_unp_bind {
|
||||
IN struct socket *socket;
|
||||
};
|
||||
|
||||
|
||||
%% unp_connect vp L L L
|
||||
|
||||
vop_unp_connect {
|
||||
@ -665,30 +673,35 @@ vop_unp_connect {
|
||||
OUT struct socket **socket;
|
||||
};
|
||||
|
||||
|
||||
%% unp_detach vp = = =
|
||||
|
||||
vop_unp_detach {
|
||||
IN struct vnode *vp;
|
||||
};
|
||||
|
||||
|
||||
%% is_text vp L L L
|
||||
|
||||
vop_is_text {
|
||||
IN struct vnode *vp;
|
||||
};
|
||||
|
||||
|
||||
%% set_text vp E E E
|
||||
|
||||
vop_set_text {
|
||||
IN struct vnode *vp;
|
||||
};
|
||||
|
||||
|
||||
%% vop_unset_text vp E E E
|
||||
|
||||
vop_unset_text {
|
||||
IN struct vnode *vp;
|
||||
};
|
||||
|
||||
|
||||
%% get_writecount vp L L L
|
||||
|
||||
vop_get_writecount {
|
||||
@ -696,6 +709,7 @@ vop_get_writecount {
|
||||
OUT int *writecount;
|
||||
};
|
||||
|
||||
|
||||
%% add_writecount vp E E E
|
||||
|
||||
vop_add_writecount {
|
||||
@ -703,6 +717,7 @@ vop_add_writecount {
|
||||
IN int inc;
|
||||
};
|
||||
|
||||
|
||||
%% fdatasync vp L L L
|
||||
|
||||
vop_fdatasync {
|
||||
|
@ -15,7 +15,7 @@
|
||||
#NO_UNIVERSE
|
||||
|
||||
# Include the default QCA955x parameters
|
||||
include "QCA955X_BASE"
|
||||
include "std.QCA955X"
|
||||
|
||||
ident AP135
|
||||
|
||||
|
@ -31,6 +31,7 @@ options AR71XX_REALMEM=(64*1024*1024)
|
||||
#device iic
|
||||
|
||||
# Options required for miiproxy and mdiobus
|
||||
options ARGE_DEBUG
|
||||
options ARGE_MDIO # Export an MDIO bus separate from arge
|
||||
device miiproxy # MDIO bus <-> MII PHY rendezvous
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#NO_UNIVERSE
|
||||
|
||||
# Include the default QCA955x parameters
|
||||
include "QCA955X_BASE"
|
||||
include "std.QCA955X"
|
||||
|
||||
ident DIR-655A1
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#NO_UNIVERSE
|
||||
|
||||
# Include the default QCA955x parameters
|
||||
include "QCA955X_BASE"
|
||||
include "std.QCA955X"
|
||||
|
||||
ident TL-ARCHERC7V2
|
||||
|
||||
|
@ -24,6 +24,7 @@ options AR71XX_REALMEM=(128*1024*1024)
|
||||
#device iic
|
||||
|
||||
# Options required for miiproxy and mdiobus
|
||||
options ARGE_DEBUG
|
||||
options ARGE_MDIO # Export an MDIO bus separate from arge
|
||||
device miiproxy # MDIO bus <-> MII PHY rendezvous
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#NO_UNIVERSE
|
||||
|
||||
# Include the default QCA955x parameters
|
||||
include "QCA955X_BASE"
|
||||
include "std.QCA955X"
|
||||
|
||||
ident TL-WR1043NDv2
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#NO_UNIVERSE
|
||||
|
||||
# Include the default AR913x parameters common to all AR913x SoC users.
|
||||
include "AR91XX_BASE"
|
||||
include "std.AR91XX"
|
||||
|
||||
ident TP-WN1043ND
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#
|
||||
|
||||
machine mips mips
|
||||
ident AR91XX_BASE
|
||||
#ident std.AR91XX
|
||||
cpu CPU_MIPS24K
|
||||
makeoptions KERNLOADADDR=0x80050000
|
||||
options HZ=1000
|
@ -25,6 +25,7 @@ makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if
|
||||
options DDB
|
||||
options KDB
|
||||
options ALQ
|
||||
options ALT_BREAK_TO_DEBUGGER
|
||||
|
||||
options SCHED_4BSD #4BSD scheduler
|
||||
options INET #InterNETworking
|
||||
|
@ -25,6 +25,7 @@ makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if
|
||||
|
||||
options DDB
|
||||
options KDB
|
||||
options ALT_BREAK_TO_DEBUGGER
|
||||
options ALQ
|
||||
|
||||
options SCHED_4BSD #4BSD scheduler
|
||||
|
@ -12,12 +12,12 @@
|
||||
#
|
||||
|
||||
machine mips mips
|
||||
ident QCA955X_BASE
|
||||
#ident std.QCA955X
|
||||
cpu CPU_MIPS74K
|
||||
makeoptions KERNLOADADDR=0x80050000
|
||||
options HZ=1000
|
||||
|
||||
options BREAK_TO_DEBUGGER
|
||||
#options BREAK_TO_DEBUGGER
|
||||
options ALT_BREAK_TO_DEBUGGER
|
||||
|
||||
# options BOOTVERBOSE=10
|
||||
@ -26,8 +26,7 @@ files "../atheros/files.ar71xx"
|
||||
hints "QCA955X_BASE.hints"
|
||||
|
||||
makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
|
||||
# makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr ath ath_ahb hwpmc"
|
||||
makeoptions MODULES_OVERRIDE="if_vlan ipfw if_gre if_gif if_bridge bridgestp"
|
||||
makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 urtwn urtwnfw otus otusfw"
|
||||
|
||||
options DDB
|
||||
options KDB
|
@ -766,7 +766,7 @@ _epic= epic
|
||||
_igb= igb
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE} == "i386"
|
||||
_cloudabi32= cloudabi32
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
|
||||
|
@ -3,7 +3,7 @@
|
||||
SYSDIR?=${.CURDIR}/../..
|
||||
|
||||
.PATH: ${SYSDIR}/compat/cloudabi32
|
||||
.PATH: ${SYSDIR}/${MACHINE}/cloudabi32
|
||||
.PATH: ${SYSDIR}/${MACHINE_CPUARCH}/cloudabi32
|
||||
|
||||
KMOD= cloudabi32
|
||||
SRCS= cloudabi32_fd.c cloudabi32_module.c cloudabi32_poll.c \
|
||||
|
@ -3,7 +3,7 @@
|
||||
SYSDIR?=${.CURDIR}/../..
|
||||
|
||||
.PATH: ${SYSDIR}/compat/cloudabi64
|
||||
.PATH: ${SYSDIR}/${MACHINE}/cloudabi64
|
||||
.PATH: ${SYSDIR}/${MACHINE_CPUARCH}/cloudabi64
|
||||
|
||||
KMOD= cloudabi64
|
||||
SRCS= cloudabi64_fd.c cloudabi64_module.c cloudabi64_poll.c \
|
||||
|
112
sys/sys/cnv.h
Normal file
112
sys/sys/cnv.h
Normal file
@ -0,0 +1,112 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Adam Starak <starak.adam@gmail.com>
|
||||
* 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 AUTHORS 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 AUTHORS 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$
|
||||
*/
|
||||
|
||||
#ifndef _CNV_H_
|
||||
#define _CNV_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef _KERNEL
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef _NVLIST_T_DECLARED
|
||||
#define _NVLIST_T_DECLARED
|
||||
struct nvlist;
|
||||
|
||||
typedef struct nvlist nvlist_t;
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* The cnvlist_get functions returns value associated with the given cookie.
|
||||
* If it returns a pointer, the pointer represents internal buffer and should
|
||||
* not be freed by the caller.
|
||||
*/
|
||||
|
||||
bool cnvlist_get_bool(void *cookiep);
|
||||
uint64_t cnvlist_get_number(void *cookiep);
|
||||
const char *cnvlist_get_string(void *cookiep);
|
||||
const nvlist_t *cnvlist_get_nvlist(void *cookiep);
|
||||
const void *cnvlist_get_binary(void *cookiep, size_t *sizep);
|
||||
const bool *cnvlist_get_bool_array(void *cookiep, size_t *nitemsp);
|
||||
const uint64_t *cnvlist_get_number_array(void *cookiep, size_t *nitemsp);
|
||||
const char * const *cnvlist_get_string_array(void *cookiep, size_t *nitemsp);
|
||||
const nvlist_t * const *cnvlist_get_nvlist_array(void *cookiep, size_t *nitemsp);
|
||||
#ifndef _KERNEL
|
||||
int cnvlist_get_descriptor(void *cookiep);
|
||||
const int *cnvlist_get_descriptor_array(void *cookiep, size_t *nitemsp);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The cnvlist_take functions returns value associated with the given cookie and
|
||||
* remove the given entry from the nvlist.
|
||||
* The caller is responsible for freeing received data.
|
||||
*/
|
||||
|
||||
bool cnvlist_take_bool(nvlist_t *nvl, void *cookiep);
|
||||
uint64_t cnvlist_take_number(nvlist_t *nvl, void *cookiep);
|
||||
char *cnvlist_take_string(nvlist_t *nvl, void *cookiep);
|
||||
nvlist_t *cnvlist_take_nvlist(nvlist_t *nvl, void *cookiep);
|
||||
void *cnvlist_take_binary(nvlist_t *nvl, void *cookiep, size_t *sizep);
|
||||
bool *cnvlist_take_bool_array(nvlist_t *nvl, void *cookiep, size_t *nitemsp);
|
||||
uint64_t *cnvlist_take_number_array(nvlist_t *nvl, void *cookiep, size_t *nitemsp);
|
||||
char **cnvlist_take_string_array(nvlist_t *nvl, void *cookiep, size_t *nitemsp);
|
||||
nvlist_t **cnvlist_take_nvlist_array(nvlist_t *nvl, void *cookiep, size_t *nitemsp);
|
||||
#ifndef _KERNEL
|
||||
int cnvlist_take_descriptor(nvlist_t *nvl, void *cookiep);
|
||||
int *cnvlist_take_descriptor_array(nvlist_t *nvl, void *cookiep, size_t *nitemsp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The cnvlist_free functions removes the given name/value pair from the nvlist based on cookie
|
||||
* and frees memory associated with it.
|
||||
*/
|
||||
|
||||
void cnvlist_free_bool(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_number(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_string(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_nvlist(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_binary(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_bool_array(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_number_array(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_string_array(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_nvlist_array(nvlist_t *nvl, void *cookiep);
|
||||
#ifndef _KERNEL
|
||||
void cnvlist_free_descriptor(nvlist_t *nvl, void *cookiep);
|
||||
void cnvlist_free_descriptor_array(nvlist_t *nvl, void *cookiep);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_CNV_H_ */
|
@ -182,7 +182,7 @@ static int
|
||||
getparent(const char *ifname, char parent[IFNAMSIZ+1])
|
||||
{
|
||||
char oid[256];
|
||||
int parentlen;
|
||||
size_t parentlen;
|
||||
|
||||
/* fetch parent interface name */
|
||||
snprintf(oid, sizeof(oid), "net.wlan.%s.%%parent", ifname+4);
|
||||
@ -239,7 +239,7 @@ iswdsvap(int s, const char *ifname)
|
||||
* to have already verified this is possible.
|
||||
*/
|
||||
static void
|
||||
getbssid(int s, const char *ifname, char bssid[IEEE80211_ADDR_LEN])
|
||||
getbssid(int s, const char *ifname, uint8_t bssid[IEEE80211_ADDR_LEN])
|
||||
{
|
||||
struct ieee80211req ireq;
|
||||
|
||||
@ -261,7 +261,7 @@ static void
|
||||
scanforvaps(int s)
|
||||
{
|
||||
char ifname[IFNAMSIZ+1];
|
||||
char bssid[IEEE80211_ADDR_LEN];
|
||||
uint8_t bssid[IEEE80211_ADDR_LEN];
|
||||
int i;
|
||||
|
||||
/* XXX brutal; should just walk sysctl tree */
|
||||
|
@ -104,7 +104,9 @@ static int ifmap_size;
|
||||
static struct timespec uptime;
|
||||
|
||||
static const char *netname4(in_addr_t, in_addr_t);
|
||||
#ifdef INET6
|
||||
static const char *netname6(struct sockaddr_in6 *, struct sockaddr_in6 *);
|
||||
#endif
|
||||
static void p_rtable_sysctl(int, int);
|
||||
static void p_rtentry_sysctl(const char *name, struct rt_msghdr *);
|
||||
static int p_sockaddr(const char *name, struct sockaddr *, struct sockaddr *,
|
||||
|
Loading…
Reference in New Issue
Block a user