kvm_getswapinfo.c (43173) | kvm_getswapinfo.c (43282) |
---|---|
1/* 2 * Copyright (c) 1999, Matthew Dillon. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided under the terms of the BSD 6 * Copyright as found in /usr/src/COPYRIGHT in the FreeBSD source tree. 7 */ 8 9#ifndef lint 10static const char copyright[] = 11 "@(#) Copyright (c) 1999\n" 12 "Matthew Dillon. All rights reserved.\n"; 13#endif /* not lint */ 14 15#ifndef lint 16static const char rcsid[] = | 1/* 2 * Copyright (c) 1999, Matthew Dillon. All Rights Reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided under the terms of the BSD 6 * Copyright as found in /usr/src/COPYRIGHT in the FreeBSD source tree. 7 */ 8 9#ifndef lint 10static const char copyright[] = 11 "@(#) Copyright (c) 1999\n" 12 "Matthew Dillon. All rights reserved.\n"; 13#endif /* not lint */ 14 15#ifndef lint 16static const char rcsid[] = |
17 "$Id: kvm_getswapinfo.c,v 1.2 1999/01/22 10:57:03 dillon Exp $"; | 17 "$Id: kvm_getswapinfo.c,v 1.3 1999/01/25 04:07:07 dillon Exp $"; |
18#endif /* not lint */ 19 20#include <sys/param.h> 21#include <sys/time.h> 22#include <sys/vnode.h> 23#include <sys/ucred.h> 24#include <sys/stat.h> 25#include <sys/conf.h> --- 26 unchanged lines hidden (view full) --- 52#define NL_DMMAX 4 53 54static int kvm_swap_nl_cached = 0; 55static int nswdev; 56static int unswdev; 57static int dmmax; 58static int type; 59 | 18#endif /* not lint */ 19 20#include <sys/param.h> 21#include <sys/time.h> 22#include <sys/vnode.h> 23#include <sys/ucred.h> 24#include <sys/stat.h> 25#include <sys/conf.h> --- 26 unchanged lines hidden (view full) --- 52#define NL_DMMAX 4 53 54static int kvm_swap_nl_cached = 0; 55static int nswdev; 56static int unswdev; 57static int dmmax; 58static int type; 59 |
60static void getswapinfo_old(kvm_t *kd, kvm_swap_t swap_ary, int swap_max, int flags); 61static void getswapinfo_radix(kvm_t *kd, kvm_swap_t swap_ary, int swap_max, int flags); | 60static void getswapinfo_old(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, 61 int flags); 62static void getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, 63 int swap_max, int flags); |
62 63#define SVAR(var) __STRING(var) /* to force expansion */ 64#define KGET(idx, var) \ 65 KGET1(idx, &var, sizeof(var), SVAR(var)) 66#define KGET1(idx, p, s, msg) \ 67 KGET2(kvm_swap_nl[idx].n_value, p, s, msg) 68#define KGET2(addr, p, s, msg) \ 69 if (kvm_read(kd, (u_long)(addr), p, s) != s) \ --- 166 unchanged lines hidden (view full) --- 236 blmeta_t *scan, 237 daddr_t blk, 238 daddr_t radix, 239 daddr_t skip, 240 daddr_t count, 241 kvm_t *kd, 242 int dmmax, 243 int nswdev, | 64 65#define SVAR(var) __STRING(var) /* to force expansion */ 66#define KGET(idx, var) \ 67 KGET1(idx, &var, sizeof(var), SVAR(var)) 68#define KGET1(idx, p, s, msg) \ 69 KGET2(kvm_swap_nl[idx].n_value, p, s, msg) 70#define KGET2(addr, p, s, msg) \ 71 if (kvm_read(kd, (u_long)(addr), p, s) != s) \ --- 166 unchanged lines hidden (view full) --- 238 blmeta_t *scan, 239 daddr_t blk, 240 daddr_t radix, 241 daddr_t skip, 242 daddr_t count, 243 kvm_t *kd, 244 int dmmax, 245 int nswdev, |
244 kvm_swap_t swap_ary, | 246 struct kvm_swap *swap_ary, |
245 int swap_max, 246 int tab, 247 int flags 248) { 249 blmeta_t meta; 250 int ti = (unswdev >= swap_max) ? swap_max - 1 : unswdev; 251 252 KGET2(scan, &meta, sizeof(meta), "blmeta_t"); --- 140 unchanged lines hidden (view full) --- 393 if (flags & SWIF_DUMP_TREE) { 394 printf("%*.*s}\n", TABME); 395 } 396 } 397 return(0); 398} 399 400static void | 247 int swap_max, 248 int tab, 249 int flags 250) { 251 blmeta_t meta; 252 int ti = (unswdev >= swap_max) ? swap_max - 1 : unswdev; 253 254 KGET2(scan, &meta, sizeof(meta), "blmeta_t"); --- 140 unchanged lines hidden (view full) --- 395 if (flags & SWIF_DUMP_TREE) { 396 printf("%*.*s}\n", TABME); 397 } 398 } 399 return(0); 400} 401 402static void |
401getswapinfo_radix(kvm_t *kd, kvm_swap_t swap_ary, int swap_max, int flags) | 403getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, int flags) |
402{ 403 struct blist *swapblist = NULL; 404 struct blist blcopy = { 0 }; 405 406 KGET(NL_SWAPBLIST, swapblist); 407 KGET2(swapblist, &blcopy, sizeof(blcopy), "*swapblist"); 408 409 if (flags & SWIF_DUMP_TREE) { --- 17 unchanged lines hidden (view full) --- 427 swap_ary, 428 swap_max, 429 0, 430 flags 431 ); 432} 433 434static void | 404{ 405 struct blist *swapblist = NULL; 406 struct blist blcopy = { 0 }; 407 408 KGET(NL_SWAPBLIST, swapblist); 409 KGET2(swapblist, &blcopy, sizeof(blcopy), "*swapblist"); 410 411 if (flags & SWIF_DUMP_TREE) { --- 17 unchanged lines hidden (view full) --- 429 swap_ary, 430 swap_max, 431 0, 432 flags 433 ); 434} 435 436static void |
435getswapinfo_old(kvm_t *kd, kvm_swap_t swap_ary, int swap_max, int flags) | 437getswapinfo_old(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, int flags) |
436{ 437 struct rlist *swapptr; 438 struct rlisthdr swaplist; 439 int ti = (unswdev >= swap_max) ? swap_max - 1 : unswdev; 440 441 KGET(NL_SWAPLIST, swaplist); 442 443 swapptr = swaplist.rlh_list; --- 44 unchanged lines hidden --- | 438{ 439 struct rlist *swapptr; 440 struct rlisthdr swaplist; 441 int ti = (unswdev >= swap_max) ? swap_max - 1 : unswdev; 442 443 KGET(NL_SWAPLIST, swaplist); 444 445 swapptr = swaplist.rlh_list; --- 44 unchanged lines hidden --- |