MFHead @349476
Sponsored by: The FreeBSD Foundation
This commit is contained in:
commit
7f49ce7a0b
6
UPDATING
6
UPDATING
@ -43,6 +43,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
|
||||
sysctls have been removed. If you felt the need to set any of them to
|
||||
a non-default value, please tell asomers@FreeBSD.org why.
|
||||
|
||||
20190620:
|
||||
Entropy collection and the /dev/random device are no longer optional
|
||||
components. The "device random" option has been removed.
|
||||
Implementations of distilling algorithms can still be made loadable
|
||||
with "options RANDOM_LOADABLE" (e.g., random_fortuna.ko).
|
||||
|
||||
20190612:
|
||||
Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have
|
||||
been upgraded to 8.0.1. Please see the 20141231 entry below for
|
||||
|
@ -1398,7 +1398,23 @@ update_shdr(struct elfcopy *ecp, int update_link)
|
||||
void
|
||||
init_shstrtab(struct elfcopy *ecp)
|
||||
{
|
||||
Elf_Scn *shstrtab;
|
||||
GElf_Shdr shdr;
|
||||
struct section *s;
|
||||
size_t indx, sizehint;
|
||||
|
||||
if (elf_getshstrndx(ecp->ein, &indx) != 0) {
|
||||
shstrtab = elf_getscn(ecp->ein, indx);
|
||||
if (shstrtab == NULL)
|
||||
errx(EXIT_FAILURE, "elf_getscn failed: %s",
|
||||
elf_errmsg(-1));
|
||||
if (gelf_getshdr(shstrtab, &shdr) != &shdr)
|
||||
errx(EXIT_FAILURE, "gelf_getshdr failed: %s",
|
||||
elf_errmsg(-1));
|
||||
sizehint = shdr.sh_size;
|
||||
} else {
|
||||
sizehint = 0;
|
||||
}
|
||||
|
||||
if ((ecp->shstrtab = calloc(1, sizeof(*ecp->shstrtab))) == NULL)
|
||||
err(EXIT_FAILURE, "calloc failed");
|
||||
@ -1410,7 +1426,7 @@ init_shstrtab(struct elfcopy *ecp)
|
||||
s->loadable = 0;
|
||||
s->type = SHT_STRTAB;
|
||||
s->vma = 0;
|
||||
s->strtab = elftc_string_table_create(0);
|
||||
s->strtab = elftc_string_table_create(sizehint);
|
||||
|
||||
add_to_shstrtab(ecp, "");
|
||||
add_to_shstrtab(ecp, ".symtab");
|
||||
|
@ -100,7 +100,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, uint64_t *offsetp,
|
||||
uint64_t form, int indirect, Dwarf_Error *error)
|
||||
{
|
||||
struct _Dwarf_Attribute atref;
|
||||
Dwarf_Section *str;
|
||||
int ret;
|
||||
|
||||
ret = DW_DLE_NONE;
|
||||
@ -183,9 +182,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, uint64_t *offsetp,
|
||||
break;
|
||||
case DW_FORM_strp:
|
||||
atref.u[0].u64 = dbg->read(ds->ds_data, offsetp, dwarf_size);
|
||||
str = _dwarf_find_section(dbg, ".debug_str");
|
||||
assert(str != NULL);
|
||||
atref.u[1].s = (char *) str->ds_data + atref.u[0].u64;
|
||||
atref.u[1].s = _dwarf_strtab_get_table(dbg) + atref.u[0].u64;
|
||||
break;
|
||||
case DW_FORM_ref_sig8:
|
||||
atref.u[0].u64 = 8;
|
||||
|
@ -44,7 +44,7 @@ ELFTC_VCSID("$Id: elftc_string_table.c 2869 2013-01-06 13:29:18Z jkoshy $");
|
||||
#define ELFTC_STRING_TABLE_POOL_SIZE_INCREMENT (4*1024)
|
||||
|
||||
struct _Elftc_String_Table_Entry {
|
||||
int ste_idx;
|
||||
ssize_t ste_idx;
|
||||
SLIST_ENTRY(_Elftc_String_Table_Entry) ste_next;
|
||||
};
|
||||
|
||||
@ -64,9 +64,9 @@ struct _Elftc_String_Table_Entry {
|
||||
} while (0)
|
||||
|
||||
struct _Elftc_String_Table {
|
||||
unsigned int st_len; /* length and flags */
|
||||
size_t st_len; /* length and flags */
|
||||
int st_nbuckets;
|
||||
int st_string_pool_size;
|
||||
size_t st_string_pool_size;
|
||||
char *st_string_pool;
|
||||
SLIST_HEAD(_Elftc_String_Table_Bucket,
|
||||
_Elftc_String_Table_Entry) st_buckets[];
|
||||
@ -86,7 +86,7 @@ elftc_string_table_find_hash_entry(Elftc_String_Table *st, const char *string,
|
||||
*rhashindex = hashindex;
|
||||
|
||||
SLIST_FOREACH(ste, &st->st_buckets[hashindex], ste_next) {
|
||||
s = st->st_string_pool + abs(ste->ste_idx);
|
||||
s = st->st_string_pool + labs(ste->ste_idx);
|
||||
|
||||
assert(s > st->st_string_pool &&
|
||||
s < st->st_string_pool + st->st_string_pool_size);
|
||||
@ -102,7 +102,7 @@ static int
|
||||
elftc_string_table_add_to_pool(Elftc_String_Table *st, const char *string)
|
||||
{
|
||||
char *newpool;
|
||||
int len, newsize, stlen;
|
||||
size_t len, newsize, stlen;
|
||||
|
||||
len = strlen(string) + 1; /* length, including the trailing NUL */
|
||||
stlen = ELFTC_STRING_TABLE_LENGTH(st);
|
||||
@ -119,17 +119,17 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st, const char *string)
|
||||
st->st_string_pool_size = newsize;
|
||||
}
|
||||
|
||||
strcpy(st->st_string_pool + stlen, string);
|
||||
memcpy(st->st_string_pool + stlen, string, len);
|
||||
ELFTC_STRING_TABLE_UPDATE_LENGTH(st, stlen + len);
|
||||
|
||||
return (stlen);
|
||||
}
|
||||
|
||||
Elftc_String_Table *
|
||||
elftc_string_table_create(int sizehint)
|
||||
elftc_string_table_create(size_t sizehint)
|
||||
{
|
||||
int n, nbuckets, tablesize;
|
||||
struct _Elftc_String_Table *st;
|
||||
int n, nbuckets, tablesize;
|
||||
|
||||
if (sizehint < ELFTC_STRING_TABLE_DEFAULT_SIZE)
|
||||
sizehint = ELFTC_STRING_TABLE_DEFAULT_SIZE;
|
||||
@ -173,13 +173,13 @@ elftc_string_table_destroy(Elftc_String_Table *st)
|
||||
}
|
||||
|
||||
Elftc_String_Table *
|
||||
elftc_string_table_from_section(Elf_Scn *scn, int sizehint)
|
||||
elftc_string_table_from_section(Elf_Scn *scn, size_t sizehint)
|
||||
{
|
||||
int len;
|
||||
Elf_Data *d;
|
||||
GElf_Shdr sh;
|
||||
const char *s, *end;
|
||||
Elftc_String_Table *st;
|
||||
size_t len;
|
||||
|
||||
/* Verify the type of the section passed in. */
|
||||
if (gelf_getshdr(scn, &sh) == NULL ||
|
||||
@ -235,7 +235,8 @@ elftc_string_table_image(Elftc_String_Table *st, size_t *size)
|
||||
char *r, *s, *end;
|
||||
struct _Elftc_String_Table_Entry *ste;
|
||||
struct _Elftc_String_Table_Bucket *head;
|
||||
int copied, hashindex, offset, length, newsize;
|
||||
size_t copied, offset, length, newsize;
|
||||
int hashindex;
|
||||
|
||||
/*
|
||||
* For the common case of a string table has not seen
|
||||
@ -303,8 +304,9 @@ elftc_string_table_image(Elftc_String_Table *st, size_t *size)
|
||||
size_t
|
||||
elftc_string_table_insert(Elftc_String_Table *st, const char *string)
|
||||
{
|
||||
int hashindex, idx;
|
||||
struct _Elftc_String_Table_Entry *ste;
|
||||
ssize_t idx;
|
||||
int hashindex;
|
||||
|
||||
hashindex = 0;
|
||||
|
||||
@ -326,7 +328,7 @@ elftc_string_table_insert(Elftc_String_Table *st, const char *string)
|
||||
|
||||
idx = ste->ste_idx;
|
||||
if (idx < 0) /* Undelete. */
|
||||
ste->ste_idx = idx = (- idx);
|
||||
ste->ste_idx = idx = -idx;
|
||||
|
||||
return (idx);
|
||||
}
|
||||
@ -334,8 +336,9 @@ elftc_string_table_insert(Elftc_String_Table *st, const char *string)
|
||||
size_t
|
||||
elftc_string_table_lookup(Elftc_String_Table *st, const char *string)
|
||||
{
|
||||
int hashindex, idx;
|
||||
struct _Elftc_String_Table_Entry *ste;
|
||||
ssize_t idx;
|
||||
int hashindex;
|
||||
|
||||
ste = elftc_string_table_find_hash_entry(st, string, &hashindex);
|
||||
|
||||
@ -350,17 +353,17 @@ elftc_string_table_lookup(Elftc_String_Table *st, const char *string)
|
||||
int
|
||||
elftc_string_table_remove(Elftc_String_Table *st, const char *string)
|
||||
{
|
||||
int idx;
|
||||
struct _Elftc_String_Table_Entry *ste;
|
||||
ssize_t idx;
|
||||
|
||||
ste = elftc_string_table_find_hash_entry(st, string, NULL);
|
||||
|
||||
if (ste == NULL || (idx = ste->ste_idx) < 0)
|
||||
return (ELFTC_FAILURE);
|
||||
|
||||
assert(idx > 0 && idx < (int) ELFTC_STRING_TABLE_LENGTH(st));
|
||||
assert(idx > 0 && (size_t)idx < ELFTC_STRING_TABLE_LENGTH(st));
|
||||
|
||||
ste->ste_idx = (- idx);
|
||||
ste->ste_idx = -idx;
|
||||
|
||||
ELFTC_STRING_TABLE_SET_COMPACTION_FLAG(st);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $Id: elftc_string_table_create.3 3645 2018-10-15 20:17:14Z jkoshy $
|
||||
.\"
|
||||
.Dd January 5, 2013
|
||||
.Dd June 19, 2019
|
||||
.Dt ELFTC_STRING_TABLE_CREATE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -40,11 +40,11 @@
|
||||
.Sh SYNOPSIS
|
||||
.In libelftc.h
|
||||
.Ft "Elftc_String_Table *"
|
||||
.Fn elftc_string_table_create "int sizehint"
|
||||
.Ft int
|
||||
.Fn elftc_string_table_create "size_t sizehint"
|
||||
.Ft void
|
||||
.Fn elftc_string_table_destroy "Elftc_String_Table *table"
|
||||
.Ft "Elftc_String_Table *"
|
||||
.Fn elftc_string_table_from_section "Elf_Scn *scn" "int sizehint"
|
||||
.Fn elftc_string_table_from_section "Elf_Scn *scn" "size_t sizehint"
|
||||
.Ft "const char *"
|
||||
.Fo elftc_string_table_image
|
||||
.Fa "Elftc_String_Table *table"
|
||||
|
@ -77,10 +77,10 @@ int elftc_demangle(const char *_mangledname, char *_buffer,
|
||||
size_t _bufsize, unsigned int _flags);
|
||||
const char *elftc_reloc_type_str(unsigned int mach, unsigned int type);
|
||||
int elftc_set_timestamps(const char *_filename, struct stat *_sb);
|
||||
Elftc_String_Table *elftc_string_table_create(int _hint);
|
||||
Elftc_String_Table *elftc_string_table_create(size_t _sizehint);
|
||||
void elftc_string_table_destroy(Elftc_String_Table *_table);
|
||||
Elftc_String_Table *elftc_string_table_from_section(Elf_Scn *_scn,
|
||||
int _hint);
|
||||
size_t _sizehint);
|
||||
const char *elftc_string_table_image(Elftc_String_Table *_table,
|
||||
size_t *_sz);
|
||||
size_t elftc_string_table_insert(Elftc_String_Table *_table,
|
||||
|
@ -38,6 +38,7 @@
|
||||
.file "tramp.asm"
|
||||
.section ".text"
|
||||
#include "ppc-asm.h"
|
||||
#include "auto-host.h"
|
||||
|
||||
#ifndef __powerpc64__
|
||||
.type trampoline_initial,@object
|
||||
@ -105,7 +106,7 @@ FUNC_START(__trampoline_setup)
|
||||
blr
|
||||
|
||||
.Labort:
|
||||
#if defined SHARED && defined HAVE_AS_REL16
|
||||
#if (defined(__PIC__) || defined(__pic__)) && defined HAVE_AS_REL16
|
||||
bcl 20,31,1f
|
||||
1: mflr r30
|
||||
addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
|
||||
|
@ -27,7 +27,7 @@ ipmon \- monitors /dev/ipl for logged packets
|
||||
.LP
|
||||
\fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
|
||||
the packet filter. The binary data read from the device is reprinted in
|
||||
human readable for, however, IP#'s are not mapped back to hostnames, nor are
|
||||
human readable form, however, IP#'s are not mapped back to hostnames, nor are
|
||||
ports mapped back to service names. The output goes to standard output by
|
||||
default or a filename, if given on the command line. Should the \fB\-s\fP
|
||||
option be used, output is instead sent to \fBsyslogd(8)\fP. Messages sent
|
||||
|
@ -1438,7 +1438,10 @@ static void print_ipflog(conf, buf, blen)
|
||||
static void usage(prog)
|
||||
char *prog;
|
||||
{
|
||||
fprintf(stderr, "%s: [-NFhstvxX] [-f <logfile>]\n", prog);
|
||||
fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B <binary-logfile> ] [ -C <config-file> ]\n"
|
||||
"\t[ -f <device> ] [ -L <facility> ] [ -N <device> ]\n"
|
||||
"\t[ -o [NSI] ] [ -O [NSI] ] [ -P <pidfile> ] [ -S <device> ]\n"
|
||||
"\t[ <filename> ]\n", prog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,8 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
||||
if (isDarwin())
|
||||
HasLazyResolverStubs = true;
|
||||
|
||||
if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD())
|
||||
if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13)
|
||||
|| TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD())
|
||||
SecurePlt = true;
|
||||
|
||||
if (HasSPE && IsPPC64)
|
||||
|
@ -116,7 +116,8 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Tripl
|
||||
const ArgList &Args) {
|
||||
if (Args.getLastArg(options::OPT_msecure_plt))
|
||||
return ppc::ReadGOTPtrMode::SecurePlt;
|
||||
if (Triple.isOSOpenBSD())
|
||||
if ((Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 13) ||
|
||||
Triple.isOSOpenBSD())
|
||||
return ppc::ReadGOTPtrMode::SecurePlt;
|
||||
else
|
||||
return ppc::ReadGOTPtrMode::Bss;
|
||||
|
@ -138,8 +138,6 @@
|
||||
mpilib
|
||||
..
|
||||
..
|
||||
nand
|
||||
..
|
||||
nvme
|
||||
..
|
||||
ofw
|
||||
@ -184,8 +182,6 @@
|
||||
..
|
||||
msdosfs
|
||||
..
|
||||
nandfs
|
||||
..
|
||||
nfs
|
||||
..
|
||||
nullfs
|
||||
|
@ -21,6 +21,9 @@ TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
|
||||
TARGET_INC+= ${GCC_CPU}/unix.h
|
||||
TARGET_INC+= ${GCC_CPU}/att.h
|
||||
.endif
|
||||
.if ${TARGET_CPUARCH} == "powerpc"
|
||||
TARGET_INC+= ${GCC_CPU}/secureplt.h
|
||||
.endif
|
||||
TARGET_INC+= dbxelf.h
|
||||
TARGET_INC+= elfos-undef.h
|
||||
TARGET_INC+= elfos.h
|
||||
|
@ -48,7 +48,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \
|
||||
dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \
|
||||
dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \
|
||||
dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd dev/wi \
|
||||
fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
|
||||
fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \
|
||||
fs/procfs fs/smbfs fs/udf fs/unionfs \
|
||||
geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
|
||||
geom/mirror geom/mountver geom/multipath geom/nop \
|
||||
@ -158,7 +158,7 @@ copies: .PHONY .META
|
||||
done; \
|
||||
fi
|
||||
.endfor
|
||||
.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS}
|
||||
.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS}
|
||||
cd ${SRCTOP}/sys; \
|
||||
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
|
||||
${SDESTDIR}${INCLUDEDIR}/$i
|
||||
@ -174,13 +174,6 @@ copies: .PHONY .META
|
||||
cd ${SRCTOP}/sys/dev/bktr; \
|
||||
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
|
||||
${SDESTDIR}${INCLUDEDIR}/dev/bktr
|
||||
.if ${MK_NAND} != "no"
|
||||
cd ${SRCTOP}/sys/dev/nand; \
|
||||
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
|
||||
${SDESTDIR}${INCLUDEDIR}/dev/nand; \
|
||||
${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
|
||||
${SDESTDIR}${INCLUDEDIR}/dev/nand
|
||||
.endif
|
||||
cd ${SRCTOP}/sys/dev/evdev; \
|
||||
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input.h \
|
||||
${SDESTDIR}${INCLUDEDIR}/dev/evdev; \
|
||||
@ -268,7 +261,7 @@ symlinks: .PHONY .META
|
||||
${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \
|
||||
done
|
||||
.endfor
|
||||
.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci:Ndev/veriexec}
|
||||
.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec}
|
||||
cd ${SRCTOP}/sys/$i; \
|
||||
for h in *.h; do \
|
||||
${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \
|
||||
@ -289,13 +282,6 @@ symlinks: .PHONY .META
|
||||
${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/bktr/$$h \
|
||||
${SDESTDIR}${INCLUDEDIR}/dev/bktr; \
|
||||
done
|
||||
.if ${MK_NAND} != "no"
|
||||
cd ${SRCTOP}/sys/dev/nand; \
|
||||
for h in nandsim.h nand_dev.h; do \
|
||||
${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/nand/$$h \
|
||||
${SDESTDIR}${INCLUDEDIR}/dev/nand; \
|
||||
done
|
||||
.endif
|
||||
cd ${SRCTOP}/sys/dev/evdev; \
|
||||
for h in input.h input-event-codes.h uinput.h; do \
|
||||
ln -fs ../../../../sys/dev/evdev/$$h \
|
||||
|
@ -174,7 +174,6 @@ SUBDIR.${MK_GOOGLETEST}+= googletest
|
||||
SUBDIR.${MK_LIBTHR}+= libthr
|
||||
SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh
|
||||
SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s
|
||||
SUBDIR.${MK_NAND}+= libnandfs
|
||||
SUBDIR.${MK_NETGRAPH}+= libnetgraph
|
||||
SUBDIR.${MK_NIS}+= libypclnt
|
||||
|
||||
|
@ -89,25 +89,31 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (zfs_prop_get_int(zfs_hdl, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF)
|
||||
return (0);
|
||||
|
||||
if (zfs_prop_get(zfs_hdl, ZFS_PROP_MOUNTPOINT, zfs_mnt, BE_MAXPATHLEN,
|
||||
NULL, NULL, 0, 1))
|
||||
return (1);
|
||||
|
||||
if (strcmp("none", zfs_mnt) == 0) {
|
||||
/*
|
||||
* mountpoint=none; we'll mount it at info->mountpoint assuming
|
||||
* we're at the root. If we're not at the root, we're likely
|
||||
* at some intermediate dataset (e.g. zroot/var) that will have
|
||||
* children that may need to be mounted.
|
||||
*/
|
||||
if (info->depth > 0)
|
||||
goto skipmount;
|
||||
|
||||
/*
|
||||
* canmount and mountpoint are both ignored for the BE dataset, because
|
||||
* the rest of the system (kernel and loader) will effectively do the
|
||||
* same.
|
||||
*/
|
||||
if (info->depth == 0) {
|
||||
snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint);
|
||||
} else {
|
||||
if (zfs_prop_get_int(zfs_hdl, ZFS_PROP_CANMOUNT) ==
|
||||
ZFS_CANMOUNT_OFF)
|
||||
return (0);
|
||||
|
||||
if (zfs_prop_get(zfs_hdl, ZFS_PROP_MOUNTPOINT, zfs_mnt,
|
||||
BE_MAXPATHLEN, NULL, NULL, 0, 1))
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* We've encountered mountpoint=none at some intermediate
|
||||
* dataset (e.g. zroot/var) that will have children that may
|
||||
* need to be mounted. Skip mounting it, but iterate through
|
||||
* the children.
|
||||
*/
|
||||
if (strcmp("none", zfs_mnt) == 0)
|
||||
goto skipmount;
|
||||
|
||||
mountpoint = be_mountpoint_augmented(info->lbh, zfs_mnt);
|
||||
snprintf(tmp, BE_MAXPATHLEN, "%s%s", info->mountpoint,
|
||||
mountpoint);
|
||||
|
@ -338,6 +338,7 @@ FBSD_1.2 {
|
||||
getutxid;
|
||||
getutxline;
|
||||
getutxuser;
|
||||
pthread_getthreadid_np;
|
||||
pututxline;
|
||||
sem_close;
|
||||
sem_destroy;
|
||||
|
@ -130,6 +130,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
|
||||
{PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEX_CONSISTENT */
|
||||
{PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_GETROBUST */
|
||||
{PJT_DUAL_ENTRY(stub_zero)}, /* PJT_MUTEXATTR_SETROBUST */
|
||||
{PJT_DUAL_ENTRY(stub_zero)}, /* PJT_GETTHREADID_NP */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -248,6 +249,7 @@ STUB_FUNC1(pthread_rwlock_trywrlock, PJT_RWLOCK_TRYWRLOCK, int, void *)
|
||||
STUB_FUNC1(pthread_rwlock_unlock, PJT_RWLOCK_UNLOCK, int, void *)
|
||||
STUB_FUNC1(pthread_rwlock_wrlock, PJT_RWLOCK_WRLOCK, int, void *)
|
||||
STUB_FUNC(pthread_self, PJT_SELF, pthread_t)
|
||||
STUB_FUNC(pthread_getthreadid_np, PJT_GETTHREADID_NP, int)
|
||||
STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *)
|
||||
STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *)
|
||||
STUB_FUNC3(pthread_atfork, PJT_ATFORK, int, void *, void *, void*)
|
||||
|
@ -48,8 +48,8 @@ libc_dlopen(const char *path, int mode)
|
||||
if (__libc_restricted_mode) {
|
||||
_rtld_error("Service unavailable -- libc in restricted mode");
|
||||
return (NULL);
|
||||
} else
|
||||
return (dlopen(path, mode));
|
||||
}
|
||||
return (dlopen(path, mode));
|
||||
}
|
||||
|
||||
void
|
||||
@ -57,6 +57,5 @@ __FreeBSD_libc_enter_restricted_mode(void)
|
||||
{
|
||||
|
||||
__libc_restricted_mode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,8 @@ static int
|
||||
opendir_compar(const void *p1, const void *p2)
|
||||
{
|
||||
|
||||
return (strcmp((*(const struct dirent **)p1)->d_name,
|
||||
(*(const struct dirent **)p2)->d_name));
|
||||
return (strcmp((*(const struct dirent * const *)p1)->d_name,
|
||||
(*(const struct dirent * const *)p2)->d_name));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -63,8 +63,8 @@ telldir(DIR *dirp)
|
||||
* 2) Otherwise, see if it's already been recorded in the linked list
|
||||
* 3) Otherwise, malloc a new one
|
||||
*/
|
||||
if (dirp->dd_seek < (1ul << DD_SEEK_BITS) &&
|
||||
dirp->dd_loc < (1ul << DD_LOC_BITS)) {
|
||||
if (dirp->dd_seek < (off_t)(1l << DD_SEEK_BITS) &&
|
||||
dirp->dd_loc < (1l << DD_LOC_BITS)) {
|
||||
ddloc.s.is_packed = 1;
|
||||
ddloc.s.loc = dirp->dd_loc;
|
||||
ddloc.s.seek = dirp->dd_seek;
|
||||
|
@ -176,6 +176,7 @@ typedef enum {
|
||||
PJT_MUTEX_CONSISTENT,
|
||||
PJT_MUTEXATTR_GETROBUST,
|
||||
PJT_MUTEXATTR_SETROBUST,
|
||||
PJT_GETTHREADID_NP,
|
||||
PJT_MAX
|
||||
} pjt_index_t;
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#define SYSCALL(name) \
|
||||
.text; \
|
||||
.align 2; \
|
||||
2: b PIC_PLT(CNAME(HIDENAME(cerror))); \
|
||||
2: b CNAME(HIDENAME(cerror)); \
|
||||
ENTRY(__sys_##name); \
|
||||
WEAK_REFERENCE(__sys_##name, name); \
|
||||
WEAK_REFERENCE(__sys_##name, _##name); \
|
||||
@ -58,15 +58,14 @@ ENTRY(__sys_##name); \
|
||||
WEAK_REFERENCE(__sys_##name, _##name); \
|
||||
_SYSCALL(name); \
|
||||
bnslr; \
|
||||
b PIC_PLT(CNAME(HIDENAME(cerror)))
|
||||
b CNAME(HIDENAME(cerror))
|
||||
|
||||
#define RSYSCALL(name) \
|
||||
.text; \
|
||||
.align 2; \
|
||||
2: b PIC_PLT(CNAME(HIDENAME(cerror))); \
|
||||
ENTRY(__sys_##name); \
|
||||
WEAK_REFERENCE(__sys_##name, name); \
|
||||
WEAK_REFERENCE(__sys_##name, _##name); \
|
||||
_SYSCALL(name); \
|
||||
bnslr; \
|
||||
b PIC_PLT(CNAME(HIDENAME(cerror)))
|
||||
b CNAME(HIDENAME(cerror))
|
||||
|
@ -35,11 +35,18 @@
|
||||
mtlr %r14
|
||||
blrl /* branch to start function */
|
||||
mr %r3,%r15 /* pass pointer to ucontext as argument */
|
||||
bl PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */
|
||||
bl CNAME(_ctx_done) /* branch to ctxt completion func */
|
||||
|
||||
/*
|
||||
* we should never return from the
|
||||
* above branch.
|
||||
*/
|
||||
/* Don't bother saving off %r30, we're already in a bad state. */
|
||||
bcl 20,31,1f
|
||||
1: mflr %r30
|
||||
mr %r3,%r30 # save for _DYNAMIC
|
||||
addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha
|
||||
addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l
|
||||
bl PIC_PLT(CNAME(abort)) /* abort */
|
||||
END(_cts_start)
|
||||
|
||||
|
@ -40,16 +40,27 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
HIDENAME(cerror):
|
||||
mflr %r0
|
||||
stwu %r1,-16(%r1) /* allocate new stack frame */
|
||||
stw %r0,20(%r1) /* and save lr, r31 */
|
||||
stw %r31,8(%r1)
|
||||
stwu %r1,-20(%r1) /* allocate new stack frame */
|
||||
stw %r0,24(%r1) /* and save lr, r31 */
|
||||
stw %r31,12(%r1)
|
||||
#ifdef __PIC__
|
||||
stw %r30,8(%r1)
|
||||
bcl 20,31,1f
|
||||
1:
|
||||
mflr %r30
|
||||
addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha
|
||||
addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l
|
||||
#endif
|
||||
mr %r31,%r3 /* stash errval in callee-saved register */
|
||||
bl PIC_PLT(CNAME(__error))
|
||||
stw %r31,0(%r3) /* store errval into &errno */
|
||||
lwz %r0,20(%r1)
|
||||
lwz %r31,8(%r1)
|
||||
lwz %r0,24(%r1)
|
||||
lwz %r31,12(%r1)
|
||||
#ifdef __PIC__
|
||||
lwz %r30,8(%r1)
|
||||
#endif
|
||||
mtlr %r0
|
||||
la %r1,16(%r1)
|
||||
la %r1,20(%r1)
|
||||
li %r3,-1
|
||||
li %r4,-1
|
||||
blr /* return to callers caller */
|
||||
|
@ -91,7 +91,7 @@ realpath1(const char *path, char *resolved)
|
||||
*/
|
||||
p = strchr(left, '/');
|
||||
|
||||
next_token_len = p != NULL ? p - left : left_len;
|
||||
next_token_len = p != NULL ? (size_t)(p - left) : left_len;
|
||||
memcpy(next_token, left, next_token_len);
|
||||
next_token[next_token_len] = '\0';
|
||||
|
||||
@ -146,7 +146,7 @@ realpath1(const char *path, char *resolved)
|
||||
return (NULL);
|
||||
}
|
||||
slen = readlink(resolved, symlink, sizeof(symlink));
|
||||
if (slen <= 0 || slen >= sizeof(symlink)) {
|
||||
if (slen <= 0 || slen >= (ssize_t)sizeof(symlink)) {
|
||||
if (slen < 0)
|
||||
; /* keep errno from readlink(2) call */
|
||||
else if (slen == 0)
|
||||
@ -173,7 +173,7 @@ realpath1(const char *path, char *resolved)
|
||||
*/
|
||||
if (p != NULL) {
|
||||
if (symlink[slen - 1] != '/') {
|
||||
if (slen + 1 >= sizeof(symlink)) {
|
||||
if (slen + 1 >= (ssize_t)sizeof(symlink)) {
|
||||
errno = ENAMETOOLONG;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd June 22, 2017
|
||||
.Dd June 20, 2019
|
||||
.Dt MMAP 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -113,6 +113,22 @@ Pages may be written.
|
||||
Pages may be executed.
|
||||
.El
|
||||
.Pp
|
||||
In addition to these protection flags,
|
||||
.Fx
|
||||
provides the ability to set the maximum protection of a region allocated by
|
||||
.Nm
|
||||
and later altered by
|
||||
.Xr mprotect 2 .
|
||||
This is accomplished by
|
||||
.Em or Ns 'ing
|
||||
one or more
|
||||
.Dv PROT_
|
||||
values wrapped in the
|
||||
.Dv PROT_MAX()
|
||||
macro into the
|
||||
.Fa prot
|
||||
argument.
|
||||
.Pp
|
||||
The
|
||||
.Fa flags
|
||||
argument specifies the type of the mapped object, mapping options and
|
||||
@ -416,6 +432,11 @@ An invalid value was passed in the
|
||||
.Fa prot
|
||||
argument.
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Fa prot
|
||||
argument contains permissions which are not a subset of the specified
|
||||
maximum permissions.
|
||||
.It Bq Er EINVAL
|
||||
An undefined option was set in the
|
||||
.Fa flags
|
||||
argument.
|
||||
@ -521,3 +542,16 @@ was specified and insufficient memory was available.
|
||||
.Xr munmap 2 ,
|
||||
.Xr getpagesize 3 ,
|
||||
.Xr getpagesizes 3
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
system call was first documented in
|
||||
.Bx 4.2
|
||||
and implemented in
|
||||
.Bx 4.4 .
|
||||
.\" XXX: lots of missing history of FreeBSD additions.
|
||||
.Pp
|
||||
The
|
||||
.Dv PROT_MAX
|
||||
functionality was introduced in
|
||||
.Fx 13 .
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 3, 2016
|
||||
.Dd June 20, 2019
|
||||
.Dt MPROTECT 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -65,6 +65,22 @@ The pages can be written.
|
||||
.It Dv PROT_EXEC
|
||||
The pages can be executed.
|
||||
.El
|
||||
.Pp
|
||||
In addition to these protection flags,
|
||||
.Fx
|
||||
provides the ability to set the maximum protection of a region
|
||||
(which prevents
|
||||
.Nm
|
||||
from upgrading the permissions).
|
||||
This is accomplished by
|
||||
.Em or Ns 'ing
|
||||
one or more
|
||||
.Dv PROT_
|
||||
values wrapped in the
|
||||
.Dv PROT_MAX()
|
||||
macro into the
|
||||
.Fa prot
|
||||
argument.
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std mprotect
|
||||
.Sh ERRORS
|
||||
@ -78,6 +94,15 @@ The virtual address range specified by the
|
||||
and
|
||||
.Fa len
|
||||
arguments is not valid.
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Fa prot
|
||||
argument contains unhandled bits.
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Fa prot
|
||||
argument contains permissions which are not a subset of the specified
|
||||
maximum permissions.
|
||||
.It Bq Er EACCES
|
||||
The calling process was not allowed to change
|
||||
the protection to the value specified by
|
||||
@ -93,5 +118,12 @@ argument.
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn mprotect
|
||||
system call first appeared in
|
||||
system call was first documented in
|
||||
.Bx 4.2
|
||||
and first appeared in
|
||||
.Bx 4.4 .
|
||||
.Pp
|
||||
The
|
||||
.Dv PROT_MAX
|
||||
functionality was introduced in
|
||||
.Fx 13 .
|
||||
|
@ -30,7 +30,6 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/jail.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -1,10 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PACKAGE=lib${LIB}
|
||||
LIB= nandfs
|
||||
SRCS+= nandfs.c
|
||||
INCS= libnandfs.h
|
||||
|
||||
CFLAGS += -I${.CURDIR}
|
||||
|
||||
.include <bsd.lib.mk>
|
@ -1,17 +0,0 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -1,67 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2010-2012 Semihalf.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef _LIBNANDFS_NANDFS_H
|
||||
#define _LIBNANDFS_NANDFS_H
|
||||
|
||||
struct nandfs {
|
||||
struct nandfs_fsdata n_fsdata;
|
||||
struct nandfs_super_block n_sb;
|
||||
char n_ioc[MNAMELEN];
|
||||
char n_dev[MNAMELEN];
|
||||
int n_iocfd;
|
||||
int n_devfd;
|
||||
int n_flags;
|
||||
char n_errmsg[120];
|
||||
};
|
||||
|
||||
int nandfs_iserror(struct nandfs *);
|
||||
const char *nandfs_errmsg(struct nandfs *);
|
||||
|
||||
void nandfs_init(struct nandfs *, const char *);
|
||||
void nandfs_destroy(struct nandfs *);
|
||||
|
||||
const char *nandfs_dev(struct nandfs *);
|
||||
|
||||
int nandfs_open(struct nandfs *);
|
||||
void nandfs_close(struct nandfs *);
|
||||
|
||||
int nandfs_get_cpstat(struct nandfs *, struct nandfs_cpstat *);
|
||||
|
||||
ssize_t nandfs_get_cp(struct nandfs *, uint64_t,
|
||||
struct nandfs_cpinfo *, size_t);
|
||||
|
||||
ssize_t nandfs_get_snap(struct nandfs *, uint64_t,
|
||||
struct nandfs_cpinfo *, size_t);
|
||||
|
||||
int nandfs_make_snap(struct nandfs *, uint64_t *);
|
||||
int nandfs_delete_snap(struct nandfs *, uint64_t);
|
||||
|
||||
#endif /* _LIBNANDFS_NANDFS_H */
|
@ -1,249 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2010-2012 Semihalf.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <fs/nandfs/nandfs_fs.h>
|
||||
#include <libnandfs.h>
|
||||
|
||||
#define NANDFS_IS_VALID 0x1
|
||||
#define NANDFS_IS_OPENED 0x2
|
||||
#define NANDFS_IS_OPENED_DEV 0x4
|
||||
#define NANDFS_IS_ERROR 0x8
|
||||
|
||||
#define DEBUG
|
||||
#undef DEBUG
|
||||
#ifdef DEBUG
|
||||
#define NANDFS_DEBUG(fmt, args...) do { \
|
||||
printf("libnandfs:" fmt "\n", ##args); } while (0)
|
||||
#else
|
||||
#define NANDFS_DEBUG(fmt, args...)
|
||||
#endif
|
||||
|
||||
#define NANDFS_ASSERT_VALID(fs) assert((fs)->n_flags & NANDFS_IS_VALID)
|
||||
#define NANDFS_ASSERT_VALID_DEV(fs) \
|
||||
assert(((fs)->n_flags & (NANDFS_IS_VALID | NANDFS_IS_OPENED_DEV)) == \
|
||||
(NANDFS_IS_VALID | NANDFS_IS_OPENED_DEV))
|
||||
|
||||
int
|
||||
nandfs_iserror(struct nandfs *fs)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
|
||||
return (fs->n_flags & NANDFS_IS_ERROR);
|
||||
}
|
||||
|
||||
const char *
|
||||
nandfs_errmsg(struct nandfs *fs)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
|
||||
assert(nandfs_iserror(fs));
|
||||
assert(fs->n_errmsg);
|
||||
return (fs->n_errmsg);
|
||||
}
|
||||
|
||||
static void
|
||||
nandfs_seterr(struct nandfs *fs, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(fs->n_errmsg, sizeof(fs->n_errmsg), fmt, ap);
|
||||
va_end(ap);
|
||||
fs->n_flags |= NANDFS_IS_ERROR;
|
||||
}
|
||||
|
||||
const char *
|
||||
nandfs_dev(struct nandfs *fs)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
return (fs->n_dev);
|
||||
}
|
||||
|
||||
void
|
||||
nandfs_init(struct nandfs *fs, const char *dir)
|
||||
{
|
||||
|
||||
snprintf(fs->n_ioc, sizeof(fs->n_ioc), "%s/%s", dir, ".");
|
||||
fs->n_iocfd = -1;
|
||||
fs->n_flags = NANDFS_IS_VALID;
|
||||
}
|
||||
|
||||
void
|
||||
nandfs_destroy(struct nandfs *fs)
|
||||
{
|
||||
|
||||
assert(fs->n_iocfd == -1);
|
||||
fs->n_flags &=
|
||||
~(NANDFS_IS_ERROR | NANDFS_IS_VALID);
|
||||
assert(fs->n_flags == 0);
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_open(struct nandfs *fs)
|
||||
{
|
||||
struct nandfs_fsinfo fsinfo;
|
||||
|
||||
fs->n_flags |= NANDFS_IS_OPENED;
|
||||
|
||||
fs->n_iocfd = open(fs->n_ioc, O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP |
|
||||
S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (fs->n_iocfd == -1) {
|
||||
nandfs_seterr(fs, "couldn't open %s: %s", fs->n_ioc,
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (ioctl(fs->n_iocfd, NANDFS_IOCTL_GET_FSINFO, &fsinfo) == -1) {
|
||||
nandfs_seterr(fs, "couldn't fetch fsinfo: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
memcpy(&fs->n_fsdata, &fsinfo.fs_fsdata, sizeof(fs->n_fsdata));
|
||||
memcpy(&fs->n_sb, &fsinfo.fs_super, sizeof(fs->n_sb));
|
||||
snprintf(fs->n_dev, sizeof(fs->n_dev), "%s", fsinfo.fs_dev);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
nandfs_close(struct nandfs *fs)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
assert(fs->n_flags & NANDFS_IS_OPENED);
|
||||
|
||||
close(fs->n_iocfd);
|
||||
fs->n_iocfd = -1;
|
||||
fs->n_flags &= ~NANDFS_IS_OPENED;
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_get_cpstat(struct nandfs *fs, struct nandfs_cpstat *cpstat)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
|
||||
if (ioctl(fs->n_iocfd, NANDFS_IOCTL_GET_CPSTAT, cpstat) == -1) {
|
||||
nandfs_seterr(fs, "ioctl NANDFS_IOCTL_GET_CPSTAT: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
nandfs_get_cpinfo(struct nandfs *fs, uint64_t cno, int mode,
|
||||
struct nandfs_cpinfo *cpinfo, size_t nci)
|
||||
{
|
||||
struct nandfs_argv args;
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
|
||||
args.nv_base = (u_long)cpinfo;
|
||||
args.nv_nmembs = nci;
|
||||
args.nv_index = cno;
|
||||
args.nv_flags = mode;
|
||||
|
||||
if (ioctl(fs->n_iocfd, NANDFS_IOCTL_GET_CPINFO, &args) == -1) {
|
||||
nandfs_seterr(fs, "ioctl NANDFS_IOCTL_GET_CPINFO: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (args.nv_nmembs);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
nandfs_get_cp(struct nandfs *fs, uint64_t cno, struct nandfs_cpinfo *cpinfo,
|
||||
size_t nci)
|
||||
{
|
||||
|
||||
return (nandfs_get_cpinfo(fs, cno, NANDFS_CHECKPOINT, cpinfo, nci));
|
||||
}
|
||||
|
||||
ssize_t
|
||||
nandfs_get_snap(struct nandfs *fs, uint64_t cno, struct nandfs_cpinfo *cpinfo,
|
||||
size_t nci)
|
||||
{
|
||||
|
||||
return (nandfs_get_cpinfo(fs, cno, NANDFS_SNAPSHOT, cpinfo, nci));
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_make_snap(struct nandfs *fs, uint64_t *cno)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
|
||||
if (ioctl(fs->n_iocfd, NANDFS_IOCTL_MAKE_SNAP, cno) == -1) {
|
||||
nandfs_seterr(fs, "ioctl NANDFS_IOCTL_MAKE_SNAP: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_delete_snap(struct nandfs *fs, uint64_t cno)
|
||||
{
|
||||
|
||||
NANDFS_ASSERT_VALID(fs);
|
||||
|
||||
if (ioctl(fs->n_iocfd, NANDFS_IOCTL_DELETE_SNAP, &cno) == -1) {
|
||||
nandfs_seterr(fs, "ioctl NANDFS_IOCTL_DELETE_SNAP: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include <bearssl.h>
|
||||
|
||||
unsigned char * read_fd(int, size_t);
|
||||
#ifndef NEED_BRSSL_H
|
||||
unsigned char * read_file(const char *, size_t *);
|
||||
#endif
|
||||
@ -51,8 +52,12 @@ extern int DebugVe;
|
||||
#define DEBUG_PRINTF(n, x) if (DebugVe >= n) printf x
|
||||
|
||||
int ve_trust_init(void);
|
||||
size_t ve_trust_anchors_add_buf(unsigned char *, size_t);
|
||||
size_t ve_trust_anchors_revoke(unsigned char *, size_t);
|
||||
int ve_trust_add(const char *);
|
||||
void ve_debug_set(int);
|
||||
void ve_anchor_verbose_set(int);
|
||||
int ve_anchor_verbose_get(void);
|
||||
void ve_utc_set(time_t utc);
|
||||
char *ve_error_get(void);
|
||||
int ve_error_set(const char *, ...) __printflike(1,2);
|
||||
|
@ -56,6 +56,8 @@ int is_verified(struct stat *stp);
|
||||
void add_verify_status(struct stat *stp, int status);
|
||||
|
||||
int openpgp_trust_init(void);
|
||||
int openpgp_trust_add_buf(unsigned char *, size_t);
|
||||
int openpgp_trust_revoke(const char *);
|
||||
int openpgp_self_tests(void);
|
||||
|
||||
int efi_secure_boot_enabled(void);
|
||||
|
@ -33,6 +33,10 @@ VE_SIGNATURE_EXT_LIST+= \
|
||||
sig
|
||||
.endif
|
||||
|
||||
# add OpenPGP support - possibly dormant
|
||||
VE_SIGNATURE_LIST+= OPENPGP
|
||||
VE_SIGNATURE_EXT_LIST+= asc
|
||||
|
||||
SIGNER ?= ${SB_TOOLS_PATH:U/volume/buildtools/bin}/sign.py
|
||||
|
||||
.if exists(${SIGNER})
|
||||
@ -42,7 +46,12 @@ SIGN_ECDSA= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${ECDSA_PORT} -h sha256
|
||||
RSA2_PORT:= ${163%y:L:gmtime}
|
||||
SIGN_RSA2= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${RSA2_PORT} -h sha256
|
||||
|
||||
# deal with quirk of our .esig format
|
||||
XCFLAGS.vets+= -DVE_ECDSA_HASH_AGAIN
|
||||
|
||||
.if !empty(OPENPGP_SIGN_URL)
|
||||
XCFLAGS.opgp_key+= -DHAVE_TA_ASC_H
|
||||
|
||||
VE_SIGNATURE_LIST+= OPENPGP
|
||||
VE_SIGNATURE_EXT_LIST+= asc
|
||||
|
||||
|
@ -209,12 +209,53 @@ openpgp_trust_add(OpenPGP_key *key)
|
||||
|
||||
LIST_INIT(&trust_list);
|
||||
}
|
||||
if (key) {
|
||||
DEBUG_PRINTF(2, ("openpgp_trust_add(%s)\n", key->id));
|
||||
if (key && openpgp_trust_get(key->id) == NULL) {
|
||||
if (ve_anchor_verbose_get())
|
||||
printf("openpgp_trust_add(%s)\n", key->id);
|
||||
LIST_INSERT_HEAD(&trust_list, key, entries);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief add trust anchor from buf
|
||||
*/
|
||||
int
|
||||
openpgp_trust_add_buf(unsigned char *buf, size_t nbytes)
|
||||
{
|
||||
OpenPGP_key *key;
|
||||
|
||||
if ((key = load_key_buf(buf, nbytes))) {
|
||||
openpgp_trust_add(key);
|
||||
}
|
||||
return (key != NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief if keyID is in our list clobber it
|
||||
*
|
||||
* @return true if keyID removed
|
||||
*/
|
||||
int
|
||||
openpgp_trust_revoke(const char *keyID)
|
||||
{
|
||||
OpenPGP_key *key, *tkey;
|
||||
|
||||
openpgp_trust_add(NULL); /* initialize if needed */
|
||||
|
||||
LIST_FOREACH(key, &trust_list, entries) {
|
||||
if (strcmp(key->id, keyID) == 0) {
|
||||
tkey = key;
|
||||
LIST_REMOVE(tkey, entries);
|
||||
printf("openpgp_trust_revoke(%s)\n", key->id);
|
||||
memset(key, 0, sizeof(OpenPGP_key));
|
||||
free(key);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief if keyID is in our list return the key
|
||||
*
|
||||
@ -251,7 +292,9 @@ load_key_file(const char *kfile)
|
||||
return (key);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TA_ASC_H
|
||||
#include <ta_asc.h>
|
||||
#endif
|
||||
|
||||
#ifndef _STANDALONE
|
||||
/* we can lookup keyID in filesystem */
|
||||
@ -330,8 +373,8 @@ openpgp_trust_init(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return (once);
|
||||
}
|
||||
|
||||
|
@ -28,21 +28,13 @@ __FBSDID("$FreeBSD$");
|
||||
#include <libsecureboot.h>
|
||||
|
||||
unsigned char *
|
||||
read_file(const char *path, size_t *len)
|
||||
read_fd(int fd, size_t len)
|
||||
{
|
||||
int fd, m, n, x;
|
||||
struct stat st;
|
||||
int m, n, x;
|
||||
unsigned char *buf;
|
||||
|
||||
if (len)
|
||||
*len = 0;
|
||||
if ((fd = open(path, O_RDONLY)) < 0)
|
||||
return (NULL);
|
||||
fstat(fd, &st);
|
||||
if (len)
|
||||
*len = st.st_size;
|
||||
buf = malloc(st.st_size + 1);
|
||||
for (x = 0, m = st.st_size; m > 0; ) {
|
||||
buf = malloc(len + 1);
|
||||
for (x = 0, m = len; m > 0; ) {
|
||||
n = read(fd, &buf[x], m);
|
||||
if (n < 0)
|
||||
break;
|
||||
@ -51,11 +43,30 @@ read_file(const char *path, size_t *len)
|
||||
x += n;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
if (m == 0) {
|
||||
buf[st.st_size] = '\0';
|
||||
buf[len] = '\0';
|
||||
return (buf);
|
||||
}
|
||||
free(buf);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
read_file(const char *path, size_t *len)
|
||||
{
|
||||
struct stat st;
|
||||
unsigned char *ucp;
|
||||
int fd;
|
||||
|
||||
if (len)
|
||||
*len = 0;
|
||||
if ((fd = open(path, O_RDONLY)) < 0)
|
||||
return (NULL);
|
||||
fstat(fd, &st);
|
||||
ucp = read_fd(fd, st.st_size);
|
||||
close(fd);
|
||||
if (len != NULL && ucp != NULL)
|
||||
*len = st.st_size;
|
||||
return (ucp);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,9 @@ severity_guess(const char *filename)
|
||||
}
|
||||
|
||||
static void
|
||||
verify_tweak(char *tweak, int *accept_no_fp, int *verbose, int *verifying)
|
||||
verify_tweak(int fd, off_t off, struct stat *stp,
|
||||
char *tweak, int *accept_no_fp,
|
||||
int *verbose, int *verifying)
|
||||
{
|
||||
if (strcmp(tweak, "off") == 0) {
|
||||
*verifying = 0;
|
||||
@ -268,6 +270,25 @@ verify_tweak(char *tweak, int *accept_no_fp, int *verbose, int *verifying)
|
||||
*verbose = 1;
|
||||
} else if (strcmp(tweak, "quiet") == 0) {
|
||||
*verbose = 0;
|
||||
} else if (strncmp(tweak, "trust", 5) == 0) {
|
||||
/* content is trust anchor to add or revoke */
|
||||
unsigned char *ucp;
|
||||
size_t num;
|
||||
|
||||
if (off > 0)
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
ucp = read_fd(fd, stp->st_size);
|
||||
if (ucp == NULL)
|
||||
return;
|
||||
if (strstr(tweak, "revoke")) {
|
||||
num = ve_trust_anchors_revoke(ucp, stp->st_size);
|
||||
DEBUG_PRINTF(3, ("revoked %d trust anchors\n",
|
||||
(int) num));
|
||||
} else {
|
||||
num = ve_trust_anchors_add_buf(ucp, stp->st_size);
|
||||
DEBUG_PRINTF(3, ("added %d trust anchors\n",
|
||||
(int) num));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,8 +338,10 @@ verify_file(int fd, const char *filename, off_t off, int severity)
|
||||
rc = verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING;
|
||||
ve_status_set(0, rc);
|
||||
ve_status_state = VE_STATUS_NONE;
|
||||
if (verifying)
|
||||
if (verifying) {
|
||||
ve_self_tests();
|
||||
ve_anchor_verbose_set(1);
|
||||
}
|
||||
}
|
||||
if (!verifying)
|
||||
return (0);
|
||||
@ -367,7 +390,7 @@ verify_file(int fd, const char *filename, off_t off, int severity)
|
||||
cp++;
|
||||
if (strncmp(cp, "loader.ve.", 10) == 0) {
|
||||
cp += 10;
|
||||
verify_tweak(cp,
|
||||
verify_tweak(fd, off, &st, cp,
|
||||
&accept_no_fp, &verbose,
|
||||
&verifying);
|
||||
}
|
||||
|
@ -55,6 +55,20 @@ static anchor_list trust_anchors = VEC_INIT;
|
||||
static anchor_list forbidden_anchors = VEC_INIT;
|
||||
static digest_list forbidden_digests = VEC_INIT;
|
||||
|
||||
static int anchor_verbose = 0;
|
||||
|
||||
void
|
||||
ve_anchor_verbose_set(int n)
|
||||
{
|
||||
anchor_verbose = n;
|
||||
}
|
||||
|
||||
int
|
||||
ve_anchor_verbose_get(void)
|
||||
{
|
||||
return (anchor_verbose);
|
||||
}
|
||||
|
||||
void
|
||||
ve_debug_set(int n)
|
||||
{
|
||||
@ -116,6 +130,47 @@ free_cert_contents(br_x509_certificate *xc)
|
||||
xfree(xc->data);
|
||||
}
|
||||
|
||||
/*
|
||||
* a bit of a dance to get commonName from a certificate
|
||||
*/
|
||||
static char *
|
||||
x509_cn_get(br_x509_certificate *xc, char *buf, size_t len)
|
||||
{
|
||||
br_x509_minimal_context mc;
|
||||
br_name_element cn;
|
||||
unsigned char cn_oid[4];
|
||||
int err;
|
||||
|
||||
if (buf == NULL)
|
||||
return (buf);
|
||||
/*
|
||||
* We want the commonName field
|
||||
* the OID we want is 2,5,4,3 - but DER encoded
|
||||
*/
|
||||
cn_oid[0] = 3;
|
||||
cn_oid[1] = 0x55;
|
||||
cn_oid[2] = 4;
|
||||
cn_oid[3] = 3;
|
||||
cn.oid = cn_oid;
|
||||
cn.buf = buf;
|
||||
cn.len = len;
|
||||
cn.buf[0] = '\0';
|
||||
|
||||
br_x509_minimal_init(&mc, &br_sha256_vtable, NULL, 0);
|
||||
br_x509_minimal_set_name_elements(&mc, &cn, 1);
|
||||
/* the below actually does the work - updates cn.status */
|
||||
mc.vtable->start_chain(&mc.vtable, NULL);
|
||||
mc.vtable->start_cert(&mc.vtable, xc->data_len);
|
||||
mc.vtable->append(&mc.vtable, xc->data, xc->data_len);
|
||||
mc.vtable->end_cert(&mc.vtable);
|
||||
/* we don' actually care about cert status - just its name */
|
||||
err = mc.vtable->end_chain(&mc.vtable);
|
||||
|
||||
if (!cn.status)
|
||||
buf = NULL;
|
||||
return (buf);
|
||||
}
|
||||
|
||||
/* ASN parsing related defines */
|
||||
#define ASN1_PRIMITIVE_TAG 0x1F
|
||||
#define ASN1_INF_LENGTH 0x80
|
||||
@ -184,7 +239,8 @@ ve_forbidden_digest_add(hash_data *digest, size_t num)
|
||||
}
|
||||
|
||||
static size_t
|
||||
ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors)
|
||||
ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors,
|
||||
char *anchors_name)
|
||||
{
|
||||
br_x509_trust_anchor ta;
|
||||
size_t u;
|
||||
@ -194,6 +250,15 @@ ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors)
|
||||
break;
|
||||
}
|
||||
VEC_ADD(*anchors, ta);
|
||||
if (anchor_verbose && anchors_name) {
|
||||
char buf[64];
|
||||
char *cp;
|
||||
|
||||
cp = x509_cn_get(&xcs[u], buf, sizeof(buf));
|
||||
if (cp) {
|
||||
printf("x509_anchor(%s) %s\n", cp, anchors_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (u);
|
||||
}
|
||||
@ -205,13 +270,68 @@ ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors)
|
||||
size_t
|
||||
ve_trust_anchors_add(br_x509_certificate *xcs, size_t num)
|
||||
{
|
||||
return (ve_anchors_add(xcs, num, &trust_anchors));
|
||||
return (ve_anchors_add(xcs, num, &trust_anchors, "trusted"));
|
||||
}
|
||||
|
||||
size_t
|
||||
ve_forbidden_anchors_add(br_x509_certificate *xcs, size_t num)
|
||||
{
|
||||
return (ve_anchors_add(xcs, num, &forbidden_anchors));
|
||||
return (ve_anchors_add(xcs, num, &forbidden_anchors, "forbidden"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief add trust anchors in buf
|
||||
*
|
||||
* Assume buf contains x509 certificates, but if not and
|
||||
* we support OpenPGP try adding as that.
|
||||
*
|
||||
* @return number of anchors added
|
||||
*/
|
||||
size_t
|
||||
ve_trust_anchors_add_buf(unsigned char *buf, size_t len)
|
||||
{
|
||||
br_x509_certificate *xcs;
|
||||
size_t num;
|
||||
|
||||
num = 0;
|
||||
xcs = parse_certificates(buf, len, &num);
|
||||
if (xcs != NULL) {
|
||||
num = ve_trust_anchors_add(xcs, num);
|
||||
#ifdef VE_OPENPGP_SUPPORT
|
||||
} else {
|
||||
num = openpgp_trust_add_buf(buf, len);
|
||||
#endif
|
||||
}
|
||||
return (num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief revoke trust anchors in buf
|
||||
*
|
||||
* Assume buf contains x509 certificates, but if not and
|
||||
* we support OpenPGP try revoking keyId
|
||||
*
|
||||
* @return number of anchors revoked
|
||||
*/
|
||||
size_t
|
||||
ve_trust_anchors_revoke(unsigned char *buf, size_t len)
|
||||
{
|
||||
br_x509_certificate *xcs;
|
||||
size_t num;
|
||||
|
||||
num = 0;
|
||||
xcs = parse_certificates(buf, len, &num);
|
||||
if (xcs != NULL) {
|
||||
num = ve_forbidden_anchors_add(xcs, num);
|
||||
#ifdef VE_OPENPGP_SUPPORT
|
||||
} else {
|
||||
if (buf[len - 1] == '\n')
|
||||
buf[len - 1] = '\0';
|
||||
num = openpgp_trust_revoke((char *)buf);
|
||||
#endif
|
||||
}
|
||||
return (num);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,11 +341,7 @@ ve_forbidden_anchors_add(br_x509_certificate *xcs, size_t num)
|
||||
int
|
||||
ve_trust_init(void)
|
||||
{
|
||||
#ifdef TRUST_ANCHOR_STR
|
||||
br_x509_certificate *xcs;
|
||||
#endif
|
||||
static int once = -1;
|
||||
size_t num;
|
||||
|
||||
if (once >= 0)
|
||||
return (once);
|
||||
@ -240,10 +356,8 @@ ve_trust_init(void)
|
||||
#endif
|
||||
|
||||
#ifdef TRUST_ANCHOR_STR
|
||||
xcs = parse_certificates(__DECONST(unsigned char *, TRUST_ANCHOR_STR),
|
||||
sizeof(TRUST_ANCHOR_STR), &num);
|
||||
if (xcs != NULL)
|
||||
num = ve_trust_anchors_add(xcs, num);
|
||||
ve_trust_anchors_add_buf(__DECONST(unsigned char *, TRUST_ANCHOR_STR),
|
||||
sizeof(TRUST_ANCHOR_STR));
|
||||
#endif
|
||||
once = (int) VEC_LEN(trust_anchors);
|
||||
#ifdef VE_OPENPGP_SUPPORT
|
||||
@ -552,6 +666,7 @@ verify_ec(br_x509_pkey *pk, const char *file, const char *sigfile)
|
||||
br_sha256_init(&ctx);
|
||||
br_sha256_update(&ctx, fcp, flen);
|
||||
br_sha256_out(&ctx, rhbuf);
|
||||
#ifdef VE_ECDSA_HASH_AGAIN
|
||||
hex = hexdigest(hexbuf, sizeof(hexbuf), rhbuf, br_sha256_SIZE);
|
||||
/* now hash that */
|
||||
if (hex) {
|
||||
@ -559,6 +674,7 @@ verify_ec(br_x509_pkey *pk, const char *file, const char *sigfile)
|
||||
br_sha256_update(&ctx, hex, strlen(hex));
|
||||
br_sha256_out(&ctx, rhbuf);
|
||||
}
|
||||
#endif
|
||||
ec = br_ec_get_default();
|
||||
vrfy = br_ecdsa_vrfy_asn1_get_default();
|
||||
if (!vrfy(ec, rhbuf, br_sha256_SIZE, &pk->key.ec, po->data,
|
||||
|
@ -272,6 +272,7 @@ static pthread_func_t jmp_table[][2] = {
|
||||
{DUAL_ENTRY(_pthread_mutex_consistent)},/* PJT_MUTEX_CONSISTENT */
|
||||
{DUAL_ENTRY(_pthread_mutexattr_getrobust)},/* PJT_MUTEXATTR_GETROBUST */
|
||||
{DUAL_ENTRY(_pthread_mutexattr_setrobust)},/* PJT_MUTEXATTR_SETROBUST */
|
||||
{DUAL_ENTRY(_pthread_getthreadid_np)}, /* PJT_GETTHREADID_NP */
|
||||
};
|
||||
|
||||
static int init_once = 0;
|
||||
|
@ -89,6 +89,8 @@ struct libusb_hotplug_callback_handle_struct {
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(libusb_device_head, libusb_device);
|
||||
|
||||
struct libusb_context {
|
||||
int debug;
|
||||
int debug_fixed;
|
||||
@ -106,7 +108,7 @@ struct libusb_context {
|
||||
TAILQ_HEAD(, libusb_super_pollfd) pollfds;
|
||||
TAILQ_HEAD(, libusb_super_transfer) tr_done;
|
||||
TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh;
|
||||
TAILQ_HEAD(, libusb_device) hotplug_devs;
|
||||
struct libusb_device_head hotplug_devs;
|
||||
|
||||
struct libusb_super_pollfd ctx_poll;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 2016 Hans Petter Selasky. All rights reserved.
|
||||
* Copyright (c) 2016-2019 Hans Petter Selasky. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -85,20 +85,35 @@ libusb_hotplug_filter(libusb_context *ctx, libusb_hotplug_callback_handle pcbh,
|
||||
return (pcbh->fn(ctx, dev, event, pcbh->user_data));
|
||||
}
|
||||
|
||||
static int
|
||||
libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead)
|
||||
{
|
||||
libusb_device **ppdev;
|
||||
ssize_t count;
|
||||
ssize_t x;
|
||||
|
||||
count = libusb_get_device_list(ctx, &ppdev);
|
||||
if (count < 0)
|
||||
return (-1);
|
||||
|
||||
for (x = 0; x != count; x++)
|
||||
TAILQ_INSERT_TAIL(phead, ppdev[x], hotplug_entry);
|
||||
|
||||
libusb_free_device_list(ppdev, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void *
|
||||
libusb_hotplug_scan(void *arg)
|
||||
{
|
||||
TAILQ_HEAD(, libusb_device) hotplug_devs;
|
||||
struct libusb_device_head hotplug_devs;
|
||||
libusb_hotplug_callback_handle acbh;
|
||||
libusb_hotplug_callback_handle bcbh;
|
||||
libusb_context *ctx = arg;
|
||||
libusb_device **ppdev;
|
||||
libusb_device *temp;
|
||||
libusb_device *adev;
|
||||
libusb_device *bdev;
|
||||
unsigned do_loop = 1;
|
||||
ssize_t count;
|
||||
ssize_t x;
|
||||
|
||||
while (do_loop) {
|
||||
usleep(4000000);
|
||||
@ -108,14 +123,8 @@ libusb_hotplug_scan(void *arg)
|
||||
TAILQ_INIT(&hotplug_devs);
|
||||
|
||||
if (ctx->hotplug_handler != NO_THREAD) {
|
||||
count = libusb_get_device_list(ctx, &ppdev);
|
||||
if (count < 0)
|
||||
if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
|
||||
continue;
|
||||
for (x = 0; x != count; x++) {
|
||||
TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x],
|
||||
hotplug_entry);
|
||||
}
|
||||
libusb_free_device_list(ppdev, 0);
|
||||
} else {
|
||||
do_loop = 0;
|
||||
}
|
||||
@ -191,6 +200,8 @@ int libusb_hotplug_register_callback(libusb_context *ctx,
|
||||
|
||||
HOTPLUG_LOCK(ctx);
|
||||
if (ctx->hotplug_handler == NO_THREAD) {
|
||||
libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
|
||||
|
||||
if (pthread_create(&ctx->hotplug_handler, NULL,
|
||||
&libusb_hotplug_scan, ctx) != 0)
|
||||
ctx->hotplug_handler = NO_THREAD;
|
||||
|
@ -37,11 +37,15 @@ motd_start()
|
||||
uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
|
||||
awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
|
||||
|
||||
cmp -s $T /etc/motd || {
|
||||
cp $T /etc/motd
|
||||
if ! cmp -s $T /etc/motd; then
|
||||
mv -f $T /etc/.motd.tmp
|
||||
fsync /etc/.motd.tmp
|
||||
mv -f /etc/.motd.tmp /etc/motd
|
||||
chmod ${PERMS} /etc/motd
|
||||
}
|
||||
rm -f $T
|
||||
fsync /etc
|
||||
else
|
||||
rm -f $T
|
||||
fi
|
||||
|
||||
check_startmsgs && echo '.'
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "rtld_printf.h"
|
||||
|
||||
void debug_printf(const char *, ...) __printflike(1, 2);
|
||||
extern int debug;
|
||||
@ -57,7 +57,7 @@ extern int debug;
|
||||
#define assert(cond) ((cond) ? (void) 0 : \
|
||||
(msg(_MYNAME ": assert failed: " __FILE__ ":" \
|
||||
__XSTRING(__LINE__) "\n"), abort()))
|
||||
#define msg(s) write(STDOUT_FILENO, s, strlen(s))
|
||||
#define msg(s) rtld_putstr(s)
|
||||
#define trace() msg(_MYNAME ": " __XSTRING(__LINE__) "\n")
|
||||
|
||||
|
||||
|
@ -57,6 +57,8 @@
|
||||
#define JMPTAB_BASE(N) (18 + N*2 + ((N > PLT_EXTENDED_BEGIN) ? \
|
||||
(N - PLT_EXTENDED_BEGIN)*2 : 0))
|
||||
|
||||
void _rtld_bind_secureplt_start(void);
|
||||
|
||||
/*
|
||||
* Process the R_PPC_COPY relocations
|
||||
*/
|
||||
@ -361,6 +363,11 @@ reloc_plt_object(Obj_Entry *obj, const Elf_Rela *rela)
|
||||
if (reloff < 0)
|
||||
return (-1);
|
||||
|
||||
if (obj->gotptr != NULL) {
|
||||
*where += (Elf_Addr)obj->relocbase;
|
||||
return (0);
|
||||
}
|
||||
|
||||
pltlongresolve = obj->pltgot + 5;
|
||||
pltresolve = pltlongresolve + 5;
|
||||
|
||||
@ -425,7 +432,7 @@ reloc_plt(Obj_Entry *obj, int flags __unused, RtldLockState *lockstate __unused)
|
||||
* Sync the icache for the byte range represented by the
|
||||
* trampoline routines and call slots.
|
||||
*/
|
||||
if (obj->pltgot != NULL)
|
||||
if (obj->pltgot != NULL && obj->gotptr == NULL)
|
||||
__syncicache(obj->pltgot, JMPTAB_BASE(N)*4);
|
||||
|
||||
return (0);
|
||||
@ -501,6 +508,14 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target,
|
||||
*/
|
||||
offset = target - (Elf_Addr)wherep;
|
||||
|
||||
if (obj->gotptr != NULL) {
|
||||
assert(wherep >= (Elf_Word *)obj->pltgot);
|
||||
assert(wherep <
|
||||
(Elf_Word *)obj->pltgot + obj->pltrelasize);
|
||||
*wherep = target;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (abs((int)offset) < 32*1024*1024) { /* inside 32MB? */
|
||||
/* b value # branch directly */
|
||||
*wherep = 0x48000000 | (offset & 0x03fffffc);
|
||||
@ -579,6 +594,16 @@ init_pltgot(Obj_Entry *obj)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle Secure-PLT first, if applicable. */
|
||||
if (obj->gotptr != NULL) {
|
||||
obj->gotptr[1] = (Elf_Addr)_rtld_bind_secureplt_start;
|
||||
obj->gotptr[2] = (Elf_Addr)obj;
|
||||
dbg("obj %s secure-plt gotptr=%p start=%p obj=%p",
|
||||
obj->path, obj->gotptr,
|
||||
(void *)obj->gotptr[1], (void *)obj->gotptr[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* From the SVR4 PPC ABI:
|
||||
*
|
||||
|
@ -52,35 +52,22 @@ _ENTRY(.rtld_start)
|
||||
* - use link-time constants to determine offset to the
|
||||
* _DYNAMIC section and the GOT. Add these to the PC to
|
||||
* convert to absolute addresses.
|
||||
* - sync icache to allow execution of the SVR4 ABI-specified
|
||||
* blrl instruction preceding the GOT
|
||||
* - Use this instruction to determine the GOT absolute address
|
||||
* - read GOT[0], which is the SVR4 ABI-specified link-time
|
||||
* value of _DYNAMIC. Subtract this value from the absolute
|
||||
* value to determine the load address
|
||||
* - call reloc_non_plt_self() to fix up ld-elf.so's relocations
|
||||
*/
|
||||
bl 1f
|
||||
.long _DYNAMIC-.
|
||||
.long _GLOBAL_OFFSET_TABLE_-. /* branch lr + 4 */
|
||||
1:
|
||||
mflr %r3 /* PC value at .long */
|
||||
lwz %r4,4(%r3)
|
||||
add %r4,%r4,%r3 /* &_GLOBAL_OFFSET_TABLE-4, blrl insn. */
|
||||
dcbst %r0,%r4 /* sync i-cache with d-cache */
|
||||
sync
|
||||
icbi %r0,%r4
|
||||
isync
|
||||
|
||||
lwz %r4,0(%r3) /* offset to _DYNAMIC */
|
||||
add %r3,%r4,%r3 /* r3 = &_DYNAMIC, absolute value */
|
||||
|
||||
bl _GLOBAL_OFFSET_TABLE_@local-4
|
||||
mflr %r4 /* &_GLOBAL_OFFSET_TABLE_, absolute value */
|
||||
lwz %r4,0(%r4) /* linker &_DYNAMIC, from got[0] */
|
||||
subf %r4,%r4,%r3 /* subtract to calculate relocbase */
|
||||
|
||||
bl reloc_non_plt_self@plt /* reloc_non_plt_self(&_DYNAMIC,base) */
|
||||
bcl 20,31,1f
|
||||
1: mflr %r30
|
||||
mr %r3,%r30 # save for _DYNAMIC
|
||||
addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha
|
||||
addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l
|
||||
addis %r3,%r3,_DYNAMIC-1b@ha # get _DYNAMIC actual address
|
||||
addi %r3,%r3,_DYNAMIC-1b@l
|
||||
lwz %r28,0(%r30) # get base-relative &_DYNAMIC
|
||||
sub %r28,%r3,%r28 # r28 = relocbase
|
||||
mr %r4,%r28 # r4 = relocbase
|
||||
bl reloc_non_plt_self /* reloc_non_plt_self(&_DYNAMIC,base) */
|
||||
|
||||
/*
|
||||
* The _rtld() function likes to see a stack layout containing
|
||||
@ -95,7 +82,7 @@ _ENTRY(.rtld_start)
|
||||
addi %r4,%r1,8 /* &exit_proc on stack */
|
||||
addi %r5,%r1,12 /* &obj_main on stack */
|
||||
|
||||
bl _rtld@plt /* &_start = _rtld(sp, &exit_proc, &obj_main)*/
|
||||
bl _rtld /* &_start = _rtld(sp, &exit_proc, &obj_main)*/
|
||||
mtlr %r3
|
||||
|
||||
/*
|
||||
@ -114,6 +101,29 @@ _ENTRY(.rtld_start)
|
||||
li %r0,1 /* _exit() */
|
||||
sc
|
||||
|
||||
/*
|
||||
* _rtld_bind_secureplt_start()
|
||||
*
|
||||
* Call into the MI binder (Secure-PLT stub).
|
||||
* secure-plt expects %r11 to be the offset to the rela entry.
|
||||
* bss-plt expects %r11 to be index of the rela entry.
|
||||
* So for bss-plt, we multiply the index by 12 to get the offset.
|
||||
*/
|
||||
_ENTRY(_rtld_bind_secureplt_start)
|
||||
stwu %r1,-160(%r1) # stack space for 29 regs + r0/lr/cr
|
||||
stw %r0,20(%r1) # save r0
|
||||
|
||||
/*
|
||||
* Instead of division which is costly we will use multiplicative
|
||||
* inverse. a / n = ((a * inv(n)) >> 32)
|
||||
* where inv(n) = (0x100000000 + n - 1) / n
|
||||
*/
|
||||
mr %r0,%r11
|
||||
lis %r11,0x15555556@h # load multiplicative inverse of 12
|
||||
ori %r11,%r11,0x15555556@l
|
||||
mulhwu %r11,%r11,%r0 # get high half of multiplication
|
||||
b 1f
|
||||
|
||||
/*
|
||||
* _rtld_bind_start()
|
||||
*
|
||||
@ -129,6 +139,7 @@ _ENTRY(.rtld_start)
|
||||
_ENTRY(_rtld_bind_start)
|
||||
stwu %r1,-160(%r1) # stack space for 29 regs + r0/lr/cr
|
||||
stw %r0,20(%r1) # save r0
|
||||
1:
|
||||
mflr %r0
|
||||
stw %r0,16(%r1) # save lr
|
||||
mfcr %r0
|
||||
@ -137,7 +148,7 @@ _ENTRY(_rtld_bind_start)
|
||||
|
||||
mr %r3,%r12 # obj
|
||||
mulli %r4,%r11,12 # rela index * sizeof(Elf_Rela)
|
||||
bl _rtld_bind@PLT # target addr = _rtld_bind(obj, reloff)
|
||||
bl _rtld_bind # target addr = _rtld_bind(obj, reloff)
|
||||
mtctr %r3 # move absolute target addr into ctr
|
||||
|
||||
lmw %r3,24(%r1) # restore r3-r31
|
||||
|
@ -1286,10 +1286,16 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc__
|
||||
#ifdef __powerpc64__
|
||||
case DT_PPC64_GLINK:
|
||||
obj->glink = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr);
|
||||
break;
|
||||
#else
|
||||
case DT_PPC_GOT:
|
||||
obj->gotptr = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case DT_FLAGS_1:
|
||||
|
@ -190,8 +190,12 @@ typedef struct Struct_Obj_Entry {
|
||||
Elf_Word gotsym; /* First dynamic symbol in GOT */
|
||||
Elf_Addr *mips_pltgot; /* Second PLT GOT */
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
#ifdef __powerpc64__
|
||||
Elf_Addr glink; /* GLINK PLT call stub section */
|
||||
#else
|
||||
Elf_Addr *gotptr; /* GOT pointer (secure-plt only) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const Elf_Verneed *verneed; /* Required versions. */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define RTLD_PRINTF_H 1
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...)
|
||||
|
@ -19,6 +19,7 @@ FTPDIR?= ${RELEASEDIR}/ftp-stage
|
||||
.if exists(${RELEASEDIR})
|
||||
STAGE_TARGETS?= iso-images-stage
|
||||
.endif
|
||||
SRCBRANCH!= ${SVN_CMD} info --show-item relative-url ${WORLDDIR}
|
||||
|
||||
.if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD))
|
||||
. if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != ""
|
||||
@ -185,6 +186,9 @@ iso-images-stage:
|
||||
.if exists(${RELEASEDIR}/ftp)
|
||||
mkdir -p ${FTP_DIR}
|
||||
cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR}
|
||||
echo ${BUILDDATE} > ${FTP_DIR}/BUILDDATE
|
||||
echo ${SRCBRANCH} > ${FTP_DIR}/SRCBRANCH
|
||||
echo r${SVNREVISION} > ${FTP_DIR}/REVISION
|
||||
cd ${TLD}/${TARGET} && \
|
||||
ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \
|
||||
${REVISION}-${BRANCH}
|
||||
|
@ -50,7 +50,6 @@ device if_bridge
|
||||
# qemu, so we set HZ explicitly.
|
||||
options HZ=1000
|
||||
|
||||
device random # used by ssh
|
||||
device pci
|
||||
|
||||
# Floppy drives
|
||||
|
@ -437,7 +437,7 @@ populate_floppy_fs() { # OK
|
||||
${MY_TREE}/floppy.tree.${SITE} ; do
|
||||
if [ -d ${FLOPPY_TREE} ] ; then
|
||||
(cd ${FLOPPY_TREE} ; tar -cf - \
|
||||
--exclude .svn ${excl} . ) | \
|
||||
--exclude .git --exclude .svn ${excl} . ) | \
|
||||
(cd ${dst} ; tar x${o_tarv}f - )
|
||||
log "Copied from ${FLOPPY_TREE}"
|
||||
fi
|
||||
@ -698,7 +698,7 @@ populate_mfs_tree() {
|
||||
for MFS_TREE in ${PICO_TREE}/mfs_tree ${MY_TREE}/mfs_tree ; do
|
||||
if [ -d ${MFS_TREE} ] ; then
|
||||
log "Copy ${MFS_TREE} ..."
|
||||
(cd ${MFS_TREE} ; tar -cf - --exclude .svn . ) | \
|
||||
(cd ${MFS_TREE} ; tar -cf - --exclude .git --exclude .svn . ) | \
|
||||
(cd ${dst} ; tar x${o_tarv}f - )
|
||||
fi
|
||||
done
|
||||
|
@ -56,7 +56,6 @@ device if_bridge
|
||||
# qemu, so we set HZ explicitly.
|
||||
options HZ=1000
|
||||
|
||||
device random # used by ssh
|
||||
device pci
|
||||
|
||||
# Floppy drives
|
||||
|
@ -79,8 +79,6 @@ SUBDIR.${MK_IPFILTER}+= ipf
|
||||
SUBDIR.${MK_IPFW}+= ipfw
|
||||
SUBDIR.${MK_IPFW}+= natd
|
||||
SUBDIR.${MK_ISCSI}+= iscontrol
|
||||
SUBDIR.${MK_NAND}+= nandfs
|
||||
SUBDIR.${MK_NAND}+= newfs_nandfs
|
||||
SUBDIR.${MK_NVME}+= nvmecontrol
|
||||
SUBDIR.${MK_OPENSSL}+= decryptcore
|
||||
SUBDIR.${MK_PF}+= pfctl
|
||||
|
@ -184,7 +184,8 @@ bectl_cmd_activate(int argc, char *argv[])
|
||||
static int
|
||||
bectl_cmd_create(int argc, char *argv[])
|
||||
{
|
||||
char *atpos, *bootenv, *snapname, *source;
|
||||
char snapshot[BE_MAXPATHLEN];
|
||||
char *atpos, *bootenv, *snapname;
|
||||
int err, opt;
|
||||
bool recursive;
|
||||
|
||||
@ -214,6 +215,8 @@ bectl_cmd_create(int argc, char *argv[])
|
||||
}
|
||||
|
||||
bootenv = *argv;
|
||||
|
||||
err = BE_ERR_SUCCESS;
|
||||
if ((atpos = strchr(bootenv, '@')) != NULL) {
|
||||
/*
|
||||
* This is the "create a snapshot variant". No new boot
|
||||
@ -221,24 +224,22 @@ bectl_cmd_create(int argc, char *argv[])
|
||||
*/
|
||||
*atpos++ = '\0';
|
||||
err = be_snapshot(be, bootenv, atpos, recursive, NULL);
|
||||
} else if (snapname != NULL) {
|
||||
if (strchr(snapname, '@') != NULL)
|
||||
err = be_create_from_existing_snap(be, bootenv,
|
||||
snapname);
|
||||
else
|
||||
err = be_create_from_existing(be, bootenv, snapname);
|
||||
} else {
|
||||
if ((snapname = strchr(bootenv, '@')) != NULL) {
|
||||
*(snapname++) = '\0';
|
||||
if ((err = be_snapshot(be, be_active_path(be),
|
||||
snapname, true, NULL)) != BE_ERR_SUCCESS)
|
||||
fprintf(stderr, "failed to create snapshot\n");
|
||||
asprintf(&source, "%s@%s", be_active_path(be), snapname);
|
||||
err = be_create_from_existing_snap(be, bootenv,
|
||||
source);
|
||||
return (err);
|
||||
} else
|
||||
err = be_create(be, bootenv);
|
||||
if (snapname == NULL)
|
||||
/* Create from currently booted BE */
|
||||
err = be_snapshot(be, be_active_path(be), NULL,
|
||||
recursive, snapshot);
|
||||
else if (strchr(snapname, '@') != NULL)
|
||||
/* Create from given snapshot */
|
||||
strlcpy(snapshot, snapname, sizeof(snapshot));
|
||||
else
|
||||
/* Create from given BE */
|
||||
err = be_snapshot(be, snapname, NULL, recursive,
|
||||
snapshot);
|
||||
|
||||
if (err == BE_ERR_SUCCESS)
|
||||
err = be_create_depth(be, bootenv, snapshot,
|
||||
recursive == true ? -1 : 0);
|
||||
}
|
||||
|
||||
switch (err) {
|
||||
|
@ -99,11 +99,35 @@ bectl_create_body()
|
||||
mount=${cwd}/mnt
|
||||
|
||||
bectl_create_setup ${zpool} ${disk} ${mount}
|
||||
|
||||
# Create a child dataset that will be used to test creation
|
||||
# of recursive and non-recursive boot environments.
|
||||
atf_check zfs create -o mountpoint=/usr -o canmount=noauto \
|
||||
${zpool}/ROOT/default/usr
|
||||
|
||||
# Test standard creation, creation of a snapshot, and creation from a
|
||||
# snapshot.
|
||||
atf_check bectl -r ${zpool}/ROOT create -e default default2
|
||||
atf_check bectl -r ${zpool}/ROOT create default2@test_snap
|
||||
atf_check bectl -r ${zpool}/ROOT create -e default2@test_snap default3
|
||||
|
||||
# Test standard creation, creation of a snapshot, and creation from a
|
||||
# snapshot for recursive boot environments.
|
||||
atf_check bectl -r ${zpool}/ROOT create -r -e default recursive
|
||||
atf_check bectl -r ${zpool}/ROOT create -r recursive@test_snap
|
||||
atf_check bectl -r ${zpool}/ROOT create -r -e recursive@test_snap recursive-snap
|
||||
|
||||
# Test that non-recursive boot environments have no child datasets.
|
||||
atf_check -e not-empty -s not-exit:0 \
|
||||
zfs list "${zpool}/ROOT/default2/usr"
|
||||
atf_check -e not-empty -s not-exit:0 \
|
||||
zfs list "${zpool}/ROOT/default3/usr"
|
||||
|
||||
# Test that recursive boot environments have child datasets.
|
||||
atf_check -o not-empty \
|
||||
zfs list "${zpool}/ROOT/recursive/usr"
|
||||
atf_check -o not-empty \
|
||||
zfs list "${zpool}/ROOT/recursive-snap/usr"
|
||||
}
|
||||
bectl_create_cleanup()
|
||||
{
|
||||
|
@ -2326,9 +2326,11 @@ ata_do_identify(struct cam_device *device, int retry_count, int timeout,
|
||||
}
|
||||
}
|
||||
|
||||
ident_buf = (struct ata_params *)ptr;
|
||||
ata_param_fixup(ident_buf);
|
||||
|
||||
error = 1;
|
||||
for (i = 0; i < sizeof(struct ata_params) / 2; i++) {
|
||||
ptr[i] = le16toh(ptr[i]);
|
||||
if (ptr[i] != 0)
|
||||
error = 0;
|
||||
}
|
||||
@ -2346,26 +2348,6 @@ ata_do_identify(struct cam_device *device, int retry_count, int timeout,
|
||||
return (error);
|
||||
}
|
||||
|
||||
ident_buf = (struct ata_params *)ptr;
|
||||
if (strncmp(ident_buf->model, "FX", 2) &&
|
||||
strncmp(ident_buf->model, "NEC", 3) &&
|
||||
strncmp(ident_buf->model, "Pioneer", 7) &&
|
||||
strncmp(ident_buf->model, "SHARP", 5)) {
|
||||
ata_bswap(ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
|
||||
ata_bswap(ident_buf->media_serial, sizeof(ident_buf->media_serial));
|
||||
}
|
||||
ata_btrim(ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
|
||||
ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
|
||||
ata_btrim(ident_buf->media_serial, sizeof(ident_buf->media_serial));
|
||||
ata_bpack(ident_buf->media_serial, ident_buf->media_serial,
|
||||
sizeof(ident_buf->media_serial));
|
||||
|
||||
*ident_bufp = ident_buf;
|
||||
|
||||
return (0);
|
||||
|
@ -896,6 +896,5 @@ do_packet(struct interface_info *interface, struct dhcp_packet *packet,
|
||||
|
||||
/* Free the data associated with the options. */
|
||||
for (i = 0; i < 256; i++)
|
||||
if (tp.options[i].len && tp.options[i].data)
|
||||
free(tp.options[i].data);
|
||||
free(tp.options[i].data);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from,
|
||||
ip_packets_seen++;
|
||||
if (wrapsum(checksum(buf + bufix, ip_len, 0)) != 0) {
|
||||
ip_packets_bad_checksum++;
|
||||
if (ip_packets_seen > 4 &&
|
||||
if (ip_packets_seen > 4 && ip_packets_bad_checksum != 0 &&
|
||||
(ip_packets_seen / ip_packets_bad_checksum) < 2) {
|
||||
note("%d bad IP checksums seen in %d packets",
|
||||
ip_packets_bad_checksum, ip_packets_seen);
|
||||
@ -235,7 +235,7 @@ decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from,
|
||||
udp_packets_seen++;
|
||||
if (usum && usum != sum) {
|
||||
udp_packets_bad_checksum++;
|
||||
if (udp_packets_seen > 4 &&
|
||||
if (udp_packets_seen > 4 && udp_packets_bad_checksum != 0 &&
|
||||
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
|
||||
note("%d bad udp checksums in %d packets",
|
||||
udp_packets_bad_checksum, udp_packets_seen);
|
||||
|
@ -3,7 +3,8 @@
|
||||
PACKAGE= ipf
|
||||
PROG= ipmon
|
||||
SRCS= ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c
|
||||
MAN= ipmon.8
|
||||
MAN= ipmon.5 ipmon.8
|
||||
MLINKS= ipmon.5 ipmon.conf.5
|
||||
|
||||
CFLAGS+= -DLOGFAC=LOG_LOCAL0 -I.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 24, 2019
|
||||
.Dd June 21, 2019
|
||||
.Dt IPFW 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -1989,6 +1989,12 @@ a non-zero offset.
|
||||
See the
|
||||
.Cm frag
|
||||
option for details on matching fragmented packets.
|
||||
.It Cm tcpmss Ar tcpmss-list
|
||||
Matches TCP packets whose MSS (maximum segment size) value is set to
|
||||
.Ar tcpmss-list ,
|
||||
which is either a single value or a list of values or ranges
|
||||
specified in the same way as
|
||||
.Ar ports .
|
||||
.It Cm tcpseq Ar seq
|
||||
TCP packets only.
|
||||
Match if the TCP header sequence number field is set to
|
||||
|
@ -338,6 +338,7 @@ static struct _s_x rule_options[] = {
|
||||
{ "tcpdatalen", TOK_TCPDATALEN },
|
||||
{ "tcpflags", TOK_TCPFLAGS },
|
||||
{ "tcpflgs", TOK_TCPFLAGS },
|
||||
{ "tcpmss", TOK_TCPMSS },
|
||||
{ "tcpoptions", TOK_TCPOPTS },
|
||||
{ "tcpopts", TOK_TCPOPTS },
|
||||
{ "tcpseq", TOK_TCPSEQ },
|
||||
@ -881,6 +882,7 @@ static struct _s_x _port_name[] = {
|
||||
{"ipttl", O_IPTTL},
|
||||
{"mac-type", O_MAC_TYPE},
|
||||
{"tcpdatalen", O_TCPDATALEN},
|
||||
{"tcpmss", O_TCPMSS},
|
||||
{"tcpwin", O_TCPWIN},
|
||||
{"tagged", O_TAGGED},
|
||||
{NULL, 0}
|
||||
@ -1588,6 +1590,7 @@ print_instruction(struct buf_pr *bp, const struct format_opts *fo,
|
||||
case O_IPTTL:
|
||||
case O_IPLEN:
|
||||
case O_TCPDATALEN:
|
||||
case O_TCPMSS:
|
||||
case O_TCPWIN:
|
||||
if (F_LEN(cmd) == 1) {
|
||||
switch (cmd->opcode) {
|
||||
@ -1603,6 +1606,9 @@ print_instruction(struct buf_pr *bp, const struct format_opts *fo,
|
||||
case O_TCPDATALEN:
|
||||
s = "tcpdatalen";
|
||||
break;
|
||||
case O_TCPMSS:
|
||||
s = "tcpmss";
|
||||
break;
|
||||
case O_TCPWIN:
|
||||
s = "tcpwin";
|
||||
break;
|
||||
@ -2217,6 +2223,8 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo,
|
||||
}
|
||||
|
||||
print_proto(bp, fo, &state);
|
||||
if (co->do_compact != 0 && (rule->flags & IPFW_RULE_NOOPT))
|
||||
goto justopts;
|
||||
|
||||
/* Print source */
|
||||
bprintf(bp, " from");
|
||||
@ -4389,6 +4397,8 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, struct tidx *tstate)
|
||||
}
|
||||
OR_BLOCK(get_proto);
|
||||
|
||||
first_cmd = cmd; /* update pointer to use in compact form */
|
||||
|
||||
/*
|
||||
* "from", mandatory
|
||||
*/
|
||||
@ -4460,6 +4470,8 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, struct tidx *tstate)
|
||||
cmd = next_cmd(cmd, &cblen);
|
||||
}
|
||||
}
|
||||
if (first_cmd == cmd)
|
||||
rule->flags |= IPFW_RULE_NOOPT;
|
||||
|
||||
read_options:
|
||||
prev = NULL;
|
||||
@ -4709,14 +4721,18 @@ compile_rule(char *av[], uint32_t *rbuf, int *rbufsize, struct tidx *tstate)
|
||||
av++;
|
||||
break;
|
||||
|
||||
case TOK_TCPMSS:
|
||||
case TOK_TCPWIN:
|
||||
NEED1("tcpwin requires length");
|
||||
NEED1("tcpmss/tcpwin requires size");
|
||||
if (strpbrk(*av, "-,")) {
|
||||
if (!add_ports(cmd, *av, 0, O_TCPWIN, cblen))
|
||||
errx(EX_DATAERR, "invalid tcpwin len %s", *av);
|
||||
if (add_ports(cmd, *av, 0,
|
||||
i == TOK_TCPWIN ? O_TCPWIN : O_TCPMSS,
|
||||
cblen) == NULL)
|
||||
errx(EX_DATAERR, "invalid %s size %s",
|
||||
s, *av);
|
||||
} else
|
||||
fill_cmd(cmd, O_TCPWIN, 0,
|
||||
strtoul(*av, NULL, 0));
|
||||
fill_cmd(cmd, i == TOK_TCPWIN ? O_TCPWIN :
|
||||
O_TCPMSS, 0, strtoul(*av, NULL, 0));
|
||||
av++;
|
||||
break;
|
||||
|
||||
|
@ -151,6 +151,7 @@ enum tokens {
|
||||
TOK_TCPOPTS,
|
||||
TOK_TCPSEQ,
|
||||
TOK_TCPACK,
|
||||
TOK_TCPMSS,
|
||||
TOK_TCPWIN,
|
||||
TOK_ICMPTYPES,
|
||||
TOK_MAC,
|
||||
|
@ -1,10 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PACKAGE=nandfs
|
||||
PROG= nandfs
|
||||
SRCS= nandfs.c lssnap.c mksnap.c rmsnap.c
|
||||
MAN= nandfs.8
|
||||
|
||||
LIBADD= nandfs
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,18 +0,0 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libnandfs \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -1,114 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2012 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under sponsorship
|
||||
* from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sysexits.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <fs/nandfs/nandfs_fs.h>
|
||||
#include <libnandfs.h>
|
||||
|
||||
#include "nandfs.h"
|
||||
|
||||
#define NCPINFO 512
|
||||
|
||||
static void
|
||||
lssnap_usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage:\n");
|
||||
fprintf(stderr, "\tlssnap node\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_cpinfo(struct nandfs_cpinfo *cpinfo)
|
||||
{
|
||||
struct tm tm;
|
||||
time_t t;
|
||||
char timebuf[128];
|
||||
|
||||
t = (time_t)cpinfo->nci_create;
|
||||
localtime_r(&t, &tm);
|
||||
strftime(timebuf, sizeof(timebuf), "%F %T", &tm);
|
||||
|
||||
printf("%20llu %s\n", (unsigned long long)cpinfo->nci_cno, timebuf);
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_lssnap(int argc, char **argv)
|
||||
{
|
||||
struct nandfs_cpinfo *cpinfos;
|
||||
struct nandfs fs;
|
||||
uint64_t next;
|
||||
int error, nsnap, i;
|
||||
|
||||
if (argc != 1) {
|
||||
lssnap_usage();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
cpinfos = malloc(sizeof(*cpinfos) * NCPINFO);
|
||||
if (cpinfos == NULL) {
|
||||
fprintf(stderr, "cannot allocate memory\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
nandfs_init(&fs, argv[0]);
|
||||
error = nandfs_open(&fs);
|
||||
if (error == -1) {
|
||||
fprintf(stderr, "nandfs_open: %s\n", nandfs_errmsg(&fs));
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (next = 1; next != 0; next = cpinfos[nsnap - 1].nci_next) {
|
||||
nsnap = nandfs_get_snap(&fs, next, cpinfos, NCPINFO);
|
||||
if (nsnap < 1)
|
||||
break;
|
||||
|
||||
for (i = 0; i < nsnap; i++)
|
||||
print_cpinfo(&cpinfos[i]);
|
||||
}
|
||||
|
||||
if (nsnap == -1)
|
||||
fprintf(stderr, "nandfs_get_snap: %s\n", nandfs_errmsg(&fs));
|
||||
|
||||
out:
|
||||
nandfs_close(&fs);
|
||||
nandfs_destroy(&fs);
|
||||
free(cpinfos);
|
||||
return (error);
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2012 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under sponsorship
|
||||
* from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
#include <fs/nandfs/nandfs_fs.h>
|
||||
#include <libnandfs.h>
|
||||
|
||||
#include "nandfs.h"
|
||||
|
||||
static void
|
||||
mksnap_usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage:\n");
|
||||
fprintf(stderr, "\tmksnap node\n");
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_mksnap(int argc, char **argv)
|
||||
{
|
||||
struct nandfs fs;
|
||||
uint64_t cpno;
|
||||
int error;
|
||||
|
||||
if (argc != 1) {
|
||||
mksnap_usage();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
nandfs_init(&fs, argv[0]);
|
||||
error = nandfs_open(&fs);
|
||||
if (error == -1) {
|
||||
fprintf(stderr, "nandfs_open: %s\n", nandfs_errmsg(&fs));
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = nandfs_make_snap(&fs, &cpno);
|
||||
if (error == -1)
|
||||
fprintf(stderr, "nandfs_make_snap: %s\n", nandfs_errmsg(&fs));
|
||||
else
|
||||
printf("%jd\n", cpno);
|
||||
|
||||
out:
|
||||
nandfs_close(&fs);
|
||||
nandfs_destroy(&fs);
|
||||
return (error);
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2012 The FreeBSD Foundation
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This software was developed by Semihalf under sponsorship
|
||||
.\" from the FreeBSD Foundation.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\"
|
||||
.\" 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 September 10, 2016
|
||||
.Dt NANDFS 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm nandfs
|
||||
.Nd manage mounted NAND FS
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Cm lssnap
|
||||
.Ar node
|
||||
.Nm
|
||||
.Cm mksnap
|
||||
.Ar node
|
||||
.Nm
|
||||
.Cm rmsnap
|
||||
.Ar snapshot node
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility allows the management of snapshots on a mounted NAND FS.
|
||||
.Sh EXAMPLES
|
||||
Create a snapshot of filesystem mounted on
|
||||
.Em /nand .
|
||||
.Bd -literal -offset 2n
|
||||
.Li # Ic nandfs mksnap /nand
|
||||
1
|
||||
.Ed
|
||||
.Pp
|
||||
List snapshots of filesystem mounted on
|
||||
.Em /nand .
|
||||
.Bd -literal -offset 2n
|
||||
.Li # Ic nandfs lssnap /nand
|
||||
1 2012-02-28 18:49:45 ss 138 2
|
||||
.Ed
|
||||
.Pp
|
||||
Remove snapshot 1 of filesystem mounted on
|
||||
.Em /nand .
|
||||
.Bd -literal -offset 2n
|
||||
.Li # Ic nandfs rmsnap 1 /nand
|
||||
.Ed
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility appeared in
|
||||
.Fx 10.0 .
|
||||
.Sh AUTHORS
|
||||
This utility and manual page were written by
|
||||
.An Mateusz Guzik .
|
@ -1,76 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2012 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under sponsorship
|
||||
* from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
#include "nandfs.h"
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: nandfs [lssnap | mksnap | rmsnap <snap>] "
|
||||
"node\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int error = 0;
|
||||
char *cmd;
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
cmd = argv[1];
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
|
||||
if (strcmp(cmd, "lssnap") == 0)
|
||||
error = nandfs_lssnap(argc, argv);
|
||||
else if (strcmp(cmd, "mksnap") == 0)
|
||||
error = nandfs_mksnap(argc, argv);
|
||||
else if (strcmp(cmd, "rmsnap") == 0)
|
||||
error = nandfs_rmsnap(argc, argv);
|
||||
else
|
||||
usage();
|
||||
|
||||
return (error);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2012 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under sponsorship
|
||||
* from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef NANDFS_H
|
||||
#define NANDFS_H
|
||||
|
||||
int nandfs_lssnap(int, char **);
|
||||
int nandfs_mksnap(int, char **);
|
||||
int nandfs_rmsnap(int, char **);
|
||||
|
||||
#endif /* !NANDFS_H */
|
@ -1,89 +0,0 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2012 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Semihalf under sponsorship
|
||||
* from the FreeBSD Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
#include <fs/nandfs/nandfs_fs.h>
|
||||
#include <libnandfs.h>
|
||||
|
||||
#include "nandfs.h"
|
||||
|
||||
static void
|
||||
rmsnap_usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage:\n");
|
||||
fprintf(stderr, "\trmsnap snap node\n");
|
||||
}
|
||||
|
||||
int
|
||||
nandfs_rmsnap(int argc, char **argv)
|
||||
{
|
||||
struct nandfs fs;
|
||||
uint64_t cpno;
|
||||
int error;
|
||||
|
||||
if (argc != 2) {
|
||||
rmsnap_usage();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
cpno = strtoll(argv[0], (char **)NULL, 10);
|
||||
if (cpno == 0) {
|
||||
fprintf(stderr, "%s must be a number greater than 0\n",
|
||||
argv[0]);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
nandfs_init(&fs, argv[1]);
|
||||
error = nandfs_open(&fs);
|
||||
if (error == -1) {
|
||||
fprintf(stderr, "nandfs_open: %s\n", nandfs_errmsg(&fs));
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = nandfs_delete_snap(&fs, cpno);
|
||||
if (error == -1)
|
||||
fprintf(stderr, "nandfs_delete_snap: %s\n", nandfs_errmsg(&fs));
|
||||
|
||||
out:
|
||||
nandfs_close(&fs);
|
||||
nandfs_destroy(&fs);
|
||||
return (error);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PACKAGE=nandfs
|
||||
PROG= newfs_nandfs
|
||||
MAN= newfs_nandfs.8
|
||||
|
||||
LIBADD= geom
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,20 +0,0 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libexpat \
|
||||
lib/libgeom \
|
||||
lib/libsbuf \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -1,74 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Semihalf
|
||||
.\" 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 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 October 1, 2013
|
||||
.Dt NEWFS_NANDFS 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm newfs_nandfs
|
||||
.Nd construct a new NAND FS file system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl b Ar blocsize
|
||||
.Op Fl B Ar blocks-per-segment
|
||||
.Op Fl L Ar label
|
||||
.Op Fl m Ar reserved-segment-percent
|
||||
.Ar device
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility creates a NAND FS file system on device.
|
||||
.Pp
|
||||
The options are as follow:
|
||||
.Bl -tag -width indent
|
||||
.It Fl b Ar blocksize
|
||||
Size of block (1024 if not specified).
|
||||
.It Fl B Ar blocks_per_segment
|
||||
Number of blocks per segment (2048 if not specified).
|
||||
.It Fl L Ar label
|
||||
Volume label (up to 16 characters).
|
||||
.It Fl m Ar reserved_block_percent
|
||||
Percentage of reserved blocks (5 if not specified).
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
Exit status is 0 on success and 1 on error.
|
||||
.Sh EXAMPLES
|
||||
Create a file system, using default parameters, on
|
||||
.Pa /dev/ada0s1 :
|
||||
.Bd -literal -offset indent
|
||||
newfs_nandfs /dev/ada0s1
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr gpart 8 ,
|
||||
.Xr newfs 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Fx 10.0 .
|
||||
.Sh AUTHORS
|
||||
.An Grzegorz Bernacki
|
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@
|
||||
.\" @(#)swapon.8 8.1 (Berkeley) 6/5/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 21, 2016
|
||||
.Dd June 21, 2019
|
||||
.Dt SWAPON 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -38,7 +38,7 @@
|
||||
.Nm swapon
|
||||
.Oo Fl F Ar fstab
|
||||
.Oc
|
||||
.Fl aLq | Ar
|
||||
.Fl aLq | E Ar
|
||||
.Nm swapoff
|
||||
.Oo Fl F Ar fstab
|
||||
.Oc
|
||||
@ -86,6 +86,11 @@ If the
|
||||
option is used,
|
||||
informational messages will not be
|
||||
written to standard output when a swap device is added.
|
||||
The
|
||||
.Fl E
|
||||
option causes each of following devices to receive a
|
||||
.Dv BIO_DELETE
|
||||
command to mark all blocks as unused.
|
||||
.Pp
|
||||
The
|
||||
.Nm swapoff
|
||||
|
@ -44,7 +44,7 @@ static char sccsid[] = "@(#)swapon.c 8.1 (Berkeley) 6/5/93";
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/mdioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
@ -77,7 +77,7 @@ static int run_cmd(int *, const char *, ...) __printflike(2, 3);
|
||||
|
||||
static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
|
||||
|
||||
static int qflag;
|
||||
static int Eflag, qflag;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@ -100,7 +100,7 @@ main(int argc, char **argv)
|
||||
|
||||
doall = 0;
|
||||
etc_fstab = NULL;
|
||||
while ((ch = getopt(argc, argv, "AadghklLmqsUF:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "AadEghklLmqsUF:")) != -1) {
|
||||
switch(ch) {
|
||||
case 'A':
|
||||
if (which_prog == SWAPCTL) {
|
||||
@ -121,6 +121,12 @@ main(int argc, char **argv)
|
||||
else
|
||||
usage();
|
||||
break;
|
||||
case 'E':
|
||||
if (which_prog == SWAPON)
|
||||
Eflag = 2;
|
||||
else
|
||||
usage();
|
||||
break;
|
||||
case 'g':
|
||||
hflag = 'G';
|
||||
break;
|
||||
@ -182,8 +188,10 @@ main(int argc, char **argv)
|
||||
strstr(fsp->fs_mntops, "late") == NULL &&
|
||||
late != 0)
|
||||
continue;
|
||||
Eflag |= (strstr(fsp->fs_mntops, "trimonce") != NULL);
|
||||
swfile = swap_on_off(fsp->fs_spec, 1,
|
||||
fsp->fs_mntops);
|
||||
Eflag &= ~1;
|
||||
if (swfile == NULL) {
|
||||
ret = 1;
|
||||
continue;
|
||||
@ -378,12 +386,22 @@ swap_on_geli_args(const char *mntops)
|
||||
return (NULL);
|
||||
}
|
||||
} else if (strcmp(token, "notrim") == 0) {
|
||||
if (Eflag) {
|
||||
warn("Options \"notrim\" and "
|
||||
"\"trimonce\" conflict");
|
||||
free(ops);
|
||||
return (NULL);
|
||||
}
|
||||
Tflag = " -T ";
|
||||
} else if (strcmp(token, "late") == 0) {
|
||||
/* ignore known option */
|
||||
} else if (strcmp(token, "noauto") == 0) {
|
||||
/* ignore known option */
|
||||
} else if (strcmp(token, "sw") != 0) {
|
||||
} else if (strcmp(token, "sw") == 0) {
|
||||
/* ignore known option */
|
||||
} else if (strcmp(token, "trimonce") == 0) {
|
||||
/* ignore known option */
|
||||
} else {
|
||||
warnx("Invalid option: %s", token);
|
||||
free(ops);
|
||||
return (NULL);
|
||||
@ -721,14 +739,42 @@ run_cmd(int *ofd, const char *cmdline, ...)
|
||||
return (WEXITSTATUS(status));
|
||||
}
|
||||
|
||||
static void
|
||||
swap_trim(const char *name)
|
||||
{
|
||||
struct stat sb;
|
||||
off_t ioarg[2], sz;
|
||||
int fd;
|
||||
|
||||
fd = open(name, O_WRONLY);
|
||||
if (fd < 0)
|
||||
errx(1, "Cannot open %s", name);
|
||||
if (fstat(fd, &sb) < 0)
|
||||
errx(1, "Cannot stat %s", name);
|
||||
if (S_ISREG(sb.st_mode))
|
||||
sz = sb.st_size;
|
||||
else if (S_ISCHR(sb.st_mode)) {
|
||||
if (ioctl(fd, DIOCGMEDIASIZE, &sz) != 0)
|
||||
err(1, "ioctl(DIOCGMEDIASIZE)");
|
||||
} else
|
||||
errx(1, "%s has an invalid file type", name);
|
||||
ioarg[0] = 0;
|
||||
ioarg[1] = sz;
|
||||
if (ioctl(fd, DIOCGDELETE, ioarg) != 0)
|
||||
warn("ioctl(DIOCGDELETE)");
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static const char *
|
||||
swap_on_off_sfile(const char *name, int doingall)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (which_prog == SWAPON)
|
||||
if (which_prog == SWAPON) {
|
||||
if (Eflag)
|
||||
swap_trim(name);
|
||||
error = swapon(name);
|
||||
else /* SWAPOFF */
|
||||
} else /* SWAPOFF */
|
||||
error = swapoff(name);
|
||||
|
||||
if (error == -1) {
|
||||
@ -759,6 +805,8 @@ usage(void)
|
||||
fprintf(stderr, "usage: %s ", getprogname());
|
||||
switch(orig_prog) {
|
||||
case SWAPON:
|
||||
fprintf(stderr, "[-F fstab] -aLq | [-E] file ...\n");
|
||||
break;
|
||||
case SWAPOFF:
|
||||
fprintf(stderr, "[-F fstab] -aLq | file ...\n");
|
||||
break;
|
||||
|
@ -49,6 +49,12 @@
|
||||
# icelake-client, cannonlake, knm, skylake-avx512, knl,
|
||||
# goldmont, skylake, broadwell, haswell, ivybridge,
|
||||
# sandybridge, westmere, nehalem, silvermont, bonnell
|
||||
# ARM architecture: armv5, armv5te, armv6, armv6t2, arm1176jzf-s, armv7,
|
||||
# armv7-a, armv7ve, generic-armv7-a, cortex-a5,
|
||||
# cortex-a7, cortex-a8, cortex-a9, cortex-a12,
|
||||
# cortex-a15, cortex-a17
|
||||
# ARM64 architechture: cortex-a53, cortex-a57, cortex-a72,
|
||||
# exynos-m1
|
||||
#
|
||||
# (?= allows to buildworld for a different CPUTYPE.)
|
||||
#
|
||||
|
@ -303,8 +303,6 @@ MAN= aac.4 \
|
||||
mx25l.4 \
|
||||
mxge.4 \
|
||||
my.4 \
|
||||
nand.4 \
|
||||
nandsim.4 \
|
||||
${_ndis.4} \
|
||||
net80211.4 \
|
||||
netdump.4 \
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 5, 2013
|
||||
.Dd June 27, 2019
|
||||
.Dt GPIO 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -103,12 +103,50 @@ passed to the kernel, being either statically compiled in, or by a variety
|
||||
of ways where the boot loader (or Open Firmware enabled system) passes the
|
||||
DTS blob to the kernel at boot.
|
||||
.Pp
|
||||
On a
|
||||
.Xr device.hints 5
|
||||
based system these hints can be used to configure drivers for devices
|
||||
attached to
|
||||
.Nm
|
||||
pins:
|
||||
.Bl -tag -width ".Va hint.driver.unit.pin_list"
|
||||
.It Va hint.driver.unit.at
|
||||
The
|
||||
.Nm gpiobus
|
||||
where the device is attached.
|
||||
For example,
|
||||
.Qq gpiobus0 .
|
||||
.Ar driver
|
||||
and
|
||||
.Ar unit
|
||||
are the driver name and the unit number for the device driver.
|
||||
.It Va hint.driver.unit.pins
|
||||
This is a bitmask of the pins on the
|
||||
.Nm gpiobus
|
||||
that are connected to the device.
|
||||
The pins will be allocated to the specified driver instance.
|
||||
Only pins with numbers from 0 to 31 can be specified using this hint.
|
||||
.It Va hint.driver.unit.pin_list
|
||||
This is a list of pin numbers of pins on the
|
||||
.Nm gpiobus
|
||||
that are connected to the device.
|
||||
The pins will be allocated to the specified driver instance.
|
||||
This is a more user friendly alternative to the
|
||||
.Ar pins
|
||||
hint.
|
||||
Additionally, this hint allows specifying pin numbers greater than 31.
|
||||
The numbers can be decimal or hexadecimal with 0x prefix.
|
||||
Any non-digit character can be used as a separator.
|
||||
For example, it can be a comma, a slash or a space.
|
||||
The separator can be followed by any number of space characters.
|
||||
.El
|
||||
.Pp
|
||||
The following
|
||||
.Xr device.hints 5
|
||||
are only provided by the
|
||||
.Cd ar71xx_gpio
|
||||
driver:
|
||||
.Bl -tag -width ".Va hint.gpioiic.%d.atXXX"
|
||||
.Bl -tag -width ".Va hint.gpio.function_clear"
|
||||
.It Va hint.gpio.%d.pinmask
|
||||
This is a bitmask of pins on the GPIO board that we would like to expose
|
||||
for use to the host operating system.
|
||||
@ -133,6 +171,7 @@ of some device in a system.
|
||||
.Xr gpioiic 4 ,
|
||||
.Xr gpioled 4 ,
|
||||
.Xr iicbus 4 ,
|
||||
.Xr device.hints 5 ,
|
||||
.Xr gpioctl 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
@ -1,145 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2012 The FreeBSD Foundation
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This documentation was written by Semihalf under sponsorship from
|
||||
.\" the FreeBSD Foundation.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 8, 2012
|
||||
.Dt NAND 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm nand
|
||||
.Nd NAND Flash framework
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device nand"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fx
|
||||
.Nm
|
||||
framework consists of a set of interfaces that aim to provide an extensible,
|
||||
object oriented environment for NAND controllers and NAND Flash memory chips
|
||||
from various hardware vendors, and to allow for uniform and flexible
|
||||
management of the NAND devices.
|
||||
It comprises of the following major components:
|
||||
.Bl -bullet
|
||||
.It
|
||||
NAND Flash controller (NFC) interface.
|
||||
.Pp
|
||||
Defines methods which allow to send commands as well as send/receive data
|
||||
between the controller and a NAND chip.
|
||||
Back-end drivers for specific NAND
|
||||
controllers plug into this interface and implement low-level routines for a
|
||||
given NAND controller.
|
||||
.Pp
|
||||
This layer implements basic functionality of a NAND Flash controller.
|
||||
It allows to send command and address to chip, drive CS (chip select line),
|
||||
as well as read/write to the selected NAND chip.
|
||||
This layer is independent of
|
||||
NAND chip devices actually connected to the controller.
|
||||
.It
|
||||
NAND chip interface.
|
||||
.Pp
|
||||
Provides basic operations like read page, program page, erase block.
|
||||
Currently three generic classes of drivers are available, which provide
|
||||
support for the following chips:
|
||||
.Bl -bullet
|
||||
.It
|
||||
large page
|
||||
.It
|
||||
small page
|
||||
.It
|
||||
ONFI-compliant
|
||||
.El
|
||||
.Pp
|
||||
This layer implements basic operations to be performed on a NAND chip, like
|
||||
read, program, erase, get status etc.
|
||||
Since these operations use specific
|
||||
commands (depending on the vendor), each chip has potentially its own
|
||||
implementation of the commands set.
|
||||
.Pp
|
||||
The framework is extensible so it is also possible to create a custom command
|
||||
set for a non standard chip support.
|
||||
.It
|
||||
NANDbus.
|
||||
.Pp
|
||||
This layer is responsible for enumerating NAND chips in the system and
|
||||
establishing the hierarchy between chips and their supervising controllers.
|
||||
.Pp
|
||||
Its main purpose is detecting type of NAND chips connected to a given chip
|
||||
select (CS line).
|
||||
It also allows manages locking access to the NAND
|
||||
controller.
|
||||
NANDbus passes requests from an active chip to the chip controller.
|
||||
.It
|
||||
NAND character / GEOM device.
|
||||
.Pp
|
||||
For each NAND chip found in a system a character and GEOM devices are created
|
||||
which allows to read / write directly to a device, as well as perform other
|
||||
specific operations (like via ioctl).
|
||||
.Pp
|
||||
There are two GEOM devices created for each NAND chip:
|
||||
.Bl -bullet
|
||||
.It
|
||||
raw device
|
||||
.It
|
||||
normal device
|
||||
.El
|
||||
.Pp
|
||||
Raw device allows to bypass ECC checking when reading/writing to it, while
|
||||
normal device always uses ECC algorithm to validate the read data.
|
||||
.Pp
|
||||
NAND character devices will be created for each NAND chip detected while
|
||||
probing the NAND controller.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr libnandfs 3 ,
|
||||
.Xr gnand 4 ,
|
||||
.Xr nandsim 4 ,
|
||||
.Xr nandfs 5 ,
|
||||
.Xr makefs 8 ,
|
||||
.Xr mount_nandfs 8 ,
|
||||
.Xr nandfs 8 ,
|
||||
.Xr nandsim 8 ,
|
||||
.Xr nandtool 8 ,
|
||||
.Xr newfs_nandfs 8 ,
|
||||
.Xr umount_nandfs 8
|
||||
.Sh STANDARDS
|
||||
Open NAND Flash Interface Working Group
|
||||
.Pq Vt ONFI .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
framework support first appeared in
|
||||
.Fx 10.0 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
framework was designed and developed by
|
||||
.An Grzegorz Bernacki .
|
||||
This manual page was written by
|
||||
.An Rafal Jaworowski .
|
@ -1,93 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2012 The FreeBSD Foundation
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This documentation was written by Semihalf under sponsorship from
|
||||
.\" the FreeBSD Foundation.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 8, 2012
|
||||
.Dt NANDSIM 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm nandsim
|
||||
.Nd NAND Flash simulator driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device nand"
|
||||
.Cd "device nandsim"
|
||||
.Cd "options ALQ"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
is part of the
|
||||
.Fx
|
||||
NAND framework
|
||||
.Xr nand 4
|
||||
and can be characterized with the following highlights:
|
||||
.Bl -bullet
|
||||
.It
|
||||
plugs into the
|
||||
.Xr nand 4
|
||||
framework APIs as if it were a hardware controller (hanging on the nexus bus)
|
||||
with real NAND chips connected to it
|
||||
.It
|
||||
physically part of the kernel code (either statically linked into the kernel
|
||||
image or built as a module)
|
||||
.It
|
||||
controlled with a user space program
|
||||
.Xr nandsim 8
|
||||
.El
|
||||
.Pp
|
||||
From the user perspective, the
|
||||
.Nm
|
||||
allows for imitating ONFI-compliant NAND Flash devices as if they were
|
||||
attached to the system via a virtual controller.
|
||||
.Pp
|
||||
Some
|
||||
.Nm
|
||||
features rely on the ability to log contents to a file, which is achieved
|
||||
through the
|
||||
.Xr alq 9
|
||||
facility.
|
||||
.Sh SEE ALSO
|
||||
.Xr nand 4 ,
|
||||
.Xr nandsim.conf 5 ,
|
||||
.Xr nandsim 8
|
||||
.Sh STANDARDS
|
||||
Open NAND Flash Interface Working Group
|
||||
.Pq Vt ONFI .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
support first appeared in
|
||||
.Fx 10.0 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
kernel driver was developed by
|
||||
.An Grzegorz Bernacki .
|
||||
This manual page was written by
|
||||
.An Rafal Jaworowski .
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 20, 2015
|
||||
.Dd June 26, 2019
|
||||
.Dt OWC 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -69,6 +69,24 @@ For more details about the
|
||||
.Va gpios
|
||||
property, please consult
|
||||
.Pa /usr/src/sys/dts/bindings-gpio.txt .
|
||||
.Pp
|
||||
On a
|
||||
.Xr device.hints 5
|
||||
based system these values are required for the
|
||||
.Nm :
|
||||
.Bl -tag -width ".Va hint.owc.%d.atXXX"
|
||||
.It Va hint.owc.%d.at
|
||||
The
|
||||
.Nm gpiobus
|
||||
you are attaching to.
|
||||
.It Va hint.owc.%d.pins
|
||||
This is a bitmask that defines a pin on the
|
||||
.Nm gpiobus
|
||||
that is to be used for the 1-Wire bus.
|
||||
For instance, to configure pin 10, use the bitmask of 0x400.
|
||||
Please note that this mask should have only one bit set
|
||||
(any other bits - i.e., pins - will be ignored).
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr gpiobus 4 ,
|
||||
.Xr ow 4 ,
|
||||
|
@ -30,7 +30,6 @@
|
||||
.Nm random
|
||||
.Nd the entropy device
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device random"
|
||||
.Cd "options RANDOM_LOADABLE"
|
||||
.Cd "options RANDOM_ENABLE_ETHER"
|
||||
.Cd "options RANDOM_ENABLE_UMA"
|
||||
|
@ -101,10 +101,6 @@ MAN+= freebsd-update.conf.5
|
||||
MAN+= hesiod.conf.5
|
||||
.endif
|
||||
|
||||
.if ${MK_NAND} != "no"
|
||||
MAN+= nandfs.5
|
||||
.endif
|
||||
|
||||
.if ${MK_PF} != "no"
|
||||
MAN+= pf.conf.5 \
|
||||
pf.os.5
|
||||
|
@ -216,6 +216,12 @@ then the special file is made available as a piece of swap
|
||||
space by the
|
||||
.Xr swapon 8
|
||||
command at the end of the system reboot procedure.
|
||||
For swap devices, the keyword
|
||||
.Dq trimonce
|
||||
triggers the delivery of a
|
||||
.Dv BIO_DELETE
|
||||
command to the device to mark
|
||||
all blocks as unused.
|
||||
For vnode-backed swap spaces,
|
||||
.Dq file
|
||||
is supported in the
|
||||
|
@ -1,132 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2010 Semihalf
|
||||
.\" 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 Nov 11, 2010
|
||||
.Dt NANDFS 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm nandfs
|
||||
.Nd NAND Flash file system
|
||||
.Sh SYNOPSIS
|
||||
To compile support for the
|
||||
.Nm ,
|
||||
place the following in your kernel configuration file:
|
||||
.Bd -ragged -offset indent
|
||||
.Cd "options NANDFS"
|
||||
.Ed
|
||||
.Pp
|
||||
Even though the NAND FS can be used with any storage media, it has been
|
||||
optimized and designed towards NAND Flash devices, so typically the following
|
||||
driver is used:
|
||||
.Bd -ragged -offset indent
|
||||
.Cd "device nand"
|
||||
.Ed
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver enables
|
||||
.Fx
|
||||
with support for NAND-oriented file system.
|
||||
.Pp
|
||||
It is a log-structured style file system with the following major features and
|
||||
characteristics:
|
||||
.Bl -bullet
|
||||
.It
|
||||
Hard links, symbolic links support
|
||||
.It
|
||||
Block journaling
|
||||
.It
|
||||
Copy-On-Write
|
||||
.It
|
||||
Snapshots (continuous, taken automatically, simultaneously mountable)
|
||||
.It
|
||||
Quick crash recovery at mount time
|
||||
.It
|
||||
64-bit data structures; supports many files, large files and volumes
|
||||
.It
|
||||
POSIX file permissions
|
||||
.It
|
||||
Checksum / ECC
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
The most common usage is mounting the file system:
|
||||
.Pp
|
||||
.Dl "mount -t nandfs /dev/<gnandN> /mnt"
|
||||
.Pp
|
||||
or:
|
||||
.Dl "mount_nandfs /dev/<gnandN> /mnt"
|
||||
.Pp
|
||||
where
|
||||
.Ar gnandN
|
||||
is the GEOM device representing a Flash partition (slice) containing the
|
||||
.Nm
|
||||
structure, and
|
||||
.Pa /mnt
|
||||
is a mount point.
|
||||
.Pp
|
||||
It is possible to define an entry in
|
||||
.Pa /etc/fstab
|
||||
for the
|
||||
.Nm :
|
||||
.Bd -literal
|
||||
/dev/gnand0 /flash nandfs rw 0 0
|
||||
.Ed
|
||||
.Pp
|
||||
This will mount a
|
||||
.Nm
|
||||
partition at the specified mount point during system boot.
|
||||
.Sh SEE ALSO
|
||||
.Xr gnand 4 ,
|
||||
.Xr nand 4 ,
|
||||
.Xr mount_nandfs 8 ,
|
||||
.Xr nandfs 8 ,
|
||||
.Xr nandsim 8 ,
|
||||
.Xr nandtool 8 ,
|
||||
.Xr umount_nandfs 8
|
||||
.Sh HISTORY
|
||||
The NAND FS concepts are based on NILFS principles and initial implementation
|
||||
was derived from early read-only NILFS NetBSD code.
|
||||
Since then the NAND FS
|
||||
code diverged significantly and is by no means compatible with NILFS.
|
||||
.Pp
|
||||
The NAND Flash file system first appeared in
|
||||
.Fx 10.0 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The NAND FS was written by
|
||||
.An Grzegorz Bernacki
|
||||
with the help of
|
||||
.An Mateusz Guzik ,
|
||||
based on the NetBSD code created by
|
||||
.An Reinoud Zandijk .
|
||||
Additional help and support by
|
||||
.An Lukasz Plachno ,
|
||||
.An Jan Sieka
|
||||
and
|
||||
.An Lukasz Wojcik .
|
||||
This manual page was written by
|
||||
.An Rafal Jaworowski .
|
@ -270,7 +270,6 @@ MAN= accept_filter.9 \
|
||||
proc_rwmem.9 \
|
||||
pseudofs.9 \
|
||||
psignal.9 \
|
||||
pwm.9 \
|
||||
pwmbus.9 \
|
||||
random.9 \
|
||||
random_harvest.9 \
|
||||
@ -1670,6 +1669,7 @@ MLINKS+=proc_rwmem.9 proc_readmem.9 \
|
||||
MLINKS+=psignal.9 gsignal.9 \
|
||||
psignal.9 pgsignal.9 \
|
||||
psignal.9 tdsignal.9
|
||||
MLINKS+=pwmbus.9 pwm.9
|
||||
MLINKS+=random.9 arc4rand.9 \
|
||||
random.9 arc4random.9 \
|
||||
random.9 is_random_seeded.9 \
|
||||
|
@ -34,7 +34,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 5, 2002
|
||||
.Dd June 20, 2019
|
||||
.Dt VOP_REVOKE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -61,7 +61,7 @@ to signify that all access will be revoked; any other value is invalid.
|
||||
.Sh LOCKS
|
||||
The
|
||||
.Fa vp
|
||||
must be unlocked on entry, and will remain unlocked upon return.
|
||||
must be exclusively locked on entry, and will remain locked upon return.
|
||||
.Sh SEE ALSO
|
||||
.Xr make_dev_alias 9 ,
|
||||
.Xr vnode 9
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $FreeBSD$
|
||||
.Dd May 24, 2017
|
||||
.Dd May 21, 2019
|
||||
.Dt IFLIBDI 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -194,10 +194,10 @@ Allocate and initialize the
|
||||
\fIif_ctx_t\fP structure.
|
||||
Setup and initialize the MSI or MSI/X interrupt queues if necessary.
|
||||
Allocate memory for queues and qset structure setup.
|
||||
.It Fn iflib_device_irq_alloc
|
||||
.It Fn iflib_irq_alloc
|
||||
Allocate an interrupt resource for a given rid value with an associated filter
|
||||
and handler function.
|
||||
.It Fn iflib_device_irq_alloc_generic
|
||||
.It Fn iflib_irq_alloc_generic
|
||||
Performs the same function as iflib_device_irq_alloc along with the additional
|
||||
functionality of adding a taskgroup.
|
||||
The data fields and callback function are determined by the type of interrupt,
|
||||
|
@ -1,93 +0,0 @@
|
||||
.\" Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 12, 2019
|
||||
.Dt PWM 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm pwm ,
|
||||
.Nm PWM_GET_BUS ,
|
||||
.Nm PWM_CHANNEL_CONFIG ,
|
||||
.Nm PWM_CHANNEL_GET_CONFIG ,
|
||||
.Nm PWM_CHANNEL_SET_FLAGS ,
|
||||
.Nm PWM_CHANNEL_GET_FLAGS ,
|
||||
.Nm PWM_CHANNEL_ENABLE ,
|
||||
.Nm PWM_CHANNEL_IS_ENABLED ,
|
||||
.Nm PWM_CHANNEL_MAX
|
||||
.Nd PWM methods
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device pwm"
|
||||
.In "pwm_if.h"
|
||||
.Ft device_t
|
||||
.Fn PWM_GET_BUS "device_t dev"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_CONFIG "device_t dev" "int channel" "uint64_t period" "uint64_t duty"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_GET_CONFIG "device_t dev" "int channel" "uint64_t *period" "uint64_t *duty"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_SET_FLAGS "device_t dev" "int channel" "uint32_t flags"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_GET_FLAGS "device_t dev" "int channel" "uint32_t *flags"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_ENABLE "device_t dev" "int channel" "bool enable"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_IS_ENABLED "device_t dev" "int channel" "bool *enabled"
|
||||
.Ft int
|
||||
.Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
|
||||
.Sh DESCRIPTION
|
||||
The PWM (Pulse-Width Modulation) interface allows the device driver to register to a global
|
||||
bus so other devices in the kernel can use them in a generic way.
|
||||
.Sh INTERFACE
|
||||
.Bl -tag -width indent
|
||||
.It Fn PWM_GET_BUS "device_t dev"
|
||||
Return the bus device.
|
||||
.It Fn PWM_CHANNEL_CONFIG "device_t dev" "int channel" "uint64_t period" "uint64_t duty"
|
||||
Configure the period and duty (in nanoseconds) in the PWM controller for the specified channel.
|
||||
Returns 0 on success or
|
||||
.Er EINVAL
|
||||
if the values are not supported by the controller or
|
||||
.Er EBUSY
|
||||
is the PWM controller is in use and does not support changing the value on the fly.
|
||||
.It Fn PWM_CHANNEL_GET_CONFIG "device_t dev" "int channel" "uint64_t *period" "uint64_t *duty"
|
||||
Get the current configuration of the period and duty for the specified channel.
|
||||
.It Fn PWM_CHANNEL_SET_FLAGS "device_t dev" "int channel" "uint32_t flags"
|
||||
Set the flags of the channel (like inverted polarity).
|
||||
.It Fn PWM_CHANNEL_GET_FLAGS "device_t dev" "int channel" "uint32_t *flags"
|
||||
Get the current flags for the channel.
|
||||
.It Fn PWM_CHANNEL_ENABLE "device_t dev" "int channel" "bool enable"
|
||||
Enable the PWM channel.
|
||||
.It Fn PWM_CHANNEL_ISENABLED "device_t dev" "int channel" "bool *enable"
|
||||
Test if the PWM channel is enabled.
|
||||
.It Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
|
||||
Get the maximum number of channels supported by the controller.
|
||||
.El
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm pwm
|
||||
interface first appeared in
|
||||
.Fx 13.0 .
|
||||
The
|
||||
.Nm pwm
|
||||
interface and manual page was written by
|
||||
.An Emmanuel Vadot Aq Mt manu@FreeBSD.org .
|
@ -22,70 +22,85 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 12, 2018
|
||||
.Dd June 21, 2019
|
||||
.Dt PWMBUS 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm pwmbus ,
|
||||
.Nm pwmbus_attach_bus ,
|
||||
.Nm PWMBUS_GET_BUS ,
|
||||
.Nm PWMBUS_CHANNEL_CONFIG ,
|
||||
.Nm PWMBUS_CHANNEL_GET_CONFIG ,
|
||||
.Nm PWMBUS_CHANNEL_SET_FLAGS ,
|
||||
.Nm PWMBUS_CHANNEL_GET_FLAGS ,
|
||||
.Nm PWMBUS_CHANNEL_COUNT ,
|
||||
.Nm PWMBUS_CHANNEL_ENABLE ,
|
||||
.Nm PWMBUS_CHANNEL_GET_CONFIG ,
|
||||
.Nm PWMBUS_CHANNEL_GET_FLAGS ,
|
||||
.Nm PWMBUS_CHANNEL_IS_ENABLED ,
|
||||
.Nm PWMBUS_CHANNEL_MAX
|
||||
.Nm PWMBUS_CHANNEL_SET_FLAGS ,
|
||||
.Nm PWMBUS_GET_BUS
|
||||
.Nd PWMBUS methods
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device pwm"
|
||||
.In "pwmbus_if.h"
|
||||
.Ft device_t
|
||||
.Fn pwmbus_attach_bus "device_t dev"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
|
||||
.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled"
|
||||
.Ft int
|
||||
.Fn PWMBUS_CHANNEL_MAX "device_t bus" "int channel" "int *nchannel"
|
||||
.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
|
||||
.Sh DESCRIPTION
|
||||
The PWMBUS (Pulse-Width Modulation) interface allows the device driver to register to a global
|
||||
bus so other devices in the kernel can use them in a generic way
|
||||
The PWMBUS (Pulse-Width Modulation) interface allows a device driver to
|
||||
register to a global bus so other devices in the kernel can use them in a
|
||||
generic way.
|
||||
.Pp
|
||||
For all
|
||||
.Nm
|
||||
methods, the
|
||||
.Va period
|
||||
argument is the duration in nanoseconds of one complete on-off cycle, and the
|
||||
.Va duty
|
||||
argument is the duration in nanoseconds of the on portion of that cycle.
|
||||
.Pp
|
||||
Some PWM hardware is organized as a single controller with multiple channels.
|
||||
Channel numbers count up from zero.
|
||||
When multiple channels are present, they sometimes share a common clock or
|
||||
other resources.
|
||||
In such cases, changing the period or duty cycle of any one channel may affect
|
||||
other channels within the hardware which share the same resources.
|
||||
Consult the documentation for the underlying PWM hardware device driver for
|
||||
details on channels that share resources.
|
||||
.Sh INTERFACE
|
||||
.Bl -tag -width indent
|
||||
.It Fn pwmbus_attach_bus "device_t dev"
|
||||
Attach the
|
||||
.Nm pwmbus
|
||||
to the device driver
|
||||
.It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty"
|
||||
Configure the period and duty (in nanoseconds) in the PWM controller on the bus for the specified channel.
|
||||
Configure the period and duty (in nanoseconds) in the PWM controller on the bus
|
||||
for the specified channel.
|
||||
Returns 0 on success or
|
||||
.Er EINVAL
|
||||
is the values are not supported by the controller or
|
||||
if the values are not supported by the controller or
|
||||
.Er EBUSY
|
||||
is the PWMBUS controller is in use and doesn't support changing the value on the fly.
|
||||
.It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
|
||||
Get the current configuration of the period and duty for the specified channel.
|
||||
.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
|
||||
Set the flags of the channel (like inverted polarity), if the driver or controller
|
||||
doesn't support this a default method is used.
|
||||
.It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
|
||||
Get the current flags for the channel, if the driver or controller
|
||||
doesn't support this, a default method is used.
|
||||
if the PWMBUS controller is in use and does not support changing the value on
|
||||
the fly.
|
||||
.It Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int *nchannel"
|
||||
Get the number of channels supported by the controller.
|
||||
.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
|
||||
Enable the PWM channel.
|
||||
.It Fn PWMBUS_CHANNEL_ISENABLED "device_t bus" "int channel" "bool *enable"
|
||||
Test if the PWM channel is enabled.
|
||||
.It PWMBUS_CHANNEL_MAX "device_t bus" "int channel" "int *nchannel"
|
||||
Get the maximum number of channel supported by the controller.
|
||||
.It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty"
|
||||
Get the current configuration of the period and duty for the specified channel.
|
||||
.It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
|
||||
Get the current flags for the channel.
|
||||
If the driver or controller
|
||||
does not support this, a default method returns a flags value of zero.
|
||||
.It Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enable"
|
||||
Test whether the PWM channel is enabled.
|
||||
.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
|
||||
Set the flags of the channel (such as inverted polarity).
|
||||
If the driver or controller does not support this a do-nothing default method
|
||||
is used.
|
||||
.El
|
||||
.Sh HISTORY
|
||||
The
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 19, 2003
|
||||
.Dd June 20, 2019
|
||||
.Dt VM_MAP_PROTECT 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -51,6 +51,11 @@ within the map
|
||||
.Fa map
|
||||
to
|
||||
.Fa new_prot .
|
||||
The value specified by
|
||||
.Fa new_prot
|
||||
may not include any protection bits that are not set in
|
||||
.Va max_protection
|
||||
on every entry within the range.
|
||||
.Pp
|
||||
If
|
||||
.Fa set_max
|
||||
@ -59,7 +64,12 @@ is TRUE,
|
||||
is treated as the new
|
||||
.Va max_protection
|
||||
setting for each underlying entry.
|
||||
Otherwise, only the
|
||||
Protection bits not included
|
||||
.Fa new_prot
|
||||
will be cleared from existing entries.
|
||||
If
|
||||
.Fa set_max
|
||||
is FALSE only the
|
||||
.Va protection
|
||||
field is affected.
|
||||
.Pp
|
||||
@ -86,6 +96,11 @@ would exceed
|
||||
for an entry within the range,
|
||||
.Dv KERN_PROTECTION_FAILURE
|
||||
is returned.
|
||||
If a copy-on-write mapping is transitioned from read-only to
|
||||
read-write, and too little swap space is available for backing the
|
||||
copied pages,
|
||||
.Dv KERN_RESOURCE_SHORTAGE
|
||||
is returned.
|
||||
.Sh SEE ALSO
|
||||
.Xr vm_map 9
|
||||
.Sh AUTHORS
|
||||
|
@ -135,7 +135,7 @@ FreeBSD 4.0 | | | | | NetBSD 1.4.2 | |
|
||||
| FreeBSD 3.5.1 | | | | | | |
|
||||
| | | | | | | |
|
||||
*---FreeBSD 4.1 | | | | | | |
|
||||
| | | | (?) | | | |
|
||||
| | | | | | | | |
|
||||
| FreeBSD 4.1.1 | | / | | | |
|
||||
| | | | / | | | |
|
||||
| FreeBSD 4.2 Darwin/ | NetBSD 1.4.3 | |
|
||||
@ -399,6 +399,8 @@ FreeBSD 5.2 | | | |
|
||||
| | | NetBSD | |
|
||||
| | | 8.1 | DragonFly 5.6
|
||||
| | | | |
|
||||
| | | | DragonFly 5.6.1
|
||||
| | | | |
|
||||
FreeBSD 13 -current | NetBSD -current OpenBSD -current DragonFly -current
|
||||
| | | | |
|
||||
v v v v v
|
||||
@ -783,6 +785,7 @@ DragonFly 5.4.1 2018-12-24 [DFB]
|
||||
OpenBSD 6.5 2019-05-01 [OBD]
|
||||
NetBSD 8.1 2019-06-04 [NBD]
|
||||
DragonFly 5.6 2019-06-17 [DFB]
|
||||
DragonFly 5.6.1 2019-06-19 [DFB]
|
||||
|
||||
Bibliography
|
||||
------------------------
|
||||
|
@ -369,6 +369,10 @@ CFLAGS += -mfloat-abi=softfp
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe"
|
||||
LDFLAGS+= -Wl,--secure-plt
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} == "powerpcspe"
|
||||
CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
||||
.endif
|
||||
|
@ -104,7 +104,6 @@ LIBMLX4?= ${LIBDESTDIR}${LIBDIR_BASE}/libmlx4.a
|
||||
LIBMLX5?= ${LIBDESTDIR}${LIBDIR_BASE}/libmlx5.a
|
||||
LIBMP?= ${LIBDESTDIR}${LIBDIR_BASE}/libmp.a
|
||||
LIBMT?= ${LIBDESTDIR}${LIBDIR_BASE}/libmt.a
|
||||
LIBNANDFS?= ${LIBDESTDIR}${LIBDIR_BASE}/libnandfs.a
|
||||
LIBNCURSES?= ${LIBDESTDIR}${LIBDIR_BASE}/libncurses.a
|
||||
LIBNCURSESW?= ${LIBDESTDIR}${LIBDIR_BASE}/libncursesw.a
|
||||
LIBNETGRAPH?= ${LIBDESTDIR}${LIBDIR_BASE}/libnetgraph.a
|
||||
|
@ -135,7 +135,6 @@ _LIBRARIES= \
|
||||
memstat \
|
||||
mp \
|
||||
mt \
|
||||
nandfs \
|
||||
ncurses \
|
||||
ncursesw \
|
||||
netgraph \
|
||||
|
@ -206,7 +206,6 @@ __DEFAULT_NO_OPTIONS = \
|
||||
LOADER_FORCE_LE \
|
||||
LOADER_VERBOSE \
|
||||
LOADER_VERIEXEC_PASS_MANIFEST \
|
||||
NAND \
|
||||
OFED_EXTRA \
|
||||
OPENLDAP \
|
||||
RPCBIND_WARMSTART_SUPPORT \
|
||||
|
@ -59,9 +59,6 @@ struct fs_ops *file_system[] = {
|
||||
#if defined(LOADER_EXT2FS_SUPPORT)
|
||||
&ext2fs_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_NANDFS_SUPPORT)
|
||||
&nandfs_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_NFS_SUPPORT)
|
||||
&nfs_fsops,
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user