Merge ^/head r305087 through r305219.

This commit is contained in:
Dimitry Andric 2016-09-01 18:16:45 +00:00
commit 8f1f370da9
199 changed files with 3997 additions and 1064 deletions

View File

@ -109,7 +109,8 @@
# Note: we use this awkward construct to be compatible with FreeBSD's
# old make used in 10.0 and 9.2 and earlier.
.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && !make(showconfig)
.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
!make(showconfig) && !make(print-dir)
# targets/Makefile plays the role of top-level
.include "targets/Makefile"
.else
@ -132,7 +133,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
xdev-links native-xtools stageworld stagekernel stage-packages \
create-world-packages create-kernel-packages create-packages \
packages installconfig real-packages sign-packages package-pkg \
test-system-compiler
print-dir test-system-compiler
# XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
# It will only work for SUBDIR_TARGETS in make.conf.
@ -257,6 +258,10 @@ _TARGET_ARCH= ${XDEV_ARCH}
_TARGET?= ${MACHINE}
_TARGET_ARCH?= ${MACHINE_ARCH}
.if make(print-dir)
.SILENT:
.endif
#
# Make sure we have an up-to-date make(1). Only world and buildworld
# should do this as those are the initial targets used for upgrades.

View File

@ -166,6 +166,9 @@ main(int argc, char *argv[])
hflag = 0;
break;
case 'l':
/* Ignore duplicate -l */
if (lflag)
break;
if (vfslist != NULL)
xo_errx(1, "-l and -t are mutually exclusive.");
vfslist = makevfslist(makenetvfslist());

View File

@ -60,7 +60,6 @@
#include <sys/ddt.h>
#include <sys/zfeature.h>
#include <zfs_comutil.h>
#undef ZFS_MAXNAMELEN
#undef verify
#include <libzfs.h>
@ -1945,7 +1944,7 @@ dump_dir(objset_t *os)
uint64_t refdbytes, usedobjs, scratch;
char numbuf[32];
char blkbuf[BP_SPRINTF_LEN + 20];
char osname[MAXNAMELEN];
char osname[ZFS_MAX_DATASET_NAME_LEN];
char *type = "UNKNOWN";
int verbosity = dump_opt['d'];
int print_header = 1;
@ -3482,7 +3481,7 @@ find_zpool(char **target, nvlist_t **configp, int dirc, char **dirv)
nvlist_t *match = NULL;
char *name = NULL;
char *sepp = NULL;
char sep;
char sep = '\0';
int count = 0;
importargs_t args = { 0 };

View File

