Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/FreeBSD]: src/external/cddl/osnet/dist Import Opensolaris source code us...



details:   https://anonhg.NetBSD.org/src/rev/c9b27ecad83f
branches:  FreeBSD
changeset: 319378:c9b27ecad83f
user:      haad <haad%NetBSD.org@localhost>
date:      Fri Aug 07 18:32:15 2009 +0000

description:
Import Opensolaris source code used with zfs port. Zfs code si from date
200811.

diffstat:

 external/cddl/osnet/dist/cmd/zdb/zdb.c                          |   2430 +
 external/cddl/osnet/dist/cmd/zdb/zdb_il.c                       |    363 +
 external/cddl/osnet/dist/cmd/zfs/zfs_iter.c                     |    420 +
 external/cddl/osnet/dist/cmd/zfs/zfs_iter.h                     |     54 +
 external/cddl/osnet/dist/cmd/zfs/zfs_main.c                     |   4229 +
 external/cddl/osnet/dist/cmd/zfs/zfs_util.h                     |     44 +
 external/cddl/osnet/dist/cmd/zpool/zpool_iter.c                 |    252 +
 external/cddl/osnet/dist/cmd/zpool/zpool_main.c                 |   3950 +
 external/cddl/osnet/dist/cmd/zpool/zpool_util.c                 |    104 +
 external/cddl/osnet/dist/cmd/zpool/zpool_util.h                 |     72 +
 external/cddl/osnet/dist/cmd/zpool/zpool_vdev.c                 |   1401 +
 external/cddl/osnet/dist/cmd/ztest/ztest.c                      |   3475 +
 external/cddl/osnet/dist/common/acl/acl_common.c                |   1724 +
 external/cddl/osnet/dist/common/acl/acl_common.h                |     61 +
 external/cddl/osnet/dist/common/avl/avl.c                       |   1033 +
 external/cddl/osnet/dist/common/nvpair/nvpair.c                 |   3246 +
 external/cddl/osnet/dist/common/nvpair/nvpair_alloc_fixed.c     |    120 +
 external/cddl/osnet/dist/common/unicode/u8_textprep.c           |   2132 +
 external/cddl/osnet/dist/common/zfs/zfs_comutil.c               |     65 +
 external/cddl/osnet/dist/common/zfs/zfs_comutil.h               |     44 +
 external/cddl/osnet/dist/common/zfs/zfs_deleg.c                 |    234 +
 external/cddl/osnet/dist/common/zfs/zfs_deleg.h                 |     81 +
 external/cddl/osnet/dist/common/zfs/zfs_namecheck.c             |    363 +
 external/cddl/osnet/dist/common/zfs/zfs_namecheck.h             |     61 +
 external/cddl/osnet/dist/common/zfs/zfs_prop.c                  |    496 +
 external/cddl/osnet/dist/common/zfs/zfs_prop.h                  |    129 +
 external/cddl/osnet/dist/common/zfs/zpool_prop.c                |    186 +
 external/cddl/osnet/dist/common/zfs/zprop_common.c              |    406 +
 external/cddl/osnet/dist/lib/libnvpair/libnvpair.c              |    618 +
 external/cddl/osnet/dist/lib/libnvpair/libnvpair.h              |     48 +
 external/cddl/osnet/dist/lib/libnvpair/nvpair_alloc_system.c    |     59 +
 external/cddl/osnet/dist/lib/libshare/common/libshare.h         |    281 +
 external/cddl/osnet/dist/lib/libuutil/common/libuutil.h         |    381 +
 external/cddl/osnet/dist/lib/libuutil/common/libuutil_common.h  |     35 +
 external/cddl/osnet/dist/lib/libuutil/common/libuutil_impl.h    |    181 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_alloc.c         |     98 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_avl.c           |    569 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_dprintf.c       |    128 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_ident.c         |    122 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_list.c          |    718 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_misc.c          |    255 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_open.c          |     70 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_pname.c         |    207 +
 external/cddl/osnet/dist/lib/libuutil/common/uu_strtoint.c      |    300 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs.h             |    570 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_changelist.c  |    713 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_config.c      |    360 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_dataset.c     |   4248 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_impl.h        |    193 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c      |   1311 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_mount.c       |   1399 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_pool.c        |   3064 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_sendrecv.c    |   2102 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_status.c      |    317 +
 external/cddl/osnet/dist/lib/libzfs/common/libzfs_util.c        |   1403 +
 external/cddl/osnet/dist/lib/libzpool/common/taskq.c            |    261 +
 external/cddl/osnet/dist/lib/libzpool/common/util.c             |    156 +
 external/cddl/osnet/dist/uts/common/fs/zfs/arc.c                |   4480 +
 external/cddl/osnet/dist/uts/common/fs/zfs/bplist.c             |    349 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c               |   2356 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c                |   1227 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_object.c         |    162 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_objset.c         |   1260 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_send.c           |   1181 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_traverse.c       |    406 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_tx.c             |   1068 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_zfetch.c         |    651 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c              |   1443 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dnode_sync.c         |    623 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dataset.c        |   3103 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_deleg.c          |    735 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_dir.c            |   1331 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_pool.c           |    613 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_prop.c           |    602 +
 external/cddl/osnet/dist/uts/common/fs/zfs/dsl_synctask.c       |    225 +
 external/cddl/osnet/dist/uts/common/fs/zfs/gzip.c               |     69 +
 external/cddl/osnet/dist/uts/common/fs/zfs/lzjb.c               |    128 +
 external/cddl/osnet/dist/uts/common/fs/zfs/metaslab.c           |   1049 +
 external/cddl/osnet/dist/uts/common/fs/zfs/refcount.c           |    195 +
 external/cddl/osnet/dist/uts/common/fs/zfs/rrwlock.c            |    249 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sha256.c             |    129 +
 external/cddl/osnet/dist/uts/common/fs/zfs/spa.c                |   4301 +
 external/cddl/osnet/dist/uts/common/fs/zfs/spa_config.c         |    444 +
 external/cddl/osnet/dist/uts/common/fs/zfs/spa_errlog.c         |    437 +
 external/cddl/osnet/dist/uts/common/fs/zfs/spa_history.c        |    428 +
 external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c           |   1410 +
 external/cddl/osnet/dist/uts/common/fs/zfs/space_map.c          |    506 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/arc.h            |    138 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/bplist.h         |     89 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dbuf.h           |    347 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h            |    638 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu_impl.h       |    239 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu_objset.h     |    135 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu_traverse.h   |     57 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu_tx.h         |    139 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu_zfetch.h     |     75 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dnode.h          |    275 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dsl_dataset.h    |    239 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dsl_deleg.h      |     73 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dsl_dir.h        |    160 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dsl_pool.h       |    150 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dsl_prop.h       |     82 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dsl_synctask.h   |     83 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/metaslab.h       |     71 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/metaslab_impl.h  |     81 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/refcount.h       |    104 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/rrwlock.h        |     80 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa.h            |    554 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa_boot.h       |     45 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa_impl.h       |    196 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/space_map.h      |    162 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/txg.h            |    130 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/txg_impl.h       |     73 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/uberblock.h      |     50 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/uberblock_impl.h |     63 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/unique.h         |     59 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev.h           |    135 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_disk.h      |     56 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_file.h      |     46 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/vdev_impl.h      |    305 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zap.h            |    425 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zap_impl.h       |    218 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zap_leaf.h       |    244 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_acl.h        |    214 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h    |     73 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_ctldir.h     |     74 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_debug.h      |     75 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_dir.h        |     76 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_fuid.h       |    125 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_ioctl.h      |    196 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_rlock.h      |     89 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_vfsops.h     |    140 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_znode.h      |    356 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zil.h            |    382 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zil_impl.h       |    109 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zio.h            |    424 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zio_checksum.h   |     73 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zio_compress.h   |     82 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zio_impl.h       |    143 +
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zvol.h           |     70 +
 external/cddl/osnet/dist/uts/common/fs/zfs/txg.c                |    627 +
 external/cddl/osnet/dist/uts/common/fs/zfs/uberblock.c          |     63 +
 external/cddl/osnet/dist/uts/common/fs/zfs/unique.c             |    116 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev.c               |   2425 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_cache.c         |    425 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c          |    526 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_file.c          |    188 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_label.c         |   1075 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_mirror.c        |    480 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_missing.c       |     85 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_queue.c         |    308 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_raidz.c         |   1209 +
 external/cddl/osnet/dist/uts/common/fs/zfs/vdev_root.c          |    118 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zap.c                |   1136 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zap_leaf.c           |    853 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zap_micro.c          |   1069 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_acl.c            |   2680 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_byteswap.c       |    175 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c         |   1159 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c            |    977 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_fm.c             |    362 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_fuid.c           |    704 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c          |   3201 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_log.c            |    694 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c         |    878 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_rlock.c          |    602 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c         |   1652 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c          |   4561 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c          |   1672 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zil.c                |   1741 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zio.c                |   2273 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zio_checksum.c       |    206 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zio_compress.c       |    148 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zio_inject.c         |    370 +
 external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c               |   1722 +
 external/cddl/osnet/dist/uts/common/os/list.c                   |    245 +
 external/cddl/osnet/dist/uts/common/os/nvpair_alloc_system.c    |     64 +
 external/cddl/osnet/dist/uts/common/rpc/types.h                 |    135 +
 external/cddl/osnet/dist/uts/common/rpc/xdr.c                   |    620 +
 external/cddl/osnet/dist/uts/common/rpc/xdr.h                   |    607 +
 external/cddl/osnet/dist/uts/common/rpc/xdr_array.c             |    114 +
 external/cddl/osnet/dist/uts/common/rpc/xdr_mem.c               |    209 +
 external/cddl/osnet/dist/uts/common/sys/acl.h                   |    300 +
 external/cddl/osnet/dist/uts/common/sys/acl_impl.h              |     61 +
 external/cddl/osnet/dist/uts/common/sys/avl.h                   |    311 +
 external/cddl/osnet/dist/uts/common/sys/avl_impl.h              |    164 +
 external/cddl/osnet/dist/uts/common/sys/bitmap.h                |    194 +
 external/cddl/osnet/dist/uts/common/sys/callb.h                 |    215 +
 external/cddl/osnet/dist/uts/common/sys/ccompile.h              |    127 +
 external/cddl/osnet/dist/uts/common/sys/compress.h              |     46 +
 external/cddl/osnet/dist/uts/common/sys/cred.h                  |    186 +
 external/cddl/osnet/dist/uts/common/sys/debug.h                 |    130 +
 external/cddl/osnet/dist/uts/common/sys/errorq.h                |     83 +
 external/cddl/osnet/dist/uts/common/sys/feature_tests.h         |    396 +
 external/cddl/osnet/dist/uts/common/sys/fm/fs/zfs.h             |     84 +
 external/cddl/osnet/dist/uts/common/sys/fm/protocol.h           |    332 +
 external/cddl/osnet/dist/uts/common/sys/fm/util.h               |    105 +
 external/cddl/osnet/dist/uts/common/sys/fs/zfs.h                |    683 +
 external/cddl/osnet/dist/uts/common/sys/list.h                  |     67 +
 external/cddl/osnet/dist/uts/common/sys/list_impl.h             |     53 +
 external/cddl/osnet/dist/uts/common/sys/note.h                  |     56 +
 external/cddl/osnet/dist/uts/common/sys/nvpair.h                |    279 +
 external/cddl/osnet/dist/uts/common/sys/nvpair_impl.h           |     73 +
 external/cddl/osnet/dist/uts/common/sys/synch.h                 |    162 +
 external/cddl/osnet/dist/uts/common/sys/sysevent.h              |    227 +
 external/cddl/osnet/dist/uts/common/sys/sysevent/eventdefs.h    |    247 +
 external/cddl/osnet/dist/uts/common/sys/systeminfo.h            |    110 +
 external/cddl/osnet/dist/uts/common/sys/taskq.h                 |     85 +
 external/cddl/osnet/dist/uts/common/sys/taskq_impl.h            |    136 +
 external/cddl/osnet/dist/uts/common/sys/u8_textprep.h           |    113 +
 external/cddl/osnet/dist/uts/common/sys/u8_textprep_data.h      |  35376 ++++++++++
 external/cddl/osnet/dist/uts/common/sys/zmod.h                  |     68 +
 external/cddl/osnet/dist/uts/common/zmod/adler32.c              |    149 +
 external/cddl/osnet/dist/uts/common/zmod/crc32.c                |    428 +
 external/cddl/osnet/dist/uts/common/zmod/crc32.h                |    443 +
 external/cddl/osnet/dist/uts/common/zmod/deflate.c              |   1742 +
 external/cddl/osnet/dist/uts/common/zmod/deflate.h              |    331 +
 external/cddl/osnet/dist/uts/common/zmod/inffast.c              |    320 +
 external/cddl/osnet/dist/uts/common/zmod/inffast.h              |     13 +
 external/cddl/osnet/dist/uts/common/zmod/inffixed.h             |     96 +
 external/cddl/osnet/dist/uts/common/zmod/inflate.c              |   1395 +
 external/cddl/osnet/dist/uts/common/zmod/inflate.h              |    117 +
 external/cddl/osnet/dist/uts/common/zmod/inftrees.c             |    331 +
 external/cddl/osnet/dist/uts/common/zmod/inftrees.h             |     57 +
 external/cddl/osnet/dist/uts/common/zmod/trees.c                |   1219 +
 external/cddl/osnet/dist/uts/common/zmod/zconf.h                |    117 +
 external/cddl/osnet/dist/uts/common/zmod/zlib.h                 |   1359 +
 external/cddl/osnet/dist/uts/common/zmod/zmod.c                 |    113 +
 external/cddl/osnet/dist/uts/common/zmod/zmod_subr.c            |     85 +
 external/cddl/osnet/dist/uts/common/zmod/zutil.c                |    324 +
 external/cddl/osnet/dist/uts/common/zmod/zutil.h                |    274 +
 231 files changed, 175075 insertions(+), 0 deletions(-)

