[PATCH v3 10/13] sandbox: hostfile: is always mmpad'ed

Marc Kleine-Budde mkl at pengutronix.de
Tue Mar 3 04:14:56 PST 2015


...so remove conditional code.

Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
 arch/sandbox/os/common.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index e2023165d542..3fa0370dfba3 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -209,7 +209,7 @@ extern void mem_malloc_init(void *start, void *end);
 static int add_image(char *str, char *devname)
 {
 	char *filename;
-	int readonly = 0, map = 1;
+	int readonly = 0;
 	struct stat s;
 	char *opt;
 	int fd, ret;
@@ -222,8 +222,6 @@ static int add_image(char *str, char *devname)
 	while ((opt = strtok(NULL, ","))) {
 		if (!strcmp(opt, "ro"))
 			readonly = 1;
-		if (!strcmp(opt, "map"))
-			map = 1;
 	}
 
 	printf("add file %s(%s)\n", filename, readonly ? "ro" : "");
@@ -245,13 +243,11 @@ static int add_image(char *str, char *devname)
 	hf->size = s.st_size;
 	hf->devname = strdup(devname);
 
-	if (map) {
-		hf->base = (unsigned long)mmap(NULL, hf->size,
-				PROT_READ | (readonly ? 0 : PROT_WRITE),
-				MAP_SHARED, fd, 0);
-		if ((void *)hf->base == MAP_FAILED)
-			printf("warning: mmapping %s failed\n", filename);
-	}
+	hf->base = (unsigned long)mmap(NULL, hf->size,
+			PROT_READ | (readonly ? 0 : PROT_WRITE),
+			MAP_SHARED, fd, 0);
+	if ((void *)hf->base == MAP_FAILED)
+		printf("warning: mmapping %s failed\n", filename);
 
 	ret = barebox_register_filedev(hf);
 	if (ret)
-- 
2.1.4




More information about the barebox mailing list