@ -21,8 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
@ -320,8 +319,8 @@ zfs_sort(const void *larg, const void *rarg, void *data)
} else if (psc->sc_prop == ZFS_PROP_NAME) {
lvalid = rvalid = B_TRUE;
(void) strlcpy(lbuf, zfs_get_name(l), sizeof(lbuf));
(void) strlcpy(rbuf, zfs_get_name(r), sizeof(rbuf));
(void) strlcpy(lbuf, zfs_get_name(l), sizeof (lbuf));
(void) strlcpy(rbuf, zfs_get_name(r), sizeof (rbuf));
lstr = lbuf;
rstr = rbuf;

View File

@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/

View File

@ -24,13 +24,12 @@
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
* Copyright 2016 Nexenta Systems, Inc.
*/
#include <assert.h>
@ -1511,7 +1510,7 @@ get_callback(zfs_handle_t *zhp, void *data)
char buf[ZFS_MAXPROPLEN];
char rbuf[ZFS_MAXPROPLEN];
zprop_source_t sourcetype;
char source[ZFS_MAXNAMELEN];
char source[ZFS_MAX_DATASET_NAME_LEN];
zprop_get_cbdata_t *cbp = data;
nvlist_t *user_props = zfs_get_user_props(zhp);
zprop_list_t *pl = cbp->cb_proplist;
@ -1991,7 +1990,7 @@ typedef struct upgrade_cbdata {
uint64_t cb_version;
boolean_t cb_newer;
boolean_t cb_foundone;
char cb_lastfs[ZFS_MAXNAMELEN];
char cb_lastfs[ZFS_MAX_DATASET_NAME_LEN];
} upgrade_cbdata_t;
static int
@ -2437,7 +2436,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
if (domain != NULL && domain[0] != '\0') {
/* SMB */
char sid[ZFS_MAXNAMELEN + 32];
char sid[MAXNAMELEN + 32];
uid_t id;
#ifdef illumos
int err;
@ -2574,7 +2573,7 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
size_t *width, us_node_t *node)
{
nvlist_t *nvl = node->usn_nvl;
char valstr[ZFS_MAXNAMELEN];
char valstr[MAXNAMELEN];
boolean_t first = B_TRUE;
int cfield = 0;
int field;
@ -3009,7 +3008,7 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
if (pl->pl_prop == ZFS_PROP_NAME) {
(void) strlcpy(property, zfs_get_name(zhp),
sizeof(property));
sizeof (property));
propstr = property;
right_justify = zfs_prop_align_right(pl->pl_prop);
} else if (pl->pl_prop != ZPROP_INVAL) {
@ -3473,7 +3472,7 @@ zfs_do_rollback(int argc, char **argv)
boolean_t force = B_FALSE;
rollback_cbdata_t cb = { 0 };
zfs_handle_t *zhp, *snap;
char parentname[ZFS_MAXNAMELEN];
char parentname[ZFS_MAX_DATASET_NAME_LEN];
char *delim;
/* check options */
@ -3873,7 +3872,7 @@ zfs_do_send(int argc, char **argv)
*/
if (strchr(argv[0], '@') == NULL ||
(fromname && strchr(fromname, '#') != NULL)) {
char frombuf[ZFS_MAXNAMELEN];
char frombuf[ZFS_MAX_DATASET_NAME_LEN];
enum lzc_send_flags lzc_flags = 0;
if (flags.replicate || flags.doall || flags.props ||
@ -3925,7 +3924,7 @@ zfs_do_send(int argc, char **argv)
* case if they specify the origin.
*/
if (fromname && (cp = strchr(fromname, '@')) != NULL) {
char origin[ZFS_MAXNAMELEN];
char origin[ZFS_MAX_DATASET_NAME_LEN];
zprop_source_t src;
(void) zfs_prop_get(zhp, ZFS_PROP_ORIGIN,
@ -4059,7 +4058,7 @@ zfs_do_receive(int argc, char **argv)
usage(B_FALSE);
}
char namebuf[ZFS_MAXNAMELEN];
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
(void) snprintf(namebuf, sizeof (namebuf),
"%s/%%recv", argv[0]);
@ -4917,7 +4916,7 @@ store_allow_perm(zfs_deleg_who_type_t type, boolean_t local, boolean_t descend,
{
int i;
char ld[2] = { '\0', '\0' };
char who_buf[ZFS_MAXNAMELEN+32];
char who_buf[MAXNAMELEN + 32];
char base_type = '\0';
char set_type = '\0';
nvlist_t *base_nvl = NULL;
@ -5285,7 +5284,7 @@ static void
print_fs_perms(fs_perm_set_t *fspset)
{
fs_perm_node_t *node = NULL;
char buf[ZFS_MAXNAMELEN+32];
char buf[MAXNAMELEN + 32];
const char *dsname = buf;
for (node = uu_list_first(fspset->fsps_list); node != NULL;
@ -5294,7 +5293,7 @@ print_fs_perms(fs_perm_set_t *fspset)
uu_avl_t *uge_avl = node->fspn_fsperm.fsp_uge_avl;
int left = 0;
(void) snprintf(buf, ZFS_MAXNAMELEN+32,
(void) snprintf(buf, sizeof (buf),
gettext("---- Permissions on %s "),
node->fspn_fsperm.fsp_name);
(void) printf(dsname);
@ -5491,7 +5490,7 @@ zfs_do_hold_rele_impl(int argc, char **argv, boolean_t holding)
for (i = 0; i < argc; ++i) {
zfs_handle_t *zhp;
char parent[ZFS_MAXNAMELEN];
char parent[ZFS_MAX_DATASET_NAME_LEN];
const char *delim;
char *path = argv[i];
@ -5624,7 +5623,7 @@ holds_callback(zfs_handle_t *zhp, void *data)
nvlist_t *nvl = NULL;
nvpair_t *nvp = NULL;
const char *zname = zfs_get_name(zhp);
size_t znamelen = strnlen(zname, ZFS_MAXNAMELEN);
size_t znamelen = strlen(zname);
if (cbp->cb_recursive && cbp->cb_snapname != NULL) {
const char *snapname;
@ -5645,7 +5644,7 @@ holds_callback(zfs_handle_t *zhp, void *data)
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) {
const char *tag = nvpair_name(nvp);
size_t taglen = strnlen(tag, MAXNAMELEN);
size_t taglen = strlen(tag);
if (taglen > cbp->cb_max_taglen)
cbp->cb_max_taglen = taglen;
}
@ -6484,6 +6483,15 @@ unshare_unmount(int op, int argc, char **argv)
continue;
}
/*
* Ignore datasets that are excluded/restricted by
* parent pool name.
*/
if (zpool_skip_pool(zfs_get_pool_name(zhp))) {
zfs_close(zhp);
continue;
}
switch (op) {
case OP_SHARE:
verify(zfs_prop_get(zhp, ZFS_PROP_SHARENFS,
@ -6973,7 +6981,7 @@ zfs_do_diff(int argc, char **argv)
static int
zfs_do_bookmark(int argc, char **argv)
{
char snapname[ZFS_MAXNAMELEN];
char snapname[ZFS_MAX_DATASET_NAME_LEN];
zfs_handle_t *zhp;
nvlist_t *nvl;
int ret = 0;

View File

@ -48,7 +48,6 @@
#include <sys/zio_compress.h>
#include <sys/zfeature.h>
#include <sys/dmu_tx.h>
#undef ZFS_MAXNAMELEN
#undef verify
#include <libzfs.h>

View File

@ -4540,7 +4540,7 @@ zpool_do_status(int argc, char **argv)
typedef struct upgrade_cbdata {
boolean_t cb_first;
boolean_t cb_unavail;
char cb_poolname[ZPOOL_MAXNAMELEN];
char cb_poolname[ZFS_MAX_DATASET_NAME_LEN];
int cb_argc;
uint64_t cb_version;
char **cb_argv;

View File

@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013, 2015 by Delphix. All rights reserved.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
*/
@ -597,7 +597,6 @@ get_replication(nvlist_t *nvroot, boolean_t fatal)
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
&top, &toplevels) == 0);
lastrep.zprl_type = NULL;
for (t = 0; t < toplevels; t++) {
uint64_t is_log = B_FALSE;

View File

@ -141,8 +141,8 @@ typedef struct ztest_shared_hdr {
static ztest_shared_hdr_t *ztest_shared_hdr;
typedef struct ztest_shared_opts {
char zo_pool[MAXNAMELEN];
char zo_dir[MAXNAMELEN];
char zo_pool[ZFS_MAX_DATASET_NAME_LEN];
char zo_dir[ZFS_MAX_DATASET_NAME_LEN];
char zo_alt_ztest[MAXNAMELEN];
char zo_alt_libpath[MAXNAMELEN];
uint64_t zo_vdevs;
@ -268,7 +268,7 @@ typedef struct ztest_od {
uint64_t od_crblocksize;
uint64_t od_gen;
uint64_t od_crgen;
char od_name[MAXNAMELEN];
char od_name[ZFS_MAX_DATASET_NAME_LEN];
} ztest_od_t;
/*
@ -280,7 +280,7 @@ typedef struct ztest_ds {
rwlock_t zd_zilog_lock;
zilog_t *zd_zilog;
ztest_od_t *zd_od; /* debugging aid */
char zd_name[MAXNAMELEN];
char zd_name[ZFS_MAX_DATASET_NAME_LEN];
mutex_t zd_dirobj_lock;
rll_t zd_object_lock[ZTEST_OBJECT_LOCKS];
rll_t zd_range_lock[ZTEST_RANGE_LOCKS];
@ -3227,7 +3227,7 @@ ztest_objset_destroy_cb(const char *name, void *arg)
static boolean_t
ztest_snapshot_create(char *osname, uint64_t id)
{
char snapname[MAXNAMELEN];
char snapname[ZFS_MAX_DATASET_NAME_LEN];
int error;
(void) snprintf(snapname, sizeof (snapname), "%llu", (u_longlong_t)id);
@ -3247,10 +3247,10 @@ ztest_snapshot_create(char *osname, uint64_t id)
static boolean_t
ztest_snapshot_destroy(char *osname, uint64_t id)
{
char snapname[MAXNAMELEN];
char snapname[ZFS_MAX_DATASET_NAME_LEN];
int error;
(void) snprintf(snapname, MAXNAMELEN, "%s@%llu", osname,
(void) snprintf(snapname, sizeof (snapname), "%s@%llu", osname,
(u_longlong_t)id);
error = dsl_destroy_snapshot(snapname, B_FALSE);
@ -3267,12 +3267,12 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
int iters;
int error;
objset_t *os, *os2;
char name[MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
zilog_t *zilog;
(void) rw_rdlock(&ztest_name_lock);
(void) snprintf(name, MAXNAMELEN, "%s/temp_%llu",
(void) snprintf(name, sizeof (name), "%s/temp_%llu",
ztest_opts.zo_pool, (u_longlong_t)id);
/*
@ -3378,18 +3378,23 @@ ztest_dmu_snapshot_create_destroy(ztest_ds_t *zd, uint64_t id)
void
ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
{
char snap1name[MAXNAMELEN];
char clone1name[MAXNAMELEN];
char snap2name[MAXNAMELEN];
char clone2name[MAXNAMELEN];
char snap3name[MAXNAMELEN];
char snap1name[ZFS_MAX_DATASET_NAME_LEN];
char clone1name[ZFS_MAX_DATASET_NAME_LEN];
char snap2name[ZFS_MAX_DATASET_NAME_LEN];
char clone2name[ZFS_MAX_DATASET_NAME_LEN];
char snap3name[ZFS_MAX_DATASET_NAME_LEN];
int error;
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
(void) snprintf(snap1name, sizeof (snap1name),
"%s@s1_%llu", osname, id);
(void) snprintf(clone1name, sizeof (clone1name),
"%s/c1_%llu", osname, id);
(void) snprintf(snap2name, sizeof (snap2name),
"%s@s2_%llu", clone1name, id);
(void) snprintf(clone2name, sizeof (clone2name),
"%s/c2_%llu", osname, id);
(void) snprintf(snap3name, sizeof (snap3name),
"%s@s3_%llu", clone1name, id);
error = dsl_destroy_head(clone2name);
if (error && error != ENOENT)
@ -3415,11 +3420,11 @@ void
ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
{
objset_t *os;
char snap1name[MAXNAMELEN];
char clone1name[MAXNAMELEN];
char snap2name[MAXNAMELEN];
char clone2name[MAXNAMELEN];
char snap3name[MAXNAMELEN];
char snap1name[ZFS_MAX_DATASET_NAME_LEN];
char clone1name[ZFS_MAX_DATASET_NAME_LEN];
char snap2name[ZFS_MAX_DATASET_NAME_LEN];
char clone2name[ZFS_MAX_DATASET_NAME_LEN];
char snap3name[ZFS_MAX_DATASET_NAME_LEN];
char *osname = zd->zd_name;
int error;
@ -3427,11 +3432,16 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
ztest_dsl_dataset_cleanup(osname, id);
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
(void) snprintf(snap1name, sizeof (snap1name),
"%s@s1_%llu", osname, id);
(void) snprintf(clone1name, sizeof (clone1name),
"%s/c1_%llu", osname, id);
(void) snprintf(snap2name, sizeof (snap2name),
"%s@s2_%llu", clone1name, id);
(void) snprintf(clone2name, sizeof (clone2name),
"%s/c2_%llu", osname, id);
(void) snprintf(snap3name, sizeof (snap3name),
"%s@s3_%llu", clone1name, id);
error = dmu_objset_snapshot_one(osname, strchr(snap1name, '@') + 1);
if (error && error != EEXIST) {
@ -4249,7 +4259,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
* 2050 entries we should see ptrtbl growth and leaf-block split.
*/
for (int i = 0; i < 2050; i++) {
char name[MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
uint64_t value = i;
dmu_tx_t *tx;
int error;
@ -4654,7 +4664,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
char fullname[100];
char clonename[100];
char tag[100];
char osname[MAXNAMELEN];
char osname[ZFS_MAX_DATASET_NAME_LEN];
nvlist_t *holds;
(void) rw_rdlock(&ztest_name_lock);
@ -5450,13 +5460,13 @@ ztest_thread(void *arg)
static void
ztest_dataset_name(char *dsname, char *pool, int d)
{
(void) snprintf(dsname, MAXNAMELEN, "%s/ds_%d", pool, d);
(void) snprintf(dsname, ZFS_MAX_DATASET_NAME_LEN, "%s/ds_%d", pool, d);
}
static void
ztest_dataset_destroy(int d)
{
char name[MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
ztest_dataset_name(name, ztest_opts.zo_pool, d);
@ -5505,7 +5515,7 @@ ztest_dataset_open(int d)
uint64_t committed_seq = ZTEST_GET_SHARED_DS(d)->zd_seq;
objset_t *os;
zilog_t *zilog;
char name[MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
int error;
ztest_dataset_name(name, ztest_opts.zo_pool, d);
@ -5728,8 +5738,8 @@ ztest_run(ztest_shared_t *zs)
* different name.
*/
if (ztest_random(2) == 0) {
char name[MAXNAMELEN];
(void) snprintf(name, MAXNAMELEN, "%s_import",
char name[ZFS_MAX_DATASET_NAME_LEN];
(void) snprintf(name, sizeof (name), "%s_import",
ztest_opts.zo_pool);
ztest_spa_import_export(ztest_opts.zo_pool, name);
ztest_spa_import_export(name, ztest_opts.zo_pool);
@ -6297,7 +6307,7 @@ main(int argc, char **argv)
if (spa_open(ztest_opts.zo_pool, &spa, FTAG) == 0) {
spa_close(spa, FTAG);
} else {
char tmpname[MAXNAMELEN];
char tmpname[ZFS_MAX_DATASET_NAME_LEN];
kernel_fini();
kernel_init(FREAD | FWRITE);
(void) snprintf(tmpname, sizeof (tmpname), "%s_tmp",

View File

@ -26,7 +26,7 @@
#include <solaris.h>
#include <inttypes.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <libintl.h>
#include <stdarg.h>
#include "libnvpair.h"
@ -1228,7 +1228,8 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
break;
}
case DATA_TYPE_BOOLEAN_VALUE: {
boolean_t val, val_arg;
int32_t val_arg;
boolean_t val;
/* scanf boolean_t from value and check for match */
sr = sscanf(value, "%"SCNi32, &val_arg);
@ -1239,7 +1240,8 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
break;
}
case DATA_TYPE_BOOLEAN_ARRAY: {
boolean_t *val_array, val_arg;
boolean_t *val_array;
int32_t val_arg;
/* check indexed value of array for match */
sr = sscanf(value, "%"SCNi32, &val_arg);

View File

@ -21,14 +21,13 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Nexenta Systems, Inc.
*/
#ifndef _LIBZFS_H
@ -52,8 +51,6 @@ extern "C" {
/*
* Miscellaneous ZFS constants
*/
#define ZFS_MAXNAMELEN MAXNAMELEN
#define ZPOOL_MAXNAMELEN MAXNAMELEN
#define ZFS_MAXPROPLEN MAXPATHLEN
#define ZPOOL_MAXPROPLEN MAXPATHLEN
@ -222,6 +219,7 @@ extern void zpool_free_handles(libzfs_handle_t *);
*/
typedef int (*zpool_iter_f)(zpool_handle_t *, void *);
extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
extern boolean_t zpool_skip_pool(const char *);
/*
* Functions to create and destroy pools
@ -412,6 +410,7 @@ extern void zfs_close(zfs_handle_t *);
extern zfs_type_t zfs_get_type(const zfs_handle_t *);
extern const char *zfs_get_name(const zfs_handle_t *);
extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);
extern const char *zfs_get_pool_name(const zfs_handle_t *);
/*
* Property management functions. Some functions are shared with the kernel,

View File

@ -24,9 +24,10 @@
* Use is subject to license terms.
*
* Portions Copyright 2007 Ramprakash Jelari
*
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2014, 2015 by Delphix. All rights reserved.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
#include <libintl.h>
@ -136,6 +137,9 @@ changelist_prefix(prop_changelist_t *clp)
case ZFS_PROP_SHARESMB:
(void) zfs_unshare_smb(cn->cn_handle, NULL);
break;
default:
break;
}
}
}
@ -293,7 +297,7 @@ void
changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
{
prop_changenode_t *cn;
char newname[ZFS_MAXNAMELEN];
char newname[ZFS_MAX_DATASET_NAME_LEN];
for (cn = uu_list_first(clp->cl_list); cn != NULL;
cn = uu_list_next(clp->cl_list, cn)) {

View File

@ -27,6 +27,7 @@
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2015 by Syneto S.R.L. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc.
*/
/*
@ -338,33 +339,47 @@ zpool_refresh_stats(zpool_handle_t *zhp, boolean_t *missing)
}
/*
* If the __ZFS_POOL_RESTRICT environment variable is set we only iterate over
* pools it lists.
* The following environment variables are undocumented
* and should be used for testing purposes only:
*
* This is an undocumented feature for use during testing only.
* __ZFS_POOL_EXCLUDE - don't iterate over the pools it lists
* __ZFS_POOL_RESTRICT - iterate only over the pools it lists
*
* This function returns B_TRUE if the pool should be skipped
* during iteration.
*/
static boolean_t
check_restricted(const char *poolname)
boolean_t
zpool_skip_pool(const char *poolname)
{
static boolean_t initialized = B_FALSE;
static char *restricted = NULL;
static const char *exclude = NULL;
static const char *restricted = NULL;
const char *cur, *end;
int len, namelen;
int len;
int namelen = strlen(poolname);
if (!initialized) {
initialized = B_TRUE;
exclude = getenv("__ZFS_POOL_EXCLUDE");
restricted = getenv("__ZFS_POOL_RESTRICT");
}
if (exclude != NULL) {
cur = exclude;
do {
end = strchr(cur, ' ');
len = (NULL == end) ? strlen(cur) : (end - cur);
if (len == namelen && 0 == strncmp(cur, poolname, len))
return (B_TRUE);
cur += (len + 1);
} while (NULL != end);
}
if (NULL == restricted)
return (B_FALSE);
cur = restricted;
namelen = strlen(poolname);
do {
end = strchr(cur, ' ');
len = (NULL == end) ? strlen(cur) : (end - cur);
@ -402,7 +417,7 @@ zpool_iter(libzfs_handle_t *hdl, zpool_iter_f func, void *data)
for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL;
cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) {
if (check_restricted(cn->cn_name))
if (zpool_skip_pool(cn->cn_name))
continue;
if (zpool_open_silent(hdl, cn->cn_name, &zhp) != 0) {
@ -440,7 +455,7 @@ zfs_iter_root(libzfs_handle_t *hdl, zfs_iter_f func, void *data)
for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL;
cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) {
if (check_restricted(cn->cn_name))
if (zpool_skip_pool(cn->cn_name))
continue;
if ((zhp = make_dataset_handle(hdl, cn->cn_name)) == NULL)

View File

@ -24,12 +24,12 @@
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright (c) 2013 Martin Matuska. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
#include <ctype.h>
@ -79,54 +79,17 @@ zfs_type_to_name(zfs_type_t type)
return (dgettext(TEXT_DOMAIN, "snapshot"));
case ZFS_TYPE_VOLUME:
return (dgettext(TEXT_DOMAIN, "volume"));
case ZFS_TYPE_POOL:
return (dgettext(TEXT_DOMAIN, "pool"));
case ZFS_TYPE_BOOKMARK:
return (dgettext(TEXT_DOMAIN, "bookmark"));
default:
assert(!"unhandled zfs_type_t");
}
return (NULL);
}
/*
* Given a path and mask of ZFS types, return a string describing this dataset.
* This is used when we fail to open a dataset and we cannot get an exact type.
* We guess what the type would have been based on the path and the mask of
* acceptable types.
*/
static const char *
path_to_str(const char *path, int types)
{
/*
* When given a single type, always report the exact type.
*/
if (types == ZFS_TYPE_SNAPSHOT)
return (dgettext(TEXT_DOMAIN, "snapshot"));
if (types == ZFS_TYPE_FILESYSTEM)
return (dgettext(TEXT_DOMAIN, "filesystem"));
if (types == ZFS_TYPE_VOLUME)
return (dgettext(TEXT_DOMAIN, "volume"));
/*
* The user is requesting more than one type of dataset. If this is the
* case, consult the path itself. If we're looking for a snapshot, and
* a '@' is found, then report it as "snapshot". Otherwise, remove the
* snapshot attribute and try again.
*/
if (types & ZFS_TYPE_SNAPSHOT) {
if (strchr(path, '@') != NULL)
return (dgettext(TEXT_DOMAIN, "snapshot"));
return (path_to_str(path, types & ~ZFS_TYPE_SNAPSHOT));
}
/*
* The user has requested either filesystems or volumes.
* We have no way of knowing a priori what type this would be, so always
* report it as "filesystem" or "volume", our two primitive types.
*/
if (types & ZFS_TYPE_FILESYSTEM)
return (dgettext(TEXT_DOMAIN, "filesystem"));
assert(types & ZFS_TYPE_VOLUME);
return (dgettext(TEXT_DOMAIN, "volume"));
}
/*
* Validate a ZFS path. This is used even before trying to open the dataset, to
* provide a more meaningful error message. We call zfs_error_aux() to
@ -188,6 +151,11 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"reserved disk name"));
break;
default:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"(%d) not defined"), why);
break;
}
}
@ -586,7 +554,7 @@ zfs_bookmark_exists(const char *path)
{
nvlist_t *bmarks;
nvlist_t *props;
char fsname[ZFS_MAXNAMELEN];
char fsname[ZFS_MAX_DATASET_NAME_LEN];
char *bmark_name;
char *pound;
int err;
@ -770,7 +738,8 @@ libzfs_mnttab_fini(libzfs_handle_t *hdl)
void *cookie = NULL;
mnttab_node_t *mtn;
while (mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie)) {
while ((mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie))
!= NULL) {
free(mtn->mtn_mt.mnt_special);
free(mtn->mtn_mt.mnt_mountp);
free(mtn->mtn_mt.mnt_fstype);
@ -842,7 +811,8 @@ libzfs_mnttab_remove(libzfs_handle_t *hdl, const char *fsname)
mnttab_node_t *ret;
find.mtn_mt.mnt_special = (char *)fsname;
if (ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL)) {
if ((ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL))
!= NULL) {
avl_remove(&hdl->libzfs_mnttab_cache, ret);
free(ret->mtn_mt.mnt_special);
free(ret->mtn_mt.mnt_mountp);
@ -1194,6 +1164,13 @@ badlabel:
"component of '%s' is too long"),
propname);
break;
default:
zfs_error_aux(hdl,
dgettext(TEXT_DOMAIN,
"(%d) not defined"),
why);
break;
}
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
@ -1312,12 +1289,17 @@ badlabel:
}
break;
case ZFS_PROP_UTF8ONLY:
chosen_utf = (int)intval;
break;
case ZFS_PROP_NORMALIZE:
chosen_normal = (int)intval;
break;
default:
break;
}
/*
@ -1366,6 +1348,9 @@ badlabel:
goto error;
}
break;
default:
break;
}
}
}
@ -1585,7 +1570,7 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
libzfs_handle_t *hdl = zhp->zfs_hdl;
nvlist_t *nvl;
int nvl_len;
int added_resv;
int added_resv = 0;
(void) snprintf(errbuf, sizeof (errbuf),
dgettext(TEXT_DOMAIN, "cannot set property for '%s'"),
@ -1975,6 +1960,9 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
mntopt_on = MNTOPT_NBMAND;
mntopt_off = MNTOPT_NONBMAND;
break;
default:
break;
}
/*
@ -2193,7 +2181,7 @@ struct get_clones_arg {
uint64_t numclones;
nvlist_t *value;
const char *origin;
char buf[ZFS_MAXNAMELEN];
char buf[ZFS_MAX_DATASET_NAME_LEN];
};
int
@ -2248,7 +2236,7 @@ zfs_get_clones_nvl(zfs_handle_t *zhp)
if (gca.numclones != 0) {
zfs_handle_t *root;
char pool[ZFS_MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
char *cp = pool;
/* get the pool name */
@ -2962,6 +2950,15 @@ zfs_get_name(const zfs_handle_t *zhp)
return (zhp->zfs_name);
}
/*
* Returns the name of the parent pool for the given zfs handle.
*/
const char *
zfs_get_pool_name(const zfs_handle_t *zhp)
{
return (zhp->zpool_hdl->zpool_name);
}
/*
* Returns the type of the given zfs handle.
*/
@ -3024,7 +3021,7 @@ check_parents(libzfs_handle_t *hdl, const char *path, uint64_t *zoned,
boolean_t accept_ancestor, int *prefixlen)
{
zfs_cmd_t zc = { 0 };
char parent[ZFS_MAXNAMELEN];
char parent[ZFS_MAX_DATASET_NAME_LEN];
char *slash;
zfs_handle_t *zhp;
char errbuf[1024];
@ -3152,7 +3149,7 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
* up to the prefixlen-long one.
*/
for (cp = target + prefixlen + 1;
cp = strchr(cp, '/'); *cp = '/', cp++) {
(cp = strchr(cp, '/')) != NULL; *cp = '/', cp++) {
*cp = '\0';
@ -3204,7 +3201,7 @@ zfs_create_ancestors(libzfs_handle_t *hdl, const char *path)
{
int prefix;
char *path_copy;
int rc;
int rc = 0;
if (check_parents(hdl, path, NULL, B_TRUE, &prefix) != 0)
return (-1);
@ -3263,7 +3260,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
ost = LZC_DATSET_TYPE_ZFS;
/* open zpool handle for prop validation */
char pool_path[MAXNAMELEN];
char pool_path[ZFS_MAX_DATASET_NAME_LEN];
(void) strlcpy(pool_path, path, sizeof (pool_path));
/* truncate pool_path at first slash */
@ -3332,7 +3329,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
/* check for failure */
if (ret != 0) {
char parent[ZFS_MAXNAMELEN];
char parent[ZFS_MAX_DATASET_NAME_LEN];
(void) parent_name(path, parent, sizeof (parent));
switch (errno) {
@ -3422,7 +3419,7 @@ static int
zfs_check_snap_cb(zfs_handle_t *zhp, void *arg)
{
struct destroydata *dd = arg;
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
int rv = 0;
(void) snprintf(name, sizeof (name),
@ -3467,12 +3464,14 @@ int
zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
{
int ret;
nvlist_t *errlist;
nvlist_t *errlist = NULL;
ret = lzc_destroy_snaps(snaps, defer, &errlist);
if (ret == 0)
if (ret == 0) {
nvlist_free(errlist);
return (0);
}
if (nvlist_empty(errlist)) {
char errbuf[1024];
@ -3500,6 +3499,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
}
}
nvlist_free(errlist);
return (ret);
}
@ -3509,7 +3509,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
int
zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
{
char parent[ZFS_MAXNAMELEN];
char parent[ZFS_MAX_DATASET_NAME_LEN];
int ret;
char errbuf[1024];
libzfs_handle_t *hdl = zhp->zfs_hdl;
@ -3639,7 +3639,7 @@ static int
zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
{
snapdata_t *sd = arg;
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
int rv = 0;
if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) == 0) {
@ -3688,7 +3688,7 @@ zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, nvlist_t *props)
* get pool handle for prop validation. assumes all snaps are in the
* same pool, as does lzc_snapshot (below).
*/
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
elem = nvlist_next_nvpair(snaps, NULL);
(void) strlcpy(pool, nvpair_name(elem), sizeof (pool));
pool[strcspn(pool, "/@")] = '\0';
@ -3742,7 +3742,7 @@ zfs_snapshot(libzfs_handle_t *hdl, const char *path, boolean_t recursive,
{
int ret;
snapdata_t sd = { 0 };
char fsname[ZFS_MAXNAMELEN];
char fsname[ZFS_MAX_DATASET_NAME_LEN];
char *cp;
zfs_handle_t *zhp;
char errbuf[1024];
@ -3843,7 +3843,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, boolean_t force)
rollback_data_t cb = { 0 };
int err;
boolean_t restore_resv = 0;
uint64_t old_volsize, new_volsize;
uint64_t old_volsize = 0, new_volsize;
zfs_prop_t resv_prop;
assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM ||
@ -3915,13 +3915,13 @@ int
zfs_rename(zfs_handle_t *zhp, const char *source, const char *target,
renameflags_t flags)
{
int ret;
int ret = 0;
zfs_cmd_t zc = { 0 };
char *delim;
prop_changelist_t *cl = NULL;
zfs_handle_t *zhrp = NULL;
char *parentname = NULL;
char parent[ZFS_MAXNAMELEN];
char parent[ZFS_MAX_DATASET_NAME_LEN];
char property[ZFS_MAXPROPLEN];
libzfs_handle_t *hdl = zhp->zfs_hdl;
char errbuf[1024];
@ -4060,6 +4060,7 @@ zfs_rename(zfs_handle_t *zhp, const char *source, const char *target,
"child dataset with inherited mountpoint is used "
"in a non-global zone"));
(void) zfs_error(hdl, EZFS_ZONED, errbuf);
ret = -1;
goto error;
}
@ -4434,7 +4435,7 @@ static int
zfs_hold_one(zfs_handle_t *zhp, void *arg)
{
struct holdarg *ha = arg;
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
int rv = 0;
(void) snprintf(name, sizeof (name),
@ -4553,7 +4554,7 @@ static int
zfs_release_one(zfs_handle_t *zhp, void *arg)
{
struct holdarg *ha = arg;
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
int rv = 0;
nvlist_t *existing_holds;
@ -4682,7 +4683,7 @@ tryagain:
zc.zc_nvlist_dst_size = nvsz;
zc.zc_nvlist_dst = (uintptr_t)nvbuf;
(void) strlcpy(zc.zc_name, zhp->zfs_name, ZFS_MAXNAMELEN);
(void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
if (ioctl(hdl->libzfs_fd, ZFS_IOC_GET_FSACL, &zc) != 0) {
(void) snprintf(errbuf, sizeof (errbuf),

View File

@ -22,7 +22,9 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2015 by Delphix. All rights reserved.
* Copyright 2016 Joyent, Inc.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
/*
@ -353,7 +355,7 @@ write_inuse_diffs(FILE *fp, differ_info_t *di, dmu_diff_record_t *dr)
int err;
for (o = dr->ddr_first; o <= dr->ddr_last; o++) {
if (err = write_inuse_diffs_one(fp, di, o))
if ((err = write_inuse_diffs_one(fp, di, o)) != 0)
return (err);
}
return (0);
@ -617,7 +619,7 @@ get_snapshot_names(differ_info_t *di, const char *fromsnap,
* not the same dataset name, might be okay if
* tosnap is a clone of a fromsnap descendant.
*/
char origin[ZFS_MAXNAMELEN];
char origin[ZFS_MAX_DATASET_NAME_LEN];
zprop_source_t src;
zfs_handle_t *zhp;

View File

@ -21,20 +21,19 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#ifndef _LIBZFS_IMPL_H
#define _LIBZFS_IMPL_H
#include <sys/dmu.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ioctl.h>
#include <sys/spa.h>
#include <sys/nvpair.h>
#include <sys/dmu.h>
#include <sys/zfs_ioctl.h>
#include <libshare.h>
#include <libuutil.h>
@ -87,7 +86,7 @@ struct libzfs_handle {
struct zfs_handle {
libzfs_handle_t *zfs_hdl;
zpool_handle_t *zpool_hdl;
char zfs_name[ZFS_MAXNAMELEN];
char zfs_name[ZFS_MAX_DATASET_NAME_LEN];
zfs_type_t zfs_type; /* type including snapshot */
zfs_type_t zfs_head_type; /* type excluding snapshot */
dmu_objset_stats_t zfs_dmustats;
@ -108,7 +107,7 @@ struct zfs_handle {
struct zpool_handle {
libzfs_handle_t *zpool_hdl;
zpool_handle_t *zpool_next;
char zpool_name[ZPOOL_MAXNAMELEN];
char zpool_name[ZFS_MAX_DATASET_NAME_LEN];
int zpool_state;
size_t zpool_config_size;
nvlist_t *zpool_config;

View File

@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
* Copyright 2015 RackTop Systems.
* Copyright 2016 Nexenta Systems, Inc.
*/
@ -440,12 +440,12 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
pool_entry_t *pe;
vdev_entry_t *ve;
config_entry_t *ce;
nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
nvlist_t *ret = NULL, *config = NULL, *tmp = NULL, *nvtop, *nvroot;
nvlist_t **spares, **l2cache;
uint_t i, nspares, nl2cache;
boolean_t config_seen;
uint64_t best_txg;
char *name, *hostname;
char *name, *hostname = NULL;
uint64_t guid;
uint_t children = 0;
nvlist_t **child = NULL;

View File

@ -22,8 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015 by Delphix. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
@ -198,7 +197,7 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zfs_iter_f func, void *data)
for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
char *bmark_name;
nvlist_t *bmark_props;
@ -386,7 +385,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
* exists.
*/
if (ssa.ssa_last[0] != '\0') {
char snapname[ZFS_MAXNAMELEN];
char snapname[ZFS_MAX_DATASET_NAME_LEN];
(void) snprintf(snapname, sizeof (snapname),
"%s@%s", zfs_get_name(fs_zhp),
ssa.ssa_last);
@ -406,7 +405,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *spec_orig,
ret = ENOENT;
}
} else {
char snapname[ZFS_MAXNAMELEN];
char snapname[ZFS_MAX_DATASET_NAME_LEN];
zfs_handle_t *snap_zhp;
(void) snprintf(snapname, sizeof (snapname), "%s@%s",
zfs_get_name(fs_zhp), comma_separated);

View File

@ -22,6 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014 by Delphix. All rights reserved.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
/*
@ -235,7 +236,7 @@ static boolean_t
zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
zprop_source_t *source)
{
char sourceloc[ZFS_MAXNAMELEN];
char sourceloc[MAXNAMELEN];
zprop_source_t sourcetype;
if (!zfs_prop_valid_for_type(ZFS_PROP_MOUNTPOINT, zhp->zfs_type))
@ -475,7 +476,8 @@ zfs_is_shared_proto(zfs_handle_t *zhp, char **where, zfs_share_proto_t proto)
if (!zfs_is_mounted(zhp, &mountpoint))
return (SHARED_NOT_SHARED);
if (rc = is_shared(zhp->zfs_hdl, mountpoint, proto)) {
if ((rc = is_shared(zhp->zfs_hdl, mountpoint, proto))
!= SHARED_NOT_SHARED) {
if (where != NULL)
*where = mountpoint;
else

View File

@ -24,6 +24,7 @@
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
#include <sys/types.h>
@ -199,6 +200,9 @@ zpool_state_to_name(vdev_state_t state, vdev_aux_t aux)
return (gettext("DEGRADED"));
case VDEV_STATE_HEALTHY:
return (gettext("ONLINE"));
default:
break;
}
return (gettext("UNKNOWN"));
@ -403,7 +407,7 @@ bootfs_name_valid(const char *pool, char *bootfs)
boolean_t
zpool_is_bootable(zpool_handle_t *zhp)
{
char bootfs[ZPOOL_MAXNAMELEN];
char bootfs[ZFS_MAX_DATASET_NAME_LEN];
return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
sizeof (bootfs), NULL, B_FALSE) == 0 && strncmp(bootfs, "-",
@ -635,6 +639,11 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
goto error;
}
break;
default:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"property '%s'(%d) not defined"), propname, prop);
break;
}
}
@ -943,6 +952,10 @@ zpool_name_valid(libzfs_handle_t *hdl, boolean_t isopen, const char *pool)
"multiple '@' delimiters in name"));
break;
default:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"(%d) not defined"), why);
break;
}
}
return (B_FALSE);
@ -1786,7 +1799,12 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
case EEXIST:
(void) zpool_standard_error(hdl, error, desc);
break;
case ENAMETOOLONG:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"new name of at least one dataset is longer than "
"the maximum allowable length"));
(void) zfs_error(hdl, EZFS_NAMETOOLONG, desc);
break;
default:
(void) zpool_standard_error(hdl, error, desc);
zpool_explain_recover(hdl,
@ -3785,7 +3803,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
zfs_cmd_t zc = { 0 };
boolean_t mounted = B_FALSE;
char *mntpnt = NULL;
char dsname[MAXNAMELEN];
char dsname[ZFS_MAX_DATASET_NAME_LEN];
if (dsobj == 0) {
/* special case for the MOS */
@ -4046,7 +4064,7 @@ zvol_check_dump_config(char *arg)
uint_t toplevels;
libzfs_handle_t *hdl;
char errbuf[1024];
char poolname[ZPOOL_MAXNAMELEN];
char poolname[ZFS_MAX_DATASET_NAME_LEN];
int pathlen = strlen(ZVOL_FULL_DEV_DIR);
int ret = 1;
@ -4069,7 +4087,7 @@ zvol_check_dump_config(char *arg)
"malformed dataset name"));
(void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf);
return (1);
} else if (p - volname >= ZFS_MAXNAMELEN) {
} else if (p - volname >= ZFS_MAX_DATASET_NAME_LEN) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"dataset name is too long"));
(void) zfs_error(hdl, EZFS_NAMETOOLONG, errbuf);

View File

@ -23,11 +23,11 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
* All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
#include <assert.h>
@ -580,13 +580,30 @@ fsavl_create(nvlist_t *fss)
* Routines for dealing with the giant nvlist of fs-nvlists, etc.
*/
typedef struct send_data {
/*
* assigned inside every recursive call,
* restored from *_save on return:
*
* guid of fromsnap snapshot in parent dataset
* txg of fromsnap snapshot in current dataset
* txg of tosnap snapshot in current dataset
*/
uint64_t parent_fromsnap_guid;
uint64_t fromsnap_txg;
uint64_t tosnap_txg;
/* the nvlists get accumulated during depth-first traversal */
nvlist_t *parent_snaps;
nvlist_t *fss;
nvlist_t *snapprops;
/* send-receive configuration, does not change during traversal */
const char *fsname;
const char *fromsnap;
const char *tosnap;
boolean_t recursive;
boolean_t verbose;
/*
* The header nvlist is of the following format:
@ -619,11 +636,23 @@ send_iterate_snap(zfs_handle_t *zhp, void *arg)
{
send_data_t *sd = arg;
uint64_t guid = zhp->zfs_dmustats.dds_guid;
uint64_t txg = zhp->zfs_dmustats.dds_creation_txg;
char *snapname;
nvlist_t *nv;
snapname = strrchr(zhp->zfs_name, '@')+1;
if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) {
if (sd->verbose) {
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
"skipping snapshot %s because it was created "
"after the destination snapshot (%s)\n"),
zhp->zfs_name, sd->tosnap);
}
zfs_close(zhp);
return (0);
}
VERIFY(0 == nvlist_add_uint64(sd->parent_snaps, snapname, guid));
/*
* NB: if there is no fromsnap here (it's a newly created fs in
@ -716,6 +745,31 @@ send_iterate_prop(zfs_handle_t *zhp, nvlist_t *nv)
}
}
/*
* returns snapshot creation txg
* and returns 0 if the snapshot does not exist
*/
static uint64_t
get_snap_txg(libzfs_handle_t *hdl, const char *fs, const char *snap)
{
char name[ZFS_MAX_DATASET_NAME_LEN];
uint64_t txg = 0;
if (fs == NULL || fs[0] == '\0' || snap == NULL || snap[0] == '\0')
return (txg);
(void) snprintf(name, sizeof (name), "%s@%s", fs, snap);
if (zfs_dataset_exists(hdl, name, ZFS_TYPE_SNAPSHOT)) {
zfs_handle_t *zhp = zfs_open(hdl, name, ZFS_TYPE_SNAPSHOT);
if (zhp != NULL) {
txg = zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG);
zfs_close(zhp);
}
}
return (txg);
}
/*
* recursively generate nvlists describing datasets. See comment
* for the data structure send_data_t above for description of contents
@ -728,9 +782,48 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg)
nvlist_t *nvfs, *nv;
int rv = 0;
uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid;
uint64_t fromsnap_txg_save = sd->fromsnap_txg;
uint64_t tosnap_txg_save = sd->tosnap_txg;
uint64_t txg = zhp->zfs_dmustats.dds_creation_txg;
uint64_t guid = zhp->zfs_dmustats.dds_guid;
uint64_t fromsnap_txg, tosnap_txg;
char guidstring[64];
fromsnap_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, sd->fromsnap);
if (fromsnap_txg != 0)
sd->fromsnap_txg = fromsnap_txg;
tosnap_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, sd->tosnap);
if (tosnap_txg != 0)
sd->tosnap_txg = tosnap_txg;
/*
* on the send side, if the current dataset does not have tosnap,
* perform two additional checks:
*
* - skip sending the current dataset if it was created later than
* the parent tosnap
* - return error if the current dataset was created earlier than
* the parent tosnap
*/
if (sd->tosnap != NULL && tosnap_txg == 0) {
if (sd->tosnap_txg != 0 && txg > sd->tosnap_txg) {
if (sd->verbose) {
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
"skipping dataset %s: snapshot %s does "
"not exist\n"), zhp->zfs_name, sd->tosnap);
}
} else {
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
"cannot send %s@%s%s: snapshot %s@%s does not "
"exist\n"), sd->fsname, sd->tosnap, sd->recursive ?
dgettext(TEXT_DOMAIN, " recursively") : "",
zhp->zfs_name, sd->tosnap);
rv = -1;
}
goto out;
}
VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0));
VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name));
VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap",
@ -739,8 +832,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg)
if (zhp->zfs_dmustats.dds_origin[0]) {
zfs_handle_t *origin = zfs_open(zhp->zfs_hdl,
zhp->zfs_dmustats.dds_origin, ZFS_TYPE_SNAPSHOT);
if (origin == NULL)
return (-1);
if (origin == NULL) {
rv = -1;
goto out;
}
VERIFY(0 == nvlist_add_uint64(nvfs, "origin",
origin->zfs_dmustats.dds_guid));
}
@ -771,7 +866,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg)
if (sd->recursive)
rv = zfs_iter_filesystems(zhp, send_iterate_fs, sd);
out:
sd->parent_fromsnap_guid = parent_fromsnap_guid_save;
sd->fromsnap_txg = fromsnap_txg_save;
sd->tosnap_txg = tosnap_txg_save;
zfs_close(zhp);
return (rv);
@ -779,7 +877,8 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg)
static int
gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap,
const char *tosnap, boolean_t recursive, nvlist_t **nvlp, avl_tree_t **avlp)
const char *tosnap, boolean_t recursive, boolean_t verbose,
nvlist_t **nvlp, avl_tree_t **avlp)
{
zfs_handle_t *zhp;
send_data_t sd = { 0 };
@ -790,9 +889,11 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap,
return (EZFS_BADTYPE);
VERIFY(0 == nvlist_alloc(&sd.fss, NV_UNIQUE_NAME, 0));
sd.fsname = fsname;
sd.fromsnap = fromsnap;
sd.tosnap = tosnap;
sd.recursive = recursive;
sd.verbose = verbose;
if ((error = send_iterate_fs(zhp, &sd)) != 0) {
nvlist_free(sd.fss);
@ -819,7 +920,7 @@ typedef struct send_dump_data {
/* these are all just the short snapname (the part after the @) */
const char *fromsnap;
const char *tosnap;
char prevsnap[ZFS_MAXNAMELEN];
char prevsnap[ZFS_MAX_DATASET_NAME_LEN];
uint64_t prevsnap_obj;
boolean_t seenfrom, seento, replicate, doall, fromorigin;
boolean_t verbose, dryrun, parsable, progress, embed_data, std_out;
@ -832,7 +933,7 @@ typedef struct send_dump_data {
snapfilter_cb_t *filter_cb;
void *filter_cb_arg;
nvlist_t *debugnv;
char holdtag[ZFS_MAXNAMELEN];
char holdtag[ZFS_MAX_DATASET_NAME_LEN];
int cleanup_fd;
uint64_t size;
} send_dump_data_t;
@ -1183,8 +1284,8 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
pa.pa_fd = sdd->outfd;
pa.pa_parsable = sdd->parsable;
if (err = pthread_create(&tid, NULL,
send_progress_thread, &pa)) {
if ((err = pthread_create(&tid, NULL,
send_progress_thread, &pa)) != 0) {
zfs_close(zhp);
return (err);
}
@ -1468,7 +1569,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
uint64_t resumeobj, resumeoff, toguid, fromguid, bytes;
zfs_handle_t *zhp;
int error = 0;
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
enum lzc_send_flags lzc_flags = 0;
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
@ -1662,7 +1763,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
if (flags->dedup && !flags->dryrun) {
featureflags |= (DMU_BACKUP_FEATURE_DEDUP |
DMU_BACKUP_FEATURE_DEDUPPROPS);
if (err = pipe(pipefd)) {
if ((err = pipe(pipefd)) != 0) {
zfs_error_aux(zhp->zfs_hdl, strerror(errno));
return (zfs_error(zhp->zfs_hdl, EZFS_PIPEFAILED,
errbuf));
@ -1670,7 +1771,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
dda.outputfd = outfd;
dda.inputfd = pipefd[1];
dda.dedup_hdl = zhp->zfs_hdl;
if (err = pthread_create(&tid, NULL, cksummer, &dda)) {
if ((err = pthread_create(&tid, NULL, cksummer, &dda)) != 0) {
(void) close(pipefd[0]);
(void) close(pipefd[1]);
zfs_error_aux(zhp->zfs_hdl, strerror(errno));
@ -1700,7 +1801,8 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
}
err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name,
fromsnap, tosnap, flags->replicate, &fss, &fsavl);
fromsnap, tosnap, flags->replicate, flags->verbose,
&fss, &fsavl);
if (err)
goto err_out;
VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss));
@ -2061,8 +2163,8 @@ recv_rename(libzfs_handle_t *hdl, const char *name, const char *tryname,
if (err != 0 && strncmp(name + baselen, "recv-", 5) != 0) {
seq++;
(void) snprintf(newname, ZFS_MAXNAMELEN, "%.*srecv-%u-%u",
baselen, name, getpid(), seq);
(void) snprintf(newname, ZFS_MAX_DATASET_NAME_LEN,
"%.*srecv-%u-%u", baselen, name, getpid(), seq);
(void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value));
if (flags->verbose) {
@ -2190,7 +2292,7 @@ static int
guid_to_name(libzfs_handle_t *hdl, const char *parent, uint64_t guid,
boolean_t bookmark_ok, char *name)
{
char pname[ZFS_MAXNAMELEN];
char pname[ZFS_MAX_DATASET_NAME_LEN];
guid_to_name_data_t gtnd;
gtnd.guid = guid;
@ -2245,7 +2347,7 @@ created_before(libzfs_handle_t *hdl, avl_tree_t *avl,
{
nvlist_t *nvfs;
char *fsname, *snapname;
char buf[ZFS_MAXNAMELEN];
char buf[ZFS_MAX_DATASET_NAME_LEN];
int rv;
zfs_handle_t *guid1hdl, *guid2hdl;
uint64_t create1, create2;
@ -2296,7 +2398,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
avl_tree_t *local_avl;
nvpair_t *fselem, *nextfselem;
char *fromsnap;
char newname[ZFS_MAXNAMELEN];
char newname[ZFS_MAX_DATASET_NAME_LEN];
char guidname[32];
int error;
boolean_t needagain, progress, recursive;
@ -2316,7 +2418,7 @@ again:
VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0));
if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL,
recursive, &local_nv, &local_avl)) != 0)
recursive, B_FALSE, &local_nv, &local_avl)) != 0)
return (error);
/*
@ -2415,7 +2517,7 @@ again:
/* check for delete */
if (found == NULL) {
char name[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
if (!flags->force)
continue;
@ -2455,8 +2557,8 @@ again:
/* check for different snapname */
if (strcmp(nvpair_name(snapelem),
stream_snapname) != 0) {
char name[ZFS_MAXNAMELEN];
char tryname[ZFS_MAXNAMELEN];
char name[ZFS_MAX_DATASET_NAME_LEN];
char tryname[ZFS_MAX_DATASET_NAME_LEN];
(void) snprintf(name, sizeof (name), "%s@%s",
fsname, nvpair_name(snapelem));
@ -2538,7 +2640,7 @@ again:
((flags->isprefix || strcmp(tofs, fsname) != 0) &&
(s1 != NULL) && (s2 != NULL) && strcmp(s1, s2) != 0)) {
nvlist_t *parent;
char tryname[ZFS_MAXNAMELEN];
char tryname[ZFS_MAX_DATASET_NAME_LEN];
parent = fsavl_find(local_avl,
stream_parent_fromsnap_guid, NULL);
@ -2606,8 +2708,8 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
char *fromsnap = NULL;
char *sendsnap = NULL;
char *cp;
char tofs[ZFS_MAXNAMELEN];
char sendfs[ZFS_MAXNAMELEN];
char tofs[ZFS_MAX_DATASET_NAME_LEN];
char sendfs[ZFS_MAX_DATASET_NAME_LEN];
char errbuf[1024];
dmu_replay_record_t drre;
int error;
@ -2691,7 +2793,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
nvlist_t *renamed = NULL;
nvpair_t *pair = NULL;
(void) strlcpy(tofs, destname, ZFS_MAXNAMELEN);
(void) strlcpy(tofs, destname, sizeof (tofs));
if (flags->isprefix) {
struct drr_begin *drrb = &drr->drr_u.drr_begin;
int i;
@ -2700,7 +2802,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
cp = strrchr(drrb->drr_toname, '/');
if (cp == NULL) {
(void) strlcat(tofs, "/",
ZFS_MAXNAMELEN);
sizeof (tofs));
i = 0;
} else {
i = (cp - drrb->drr_toname);
@ -2710,7 +2812,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
}
/* zfs_receive_one() will create_parents() */
(void) strlcat(tofs, &drrb->drr_toname[i],
ZFS_MAXNAMELEN);
sizeof (tofs));
*strchr(tofs, '@') = '\0';
}
@ -2752,7 +2854,7 @@ zfs_receive_package(libzfs_handle_t *hdl, int fd, const char *destname,
* zfs_receive_one().
*/
(void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname,
ZFS_MAXNAMELEN);
sizeof (sendfs));
if ((cp = strchr(sendfs, '@')) != NULL) {
*cp = '\0';
/*
@ -2866,7 +2968,7 @@ recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byteswap)
break;
case DRR_SPILL:
if (byteswap) {
drr->drr_u.drr_write.drr_length =
drr->drr_u.drr_spill.drr_length =
BSWAP_64(drr->drr_u.drr_spill.drr_length);
}
(void) recv_read(hdl, fd, buf,
@ -2902,7 +3004,7 @@ static void
recv_ecksum_set_aux(libzfs_handle_t *hdl, const char *target_snap,
boolean_t resumable)
{
char target_fs[ZFS_MAXNAMELEN];
char target_fs[ZFS_MAX_DATASET_NAME_LEN];
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"checksum mismatch or incomplete stream"));
@ -3105,7 +3207,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
if (flags->verbose)
(void) printf("found clone origin %s\n", zc.zc_string);
} else if (originsnap) {
(void) strncpy(zc.zc_string, originsnap, ZFS_MAXNAMELEN);
(void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string));
if (flags->verbose)
(void) printf("using provided clone origin %s\n",
zc.zc_string);
@ -3130,7 +3232,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
*cp = '\0';
if (cp &&
!zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) {
char suffix[ZFS_MAXNAMELEN];
char suffix[ZFS_MAX_DATASET_NAME_LEN];
(void) strcpy(suffix, strrchr(zc.zc_value, '/'));
if (guid_to_name(hdl, zc.zc_name, parent_snapguid,
B_FALSE, zc.zc_value) == 0) {
@ -3157,7 +3259,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
if ((flags->isprefix || (*(chopprefix = drrb->drr_toname +
strlen(sendfs)) != '\0' && *chopprefix != '@')) &&
!zfs_dataset_exists(hdl, zc.zc_name, ZFS_TYPE_DATASET)) {
char snap[ZFS_MAXNAMELEN];
char snap[ZFS_MAX_DATASET_NAME_LEN];
(void) strcpy(snap, strchr(zc.zc_value, '@'));
if (guid_to_name(hdl, zc.zc_name, drrb->drr_fromguid,
B_FALSE, zc.zc_value) == 0) {
@ -3380,7 +3482,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
*/
*cp = '\0';
if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE,
&local_nv, &local_avl) == 0) {
B_FALSE, &local_nv, &local_avl) == 0) {
*cp = '@';
fs = fsavl_find(local_avl, drrb->drr_toguid, NULL);
fsavl_destroy(local_avl);
@ -3607,7 +3709,7 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap,
}
if (DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo) == DMU_SUBSTREAM) {
char nonpackage_sendfs[ZFS_MAXNAMELEN];
char nonpackage_sendfs[ZFS_MAX_DATASET_NAME_LEN];
if (sendfs == NULL) {
/*
* We were not called from zfs_receive_package(). Get
@ -3615,7 +3717,8 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap,
*/
char *cp;
(void) strlcpy(nonpackage_sendfs,
drr.drr_u.drr_begin.drr_toname, ZFS_MAXNAMELEN);
drr.drr_u.drr_begin.drr_toname,
sizeof (nonpackage_sendfs));
if ((cp = strchr(nonpackage_sendfs, '@')) != NULL)
*cp = '\0';
sendfs = nonpackage_sendfs;

View File

@ -23,6 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
*/
/*
@ -1010,7 +1011,7 @@ zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
const char *source, const char *recvd_value)
{
int i;
const char *str;
const char *str = NULL;
char buf[128];
/*
@ -1062,6 +1063,10 @@ zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
case ZPROP_SRC_RECEIVED:
str = "received";
break;
default:
str = NULL;
assert(!"unhandled zprop_source_t");
}
break;

View File

@ -265,7 +265,7 @@ lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist)
nvpair_t *elem;
nvlist_t *args;
int error;
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
*errlist = NULL;
@ -317,7 +317,7 @@ lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist)
nvpair_t *elem;
nvlist_t *args;
int error;
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
/* determine the pool name */
elem = nvlist_next_nvpair(snaps, NULL);
@ -344,7 +344,7 @@ lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
nvlist_t *args;
nvlist_t *result;
int err;
char fs[MAXNAMELEN];
char fs[ZFS_MAX_DATASET_NAME_LEN];
char *atp;
/* determine the fs name */
@ -409,7 +409,7 @@ lzc_exists(const char *dataset)
int
lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
{
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
nvlist_t *args;
nvpair_t *elem;
int error;
@ -456,7 +456,7 @@ lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist)
int
lzc_release(nvlist_t *holds, nvlist_t **errlist)
{
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
nvpair_t *elem;
/* determine the pool name */
@ -743,7 +743,7 @@ lzc_bookmark(nvlist_t *bookmarks, nvlist_t **errlist)
{
nvpair_t *elem;
int error;
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
/* determine the pool name */
elem = nvlist_next_nvpair(bookmarks, NULL);
@ -805,7 +805,7 @@ lzc_destroy_bookmarks(nvlist_t *bmarks, nvlist_t **errlist)
{
nvpair_t *elem;
int error;
char pool[MAXNAMELEN];
char pool[ZFS_MAX_DATASET_NAME_LEN];
/* determine the pool name */
elem = nvlist_next_nvpair(bmarks, NULL);

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libkvm \
lib/libproc \
lib/libprocstat \
lib/librtld_db \
lib/libthr \
lib/libutil \

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libkvm \
lib/libproc \
lib/libprocstat \
lib/librt \
lib/librtld_db \
lib/libthr \

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libkvm \
lib/libproc \
lib/libprocstat \
lib/librtld_db \
lib/libthr \
lib/libutil \

View File

@ -0,0 +1,35 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
cddl/lib/libavl \
cddl/lib/libnvpair \
cddl/lib/libumem \
cddl/lib/libuutil \
cddl/lib/libzfs \
cddl/lib/libzfs_core \
gnu/lib/csu \
gnu/lib/libgcc \
include \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
lib/libc++ \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libdevdctl \
lib/libexpat \
lib/libgeom \
lib/libmd \
lib/libsbuf \
lib/libthr \
lib/libutil \
lib/libz \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -82,7 +82,7 @@ struct zpool_handle
{
libzfs_handle_t *zpool_hdl;
zpool_handle_t *zpool_next;
char zpool_name[ZPOOL_MAXNAMELEN];
char zpool_name[ZFS_MAX_DATASET_NAME_LEN];
int zpool_state;
size_t zpool_config_size;
nvlist_t *zpool_config;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $
* $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $
*/
/*
@ -2091,7 +2091,10 @@ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \
_ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \
_ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45)
_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) \
_ELF_DEFINE_RELOC(R_RISCV_RVC_LUI, 46) \
_ELF_DEFINE_RELOC(R_RISCV_GPREL_I, 47) \
_ELF_DEFINE_RELOC(R_RISCV_GPREL_S, 48)
#define _ELF_DEFINE_SPARC_RELOCATIONS() \
_ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \

View File

@ -38,7 +38,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $");
ELFTC_VCSID("$Id: archive.c 3490 2016-08-31 00:12:22Z emaste $");
#define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */
@ -440,6 +440,7 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
struct archive *a;
struct archive_entry *entry;
struct ar_obj *obj;
time_t timestamp;
int nr;
if ((a = archive_write_new()) == NULL)
@ -450,7 +451,9 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
/* Write the archive symbol table, even if it's empty. */
entry = archive_entry_new();
archive_entry_copy_pathname(entry, "/");
archive_entry_set_mtime(entry, time(NULL), 0);
if (elftc_timestamp(&timestamp) != 0)
err(EXIT_FAILURE, "elftc_timestamp");
archive_entry_set_mtime(entry, timestamp, 0);
archive_entry_set_size(entry, (ecp->s_cnt + 1) * sizeof(uint32_t) +
ecp->s_sn_sz);
AC(archive_write_header(a, entry));

View File

@ -36,7 +36,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $");
ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $");
static void append_data(struct section *s, const void *buf, size_t sz);
static char hex_digit(uint8_t n);
@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp, int ifd)
sec_index = 1;
sec_addr = entry = 0;
while (fgets(line, _LINE_BUFSZ, ifp) != NULL) {
sz = 0; /* Silence GCC 5.3 uninitialized variable warning */
sz = 0;
if (line[0] == '\r' || line[0] == '\n')
continue;
if (line[0] == '$' && line[1] == '$') {

View File

@ -34,7 +34,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $");
ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $");
/* Convert ELF object to Portable Executable (PE). */
void
@ -54,6 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
PE_Buffer *pb;
const char *name;
size_t indx;
time_t timestamp;
int elferr;
if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64)
@ -89,7 +90,9 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN;
break;
}
pch.ch_timestamp = (uint32_t) time(NULL);
if (elftc_timestamp(&timestamp) != 0)
err(EXIT_FAILURE, "elftc_timestamp");
pch.ch_timestamp = (uint32_t) timestamp;
if (pe_update_coff_header(pe, &pch) < 0)
err(EXIT_FAILURE, "pe_update_coff_header() failed");

View File

@ -50,7 +50,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $");
ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
@ -332,6 +332,8 @@ static const char *ei_abis[256] = {
"ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
"ELFOSABI_MODESTO", "ELFOSABI_OPENBSD",
[17] = "ELFOSABI_CLOUDABI",
[64] = "ELFOSABI_ARM_AEABI",
[97] = "ELFOSABI_ARM",
[255] = "ELFOSABI_STANDALONE"
};

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy $
.\" $Id: elf_flagdata.3 3479 2016-06-25 20:44:33Z jkoshy $
.\"
.Dd December 3, 2011
.Os
@ -208,16 +208,13 @@ was called without a program header being allocated.
.Xr elf 3 ,
.Xr elf32_newehdr 3 ,
.Xr elf32_newphdr 3 ,
.Xr elf32_newshdr 3 ,
.Xr elf64_newehdr 3 ,
.Xr elf64_newphdr 3 ,
.Xr elf64_newshdr 3 ,
.Xr elf_newdata 3 ,
.Xr elf_update 3 ,
.Xr gelf 3 ,
.Xr gelf_newehdr 3 ,
.Xr gelf_newphdr 3 ,
.Xr gelf_newshdr 3 ,
.Xr gelf_update_dyn 3 ,
.Xr gelf_update_move 3 ,
.Xr gelf_update_rel 3 ,

View File

@ -1,4 +1,4 @@
# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $
# $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $
TOP= ${.CURDIR}/..
@ -10,6 +10,7 @@ SRCS= elftc_bfdtarget.c \
elftc_reloc_type_str.c \
elftc_set_timestamps.c \
elftc_string_table.c \
elftc_timestamp.c \
elftc_version.c \
libelftc_bfdtarget.c \
libelftc_dem_arm.c \

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elftc_bfd_find_target.3 3348 2016-01-18 14:18:50Z emaste $
.\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $
.\"
.Dd November 30, 2011
.Os

View File

@ -545,6 +545,9 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type)
case 43: return "R_RISCV_ALIGN";
case 44: return "R_RISCV_RVC_BRANCH";
case 45: return "R_RISCV_RVC_JUMP";
case 46: return "R_RISCV_RVC_LUI";
case 47: return "R_RISCV_GPREL_I";
case 48: return "R_RISCV_GPREL_S";
}
break;
case EM_SPARC:

View File

@ -0,0 +1,79 @@
.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved.
.\"
.\" This documentation was written by Ed Maste under sponsorship of
.\" 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.
.\"
.\" $Id$
.\"
.Dd August 24, 2016
.Os
.Dt ELFTC_TIMESTAMP 3
.Sh NAME
.Nm elftc_timestamp
.Nd return the current or environment-provided timestamp
.Sh LIBRARY
.Lb libelftc
.Sh SYNOPSIS
.In libelftc.h
.Ft int
.Fo elftc_timestamp
.Fa "time_t *timestamp"
.Fc
.Sh DESCRIPTION
The
.Fn elftc_timestamp
function returns a timestamp supplied by the
.Ev SOURCE_DATE_EPOCH
environment variable, or the current time provided by
.Xr time 3
if the environment variable is not set.
.Pp
The
.Ar timestamp
argument specifies a pointer to the location where the timestamp will be
stored.
.Sh RETURN VALUE
Function
.Fn elftc_timestamp
returns 0 on success, and -1 in the event of an error.
.Sh ERRORS
The
.Fn elftc_timestamp
function may fail with the following errors:
.Bl -tag -width ".Bq Er ERANGE"
.It Bq Er EINVAL
.Ev SOURCE_DATE_EPOCH
contains invalid characters.
.It Bq Er ERANGE
.Ev SOURCE_DATE_EPOCH
specifies a negative value or a value that cannot be stored in a
time_t.
.El
The
.Fn elftc_timestamp
function may also fail for any of the reasons described in
.Xr strtoll 3 .
.Sh SEE ALSO
.Xr strtoll 3 ,
.Xr time 3

View File

@ -0,0 +1,55 @@
/*-
* Copyright (c) 2016 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Ed Maste under sponsorship
* of 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 <errno.h>
#include <stdlib.h>
#include <time.h>
#include <libelftc.h>
int
elftc_timestamp(time_t *timestamp)
{
long long source_date_epoch;
char *env, *eptr;
if ((env = getenv("SOURCE_DATE_EPOCH")) != NULL) {
errno = 0;
source_date_epoch = strtoll(env, &eptr, 10);
if (*eptr != '\0')
errno = EINVAL;
if (source_date_epoch < 0)
errno = ERANGE;
if (errno != 0)
return (-1);
*timestamp = source_date_epoch;
return (0);
}
*timestamp = time(NULL);
return (0);
}

View File

@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
* $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $
* $Id: libelftc.h 3489 2016-08-31 00:12:15Z emaste $
*/
#ifndef _LIBELFTC_H_
@ -91,6 +91,7 @@ int elftc_string_table_remove(Elftc_String_Table *_table,
const char *_string);
const char *elftc_string_table_to_string(Elftc_String_Table *_table,
size_t offset);
int elftc_timestamp(time_t *_timestamp);
const char *elftc_version(void);
#ifdef __cplusplus
}

View File

@ -30,7 +30,7 @@
#include "_libelftc.h"
ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3309 2016-01-10 09:10:51Z kaiwang27 $");
ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $");
struct _Elftc_Bfd_Target _libelftc_targets[] = {

View File

@ -36,7 +36,7 @@
#include "_libelftc.h"
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $");
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3480 2016-07-24 23:38:41Z emaste $");
/**
* @file cpp_demangle.c

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: readelf.1 3219 2015-05-24 23:42:34Z kaiwang27 $
.\" $Id: readelf.1 3486 2016-08-22 14:10:05Z emaste $
.\"
.Dd September 13, 2012
.Os
@ -43,12 +43,12 @@
.Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section
.Op Fl r | Fl -relocs
.Op Fl t | Fl -section-details
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
.Op Fl v | Fl -version
.Oo
.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
.Oc
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
.Op Fl A | Fl -arch-specific
.Op Fl D | Fl -use-dynamic
.Op Fl H | Fl -help

View File

@ -47,7 +47,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $");
ELFTC_VCSID("$Id: readelf.c 3484 2016-08-03 13:36:49Z emaste $");
/* Backwards compatability for older FreeBSD releases. */
#ifndef STB_GNU_UNIQUE
@ -440,6 +440,7 @@ elf_osabi(unsigned int abi)
case ELFOSABI_OPENVMS: return "OpenVMS";
case ELFOSABI_NSK: return "NSK";
case ELFOSABI_CLOUDABI: return "CloudABI";
case ELFOSABI_ARM_AEABI: return "ARM EABI";
case ELFOSABI_ARM: return "ARM";
case ELFOSABI_STANDALONE: return "StandAlone";
default:
@ -2787,6 +2788,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
const char *symname;
uint64_t symval;
int i, len;
uint32_t type;
uint8_t type2, type3;
if (s->link >= re->shnum)
return;
@ -2796,8 +2799,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
elftc_reloc_type_str(re->ehdr.e_machine, \
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
#define REL_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
elftc_reloc_type_str(re->ehdr.e_machine, \
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
elftc_reloc_type_str(re->ehdr.e_machine, type), \
(uintmax_t)symval, symname
printf("\nRelocation section (%s):\n", s->name);
if (re->ec == ELFCLASS32)
@ -2823,12 +2826,37 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
ELF64_R_TYPE(r.r_info));
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s\n", REL_CT32);
} else {
type = ELF64_R_TYPE(r.r_info);
if (re->ehdr.e_machine == EM_MIPS) {
type2 = (type >> 8) & 0xFF;
type3 = (type >> 16) & 0xFF;
type = type & 0xFF;
} else {
type2 = type3 = 0;
}
if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s\n", REL_CT64);
else
printf("%12.12jx %12.12jx %-19.19s"
" %16.16jx %s\n", REL_CT64);
if (re->ehdr.e_machine == EM_MIPS) {
if (re->options & RE_WW) {
printf("%32s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%32s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
} else {
printf("%24s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%24s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
}
}
}
}
@ -2843,6 +2871,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
const char *symname;
uint64_t symval;
int i, len;
uint32_t type;
uint8_t type2, type3;
if (s->link >= re->shnum)
return;
@ -2853,8 +2883,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
elftc_reloc_type_str(re->ehdr.e_machine, \
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
#define RELA_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
elftc_reloc_type_str(re->ehdr.e_machine, \
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
elftc_reloc_type_str(re->ehdr.e_machine, type), \
(uintmax_t)symval, symname
printf("\nRelocation section with addend (%s):\n", s->name);
if (re->ec == ELFCLASS32)
@ -2881,6 +2911,14 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s", RELA_CT32);
printf(" + %x\n", (uint32_t) r.r_addend);
} else {
type = ELF64_R_TYPE(r.r_info);
if (re->ehdr.e_machine == EM_MIPS) {
type2 = (type >> 8) & 0xFF;
type3 = (type >> 16) & 0xFF;
type = type & 0xFF;
} else {
type2 = type3 = 0;
}
if (re->options & RE_WW)
printf("%16.16jx %16.16jx %-24.24s"
" %16.16jx %s", RELA_CT64);
@ -2888,6 +2926,23 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
printf("%12.12jx %12.12jx %-19.19s"
" %16.16jx %s", RELA_CT64);
printf(" + %jx\n", (uintmax_t) r.r_addend);
if (re->ehdr.e_machine == EM_MIPS) {
if (re->options & RE_WW) {
printf("%32s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%32s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
} else {
printf("%24s: %s\n", "Type2",
elftc_reloc_type_str(EM_MIPS,
type2));
printf("%24s: %s\n", "Type3",
elftc_reloc_type_str(EM_MIPS,
type3));
}
}
}
}

View File

@ -0,0 +1,134 @@
/*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* In addition to the permissions in the GNU General Public License, the
* Free Software Foundation gives you unlimited permission to link the
* compiled version of this file with other programs, and to distribute
* those programs without any restriction coming from the use of this
* file. (The General Public License restrictions do apply in other
* respects; for example, they cover modification of the file, and
* distribution when not linked into another program.)
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* As a special exception, if you link this library with files
* compiled with GCC to produce an executable, this does not cause
* the resulting executable to be covered by the GNU General Public License.
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*/
/* %ecx */
#define bit_SSE3 (1 << 0)
#define bit_SSSE3 (1 << 9)
#define bit_CMPXCHG16B (1 << 13)
#define bit_SSE4_1 (1 << 19)
#define bit_SSE4_2 (1 << 20)
#define bit_POPCNT (1 << 23)
/* %edx */
#define bit_CMPXCHG8B (1 << 8)
#define bit_CMOV (1 << 15)
#define bit_MMX (1 << 23)
#define bit_FXSAVE (1 << 24)
#define bit_SSE (1 << 25)
#define bit_SSE2 (1 << 26)
/* Extended Features */
/* %ecx */
#define bit_LAHF_LM (1 << 0)
#define bit_SSE4a (1 << 6)
#define bit_SSE5 (1 << 11)
/* %edx */
#define bit_LM (1 << 29)
#define bit_3DNOWP (1 << 30)
#define bit_3DNOW (1 << 31)
#if defined(__i386__) && defined(__PIC__)
/* %ebx may be the PIC register. */
#define __cpuid(level, a, b, c, d) \
__asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
"cpuid\n\t" \
"xchg{l}\t{%%}ebx, %1\n\t" \
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
: "0" (level))
#else
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level))
#endif
/* Return highest supported input value for cpuid instruction. ext can
be either 0x0 or 0x8000000 to return highest supported value for
basic or extended cpuid information. Function returns 0 if cpuid
is not supported or whatever cpuid returns in eax register. If sig
pointer is non-null, then first four bytes of the signature
(as found in ebx register) are returned in location pointed by sig. */
static __inline unsigned int
__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
{
unsigned int __eax, __ebx, __ecx, __edx;
#ifndef __x86_64__
/* See if we can use cpuid. On AMD64 we always can. */
__asm__ ("pushf{l|d}\n\t"
"pushf{l|d}\n\t"
"pop{l}\t%0\n\t"
"mov{l}\t{%0, %1|%1, %0}\n\t"
"xor{l}\t{%2, %0|%0, %2}\n\t"
"push{l}\t%0\n\t"
"popf{l|d}\n\t"
"pushf{l|d}\n\t"
"pop{l}\t%0\n\t"
"popf{l|d}\n\t"
: "=&r" (__eax), "=&r" (__ebx)
: "i" (0x00200000));
if (!((__eax ^ __ebx) & 0x00200000))
return 0;
#endif
/* Host supports cpuid. Return highest supported cpuid input value. */
__cpuid (__ext, __eax, __ebx, __ecx, __edx);
if (__sig)
*__sig = __ebx;
return __eax;
}
/* Return cpuid data for requested cpuid level, as found in returned
eax, ebx, ecx and edx registers. The function checks if cpuid is
supported and returns 1 for valid cpuid information or 0 for
unsupported cpuid level. All pointers are required to be non-null. */
static __inline int
__get_cpuid (unsigned int __level,
unsigned int *__eax, unsigned int *__ebx,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __level & 0x80000000;
if (__get_cpuid_max (__ext, 0) < __level)
return 0;
__cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
return 1;
}

View File

@ -56,6 +56,9 @@ unsigned AArch64InstrInfo::GetInstSizeInBytes(const MachineInstr &MI) const {
case TargetOpcode::IMPLICIT_DEF:
case TargetOpcode::KILL:
return 0;
case AArch64::TLSDESC_CALLSEQ:
// This gets lowered to an instruction sequence which takes 16 bytes
return 16;
}
llvm_unreachable("GetInstSizeInBytes()- Unable to determin insn size");

View File

@ -95,6 +95,10 @@ CXXFLAGS+= -std=c++11
.endif
CXXFLAGS+= -fno-rtti
STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC
.if ${MK_DIRDEPS_BUILD} == "yes"
# Avoid dependency on lib/libc++
CFLAGS+= -I${SRCTOP}/contrib/libc++/include
.endif
.else # MK_LLVM_LIBUNWIND

View File

@ -28,6 +28,18 @@
.include <src.opts.mk>
.include <bsd.init.mk>
# Store the toolchain executable in ATF_BUILD_{CC,CPP,CXX} to ensure other
# values -- like -target, -B ..., etc -- don't get leaked into the tests.
#
# Be sure to omit ${CCACHE_BIN} (if specified) from the variable as it gets
# automatically appended to the variables in bsd.compiler.mk when
# ${MK_CCACHE_BUILD} != no.
ATF_BUILD_CC:= ${CC:N${CCACHE_BIN}:[1]}
ATF_BUILD_CPP:= ${CPP:N${CCACHE_BIN}:[1]}
ATF_BUILD_CXX:= ${CXX:N${CCACHE_BIN}:[1]}
# Only capture defines, includes, linker flags, optimization levels, warnings
# and preprocessor flags when building ATF_BUILD_{C,CPP,CXX}FLAGS.
ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*}
ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*}
ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*}
@ -41,11 +53,11 @@ ATF= ${SRCTOP}/contrib/atf
.PATH: ${ATF}/atf-c
.PATH: ${ATF}/atf-c/detail
CFLAGS+= -DATF_BUILD_CC='"${CC}"'
CFLAGS+= -DATF_BUILD_CC='"${ATF_BUILD_CC}"'
CFLAGS+= -DATF_BUILD_CFLAGS='"${ATF_BUILD_CFLAGS}"'
CFLAGS+= -DATF_BUILD_CPP='"${CPP}"'
CFLAGS+= -DATF_BUILD_CPP='"${ATF_BUILD_CPP}"'
CFLAGS+= -DATF_BUILD_CPPFLAGS='"${ATF_BUILD_CPPFLAGS}"'
CFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
CFLAGS+= -DATF_BUILD_CXX='"${ATF_BUILD_CXX}"'
CFLAGS+= -DATF_BUILD_CXXFLAGS='"${ATF_BUILD_CXXFLAGS}"'
CFLAGS+= -I${ATF}
CFLAGS+= -I${.CURDIR}

View File

@ -28,7 +28,7 @@
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd February 19, 2016
.Dd August 31, 2016
.Dt DIRECTORY 3
.Os
.Sh NAME
@ -68,6 +68,15 @@
.Ft int
.Fn dirfd "DIR *dirp"
.Sh DESCRIPTION
.Bf -symbolic
The
.Fn readdir_r
interface is deprecated
because it cannot be used correctly unless
.Brq Va NAME_MAX
is a fixed value.
.Ef
.Pp
The
.Fn opendir
function
@ -122,7 +131,13 @@ The
.Fn readdir
function
returns a pointer to the next directory entry.
It returns
The directory entry remains valid until the next call to
.Fn readdir
or
.Fn closedir
on the same
.Em directory stream .
The function returns
.Dv NULL
upon reaching the end of the directory or on error.
In the event of an error,
@ -139,6 +154,13 @@ provides the same functionality as
but the caller must provide a directory
.Fa entry
buffer to store the results in.
The buffer must be large enough for a
.Vt struct dirent
with a
.Va d_name
array with
.Brq Va NAME_MAX
+ 1 elements.
If the read succeeds,
.Fa result
is pointed at the

View File

@ -28,7 +28,7 @@
.\" @(#)kvm_getvfsbyname.3 8.3 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd April 5, 2007
.Dd August 30, 2016
.Dt GETVFSBYNAME 3
.Os
.Sh NAME
@ -97,11 +97,6 @@ sysctl is set to
.Sh ERRORS
The following errors may be reported:
.Bl -tag -width Er
.It Bq Er EFAULT
The
.Fa vfc
argument
points to an invalid address.
.It Bq Er ENOENT
The
.Fa name

View File

@ -949,7 +949,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
while (r < addrlen * 8) {
while ((r & 0x80) == 0) {
match++;
r <<= 1;
}

View File

@ -185,6 +185,7 @@ struct hp_order {
#define aio_sa aio_un.aiou_sa
int aio_matchlen;
char *aio_h_addr;
int aio_initial_sequence;
};
static struct hostent *_hpcopy(struct hostent *, int *);
@ -711,6 +712,7 @@ _hpreorder(struct hostent *hp)
aio[i].aio_dstscope = gai_addr2scopetype(sa);
aio[i].aio_dstpolicy = match_addrselectpolicy(sa, &policyhead);
set_source(&aio[i], &policyhead);
aio[i].aio_initial_sequence = i;
}
/* perform sorting. */
@ -928,7 +930,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
while (r < addrlen * 8) {
while ((r & 0x80) == 0) {
match++;
r <<= 1;
}
@ -1045,6 +1047,23 @@ comp_dst(const void *arg1, const void *arg2)
}
/* Rule 10: Otherwise, leave the order unchanged. */
/*
* Note that qsort is unstable; so, we can't return zero and
* expect the order to be unchanged.
* That also means we can't depend on the current position of
* dst2 being after dst1. We must enforce the initial order
* with an explicit compare on the original position.
* The qsort specification requires that "When the same objects
* (consisting of width bytes, irrespective of their current
* positions in the array) are passed more than once to the
* comparison function, the results shall be consistent with one
* another."
* In other words, If A < B, then we must also return B > A.
*/
if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
return(1);
return(-1);
}

View File

@ -84,9 +84,10 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, int *nread, locale_t locale)
return (WEOF);
do {
nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs);
if (nconv == (size_t)-1)
break;
else if (nconv == (size_t)-2)
if (nconv == (size_t)-1) {
fp->_flags |= __SERR;
return (WEOF);
} else if (nconv == (size_t)-2)
continue;
else if (nconv == 0) {
fp->_p++;
@ -100,7 +101,9 @@ __fgetwc_mbs(FILE *fp, mbstate_t *mbs, int *nread, locale_t locale)
return (wc);
}
} while (__srefill(fp) == 0);
fp->_flags |= __SERR;
errno = EILSEQ;
if (__sfeof(fp)) {
fp->_flags |= __SERR;
errno = EILSEQ;
}
return (WEOF);
}

View File

@ -11,9 +11,10 @@ DIRDEPS = \
lib/atf/libatf-c++ \
lib/libc \
lib/libc++ \
lib/libthr \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libnetbsd \
lib/libthr \
lib/libutil \
lib/msun \

View File

@ -16,6 +16,7 @@ SRCS= elftc_bfdtarget.c \
elftc_reloc_type_str.c \
elftc_set_timestamps.c \
elftc_string_table.c \
elftc_timestamp.c \
elftc_version.c \
libelftc_bfdtarget.c \
libelftc_dem_arm.c \

View File

@ -6,5 +6,5 @@
const char *
elftc_version(void)
{
return "elftoolchain r3477M";
return "elftoolchain r3490M";
}

View File

@ -12,6 +12,7 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libprocstat \
lib/librtld_db \
lib/libutil \

View File

@ -13,7 +13,9 @@ DIRDEPS = \
lib/libcompiler_rt \
lib/libcxxrt \
lib/libelf \
lib/libkvm \
lib/libproc \
lib/libprocstat \
lib/librtld_db \
lib/libutil \
lib/libz \

View File

@ -10,6 +10,7 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libelf \
lib/libprocstat \
lib/libutil \

View File

@ -411,6 +411,10 @@ vend_rfc1048(cp, len)
bcopy(cp, &dhcp_serverip.s_addr,
sizeof(dhcp_serverip.s_addr));
}
if (tag == TAG_TFTP_SERVER) {
bcopy(cp, &tftpip.s_addr,
sizeof(tftpip.s_addr));
}
#endif
cp += size;
}

View File

@ -106,6 +106,7 @@ struct bootp {
#define TAG_T2 ((unsigned char) 59)
#define TAG_CLASSID ((unsigned char) 60)
#define TAG_CLIENTID ((unsigned char) 61)
#define TAG_TFTP_SERVER ((unsigned char) 150)
#endif
#define TAG_END ((unsigned char) 255)

View File

@ -25,12 +25,14 @@ char hostname[FNAME_SIZE]; /* our hostname */
int hostnamelen;
char domainname[FNAME_SIZE]; /* our DNS domain */
int domainnamelen;
int netproto = NET_NONE; /* Network prototol */
char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */
struct in_addr myip; /* my ip address */
struct in_addr nameip; /* DNS server ip address */
struct in_addr rootip; /* root ip address */
struct in_addr swapip; /* swap ip address */
struct in_addr gateip; /* gateway ip address */
struct in_addr tftpip; /* TFTP ip address */
n_long netmask = 0xffffff00; /* subnet or net mask */
u_int intf_mtu; /* interface mtu from bootp/dhcp */
int errno; /* our old friend */

View File

@ -36,6 +36,8 @@
* $FreeBSD$
*/
#ifndef _STAND_NET_H
#define _STAND_NET_H
#ifndef _KERNEL /* XXX - see <netinet/in.h> */
#undef __IPADDR
#define __IPADDR(x) htonl((u_int32_t)(x))
@ -45,6 +47,12 @@
#define BA { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
enum net_proto {
NET_NONE,
NET_NFS,
NET_TFTP
};
/* Returns true if n_long's on the same net */
#define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m))
@ -74,6 +82,7 @@ extern char hostname[FNAME_SIZE];
extern int hostnamelen;
extern char domainname[FNAME_SIZE];
extern int domainnamelen;
extern int netproto;
extern char ifname[IFNAME_SIZE];
/* All of these are in network order. */
@ -82,6 +91,7 @@ extern struct in_addr rootip;
extern struct in_addr swapip;
extern struct in_addr gateip;
extern struct in_addr nameip;
extern struct in_addr tftpip;
extern n_long netmask;
extern u_int intf_mtu;
@ -120,3 +130,4 @@ n_long inet_addr(char *);
/* Machine-dependent functions: */
time_t getsecs(void);
#endif

View File

@ -458,6 +458,9 @@ nfs_open(const char *upath, struct open_file *f)
int error;
char *path;
if (netproto != NET_NFS)
return (EINVAL);
#ifdef NFS_DEBUG
if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
@ -1100,6 +1103,9 @@ nfs_open(const char *upath, struct open_file *f)
int error;
char *path;
if (netproto != NET_NFS)
return (EINVAL);
#ifdef NFS_DEBUG
if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);

View File

@ -200,7 +200,7 @@ recvtftp(struct tftp_handle *h, void *pkt, ssize_t len, time_t tleft,
case DATA: {
int got;
if (htons(t->th_block) != d->xid) {
if (htons(t->th_block) != (u_short) d->xid) {
/*
* Expected block?
*/
@ -402,6 +402,9 @@ tftp_open(const char *path, struct open_file *f)
size_t pathsize;
const char *extraslash;
if (netproto != NET_TFTP)
return (EINVAL);
if (strcmp(f->f_dev->dv_name, "net") != 0) {
#ifdef __i386__
if (strcmp(f->f_dev->dv_name, "pxe") != 0)
@ -560,7 +563,7 @@ tftp_stat(struct open_file *f, struct stat *sb)
sb->st_nlink = 1;
sb->st_uid = 0;
sb->st_gid = 0;
sb->st_size = -1;
sb->st_size = (off_t) tftpfile->tftp_tsize;
return (0);
}
@ -731,6 +734,8 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len)
} else if (strcasecmp(tftp_options[i], "tsize") == 0) {
if (i + 1 < option_idx)
tsize = strtol(tftp_options[i + 1], (char **)NULL, 10);
if (tsize != 0)
h->tftp_tsize = tsize;
} else {
/* Do not allow any options we did not expect to be ACKed. */
printf("unexpected tftp option '%s'\n", tftp_options[i]);

View File

@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
lib/msun \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -0,0 +1,18 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
gnu/lib/csu \
gnu/lib/libgcc \
include \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
libexec/rtld-elf/tests/libpythagoras \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -9,8 +9,6 @@ DIRDEPS = \
include/gssapi \
include/rpc \
include/xlocale \
kerberos5/lib/libasn1 \
kerberos5/lib/libkrb5 \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \

View File

@ -339,7 +339,7 @@ FreeBSD 5.2 | | | |
| FreeBSD | | OpenBSD 5.9 |
| 10.3 | | | |
| | | | DragonFly 4.6.0
*--FreeBSD | | | |
*--FreeBSD | | OpenBSD 6.0 |
| 11.0 | | | |
| | | | |
| | | | |
@ -692,6 +692,7 @@ DragonFly 4.4.1 2015-12-07 [DFB]
OpenBSD 5.9 2016-03-29 [OBD]
FreeBSD 10.3 2016-04-04 [FBD]
DragonFly 4.6.0 2016-08-02 [DFB]
OpenBSD 6.0 2016-09-01 [OBD]
Bibliography
------------------------

View File

@ -82,9 +82,9 @@ _meta_filemon= 1
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used.
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
${.TARGETS:M*install*} == ${.TARGETS} || \
make(analyze) || defined(_meta_filemon)
make(analyze) || defined(_meta_filemon) || make(print-dir)
_SKIP_READ_DEPEND= 1
.if ${MK_DIRDEPS_BUILD} == "no"
.if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir)
.MAKE.DEPENDFILE= /dev/null
.endif
.endif
@ -181,7 +181,7 @@ DEPEND_CFLAGS+= -MT${.TARGET}
.if defined(.PARSEDIR)
# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
# as those are the only ones we will include.
DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:M${.TARGET:${DEPEND_FILTER}}}" != ""
DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:${DEPEND_FILTER}:M${.TARGET:${DEPEND_FILTER}}}" != ""
CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
.else
CFLAGS+= ${DEPEND_CFLAGS}
@ -198,7 +198,7 @@ CFLAGS+= ${DEPEND_CFLAGS}
.endif # !defined(_meta_filemon)
.endif # defined(SRCS)
.if ${MK_DIRDEPS_BUILD} == "yes"
.if ${MK_DIRDEPS_BUILD} == "yes" && !make(analyze) && !make(print-dir)
# Prevent meta.autodep.mk from tracking "local dependencies".
.depend:
.include <meta.autodep.mk>
@ -216,8 +216,17 @@ afterdepend: beforedepend
# For meta+filemon the .meta file is checked for since it is the dependency
# file used.
.for __obj in ${DEPENDOBJS:O:u}
.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
(!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}))
# If the obj has any '/', then replace with '_'. For meta files, this is
# mimicing what bmake's meta_name() does and adding in the full path
# as well to ensure that the expected meta file is read.
.if ${__obj:M*/*}
_meta_obj= ${.OBJDIR:C,/,_,g}_${__obj:C,/,_,g}.meta
.else
_meta_obj= ${__obj}.meta
.endif
_dep_obj= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}}
.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${_meta_obj})) || \
(!defined(_meta_filemon) && !exists(${.OBJDIR}/${_dep_obj}))
${__obj}: ${OBJS_DEPEND_GUESS}
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
.elif defined(_meta_filemon)

View File

@ -31,7 +31,7 @@ _SKIP_BUILD = not building at level 0
.if ${MK_META_MODE} == "yes"
.if !exists(/dev/filemon) && \
${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
!make(showconfig) && ${.MAKEFLAGS:M-V} == ""
!make(showconfig) && !make(print-dir) && ${.MAKEFLAGS:M-V} == ""
.warning The filemon module (/dev/filemon) is not loaded.
.warning META_MODE is less useful for incremental builds without filemon.
.warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.

View File

@ -51,6 +51,30 @@ CANONICALOBJDIR= ${.OBJDIR}
# but this makefile does not want it!
.OBJDIR: ${.CURDIR}
.endif
# Handle special case where SRCS is full-pathed and requires
# nested objdirs. This duplicates some auto.obj.mk logic.
.if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \
(${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "")
_wantdirs= ${SRCS:M*/*:H} ${DPSRCS:M*/*:H}
.if !empty(_wantdirs)
_wantdirs:= ${_wantdirs:O:u}
_needdirs=
.for _dir in ${_wantdirs}
.if !exists(${.OBJDIR}/${_dir}/)
_needdirs+= ${_dir}
.endif
.endfor
.endif
.if !empty(_needdirs)
#_mkneededdirs!= umask ${OBJDIR_UMASK:U002}; ${Mkdirs} ${_needdirs}
__objdir_made != umask ${OBJDIR_UMASK:U002}; ${Mkdirs}; \
for dir in ${_needdirs}; do \
dir=${.OBJDIR}/$${dir}; \
${ECHO_TRACE} "[Creating nested objdir $${dir}...]" >&2; \
Mkdirs $${dir}; \
done
.endif
.endif # !empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)
.elif defined(MAKEOBJDIRPREFIX)
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != ""

View File

@ -42,15 +42,15 @@ SUBDIR_TARGETS+= \
all all-man analyze buildconfig buildfiles buildincludes \
checkdpadd clean cleandepend cleandir cleanilinks \
cleanobj depend distribute files includes installconfig \
installfiles installincludes realinstall lint maninstall \
manlint obj objlink tags \
installfiles installincludes print-dir realinstall lint \
maninstall manlint obj objlink tags \
# Described above.
STANDALONE_SUBDIR_TARGETS+= \
all-man buildconfig buildfiles buildincludes check checkdpadd \
clean cleandepend cleandir cleanilinks cleanobj files includes \
installconfig installincludes installfiles maninstall manlint \
obj objlink \
installconfig installincludes installfiles print-dir \
maninstall manlint obj objlink
# It is safe to install in parallel when staging.
.if defined(NO_ROOT)
@ -59,6 +59,16 @@ STANDALONE_SUBDIR_TARGETS+= realinstall
.include <bsd.init.mk>
.if make(print-dir)
NEED_SUBDIR= 1
ECHODIR= :
.SILENT:
.if ${RELDIR:U.} != "."
print-dir: .PHONY
@echo ${RELDIR}
.endif
.endif
.if !defined(NEED_SUBDIR)
.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
.include <meta.subdir.mk>

View File

@ -214,7 +214,8 @@ CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
.if !empty(TIME_STAMP)
TRACER= ${TIME_STAMP} ${:U}
.endif
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH)
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
!make(print-dir)
WITH_META_STATS= t
.endif

View File

@ -97,7 +97,7 @@ META_MODE?= normal
# This needs to be done early - before .PATH is computed
# Don't do this for 'make showconfig' as it enables all options where meta mode
# is not expected.
.if !make(showconfig)
.if !make(showconfig) && !make(print-dir)
.sinclude <auto.obj.mk>
.endif
.endif

View File

@ -5843,6 +5843,14 @@ safe_to_clear_referenced(pmap_t pmap, pt_entry_t pte)
* should be tested and standardized at some point in the future for
* optimal aging of shared pages.
*
* As an optimization, update the page's dirty field if a modified bit is
* found while counting reference bits. This opportunistic update can be
* performed at low cost and can eliminate the need for some future calls
* to pmap_is_modified(). However, since this function stops after
* finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some
* dirty pages. Those dirty pages will only be detected by a future call
* to pmap_is_modified().
*
* A DI block is not needed within this function, because
* invalidations are performed before the PV list lock is
* released.
@ -5855,7 +5863,7 @@ pmap_ts_referenced(vm_page_t m)
pmap_t pmap;
struct rwlock *lock;
pd_entry_t oldpde, *pde;
pt_entry_t *pte, PG_A;
pt_entry_t *pte, PG_A, PG_M, PG_RW;
vm_offset_t va;
vm_paddr_t pa;
int cleared, md_gen, not_cleared, pvh_gen;
@ -5890,9 +5898,19 @@ retry:
}
}
PG_A = pmap_accessed_bit(pmap);
PG_M = pmap_modified_bit(pmap);
PG_RW = pmap_rw_bit(pmap);
va = pv->pv_va;
pde = pmap_pde(pmap, pv->pv_va);
oldpde = *pde;
if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
/*
* Although "oldpde" is mapping a 2MB page, because
* this function is called at a 4KB page granularity,
* we only update the 4KB page under test.
*/
vm_page_dirty(m);
}
if ((*pde & PG_A) != 0) {
/*
* Since this reference bit is shared by 512 4KB
@ -5986,11 +6004,15 @@ small_mappings:
}
}
PG_A = pmap_accessed_bit(pmap);
PG_M = pmap_modified_bit(pmap);
PG_RW = pmap_rw_bit(pmap);
pde = pmap_pde(pmap, pv->pv_va);
KASSERT((*pde & PG_PS) == 0,
("pmap_ts_referenced: found a 2mpage in page %p's pv list",
m));
pte = pmap_pde_to_pte(pde, pv->pv_va);
if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW))
vm_page_dirty(m);
if ((*pte & PG_A) != 0) {
if (safe_to_clear_referenced(pmap, *pte)) {
atomic_clear_long(pte, PG_A);

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/gpio.h>
#include <machine/bus.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@ -53,25 +54,89 @@ __FBSDID("$FreeBSD$");
#include "phy_if.h"
#define USBPHY_NPHYS 4
#define USBPHY_NRES USBPHY_NPHYS
enum awusbphy_type {
AWUSBPHY_TYPE_A10 = 1,
AWUSBPHY_TYPE_A13,
AWUSBPHY_TYPE_A20,
AWUSBPHY_TYPE_A31,
AWUSBPHY_TYPE_A83T,
AWUSBPHY_TYPE_H3,
AWUSBPHY_TYPE_A64
};
static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-usb-phy", 1 },
{ "allwinner,sun5i-a13-usb-phy", 1 },
{ "allwinner,sun6i-a31-usb-phy", 1 },
{ "allwinner,sun7i-a20-usb-phy", 1 },
{ "allwinner,sun8i-a83t-usb-phy", 1 },
{ "allwinner,sun8i-h3-usb-phy", 1 },
{ "allwinner,sun4i-a10-usb-phy", AWUSBPHY_TYPE_A10 },
{ "allwinner,sun5i-a13-usb-phy", AWUSBPHY_TYPE_A13 },
{ "allwinner,sun6i-a31-usb-phy", AWUSBPHY_TYPE_A31 },
{ "allwinner,sun7i-a20-usb-phy", AWUSBPHY_TYPE_A20 },
{ "allwinner,sun8i-a83t-usb-phy", AWUSBPHY_TYPE_A83T },
{ "allwinner,sun8i-h3-usb-phy", AWUSBPHY_TYPE_H3 },
{ "allwinner,sun50i-a64-usb-phy", AWUSBPHY_TYPE_A64 },
{ NULL, 0 }
};
struct awusbphy_softc {
struct resource * res[USBPHY_NRES];
regulator_t reg[USBPHY_NPHYS];
gpio_pin_t id_det_pin;
int id_det_valid;
gpio_pin_t vbus_det_pin;
int vbus_det_valid;
enum awusbphy_type phy_type;
};
static struct resource_spec awusbphy_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_MEMORY, 1, RF_ACTIVE },
{ SYS_RES_MEMORY, 2, RF_ACTIVE | RF_OPTIONAL },
{ SYS_RES_MEMORY, 3, RF_ACTIVE | RF_OPTIONAL },
{ -1, 0 }
};
#define RD4(sc, i, o) bus_read_4((sc)->res[(i)], (o))
#define WR4(sc, i, o, v) bus_write_4((sc)->res[(i)], (o), (v))
#define CLR4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) & ~(m))
#define SET4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) | (m))
#define OTG_PHY_CFG 0x20
#define OTG_PHY_ROUTE_OTG (1 << 0)
#define PMU_IRQ_ENABLE 0x00
#define PMU_AHB_INCR8 (1 << 10)
#define PMU_AHB_INCR4 (1 << 9)
#define PMU_AHB_INCRX_ALIGN (1 << 8)
#define PMU_ULPI_BYPASS (1 << 0)
#define PMU_UNK_H3 0x10
#define PMU_UNK_H3_CLR 0x2
static void
awusbphy_configure(device_t dev, int phyno)
{
struct awusbphy_softc *sc;
sc = device_get_softc(dev);
if (sc->res[phyno] == NULL)
return;
if (sc->phy_type == AWUSBPHY_TYPE_A64) {
CLR4(sc, phyno, PMU_UNK_H3, PMU_UNK_H3_CLR);
/* EHCI0 and OTG share a PHY */
if (phyno == 0)
SET4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG);
else if (phyno == 1)
CLR4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG);
}
if (phyno > 0) {
/* Enable passby */
SET4(sc, phyno, PMU_IRQ_ENABLE, PMU_ULPI_BYPASS |
PMU_AHB_INCR8 | PMU_AHB_INCR4 | PMU_AHB_INCRX_ALIGN);
}
}
static int
awusbphy_init(device_t dev)
{
@ -86,6 +151,8 @@ awusbphy_init(device_t dev)
sc = device_get_softc(dev);
node = ofw_bus_get_node(dev);
sc->phy_type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
/* Enable clocks */
for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) {
error = clk_enable(clk);
@ -123,6 +190,10 @@ awusbphy_init(device_t dev)
if (error == 0)
sc->vbus_det_valid = 1;
/* Allocate resources */
if (bus_alloc_resources(dev, awusbphy_spec, sc->res) != 0)
device_printf(dev, "couldn't allocate resources\n");
return (0);
}
@ -159,6 +230,9 @@ awusbphy_phy_enable(device_t dev, intptr_t phy, bool enable)
sc = device_get_softc(dev);
/* Configure PHY */
awusbphy_configure(dev, phy);
/* Regulators are optional. If not found, return success. */
reg = sc->reg[phy];
if (reg == NULL)

View File

@ -364,8 +364,6 @@ ENTRY(xscalec3_setttb)
#ifdef CACHE_CLEAN_BLOCK_INTR
msr cpsr_fsxc, r3
#else
str r2, [r3]
#endif
RET
END(xscalec3_setttb)

View File

@ -195,6 +195,16 @@ Lunmapped:
ldr r2, =(KERNVIRTADDR)
mov r3, #64
bl build_pagetables
#if defined(PHYSADDR) && (KERNVIRTADDR != KERNBASE)
/*
* If the kernel wasn't loaded at the beginning of the ram, map the memory
* before the kernel too, as some ports use that for pagetables, stack, etc...
*/
ldr r1, =PHYSADDR
ldr r2, =KERNBASE
ldr r3, =((KERNVIRTADDR - KERNBASE) / L1_S_SIZE)
bl build_pagetables
#endif
/* Create a device mapping for early_printf if specified. */
#if defined(SOCDEV_PA) && defined(SOCDEV_VA)

View File

@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include "am335x_scm.h"
#define CM_PER 0
#define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000)
#define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004)
@ -619,10 +621,9 @@ am335x_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq)
{
uint32_t ctrl_status;
/* Read the input clock freq from the control module */
/* control_status reg (0x40) */
if (ti_scm_reg_read_4(0x40, &ctrl_status))
return ENXIO;
/* Read the input clock freq from the control module. */
if (ti_scm_reg_read_4(SCM_CTRL_STATUS, &ctrl_status))
return (ENXIO);
switch ((ctrl_status>>22) & 0x3) {
case 0x0:

View File

@ -0,0 +1,169 @@
/*-
* Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
* 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 <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>
#include <machine/bus.h>
#include <arm/ti/am335x/am335x_scm.h>
#include <arm/ti/ti_cpuid.h>
#include <arm/ti/ti_scm.h>
#define TZ_ZEROC 2731
struct am335x_scm_softc {
int sc_last_temp;
struct sysctl_oid *sc_temp_oid;
};
static int
am335x_scm_temp_sysctl(SYSCTL_HANDLER_ARGS)
{
device_t dev;
int i, temp;
struct am335x_scm_softc *sc;
uint32_t reg;
dev = (device_t)arg1;
sc = device_get_softc(dev);
/* Read the temperature and convert to Kelvin. */
for(i = 50; i > 0; i--) {
ti_scm_reg_read_4(SCM_BGAP_CTRL, &reg);
if ((reg & SCM_BGAP_EOCZ) == 0)
break;
DELAY(50);
}
if ((reg & SCM_BGAP_EOCZ) == 0) {
sc->sc_last_temp =
(reg >> SCM_BGAP_TEMP_SHIFT) & SCM_BGAP_TEMP_MASK;
sc->sc_last_temp *= 10;
}
temp = sc->sc_last_temp + TZ_ZEROC;
return (sysctl_handle_int(oidp, &temp, 0, req));
}
static void
am335x_scm_identify(driver_t *driver, device_t parent)
{
device_t child;
/* AM335x only. */
if (ti_chip() != CHIP_AM335X)
return;
/* Make sure we attach only once. */
if (device_find_child(parent, "am335x_scm", -1) != NULL)
return;
child = device_add_child(parent, "am335x_scm", -1);
if (child == NULL)
device_printf(parent, "cannot add ti_scm child\n");
}
static int
am335x_scm_probe(device_t dev)
{
device_set_desc(dev, "AM335x Control Module Extension");
return (BUS_PROBE_DEFAULT);
}
static int
am335x_scm_attach(device_t dev)
{
struct am335x_scm_softc *sc;
struct sysctl_ctx_list *ctx;
struct sysctl_oid_list *tree;
uint32_t reg;
/* Set ADC to continous mode, clear output reset. */
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV;
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
/* Flush write. */
ti_scm_reg_read_4(SCM_BGAP_CTRL, &reg);
/* Start the ADC conversion. */
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV | SCM_BGAP_SOC;
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
/* Temperature sysctl. */
sc = device_get_softc(dev);
ctx = device_get_sysctl_ctx(dev);
tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
sc->sc_temp_oid = SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
"temperature", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
dev, 0, am335x_scm_temp_sysctl, "IK", "Current temperature");
return (0);
}
static int
am335x_scm_detach(device_t dev)
{
struct am335x_scm_softc *sc;
sc = device_get_softc(dev);
/* Remove temperature sysctl. */
if (sc->sc_temp_oid != NULL)
sysctl_remove_oid(sc->sc_temp_oid, 1, 0);
/* Stop the bandgap ADC. */
ti_scm_reg_write_4(SCM_BGAP_CTRL, SCM_BGAP_BGOFF);
return (0);
}
static device_method_t am335x_scm_methods[] = {
DEVMETHOD(device_identify, am335x_scm_identify),
DEVMETHOD(device_probe, am335x_scm_probe),
DEVMETHOD(device_attach, am335x_scm_attach),
DEVMETHOD(device_detach, am335x_scm_detach),
DEVMETHOD_END
};
static driver_t am335x_scm_driver = {
"am335x_scm",
am335x_scm_methods,
sizeof(struct am335x_scm_softc),
};
static devclass_t am335x_scm_devclass;
DRIVER_MODULE(am335x_scm, ti_scm, am335x_scm_driver, am335x_scm_devclass, 0, 0);
MODULE_VERSION(am335x_scm, 1);
MODULE_DEPEND(am335x_scm, ti_scm, 1, 1, 1);

View File

@ -29,6 +29,15 @@
#define __AM335X_SCM_H__
/* AM335x-specific registers for control module (scm) */
#define SCM_CTRL_STATUS 0x40
#define SCM_BGAP_CTRL 0x448
#define SCM_BGAP_TEMP_MASK 0xff
#define SCM_BGAP_TEMP_SHIFT 8
#define SCM_BGAP_BGOFF (1 << 6)
#define SCM_BGAP_SOC (1 << 4)
#define SCM_BGAP_CLRZ (1 << 3)
#define SCM_BGAP_CONTCONV (1 << 2)
#define SCM_BGAP_EOCZ (1 << 1)
#define SCM_USB_CTRL0 0x620
#define SCM_USB_STS0 0x624
#define SCM_USB_CTRL1 0x628

View File

@ -13,6 +13,7 @@ arm/ti/am335x/am335x_pwmss.c standard
arm/ti/am335x/am335x_ehrpwm.c standard
arm/ti/am335x/am335x_ecap.c standard
arm/ti/am335x/am335x_rtc.c optional am335x_rtc
arm/ti/am335x/am335x_scm.c standard
arm/ti/am335x/am335x_scm_padconf.c standard
arm/ti/am335x/am335x_usbss.c optional musb fdt
arm/ti/am335x/am335x_musb.c optional musb fdt

View File

@ -1019,14 +1019,14 @@ cpswp_attach(device_t dev)
IFQ_SET_READY(&ifp->if_snd);
/* Get high part of MAC address from control module (mac_id[0|1]_hi) */
ti_scm_reg_read_4(0x634 + sc->unit * 8, &reg);
ti_scm_reg_read_4(CPSW_MAC_ID0_HI + sc->unit * 8, &reg);
mac_addr[0] = reg & 0xFF;
mac_addr[1] = (reg >> 8) & 0xFF;
mac_addr[2] = (reg >> 16) & 0xFF;
mac_addr[3] = (reg >> 24) & 0xFF;
/* Get low part of MAC address from control module (mac_id[0|1]_lo) */
ti_scm_reg_read_4(0x630 + sc->unit * 8, &reg);
ti_scm_reg_read_4(CPSW_MAC_ID0_LO + sc->unit * 8, &reg);
mac_addr[4] = reg & 0xFF;
mac_addr[5] = (reg >> 8) & 0xFF;

View File

@ -46,6 +46,9 @@
#define CPSW_PORT_P_SA_LO(p) (CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100))
#define CPSW_PORT_P_SA_HI(p) (CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100))
#define CPSW_MAC_ID0_LO 0x0630
#define CPSW_MAC_ID0_HI 0x0634
#define CPSW_CPDMA_OFFSET 0x0800
#define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04)
#define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08)

View File

@ -131,7 +131,10 @@ ti_scm_attach(device_t dev)
ti_scm_sc = sc;
return (0);
/* Attach platform extensions, if any. */
bus_generic_probe(dev);
return (bus_generic_attach(dev));
}
int

View File

@ -286,7 +286,7 @@ initarm(struct arm_boot_params *abp)
cpu_setup();
i80321_calibrate_delay();
i81342_sdram_bounds(obio_bs_tag, IOP34X_VADDR, &memstart, &memsize);
i81342_sdram_bounds(arm_base_bs_tag, IOP34X_VADDR, &memstart, &memsize);
physmem = memsize / PAGE_SIZE;
cninit();
/* Set stack for exception handlers */

View File

@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$");
#include <arm/xscale/i8134x/i81342reg.h>
#include <arm/xscale/i8134x/obiovar.h>
bus_space_tag_t obio_bs_tag;
static int
obio_probe(device_t dev)
{
@ -69,8 +67,7 @@ obio_attach(device_t dev)
{
struct obio_softc *sc = device_get_softc(dev);
obio_bs_tag = arm_base_bs_tag;
sc->oba_st = obio_bs_tag;
sc->oba_st = arm_base_bs_tag;
sc->oba_rman.rm_type = RMAN_ARRAY;
sc->oba_rman.rm_descr = "OBIO I/O";
if (rman_init(&sc->oba_rman) != 0 ||

View File

@ -50,6 +50,5 @@ struct obio_softc {
struct rman oba_irq_rman;
};
extern bus_space_tag_t obio_bs_tag;
#endif /* _IQ80321_OBIOVAR_H_ */

View File

@ -54,14 +54,14 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
di->ops = uart_getops(&uart_ns8250_class);
di->bas.chan = 0;
di->bas.bst = obio_bs_tag;
di->bas.bst = arm_base_bs_tag;
di->bas.regshft = 2;
di->bas.rclk = 33334000;
di->baudrate = 115200;
di->databits = 8;
di->stopbits = 1;
di->parity = UART_PARITY_NONE;
uart_bus_space_io = obio_bs_tag;
uart_bus_space_io = arm_base_bs_tag;
uart_bus_space_mem = NULL;
di->bas.bsh = IOP34X_UART0_VADDR;
return (0);

View File

@ -2732,7 +2732,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
if (pde != NULL && lvl == 1) {
l2 = pmap_l1_to_l2(pde, va);
if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK &&
(l3 = pmap_demote_l2_locked(pmap, l2, va, &lock)) != NULL) {
(l3 = pmap_demote_l2_locked(pmap, l2, va & ~L2_OFFSET,
&lock)) != NULL) {
l3 = &l3[pmap_l3_index(va)];
if (va < VM_MAXUSER_ADDRESS) {
mpte = PHYS_TO_VM_PAGE(
pmap_load(l2) & ~ATTR_MASK);
@ -2944,7 +2946,6 @@ validate:
pmap_superpages_enabled() &&
(m->flags & PG_FICTITIOUS) == 0 &&
vm_reserv_level_iffullpop(m) == 0) {
KASSERT(lvl == 2, ("Invalid pde level %d", lvl));
pmap_promote_l2(pmap, pde, va, &lock);
}
}

View File

@ -285,6 +285,7 @@ do_el1h_sync(struct trapframe *frame)
print_registers(frame);
printf(" esr: %.8lx\n", esr);
panic("VFP exception in the kernel");
case EXCP_INSN_ABORT:
case EXCP_DATA_ABORT:
far = READ_SPECIALREG(far_el1);
intr_enable();

View File

@ -167,13 +167,14 @@ net_open(struct open_file *f, ...)
setenv("boot.netif.ip", inet_ntoa(myip), 1);
setenv("boot.netif.netmask", intoa(netmask), 1);
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
#ifdef LOADER_TFTP_SUPPORT
setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
setenv("boot.tftproot.path", rootpath, 1);
#else
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
setenv("boot.nfsroot.path", rootpath, 1);
#endif
setenv("boot.netif.server", inet_ntoa(rootip), 1);
if (netproto == NET_TFTP) {
setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
setenv("boot.tftproot.path", rootpath, 1);
} else if (netproto == NET_NFS) {
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
setenv("boot.nfsroot.path", rootpath, 1);
}
if (intf_mtu != 0) {
char mtu[16];
sprintf(mtu, "%u", intf_mtu);
@ -367,16 +368,24 @@ net_print(int verbose)
uint32_t
net_parse_rootpath()
{
int i;
int i, ipstart;
n_long addr = INADDR_NONE;
netproto = NET_NFS;
if (tftpip.s_addr != 0) {
netproto = NET_TFTP;
addr = tftpip.s_addr;
}
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
if (rootpath[i] == ':')
break;
if (i && i != FNAME_SIZE && rootpath[i] == ':') {
rootpath[i++] = '\0';
addr = inet_addr(&rootpath[0]);
addr = inet_addr(&rootpath[ipstart]);
bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1);
}
return (addr);
}

View File

@ -89,11 +89,15 @@ EFI_TARGET= efi-app-ia32
EFI_TARGET= binary
.endif
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
# for build reproducibility.
SOURCE_DATE_EPOCH?=1451606400
boot1.efi: ${PROG}
if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \
exit 1; \
fi
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame \

View File

@ -13,10 +13,6 @@ SRCS+= time.c
SRCS+= time_event.c
.endif
.if defined(LOADER_TFTP_SUPPORT)
CFLAGS+= -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
.endif
# We implement a slightly non-standard %S in that it always takes a
# CHAR16 that's common in UEFI-land instead of a wchar_t. This only
# seems to matter on arm64 where wchar_t defaults to an int instead

View File

@ -21,10 +21,6 @@ SRCS= autoload.c \
smbios.c \
vers.c
.if defined(LOADER_TFTP_SUPPORT)
CFLAGS+= -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
.endif
.if ${MK_ZFS} != "no"
SRCS+= zfs.c
.PATH: ${.CURDIR}/../../zfs
@ -135,11 +131,15 @@ EFI_TARGET= efi-app-ia32
EFI_TARGET= binary
.endif
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
# for build reproducibility.
SOURCE_DATE_EPOCH?=1451606400
loader.efi: ${PROG}
if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \
exit 1; \
fi
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel.dyn \
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \

View File

@ -51,11 +51,8 @@ struct fs_ops *file_system[] = {
&dosfs_fsops,
&ufs_fsops,
&cd9660_fsops,
#ifdef LOADER_TFTP_SUPPORT
&tftp_fsops,
#else
&nfs_fsops,
#endif
&gzipfs_fsops,
&bzipfs_fsops,
NULL

View File

@ -1,5 +1,5 @@
# $FreeBSD$
SUBDIR=arm mips powerpc
SUBDIR=arm arm64 mips powerpc
.include <bsd.subdir.mk>

View File

@ -0,0 +1,7 @@
# $FreeBSD$
DTS!=ls *.dts
all: test-dts
.include <bsd.init.mk>

Some files were not shown because too many files have changed in this diff Show More