diffs (truncated from 175999 to 300 lines):

diff -r ca45222c1f31 -r c9b27ecad83f external/cddl/osnet/dist/cmd/zdb/zdb.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/cddl/osnet/dist/cmd/zdb/zdb.c    Fri Aug 07 18:32:15 2009 +0000
@@ -0,0 +1,2430 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (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 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/zfs_context.h>
+#include <sys/spa.h>
+#include <sys/spa_impl.h>
+#include <sys/dmu.h>
+#include <sys/zap.h>
+#include <sys/fs/zfs.h>
+#include <sys/zfs_znode.h>
+#include <sys/vdev.h>
+#include <sys/vdev_impl.h>
+#include <sys/metaslab_impl.h>
+#include <sys/dmu_objset.h>
+#include <sys/dsl_dir.h>
+#include <sys/dsl_dataset.h>
+#include <sys/dsl_pool.h>
+#include <sys/dbuf.h>
+#include <sys/zil.h>
+#include <sys/zil_impl.h>
+#include <sys/stat.h>
+#include <sys/resource.h>
+#include <sys/dmu_traverse.h>
+#include <sys/zio_checksum.h>
+#include <sys/zio_compress.h>
+#include <sys/zfs_fuid.h>
+#include <sys/arc.h>
+#undef ZFS_MAXNAMELEN
+#undef verify
+#include <libzfs.h>
+
+const char cmdname[] = "zdb";
+uint8_t dump_opt[256];
+
+typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
+
+extern void dump_intent_log(zilog_t *);
+uint64_t *zopt_object = NULL;
+int zopt_objects = 0;
+libzfs_handle_t *g_zfs;
+boolean_t zdb_sig_user_data = B_TRUE;
+int zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256;
+
+/*
+ * These libumem hooks provide a reasonable set of defaults for the allocator's
+ * debugging facilities.
+ */
+const char *
+_umem_debug_init()
+{
+       return ("default,verbose"); /* $UMEM_DEBUG setting */
+}
+
+const char *
+_umem_logging_init(void)
+{
+       return ("fail,contents"); /* $UMEM_LOGGING setting */
+}
+
+static void
+usage(void)
+{
+       (void) fprintf(stderr,
+           "Usage: %s [-udibcsvL] [-U cachefile_path] "
+           "[-S user:cksumalg] "
+           "dataset [object...]\n"
+           "       %s -C [pool]\n"
+           "       %s -l dev\n"
+           "       %s -R pool:vdev:offset:size:flags\n"
+           "       %s [-p path_to_vdev_dir]\n"
+           "       %s -e pool | GUID | devid ...\n",
+           cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
+
+       (void) fprintf(stderr, "        -u uberblock\n");
+       (void) fprintf(stderr, "        -d datasets\n");
+       (void) fprintf(stderr, "        -C cached pool configuration\n");
+       (void) fprintf(stderr, "        -i intent logs\n");
+       (void) fprintf(stderr, "        -b block statistics\n");
+       (void) fprintf(stderr, "        -c checksum all data blocks\n");
+       (void) fprintf(stderr, "        -s report stats on zdb's I/O\n");
+       (void) fprintf(stderr, "        -S <user|all>:<cksum_alg|all> -- "
+           "dump blkptr signatures\n");
+       (void) fprintf(stderr, "        -v verbose (applies to all others)\n");
+       (void) fprintf(stderr, "        -l dump label contents\n");
+       (void) fprintf(stderr, "        -L disable leak tracking (do not "
+           "load spacemaps)\n");
+       (void) fprintf(stderr, "        -U cachefile_path -- use alternate "
+           "cachefile\n");
+       (void) fprintf(stderr, "        -R read and display block from a "
+           "device\n");
+       (void) fprintf(stderr, "        -e Pool is exported/destroyed/"
+           "has altroot\n");
+       (void) fprintf(stderr, "        -p <Path to vdev dir> (use with -e)\n");
+       (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
+           "to make only that option verbose\n");
+       (void) fprintf(stderr, "Default is to dump everything non-verbosely\n");
+       exit(1);
+}
+
+static void
+fatal(const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       (void) fprintf(stderr, "%s: ", cmdname);
+       (void) vfprintf(stderr, fmt, ap);
+       va_end(ap);
+       (void) fprintf(stderr, "\n");
+
+       abort();
+}
+
+static void
+dump_nvlist(nvlist_t *list, int indent)
+{
+       nvpair_t *elem = NULL;
+
+       while ((elem = nvlist_next_nvpair(list, elem)) != NULL) {
+               switch (nvpair_type(elem)) {
+               case DATA_TYPE_STRING:
+                       {
+                               char *value;
+
+                               VERIFY(nvpair_value_string(elem, &value) == 0);
+                               (void) printf("%*s%s='%s'\n", indent, "",
+                                   nvpair_name(elem), value);
+                       }
+                       break;
+
+               case DATA_TYPE_UINT64:
+                       {
+                               uint64_t value;
+
+                               VERIFY(nvpair_value_uint64(elem, &value) == 0);
+                               (void) printf("%*s%s=%llu\n", indent, "",
+                                   nvpair_name(elem), (u_longlong_t)value);
+                       }
+                       break;
+
+               case DATA_TYPE_NVLIST:
+                       {
+                               nvlist_t *value;
+
+                               VERIFY(nvpair_value_nvlist(elem, &value) == 0);
+                               (void) printf("%*s%s\n", indent, "",
+                                   nvpair_name(elem));
+                               dump_nvlist(value, indent + 4);
+                       }
+                       break;
+
+               case DATA_TYPE_NVLIST_ARRAY:
+                       {
+                               nvlist_t **value;
+                               uint_t c, count;
+
+                               VERIFY(nvpair_value_nvlist_array(elem, &value,
+                                   &count) == 0);
+
+                               for (c = 0; c < count; c++) {
+                                       (void) printf("%*s%s[%u]\n", indent, "",
+                                           nvpair_name(elem), c);
+                                       dump_nvlist(value[c], indent + 8);
+                               }
+                       }
+                       break;
+
+               default:
+
+                       (void) printf("bad config type %d for %s\n",
+                           nvpair_type(elem), nvpair_name(elem));
+               }
+       }
+}
+
+/* ARGSUSED */
+static void
+dump_packed_nvlist(objset_t *os, uint64_t object, void *data, size_t size)
+{
+       nvlist_t *nv;
+       size_t nvsize = *(uint64_t *)data;
+       char *packed = umem_alloc(nvsize, UMEM_NOFAIL);
+
+       VERIFY(0 == dmu_read(os, object, 0, nvsize, packed));
+
+       VERIFY(nvlist_unpack(packed, nvsize, &nv, 0) == 0);
+
+       umem_free(packed, nvsize);
+
+       dump_nvlist(nv, 8);
+
+       nvlist_free(nv);
+}
+
+const char dump_zap_stars[] = "****************************************";
+const int dump_zap_width = sizeof (dump_zap_stars) - 1;
+
+static void
+dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE])
+{
+       int i;
+       int minidx = ZAP_HISTOGRAM_SIZE - 1;
+       int maxidx = 0;
+       uint64_t max = 0;
+
+       for (i = 0; i < ZAP_HISTOGRAM_SIZE; i++) {
+               if (histo[i] > max)
+                       max = histo[i];
+               if (histo[i] > 0 && i > maxidx)
+                       maxidx = i;
+               if (histo[i] > 0 && i < minidx)
+                       minidx = i;
+       }
+
+       if (max < dump_zap_width)
+               max = dump_zap_width;
+
+       for (i = minidx; i <= maxidx; i++)
+               (void) printf("\t\t\t%u: %6llu %s\n", i, (u_longlong_t)histo[i],
+                   &dump_zap_stars[(max - histo[i]) * dump_zap_width / max]);
+}
+
+static void
+dump_zap_stats(objset_t *os, uint64_t object)
+{
+       int error;
+       zap_stats_t zs;
+
+       error = zap_get_stats(os, object, &zs);
+       if (error)
+               return;
+
+       if (zs.zs_ptrtbl_len == 0) {
+               ASSERT(zs.zs_num_blocks == 1);
+               (void) printf("\tmicrozap: %llu bytes, %llu entries\n",
+                   (u_longlong_t)zs.zs_blocksize,
+                   (u_longlong_t)zs.zs_num_entries);
+               return;
+       }
+
+       (void) printf("\tFat ZAP stats:\n");
+
+       (void) printf("\t\tPointer table:\n");
+       (void) printf("\t\t\t%llu elements\n",
+           (u_longlong_t)zs.zs_ptrtbl_len);
+       (void) printf("\t\t\tzt_blk: %llu\n",
+           (u_longlong_t)zs.zs_ptrtbl_zt_blk);
+       (void) printf("\t\t\tzt_numblks: %llu\n",
+           (u_longlong_t)zs.zs_ptrtbl_zt_numblks);
+       (void) printf("\t\t\tzt_shift: %llu\n",
+           (u_longlong_t)zs.zs_ptrtbl_zt_shift);
+       (void) printf("\t\t\tzt_blks_copied: %llu\n",
+           (u_longlong_t)zs.zs_ptrtbl_blks_copied);
+       (void) printf("\t\t\tzt_nextblk: %llu\n",
+           (u_longlong_t)zs.zs_ptrtbl_nextblk);
+
+       (void) printf("\t\tZAP entries: %llu\n",
+           (u_longlong_t)zs.zs_num_entries);
+       (void) printf("\t\tLeaf blocks: %llu\n",
+           (u_longlong_t)zs.zs_num_leafs);
+       (void) printf("\t\tTotal blocks: %llu\n",
+           (u_longlong_t)zs.zs_num_blocks);
+       (void) printf("\t\tzap_block_type: 0x%llx\n",
+           (u_longlong_t)zs.zs_block_type);
+       (void) printf("\t\tzap_magic: 0x%llx\n",
+           (u_longlong_t)zs.zs_magic);
+       (void) printf("\t\tzap_salt: 0x%llx\n",
+           (u_longlong_t)zs.zs_salt);
+
+       (void) printf("\t\tLeafs with 2^n pointers:\n");



Home | Main Index | Thread Index | Old Index