1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-03 12:35:02 +00:00

Originally, this file could be compiled as a user-space application for

testing purposes.  However, over the years, various changes to the kernel
have broken this feature.  This revision applies some fixes to get user-
space compilation working again.  There are no changes in this revision
to code that is used by the kernel.

MFC after:	3 days
This commit is contained in:
Alan Cox 2017-06-07 16:04:34 +00:00
parent a8cf90eb9a
commit d90bf7d850
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319655

View File

@ -99,9 +99,8 @@ __FBSDID("$FreeBSD$");
#define BLIST_DEBUG
#endif
#define SWAPBLK_NONE ((daddr_t)-1)
#include <sys/types.h>
#include <sys/malloc.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -110,8 +109,6 @@ __FBSDID("$FreeBSD$");
#define malloc(a,b,c) calloc(a, 1)
#define free(a,b) free(a)
typedef unsigned int u_daddr_t;
#include <sys/blist.h>
void panic(const char *ctl, ...);
@ -921,7 +918,7 @@ blst_radix_print(blmeta_t *scan, daddr_t blk, daddr_t radix, int skip, int tab)
if (radix == BLIST_BMAP_RADIX) {
printf(
"%*.*s(%08llx,%lld): bitmap %08llx big=%lld\n",
"%*.*s(%08llx,%lld): bitmap %016llx big=%lld\n",
tab, tab, "",
(long long)blk, (long long)radix,
(long long)scan->u.bmu_bitmap,
@ -1015,9 +1012,8 @@ main(int ac, char **av)
for (;;) {
char buf[1024];
daddr_t da = 0;
daddr_t count = 0;
long long da = 0;
long long count = 0;
printf("%lld/%lld/%lld> ", (long long)bl->bl_free,
(long long)size, (long long)bl->bl_radix);
@ -1027,7 +1023,7 @@ main(int ac, char **av)
switch(buf[0]) {
case 'r':
if (sscanf(buf + 1, "%lld", &count) == 1) {
blist_resize(&bl, count, 1);
blist_resize(&bl, count, 1, M_WAITOK);
} else {
printf("?\n");
}
@ -1043,16 +1039,14 @@ main(int ac, char **av)
}
break;
case 'f':
if (sscanf(buf + 1, "%llx %lld",
(long long *)&da, (long long *)&count) == 2) {
if (sscanf(buf + 1, "%llx %lld", &da, &count) == 2) {
blist_free(bl, da, count);
} else {
printf("?\n");
}
break;
case 'l':
if (sscanf(buf + 1, "%llx %lld",
(long long *)&da, (long long *)&count) == 2) {
if (sscanf(buf + 1, "%llx %lld", &da, &count) == 2) {
printf(" n=%d\n",
blist_fill(bl, da, count));
} else {