summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/auditstat/auditstat.c7
-rw-r--r--usr/src/cmd/dladm/dladm.c32
-rw-r--r--usr/src/cmd/lp/lib/access/llib-llpacc58
-rw-r--r--usr/src/cmd/lp/lib/class/llib-llpcls44
-rw-r--r--usr/src/cmd/lp/lib/filters/llib-llpflt120
-rw-r--r--usr/src/cmd/lp/lib/forms/llib-llpfrm62
-rw-r--r--usr/src/cmd/lp/lib/lp/llib-llp173
-rw-r--r--usr/src/cmd/lp/lib/msgs/llib-llpmsg116
-rw-r--r--usr/src/cmd/lp/lib/oam/llib-llpoam39
-rw-r--r--usr/src/cmd/lp/lib/printers/llib-llpprt99
-rw-r--r--usr/src/cmd/lp/lib/requests/llib-llpreq59
-rw-r--r--usr/src/cmd/lp/lib/secure/llib-llpsec52
-rw-r--r--usr/src/cmd/lp/lib/users/llib-llpusr59
-rw-r--r--usr/src/cmd/picl/plugins/lib/picld_pluginutil/llib-lpicld_pluginutil37
-rw-r--r--usr/src/cmd/sendmail/libmilter/llib-lmilter32
-rw-r--r--usr/src/cmd/zdb/zdb.c56
-rw-r--r--usr/src/cmd/zdb/zdb_il.c16
-rw-r--r--usr/src/cmd/zstreamdump/zstreamdump.c10
-rw-r--r--usr/src/cmd/ztest/ztest.c237
19 files changed, 276 insertions, 1032 deletions
diff --git a/usr/src/cmd/auditstat/auditstat.c b/usr/src/cmd/auditstat/auditstat.c
index 594ba8e16a..cdb5a586ae 100644
--- a/usr/src/cmd/auditstat/auditstat.c
+++ b/usr/src/cmd/auditstat/auditstat.c
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2018, Joyent, Inc.
+ */
+
#include "statcommon.h"
#include <sys/types.h>
@@ -118,8 +122,7 @@ char **argv;
static void
-display_stats(s, cnt)
-au_stat_t *s;
+display_stats(au_stat_t *s, int cnt)
{
int offset[12]; /* used to line the header up correctly */
char buf[512];
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c
index d80e68f165..97fc010fa2 100644
--- a/usr/src/cmd/dladm/dladm.c
+++ b/usr/src/cmd/dladm/dladm.c
@@ -233,7 +233,7 @@ static cmdfunc_t do_show_iptun, do_up_iptun, do_down_iptun;
static cmdfunc_t do_create_overlay, do_delete_overlay, do_modify_overlay;
static cmdfunc_t do_show_overlay;
-static void do_up_vnic_common(int, char **, const char *, boolean_t);
+static void do_up_vnic_common(int, char **, const char *, boolean_t);
static int show_part(dladm_handle_t, datalink_id_t, void *);
@@ -333,9 +333,9 @@ static cmd_t cmds[] = {
" show-secobj [-pP] [-o <field>,...] [<secobj>,...]\n" },
{ "init-linkprop", do_init_linkprop, NULL },
{ "init-secobj", do_init_secobj, NULL },
- { "create-vlan", do_create_vlan,
+ { "create-vlan", do_create_vlan,
" create-vlan [-ft] -l <link> -v <vid> [link]" },
- { "delete-vlan", do_delete_vlan,
+ { "delete-vlan", do_delete_vlan,
" delete-vlan [-t] <link>" },
{ "show-vlan", do_show_vlan,
" show-vlan [-pP] [-o <field>,..] [<link>]\n" },
@@ -646,7 +646,7 @@ static const ofmt_field_t ether_fields[] = {
{ "REM_FAULT", 17,
offsetof(ether_fields_buf_t, eth_rem_fault), print_default_cb},
{NULL, 0,
- 0, NULL}}
+ 0, NULL}}
;
typedef struct print_ether_state {
@@ -678,8 +678,8 @@ static const ofmt_field_t link_s_fields[] = {
{ "IERRORS", 10, LINK_S_IERRORS, print_link_stats_cb},
{ "OPACKETS", 12, LINK_S_OPKTS, print_link_stats_cb},
{ "OBYTES", 12, LINK_S_OBYTES, print_link_stats_cb},
-{ "OERRORS", 8, LINK_S_OERRORS, print_link_stats_cb}}
-;
+{ "OERRORS", 8, LINK_S_OERRORS, print_link_stats_cb},
+{ NULL, 0, 0, NULL}};
typedef struct link_args_s {
char *link_s_link;
@@ -739,7 +739,7 @@ typedef struct laggr_fields_buf_s {
typedef struct laggr_args_s {
int laggr_lport; /* -1 indicates the aggr itself */
- const char *laggr_link;
+ const char *laggr_link;
dladm_aggr_grp_attr_t *laggr_ginfop;
dladm_status_t *laggr_status;
pktsum_t *laggr_pktsumtot; /* -s only */
@@ -1649,7 +1649,7 @@ show_usage_time(dladm_usage_t *usage, void *arg)
{
show_usage_state_t *state = (show_usage_state_t *)arg;
char buf[DLADM_STRSIZE];
- usage_l_fields_buf_t ubuf;
+ usage_l_fields_buf_t ubuf;
time_t time;
double bw;
dladm_status_t status;
@@ -1838,7 +1838,7 @@ do_show_usage(int argc, char *argv[], const char *use)
die("show-usage requires a file");
if (optind == (argc-1)) {
- uint32_t flags;
+ uint32_t flags;
resource = argv[optind];
if (!state.us_showall &&
@@ -3107,7 +3107,7 @@ print_aggr_info(show_grp_state_t *state, const char *link,
static boolean_t
print_xaggr_cb(ofmt_arg_t *ofarg, char *buf, uint_t bufsize)
{
- const laggr_args_t *l = ofarg->ofmt_cbarg;
+ const laggr_args_t *l = ofarg->ofmt_cbarg;
boolean_t is_port = (l->laggr_lport >= 0);
char tmpbuf[DLADM_STRSIZE];
const char *objname;
@@ -3293,7 +3293,7 @@ static boolean_t
print_aggr_stats_cb(ofmt_arg_t *ofarg, char *buf, uint_t bufsize)
{
const laggr_args_t *l = ofarg->ofmt_cbarg;
- int portnum;
+ int portnum;
boolean_t is_port = (l->laggr_lport >= 0);
dladm_aggr_port_attr_t *portp;
dladm_status_t *stat, status;
@@ -3949,7 +3949,7 @@ print_phys_one_hwgrp_cb(ofmt_arg_t *ofarg, char *buf, uint_t bufsize)
case PHYS_H_RINGS:
ringstr[0] = '\0';
for (i = 0; i < attr->hg_n_rings; i++) {
- uint_t index = attr->hg_rings[i];
+ uint_t index = attr->hg_rings[i];
if (start == -1) {
start = index;
@@ -5012,7 +5012,7 @@ do_up_vnic_common(int argc, char *argv[], const char *use, boolean_t vlan)
{
datalink_id_t linkid = DATALINK_ALL_LINKID;
dladm_status_t status;
- char *type;
+ char *type;
type = vlan ? "vlan" : "vnic";
@@ -6712,7 +6712,7 @@ static boolean_t
print_linkprop_cb(ofmt_arg_t *ofarg, char *buf, uint_t bufsize)
{
linkprop_args_t *arg = ofarg->ofmt_cbarg;
- char *propname = arg->ls_propname;
+ char *propname = arg->ls_propname;
show_linkprop_state_t *statep = arg->ls_state;
char *ptr = statep->ls_line;
char *lim = ptr + MAX_PROP_LINE;
@@ -7790,9 +7790,9 @@ do_init_linkprop(int argc, char **argv, const char *use)
static void
do_show_ether(int argc, char **argv, const char *use)
{
- int option;
+ int option;
datalink_id_t linkid;
- print_ether_state_t state;
+ print_ether_state_t state;
char *fields_str = NULL;
ofmt_handle_t ofmt;
ofmt_status_t oferr;
diff --git a/usr/src/cmd/lp/lib/access/llib-llpacc b/usr/src/cmd/lp/lib/access/llib-llpacc
deleted file mode 100644
index 8e15c15c3f..0000000000
--- a/usr/src/cmd/lp/lib/access/llib-llpacc
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-int allow_form_printer ( char **, char * );
-int allow_user_form ( char ** , char * );
-int allow_user_printer ( char **, char * );
-int allowed ( char *, char **, char ** );
-int deny_form_printer ( char **, char * );
-int deny_user_form ( char ** , char * );
-int deny_user_printer ( char **, char * );
-int dumpaccess ( char *, char *, char *, char ***, char *** );
-int is_form_allowed_printer ( char *, char * );
-int is_user_admin ( void );
-int is_user_allowed ( char *, char ** , char ** );
-int is_user_allowed_form ( char *, char * );
-int is_user_allowed_printer ( char *, char * );
-int load_formprinter_access ( char *, char ***, char *** );
-int load_paperprinter_access(char *, char ***, char ***);
-int load_userform_access ( char *, char ***, char *** );
-int load_userprinter_access ( char *, char ***, char *** );
-int loadaccess ( char *, char *, char *, char ***, char *** );
-int bangequ ( char * , char * );
-int bang_searchlist ( char * , char ** );
-int bang_dellist ( char *** , char * );
-
-char * getaccessfile ( char *, char *, char *, char * );
-
diff --git a/usr/src/cmd/lp/lib/class/llib-llpcls b/usr/src/cmd/lp/lib/class/llib-llpcls
deleted file mode 100644
index fea59cd737..0000000000
--- a/usr/src/cmd/lp/lib/class/llib-llpcls
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-typedef struct CLASS {
- char *name; /* name of class (redundant) */
- char **members; /* members of class */
-} CLASS;
-
-int putclass ( char *, CLASS * );
-int delclass ( char * );
-
-void freeclass ( CLASS * );
-
diff --git a/usr/src/cmd/lp/lib/filters/llib-llpflt b/usr/src/cmd/lp/lib/filters/llib-llpflt
deleted file mode 100644
index 61db757567..0000000000
--- a/usr/src/cmd/lp/lib/filters/llib-llpflt
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-
-typedef enum FILTERTYPE {
- fl_none,
- fl_fast,
- fl_slow,
- fl_both
-} FILTERTYPE;
-
-typedef struct FILTER {
- char * name; /* name of filter (redundant) */
- char * command; /* shell command (full path) */
- FILTERTYPE type; /* type of filter (fast/slow) */
- char ** printer_types; /* list of valid printer types */
- char ** printers; /* list of valid printers */
- char ** input_types; /* list of valid input types */
- char ** output_types; /* list of valid output types */
- char ** templates; /* list of option templates */
-} FILTER;
-
-
-
-typedef struct TYPE {
- char * name;
- unsigned short info; /* 1 iff "name" is in Terminfo */
-} TYPE;
-
-
-typedef struct TEMPLATE {
- char * keyword;
- char * pattern;
- char * re;
- char * result;
- int nbra;
-} TEMPLATE;
-
-typedef struct _FILTER {
- struct _FILTER * next; /* for linking several */
- char * name;
- char * command;
- char ** printers;
- TYPE * printer_types;
- TYPE * input_types; /* all possible choices */
- TYPE * output_types; /* all possible choices */
- TYPE * inputp; /* the one to be used */
- TYPE * outputp; /* the one to be used */
- TEMPLATE * templates;
- FILTERTYPE type;
- unsigned char mark,
- level;
-} _FILTER;
-
-
-FILTER * getfilter ( char * );
-
-_FILTER * search_filter ( char * );
-
-FILTERTYPE insfilter ( char ** , char * , char * , char * , char * , char ** , unsigned short * );
-FILTERTYPE s_to_filtertype ( char * );
-
-TEMPLATE s_to_template ( char * );
-
-TEMPLATE * sl_to_templatel ( char ** );
-
-TYPE s_to_type ( char * );
-
-TYPE * sl_to_typel ( char ** );
-
-char * template_to_s ( TEMPLATE );
-char * type_to_s ( TYPE );
-
-char ** templatel_to_sl ( TEMPLATE * );
-char ** typel_to_sl ( TYPE * );
-
-int open_filtertable ( char * , char * );
-
-int get_and_load ( void );
-int putfilter ( char * , FILTER * );
-int delfilter ( char * );
-int loadfilters ( char * );
-
-void freetempl ( TEMPLATE * );
-void freefilter ( FILTER * );
-void free_filter ( _FILTER * );
-void trash_filters ( void );
-void close_filtertable ( FILE * );
diff --git a/usr/src/cmd/lp/lib/forms/llib-llpfrm b/usr/src/cmd/lp/lib/forms/llib-llpfrm
deleted file mode 100644
index 625d3e7be5..0000000000
--- a/usr/src/cmd/lp/lib/forms/llib-llpfrm
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "../../include/lp.h"
-
-typedef struct FORM {
- SCALED plen;
- SCALED pwid;
- SCALED lpi;
- SCALED cpi;
- int np;
- char * chset;
- short mandatory;
- char * rcolor;
- char * comment;
- char * conttype;
- char * name;
- char * paper;
- short isDefault;
-} FORM;
-
-#define err_hndlr int (*)( int , int , int )
-
-int delform ( char * );
-int getform ( char * , FORM * , FALERT * , FILE ** );
-int putform ( char * , FORM * , FALERT * , FILE ** );
-int rdform ( char * , FORM * , int , err_hndlr , int * );
-int wrform ( char * , FORM * , int , err_hndlr , int * );
-
-void freeform ( FORM * );
-
diff --git a/usr/src/cmd/lp/lib/lp/llib-llp b/usr/src/cmd/lp/lib/lp/llib-llp
deleted file mode 100644
index b1faa81b20..0000000000
--- a/usr/src/cmd/lp/lib/lp/llib-llp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "errno.h"
-#include "fcntl.h"
-#include "sys/types.h"
-#include "sys/stat.h"
-#include "stdio.h"
-#include "dirent.h"
-
-typedef struct SCALED {
- float val; /* value of number, scaled according to "sc" */
- char sc; /* 'i' inches, 'c' centimeters, ' ' lines/cols */
-} SCALED;
-
-typedef struct FALERT {
- char * shcmd; /* shell command used to perform the alert */
- int Q; /* # requests queued to activate alert */
- int W; /* alert is sent every "W" minutes */
-} FALERT;
-
-extern int open_locked(char *, char *, mode_t);
-extern char *fdgets(char *, int, int);
-extern int fdprintf(int, char *, ...);
-extern int fdputs(char *, int);
-extern int fdputc(char, int);
-
-
-FILE *open_lpfile ( char * , char * , mode_t );
-int close_lpfile ( FILE * );
-int chown_lppath ( char * path );
-int mkdir_lpdir ( char * path , int mode );
-int rmfile ( char * path );
-int dumpstring ( char * path , char * str );
-
-char * loadstring ( char * path );
-char * loadline ( char * path );
-char * sop_up_rest (int, char * endsop );
-
-int addlist ( char *** , char * );
-int addstring ( char ** , char * );
-int appendlist ( char *** , char * );
-int dellist ( char *** , char * );
-int joinlist ( char *** , char ** );
-int lenlist ( char ** );
-int printlist ( FILE * , char ** );
-int fdprintlist(int , char ** );
-int searchlist ( char *, char ** );
-int searchlist_with_terminfo ( char * , char ** );
-
-char ** duplist ( char ** );
-char ** getlist ( char * , char * , char * );
-char ** dashos ( char * );
-char ** wherelist ( char * , char ** );
-
-char * sprintlist ( char ** );
-char * search_cslist ( char * , char ** );
-
-void freelist ( char ** );
-void printlist_setup ( char * , char * , char * , char * );
-void printlist_unsetup ( void );
-
-
-void printsdn ( FILE * , SCALED );
-void fdprintsdn ( int , SCALED );
-void printsdn_setup ( char * , char * , char * );
-void printsdn_unsetup ( void );
-
-SCALED _getsdn ( char * , char ** , int );
-
-char * makepath ( char * , ... );
-char * getspooldir ( void );
-char * getrequestfile ( char * );
-char * getprinterfile ( char * , char * );
-char * getsystemfile ( char * , char * );
-char * getclassfile ( char * );
-char * getfilterfile ( char * );
-char * getformfile ( char * , char * );
-
-int cs_strcmp ( char * , char * );
-int cs_strncmp ( char * , char * , int );
-
-int syn_name ( char * );
-int syn_text ( char * );
-int syn_comment ( char * );
-int syn_machine_name ( char * );
-int syn_option ( char * );
-
-int putalert ( char * , char * , FALERT * );
-int delalert ( char * , char * );
-
-FALERT * getalert ( char * , char * );
-
-void printalert ( FILE * , FALERT * , int );
-
-int tidbit ( char * , char * , ... );
-void untidbit ( char * );
-
-int _Access ( char * , int );
-int _Chdir ( char * );
-int _Chmod ( char * , int );
-int _Chown ( char * , int , int );
-int _Close ( int );
-int _Creat ( char * , int );
-int _Fcntl ( int , int , ... );
-int _Fstat ( int , struct stat * );
-int _Link ( char * , char * );
-int _Lstat ( char * , struct stat * );
-int _Mknod ( char * , int , int );
-int _Mkpipe ( char * , int , int );
-int _Open ( char * , int , ... /* mode_t */ );
-int _Read ( int , char * , unsigned int );
-int _Readlink ( char * , char * , unsigned int );
-int _Rename ( char * , char * );
-int _Symlink ( char * , char * );
-int _Stat ( char * , struct stat * );
-int _Unlink ( char * );
-int _Wait ( int * );
-int _Write ( int , char * , unsigned int );
-
-void * _Malloc ( size_t , const char * , int );
-void * _Realloc ( void * , size_t , const char * , int );
-void * _Calloc ( size_t , size_t , const char * , int );
-char * _Strdup ( const char * , const char * , int );
-void _Free ( void * , const char * , int );
-
-
-int isterminfo ( char * );
-int isprinter ( char * );
-int isrequest ( char * );
-int isnumber ( char * );
-
-char * getname ( void );
-char * makestr ( char * , ... );
-char * strip ( char * );
-
-void sendmail ( char * , char * );
-
-void (*lp_alloc_fail_handler)( void );
-
-char * next_x ( char * , long * , unsigned int );
-
diff --git a/usr/src/cmd/lp/lib/msgs/llib-llpmsg b/usr/src/cmd/lp/lib/msgs/llib-llpmsg
deleted file mode 100644
index 84d1fa3b1c..0000000000
--- a/usr/src/cmd/lp/lib/msgs/llib-llpmsg
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-# include <sys/types.h>
-# include <poll.h>
-# include <stdarg.h>
-# include <stropts.h>
-
-
-typedef struct strbuf strbuf_t; /* STREAMS buffer */
-
-typedef struct mque
-{
- struct mque *next;
- struct strbuf *dat;
-} MQUE;
-
-typedef struct
-{
- short type; /* type of connection */
- int readfd; /* STREAM fd to read from */
- int writefd; /* STREAM fd to write to */
- int wait; /* number of systems waiting for */
- char *file; /* pipe name if type==MD_FIFO */
- short state; /* Current state of client */
- short admin; /* Non zero if admin */
- short event; /* Event returned from poll */
- MQUE * mque; /* backlogged message ptr */
- uid_t uid; /* Clients UID */
- gid_t gid; /* Clients GID */
- void (**on_discon)(); /* Clean up functions */
-} MESG;
-
-#define MSGMAX 2048
-typedef struct
-{
- int full;
- char save [MSGMAX],
- *psave,
- *psave_end;
-} fifobuffer_t;
-
-MESG * mcreate ( char * );
-int mlisteninit ( MESG * );
-MESG * mlisten ( void );
-int mlistenadd ( MESG *, short );
-int mon_discon ( MESG *, void (*)());
-MESG * mlistenreset ( void );
-int mdestroy ( MESG * );
-
-MESG * mconnect ( char *, int, int );
-int mgetm ( MESG *, int, ... );
-int mwrite ( MESG *, char * );
-int mputm ( MESG *, int, ... );
-int mread ( MESG *, char *, int );
-short msize ( char * );
-short mpeek ( MESG * );
-int mdisconnect ( MESG * );
-
-void __mbfree ( void );
-
-int mclose ( void );
-int mneeds ( void );
-int mopen ( void );
-int mrecv ( char *, int );
-int msend ( char * );
-
-int Putmsg (MESG *, strbuf_t *, strbuf_t *, int);
-int Getmsg (MESG *, strbuf_t *, strbuf_t *, int *);
-int read3_2 (MESG * md, char *msgbuf, int size);
-int write3_2 (MESG *, char *, int);
-int read_fifo (int, char *, unsigned int);
-int write_fifo (int, char *, unsigned int);
-int ResetFifoBuffer (int);
-fifobuffer_t *GetFifoBuffer (int);
-
-char * htos ( char *, unsigned short );
-char * ltos ( char *, unsigned long );
-unsigned long stol ( char * );
-unsigned short stoh ( char * );
-int _getmessage ( char *, short, va_list );
-int _putmessage ( char *, short, va_list );
-int getmessage ( char *, short, ... );
-int putmessage ( char *, short, ... );
diff --git a/usr/src/cmd/lp/lib/oam/llib-llpoam b/usr/src/cmd/lp/lib/oam/llib-llpoam
deleted file mode 100644
index b2a06901ee..0000000000
--- a/usr/src/cmd/lp/lib/oam/llib-llpoam
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-char *agettxt(long msg_id, char *buf, int buflen);
-
-void fmtmsg(char * label, int severity, char * text, char * action);
-
-
diff --git a/usr/src/cmd/lp/lib/printers/llib-llpprt b/usr/src/cmd/lp/lib/printers/llib-llpprt
deleted file mode 100644
index f71ee5ff18..0000000000
--- a/usr/src/cmd/lp/lib/printers/llib-llpprt
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "../../include/lp.h"
-
-typedef struct PRINTER {
- char *name; /* name of printer (redundant) */
- unsigned short banner; /* banner page conditions */
- SCALED cpi; /* default character pitch */
- char **char_sets; /* list of okay char-sets/print-wheels */
- char **input_types; /* list of types acceptable to printer */
- char *device; /* printer port full path name */
- char *dial_info; /* system name or phone # for dial-up */
- char *fault_rec; /* printer fault recovery procedure */
- char *interface; /* interface program full path name */
- SCALED lpi; /* default line pitch */
- SCALED plen; /* default page length */
- unsigned short login; /* is/isn't a login terminal */
- char *printer_type; /* Terminfo look-up value (obsolete) */
- char *remote; /* remote machine!printer-name */
- char *speed; /* baud rate for connection */
- char *stty; /* space separated list of stty options */
- SCALED pwid; /* default page width */
- char *description; /* comment about printer */
- FALERT fault_alert; /* how to alert on printer fault */
- short daisy; /* 1/0 - printwheels/character-sets */
-#if defined(CAN_DO_MODULES)
- char **modules; /* streams modules to push */
-#endif
- char **printer_types; /* Terminfo look-up values */
- char **options; /* space separated list of undefined -o options */
-
- /*
- * Adding new members to this structure? Check out
- * cmd/lpadmin/do_printer.c, where we initialize
- * each new printer structure.
- */
-} PRINTER;
-
-typedef struct PWHEEL {
- char *name; /* name of print wheel */
- FALERT alert; /* how to alert when mount needed */
-} PWHEEL;
-
-extern unsigned long badprinter,
- ignprinter;
-PRINTER * getprinter ( char * );
-
-PWHEEL * getpwheel ( char * );
-
-char * getdefault ( void );
-
-int putprinter ( char *, PRINTER *);
-int delprinter ( char * );
-int putdefault ( char * );
-int deldefault ( void );
-int putpwheel ( char * , PWHEEL * );
-int delpwheel ( char * );
-int okprinter ( char * , PRINTER * , int );
-
-unsigned long chkprinter (char *, char *, char *, char *, char *, char *);
-
-void freeprinter ( PRINTER * );
-void freepwheel ( PWHEEL * );
-
-char * getpentry(char *, int);
-
-
diff --git a/usr/src/cmd/lp/lib/requests/llib-llpreq b/usr/src/cmd/lp/lib/requests/llib-llpreq
deleted file mode 100644
index ec8a5f0250..0000000000
--- a/usr/src/cmd/lp/lib/requests/llib-llpreq
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-
-typedef struct REQUEST {
- short copies; /* number of copies of request to print */
- char *destination; /* printer or class name */
- char **file_list; /* list of files to print: req. content */
- char *form; /* preprinted form to print on */
- ushort actions; /* mail/write, immediate/hold/resume, raw */
- char *alert; /* program to run to alert user when done */
- char *options; /* print options; space separated list */
- short priority; /* priority level, 0-39, of the request */
- char *pages; /* list of pages to print (uniq. please!) */
- char *charset; /* character set to select or mount */
- char *modes; /* mode(s) of operation; space sep. list */
- char *title; /* optional title for banner page */
- char *input_type; /* type of content */
- char *user; /* user name of person submitting */
- ushort outcome; /* success/fauilure */
- ushort version; /* version of system sending job*/
-} REQUEST;
-
-REQUEST * getrequest ( char * );
-int putrequest ( char *, REQUEST * );
-void freerequest ( REQUEST * );
-
diff --git a/usr/src/cmd/lp/lib/secure/llib-llpsec b/usr/src/cmd/lp/lib/secure/llib-llpsec
deleted file mode 100644
index 796719ea7a..0000000000
--- a/usr/src/cmd/lp/lib/secure/llib-llpsec
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "sys/types.h"
-
-typedef struct SECURE {
- uid_t uid;
- gid_t gid;
- off_t size;
- time_t date;
- char *system;
- char *user;
- char *req_id;
-} SECURE;
-
-
-SECURE * getsecure ( char * );
-int putsecure ( char *, SECURE * );
-int rmsecure (char *);
-void freesecure ( SECURE * );
-
diff --git a/usr/src/cmd/lp/lib/users/llib-llpusr b/usr/src/cmd/lp/lib/users/llib-llpusr
deleted file mode 100644
index 86a18b8b1c..0000000000
--- a/usr/src/cmd/lp/lib/users/llib-llpusr
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-/*
- * Copyright (c) 1998 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "stdio.h"
-
-typedef struct
-{
- short priority_limit;
-}
-USER;
-
-int putuser ( char * , USER * );
-int deluser ( char * );
-int getdfltpri ( void );
-void trashusers ( void );
-
-USER * getuser ( char *);
-
-#define PRI_MAX 39
-#define PRI_MIN 0
-
-struct user_priority
-{
- short deflt; /* priority to use when not specified */
- short deflt_limit; /* priority limit for users not
- otherwise specified */
- char **users[PRI_MAX - PRI_MIN + 1];
-};
diff --git a/usr/src/cmd/picl/plugins/lib/picld_pluginutil/llib-lpicld_pluginutil b/usr/src/cmd/picl/plugins/lib/picld_pluginutil/llib-lpicld_pluginutil
deleted file mode 100644
index 393c896161..0000000000
--- a/usr/src/cmd/picl/plugins/lib/picld_pluginutil/llib-lpicld_pluginutil
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*LINTLIBRARY*/
-/*PROTOLIB1*/
-
-/*
- * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <picl.h>
-#include <picltree.h>
-#include "picld_pluginutil.h"
-
-int picld_pluginutil_parse_config_file(picl_nodehdl_t nh,
- const char *filename);
diff --git a/usr/src/cmd/sendmail/libmilter/llib-lmilter b/usr/src/cmd/sendmail/libmilter/llib-lmilter
deleted file mode 100644
index 0d56627c3e..0000000000
--- a/usr/src/cmd/sendmail/libmilter/llib-lmilter
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-#include "libmilter.h"
diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c
index b591cc89a2..489b3db63c 100644
--- a/usr/src/cmd/zdb/zdb.c
+++ b/usr/src/cmd/zdb/zdb.c
@@ -2107,14 +2107,15 @@ static object_viewer_t *object_viewer[DMU_OT_NUMTYPES + 1] = {
};
static void
-dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
+dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header,
+ uint64_t *dnode_slots_used)
{
dmu_buf_t *db = NULL;
dmu_object_info_t doi;
dnode_t *dn;
void *bonus = NULL;
size_t bsize = 0;
- char iblk[32], dblk[32], lsize[32], asize[32], fill[32];
+ char iblk[32], dblk[32], lsize[32], asize[32], fill[32], dnsize[32];
char bonus_size[32];
char aux[50];
int error;
@@ -2127,9 +2128,9 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
CTASSERT(sizeof (bonus_size) >= NN_NUMBUF_SZ);
if (*print_header) {
- (void) printf("\n%10s %3s %5s %5s %5s %5s %6s %s\n",
- "Object", "lvl", "iblk", "dblk", "dsize", "lsize",
- "%full", "type");
+ (void) printf("\n%10s %3s %5s %5s %5s %6s %5s %6s %s\n",
+ "Object", "lvl", "iblk", "dblk", "dsize", "dnsize",
+ "lsize", "%full", "type");
*print_header = 0;
}
@@ -2146,11 +2147,15 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
}
dmu_object_info_from_dnode(dn, &doi);
+ if (dnode_slots_used != NULL)
+ *dnode_slots_used = doi.doi_dnodesize / DNODE_MIN_SIZE;
+
zdb_nicenum(doi.doi_metadata_block_size, iblk, sizeof (iblk));
zdb_nicenum(doi.doi_data_block_size, dblk, sizeof (dblk));
zdb_nicenum(doi.doi_max_offset, lsize, sizeof (lsize));
zdb_nicenum(doi.doi_physical_blocks_512 << 9, asize, sizeof (asize));
zdb_nicenum(doi.doi_bonus_size, bonus_size, sizeof (bonus_size));
+ zdb_nicenum(doi.doi_dnodesize, dnsize, sizeof (dnsize));
(void) sprintf(fill, "%6.2f", 100.0 * doi.doi_fill_count *
doi.doi_data_block_size / (object == 0 ? DNODES_PER_BLOCK : 1) /
doi.doi_max_offset);
@@ -2167,13 +2172,14 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
ZDB_COMPRESS_NAME(doi.doi_compress));
}
- (void) printf("%10lld %3u %5s %5s %5s %5s %6s %s%s\n",
- (u_longlong_t)object, doi.doi_indirection, iblk, dblk,
- asize, lsize, fill, ZDB_OT_NAME(doi.doi_type), aux);
+ (void) printf("%10" PRIu64
+ " %3u %5s %5s %5s %5s %5s %6s %s%s\n",
+ object, doi.doi_indirection, iblk, dblk,
+ asize, dnsize, lsize, fill, ZDB_OT_NAME(doi.doi_type), aux);
if (doi.doi_bonus_type != DMU_OT_NONE && verbosity > 3) {
- (void) printf("%10s %3s %5s %5s %5s %5s %6s %s\n",
- "", "", "", "", "", bonus_size, "bonus",
+ (void) printf("%10s %3s %5s %5s %5s %5s %5s %6s %s\n",
+ "", "", "", "", "", "", bonus_size, "bonus",
ZDB_OT_NAME(doi.doi_bonus_type));
}
@@ -2277,6 +2283,9 @@ dump_dir(objset_t *os)
int print_header = 1;
unsigned i;
int error;
+ uint64_t total_slots_used = 0;
+ uint64_t max_slot_used = 0;
+ uint64_t dnode_slots;
/* make sure nicenum has enough space */
CTASSERT(sizeof (numbuf) >= NN_NUMBUF_SZ);
@@ -2321,7 +2330,7 @@ dump_dir(objset_t *os)
if (zopt_objects != 0) {
for (i = 0; i < zopt_objects; i++)
dump_object(os, zopt_object[i], verbosity,
- &print_header);
+ &print_header, NULL);
(void) printf("\n");
return;
}
@@ -2346,24 +2355,39 @@ dump_dir(objset_t *os)
if (BP_IS_HOLE(os->os_rootbp))
return;
- dump_object(os, 0, verbosity, &print_header);
+ dump_object(os, 0, verbosity, &print_header, NULL);
object_count = 0;
if (DMU_USERUSED_DNODE(os) != NULL &&
DMU_USERUSED_DNODE(os)->dn_type != 0) {
- dump_object(os, DMU_USERUSED_OBJECT, verbosity, &print_header);
- dump_object(os, DMU_GROUPUSED_OBJECT, verbosity, &print_header);
+ dump_object(os, DMU_USERUSED_OBJECT, verbosity, &print_header,
+ NULL);
+ dump_object(os, DMU_GROUPUSED_OBJECT, verbosity, &print_header,
+ NULL);
}
object = 0;
while ((error = dmu_object_next(os, &object, B_FALSE, 0)) == 0) {
- dump_object(os, object, verbosity, &print_header);
+ dump_object(os, object, verbosity, &print_header, &dnode_slots);
object_count++;
+ total_slots_used += dnode_slots;
+ max_slot_used = object + dnode_slots - 1;
}
ASSERT3U(object_count, ==, usedobjs);
(void) printf("\n");
+ (void) printf(" Dnode slots:\n");
+ (void) printf("\tTotal used: %10llu\n",
+ (u_longlong_t)total_slots_used);
+ (void) printf("\tMax used: %10llu\n",
+ (u_longlong_t)max_slot_used);
+ (void) printf("\tPercent empty: %10lf\n",
+ (double)(max_slot_used - total_slots_used)*100 /
+ (double)max_slot_used);
+
+ (void) printf("\n");
+
if (error != ESRCH) {
(void) fprintf(stderr, "dmu_object_next() = %d\n", error);
abort();
@@ -2552,7 +2576,7 @@ dump_path_impl(objset_t *os, uint64_t obj, char *name)
return (dump_path_impl(os, child_obj, s + 1));
/*FALLTHROUGH*/
case DMU_OT_PLAIN_FILE_CONTENTS:
- dump_object(os, child_obj, dump_opt['v'], &header);
+ dump_object(os, child_obj, dump_opt['v'], &header, NULL);
return (0);
default:
(void) fprintf(stderr, "object %llu has non-file/directory "
diff --git a/usr/src/cmd/zdb/zdb_il.c b/usr/src/cmd/zdb/zdb_il.c
index a2ebe5857e..9daf9a7000 100644
--- a/usr/src/cmd/zdb/zdb_il.c
+++ b/usr/src/cmd/zdb/zdb_il.c
@@ -84,13 +84,15 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg)
}
(void) printf("%s%s", tab_prefix, ctime(&crtime));
- (void) printf("%sdoid %llu, foid %llu, mode %llo\n", tab_prefix,
- (u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid,
- (longlong_t)lr->lr_mode);
- (void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n",
- tab_prefix,
- (u_longlong_t)lr->lr_uid, (u_longlong_t)lr->lr_gid,
- (u_longlong_t)lr->lr_gen, (u_longlong_t)lr->lr_rdev);
+ (void) printf("%sdoid %" PRIu64 ", foid %" PRIu64 ", slots %" PRIu64
+ ", mode %" PRIo64 "\n",
+ tab_prefix, lr->lr_doid,
+ LR_FOID_GET_OBJ(lr->lr_foid),
+ LR_FOID_GET_SLOTS(lr->lr_foid),
+ lr->lr_mode);
+ (void) printf("%suid %" PRIu64 ", gid %" PRIu64 ", gen %" PRIu64
+ ", rdev %#" PRIx64 "\n",
+ tab_prefix, lr->lr_uid, lr->lr_gid, lr->lr_gen, lr->lr_rdev);
}
/* ARGSUSED */
diff --git a/usr/src/cmd/zstreamdump/zstreamdump.c b/usr/src/cmd/zstreamdump/zstreamdump.c
index 17adbecd79..987f4fdf12 100644
--- a/usr/src/cmd/zstreamdump/zstreamdump.c
+++ b/usr/src/cmd/zstreamdump/zstreamdump.c
@@ -415,13 +415,15 @@ main(int argc, char *argv[])
drro->drr_toguid = BSWAP_64(drro->drr_toguid);
}
if (verbose) {
- (void) printf("OBJECT object = %llu type = %u "
- "bonustype = %u blksz = %u bonuslen = %u\n",
- (u_longlong_t)drro->drr_object,
+ (void) printf("OBJECT object = %" PRIu64
+ " type = %u bonustype = %u blksz = %u"
+ " bonuslen = %u dn_slots = %u\n",
+ drro->drr_object,
drro->drr_type,
drro->drr_bonustype,
drro->drr_blksz,
- drro->drr_bonuslen);
+ drro->drr_bonuslen,
+ drro->drr_dn_slots);
}
if (drro->drr_bonuslen > 0) {
(void) ssread(buf,
diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c
index 8db1103272..9198928d55 100644
--- a/usr/src/cmd/ztest/ztest.c
+++ b/usr/src/cmd/ztest/ztest.c
@@ -194,6 +194,7 @@ extern uint64_t zfs_deadman_synctime_ms;
extern int metaslab_preload_limit;
extern boolean_t zfs_compressed_arc_enabled;
extern boolean_t zfs_abd_scatter_enabled;
+extern int dmu_object_alloc_chunk_shift;
extern boolean_t zfs_force_some_double_word_sm_entries;
static ztest_shared_opts_t *ztest_shared_opts;
@@ -224,6 +225,7 @@ typedef struct ztest_block_tag {
uint64_t bt_magic;
uint64_t bt_objset;
uint64_t bt_object;
+ uint64_t bt_dnodesize;
uint64_t bt_offset;
uint64_t bt_gen;
uint64_t bt_txg;
@@ -274,6 +276,7 @@ typedef struct ztest_od {
dmu_object_type_t od_crtype;
uint64_t od_blocksize;
uint64_t od_crblocksize;
+ uint64_t od_crdnodesize;
uint64_t od_gen;
uint64_t od_crgen;
char od_name[ZFS_MAX_DATASET_NAME_LEN];
@@ -320,6 +323,7 @@ static ztest_shared_callstate_t *ztest_shared_callstate;
ztest_func_t ztest_dmu_read_write;
ztest_func_t ztest_dmu_write_parallel;
ztest_func_t ztest_dmu_object_alloc_free;
+ztest_func_t ztest_dmu_object_next_chunk;
ztest_func_t ztest_dmu_commit_callbacks;
ztest_func_t ztest_zap;
ztest_func_t ztest_zap_parallel;
@@ -349,6 +353,7 @@ ztest_func_t ztest_device_removal;
ztest_func_t ztest_remap_blocks;
ztest_func_t ztest_spa_checkpoint_create_discard;
ztest_func_t ztest_initialize;
+ztest_func_t ztest_verify_dnode_bt;
uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
@@ -360,6 +365,7 @@ ztest_info_t ztest_info[] = {
{ ztest_dmu_read_write, 1, &zopt_always },
{ ztest_dmu_write_parallel, 10, &zopt_always },
{ ztest_dmu_object_alloc_free, 1, &zopt_always },
+ { ztest_dmu_object_next_chunk, 1, &zopt_sometimes },
{ ztest_dmu_commit_callbacks, 1, &zopt_always },
{ ztest_zap, 30, &zopt_always },
{ ztest_zap_parallel, 100, &zopt_always },
@@ -392,7 +398,8 @@ ztest_info_t ztest_info[] = {
{ ztest_device_removal, 1, &zopt_sometimes },
{ ztest_remap_blocks, 1, &zopt_sometimes },
{ ztest_spa_checkpoint_create_discard, 1, &zopt_rarely },
- { ztest_initialize, 1, &zopt_sometimes }
+ { ztest_initialize, 1, &zopt_sometimes },
+ { ztest_verify_dnode_bt, 1, &zopt_sometimes }
};
#define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t))
@@ -438,8 +445,8 @@ static spa_t *ztest_spa = NULL;
static ztest_ds_t *ztest_ds;
static kmutex_t ztest_vdev_lock;
-static kmutex_t ztest_checkpoint_lock;
static boolean_t ztest_device_removal_active = B_FALSE;
+static kmutex_t ztest_checkpoint_lock;
/*
* The ztest_name_lock protects the pool and dataset namespace used by
@@ -1009,6 +1016,36 @@ ztest_random_blocksize(void)
}
static int
+ztest_random_dnodesize(void)
+{
+ int slots;
+ int max_slots = spa_maxdnodesize(ztest_spa) >> DNODE_SHIFT;
+
+ if (max_slots == DNODE_MIN_SLOTS)
+ return (DNODE_MIN_SIZE);
+
+ /*
+ * Weight the random distribution more heavily toward smaller
+ * dnode sizes since that is more likely to reflect real-world
+ * usage.
+ */
+ ASSERT3U(max_slots, >, 4);
+ switch (ztest_random(10)) {
+ case 0:
+ slots = 5 + ztest_random(max_slots - 4);
+ break;
+ case 1 ... 4:
+ slots = 2 + ztest_random(3);
+ break;
+ default:
+ slots = 1;
+ break;
+ }
+
+ return (slots << DNODE_SHIFT);
+}
+
+static int
ztest_random_ibshift(void)
{
return (DN_MIN_INDBLKSHIFT +
@@ -1285,11 +1322,13 @@ ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
static void
ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
- uint64_t offset, uint64_t gen, uint64_t txg, uint64_t crtxg)
+ uint64_t dnodesize, uint64_t offset, uint64_t gen, uint64_t txg,
+ uint64_t crtxg)
{
bt->bt_magic = BT_MAGIC;
bt->bt_objset = dmu_objset_id(os);
bt->bt_object = object;
+ bt->bt_dnodesize = dnodesize;
bt->bt_offset = offset;
bt->bt_gen = gen;
bt->bt_txg = txg;
@@ -1298,11 +1337,13 @@ ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
static void
ztest_bt_verify(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
- uint64_t offset, uint64_t gen, uint64_t txg, uint64_t crtxg)
+ uint64_t dnodesize, uint64_t offset, uint64_t gen, uint64_t txg,
+ uint64_t crtxg)
{
ASSERT3U(bt->bt_magic, ==, BT_MAGIC);
ASSERT3U(bt->bt_objset, ==, dmu_objset_id(os));
ASSERT3U(bt->bt_object, ==, object);
+ ASSERT3U(bt->bt_dnodesize, ==, dnodesize);
ASSERT3U(bt->bt_offset, ==, offset);
ASSERT3U(bt->bt_gen, <=, gen);
ASSERT3U(bt->bt_txg, <=, txg);
@@ -1324,6 +1365,52 @@ ztest_bt_bonus(dmu_buf_t *db)
}
/*
+ * Generate a token to fill up unused bonus buffer space. Try to make
+ * it unique to the object, generation, and offset to verify that data
+ * is not getting overwritten by data from other dnodes.
+ */
+#define ZTEST_BONUS_FILL_TOKEN(obj, ds, gen, offset) \
+ (((ds) << 48) | ((gen) << 32) | ((obj) << 8) | (offset))
+
+/*
+ * Fill up the unused bonus buffer region before the block tag with a
+ * verifiable pattern. Filling the whole bonus area with non-zero data
+ * helps ensure that all dnode traversal code properly skips the
+ * interior regions of large dnodes.
+ */
+void
+ztest_fill_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
+ objset_t *os, uint64_t gen)
+{
+ uint64_t *bonusp;
+
+ ASSERT(IS_P2ALIGNED((char *)end - (char *)db->db_data, 8));
+
+ for (bonusp = db->db_data; bonusp < (uint64_t *)end; bonusp++) {
+ uint64_t token = ZTEST_BONUS_FILL_TOKEN(obj, dmu_objset_id(os),
+ gen, bonusp - (uint64_t *)db->db_data);
+ *bonusp = token;
+ }
+}
+
+/*
+ * Verify that the unused area of a bonus buffer is filled with the
+ * expected tokens.
+ */
+void
+ztest_verify_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
+ objset_t *os, uint64_t gen)
+{
+ uint64_t *bonusp;
+
+ for (bonusp = db->db_data; bonusp < (uint64_t *)end; bonusp++) {
+ uint64_t token = ZTEST_BONUS_FILL_TOKEN(obj, dmu_objset_id(os),
+ gen, bonusp - (uint64_t *)db->db_data);
+ VERIFY3U(*bonusp, ==, token);
+ }
+}
+
+/*
* ZIL logging ops
*/
@@ -1331,7 +1418,7 @@ ztest_bt_bonus(dmu_buf_t *db)
#define lrz_blocksize lr_uid
#define lrz_ibshift lr_gid
#define lrz_bonustype lr_rdev
-#define lrz_bonuslen lr_crtime[1]
+#define lrz_dnodesize lr_crtime[1]
static void
ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr)
@@ -1447,6 +1534,7 @@ ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
dmu_tx_t *tx;
uint64_t txg;
int error = 0;
+ int bonuslen;
if (byteswap)
byteswap_uint64_array(lr, sizeof (*lr));
@@ -1469,26 +1557,27 @@ ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
return (ENOSPC);
ASSERT(dmu_objset_zil(os)->zl_replay == !!lr->lr_foid);
+ bonuslen = DN_BONUS_SIZE(lr->lrz_dnodesize);
if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
if (lr->lr_foid == 0) {
- lr->lr_foid = zap_create(os,
+ lr->lr_foid = zap_create_dnsize(os,
lr->lrz_type, lr->lrz_bonustype,
- lr->lrz_bonuslen, tx);
+ bonuslen, lr->lrz_dnodesize, tx);
} else {
- error = zap_create_claim(os, lr->lr_foid,
+ error = zap_create_claim_dnsize(os, lr->lr_foid,
lr->lrz_type, lr->lrz_bonustype,
- lr->lrz_bonuslen, tx);
+ bonuslen, lr->lrz_dnodesize, tx);
}
} else {
if (lr->lr_foid == 0) {
- lr->lr_foid = dmu_object_alloc(os,
+ lr->lr_foid = dmu_object_alloc_dnsize(os,
lr->lrz_type, 0, lr->lrz_bonustype,
- lr->lrz_bonuslen, tx);
+ bonuslen, lr->lrz_dnodesize, tx);
} else {
- error = dmu_object_claim(os, lr->lr_foid,
+ error = dmu_object_claim_dnsize(os, lr->lr_foid,
lr->lrz_type, 0, lr->lrz_bonustype,
- lr->lrz_bonuslen, tx);
+ bonuslen, lr->lrz_dnodesize, tx);
}
}
@@ -1508,7 +1597,9 @@ ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
bbt = ztest_bt_bonus(db);
dmu_buf_will_dirty(db, tx);
- ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_gen, txg, txg);
+ ztest_bt_generate(bbt, os, lr->lr_foid, lr->lrz_dnodesize, -1ULL,
+ lr->lr_gen, txg, txg);
+ ztest_fill_unused_bonus(db, bbt, lr->lr_foid, os, lr->lr_gen);
dmu_buf_rele(db, FTAG);
VERIFY3U(0, ==, zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1,
@@ -1658,7 +1749,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
VERIFY(dmu_read(os, lr->lr_foid, offset,
sizeof (rbt), &rbt, prefetch) == 0);
if (rbt.bt_magic == BT_MAGIC) {
- ztest_bt_verify(&rbt, os, lr->lr_foid,
+ ztest_bt_verify(&rbt, os, lr->lr_foid, 0,
offset, gen, txg, crtxg);
}
}
@@ -1670,7 +1761,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
* as it was when the write was generated.
*/
if (zd->zd_zilog->zl_replay) {
- ztest_bt_verify(bt, os, lr->lr_foid, offset,
+ ztest_bt_verify(bt, os, lr->lr_foid, 0, offset,
MAX(gen, bt->bt_gen), MAX(txg, lrtxg),
bt->bt_crtxg);
}
@@ -1679,7 +1770,8 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
* Set the bt's gen/txg to the bonus buffer's gen/txg
* so that all of the usual ASSERTs will work.
*/
- ztest_bt_generate(bt, os, lr->lr_foid, offset, gen, txg, crtxg);
+ ztest_bt_generate(bt, os, lr->lr_foid, 0, offset, gen, txg,
+ crtxg);
}
if (abuf == NULL) {
@@ -1751,7 +1843,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
dmu_tx_t *tx;
dmu_buf_t *db;
ztest_block_tag_t *bbt;
- uint64_t txg, lrtxg, crtxg;
+ uint64_t txg, lrtxg, crtxg, dnodesize;
if (byteswap)
byteswap_uint64_array(lr, sizeof (*lr));
@@ -1774,6 +1866,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
ASSERT3U(bbt->bt_magic, ==, BT_MAGIC);
crtxg = bbt->bt_crtxg;
lrtxg = lr->lr_common.lrc_txg;
+ dnodesize = bbt->bt_dnodesize;
if (zd->zd_zilog->zl_replay) {
ASSERT(lr->lr_size != 0);
@@ -1792,7 +1885,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
/*
* Verify that the current bonus buffer is not newer than our txg.
*/
- ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
+ ztest_bt_verify(bbt, os, lr->lr_foid, dnodesize, -1ULL, lr->lr_mode,
MAX(txg, lrtxg), crtxg);
dmu_buf_will_dirty(db, tx);
@@ -1802,7 +1895,9 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
VERIFY0(dmu_set_bonus(db, lr->lr_size, tx));
bbt = ztest_bt_bonus(db);
- ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
+ ztest_bt_generate(bbt, os, lr->lr_foid, dnodesize, -1ULL, lr->lr_mode,
+ txg, crtxg);
+ ztest_fill_unused_bonus(db, bbt, lr->lr_foid, os, bbt->bt_gen);
dmu_buf_rele(db, FTAG);
@@ -2033,7 +2128,7 @@ ztest_create(ztest_ds_t *zd, ztest_od_t *od, int count)
lr->lrz_blocksize = od->od_crblocksize;
lr->lrz_ibshift = ztest_random_ibshift();
lr->lrz_bonustype = DMU_OT_UINT64_OTHER;
- lr->lrz_bonuslen = dmu_bonus_max();
+ lr->lrz_dnodesize = od->od_crdnodesize;
lr->lr_gen = od->od_crgen;
lr->lr_crtime[0] = time(NULL);
@@ -2212,7 +2307,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
switch (io_type) {
case ZTEST_IO_WRITE_TAG:
- ztest_bt_generate(&wbt, zd->zd_os, object, offset, 0, 0, 0);
+ ztest_bt_generate(&wbt, zd->zd_os, object, doi.doi_dnodesize,
+ offset, 0, 0, 0);
(void) ztest_write(zd, object, offset, sizeof (wbt), &wbt);
break;
@@ -2273,13 +2369,15 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
*/
static void
ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index,
- dmu_object_type_t type, uint64_t blocksize, uint64_t gen)
+ dmu_object_type_t type, uint64_t blocksize, uint64_t dnodesize,
+ uint64_t gen)
{
od->od_dir = ZTEST_DIROBJ;
od->od_object = 0;
od->od_crtype = type;
od->od_crblocksize = blocksize ? blocksize : ztest_random_blocksize();
+ od->od_crdnodesize = dnodesize ? dnodesize : ztest_random_dnodesize();
od->od_crgen = gen;
od->od_type = DMU_OT_NONE;
@@ -3724,8 +3822,10 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
ztest_od_t od[4];
int batchsize = sizeof (od) / sizeof (od[0]);
- for (int b = 0; b < batchsize; b++)
- ztest_od_init(&od[b], id, FTAG, b, DMU_OT_UINT64_OTHER, 0, 0);
+ for (int b = 0; b < batchsize; b++) {
+ ztest_od_init(&od[b], id, FTAG, b, DMU_OT_UINT64_OTHER,
+ 0, 0, 0);
+ }
/*
* Destroy the previous batch of objects, create a new batch,
@@ -3740,6 +3840,26 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
}
/*
+ * Rewind the global allocator to verify object allocation backfilling.
+ */
+void
+ztest_dmu_object_next_chunk(ztest_ds_t *zd, uint64_t id)
+{
+ objset_t *os = zd->zd_os;
+ int dnodes_per_chunk = 1 << dmu_object_alloc_chunk_shift;
+ uint64_t object;
+
+ /*
+ * Rewind the global allocator randomly back to a lower object number
+ * to force backfilling and reclamation of recently freed dnodes.
+ */
+ mutex_enter(&os->os_obj_lock);
+ object = ztest_random(os->os_obj_next_chunk);
+ os->os_obj_next_chunk = P2ALIGN(object, dnodes_per_chunk);
+ mutex_exit(&os->os_obj_lock);
+}
+
+/*
* Verify that dmu_{read,write} work as expected.
*/
void
@@ -3785,8 +3905,10 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
/*
* Read the directory info. If it's the first time, set things up.
*/
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, chunksize);
- ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, chunksize);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0,
+ chunksize);
+ ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, 0,
+ chunksize);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@@ -4055,8 +4177,10 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
/*
* Read the directory info. If it's the first time, set things up.
*/
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
- ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, chunksize);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize,
+ 0, 0);
+ ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, 0,
+ chunksize);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@@ -4257,7 +4381,8 @@ ztest_dmu_write_parallel(ztest_ds_t *zd, uint64_t id)
* to verify that parallel writes to an object -- even to the
* same blocks within the object -- doesn't cause any trouble.
*/
- ztest_od_init(&od[0], ID_PARALLEL, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
+ ztest_od_init(&od[0], ID_PARALLEL, FTAG, 0, DMU_OT_UINT64_OTHER,
+ 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@@ -4276,7 +4401,8 @@ ztest_dmu_prealloc(ztest_ds_t *zd, uint64_t id)
uint64_t blocksize = ztest_random_blocksize();
void *data;
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize,
+ 0, 0);
if (ztest_object_init(zd, od, sizeof (od), !ztest_random(2)) != 0)
return;
@@ -4322,7 +4448,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
int error;
char *hc[2] = { "s.acl.h", ".s.open.h.hyLZlg" };
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), !ztest_random(2)) != 0)
return;
@@ -4454,7 +4580,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
ztest_od_t od[1];
uint64_t object, txg;
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), !ztest_random(2)) != 0)
return;
@@ -4500,7 +4626,8 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
char name[20], string_value[20];
void *data;
- ztest_od_init(&od[0], ID_PARALLEL, FTAG, micro, DMU_OT_ZAP_OTHER, 0, 0);
+ ztest_od_init(&od[0], ID_PARALLEL, FTAG, micro, DMU_OT_ZAP_OTHER,
+ 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@@ -4688,7 +4815,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
uint64_t old_txg, txg;
int i, error;
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@@ -4802,6 +4929,41 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
dmu_tx_commit(tx);
}
+/*
+ * Visit each object in the dataset. Verify that its properties
+ * are consistent what was stored in the block tag when it was created,
+ * and that its unused bonus buffer space has not been overwritten.
+ */
+void
+ztest_verify_dnode_bt(ztest_ds_t *zd, uint64_t id)
+{
+ objset_t *os = zd->zd_os;
+ uint64_t obj;
+ int err = 0;
+
+ for (obj = 0; err == 0; err = dmu_object_next(os, &obj, FALSE, 0)) {
+ ztest_block_tag_t *bt = NULL;
+ dmu_object_info_t doi;
+ dmu_buf_t *db;
+
+ if (dmu_bonus_hold(os, obj, FTAG, &db) != 0)
+ continue;
+
+ dmu_object_info_from_db(db, &doi);
+ if (doi.doi_bonus_size >= sizeof (*bt))
+ bt = ztest_bt_bonus(db);
+
+ if (bt && bt->bt_magic == BT_MAGIC) {
+ ztest_bt_verify(bt, os, obj, doi.doi_dnodesize,
+ bt->bt_offset, bt->bt_gen, bt->bt_txg,
+ bt->bt_crtxg);
+ ztest_verify_unused_bonus(db, bt, obj, os, bt->bt_gen);
+ }
+
+ dmu_buf_rele(db, FTAG);
+ }
+}
+
/* ARGSUSED */
void
ztest_dsl_prop_get_set(ztest_ds_t *zd, uint64_t id)
@@ -5286,7 +5448,8 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
blocksize = ztest_random_blocksize();
blocksize = MIN(blocksize, 2048); /* because we write so many */
- ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
+ ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize,
+ 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@@ -6158,7 +6321,7 @@ ztest_freeze(void)
numloops++ < ztest_opts.zo_maxloops &&
metaslab_class_get_alloc(spa_normal_class(spa)) < capacity) {
ztest_od_t od;
- ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
+ ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0, 0);
VERIFY0(ztest_object_init(zd, &od, sizeof (od), B_FALSE));
ztest_io(zd, od.od_object,
ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);