Date: Mon, 7 Mar 2011 22:30:55 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 189688 for review Message-ID: <201103072230.p27MUt0E091486@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@189688?ac=10 Change 189688 by jhb@jhb_jhbbsd on 2011/03/07 22:30:28 Flesh out and compile. Affected files ... .. //depot/projects/pci/sys/modules/rman/rman.c#2 edit Differences ... ==== //depot/projects/pci/sys/modules/rman/rman.c#2 (text+ko) ==== @@ -2,6 +2,8 @@ * Regression tests for rman_adjust_resource(). */ +#include <sys/param.h> +#include <sys/kernel.h> #include <sys/module.h> #include <sys/rman.h> #include <sys/sysctl.h> @@ -24,6 +26,8 @@ SYSCTL_ULONG(_debug_rman, OID_AUTO, count, CTLFLAG_RW, &count_value, 0, "count parameter"); +static void unload(void); + static int sysctl_rman_alloc(SYSCTL_HANDLER_ARGS) { @@ -47,6 +51,45 @@ sysctl_rman_alloc, "I", "allocate a resource"); static int +sysctl_rman_adjust(SYSCTL_HANDLER_ARGS) +{ + int error, i = 0; + + error = sysctl_handle_int(oidp, &i, sizeof(i), req); + if (error || req->newptr == NULL || i == 0) + return (error); + if (r == NULL) + return (EINVAL); + error = rman_adjust_resource(r, start_value, end_value); + if (error) + printf("Failed to adjust resource\n"); + else + printf("Adjusted to (%lu, %lu)\n", rman_get_start(r), + rman_get_end(r)); + return (error); +} +SYSCTL_PROC(_debug_rman, OID_AUTO, adjust, CTLTYPE_INT | CTLFLAG_RW, 0, 0, + sysctl_rman_adjust, "I", "adjust a resource"); + +static int +sysctl_rman_release(SYSCTL_HANDLER_ARGS) +{ + int error, i = 0; + + error = sysctl_handle_int(oidp, &i, sizeof(i), req); + if (error || req->newptr == NULL || i == 0) + return (error); + if (r == NULL) + return (EINVAL); + error = rman_release_resource(r); + if (error == 0) + r = NULL; + return (error); +} +SYSCTL_PROC(_debug_rman, OID_AUTO, release, CTLTYPE_INT | CTLFLAG_RW, 0, 0, + sysctl_rman_release, "I", "release a resource"); + +static int load(void) { int error; @@ -80,15 +123,6 @@ printf("Failed to destroy rman: %d\n", error); } -static void -run_rman_tests(void) -{ - error = rman_adjust_resource(r, 10, 15); - if (error != EINVAL) { - printf("Hmm, adjust to (10, 15) should have failed\n"); - kdb_enter(KDB_W -} - static int mod_event(struct module *module, int cmd, void *arg) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103072230.p27MUt0E091486>