From owner-svn-soc-all@FreeBSD.ORG Sun Aug 19 00:06:16 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D85D81065744 for ; Sun, 19 Aug 2012 00:06:13 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 19 Aug 2012 00:06:13 +0000 Date: Sun, 19 Aug 2012 00:06:13 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120819000613.D85D81065744@hub.freebsd.org> Cc: Subject: socsvn commit: r240515 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2012 00:06:16 -0000 Author: jhagewood Date: Sun Aug 19 00:06:13 2012 New Revision: 240515 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240515 Log: completed zdiff Modified: soc2012/jhagewood/diff/diffreg.c Modified: soc2012/jhagewood/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diffreg.c Sat Aug 18 23:28:34 2012 (r240514) +++ soc2012/jhagewood/diff/diffreg.c Sun Aug 19 00:06:13 2012 (r240515) @@ -339,9 +339,11 @@ f1 = stdin; else { if (filebehave == FILE_NORMAL) - f1 = fopen(file1, "r"); + if ((f1 = fopen(file1, "r")) == NULL) + err(2, "could not open %s", file1); if (filebehave == FILE_GZIP) { - f1 = decompressfile(file1, "r"); + if ((f1 = decompressfile(file1, "r")) == NULL) + err(2, "could not open %s", file1); } } } @@ -365,9 +367,11 @@ f2 = stdin; else { if (filebehave == FILE_NORMAL) - f2 = fopen(file2, "r"); + if ((f2 = fopen(file2, "r")) == NULL) + err(2, "could not open %s", file2); if (filebehave == FILE_GZIP) - f2 = decompressfile(file2, "r"); + if ((f2 = decompressfile(file2, "r")) == NULL) + err(2, "could not open %s", file2); } } if (f2 == NULL) { From owner-svn-soc-all@FreeBSD.ORG Sun Aug 19 14:19:15 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 4D4FB106564A for ; Sun, 19 Aug 2012 14:19:13 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 19 Aug 2012 14:19:13 +0000 Date: Sun, 19 Aug 2012 14:19:13 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120819141913.4D4FB106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240532 - in soc2012/aleek/beaglexm-armv6/sys: arm/ti/twl boot/fdt/dts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2012 14:19:15 -0000 Author: aleek Date: Sun Aug 19 14:19:12 2012 New Revision: 240532 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240532 Log: minor fixed in TWL Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 11:54:02 2012 (r240531) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 14:19:12 2012 (r240532) @@ -598,11 +598,11 @@ if (!xlocked) TWL_VREG_LOCK_DOWNGRADE(sc); -//#ifdef DEBUG +#ifdef DEBUG if (!err) device_printf(sc->sc_dev, "%s : setting voltage to %dmV (vsel: 0x%x)\n", regulator->name, millivolts, vsel); -//#endif +#endif return (err); } @@ -680,11 +680,11 @@ if (!xlocked) TWL_VREG_LOCK_DOWNGRADE(sc); -//#ifdef DEBUG +#ifdef DEBUG if (!err) device_printf(sc->sc_dev, "%s : read voltage is %dmV (vsel: 0x%x)\n", regulator->name, *millivolts, vsel); -//#endif +#endif return (err); } @@ -900,9 +900,37 @@ /* Enable writing to power configuration registers */ if (twl_is_4030(sc->sc_pdev)) { val = 0xC0; - twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ); + if( twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Unable to unlock PROTECT_KEY\n" ); + return 0; // @todo XXX return sth else + } val = 0x0C; - twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ); + if( twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Unable to unlock PROTECT_KEY\n" ); + return 0; + } + + val = 0x01; + if( twl_write( sc->sc_pdev, 0, 0xFD, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Unable to power USB PHY\n" ); + return 0; + } + if( twl_read( sc->sc_pdev, 3, 0x46, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Could not read P1_SW_EVENTS register\n" ); + return 0; + } + val |= 0x06; + if( twl_write( sc->sc_pdev, 3, 0x46, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Could not write P1_SW_EVENTS register\n" ); + return 0; + } + + } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Sun Aug 19 11:54:02 2012 (r240531) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Sun Aug 19 14:19:12 2012 (r240532) @@ -184,13 +184,22 @@ compatible = "ti,twl4030"; reg = < 0x48 >; voltage-regulators = - "vusb1v5", "1500", - "vusb1v8", "1800", - "vusb3v1", "3100", + "vaux1", "0", + "vaux2", "0", + "vaux3", "0", + "vaux4", "0", + /*"vmmc1", "0",*/ + /*"vmmc2", "0",*/ + /*"vpll1", "0",*/ + "vpll2", "0", + "vsim", "0", + "vdac", "0", + /*"vintana1", "0",*/ + "vintana2", "0", + /*"vintdig", "0",*/ "vusb1v5", "0", "vusb1v8", "0", - "vusb3v1", "0", - "vaux2", "0"; + "vusb3v1", "0"; }; }; /* From owner-svn-soc-all@FreeBSD.ORG Sun Aug 19 14:48:40 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 32AFC106564A for ; Sun, 19 Aug 2012 14:48:38 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 19 Aug 2012 14:48:38 +0000 Date: Sun, 19 Aug 2012 14:48:38 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120819144838.32AFC106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240533 - soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2012 14:48:40 -0000 Author: aleek Date: Sun Aug 19 14:48:33 2012 New Revision: 240533 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240533 Log: cutting off the power to the USB hub Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 14:19:12 2012 (r240532) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 14:48:33 2012 (r240533) @@ -918,18 +918,31 @@ device_printf( sc->sc_dev, "Unable to power USB PHY\n" ); return 0; } + /* if( twl_read( sc->sc_pdev, 3, 0x46, &val, 1 ) != 0 ) { device_printf( sc->sc_dev, "Could not read P1_SW_EVENTS register\n" ); return 0; - } - val |= 0x06; + }*/ + val = 0x00; if( twl_write( sc->sc_pdev, 3, 0x46, &val, 1 ) != 0 ) { device_printf( sc->sc_dev, "Could not write P1_SW_EVENTS register\n" ); return 0; } + if( twl_read( sc->sc_pdev, 2, 0xEE, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Could not read LEDA register\n" ); + return 0; + } + val &= ~0x03; + if( twl_write( sc->sc_pdev, 2, 0xEE, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Could not write LEDA register\n" ); + return 0; + } + } From owner-svn-soc-all@FreeBSD.ORG Sun Aug 19 16:18:46 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 02D36106564A for ; Sun, 19 Aug 2012 16:18:44 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 19 Aug 2012 16:18:44 +0000 Date: Sun, 19 Aug 2012 16:18:44 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120819161844.02D36106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240534 - soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2012 16:18:46 -0000 Author: aleek Date: Sun Aug 19 16:18:43 2012 New Revision: 240534 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240534 Log: created separate function for modyfing LED pin status Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.h Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 14:48:33 2012 (r240533) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 16:18:43 2012 (r240534) @@ -3,6 +3,10 @@ * Ben Gray . * All rights reserved. * + * Copyright (c) 2012 + * Aleksander Dutkowski . + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -815,6 +819,41 @@ } /** + * twl_vreg_led_set - enables or disabled LEDs + * @sc: device soft context + * @leden: LEDEN register mask + * + * To enable led use simple mask TWL4030_LEDEN_LEDnON, + * to disable ~TWL4030_LEDEN_LEDnON + * + * LOCKING: + * The TWL_VEG exclusive lock must be held while this function is called. + * + * RETURNS: + * Zero on success otherwise EINVAL. + * */ +static int +twl_vreg_led_set( struct twl_vreg_softc *sc, uint8_t led ) +{ + uint8_t val; + + if( twl_read( sc->sc_pdev, 2, TWL4030_LEDEN, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Could not read LEDEN register\n" ); + return EINVAL; + } + + val &= led; + + if( twl_write( sc->sc_pdev, 2, TWL4030_LEDEN, &val, 1 ) != 0 ) + { + device_printf( sc->sc_dev, "Could not write LEDEN register\n" ); + return EINVAL; + } + return 0; +} + +/** * twl_add_regulator - adds single voltage regulator sysctls for the device * @sc: device soft context * @name: the name of the regulator @@ -897,8 +936,11 @@ int len = 0, prop_len; uint8_t val; - /* Enable writing to power configuration registers */ if (twl_is_4030(sc->sc_pdev)) { + /* Enable writing to power configuration registers + * by writing proper values to PROTECT_KEY register + */ + val = 0xC0; if( twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ) != 0 ) { @@ -931,19 +973,11 @@ return 0; } - if( twl_read( sc->sc_pdev, 2, 0xEE, &val, 1 ) != 0 ) - { - device_printf( sc->sc_dev, "Could not read LEDA register\n" ); - return 0; - } - val &= ~0x03; - if( twl_write( sc->sc_pdev, 2, 0xEE, &val, 1 ) != 0 ) - { - device_printf( sc->sc_dev, "Could not write LEDA register\n" ); - return 0; - } - - + // if we have BeagleBoard-xM, we need to repower HUB + val = ~(TWL4030_LEDEN_LEDAON || TWL4030_LEDEN_LEDBON); + twl_vreg_led_set( sc, val ); + val = (TWL4030_LEDEN_LEDAON || TWL4030_LEDEN_LEDBON); + twl_vreg_led_set( sc, val ); } Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.h Sun Aug 19 14:48:33 2012 (r240533) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.h Sun Aug 19 16:18:43 2012 (r240534) @@ -3,6 +3,10 @@ * Ben Gray . * All rights reserved. * + * Copyright (c) 2012 + * Aleksander Dutkowski . + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -31,4 +35,13 @@ int twl_vreg_get_voltage(device_t dev, const char *name, int *millivolts); int twl_vreg_set_voltage(device_t dev, const char *name, int millivolts); +#define TWL4030_LEDEN 0xEE +#define TWL4030_LEDEN_LEDAON 0x01 +#define TWL4030_LEDEN_LEDBON 0x02 + +#define TWL4030_PROTECT_KEY 0x44 +#define TWL4030_PROTECT_KEY_1 0xC0 +#define TWL4030_PROTECT_KEY_2 0x0C + + #endif /* _TWL_VREG_H_ */ From owner-svn-soc-all@FreeBSD.ORG Sun Aug 19 17:03:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 09930106564A for ; Sun, 19 Aug 2012 17:03:03 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 19 Aug 2012 17:03:03 +0000 Date: Sun, 19 Aug 2012 17:03:03 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120819170303.09930106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240535 - soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2012 17:03:05 -0000 Author: aleek Date: Sun Aug 19 17:03:02 2012 New Revision: 240535 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240535 Log: minor fixes Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 16:18:43 2012 (r240534) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Sun Aug 19 17:03:02 2012 (r240535) @@ -831,7 +831,8 @@ * * RETURNS: * Zero on success otherwise EINVAL. - * */ + */ +#if 0 static int twl_vreg_led_set( struct twl_vreg_softc *sc, uint8_t led ) { @@ -852,6 +853,7 @@ } return 0; } +#endif /** * twl_add_regulator - adds single voltage regulator sysctls for the device @@ -941,6 +943,7 @@ * by writing proper values to PROTECT_KEY register */ + /* val = 0xC0; if( twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ) != 0 ) { @@ -952,7 +955,7 @@ { device_printf( sc->sc_dev, "Unable to unlock PROTECT_KEY\n" ); return 0; - } + }*/ val = 0x01; if( twl_write( sc->sc_pdev, 0, 0xFD, &val, 1 ) != 0 ) @@ -974,10 +977,11 @@ } // if we have BeagleBoard-xM, we need to repower HUB - val = ~(TWL4030_LEDEN_LEDAON || TWL4030_LEDEN_LEDBON); - twl_vreg_led_set( sc, val ); - val = (TWL4030_LEDEN_LEDAON || TWL4030_LEDEN_LEDBON); + /* + val = ~(TWL4030_LEDEN_LEDAON | TWL4030_LEDEN_LEDBON); twl_vreg_led_set( sc, val ); + val = (TWL4030_LEDEN_LEDAON | TWL4030_LEDEN_LEDBON); + twl_vreg_led_set( sc, val );*/ } From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 02:23:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0376B106566B for ; Mon, 20 Aug 2012 02:23:03 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 02:23:03 +0000 Date: Mon, 20 Aug 2012 02:23:03 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820022303.0376B106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r240548 - in soc2012/tzabal/server-side/akcrs-website/akcrs: . templates X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 02:23:05 -0000 Author: tzabal Date: Mon Aug 20 02:23:02 2012 New Revision: 240548 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240548 Log: Update for the website. Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/bug.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/bugs.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/edit_report.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/index.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/login.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/report.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/reports.mako soc2012/tzabal/server-side/akcrs-website/akcrs/views.py Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py Sun Aug 19 21:31:47 2012 (r240547) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py Mon Aug 20 02:23:02 2012 (r240548) @@ -19,13 +19,16 @@ config.add_static_view('static', 'static', cache_max_age=3600) # Routes config.add_route('index', '/') + config.add_route('login', '/login') + config.add_route('logout', '/logout') + config.add_route('account', '/account') + config.add_route('change_password', '/change_password') config.add_route('reports', '/reports') - config.add_route('report', '/report/{id}') + config.add_route('report', '/reports/{id}') config.add_route('edit_report', '/report/{id}/edit_report') + config.add_route('delete_report', '/report/{id}/delete_report') config.add_route('bugs', '/bugs') - config.add_route('bug', '/bug/{id}') - config.add_route('login', '/login') - config.add_route('logout', '/logout') + config.add_route('bug', '/bugs/{id}') # Scan config.scan() return config.make_wsgi_app() \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako Sun Aug 19 21:31:47 2012 (r240547) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako Mon Aug 20 02:23:02 2012 (r240548) @@ -3,25 +3,24 @@ Automated Kernel Crash Reporting System + - +
+ Hostname
+
+
+
+ Operating System
+
+
+
+ Release
+
+
+
+ Version
+
+
+
+ Platform
+
+
+
+ Panic Message
+
+
+
+ Backtrace
+
+
+
+ ps -axl
+
+
+
+ vmstat -s
+
+
+
+ vmstat -m
+
+
+
+ vmstat -z
+
+
+
+ vmstat -i
+
+
+
+ pstat -t
+
+
+
+ pstat -s
+
+
+
+ iostat
+
+
+
+ ipcs -a
+
+
+
+ ipcs -t
+
+
+
+ nfsstat
+
+
+
+ netstat -s
+
+
+
+ netstat -m
+
+
+
+ netstat -id
+
+
+
+ netstat -anr
+
+
+
+ netstat -ana
+
+
+
+ netstat -al
+
+
+
+ fstat
+
+
+
+ dmesg
+
+
+
+ Kernel config
+
+
+ % if is_developer:

As a developer you can perform the following actions:

-Do you think that this report refers correctly to the bug? +Do you think that this report refers correctly to the bug with ID ${report.bug_id}? +Yes +No

% endif \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/reports.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/reports.mako Sun Aug 19 21:31:47 2012 (r240547) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/reports.mako Mon Aug 20 02:23:02 2012 (r240548) @@ -1,24 +1,29 @@ <%inherit file="base.mako"/> -<%block name="header"> - Kernel Crash Reports + +<%block name="headerleft"> +Kernel Crash Reports

A list that contains all the crash reports that we have collected.

- - - - - - - - +
ReleaseArchitecturePanic MessageMore DetailsRefers to
+ + + + + + + + + + % for report in reports: - - - - - - - + + + + + + + % endfor -
ReceivedReleasePlatformDetailsRefers to
${report.osrelease}${report.machine}${report.panic}ReportBug
${str(report.received_datetime)[:10]}${report.osrelease}${report.machine}ReportBug
\ No newline at end of file + + Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/views.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/views.py Sun Aug 19 21:31:47 2012 (r240547) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/views.py Mon Aug 20 02:23:02 2012 (r240548) @@ -52,13 +52,50 @@ @view_config(route_name='logout') def logout(request): logged_in = authenticated_userid(request) + goto = request.route_url('index') if not logged_in: - goto = request.route_url('index') return HTTPFound(location=goto) headers = forget(request) - goto = request.route_url('index') return HTTPFound(location=goto, headers=headers) + + +@view_config(route_name='account', renderer='account.mako') +def account(request): + logged_in = authenticated_userid(request) + return {'logged_in': logged_in} + +@view_config(route_name='change_password', renderer='change_password.mako') +def change_password(request): + logged_in = authenticated_userid(request) + goto = request.route_url('index') + if not logged_in: + # change it to HTTPForbidden + return HTTPFound(location=goto) + + result = False + if request.method == 'POST': + curr = request.POST.get('current_password') + new1 = request.POST.get('new_password_1') + new2 = request.POST.get('new_password_2') + + if curr and new1 and new2: + if new1 == new2: + query = DBSession.query(User).filter(User.email == logged_in) + try: + user = query.one() + except: + pass # either no such email in db or more than 2 times in db! + else: + hashcurr = hashlib.sha256() + hashcurr.update(curr) + if user.password == hashcurr.hexdigest(): + hashnew = hashlib.sha256() + hashnew.update(new1) + user.password = hashnew.hexdigest() + DBSession.flush() + result = True + return {'result': result, 'logged_in': logged_in} @view_config(route_name='reports', renderer='reports.mako') @@ -87,6 +124,11 @@ return {} +@view_config(route_name='delete_report', renderer='delete_report.mako') +def delete_report(request): + return {} + + @view_config(route_name='bugs', renderer='bugs.mako') def bugs(request): logged_in = authenticated_userid(request) From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 02:28:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 24382106567B for ; Mon, 20 Aug 2012 02:28:08 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 02:28:08 +0000 Date: Mon, 20 Aug 2012 02:28:08 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820022808.24382106567B@hub.freebsd.org> Cc: Subject: socsvn commit: r240549 - in soc2012/tzabal/server-side/akcrs-website/akcrs: static static/default templates X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 02:28:10 -0000 Author: tzabal Date: Mon Aug 20 02:28:07 2012 New Revision: 240549 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240549 Log: Update for the website. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/ soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/favicon.ico (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/footerbg.png (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/headerbg.png (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/ie6.css soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/middlebg.png (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pylons.css soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pyramid-small.png (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pyramid.png (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/transparent.gif (contents, props changed) soc2012/tzabal/server-side/akcrs-website/akcrs/static/style.css soc2012/tzabal/server-side/akcrs-website/akcrs/templates/account.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/change_password.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/checkforuser.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/delete_report.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/menu.html Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/favicon.ico ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/footerbg.png ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/headerbg.png ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/ie6.css ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/ie6.css Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,8 @@ +* html img, +* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none", +this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')", +this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''), +this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')", +this.runtimeStyle.backgroundImage = "none")),this.pngSet=true) +);} +#wrap{display:table;height:100%} Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/middlebg.png ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pylons.css ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pylons.css Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,65 @@ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;/* 16px */ +vertical-align:baseline;background:transparent;} +body{line-height:1;} +ol,ul{list-style:none;} +blockquote,q{quotes:none;} +blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;} +:focus{outline:0;} +ins{text-decoration:none;} +del{text-decoration:line-through;} +table{border-collapse:collapse;border-spacing:0;} +sub{vertical-align:sub;font-size:smaller;line-height:normal;} +sup{vertical-align:super;font-size:smaller;line-height:normal;} +ul,menu,dir{display:block;list-style-type:disc;margin:1em 0;padding-left:40px;} +ol{display:block;list-style-type:decimal-leading-zero;margin:1em 0;padding-left:40px;} +li{display:list-item;} +ul ul,ul ol,ul dir,ul menu,ul dl,ol ul,ol ol,ol dir,ol menu,ol dl,dir ul,dir ol,dir dir,dir menu,dir dl,menu ul,menu ol,menu dir,menu menu,menu dl,dl ul,dl ol,dl dir,dl menu,dl dl{margin-top:0;margin-bottom:0;} +ol ul,ul ul,menu ul,dir ul,ol menu,ul menu,menu menu,dir menu,ol dir,ul dir,menu dir,dir dir{list-style-type:circle;} +ol ol ul,ol ul ul,ol menu ul,ol dir ul,ol ol menu,ol ul menu,ol menu menu,ol dir menu,ol ol dir,ol ul dir,ol menu dir,ol dir dir,ul ol ul,ul ul ul,ul menu ul,ul dir ul,ul ol menu,ul ul menu,ul menu menu,ul dir menu,ul ol dir,ul ul dir,ul menu dir,ul dir dir,menu ol ul,menu ul ul,menu menu ul,menu dir ul,menu ol menu,menu ul menu,menu menu menu,menu dir menu,menu ol dir,menu ul dir,menu menu dir,menu dir dir,dir ol ul,dir ul ul,dir menu ul,dir dir ul,dir ol menu,dir ul menu,dir menu menu,dir dir menu,dir ol dir,dir ul dir,dir menu dir,dir dir dir{list-style-type:square;} +.hidden{display:none;} +p{line-height:1.5em;} +h1{font-size:1.75em;line-height:1.7em;font-family:helvetica,verdana;} +h2{font-size:1.5em;line-height:1.7em;font-family:helvetica,verdana;} +h3{font-size:1.25em;line-height:1.7em;font-family:helvetica,verdana;} +h4{font-size:1em;line-height:1.7em;font-family:helvetica,verdana;} +html,body{width:100%;height:100%;} +body{margin:0;padding:0;background-color:#ffffff;position:relative;font:16px/24px "NobileRegular","Lucida Grande",Lucida,Verdana,sans-serif;} +a{color:#1b61d6;text-decoration:none;} +a:hover{color:#e88f00;text-decoration:underline;} +body h1, +body h2, +body h3, +body h4, +body h5, +body h6{font-family:"NeutonRegular","Lucida Grande",Lucida,Verdana,sans-serif;font-weight:normal;color:#373839;font-style:normal;} +#wrap{min-height:100%;} +#header,#footer{width:100%;color:#ffffff;height:40px;position:absolute;text-align:center;line-height:40px;overflow:hidden;font-size:12px;vertical-align:middle;} +#header{background:#000000;top:0;font-size:14px;} +#footer{bottom:0;background:#000000 url(footerbg.png) repeat-x 0 top;position:relative;margin-top:-40px;clear:both;} +.header,.footer{width:750px;margin-right:auto;margin-left:auto;} +.wrapper{width:100%} +#top,#top-small,#bottom{width:100%;} +#top{color:#000000;height:230px;background:#ffffff url(headerbg.png) repeat-x 0 top;position:relative;} +#top-small{color:#000000;height:60px;background:#ffffff url(headerbg.png) repeat-x 0 top;position:relative;} +#bottom{color:#222;background-color:#ffffff;} +.top,.top-small,.middle,.bottom{width:750px;margin-right:auto;margin-left:auto;} +.top{padding-top:40px;} +.top-small{padding-top:10px;} +#middle{width:100%;height:100px;background:url(middlebg.png) repeat-x;border-top:2px solid #ffffff;border-bottom:2px solid #b2b2b2;} +.app-welcome{margin-top:25px;} +.app-name{color:#000000;font-weight:bold;} +.bottom{padding-top:50px;} +#left{width:350px;float:left;padding-right:25px;} +#right{width:350px;float:right;padding-left:25px;} +.align-left{text-align:left;} +.align-right{text-align:right;} +.align-center{text-align:center;} +ul.links{margin:0;padding:0;} +ul.links li{list-style-type:none;font-size:14px;} +form{border-style:none;} +fieldset{border-style:none;} +input{color:#222;border:1px solid #ccc;font-family:sans-serif;font-size:12px;line-height:16px;} +input[type=text],input[type=password]{width:205px;} +input[type=submit]{background-color:#ddd;font-weight:bold;} +/*Opera Fix*/ +body:before{content:"";height:100%;float:left;width:0;margin-top:-32767px;} Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pyramid-small.png ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/pyramid.png ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/transparent.gif ============================================================================== Binary file. No diff available. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/static/style.css ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/static/style.css Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,105 @@ +/* HTML Elements */ +body { + margin: 0; + padding: 0; + font-family: tahoma, helvetica, sans-serif; + font-size: 12pt; +} + + +/* Container */ +#container { + width: 1024px; + margin: auto; + position: relative; +} + + +/* Header */ +#header { + height: 5em; +} + +/* Header Left Side */ +#header-left { + height: 5em; + position: absolute; +} + +/* Header Right Side */ +#header-right { + top: 1em; + right: 1em; + position: absolute; +} + +#header-right a { + color: black; + text-decoration: none; +} + +#header-right a:hover { + text-decoration: underline; +} + + +/* Menu */ +#menu { + border-top: 1px solid #E4E1DB; + border-bottom: 1px solid #E4E1DB; +} + +#menu ul li { + display: inline; + padding: 2em; +} + +#menu ul li a { + color: black; + text-decoration: none; +} + +#menu ul li a:hover { + text-decoration: underline; +} + + +/* Reports and Bugs */ +#reports-bugs-tables { + border-collapse:collapse; + text-align: left; +} + +#reports-bugs-tables th { + border-bottom: 2px solid #E4E1DB; + padding: 10px 12px; +} + +#reports-bugs-tables td { + border-bottom: 1px solid #E4E1DB; + padding: 6px 12px; +} + + +/* Report */ +#report-contents-table { + margin-top: 1em; + margin-bottom: 2em; +} + +#report-contents-table td { + padding-right: 3em; +} + +.report-data { + margin-bottom: 1em; +} + +.report-data textarea { + width: 768px; + height: 256px; + border-color: #E4E1DB; + border-style: solid; + border-width: thin; + padding: 0.3em; +} \ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/account.mako ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/account.mako Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,21 @@ +<%inherit file="base.mako"/> + +<%block name="headerleft"> +Account + + +
+

+
+ +

+

+
+ +

+

+
+ +

+ +
\ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/change_password.mako ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/change_password.mako Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,11 @@ +<%inherit file="base.mako"/> + +<%block name="headerleft"> +Change Password + + +% if not result: +

Your password did not change. Please try again.

+% else: +

Your password has changed successfully.

+% endif \ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/checkforuser.mako ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/checkforuser.mako Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,8 @@ +% if not logged_in: +Login +% else: + <% + userid = logged_in.replace('@', '').replace('.', '') + %> +My Account | Logout +% endif \ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/delete_report.mako ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/delete_report.mako Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,12 @@ +<%inherit file="base.mako"/> + +<%block name="headerleft"> +Delete the Crash Report with ID ${request.matchdict['id']} + + +
+ Are you sure that you want to delete the report?
+ Yes
+ No
+ +
Added: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/menu.html ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/menu.html Mon Aug 20 02:28:07 2012 (r240549) @@ -0,0 +1,5 @@ + \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 04:26:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 088A8106564A for ; Mon, 20 Aug 2012 04:26:51 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 04:26:51 +0000 Date: Mon, 20 Aug 2012 04:26:51 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820042651.088A8106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240550 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 04:26:53 -0000 Author: gmiller Date: Mon Aug 20 04:26:50 2012 New Revision: 240550 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240550 Log: r240561@FreeBSD-dev: root | 2012-08-17 20:12:46 -0500 Add comments to libwitness. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/api.c soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c soc2012/gmiller/locking-head/lib/libwitness/locklist.c soc2012/gmiller/locking-head/lib/libwitness/unwind.c soc2012/gmiller/locking-head/lib/libwitness/witness.h Modified: soc2012/gmiller/locking-head/lib/libwitness/api.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 02:28:07 2012 (r240549) +++ soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 04:26:50 2012 (r240550) @@ -48,6 +48,16 @@ int _pthread_spin_unlock(pthread_spinlock_t *spin); int _pthread_spin_destroy(pthread_spinlock_t *spin); +/* + Keep witness from including any lock usage that occurs as a result of + witness itself. + + All API functions should call enter_witness() before doing anything that + could acquire a lock or using shared data that may experience race + conditions. Before returning, every function that calls enter_witness() + should call leave_witness(). +*/ + pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; static int witness_depth = 0; @@ -73,6 +83,12 @@ return (witness_depth); } +/* + Each of these wrapper functions ensures that the default lock name has been + set and calls add_lock() or remove_lock() to update the thread-local list + of locks that are currently held adjust the lock order graph and LoR logs. +*/ + int pthread_mutex_lock(pthread_mutex_t *mutex) { @@ -378,6 +394,10 @@ return (ret); } +/* + The pthread_lockorder_set_np() function attempts to insert the specified + pair into the lock order graph. +*/ int pthread_lockorder_set_np(void *first, void *second) { @@ -395,6 +415,10 @@ return (ret); } +/* + The pthread_lockorder_bless_np() function prevents LoRs from being generated + for the given pair of locks. +*/ int pthread_lockorder_bless_np(void *first_addr, void *second_addr) { @@ -438,6 +462,9 @@ return (ret); } +/* + pthread_lockorder_reset_np() resets all lock order information. +*/ void pthread_lockorder_reset_np(void) { @@ -450,6 +477,11 @@ leave_witness(); } +/* + The pthread_*_setname_np() functions set lock names and ensure that all + locks with the same name are treated as the same lock. +*/ + int pthread_mutex_setname_np(pthread_mutex_t *mutex, const char *name) { @@ -491,6 +523,20 @@ return (ret); } + +/* + The pthread_lor_*_np() functions retrieve LoR log information. + + pthread_lor_begin_np() must be called first to initialize the + pthread_lor_np structure. + + pthread_lor_next_np() is used to retrieve one LoR entry per call. + Returns 0 if no LoR records remain. + + pthread_lor_end_np() should be called after the final call to + pthread_lor_next_np(). +*/ + int pthread_lor_begin_np(struct pthread_lor_np *lor) { @@ -597,6 +643,16 @@ leave_witness(); } +/* + The pthread_lockorder_*_np() functions are used to retrieve the contents + of the lock order graph. + + pthread_lockorder_begin_np() is called to initialize the + pthread_lockorder_np structure, pthread_lockorder_next_np() is then called + until it returns 0, and pthread_lockorder_end_np() is called to clean up the + pthread_lockorder_np structure. +*/ + int pthread_lockorder_begin_np(struct pthread_lockorder_np *node) { Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Mon Aug 20 02:28:07 2012 (r240549) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Mon Aug 20 04:26:50 2012 (r240550) @@ -27,6 +27,10 @@ #include "witness.h" +/* + scan_graph() returns 1 if lock is reachable from graph in the lock order + graph, or 0 if it isn't. +*/ static int scan_graph(struct lock_info *graph, struct lock_info *lock) { @@ -41,6 +45,7 @@ return (1); } + /* Scan all children of the current node. */ ret = 0; child = graph->child; while (ret == 0 && child != NULL) { @@ -51,6 +56,10 @@ return (ret); } +/* + Remove the edge from "from" to "to" if "to" would still be reachable from + "from" without the direct edge. +*/ static void optimize_path(struct lock_info *from, struct lock_info *to) { @@ -83,6 +92,10 @@ } } +/* + Insert an edge from "from" to "to" in the graph, while maintaining an + optimal lock order graph. Returns 0 if successful. +*/ int insert_lock(struct lock_info *from, struct lock_info *to) { @@ -92,15 +105,27 @@ return (0); } + /* + If "from" is reachable from "to," a lock order reversal has been + detected. + */ if (scan_graph(to, from) && !blessed(from, to)) { return (-1); } + /* Insert the edge if it's not already present. */ if (to != from->child) { to->sibling = from->child; from->child = to; } + /* + Redundant edges may be present, in which case they fall into two + categories. Either one of the edge from "from" to one of its + children will be redundant (in which case it will be handled by the + following loop) or the newly inserted edge will be (in which case + the final optimize_path() call will take care of it. + */ child = to->sibling; while (child != NULL) { optimize_path(from, child); Modified: soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c Mon Aug 20 02:28:07 2012 (r240549) +++ soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c Mon Aug 20 04:26:50 2012 (r240550) @@ -32,6 +32,10 @@ static SLIST_HEAD(lock_instance_head, lock_instance) lock_instance_head = SLIST_HEAD_INITIALIZER(lock_instance_head); +/* + lookup_lock() returns the lock_instance structure associated with the + POSIX lock object, creating a new one if needed. +*/ struct lock_instance * lookup_lock(void *lock) { @@ -59,6 +63,9 @@ return (inst); } +/* + Free the lock_instance structure associated with a POSIX lock object. +*/ void destroy_lock(void *lock) { @@ -72,6 +79,9 @@ } } +/* + Returns 1 if first and second have been blessed, or 0 if not. +*/ int blessed(struct lock_info *first, struct lock_info *second) { @@ -86,6 +96,9 @@ return (0); } +/* + Free all lock_info data. +*/ void reset_lock_info(void) { @@ -111,6 +124,9 @@ } } +/* + Free all lock_instance data. +*/ void reset_lock_instance(void) { @@ -125,6 +141,10 @@ } } +/* + Returns the lock_info associated with a lock_instance, creating a new one if + needed. +*/ struct lock_info * get_lock_info(struct lock_instance *inst) { @@ -152,6 +172,9 @@ return (info); } +/* + Return the lock_info associated with a particular lock name. +*/ static struct lock_info * lookup_info(const char *name) { @@ -180,6 +203,10 @@ return (info); } +/* + Set the name associated with a lock. If multiple locks share the same name, + set_lock_name() will ensure that they share the same lock_info. +*/ int set_lock_name(void *lock, const char *name) { @@ -208,6 +235,9 @@ return ""; } +/* + Ensure that a lock has a default name if no name has been previously set. +*/ void check_default_name(void *lock, const char *prefix) { Modified: soc2012/gmiller/locking-head/lib/libwitness/locklist.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/locklist.c Mon Aug 20 02:28:07 2012 (r240549) +++ soc2012/gmiller/locking-head/lib/libwitness/locklist.c Mon Aug 20 04:26:50 2012 (r240550) @@ -27,6 +27,9 @@ #include "witness.h" +/* + lock_entry is used to maintain the list of locks held by the current thread. +*/ struct lock_entry { SLIST_ENTRY(lock_entry) lock_next; struct lock_info *lock; @@ -40,6 +43,9 @@ static int exit_set = 0; struct lor_head lor_head = STAILQ_HEAD_INITIALIZER(lor_head); +/* + Record a lock order reversal in the lor log. +*/ static void log_reversal(struct lock_info *lock, struct backtrace *lock_trace, struct lock_info *previous, struct backtrace *previous_trace) @@ -78,6 +84,11 @@ free(entry); } +/* + Add a lock to the list of locks held by the current thread and insert it + insert it into the lock order graph. If a lock order reversal is detected, + log it. +*/ void add_lock(void *lock) { @@ -86,11 +97,13 @@ struct lock_instance *inst; struct lock_info *info; + /* Call write_xml() on exit to generate the XML data file. */ if (exit_set == 0) { atexit(write_xml); exit_set = 1; } + /* Don't track lock acquisitions that occur within witness. */ if (in_witness() > 1 || lock == NULL) { return; } @@ -109,6 +122,10 @@ record_backtrace(&entry->trace); entry->lock = info; + /* + If a reset has been requested since this thread's lock list has + been reset, reset the data and update the reset count. + */ if (reset_count > thread_reset_count) { thread_reset_count = reset_count; @@ -125,12 +142,19 @@ SLIST_INSERT_HEAD(&lock_head, entry, lock_next); + /* + Insert the lock into the lock order graph and log the reversal if + one is detected. + */ if (next != NULL && insert_lock(next->lock, entry->lock) < 0) { log_reversal(entry->lock, &entry->trace, next->lock, &next->trace); } } +/* + Remove a lock from the list of locks currently held. +*/ void remove_lock(void *lock) { @@ -152,6 +176,9 @@ } } +/* + Request a reset of the list of locks held by each thread. +*/ void reset_lists(void) { Modified: soc2012/gmiller/locking-head/lib/libwitness/unwind.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/unwind.c Mon Aug 20 02:28:07 2012 (r240549) +++ soc2012/gmiller/locking-head/lib/libwitness/unwind.c Mon Aug 20 04:26:50 2012 (r240550) @@ -27,6 +27,10 @@ #include "witness.h" +/* + Return a string containing a description of the given backtrace. The string + must be freed by the caller using free(). +*/ char * trace_str(struct backtrace *trace) { @@ -41,6 +45,10 @@ buffer[0] = '\0'; SLIST_FOREACH(frame, trace, frame_next) { + /* + Ignore pthread_* API functions and any calls made + from within them. + */ if (strncmp(frame->id, "pthread_", 8) == 0) { break; } @@ -52,6 +60,7 @@ strcat(buffer, line_buf); + /* Include no more than 10 calls. */ if (++count == 10) { break; } @@ -61,6 +70,11 @@ return (buffer); } +/* + If USE_LIBWUNWIND is set in src.conf, use devel/libunwind to record + backtrace information. +*/ + #ifdef USE_LIBUNWIND #include Modified: soc2012/gmiller/locking-head/lib/libwitness/witness.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/witness.h Mon Aug 20 02:28:07 2012 (r240549) +++ soc2012/gmiller/locking-head/lib/libwitness/witness.h Mon Aug 20 04:26:50 2012 (r240550) @@ -37,11 +37,22 @@ #define MAX_FRAME_ID_LENGTH (80) #define MAX_DEFAULT_NAME_LENGTH (80) +/* + Each lock_info structure has a list of blessing structures that records the + list of structures whose ordering relative to the given lock can be safely + ignored. +*/ struct blessing { SLIST_ENTRY(blessing) bless_next; struct lock_info *lock; }; +/* + One lock_info structure exists for each lock in the ordering graph. The + child pointer points to the first node that has an outbound edge from the + current node. Sibling points to the next child of the current node's + parent(s). +*/ struct lock_info { SLIST_ENTRY(lock_info) lock_info_next; struct lock_info *child; @@ -52,12 +63,21 @@ SLIST_HEAD(lock_info_head, lock_info); +/* + lock_instance holds data about a pthread_*_t object. Multiple locks may + have the same name, in which case multiple lock_instance structures will + point to a single lock_info structure. +*/ struct lock_instance { SLIST_ENTRY(lock_instance) lock_instance_next; struct lock_info *info; void *lock; }; +/* + Each stack_frame entry represents one frame in the backtrace data that is + recorded whenever a lock is acquired. +*/ struct stack_frame { SLIST_ENTRY(stack_frame) frame_next; char id[MAX_FRAME_ID_LENGTH + 1]; @@ -65,6 +85,10 @@ SLIST_HEAD(backtrace, stack_frame); +/* + lor_entry stores information about the locks and call sequences for a + lock order reversal. +*/ struct lor_entry { STAILQ_ENTRY(lor_entry) lor_next; struct lock_info *lock_first; From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 05:00:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 381881065674 for ; Mon, 20 Aug 2012 05:00:05 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 05:00:05 +0000 Date: Mon, 20 Aug 2012 05:00:05 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820050005.381881065674@hub.freebsd.org> Cc: Subject: socsvn commit: r240551 - in soc2012/gmiller/locking-head: . lib/libthr/thread X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 05:00:07 -0000 Author: gmiller Date: Mon Aug 20 05:00:03 2012 New Revision: 240551 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240551 Log: r240629@FreeBSD-dev: root | 2012-08-17 20:46:07 -0500 Add some comments to the lock profiling code. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Mon Aug 20 04:26:50 2012 (r240550) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Mon Aug 20 05:00:03 2012 (r240551) @@ -727,6 +727,10 @@ extern struct urwlock _thr_list_lock __hidden; extern struct umutex _thr_event_lock __hidden; +/* + Macros used to pass file and line parameters if and only if lock profiling + is enabled. +*/ #ifdef LOCK_PROFILING #define _PROFILE_PARMS , const char *file, int line #define _PROFILE_PASS , file, line @@ -748,11 +752,6 @@ int _mutex_owned(struct pthread *, const struct pthread_mutex *) __hidden; int _mutex_reinit(pthread_mutex_t *) __hidden; void _mutex_fork(struct pthread *curthread) __hidden; -void _lock_profile_init(void) __hidden; -void _lock_profile_obtain_failed(struct timespec *, const char *) __hidden; -void _lock_profile_obtain_success(void *, struct timespec *, const char *, - int) __hidden; -void _lock_profile_release(void *, const char *file) __hidden; void _libpthread_init(struct pthread *) __hidden; struct pthread *_thr_alloc(struct pthread *) __hidden; void _thread_exit(const char *, int, const char *) __hidden __dead2; @@ -821,6 +820,12 @@ _lock_profile_obtain_failed(ts, file) #define LOCK_PROFILE_RELEASE(l) _lock_profile_release(l, file) +void _lock_profile_init(void) __hidden; +void _lock_profile_obtain_failed(struct timespec *, const char *) __hidden; +void _lock_profile_obtain_success(void *, struct timespec *, const char *, + int) __hidden; +void _lock_profile_release(void *, const char *file) __hidden; + #else #define INIT_LOCK_PROFILING() do { } while (0) Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 04:26:50 2012 (r240550) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 05:00:03 2012 (r240551) @@ -37,6 +37,10 @@ #define LOCK_PROF_HASH_SIZE (4096) +/* + The acquisition_point structure is used to record data about each point in + the program that acquires a lock. +*/ struct acquisition_point { SLIST_ENTRY(acquisition_point) acq_point_next; const char *file; @@ -51,6 +55,10 @@ SLIST_HEAD(acq_point_head, acquisition_point); +/* + The acquisition struct is used to store data about a single acquisition of + a lock until the lock is released. +*/ struct acquisition { LIST_ENTRY(acquisition) acq_next; void *lock; @@ -76,6 +84,11 @@ static int xml_indent = 0; static FILE *xml_file; +/* + The following functions are used to write out an XML file containing the + profiling data on exit. +*/ + static void indent(void) { @@ -213,6 +226,10 @@ return (acq_point); } +/* + This function is called when a lock is successfully acquired. It creates an + acquisition structure if one doesn't already exist and records the wait time. +*/ void _lock_profile_obtain_success(void *lock, struct timespec *wait_time, const char *file, int line) @@ -247,6 +264,11 @@ THR_CRITICAL_LEAVE(curthread); } +/* + This function is called when a lock attempt fails. If this is the first + attempt to acquire the lock, the time is recorded. This time will be used + by _lock_profile_obtain_success() to calculate the wait time. +*/ void _lock_profile_obtain_failed(struct timespec *wait_time, const char *file) { @@ -259,6 +281,10 @@ } } +/* + This function is called when a lock is released to free the acquisition + and update the acquisition_point. +*/ void _lock_profile_release(void *lock, const char *file) { @@ -323,6 +349,14 @@ THR_CRITICAL_LEAVE(curthread); } +/* + The following functions are used to acquire profile statistics. The + pthread_statistics_begin_np() function is called in order to initialize + a pthread_statistics_np structure, pthread_statistics_next_np() is called + to retrieve the statistics for each acquisition point (ending when it + returns 0), and then pthread_statistics_end_np() is called to free working + data. +*/ static int find_next_record(struct pthread_statistics_np *stats) { From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 06:33:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 38D03106566C for ; Mon, 20 Aug 2012 06:33:37 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 06:33:37 +0000 Date: Mon, 20 Aug 2012 06:33:37 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820063337.38D03106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r240553 - in soc2012/gmiller/locking-head: . include lib/libthr/thread lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 06:33:39 -0000 Author: gmiller Date: Mon Aug 20 06:33:36 2012 New Revision: 240553 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240553 Log: r240631@FreeBSD-dev: root | 2012-08-17 22:11:19 -0500 Apply various style(9) fixes. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/include/pthread_np.h soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c soc2012/gmiller/locking-head/lib/libwitness/api.c soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c soc2012/gmiller/locking-head/lib/libwitness/locklist.c soc2012/gmiller/locking-head/lib/libwitness/unwind.c soc2012/gmiller/locking-head/lib/libwitness/witness.h soc2012/gmiller/locking-head/lib/libwitness/xml.c Modified: soc2012/gmiller/locking-head/include/pthread_np.h ============================================================================== --- soc2012/gmiller/locking-head/include/pthread_np.h Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/include/pthread_np.h Mon Aug 20 06:33:36 2012 (r240553) @@ -108,28 +108,28 @@ int pthread_switch_add_np(pthread_switch_routine_t); int pthread_switch_delete_np(pthread_switch_routine_t); int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); -int pthread_lor_begin_np(struct pthread_lor_np *); -int pthread_lor_next_np(struct pthread_lor_np *); -void pthread_lor_end_np(struct pthread_lor_np *); -void pthread_lor_clear_np(void); -int pthread_lockorder_bless_np(void *, void *); -int pthread_lockorder_set_np(void *first, void *second); -void pthread_lockorder_reset_np(void); -int pthread_lockorder_begin_np(struct pthread_lockorder_np *); -int pthread_lockorder_next_np(struct pthread_lockorder_np *); -void pthread_lockorder_end_np(struct pthread_lockorder_np *); -int pthread_mutex_setname_np(pthread_mutex_t *, const char *); -int pthread_rwlock_setname_np(pthread_rwlock_t *, const char *); -int pthread_spin_setname_np(pthread_spinlock_t *, const char *); +int pthread_lor_begin_np(struct pthread_lor_np *); +int pthread_lor_next_np(struct pthread_lor_np *); +void pthread_lor_end_np(struct pthread_lor_np *); +void pthread_lor_clear_np(void); +int pthread_lockorder_bless_np(void *, void *); +int pthread_lockorder_set_np(void *, void *); +void pthread_lockorder_reset_np(void); +int pthread_lockorder_begin_np(struct pthread_lockorder_np *); +int pthread_lockorder_next_np(struct pthread_lockorder_np *); +void pthread_lockorder_end_np(struct pthread_lockorder_np *); +int pthread_mutex_setname_np(pthread_mutex_t *, const char *); +int pthread_rwlock_setname_np(pthread_rwlock_t *, const char *); +int pthread_spin_setname_np(pthread_spinlock_t *, const char *); #ifdef LOCK_PROFILING -void pthread_statistics_begin_np(struct pthread_statistics_np *); -int pthread_statistics_next_np(struct pthread_statistics_np *); -void pthread_statistics_end_np(struct pthread_statistics_np *); -void pthread_statistics_reset_np(void); -void pthread_statistics_enable_np(void); -void pthread_statistics_disable_np(void); +void pthread_statistics_begin_np(struct pthread_statistics_np *); +int pthread_statistics_next_np(struct pthread_statistics_np *); +void pthread_statistics_end_np(struct pthread_statistics_np *); +void pthread_statistics_reset_np(void); +void pthread_statistics_enable_np(void); +void pthread_statistics_disable_np(void); #endif Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Mon Aug 20 06:33:36 2012 (r240553) @@ -728,15 +728,15 @@ extern struct umutex _thr_event_lock __hidden; /* - Macros used to pass file and line parameters if and only if lock profiling - is enabled. -*/ + * Macros used to pass file and line parameters if and only if lock profiling + * is enabled. + */ #ifdef LOCK_PROFILING -#define _PROFILE_PARMS , const char *file, int line -#define _PROFILE_PASS , file, line +#define _PROFILE_PARMS , const char *file, int line +#define _PROFILE_PASS , file, line #else -#define _PROFILE_PARMS /* */ -#define _PROFILE_PASS /* */ +#define _PROFILE_PARMS /* */ +#define _PROFILE_PASS /* */ #endif /* @@ -812,13 +812,14 @@ #ifdef LOCK_PROFILING -#define INIT_LOCK_PROFILING() \ - _lock_profile_init() -#define LOCK_PROFILE_OBTAIN_SUCCESS(l, ts) \ - _lock_profile_obtain_success(l, ts, file, line) -#define LOCK_PROFILE_OBTAIN_FAILED(ts) \ - _lock_profile_obtain_failed(ts, file) -#define LOCK_PROFILE_RELEASE(l) _lock_profile_release(l, file) +#define INIT_LOCK_PROFILING() \ + _lock_profile_init() +#define LOCK_PROFILE_OBTAIN_SUCCESS(l, ts) \ + _lock_profile_obtain_success(l, ts, file, line) +#define LOCK_PROFILE_OBTAIN_FAILED(ts) \ + _lock_profile_obtain_failed(ts, file) +#define LOCK_PROFILE_RELEASE(l) \ + _lock_profile_release(l, file) void _lock_profile_init(void) __hidden; void _lock_profile_obtain_failed(struct timespec *, const char *) __hidden; @@ -828,10 +829,10 @@ #else -#define INIT_LOCK_PROFILING() do { } while (0) -#define LOCK_PROFILE_OBTAIN_SUCCESS(l, ts) do { } while (0) -#define LOCK_PROFILE_OBTAIN_FAILED(ts) do { } while (0) -#define LOCK_PROFILE_RELEASE(l) do { } while (0) +#define INIT_LOCK_PROFILING() do { } while (0) +#define LOCK_PROFILE_OBTAIN_SUCCESS(l, ts) do { } while (0) +#define LOCK_PROFILE_OBTAIN_FAILED(ts) do { } while (0) +#define LOCK_PROFILE_RELEASE(l) do { } while (0) #endif Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 06:33:36 2012 (r240553) @@ -35,12 +35,12 @@ #include "thr_private.h" -#define LOCK_PROF_HASH_SIZE (4096) +#define LOCK_PROF_HASH_SIZE 4096 /* - The acquisition_point structure is used to record data about each point in - the program that acquires a lock. -*/ + * The acquisition_point structure is used to record data about each point in + * the program that acquires a lock. + */ struct acquisition_point { SLIST_ENTRY(acquisition_point) acq_point_next; const char *file; @@ -56,9 +56,9 @@ SLIST_HEAD(acq_point_head, acquisition_point); /* - The acquisition struct is used to store data about a single acquisition of - a lock until the lock is released. -*/ + * The acquisition struct is used to store data about a single acquisition of + * a lock until the lock is released. + */ struct acquisition { LIST_ENTRY(acquisition) acq_next; void *lock; @@ -85,14 +85,14 @@ static FILE *xml_file; /* - The following functions are used to write out an XML file containing the - profiling data on exit. -*/ + * The following functions are used to write out an XML file containing the + * profiling data on exit. + */ static void indent(void) { - int i; + int i; for (i = 0; i < xml_indent; i++) { fputc(' ', xml_file); @@ -227,20 +227,22 @@ } /* - This function is called when a lock is successfully acquired. It creates an - acquisition structure if one doesn't already exist and records the wait time. -*/ + * This function is called when a lock is successfully acquired. It creates an + * acquisition structure if one doesn't already exist and records the wait + * time. + */ void _lock_profile_obtain_success(void *lock, struct timespec *wait_time, const char *file, int line) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; struct acquisition *acq; if (file == NULL || !lockprof_enabled) { return; } + curthread = _get_curthread(); THR_CRITICAL_ENTER(curthread); acq = lookup_acq(lock, file, line); @@ -265,10 +267,10 @@ } /* - This function is called when a lock attempt fails. If this is the first - attempt to acquire the lock, the time is recorded. This time will be used - by _lock_profile_obtain_success() to calculate the wait time. -*/ + * This function is called when a lock attempt fails. If this is the first + * attempt to acquire the lock, the time is recorded. This time will be used + * by _lock_profile_obtain_success() to calculate the wait time. + */ void _lock_profile_obtain_failed(struct timespec *wait_time, const char *file) { @@ -282,13 +284,13 @@ } /* - This function is called when a lock is released to free the acquisition - and update the acquisition_point. -*/ + * This function is called when a lock is released to free the acquisition + * and update the acquisition_point. + */ void _lock_profile_release(void *lock, const char *file) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; struct acquisition *acq; struct acquisition_point *acq_point; struct timespec current_time; @@ -298,6 +300,7 @@ return; } + curthread = _get_curthread(); THR_CRITICAL_ENTER(curthread); LIST_FOREACH(acq, &acq_head, acq_next) { @@ -350,18 +353,19 @@ } /* - The following functions are used to acquire profile statistics. The - pthread_statistics_begin_np() function is called in order to initialize - a pthread_statistics_np structure, pthread_statistics_next_np() is called - to retrieve the statistics for each acquisition point (ending when it - returns 0), and then pthread_statistics_end_np() is called to free working - data. -*/ + * The following functions are used to acquire profile statistics. The + * pthread_statistics_begin_np() function is called in order to initialize + * a pthread_statistics_np structure, pthread_statistics_next_np() is called + * to retrieve the statistics for each acquisition point (ending when it + * returns 0), and then pthread_statistics_end_np() is called to free working + * data. + */ static int find_next_record(struct pthread_statistics_np *stats) { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; + curthread = _get_curthread(); THR_CRITICAL_ENTER(curthread); for (;;) { @@ -426,11 +430,12 @@ void pthread_statistics_reset_np() { - struct pthread *curthread = _get_curthread(); + struct pthread *curthread; u_int hash; struct acquisition_point *acq_point; struct acquisition *acq; + curthread = _get_curthread(); THR_CRITICAL_ENTER(curthread); for (hash = 0; hash < LOCK_PROF_HASH_SIZE; hash++) { @@ -462,4 +467,4 @@ lockprof_enabled = 0; } -#endif /* LOCK_PROFILING */ +#endif /* LOCK_PROFILING */ Modified: soc2012/gmiller/locking-head/lib/libwitness/api.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 06:33:36 2012 (r240553) @@ -49,14 +49,14 @@ int _pthread_spin_destroy(pthread_spinlock_t *spin); /* - Keep witness from including any lock usage that occurs as a result of - witness itself. + * Keep witness from including any lock usage that occurs as a result of + * witness itself. - All API functions should call enter_witness() before doing anything that - could acquire a lock or using shared data that may experience race - conditions. Before returning, every function that calls enter_witness() - should call leave_witness(). -*/ + * All API functions should call enter_witness() before doing anything that + * could acquire a lock or using shared data that may experience race + * conditions. Before returning, every function that calls enter_witness() + * should call leave_witness(). + */ pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -84,15 +84,15 @@ } /* - Each of these wrapper functions ensures that the default lock name has been - set and calls add_lock() or remove_lock() to update the thread-local list - of locks that are currently held adjust the lock order graph and LoR logs. -*/ + * Each of these wrapper functions ensures that the default lock name has been + * set and calls add_lock() or remove_lock() to update the thread-local list + * of locks that are currently held adjust the lock order graph and LoR logs. + */ int pthread_mutex_lock(pthread_mutex_t *mutex) { - int ret; + int ret; enter_witness(); @@ -111,7 +111,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex) { - int ret; + int ret; enter_witness(); @@ -130,7 +130,7 @@ int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *ts) { - int ret; + int ret; enter_witness(); @@ -149,7 +149,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) { - int ret; + int ret; enter_witness(); @@ -166,7 +166,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex) { - int ret; + int ret; enter_witness(); @@ -181,7 +181,7 @@ int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) { - int ret; + int ret; enter_witness(); @@ -200,7 +200,7 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) { - int ret; + int ret; enter_witness(); @@ -219,7 +219,7 @@ int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *ts) { - int ret; + int ret; enter_witness(); @@ -238,7 +238,7 @@ int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) { - int ret; + int ret; enter_witness(); @@ -257,7 +257,7 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) { - int ret; + int ret; enter_witness(); @@ -276,7 +276,7 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts) { - int ret; + int ret; enter_witness(); @@ -295,7 +295,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) { - int ret; + int ret; enter_witness(); @@ -312,7 +312,7 @@ int pthread_rwlock_destroy(pthread_rwlock_t *rwlock) { - int ret; + int ret; enter_witness(); @@ -327,7 +327,7 @@ int pthread_spin_lock(pthread_spinlock_t *spin) { - int ret; + int ret; enter_witness(); @@ -346,7 +346,7 @@ int pthread_spin_trylock(pthread_spinlock_t *spin) { - int ret; + int ret; enter_witness(); @@ -365,7 +365,7 @@ int pthread_spin_unlock(pthread_spinlock_t *spin) { - int ret; + int ret; enter_witness(); @@ -382,7 +382,7 @@ int pthread_spin_destroy(pthread_spinlock_t *spin) { - int ret; + int ret; enter_witness(); @@ -395,16 +395,17 @@ } /* - The pthread_lockorder_set_np() function attempts to insert the specified - pair into the lock order graph. -*/ + * The pthread_lockorder_set_np() function attempts to insert the specified + * pair into the lock order graph. + */ int pthread_lockorder_set_np(void *first, void *second) { - int ret = 0; + int ret; enter_witness(); + ret = 0; if (insert_lock(get_lock_info(lookup_lock(first)), get_lock_info(lookup_lock(second))) < 0) { ret = EINVAL; @@ -416,19 +417,19 @@ } /* - The pthread_lockorder_bless_np() function prevents LoRs from being generated - for the given pair of locks. -*/ + * The pthread_lockorder_bless_np() function prevents LoRs from being generated + * for the given pair of locks. + */ int pthread_lockorder_bless_np(void *first_addr, void *second_addr) { - struct lock_info *first; - struct lock_info *second; struct lock_instance *first_inst; struct lock_instance *second_inst; - struct blessing *first_bless = NULL; - struct blessing *second_bless = NULL; - int ret = 0; + struct lock_info *first; + struct lock_info *second; + struct blessing *first_bless; + struct blessing *second_bless; + int ret; enter_witness(); @@ -441,6 +442,7 @@ first_bless = malloc(sizeof(struct blessing)); second_bless = malloc(sizeof(struct blessing)); + ret = 0; if (first == NULL || second == NULL || first_bless == NULL || second_bless == NULL) { ret = ENOMEM; @@ -463,8 +465,8 @@ } /* - pthread_lockorder_reset_np() resets all lock order information. -*/ + * pthread_lockorder_reset_np() resets all lock order information. + */ void pthread_lockorder_reset_np(void) { @@ -478,14 +480,14 @@ } /* - The pthread_*_setname_np() functions set lock names and ensure that all - locks with the same name are treated as the same lock. -*/ + * The pthread_*_setname_np() functions set lock names and ensure that all + * locks with the same name are treated as the same lock. + */ int pthread_mutex_setname_np(pthread_mutex_t *mutex, const char *name) { - int ret; + int ret; enter_witness(); @@ -499,7 +501,7 @@ int pthread_rwlock_setname_np(pthread_rwlock_t *rwlock, const char *name) { - int ret; + int ret; enter_witness(); @@ -513,7 +515,7 @@ int pthread_spin_setname_np(pthread_spinlock_t *spin, const char *name) { - int ret; + int ret; enter_witness(); @@ -525,22 +527,22 @@ } /* - The pthread_lor_*_np() functions retrieve LoR log information. - - pthread_lor_begin_np() must be called first to initialize the - pthread_lor_np structure. - - pthread_lor_next_np() is used to retrieve one LoR entry per call. - Returns 0 if no LoR records remain. - - pthread_lor_end_np() should be called after the final call to - pthread_lor_next_np(). -*/ + * The pthread_lor_*_np() functions retrieve LoR log information. + * + * pthread_lor_begin_np() must be called first to initialize the + * pthread_lor_np structure. + * + * pthread_lor_next_np() is used to retrieve one LoR entry per call. + * Returns 0 if no LoR records remain. + * + * pthread_lor_end_np() should be called after the final call to + * pthread_lor_next_np(). + */ int pthread_lor_begin_np(struct pthread_lor_np *lor) { - int ret = 0; + int ret; lor->name_first = NULL; lor->first_trace = NULL; @@ -549,6 +551,7 @@ enter_witness(); + ret = 0; lor->_pvt = malloc(sizeof(struct _pthread_lor_private)); if (lor->_pvt == NULL) { ret = ENOMEM; @@ -564,7 +567,7 @@ int pthread_lor_next_np(struct pthread_lor_np *lor) { - int res = 0; + int ret; enter_witness(); @@ -575,6 +578,7 @@ STAILQ_NEXT(lor->_pvt->last_record, lor_next); } + ret = 0; if (lor->_pvt->last_record != NULL) { lor->name_first = strdup(get_lock_name(lor->_pvt->last_record->lock_first)); @@ -585,12 +589,12 @@ lor->second_trace = strdup(lor->_pvt->last_record->second_trace); - res = 1; + ret = 1; } leave_witness(); - return (res); + return (ret); } void @@ -644,22 +648,23 @@ } /* - The pthread_lockorder_*_np() functions are used to retrieve the contents - of the lock order graph. + * The pthread_lockorder_*_np() functions are used to retrieve the contents + * of the lock order graph. - pthread_lockorder_begin_np() is called to initialize the - pthread_lockorder_np structure, pthread_lockorder_next_np() is then called - until it returns 0, and pthread_lockorder_end_np() is called to clean up the - pthread_lockorder_np structure. -*/ + * pthread_lockorder_begin_np() is called to initialize the + * pthread_lockorder_np structure, pthread_lockorder_next_np() is then called + * until it returns 0, and pthread_lockorder_end_np() is called to clean up the + * pthread_lockorder_np structure. + */ int pthread_lockorder_begin_np(struct pthread_lockorder_np *node) { - int ret = 0; + int ret; enter_witness(); + ret = 0; node->_pvt = malloc(sizeof(struct _pthread_lockorder_private)); if (node->_pvt == NULL) { ret = ENOMEM; Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Mon Aug 20 06:33:36 2012 (r240553) @@ -28,13 +28,13 @@ #include "witness.h" /* - scan_graph() returns 1 if lock is reachable from graph in the lock order - graph, or 0 if it isn't. -*/ + * scan_graph() returns 1 if lock is reachable from graph in the lock order + * graph, or 0 if it isn't. + */ static int scan_graph(struct lock_info *graph, struct lock_info *lock) { - int ret; + int ret; struct lock_info *child; if (graph == NULL) { @@ -57,14 +57,14 @@ } /* - Remove the edge from "from" to "to" if "to" would still be reachable from - "from" without the direct edge. -*/ + * Remove the edge from "from" to "to" if "to" would still be reachable from + * "from" without the direct edge. + */ static void optimize_path(struct lock_info *from, struct lock_info *to) { - struct lock_info *child; struct lock_info *previous; + struct lock_info *child; struct lock_info *next; previous = NULL; @@ -93,9 +93,9 @@ } /* - Insert an edge from "from" to "to" in the graph, while maintaining an - optimal lock order graph. Returns 0 if successful. -*/ + * Insert an edge from "from" to "to" in the graph, while maintaining an + * optimal lock order graph. Returns 0 if successful. + */ int insert_lock(struct lock_info *from, struct lock_info *to) { @@ -106,9 +106,9 @@ } /* - If "from" is reachable from "to," a lock order reversal has been - detected. - */ + * If "from" is reachable from "to," a lock order reversal has been + * detected. + */ if (scan_graph(to, from) && !blessed(from, to)) { return (-1); } @@ -120,12 +120,12 @@ } /* - Redundant edges may be present, in which case they fall into two - categories. Either one of the edge from "from" to one of its - children will be redundant (in which case it will be handled by the - following loop) or the newly inserted edge will be (in which case - the final optimize_path() call will take care of it. - */ + * Redundant edges may be present, in which case they fall into two + * categories. Either one of the edge from "from" to one of its + * children will be redundant (in which case it will be handled by the + * following loop) or the newly inserted edge will be (in which case + * the final optimize_path() call will take care of it. + */ child = to->sibling; while (child != NULL) { optimize_path(from, child); Modified: soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libwitness/lockinfo.c Mon Aug 20 06:33:36 2012 (r240553) @@ -33,15 +33,16 @@ SLIST_HEAD_INITIALIZER(lock_instance_head); /* - lookup_lock() returns the lock_instance structure associated with the - POSIX lock object, creating a new one if needed. -*/ + * lookup_lock() returns the lock_instance structure associated with the + * POSIX lock object, creating a new one if needed. + */ struct lock_instance * lookup_lock(void *lock) { - struct lock_instance *inst = NULL; struct lock_instance *iter; + struct lock_instance *inst; + inst = NULL; SLIST_FOREACH(iter, &lock_instance_head, lock_instance_next) { if (iter->lock == lock) { inst = iter; @@ -63,9 +64,7 @@ return (inst); } -/* - Free the lock_instance structure associated with a POSIX lock object. -*/ +/* Free the lock_instance structure associated with a POSIX lock object. */ void destroy_lock(void *lock) { @@ -79,9 +78,7 @@ } } -/* - Returns 1 if first and second have been blessed, or 0 if not. -*/ +/* Returns 1 if first and second have been blessed, or 0 if not. */ int blessed(struct lock_info *first, struct lock_info *second) { @@ -96,9 +93,7 @@ return (0); } -/* - Free all lock_info data. -*/ +/* Free all lock_info data. */ void reset_lock_info(void) { @@ -124,9 +119,7 @@ } } -/* - Free all lock_instance data. -*/ +/* Free all lock_instance data. */ void reset_lock_instance(void) { @@ -142,9 +135,9 @@ } /* - Returns the lock_info associated with a lock_instance, creating a new one if - needed. -*/ + * Returns the lock_info associated with a lock_instance, creating a new one if + * needed. + */ struct lock_info * get_lock_info(struct lock_instance *inst) { @@ -172,15 +165,14 @@ return (info); } -/* - Return the lock_info associated with a particular lock name. -*/ +/* Return the lock_info associated with a particular lock name. */ static struct lock_info * lookup_info(const char *name) { - struct lock_info *info = NULL; struct lock_info *iter; + struct lock_info *info; + info = NULL; SLIST_FOREACH(iter, &lock_info_head, lock_info_next) { if (strcmp(name, get_lock_name(iter)) == 0) { info = iter; @@ -204,9 +196,9 @@ } /* - Set the name associated with a lock. If multiple locks share the same name, - set_lock_name() will ensure that they share the same lock_info. -*/ + * Set the name associated with a lock. If multiple locks share the same name, + * set_lock_name() will ensure that they share the same lock_info. + */ int set_lock_name(void *lock, const char *name) { @@ -232,12 +224,10 @@ return (info->name); } - return ""; + return (""); } -/* - Ensure that a lock has a default name if no name has been previously set. -*/ +/* Ensure that a lock has a default name if no name has been previously set. */ void check_default_name(void *lock, const char *prefix) { Modified: soc2012/gmiller/locking-head/lib/libwitness/locklist.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/locklist.c Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libwitness/locklist.c Mon Aug 20 06:33:36 2012 (r240553) @@ -28,8 +28,9 @@ #include "witness.h" /* - lock_entry is used to maintain the list of locks held by the current thread. -*/ + * lock_entry is used to maintain the list of locks held by the current + * thread. + */ struct lock_entry { SLIST_ENTRY(lock_entry) lock_next; struct lock_info *lock; @@ -43,9 +44,7 @@ static int exit_set = 0; struct lor_head lor_head = STAILQ_HEAD_INITIALIZER(lor_head); -/* - Record a lock order reversal in the lor log. -*/ +/* Record a lock order reversal in the lor log. */ static void log_reversal(struct lock_info *lock, struct backtrace *lock_trace, struct lock_info *previous, struct backtrace *previous_trace) @@ -85,17 +84,17 @@ } /* - Add a lock to the list of locks held by the current thread and insert it - insert it into the lock order graph. If a lock order reversal is detected, - log it. -*/ + * Add a lock to the list of locks held by the current thread and insert it + * insert it into the lock order graph. If a lock order reversal is detected, + * log it. + */ void add_lock(void *lock) { - struct lock_entry *entry; - struct lock_entry *next; struct lock_instance *inst; struct lock_info *info; + struct lock_entry *next; + struct lock_entry *entry; /* Call write_xml() on exit to generate the XML data file. */ if (exit_set == 0) { @@ -123,9 +122,9 @@ entry->lock = info; /* - If a reset has been requested since this thread's lock list has - been reset, reset the data and update the reset count. - */ + * If a reset has been requested since this thread's lock list has + * been reset, reset the data and update the reset count. + */ if (reset_count > thread_reset_count) { thread_reset_count = reset_count; @@ -143,18 +142,16 @@ SLIST_INSERT_HEAD(&lock_head, entry, lock_next); /* - Insert the lock into the lock order graph and log the reversal if - one is detected. - */ + * Insert the lock into the lock order graph and log the reversal if + * one is detected. + */ if (next != NULL && insert_lock(next->lock, entry->lock) < 0) { log_reversal(entry->lock, &entry->trace, next->lock, &next->trace); } } -/* - Remove a lock from the list of locks currently held. -*/ +/* Remove a lock from the list of locks currently held. */ void remove_lock(void *lock) { @@ -176,9 +173,7 @@ } } -/* - Request a reset of the list of locks held by each thread. -*/ +/* Request a reset of the list of locks held by each thread. */ void reset_lists(void) { Modified: soc2012/gmiller/locking-head/lib/libwitness/unwind.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/unwind.c Mon Aug 20 05:47:07 2012 (r240552) +++ soc2012/gmiller/locking-head/lib/libwitness/unwind.c Mon Aug 20 06:33:36 2012 (r240553) @@ -28,27 +28,29 @@ #include "witness.h" /* - Return a string containing a description of the given backtrace. The string - must be freed by the caller using free(). -*/ + * Return a string containing a description of the given backtrace. The string + * must be freed by the caller using free(). + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 08:37:54 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 17CDA1065675 for ; Mon, 20 Aug 2012 08:37:52 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 08:37:52 +0000 Date: Mon, 20 Aug 2012 08:37:52 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820083752.17CDA1065675@hub.freebsd.org> Cc: Subject: socsvn commit: r240556 - in soc2012/gmiller/locking-head: . include lib/libthr/thread lib/libwitness tools/regression/lib/libthr/lockprof tools/regression/lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 08:37:54 -0000 Author: gmiller Date: Mon Aug 20 08:37:51 2012 New Revision: 240556 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240556 Log: r240634@FreeBSD-dev: root | 2012-08-18 00:23:09 -0500 Adjust some names for clarity and consistency and fix style(9) issues in the test suites. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/include/pthread_np.h soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c soc2012/gmiller/locking-head/lib/libwitness/api.c soc2012/gmiller/locking-head/lib/libwitness/xml.c soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c Modified: soc2012/gmiller/locking-head/include/pthread_np.h ============================================================================== --- soc2012/gmiller/locking-head/include/pthread_np.h Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/include/pthread_np.h Mon Aug 20 08:37:51 2012 (r240556) @@ -51,8 +51,8 @@ struct timespec wait_max; struct timespec hold_max; uintmax_t contest_count; - struct timespec wait_time; - struct timespec hold_time; + struct timespec wait_total; + struct timespec hold_total; int acq_count; }; @@ -62,9 +62,9 @@ struct pthread_lor_np { struct _pthread_lor_private *_pvt; - char *name_first; + char *first_name; char *first_trace; - char *name_second; + char *second_name; char *second_trace; }; Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 08:37:51 2012 (r240556) @@ -48,8 +48,8 @@ struct timespec wait_max; struct timespec hold_max; uintmax_t contest_count; - struct timespec wait_time; - struct timespec hold_time; + struct timespec wait_total; + struct timespec hold_total; int acq_count; }; @@ -157,8 +157,8 @@ write_element_timespec("wait_max", &stats.wait_max); write_element_timespec("hold_max", &stats.hold_max); write_element_numeric("contest_count", stats.contest_count); - write_element_timespec("wait_time", &stats.wait_time); - write_element_timespec("hold_time", &stats.hold_time); + write_element_timespec("wait_total", &stats.wait_total); + write_element_timespec("hold_total", &stats.hold_total); write_element_numeric("acq_count", stats.acq_count); } pthread_statistics_end_np(&stats); @@ -333,10 +333,11 @@ &acq->wait_time, sizeof(struct timespec)); } - TIMESPEC_ADD(&acq_point->hold_time, - &acq_point->hold_time, &hold_time); - TIMESPEC_ADD(&acq_point->wait_time, - &acq_point->wait_time, &acq->wait_time); + TIMESPEC_ADD(&acq_point->hold_total, + &acq_point->hold_total, + &hold_time); + TIMESPEC_ADD(&acq_point->wait_total, + &acq_point->wait_total, &acq->wait_time); acq_point->acq_count += acq->count; if (acq->wait_time.tv_sec != 0 || acq->wait_time.tv_nsec != 0) { @@ -394,8 +395,8 @@ stats->wait_max = stats->_pvt->last_record->wait_max; stats->hold_max = stats->_pvt->last_record->hold_max; stats->contest_count = stats->_pvt->last_record->contest_count; - stats->wait_time = stats->_pvt->last_record->wait_time; - stats->hold_time = stats->_pvt->last_record->hold_time; + stats->wait_total = stats->_pvt->last_record->wait_total; + stats->hold_total = stats->_pvt->last_record->hold_total; stats->acq_count = stats->_pvt->last_record->acq_count; } Modified: soc2012/gmiller/locking-head/lib/libwitness/api.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 08:37:51 2012 (r240556) @@ -544,9 +544,9 @@ { int ret; - lor->name_first = NULL; + lor->first_name = NULL; lor->first_trace = NULL; - lor->name_second = NULL; + lor->second_name = NULL; lor->second_trace = NULL; enter_witness(); @@ -580,11 +580,11 @@ ret = 0; if (lor->_pvt->last_record != NULL) { - lor->name_first = + lor->first_name = strdup(get_lock_name(lor->_pvt->last_record->lock_first)); lor->first_trace = strdup(lor->_pvt->last_record->first_trace); - lor->name_second = + lor->second_name = strdup(get_lock_name(lor->_pvt->last_record->lock_second)); lor->second_trace = strdup(lor->_pvt->last_record->second_trace); @@ -605,12 +605,12 @@ lor->_pvt = NULL; } - if (lor->name_first != NULL) { - free(lor->name_first); + if (lor->first_name != NULL) { + free(lor->first_name); } - if (lor->name_second != NULL) { - free(lor->name_second); + if (lor->second_name != NULL) { + free(lor->second_name); } if (lor->first_trace != NULL) { Modified: soc2012/gmiller/locking-head/lib/libwitness/xml.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/xml.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/lib/libwitness/xml.c Mon Aug 20 08:37:51 2012 (r240556) @@ -90,12 +90,12 @@ open_element("lor"); open_element("first"); - write_element_string("name", lor.name_first); + write_element_string("name", lor.first_name); write_element_block("backtrace", lor.first_trace); close_element("first"); open_element("second"); - write_element_string("name", lor.name_second); + write_element_string("name", lor.second_name); write_element_block("backtrace", lor.second_trace); close_element("second"); Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c Mon Aug 20 08:37:51 2012 (r240556) @@ -27,7 +27,7 @@ #include -#define MAX_TESTS (100) +#define MAX_TESTS 100 int success_count = 0; int fail_count = 0; @@ -48,7 +48,7 @@ void show_test_results(void) { - int i; + int i; printf("1..%d\n", success_count + fail_count); Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h Mon Aug 20 08:37:51 2012 (r240556) @@ -25,5 +25,5 @@ * */ -void check(char cond); -void show_test_results(void); +void check(char cond); +void show_test_results(void); Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c Mon Aug 20 08:37:51 2012 (r240556) @@ -44,7 +44,7 @@ pthread_mutex_unlock(&mutex); - return NULL; + return (NULL); } void @@ -65,10 +65,11 @@ void check_stats_conflict(void) { - int record_count = 0; struct pthread_statistics_np stats; - long tm; + int record_count; + long tm; + record_count = 0; pthread_statistics_begin_np(&stats); while (pthread_statistics_next_np(&stats)) { record_count++; @@ -79,8 +80,8 @@ check(stats.contest_count == 1); - tm = stats.wait_time.tv_sec * 1000000L + - stats.wait_time.tv_nsec / 1000; + tm = stats.wait_total.tv_sec * 1000000L + + stats.wait_total.tv_nsec / 1000; check(tm > 0); tm = stats.wait_max.tv_sec * 1000000L + stats.wait_max.tv_nsec / 1000; @@ -95,5 +96,5 @@ show_test_results(); - return 0; + return (0); } Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c Mon Aug 20 08:37:51 2012 (r240556) @@ -37,7 +37,7 @@ void lock_cycle(void) { - int i; + int i; for (i = 0; i < 1000; i++) { pthread_mutex_lock(&mutex); @@ -55,14 +55,14 @@ lock_cycle(); - return NULL; + return (NULL); } void multi_cycle() { - pthread_t thread1; - pthread_t thread2; + pthread_t thread1; + pthread_t thread2; pthread_create(&thread1, NULL, thread_func, NULL); pthread_create(&thread2, NULL, thread_func, NULL); @@ -82,10 +82,11 @@ void check_stats_single(void) { - int record_count = 0; + int record_count; struct pthread_statistics_np stats; - long tm; + long tm; + record_count = 0; pthread_statistics_begin_np(&stats); while (pthread_statistics_next_np(&stats)) { record_count++; @@ -104,10 +105,10 @@ check(stats.contest_count == 0); - check(stats.wait_time.tv_sec == 0 && stats.wait_time.tv_nsec == 0); + check(stats.wait_total.tv_sec == 0 && stats.wait_total.tv_nsec == 0); - tm = stats.hold_time.tv_sec * 1000000L + - stats.hold_time.tv_nsec / 1000; + tm = stats.hold_total.tv_sec * 1000000L + + stats.hold_total.tv_nsec / 1000; check(tm >= 10000); check(stats.acq_count == 1000); @@ -116,10 +117,11 @@ void check_stats_multi(void) { - int record_count = 0; + int record_count; struct pthread_statistics_np stats; - long tm; + long tm; + record_count = 0; pthread_statistics_begin_np(&stats); while (pthread_statistics_next_np(&stats)) { record_count++; @@ -134,8 +136,8 @@ tm = stats.hold_max.tv_sec * 1000000L + stats.hold_max.tv_nsec / 1000; check(tm >= 30); - tm = stats.hold_time.tv_sec * 1000000L + - stats.hold_time.tv_nsec / 1000; + tm = stats.hold_total.tv_sec * 1000000L + + stats.hold_total.tv_nsec / 1000; check(tm >= 30000); check(stats.acq_count == 3000); @@ -144,9 +146,10 @@ void check_stats_reset(void) { - int record_count = 0; + int record_count; struct pthread_statistics_np stats; + record_count = 0; pthread_statistics_begin_np(&stats); while (pthread_statistics_next_np(&stats)) { record_count++; @@ -170,5 +173,5 @@ show_test_results(); - return 0; + return (0); } Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c Mon Aug 20 08:37:51 2012 (r240556) @@ -55,10 +55,11 @@ void check_stats_recursion(void) { - int record_count = 0; + int record_count; struct pthread_statistics_np stats; - long tm; + long tm; + record_count = 0; pthread_statistics_begin_np(&stats); while (pthread_statistics_next_np(&stats)) { record_count++; @@ -73,15 +74,15 @@ check(stats.contest_count == 0); - check(stats.wait_time.tv_sec == 0 && stats.wait_time.tv_nsec == 0); + check(stats.wait_total.tv_sec == 0 && stats.wait_total.tv_nsec == 0); check(stats.acq_count == 1); tm = stats.hold_max.tv_sec * 1000000L + stats.hold_max.tv_nsec / 1000; check(tm >= 1000000); - tm = stats.hold_time.tv_sec * 1000000L + - stats.hold_time.tv_nsec / 1000; + tm = stats.hold_total.tv_sec * 1000000L + + stats.hold_total.tv_nsec / 1000; check(tm >= 1000000); } @@ -93,5 +94,5 @@ show_test_results(); - return 0; + return (0); } Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c Mon Aug 20 08:37:51 2012 (r240556) @@ -78,9 +78,10 @@ void check_unbless(void) { - int record_count = 0; + int record_count; struct pthread_lor_np lor; + record_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { record_count++; @@ -93,9 +94,10 @@ void check_bless(void) { - int record_count = 0; + int record_count; struct pthread_lor_np lor; + record_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { record_count++; Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c Mon Aug 20 08:37:51 2012 (r240556) @@ -27,7 +27,7 @@ #include -#define MAX_TESTS (100) +#define MAX_TESTS 100 int success_count = 0; int fail_count = 0; @@ -48,7 +48,7 @@ void show_test_results(void) { - int i; + int i; printf("1..%d\n", success_count + fail_count); Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h Mon Aug 20 08:37:51 2012 (r240556) @@ -25,5 +25,5 @@ * */ -void check(char cond); -void show_test_results(void); +void check(char cond); +void show_test_results(void); Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c Mon Aug 20 08:37:51 2012 (r240556) @@ -55,8 +55,9 @@ void cycle_locks(pthread_mutex_t *lock_buffer, int *lock_set, int lock_set_size) { - int i = 0; + int i; + i = 0; while (i < lock_set_size) { pthread_mutex_lock(&lock_buffer[lock_set[i++]]); } @@ -86,10 +87,10 @@ void all_tests(int lock_count) { - int i; - pthread_mutex_t *lock_buffer; - int *lock_set; - char name[11]; + pthread_mutex_t *lock_buffer; + int *lock_set; + int i; + char name[11]; pthread_lockorder_reset_np(); Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c Mon Aug 20 08:37:51 2012 (r240556) @@ -59,9 +59,10 @@ void check_lor_basic(void) { - int record_count = 0; + int record_count; struct pthread_lor_np lor; + record_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { record_count++; Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c Mon Aug 20 08:37:51 2012 (r240556) @@ -56,15 +56,16 @@ void check_setname(void) { - int record_count = 0; + int record_count; struct pthread_lor_np lor; + record_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { - check((strcmp(lor.name_first, "mutex 1") == 0 && - strcmp(lor.name_second, "mutex 2") == 0) || - (strcmp(lor.name_first, "mutex 2") == 0 && - strcmp(lor.name_second, "mutex 1") == 0)); + check((strcmp(lor.first_name, "mutex 1") == 0 && + strcmp(lor.second_name, "mutex 2") == 0) || + (strcmp(lor.first_name, "mutex 2") == 0 && + strcmp(lor.second_name, "mutex 1") == 0)); record_count++; } Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c Mon Aug 20 08:37:51 2012 (r240556) @@ -62,9 +62,10 @@ void check_unset(void) { - int record_count = 0; + int record_count; struct pthread_lor_np lor; + record_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { record_count++; @@ -77,9 +78,10 @@ void check_set(void) { - int record_count = 0; + int record_count; struct pthread_lor_np lor; + record_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { record_count++; Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c ============================================================================== --- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c Mon Aug 20 06:11:04 2012 (r240555) +++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c Mon Aug 20 08:37:51 2012 (r240556) @@ -94,9 +94,10 @@ void check_shared(void) { + int lor_count; struct pthread_lor_np lor; - int lor_count = 0; + lor_count = 0; pthread_lor_begin_np(&lor); while (pthread_lor_next_np(&lor)) { lor_count++; From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 13:15:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B5BA01065670 for ; Mon, 20 Aug 2012 13:15:20 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 13:15:20 +0000 Date: Mon, 20 Aug 2012 13:15:20 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820131520.B5BA01065670@hub.freebsd.org> Cc: Subject: socsvn commit: r240565 - in soc2012/syuu/bhyve-bios: lib/libbiosemul usr.sbin/bhyve usr.sbin/bhyvebiosload X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 13:15:22 -0000 Author: syuu Date: Mon Aug 20 13:15:20 2012 New Revision: 240565 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240565 Log: Replaced my own bios emulation code by libbiosemul, which includes interrupt vector with trampoline code, loading boot sector, bios call emulation. Added handling secondary PIC IO(0xa0, 0xa1), keyboard controller IO(0x60, 0x64). Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int10.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c soc2012/syuu/bhyve-bios/lib/libbiosemul/int14.c soc2012/syuu/bhyve-bios/lib/libbiosemul/mouse.c soc2012/syuu/bhyve-bios/lib/libbiosemul/port.c soc2012/syuu/bhyve-bios/lib/libbiosemul/register.h soc2012/syuu/bhyve-bios/lib/libbiosemul/signal.c soc2012/syuu/bhyve-bios/lib/libbiosemul/trap.c soc2012/syuu/bhyve-bios/lib/libbiosemul/tty.c soc2012/syuu/bhyve-bios/lib/libbiosemul/video.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/Makefile soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_call.h soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int10.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int13.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int16.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/bios_int18.c soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/Makefile Mon Aug 20 13:15:20 2012 (r240565) @@ -5,16 +5,18 @@ LIB= biosemul WARNS?= 2 SRCS= biosemul.c \ - bios.c callback.c \ + bios.c callback.c cpu.c \ debug.c i386-pinsn.c \ - int13.c + int.c int10.c int13.c int16.c \ + mouse.c port.c trap.c \ + tty.c video.c ${FONTHDRS} INCS= biosemul.h CFLAGS+= -I. -DDISASSEMBLER FONTFILES= cp437-8x8.pcf.gz cp437-8x14.pcf.gz cp437-8x16.pcf.gz FONTHDRS= font8x8.h font8x14.h font8x16.h CLEANFILES= ${FONTFILES} ${FONTHDRS} -CFLAGS+= -DNO_X -g +CFLAGS+= -DNO_X cp437-8x8.pcf.gz: cp437-8x8.pcf.gz.uu uudecode ${.CURDIR}/cp437-8x8.pcf.gz.uu Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/bios.c Mon Aug 20 13:15:20 2012 (r240565) @@ -82,7 +82,6 @@ int nparallel = 0; u_int32_t rom_config; -#if 0 /* ** BIOS equipment list */ @@ -138,11 +137,13 @@ debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n"); /* Don't translate scan code. */ break; -#if 0 case 0x88: - get_raw_extmemory_info(REGS); - break; +#if 0 + get_raw_extmemory_info(REGS); #endif + /* XXX: implement max size */ + R_AX = 0x0; + break; case 0xc0: /* Get configuration */ debug(D_TRAPS | 0x15, "BIOS: Get configuration\n"); PUTVEC(R_ES, R_BX, rom_config); @@ -161,22 +162,17 @@ break; } } -#endif void bios_init(void) { -#if 0 int i, j, k; -#endif u_char *jtab; -#if 0 struct timeval tv; time_t tv_sec; struct timezone tz; struct tm tm; u_int32_t vec; -#endif strcpy((char *)BIOS_copyright, "Copyright (C) 1993 Krystal Technologies/BSDI"); @@ -219,7 +215,6 @@ *(u_char *)BIOS_hardware_id = 0xfc; /* Identify as a PC/AT */ -#if 0 /* * Interrupt revectors F000:0000 - F000:03ff */ @@ -229,13 +224,15 @@ continue; if ((i >= 0x00 && i < 0x2f) || (i >= 0x30 && i < 0xfe)) { - ivec[i] = 0xF0300000L | (k * 1); - jtab = (u_char *)VECPTR(ivec[i]); - *jtab++ = 0xf4; /* HLT */ + ivec[i] = 0xF0300000L | (k * 4); + jtab = (u_char *)(lomem_addr + VECPTR(ivec[i])); + *jtab++ = 0x0f; + *jtab++ = 0x01; + *jtab++ = 0xc1; /* VMCALL */ ++k; } else { ivec[i] = 0xF0000000L | (j * 6); - jtab = (u_char *)VECPTR(ivec[i]); + jtab = (u_char *)(lomem_addr + VECPTR(ivec[i])); *jtab++ = 0xcd; /* INT i */ *jtab++ = i; *jtab++ = 0xca; /* RETF 2 */ @@ -244,13 +241,12 @@ ++j; } } -#endif /* * Misc variables from F000:0400 - F000:0fff */ rom_config = 0xF0000400; - jtab = (u_char *)VECPTR(rom_config); + jtab = (u_char *)(lomem_addr + VECPTR(rom_config)); *jtab++ = 20; /* length of entry */ *jtab++ = 0; *jtab++ = *(u_char *)BIOS_hardware_id; @@ -267,18 +263,17 @@ #if 0 InDOS = jtab++; *InDOS = 0; +#else + jtab++; +#endif mouse_area = jtab; -#endif jtab += 0x10; *(u_short *)&BIOSDATA[0x10] = (1 << 0) | /* Diskette avail for boot */ (1 << 1) | /* Math co-processor */ -#if 0 (nmice << 2) | /* No pointing device */ -#endif - (0 << 2) | (2 << 4) | /* Initial video (80 x 25 C) */ ((nfloppies - 1) << 6) | /* Number of floppies - 1 */ (nserial << 9) | /* Number of serial devices */ @@ -298,7 +293,6 @@ BIOSDATA[0x91] = 0x40; } -#if 0 gettimeofday(&tv, &tz); tv_sec = tv.tv_sec; tm = *localtime(&tv_sec); @@ -313,12 +307,14 @@ ivec[0x12] = vec; register_callback(vec, int12, "int 12"); +#if 0 if(fossil) vec = insert_fossil_softint_trampoline(); else vec = insert_softint_trampoline(); ivec[0x14] = vec; register_callback(vec, int14, "int 14"); +#endif vec = insert_softint_trampoline(); ivec[0x15] = vec; @@ -327,7 +323,7 @@ vec = insert_softint_trampoline(); ivec[0x16] = vec; register_callback(vec, int16, "int 16"); - +#if 0 vec = insert_softint_trampoline(); ivec[0x17] = vec; register_callback(vec, int17, "int 17"); Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.c Mon Aug 20 13:15:20 2012 (r240565) @@ -71,8 +71,8 @@ int raw_kbd = 0; int timer_disable = 0; struct timeval boot_time; -u_int32_t *ivec = (u_int32_t *)0; -char *lomem_addr = NULL; +u_int32_t *ivec; +char *lomem_addr; #ifndef USE_VM86 #define PRB_V86_FORMAT 0x4242 @@ -85,10 +85,12 @@ }; #endif -#if 0 /* local prototypes */ +#if 0 static void setup_boot(regcontext_t *REGS); +#endif static int try_boot(int); +#if 0 static void setup_command(int argc, char *argv[], regcontext_t *REGS); static FILE *find_doscmdrc(void); static int do_args(int argc, char *argv[]); @@ -109,29 +111,33 @@ static struct vm86_init_args kargs; #endif +static int set_modified_regs(struct vmctx *ctx, int vcpu, regcontext_t *orig, regcontext_t *modified); +static int get_all_regs(struct vmctx *ctx, int vcpu, regcontext_t *regs); + #define HDISK_CYL 2610 #define HDISK_HEAD 255 #define HDISK_TRACK 63 #define HDISK_FILE "/home/syuu/test.img" +regcontext_t *saved_regcontext; + /* lobotomise */ -void biosemul_init(char *lomem) +void biosemul_init(struct vmctx *ctx, int vcpu, char *lomem) { lomem_addr = lomem; ivec = (u_int32_t *)lomem_addr; - debugf = stderr; - debug_set(0xfffffff); + init_ints(); + + debugf = stderr; -#if 0 /* Call init functions */ if (raw_kbd) console_init(); init_io_port_handlers(); -#endif bios_init(); init_hdisk(2, HDISK_CYL, HDISK_HEAD, HDISK_TRACK, HDISK_FILE, NULL); -#if 0 + try_boot(booting = 2); /* try C: */ cpu_init(); kbd_init(); kbd_bios_init(); @@ -140,10 +146,13 @@ mouse_init(); video_bios_init(); disk_bios_init(); +#if 0 cmos_init(); timer_init(); +#endif /* iomap_init(); */ +#if 0 gettimeofday(&boot_time, 0); #endif } @@ -157,6 +166,10 @@ static void setup_boot(regcontext_t *REGS) { + int fd; /* don't close this! */ + + fd = try_boot(booting = 2); /* try C: */ + /* initialise registers for entry to bootblock */ R_EFLAGS = 0x20202; R_CS = 0x0000; @@ -176,6 +189,7 @@ R_GS = 0x0000; #endif } +#endif /* ** try_boot @@ -194,7 +208,7 @@ } /* read bootblock */ - if (read(fd, (char *)0x7c00, 512) != 512) { + if (read(fd, (char *)(lomem_addr + 0x7c00), 512) != 512) { debug(D_DISK, "Short read on boot block from %c:\n", drntol(bootdrv)); return -1; } @@ -202,6 +216,7 @@ return fd; } +#if 0 /* ** setup_command ** @@ -768,7 +783,7 @@ } #endif -int +static int get_all_regs(struct vmctx *ctx, int vcpu, regcontext_t *regs) { int error = 0; @@ -806,108 +821,108 @@ if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RAX, ®s->r.eax.r_rx)) != 0) goto done; - if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, ®s->r.eip.r_rx)) != 0) + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RSP, ®s->r.esp.r_rx)) != 0) goto done; - if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_CS, ®s->r.cs.r_rx)) != 0) + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_SS, ®s->r.ss.r_rx)) != 0) goto done; - if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, ®s->r.efl.r_rx)) != 0) + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, ®s->r.eip.r_rx)) != 0) goto done; - if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RSP, ®s->r.esp.r_rx)) != 0) + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_CS, ®s->r.cs.r_rx)) != 0) goto done; - if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_SS, ®s->r.ss.r_rx)) != 0) + if ((error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, ®s->r.efl.r_rx)) != 0) goto done; done: return (error); } -int +static int set_modified_regs(struct vmctx *ctx, int vcpu, regcontext_t *orig, regcontext_t *modified) { int error = 0; if ((orig->r.gs.r_rx != modified->r.gs.r_rx) && - printf("%s gs:%lx\n", __func__, modified->r.gs.r_rx) && + fprintf(stderr, "%s gs:%lx\n", __func__, modified->r.gs.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_GS, modified->r.gs.r_rx)) != 0) goto done; if ((orig->r.fs.r_rx != modified->r.fs.r_rx) && - printf("%s fs:%lx\n", __func__, modified->r.fs.r_rx) && + fprintf(stderr, "%s fs:%lx\n", __func__, modified->r.fs.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_FS, modified->r.fs.r_rx)) != 0) goto done; if ((orig->r.es.r_rx != modified->r.es.r_rx) && - printf("%s es:%lx\n", __func__, modified->r.es.r_rx) && + fprintf(stderr, "%s es:%lx\n", __func__, modified->r.es.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_ES, modified->r.es.r_rx)) != 0) goto done; if ((orig->r.ds.r_rx != modified->r.ds.r_rx) && - printf("%s ds:%lx\n", __func__, modified->r.ds.r_rx) && + fprintf(stderr, "%s ds:%lx\n", __func__, modified->r.ds.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_DS, modified->r.es.r_rx)) != 0) goto done; if ((orig->r.edi.r_rx != modified->r.edi.r_rx) && - printf("%s edi:%lx\n", __func__, modified->r.edi.r_rx) && + fprintf(stderr, "%s edi:%lx\n", __func__, modified->r.edi.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RDI, modified->r.edi.r_rx)) != 0) goto done; if ((orig->r.esi.r_rx != modified->r.esi.r_rx) && - printf("%s esi:%lx\n", __func__, modified->r.esi.r_rx) && + fprintf(stderr, "%s esi:%lx\n", __func__, modified->r.esi.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RSI, modified->r.esi.r_rx)) != 0) goto done; if ((orig->r.ebp.r_rx != modified->r.ebp.r_rx) && - printf("%s ebp:%lx\n", __func__, modified->r.ebp.r_rx) && + fprintf(stderr, "%s ebp:%lx\n", __func__, modified->r.ebp.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RBP, modified->r.ebp.r_rx)) != 0) goto done; if ((orig->r.ebx.r_rx != modified->r.ebx.r_rx) && - printf("%s ebx:%lx\n", __func__, modified->r.ebx.r_rx) && + fprintf(stderr, "%s ebx:%lx\n", __func__, modified->r.ebx.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RBX, modified->r.ebx.r_rx)) != 0) goto done; if ((orig->r.edx.r_rx != modified->r.edx.r_rx) && - printf("%s edx:%lx\n", __func__, modified->r.edx.r_rx) && + fprintf(stderr, "%s edx:%lx\n", __func__, modified->r.edx.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RDX, modified->r.edx.r_rx)) != 0) goto done; if ((orig->r.ecx.r_rx != modified->r.ecx.r_rx) && - printf("%s ecx:%lx\n", __func__, modified->r.ecx.r_rx) && + fprintf(stderr, "%s ecx:%lx\n", __func__, modified->r.ecx.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RCX, modified->r.ecx.r_rx)) != 0) goto done; if ((orig->r.eax.r_rx != modified->r.eax.r_rx) && - printf("%s eax:%lx\n", __func__, modified->r.eax.r_rx) && + fprintf(stderr, "%s eax:%lx\n", __func__, modified->r.eax.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RAX, modified->r.eax.r_rx)) != 0) goto done; + if ((orig->r.esp.r_rx != modified->r.esp.r_rx) && + fprintf(stderr, "%s esp:%lx\n", __func__, modified->r.esp.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RSP, modified->r.esp.r_rx)) != 0) + goto done; + + if ((orig->r.ss.r_rx != modified->r.ss.r_rx) && + fprintf(stderr, "%s ss:%lx\n", __func__, modified->r.ss.r_rx) && + (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_SS, modified->r.ss.r_rx)) != 0) + goto done; + if ((orig->r.eip.r_rx != modified->r.eip.r_rx) && - printf("%s eip:%lx\n", __func__, modified->r.eip.r_rx) && + fprintf(stderr, "%s eip:%lx\n", __func__, modified->r.eip.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, modified->r.eip.r_rx)) != 0) goto done; if ((orig->r.cs.r_rx != modified->r.cs.r_rx) && - printf("%s cs:%lx\n", __func__, modified->r.cs.r_rx) && + fprintf(stderr, "%s cs:%lx\n", __func__, modified->r.cs.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_CS, modified->r.cs.r_rx)) != 0) goto done; if ((orig->r.efl.r_rx != modified->r.efl.r_rx) && - printf("%s eflags:%lx\n", __func__, modified->r.efl.r_rx) && + fprintf(stderr, "%s eflags:%lx\n", __func__, modified->r.efl.r_rx) && (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RFLAGS, modified->r.efl.r_rx)) != 0) goto done; - - if ((orig->r.esp.r_rx != modified->r.esp.r_rx) && - printf("%s esp:%lx\n", __func__, modified->r.esp.r_rx) && - (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RSP, modified->r.esp.r_rx)) != 0) - goto done; - - if ((orig->r.ss.r_rx != modified->r.ss.r_rx) && - printf("%s ss:%lx\n", __func__, modified->r.ss.r_rx) && - (error = vm_set_register(ctx, vcpu, VM_REG_GUEST_SS, modified->r.ss.r_rx)) != 0) - goto done; done: return (error); @@ -920,48 +935,84 @@ { int ret = 0; regcontext_t orig, modified; + regcontext_t *REGS = &modified; get_all_regs(ctx, vcpu, &orig); + { + u_int16_t *sp, eip, cs, efl; + + sp = (uint16_t *)(lomem_addr + orig.r.esp.r_rx); + eip = *sp; + cs = *(--sp); + efl = *(--sp); + fprintf(stderr, "%s eip:%x cs:%x efl:%x\n", + __func__, eip, cs, efl); + } modified = orig; - printf("%s orig RAX=%lx EAX=%x AX=%x AL=%x AH=%x\n", + fprintf(stderr, "%s orig RAX=%lx EAX=%x AX=%x AL=%x AH=%x\n", __func__, orig.r.eax.r_rx, orig.r.eax.r_dw.r_ex, orig.r.eax.r_w.r_x, orig.r.eax.r_b.r_l, orig.r.eax.r_b.r_h); - printf("%s orig RBX=%lx EBX=%x BX=%x BL=%x BH=%x\n", + fprintf(stderr, "%s orig RBX=%lx EBX=%x BX=%x BL=%x BH=%x\n", __func__, orig.r.ebx.r_rx, orig.r.ebx.r_dw.r_ex, orig.r.ebx.r_w.r_x, orig.r.ebx.r_b.r_l, orig.r.ebx.r_b.r_h); - printf("%s modified RAX=%lx EAX=%x AX=%x AL=%x AH=%x\n", + fprintf(stderr, "%s modified RAX=%lx EAX=%x AX=%x AL=%x AH=%x\n", __func__, modified.r.eax.r_rx, modified.r.eax.r_dw.r_ex, modified.r.eax.r_w.r_x, modified.r.eax.r_b.r_l, modified.r.eax.r_b.r_h); - printf("%s modified RBX=%lx EBX=%x BX=%x BL=%x BH=%x\n", + fprintf(stderr, "%s modified RBX=%lx EBX=%x BX=%x BL=%x BH=%x\n", __func__, modified.r.ebx.r_rx, modified.r.ebx.r_dw.r_ex, modified.r.ebx.r_w.r_x, modified.r.ebx.r_b.r_l, modified.r.ebx.r_b.r_h); + callback_t func = find_callback(MAKEVEC(R_CS, R_IP)); + fprintf(stderr, "%s R_CS:%x R_IP:%x MAKEVEC(R_CS, R_IP):%x func:%p\n", + __func__, R_CS, R_IP, MAKEVEC(R_CS, R_IP), func); + if (func) + func(&modified); - switch (intno) { - case 0x13: - printf("call int13\n"); - int13(&modified); - break; - default: - ret = -1; - } set_modified_regs(ctx, vcpu, &orig, &modified); return (ret); } +bool biosemul_inout_registered(int in, int port) +{ + return io_port_defined(in, port); +} + +int biosemul_inout(struct vmctx *ctx, int vcpu, int in, int port, int bytes, + uint32_t *eax, int strict) +{ + regcontext_t orig, modified; + + get_all_regs(ctx, vcpu, &orig); + modified = orig; + saved_regcontext = &modified; + + fprintf(stderr, "%s in:%d port:%x bytes:%d eax:%x strict:%d\n", + __func__, in, port, bytes, *eax, strict); + + if (in) + inb(&modified, port); + else + outb(&modified, port); + + set_modified_regs(ctx, vcpu, &orig, &modified); + + return 0; +} + + Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/biosemul.h Mon Aug 20 13:15:20 2012 (r240565) @@ -2,10 +2,14 @@ #ifndef _BIOSEMUL_H_ #define _BIOSEMUL_H_ +#include #include #include -void biosemul_init(char *lomem); +void biosemul_init(struct vmctx *ctx, int vcpu, char *lomem); int biosemul_call(struct vmctx *ctx, int vcpu, int intno); +bool biosemul_inout_registered(int in, int port); +int biosemul_inout(struct vmctx *ctx, int vcpu, int in, int port, int bytes, + uint32_t *eax, int strict); #endif Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/callback.c Mon Aug 20 13:15:20 2012 (r240565) @@ -70,7 +70,7 @@ * stack which re-enables interrupts. */ u_char softint_trampoline[] = { - 0xf4, /* HLT */ + 0x0f, 0x01, 0xc1, /* VMCALL */ 0xfb, /* STI */ 0xca, /* RETF 2 */ 2, @@ -85,7 +85,7 @@ * driver is present and what level of functionality it provides. */ u_char fossil_softint_trampoline[] = { - 0xf4, /* HLT */ + 0x0f, 0x01, 0xc1, /* VMCALL */ 0xfb, /* STI */ 0xca, /* RETF 2 */ 2, @@ -96,7 +96,7 @@ 0x1b, /* Max. Supported FOSSIL AH */ }; u_char hardint_trampoline[] = { - 0xf4, /* HLT */ + 0x0f, 0x01, 0xc1, /* VMCALL */ 0xcf, /* IRET */ }; u_char null_trampoline[] = { @@ -110,7 +110,7 @@ u_int32_t where; where = trampoline_rover; - q = (u_char *)VECPTR(where); + q = (u_char *)(lomem_addr + VECPTR(where)); memcpy(q, p, len); trampoline_rover += len; return (where); Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/cpu.c Mon Aug 20 13:15:20 2012 (r240565) @@ -121,7 +121,7 @@ emu_instr(regcontext_t *REGS) { int prefix = 1; - u_int8_t *cs = (u_int8_t *)(uintptr_t)(R_CS << 4); + u_int8_t *cs = (u_int8_t *)(lomem_addr + (uintptr_t)(R_CS << 4)); int ip = R_IP; int dir, i, instrlen; u_int8_t *r8; @@ -400,7 +400,7 @@ if (addr >= 0xa0000 && addr < 0xb0000) return vga_read(addr); else - return *(u_int8_t *)(uintptr_t)addr; + return *(u_int8_t *)(uintptr_t)(lomem_addr + addr); } /* Write an 8-bit value to the location specified by 'addr'. If 'addr' lies @@ -411,7 +411,7 @@ if (addr >= 0xa0000 && addr < 0xb0000) vga_write(addr, val); else - *(u_int8_t *)(uintptr_t)addr = val; + *(u_int8_t *)(uintptr_t)(lomem_addr + addr) = val; return; } @@ -425,7 +425,7 @@ vga_write(addr, (u_int8_t)(val & 0xff)); vga_write(addr + 1, (u_int8_t)((val & 0xff00) >> 8)); } else - *(u_int16_t *)(uintptr_t)addr = val; + *(u_int16_t *)(uintptr_t)(lomem_addr + addr) = val; return; } Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/debug.c Mon Aug 20 13:15:20 2012 (r240565) @@ -162,13 +162,13 @@ debug (D_ALWAYS, "cs=%04x ss=%04x ds=%04x es=%04x\n", R_CS, R_SS, R_DS, R_ES); debug (D_ALWAYS, "ip=%x eflags=%"PRIx32"\n", R_IP, R_EFLAGS); - addr = (u_char *)MAKEPTR(R_CS, R_IP); + addr = (u_char *)(lomem_addr + MAKEPTR(R_CS, R_IP)); for (i = 0; i < 16; i++) debug (D_ALWAYS, "%02x ", addr[i]); debug (D_ALWAYS, "\n"); - addr = (char *)MAKEPTR(R_CS, R_IP); + addr = (char *)(lomem_addr + MAKEPTR(R_CS, R_IP)); i386dis(R_CS, R_IP, addr, buf, 0); debug (D_ALWAYS, "%s\n", buf); Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/doscmd.h Mon Aug 20 13:15:20 2012 (r240565) @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -96,7 +97,6 @@ extern int nparallel; void bios_init(void); -#if 0 extern volatile int poll_cnt; void wakeup_poll(void); void reset_poll(void); @@ -105,6 +105,8 @@ /* cmos.c */ extern time_t delta_clock; +void cmos_init(void); + /* cpu.c */ void cpu_init(void); int emu_instr(regcontext_t *); @@ -112,7 +114,6 @@ void int01(regcontext_t *); void int03(regcontext_t *); void int0d(regcontext_t *); -#endif /* debug.c */ extern int vflag; @@ -200,7 +201,6 @@ extern int i386dis(unsigned short, unsigned short, unsigned char *, char *, int); -#if 0 /* int.c */ void init_ints(void); int isinhardint(int); @@ -213,7 +213,6 @@ /* int10.c */ extern void int10(regcontext_t *); -#endif /* int13.c */ extern int init_hdisk(int drive, int cyl, int head, int tracksize, @@ -222,13 +221,12 @@ extern int disk_fd(int drive); extern void make_readonly(int drive); extern int search_floppy(int i); -#if 0 extern void disk_bios_init(void); -#endif #if 0 /* int14.c */ extern int fossil; +#endif /* int16.c */ void int16(regcontext_t *); @@ -243,6 +241,7 @@ /* int1a.c */ void int1a(regcontext_t *); +#if 0 /* mem.c */ extern char *dosmem; @@ -251,6 +250,7 @@ extern int mem_adjust(long addr, int size, int *availp); extern void mem_free_owner(int owner); extern void mem_change_owner(long addr, int owner); +#endif /* mouse.c */ void int33(regcontext_t *); @@ -272,20 +272,26 @@ void outsb(regcontext_t *, int); void outsx(regcontext_t *, int); void outx(regcontext_t *, int); +bool io_port_defined(int, int); +#if 0 /* setver.c */ extern void setver(char *, short); extern short getver(char *); /* signal.c */ extern struct sigframe *saved_sigframe; +#endif extern regcontext_t *saved_regcontext; +#if 0 extern int saved_valid; extern void setsignal(int s, void (*h)(struct sigframe *)); +#endif /* timer.c */ extern void timer_init(void); +#if 0 /* trace.c */ extern int resettrace(regcontext_t *); extern void tracetrap(regcontext_t *); Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int.c Mon Aug 20 13:15:20 2012 (r240565) @@ -35,7 +35,7 @@ void *arg; }; -static unsigned char IM; +static unsigned char IM, IM2; static int Irql; static struct IRQ Irqs[8]; @@ -54,7 +54,6 @@ return Irqs[irql].within; } -#if 0 static void set_vip(void) { @@ -74,12 +73,10 @@ R_EFLAGS &= ~PSL_VIP; } -#endif void resume_interrupt(void) { -#if 0 regcontext_t *REGS = saved_regcontext; int irql; @@ -99,7 +96,6 @@ } } set_vip(); -#endif } void @@ -124,7 +120,6 @@ void hardint(int irql) { -#if 0 regcontext_t *REGS = saved_regcontext; u_int32_t vec = ivec[8 + irql]; @@ -132,14 +127,18 @@ ** if we're dead, or there's no vector, or the saved registers ** are invalid */ +#if 0 if (dead || !saved_valid || vec == 0) +#else + if (dead || vec == 0) +#endif return; /* ** if the vector points into the BIOS, or the handler at the ** other end is just an IRET, don't bother */ - if ((vec >> 16) == 0xf000 || *(u_char *)VECPTR(vec) == 0xcf) + if ((vec >> 16) == 0xf000 || *(u_char *)(lomem_addr + VECPTR(vec)) == 0xcf) return; if (!int_allowed(irql)) { @@ -166,18 +165,15 @@ PUSH(R_IP, REGS); R_EFLAGS &= ~PSL_VIF; /* XXX disable interrupts */ PUTVEC(R_CS, R_IP, vec); -#endif } void unpend(int irql) { -#if 0 if (!Irqs[irql].pending) return; Irqs[irql].pending = 0; set_vip(); -#endif } static unsigned char @@ -194,15 +190,22 @@ } static unsigned char -imr_in(int port __unused) +imr_in(int port) { - return IM; + if (port == 0x21) + return IM; + else if (port == 0xa1) + return IM2; + return 0; } static void -imr_out(int port __unused, unsigned char val) +imr_out(int port, unsigned char val) { - IM = val; + if (port == 0x21) + IM = val; + else if (port == 0xa1) + IM2 = val; resume_interrupt(); } @@ -220,14 +223,18 @@ ** if we're dead, or there's no vector or the saved registers are ** invalid */ +#if 0 if (dead || !saved_valid || vec == 0) +#else + if (dead || vec == 0) +#endif return; /* ** if the vector points into the BIOS, or the handler at the other ** end is just an IRET, don't bother. */ - if ((vec >> 16) == 0xf000 || *(u_char *)VECPTR(vec) == 0xcf) + if ((vec >> 16) == 0xf000 || *(u_char *)(lomem_addr + VECPTR(vec)) == 0xcf) return; debug(D_TRAPS | intnum, "INT %02x [%04"PRIx32":%04"PRIx32"]\n", @@ -251,11 +258,16 @@ Irqs[i].within = 0; } - IM = 0x00; + IM = IM2 = 0x00; Irql = 8; define_input_port_handler(0x20, irqc_in); define_output_port_handler(0x20, irqc_out); define_input_port_handler(0x21, imr_in); define_output_port_handler(0x21, imr_out); + + define_input_port_handler(0xa0, irqc_in); + define_output_port_handler(0xa0, irqc_out); + define_input_port_handler(0xa1, imr_in); + define_output_port_handler(0xa1, imr_out); } Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int10.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/int10.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int10.c Mon Aug 20 13:15:20 2012 (r240565) @@ -49,6 +49,7 @@ int i, j; int saved_row, saved_col; + debug(D_DISK, "%s:%d AH:%x AL:%x FLAGS:%x\n", __func__, __LINE__, R_AH, R_AL, R_FLAGS); /* * Any call to the video BIOS is enough to reset the poll * count on the keyboard. @@ -157,7 +158,10 @@ debug(D_VIDEO, "Read graphics pixel at %d, %d\n", R_CX, R_DX); break; case 0x0e: /* write character */ +#if 0 tty_write(R_AL, -1); +#endif + tty_write(R_AL, TTYF_REDIRECT); break; case 0x0f: /* get current video mode */ R_AH = DpyCols; /* number of columns */ @@ -176,7 +180,7 @@ VGA_ATC[ATC_OverscanColor] = R_BH; break; case 0x02: /* Set all palette registers */ - addr = (char *)MAKEPTR(R_ES, R_DX); + addr = (char *)(lomem_addr + MAKEPTR(R_ES, R_DX)); for (i = 0; i < 16; i++) palette[i] = *addr++; VGA_ATC[ATC_OverscanColor] = *addr; @@ -192,7 +196,7 @@ R_BH = VGA_ATC[ATC_OverscanColor]; break; case 0x09: /* Read all palette registers */ - addr = (char *)MAKEPTR(R_ES, R_DX); + addr = (char *)(lomem_addr + MAKEPTR(R_ES, R_DX)); for (i = 0; i < 16; i++) *addr++ = palette[i]; *addr = VGA_ATC[ATC_OverscanColor]; @@ -204,7 +208,7 @@ update_pixels(); break; case 0x12: /* Set block of DAC registers */ - addr = (char *)MAKEPTR(R_ES, R_DX); + addr = (char *)(lomem_addr + MAKEPTR(R_ES, R_DX)); for (i = R_BX; i < R_BX + R_CX; i++) { dac_rgb[i].red = *addr++; dac_rgb[i].green = *addr++; @@ -231,7 +235,7 @@ R_CL = dac_rgb[R_BX].blue; break; case 0x17: /* Read block of DAC registers */ - addr = (char *)MAKEPTR(R_ES, R_DX); + addr = (char *)(lomem_addr + MAKEPTR(R_ES, R_DX)); for (i = R_BX; i < R_BX + R_CX; i++) { *addr++ = dac_rgb[i].red; *addr++ = dac_rgb[i].green; @@ -374,7 +378,7 @@ case 0x13: /* write character string */ if (!(xmode || quietmode)) goto unsupported; - addr = (char *)MAKEPTR(R_ES, R_BP); + addr = (char *)(lomem_addr + MAKEPTR(R_ES, R_BP)); switch (R_AL & 0x03) { case 0: tty_report(&saved_row, &saved_col); @@ -415,7 +419,7 @@ break; case 0x1b: /* Video Functionality/State information */ if (R_BX == 0) { - addr = (char *)MAKEPTR(R_ES, R_DI); + addr = (char *)(lomem_addr + MAKEPTR(R_ES, R_DI)); memcpy(addr, vga_status, 64); R_AL = 0x1b; } Modified: soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Mon Aug 20 12:53:29 2012 (r240564) +++ soc2012/syuu/bhyve-bios/lib/libbiosemul/int13.c Mon Aug 20 13:15:20 2012 (r240565) @@ -589,13 +589,11 @@ int side; int drive; -#if 0 reset_poll(); -#endif R_FLAGS &= ~PSL_C; - printf("%s:%d AH:%x AL:%x FLAGS:%x\n", __func__, __LINE__, R_AH, R_AL, R_FLAGS); + debug(D_DISK, "%s:%d AH:%x AL:%x FLAGS:%x\n", __func__, __LINE__, R_AH, R_AL, R_FLAGS); drive = R_DL; @@ -619,11 +617,11 @@ break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 15:20:04 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3F52210657C4 for ; Mon, 20 Aug 2012 15:20:02 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 15:20:02 +0000 Date: Mon, 20 Aug 2012 15:20:02 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820152002.3F52210657C4@hub.freebsd.org> Cc: Subject: socsvn commit: r240581 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 15:20:04 -0000 Author: tzabal Date: Mon Aug 20 15:20:01 2012 New Revision: 240581 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240581 Log: Update for crashreport in client-side. Informing the user that is running and fix issue related with the DDB capture buffer. Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Mon Aug 20 14:54:30 2012 (r240580) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Mon Aug 20 15:20:01 2012 (r240581) @@ -80,6 +80,10 @@ done +## Inform the user that the program has started +echo "crashreport is running..." + + ## Find the dump directory if [ -z "${_dumpdir}" ]; then # dumpdir of /etc/rc.conf @@ -243,7 +247,7 @@ sed '/^ *$/d' > "${tmp_file}" numline='' while read line; do - echo "${line}" | egrep '^#[0-9] ' > /dev/null + echo "${line}" | egrep '^#[0-9]{1,2} ' > /dev/null if [ $? -eq 0 ]; then if [ -z "${numline}" ]; then numline="${line}" @@ -263,7 +267,9 @@ for cmd in $commands2; do echo "" >> ${data} echo "" >> ${data} - echo "${cmd}" >> ${data} + name=`echo "${cmd}" | sed 's/ -/_/'` + name=`echo "${name}" | sed -E 's/([a-z]) ([a-z])/\1\2/g'` + echo "${name}" >> ${data} echo "" >> ${data} echo "" >> ${data} cat "${_dumpdir}/${_file}" | \ @@ -285,33 +291,54 @@ # A valid textdump can contain up to 5 files with the following names: # ddb.txt, config.txt, msgbuf.txt, panic.txt and version.txt +# if [ -f "${tmp_dir}/ddb.txt" ]; then +# flag='false' +# while read line; do +# echo "${line}" | egrep '^.+> [a-z ]+$' > /dev/null +# if [ $? -eq 0 ]; then +# if [ "${flag}" == false ]; then +# flag='true' +# echo "" >> ${data} +# echo "" >> ${data} +# echo "${line}" | \ +# sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data} +# echo "" >> ${data} +# echo "" >> ${data} +# else +# echo "" >> ${data} +# echo "" >> ${data} +# echo "" >> ${data} +# echo "" >> ${data} +# echo "${line}" | \ +# sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data} +# echo "" >> ${data} +# echo "" >> ${data} +# fi +# else +# echo "${line}" >> ${data} +# fi +# done < "${tmp_dir}/ddb.txt" +# echo "" >> ${data} +# echo "" >> ${data} +# fi + + # The above code reads the ddb.txt file and for every DDB command it + # creates an equivalent XML command tag. Although this is useful, it is + # not feasible to be used from the server side system because the + # number of commands and which commands are arbitrary. For example, a + # user could have a captured ddb output with only 2 commands. Another + # user could have a captured ddb output that includes all the commands + # that DDB offers. We decided to create one column in the database with + # the name ddbcapturebuffer instead of creating a large number of + # extra columns only for the output of DDB. + if [ -f "${tmp_dir}/ddb.txt" ]; then - flag='false' - while read line; do - echo "${line}" | egrep '^.+> [a-z ]+$' > /dev/null - if [ $? -eq 0 ]; then - if [ "${flag}" == false ]; then - flag='true' - echo "" >> ${data} - echo "" >> ${data} - echo "${line}" | \ - sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data} - echo "" >> ${data} - echo "" >> ${data} - else - echo "" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - echo "${line}" | \ - sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data} - echo "" >> ${data} - echo "" >> ${data} - fi - else - echo "${line}" >> ${data} - fi - done < "${tmp_dir}/ddb.txt" + echo "" >> ${data} + echo "" >> ${data} + echo "ddb capture buffer" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${tmp_dir}/ddb.txt" >> ${data} echo "" >> ${data} echo "" >> ${data} fi From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 16:08:45 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1B86F1065675 for ; Mon, 20 Aug 2012 16:08:43 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 16:08:43 +0000 Date: Mon, 20 Aug 2012 16:08:43 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820160843.1B86F1065675@hub.freebsd.org> Cc: Subject: socsvn commit: r240588 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 16:08:45 -0000 Author: gpf Date: Mon Aug 20 16:08:42 2012 New Revision: 240588 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240588 Log: - add man page entries for new /sbin/pefs actions. - also, change the letters used for some options so as to avoid conflict with pre-existing ones. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 Mon Aug 20 15:34:06 2012 (r240587) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 Mon Aug 20 16:08:42 2012 (r240588) @@ -104,6 +104,25 @@ .Pp .Nm .Cm showalgs +.Pp +.Nm +.Cm addchecksum +.Op Fl s +.Op Fl a Ar alg +.Op Fl i Ar input_file +.Op Fl k Ar privatekey_file +.Op Fl d Ar dirpath +.Ar filesystem +.Nm +.Cm verify +.Op Fl u|n +.Op Fl k Ar publickey_file +.Ar checksum_file +.Ar filesystem +.Nm +.Cm nameid +.Op Fl u|n +.Ar filepath .Sh DESCRIPTION The .Nm @@ -227,6 +246,76 @@ Print all elements of the key chain staring with given parent key. .It Cm showalgs Print list of all supported algorithms. +.It Cm addchecksum Ar filesystem +Create +.Em .pefs.checksum +db file for +.Ar filesystem. +The algorithm that will be used as a hash function (sha256 by default) is +set by +.Fl a Ar alg . +The file that contains the private key in PEM format for the DSA signing +algorithm must be provided using +.Fl k Ar privatekey_file . +The list of files is read from stdin unless +.Fl i Ar input_file +is used. Files should be either regular files or symbolic links. Symlinks +are not traversed. +All files that need integrity checking must have the immutable flag (schg) set; +.Fl s +can be used to let +.Nm +turn it on for files that do not. +.Fl d Ar dirpath +can be used to specify under which directory the resulting +.Em .pefs.checksum +file should be placed. Otherwise, it is created under $PWD. +.It Cm verify Ar checksumpath filesystem +Verify the contents of a +.Em .pefs.checksum +file. This command scans the entire +.Ar filesystem +and checks that every entry in +.Em .pefs.checkum +is found and produces the same checksums. The command will try to produce +the same warning messages as +.Cm addchecksum +concerning hardlinks and symbolic links. It will also try to produce as many +warning messages as possible before failing. If +.Ar filesystem +is mounted but the key has not been supplied yet, +.Fl n +flag should be used. If the pefs +.Ar filesystem +is unmounted, the +.Fl u +flag should be used instead. By default, +.Nm +will assume that the filesystem is mounted and user has provided the +necessary key(s) using +.Cm addkey . +The file that contains the public key in PEM format must be provided using +.Fl k Ar privatekey_file . +.It Cm nameid Ar filepath +Print the identifier for an encrypted pefs filename where filename = +XBase64(checksum || E(tweak || filename)). The id is the name checksum, +meaning VMAC(E(tweak || filename)). This identifier is used as a primary key +when a filename is handled by +.Nm +for integrity checking purposes. Some warning messages produced by +.Nm +refer to files by their internal ID and not their decrypted fullpath; e.g. +when verifying an unmounted pefs filesystem. Therefore, this command can be +used to map fullpaths to internal IDs. If the pefs +.Ar filesystem +is unmounted, the +.Fl u +flag should be used instead. By default, +.Nm +will assume that the filesystem is mounted and user has provided the +necessary key(s) using +.Cm addkey . +Symlinks are not traversed. .El .Pp .Ss COMMAND OPTIONS @@ -248,11 +337,18 @@ .It Fl C Disables key chain lookup. By default if chain is found, keys it consists of are also used for operation. +.It Fl d Ar dirpath +specifies under which directory the resulting +.Em .pefs.checksum +file should be placed. .It Fl i Ar iterations Number of .Ar iterations to use with PKCS#5v2. -If this option is not specified default value of 50000 is used. +If this option is not specified default value of 50000 is used. In case of +.Cm addchecksum +, it may be used to specify the file that contains the list of full filenames +that require integrity checking. .It Fl I Ar iterations Specifies number of .Ar iterations @@ -270,9 +366,15 @@ Specifies a file which contains part of the key. If .Ar keyfile -is given as -, standard input will be used. +is given as -, standard input will be used. In case of integrity +checking actions, this specifies either the public or the private key +that is used by the signing algorithm. .It Fl K Ar keyfile Specifies a file which contains part of the secondary/child key. +.It Fl n +Specifies that the pefs +.Ar filesystem +is mounted but user has not provided the necessary key(s) yet. .It Fl o Ar options Mount options passed to .Xr mount 8 @@ -281,10 +383,19 @@ Do not ask for passphrase. .It Fl P Do not ask for passphrase for secondary/child key. +.It Fl s +Is used to let +.Cm addchecksum +turn on the schg immutable flag for files that need integrity checking but +lack the schg flag. .It Fl t Test-only mode. Do not perform actual operation but check if it can be performed. Usable for scripting. +.It Fl u +Specifies that the pefs +.Ar filesystem +is unmounted. .It Fl v Verbose mode. .It Fl x @@ -369,6 +480,14 @@ before loading .Nm kernel module. +.It Va vfs.pefs.exec.enable +If this flag is set to 1, the system allows execution of code that derives +solely from files with the immutable flag (schg) set. This flag is temporary +as this functionality should be controlled by securelevel. +.It Va vfs.pefs.exec.enable.noscript +Same as the above except for when user is trying to execute a script. In +that case, only the interpreter will be checked for the schg flag, not the +script file. .El .Sh EXAMPLES Encrypting a directory: Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Mon Aug 20 15:34:06 2012 (r240587) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Mon Aug 20 16:08:42 2012 (r240588) @@ -1006,14 +1006,14 @@ /* * XXXgpf: Instead of a man page entry: * - * pefs addchecksum [-f] [-a algo] [-i inputfile] [-k pkey_file] [-p path] \ + * pefs addchecksum [-s] [-a alg] [-i inputfile] [-k pkey_file] [-d dirpath] \ * filesystem * * $command creates .pefs.checksum db file for filesystem. * This file will contain all checksums necessary to check integrity * of files upon access. * - * algo is the name of the algorithm to be used as a cryptographic + * alg is the name of the algorithm to be used as a cryptographic * hash function; supported algorithms: sha256, sha512. sha256 is * used by default. * @@ -1022,8 +1022,8 @@ * These files should be either regular files or symbolic links. * Symlinks are not traversed. * - * path defines where .pefs.checksum should be created. By default, - * .pefs.checksum is created under $PWD. path should be a directory, + * dirpath defines where .pefs.checksum should be created. By default, + * .pefs.checksum is created under $PWD. dirpath should be a directory, * outside of target pefs filesystem. * * pkey_file is the file that contains the private key that will be used @@ -1054,7 +1054,7 @@ /* by default create checksum file under $PWD */ snprintf(csm_path, sizeof(csm_path), "./%s", PEFS_FILE_CHECKSUM); - while ((i = getopt(argc, argv, "fa:i:k:p:")) != -1) + while ((i = getopt(argc, argv, "sa:i:k:d:")) != -1) switch(i) { case 'a': for (j=0; j < PEFS_SUPPORTED_DIGESTS; j++) @@ -1069,7 +1069,7 @@ goto out; } break; - case 'f': + case 's': flags|= PEFS_SETIMMUTABLE; break; case 'i': @@ -1088,7 +1088,7 @@ goto out; } break; - case 'p': + case 'd': if (stat(optarg, &sb) != 0) { warn("cannot stat file %s", optarg); error = PEFS_ERR_INVALID; @@ -1356,7 +1356,7 @@ " pefs randomchain [-fv] [-n min] [-N max] filesystem\n" " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\n" -" pefs addchecksum [-f] [-a algo] [-i inputfile] [-k pkey_file] [-p checksumpath] filesystem\n" +" pefs addchecksum [-s] [-a algo] [-i inputfile] [-k pkey_file] [-d dirpath] filesystem\n" " pefs verify [-n/u] [-k pkey_file] [checksumpath filesystem]\n" " pefs nameid [-u/-n] [filepath]" ); From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 17:45:42 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BDA2D1065677 for ; Mon, 20 Aug 2012 17:45:40 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 17:45:40 +0000 Date: Mon, 20 Aug 2012 17:45:40 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820174540.BDA2D1065677@hub.freebsd.org> Cc: Subject: socsvn commit: r240600 - in soc2012/aleek/beaglexm-armv6/sys: arm/conf arm/ti arm/ti/omap3 arm/ti/omap3/beagleboard arm/ti/twl boot/fdt/dts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 17:45:42 -0000 Author: aleek Date: Mon Aug 20 17:45:39 2012 New Revision: 240600 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240600 Log: minor fixes and cleanup. Added beagleboard board initialization as SYSINIT function Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/files.beagleboardxm soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/std.beagleboardxm Deleted: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.beagleboardxm soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/std.beagleboardxm Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/files.ti soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_early_uart.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Mon Aug 20 17:45:39 2012 (r240600) @@ -20,7 +20,7 @@ ident BEAGLEBOARD-XM -include "../ti/omap3/std.beagleboardxm" +include "../ti/omap3/beagleboard/std.beagleboardxm" makeoptions MODULES_OVERRIDE="" makeoptions WITHOUT_MODULES="ahc" @@ -68,7 +68,7 @@ device mmcsd # mmc/sd flash cards # Boot device is 2nd slice on MMC/SD card -options ROOTDEVNAME=\"msdosfs:mmcsd0s2\" +options ROOTDEVNAME=\"msdosfs:mmcsd0s3\" # Console and misc Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/files.ti ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/files.ti Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/files.ti Mon Aug 20 17:45:39 2012 (r240600) @@ -3,7 +3,7 @@ kern/kern_clocksource.c standard arm/arm/bus_space_generic.c standard -arm/arm/bus_space_asm_generic.S standard +arm/arm/bus_space_asm_generic.S standard arm/arm/cpufunc_asm_armv5.S standard arm/arm/cpufunc_asm_arm10.S standard arm/arm/cpufunc_asm_arm11.S standard Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c Mon Aug 20 17:45:39 2012 (r240600) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2012 + * Aleksander Dutkowski . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +static void +board_init(void *dummy) +{ + printf( "BeagleBoard Init!\n" ); + return; +} +SYSINIT(board_init, SI_SUB_PSEUDO, SI_ORDER_ANY, board_init, NULL); Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/files.beagleboardxm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/files.beagleboardxm Mon Aug 20 17:45:39 2012 (r240600) @@ -0,0 +1,6 @@ +#$FreeBSD$ + +arm/ti/twl/twl.c optional twl +arm/ti/twl/twl_vreg.c optional twl twl_vreg +arm/ti/twl/twl_clks.c optional twl twl_clks +arm/ti/omap3/beagleboard/beagleboard.c standard Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/std.beagleboardxm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/std.beagleboardxm Mon Aug 20 17:45:39 2012 (r240600) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +files "../ti/omap3/beagleboard/files.beagleboardxm" +include "../ti/omap3/std.omap3" Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_early_uart.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_early_uart.c Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_early_uart.c Mon Aug 20 17:45:39 2012 (r240600) @@ -27,6 +27,8 @@ /* * Debugging functions for early uart for omap3530 and omap3 TI SoC's + * They might be used for early frinting when console is not initialized yet + * Just change the arm_early_putc() function */ #include Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.c Mon Aug 20 17:45:39 2012 (r240600) @@ -1,9 +1,8 @@ - /*- * Copyright (c) 2012 Aleksander Dutkowski + * Copyright (c) 2011 Ben Gray . * All rights reserved. * - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.h Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_gptimer.h Mon Aug 20 17:45:39 2012 (r240600) @@ -1,10 +1,30 @@ -#define OMAP3_NUM_TIMERS 12 - -/* - * Ids of the timers used by the kernel +/*- + * Copyright (c) 2012 Aleksander Dutkowski + * Copyright (c) 2011 Ben Gray . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ -#define TICKTIMER_GPTIMER 10 -#define TIMECOUNT_GPTIMER 11 +#define OMAP3_NUM_TIMERS 12 /* * Standard registers for OMAP3 General Purpose Timers Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c Mon Aug 20 17:45:39 2012 (r240600) @@ -341,8 +341,6 @@ if (ch == NULL) return (EINVAL); - device_printf( sc->sc_dev, "Activating channel %d\n", *ch ); - TI_SDMA_LOCK(sc); /* Check to see if all channels are in use */ Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/twl/twl_vreg.c Mon Aug 20 17:45:39 2012 (r240600) @@ -936,6 +936,10 @@ char rnames[256]; char *name, *voltage; int len = 0, prop_len; + + // playing with TWL can sometimes cause a kernel panic + // +#ifdef notyet uint8_t val; if (twl_is_4030(sc->sc_pdev)) { @@ -943,7 +947,6 @@ * by writing proper values to PROTECT_KEY register */ - /* val = 0xC0; if( twl_write( sc->sc_pdev, 3, 0x44, &val, 1 ) != 0 ) { @@ -955,7 +958,7 @@ { device_printf( sc->sc_dev, "Unable to unlock PROTECT_KEY\n" ); return 0; - }*/ + } val = 0x01; if( twl_write( sc->sc_pdev, 0, 0xFD, &val, 1 ) != 0 ) @@ -963,12 +966,11 @@ device_printf( sc->sc_dev, "Unable to power USB PHY\n" ); return 0; } - /* if( twl_read( sc->sc_pdev, 3, 0x46, &val, 1 ) != 0 ) { device_printf( sc->sc_dev, "Could not read P1_SW_EVENTS register\n" ); return 0; - }*/ + } val = 0x00; if( twl_write( sc->sc_pdev, 3, 0x46, &val, 1 ) != 0 ) { @@ -977,13 +979,12 @@ } // if we have BeagleBoard-xM, we need to repower HUB - /* val = ~(TWL4030_LEDEN_LEDAON | TWL4030_LEDEN_LEDBON); twl_vreg_led_set( sc, val ); val = (TWL4030_LEDEN_LEDAON | TWL4030_LEDEN_LEDBON); - twl_vreg_led_set( sc, val );*/ + twl_vreg_led_set( sc, val ); } - +#endif /* Add the regulators from the list */ walker = ®ulators[0]; @@ -1030,14 +1031,14 @@ } } -//#ifdef DEBUG +#ifdef DEBUG int err; LIST_FOREACH(entry, &sc->sc_vreg_list, entries) { err = twl_vreg_read_regulator_voltage(sc, entry, &millivolts); if (!err) device_printf(sc->sc_dev, "%s : %d mV\n", entry->name, millivolts); } -//#endif +#endif return (0); } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Aug 20 16:57:27 2012 (r240599) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Mon Aug 20 17:45:39 2012 (r240600) @@ -101,8 +101,6 @@ so they work even without SCM configuration. It is need to be fixed */ /*"ic11", "i2c1_scl", "input_pullup_inact", "ic12", "i2c1_sda", "input_pullup_inact";*/ - - }; prcm@48004000 { @@ -113,6 +111,30 @@ 0x48306000 0x2000>; }; + i2c: i2c@48070000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,i2c"; + reg =< 0x48070000 0x1000 >; + interrupts = <56>; + interrupt-parent = <&AINTC>; + i2c-device-id = <1>; + + twl4030@48 { + compatible = "ti,twl4030"; + reg = < 0x48 >; + voltage-regulators = + "vaux2", "0", + "vusb1v5", "1500", + "vusb1v8", "1800", + "vusb3v1", "3100", + "vaux2", "1800", + "vusb1v5", "0", + "vusb1v8", "0", + "vusb3v1", "0"; + }; + }; + GPIO: gpio { #gpio-cells = <3>; compatible = "ti,gpio"; @@ -171,37 +193,6 @@ mmchs-device-id = <1>; }; - i2c1: i2c@48070000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "ti,i2c"; - reg =< 0x48070000 0x1000 >; - interrupts = <56>; - interrupt-parent = <&AINTC>; - i2c-device-id = <1>; - - twl4030@48 { - compatible = "ti,twl4030"; - reg = < 0x48 >; - voltage-regulators = - "vaux1", "0", - "vaux2", "0", - "vaux3", "0", - "vaux4", "0", - /*"vmmc1", "0",*/ - /*"vmmc2", "0",*/ - /*"vpll1", "0",*/ - "vpll2", "0", - "vsim", "0", - "vdac", "0", - /*"vintana1", "0",*/ - "vintana2", "0", - /*"vintdig", "0",*/ - "vusb1v5", "0", - "vusb1v8", "0", - "vusb3v1", "0"; - }; - }; /* ehci@48064800 { compatible = "ti,ehci"; From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 17:48:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C764C106564A for ; Mon, 20 Aug 2012 17:48:20 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 17:48:20 +0000 Date: Mon, 20 Aug 2012 17:48:20 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820174820.C764C106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240601 - soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 17:48:22 -0000 Author: aleek Date: Mon Aug 20 17:48:20 2012 New Revision: 240601 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240601 Log: added copyrights ;) Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm.c Mon Aug 20 17:45:39 2012 (r240600) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm.c Mon Aug 20 17:48:20 2012 (r240601) @@ -1,9 +1,9 @@ /*- * Copyright (c) 2011 * Ben Gray . + * Copyright (c) 2012 Aleksander Dutkowski * All rights reserved. * - * Modified 2012 Aleksander Dutkowski * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -85,9 +85,6 @@ * bus_allocate_resources(...) and the resource handles are passed to all * individual clock callback handlers. * - * - * - * */ From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 18:54:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AD190106564A for ; Mon, 20 Aug 2012 18:54:19 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 18:54:19 +0000 Date: Mon, 20 Aug 2012 18:54:19 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820185419.AD190106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r240606 - in soc2012/tzabal: client-side/akcrs-head/usr.sbin/crashreport server-side/akcrs-handler server-side/akcrs-setup server-side/akcrs-website/akcrs server-side/akcrs-website/a... X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 18:54:21 -0000 Author: tzabal Date: Mon Aug 20 18:54:18 2012 New Revision: 240606 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240606 Log: Last commit for the GSoC period. Upload any remaining changes. Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh soc2012/tzabal/server-side/akcrs-handler/crashreport.py soc2012/tzabal/server-side/akcrs-handler/main.py soc2012/tzabal/server-side/akcrs-handler/settings.py soc2012/tzabal/server-side/akcrs-setup/database.sql soc2012/tzabal/server-side/akcrs-setup/setup soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py soc2012/tzabal/server-side/akcrs-website/akcrs/templates/bug.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/index.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/login.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/report.mako soc2012/tzabal/server-side/akcrs-website/akcrs/views.py Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Mon Aug 20 18:54:18 2012 (r240606) @@ -335,7 +335,7 @@ if [ -f "${tmp_dir}/ddb.txt" ]; then echo "" >> ${data} echo "" >> ${data} - echo "ddb capture buffer" >> ${data} + echo "ddbcapturebuffer" >> ${data} echo "" >> ${data} echo "" >> ${data} cat "${tmp_dir}/ddb.txt" >> ${data} @@ -346,7 +346,7 @@ if [ -f "${tmp_dir}/config.txt" ]; then echo "" >> ${data} echo "" >> ${data} - echo "kernel config" >> ${data} + echo "kernelconfig" >> ${data} echo "" >> ${data} echo "" >> ${data} cat "${tmp_dir}/config.txt" >> ${data} Modified: soc2012/tzabal/server-side/akcrs-handler/crashreport.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-handler/crashreport.py Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-handler/crashreport.py Mon Aug 20 18:54:18 2012 (r240606) @@ -88,7 +88,37 @@ self.name = None self.path = None self.info = {} - self.commands = {} + self.commands = {'crashtype': None, + 'crashdate': None, + 'hostname': None, + 'ostype': None, + 'osrelease': None, + 'version': None, + 'machine': None, + 'panic': None, + 'backtrace': None, + 'ps_axl': None, + 'vmstat_s': None, + 'vmstat_m': None, + 'vmstat_z': None, + 'vmstat_i': None, + 'pstat_T': None, + 'pstat_s': None, + 'iostat': None, + 'ipcs_a': None, + 'ipcs_T': None, + 'nfsstat': None, + 'netstat_s': None, + 'netstat_m': None, + 'netstat_id': None, + 'netstat_anr': None, + 'netstat_anA': None, + 'netstat_aL': None, + 'fstat': None, + 'dmesg': None, + 'kernelconfig': None, + 'ddbcapturebuffer': None + } def has_valid_name(self): Modified: soc2012/tzabal/server-side/akcrs-handler/main.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-handler/main.py Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-handler/main.py Mon Aug 20 18:54:18 2012 (r240606) @@ -36,7 +36,12 @@ sender = settings.SENDER receiver = report.data.info['email'] subject = settings.SUBJECT - text = settings.TEXT % (report.id, report.confirmation_code) + + if not report.user_password: + text = settings.TEXT01 % (report.id, report.confirmation_code) + else: + text = settings.TEXT02 % (report.id, report.confirmation_code, + report.user_password) message = MIMEText(text) message['From'] = sender @@ -45,6 +50,7 @@ try: smtpconn = smtplib.SMTP(smtpserver) + print smtpserver smtpconn.sendmail(sender, receiver, message.as_string()) except smtplib.SMTPException, err: logging.info(err) @@ -81,22 +87,27 @@ elif type(report.bug_id) == type([]): report.bug_id = -1 - # Submitters - db.query = 'SELECT id FROM submitters WHERE email = %s' + # Users + db.query = 'SELECT id FROM users WHERE email = %s' db.values = (report.data.info['email'], ) if not db.execute_query(): return if db.cursor.rowcount: - report.submitter_id = db.cursor.fetchone() + report.user_id = db.cursor.fetchone() + report.user_password = None # Part of Hack else: password = generate_random_string(8) hashobj = hashlib.sha256() hashobj.update(password) hashpass = hashobj.hexdigest() - db.query = ('INSERT INTO submitters (email, password) ' + # Hack: send the password of the new submitter along with the + # confirmation email instead of sending two emails + report.user_password = password + + db.query = ('INSERT INTO users (email, password) ' 'VALUES (%s, %s)' 'RETURNING id') db.values = (report.data.info['email'], hashpass) @@ -104,13 +115,13 @@ if not db.execute_query(): return - report.submitter_id = db.cursor.fetchone() + report.user_id = db.cursor.fetchone() db.save() # Reports report.confirmation_code = generate_random_string(16) - db.query = """INSERT INTO reports (bug_id, submitter_id, confirmation_code, + db.query = """INSERT INTO reports (bug_id, user_id, confirmation_code, crashtype, crashdate, hostname, ostype, osrelease, version, machine, panic, backtrace, top_significant_func, rem_significant_funcs, ps_axl, vmstat_s, vmstat_m, vmstat_z, vmstat_i, pstat_T, pstat_s, iostat, ipcs_a, ipcs_T, @@ -121,7 +132,7 @@ RETURNING id""" db.values = (report.bug_id, - report.submitter_id, + report.user_id, report.confirmation_code, report.data.commands['crashtype'], report.data.commands['crashdate'], @@ -159,7 +170,7 @@ if not db.execute_query(): return - report.id = db.cursor.fetchone() + report.id = db.cursor.fetchone()[0] db.save() return True @@ -249,7 +260,13 @@ def recognize_report(report): - # Calculate the significant functions of the report + # The algorithm needs from every report to provide a valid panic message + # and a backtrace. If one of them is not provided, the report is marked + # as invalid. + if not report.data.commands['panic'] or not report.data.commands['backtrace']: + return + + # Calculate the significant functions of the reports significant_funcs = get_significant_funcs(report.data.commands['backtrace']) report.top_significant_func = significant_funcs[0] report.rem_significant_funcs = significant_funcs[1:] @@ -316,6 +333,7 @@ # one logged bug. If it refers to more than one bugs, then this is an # indication that our algorithm is not accurate. report.bug_id = -1 + print len(passlimit) if len(passlimit): if passlimit.count(passlimit[0]) == len(passlimit): # Refers to a known bug @@ -468,7 +486,7 @@ for filename in dirlist: path = settings.CRASHREPORTS_DIR + '/' + filename report = crashreport.CrashReport(path) - + print report if not check_report(report): move_invalid_report(report.path) continue Modified: soc2012/tzabal/server-side/akcrs-handler/settings.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-handler/settings.py Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-handler/settings.py Mon Aug 20 18:54:18 2012 (r240606) @@ -37,8 +37,8 @@ # Confirmation email subject SUBJECT = 'Confirm your kernel crash report' -# Confirmation email text -TEXT = """\ +# Confirmation email text (for a registered user) +TEXT01 = """\ Hello, Please confirm your kernel crash report by clicking the following link: @@ -47,7 +47,24 @@ Once you confirm, your kernel crash report will be stored in our database as valid. -Thank your for your time. +Thank you for your time. +""" + +# Confirmation email text (for a new user) +TEXT02 = """\ +Hello, + +Please confirm your kernel crash report by clicking the following link: +http://akcrs.dyndns.org/confirm_report?id=%s&code=%s + +Once you confirm, your kernel crash report will be stored in our database as +valid. + +Finally, because this is the first time that you report a kernel crash to our +system, we have created for you an account with the following password: %s +Use your email address and the password to login into your account. + +Thank you for your time. """ # Panic message maximum percentage Modified: soc2012/tzabal/server-side/akcrs-setup/database.sql ============================================================================== --- soc2012/tzabal/server-side/akcrs-setup/database.sql Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-setup/database.sql Mon Aug 20 18:54:18 2012 (r240606) @@ -5,23 +5,28 @@ DROP TABLE reports; DROP TABLE bugs; -DROP TABLE submitters; +DROP TABLE users; +DROP TYPE bugstate; -CREATE TABLE submitters +CREATE TYPE bugstate AS ENUM ('NOSTATE', 'Open', 'Analyzed', 'Feedback', 'Closed', 'Suspended'); + + +CREATE TABLE users ( id serial NOT NULL, email varchar(254) NOT NULL, password char(64) NOT NULL, + is_developer boolean DEFAULT false, - CONSTRAINT submitters_pkey PRIMARY KEY (id) + CONSTRAINT users_pkey PRIMARY KEY (id) ); CREATE TABLE bugs ( id serial NOT NULL, - state varchar(10) NOT NULL, + state bugstate NOT NULL, reported integer NOT NULL, CONSTRAINT bugs_pkey PRIMARY KEY (id) @@ -32,8 +37,10 @@ ( id serial NOT NULL, bug_id integer NOT NULL, - submitter_id integer NOT NULL, - received_date date DEFAULT CURRENT_DATE, + user_id integer NOT NULL, + received_datetime timestamp DEFAULT CURRENT_TIMESTAMP, + --received_date date DEFAULT CURRENT_DATE, + --received_time time DEFAULT LOCALTIME, confirmation_code char(16) NOT NULL, confirmed boolean DEFAULT false, crashtype text, @@ -70,8 +77,8 @@ ddbcapturebuffer text, CONSTRAINT reports_pkey PRIMARY KEY (id), - CONSTRAINT reports_bug_id_fkey FOREIGN KEY (bug_id) REFERENCES Bugs (id), - CONSTRAINT reports_submitter_id_fkey FOREIGN KEY (submitter_id) REFERENCES Submitters (id) + CONSTRAINT reports_bug_id_fkey FOREIGN KEY (bug_id) REFERENCES bugs (id), + CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES users (id) ); -INSERT INTO bugs (id, state, reported) VALUES (-1, 'Unknown', -1); \ No newline at end of file +INSERT INTO bugs (id, state, reported) VALUES (-1, 'NOSTATE', -1); \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-setup/setup ============================================================================== --- soc2012/tzabal/server-side/akcrs-setup/setup Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-setup/setup Mon Aug 20 18:54:18 2012 (r240606) @@ -157,4 +157,11 @@ easy_install psycopg2 # Install the module lxml (Library for processing XML and HTML in Python) -easy_install lxml \ No newline at end of file +easy_install lxml + +# Install the pip installer +cd /usr/ports/devel/py-pip +make install clean + +# Install Django +pip install Django \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/__init__.py Mon Aug 20 18:54:18 2012 (r240606) @@ -25,10 +25,10 @@ config.add_route('change_password', '/change_password') config.add_route('reports', '/reports') config.add_route('report', '/reports/{id}') - config.add_route('edit_report', '/report/{id}/edit_report') - config.add_route('delete_report', '/report/{id}/delete_report') + config.add_route('evaluate_report', '/reports/{id}/evaluate') config.add_route('bugs', '/bugs') config.add_route('bug', '/bugs/{id}') + config.add_route('change_bugstate', '/bugs/{id}/change_state') # Scan config.scan() return config.make_wsgi_app() \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/bug.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/bug.mako Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/bug.mako Mon Aug 20 18:54:18 2012 (r240606) @@ -18,3 +18,19 @@ % endif

+ +% if is_developer: +

+ As a FreeBSD developer, you can change the state of the bug. Please choose below the new state.
+

+ + +
+

+% endif \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/index.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/index.mako Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/index.mako Mon Aug 20 18:54:18 2012 (r240606) @@ -10,7 +10,8 @@
  • One bug may be referred from more than one reports
  • -

    A crash report (or problem report or ticket etc) is an indication of a problem. -Because we deal with software, and specifically kernel crashes, we call them bugs. -Our goal is to fix the bugs. The reports are the information that we have for those bugs. +

    Generally, a problem report or an issue ticket is an indication of a problem. +The ultimate goal is to fix the problem. The problem report or the issue ticket contains the information that we have for the problem. Multiple problem reports or issue tickets may refer to one problem. That means that we have more information about it. +Because our domain is kernel crashes, we use the terms kernel crash report (or report for short) and kernel bug (or bug for short). We these things in mind, have a happy browsing :)

    +

    For more information about the Automated Kernel Crash Reporting System, please visit the wiki page of the project.

    Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/login.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/login.mako Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/login.mako Mon Aug 20 18:54:18 2012 (r240606) @@ -8,7 +8,7 @@

    Invalid credentials, try again.

    % endif -

    There is no registration. In order to log in into the system, you use the email address that you have provided in the crashreport program, and the password that has been sent to you via email.

    +

    There is no registration. In order to login into the system, you use the email address that you have provided in the crashreport program, and the password that has been sent to you via email.

    Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/report.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/report.mako Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/report.mako Mon Aug 20 18:54:18 2012 (r240606) @@ -55,136 +55,144 @@ dmesg Kernel config + DDB capture buffer

    Crash type
    -
    +
    Crash date
    -
    +
    Hostname
    -
    +
    Operating System
    -
    +
    Release
    -
    +
    Version
    -
    +
    Platform
    -
    +
    Panic Message
    -
    +
    Backtrace
    -
    +
    ps -axl
    -
    +
    vmstat -s
    -
    +
    vmstat -m
    -
    +
    vmstat -z
    -
    +
    vmstat -i
    -
    +
    pstat -t
    -
    +
    pstat -s
    -
    +
    iostat
    -
    +
    ipcs -a
    -
    +
    ipcs -t
    -
    +
    nfsstat
    -
    +
    netstat -s
    -
    +
    netstat -m
    -
    +
    netstat -id
    -
    +
    netstat -anr
    -
    +
    netstat -ana
    -
    +
    netstat -al
    -
    +
    fstat
    -
    +
    dmesg
    -
    +
    Kernel config
    -
    +
    +
    +
    + DDB capture buffer
    +
    % if is_developer:

    - As a developer you can perform the following actions: -

    -Do you think that this report refers correctly to the bug with ID ${report.bug_id}? -Yes -No + As a FreeBSD developer, you can view the email address of the submitter in order to contact him for any feedback.
    + The email address of the submitter that sent this report is ${user.email}. +

    + Also, if you think that this report refers correctly to the bug with ID ${report.bug_id}, click the checkbox below.
    + Otherwise, suggest in which bug this report should point to or suggest the creation of a new bug for this report. Please write the ID of the bug below or write "new". +

    + + It refers correctly to the existing bug

    + Bug ID or "new"

    +
    +
    % endif \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/views.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/views.py Mon Aug 20 17:50:20 2012 (r240605) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/views.py Mon Aug 20 18:54:18 2012 (r240606) @@ -116,17 +116,18 @@ id = request.matchdict['id'] query = DBSession.query(Report).filter(Report.confirmed == True, Report.id == id) report = query.one() - return {'report': report, 'logged_in': logged_in, 'is_developer': is_developer} - - -@view_config(route_name='edit_report', renderer='edit_report.mako') -def edit_report(request): - return {} + + # To have the email address of the submitter + query = DBSession.query(User).filter(User.id == report.user_id) + user = query.one() + + return {'report': report, 'user': user, 'logged_in': logged_in, 'is_developer': is_developer} -@view_config(route_name='delete_report', renderer='delete_report.mako') -def delete_report(request): - return {} +@view_config(route_name='evaluate_report', renderer='evaluate_report.mako') +def evaluate_report(request): + logged_in = authenticated_userid(request) + return {'logged_in': logged_in} @view_config(route_name='bugs', renderer='bugs.mako') @@ -139,6 +140,11 @@ @view_config(route_name='bug', renderer='bug.mako') def bug(request): logged_in = authenticated_userid(request) + is_developer = None + if logged_in: + user = DBSession.query(User).filter(User.email == logged_in).one() + is_developer = user.is_developer + id = request.matchdict['id'] # All the data related to the requested bug @@ -151,4 +157,30 @@ # The reports that refer to the requested bug query = DBSession.query(Report).filter(Report.bug_id == id, Report.confirmed == True) reports = query.all() - return {'bug': bug, 'reports': reports, 'logged_in': logged_in} + return {'bug': bug, 'reports': reports, 'logged_in': logged_in, 'is_developer': is_developer} + + +@view_config(route_name='change_bugstate', renderer='change_bugstate.mako') +def change_bugstate(request): + logged_in = authenticated_userid(request) + failed_attempt = True + id = request.matchdict['id'] + + is_developer = None + if logged_in: + user = DBSession.query(User).filter(User.email == logged_in).one() + is_developer = user.is_developer + else: + # change it to HTTPForbidden + HTTPFound(location=request.route_url('index')) + + if request.method == 'POST': + newstate = request.POST.get('bugstate') + if newstate: + query = DBSession.query(Bug).filter(Bug.reported > 0, Bug.id == id) + bug = query.one() + bug.state = newstate + DBSession.flush() + failed_attempt = False + + return {'failed_attempt': failed_attempt, 'is_developer': is_developer, 'logged_in': logged_in} \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Mon Aug 20 19:00:30 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 78D87106567E for ; Mon, 20 Aug 2012 19:00:29 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 20 Aug 2012 19:00:29 +0000 Date: Mon, 20 Aug 2012 19:00:29 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120820190029.78D87106567E@hub.freebsd.org> Cc: Subject: socsvn commit: r240614 - soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 19:00:30 -0000 Author: aleek Date: Mon Aug 20 19:00:29 2012 New Revision: 240614 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240614 Log: This my final GSoC 2012 project - Porting FreeBSD/arm on BeagleBoard-xM commit Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c Mon Aug 20 18:32:46 2012 (r240613) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/beagleboard/beagleboard.c Mon Aug 20 19:00:29 2012 (r240614) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2012 - * Aleksander Dutkowski . + * Aleksander Dutkowski . * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-soc-all@FreeBSD.ORG Wed Aug 22 21:46:24 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1C0EC106567B for ; Wed, 22 Aug 2012 21:46:22 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 22 Aug 2012 21:46:22 +0000 Date: Wed, 22 Aug 2012 21:46:22 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120822214622.1C0EC106567B@hub.freebsd.org> Cc: Subject: socsvn commit: r240747 - in soc2012/tzabal/server-side: akcrs-handler akcrs-setup akcrs-website akcrs-website/akcrs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2012 21:46:24 -0000 Author: tzabal Date: Wed Aug 22 21:46:20 2012 New Revision: 240747 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240747 Log: Fix bug related with the recognize phase. Modified: soc2012/tzabal/server-side/akcrs-handler/confirm_report.wsgi soc2012/tzabal/server-side/akcrs-handler/main.py soc2012/tzabal/server-side/akcrs-setup/database.sql soc2012/tzabal/server-side/akcrs-setup/setup soc2012/tzabal/server-side/akcrs-website/akcrs/models.py soc2012/tzabal/server-side/akcrs-website/setup.py Modified: soc2012/tzabal/server-side/akcrs-handler/confirm_report.wsgi ============================================================================== --- soc2012/tzabal/server-side/akcrs-handler/confirm_report.wsgi Wed Aug 22 20:56:53 2012 (r240746) +++ soc2012/tzabal/server-side/akcrs-handler/confirm_report.wsgi Wed Aug 22 21:46:20 2012 (r240747) @@ -19,7 +19,7 @@ report_id = parameters['id'][0] code = parameters['code'][0] - db.query = ('SELECT 1' + db.query = ('SELECT bug_id ' 'FROM reports ' 'WHERE id = %s AND confirmation_code = %s AND ' 'confirmed = %s') @@ -29,8 +29,16 @@ response_body = 'Could not execute the query.' if db.cursor.rowcount == 1: - db.query = 'UPDATE Reports SET confirmed = %s WHERE id = %s' - db.values = (True, id) + bug_id = db.cursor.fetchone() + + db.query = 'UPDATE reports SET confirmed = %s WHERE id = %s' + db.values = (True, report_id) + + if not db.execute_query(): + response_body = 'Could not execute the query.' + + db.query = 'UPDATE bugs SET reported = reported + 1 WHERE id = %s' + db.values = (bug_id, ) if not db.execute_query(): response_body = 'Could not execute the query.' Modified: soc2012/tzabal/server-side/akcrs-handler/main.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-handler/main.py Wed Aug 22 20:56:53 2012 (r240746) +++ soc2012/tzabal/server-side/akcrs-handler/main.py Wed Aug 22 21:46:20 2012 (r240747) @@ -20,15 +20,19 @@ db = database.Database() -def move_invalid_report(path): - if not os.path.isfile(path): +def move_invalid_report(report): + if not os.path.isfile(report.path): return if not os.path.isdir(settings.INVALID_REPORTS_DIR): logging.error('Invalid reports directory does not exist') return - shutil.move(path, settings.INVALID_REPORTS_DIR) + # If file with same name exists, remove it in order to avoid shutil.Error + if os.path.exists(settings.INVALID_REPORTS_DIR + '/' + report.name): + os.remove(settings.INVALID_REPORTS_DIR + '/' + report.name) + + shutil.move(report.path, settings.INVALID_REPORTS_DIR) def send_confirmation_email(report): @@ -50,7 +54,6 @@ try: smtpconn = smtplib.SMTP(smtpserver) - print smtpserver smtpconn.sendmail(sender, receiver, message.as_string()) except smtplib.SMTPException, err: logging.info(err) @@ -73,6 +76,7 @@ def store_report(report): # Bugs + report.bugs_id = None if report.bug_id == -1: db.query = ('INSERT INTO bugs (state, reported) ' 'VALUES (%s, %s) ' @@ -85,7 +89,8 @@ report.bug_id = db.cursor.fetchone() db.save() elif type(report.bug_id) == type([]): - report.bug_id = -1 + report.bugs_id = report.bug_id + report.bug_id = None # Users db.query = 'SELECT id FROM users WHERE email = %s' @@ -122,18 +127,19 @@ report.confirmation_code = generate_random_string(16) db.query = """INSERT INTO reports (bug_id, user_id, confirmation_code, - crashtype, crashdate, hostname, ostype, osrelease, version, machine, panic, - backtrace, top_significant_func, rem_significant_funcs, ps_axl, vmstat_s, - vmstat_m, vmstat_z, vmstat_i, pstat_T, pstat_s, iostat, ipcs_a, ipcs_T, - nfsstat, netstat_s, netstat_m, netstat_id, netstat_anr, netstat_anA, - netstat_aL, fstat, dmesg, kernelconfig, ddbcapturebuffer) + bugs_id, crashtype, crashdate, hostname, ostype, osrelease, version, + machine, panic, backtrace, top_significant_func, rem_significant_funcs, + ps_axl, vmstat_s, vmstat_m, vmstat_z, vmstat_i, pstat_T, pstat_s, iostat, + ipcs_a, ipcs_T, nfsstat, netstat_s, netstat_m, netstat_id, netstat_anr, + netstat_anA, netstat_aL, fstat, dmesg, kernelconfig, ddbcapturebuffer) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) + %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING id""" db.values = (report.bug_id, report.user_id, report.confirmation_code, + report.bugs_id, report.data.commands['crashtype'], report.data.commands['crashdate'], report.data.commands['hostname'], @@ -206,8 +212,9 @@ aux = 1 else: aux = 2 - # If odd, then the average value to the middle element + # If odd, then the average value to the middle element (starting from 1) values[elems_per_set + 1] = avg + #values[elems_per_set] = avg # How the values will be allocated diff = 1 @@ -268,13 +275,18 @@ # Calculate the significant functions of the reports significant_funcs = get_significant_funcs(report.data.commands['backtrace']) - report.top_significant_func = significant_funcs[0] - report.rem_significant_funcs = significant_funcs[1:] - + if len(significant_funcs) > 1: + report.top_significant_func = significant_funcs[0] + report.rem_significant_funcs = significant_funcs[1:] + elif len(significant_funcs) == 1: + report.top_significant_func = significant_funcs[0] + report.rem_significant_funcs = [] + else: + report.top_significant_func = report.rem_significant_funcs = [] + # Retrieve from the database the confirmed reports - db.query = ('SELECT bug_id, panic, top_significant_func, rem_significant_funcs ' - 'FROM Reports ' - 'WHERE confirmed = true') + db.query = ('SELECT bug_id, panic, top_significant_func, ' + 'rem_significant_funcs FROM Reports') if not db.execute_query(): return loggedreports = db.cursor.fetchall() @@ -310,8 +322,10 @@ # percentages for the remaining significant function names. # Compare X function names, where X is the length of the report with # the fewest remaining significant function names - length = min(len(significant_funcs), len(loggedreport[3])) - rem_sig_max_percs = allocate_values(length - 1) + # sigkrisi tou full sign funcs me tou rem sign funcs twn logged! (fixed) + length = min(len(report.rem_significant_funcs), len(loggedreport[3])) + #rem_sig_max_percs = allocate_values(length - 1) + rem_sig_max_percs = allocate_values(length) # Then, calculate the percentage of similarity between every remaining # significant function name based on the previous calculated percentages @@ -322,18 +336,17 @@ ).ratio() sims[index][1] += rem_sig_max_percs[i] * ratio - # Find with which reports the examined report is similar based on the value + # Find with which bugs the examined report is similar based on the value # of the limit percentage passlimit = [] for sim in sims: if sim[1] >= settings.LIMIT_PERC: passlimit.append(sim[0]) - # Finally, check if the examined report concluded to refer to none or only - # one logged bug. If it refers to more than one bugs, then this is an - # indication that our algorithm is not accurate. - report.bug_id = -1 - print len(passlimit) + # Finally, check if the examined report concluded to refer to none, only + # one, or more logged bugs. If it refers to more than one bugs, then this is + # an indication that our algorithm is not accurate. + report.bug_id = -1 # new bug if len(passlimit): if passlimit.count(passlimit[0]) == len(passlimit): # Refers to a known bug @@ -488,23 +501,23 @@ report = crashreport.CrashReport(path) print report if not check_report(report): - move_invalid_report(report.path) + move_invalid_report(report) continue if not parse_crashdata(report): - move_invalid_report(report.path) + move_invalid_report(report) continue if not recognize_report(report): - move_invalid_report(report.path) + move_invalid_report(report) continue if not store_report(report): - move_invalid_report(report.path) + move_invalid_report(report) continue if not send_confirmation_email(report): - move_invalid_report(report.path) + move_invalid_report(report) continue discard_report(report.path) Modified: soc2012/tzabal/server-side/akcrs-setup/database.sql ============================================================================== --- soc2012/tzabal/server-side/akcrs-setup/database.sql Wed Aug 22 20:56:53 2012 (r240746) +++ soc2012/tzabal/server-side/akcrs-setup/database.sql Wed Aug 22 21:46:20 2012 (r240747) @@ -9,7 +9,7 @@ DROP TYPE bugstate; -CREATE TYPE bugstate AS ENUM ('NOSTATE', 'Open', 'Analyzed', 'Feedback', 'Closed', 'Suspended'); +CREATE TYPE bugstate AS ENUM ('Open', 'Analyzed', 'Feedback', 'Closed', 'Suspended'); CREATE TABLE users @@ -36,13 +36,14 @@ CREATE TABLE reports ( id serial NOT NULL, - bug_id integer NOT NULL, + bug_id integer, user_id integer NOT NULL, received_datetime timestamp DEFAULT CURRENT_TIMESTAMP, --received_date date DEFAULT CURRENT_DATE, --received_time time DEFAULT LOCALTIME, confirmation_code char(16) NOT NULL, confirmed boolean DEFAULT false, + bugs_id integer[], crashtype text, crashdate text, hostname text, @@ -79,6 +80,4 @@ CONSTRAINT reports_pkey PRIMARY KEY (id), CONSTRAINT reports_bug_id_fkey FOREIGN KEY (bug_id) REFERENCES bugs (id), CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES users (id) -); - -INSERT INTO bugs (id, state, reported) VALUES (-1, 'NOSTATE', -1); \ No newline at end of file +); \ No newline at end of file Modified: soc2012/tzabal/server-side/akcrs-setup/setup ============================================================================== --- soc2012/tzabal/server-side/akcrs-setup/setup Wed Aug 22 20:56:53 2012 (r240746) +++ soc2012/tzabal/server-side/akcrs-setup/setup Wed Aug 22 21:46:20 2012 (r240747) @@ -76,7 +76,7 @@ make config # Build, install and clean -make install clean +make -DBATCH install clean # Launch Apache at system startup echo 'apache22_enable="YES"' >> /etc/rc.conf Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/models.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/models.py Wed Aug 22 20:56:53 2012 (r240746) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/models.py Wed Aug 22 21:46:20 2012 (r240747) @@ -47,11 +47,12 @@ __tablename__ = 'reports' id = Column(Integer, Sequence('reports_id_seq'), primary_key=True) - bug_id = Column(Integer, ForeignKey('bugs.id'), nullable=False) + bug_id = Column(Integer, ForeignKey('bugs.id')) user_id = Column(Integer, ForeignKey('users.id'), nullable=False) received_datetime = Column(TIMESTAMP, default=datetime.datetime.now) confirmation_code = Column(CHAR(length=16), nullable=False) confirmed = Column(Boolean, default='false') + bugs_id = Column(ARRAY(Integer)) crashtype = Column(Text) crashdate = Column(Text) hostname = Column(Text) Modified: soc2012/tzabal/server-side/akcrs-website/setup.py ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/setup.py Wed Aug 22 20:56:53 2012 (r240746) +++ soc2012/tzabal/server-side/akcrs-website/setup.py Wed Aug 22 21:46:20 2012 (r240747) @@ -14,8 +14,6 @@ 'pyramid_debugtoolbar', 'zope.sqlalchemy', 'waitress', - # tutorial added dependency. maybe remove (docutils) - 'docutils', ] setup(name='akcrs', From owner-svn-soc-all@FreeBSD.ORG Thu Aug 23 22:07:30 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 4E28C106566C for ; Thu, 23 Aug 2012 22:07:29 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 23 Aug 2012 22:07:29 +0000 Date: Thu, 23 Aug 2012 22:07:29 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120823220729.4E28C106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r240779 - soc2012/tzabal/server-side/akcrs-website/akcrs/static/default X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 22:07:30 -0000 Author: tzabal Date: Thu Aug 23 22:07:29 2012 New Revision: 240779 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240779 Log: Deleting the files of the static directory created by default from Pyramid. Deleted: soc2012/tzabal/server-side/akcrs-website/akcrs/static/default/ From owner-svn-soc-all@FreeBSD.ORG Thu Aug 23 22:10:28 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8AE2C1065741 for ; Thu, 23 Aug 2012 22:10:27 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 23 Aug 2012 22:10:27 +0000 Date: Thu, 23 Aug 2012 22:10:27 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120823221027.8AE2C1065741@hub.freebsd.org> Cc: Subject: socsvn commit: r240780 - soc2012/tzabal/server-side/akcrs-website/akcrs/static X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 22:10:28 -0000 Author: tzabal Date: Thu Aug 23 22:10:27 2012 New Revision: 240780 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240780 Log: Deleting the files of the static directory created by default from Pyramid. Deleted: soc2012/tzabal/server-side/akcrs-website/akcrs/static/favicon.ico soc2012/tzabal/server-side/akcrs-website/akcrs/static/footerbg.png soc2012/tzabal/server-side/akcrs-website/akcrs/static/headerbg.png soc2012/tzabal/server-side/akcrs-website/akcrs/static/ie6.css soc2012/tzabal/server-side/akcrs-website/akcrs/static/middlebg.png soc2012/tzabal/server-side/akcrs-website/akcrs/static/pylons.css soc2012/tzabal/server-side/akcrs-website/akcrs/static/pyramid-small.png soc2012/tzabal/server-side/akcrs-website/akcrs/static/pyramid.png soc2012/tzabal/server-side/akcrs-website/akcrs/static/transparent.gif From owner-svn-soc-all@FreeBSD.ORG Thu Aug 23 22:21:30 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3CC5E1065670 for ; Thu, 23 Aug 2012 22:21:29 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 23 Aug 2012 22:21:29 +0000 Date: Thu, 23 Aug 2012 22:21:29 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120823222129.3CC5E1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r240781 - soc2012/tzabal/server-side/akcrs-website/akcrs/templates X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 22:21:30 -0000 Author: tzabal Date: Thu Aug 23 22:21:28 2012 New Revision: 240781 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240781 Log: Deleting the files of the static directory created by default from Pyramid. Deleted: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/checkforuser.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/delete_report.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/edit_report.mako From owner-svn-soc-all@FreeBSD.ORG Thu Aug 23 22:26:08 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A4B1A1065676 for ; Thu, 23 Aug 2012 22:26:06 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 23 Aug 2012 22:26:06 +0000 Date: Thu, 23 Aug 2012 22:26:06 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120823222606.A4B1A1065676@hub.freebsd.org> Cc: Subject: socsvn commit: r240782 - in soc2012/tzabal/server-side/akcrs-website: . akcrs/templates X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 22:26:08 -0000 Author: tzabal Date: Thu Aug 23 22:26:06 2012 New Revision: 240782 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240782 Log: Add the mako templates: change_bugstate.mako, check_for_user.mako and evaluate_report.mako. Added: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/change_bugstate.mako soc2012/tzabal/server-side/akcrs-website/akcrs/templates/check_for_user.mako Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako soc2012/tzabal/server-side/akcrs-website/setup.py Modified: soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako ============================================================================== --- soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako Thu Aug 23 22:21:28 2012 (r240781) +++ soc2012/tzabal/server-side/akcrs-website/akcrs/templates/base.mako Thu Aug 23 22:26:06 2012 (r240782) @@ -12,7 +12,7 @@

    <%block name="headerleft"/>

    - <%include file="checkforuser.mako"/> + <%include file="check_for_user.mako"/>
    +
    + Hostname
    +
    +
    +
    + Operating System
    +
    +
    +
    + Release
    +
    +
    +
    + Version
    +
    +
    +
    + Platform
    +
    +
    +
    + Panic Message
    +
    +
    +
    + Backtrace
    +
    +
    +
    + ps -axl
    +
    +
    +
    + vmstat -s
    +
    +
    +
    + vmstat -m
    +
    +
    +
    + vmstat -z
    +
    +
    +
    + vmstat -i
    +
    +
    +
    + pstat -t
    +
    +
    +
    + pstat -s
    +
    +
    +
    + iostat
    +
    +
    +
    + ipcs -a
    +
    +
    +
    + ipcs -t
    +
    +
    +
    + nfsstat
    +
    +
    +
    + netstat -s
    +
    +
    +
    + netstat -m
    +
    +
    +
    + netstat -id
    +
    +
    +
    + netstat -anr
    +
    +
    +
    + netstat -ana
    +
    +
    +
    + netstat -al
    +
    +
    +
    + fstat
    +
    +
    +
    + dmesg
    +
    +
    +
    + Kernel config
    +
    +
    +
    + DDB capture buffer
    +
    +
    + +% if is_developer: +

    + As a FreeBSD developer, you can view the email address of the submitter in order to contact him for any feedback.
    + The email address of the submitter that sent this report is ${user.email}. +

    +

    + Also, if you think that this report refers correctly to the bug with ID ${report.bug_id}, click the checkbox below.
    + Otherwise, suggest in which bug this report should point to or suggest the creation of a new bug for this report. Please write the ID of the bug below or write "new". +

    +
    + It refers correctly to the existing bug

    + Bug ID or "new"

    +
    +
    +% endif \ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-website/akcrswebsite/templates/reports.mako ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrswebsite/templates/reports.mako Sat Aug 25 19:55:46 2012 (r240850) @@ -0,0 +1,29 @@ +<%inherit file="base.mako"/> + +<%block name="headerleft"> +Kernel Crash Reports + + +

    A list that contains all the crash reports that we have collected.

    + + + + + + + + + + + + % for report in reports: + + + + + + + + % endfor + +
    ReceivedReleasePlatformDetailsRefers to
    ${str(report.received_datetime)[:10]}${report.osrelease}${report.machine}ReportBug
    Added: soc2012/tzabal/server-side/akcrs-website/akcrswebsite/views.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/akcrswebsite/views.py Sat Aug 25 19:55:46 2012 (r240850) @@ -0,0 +1,186 @@ +import hashlib + +from pyramid.httpexceptions import HTTPForbidden +from pyramid.httpexceptions import HTTPFound +from pyramid.httpexceptions import HTTPNotFound +from pyramid.security import authenticated_userid +from pyramid.security import forget +from pyramid.security import remember +from pyramid.view import view_config +from sqlalchemy.exc import DBAPIError + +from .models import DBSession, User, Bug, Report + + +@view_config(route_name='index', renderer='index.mako') +def index(request): + logged_in = authenticated_userid(request) + return {'logged_in': logged_in} + + +@view_config(route_name='login', renderer='login.mako') +def login(request): + logged_in = authenticated_userid(request) + if logged_in: + goto = request.route_url('index') + return HTTPFound(location=goto) + + if request.method == 'POST': + email = request.POST.get('email') + password = request.POST.get('password') + + if email and password: + query = DBSession.query(User).filter(User.email == email) + try: + user = query.one() + except: + pass # either no such email in db or more than 2 times in db! + else: + hashobj = hashlib.sha256() + hashobj.update(password) + hashpass = hashobj.hexdigest() + if hashpass == user.password: + goto = request.route_url('index') + headers = remember(request, email) + return HTTPFound(location=goto, headers=headers) + + return {'failed_attempt': True} + + return {'failed_attempt': False, 'logged_in': logged_in} + + +@view_config(route_name='logout') +def logout(request): + logged_in = authenticated_userid(request) + goto = request.route_url('index') + if not logged_in: + return HTTPFound(location=goto) + headers = forget(request) + return HTTPFound(location=goto, headers=headers) + + +@view_config(route_name='account', renderer='account.mako') +def account(request): + logged_in = authenticated_userid(request) + return {'logged_in': logged_in} + +@view_config(route_name='change_password', renderer='change_password.mako') +def change_password(request): + logged_in = authenticated_userid(request) + goto = request.route_url('index') + if not logged_in: + # change it to HTTPForbidden + return HTTPFound(location=goto) + + result = False + if request.method == 'POST': + curr = request.POST.get('current_password') + new1 = request.POST.get('new_password_1') + new2 = request.POST.get('new_password_2') + + if curr and new1 and new2: + if new1 == new2: + query = DBSession.query(User).filter(User.email == logged_in) + try: + user = query.one() + except: + pass # either no such email in db or more than 2 times in db! + else: + hashcurr = hashlib.sha256() + hashcurr.update(curr) + if user.password == hashcurr.hexdigest(): + hashnew = hashlib.sha256() + hashnew.update(new1) + user.password = hashnew.hexdigest() + DBSession.flush() + result = True + + return {'result': result, 'logged_in': logged_in} + + +@view_config(route_name='reports', renderer='reports.mako') +def reports(request): + logged_in = authenticated_userid(request) + reports = DBSession.query(Report).filter(Report.confirmed == True).all() + return {'reports': reports, 'logged_in': logged_in} + + +@view_config(route_name='report', renderer='report.mako') +def report(request): + logged_in = authenticated_userid(request) + is_developer = None + if logged_in: + user = DBSession.query(User).filter(User.email == logged_in).one() + is_developer = user.is_developer + + id = request.matchdict['id'] + query = DBSession.query(Report).filter(Report.confirmed == True, Report.id == id) + report = query.one() + + # To have the email address of the submitter + query = DBSession.query(User).filter(User.id == report.user_id) + user = query.one() + + return {'report': report, 'user': user, 'logged_in': logged_in, 'is_developer': is_developer} + + +@view_config(route_name='evaluate_report', renderer='evaluate_report.mako') +def evaluate_report(request): + logged_in = authenticated_userid(request) + return {'logged_in': logged_in} + + +@view_config(route_name='bugs', renderer='bugs.mako') +def bugs(request): + logged_in = authenticated_userid(request) + bugs = DBSession.query(Bug).filter(Bug.reported > 0).all() + return {'bugs': bugs, 'logged_in': logged_in} + + +@view_config(route_name='bug', renderer='bug.mako') +def bug(request): + logged_in = authenticated_userid(request) + is_developer = None + if logged_in: + user = DBSession.query(User).filter(User.email == logged_in).one() + is_developer = user.is_developer + + id = request.matchdict['id'] + + # All the data related to the requested bug + # A bug is considered valid when it is reported from at least one report + # A bug can have reported equals to zero if the report that refers to it + # is unconfirmed. + query = DBSession.query(Bug).filter(Bug.reported > 0, Bug.id == id) + bug = query.one() + + # The reports that refer to the requested bug + query = DBSession.query(Report).filter(Report.bug_id == id, Report.confirmed == True) + reports = query.all() + return {'bug': bug, 'reports': reports, 'logged_in': logged_in, 'is_developer': is_developer} + + +@view_config(route_name='change_bugstate', renderer='change_bugstate.mako') +def change_bugstate(request): + logged_in = authenticated_userid(request) + failed_attempt = True + id = request.matchdict['id'] + + is_developer = None + if logged_in: + user = DBSession.query(User).filter(User.email == logged_in).one() + is_developer = user.is_developer + else: + # change it to HTTPForbidden + HTTPFound(location=request.route_url('index')) + + if request.method == 'POST': + newstate = request.POST.get('bugstate') + if newstate: + query = DBSession.query(Bug).filter(Bug.reported > 0, Bug.id == id) + bug = query.one() + bug.state = newstate + DBSession.flush() + failed_attempt = False + + return {'failed_attempt': failed_attempt, 'is_developer': is_developer, 'logged_in': logged_in} \ No newline at end of file Added: soc2012/tzabal/server-side/akcrs-website/development.ini ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-website/development.ini Sat Aug 25 19:55:46 2012 (r240850) @@ -0,0 +1,58 @@ +[app:main] +use = egg:akcrs-website + +pyramid.reload_templates = true +pyramid.debug_authorization = false +pyramid.debug_notfound = false +pyramid.debug_routematch = false +pyramid.default_locale_name = en +pyramid.includes = + pyramid_debugtoolbar + pyramid_tm + +sqlalchemy.url = postgresql+psycopg2://username:password@host/database +mako.directories = akcrswebsite:templates + +[server:main] +use = egg:waitress#main +host = 0.0.0.0 +port = 6543 + +# Begin logging configuration + +[loggers] +keys = root, akcrswebsite, sqlalchemy + +[handlers] +keys = console + +[formatters] +keys = generic + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***