Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Jun 2017 16:04:34 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319655 - head/sys/kern
Message-ID:  <201706071604.v57G4YIJ069344@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Wed Jun  7 16:04:34 2017
New Revision: 319655
URL: https://svnweb.freebsd.org/changeset/base/319655

Log:
  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

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==============================================================================
--- head/sys/kern/subr_blist.c	Wed Jun  7 12:50:54 2017	(r319654)
+++ head/sys/kern/subr_blist.c	Wed Jun  7 16:04:34 2017	(r319655)
@@ -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 
 
 	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,10 +1012,9 @@ 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);
 		fflush(stdout);
@@ -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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706071604.v57G4YIJ069344>