diff options
author | phk <phk@FreeBSD.org> | 2003-07-31 21:30:28 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-07-31 21:30:28 +0000 |
commit | 5a8eb87c5a2d61d28976b139ed73bbcc22dc6f8d (patch) | |
tree | 0b31c4ecc9977f673344961dc3c29fe215244ad3 /lib/libkvm | |
parent | 1852720fa33fb1603dc8d66f3b8d02faa7cf42ba (diff) | |
download | FreeBSD-src-5a8eb87c5a2d61d28976b139ed73bbcc22dc6f8d.zip FreeBSD-src-5a8eb87c5a2d61d28976b139ed73bbcc22dc6f8d.tar.gz |
Retire the SWIF_DUMP_TREE code, this is in the way for a rework of
the swap_pager layout.
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm.h | 1 | ||||
-rw-r--r-- | lib/libkvm/kvm_getswapinfo.c | 190 |
2 files changed, 0 insertions, 191 deletions
diff --git a/lib/libkvm/kvm.h b/lib/libkvm/kvm.h index 034432e..1bb4eda 100644 --- a/lib/libkvm/kvm.h +++ b/lib/libkvm/kvm.h @@ -69,7 +69,6 @@ struct kvm_swap { int ksw_reserved2; }; -#define SWIF_DUMP_TREE 0x0001 #define SWIF_DEV_PREFIX 0x0002 __BEGIN_DECLS diff --git a/lib/libkvm/kvm_getswapinfo.c b/lib/libkvm/kvm_getswapinfo.c index be22e76..35702a8 100644 --- a/lib/libkvm/kvm_getswapinfo.c +++ b/lib/libkvm/kvm_getswapinfo.c @@ -51,8 +51,6 @@ static int nswdev; static int unswdev; /* number of found swap dev's */ static int dmmax; -static void getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, - int swap_max, int flags); static int kvm_getswapinfo2(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, int flags); static int kvm_getswapinfo_kvm(kvm_t *, struct kvm_swap *, int, int); @@ -108,23 +106,6 @@ kvm_getswapinfo( return(0); } - rv = kvm_getswapinfo2(kd, swap_ary, swap_max, flags); - - /* This is only called when the tree shall be dumped. It needs kvm. */ - if (flags & SWIF_DUMP_TREE) { - getswapinfo_radix(kd, swap_ary, swap_max, flags); - } - - return rv; -} - -static int -kvm_getswapinfo2( - kvm_t *kd, - struct kvm_swap *swap_ary, - int swap_max, - int flags -) { if (ISALIVE(kd)) { return kvm_getswapinfo_sysctl(kd, swap_ary, swap_max, flags); } else { @@ -199,177 +180,6 @@ kvm_getswapinfo_kvm( return(ti); } -/* - * scanradix() - support routine for radix scanner - */ - -#define TABME tab, tab, "" - -static int -scanradix( - blmeta_t *scan, - daddr_t blk, - daddr_t radix, - daddr_t skip, - daddr_t count, - kvm_t *kd, - int dmmax, - int nswdev, - struct kvm_swap *swap_ary, - int swap_max, - int tab, - int flags -) { - blmeta_t meta; - - KGET2(scan, &meta, sizeof(meta), "blmeta_t"); - - /* - * Terminator - */ - if (meta.bm_bighint == (daddr_t)-1) { - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Terminator\n", - TABME, - blk, - radix - ); - } - return(-1); - } - - if (radix == BLIST_BMAP_RADIX) { - /* - * Leaf bitmap - */ - - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Bitmap %08x big=%d\n", - TABME, - blk, - radix, - (int)meta.u.bmu_bitmap, - meta.bm_bighint - ); - } - - } else if (meta.u.bmu_avail == radix) { - /* - * Meta node if all free - */ - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Submap ALL-FREE {\n", - TABME, - blk, - radix - ); - } - } else if (meta.u.bmu_avail == 0) { - /* - * Meta node if all used - */ - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Submap ALL-ALLOCATED\n", - TABME, - blk, - radix - ); - } - } else { - /* - * Meta node if not all free - */ - int i; - int next_skip; - - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Submap avail=%d big=%d {\n", - TABME, - blk, - radix, - (int)meta.u.bmu_avail, - meta.bm_bighint - ); - } - - radix /= BLIST_META_RADIX; - next_skip = skip / BLIST_META_RADIX; - - for (i = 1; i <= skip; i += next_skip) { - int r; - daddr_t vcount = (count > radix) ? radix : count; - - r = scanradix( - &scan[i], - blk, - radix, - next_skip - 1, - vcount, - kd, - dmmax, - nswdev, - swap_ary, - swap_max, - tab + 4, - flags - ); - if (r < 0) - break; - blk += radix; - } - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s}\n", TABME); - } - } - return(0); -} - -static void -getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, int flags) -{ - struct blist *swapblist = NULL; - struct blist blcopy = { 0 }; - - if (!nlist_init(kd)) { - fprintf(stderr, "radix tree: nlist_init failed!\n"); - return; - } - - KGET(NL_SWAPBLIST, swapblist); - - if (swapblist == NULL) { - if (flags & SWIF_DUMP_TREE) - printf("radix tree: NULL - no swap in system\n"); - return; - } - - KGET2(swapblist, &blcopy, sizeof(blcopy), "*swapblist"); - - if (flags & SWIF_DUMP_TREE) { - printf("radix tree: %d/%d/%d blocks, %dK wired\n", - blcopy.bl_free, - blcopy.bl_blocks, - blcopy.bl_radix, - (int)((blcopy.bl_rootblks * sizeof(blmeta_t) + 1023)/ - 1024) - ); - } - scanradix( - blcopy.bl_root, - 0, - blcopy.bl_radix, - blcopy.bl_skip, - blcopy.bl_rootblks, - kd, - dmmax, - nswdev, - swap_ary, - swap_max, - 0, - flags - ); -} - #define GETSYSCTL(kd, name, var) \ getsysctl(kd, name, &(var), sizeof(var)) |