From owner-p4-projects@FreeBSD.ORG Wed Nov 28 21:33:52 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 47414B35; Wed, 28 Nov 2012 21:33:52 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 05F90B33 for ; Wed, 28 Nov 2012 21:33:52 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id DED9A8FC13 for ; Wed, 28 Nov 2012 21:33:51 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.5/8.14.5) with ESMTP id qASLXpJ8088238 for ; Wed, 28 Nov 2012 21:33:51 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.5/8.14.5/Submit) id qASLXph9088235 for perforce@freebsd.org; Wed, 28 Nov 2012 21:33:51 GMT (envelope-from brooks@freebsd.org) Date: Wed, 28 Nov 2012 21:33:51 GMT Message-Id: <201211282133.qASLXph9088235@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 219861 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 21:33:52 -0000 http://p4web.freebsd.org/@@219861?ac=10 Change 219861 by brooks@brooks_zenith on 2012/11/28 21:33:04 Add verbosity controls to libimagebox, libcheri, and cheripoint. For now just push the same level down to all libraries. CheriPoint should now no longer spam the pictview console. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/imagebox.h#4 edit .. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#8 edit .. //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#15 edit .. //depot/projects/ctsrd/cheribsd/src/lib/libcheri/sandbox.c#2 edit .. //depot/projects/ctsrd/cheribsd/src/lib/libcheri/sandbox.h#2 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/imagebox.h#4 (text+ko) ==== @@ -49,6 +49,8 @@ void *private; }; +extern int ibox_verbose; + void iboxstate_free(struct iboxstate *ps); struct iboxstate* png_read_start(int pfd, uint32_t maxw, uint32_t maxh, ==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#8 (text+ko) ==== @@ -51,6 +51,8 @@ #include "iboxpriv.h" #include "sandbox.h" +int ibox_verbose; + struct pthr_decode_private { pthread_t pthr; @@ -239,6 +241,9 @@ sizeof(*is->buffer))) == NULL) goto error; + if (ibox_verbose) + sb_verbose = ibox_verbose; + if (sandbox_setup("/usr/libexec/readpng-cheri.bin", 4*1024*1024, &sandbox) < 0) goto error; @@ -262,7 +267,8 @@ v = sandbox_invoke(sandbox, width, height, pnglen, 0, &c1, &c2, NULL, NULL, NULL, NULL, NULL); - printf("%s: sandbox returned %ju\n", __func__, (uintmax_t)v); + if (ibox_verbose) + printf("%s: sandbox returned %ju\n", __func__, (uintmax_t)v); sandbox_destroy(sandbox); is->valid_rows = height; is->passes_remaining = 0; ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#15 (text+ko) ==== @@ -34,6 +34,9 @@ #include #include +#include +#include + #include #include #include @@ -66,6 +69,7 @@ MTL_DM_640x480_CENTER /* 640x480 VGA from 480p, center pixels */ }; +int verbose = 0; int sb_vis = 0; uint32_t header_height; uint32_t *busyarea, *hourglass; @@ -447,8 +451,6 @@ uint32_t r; struct iboxstate *is; - printf("rendering cover\n"); - busy(1); if ((pfd = openat(dfd, cover, O_RDONLY)) == -1) { @@ -504,8 +506,6 @@ error = 0; - printf("rendering slide %s\n", slide); - busy(1); if ((pfd = openat(dfd, slide, O_RDONLY)) == -1) { @@ -840,11 +840,14 @@ int slide, nslides, maxslides; struct tsstate *ts, tshack = {0, 0, 0, 0, 0, 0,}; - while ((ch = getopt(argc, argv, "f")) != -1) { + while ((ch = getopt(argc, argv, "fv")) != -1) { switch (ch) { case 'f': forkflag = 1; break; + case 'v': + verbose++; + break; default: usage(); } @@ -852,6 +855,9 @@ argc -= optind; argv += optind; + if (verbose) + ibox_verbose = verbose; + if (argc != 1) usage(); @@ -879,8 +885,6 @@ set_display_mode(res); init_header_height(); - printf("reading slides\n"); - maxcovers = ncovers = 0; maxslides = nslides = 0; if ((dirp = opendir(argv[0])) == NULL) @@ -898,7 +902,8 @@ else addslide(&nslides, &maxslides, &slides, entry->d_name); } - printf("read %d covers and %d slides\n", ncovers, nslides); + if (verbose) + printf("read %d covers and %d slides\n", ncovers, nslides); qsort(slides, nslides, sizeof(*slides), &strpcmp); qsort(covers, ncovers, sizeof(*covers), &strpcmp); ==== //depot/projects/ctsrd/cheribsd/src/lib/libcheri/sandbox.c#2 (text+ko) ==== @@ -51,6 +51,8 @@ #define PAGE_SIZE 0x1000 #define STACK_SIZE (32*PAGE_SIZE) +int sb_verbose; + /* * Library routine for setting up a sandbox. */ @@ -209,23 +211,25 @@ CHERI_CSC(10, 0, &sb->sb_segment, 0); sb->sb_sandboxlen = sandboxlen; - printf("Sandbox configured:\n"); - printf(" Path: %s\n", sb->sb_path); - printf(" Mem: %p\n", sb->sb_mem); - printf(" Len: %ju\n", (uintmax_t)sb->sb_sandboxlen); - printf(" Segment:\n"); - CHERI_CGETTAG(v, 10); - printf(" t %u", (u_int)v); - CHERI_CGETUNSEALED(v, 10); - printf(" u %u", (u_int)v); - CHERI_CGETPERM(v, 10); - printf(" perms %04x", (u_int)v); - CHERI_CGETTYPE(v, 10); - printf(" otype %p\n", (void *)v); - CHERI_CGETBASE(v, 10); - printf(" base %p", (void *)v); - CHERI_CGETLEN(v, 10); - printf(" length %p\n", (void *)v); + if (sb_verbose) { + printf("Sandbox configured:\n"); + printf(" Path: %s\n", sb->sb_path); + printf(" Mem: %p\n", sb->sb_mem); + printf(" Len: %ju\n", (uintmax_t)sb->sb_sandboxlen); + printf(" Segment:\n"); + CHERI_CGETTAG(v, 10); + printf(" t %u", (u_int)v); + CHERI_CGETUNSEALED(v, 10); + printf(" u %u", (u_int)v); + CHERI_CGETPERM(v, 10); + printf(" perms %04x", (u_int)v); + CHERI_CGETTYPE(v, 10); + printf(" otype %p\n", (void *)v); + CHERI_CGETBASE(v, 10); + printf(" base %p", (void *)v); + CHERI_CGETLEN(v, 10); + printf(" length %p\n", (void *)v); + } *sbp = sb; return (0); ==== //depot/projects/ctsrd/cheribsd/src/lib/libcheri/sandbox.h#2 (text+ko) ==== @@ -31,6 +31,8 @@ #ifndef _SANDBOX_H_ #define _SANDBOX_H_ +extern int sb_verbose; + struct sandbox; int sandbox_setup(const char *path, register_t sandboxlen, struct sandbox **sbp);