From owner-svn-soc-all@FreeBSD.ORG Sun Jun 3 05:02: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 4B07F1065670 for ; Sun, 3 Jun 2012 05:02:05 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 03 Jun 2012 05:02:05 +0000 Date: Sun, 03 Jun 2012 05:02:05 +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: <20120603050205.4B07F1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236984 - soc2012/jhagewood/mdocml 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, 03 Jun 2012 05:02:07 -0000 Author: jhagewood Date: Sun Jun 3 05:02:04 2012 New Revision: 236984 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236984 Log: Added: soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt Added: soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt Sun Jun 3 05:02:04 2012 (r236984) @@ -0,0 +1,16 @@ +/usr/src/contrib/ipfilter/ipsend/ipsend.1:66:2: FATAL: line scope broken, syntax violated +/usr/src/contrib/opie/opiekey.1:120:2: FATAL: line scope broken, syntax violated +/usr/src/contrib/opie/opiepasswd.1:57:2: FATAL: line scope broken, syntax violated +/usr/src/contrib/one-true-awk/awk.1:473:2: FATAL: line scope broken, syntax violated +/usr/src/bin/ps/ps.1:309:2: FATAL: argument count wrong, violates syntax: columns == 2 (have 4) +/usr/src/lib/libc/posix1e/acl_to_text.3:71:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +/usr/src/lib/libc/posix1e/acl_add_perm.3:62:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +/usr/src/lib/libc/posix1e/acl_set_entry_type_np.3:53:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +/usr/src/lib/libc/posix1e/acl_add_flag_np.3:55:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +/usr/src/lib/libc/posix1e/acl_set_tag_type.3:53:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +/usr/src/contrib/ipfilter/man/ipmon.5:44:2: FATAL: line scope broken, syntax violated +/usr/src/contrib/ipfilter/man/ippool.5:61:2: FATAL: line scope broken, syntax violated +/usr/src/lib/libutil/login.conf.5:227:2: FATAL: argument count wrong, violates syntax: columns == 3 (have 5) +/usr/src/usr.bin/rctl/rctl.8:125:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +/usr/src/tools/regression/usr.bin/sed/regress.multitest.out/4.8:1:1: FATAL: not a manual +/usr/src/tools/regression/usr.bin/sed/regress.multitest.out/2.8:1:1: FATAL: not a manual From owner-svn-soc-all@FreeBSD.ORG Sun Jun 3 05:02:34 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 6667C1065686 for ; Sun, 3 Jun 2012 05:02:33 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 03 Jun 2012 05:02:33 +0000 Date: Sun, 03 Jun 2012 05:02:33 +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: <20120603050233.6667C1065686@hub.freebsd.org> Cc: Subject: socsvn commit: r236985 - soc2012/jhagewood/mdocml/tests 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, 03 Jun 2012 05:02:34 -0000 Author: jhagewood Date: Sun Jun 3 05:02:32 2012 New Revision: 236985 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236985 Log: Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh ============================================================================== --- soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Sun Jun 3 05:02:04 2012 (r236984) +++ soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Sun Jun 3 05:02:32 2012 (r236985) @@ -6,10 +6,13 @@ mkdir $HOME/Documents/man_pages cd $HOME/Documents/man_pages/ -mkdir ./output/ find /usr/src/ \( -name "*.1" \) -type f >> ./manpaths.txt +find /usr/src/ \( -name "*.2" \) -type f >> ./manpaths.txt +find /usr/src/ \( -name "*.3" \) -type f >> ./manpaths.txt +find /usr/src/ \( -name "*.4" \) -type f >> ./manpaths.txt find /usr/src/ \( -name "*.5" \) -type f >> ./manpaths.txt find /usr/src/ \( -name "*.6" \) -type f >> ./manpaths.txt +find /usr/src/ \( -name "*.7" \) -type f >> ./manpaths.txt find /usr/src/ \( -name "*.8" \) -type f >> ./manpaths.txt find /usr/src/ \( -name "*.man" \) -type f >> ./manpaths.txt echo "EOL" >> ./manpaths.txt @@ -21,7 +24,7 @@ do current_doc=$(tail -n $num_lines ./manpaths.txt) sed -n '2,$p' ./manpaths.txt > ./manpaths.txt - mandoc -Tutf8 -Ostyle=style.css $current_doc > ./output/$numlines.txt + mandoc -Tpdf -Ostyle=style.css $current_doc 2> ./mdocml-manpage-errors.txt >> ./out.pdf num_lines=$(cat ./manpaths.txt | grep -c .) done From owner-svn-soc-all@FreeBSD.ORG Sun Jun 3 15:35:57 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 4E89D106564A for ; Sun, 3 Jun 2012 15:35:55 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 03 Jun 2012 15:35:55 +0000 Date: Sun, 03 Jun 2012 15:35:55 +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: <20120603153555.4E89D106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237004 - in soc2012/tzabal/client-side/akcrs-head/usr.sbin: crashinfo 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: Sun, 03 Jun 2012 15:35:57 -0000 Author: tzabal Date: Sun Jun 3 15:35:54 2012 New Revision: 237004 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237004 Log: Add the code that implements the method for sending the report to the Central Collector machine. Method used: SSH (OpenSSH) with public-key authentication. Trivial change to /usr.sbin/crashinfo - follow the '3 echos, command, echo' scheme in the code that prints the capture buffer of ddb. Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh Sun Jun 3 14:54:50 2012 (r237003) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh Sun Jun 3 15:35:54 2012 (r237004) @@ -307,10 +307,9 @@ echo "kernel config" echo config -x $KERNEL - echo + echo "------------------------------------------------------------------------" echo "ddb capture buffer" echo - ddb capture -M $VMCORE -N $KERNEL print Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sun Jun 3 14:54:50 2012 (r237003) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sun Jun 3 15:35:54 2012 (r237004) @@ -17,7 +17,7 @@ error() { - echo "${PROG}: ERROR: $*" 1>&2 + echo "${PROG}: Error: $*" 1>&2 } @@ -123,24 +123,68 @@ echo ${_email} | egrep '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$' \ > /dev/null -if [ "$?" -ne "0" ]; then +if [ "$?" != "0" ]; then error "Email address ${_email} is invalid." exit 7 fi ## Bundle the report -report="report.tar" +report="report.tar.gz" email_file=`mktemp /tmp/crashreport.XXXXXX` - echo "${_email}" > ${email_file} -tar -c -f ${report} ${_dumpdir}/${_file} ${email_file} + +tar -czf ${report} -C ${_dumpdir} ${_file} -C `dirname ${email_file}` \ + `basename ${email_file}` + +if [ "$?" != "0" ]; then + error 'An error occurred when bundling the report.' + exit 8 +fi ## Send the report to the Central Collector machine user="reporter" hostname="akcrs.dyndns.org" -scp -q ${report} ${user}@${hostname}: + +# Host public key +host_public_key_file=`mktemp /tmp/crashreport.XXXXXX` +echo "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIb\ +mlzdHAyNTYAAABBBIhASIzluEhQKC/R3aVYpdV7IU14XCDKnXp8c1/Bc2m6ri7S\ +aW0sJxihnGjgm4n3XFa+s5FpjHbN4snK4NAuDEY=" > ${host_public_key_file} + +# User private key +user_private_key_file=`mktemp /tmp/crashreport.XXXXXX` +echo "-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAxpufuG9WyYDhq/96/EmIrLd+ent/nZns7eHA41zeiSObGgTO +Rml6w6aXSWglUzv3RHDilXYWcUpZ61ke5bf+coVARmfqp5qhpwxvoGr2//jD4R0x +PLCY1U2bZKxEJhhresWQIhhF9TZ6zYRpkm3to9PpsqTfR812gDcKjBAZ3+RGGBhR +7q/LNiXVasMyIplSobcZvC+5klh4J/N2u4teC9BruxVTBScyqsayJg1V4g4OmzZY +VY0tHKOivn55X2tb5a9mKpKWxJY6OYo0r/3bqqfFC+b58hYSy51HR3mCpJBQJGgH +a2uab/TEJ3i/A4Hnfv6iRDqhdxXfgPc3WetVrwIDAQABAoIBAFpXYfDwXGbuhDjL +zrLB9DS0hwjJ8oPLB7YxcZ86mFODacMNGpN22Yvz1G9ku03AQjrUqozYGV9RNdPT +RzWxW0HWkSU1kczJjuzAwGoVHePT0a4trD7yCaNFWQETRzCY/RLsmSKZLgFb1cJ0 +j902udlCxNQpIRO1R0kNQHPzwwFPNGUCbAjMgVzuCK0sf1705fMXaI87oYiPZWXS +80UJEUjS/oSqcMQyRZIAZhKysbGikXpujc91YZHJ3rIgyswPxsoHdZVPT1F0W/ip +H7F+lOI+ipwcl4J2ZOYSTFu7GXeQbx2kqPiN1oMLa4hPdEDi14B3lBM8qrljsIKE +1ZPSszECgYEA8S+H5sCJXX1fAhWBPtE7FpRNiwJ7HuG2bjC/pUXfRl/U2F1+UVUt +x10hbsfdtAays25i3L+1SJiyNHDzzN/aN08V6vXULSeYhJiAMFwnoFYM6KtdrU+E +06jpR/EjhVl+JbuzeYzwbIipaODsqFOTVotuddieLb0hIlmoNWWoVlkCgYEA0s6W +tn+u499fr2sppLIsBB0qzbVvlsxYYFPbm3ZFPO8BV+0hEldwAUoBN32cBy+N7TRU +zIEuKWkysyX72Sd7EN+KAF+ULshi2T/jf80HaKOoPcdcS73Q7Y0KJJJ2D9G5B+U7 +zQ22tPNTcOJFmR5s8+baY9qUhrRCTSvvLfwgG0cCgYEA6KEbx+n1lIMUXII5g0l0 +YLbyhB4EeyjiOS4z60mVrd9JANhMuk4aNa0STjPhF39OZdsW6CzQwhDl8cbwoK9Z +XvedAF/UIymJ5nrhScPZRME6+kAvvrZwO2c0evuPc1N6ZRLCbX8Pdt/p5wrruP/D +oTojdO9Wwm8lwmgP4lEHKSECgYB6LFzQfAOB8U1lPvgtiU1VPQo3mjWH8fouKauW +196cx+/BY57NIHu7Y4Z9AIFS8M6ScMfMlfmI6n0FsrfZTLZYOxWhzcL1shEH060n +vk3S6TZyR35IL0RMyHbeZzuhQ2y3FLWpy47eJD9xptGrQiTm3h4nzOBTiVj7nMDL +p9l7tQKBgB9cgiwW0wqTk+Rz+vG4dlBn8P+qzSFo5qoSxa7siIRJf5/R3Cz6QRSy +/Fn0mQpcI8AZkF96dt5thwIA5X2HmpxURI4gbmUHbXIq8+H9pHzQ8wPK6JeqEzxC +4A2OywvWcs45QnlxYmKUIL6x8stKQAbtuHkbda3v/4ts/+6Y0jss +-----END RSA PRIVATE KEY-----" > ${user_private_key_file} + +scp -q -o GlobalKnownHostsFile=${host_public_key_file} BatchMode=yes \ + -i ${user_private_key_file} ${report} ${user}@${hostname}: # Everything went smoothly From owner-svn-soc-all@FreeBSD.ORG Sun Jun 3 16:28: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 1E2351065675 for ; Sun, 3 Jun 2012 16:28:43 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 03 Jun 2012 16:28:43 +0000 Date: Sun, 03 Jun 2012 16:28:43 +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: <20120603162843.1E2351065675@hub.freebsd.org> Cc: Subject: socsvn commit: r237005 - 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: Sun, 03 Jun 2012 16:28:45 -0000 Author: tzabal Date: Sun Jun 3 16:28:42 2012 New Revision: 237005 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237005 Log: Fix: Bug in code responsible for sending the reports. Also, add message that informs the user that the report was sent successfully. 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 Sun Jun 3 15:35:54 2012 (r237004) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sun Jun 3 16:28:42 2012 (r237005) @@ -183,9 +183,11 @@ 4A2OywvWcs45QnlxYmKUIL6x8stKQAbtuHkbda3v/4ts/+6Y0jss -----END RSA PRIVATE KEY-----" > ${user_private_key_file} -scp -q -o GlobalKnownHostsFile=${host_public_key_file} BatchMode=yes \ - -i ${user_private_key_file} ${report} ${user}@${hostname}: +scp -o GlobalKnownHostsFile=${host_public_key_file} -o BatchMode=yes \ + -i ${user_private_key_file} -q ${report} ${user}@${hostname}: -# Everything went smoothly +## Everything went smoothly +echo "Crash report has been sent successfully.\ +Check your email for confirmation." exit 0 \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Sun Jun 3 19: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 AD1891065673 for ; Sun, 3 Jun 2012 19:23:03 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 03 Jun 2012 19:23:03 +0000 Date: Sun, 03 Jun 2012 19:23: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: <20120603192303.AD1891065673@hub.freebsd.org> Cc: Subject: socsvn commit: r237015 - in soc2012/aleek/beaglexm-armv6/sys/arm: arm ti 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: Sun, 03 Jun 2012 19:23:05 -0000 Author: aleek Date: Sun Jun 3 19:23:02 2012 New Revision: 237015 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237015 Log: beagle early puts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/locore.S soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap3 soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3var.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/locore.S ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/arm/locore.S Sun Jun 3 18:34:32 2012 (r237014) +++ soc2012/aleek/beaglexm-armv6/sys/arm/arm/locore.S Sun Jun 3 19:23:02 2012 (r237015) @@ -246,6 +246,8 @@ MMU_INIT(KERNBASE, PHYSADDR, 64, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) MMU_INIT(0x48000000, 0x48000000, 1, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) #endif + /*MMU_INIT(0x49020000, 0x49020000, 1, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))*/ + MMU_INIT(0x49000000, 0x49000000, 1, L1_TYPE_S|L1_S_AP(AP_KRW)) .word 0 /* end of table */ #endif .Lstart: Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap3 ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap3 Sun Jun 3 18:34:32 2012 (r237014) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap3 Sun Jun 3 19:23:02 2012 (r237015) @@ -1,3 +1,5 @@ #$FreeBSD$ arm/ti/omap3/omap3_intr.c standard +arm/ti/omap3/omap35x.c standard +arm/ti/omap3/omap3_prcm_clks.c standard Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3var.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3var.h Sun Jun 3 18:34:32 2012 (r237014) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3var.h Sun Jun 3 19:23:02 2012 (r237015) @@ -45,6 +45,7 @@ #include #include +#include /* * Random collection of functions and definitions ... needs cleanup @@ -82,6 +83,111 @@ omap3_padconf_init(device_t dev, int prio); +/* + * Random collection of functions and definitions ... needs cleanup + * + * + * + */ + + +extern struct bus_space omap_bs_tag; + +unsigned int +omap_sdram_size(void); + +void +omap_mask_all_intr(void); + +void +omap_post_filter_intr(void *arg); + +int +omap_setup_intr(device_t dev, device_t child, + struct resource *res, int flags, driver_filter_t *filt, + driver_intr_t *intr, void *arg, void **cookiep); + +int +omap_teardown_intr(device_t dev, device_t child, struct resource *res, + void *cookie); + + + +/** + * OMAP Device IDs + * + * These values are typically read out of the ID_CODE register, located at + * physical address 0x4A00 2204 on most OMAP devices + */ +#define OMAP_CPUID_OMAP3530 0x0C00 +#define OMAP_CPUID_OMAP3525 0x4C00 +#define OMAP_CPUID_OMAP3515 0x1C00 +#define OMAP_CPUID_OMAP3503 0x5C00 + +#define OMAP_CPUID_OMAP4430_ES1_2 0xB852 +#define OMAP_CPUID_OMAP4430 0xB95C + + + + +/** + * struct omap_softc + * + * + * + */ +extern uint32_t omap3_chip_id; + +static inline int +omap_cpu_is(uint32_t cpu) +{ + return ((omap3_chip_id & 0xffff) == cpu); +} + + +/** + * struct omap_softc + * + * + * + */ +struct omap_softc { + device_t sc_dev; + bus_space_tag_t sc_iotag; + bus_space_handle_t sc_ioh; + + struct rman sc_irq_rman; + struct rman sc_mem_rman; + bus_dma_tag_t sc_dmat; +}; + + +struct omap_mem_range { + bus_addr_t base; + bus_size_t size; +}; + +/** + * struct omap_cpu_dev + * + * Structure used to define all the SoC devices, it allows for two memory + * address ranges and 4 IRQ's per device. + * + */ +struct omap_cpu_dev { + const char *name; + int unit; + + struct omap_mem_range mem[16]; + int irqs[16]; +}; + + + +struct omap_ivar { + struct resource_list resources; +}; + #endif /* _OMAP3VAR_H_ */ Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Sun Jun 3 18:34:32 2012 (r237014) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Sun Jun 3 19:23:02 2012 (r237015) @@ -299,6 +299,31 @@ phys_avail[j + 1] = 0; } +void +beagle_early_puts(char *s); + +void +beagle_early_puts(char *s) +{ + // 0xFFFFEE00 + volatile uint32_t *uart = (volatile uint32_t *)0x49020000; + volatile uint32_t *uart_lsr = (volatile uint32_t *)0x49020014; + while (*s) + { + while ((*uart_lsr & 0x60) == 0); + *uart = *s; + + if (*s == '\n') + { + while ((*uart_lsr & 0x60) == 0); + *uart = '\r'; + } + *s++; + } +} + + + void * initarm(void *mdp, void *unused __unused) { @@ -310,12 +335,18 @@ u_int l1pagetable; int i = 0, j = 0; + + beagle_early_puts( "BeagleBoard-XM revC FreeBSD hababababa booting...\n" ); + kmdp = NULL; lastaddr = 0; memsize = 0; dtbp = (vm_offset_t)NULL; + + beagle_early_puts( "set_cpufuncs()..." ); set_cpufuncs(); + beagle_early_puts( "done!\n" ); /* * Mask metadata pointer: it is supposed to be on page boundary. If From owner-svn-soc-all@FreeBSD.ORG Sun Jun 3 23: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 1BB10106567B for ; Sun, 3 Jun 2012 23:54:19 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 03 Jun 2012 23:54:19 +0000 Date: Sun, 03 Jun 2012 23:54:19 +0000 From: emc2@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: <20120603235419.1BB10106567B@hub.freebsd.org> Cc: Subject: socsvn commit: r237023 - soc2012/emc2/experimental 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, 03 Jun 2012 23:54:21 -0000 Author: emc2 Date: Sun Jun 3 23:54:18 2012 New Revision: 237023 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237023 Log: Results of some exploration. The end result of this is a better understanding of how to build EFI applications using the build tools. I've also done a fair amount of exploring the EFI API, though that can't be reflected in actual code changes. Modified: soc2012/emc2/experimental/Makefile soc2012/emc2/experimental/helloworld.c Modified: soc2012/emc2/experimental/Makefile ============================================================================== --- soc2012/emc2/experimental/Makefile Sun Jun 3 22:40:32 2012 (r237022) +++ soc2012/emc2/experimental/Makefile Sun Jun 3 23:54:18 2012 (r237023) @@ -6,13 +6,19 @@ all: helloworld.efi +clean: + rm -f helloworld.o helloworld helloworld.efi start.o + +start.o: start.S + ${CC} -c ${CFLAGS} start.S + helloworld.o: helloworld.c ${CC} -c ${CFLAGS} helloworld.c -helloworld: helloworld.o - ${LD} -T ${LDSCRIPT} -shared -symbolic -o helloworld helloworld.o +helloworld: helloworld.o start.o + ${CC} -nostdlib -o helloworld -Wl,-T ${LDSCRIPT} -shared -symbolic helloworld.o start.o helloworld.efi: helloworld ${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \ -j .rel.dyn -j .reloc -j .sdata -j .text -j set_Xcommand_set \ - --target=${EFIFORMAT} ${.ALLSRC} helloworld.efi \ No newline at end of file + --target=${EFIFORMAT} ${.ALLSRC} helloworld.efi Modified: soc2012/emc2/experimental/helloworld.c ============================================================================== --- soc2012/emc2/experimental/helloworld.c Sun Jun 3 22:40:32 2012 (r237022) +++ soc2012/emc2/experimental/helloworld.c Sun Jun 3 23:54:18 2012 (r237023) @@ -1,6 +1,6 @@ #include -unsigned short str[] = +static unsigned short str[] = { 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\n', '\r', 0 }; EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systab) From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 03:34:34 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 58AF41065675 for ; Mon, 4 Jun 2012 03:34:32 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 03:34:32 +0000 Date: Mon, 04 Jun 2012 03:34:32 +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: <20120604033432.58AF41065675@hub.freebsd.org> Cc: Subject: socsvn commit: r237026 - soc2012/jhagewood/mdocml 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, 04 Jun 2012 03:34:34 -0000 Author: jhagewood Date: Mon Jun 4 03:34:31 2012 New Revision: 237026 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237026 Log: Added: soc2012/jhagewood/mdocml/manpaths.txt Added: soc2012/jhagewood/mdocml/manpaths.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/manpaths.txt Mon Jun 4 03:34:31 2012 (r237026) @@ -0,0 +1,6312 @@ +./man/man1/rtld.1 +./man/man1/ld-elf.so.1.1 +./man/man1/ld.so.1 +./man/man1/cat.1 +./man/man1/chflags.1 +./man/man1/chio.1 +./man/man1/chmod.1 +./man/man1/cp.1 +./man/man1/csh.1 +./man/man1/tcsh.1 +./man/man1/date.1 +./man/man1/dd.1 +./man/man1/df.1 +./man/man1/domainname.1 +./man/man1/echo.1 +./man/man1/ed.1 +./man/man1/red.1 +./man/man1/expr.1 +./man/man1/getfacl.1 +./man/man1/hostname.1 +./man/man1/kenv.1 +./man/man1/kill.1 +./man/man1/ln.1 +./man/man1/link.1 +./man/man1/ls.1 +./man/man1/mkdir.1 +./man/man1/mv.1 +./man/man1/pax.1 +./man/man1/[.1 +./man/man1/pkill.1 +./man/man1/pgrep.1 +./man/man1/ps.1 +./man/man1/pwait.1 +./man/man1/pwd.1 +./man/man1/rcp.1 +./man/man1/realpath.1 +./man/man1/rm.1 +./man/man1/unlink.1 +./man/man1/rmdir.1 +./man/man1/setfacl.1 +./man/man1/sh.1 +./man/man1/sleep.1 +./man/man1/stty.1 +./man/man1/test.1 +./man/man1/uuidgen.1 +./man/man1/ctfconvert.1 +./man/man1/ctfdump.1 +./man/man1/ctfmerge.1 +./man/man1/zstreamdump.1 +./man/man1/dtrace.1 +./man/man1/dtruss.1 +./man/man1/addr2line.1 +./man/man1/gnu-ar.1 +./man/man1/as.1 +./man/man1/ld.1 +./man/man1/nm.1 +./man/man1/objcopy.1 +./man/man1/objdump.1 +./man/man1/gnu-ranlib.1 +./man/man1/readelf.1 +./man/man1/size.1 +./man/man1/strings.1 +./man/man1/strip.1 +./man/man1/gcc.1 +./man/man1/cc.1 +./man/man1/c++.1 +./man/man1/g++.1 +./man/man1/CC.1 +./man/man1/cpp.1 +./man/man1/gcov.1 +./man/man1/cvs.1 +./man/man1/dialog.1 +./man/man1/diff.1 +./man/man1/diff3.1 +./man/man1/gdb.1 +./man/man1/kgdb.1 +./man/man1/gdbserver.1 +./man/man1/gperf.1 +./man/man1/grep.1 +./man/man1/egrep.1 +./man/man1/fgrep.1 +./man/man1/bzgrep.1 +./man/man1/bzegrep.1 +./man/man1/bzfgrep.1 +./man/man1/zgrep.1 +./man/man1/zegrep.1 +./man/man1/zfgrep.1 +./man/man1/mmroff.1 +./man/man1/grodvi.1 +./man/man1/grolbp.1 +./man/man1/grolj4.1 +./man/man1/grops.1 +./man/man1/grotty.1 +./man/man1/eqn.1 +./man/man1/neqn.1 +./man/man1/grn.1 +./man/man1/pic.1 +./man/man1/refer.1 +./man/man1/soelim.1 +./man/man1/tbl.1 +./man/man1/groff.1 +./man/man1/grog.1 +./man/man1/nroff.1 +./man/man1/psroff.1 +./man/man1/troff.1 +./man/man1/addftinfo.1 +./man/man1/afmtodit.1 +./man/man1/hpftodit.1 +./man/man1/indxbib.1 +./man/man1/lkbib.1 +./man/man1/lookbib.1 +./man/man1/pfbtops.1 +./man/man1/tfmtodit.1 +./man/man1/patch.1 +./man/man1/ci.1 +./man/man1/co.1 +./man/man1/ident.1 +./man/man1/merge.1 +./man/man1/rcs.1 +./man/man1/rcsintro.1 +./man/man1/rcsclean.1 +./man/man1/rcsdiff.1 +./man/man1/rlog.1 +./man/man1/rcsmerge.1 +./man/man1/rcsfreeze.1 +./man/man1/sdiff.1 +./man/man1/send-pr.1 +./man/man1/sendbug.1 +./man/man1/sort.1 +./man/man1/makeinfo.1 +./man/man1/info.1 +./man/man1/infokey.1 +./man/man1/install-info.1 +./man/man1/texindex.1 +./man/man1/kdestroy.1 +./man/man1/kinit.1 +./man/man1/klist.1 +./man/man1/kpasswd.1 +./man/man1/krb5-config.1 +./man/man1/ipftest.1 +./man/man1/ipresend.1 +./man/man1/md5.1 +./man/man1/rmd160.1 +./man/man1/sha1.1 +./man/man1/sha256.1 +./man/man1/recoverdisk.1 +./man/man1/bdes.1 +./man/man1/scp.1 +./man/man1/sftp.1 +./man/man1/ssh.1 +./man/man1/slogin.1 +./man/man1/ssh-add.1 +./man/man1/ssh-agent.1 +./man/man1/ssh-keygen.1 +./man/man1/ssh-keyscan.1 +./man/man1/mkfilters.1 +./man/man1/builtin.1 +./man/man1/intro.1 +./man/man1/alias.1 +./man/man1/alloc.1 +./man/man1/bg.1 +./man/man1/bind.1 +./man/man1/bindkey.1 +./man/man1/break.1 +./man/man1/breaksw.1 +./man/man1/builtins.1 +./man/man1/case.1 +./man/man1/cd.1 +./man/man1/chdir.1 +./man/man1/command.1 +./man/man1/complete.1 +./man/man1/continue.1 +./man/man1/default.1 +./man/man1/dirs.1 +./man/man1/do.1 +./man/man1/done.1 +./man/man1/echotc.1 +./man/man1/elif.1 +./man/man1/else.1 +./man/man1/end.1 +./man/man1/endif.1 +./man/man1/endsw.1 +./man/man1/esac.1 +./man/man1/eval.1 +./man/man1/exec.1 +./man/man1/exit.1 +./man/man1/export.1 +./man/man1/fc.1 +./man/man1/fg.1 +./man/man1/fi.1 +./man/man1/filetest.1 +./man/man1/for.1 +./man/man1/foreach.1 +./man/man1/getopts.1 +./man/man1/glob.1 +./man/man1/goto.1 +./man/man1/hash.1 +./man/man1/hashstat.1 +./man/man1/history.1 +./man/man1/hup.1 +./man/man1/if.1 +./man/man1/jobid.1 +./man/man1/jobs.1 +./man/man1/limit.1 +./man/man1/log.1 +./man/man1/logout.1 +./man/man1/ls-F.1 +./man/man1/notify.1 +./man/man1/onintr.1 +./man/man1/popd.1 +./man/man1/pushd.1 +./man/man1/read.1 +./man/man1/readonly.1 +./man/man1/rehash.1 +./man/man1/repeat.1 +./man/man1/sched.1 +./man/man1/set.1 +./man/man1/setenv.1 +./man/man1/settc.1 +./man/man1/setty.1 +./man/man1/setvar.1 +./man/man1/shift.1 +./man/man1/source.1 +./man/man1/stop.1 +./man/man1/suspend.1 +./man/man1/switch.1 +./man/man1/then.1 +./man/man1/telltc.1 +./man/man1/times.1 +./man/man1/trap.1 +./man/man1/type.1 +./man/man1/ulimit.1 +./man/man1/umask.1 +./man/man1/unalias.1 +./man/man1/uncomplete.1 +./man/man1/unhash.1 +./man/man1/unlimit.1 +./man/man1/unset.1 +./man/man1/unsetenv.1 +./man/man1/until.1 +./man/man1/wait.1 +./man/man1/where.1 +./man/man1/while.1 +./man/man1/introduction.1 +./man/man1/apply.1 +./man/man1/ar.1 +./man/man1/ranlib.1 +./man/man1/asa.1 +./man/man1/at.1 +./man/man1/batch.1 +./man/man1/atq.1 +./man/man1/atrm.1 +./man/man1/sscop.1 +./man/man1/awk.1 +./man/man1/nawk.1 +./man/man1/basename.1 +./man/man1/dirname.1 +./man/man1/bc.1 +./man/man1/biff.1 +./man/man1/bthost.1 +./man/man1/btsockstat.1 +./man/man1/rfcomm_sppd.1 +./man/man1/brandelf.1 +./man/man1/bsdiff.1 +./man/man1/bspatch.1 +./man/man1/bzip2.1 +./man/man1/bunzip2.1 +./man/man1/bzcat.1 +./man/man1/c89.1 +./man/man1/c99.1 +./man/man1/calendar.1 +./man/man1/cap_mkdb.1 +./man/man1/catman.1 +./man/man1/checknr.1 +./man/man1/chkey.1 +./man/man1/chpass.1 +./man/man1/chfn.1 +./man/man1/chsh.1 +./man/man1/ypchpass.1 +./man/man1/ypchfn.1 +./man/man1/ypchsh.1 +./man/man1/cksum.1 +./man/man1/sum.1 +./man/man1/clang.1 +./man/man1/clang++.1 +./man/man1/clang-cpp.1 +./man/man1/tblgen.1 +./man/man1/cmp.1 +./man/man1/col.1 +./man/man1/colcrt.1 +./man/man1/colldef.1 +./man/man1/colrm.1 +./man/man1/column.1 +./man/man1/comm.1 +./man/man1/compile_et.1 +./man/man1/compress.1 +./man/man1/uncompress.1 +./man/man1/bsdcpio.1 +./man/man1/cpio.1 +./man/man1/cpuset.1 +./man/man1/csplit.1 +./man/man1/csup.1 +./man/man1/cpasswd.1 +./man/man1/ctags.1 +./man/man1/cut.1 +./man/man1/dc.1 +./man/man1/dig.1 +./man/man1/du.1 +./man/man1/ee.1 +./man/man1/ree.1 +./man/man1/edit.1 +./man/man1/elf2aout.1 +./man/man1/elfdump.1 +./man/man1/enigma.1 +./man/man1/crypt.1 +./man/man1/env.1 +./man/man1/expand.1 +./man/man1/unexpand.1 +./man/man1/false.1 +./man/man1/fetch.1 +./man/man1/file.1 +./man/man1/file2c.1 +./man/man1/find.1 +./man/man1/finger.1 +./man/man1/fmt.1 +./man/man1/fold.1 +./man/man1/from.1 +./man/man1/fuser.1 +./man/man1/fstat.1 +./man/man1/fsync.1 +./man/man1/ftp.1 +./man/man1/pftp.1 +./man/man1/gate-ftp.1 +./man/man1/gcore.1 +./man/man1/gencat.1 +./man/man1/getconf.1 +./man/man1/getent.1 +./man/man1/getopt.1 +./man/man1/gprof.1 +./man/man1/gzip.1 +./man/man1/bsdgrep.1 +./man/man1/gzexe.1 +./man/man1/zdiff.1 +./man/man1/zforce.1 +./man/man1/zmore.1 +./man/man1/znew.1 +./man/man1/gunzip.1 +./man/man1/gzcat.1 +./man/man1/zcat.1 +./man/man1/zcmp.1 +./man/man1/head.1 +./man/man1/hexdump.1 +./man/man1/od.1 +./man/man1/hd.1 +./man/man1/host.1 +./man/man1/id.1 +./man/man1/groups.1 +./man/man1/whoami.1 +./man/man1/indent.1 +./man/man1/ipcrm.1 +./man/man1/ipcs.1 +./man/man1/join.1 +./man/man1/jot.1 +./man/man1/kdump.1 +./man/man1/m4.1 +./man/man1/keylogin.1 +./man/man1/keylogout.1 +./man/man1/killall.1 +./man/man1/ktrace.1 +./man/man1/trace.1 +./man/man1/lam.1 +./man/man1/last.1 +./man/man1/lastcomm.1 +./man/man1/ldd.1 +./man/man1/leave.1 +./man/man1/less.1 +./man/man1/more.1 +./man/man1/lessecho.1 +./man/man1/lesskey.1 +./man/man1/lex.1 +./man/man1/flex.1 +./man/man1/flex++.1 +./man/man1/lex++.1 +./man/man1/limits.1 +./man/man1/locale.1 +./man/man1/locate.1 +./man/man1/lock.1 +./man/man1/lockf.1 +./man/man1/logger.1 +./man/man1/login.1 +./man/man1/logins.1 +./man/man1/logname.1 +./man/man1/look.1 +./man/man1/lorder.1 +./man/man1/lsvfs.1 +./man/man1/lzmainfo.1 +./man/man1/mail.1 +./man/man1/Mail.1 +./man/man1/mailx.1 +./man/man1/make.1 +./man/man1/makewhatis.1 +./man/man1/man.1 +./man/man1/manpath.1 +./man/man1/apropos.1 +./man/man1/whatis.1 +./man/man1/mesg.1 +./man/man1/minigzip.1 +./man/man1/ministat.1 +./man/man1/mkdep.1 +./man/man1/mkfifo.1 +./man/man1/mklocale.1 +./man/man1/mkstr.1 +./man/man1/mktemp.1 +./man/man1/msgs.1 +./man/man1/mt.1 +./man/man1/nc.1 +./man/man1/ncal.1 +./man/man1/cal.1 +./man/man1/ncplist.1 +./man/man1/ncplogin.1 +./man/man1/ncplogout.1 +./man/man1/netstat.1 +./man/man1/newgrp.1 +./man/man1/nfsstat.1 +./man/man1/nice.1 +./man/man1/nl.1 +./man/man1/nohup.1 +./man/man1/nslookup.1 +./man/man1/nsupdate.1 +./man/man1/opieinfo.1 +./man/man1/opiekey.1 +./man/man1/otp-md4.1 +./man/man1/otp-md5.1 +./man/man1/otp-sha.1 +./man/man1/opiepasswd.1 +./man/man1/pagesize.1 +./man/man1/passwd.1 +./man/man1/yppasswd.1 +./man/man1/paste.1 +./man/man1/pathchk.1 +./man/man1/perror.1 +./man/man1/pr.1 +./man/man1/printenv.1 +./man/man1/printf.1 +./man/man1/procstat.1 +./man/man1/quota.1 +./man/man1/rev.1 +./man/man1/revoke.1 +./man/man1/rlogin.1 +./man/man1/rpcgen.1 +./man/man1/rs.1 +./man/man1/rsh.1 +./man/man1/rup.1 +./man/man1/ruptime.1 +./man/man1/rusers.1 +./man/man1/rwall.1 +./man/man1/rwho.1 +./man/man1/script.1 +./man/man1/sed.1 +./man/man1/seq.1 +./man/man1/shar.1 +./man/man1/smbutil.1 +./man/man1/sockstat.1 +./man/man1/split.1 +./man/man1/stat.1 +./man/man1/readlink.1 +./man/man1/su.1 +./man/man1/systat.1 +./man/man1/tabs.1 +./man/man1/tail.1 +./man/man1/talk.1 +./man/man1/bsdtar.1 +./man/man1/tar.1 +./man/man1/tcopy.1 +./man/man1/tee.1 +./man/man1/telnet.1 +./man/man1/tftp.1 +./man/man1/time.1 +./man/man1/tip.1 +./man/man1/cu.1 +./man/man1/top.1 +./man/man1/touch.1 +./man/man1/w.1 +./man/man1/tput.1 +./man/man1/clear.1 +./man/man1/tr.1 +./man/man1/true.1 +./man/man1/truncate.1 +./man/man1/truss.1 +./man/man1/tset.1 +./man/man1/reset.1 +./man/man1/tsort.1 +./man/man1/tty.1 +./man/man1/ul.1 +./man/man1/uname.1 +./man/man1/unifdef.1 +./man/man1/unifdefall.1 +./man/man1/uniq.1 +./man/man1/units.1 +./man/man1/unvis.1 +./man/man1/unzip.1 +./man/man1/usbhidaction.1 +./man/man1/usbhidctl.1 +./man/man1/users.1 +./man/man1/uuencode.1 +./man/man1/uudecode.1 +./man/man1/b64encode.1 +./man/man1/b64decode.1 +./man/man1/vacation.1 +./man/man1/vgrind.1 +./man/man1/vi.1 +./man/man1/ex.1 +./man/man1/view.1 +./man/man1/nex.1 +./man/man1/nview.1 +./man/man1/nvi.1 +./man/man1/vis.1 +./man/man1/uptime.1 +./man/man1/wall.1 +./man/man1/wc.1 +./man/man1/what.1 +./man/man1/whereis.1 +./man/man1/which.1 +./man/man1/who.1 +./man/man1/whois.1 +./man/man1/write.1 +./man/man1/wtmpcvt.1 +./man/man1/xargs.1 +./man/man1/install.1 +./man/man1/lint.1 +./man/man1/xstr.1 +./man/man1/xz.1 +./man/man1/unxz.1 +./man/man1/lzma.1 +./man/man1/unlzma.1 +./man/man1/xzcat.1 +./man/man1/lzcat.1 +./man/man1/xzdec.1 +./man/man1/lzmadec.1 +./man/man1/yacc.1 +./man/man1/yyfix.1 +./man/man1/byacc.1 +./man/man1/yes.1 +./man/man1/ypcat.1 +./man/man1/ypmatch.1 +./man/man1/ypwhich.1 +./man/man1/pawd.1 +./man/man1/arpaname.1 +./man/man1/auditreduce.1 +./man/man1/gensnmptree.1 +./man/man1/bsnmpd.1 +./man/man1/bsnmpget.1 +./man/man1/bsnmpwalk.1 +./man/man1/bsnmpset.1 +./man/man1/cdcontrol.1 +./man/man1/chgrp.1 +./man/man1/ckdist.1 +./man/man1/crontab.1 +./man/man1/crunchgen.1 +./man/man1/crunchide.1 +./man/man1/ctm.1 +./man/man1/ctm_rmail.1 +./man/man1/ctm_smail.1 +./man/man1/ctm_dequeue.1 +./man/man1/fdformat.1 +./man/man1/fdread.1 +./man/man1/fdwrite.1 +./man/man1/fifolog.1 +./man/man1/fifolog_create.1 +./man/man1/fifolog_reader.1 +./man/man1/fifolog_writer.1 +./man/man1/kbdcontrol.1 +./man/man1/kbdmap.1 +./man/man1/vidfont.1 +./man/man1/lp.1 +./man/man1/lpq.1 +./man/man1/lpr.1 +./man/man1/lprm.1 +./man/man1/lptest.1 +./man/man1/mptable.1 +./man/man1/pkg_add.1 +./man/man1/pkg_create.1 +./man/man1/pkg_delete.1 +./man/man1/pkg_info.1 +./man/man1/pkg_updating.1 +./man/man1/pkg_version.1 +./man/man1/praudit.1 +./man/man1/rtprio.1 +./man/man1/idprio.1 +./man/man1/mailq.1 +./man/man1/newaliases.1 +./man/man1/setfib.1 +./man/man1/tcpdump.1 +./man/man1/uhsoctl.1 +./man/man1/vidcontrol.1 +./man/man2/creat.2 +./man/man2/killpg.2 +./man/man2/sigpause.2 +./man/man2/sigsetmask.2 +./man/man2/sigvec.2 +./man/man2/abort2.2 +./man/man2/accept.2 +./man/man2/access.2 +./man/man2/acct.2 +./man/man2/adjtime.2 +./man/man2/aio_cancel.2 +./man/man2/aio_error.2 +./man/man2/aio_read.2 +./man/man2/aio_return.2 +./man/man2/aio_suspend.2 +./man/man2/aio_waitcomplete.2 +./man/man2/aio_write.2 +./man/man2/bind.2 +./man/man2/brk.2 +./man/man2/cap_enter.2 +./man/man2/cap_new.2 +./man/man2/chdir.2 +./man/man2/chflags.2 +./man/man2/chmod.2 +./man/man2/chown.2 +./man/man2/chroot.2 +./man/man2/clock_gettime.2 +./man/man2/close.2 +./man/man2/closefrom.2 +./man/man2/connect.2 +./man/man2/cpuset.2 +./man/man2/cpuset_getaffinity.2 +./man/man2/dup.2 +./man/man2/execve.2 +./man/man2/_exit.2 +./man/man2/extattr_get_file.2 +./man/man2/fcntl.2 +./man/man2/fhopen.2 +./man/man2/flock.2 +./man/man2/fork.2 +./man/man2/fsync.2 +./man/man2/getdirentries.2 +./man/man2/getdtablesize.2 +./man/man2/getfh.2 +./man/man2/getfsstat.2 +./man/man2/getgid.2 +./man/man2/getgroups.2 +./man/man2/getitimer.2 +./man/man2/getlogin.2 +./man/man2/intro.2 +./man/man2/getloginclass.2 +./man/man2/getpeername.2 +./man/man2/getpgrp.2 +./man/man2/getpid.2 +./man/man2/getpriority.2 +./man/man2/getrlimit.2 +./man/man2/getrusage.2 +./man/man2/getsid.2 +./man/man2/getsockname.2 +./man/man2/getsockopt.2 +./man/man2/gettimeofday.2 +./man/man2/getuid.2 +./man/man2/ioctl.2 +./man/man2/issetugid.2 +./man/man2/jail.2 +./man/man2/kenv.2 +./man/man2/kill.2 +./man/man2/kldfind.2 +./man/man2/kldfirstmod.2 +./man/man2/kldload.2 +./man/man2/kldnext.2 +./man/man2/kldstat.2 +./man/man2/kldsym.2 +./man/man2/kldunload.2 +./man/man2/kqueue.2 +./man/man2/ktrace.2 +./man/man2/link.2 +./man/man2/lio_listio.2 +./man/man2/listen.2 +./man/man2/lseek.2 +./man/man2/madvise.2 +./man/man2/mincore.2 +./man/man2/minherit.2 +./man/man2/mkdir.2 +./man/man2/mkfifo.2 +./man/man2/mknod.2 +./man/man2/mlock.2 +./man/man2/mlockall.2 +./man/man2/mmap.2 +./man/man2/modfind.2 +./man/man2/modnext.2 +./man/man2/modstat.2 +./man/man2/mount.2 +./man/man2/mprotect.2 +./man/man2/mq_close.2 +./man/man2/mq_getattr.2 +./man/man2/mq_notify.2 +./man/man2/mq_open.2 +./man/man2/mq_receive.2 +./man/man2/mq_send.2 +./man/man2/mq_setattr.2 +./man/man2/msgctl.2 +./man/man2/msgget.2 +./man/man2/msgrcv.2 +./man/man2/msgsnd.2 +./man/man2/msync.2 +./man/man2/munmap.2 +./man/man2/nanosleep.2 +./man/man2/nfssvc.2 +./man/man2/open.2 +./man/man2/ntp_adjtime.2 +./man/man2/pathconf.2 +./man/man2/pdfork.2 +./man/man2/pipe.2 +./man/man2/poll.2 +./man/man2/posix_fallocate.2 +./man/man2/posix_openpt.2 +./man/man2/profil.2 +./man/man2/pselect.2 +./man/man2/ptrace.2 +./man/man2/quotactl.2 +./man/man2/read.2 +./man/man2/readlink.2 +./man/man2/reboot.2 +./man/man2/recv.2 +./man/man2/rename.2 +./man/man2/revoke.2 +./man/man2/rfork.2 +./man/man2/rmdir.2 +./man/man2/rtprio.2 +./man/man2/sched_get_priority_max.2 +./man/man2/sched_setparam.2 +./man/man2/sched_setscheduler.2 +./man/man2/sched_yield.2 +./man/man2/sctp_generic_recvmsg.2 +./man/man2/sctp_generic_sendmsg.2 +./man/man2/sctp_peeloff.2 +./man/man2/select.2 +./man/man2/semctl.2 +./man/man2/semget.2 +./man/man2/semop.2 +./man/man2/send.2 +./man/man2/setfib.2 +./man/man2/sendfile.2 +./man/man2/setgroups.2 +./man/man2/setpgid.2 +./man/man2/setregid.2 +./man/man2/setresuid.2 +./man/man2/setreuid.2 +./man/man2/setsid.2 +./man/man2/setuid.2 +./man/man2/shmat.2 +./man/man2/shmctl.2 +./man/man2/shmget.2 +./man/man2/shm_open.2 +./man/man2/shutdown.2 +./man/man2/sigaction.2 +./man/man2/sigaltstack.2 +./man/man2/sigpending.2 +./man/man2/sigprocmask.2 +./man/man2/sigqueue.2 +./man/man2/sigreturn.2 +./man/man2/sigstack.2 +./man/man2/sigsuspend.2 +./man/man2/sigwait.2 +./man/man2/sigwaitinfo.2 +./man/man2/socket.2 +./man/man2/socketpair.2 +./man/man2/stat.2 +./man/man2/statfs.2 +./man/man2/swapon.2 +./man/man2/symlink.2 +./man/man2/sync.2 +./man/man2/sysarch.2 +./man/man2/umask.2 +./man/man2/syscall.2 +./man/man2/timer_create.2 +./man/man2/timer_delete.2 +./man/man2/timer_settime.2 +./man/man2/truncate.2 +./man/man2/undelete.2 +./man/man2/unlink.2 +./man/man2/utimes.2 +./man/man2/utrace.2 +./man/man2/uuidgen.2 +./man/man2/vfork.2 +./man/man2/wait.2 +./man/man2/write.2 +./man/man2/sighold.2 +./man/man2/sigignore.2 +./man/man2/sigrelse.2 +./man/man2/sigset.2 +./man/man2/xsi_sigpause.2 +./man/man2/sigblock.2 +./man/man2/sigmask.2 +./man/man2/eaccess.2 +./man/man2/sbrk.2 +./man/man2/faccessat.2 +./man/man2/cap_getmode.2 +./man/man2/cap_getrights.2 +./man/man2/fchdir.2 +./man/man2/fchflags.2 +./man/man2/lchflags.2 +./man/man2/fchmod.2 +./man/man2/fchmodat.2 +./man/man2/lchmod.2 +./man/man2/fchown.2 +./man/man2/fchownat.2 +./man/man2/lchown.2 +./man/man2/clock_getres.2 +./man/man2/clock_settime.2 +./man/man2/cpuset_getid.2 +./man/man2/cpuset_setid.2 +./man/man2/cpuset_setaffinity.2 +./man/man2/dup2.2 +./man/man2/fexecve.2 +./man/man2/extattr.2 +./man/man2/fhstat.2 +./man/man2/extattr_delete_fd.2 +./man/man2/extattr_delete_file.2 +./man/man2/extattr_delete_list.2 +./man/man2/extattr_get_fd.2 +./man/man2/extattr_get_list.2 +./man/man2/extattr_list_fd.2 +./man/man2/extattr_list_file.2 +./man/man2/extattr_list_link.2 +./man/man2/extattr_set_fd.2 +./man/man2/extattr_set_file.2 +./man/man2/extattr_set_link.2 +./man/man2/fhstatfs.2 +./man/man2/getdents.2 +./man/man2/lgetfh.2 +./man/man2/getegid.2 +./man/man2/setitimer.2 +./man/man2/setlogin.2 +./man/man2/errno.2 +./man/man2/setloginclass.2 +./man/man2/getpgid.2 +./man/man2/getppid.2 +./man/man2/setpriority.2 +./man/man2/setrlimit.2 +./man/man2/setsockopt.2 +./man/man2/settimeofday.2 +./man/man2/geteuid.2 +./man/man2/jail_attach.2 +./man/man2/jail_get.2 +./man/man2/jail_remove.2 +./man/man2/jail_set.2 +./man/man2/kldunloadf.2 +./man/man2/kevent.2 +./man/man2/linkat.2 +./man/man2/posix_madvise.2 +./man/man2/mkdirat.2 +./man/man2/mkfifoat.2 +./man/man2/mknodat.2 +./man/man2/munlock.2 +./man/man2/munlockall.2 +./man/man2/modfnext.2 +./man/man2/nmount.2 +./man/man2/unmount.2 +./man/man2/mq_timedreceive.2 +./man/man2/mq_timedsend.2 +./man/man2/ntp_gettime.2 +./man/man2/openat.2 +./man/man2/fpathconf.2 +./man/man2/lpathconf.2 +./man/man2/pdgetpid.2 +./man/man2/pread.2 +./man/man2/pdkill.2 +./man/man2/pdwait4.2 +./man/man2/preadv.2 +./man/man2/readv.2 +./man/man2/readlinkat.2 +./man/man2/recvfrom.2 +./man/man2/recvmsg.2 +./man/man2/renameat.2 +./man/man2/sched_get_priority_min.2 +./man/man2/sched_rr_get_interval.2 +./man/man2/sched_getparam.2 +./man/man2/sched_getscheduler.2 +./man/man2/sendmsg.2 +./man/man2/sendto.2 +./man/man2/setpgrp.2 +./man/man2/getresgid.2 +./man/man2/getresuid.2 +./man/man2/setresgid.2 +./man/man2/setegid.2 +./man/man2/seteuid.2 +./man/man2/setgid.2 +./man/man2/shmdt.2 +./man/man2/shm_unlink.2 +./man/man2/sigtimedwait.2 +./man/man2/fstat.2 +./man/man2/fstatat.2 +./man/man2/lstat.2 +./man/man2/fstatfs.2 +./man/man2/swapoff.2 +./man/man2/symlinkat.2 +./man/man2/__syscall.2 +./man/man2/timer_getoverrun.2 +./man/man2/timer_gettime.2 +./man/man2/ftruncate.2 +./man/man2/unlinkat.2 +./man/man2/futimes.2 +./man/man2/futimesat.2 +./man/man2/lutimes.2 +./man/man2/wait3.2 +./man/man2/wait4.2 +./man/man2/waitpid.2 +./man/man2/pwrite.2 +./man/man2/pwritev.2 +./man/man2/writev.2 +./man/man2/audit.2 +./man/man2/auditctl.2 +./man/man2/auditon.2 +./man/man2/getaudit.2 +./man/man2/getauid.2 +./man/man2/setaudit.2 +./man/man2/setauid.2 +./man/man2/getaudit_addr.2 +./man/man2/setaudit_addr.2 +./man/man3/btree.3 +./man/man3/dbm.3 +./man/man3/gethostid.3 +./man/man3/setruid.3 +./man/man3/arc4random.3 +./man/man3/basename.3 +./man/man3/check_utility_compat.3 +./man/man3/confstr.3 +./man/man3/ctermid.3 +./man/man3/daemon.3 +./man/man3/devname.3 +./man/man3/directory.3 +./man/man3/dirname.3 +./man/man3/dladdr.3 +./man/man3/dlinfo.3 +./man/man3/dllockinit.3 +./man/man3/dlopen.3 +./man/man3/feature_present.3 +./man/man3/fmtcheck.3 +./man/man3/fmtmsg.3 +./man/man3/fnmatch.3 +./man/man3/fpclassify.3 +./man/man3/getbootfile.3 +./man/man3/getbsize.3 +./man/man3/getcap.3 +./man/man3/getcontext.3 +./man/man3/getcwd.3 +./man/man3/getdiskbyname.3 +./man/man3/getdomainname.3 +./man/man3/getfsent.3 +./man/man3/getgrent.3 +./man/man3/getgrouplist.3 +./man/man3/gethostname.3 +./man/man3/getloadavg.3 +./man/man3/getmntinfo.3 +./man/man3/getnetgrent.3 +./man/man3/getosreldate.3 +./man/man3/getpagesize.3 +./man/man3/getpagesizes.3 +./man/man3/getpass.3 +./man/man3/getpeereid.3 +./man/man3/getprogname.3 +./man/man3/getpwent.3 +./man/man3/getttyent.3 +./man/man3/getusershell.3 +./man/man3/sleep.3 +./man/man3/getutxent.3 +./man/man3/getvfsbyname.3 +./man/man3/initgroups.3 +./man/man3/isgreater.3 +./man/man3/makecontext.3 +./man/man3/posix_spawn.3 +./man/man3/posix_spawn_file_actions_addopen.3 +./man/man3/posix_spawn_file_actions_init.3 +./man/man3/posix_spawnattr_getflags.3 +./man/man3/posix_spawnattr_getpgroup.3 +./man/man3/posix_spawnattr_getschedparam.3 +./man/man3/posix_spawnattr_getschedpolicy.3 +./man/man3/posix_spawnattr_init.3 +./man/man3/posix_spawnattr_getsigmask.3 +./man/man3/posix_spawnattr_getsigdefault.3 +./man/man3/psignal.3 +./man/man3/pwcache.3 +./man/man3/rand48.3 +./man/man3/readpassphrase.3 +./man/man3/rfork_thread.3 +./man/man3/scandir.3 +./man/man3/sem_destroy.3 +./man/man3/sem_getvalue.3 +./man/man3/sem_init.3 +./man/man3/sem_open.3 +./man/man3/sem_post.3 +./man/man3/sem_timedwait.3 +./man/man3/sem_wait.3 +./man/man3/setjmp.3 +./man/man3/setmode.3 +./man/man3/setproctitle.3 +./man/man3/siginterrupt.3 +./man/man3/signal.3 +./man/man3/sigsetops.3 +./man/man3/statvfs.3 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 03:39: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 4B3FC106566B for ; Mon, 4 Jun 2012 03:39:43 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 03:39:43 +0000 Date: Mon, 04 Jun 2012 03:39:43 +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: <20120604033943.4B3FC106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237027 - soc2012/jhagewood/mdocml/tests 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, 04 Jun 2012 03:39:45 -0000 Author: jhagewood Date: Mon Jun 4 03:39:43 2012 New Revision: 237027 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237027 Log: Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh ============================================================================== --- soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Mon Jun 4 03:34:31 2012 (r237026) +++ soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Mon Jun 4 03:39:43 2012 (r237027) @@ -6,25 +6,24 @@ mkdir $HOME/Documents/man_pages cd $HOME/Documents/man_pages/ -find /usr/src/ \( -name "*.1" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.2" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.3" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.4" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.5" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.6" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.7" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.8" \) -type f >> ./manpaths.txt -find /usr/src/ \( -name "*.man" \) -type f >> ./manpaths.txt -echo "EOL" >> ./manpaths.txt - +find ./man \( -name "*.1" \) -type f >> ./manpaths.txt +find ./man \( -name "*.2" \) -type f >> ./manpaths.txt +find ./man \( -name "*.3" \) -type f >> ./manpaths.txt +find ./man \( -name "*.4" \) -type f >> ./manpaths.txt +find ./man \( -name "*.5" \) -type f >> ./manpaths.txt +find ./man \( -name "*.6" \) -type f >> ./manpaths.txt +find ./man \( -name "*.7" \) -type f >> ./manpaths.txt +find ./man \( -name "*.8" \) -type f >> ./manpaths.txt +find ./man \( -name "*.man" \) -type f >> ./manpaths.txt +echo "EOF" >> ./manpaths.txt num_lines=$(cat ./manpaths.txt | grep -c .) current_doc="." - -while [ ! current_doc == "EOL" ] +exit +while [ ! current_doc == "EOF" ] do current_doc=$(tail -n $num_lines ./manpaths.txt) sed -n '2,$p' ./manpaths.txt > ./manpaths.txt - mandoc -Tpdf -Ostyle=style.css $current_doc 2> ./mdocml-manpage-errors.txt >> ./out.pdf + mandoc -Tpdf -Ostyle=style.css $current_doc 2> ./mdocml-manpage-errors.txt >> /dev/null num_lines=$(cat ./manpaths.txt | grep -c .) done From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 03:42:43 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 8F0F21065670 for ; Mon, 4 Jun 2012 03:42:41 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 03:42:41 +0000 Date: Mon, 04 Jun 2012 03:42:41 +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: <20120604034241.8F0F21065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237028 - soc2012/jhagewood/mdocml/tests 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, 04 Jun 2012 03:42:43 -0000 Author: jhagewood Date: Mon Jun 4 03:42:41 2012 New Revision: 237028 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237028 Log: Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh ============================================================================== --- soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Mon Jun 4 03:39:43 2012 (r237027) +++ soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Mon Jun 4 03:42:41 2012 (r237028) @@ -18,7 +18,7 @@ echo "EOF" >> ./manpaths.txt num_lines=$(cat ./manpaths.txt | grep -c .) current_doc="." -exit + while [ ! current_doc == "EOF" ] do current_doc=$(tail -n $num_lines ./manpaths.txt) From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 03:43:55 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 A2886106566B for ; Mon, 4 Jun 2012 03:43:54 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 03:43:54 +0000 Date: Mon, 04 Jun 2012 03:43:54 +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: <20120604034354.A2886106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237029 - soc2012/jhagewood/mdocml 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, 04 Jun 2012 03:43:55 -0000 Author: jhagewood Date: Mon Jun 4 03:43:54 2012 New Revision: 237029 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237029 Log: Deleted: soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 03:44:14 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 8CCB31065672 for ; Mon, 4 Jun 2012 03:44:12 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 03:44:12 +0000 Date: Mon, 04 Jun 2012 03:44:12 +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: <20120604034412.8CCB31065672@hub.freebsd.org> Cc: Subject: socsvn commit: r237030 - soc2012/jhagewood/mdocml 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, 04 Jun 2012 03:44:14 -0000 Author: jhagewood Date: Mon Jun 4 03:44:12 2012 New Revision: 237030 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237030 Log: Added: soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt Added: soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-manpage-errors.txt Mon Jun 4 03:44:12 2012 (r237030) @@ -0,0 +1,20 @@ +./man/man1/ps.1:309:2: FATAL: argument count wrong, violates syntax: columns == 2 (have 4) +./man/man1/awk.1:473:2: FATAL: line scope broken, syntax violated +./man/man1/nawk.1:473:2: FATAL: line scope broken, syntax violated +./man/man1/file.1:178:16: FATAL: argument count wrong, violates syntax +./man/man1/opiekey.1:120:2: FATAL: line scope broken, syntax violated +./man/man1/otp-md4.1:120:2: FATAL: line scope broken, syntax violated +./man/man1/otp-md5.1:120:2: FATAL: line scope broken, syntax violated +./man/man1/otp-sha.1:120:2: FATAL: line scope broken, syntax violated +./man/man1/opiepasswd.1:57:2: FATAL: line scope broken, syntax violated +./man/man3/acl_add_flag_np.3:55:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +./man/man3/acl_add_perm.3:62:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +./man/man3/acl_set_entry_type_np.3:53:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +./man/man3/acl_set_tag_type.3:53:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +./man/man3/acl_to_text.3:71:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +./man/man3/acl_to_text_np.3:71:2: FATAL: argument count wrong, violates syntax: columns == 1 (have 3) +./man/man3/form_field_opts.3:110:2: FATAL: line scope broken, syntax violated +./man/man3/field_opts.3:110:2: FATAL: line scope broken, syntax violated +./man/man3/field_opts_off.3:110:2: FATAL: line scope broken, syntax violated +./man/man3/field_opts_on.3:110:2: FATAL: line scope broken, syntax violated +./man/man3/set_field_opts.3:110:2: FATAL: line scope broken, syntax violated From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 05:41:58 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 639F11065672 for ; Mon, 4 Jun 2012 05:41:56 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 05:41:56 +0000 Date: Mon, 04 Jun 2012 05:41:56 +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: <20120604054156.639F11065672@hub.freebsd.org> Cc: Subject: socsvn commit: r237033 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 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, 04 Jun 2012 05:41:58 -0000 Author: jhagewood Date: Mon Jun 4 05:41:55 2012 New Revision: 237033 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237033 Log: Modified: soc2012/jhagewood/mdocml/hagewood-mdocml.patch soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c Modified: soc2012/jhagewood/mdocml/hagewood-mdocml.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml.patch Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/hagewood-mdocml.patch Mon Jun 4 05:41:55 2012 (r237033) @@ -1,221 +1,61 @@ -diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/libmandoc.h jhagewood/mdocml/mdocml-1.12.1/libmandoc.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/libmandoc.h 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/libmandoc.h 2012-06-02 06:16:40.000000000 -0400 -@@ -31,6 +31,7 @@ enum rofferr { - - enum regs { - REG_nS = 0, /* nS register */ -+ REG_ns = 0, /* ns register (no-space) */ - REG__MAX - }; - -diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_html.c jhagewood/mdocml/mdocml-1.12.1/man_html.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_html.c 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_html.c 2012-06-02 06:45:04.000000000 -0400 -@@ -27,6 +27,7 @@ - #include - - #include "mandoc.h" -+#include "libmandoc.h" - #include "out.h" - #include "html.h" - #include "man.h" -@@ -134,7 +135,8 @@ print_bvspace(struct html *h, const stru - if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok) - if (NULL == n->prev) - return; -- -+ if (REG_ns) -+ return; - print_otag(h, TAG_P, 0, NULL); - } - +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-01 05:35:15.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-04 04:47:34.000000000 -0400 +@@ -43,6 +43,8 @@ enum mant { + MAN_sp, + MAN_nf, + MAN_fi, ++ MAN_ns, ++ MAN_rs, + MAN_RE, + MAN_RS, + MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-02 06:51:05.000000000 -0400 -@@ -28,6 +28,7 @@ - #include - - #include "mandoc.h" -+#include "libmandoc.h" - #include "out.h" - #include "man.h" - #include "term.h" -@@ -455,13 +456,14 @@ pre_sp(DECL_ARGS) - len = n->child ? a2height(p, n->child->string) : 1; - break; - } -- -- if (0 == len) -- term_newln(p); -- for (i = 0; i < len; i++) -- term_vspace(p); -- -- return(0); -+ if (!REG_ns) -+ { -+ if (0 == len) -+ term_newln(p); -+ for (i = 0; i < len; i++) -+ term_vspace(p); -+ } -+ return(0); - } - - -diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_html.c jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_html.c 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c 2012-06-02 06:46:47.000000000 -0400 -@@ -28,6 +28,7 @@ - #include - - #include "mandoc.h" -+#include "libmandoc.h" - #include "out.h" - #include "html.h" - #include "mdoc.h" -@@ -1614,27 +1615,27 @@ mdoc_pp_pre(MDOC_ARGS) - static int - mdoc_sp_pre(MDOC_ARGS) - { -- struct roffsu su; -- struct htmlpair tag; -+ struct roffsu su; -+ struct htmlpair tag; - -- SCALE_VS_INIT(&su, 1); -+ SCALE_VS_INIT(&su, 1); - -- if (MDOC_sp == n->tok) { -- if (NULL != (n = n->child)) -- if ( ! a2roffsu(n->string, &su, SCALE_VS)) -- SCALE_VS_INIT(&su, atoi(n->string)); -- } else -- su.scale = 0; -+ if (MDOC_sp == n->tok) { -+ if (NULL != (n = n->child)) -+ if ( ! a2roffsu(n->string, &su, SCALE_VS)) -+ SCALE_VS_INIT(&su, atoi(n->string)); -+ } else -+ su.scale = 0; - -- bufinit(h); -- bufcat_su(h, "height", &su); -- PAIR_STYLE_INIT(&tag, h); -- print_otag(h, TAG_DIV, 1, &tag); -- -- /* So the div isn't empty: */ -- print_text(h, "\\~"); -+ bufinit(h); -+ bufcat_su(h, "height", &su); -+ PAIR_STYLE_INIT(&tag, h); -+ if (!REG_ns) -+ print_otag(h, TAG_DIV, 1, &tag); - -- return(0); -+ /* So the div isn't empty: */ -+ print_text(h, "\\~"); -+ return(0); - - } - -diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c 2012-06-02 06:47:03.000000000 -0400 -@@ -29,6 +29,7 @@ - #include - - #include "mandoc.h" -+#include "libmandoc.h" - #include "out.h" - #include "term.h" - #include "mdoc.h" -@@ -1882,12 +1883,13 @@ termp_sp_pre(DECL_ARGS) - len = 1; - break; - } -- -- if (0 == len) -- term_newln(p); -- for (i = 0; i < len; i++) -- term_vspace(p); -- -+ if (!REG_ns) -+ { -+ if (0 == len) -+ term_newln(p); -+ for (i = 0; i < len; i++) -+ term_vspace(p); -+ } ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-04 05:04:08.000000000 -0400 +@@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); + static int pre_ft(DECL_ARGS); + static int pre_ign(DECL_ARGS); + static int pre_in(DECL_ARGS); ++static int pre_ns(DECL_ARGS); ++static int pre_rs(DECL_ARGS); + static int pre_literal(DECL_ARGS); + static int pre_sp(DECL_ARGS); + +@@ -125,6 +127,8 @@ static const struct termact termacts[MAN + { pre_ign, NULL, 0 }, /* PD */ + { pre_ign, NULL, 0 }, /* AT */ + { pre_in, NULL, MAN_NOTEXT }, /* in */ ++ { pre_ns, NULL, MAN_NOTEXT }, /* ns */ ++ { pre_rs, NULL, MAN_NOTEXT }, /* rs */ + { pre_ft, NULL, MAN_NOTEXT }, /* ft */ + { pre_OP, NULL, 0 }, /* OP */ + }; +@@ -433,6 +437,27 @@ pre_in(DECL_ARGS) return(0); } -diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/roff.c jhagewood/mdocml/mdocml-1.12.1/roff.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/roff.c 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/roff.c 2012-06-02 06:51:16.000000000 -0400 -@@ -55,6 +55,7 @@ enum rofft { - ROFF_ns, - ROFF_ps, - ROFF_rm, -+ ROFF_rs, - ROFF_so, - ROFF_ta, - ROFF_tr, -@@ -182,6 +183,7 @@ static const char *roff_getstrn(const st - const char *, size_t); - static enum rofferr roff_line_ignore(ROFF_ARGS); - static enum rofferr roff_nr(ROFF_ARGS); -+static enum rofferr roff_ns(ROFF_ARGS); - static void roff_openeqn(struct roff *, const char *, - int, int, const char *); - static enum rofft roff_parse(struct roff *, const char *, int *); -@@ -189,6 +191,7 @@ static enum rofferr roff_parsetext(char - static enum rofferr roff_res(struct roff *, - char **, size_t *, int, int); - static enum rofferr roff_rm(ROFF_ARGS); -+static enum rofferr roff_rs(ROFF_ARGS); - static void roff_setstr(struct roff *, - const char *, const char *, int); - static void roff_setstrn(struct roffkv **, const char *, -@@ -228,9 +231,10 @@ static struct roffmac roffs[ROFF_MAX] = - { "ne", roff_line_ignore, NULL, NULL, 0, NULL }, - { "nh", roff_line_ignore, NULL, NULL, 0, NULL }, - { "nr", roff_nr, NULL, NULL, 0, NULL }, -- { "ns", roff_line_ignore, NULL, NULL, 0, NULL }, -+ { "ns", roff_ns, NULL, NULL, 0, NULL }, - { "ps", roff_line_ignore, NULL, NULL, 0, NULL }, - { "rm", roff_rm, NULL, NULL, 0, NULL }, -+ { "rs", roff_rs, NULL, NULL, 0, NULL }, - { "so", roff_so, NULL, NULL, 0, NULL }, - { "ta", roff_line_ignore, NULL, NULL, 0, NULL }, - { "tr", roff_tr, NULL, NULL, 0, NULL }, -@@ -1256,6 +1260,14 @@ roff_nr(ROFF_ARGS) - return(ROFF_IGN); - } - -+static enum rofferr -+roff_ns(ROFF_ARGS) ++/* ARGSUSED */ ++static int ++pre_ns(DECL_ARGS) +{ -+ /* Sets no-space register to 1. (on) */ -+ r->regs[(int)REG_ns].set = 1; -+ return(ROFF_IGN); ++ ++ if ( ! (MAN_LINE & n->flags)) ++ p->flags |= TERMP_NOSPACE; ++ return(1); +} + - /* ARGSUSED */ - static enum rofferr - roff_rm(ROFF_ARGS) -@@ -1272,6 +1284,14 @@ roff_rm(ROFF_ARGS) - return(ROFF_IGN); - } - -+static enum rofferr -+roff_rs(ROFF_ARGS) ++/* ARGSUSED */ ++static int ++pre_rs(DECL_ARGS) +{ -+ /* Sets no-space register to 0. */ -+ roff_regunset(r, REG_ns); -+ return(ROFF_IGN); ++ /* ++ if (SEC_SEE_ALSO != n->sec) ++ return(1); ++ if (MAN_BLOCK == n->type && n->prev) ++ term_vspace(p); */ ++ return(1); +} -+ + /* ARGSUSED */ - static enum rofferr - roff_TE(ROFF_ARGS) + static int Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h Mon Jun 4 05:41:55 2012 (r237033) @@ -31,7 +31,6 @@ enum regs { REG_nS = 0, /* nS register */ - REG_ns = 0, /* ns register (no-space) */ REG__MAX }; Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h Mon Jun 4 05:41:55 2012 (r237033) @@ -43,6 +43,8 @@ MAN_sp, MAN_nf, MAN_fi, + MAN_ns, + MAN_rs, MAN_RE, MAN_RS, MAN_DT, Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c Mon Jun 4 05:41:55 2012 (r237033) @@ -27,7 +27,6 @@ #include #include "mandoc.h" -#include "libmandoc.h" #include "out.h" #include "html.h" #include "man.h" @@ -135,8 +134,7 @@ if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok) if (NULL == n->prev) return; - if (REG_ns) - return; + print_otag(h, TAG_P, 0, NULL); } Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c Mon Jun 4 05:41:55 2012 (r237033) @@ -28,7 +28,6 @@ #include #include "mandoc.h" -#include "libmandoc.h" #include "out.h" #include "man.h" #include "term.h" @@ -83,6 +82,8 @@ static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); static int pre_in(DECL_ARGS); +static int pre_ns(DECL_ARGS); +static int pre_rs(DECL_ARGS); static int pre_literal(DECL_ARGS); static int pre_sp(DECL_ARGS); @@ -126,6 +127,8 @@ { pre_ign, NULL, 0 }, /* PD */ { pre_ign, NULL, 0 }, /* AT */ { pre_in, NULL, MAN_NOTEXT }, /* in */ + { pre_ns, NULL, MAN_NOTEXT }, /* ns */ + { pre_rs, NULL, MAN_NOTEXT }, /* rs */ { pre_ft, NULL, MAN_NOTEXT }, /* ft */ { pre_OP, NULL, 0 }, /* OP */ }; @@ -434,6 +437,27 @@ return(0); } +/* ARGSUSED */ +static int +pre_ns(DECL_ARGS) +{ + + if ( ! (MAN_LINE & n->flags)) + p->flags |= TERMP_NOSPACE; + return(1); +} + +/* ARGSUSED */ +static int +pre_rs(DECL_ARGS) +{ + /* + if (SEC_SEE_ALSO != n->sec) + return(1); + if (MAN_BLOCK == n->type && n->prev) + term_vspace(p); */ + return(1); +} /* ARGSUSED */ static int @@ -456,14 +480,13 @@ len = n->child ? a2height(p, n->child->string) : 1; break; } - if (!REG_ns) - { - if (0 == len) - term_newln(p); - for (i = 0; i < len; i++) - term_vspace(p); - } - return(0); + + if (0 == len) + term_newln(p); + for (i = 0; i < len; i++) + term_vspace(p); + + return(0); } Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c Mon Jun 4 05:41:55 2012 (r237033) @@ -28,7 +28,6 @@ #include #include "mandoc.h" -#include "libmandoc.h" #include "out.h" #include "html.h" #include "mdoc.h" @@ -1615,27 +1614,27 @@ static int mdoc_sp_pre(MDOC_ARGS) { - struct roffsu su; - struct htmlpair tag; + struct roffsu su; + struct htmlpair tag; - SCALE_VS_INIT(&su, 1); + SCALE_VS_INIT(&su, 1); - if (MDOC_sp == n->tok) { - if (NULL != (n = n->child)) - if ( ! a2roffsu(n->string, &su, SCALE_VS)) - SCALE_VS_INIT(&su, atoi(n->string)); - } else - su.scale = 0; + if (MDOC_sp == n->tok) { + if (NULL != (n = n->child)) + if ( ! a2roffsu(n->string, &su, SCALE_VS)) + SCALE_VS_INIT(&su, atoi(n->string)); + } else + su.scale = 0; - bufinit(h); - bufcat_su(h, "height", &su); - PAIR_STYLE_INIT(&tag, h); - if (!REG_ns) - print_otag(h, TAG_DIV, 1, &tag); + bufinit(h); + bufcat_su(h, "height", &su); + PAIR_STYLE_INIT(&tag, h); + print_otag(h, TAG_DIV, 1, &tag); - /* So the div isn't empty: */ - print_text(h, "\\~"); - return(0); + /* So the div isn't empty: */ + print_text(h, "\\~"); + + return(0); } Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c Mon Jun 4 05:41:55 2012 (r237033) @@ -29,7 +29,6 @@ #include #include "mandoc.h" -#include "libmandoc.h" #include "out.h" #include "term.h" #include "mdoc.h" @@ -1883,13 +1882,12 @@ len = 1; break; } - if (!REG_ns) - { - if (0 == len) - term_newln(p); - for (i = 0; i < len; i++) - term_vspace(p); - } + + if (0 == len) + term_newln(p); + for (i = 0; i < len; i++) + term_vspace(p); + return(0); } Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c Mon Jun 4 04:24:59 2012 (r237032) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c Mon Jun 4 05:41:55 2012 (r237033) @@ -55,7 +55,6 @@ ROFF_ns, ROFF_ps, ROFF_rm, - ROFF_rs, ROFF_so, ROFF_ta, ROFF_tr, @@ -183,7 +182,6 @@ const char *, size_t); static enum rofferr roff_line_ignore(ROFF_ARGS); static enum rofferr roff_nr(ROFF_ARGS); -static enum rofferr roff_ns(ROFF_ARGS); static void roff_openeqn(struct roff *, const char *, int, int, const char *); static enum rofft roff_parse(struct roff *, const char *, int *); @@ -191,7 +189,6 @@ static enum rofferr roff_res(struct roff *, char **, size_t *, int, int); static enum rofferr roff_rm(ROFF_ARGS); -static enum rofferr roff_rs(ROFF_ARGS); static void roff_setstr(struct roff *, const char *, const char *, int); static void roff_setstrn(struct roffkv **, const char *, @@ -231,10 +228,9 @@ { "ne", roff_line_ignore, NULL, NULL, 0, NULL }, { "nh", roff_line_ignore, NULL, NULL, 0, NULL }, { "nr", roff_nr, NULL, NULL, 0, NULL }, - { "ns", roff_ns, NULL, NULL, 0, NULL }, + { "ns", roff_line_ignore, NULL, NULL, 0, NULL }, { "ps", roff_line_ignore, NULL, NULL, 0, NULL }, { "rm", roff_rm, NULL, NULL, 0, NULL }, - { "rs", roff_rs, NULL, NULL, 0, NULL }, { "so", roff_so, NULL, NULL, 0, NULL }, { "ta", roff_line_ignore, NULL, NULL, 0, NULL }, { "tr", roff_tr, NULL, NULL, 0, NULL }, @@ -1260,14 +1256,6 @@ return(ROFF_IGN); } -static enum rofferr -roff_ns(ROFF_ARGS) -{ - /* Sets no-space register to 1. (on) */ - r->regs[(int)REG_ns].set = 1; - return(ROFF_IGN); -} - /* ARGSUSED */ static enum rofferr roff_rm(ROFF_ARGS) @@ -1284,14 +1272,6 @@ return(ROFF_IGN); } -static enum rofferr -roff_rs(ROFF_ARGS) -{ - /* Sets no-space register to 0. */ - roff_regunset(r, REG_ns); - return(ROFF_IGN); -} - /* ARGSUSED */ static enum rofferr roff_TE(ROFF_ARGS) From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 10:10:43 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 E62B0106566C for ; Mon, 4 Jun 2012 10:10:40 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 10:10:40 +0000 Date: Mon, 04 Jun 2012 10:10:40 +0000 From: scher@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: <20120604101040.E62B0106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237052 - soc2012/scher/par_ports/head/Mk 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, 04 Jun 2012 10:10:43 -0000 Author: scher Date: Mon Jun 4 10:10:38 2012 New Revision: 237052 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237052 Log: Merge with current ports collection Mk/* files [bugfix] "{DO_NADA}: not found" error fixed in bsd.port.mk Added: soc2012/scher/par_ports/head/Mk/bsd.options.desc.mk soc2012/scher/par_ports/head/Mk/bsd.options.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.apache.mk soc2012/scher/par_ports/head/Mk/bsd.autotools.mk soc2012/scher/par_ports/head/Mk/bsd.cmake.mk soc2012/scher/par_ports/head/Mk/bsd.commands.mk soc2012/scher/par_ports/head/Mk/bsd.database.mk soc2012/scher/par_ports/head/Mk/bsd.destdir.mk soc2012/scher/par_ports/head/Mk/bsd.gcc.mk soc2012/scher/par_ports/head/Mk/bsd.gecko.mk soc2012/scher/par_ports/head/Mk/bsd.gnome.mk soc2012/scher/par_ports/head/Mk/bsd.gnustep.mk soc2012/scher/par_ports/head/Mk/bsd.gstreamer.mk soc2012/scher/par_ports/head/Mk/bsd.java.mk soc2012/scher/par_ports/head/Mk/bsd.kde.mk soc2012/scher/par_ports/head/Mk/bsd.kde4.mk soc2012/scher/par_ports/head/Mk/bsd.ldap.mk soc2012/scher/par_ports/head/Mk/bsd.licenses.db.mk soc2012/scher/par_ports/head/Mk/bsd.licenses.mk soc2012/scher/par_ports/head/Mk/bsd.linux-apps.mk soc2012/scher/par_ports/head/Mk/bsd.linux-rpm.mk soc2012/scher/par_ports/head/Mk/bsd.local.mk soc2012/scher/par_ports/head/Mk/bsd.lua.mk soc2012/scher/par_ports/head/Mk/bsd.mail.mk soc2012/scher/par_ports/head/Mk/bsd.octave.mk soc2012/scher/par_ports/head/Mk/bsd.parallel.mk soc2012/scher/par_ports/head/Mk/bsd.perl.mk soc2012/scher/par_ports/head/Mk/bsd.php.mk soc2012/scher/par_ports/head/Mk/bsd.pkgng.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk soc2012/scher/par_ports/head/Mk/bsd.port.options.mk soc2012/scher/par_ports/head/Mk/bsd.port.subdir.mk soc2012/scher/par_ports/head/Mk/bsd.python.mk soc2012/scher/par_ports/head/Mk/bsd.qt.mk soc2012/scher/par_ports/head/Mk/bsd.scons.mk soc2012/scher/par_ports/head/Mk/bsd.sdl.mk soc2012/scher/par_ports/head/Mk/bsd.sites.mk soc2012/scher/par_ports/head/Mk/bsd.tcl.mk soc2012/scher/par_ports/head/Mk/bsd.wx.mk soc2012/scher/par_ports/head/Mk/bsd.xfce.mk soc2012/scher/par_ports/head/Mk/bsd.xorg.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.apache.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.apache.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.apache.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.apache.mk,v 1.35 2012/01/11 20:09:27 ohauer Exp $ +# $FreeBSD: ports/Mk/bsd.apache.mk,v 1.36 2012/05/23 08:17:48 miwi Exp $ # # bsd.apache.mk - Apache related macros. # Author: Clement Laforet Modified: soc2012/scher/par_ports/head/Mk/bsd.autotools.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.autotools.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.autotools.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.autotools.mk,v 1.41 2012/05/11 20:38:01 ade Exp $ +# $FreeBSD: ports/Mk/bsd.autotools.mk,v 1.42 2012/05/23 08:17:48 miwi Exp $ # # Please view me with 4 column tabs! # Modified: soc2012/scher/par_ports/head/Mk/bsd.cmake.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.cmake.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.cmake.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,4 +1,4 @@ -#-*- mode: Makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # USE_CMAKE - If set, this port uses cmake. @@ -26,7 +26,7 @@ # Default: ${PREFIX} # # -# $FreeBSD: ports/Mk/bsd.cmake.mk,v 1.13 2011/11/10 19:50:26 rakuco Exp $ +# $FreeBSD: ports/Mk/bsd.cmake.mk,v 1.14 2012/05/23 08:17:48 miwi Exp $ CMAKE_MAINTAINER= kde@FreeBSD.org Modified: soc2012/scher/par_ports/head/Mk/bsd.commands.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.commands.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.commands.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,11 +1,11 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # bsd.commands.mk - Common commands used within the ports infrastructure # # Created by: Gabor Kovesdan # -# $FreeBSD: ports/Mk/bsd.commands.mk,v 1.10 2012/02/22 17:34:47 bapt Exp $ +# $FreeBSD: ports/Mk/bsd.commands.mk,v 1.11 2012/05/23 08:17:48 miwi Exp $ # # DO NOT COMMIT CHANGES TO THIS FILE BY YOURSELF, EVEN IF YOU DID NOT GET # A RESPONSE FROM THE MAINTAINER(S) WITHIN A REASONABLE TIMEFRAME! ALL Modified: soc2012/scher/par_ports/head/Mk/bsd.database.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.database.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.database.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -# -*- mode: Makefile; tab-width: 4; -*- +# -*- tab-width: 4; -*- # ex: ts=4 # -# $FreeBSD: ports/Mk/bsd.database.mk,v 1.74 2012/05/15 22:14:54 girgen Exp $ +# $FreeBSD: ports/Mk/bsd.database.mk,v 1.75 2012/05/23 08:17:48 miwi Exp $ # .if defined(_POSTMKINCLUDED) && !defined(Database_Post_Include) Modified: soc2012/scher/par_ports/head/Mk/bsd.destdir.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.destdir.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.destdir.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,11 +1,11 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # bsd.destdir.mk - Support for chrooted installation # # Created by: Gabor Kovesdan # -# $FreeBSD: ports/Mk/bsd.destdir.mk,v 1.3 2011/01/25 13:39:44 pav Exp $ +# $FreeBSD: ports/Mk/bsd.destdir.mk,v 1.4 2012/05/23 08:17:48 miwi Exp $ # # Please make sure all changes to this file are passed through the maintainer. Modified: soc2012/scher/par_ports/head/Mk/bsd.gcc.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.gcc.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.gcc.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,4 +1,4 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # bsd.gcc.mk - Support for smarter USE_GCC usage. @@ -29,7 +29,7 @@ # If you are wondering what your port exactly does, use "make test-gcc" # to see some debugging. # -# $FreeBSD: ports/Mk/bsd.gcc.mk,v 1.63 2012/04/29 12:20:17 gerald Exp $ +# $FreeBSD: ports/Mk/bsd.gcc.mk,v 1.64 2012/05/23 08:17:48 miwi Exp $ # GCC_Include_MAINTAINER= gerald@FreeBSD.org Modified: soc2012/scher/par_ports/head/Mk/bsd.gecko.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.gecko.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.gecko.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,10 +1,10 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # Date created: 12 Nov 2005 # Whom: Michael Johnson # -# $FreeBSD: ports/Mk/bsd.gecko.mk,v 1.57 2012/05/12 16:23:08 beat Exp $ +# $FreeBSD: ports/Mk/bsd.gecko.mk,v 1.59 2012/06/01 05:15:42 dinoex Exp $ # # 4 column tabs prevent hair loss and tooth decay! @@ -595,7 +595,7 @@ nss_LDFLAGS+= -L${LOCALBASE}/lib/nss -Wl,-rpath,${PREFIX}/lib/${MOZ_RPATH} -png_LIB_DEPENDS= png.6:${PORTSDIR}/graphics/png +png_LIB_DEPENDS= png15:${PORTSDIR}/graphics/png png_MOZ_OPTIONS= --with-system-png=${LOCALBASE} xft_LIB_DEPENDS= Xft.2:${PORTSDIR}/x11-fonts/libXft Modified: soc2012/scher/par_ports/head/Mk/bsd.gnome.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.gnome.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.gnome.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.gnome.mk,v 1.173 2011/08/12 08:03:18 kwm Exp $ +# $FreeBSD: ports/Mk/bsd.gnome.mk,v 1.174 2012/05/23 08:17:48 miwi Exp $ # $NetBSD: $ # $MCom: ports/Mk/bsd.gnome.mk,v 1.549 2011/06/10 22:16:59 mezz Exp $ # Modified: soc2012/scher/par_ports/head/Mk/bsd.gnustep.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.gnustep.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.gnustep.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,5 +1,5 @@ # -# $FreeBSD: ports/Mk/bsd.gnustep.mk,v 1.70 2012/01/16 18:55:36 dinoex Exp $ +# $FreeBSD: ports/Mk/bsd.gnustep.mk,v 1.71 2012/06/01 09:59:53 dinoex Exp $ # # This file contains some variable definitions that are supposed to # make your life easier when dealing with ports related to the GNUstep. @@ -201,7 +201,7 @@ GNUSTEP_WITH_GCC42=yes .endif .endif -.if !exists(${DESTDIR}/usr/lib/libobjc.so) +.if !exists(${DESTDIR}/usr/lib/libobjc.so) GNUSTEP_WITH_GCC42=yes .endif .endif Modified: soc2012/scher/par_ports/head/Mk/bsd.gstreamer.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.gstreamer.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.gstreamer.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,4 +1,4 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # bsd.gstreamer.mk - Support for gstreamer-plugins-based ports. @@ -6,7 +6,7 @@ # Created by: Michael Johnson # Date: 4 Oct 2004 # -# $FreeBSD: ports/Mk/bsd.gstreamer.mk,v 1.51 2012/04/09 22:34:35 bapt Exp $ +# $FreeBSD: ports/Mk/bsd.gstreamer.mk,v 1.52 2012/05/23 08:17:48 miwi Exp $ # $MCom: ports/Mk/bsd.gstreamer.mk,v 1.43 2008/03/21 04:14:18 ahze Exp $ .if !defined(_POSTMKINCLUDED) && !defined(Gstreamer_Pre_Include) Modified: soc2012/scher/par_ports/head/Mk/bsd.java.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.java.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.java.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,4 +1,4 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # # bsd.java.mk - Support for Java-based ports. @@ -9,7 +9,7 @@ # Please send all suggested changes to the maintainer instead of committing # them to CVS yourself. # -# $FreeBSD: ports/Mk/bsd.java.mk,v 1.93 2012/04/13 04:03:42 glewis Exp $ +# $FreeBSD: ports/Mk/bsd.java.mk,v 1.94 2012/05/23 08:17:48 miwi Exp $ # .if !defined(Java_Include) Modified: soc2012/scher/par_ports/head/Mk/bsd.kde.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.kde.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.kde.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: Makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.kde.mk,v 1.82 2011/09/23 22:20:46 amdmi3 Exp $ +# $FreeBSD: ports/Mk/bsd.kde.mk,v 1.83 2012/05/23 08:17:48 miwi Exp $ # # Please view me with 4 column tabs! Modified: soc2012/scher/par_ports/head/Mk/bsd.kde4.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.kde4.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.kde4.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,180 +1,312 @@ -#-*- mode: Makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.kde4.mk,v 1.127 2012/02/24 13:34:28 avilla Exp $ +# $FreeBSD: ports/Mk/bsd.kde4.mk,v 1.131 2012/05/31 00:09:11 avilla Exp $ # .if !defined(_POSTMKINCLUDED) && !defined(Kde_Pre_Include) # Please make sure all changes to this file are past through the maintainer. # Do not commit them yourself (unless of course you're the Port's Wraith ;). -Kde_Pre_Include= bsd.kde4.mk Kde_Include_MAINTAINER= kde@FreeBSD.org +Kde_Pre_Include= bsd.kde4.mk # -# This file contains some variable definitions that are supposed to -# make your life easier when dealing with ports related to the KDE4 -# desktop environment. It's automatically included when USE_KDE4 -# is defined in the ports' makefile. +# This file contains some variable definitions that are supposed to make your +# life easier when dealing with ports related to the KDE Software Compilation 4. +# It's automatically included when ${USE_KDE4} is defined in a port's Makefile. # # KDE4 related ports can use this as follows: # -# USE_KDE4= kdehier kdeprefix kdelibs -# USE_QT_VER= 4 -# QT_COMPONENTS=corelib #set additional qt4 components here +# USE_KDE4= kdehier kdelibs kdeprefix +# USE_QT4= corelib # Set Qt 4 components here. # # .include # +# Additionally, '_build' and '_run' suffixes can be used to force components +# dependency type (e.g., 'marble_run'). If no suffix is set, a default +# dependency type will be used. If you want to force both types, add the +# component twice with both suffixes (e.g., 'pykde4_build pykde4_run'). +# # Available KDE4 components are: # -# akonadi - Akonadi PIM storage service -# automoc4 - automoc4 tool -# baseapps - Basic KDE applications (Konqueror, Dolphin) -# kdeexp - experimental libraries (with non-stable ABI/API) -# kdehier - Provides common KDE directories -# kdelibs - The base set of KDE libraries -# kdeprefix - If set, port will be installed into ${KDE4_PREFIX} instead of ${LOCALBASE} -# oxygen - icon themes -# pimlibs - KDE PIM libraries -# pimruntime - KDE PIM runtime services -# pykde4 - Python bindings for KDE -# pykdeuic4 - User Interface Compiler for PyKDE -# runtime - More KDE applications -# sharedmime - share-mime-info wrapper for KDE ports -# workspace - More KDE applications (Plasma, kwin, etc.) +# baseapps - Basic applications for KDE Desktop +# kate - KDE text editor framework +# kdehier - Hierarchy of common KDE directories +# kdelibs - KDE Developer Platform +# kdeprefix - If set, port will be installed into ${KDE4_PREFIX} instead of +# ${LOCALBASE} +# korundum - KDE Ruby bindings +# libkdcraw - KDE LibRaw library +# libkdeedu - Libraries used by KDE educational applications +# libkexiv2 - KDE Exiv2 library +# libkipi - KDE Image Plugin Interface +# libkonq - Konqueror core library +# libksane - KDE SANE library +# marble - KDE virtual globe +# okular - KDE universal document viewer +# oxygen - KDE icon theme +# perlkde - KDE Perl bindings +# perlqt - Qt 4 Perl bindings +# pimlibs - KDE-Pim libraries +# pykde4 - KDE Python bindings +# pykdeuic4 - PyKDE user interface compiler +# qtruby - Qt 4 Ruby bindings +# runtime - Components required by many KDE Applications +# sharedmime - MIME types database for KDE ports +# smokegen - SMOKE base libraries +# smokekde - KDE SMOKE libraries +# smokeqt - Qt 4 SMOKE libraries +# workspace - KDE user environments +# akonadi - Storage server for KDE-Pim +# attica - Qt library implementing Open Collaboration Services API +# automoc4 - Automatic moc for Qt 4 packages +# ontologies - Shared ontologies for semantic searching +# qimageblitz - KDE graphical effects and filters library +# soprano - Qt 4 RDF framework +# strigi - Desktop search daemon # -# These read-only variables can be used in port Makefile: +# These read-only variables can be used in a port's Makefile: # # MASTER_SITE_KDE_kde -# - MASTER_SITE_KDE_kde is equivalent to MASTER_SITE_KDE -# with :kde tag. It could be used when port needs multiple -# distfiles from different sites. See for details porters-handbook: -# http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html -# KDE4_PREFIX - The place where KDE4 ports live. Currently it is {LOCALBASE}/kde4, -# but this could be changed in a future. +# - It is equivalent to ${MASTER_SITE_KDE} with :kde tag. It could +# be used when port needs multiple distfiles from different +# sites. See for details the Porter's Handbook: +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-distfiles.html +# KDE4_PREFIX - The place where KDE4 ports live. Currently it is +# ${LOCALBASE}/kde4, but this could change in the future. # -KDE4_VERSION= 4.7.4 -KDE4_BRANCH?= stable -KDEPIM4_VERSION= 4.4.11.1 -KDEPIM4_BRANCH?= stable -KOFFICE2_VERSION= 2.3.2 -KOFFICE2_BRANCH?= stable -KDEVELOP_VERSION= 4.2.3 -KDEVELOP_BRANCH?= stable +KDE4_VERSION?= 4.8.3 +KDE4_BRANCH?= stable +CALLIGRA_VERSION?= 2.4.2 +CALLIGRA_BRANCH?= stable +KDEVELOP_VERSION?= 4.3.1 +KDEVELOP_BRANCH?= stable # -# KDE4 is installed into its own prefix to not conflict with KDE3 +# KDE4 is installed into its own prefix to avoid conflicting with KDE3. # -KDE4_PREFIX?= ${LOCALBASE}/kde4 + +KDE4_PREFIX?= ${LOCALBASE}/kde4 # -# Tagged MASTER_SITE_KDE +# Common definitions for KDE4 ports. # -kmaster= ${MASTER_SITE_KDE:S@%/@%/:kde@g} + +# ${PREFIX} and ${NO_MTREE} have to be defined in the pre-makefile section. +.if defined(USE_KDE4) && ${USE_KDE4:Mkdeprefix} != "" +. if ${.MAKEFLAGS:MPREFIX=*} == "" +PREFIX= ${KDE4_PREFIX} +. if ${KDE4_PREFIX} != ${LOCALBASE} +NO_MTREE= yes +. endif +. endif +.endif + +# Tagged ${MASTER_SITE_KDE}. +kmaster= ${MASTER_SITE_KDE:S@%/@%/:kde@g} .if !defined(MASTER_SITE_SUBDIR) MASTER_SITE_KDE_kde= ${kmaster:S@%SUBDIR%/@@g} .else -ksub=${MASTER_SITE_SUBDIR} +ksub= ${MASTER_SITE_SUBDIR} MASTER_SITE_KDE_kde= ${kmaster:S@%SUBDIR%/@${ksub}/@g} -.endif # !defined(MASTER_SITE_SUBDIR) +.endif + +PLIST_SUB+= KDE4_PREFIX="${KDE4_PREFIX}" + +# The following definitions are not intended for usage in KDE4-dependent ports. +.if defined(KDE4_BUILDENV) + +USE_CMAKE= yes +CMAKE_SOURCE_PATH= ${WRKSRC} +USE_LDCONFIG= yes + +. if ${KDE4_BRANCH} == "unstable" +WITH_DEBUG= yes +. endif + +. if defined(WITH_DEBUG) +CMAKE_BUILD_TYPE= DebugFull +. endif + +PLIST_SUB+= KDE4_VERSION="${KDE4_VERSION}" + +CONFIGURE_WRKSRC= ${CMAKE_SOURCE_PATH}/build +BUILD_WRKSRC= ${CONFIGURE_WRKSRC} +INSTALL_WRKSRC?= ${BUILD_WRKSRC} + +post-extract: kde4-create-builddir + +kde4-create-builddir: + ${MKDIR} ${BUILD_WRKSRC} + +.endif # defined(KDE4_BUILDENV) + +.endif # !defined(_POSTMKINCLUDED) && !defined(Kde_Pre_Include) + +.if defined(_POSTMKINCLUDED) && !defined(Kde_Post_Include) + +Kde_Post_Include= bsd.kde4.mk # -# KDE4 modules +# KDE4 components. +# Set ${component}_TYPE to 'build' or 'run' to specify default dependency type +# for ${component}; otherwise, it will default to 'build run'. # -_USE_KDE4_ALL= akonadi automoc4 baseapps kdebase kdehier kdelibs kdeprefix \ - oxygen pimlibs pimruntime pykde4 pykdeuic4 runtime \ - sharedmime workspace -akonadi_LIB_DEPENDS= akonadiprotocolinternals.1:${PORTSDIR}/databases/akonadi +_USE_KDE4_ALL= baseapps kdebase kate kdehier kdelibs kdeprefix korundum \ + libkdcraw libkdeedu libkexiv2 libkipi libkonq libksane \ + marble okular oxygen perlkde perlqt pimlibs pykde4 \ + pykdeuic4 qtruby runtime sharedmime smokegen smokekde \ + smokeqt workspace +# These components are not shipped with the Software Compilation. +_USE_KDE4_ALL+= akonadi attica automoc4 ontologies qimageblitz soprano \ + strigi -automoc4_BUILD_DEPENDS= ${LOCALBASE}/bin/automoc4:${PORTSDIR}/devel/automoc4 +# Do baseapps and runtime really need to be in ${BUILD_DEPENDS}? +baseapps_PORT= x11/kde4-baseapps +baseapps_PATH= ${KDE4_PREFIX}/bin/kfmclient -baseapps_LIB_DEPENDS= konq.7:${PORTSDIR}/x11/kde4-baseapps -kdebase_LIB_DEPENDS= ${baseapps_LIB_DEPENDS} +# kdebase was replaced by baseapps. +kdebase_PORT= ${baseapps_PORT} +kdebase_PATH= ${baseapps_PATH} -kdehier_RUN_DEPENDS= kdehier4>=1:${PORTSDIR}/misc/kdehier4 +kate_PORT= editors/kate +kate_PATH= ${KDE4_PREFIX}/lib/libkateinterfaces.so.5 -kdelibs_LIB_DEPENDS= kimproxy.5:${PORTSDIR}/x11/kdelibs4 +kdehier_PORT= misc/kdehier4 +kdehier_PATH= kdehier4>=0 +kdehier_TYPE= run -kdeprefix_PREFIX= ${KDE4_PREFIX} +kdelibs_PORT= x11/kdelibs4 +kdelibs_PATH= ${KDE4_PREFIX}/lib/libkdecore.so.7 -oxygen_RUN_DEPENDS= ${KDE4_PREFIX}/share/icons/oxygen/index.theme:${PORTSDIR}/x11-themes/kde4-icons-oxygen +korundum_PORT= devel/kdebindings4-ruby-korundum +korundum_PATH= ${KDE4_PREFIX}/lib/kde4/krubypluginfactory.so +korundum_TYPE= run -pimlibs_LIB_DEPENDS= kpimutils.5:${PORTSDIR}/deskutils/kdepimlibs4 +libkdcraw_PORT= graphics/libkdcraw-kde4 +libkdcraw_PATH= ${KDE4_PREFIX}/lib/libkdcraw.so.20 -pimruntime_LIB_DEPENDS= kdepim-copy.5:${PORTSDIR}/deskutils/kdepim4-runtime +libkdeedu_PORT= misc/libkdeedu +libkdeedu_PATH= ${KDE4_PREFIX}/lib/libkeduvocdocument.so.5 -pykde4_RUN_DEPENDS= ${KDE4_PYTHON_SITELIBDIR}/PyKDE4/kdeui.so:${PORTSDIR}/devel/kdebindings4-python-pykde4 +libkexiv2_PORT= graphics/libkexiv2-kde4 +libkexiv2_PATH= ${KDE4_PREFIX}/lib/libkexiv2.so.10 -pykdeuic4_RUN_DEPENDS= ${LOCALBASE}/bin/pykdeuic4:${PORTSDIR}/devel/kdebindings4-python-pykdeuic4 +libkipi_PORT= graphics/libkipi-kde4 +libkipi_PATH= ${KDE4_PREFIX}/lib/libkipi.so.8 -runtime_BUILD_DEPENDS= ${KDE4_PREFIX}/bin/kdebugdialog:${PORTSDIR}/x11/kde4-runtime -runtime_RUN_DEPENDS= ${KDE4_PREFIX}/bin/kdebugdialog:${PORTSDIR}/x11/kde4-runtime +libkonq_PORT= x11/libkonq +libkonq_PATH= ${KDE4_PREFIX}/lib/libkonq.so.7 -sharedmime_BUILD_DEPENDS= kde4-shared-mime-info>=1:${PORTSDIR}/misc/kde4-shared-mime-info -sharedmime_RUN_DEPENDS= kde4-shared-mime-info>=1:${PORTSDIR}/misc/kde4-shared-mime-info +libksane_PORT= graphics/libksane +libksane_PATH= ${KDE4_PREFIX}/lib/libksane.so.0 -workspace_LIB_DEPENDS= kscreensaver.5:${PORTSDIR}/x11/kde4-workspace +marble_PORT= astro/marble +marble_PATH= ${KDE4_PREFIX}/lib/libmarblewidget.so.13 +okular_PORT= graphics/okular +okular_PATH= ${KDE4_PREFIX}/lib/libokularcore.so.1 -PLIST_SUB+= KDE4_PREFIX="${KDE4_PREFIX}" +oxygen_PORT= x11-themes/kde4-icons-oxygen +oxygen_PATH= ${KDE4_PREFIX}/share/icons/oxygen/index.theme +oxygen_TYPE= run -KDE4_PYTHON_SITELIBDIR= ${PYTHON_SITELIBDIR:S;${PYTHONBASE};${KDE4_PREFIX};} +perlkde_PORT= devel/kdebindings4-perl-perlkde +perlkde_PATH= ${KDE4_PREFIX}/lib/kde4/kperlpluginfactory.so +perlkde_TYPE= run -# -# Common build related stuff for kde4 ports. It's not intended for usage -# in KDE4-dependent ports -# -.if defined(KDE4_BUILDENV) +perlqt_PORT= devel/kdebindings4-perl-perlqt +perlqt_PATH= ${KDE4_PREFIX}/bin/puic4 -.if ${KDE4_BRANCH} == "unstable" -WITH_DEBUG=yes -.endif +pimlibs_PORT= deskutils/kdepimlibs4 +pimlibs_PATH= ${KDE4_PREFIX}/lib/libkpimutils.so.5 -.if defined(WITH_DEBUG) -CMAKE_BUILD_TYPE= DebugFull -.endif +pykde4_PORT= devel/kdebindings4-python-pykde4 +pykde4_PATH= ${KDE4_PREFIX}/lib/kde4/kpythonpluginfactory.so +pykde4_TYPE= run -PLIST_SUB+= KDE4_VERSION="${KDE4_VERSION}" +pykdeuic4_PORT= devel/kdebindings4-python-pykdeuic4 +pykdeuic4_PATH= ${LOCALBASE}/bin/pykdeuic4 +pykdeuic4_TYPE= run -USE_LDCONFIG= yes +qtruby_PORT= devel/kdebindings4-ruby-qtruby +qtruby_PATH= ${KDE4_PREFIX}/lib/libqtruby4shared.so.2 -USE_CMAKE= yes -CMAKE_SOURCE_PATH= ${WRKSRC} -CONFIGURE_WRKSRC= ${CMAKE_SOURCE_PATH}/build -BUILD_WRKSRC= ${CONFIGURE_WRKSRC} -INSTALL_WRKSRC?= ${BUILD_WRKSRC} +runtime_PORT= x11/kde4-runtime +runtime_PATH= ${KDE4_PREFIX}/bin/knotify4 -post-extract: kde-create-builddir +sharedmime_PORT= misc/kde4-shared-mime-info +sharedmime_PATH= kde4-shared-mime-info>=0 -kde-create-builddir: - ${MKDIR} ${BUILD_WRKSRC} +smokegen_PORT= devel/kdebindings4-smoke-smokegen +smokegen_PATH= ${KDE4_PREFIX}/lib/libsmokebase.so.3 -.endif # KDE4_BUILDENV +smokekde_PORT= devel/kdebindings4-smoke-smokekde +smokekde_PATH= ${KDE4_PREFIX}/lib/libsmokekdecore.so.3 -.endif #!defined(_POSTMKINCLUDED) && !defined(Kde_Pre_Include) +smokeqt_PORT= devel/kdebindings4-smoke-smokeqt +smokeqt_PATH= ${KDE4_PREFIX}/lib/libsmokeqtcore.so.3 -.if defined(_POSTMKINCLUDED) && !defined(Kde_Post_Include) +workspace_PORT= x11/kde4-workspace +workspace_PATH= ${KDE4_PREFIX}/lib/libkworkspace.so.5 -Kde_Post_Include= bsd.kde4.mk +akonadi_PORT= databases/akonadi +akonadi_PATH= ${KDE4_PREFIX}/lib/libakonadiprotocolinternals.so.1 + +attica_PORT= x11-toolkits/attica +attica_PATH= ${LOCALBASE}/lib/libattica.so.0 + +automoc4_PORT= devel/automoc4 +automoc4_PATH= ${LOCALBASE}/bin/automoc4 +automoc4_TYPE= build + +ontologies_PORT= x11-toolkits/shared-desktop-ontologies +ontologies_PATH= ${LOCALBASE}/share/ontology/core/rdf.ontology + +qimageblitz_PORT= x11/qimageblitz +qimageblitz_PATH= ${LOCALBASE}/lib/libqimageblitz.so.4 + +soprano_PORT= textproc/soprano +soprano_PATH= ${LOCALBASE}/lib/libsoprano.so.4 -.for component in ${USE_KDE4} -. if ${_USE_KDE4_ALL:M${component}}!="" -BUILD_DEPENDS+= ${${component}_BUILD_DEPENDS} -LIB_DEPENDS+= ${${component}_LIB_DEPENDS} -RUN_DEPENDS+= ${${component}_RUN_DEPENDS} -. if defined(${component}_PREFIX) -. if ${.MAKEFLAGS:MPREFIX=*}=="" -PREFIX= ${${component}_PREFIX} -. if ${KDE4_PREFIX} != ${LOCALBASE} -NO_MTREE= yes +strigi_PORT= deskutils/strigi +strigi_PATH= ${LOCALBASE}/lib/libstreamanalyzer.so.0 + +# Iterate through components deprived of suffix. +.for component in ${USE_KDE4:O:u:C/_.+//} + # Check that the component is valid. +. if ${_USE_KDE4_ALL:M${component}} != "" + # Skip meta-components (e.g., kdeprefix). +. if defined(${component}_PORT) && defined(${component}_PATH) +${component}_DEPENDS= ${${component}_PATH}:${PORTSDIR}/${${component}_PORT} + # Check if a dependency type is explicitly requested. +. if ${USE_KDE4:M${component}_*} != "" && ${USE_KDE4:M${component}} == "" +${component}_TYPE= # empty +. if ${USE_KDE4:M${component}_build} != "" +${component}_TYPE+= build +. endif +. if ${USE_KDE4:M${component}_run} != "" +${component}_TYPE+= run . endif +. endif # ${USE_KDE4:M${component}_*} != "" && ${USE_KDE4:M${component}} == "" + # If no dependency type is set, default to full dependency. +. if !defined(${component}_TYPE) +${component}_TYPE= build run . endif -. endif -. else -IGNORE= cannot install: Unknown component ${component} -. endif + # Set real dependencies. +. if ${${component}_TYPE:Mbuild} != "" +BUILD_DEPENDS+= ${${component}_DEPENDS} +. endif +. if ${${component}_TYPE:Mrun} != "" +RUN_DEPENDS+= ${${component}_DEPENDS} +. endif +. endif # defined(${component}_PORT) && defined(${component}_PATH) +. else # ! ${_USE_KDE4_ALL:M${component}} != "" +IGNORE= can't be installed: unknown USE_KDE4 component '${component}' +. endif # ${_USE_KDE4_ALL:M${component}} != "" .endfor -.endif #defined(_POSTMKINCLUDED) && !defined(Kde_Post_Include) +.endif # defined(_POSTMKINCLUDED) && !defined(Kde_Post_Include) Modified: soc2012/scher/par_ports/head/Mk/bsd.ldap.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.ldap.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.ldap.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -# -*- mode: Makefile; tab-width: 4; -*- +# -*- tab-width: 4; -*- # ex: ts=4 # -# $FreeBSD: ports/Mk/bsd.ldap.mk,v 1.9 2012/05/11 15:19:49 bapt Exp $ +# $FreeBSD: ports/Mk/bsd.ldap.mk,v 1.10 2012/05/23 08:17:49 miwi Exp $ # .if defined(_POSTMKINCLUDED) && !defined(Ldap_Post_Include) Modified: soc2012/scher/par_ports/head/Mk/bsd.licenses.db.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.licenses.db.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.licenses.db.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.licenses.db.mk,v 1.17 2012/01/09 15:40:53 tabthorpe Exp $ +# $FreeBSD: ports/Mk/bsd.licenses.db.mk,v 1.18 2012/05/23 08:17:49 miwi Exp $ Licenses_db_Include_MAINTAINER= portmgr@FreeBSD.org Modified: soc2012/scher/par_ports/head/Mk/bsd.licenses.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.licenses.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.licenses.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.licenses.mk,v 1.11 2012/03/13 17:01:54 eadler Exp $ +# $FreeBSD: ports/Mk/bsd.licenses.mk,v 1.12 2012/05/23 08:17:49 miwi Exp $ Licenses_Include_MAINTAINER= portmgr@FreeBSD.org Modified: soc2012/scher/par_ports/head/Mk/bsd.linux-apps.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.linux-apps.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.linux-apps.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: Makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.linux-apps.mk,v 1.46 2012/01/14 22:35:19 netchild Exp $ +# $FreeBSD: ports/Mk/bsd.linux-apps.mk,v 1.47 2012/05/23 08:17:49 miwi Exp $ # # Please view me with 4 column tabs! Modified: soc2012/scher/par_ports/head/Mk/bsd.linux-rpm.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.linux-rpm.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.linux-rpm.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: Makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.linux-rpm.mk,v 1.26 2011/04/18 13:07:21 netchild Exp $ +# $FreeBSD: ports/Mk/bsd.linux-rpm.mk,v 1.27 2012/05/23 08:17:49 miwi Exp $ # # Variables: Modified: soc2012/scher/par_ports/head/Mk/bsd.local.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.local.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.local.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,11 +1,11 @@ -# -*- mode: Makefile; tab-width: 4; -*- +# -*- tab-width: 4; -*- # ex: ts=4 # # bsd.local.mk - Sandbox for local modification to ports framework. # # Created by: Mark Linimon # -# $FreeBSD: ports/Mk/bsd.local.mk,v 1.2 2006/12/10 18:15:33 linimon Exp $ +# $FreeBSD: ports/Mk/bsd.local.mk,v 1.3 2012/05/23 08:17:49 miwi Exp $ # .if !defined(_POSTMKINCLUDED) && !defined(Local_Pre_Include) Modified: soc2012/scher/par_ports/head/Mk/bsd.lua.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.lua.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.lua.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.lua.mk,v 1.22 2011/12/31 08:52:36 mandree Exp $ +# $FreeBSD: ports/Mk/bsd.lua.mk,v 1.23 2012/05/23 08:17:49 miwi Exp $ # # bsd.lua.mk - Support for Lua based ports. # Modified: soc2012/scher/par_ports/head/Mk/bsd.mail.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.mail.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.mail.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: Fundamental; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.mail.mk,v 1.3 2007/08/04 11:37:23 gabor Exp $ +# $FreeBSD: ports/Mk/bsd.mail.mk,v 1.4 2012/05/23 08:17:49 miwi Exp $ # # Please view me with 4 column tabs! Modified: soc2012/scher/par_ports/head/Mk/bsd.octave.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.octave.mk Mon Jun 4 09:55:47 2012 (r237051) +++ soc2012/scher/par_ports/head/Mk/bsd.octave.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -1,7 +1,7 @@ -#-*- mode: makefile; tab-width: 4; -*- +#-*- tab-width: 4; -*- # ex:ts=4 # -# $FreeBSD: ports/Mk/bsd.octave.mk,v 1.14 2012/01/31 14:50:12 stephen Exp $ +# $FreeBSD: ports/Mk/bsd.octave.mk,v 1.15 2012/05/23 08:17:49 miwi Exp $ # # bsd.octave.mk - Octave related macro # Common code to install octave-forge packages. Added: soc2012/scher/par_ports/head/Mk/bsd.options.desc.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Mk/bsd.options.desc.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -0,0 +1,200 @@ +# $FreeBSD: ports/Mk/bsd.options.desc.mk,v 1.56 2012/06/03 16:59:50 sunpoet Exp $ +# +# READ BEFORE EDITING: +# - Please keep descriptions sorted alphabetically by variable name. +# + +Options_Desc_MAINTAINER= ports@FreeBSD.org + +AAC_DESC?= Enable support for aac/mp4 +AALIB_DESC?= Enable aalib support +ALSA_DESC?= Enable alsa audio support +AMR_DESC?= Enable OpenCORE AMR 3GPP Speech Codecs +APACHE_DESC?= Enable Apache server +APE_DESC?= Enable Monkey's Audio support +AO_DESC?= Support libao audio library +ARCHIVE_DESC?= Support bzip2/zip/iso9660 archive +ARTS_DESC?= Enable Arts audio system support +ASSERT_DESC?= Enable debug assertions +AVAHI_DESC?= Support Zeroconf through Avahi +BDB1_DESC?= Enable Berkeley DB 1.85 support +BDB_DESC?= Enable Berkeley DB support +CACA_DESC?= Enable libcaca support +CAIRO_DESC?= Enable Cairo graphic library support +CDDA2WAV_DESC?= Enable cdda2wav CD ripper +CDDB_DESC?= Enable CDDB support +CDPARANOIA_DESC?= Enable cdparanoia CD ripper +CFITSIO_DESC?= Enable FITS support via CFITSIO +COMPOSITE_DESC?= Enable X11 Composite extension +CUE_DESC?= Support embedded cue sheets +CUPS_DESC?= Enable Cups printing support +CURL_DESC?= Enable CURL support +DAGRAB_DESC?= Enable dagrab CD ripper +DBM_DESC?= Enable DBM support +DBUS_DESC?= Enable D-Bus support +DEBUG_DESC?= Enable debug flags +DOCS_DESC?= Build and install the documentation +DV_DESC?= Enable libDV support +ECW_DESC?= Enable ECW support +ESOUND_DESC?= Enable Esound sound server support +EXAMPLES_DESC?= Build and install the examples +EXPAT_DESC?= Enable Expat support +FAAC_DESC?= Enable FAAC encoder support +FAAD_DESC?= Enable FAAD aac decoder support +FASTCGI_DESC?= Enable FastCGI support +FFMPEG_DESC?= Support FFMPEG (wma aiff ac3 ape...) +FLAC_DESC?= Enable support for flac +FONTCONFIG_DESC?= Enable Font configuration API for X +FPECTL_DESC?= Enable floating point exception handling +FREETDS_DESC?= Enable FreeTDS support +FREETYPE_DESC?= Enable TrueType font rendering engine +FUSE_DESC?= Enable Fuse support +GCONF_DESC?= Enable gconf backend +GDM_DESC?= Build GDM login manager +GEOS_DESC?= Enable GEOS support +GEOTIFF_DESC?= Enable GeoTIFF support +GIF_DESC?= Enable GIF support +GLADE_DESC?= Enable Glade interface support +GNOME_DESC?= Enable GNOME Desktop support +GNOMEVFS2_DESC?= Enable GnomeVFS2 support +GNUPG_DESC?= Enable GNU Privacy Guard support +GNUPLOT_DESC?= Enable plotting using gnuplot +GOGO_DESC?= Enable gogo mp3 encoder +GRAPHVIZ_DESC?= Enable Graphviz support +GRASS_DESC?= Enable GRASS support +GSM_DESC?= Enable GSM codec support +GSTREAMER_DESC?= Enable multimedia support +GTK2_DESC?= Enable GTK2 gui toolkit support +GTK3_DESC?= Enable GTK3 gui toolkit support +GUI_DESC?= Enable GUI support +GVFS_DESC?= Enable remote access support +H323_DESC?= Enable H323 support +HAL_DESC?= Enable HAL support +HDF5_DESC?= Enable HDF-5 support +HTTPD_DESC?= Support for httpd output streaming +ICONS_DESC?= Enable Icons theme +ICONV_DESC?= Enable ICONV support +IMLIB2_DESC?= Enable imlib2 image library support +ID3TAG_DESC?= Support ID3 v1/v2 tags +ID3_DESC?= Enable support for id3 tags +IPV6_DESC?= Enable IPv6 support +JABBER_DESC?= Enable Jabber support +JACK_DESC?= Support JACK audio server +JASPER_DESC?= Enable JPEG 2000 support via JasPer +JAVA_DESC?= Enable JAVA platform support +JPEG_DESC?= Enable JPEG support +KERBEROS_DESC?= Enable Kerberos support +KDE3_DESC?= Enable KDE3 Desktop support +KDE4_DESC?= Enable KDE4 Desktop support +KML_DESC?= Enable KML support +LADSPA_DESC?= Enable LDSPA audio support +LAME_DESC?= Enable lame mp3 encoder support +LASH_DESC?= Enable LDASH audio support +LASTFM_DESC?= Support Last.FM stream input +LCMS2_DESC?= Enable LCMS2 support +LDAP_DESC?= Enable LDAP support +LIBBLURAY_DESC?= Enable libbluray support +LIBEXTRACTOR_DESC?= Enable libextractor support +LIRC_DESC?= Enable LIRC support +LUA_DESC?= Enable LUA support +MAD_DESC?= Enable Mad mp3 decoder support +MAGICK_DESC?= Enable ImageMagick Library +MANPAGES_DESC?= Build and install man pages +MIKMOD_DESC?= Support MOD audio format +MIXER_DESC?= Enable Mixer support +MMKEYS_DESC?= Enable multimedia keys support +MMS_DESC?= Support MMS stream input +MMX_DESC?= Enable MMX optimized routines +MODPERL_DESC?= Enable mod_perl support +MODPLUG_DESC?= Support MODPLUG decoder +MOTIF_DESC?= Enable Motif widget library +MP4_DESC?= Enable support for mp4 +MPP_DESC?= Enable support for musepack +MSQL_DESC?= Enable msql backend +MTP_DESC?= Enable MTP device support +MULTIBYTE_DESC?= Enable multibyte character support +MUSEPACK_DESC?= Support MPC audio format +MYSQL_DESC?= Enable MySQL backend +NAS_DESC?= Enable Network Audio System support +NETCDF_DESC?= Enable NetCDF support +NLS_DESC?= Build and install the localisation data +NOTIFY_DESC?= Enable startup notification support +ODBC_DESC?= Enable ODBC backend +ODF_DESC?= Enable ODF support +OPENGL_DESC?= Enable OpenGL support +OPTIMIZED_CFLAGS_DESC?= Enable compilation optimizations +ORACLE_DESC?= Enable Oracle support +OSS_DESC?= Enable Open Sound System support +PCRE_DESC?= Enable regular expressions using libpcre +PERL_DESC?= Enable Perl scripting language support +PGSQL_DESC?= Enable PostgreSQL backend +PHP_DESC?= Enable PHP binding/support +PIXBUF_DESC?= Enable gdk-pixbuf support +PNG_DESC?= Enable PNG support +POPPLER_DESC?= Enable PDF and PS support +PORTAUDIO_DESC?= Enable PortAudio support +PRINT_DESC?= Enable Printer support +PROJ_DESC?= Enable PROJ.4 support +PTH_DESC?= Enable GNU Pth for threading/multiprocessing +PULSEAUDIO_DESC?= Support PulseAudio sound server +PYMALLOC_DESC?= Enable python's internal malloc +PYTHON_DESC?= Enable Python binding/support +QT4_DESC?= Enable Qt4 gui toolkit support +RADIUS_DESC?= Enable RADIUS support +RAW_DESC?= Enable RAW support +RESIN3_DESC?= Enable Resin 3.x support +RTMP_DESC?= Enable RTMP support via librtmp +RUBY_DESC?= Enable Ruby binding/support +SAMPLERATE_DESC?= Support sample rate conversion +SASL_DESC?= Enable SASL support +SDL_DESC?= Enable Simple Direct Madia Layer support +SEM_DESC?= Enable POSIX semaphores support +SHOUTCAST_DESC?= Support for Ogg Icecast and Shoutcast +SIMD_DESC?= Use cpu-specific optimizations if possible +SMB_DESC?= Enable SMB protocol support +SNDFILE_DESC?= Add support for libsndfile +SNMP_DESC?= Enable SNMP support +SPANDSP_DESC?= Enable Spandsp faxing support +SPEEX_DESC?= Enable support for speex audio format +SQLITE_DESC?= Enable SQLite backend +SSE_DESC?= Enable SSE optimized routines +SSH_DESC?= Enable SSH support +SSL_DESC?= Enable SSL support +SVG_DESC?= Enable SVG image support +STATIC_DESC?= Build static executable/libraries +SVN_DESC?= Enable Subversion support +THREADS_DESC?= Enable thread support +TIDY_DESC?= Enable tidy html cleaner support +TIFF_DESC?= Enable TIFF support +TINYXML_DESC?= Enable XML Parser support via TinyXML +TOMCAT5_DESC?= Enable Tomcat 5.x support +TOMCAT6_DESC?= Enable Tomcat 6.x support +TOMCAT7_DESC?= Enable Tomcat 7.x support +TREMOR_DESC?= Support Tremor +UCS2_DESC?= Enable Unicode UCS-2 support +UCS4_DESC?= Enable Unicode UCS-4 support +VAAPI_DESC?= Enable VAAPI support +VDPAU_DESC?= Enable VDPAU support +VORBIS_DESC?= Enable support for Ogg Vorbis +VPX_DESC?= Enable VP8 video codec +WAV_DESC?= Support WAV audio format +WAVPACK_DESC?= Enable WavPack support +WEBP_DESC?= Enable WebP support +WEBSERVER_DESC?= Build Internal Webserver +WXGTK_DESC?= Enable WxGTK gui toolkit +X11_DESC?= Enable support for X11 +X264_DESC?= Enable H264 video codec using x264 +XALAN_DESC?= Enable Xalan support +XCURSOR_DESC?= Enable cursor themes support +XERCES_DESC?= Enable Xerces support +XINERAMA_DESC?= Enable X11 Xinerama Extension support +XKLAVIER_DESC?= Enable Keyboard layout settings +XFT_DESC?= Enable Xft support +XML_DESC?= Enable XML Parser support +XPM_DESC?= Enable XPM pixmaps support +XRANDR_DESC?= Enable Xrandr support +XSPF_DESC?= Enable support for XSPF +XVIDEO_DESC?= Enable the X Video Extension library +XVID_DESC?= Enable xvid mpeg4 video codec +XVMC_DESC?= Enable XvMC support +YAML_DESC?= Enable YAML support Added: soc2012/scher/par_ports/head/Mk/bsd.options.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Mk/bsd.options.mk Mon Jun 4 10:10:38 2012 (r237052) @@ -0,0 +1,183 @@ +#-*- tab-width: 4; -*- +# $FreeBSD: ports/Mk/bsd.options.mk,v 1.8 2012/06/02 09:13:13 bapt Exp $ +# Global options +# + +## +# Set all the options available for the ports, beginning with the +# global ones and ending with the ones decided by the maintainer. +# Options global to the entire ports tree + +OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options + +#ALL_OPTIONS= DOCS \ +# NLS + +# Set the default values for the global options, as defined by portmgr +.if !defined(NOPORTDOCS) +PORT_OPTIONS+= DOCS +.endif +PORT_OPTIONS+= NLS + +# Set the default values for the global options, as defined by portmgr +.if !defined(NOPORTEXAMPLES) +PORT_OPTIONS+= EXAMPLES +.endif + +# Append options set by the port Makefile +.for opt in ${OPTIONS_DEFINE} +ALL_OPTIONS+= ${opt} +.endfor + +ALL_OPTIONS:= ${ALL_OPTIONS:O:u} + +# Remove global options the port maintainer doesn't want +.for opt in ${OPTIONS_EXCLUDE} +ALL_OPTIONS:= ${ALL_OPTIONS:N${opt}} +.endfor + +#XXX to kill when old option framework won't be used anymore +.if defined(OPTIONS) +. undef optname +. for O in ${OPTIONS:S|\#|\\\#|g} +opt:= ${O} +. if !defined(optname) +optname:= ${O} +ALL_OPTIONS+= ${O} +PORT_OPTIONS+= ${O} +. elif !defined(optdesc) +optdesc:= ${opt} +${optname}_DESC:= ${opt:S|"||g} +. else +. if ${opt:L} == off +. if defined(PORT_OPTIONS) && defined(optname) +NO_OPTIONS+= ${optname} +NO_OPTIONS:= ${NO_OPTIONS:O:u} +. else *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 12:25: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 A40C2106564A for ; Mon, 4 Jun 2012 12:25:45 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 12:25:45 +0000 Date: Mon, 04 Jun 2012 12:25:45 +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: <20120604122545.A40C2106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237057 - 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, 04 Jun 2012 12:25:46 -0000 Author: gpf Date: Mon Jun 4 12:25:43 2012 New Revision: 237057 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237057 Log: rewrite pefs_next_prime Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jun 4 11:51:17 2012 (r237056) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jun 4 12:25:43 2012 (r237057) @@ -53,7 +53,7 @@ #include "pefs_ctl.h" -#define PEFS_INTEGRITY_DEBUG +//#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -62,7 +62,7 @@ #define PEFS_CHECKSUM_FILE_VERSION 0xDD #define PEFS_HASH_BYTE_ALIGNMENT 512 -#define PEFS_EXTRA_TABLE_SIZE 0.15 +#define PEFS_EXTRA_TABLE_SIZE 15 TAILQ_HEAD(checksum_head, checksum); @@ -112,14 +112,15 @@ static int pefs_is_prime(uint32_t num) { - int i; + uint32_t i, sq; - if (num == 0) - return 1; + if ((num % 2 == 0) || (num % 3 == 0)) + return 0; - /* XXXgpf: [TODO] Take a look at arithmetics, comparisons between signed/unsigned etc */ - for (i = 2; i <= sqrt(num); i++) { - if (num % i == 0) + sq = sqrt(num); + /* All other primes are in the form of 6k+-1 */ + for (i = 5; i <= sq; i+=6) { + if ((num % i == 0) || (num % (i+2) == 0)) return 0; } @@ -131,10 +132,15 @@ { uint32_t i; - for (i = num;; i++) { + if (num % 2 == 0) + num+=1; + + for (i = num;; i+=2) { if (pefs_is_prime(i)) return i; } + + return 0; } static int @@ -262,11 +268,11 @@ { uint32_t i; - /* - * spending 15% more space for each table lowers the chance to fall into an + /* + * spending 15% more space for each table lowers the chance to fall into an * infinite loop during cuckoo insertion to about 1.5%. */ - chtp->size = pefs_next_prime(nelements + (nelements * PEFS_EXTRA_TABLE_SIZE)); + chtp->size = pefs_next_prime(nelements + ((nelements * PEFS_EXTRA_TABLE_SIZE)/100)); chtp->nelements = nelements; if (chtp->size < chtp->nelements) { pefs_warn("numeric overflow while computing hash table size"); @@ -348,6 +354,15 @@ return (nbucket); } +/* + * XXXgpf: [TODO] change hash2 + * gleb says: + * http://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function + * Yes, I've mentioned it because it's available under + * /usr/include/sys/fnv_hash.h + * murmur3 has good performance/collisions characteristics. + */ + static uint32_t pefs_hash2(struct cuckoo_hash_table *chtp, struct file_header *fhp) { @@ -584,7 +599,7 @@ * file should be regular file * B2) the file_id is retrieved. * B3) list of checksums is computed for the file's 4k blocks. - * B4) file entry is added to hash table. (separate chaining is used) + * B4) file entry is added to hash table. (cuckoo hashing is used) */ static int pefs_create_in_memory_db(FILE *fpin, const EVP_MD *md, uint8_t hash_len, @@ -757,22 +772,22 @@ * Writes are always in little endian byte order. * * First 16 bytes of .pefs.checksum are filled with .pefs.checksum's file header. - * Right after this header lies the 'index' part of our database. This index is later + * Right after this header lies the 'index' part of our database. This index is later * kept in kernel memory. * - * Index: - * Both hash tables of cuckoo algorithm are written to the file sequentially. The + * Index: + * Both hash tables of cuckoo algorithm are written to the file sequentially. The * first hash table corresponds to hash1() and the second hash table to hash2(). * Each bucket (cell) of a hash table contains at most one entry(=file_header). * The size of an entry is 16 bytes. - * - * hash table entries end at the following offset: + * + * hash table entries end at the following offset: * 16 + hash_table_size * 2 * 16 * * Checksums: * The last part of .pefs.checksum is filled with the actual checksums. * The offset where the first checksum starts is a 512 aligned address. - * Each hash table file header entry contains an offset that points to the beginning + * Each hash table file header entry contains an offset that points to the beginning * of a chain of checksums for that particular file's 4k blocks. */ static int From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 13:31:35 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 EC5DC1065670 for ; Mon, 4 Jun 2012 13:31:32 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 13:31:32 +0000 Date: Mon, 04 Jun 2012 13:31:32 +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: <20120604133132.EC5DC1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237061 - 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, 04 Jun 2012 13:31:35 -0000 Author: gpf Date: Mon Jun 4 13:31:32 2012 New Revision: 237061 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237061 Log: properly handle scenario where cuckoo insertion falls into infinite loop. new hash tables are allocated where new_size=next_prime(old_size). all file_header elements are kept in a 'global' tail so that we won't have to re-produce them, should insertion fail. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jun 4 12:49:21 2012 (r237060) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jun 4 13:31:32 2012 (r237061) @@ -53,7 +53,7 @@ #include "pefs_ctl.h" -//#define PEFS_INTEGRITY_DEBUG +#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -65,6 +65,7 @@ #define PEFS_EXTRA_TABLE_SIZE 15 TAILQ_HEAD(checksum_head, checksum); +TAILQ_HEAD(file_header_head, file_header); #define PEFS_CFH_SIZE 16 #define PEFS_FH_SIZE 16 @@ -89,9 +90,9 @@ uint32_t nhashes; uint64_t file_id; char path[MAXPATHLEN]; - LIST_ENTRY(file_header) bucket_entries; uint32_t offset_to_checksums; struct checksum_head checksums; + TAILQ_ENTRY(file_header) file_header_entries; }; struct bucket { @@ -132,6 +133,9 @@ { uint32_t i; + if (num == 2 || num == 3) + return num; + if (num % 2 == 0) num+=1; @@ -262,22 +266,30 @@ chtp->buckets1 = NULL; chtp->buckets2 = NULL; } - + static int -pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements) +pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements, char reallocate) { uint32_t i; - /* - * spending 15% more space for each table lowers the chance to fall into an - * infinite loop during cuckoo insertion to about 1.5%. - */ - chtp->size = pefs_next_prime(nelements + ((nelements * PEFS_EXTRA_TABLE_SIZE)/100)); - chtp->nelements = nelements; - if (chtp->size < chtp->nelements) { - pefs_warn("numeric overflow while computing hash table size"); - return (PEFS_ERR_GENERIC); + if (reallocate == 0) { + /* + * spending 15% more space for each table lowers the chance to fall into an + * infinite loop during cuckoo insertion to about 1.5%. + */ + chtp->size = pefs_next_prime(nelements + ((nelements * PEFS_EXTRA_TABLE_SIZE)/100)); + chtp->nelements = nelements; + if (chtp->size < chtp->nelements) { + pefs_warn("numeric overflow while computing hash table size"); + return (PEFS_ERR_GENERIC); + } } + else { + chtp->size = pefs_next_prime(chtp->size + 1); + free(chtp->buckets1); + free(chtp->buckets2); + } + dprintf(("hash table elem:%u\tsize: %u\n", chtp->nelements, chtp->size)); chtp->buckets1 = malloc (chtp->size * sizeof(struct bucket)); @@ -422,7 +434,7 @@ } pefs_warn("cuckoo_insert resulted in infinite loop!"); - return (PEFS_ERR_CUCKOO_LOOP); + return (PEFS_ERR_GENERIC); } static int @@ -593,19 +605,25 @@ /* * This function creates the in memory database that will be later written to * the checksum file. - * A) The total sum of entries is gathered so that a hash table is allocated. + * A) The total sum of entries is gathered so that the hash tables are allocated. * B) For each file entry: * B1) semantic checks: file should reside in pefs filesystem & * file should be regular file * B2) the file_id is retrieved. * B3) list of checksums is computed for the file's 4k blocks. - * B4) file entry is added to hash table. (cuckoo hashing is used) + * B4) file entry is added to fh_head + * C) Cuckoo insertion: + * We try to populate our hash tables using the cuckoo algorithm. Should we fall + * into an infinite loop during insertion, we re-allocate larger hash tables + * and try again until we succeed. The possibility to fail twice in a row is + * 1.5% * 1.5% = 0.0225% */ static int pefs_create_in_memory_db(FILE *fpin, const EVP_MD *md, uint8_t hash_len, struct cuckoo_hash_table *chtp, char *fsroot) { struct statfs fs; + struct file_header_head fh_head; struct file_header *fhp; int error; uint32_t nfiles; @@ -619,10 +637,11 @@ if (error != 0) return (error); - error = pefs_allocate_hash_table(chtp, nfiles); + error = pefs_allocate_hash_table(chtp, nfiles, 0); if (error != 0) return (error); + TAILQ_INIT(&fh_head); while((fhp = pefs_next_file(fpin, &error)) != NULL) { error = pefs_file_semantic_checks(fhp, &fs); if (error != 0) @@ -636,11 +655,26 @@ if (error != 0) return (error); - error = pefs_add_to_hash_table(chtp, fhp); - if (error != 0) - return (error); + TAILQ_INSERT_TAIL(&fh_head, fhp, file_header_entries); } +cuckoo_insert: + TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { + error = pefs_add_to_hash_table(chtp, fhp); + /* + * cuckoo insertion algorithm fell into an infinite loop! + * Create new, larger hash tables where size = next_prime(old_size) + * and try again. + */ + if (error != 0) { + dprintf(("fell into an infinite loop!\n")); + error = pefs_allocate_hash_table(chtp, nfiles, 1); + if (error != 0) + return (error); + goto cuckoo_insert; + } + } + pefs_print_hash_table(chtp, hash_len); return (error); @@ -933,11 +967,6 @@ error = pefs_create_in_memory_db(fpin, md, hash_len, &checksum_hash_table, fsroot); - /* - * XXXgpf: [TODO] Properly handle PEFS_ERR_CUCKOO_LOOP by retrying with - * larger tables (next prime number?). We shouldn't have to reread all - * file entries btw. - */ if (error != 0) goto out; Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Mon Jun 4 12:49:21 2012 (r237060) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Mon Jun 4 13:31:32 2012 (r237061) @@ -61,7 +61,6 @@ #define PEFS_ERR_NOENT 5 #define PEFS_ERR_EXIST 6 #define PEFS_ERR_INVALID 7 -#define PEFS_ERR_CUCKOO_LOOP 8 #define PEFS_FS_IGNORE_TYPE 0x0001 From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 14:27: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 E1307106564A for ; Mon, 4 Jun 2012 14:27:04 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 14:27:04 +0000 Date: Mon, 04 Jun 2012 14:27:04 +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: <20120604142704.E1307106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237063 - 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, 04 Jun 2012 14:27:07 -0000 Author: gpf Date: Mon Jun 4 14:27:04 2012 New Revision: 237063 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237063 Log: use FNV as hash function no2 Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jun 4 13:41:22 2012 (r237062) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon Jun 4 14:27:04 2012 (r237063) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -266,7 +267,7 @@ chtp->buckets1 = NULL; chtp->buckets2 = NULL; } - + static int pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements, char reallocate) { @@ -362,26 +363,18 @@ uint32_t nbucket; nbucket = fhp->file_id % chtp->size; - dprintf(("hash1: goto bucket %d\n", nbucket)); + printf("hash1: goto bucket %d\n", nbucket); return (nbucket); } -/* - * XXXgpf: [TODO] change hash2 - * gleb says: - * http://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function - * Yes, I've mentioned it because it's available under - * /usr/include/sys/fnv_hash.h - * murmur3 has good performance/collisions characteristics. - */ - static uint32_t pefs_hash2(struct cuckoo_hash_table *chtp, struct file_header *fhp) { uint32_t nbucket; - nbucket = (fhp->file_id / chtp->size) % chtp->size; - dprintf(("hash2: goto bucket %d\n", nbucket)); + nbucket = fnv_64_buf(&(fhp->file_id), sizeof(fhp->file_id), FNV1_64_INIT) % chtp->size; + printf("hash2: goto bucket %d\n", nbucket); + return (nbucket); } @@ -433,6 +426,7 @@ elem = elem2; } + /* XXXgpf: should be left as a warning at least during development phase */ pefs_warn("cuckoo_insert resulted in infinite loop!"); return (PEFS_ERR_GENERIC); } @@ -615,7 +609,7 @@ * C) Cuckoo insertion: * We try to populate our hash tables using the cuckoo algorithm. Should we fall * into an infinite loop during insertion, we re-allocate larger hash tables - * and try again until we succeed. The possibility to fail twice in a row is + * and try again until we succeed. The possibility to fail twice in a row is * 1.5% * 1.5% = 0.0225% */ static int @@ -659,9 +653,9 @@ } cuckoo_insert: - TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { + TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { error = pefs_add_to_hash_table(chtp, fhp); - /* + /* * cuckoo insertion algorithm fell into an infinite loop! * Create new, larger hash tables where size = next_prime(old_size) * and try again. @@ -674,7 +668,6 @@ goto cuckoo_insert; } } - pefs_print_hash_table(chtp, hash_len); return (error); From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 18:05: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 04A42106567F for ; Mon, 4 Jun 2012 18:05:41 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 18:05:40 +0000 Date: Mon, 04 Jun 2012 18:05:40 +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: <20120604180541.04A42106567F@hub.freebsd.org> Cc: Subject: socsvn commit: r237074 - soc2012/jhagewood/mdocml/tests 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, 04 Jun 2012 18:05:42 -0000 Author: jhagewood Date: Mon Jun 4 18:05:40 2012 New Revision: 237074 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237074 Log: Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Modified: soc2012/jhagewood/mdocml/tests/compile-man-pages.sh ============================================================================== --- soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Mon Jun 4 17:22:43 2012 (r237073) +++ soc2012/jhagewood/mdocml/tests/compile-man-pages.sh Mon Jun 4 18:05:40 2012 (r237074) @@ -1,4 +1,4 @@ -# Script for compiling all man pages in the FreeBSD core using mandoc. +# Script for compiling all man pages in the FreeBSD using mandoc. # Jesse Hagewood # jhagewood@freebsd.org From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 18:39: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 09C4E106566B for ; Mon, 4 Jun 2012 18:39:51 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 18:39:51 +0000 Date: Mon, 04 Jun 2012 18:39:51 +0000 From: rudot@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: <20120604183951.09C4E106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237075 - in soc2012/rudot: aux sys/kern 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, 04 Jun 2012 18:39:53 -0000 Author: rudot Date: Mon Jun 4 18:39:50 2012 New Revision: 237075 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237075 Log: fix problems that witness complains about Added: soc2012/rudot/aux/check_proc.sh (contents, props changed) Modified: soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c Added: soc2012/rudot/aux/check_proc.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/check_proc.sh Mon Jun 4 18:39:50 2012 (r237075) @@ -0,0 +1,3 @@ +./proc_pcpu.sh $1 + +ps ax -O %cpu | grep dummy Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Mon Jun 4 18:05:40 2012 (r237074) +++ soc2012/rudot/sys/kern/kern_racct.c Mon Jun 4 18:39:50 2012 (r237075) @@ -54,6 +54,7 @@ #include #include #include +#include #ifdef RCTL #include @@ -61,6 +62,9 @@ #ifdef RACCT +#define TDF_RACCT_PCTCPU TDF_SCHED2 +#define TDF_RACCT_RQ TDF_SCHED3 + FEATURE(racct, "Resource Accounting"); static struct mtx racct_lock; @@ -842,6 +846,70 @@ } static void +racct_proc_disable(struct proc *p) +{ + struct thread *td; + + FOREACH_THREAD_IN_PROC(p, td) { + if ((td->td_flags & TDF_RACCT_PCTCPU) == 0) { + thread_lock(td); + td->td_flags |= TDF_RACCT_PCTCPU; + + switch (td->td_state) { + case TDS_RUNQ: + sched_rem(td); + td->td_flags |= TDF_RACCT_RQ; + break; + case TDS_RUNNING: + td->td_flags |= TDF_NEEDRESCHED; +#ifdef SMP + if (td != curthread) + ipi_cpu(td->td_oncpu, IPI_AST); +#endif + break; + default: + break; + } + + thread_unlock(td); + } + } +} + +/* + * Returns true if at least one of the process threads + * has been disabled. + */ +static int +racct_proc_disabled(struct proc *p) +{ + struct thread *td; + + FOREACH_THREAD_IN_PROC(p, td) { + if (td->td_flags & TDF_RACCT_PCTCPU) + return (1); + } + + return (0); +} + +static void +racct_proc_enable(struct proc *p) +{ + struct thread *td; + + FOREACH_THREAD_IN_PROC(p, td) { + thread_lock(td); + td->td_flags &= ~TDF_RACCT_PCTCPU; + if (td->td_flags & TDF_RACCT_RQ) { + td->td_flags &= ~TDF_RACCT_RQ; + sched_add(td, SRQ_BORING); + } + thread_unlock(td); + } +} + +static void racctd(void) { struct thread *td; @@ -849,6 +917,7 @@ struct timeval wallclock; uint64_t runtime; u_int pct; + uint64_t limit; for (;;) { sx_slock(&allproc_lock); @@ -873,14 +942,20 @@ runtime = p->p_prev_runtime; #endif p->p_prev_runtime = runtime; - mtx_lock(&racct_lock); + limit = racct_get_limit(p, RACCT_PCTCPU); pct = racct_getpcpu(p); + mtx_lock(&racct_lock); /* * I use _force_ here because we always want to have * the real value in the RACCT_PCTCPU resource * regardless of the limits set. */ racct_set_force_locked(p, RACCT_PCTCPU, pct); + if (pct >= limit) { + racct_proc_disable(p); + } else if (racct_proc_disabled(p)) { + racct_proc_enable(p); + } racct_set_locked(p, RACCT_CPU, runtime); racct_set_locked(p, RACCT_WALLCLOCK, (uint64_t)wallclock.tv_sec * 1000000 + Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Mon Jun 4 18:05:40 2012 (r237074) +++ soc2012/rudot/sys/kern/sched_4bsd.c Mon Jun 4 18:39:50 2012 (r237075) @@ -107,6 +107,10 @@ /* flags kept in td_flags */ #define TDF_DIDRUN TDF_SCHED0 /* thread actually ran. */ #define TDF_BOUND TDF_SCHED1 /* Bound to one CPU. */ +#ifdef RACCT +#define TDF_RACCT_PCTCPU TDF_SCHED2 +#define TDF_RACCT_RQ TDF_SCHED3 +#endif /* flags kept in ts_flags */ #define TSF_AFFINITY 0x0001 /* Has a non-"full" CPU set. */ @@ -693,9 +697,6 @@ { struct pcpuidlestat *stat; struct td_sched *ts; -#ifdef RACCT - u_int pct; -#endif THREAD_LOCK_ASSERT(td, MA_OWNED); ts = td->td_sched; @@ -718,14 +719,6 @@ stat = DPCPU_PTR(idlestat); stat->oldidlecalls = stat->idlecalls; stat->idlecalls = 0; - -#ifdef RACCT - pct = racct_getpcpu(td->td_proc); - racct_set_force(td->td_proc, RACCT_PCTCPU, pct); - if (pct >= racct_get_limit(td->td_proc, RACCT_PCTCPU)) { - pause("racct", hz); - } -#endif } /* @@ -1239,7 +1232,18 @@ KTR_POINT1(KTR_SCHED, "thread", sched_tdname(curthread), "wokeup", KTR_ATTR_LINKED, sched_tdname(td)); - +#ifdef RACCT + /* + * Skip adding threads to the rq that have exceeded their racct + * pctcpu limits. Also set a flag that says when the thread is + * again within its pctcpu limits, it should be also added to + * the rq. + */ + if (td->td_flags & TDF_RACCT_PCTCPU) { + td->td_flags |= TDF_RACCT_RQ; + return; + } +#endif /* * Now that the thread is moving to the run-queue, set the lock * to the scheduler's lock. From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 18:40:11 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 EC1AB106564A for ; Mon, 4 Jun 2012 18:40:08 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 18:40:08 +0000 Date: Mon, 04 Jun 2012 18:40:08 +0000 From: emc2@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: <20120604184008.EC1AB106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237076 - soc2012/emc2/hfsimg 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, 04 Jun 2012 18:40:11 -0000 Author: emc2 Date: Mon Jun 4 18:40:08 2012 New Revision: 237076 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237076 Log: Added some code for creating HFS filesystem images containing a boot loader. This code is not complete, but it's probably a good idea to get it into version control. Added: soc2012/emc2/hfsimg/ soc2012/emc2/hfsimg/Makefile soc2012/emc2/hfsimg/hfs.c soc2012/emc2/hfsimg/hfsimg.8 soc2012/emc2/hfsimg/main.c Added: soc2012/emc2/hfsimg/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/hfsimg/Makefile Mon Jun 4 18:40:08 2012 (r237076) @@ -0,0 +1,8 @@ +.include + +MAN1= +MAN8=hfsimg.8 +PROG=hfsimg +SRCS=main.c hfs.c + +.include \ No newline at end of file Added: soc2012/emc2/hfsimg/hfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/hfsimg/hfs.c Mon Jun 4 18:40:08 2012 (r237076) @@ -0,0 +1,238 @@ +#include +#include +#include +#include +#include + +#include "hfs.h" + +#define HFS_PROLOG_SIZE 1024 +#define HFS_EPILOG_SIZE 512 +#define HFS_ATTRIBUTES 0x100 +#define HFS_RESERVED 0 +#define HFS_FORK_DATA_SIZE 80 +#define HFS_TIME_OFFSET (60 * 60 * 24 * 365 * 66) +#define HFS_BLOCK_SIZE 512 +#define HFS_CATALOG_NODE_SIZE 8192 + +#define SYSTEM_DIR_CNID 16 +#define LIBRARY_DIR_CNID 17 +#define CORESERVICES_DIR_CNID 18 +#define BOOTEFI_CNID 19 + +#define ZEROES_SIZE (HFS_PROLOG_SIZE > HFS_EPILOG_SIZE ? \ + HFS_PROLOG_SIZE : HFS_EPILOG_SIZE) + +static const uint8_t zeroes[ZEROES_SIZE] = { 0 }; +static uint8_t block[HFS_BLOCK_SIZE]; +static uint8_t node[HFS_CATALOG_NODE_SIZE]; + +static int write_hfs_prolog(FILE* const restrict file) { + + const int count = fwrite(zeroes, 1, HFS_PROLOG_SIZE, file); + + return count == HFS_PROLOG_SIZE ? 0 : -1; + +} + +static uint32_t get_time(void) { + + const time_t currtime = time(NULL); + + if(currtime != (time_t)-1) + return HFS_TIME_OFFSET + currtime; + + else + return (uint32_t)-1; + +}; + +static void init_null_fork_data(void* const restrict ptr) { + + uint32_t* const clumpsize = (uint32_t*)((uint8_t*)ptr + 8); + + memset(ptr, 0, HFS_FORK_DATA_SIZE); + clumpsize[0] = HFS_BLOCK_SIZE; + +} + +static int write_hfs_volume_header(FILE* const restrict file) { + + const uint32_t currtime = get_time(); + + if(currtime != (uint32_t)-1) { + + uint8_t* const sig = block; + uint16_t* const version = (uint16_t*)(block + 2); + uint32_t* const attrs = (uint32_t*)(block + 4); + uint8_t* const lastmountvers = block + 8; + uint32_t* const journalinfo = (uint32_t*)(block + 12); + uint32_t* const createdate = (uint32_t*)(block + 16); + uint32_t* const moddate = (uint32_t*)(block + 20); + uint32_t* const backupdate = (uint32_t*)(block + 24); + uint32_t* const checkdate = (uint32_t*)(block + 28); + uint32_t* const filecount = (uint32_t*)(block + 32); + uint32_t* const foldercount = (uint32_t*)(block + 36); + uint32_t* const blocksize = (uint32_t*)(block + 40); + uint32_t* const totalblocks = (uint32_t*)(block + 44); + uint32_t* const freeblocks = (uint32_t*)(block + 48); + uint32_t* const nextalloc = (uint32_t*)(block + 52); + uint32_t* const rsrcclumpsize = (uint32_t*)(block + 56); + uint32_t* const dataclumpsize = (uint32_t*)(block + 60); + uint32_t* const catalogid = (uint32_t*)(block + 64); + uint32_t* const writecount = (uint32_t*)(block + 68); + uint64_t* const encodings = (uint64_t*)(block + 72); + uint32_t* const finderinfo = (uint32_t*)(block + 80); + void* const allocfile = (void*)(block + 112); + void* const extentsfile = (void*)(block + 192); + void* const catalogfile = (void*)(block + 272); + void* const attrsfile = (void*)(block + 352); + void* const startupfile = (void*)(block + 432); + + sig[0] = 'H'; + sig[1] = '+'; + attrs[0] = HFS_ATTRIBUTES; + version[0] = 4; + lastmountvers[0] = 'f'; + lastmountvers[1] = 's'; + lastmountvers[2] = 'c'; + lastmountvers[3] = 'k'; + journalinfo[0] = HFS_RESERVED; + createdate[0] = currtime; + moddate[0] = currtime; + backupdate[0] = currtime; + checkdate[0] = currtime; + filecount[0] = 1; + foldercount[0] = 3; + blocksize[0] = HFS_BLOCK_SIZE; + rsrcclumpsize[0] = HFS_BLOCK_SIZE; + dataclumpsize[0] = HFS_BLOCK_SIZE; + writecount[0] = 1; + encodings[0] = HFS_RESERVED; + finderinfo[3] = 0; + finderinfo[4] = HFS_RESERVED; + finderinfo[6] = 0; + finderinfo[7] = 0; + init_null_fork_data(extentsfile); + init_null_fork_data(attrsfile); + + const int count = fwrite(block, 1, HFS_BLOCK_SIZE, file); + + return count == HFS_BLOCK_SIZE ? 0 : -1; + + } + + else + return errno; + +} + +#define HEADER_REC_OFFSET 14 +#define HEADER_USER_OFFSET 120 +#define HEADER_MAP_OFFSET 248 + +static int write_catalog_header_node(FILE* const restrict file) { + + uint32_t* const flink = (uint32_t*)node; + uint32_t* const blink = (uint32_t*)(node + 4); + int8_t* const kind = (int8_t*)(node + 8); + uint8_t* const height = node + 9; + uint16_t* const records = (uint16_t*)(node + 10); + uint16_t* const reserved = (uint16_t*)(node + 12); + uint16_t* const treedepth = (uint16_t*)(node + 14); + uint32_t* const rootnode = (uint32_t*)(node + 16); + uint32_t* const leafrecords = (uint32_t*)(node + 20); + uint32_t* const firstleaf = (uint32_t*)(node + 24); + uint32_t* const lastleaf = (uint32_t*)(node + 28); + uint16_t* const nodesize = (uint16_t*)(node + 32); + uint16_t* const maxkeylen = (uint16_t*)(node + 34); + uint32_t* const totalnodes = (uint32_t*)(node + 36); + uint32_t* const freenodes = (uint32_t*)(node + 40); + uint16_t* const reserved2 = (uint16_t*)(node + 44); + uint32_t* const clumpsize = (uint32_t*)(node + 46); + uint8_t* const btreetype = node + 50; + uint8_t* const keycomptype = node + 51; + uint32_t* const attrs = (uint32_t*)(node + 52); + uint32_t* const reserved3 = (uint32_t*)(node + 56); + uint16_t* const freeoff = (uint16_t*)(node + 8184); + uint16_t* const mapoff = (uint16_t*)(node + 8186); + uint16_t* const useroff = (uint16_t*)(node + 8188); + uint16_t* const headerrecoff = (uint16_t*)(node + 8190); + + memset(node, 0, HFS_CATALOG_NODE_SIZE); + flink[0] = 0; + blink[0] = 0; + height[0] = 0; + records[0] = 3; + reserved[0] = HFS_RESERVED; + treedepth[0] = 0; + nodesize[0] = HFS_CATALOG_NODE_SIZE; + reserved2[0] = HFS_RESERVED; + clumpsize[0] = HFS_CATALOG_NODE_SIZE; + btreetype[0] = 0; + keycomptype[0] = 0xbc; + attrs[0] = 4; + reserved3[0] = HFS_RESERVED; + reserved3[1] = HFS_RESERVED; + reserved3[2] = HFS_RESERVED; + freeoff[0] = 8176; + mapoff[0] = HEADER_MAP_OFFSET; + useroff[0] = HEADER_USER_OFFSET; + headerrecoff[0] = HEADER_REC_OFFSET; + + return fwrite(node, 1, HFS_CATALOG_NODE_SIZE, file); + +} + +static int write_catalog_data_node(FILE* const restrict file) { + + uint32_t* const flink = (uint32_t*)node; + uint32_t* const blink = (uint32_t*)(node + 4); + int8_t* const kind = (int8_t*)(node + 8); + uint8_t* const height = node + 9; + uint16_t* const records = (uint16_t*)(node + 10); + uint16_t* const reserved = (uint16_t*)(node + 12); + uint16_t* const systemdiroff = (uint16_t*)(node + 8188); + uint16_t* const rootdiroff = (uint16_t*)(node + 8190); + + flink[0] = 0; + blink[0] = 0; + kind[0] = -1; + height[0] = 1; + records[0] = 7; + rootdiroff[0] = 14; + + return fwrite(node, 1, HFS_CATALOG_NODE_SIZE, file); + +} + +static int write_hfs_epilog(FILE* restrict const file) { + + return fwrite(zeroes, HFS_EPILOG_SIZE, 1, file); + +} + +int write_hfs_image(FILE* const restrict infile, + FILE* const restrict outfile) { + + int out; + + if((out = fseek(infile, 0, SEEK_SET))) + return out; + + if((out = fseek(outfile, 0, SEEK_SET))) + return out; + + if((out = write_hfs_prolog(outfile))) { + perror("Could not write prologue"); + return out; + } + + if((out = write_hfs_volume_header(outfile))) { + perror("Could not write volume header"); + return out; + } + + return out; + +} Added: soc2012/emc2/hfsimg/hfsimg.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/hfsimg/hfsimg.8 Mon Jun 4 18:40:08 2012 (r237076) @@ -0,0 +1,20 @@ +.Dd June 4, 2012 +.Dt HFSIMG 8 +.Os +.Sh NAME +.Nm hfsimg +.Nd "embed a boot loader within an HFS+ filesystem image" +.Sh SYNOPSIS +.Nm +image volume +.Sh DESCRIPTION +The hfsimg utility creates an HFS+ filesystem image containing a single file as +a boot loader program on the given volume. The filesystem will contain a single +file, named boot.efi in the /System/Library/CoreServices directory, which will +be marked as a startup file in the filesystem. The contents of this file will +be exactly the contents of the image file given to hfsimg. + +This is intended for installing boot loaders on Apple machines, which have +an alternate boot procedure from the UEFI specification. +.Sh AUTHORS +.An Eric McCorkle Added: soc2012/emc2/hfsimg/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/hfsimg/main.c Mon Jun 4 18:40:08 2012 (r237076) @@ -0,0 +1,26 @@ +#include + +#include "hfs.h" + +int main(int argc, char** argv) { + + int out; + FILE* infile; + FILE* outfile; + + if(3 != argc) + fprintf(stderr, "Usage: %s \n", argv[0]); + + if(!(infile = fopen(argv[1], "r"))) { + perror("Could not open input file"); + return out; + } + + if(!(outfile = fopen(argv[2], "w"))) { + perror("Could not open output file"); + return out; + } + + return write_hfs_image(infile, outfile); + +} From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 20:07:48 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 5D6C1106564A for ; Mon, 4 Jun 2012 20:07:46 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 20:07:46 +0000 Date: Mon, 04 Jun 2012 20:07:46 +0000 From: scher@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: <20120604200746.5D6C1106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237083 - in soc2012/scher/par_ports/head: . Mk db/portlocks lock 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, 04 Jun 2012 20:07:48 -0000 Author: scher Date: Mon Jun 4 20:07:46 2012 New Revision: 237083 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237083 Log: [fixed] LOCK_DIR changed from ${PORTSDIR}/lock to /var/db/portlocks Added: soc2012/scher/par_ports/head/db/portlocks/ Deleted: soc2012/scher/par_ports/head/lock/ Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk soc2012/scher/par_ports/head/dev_env.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jun 4 19:09:14 2012 (r237082) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jun 4 20:07:46 2012 (r237083) @@ -65,6 +65,7 @@ _parv_KILL_SIGNAL= USR1 _parv_PKILL= /bin/pkill _parv_PKILL_FLAGS= -P +_parv_UMASK= 777 DO_NADA?= ${TRUE} # End of Commands section @@ -72,7 +73,7 @@ ##################################################### # Locking variables and tools #PKG_DBDIR?= /var/db/pkg -LOCK_DIR= ${PORTSDIR}/lock +LOCK_DIR?= /var/db/portlocks _parv_PKG_DBDIR_LOCK_FILE= .lock _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME} @@ -106,7 +107,7 @@ #_parv_${_lock_dir}_LOCK_FILE:= ${_parv_${_lock_dir}_LOCK_FILE} _parv_${_lock_dir}_LOCK_SEQ= \ - ${CHMOD} 777 ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ + ${CHMOD} ${_parv_UMASK} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \ if [ $${pid} ]; then \ ps -p $${pid} > /dev/null && status=$$? || status=$$?; \ @@ -215,7 +216,7 @@ # Script exits with status ${_parv_ON_LOCK_EXIT_STATUS} if $${pkg_name} is locked # _parv_CHECK_SEQ= \ - ${CHMOD} 777 ${LOCK_DIR}/$${pkg_name}; \ + ${CHMOD} ${_parv_UMASK} ${LOCK_DIR}/$${pkg_name}; \ pid=\$$(${CAT} ${LOCK_DIR}/$${pkg_name}); \ if [ \$${pid} ]; then \ ps -p \$${pid} > /dev/null && status=\$$? || status=\$$?; \ Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jun 4 19:09:14 2012 (r237082) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jun 4 20:07:46 2012 (r237083) @@ -1522,7 +1522,7 @@ ${_dparv_START_OUTPUT}; \ ${ECHO_CMD} "Creating lock dir"; \ ${_dparv_END_OUTPUT}; \ - ${MKDIR} ${LOCK_DIR}; \ + ${MKDIR} -m ${_parv_UMASK} ${LOCK_DIR}; \ fi . if ${_parv_IS_DEFAULT_TARGET} . if defined(INSTALLS_DEPENDS) Modified: soc2012/scher/par_ports/head/dev_env.mk ============================================================================== --- soc2012/scher/par_ports/head/dev_env.mk Mon Jun 4 19:09:14 2012 (r237082) +++ soc2012/scher/par_ports/head/dev_env.mk Mon Jun 4 20:07:46 2012 (r237083) @@ -2,11 +2,13 @@ CSH_PORTSDIR_ENTRY = "setenv PORTSDIR ${.CURDIR}" CSH_PKG_DBDIR_ENTRY = "setenv PKG_DBDIR ${.CURDIR}/db/pkg" CSH_PORT_DBDIR_ENTRY = "setenv PORT_DBDIR ${.CURDIR}/db/ports" +CSH_LOCK_DIR_ENTRY = "setenv LOCK_DIR ${.CURDIR}/db/portlocks" SH_PREFIX_ENTRY = "PREFIX=${.CURDIR}/tmp\; export PREFIX" SH_PORTSDIR_ENTRY = "PORTSDIR=${.CURDIR}\; export PORTSDIR" SH_PKG_DBDIR_ENTRY = "PKG_DBDIR=${.CURDIR}/db/pkg\; export PKG_DBDIR" SH_PORT_DBDIR_ENTRY = "PORT_DBDIR=${.CURDIR}/db/ports\; export PORT_DBDIR" +SH_LOCK_DIR_ENTRY = "LOCK_DIR=${.CURDIR}/db/portlocks\; export LOCK_DIR" list_env_info: @echo "=== Configuring project environment" @@ -16,8 +18,10 @@ @echo "${CSH_PORTSDIR_ENTRY}" @echo "${CSH_PKG_DBDIR_ENTRY}" @echo "${CSH_PORT_DBDIR_ENTRY}" + @echo "${CSH_LOCK_DIR_ENTRY}" @echo "=== Add the following lines to your ~/.shrc and /.shrc files" @echo "${SH_PREFIX_ENTRY}" @echo "${SH_PORTSDIR_ENTRY}" @echo "${SH_PKG_DBDIR_ENTRY}" @echo "${SH_PORT_DBDIR_ENTRY}" + @echo "${SH_LOCK_DIR_ENTRY}" From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 23:27:37 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 E0B45106566C for ; Mon, 4 Jun 2012 23:27:35 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 23:27:35 +0000 Date: Mon, 04 Jun 2012 23:27:35 +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: <20120604232735.E0B45106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237101 - soc2012/jhagewood/diff3 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, 04 Jun 2012 23:27:37 -0000 Author: jhagewood Date: Mon Jun 4 23:27:35 2012 New Revision: 237101 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237101 Log: Deleted: soc2012/jhagewood/diff3/ From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 23:28:20 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 5B019106564A for ; Mon, 4 Jun 2012 23:28:19 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 23:28:19 +0000 Date: Mon, 04 Jun 2012 23:28:19 +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: <20120604232819.5B019106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237102 - soc2012/jhagewood/diff3 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, 04 Jun 2012 23:28:20 -0000 Author: jhagewood Date: Mon Jun 4 23:28:19 2012 New Revision: 237102 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237102 Log: Added: soc2012/jhagewood/diff3/ From owner-svn-soc-all@FreeBSD.ORG Mon Jun 4 23:29: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 4EEB6106566C for ; Mon, 4 Jun 2012 23:29:06 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 04 Jun 2012 23:29:06 +0000 Date: Mon, 04 Jun 2012 23:29:06 +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: <20120604232906.4EEB6106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237103 - in soc2012/jhagewood/diff3: . diff3 diff3-orig 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, 04 Jun 2012 23:29:08 -0000 Author: jhagewood Date: Mon Jun 4 23:29:06 2012 New Revision: 237103 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237103 Log: Added: soc2012/jhagewood/diff3/diff3/ soc2012/jhagewood/diff3/diff3-orig/ soc2012/jhagewood/diff3/diff3-orig/Makefile soc2012/jhagewood/diff3/diff3-orig/diff3.1 soc2012/jhagewood/diff3/diff3-orig/diff3.ksh soc2012/jhagewood/diff3/diff3-orig/diff3.sh soc2012/jhagewood/diff3/diff3-orig/diff3prog.c soc2012/jhagewood/diff3/diff3/Makefile soc2012/jhagewood/diff3/diff3/diff3.1 soc2012/jhagewood/diff3/diff3/diff3.ksh soc2012/jhagewood/diff3/diff3/diff3.sh soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Added: soc2012/jhagewood/diff3/diff3-orig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff3/diff3-orig/Makefile Mon Jun 4 23:29:06 2012 (r237103) @@ -0,0 +1,11 @@ +# $OpenBSD: Makefile,v 1.2 2003/07/22 00:11:30 millert Exp $ + +PROG= diff3prog +MAN= diff3.1 +BINDIR= /usr/libexec + +beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 + +.include Added: soc2012/jhagewood/diff3/diff3-orig/diff3.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff3/diff3-orig/diff3.1 Mon Jun 4 23:29:06 2012 (r237103) @@ -0,0 +1,201 @@ +.\" $OpenBSD: diff3.1,v 1.7 2007/05/31 19:20:09 jmc Exp $ +.\" +.\" Copyright (c) 1990, 1993, 1994 +.\" The Regents of the University of California. 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. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\" +.\" @(#)diff3.1 8.2 (Berkeley) 4/18/94 +.\" +.Dd $Mdocdate: May 31 2007 $ +.Dt DIFF3 1 +.Os +.Sh NAME +.Nm diff3 +.Nd 3-way differential file comparison +.Sh SYNOPSIS +.Nm diff3 +.Op Fl 3aEeXx +.Ar file1 file2 file3 +.Sh DESCRIPTION +The +.Nm +utility compares the contents of three different versions of a file, +.Ar file1 , +.Ar file2 +and +.Ar file3 , +writing the result to the standard output. +The options describe different methods of merging and +purging +the separate versions into a new file. +.Nm +is used by +.Xr rcs 1 +to merge specific versions or create +new versions. +.Pp +The options are as follows: +.Bl -tag -width "-E, -X" +.It Fl 3 +Produces an output script suitable for +.Xr ed 1 +with changes +specific only to +.Ar file3 . +.It Fl a +Treat all files as ASCII. +.It Fl E , X +Similar to +.Fl e +and +.Fl x , +respectively, but treat overlapping changes (i.e., changes that would +be noted with ==== in the normal listing) differently. +The overlapping lines from both files will be inserted by the edit script, +bracketed by "<<<<<<" and ">>>>>>" lines. +.It Fl e +Produces output in a form suitable as an input script for the +.Xr ed 1 +utility. +The script may then be used to merge differences common between all +three files and differences specific to +.Ar file1 +and +.Ar file3 . +In other words, the +.Fl e +option ignores differences specific to +.Ar file1 +and +.Ar file2 , +and those specific to +.Ar file2 +and +.Ar file3 . +It is useful for backing out changes specific to +.Ar file2 +only. +.It Fl x +Produces an output script suitable for +.Xr ed 1 +with changes +specific only to all three versions. +.El +.Pp +The +.Fl E +option is used by +.Tn RCS +.Xr merge 1 +to ensure that overlapping changes in the merged files are preserved +and brought to someone's attention. +.Pp +For example, suppose lines 7-8 are changed in both +.Ar file1 +and +.Ar file2 . +Applying the edit script generated by the command +.Pp +.Dl $ diff3 -E file1 file2 file3 +.Pp +to +.Ar file1 +results in the file: +.Bd -literal -offset indent +lines 1-6 +of file1 +<<<<<<< file1 +lines 7-8 +of file1 +======= +lines 7-8 +of file3 +>>>>>>> file3 +rest of file1 +.Ed +.Pp +The default output of +.Nm +makes notation of the differences between all files, and those +differences specific to each pair of files. +The changes are described by the commands necessary for +.Xr ed 1 +to create the desired target from the different versions. +See +.Xr diff 1 +for a description of the commands. +.Bl -tag -width "=====" +.It Li \&==== +The lines beneath this notation are ranges of lines which are different +between all files. +.It \&==== Ns Va n +The lines beneath this notation are ranges of lines which are exclusively +different in file +.Va n . +.El +.Sh ENVIRONMENT +.Bl -tag -width TMPDIR +.It Ev TMPDIR +If the environment variable +.Ev TMPDIR +exists, +.Nm +will use the directory specified by +.Ev TMPDIR +as the temporary directory. +.El +.Sh FILES +.Bl -tag -width /usr/libexec/diff3prog -compact +.It Pa /tmp/d3a.XXXXXXXXXX +temporary file +.It Pa /tmp/d3b.XXXXXXXXXX +temporary file +.It Pa /usr/libexec/diff3prog +the actual executable +.El +.Sh SEE ALSO +.Xr diff 1 , +.Xr ed 1 , +.Xr merge 1 , +.Xr rcs 1 , +.Xr sdiff 1 +.Sh HISTORY +A +.Nm +command appeared in +.At v7 . +.Sh BUGS +The +.Fl e +option cannot catch and change lines which have +.Ql \&. +as the first and only character on the line. +The resulting script will fail on that line +as +.Ql \&. +is an +.Xr ed 1 +editing command. Added: soc2012/jhagewood/diff3/diff3-orig/diff3.ksh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff3/diff3-orig/diff3.ksh Mon Jun 4 23:29:06 2012 (r237103) @@ -0,0 +1,65 @@ +#!/bin/ksh - +# +# $OpenBSD: diff3.ksh,v 1.4 2006/02/22 22:35:11 jmc Exp $ +# +# Copyright (c) 2003 Todd C. Miller +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Sponsored in part by the Defense Advanced Research Projects +# Agency (DARPA) and Air Force Research Laboratory, Air Force +# Materiel Command, USAF, under agreement number F39502-99-1-0512. +# + +set -o posix # set POSIX mode to prevent +foo in getopts +OPTIND=1 # force getopts to reset itself + +export PATH=/bin:/usr/bin +diff3prog=/usr/libexec/diff3prog +USAGE="usage: diff3 [-3aEeXx] file1 file2 file3" + +# Pull out any command line flags (some for diff, some for diff3) +dflags= +d3flags= +while getopts "aeExX3" c; do + case "$c" in + a) + dflags="$dflags -$c" + ;; + e|E|x|X|3) + d3flags="-$c" + ;; + *) + echo "$USAGE" 1>&2 + exit 1 + ;; + esac +done +shift $(( $OPTIND - 1 )) + +if [ $# -lt 3 ]; then + echo "$USAGE" 1>&2 + exit 1 +fi + +TMP1=`mktemp -t d3a.XXXXXXXXXX` || exit 1 +TMP2=`mktemp -t d3b.XXXXXXXXXX` +if [ $? -ne 0 ]; then + rm -f $TMP1 + exit 1 +fi +trap "/bin/rm -f $TMP1 $TMP2" 0 1 2 13 15 +diff $dflags -- $1 $3 > $TMP1 +diff $dflags -- $2 $3 > $TMP2 +$diff3prog $d3flags -- $TMP1 $TMP2 $1 $2 $3 +exit $? Added: soc2012/jhagewood/diff3/diff3-orig/diff3.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff3/diff3-orig/diff3.sh Mon Jun 4 23:29:06 2012 (r237103) @@ -0,0 +1,66 @@ +#!/bin/sh - +# +# $OpenBSD: diff3.ksh,v 1.4 2006/02/22 22:35:11 jmc Exp $ +# +# Copyright (c) 2003 Todd C. Miller +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Sponsored in part by the Defense Advanced Research Projects +# Agency (DARPA) and Air Force Research Laboratory, Air Force +# Materiel Command, USAF, under agreement number F39502-99-1-0512. +# + +#set -o posix # set POSIX mode to prevent +foo in getopts +OPTIND=1 # force getopts to reset itself + +export PATH=/bin:/usr/bin +#diff3prog=/usr/libexec/diff3prog +diff3prog=$PWD/diff3prog +USAGE="usage: diff3 [-3aEeXx] file1 file2 file3" + +# Pull out any command line flags (some for diff, some for diff3) +dflags= +d3flags= +while getopts "3aAeEiL:mTvxX" c; do + case "$c" in + a) + dflags="$dflags -$c" + ;; + a|A|e|E|i|L|m|T|v|x|X|3) + d3flags="-$c" + ;; + *) + echo "$USAGE" 1>&2 + exit 1 + ;; + esac +done +shift $(( $OPTIND - 1 )) + +if [ $# -lt 3 ]; then + echo "$USAGE" 1>&2 + exit 1 +fi + +TMP1=`mktemp -t d3a.XXXXXXXXXX` || exit 1 +TMP2=`mktemp -t d3b.XXXXXXXXXX` +if [ $? -ne 0 ]; then + rm -f $TMP1 + exit 1 +fi +trap "/bin/rm -f $TMP1 $TMP2" 0 1 2 13 15 +diff $dflags -- $1 $3 > $TMP1 +diff $dflags -- $2 $3 > $TMP2 +$diff3prog $d3flags -- $TMP1 $TMP2 $1 $2 $3 +exit $? Added: soc2012/jhagewood/diff3/diff3-orig/diff3prog.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff3/diff3-orig/diff3prog.c Mon Jun 4 23:29:06 2012 (r237103) @@ -0,0 +1,710 @@ +/* $OpenBSD: diff3prog.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $ */ + +/* + * Copyright (C) Caldera International Inc. 2001-2002. + * 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 and documentation 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed or owned by Caldera + * International, Inc. + * 4. Neither the name of Caldera International, Inc. nor the names of other + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA + * INTERNATIONAL, INC. 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 CALDERA INTERNATIONAL, INC. 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. + */ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)diff3.c 8.1 (Berkeley) 6/6/93 + */ + +#ifdef __FreeBSD__ +#define __dead +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* diff3 - 3-way differential file comparison */ + +/* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] + * + * d13 = diff report on f1 vs f3 + * d23 = diff report on f2 vs f3 + * f1, f2, f3 the 3 files + * if changes in f1 overlap with changes in f3, m1 and m3 are used + * to mark the overlaps; otherwise, the file names f1 and f3 are used + * (only for options E and X). + */ + +/* + * "from" is first in range of changed lines; "to" is last+1 + * from=to=line after point of insertion for added lines. + */ +struct range { + int from; + int to; +}; +struct diff { + struct range old; + struct range new; +}; + +size_t szchanges; + +struct diff *d13; +struct diff *d23; +/* + * "de" is used to gather editing scripts. These are later spewed out in + * reverse order. Its first element must be all zero, the "new" component + * of "de" contains line positions or byte positions depending on when you + * look (!?). Array overlap indicates which sections in "de" correspond to + * lines that are different in all three files. + */ +struct diff *de; +char *overlap; +int overlapcnt; +FILE *fp[3]; +int cline[3]; /* # of the last-read line in each file (0-2) */ +char *diff_prog = NULL; +char *labels[3] = {NULL}; +/* + * the latest known correspondence between line numbers of the 3 files + * is stored in last[1-3]; + */ +int last[4]; +int aflag, Aflag, eflag, iflag, Tflag; +int oflag; /* indicates whether to mark overlaps (-E or -X)*/ +int strip_cr; +int debug = 0; +char f1mark[40], f2mark[40], f3mark[40]; /* markers for -E and -X */ + +int duplicate(struct range *, struct range *); +int edit(struct diff *, int, int); +char *getchange(FILE *); +char *getline(FILE *, size_t *); +int number(char **); +int readin(char *, struct diff **); +int skip(int, int, char *); +void change(int, struct range *, int); +void keep(int, struct range *); +void merge(int, int); +static int asciifile(FILE *); +void prange(struct range *); +void repos(int); +void separate(const char *); +__dead void edscript(int); +__dead void trouble(void); +void increase(void); +__dead void usage(void); + +enum { + HELP_OPT = CHAR_MAX + 1, + STRIPCR_OPT, + DIFFPROG_OPT, +}; + +#define OPTIONS "3aAeEiL:mTvxX" +static struct option longopts[] = { + { "ed", no_argument, NULL, 'e' }, + { "show-overlap", no_argument, NULL, 'E' }, + { "overlap-only", no_argument, NULL, 'x' }, + { "initial-tab", no_argument, NULL, 'T' }, + { "text", no_argument, NULL, 'a' }, + + /* features to implement */ + { "show-all", no_argument, NULL, 'A' }, + { "easy-only", no_argument, NULL, '3' }, + { "merge", no_argument, NULL, 'm' }, + { "label", required_argument, NULL, 'L' }, + { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, + { "diff-program", required_argument, NULL, DIFFPROG_OPT }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, HELP_OPT } +}; + + +int +main(int argc, char **argv) +{ + int ch, i, m, n; + + eflag = 0; + oflag = 0; + while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) { + switch (ch) { + case 'A': + Aflag = 1; + break; + case 'a': + aflag = 1; + break; + case 'E': + eflag = 3; + oflag = 1; + break; + case 'e': + eflag = 3; + break; + case 'i': + iflag = 1; + break; + case 'L': + oflag = 1; + for(i=0; i<3 && labels[i] != NULL; i++); + i = i <= 2 ? i : 2 ; + labels[i] = optarg; + break; + case 'T': + Tflag = 1; + break; + case 'X': + oflag = eflag = 1; + break; + case 'x': + eflag = 1; + break; + case '3': + eflag = 2; + break; + case STRIPCR_OPT: + strip_cr = 1; + break; + case DIFFPROG_OPT: + diff_prog = optarg; + break; + } + } + argc -= optind; + argv += optind; + /* XXX - argc usage seems wrong here */ + if (argc < 5) + usage(); + + if (oflag) { + (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", + labels[0] != NULL ? labels[0] : + argc >= 6 ? argv[5] : argv[2]); + (void)snprintf(f2mark, sizeof(f2mark), "||||||| %s", + labels[1] != NULL ? labels[1] : + argc >= 6 ? argv[4] : argv[3]); + (void)snprintf(f3mark, sizeof(f3mark), ">>>>>>> %s", + labels[2] != NULL ? labels[2] : + argc >= 7 ? argv[6] : argv[4]); + } + + increase(); + m = readin(argv[0], &d13); + n = readin(argv[1], &d23); + for (i = 0; i <= 2; i++) { + if ((fp[i] = fopen(argv[i + 2], "r")) == NULL) + err(EXIT_FAILURE, "can't open %s", argv[i + 2]); + } + merge(m, n); + exit(EXIT_SUCCESS); +} + +/* + * Pick up the line numbers of all changes from one change file. + * (This puts the numbers in a vector, which is not strictly necessary, + * since the vector is processed in one sequential pass. + * The vector could be optimized out of existence) + */ +int +readin(char *name, struct diff **dd) +{ + int a, b, c, d, i; + char kind, *p; + + fp[0] = fopen(name, "r"); + if (fp[0] == NULL) + err(EXIT_FAILURE, "can't open %s", name); + for (i=0; (p = getchange(fp[0])); i++) { + if (i >= szchanges - 1) + increase(); + a = b = number(&p); + if (*p == ',') { + p++; + b = number(&p); + } + kind = *p++; + c = d = number(&p); + if (*p==',') { + p++; + d = number(&p); + } + if (kind == 'a') + a++; + if (kind == 'd') + c++; + b++; + d++; + (*dd)[i].old.from = a; + (*dd)[i].old.to = b; + (*dd)[i].new.from = c; + (*dd)[i].new.to = d; + } + if (i) { + (*dd)[i].old.from = (*dd)[i-1].old.to; + (*dd)[i].new.from = (*dd)[i-1].new.to; + } + (void)fclose(fp[0]); + return (i); +} + +int +number(char **lc) +{ + int nn; + nn = 0; + while (isdigit((unsigned char)(**lc))) + nn = nn*10 + *(*lc)++ - '0'; + return (nn); +} + +char * +getchange(FILE *b) +{ + char *line; + + while ((line = getline(b, NULL))) { + if (isdigit((unsigned char)line[0])) + return (line); + } + return (NULL); +} + +char * +getline(FILE *b, size_t *n) +{ + char *cp; + size_t len; + static char *buf; + static size_t bufsize; + + if ((cp = fgetln(b, &len)) == NULL) + return (NULL); + + if (cp[len - 1] != '\n') + len++; + if (len + 1 > bufsize) { + do { + bufsize += 1024; + } while (len + 1 > bufsize); + if ((buf = realloc(buf, bufsize)) == NULL) + err(EXIT_FAILURE, NULL); + } + memcpy(buf, cp, len - 1); + buf[len - 1] = '\n'; + buf[len] = '\0'; + if (n != NULL) + *n = len; + return (buf); +} + +void +merge(int m1, int m2) +{ + struct diff *d1, *d2, *d3; + int dup, j, t1, t2; + + d1 = d13; + d2 = d23; + j = 0; + + if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) + { + printf("Binary file detected; comparison failed\n"); + exit(EXIT_FAILURE); + } + while ((t1 = d1 < d13 + m1) | (t2 = d2 < d23 + m2)) { + if (debug) { + printf("%d,%d=%d,%d %d,%d=%d,%d\n", + d1->old.from,d1->old.to, + d1->new.from,d1->new.to, + d2->old.from,d2->old.to, + d2->new.from,d2->new.to); + } + /* first file is different from others */ + if (!t2 || (t1 && d1->new.to < d2->new.from)) { + /* stuff peculiar to 1st file */ + if (eflag==0) { + separate("1"); + change(1, &d1->old, 0); + keep(2, &d1->new); + change(3, &d1->new, 0); + } + d1++; + continue; + } + /* second file is different from others */ + if (!t1 || (t2 && d2->new.to < d1->new.from)) { + if (eflag==0) { + separate("2"); + keep(1, &d2->new); + change(2, &d2->old, 0); + change(3, &d2->new, 0); + } + d2++; + continue; + } + /* + * Merge overlapping changes in first file + * this happens after extension (see below). + */ + if (d1 + 1 < d13 + m1 && d1->new.to >= d1[1].new.from) { + d1[1].old.from = d1->old.from; + d1[1].new.from = d1->new.from; + d1++; + continue; + } + + /* merge overlapping changes in second */ + if (d2 + 1 < d23 + m2 && d2->new.to >= d2[1].new.from) { + d2[1].old.from = d2->old.from; + d2[1].new.from = d2->new.from; + d2++; + continue; + } + /* stuff peculiar to third file or different in all */ + if (d1->new.from == d2->new.from && d1->new.to == d2->new.to) { + dup = duplicate(&d1->old,&d2->old); + /* + * dup = 0 means all files differ + * dup = 1 means files 1 and 2 identical + */ + if (eflag==0) { + separate(dup ? "3" : ""); + change(1, &d1->old, dup); + change(2, &d2->old, 0); + d3 = d1->old.to > d1->old.from ? d1 : d2; + change(3, &d3->new, 0); + } else + j = edit(d1, dup, j); + d1++; + d2++; + continue; + } + /* + * Overlapping changes from file 1 and 2; extend changes + * appropriately to make them coincide. + */ + if (d1->new.from < d2->new.from) { + d2->old.from -= d2->new.from-d1->new.from; + d2->new.from = d1->new.from; + } else if (d2->new.from < d1->new.from) { + d1->old.from -= d1->new.from-d2->new.from; + d1->new.from = d2->new.from; + } + if (d1->new.to > d2->new.to) { + d2->old.to += d1->new.to - d2->new.to; + d2->new.to = d1->new.to; + } else if (d2->new.to > d1->new.to) { + d1->old.to += d2->new.to - d1->new.to; + d1->new.to = d2->new.to; + } + } + if (eflag) + edscript(j); +} + +static int +asciifile(FILE *f) +{ + wint_t ch = L'\0'; + size_t i; + + if (aflag || f == NULL) + return (1); + + rewind(f); + errno = 0; + for (i = 0; i <= BUFSIZ; i++) { + if ((ch = fgetwc(f)) == WEOF) { + if (errno == EILSEQ) + return (0); + break; + } + if (!iswspace(ch) && iswcntrl(ch)) + return (0); + } + return (1); +} + +void +separate(const char *s) +{ + printf("====%s\n", s); +} + +/* + * The range of lines rold.from thru rold.to in file i is to be changed. + * It is to be printed only if it does not duplicate something to be + * printed later. + */ +void +change(int i, struct range *rold, int dup) +{ + printf("%d:", i); + last[i] = rold->to; + prange(rold); + if (dup || debug) + return; + i--; + (void)skip(i, rold->from, NULL); + (void)skip(i, rold->to, " "); +} + +/* + * print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 + */ +void +prange(struct range *rold) +{ + if (rold->to <= rold->from) + printf("%da\n", rold->from - 1); + else { + printf("%d", rold->from); + if (rold->to > rold->from+1) + printf(",%d", rold->to - 1); + printf("c\n"); + } +} + +/* + * No difference was reported by diff between file 1 (or 2) and file 3, + * and an artificial dummy difference (trange) must be ginned up to + * correspond to the change reported in the other file. + */ +void +keep(int i, struct range *rnew) +{ + int delta; + struct range trange; + + delta = last[3] - last[i]; + trange.from = rnew->from - delta; + trange.to = rnew->to - delta; + change(i, &trange, 1); +} + +/* + * skip to just before line number from in file "i". If "pr" is non-NULL, + * print all skipped stuff with string pr as a prefix. + */ +int +skip(int i, int from, char *pr) +{ + size_t j, n; + char *line; + + for (n = 0; cline[i] < from - 1; n += j) { + if ((line = getline(fp[i], &j)) == NULL) + trouble(); + if (pr != NULL) + printf("%s%s", Tflag == 1? "\t" : pr, line); + + cline[i]++; + } + return ((int) n); +} + +/* + * Return 1 or 0 according as the old range (in file 1) contains exactly + * the same data as the new range (in file 2). + */ +int +duplicate(struct range *r1, struct range *r2) +{ + int c,d; + int nchar; + int nline; + + if (r1->to-r1->from != r2->to-r2->from) + return (0); + (void)skip(0, r1->from, NULL); + (void)skip(1, r2->from, NULL); + nchar = 0; + for (nline=0; nline < r1->to - r1->from; nline++) { + do { + c = getc(fp[0]); + d = getc(fp[1]); + if (c == -1 || d== -1) + trouble(); + nchar++; + if (c != d) { + repos(nchar); + return (0); + } + } while (c != '\n'); + } + repos(nchar); + return (1); +} + +void +repos(int nchar) +{ + int i; + + for (i = 0; i < 2; i++) + (void)fseek(fp[i], (long)-nchar, SEEK_CUR); +} + +__dead void +trouble(void) +{ + errx(EXIT_FAILURE, "logic error"); +} + +/* + * collect an editing script for later regurgitation + */ +int +edit(struct diff *diff, int dup, int j) +{ + if (((dup + 1) & eflag) == 0) + return (j); + j++; + overlap[j] = !dup; + if (!dup) + overlapcnt++; + de[j].old.from = diff->old.from; + de[j].old.to = diff->old.to; + de[j].new.from = de[j-1].new.to + skip(2, diff->new.from, NULL); + de[j].new.to = de[j].new.from + skip(2, diff->new.to, NULL); + return (j); +} + +/* regurgitate */ +__dead void +edscript(int n) +{ + int j,k; + char block[BUFSIZ]; + + for (n = n; n > 0; n--) { + if (!oflag || !overlap[n]) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 00:06:48 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 88DF6106564A for ; Tue, 5 Jun 2012 00:06:46 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 00:06:46 +0000 Date: Tue, 05 Jun 2012 00:06:46 +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: <20120605000646.88DF6106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237104 - in soc2012/jhagewood: diff3 diff3/diff3 mdocml 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: Tue, 05 Jun 2012 00:06:48 -0000 Author: jhagewood Date: Tue Jun 5 00:06:45 2012 New Revision: 237104 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237104 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Mon Jun 4 23:29:06 2012 (r237103) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 00:06:45 2012 (r237104) @@ -151,7 +151,9 @@ __dead void edscript(int); __dead void trouble(void); void increase(void); -__dead void usage(void); +__dead void try_help(void); +void help(void); +void usage(void); enum { HELP_OPT = CHAR_MAX + 1, @@ -167,6 +169,7 @@ { "initial-tab", no_argument, NULL, 'T' }, { "text", no_argument, NULL, 'a' }, { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 128 }, /* features to implement */ { "show-all", no_argument, NULL, 'A' }, @@ -176,7 +179,7 @@ { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, - { "help", no_argument, NULL, HELP_OPT } + }; @@ -226,6 +229,10 @@ case '3': eflag = 2; break; + case 128: + usage(); + help(); + exit(0); case STRIPCR_OPT: strip_cr = 1; break; @@ -237,8 +244,10 @@ argc -= optind; argv += optind; /* XXX - argc usage seems wrong here */ - if (argc < 5) + if (argc < 5) { usage(); + try_help(); + } if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", @@ -703,13 +712,39 @@ } -__dead void +__dead void +try_help(void) +{ + fprintf(stderr, "diff3: Try `diff3 --help' for more information."); + exit(EXIT_FAILURE); +} + +void +help(void) +{ + printf ("%s", "\ + -e --ed Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\ + -A --show-all Output all changes, bracketing conflicts.\n\ + -x --overlap-only Output overlapping changes.\n\ + -3 --easy-only Output unmerged nonoverlapping changes.\n\n"); + printf ("%s", "\ + -m --merge Output merged file instead of ed script (default -A).\n\ + -L LABEL --label=LABEL Use LABEL instead of file name.\n\ + -a --text Treat all files as text.\n\ + -T --initial-tab Make tabs line up by prepending a tab.\n\n"); + printf ("%s", "\ + -v --version Output version info.\n\ + --help Output this help.\n\n"); + printf ("If a FILE is `-', read standard input.\n"); + +} + +void usage(void) { extern char *__progname; fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " "/tmp/d3b.?????????? file1 file2 file3\n", __progname); - fprintf(stderr, "diff3: Try `diff3 --help' for more information."); - exit(EXIT_FAILURE); + } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jun 4 23:29:06 2012 (r237103) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 00:06:45 2012 (r237104) @@ -1,26 +1,40 @@ -diff -rupN diff3-orig/diff3prog.c diff3/diff3prog.c ---- diff3-orig/diff3prog.c 2012-06-01 05:35:13.000000000 -0400 -+++ diff3/diff3prog.c 2012-06-04 23:23:50.000000000 -0400 -@@ -166,7 +166,8 @@ static struct option longopts[] = { +diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 00:06:08.000000000 -0400 +@@ -151,7 +151,9 @@ void separate(const char *); + __dead void edscript(int); + __dead void trouble(void); + void increase(void); +-__dead void usage(void); ++__dead void try_help(void); ++void help(void); ++void usage(void); + + enum { + HELP_OPT = CHAR_MAX + 1, +@@ -166,7 +168,9 @@ static struct option longopts[] = { { "overlap-only", no_argument, NULL, 'x' }, { "initial-tab", no_argument, NULL, 'T' }, { "text", no_argument, NULL, 'a' }, - + { "version", no_argument, NULL, 'v' }, ++ { "help", no_argument, NULL, 128 }, + /* features to implement */ { "show-all", no_argument, NULL, 'A' }, { "easy-only", no_argument, NULL, '3' }, -@@ -174,7 +175,7 @@ static struct option longopts[] = { +@@ -174,8 +178,8 @@ static struct option longopts[] = { { "label", required_argument, NULL, 'L' }, { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, - { "version", no_argument, NULL, 'v' }, +- { "help", no_argument, NULL, HELP_OPT } ++ + - { "help", no_argument, NULL, HELP_OPT } }; -@@ -216,6 +217,9 @@ main(int argc, char **argv) + +@@ -216,12 +220,19 @@ main(int argc, char **argv) case 'X': oflag = eflag = 1; break; @@ -30,10 +44,67 @@ case 'x': eflag = 1; break; -@@ -706,5 +710,6 @@ usage(void) + case '3': + eflag = 2; + break; ++ case 128: ++ usage(); ++ help(); ++ exit(0); + case STRIPCR_OPT: + strip_cr = 1; + break; +@@ -233,8 +244,10 @@ main(int argc, char **argv) + argc -= optind; + argv += optind; + /* XXX - argc usage seems wrong here */ +- if (argc < 5) ++ if (argc < 5) { + usage(); ++ try_help(); ++ } + + if (oflag) { + (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", +@@ -699,12 +712,39 @@ increase(void) + } + + +-__dead void ++__dead void ++try_help(void) ++{ ++ fprintf(stderr, "diff3: Try `diff3 --help' for more information."); ++ exit(EXIT_FAILURE); ++} ++ ++void ++help(void) ++{ ++ printf ("%s", "\ ++ -e --ed Output unmerged changes from OLDFILE to YOURFILE into MYFILE.\n\ ++ -A --show-all Output all changes, bracketing conflicts.\n\ ++ -x --overlap-only Output overlapping changes.\n\ ++ -3 --easy-only Output unmerged nonoverlapping changes.\n\n"); ++ printf ("%s", "\ ++ -m --merge Output merged file instead of ed script (default -A).\n\ ++ -L LABEL --label=LABEL Use LABEL instead of file name.\n\ ++ -a --text Treat all files as text.\n\ ++ -T --initial-tab Make tabs line up by prepending a tab.\n\n"); ++ printf ("%s", "\ ++ -v --version Output version info.\n\ ++ --help Output this help.\n\n"); ++ printf ("If a FILE is `-', read standard input.\n"); ++ ++} ++ ++void + usage(void) + { + extern char *__progname; fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " "/tmp/d3b.?????????? file1 file2 file3\n", __progname); -+ fprintf(stderr, "diff3: Try `diff3 --help' for more information."); - exit(EXIT_FAILURE); +- exit(EXIT_FAILURE); ++ } Modified: soc2012/jhagewood/mdocml/hagewood-mdocml.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml.patch Mon Jun 4 23:29:06 2012 (r237103) +++ soc2012/jhagewood/mdocml/hagewood-mdocml.patch Tue Jun 5 00:06:45 2012 (r237104) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-04 04:47:34.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-04 23:30:15.000000000 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -11,8 +11,8 @@ MAN_RS, MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-01 05:35:15.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-04 05:04:08.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-04 23:30:15.000000000 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 01:03:12 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 C09991065678 for ; Tue, 5 Jun 2012 01:03:10 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 01:03:10 +0000 Date: Tue, 05 Jun 2012 01:03:10 +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: <20120605010310.C09991065678@hub.freebsd.org> Cc: Subject: socsvn commit: r237105 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 01:03:12 -0000 Author: jhagewood Date: Tue Jun 5 01:03:10 2012 New Revision: 237105 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237105 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 00:06:45 2012 (r237104) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 01:03:10 2012 (r237105) @@ -169,7 +169,7 @@ { "initial-tab", no_argument, NULL, 'T' }, { "text", no_argument, NULL, 'a' }, { "version", no_argument, NULL, 'v' }, - { "help", no_argument, NULL, 128 }, + { "help", no_argument, NULL, HELP_OPT }, /* features to implement */ { "show-all", no_argument, NULL, 'A' }, @@ -229,7 +229,7 @@ case '3': eflag = 2; break; - case 128: + case HELP_OPT: usage(); help(); exit(0); @@ -715,7 +715,7 @@ __dead void try_help(void) { - fprintf(stderr, "diff3: Try `diff3 --help' for more information."); + fprintf(stderr, "diff3: Try `diff3 --help' for more information.\n"); exit(EXIT_FAILURE); } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 00:06:45 2012 (r237104) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:03:10 2012 (r237105) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 00:06:08.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:02:57.000000000 -0400 @@ -151,7 +151,9 @@ void separate(const char *); __dead void edscript(int); __dead void trouble(void); @@ -18,7 +18,7 @@ { "text", no_argument, NULL, 'a' }, - + { "version", no_argument, NULL, 'v' }, -+ { "help", no_argument, NULL, 128 }, ++ { "help", no_argument, NULL, HELP_OPT }, + /* features to implement */ { "show-all", no_argument, NULL, 'A' }, @@ -47,7 +47,7 @@ case '3': eflag = 2; break; -+ case 128: ++ case HELP_OPT: + usage(); + help(); + exit(0); @@ -74,7 +74,7 @@ +__dead void +try_help(void) +{ -+ fprintf(stderr, "diff3: Try `diff3 --help' for more information."); ++ fprintf(stderr, "diff3: Try `diff3 --help' for more information.\n"); + exit(EXIT_FAILURE); +} + From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 01:14:47 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 CE2A6106566C for ; Tue, 5 Jun 2012 01:14:45 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 01:14:45 +0000 Date: Tue, 05 Jun 2012 01:14:45 +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: <20120605011445.CE2A6106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237106 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 01:14:48 -0000 Author: jhagewood Date: Tue Jun 5 01:14:45 2012 New Revision: 237106 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237106 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 01:03:10 2012 (r237105) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 01:14:45 2012 (r237106) @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ +extern char const *__progname; +char const version_string[] = "8.1"; + /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * * d13 = diff report on f1 vs f3 @@ -156,14 +159,14 @@ void usage(void); enum { - HELP_OPT = CHAR_MAX + 1, - STRIPCR_OPT, + HELP_OPT = CHAR_MAX + 1, + STRIPCR_OPT, DIFFPROG_OPT, }; #define OPTIONS "3aAeEiL:mTvxX" static struct option longopts[] = { - { "ed", no_argument, NULL, 'e' }, + { "ed", no_argument, NULL, 'e' }, { "show-overlap", no_argument, NULL, 'E' }, { "overlap-only", no_argument, NULL, 'x' }, { "initial-tab", no_argument, NULL, 'T' }, @@ -221,7 +224,7 @@ oflag = eflag = 1; break; case 'v': - printf("FreeBSD diff3 8.1\n"); + printf("FreeBSD %s %s\n", __progname, version_string); exit(0); case 'x': eflag = 1; @@ -742,7 +745,6 @@ void usage(void) { - extern char *__progname; fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " "/tmp/d3b.?????????? file1 file2 file3\n", __progname); Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:03:10 2012 (r237105) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:14:45 2012 (r237106) @@ -1,7 +1,17 @@ diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:02:57.000000000 -0400 -@@ -151,7 +151,9 @@ void separate(const char *); ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:13:37.000000000 -0400 +@@ -82,6 +82,9 @@ + + /* diff3 - 3-way differential file comparison */ + ++extern char const *__progname; ++char const version_string[] = "8.1"; ++ + /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] + * + * d13 = diff report on f1 vs f3 +@@ -151,22 +154,26 @@ void separate(const char *); __dead void edscript(int); __dead void trouble(void); void increase(void); @@ -11,8 +21,18 @@ +void usage(void); enum { - HELP_OPT = CHAR_MAX + 1, -@@ -166,7 +168,9 @@ static struct option longopts[] = { +- HELP_OPT = CHAR_MAX + 1, +- STRIPCR_OPT, ++ HELP_OPT = CHAR_MAX + 1, ++ STRIPCR_OPT, + DIFFPROG_OPT, + }; + + #define OPTIONS "3aAeEiL:mTvxX" + static struct option longopts[] = { +- { "ed", no_argument, NULL, 'e' }, ++ { "ed", no_argument, NULL, 'e' }, + { "show-overlap", no_argument, NULL, 'E' }, { "overlap-only", no_argument, NULL, 'x' }, { "initial-tab", no_argument, NULL, 'T' }, { "text", no_argument, NULL, 'a' }, @@ -23,7 +43,7 @@ /* features to implement */ { "show-all", no_argument, NULL, 'A' }, { "easy-only", no_argument, NULL, '3' }, -@@ -174,8 +178,8 @@ static struct option longopts[] = { +@@ -174,8 +181,8 @@ static struct option longopts[] = { { "label", required_argument, NULL, 'L' }, { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, @@ -34,12 +54,12 @@ }; -@@ -216,12 +220,19 @@ main(int argc, char **argv) +@@ -216,12 +223,19 @@ main(int argc, char **argv) case 'X': oflag = eflag = 1; break; + case 'v': -+ printf("FreeBSD diff3 8.1\n"); ++ printf("FreeBSD %s %s\n", __progname, version_string); + exit(0); case 'x': eflag = 1; @@ -54,7 +74,7 @@ case STRIPCR_OPT: strip_cr = 1; break; -@@ -233,8 +244,10 @@ main(int argc, char **argv) +@@ -233,8 +247,10 @@ main(int argc, char **argv) argc -= optind; argv += optind; /* XXX - argc usage seems wrong here */ @@ -66,7 +86,7 @@ if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", -@@ -699,12 +712,39 @@ increase(void) +@@ -699,12 +715,38 @@ increase(void) } @@ -101,7 +121,7 @@ +void usage(void) { - extern char *__progname; +- extern char *__progname; fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " "/tmp/d3b.?????????? file1 file2 file3\n", __progname); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 01:17:58 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 E7C8F106564A for ; Tue, 5 Jun 2012 01:17:55 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 01:17:55 +0000 Date: Tue, 05 Jun 2012 01:17:55 +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: <20120605011755.E7C8F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237107 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 01:17:58 -0000 Author: jhagewood Date: Tue Jun 5 01:17:55 2012 New Revision: 237107 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237107 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 01:14:45 2012 (r237106) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 01:17:55 2012 (r237107) @@ -83,7 +83,7 @@ /* diff3 - 3-way differential file comparison */ extern char const *__progname; -char const version_string[] = "8.1"; +char const __version[] = "8.1"; /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * @@ -224,7 +224,7 @@ oflag = eflag = 1; break; case 'v': - printf("FreeBSD %s %s\n", __progname, version_string); + printf("FreeBSD %s %s\n", __progname, __version); exit(0); case 'x': eflag = 1; @@ -718,7 +718,7 @@ __dead void try_help(void) { - fprintf(stderr, "diff3: Try `diff3 --help' for more information.\n"); + fprintf(stderr, "%s: Try `%s --help' for more information.\n", __progname, __progname); exit(EXIT_FAILURE); } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:14:45 2012 (r237106) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:17:55 2012 (r237107) @@ -1,12 +1,12 @@ diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:13:37.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:17:18.000000000 -0400 @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ +extern char const *__progname; -+char const version_string[] = "8.1"; ++char const __version[] = "8.1"; + /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * @@ -59,7 +59,7 @@ oflag = eflag = 1; break; + case 'v': -+ printf("FreeBSD %s %s\n", __progname, version_string); ++ printf("FreeBSD %s %s\n", __progname, __version); + exit(0); case 'x': eflag = 1; @@ -94,7 +94,7 @@ +__dead void +try_help(void) +{ -+ fprintf(stderr, "diff3: Try `diff3 --help' for more information.\n"); ++ fprintf(stderr, "%s: Try `%s --help' for more information.\n", __progname, __progname); + exit(EXIT_FAILURE); +} + From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 01:41:49 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 94DE5106566C for ; Tue, 5 Jun 2012 01:41:47 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 01:41:47 +0000 Date: Tue, 05 Jun 2012 01:41:47 +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: <20120605014147.94DE5106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237108 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 01:41:49 -0000 Author: jhagewood Date: Tue Jun 5 01:41:46 2012 New Revision: 237108 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237108 Log: Modified: soc2012/jhagewood/diff3/diff3/Makefile soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/Makefile ============================================================================== --- soc2012/jhagewood/diff3/diff3/Makefile Tue Jun 5 01:17:55 2012 (r237107) +++ soc2012/jhagewood/diff3/diff3/Makefile Tue Jun 5 01:41:46 2012 (r237108) @@ -6,6 +6,6 @@ beforeinstall: install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 + ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 .include Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:17:55 2012 (r237107) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 01:41:46 2012 (r237108) @@ -1,3 +1,14 @@ +diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-04 23:30:11.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-05 01:41:11.000000000 -0400 +@@ -6,6 +6,6 @@ BINDIR= /usr/libexec + + beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 ++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 + + .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 +++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:17:18.000000000 -0400 From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 06:00: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 EDA831065670 for ; Tue, 5 Jun 2012 06:00:06 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 06:00:06 +0000 Date: Tue, 05 Jun 2012 06:00:06 +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: <20120605060006.EDA831065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237113 - 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: Tue, 05 Jun 2012 06:00:09 -0000 Author: gmiller Date: Tue Jun 5 06:00:06 2012 New Revision: 237113 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237113 Log: Add time parameters to lock profiling functions to track blocking times on contested locks. Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c 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/libthr/thread/thr_pspinlock.c soc2012/gmiller/locking-head/lib/libthr/thread/thr_rwlock.c Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Tue Jun 5 05:16:04 2012 (r237112) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Tue Jun 5 06:00:06 2012 (r237113) @@ -339,19 +339,23 @@ struct pthread_mutex *m = *mutex; uint32_t id; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif id = TID(curthread); if (m->m_flags & PMUTEX_FLAG_PRIVATE) THR_CRITICAL_ENTER(curthread); ret = _thr_umutex_trylock(&m->m_lock, id); if (__predict_true(ret == 0)) { ENQUEUE_MUTEX(curthread, m); - MUTEX_OBTAIN_SUCCESS(m); + MUTEX_OBTAIN_SUCCESS(m, &waittime); } else if (m->m_owner == curthread) { ret = mutex_self_trylock(m _PROFILE_PASS); - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); } else { - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); } if (ret && (m->m_flags & PMUTEX_FLAG_PRIVATE)) @@ -387,11 +391,15 @@ uint32_t id, owner; int count; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif if (m->m_owner == curthread) return mutex_self_lock(m, abstime _PROFILE_PASS); - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); id = TID(curthread); /* @@ -446,7 +454,7 @@ done: if (ret == 0) { ENQUEUE_MUTEX(curthread, m); - MUTEX_OBTAIN_SUCCESS(m); + MUTEX_OBTAIN_SUCCESS(m, &waittime); } return (ret); @@ -458,14 +466,18 @@ { struct pthread *curthread = _get_curthread(); int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif if (!cvattach && m->m_flags & PMUTEX_FLAG_PRIVATE) THR_CRITICAL_ENTER(curthread); if (_thr_umutex_trylock2(&m->m_lock, TID(curthread)) == 0) { ENQUEUE_MUTEX(curthread, m); ret = 0; - MUTEX_OBTAIN_SUCCESS(m); + MUTEX_OBTAIN_SUCCESS(m, &waittime); } else { ret = mutex_lock_sleep(curthread, m, abstime _PROFILE_PASS); } @@ -600,7 +612,11 @@ mutex_self_trylock(struct pthread_mutex *m _PROFILE_PARMS) { int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif switch (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_NORMAL: @@ -622,9 +638,9 @@ } if (ret == 0) { - MUTEX_OBTAIN_SUCCESS(m); + MUTEX_OBTAIN_SUCCESS(m, &waittime); } else { - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); } return (ret); @@ -636,11 +652,15 @@ { struct timespec ts1, ts2; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif switch (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_ADAPTIVE_NP: - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); if (abstime) { if (abstime->tv_sec < 0 || abstime->tv_nsec < 0 || @@ -666,7 +686,7 @@ * What SS2 define as a 'normal' mutex. Intentionally * deadlock on attempts to get a lock you already own. */ - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); ret = 0; if (abstime) { @@ -694,7 +714,7 @@ ret = 0; } else { ret = EAGAIN; - MUTEX_OBTAIN_FAILED(m); + MUTEX_OBTAIN_FAILED(m, &waittime); } break; @@ -704,7 +724,7 @@ } if (ret == 0) { - MUTEX_OBTAIN_SUCCESS(m); + MUTEX_OBTAIN_SUCCESS(m, &waittime); } return (ret); @@ -716,7 +736,11 @@ struct pthread *curthread = _get_curthread(); uint32_t id; int defered; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif if (__predict_false(m <= THR_MUTEX_DESTROYED)) { if (m == THR_MUTEX_DESTROYED) return (EINVAL); @@ -736,10 +760,10 @@ m->m_count--; if (m->m_count == 0) { - MUTEX_RELEASE(m); + MUTEX_RELEASE(m, &waittime); } } else { - MUTEX_RELEASE(m); + MUTEX_RELEASE(m, &waittime); if ((m->m_flags & PMUTEX_FLAG_DEFERED) != 0) { defered = 1; Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Tue Jun 5 05:16:04 2012 (r237112) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Tue Jun 5 06:00:06 2012 (r237113) @@ -743,27 +743,41 @@ 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 _mutex_obtain_failed(struct pthread_mutex *, const char *, int) +void _mutex_obtain_failed(struct pthread_mutex *, + struct timespec *waittime, const char *, int) __hidden; -void _mutex_obtain_success(struct pthread_mutex *, const char *, int) +void _mutex_obtain_success(struct pthread_mutex *, + struct timespec *waittime, const char *, int) __hidden; void _lock_profile_exit_thread(struct pthread *curthread) __hidden; -void _rwlock_obtain_read_success(struct pthread_rwlock *, const char *file, - int line) __hidden; -void _rwlock_obtain_read_failed(struct pthread_rwlock *, const char *file, - int line) __hidden; -void _rwlock_obtain_write_success(struct pthread_rwlock *, const char *file, - int line) __hidden; -void _rwlock_obtain_write_failed(struct pthread_rwlock *, const char *file, - int line) __hidden; -void _rwlock_release_read(struct pthread_rwlock *) __hidden; -void _rwlock_release_write(struct pthread_rwlock *) __hidden; -void _mutex_release(struct pthread_mutex *) __hidden; -void _spin_obtain_success(struct pthread_spinlock *, const char *file, - int line) __hidden; -void _spin_obtain_failed(struct pthread_spinlock *, const char *file, - int line) __hidden; -void _spin_release(struct pthread_spinlock *) __hidden; +void _rwlock_obtain_read_success(struct pthread_rwlock *, + struct timespec *waittime, + const char *file, int line) + __hidden; +void _rwlock_obtain_read_failed(struct pthread_rwlock *, + struct timespec *waittime, + const char *file, int line) + __hidden; +void _rwlock_obtain_write_success(struct pthread_rwlock *, + struct timespec *waittime, + const char *file, int line) + __hidden; +void _rwlock_obtain_write_failed(struct pthread_rwlock *, + struct timespec *waittime, + const char *file, int line) + __hidden; +void _rwlock_release_read(struct pthread_rwlock *, struct timespec *) + __hidden; +void _rwlock_release_write(struct pthread_rwlock *, struct timespec *) + __hidden; +void _mutex_release(struct pthread_mutex *, struct timespec *) __hidden; +void _spin_obtain_success(struct pthread_spinlock *, + struct timespec *waittime, + const char *file, int line) __hidden; +void _spin_obtain_failed(struct pthread_spinlock *, + struct timespec *waittime, + const char *file, int line) __hidden; +void _spin_release(struct pthread_spinlock *, struct timespec *) __hidden; void _libpthread_init(struct pthread *) __hidden; struct pthread *_thr_alloc(struct pthread *) __hidden; void _thread_exit(const char *, int, const char *) __hidden __dead2; @@ -826,43 +840,43 @@ #define LOCK_PROFILE_EXIT_THREAD(t) \ _lock_profile_exit_thread(t) -#define MUTEX_OBTAIN_SUCCESS(m) \ - _mutex_obtain_success(m, file, line) -#define MUTEX_OBTAIN_FAILED(m) \ - _mutex_obtain_failed(m, file, line) -#define MUTEX_RELEASE(m) _mutex_release(m) -#define RWLOCK_OBTAIN_READ_SUCCESS(l) \ - _rwlock_obtain_read_success(l, file, line) -#define RWLOCK_OBTAIN_READ_FAILED(l) \ - _rwlock_obtain_read_failed(l, file, line) -#define RWLOCK_OBTAIN_WRITE_SUCCESS(l) \ - _rwlock_obtain_write_success(l, file, line) -#define RWLOCK_OBTAIN_WRITE_FAILED(l) \ - _rwlock_obtain_write_failed(l, file, line) -#define RWLOCK_RELEASE_READ(l) _rwlock_release_read(l) -#define RWLOCK_RELEASE_WRITE(l) _rwlock_release_write(l) -#define SPIN_OBTAIN_SUCCESS(s) \ - _spin_obtain_success(s, file, line) -#define SPIN_OBTAIN_FAILED(s) \ - _spin_obtain_failed(s, file, line) -#define SPIN_RELEASE(s) \ - _spin_release(s) +#define MUTEX_OBTAIN_SUCCESS(m, ts) \ + _mutex_obtain_success(m, ts, file, line) +#define MUTEX_OBTAIN_FAILED(m, ts) \ + _mutex_obtain_failed(m, ts, file, line) +#define MUTEX_RELEASE(m, ts) _mutex_release(m, ts) +#define RWLOCK_OBTAIN_READ_SUCCESS(l, ts) \ + _rwlock_obtain_read_success(l, ts, file, line) +#define RWLOCK_OBTAIN_READ_FAILED(l, ts) \ + _rwlock_obtain_read_failed(l, ts, file, line) +#define RWLOCK_OBTAIN_WRITE_SUCCESS(l, ts) \ + _rwlock_obtain_write_success(l, ts, file, line) +#define RWLOCK_OBTAIN_WRITE_FAILED(l, ts) \ + _rwlock_obtain_write_failed(l, ts, file, line) +#define RWLOCK_RELEASE_READ(l, ts) _rwlock_release_read(l, ts) +#define RWLOCK_RELEASE_WRITE(l, ts) _rwlock_release_write(l, ts) +#define SPIN_OBTAIN_SUCCESS(s, ts) \ + _spin_obtain_success(s, ts, file, line) +#define SPIN_OBTAIN_FAILED(s, ts) \ + _spin_obtain_failed(s, ts, file, line) +#define SPIN_RELEASE(s, ts) \ + _spin_release(s, ts) #else -#define LOCK_PROFILE_EXIT_THREAD(t) do { } while (0) -#define MUTEX_OBTAIN_SUCCESS(m) do { } while (0) -#define MUTEX_OBTAIN_FAILED(m) do { } while (0) -#define MUTEX_RELEASE(m) do { } while (0) -#define RWLOCK_OBTAIN_READ_SUCCESS(l) do { } while (0) -#define RWLOCK_OBTAIN_READ_FAILED(l) do { } while (0) -#define RWLOCK_OBTAIN_WRITE_SUCCESS(l) do { } while (0) -#define RWLOCK_OBTAIN_WRITE_FAILED(l) do { } while (0) -#define RWLOCK_RELEASE_READ(l) do { } while (0) -#define RWLOCK_RELEASE_WRITE(l) do { } while (0) -#define SPIN_OBTAIN_SUCCESS(s) do { } while (0) -#define SPIN_OBTAIN_FAILED(s) do { } while (0) -#define SPIN_RELEASE(s) do { } while (0) +#define LOCK_PROFILE_EXIT_THREAD(t) do { } while (0) +#define MUTEX_OBTAIN_SUCCESS(m, ts) do { } while (0) +#define MUTEX_OBTAIN_FAILED(m, ts) do { } while (0) +#define MUTEX_RELEASE(m, ts) do { } while (0) +#define RWLOCK_OBTAIN_READ_SUCCESS(l, ts) do { } while (0) +#define RWLOCK_OBTAIN_READ_FAILED(l, ts) do { } while (0) +#define RWLOCK_OBTAIN_WRITE_SUCCESS(l, ts) do { } while (0) +#define RWLOCK_OBTAIN_WRITE_FAILED(l, ts) do { } while (0) +#define RWLOCK_RELEASE_READ(l, ts) do { } while (0) +#define RWLOCK_RELEASE_WRITE(l, ts) do { } while (0) +#define SPIN_OBTAIN_SUCCESS(s, ts) do { } while (0) +#define SPIN_OBTAIN_FAILED(s, ts) do { } while (0) +#define SPIN_RELEASE(s, ts) 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 Tue Jun 5 05:16:04 2012 (r237112) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Tue Jun 5 06:00:06 2012 (r237113) @@ -30,17 +30,19 @@ #include "thr_private.h" void -_mutex_obtain_success(struct pthread_mutex *m, const char *file, int line) +_mutex_obtain_success(struct pthread_mutex *m, struct timespec *waittime, + const char *file, int line) { } void -_mutex_obtain_failed(struct pthread_mutex *m, const char *file, int line) +_mutex_obtain_failed(struct pthread_mutex *m, struct timespec *waittime, + const char *file, int line) { } void -_mutex_release(struct pthread_mutex *m) +_mutex_release(struct pthread_mutex *m, struct timespec *waittime) { } @@ -50,51 +52,57 @@ } void -_rwlock_obtain_read_success(struct pthread_rwlock *l, const char *file, +_rwlock_obtain_read_success(struct pthread_rwlock *l, + struct timespec *waittime, const char *file, int line) { } void -_rwlock_obtain_read_failed(struct pthread_rwlock *l, const char *file, +_rwlock_obtain_read_failed(struct pthread_rwlock *l, + struct timespec *waittime, const char *file, int line) { } void -_rwlock_obtain_write_success(struct pthread_rwlock *l, const char *file, +_rwlock_obtain_write_success(struct pthread_rwlock *l, + struct timespec *waittime, const char *file, int line) { } void -_rwlock_obtain_write_failed(struct pthread_rwlock *l, const char *file, +_rwlock_obtain_write_failed(struct pthread_rwlock *l, + struct timespec *watitime, const char *file, int line) { } void -_rwlock_release_read(struct pthread_rwlock *l) +_rwlock_release_read(struct pthread_rwlock *l, struct timespec *waittime) { } void -_rwlock_release_write(struct pthread_rwlock *l) +_rwlock_release_write(struct pthread_rwlock *l, struct timespec *waittime) { } void -_spin_obtain_success(struct pthread_spinlock *s, const char *file, int line) +_spin_obtain_success(struct pthread_spinlock *s, struct timespec *waittime, + const char *file, int line) { } void -_spin_obtain_failed(struct pthread_spinlock *s, const char *file, int line) +_spin_obtain_failed(struct pthread_spinlock *s, struct timespec *waittime, + const char *file, int line) { } void -_spin_release(struct pthread_spinlock *s) +_spin_release(struct pthread_spinlock *s, struct timespec *waittime) { } Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_pspinlock.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_pspinlock.c Tue Jun 5 05:16:04 2012 (r237112) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_pspinlock.c Tue Jun 5 06:00:06 2012 (r237113) @@ -101,15 +101,19 @@ struct pthread *curthread = _get_curthread(); struct pthread_spinlock *lck; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif if (lock == NULL || (lck = *lock) == NULL) ret = EINVAL; else { ret = THR_UMUTEX_TRYLOCK(curthread, &lck->s_lock); if (ret == 0) { - SPIN_OBTAIN_SUCCESS(lck); + SPIN_OBTAIN_SUCCESS(lck, &waittime); } else { - SPIN_OBTAIN_FAILED(lck); + SPIN_OBTAIN_FAILED(lck, &waittime); } } @@ -133,6 +137,9 @@ int ret, count; #ifdef LOCK_PROFILING int spin_needed = 0; + struct timespec waittime; + + bzero(&waittime, sizeof(waittime)); #endif if (lock == NULL || (lck = *lock) == NULL) ret = EINVAL; @@ -142,7 +149,7 @@ #ifdef LOCK_PROFILING if (!spin_needed) { spin_needed = 1; - SPIN_OBTAIN_FAILED(lck); + SPIN_OBTAIN_FAILED(lck, &waittime); } #endif while (lck->s_lock.m_owner) { @@ -159,7 +166,7 @@ } } ret = 0; - SPIN_OBTAIN_SUCCESS(lck); + SPIN_OBTAIN_SUCCESS(lck, &waittime); } return (ret); @@ -171,13 +178,17 @@ struct pthread *curthread = _get_curthread(); struct pthread_spinlock *lck; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif if (lock == NULL || (lck = *lock) == NULL) ret = EINVAL; else { ret = THR_UMUTEX_UNLOCK(curthread, &lck->s_lock); if (ret == 0) { - SPIN_RELEASE(lck); + SPIN_RELEASE(lck, &waittime); } } return (ret); Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_rwlock.c Tue Jun 5 05:16:04 2012 (r237112) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_rwlock.c Tue Jun 5 06:00:06 2012 (r237113) @@ -150,7 +150,11 @@ pthread_rwlock_t prwlock; int flags; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif CHECK_AND_INIT_RWLOCK if (curthread->rdlock_count) { @@ -179,12 +183,12 @@ if (ret == 0) { curthread->rdlock_count++; - RWLOCK_OBTAIN_READ_SUCCESS(*rwlock); + RWLOCK_OBTAIN_READ_SUCCESS(*rwlock, &waittime); return (ret); } - RWLOCK_OBTAIN_READ_FAILED(*rwlock); + RWLOCK_OBTAIN_READ_FAILED(*rwlock, &waittime); if (__predict_false(abstime && (abstime->tv_nsec >= 1000000000 || abstime->tv_nsec < 0))) @@ -204,7 +208,7 @@ } if (ret == 0) { curthread->rdlock_count++; - RWLOCK_OBTAIN_READ_SUCCESS(*rwlock); + RWLOCK_OBTAIN_READ_SUCCESS(*rwlock, &waittime); } return (ret); @@ -260,6 +264,11 @@ pthread_rwlock_t prwlock; int flags; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + + bzero(&waittime, sizeof(waittime)); +#endif CHECK_AND_INIT_RWLOCK @@ -284,9 +293,9 @@ ret = _thr_rwlock_tryrdlock(&prwlock->lock, flags); if (ret == 0) { curthread->rdlock_count++; - RWLOCK_OBTAIN_READ_SUCCESS(*rwlock); + RWLOCK_OBTAIN_READ_SUCCESS(*rwlock, &waittime); } else { - RWLOCK_OBTAIN_READ_FAILED(*rwlock); + RWLOCK_OBTAIN_READ_FAILED(*rwlock, &waittime); } return (ret); } @@ -306,15 +315,20 @@ struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + + bzero(&waittime, sizeof(waittime)); +#endif CHECK_AND_INIT_RWLOCK ret = _thr_rwlock_trywrlock(&prwlock->lock); if (ret == 0) { prwlock->owner = curthread; - RWLOCK_OBTAIN_WRITE_SUCCESS(*rwlock); + RWLOCK_OBTAIN_WRITE_SUCCESS(*rwlock, &waittime); } else { - RWLOCK_OBTAIN_WRITE_FAILED(*rwlock); + RWLOCK_OBTAIN_WRITE_FAILED(*rwlock, &waittime); } return (ret); } @@ -326,6 +340,11 @@ struct pthread *curthread = _get_curthread(); pthread_rwlock_t prwlock; int ret; +#ifdef LOCK_PROFILING + struct timespec waittime; + + bzero(&waittime, sizeof(waittime)); +#endif CHECK_AND_INIT_RWLOCK @@ -337,12 +356,12 @@ if (ret == 0) { prwlock->owner = curthread; - RWLOCK_OBTAIN_WRITE_SUCCESS(*rwlock); + RWLOCK_OBTAIN_WRITE_SUCCESS(*rwlock, &waittime); return (ret); } - RWLOCK_OBTAIN_WRITE_FAILED(*rwlock); + RWLOCK_OBTAIN_WRITE_FAILED(*rwlock, &waittime); if (__predict_false(abstime && (abstime->tv_nsec >= 1000000000 || abstime->tv_nsec < 0))) @@ -368,9 +387,9 @@ } if (ret == 0) { - RWLOCK_OBTAIN_WRITE_SUCCESS(*rwlock); + RWLOCK_OBTAIN_WRITE_SUCCESS(*rwlock, &waittime); } else { - RWLOCK_OBTAIN_WRITE_FAILED(*rwlock); + RWLOCK_OBTAIN_WRITE_FAILED(*rwlock, &waittime); } return (ret); @@ -416,7 +435,11 @@ pthread_rwlock_t prwlock; int ret; int32_t state; +#ifdef LOCK_PROFILING + struct timespec waittime; + bzero(&waittime, sizeof(waittime)); +#endif prwlock = *rwlock; if (__predict_false(prwlock <= THR_RWLOCK_DESTROYED)) @@ -432,9 +455,9 @@ ret = _thr_rwlock_unlock(&prwlock->lock); if (ret == 0 && (state & URWLOCK_WRITE_OWNER) == 0) { curthread->rdlock_count--; - RWLOCK_RELEASE_READ(*rwlock); + RWLOCK_RELEASE_READ(*rwlock, &waittime); } else if (ret == 0) { - RWLOCK_RELEASE_WRITE(*rwlock); + RWLOCK_RELEASE_WRITE(*rwlock, &waittime); } return (ret); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 07:53:25 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 DFDBD106566C for ; Tue, 5 Jun 2012 07:53:22 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 07:53:22 +0000 Date: Tue, 05 Jun 2012 07:53:22 +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: <20120605075322.DFDBD106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237117 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 07:53:25 -0000 Author: jhagewood Date: Tue Jun 5 07:53:22 2012 New Revision: 237117 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237117 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 06:43:45 2012 (r237116) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 07:53:22 2012 (r237117) @@ -152,6 +152,7 @@ void repos(int); void separate(const char *); __dead void edscript(int); +void remove_cr(FILE *); __dead void trouble(void); void increase(void); __dead void try_help(void); @@ -173,13 +174,13 @@ { "text", no_argument, NULL, 'a' }, { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, HELP_OPT }, - + { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, + /* features to implement */ { "show-all", no_argument, NULL, 'A' }, { "easy-only", no_argument, NULL, '3' }, { "merge", no_argument, NULL, 'm' }, { "label", required_argument, NULL, 'L' }, - { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, @@ -270,6 +271,8 @@ for (i = 0; i <= 2; i++) { if ((fp[i] = fopen(argv[i + 2], "r")) == NULL) err(EXIT_FAILURE, "can't open %s", argv[i + 2]); + if (strip_cr) + remove_cr(fp[i]); } merge(m, n); exit(EXIT_SUCCESS); @@ -622,6 +625,26 @@ (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } +/* Removes carriage return from open file. + * TODO: Remove trailing cr only. + */ +void +remove_cr(FILE *f) { + + char ch; + fpos_t position; + + while ( ch != EOF) { + fgetpos(f, &position); + ch = fgetc(f); + if (ch == '\r') { + fsetpos(f, &position); + fputc((int)'\0', f); + } + } + rewind(f); +} + __dead void trouble(void) { Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 06:43:45 2012 (r237116) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 07:53:22 2012 (r237117) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 01:17:18.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 07:53:14.000000000 -0400 @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ @@ -22,8 +22,11 @@ /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * * d13 = diff report on f1 vs f3 -@@ -151,22 +154,26 @@ void separate(const char *); +@@ -149,33 +152,38 @@ void prange(struct range *); + void repos(int); + void separate(const char *); __dead void edscript(int); ++void remove_cr(FILE *); __dead void trouble(void); void increase(void); -__dead void usage(void); @@ -50,13 +53,14 @@ - + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, HELP_OPT }, -+ ++ { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, ++ /* features to implement */ { "show-all", no_argument, NULL, 'A' }, { "easy-only", no_argument, NULL, '3' }, -@@ -174,8 +181,8 @@ static struct option longopts[] = { + { "merge", no_argument, NULL, 'm' }, { "label", required_argument, NULL, 'L' }, - { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, +- { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, - { "version", no_argument, NULL, 'v' }, - { "help", no_argument, NULL, HELP_OPT } @@ -65,7 +69,7 @@ }; -@@ -216,12 +223,19 @@ main(int argc, char **argv) +@@ -216,12 +224,19 @@ main(int argc, char **argv) case 'X': oflag = eflag = 1; break; @@ -85,7 +89,7 @@ case STRIPCR_OPT: strip_cr = 1; break; -@@ -233,8 +247,10 @@ main(int argc, char **argv) +@@ -233,8 +248,10 @@ main(int argc, char **argv) argc -= optind; argv += optind; /* XXX - argc usage seems wrong here */ @@ -97,7 +101,43 @@ if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", -@@ -699,12 +715,38 @@ increase(void) +@@ -254,6 +271,8 @@ main(int argc, char **argv) + for (i = 0; i <= 2; i++) { + if ((fp[i] = fopen(argv[i + 2], "r")) == NULL) + err(EXIT_FAILURE, "can't open %s", argv[i + 2]); ++ if (strip_cr) ++ remove_cr(fp[i]); + } + merge(m, n); + exit(EXIT_SUCCESS); +@@ -606,6 +625,26 @@ repos(int nchar) + (void)fseek(fp[i], (long)-nchar, SEEK_CUR); + } + ++/* Removes carriage return from open file. ++ * TODO: Remove trailing cr only. ++ */ ++void ++remove_cr(FILE *f) { ++ ++ char ch; ++ fpos_t position; ++ ++ while ( ch != EOF) { ++ fgetpos(f, &position); ++ ch = fgetc(f); ++ if (ch == '\r') { ++ fsetpos(f, &position); ++ fputc((int)'\0', f); ++ } ++ } ++ rewind(f); ++} ++ + __dead void + trouble(void) + { +@@ -699,12 +738,38 @@ increase(void) } From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 09:37:51 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 A9659106566B for ; Tue, 5 Jun 2012 09:37:49 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 09:37:49 +0000 Date: Tue, 05 Jun 2012 09:37:49 +0000 From: scher@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: <20120605093749.A9659106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237118 - soc2012/scher/par_ports/head/Mk 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: Tue, 05 Jun 2012 09:37:51 -0000 Author: scher Date: Tue Jun 5 09:37:48 2012 New Revision: 237118 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237118 Log: [new_feature] _parv_PARALLEL_BUILDS_NUMBER variable controls number of parallel builds. May be set by user. Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue Jun 5 07:53:22 2012 (r237117) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue Jun 5 09:37:48 2012 (r237118) @@ -58,6 +58,15 @@ . endfor .endfor .endif #!{.TARGETS} + +_parv_DEFAULT_PAR_BUILDS_NUM!= sysctl -a | grep hw.n | awk '{print $$2}' +############### THIS ENTRY IS FOR DEBUGGING PURPOSE ############### +############### Custom number of parallel builds for debugging +_parv_DEFAULT_PAR_BUILDS_NUM= 3 +############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### +.if !defined(_parv_PARALLEL_BUILDS_NUMBER) || ${_parv_PARALLEL_BUILDS_NUMBER} > ${_parv_DEFAULT_PAR_BUILDS_NUM} +_parv_PARALLEL_BUILDS_NUMBER= ${_parv_DEFAULT_PAR_BUILDS_NUM} +.endif ##################################################### ##################################################### # Commands Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue Jun 5 07:53:22 2012 (r237117) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue Jun 5 09:37:48 2012 (r237118) @@ -1150,6 +1150,11 @@ .include "${PORTSDIR}/Mk/bsd.parallel.mk" .endif +# non-parallel build +.if !defined(_parv_WANT_PARALLEL_BUILD) +_parv_PARALLEL_BUILDS_NUMBER= 1 +.endif + .if !target(lock-pkg-dbdir) lock-pkg-dbdir: @${DO_NADA} From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 10:38:41 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 AFAA6106566B for ; Tue, 5 Jun 2012 10:38:39 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 10:38:39 +0000 Date: Tue, 05 Jun 2012 10:38:39 +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: <20120605103839.AFAA6106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237121 - 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: Tue, 05 Jun 2012 10:38:41 -0000 Author: tzabal Date: Tue Jun 5 10:38:39 2012 New Revision: 237121 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237121 Log: Updated version of crashreport. Patch from Lars Engels is included. 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 Tue Jun 5 09:49:31 2012 (r237120) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Tue Jun 5 10:38:39 2012 (r237121) @@ -6,9 +6,10 @@ # the FreeBSD developers. # -. /etc/rc.conf +[ -f /etc/rc.conf ] && . /etc/rc.conf -PROG=`/usr/bin/basename $0` +# Basename +PROG=${0##*/} print_usage() { @@ -31,7 +32,7 @@ ## Check if the user that executes the script is root user=`/usr/bin/id -u` -if [ "${user}" != "0" ]; then +if [ ${user} -ne 0 ]; then error 'Only the superuser (uid 0) can use this program.' exit 1 fi @@ -39,15 +40,15 @@ ## Get positional parameters while getopts "d:f:e:" opt; do - case "$opt" in + case "${opt}" in d) - _dumpdir=$OPTARG + _dumpdir="${OPTARG}" ;; f) - _file=$OPTARG + _file="${OPTARG}" ;; e) - _email=$OPTARG + _email="${OPTARG}" ;; *) print_usage @@ -61,9 +62,9 @@ if [ -z "${_dumpdir}" ]; then # dumpdir of /etc/rc.conf if [ -z "${dumpdir}" ]; then - _dumpdir=${DUMPDIR} + _dumpdir="${DUMPDIR}" else - _dumpdir=${dumpdir} + _dumpdir="${dumpdir}" fi fi @@ -85,20 +86,26 @@ CORE="${_dumpdir}/core.txt" TEXTDUMP="${_dumpdir}/textdump.tar" +flag=1 if [ -z "${_file}" ]; then # Find it using the file bounds if [ -r "${BOUNDS}" ]; then value=`head -n 1 ${BOUNDS}` - X=$((value - 1)) - if [ -f "${CORE}.${X}" ]; then - _file=`basename "${CORE}.${X}"` - else - _file=`basename "${TEXTDUMP}.${X}"` + if [ ${value} -ge 1 ]; then + flag=0 + X=$((value - 1)) + if [ -f "${CORE}.${X}" ]; then + _file="${CORE##*/}.${X}" + else + _file="${TEXTDUMP##*/}.${X}" + fi fi + fi + # Otherwise, use this (heavier) way - else - _file=`ls ${_dumpdir} | egrep '[a-z]+\.[a-z]+\.[0-9]+' | \ - sort -n -t . -k 3 | tail -1` + if [ ${flag} -eq 1 ]; then + _file="`ls ${_dumpdir} | egrep '[a-z]+\.[a-z]+\.[0-9]+' | \ + sort -n -t . -k 3 | tail -1`" fi fi @@ -114,16 +121,16 @@ _email="${email}" fi -if [ -z "$_email" ]; then +if [ -z "${_email}" ]; then error 'No email address for contact is specified.' exit 6 fi # Check if the given email address is valid based on its format. -echo ${_email} | egrep '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$' \ - > /dev/null +echo "${_email}" | egrep '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$' \ + > /dev/null 2>&1 -if [ "$?" != "0" ]; then +if [ $? -ne 0 ]; then error "Email address ${_email} is invalid." exit 7 fi @@ -134,14 +141,16 @@ email_file=`mktemp /tmp/crashreport.XXXXXX` echo "${_email}" > ${email_file} -tar -czf ${report} -C ${_dumpdir} ${_file} -C `dirname ${email_file}` \ - `basename ${email_file}` +tar -czf ${report} -C "${_dumpdir}" "${_file}" -C ${email_file%/*} \ + ${email_file##*/} -if [ "$?" != "0" ]; then - error 'An error occurred when bundling the report.' +if [ $? -ne 0 ]; then + error 'An error occurred while bundling the report.' exit 8 fi +rm -f "${email_file}" + ## Send the report to the Central Collector machine user="reporter" @@ -183,11 +192,18 @@ 4A2OywvWcs45QnlxYmKUIL6x8stKQAbtuHkbda3v/4ts/+6Y0jss -----END RSA PRIVATE KEY-----" > ${user_private_key_file} -scp -o GlobalKnownHostsFile=${host_public_key_file} -o BatchMode=yes \ - -i ${user_private_key_file} -q ${report} ${user}@${hostname}: +scp -o GlobalKnownHostsFile="${host_public_key_file}" -o BatchMode=yes \ + -i "${user_private_key_file}" -q "${report}" "${user}@${hostname}:" + +if [ $? -ne 0 ]; then + error 'An error occurred while sending the report.' + exit 9 +fi + +rm -f ${host_public_key_file} ${user_private_key_file} ## Everything went smoothly -echo "Crash report has been sent successfully.\ -Check your email for confirmation." -exit 0 \ No newline at end of file +echo "Kernel crash report has been sent successfully. \ +Check your email for confirmation of the report." +exit 0 From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 11:05:01 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 F09ED106564A for ; Tue, 5 Jun 2012 11:04:58 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 11:04:58 +0000 Date: Tue, 05 Jun 2012 11:04:58 +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: <20120605110458.F09ED106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237124 - 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: Tue, 05 Jun 2012 11:05:01 -0000 Author: tzabal Date: Tue Jun 5 11:04:58 2012 New Revision: 237124 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237124 Log: Updated version of crashreport. Include a section of the patch (about email checking) that I did not have in my last commit. 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 Tue Jun 5 10:23:41 2012 (r237123) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Tue Jun 5 11:04:58 2012 (r237124) @@ -117,13 +117,13 @@ ## Find the email that will be used for contact if [ -z "${_email}" ]; then - # email of /etc/rc.conf - _email="${email}" -fi - -if [ -z "${_email}" ]; then - error 'No email address for contact is specified.' - exit 6 + if [ -n "${email}" ]; then + # email of /etc/rc.conf + _email="${email}" + else + error 'No email address for contact is specified.' + exit 6 + fi fi # Check if the given email address is valid based on its format. From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 11:45:02 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 5C2ED106564A for ; Tue, 5 Jun 2012 11:45:00 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 11:45:00 +0000 Date: Tue, 05 Jun 2012 11:45:00 +0000 From: oleksandr@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: <20120605114500.5C2ED106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237125 - soc2012/oleksandr/udf-head/sbin/mount_udf2 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: Tue, 05 Jun 2012 11:45:02 -0000 Author: oleksandr Date: Tue Jun 5 11:44:59 2012 New Revision: 237125 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237125 Log: add command for mounting udf2 Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/ soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile soc2012/oleksandr/udf-head/sbin/mount_udf2/getmntopts.c soc2012/oleksandr/udf-head/sbin/mount_udf2/mntopts.h soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.8 soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/Makefile Tue Jun 5 11:44:59 2012 (r237125) @@ -0,0 +1,20 @@ +# $FreeBSD: src/sbin/mount_udf/Makefile,v 1.6 2006/07/17 20:53:25 stefanf Exp $ + +PROG= mount_udf2 +SRCS= mount_udf.c getmntopts.c +MAN= mount_udf.8 +DPADD= ${LIBKICONV} +LDADD= -lkiconv + +#MOUNT= ${.CURDIR}/../mount +#CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys +#.PATH: ${MOUNT} +WARNS?= 1 + +# Needs to be dynamically linked for optional dlopen() access to +# userland libiconv +NO_SHARED?= NO + +BINDIR=/sbin + +.include Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/getmntopts.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/getmntopts.c Tue Jun 5 11:44:59 2012 (r237125) @@ -0,0 +1,182 @@ +/*- + * Copyright (c) 1994 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ + +#if 0 +#ifndef lint +static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95"; +#endif /* not lint */ +#endif +#include +__FBSDID("$FreeBSD: src/sbin/mount/getmntopts.c,v 1.19 2008/12/26 22:55:38 obrien Exp $"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "mntopts.h" + +int getmnt_silent = 0; + +void +getmntopts(const char *options, const struct mntopt *m0, int *flagp, + int *altflagp) +{ + const struct mntopt *m; + int negative, len; + char *opt, *optbuf, *p; + int *thisflagp; + + /* Copy option string, since it is about to be torn asunder... */ + if ((optbuf = strdup(options)) == NULL) + err(1, NULL); + + for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { + /* Check for "no" prefix. */ + if (opt[0] == 'n' && opt[1] == 'o') { + negative = 1; + opt += 2; + } else + negative = 0; + + /* + * for options with assignments in them (ie. quotas) + * ignore the assignment as it's handled elsewhere + */ + p = strchr(opt, '='); + if (p != NULL) + *++p = '\0'; + + /* Scan option table. */ + for (m = m0; m->m_option != NULL; ++m) { + len = strlen(m->m_option); + if (strncasecmp(opt, m->m_option, len) == 0) + if (opt[len] == '\0' || opt[len] == '=') + break; + } + + /* Save flag, or fail if option is not recognized. */ + if (m->m_option) { + thisflagp = m->m_altloc ? altflagp : flagp; + if (negative == m->m_inverse) + *thisflagp |= m->m_flag; + else + *thisflagp &= ~m->m_flag; + } else if (!getmnt_silent) { + errx(1, "-o %s: option not supported", opt); + } + } + + free(optbuf); +} + +void +rmslashes(char *rrpin, char *rrpout) +{ + char *rrpoutstart; + + *rrpout = *rrpin; + for (rrpoutstart = rrpout; *rrpin != '\0'; *rrpout++ = *rrpin++) { + + /* skip all double slashes */ + while (*rrpin == '/' && *(rrpin + 1) == '/') + rrpin++; + } + + /* remove trailing slash if necessary */ + if (rrpout - rrpoutstart > 1 && *(rrpout - 1) == '/') + *(rrpout - 1) = '\0'; + else + *rrpout = '\0'; +} + +void +checkpath(const char *path, char *resolved) +{ + struct stat sb; + + if (realpath(path, resolved) != NULL && stat(resolved, &sb) == 0) { + if (!S_ISDIR(sb.st_mode)) + errx(EX_USAGE, "%s: not a directory", resolved); + } else + errx(EX_USAGE, "%s: %s", resolved, strerror(errno)); +} + +void +build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, + size_t len) +{ + int i; + + if (*iovlen < 0) + return; + i = *iovlen; + *iov = realloc(*iov, sizeof **iov * (i + 2)); + if (*iov == NULL) { + *iovlen = -1; + return; + } + (*iov)[i].iov_base = strdup(name); + (*iov)[i].iov_len = strlen(name) + 1; + i++; + (*iov)[i].iov_base = val; + if (len == (size_t)-1) { + if (val != NULL) + len = strlen(val) + 1; + else + len = 0; + } + (*iov)[i].iov_len = (int)len; + *iovlen = ++i; +} + +/* + * This function is needed for compatibility with parameters + * which used to use the mount_argf() command for the old mount() syscall. + */ +void +build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, + const char *fmt, ...) +{ + va_list ap; + char val[255] = { 0 }; + + va_start(ap, fmt); + vsnprintf(val, sizeof(val), fmt, ap); + va_end(ap); + build_iovec(iov, iovlen, name, strdup(val), (size_t)-1); +} Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/mntopts.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mntopts.h Tue Jun 5 11:44:59 2012 (r237125) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 1994 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)mntopts.h 8.7 (Berkeley) 3/29/95 + * $FreeBSD: src/sbin/mount/mntopts.h,v 1.30 2009/12/21 19:39:10 trasz Exp $ + */ + +struct mntopt { + const char *m_option; /* option name */ + int m_inverse; /* if a negative option, e.g. "atime" */ + int m_flag; /* bit to set, e.g. MNT_RDONLY */ + int m_altloc; /* 1 => set bit in altflags */ +}; + +/* User-visible MNT_ flags. */ +#define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 } +#define MOPT_NOATIME { "atime", 1, MNT_NOATIME, 0 } +#define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 } +#define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 } +#define MOPT_NOSYMFOLLOW { "symfollow", 1, MNT_NOSYMFOLLOW, 0 } +#define MOPT_RDONLY { "rdonly", 0, MNT_RDONLY, 0 } +#define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 } +#define MOPT_UNION { "union", 0, MNT_UNION, 0 } +#define MOPT_USERQUOTA { "userquota", 0, 0, 0 } +#define MOPT_GROUPQUOTA { "groupquota", 0, 0, 0 } +#define MOPT_NOCLUSTERR { "clusterr", 1, MNT_NOCLUSTERR, 0 } +#define MOPT_NOCLUSTERW { "clusterw", 1, MNT_NOCLUSTERW, 0 } +#define MOPT_SUIDDIR { "suiddir", 0, MNT_SUIDDIR, 0 } +#define MOPT_SNAPSHOT { "snapshot", 0, MNT_SNAPSHOT, 0 } +#define MOPT_MULTILABEL { "multilabel", 0, MNT_MULTILABEL, 0 } +#define MOPT_ACLS { "acls", 0, MNT_ACLS, 0 } +#define MOPT_NFS4ACLS { "nfsv4acls", 0, MNT_NFS4ACLS, 0 } + +/* Control flags. */ +#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 } +#define MOPT_UPDATE { "update", 0, MNT_UPDATE, 0 } +#define MOPT_RO { "ro", 0, MNT_RDONLY, 0 } +#define MOPT_RW { "rw", 1, MNT_RDONLY, 0 } + +/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */ +#define MOPT_AUTO { "auto", 0, 0, 0 } + +/* A handy macro as terminator of MNT_ array. */ +#define MOPT_END { NULL, 0, 0, 0 } + +#define MOPT_FSTAB_COMPAT \ + MOPT_RO, \ + MOPT_RW, \ + MOPT_AUTO + +/* Standard options which all mounts can understand. */ +#define MOPT_STDOPTS \ + MOPT_USERQUOTA, \ + MOPT_GROUPQUOTA, \ + MOPT_FSTAB_COMPAT, \ + MOPT_NOATIME, \ + MOPT_NOEXEC, \ + MOPT_SUIDDIR, /* must be before MOPT_NOSUID */ \ + MOPT_NOSUID, \ + MOPT_NOSYMFOLLOW, \ + MOPT_RDONLY, \ + MOPT_UNION, \ + MOPT_NOCLUSTERR, \ + MOPT_NOCLUSTERW, \ + MOPT_MULTILABEL, \ + MOPT_ACLS, \ + MOPT_NFS4ACLS + +void getmntopts(const char *, const struct mntopt *, int *, int *); +void rmslashes(char *, char *); +void checkpath(const char *, char resolved_path[]); +extern int getmnt_silent; +void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len); +void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...); Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.8 Tue Jun 5 11:44:59 2012 (r237125) @@ -0,0 +1,76 @@ +.\" Copyright (c) 2002 +.\" Scott Long +.\" Jeroen Ruigrok van der Werven +.\" 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 REGENTS 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 REGENTS 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. +.\" +.\" $FreeBSD: src/sbin/mount_udf/mount_udf.8,v 1.6 2005/02/10 09:19:31 ru Exp $ +.\" +.Dd March 23, 2002 +.Dt MOUNT_UDF 8 +.Os +.Sh NAME +.Nm mount_udf +.Nd mount a UDF file system +.Sh SYNOPSIS +.Nm +.Op Fl v +.Op Fl o Ar options +.Op Fl C Ar charset +.Ar special node +.Sh DESCRIPTION +The +.Nm +utility attaches the UDF file system residing on the device +.Ar special +to the global file system namespace at the location indicated by +.Ar node . +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl o +Options are specified with a +.Fl o +flag followed by a comma separated string of options. +See the +.Xr mount 8 +man page for possible options and their meanings. +The following UDF specific options are available: +.It Fl v +Be verbose about mounting the UDF file system. +.It Fl C Ar charset +Specify local +.Ar charset +to convert Unicode file names. +.El +.Sh SEE ALSO +.Xr cdcontrol 1 , +.Xr mount 2 , +.Xr unmount 2 , +.Xr fstab 5 , +.Xr mount 8 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 5.0 . Added: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Tue Jun 5 11:44:59 2012 (r237125) @@ -0,0 +1,284 @@ +/* + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 2002 Scott Long + * + * This code is derived from software contributed to Berkeley + * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension + * Support code is derived from software contributed to Berkeley + * by Atsushi Murai (amurai@spec.co.jp). + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * $FreeBSD: src/sbin/mount_udf/mount_udf.c,v 1.13 2005/06/10 09:51:43 delphij Exp $ + */ + +/* + * This is just a rip-off of mount_iso9660.c. It's been vastly simplified + * because UDF doesn't take any options at this time. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mntopts.h" +//#include "fs/udf2/udf_mount.h" +#include "udf2/udf_mount.h" + + +struct mntopt mopts[] = { + MOPT_STDOPTS, + MOPT_UPDATE, + MOPT_END +}; + +static int set_charset(char **, char **, const char *); +static void getlastblock(char *dev, struct udf_session_info *usi, + int session_num); +static void usage(void); +static void print_session_info(char *dev, int session_num); + +int +main(int argc, char **argv) +{ + struct udf_session_info usi; + struct iovec iov[18]; + long session_num; + int ch, i, mntflags, opts, udf_flags, sessioninfo, verbose; + int32_t first_trackblank; + char *dev, *dir, mntpath[MAXPATHLEN], *cs_disk, *cs_local, *endp; + + session_num = 0; + sessioninfo = 0; + + i = mntflags = opts = udf_flags = verbose = 0; + cs_disk = cs_local = NULL; + while ((ch = getopt(argc, argv, "o:vC:s:p")) != -1) + switch (ch) { + case 'o': + getmntopts(optarg, mopts, &mntflags, &opts); + break; + case 'v': + verbose++; + break; + case 'C': + if (set_charset(&cs_disk, &cs_local, optarg) == -1) + err(EX_OSERR, "udf2_iconv"); + udf_flags |= UDFMNT_KICONV; + break; + case 's': + session_num = strtol(optarg, &endp, 10); + if (optarg == endp || *endp != '\0') + usage(); + break; + case 'p': + sessioninfo = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (sessioninfo) { + if (argc != 1) + usage(); + print_session_info(argv[0], session_num); + } + + if (argc != 2) + usage(); + + dev = argv[0]; + dir = argv[1]; + + + /* + * Resolve the mountpoint with realpath(3) and remove unnecessary + * slashes from the devicename if there are any. + */ + (void)checkpath(dir, mntpath); + (void)rmslashes(dev, dev); + + /* + * Get session info from device + */ + getlastblock(dev, &usi, session_num); + + /* + * UDF file systems are not writeable. + */ + mntflags |= MNT_RDONLY; + + iov[i].iov_base = "fstype"; + iov[i++].iov_len = sizeof("fstype"); + iov[i].iov_base = "udf2"; + iov[i].iov_len = strlen(iov[i].iov_base) + 1; + i++; + + iov[i].iov_base = "fspath"; + iov[i++].iov_len = sizeof("fspath"); + iov[i].iov_base = mntpath; + iov[i++].iov_len = strlen(mntpath) + 1; + + iov[i].iov_base = "from"; + iov[i++].iov_len = sizeof("from"); + iov[i].iov_base = dev; + iov[i++].iov_len = strlen(dev) + 1; + + iov[i].iov_base = "flags"; + iov[i++].iov_len = sizeof("flags"); + iov[i].iov_base = &udf_flags; + iov[i++].iov_len = sizeof(udf_flags); + + iov[i].iov_base = "first_trackblank"; + iov[i++].iov_len = sizeof("first_trackblank"); + first_trackblank = 0; + iov[i].iov_base = &first_trackblank; + iov[i++].iov_len = sizeof(uint32_t); + + iov[i].iov_base = "session_start_addr"; + iov[i++].iov_len = sizeof("session_start_addr"); + iov[i].iov_base = &usi.session_start_addr; + iov[i++].iov_len = sizeof(uint32_t); + + iov[i].iov_base = "session_end_addr"; + iov[i++].iov_len = sizeof("session_end_addr"); + iov[i].iov_base = &usi.session_end_addr; + iov[i++].iov_len = sizeof(uint32_t); + + if (udf_flags & UDFMNT_KICONV) { + iov[i].iov_base = "cs_disk"; + iov[i++].iov_len = sizeof("cs_disk"); + iov[i].iov_base = cs_disk; + iov[i++].iov_len = strlen(cs_disk) + 1; + iov[i].iov_base = "cs_local"; + iov[i++].iov_len = sizeof("cs_local"); + iov[i].iov_base = cs_local; + iov[i++].iov_len = strlen(cs_local) + 1; + } + if (nmount(iov, i, mntflags) < 0) + err(1, "%s", dev); + exit(0); +} + +static int +set_charset(char **cs_disk, char **cs_local, const char *localcs) +{ + int error; + + if (modfind("udf2_iconv") < 0) + if (kldload("udf2_iconv") < 0 || modfind("udf2_iconv") < 0) { + warnx( "cannot find or load \"udf2_iconv\" kernel module"); + return (-1); + } + + if ((*cs_disk = malloc(ICONV_CSNMAXLEN)) == NULL) + return (-1); + if ((*cs_local = malloc(ICONV_CSNMAXLEN)) == NULL) + return (-1); + strncpy(*cs_disk, ENCODING_UNICODE, ICONV_CSNMAXLEN); + strncpy(*cs_local, localcs, ICONV_CSNMAXLEN); + error = kiconv_add_xlat16_cspairs(*cs_disk, *cs_local); + if (error) + return (-1); + + return (0); +} + +static void +getlastblock(char *dev, struct udf_session_info *usi, int session_num) +{ + int fd, error; + unsigned int out; + fd = open(dev, O_RDONLY, 0); + + if (fd < 0) + err(1, "open"); + + bzero(usi, sizeof(struct udf_session_info)); + usi->session_num = session_num; + error = ioctl(fd, UDFIOTEST, usi); + if (error != 0) { + if (session_num == 0) + warn("This device not not support sessions"); + else + err(2, "This device does not support sessions"); + } + + close(fd); +} + +static void +print_session_info(char *dev, int session_num) +{ + struct udf_session_info usi; + + rmslashes(dev, dev); + getlastblock(dev, &usi, session_num); + + + printf("session_num: %u\n", usi.session_num); + + printf("sector_size: %u\n", usi.sector_size); + printf("num_sessions: %u\n", usi.num_sessions); + printf("session_start_addr: %u\n", usi.session_start_addr); + printf("session_end_addr: %u\n", usi.session_end_addr); + + printf("num_tracks: %u\n", usi.num_tracks); + printf("first_track: %u\n", usi.first_track); + printf("session_first_track: %u\n", usi.session_first_track); + printf("session_last_track: %u\n", usi.session_last_track); + + exit(0); +} + +static void +usage(void) +{ + (void)fprintf(stderr, + "usage: mount_udf [-v] [-o options] [-C charset] [-s session] [-p] special node\n"); + exit(EX_USAGE); +} From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 12:40:33 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 880C01065678 for ; Tue, 5 Jun 2012 12:40:31 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 12:40:31 +0000 Date: Tue, 05 Jun 2012 12:40:31 +0000 From: oleksandr@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: <20120605124031.880C01065678@hub.freebsd.org> Cc: Subject: socsvn commit: r237134 - soc2012/oleksandr/udf-head/sys/fs/udf2 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: Tue, 05 Jun 2012 12:40:33 -0000 Author: oleksandr Date: Tue Jun 5 12:40:30 2012 New Revision: 237134 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237134 Log: Initial change in udf structure and vfs system Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile Tue Jun 5 11:48:32 2012 (r237133) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile Tue Jun 5 12:40:30 2012 (r237134) @@ -1,7 +1,13 @@ -# $NetBSD: Makefile,v 1.1 2006/02/02 15:19:15 reinoud Exp $ +# $FreeBSD: src/sys/modules/udf/Makefile,v 1.5 2004/01/13 11:28:50 ru Exp $ -INCSDIR= /usr/include/fs/udf +.PATH: ${.CURDIR} -INCS= ecma167-udf.h udf_mount.h +KMOD= udf2 -.include +SRCS= udf_readwrite.c udf_subr.c udf_allocation.c \ + udf_osta.c udf_vfsops.c udf_vnops.c udf_filenames.c +# udf_strat_bootstrap.c udf_strat_direct.c udf_strat_rmw.c udf_strat_sequential.c +SRCS+= vnode_if.h +EXPORT_SYMS= udf_iconv + +.include Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Tue Jun 5 11:48:32 2012 (r237133) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Tue Jun 5 12:40:30 2012 (r237134) @@ -1,6 +1,4 @@ -/* $NetBSD: udf.h,v 1.44 2011/09/27 01:13:16 christos Exp $ */ - -/* +/*- * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -29,71 +27,15 @@ #ifndef _FS_UDF_UDF_H_ #define _FS_UDF_UDF_H_ -#include -#include -#include -#include - #include "udf_osta.h" -#include "ecma167-udf.h" -#include -#include -#include -#include -#include -/* debug section */ -extern int udf_verbose; +/* lets see debug stuff for now */ +#define DEBUG + /* undefine UDF_COMPLETE_DELETE to need `purge'; but purge is not implemented */ #define UDF_COMPLETE_DELETE -/* debug categories */ -#define UDF_DEBUG_VOLUMES 0x0000001 -#define UDF_DEBUG_LOCKING 0x0000002 -#define UDF_DEBUG_NODE 0x0000004 -#define UDF_DEBUG_LOOKUP 0x0000008 -#define UDF_DEBUG_READDIR 0x0000010 -#define UDF_DEBUG_FIDS 0x0000020 -#define UDF_DEBUG_DESCRIPTOR 0x0000040 -#define UDF_DEBUG_TRANSLATE 0x0000080 -#define UDF_DEBUG_STRATEGY 0x0000100 -#define UDF_DEBUG_READ 0x0000200 -#define UDF_DEBUG_WRITE 0x0000400 -#define UDF_DEBUG_CALL 0x0000800 -#define UDF_DEBUG_ATTR 0x0001000 -#define UDF_DEBUG_EXTATTR 0x0002000 -#define UDF_DEBUG_ALLOC 0x0004000 -#define UDF_DEBUG_ADWLK 0x0008000 -#define UDF_DEBUG_DIRHASH 0x0010000 -#define UDF_DEBUG_NOTIMPL 0x0020000 -#define UDF_DEBUG_SHEDULE 0x0040000 -#define UDF_DEBUG_ECCLINE 0x0080000 -#define UDF_DEBUG_SYNC 0x0100000 -#define UDF_DEBUG_PARANOIA 0x0200000 -#define UDF_DEBUG_PARANOIDADWLK 0x0400000 -#define UDF_DEBUG_NODEDUMP 0x0800000 -#define UDF_DEBUG_RESERVE 0x1000000 - -/* initial value of udf_verbose */ -#define UDF_DEBUGGING 0 - -#ifdef DEBUG -#define DPRINTF(name, arg) { \ - if (udf_verbose & UDF_DEBUG_##name) {\ - printf arg;\ - };\ - } -#define DPRINTFIF(name, cond, arg) { \ - if (udf_verbose & UDF_DEBUG_##name) { \ - if (cond) printf arg;\ - };\ - } -#else -#define DPRINTF(name, arg) {} -#define DPRINTFIF(name, cond, arg) {} -#endif - /* constants to identify what kind of identifier we are dealing with */ #define UDF_REGID_DOMAIN 1 @@ -111,9 +53,7 @@ /* Configuration values */ -#define UDF_INODE_HASHBITS 10 -#define UDF_INODE_HASHSIZE (1<p */ @@ -291,7 +251,7 @@ int vtop_tp[UDF_PMAPS+1]; /* type of trans */ /* disc allocation / writing method */ - kmutex_t allocate_mutex; +/* kmutex_t allocate_mutex; */ int lvreadwrite; /* error handling */ int vtop_alloc[UDF_PMAPS+1]; /* alloc scheme */ int data_part; @@ -299,8 +259,8 @@ int fids_part; /* sequential track info */ - struct mmc_trackinfo data_track; - struct mmc_trackinfo metadata_track; +/* struct mmc_trackinfo data_track; + struct mmc_trackinfo metadata_track; */ /* VAT */ uint32_t first_possible_vat_location; @@ -336,18 +296,18 @@ uint8_t metadata_flags; /* rb tree for lookup icb to udf_node and sorted list for sync */ - kmutex_t ihash_lock; - kmutex_t get_node_lock; - struct rb_tree udf_node_tree; +/* kmutex_t ihash_lock; + kmutex_t get_node_lock; */ +/* struct rb_tree udf_node_tree; */ /* syncing */ int syncing; /* are we syncing? */ - kcondvar_t dirtynodes_cv; /* sleeping on sync */ +/* kcondvar_t dirtynodes_cv; */ /* sleeping on sync */ /* late allocation */ int32_t uncommitted_lbs[UDF_PARTITIONS]; - struct long_ad *la_node_ad_cpy; /* issue buf */ - uint64_t *la_lmapping, *la_pmapping; /* issue buf */ +// struct long_ad *la_node_ad_cpy; /* issue buf */ +// uint64_t *la_lmapping, *la_pmapping; /* issue buf */ /* lists */ STAILQ_HEAD(udfmntpts, udf_mount) all_udf_mntpnts; @@ -357,23 +317,32 @@ void *strategy_private; }; +#if 0 +#define RBTOUDFNODE(node) \ + ((node) ? \ + (void *)((uintptr_t)(node) - offsetof(struct udf_node, rbnode)) \ + : NULL) +#endif + /* * UDF node describing a file/directory. * * BUGALERT claim node_mutex before reading/writing to prevent inconsistencies ! */ struct udf_node { - struct genfs_node i_gnode; /* has to be first */ +/* struct genfs_node i_gnode; */ /* has to be first */ struct vnode *vnode; /* vnode associated */ struct udf_mount *ump; - kmutex_t node_mutex; - kcondvar_t node_lock; /* sleeping lock */ + ino_t hash_id; /* should contain inode */ + int diroff; /* used in lookup */ +/* kmutex_t node_mutex; + kcondvar_t node_lock; */ /* sleeping lock */ char const *lock_fname; int lock_lineno; /* rb_node for fast lookup and fast sequential visiting */ - struct rb_node rbnode; +/* struct rb_node rbnode; */ /* one of `fe' or `efe' can be set, not both (UDF file entry dscr.) */ struct file_entry *fe; @@ -423,4 +392,10 @@ "\6IN_ACCESSED\7IN_RENAME\10IN_DELETED\11IN_LOCKED\12IN_SYNCED" \ "\13IN_CALLBACK_ULK\14IN_NODE_REBUILD" +struct udf_fid { + u_short len; /* length of data in bytes */ + u_short padding; /* force longword alignment */ + ino_t ino; +}; + #endif /* !_FS_UDF_UDF_H_ */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Tue Jun 5 11:48:32 2012 (r237133) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Tue Jun 5 12:40:30 2012 (r237134) @@ -1,6 +1,4 @@ -/* $NetBSD: udf_allocation.c,v 1.32 2011/06/16 09:21:02 hannken Exp $ */ - -/* +/*- * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -27,48 +25,18 @@ */ #include -#ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.32 2011/06/16 09:21:02 hannken Exp $"); -#endif /* not lint */ - - -#if defined(_KERNEL_OPT) -#include "opt_compat_netbsd.h" -#endif - -/* TODO strip */ +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include - -#include -#include +#include "ecma167-udf.h" #include "udf.h" #include "udf_subr.h" -#include "udf_bswap.h" -#define VTOI(vnode) ((struct udf_node *) vnode->v_data) - +#if 0 static void udf_record_allocation_in_node(struct udf_mount *ump, struct buf *buf, uint16_t vpart_num, uint64_t *mapping, struct long_ad *node_ad_cpy); @@ -76,10 +44,15 @@ static void udf_collect_free_space_for_vpart(struct udf_mount *ump, uint16_t vpart_num, uint32_t num_lb); -static int udf_ads_merge(uint32_t max_len, uint32_t lb_size, struct long_ad *a1, struct long_ad *a2); static void udf_wipe_adslots(struct udf_node *udf_node); static void udf_count_alloc_exts(struct udf_node *udf_node); +/* + * IDEA/BUSY: Each udf_node gets its own extentwalker state for all operations; + * this will hopefully/likely reduce O(nlog(n)) to O(1) for most functionality + * since actions are most likely sequencial and thus seeking doesn't need + * searching for the same or adjacent position again. + */ /* --------------------------------------------------------------------- */ @@ -101,19 +74,19 @@ if ((udf_verbose & UDF_DEBUG_NODEDUMP) == 0) return; - lb_size = udf_rw32(udf_node->ump->logical_vol->lb_size); + lb_size = le32toh(udf_node->ump->logical_vol->lb_size); fe = udf_node->fe; efe = udf_node->efe; if (fe) { icbtag = &fe->icbtag; - inflen = udf_rw64(fe->inf_len); + inflen = le64toh(fe->inf_len); } else { icbtag = &efe->icbtag; - inflen = udf_rw64(efe->inf_len); + inflen = le64toh(efe->inf_len); } - icbflags = udf_rw16(icbtag->flags); + icbflags = le16toh(icbtag->flags); addr_type = icbflags & UDF_ICB_TAG_FLAGS_ALLOC_MASK; printf("udf_node_dump %p :\n", udf_node); @@ -131,9 +104,9 @@ udf_get_adslot(udf_node, slot, &s_ad, &eof); if (eof) break; - part_num = udf_rw16(s_ad.loc.part_num); - lb_num = udf_rw32(s_ad.loc.lb_num); - len = udf_rw32(s_ad.len); + part_num = le16toh(s_ad.loc.part_num); + lb_num = le32toh(s_ad.loc.lb_num); + len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); len = UDF_EXT_LEN(len); @@ -181,7 +154,7 @@ case UDF_VTOP_TYPE_PHYS : case UDF_VTOP_TYPE_SPARABLE : /* free space to freed or unallocated space bitmap */ - ptov = udf_rw32(pdesc->start_loc); + ptov = le32toh(pdesc->start_loc); phys_part = ump->vtop[vpart_num]; /* use unallocated bitmap */ @@ -246,35 +219,35 @@ int dscr_size, lb_size, flags, whole_lb; int i, slot, eof; -// KASSERT(mutex_owned(&udf_node->ump->allocate_mutex)); + KASSERT(mutex_owned(&udf_node->ump->allocate_mutex)); if (1) udf_node_dump(udf_node); - lb_size = udf_rw32(udf_node->ump->logical_vol->lb_size); + lb_size = le32toh(udf_node->ump->logical_vol->lb_size); fe = udf_node->fe; efe = udf_node->efe; if (fe) { dscr = (union dscrptr *) fe; icbtag = &fe->icbtag; - inflen = udf_rw64(fe->inf_len); + inflen = le64toh(fe->inf_len); dscr_size = sizeof(struct file_entry) -1; - logblksrec = udf_rw64(fe->logblks_rec); - l_ad = udf_rw32(fe->l_ad); - l_ea = udf_rw32(fe->l_ea); + logblksrec = le64toh(fe->logblks_rec); + l_ad = le32toh(fe->l_ad); + l_ea = le32toh(fe->l_ea); } else { dscr = (union dscrptr *) efe; icbtag = &efe->icbtag; - inflen = udf_rw64(efe->inf_len); + inflen = le64toh(efe->inf_len); dscr_size = sizeof(struct extfile_entry) -1; - logblksrec = udf_rw64(efe->logblks_rec); - l_ad = udf_rw32(efe->l_ad); - l_ea = udf_rw32(efe->l_ea); + logblksrec = le64toh(efe->logblks_rec); + l_ad = le32toh(efe->l_ad); + l_ea = le32toh(efe->l_ea); } data_pos = (uint8_t *) dscr + dscr_size + l_ea; max_l_ad = lb_size - dscr_size - l_ea; - icbflags = udf_rw16(icbtag->flags); + icbflags = le16toh(icbtag->flags); addr_type = icbflags & UDF_ICB_TAG_FLAGS_ALLOC_MASK; /* check if tail is zero */ @@ -305,9 +278,9 @@ break; KASSERT(whole_lb == 1); - part_num = udf_rw16(s_ad.loc.part_num); - lb_num = udf_rw32(s_ad.loc.lb_num); - len = udf_rw32(s_ad.len); + part_num = le16toh(s_ad.loc.part_num); + lb_num = le32toh(s_ad.loc.lb_num); + len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); len = UDF_EXT_LEN(len); @@ -334,7 +307,7 @@ KASSERT(*cnt_inflen == inflen); KASSERT(*cnt_logblksrec == logblksrec); -// KASSERT(mutex_owned(&udf_node->ump->allocate_mutex)); + KASSERT(mutex_owned(&udf_node->ump->allocate_mutex)); } #else static void @@ -346,26 +319,26 @@ uint64_t inflen, logblksrec; int dscr_size, lb_size; - lb_size = udf_rw32(udf_node->ump->logical_vol->lb_size); + lb_size = le32toh(udf_node->ump->logical_vol->lb_size); fe = udf_node->fe; efe = udf_node->efe; if (fe) { icbtag = &fe->icbtag; - inflen = udf_rw64(fe->inf_len); + inflen = le64toh(fe->inf_len); dscr_size = sizeof(struct file_entry) -1; - logblksrec = udf_rw64(fe->logblks_rec); + logblksrec = le64toh(fe->logblks_rec); } else { icbtag = &efe->icbtag; - inflen = udf_rw64(efe->inf_len); + inflen = le64toh(efe->inf_len); dscr_size = sizeof(struct extfile_entry) -1; - logblksrec = udf_rw64(efe->logblks_rec); + logblksrec = le64toh(efe->logblks_rec); } *cnt_logblksrec = logblksrec; *cnt_inflen = inflen; } #endif - +#endif /* --------------------------------------------------------------------- */ void @@ -385,9 +358,10 @@ * We sum all free space up here regardless of type. */ - KASSERT(lvid); - num_vpart = udf_rw32(lvid->num_part); +/* KASSERT(lvid); */ + num_vpart = le32toh(lvid->num_part); +#if 0 if (ump->discinfo.mmc_cur & MMC_CAP_SEQUENTIAL) { /* use track info directly summing if there are 2 open */ /* XXX assumption at most two tracks open */ @@ -396,16 +370,19 @@ *freeblks += ump->metadata_track.free_blocks; *sizeblks = ump->discinfo.last_possible_lba; } else { +#endif /* free and used space for mountpoint based on logvol integrity */ for (vpart = 0; vpart < num_vpart; vpart++) { pos1 = &lvid->tables[0] + vpart; pos2 = &lvid->tables[0] + num_vpart + vpart; - if (udf_rw32(*pos1) != (uint32_t) -1) { - *freeblks += udf_rw32(*pos1); - *sizeblks += udf_rw32(*pos2); + if (le32toh(*pos1) != (uint32_t) -1) { + *freeblks += le32toh(*pos1); + *sizeblks += le32toh(*pos2); } } +#if 0 } +#endif /* adjust for accounted uncommitted blocks */ for (vpart = 0; vpart < num_vpart; vpart++) *freeblks -= ump->uncommitted_lbs[vpart]; @@ -417,7 +394,7 @@ } } - +#if 0 static void udf_calc_vpart_freespace(struct udf_mount *ump, uint16_t vpart_num, uint64_t *freeblks) { @@ -445,8 +422,8 @@ } else { /* free and used space for mountpoint based on logvol integrity */ pos1 = &lvid->tables[0] + vpart_num; - if (udf_rw32(*pos1) != (uint32_t) -1) - *freeblks += udf_rw32(*pos1); + if (le32toh(*pos1) != (uint32_t) -1) + *freeblks += le32toh(*pos1); } /* adjust for accounted uncommitted blocks */ @@ -456,7 +433,7 @@ *freeblks = 0; } } - +#endif /* --------------------------------------------------------------------- */ int @@ -467,16 +444,15 @@ struct spare_map_entry *sme; struct long_ad s_icb_loc; uint64_t foffset, end_foffset; - uint32_t lb_size, len; - uint32_t lb_num, lb_rel, lb_packet; + int rel, part, error, eof, slot, flags; + uint32_t lb_size, len, lb_num, lb_rel, lb_packet; uint32_t udf_rw32_lbmap, ext_offset; uint16_t vpart; - int rel, part, error, eof, slot, flags; - assert(ump && icb_loc && lb_numres); + KASSERT(ump && icb_loc && lb_numres,("ump && icb_loc && lb_numres")); - vpart = udf_rw16(icb_loc->loc.part_num); - lb_num = udf_rw32(icb_loc->loc.lb_num); + vpart = le16toh(icb_loc->loc.part_num); + lb_num = le32toh(icb_loc->loc.lb_num); if (vpart > UDF_VTOP_RAWPART) return EINVAL; @@ -492,12 +468,12 @@ return 0; case UDF_VTOP_TYPE_PHYS : /* transform into its disc logical block */ - if (lb_num > udf_rw32(pdesc->part_len)) + if (lb_num > le32toh(pdesc->part_len)) return EINVAL; - *lb_numres = lb_num + udf_rw32(pdesc->start_loc); + *lb_numres = lb_num + le32toh(pdesc->start_loc); /* extent from here to the end of the partition */ - *extres = udf_rw32(pdesc->part_len) - lb_num; + *extres = le32toh(pdesc->part_len) - lb_num; return 0; case UDF_VTOP_TYPE_VIRT : /* only maps one logical block, lookup in VAT */ @@ -505,21 +481,18 @@ return EINVAL; /* lookup in virtual allocation table file */ - mutex_enter(&ump->allocate_mutex); error = udf_vat_read(ump->vat_node, (uint8_t *) &udf_rw32_lbmap, 4, ump->vat_offset + lb_num * 4); - mutex_exit(&ump->allocate_mutex); - if (error) return error; - lb_num = udf_rw32(udf_rw32_lbmap); + lb_num = le32toh(udf_rw32_lbmap); /* transform into its disc logical block */ - if (lb_num > udf_rw32(pdesc->part_len)) + if (lb_num > le32toh(pdesc->part_len)) return EINVAL; - *lb_numres = lb_num + udf_rw32(pdesc->start_loc); + *lb_numres = lb_num + le32toh(pdesc->start_loc); /* just one logical block */ *extres = 1; @@ -529,29 +502,30 @@ lb_packet = lb_num / ump->sparable_packet_size; lb_rel = lb_num % ump->sparable_packet_size; - for (rel = 0; rel < udf_rw16(ump->sparing_table->rt_l); rel++) { + for (rel = 0; rel < le16toh(ump->sparing_table->rt_l); rel++) { sme = &ump->sparing_table->entries[rel]; - if (lb_packet == udf_rw32(sme->org)) { + if (lb_packet == le32toh(sme->org)) { /* NOTE maps to absolute disc logical block! */ - *lb_numres = udf_rw32(sme->map) + lb_rel; + *lb_numres = le32toh(sme->map) + lb_rel; *extres = ump->sparable_packet_size - lb_rel; return 0; } } /* transform into its disc logical block */ - if (lb_num > udf_rw32(pdesc->part_len)) + if (lb_num > le32toh(pdesc->part_len)) return EINVAL; - *lb_numres = lb_num + udf_rw32(pdesc->start_loc); + *lb_numres = lb_num + le32toh(pdesc->start_loc); /* rest of block */ *extres = ump->sparable_packet_size - lb_rel; return 0; case UDF_VTOP_TYPE_META : +printf("Metadata Partition Translated\n"); /* we have to look into the file's allocation descriptors */ /* use metadatafile allocation mutex */ - lb_size = udf_rw32(ump->logical_vol->lb_size); + lb_size = le32toh(ump->logical_vol->lb_size); UDF_LOCK_NODE(ump->metadata_node, 0); @@ -561,21 +535,11 @@ for (;;) { udf_get_adslot(ump->metadata_node, slot, &s_icb_loc, &eof); - DPRINTF(ADWLK, ("slot %d, eof = %d, flags = %d, " - "len = %d, lb_num = %d, part = %d\n", - slot, eof, - UDF_EXT_FLAGS(udf_rw32(s_icb_loc.len)), - UDF_EXT_LEN(udf_rw32(s_icb_loc.len)), - udf_rw32(s_icb_loc.loc.lb_num), - udf_rw16(s_icb_loc.loc.part_num))); if (eof) { - DPRINTF(TRANSLATE, - ("Meta partition translation " - "failed: can't seek location\n")); UDF_UNLOCK_NODE(ump->metadata_node, 0); return EINVAL; } - len = udf_rw32(s_icb_loc.len); + len = le32toh(s_icb_loc.len); flags = UDF_EXT_FLAGS(len); len = UDF_EXT_LEN(len); @@ -595,17 +559,14 @@ ext_offset = lb_num * lb_size - foffset; /* process extent offset */ - lb_num = udf_rw32(s_icb_loc.loc.lb_num); - vpart = udf_rw16(s_icb_loc.loc.part_num); + lb_num = le32toh(s_icb_loc.loc.lb_num); + vpart = le16toh(s_icb_loc.loc.part_num); lb_num += (ext_offset + lb_size -1) / lb_size; ext_offset = 0; UDF_UNLOCK_NODE(ump->metadata_node, 0); - if (flags != UDF_EXT_ALLOCATED) { - DPRINTF(TRANSLATE, ("Metadata partition translation " - "failed: not allocated\n")); + if (flags != UDF_EXT_ALLOCATED) return EINVAL; - } /* * vpart and lb_num are updated, translate again since we @@ -623,6 +584,7 @@ /* XXX provisional primitive braindead version */ /* TODO use ext_res */ +#if 0 void udf_translate_vtop_list(struct udf_mount *ump, uint32_t sectors, uint16_t vpart_num, uint64_t *lmapping, uint64_t *pmapping) @@ -633,22 +595,133 @@ for (sector = 0; sector < sectors; sector++) { memset(&loc, 0, sizeof(struct long_ad)); - loc.loc.part_num = udf_rw16(vpart_num); - loc.loc.lb_num = udf_rw32(*lmapping); + loc.loc.part_num = le16toh(vpart_num); + loc.loc.lb_num = le32toh(*lmapping); udf_translate_vtop(ump, &loc, &lb_numres, &ext_res); *pmapping = lb_numres; lmapping++; pmapping++; } } +#endif + +/* --------------------------------------------------------------------- */ +/* + *This is a simplified version of the following function. It is used in + * bmap. + */ +int +udf_bmap_translate(struct udf_node *udf_node, uint32_t block, + uint64_t *lsector, uint32_t *maxblks) +{ + struct udf_mount *ump; + struct icb_tag *icbtag; + struct long_ad t_ad, s_ad; + uint64_t foffset, new_foffset; + int eof, error, flags, slot, addr_type, icbflags; + uint32_t transsec32, lb_size, ext_offset, lb_num, len; + uint32_t ext_remain, translen; + uint16_t vpart_num; + + if (!udf_node) + return ENOENT; + + KASSERT(num_lb > 0,("num_lb > 0")); + + UDF_LOCK_NODE(udf_node, 0); + + /* initialise derivative vars */ + ump = udf_node->ump; + lb_size = le32toh(ump->logical_vol->lb_size); + + if (udf_node->fe) { + icbtag = &udf_node->fe->icbtag; + } else { + icbtag = &udf_node->efe->icbtag; + } + icbflags = le16toh(icbtag->flags); + addr_type = icbflags & UDF_ICB_TAG_FLAGS_ALLOC_MASK; + + /* do the work */ + if (addr_type == UDF_ICB_INTERN_ALLOC) { + *lsector = UDF_TRANS_INTERN; + *maxblks = 1; + UDF_UNLOCK_NODE(udf_node, 0); + return 0; + } + + /* find first overlapping extent */ + foffset = 0; + slot = 0; + for (;;) { + udf_get_adslot(udf_node, slot, &s_ad, &eof); + if (eof) { + UDF_UNLOCK_NODE(udf_node, 0); + return EINVAL; + } + len = le32toh(s_ad.len); + flags = UDF_EXT_FLAGS(len); + len = UDF_EXT_LEN(len); + + if (flags == UDF_EXT_REDIRECT) { + slot++; + continue; + } + + new_foffset = foffset + len; + + if (new_foffset > block * lb_size) + break; /* found */ + foffset = new_foffset; + slot++; + } + /* found overlapping slot */ + lb_num = le32toh(s_ad.loc.lb_num); + vpart_num = le16toh(s_ad.loc.part_num); + + ext_offset = block * lb_size - foffset; + lb_num += (ext_offset + lb_size -1) / lb_size; + ext_remain = (len - ext_offset + lb_size -1) / lb_size; + /* + * note that the while(){} is nessisary for the extent that + * the udf_translate_vtop() returns doens't have to span the + * whole extent. + */ + switch (flags) { + case UDF_EXT_FREE : + case UDF_EXT_ALLOCATED_BUT_NOT_USED : + *lsector = UDF_TRANS_ZERO; + *maxblks = ext_remain; + break; + case UDF_EXT_ALLOCATED : + t_ad.loc.lb_num = htole32(lb_num); + t_ad.loc.part_num = htole16(vpart_num); + error = udf_translate_vtop(ump, + &t_ad, &transsec32, &translen); + if (error) { + UDF_UNLOCK_NODE(udf_node, 0); + return error; + } + *lsector = transsec32; + *maxblks = MIN(ext_remain, translen); + break; + default: + UDF_UNLOCK_NODE(udf_node, 0); + return EINVAL; + } + + UDF_UNLOCK_NODE(udf_node, 0); + + return 0; +} /* --------------------------------------------------------------------- */ /* * Translate an extent (in logical_blocks) into logical block numbers; used * for read and write operations. DOESNT't check extents. */ - +#if 0 int udf_translate_file_extent(struct udf_node *udf_node, uint32_t from, uint32_t num_lb, @@ -677,14 +750,14 @@ /* initialise derivative vars */ ump = udf_node->ump; - lb_size = udf_rw32(ump->logical_vol->lb_size); + lb_size = le32toh(ump->logical_vol->lb_size); if (udf_node->fe) { icbtag = &udf_node->fe->icbtag; } else { icbtag = &udf_node->efe->icbtag; } - icbflags = udf_rw16(icbtag->flags); + icbflags = le16toh(icbtag->flags); addr_type = icbflags & UDF_ICB_TAG_FLAGS_ALLOC_MASK; /* do the work */ @@ -701,10 +774,10 @@ udf_get_adslot(udf_node, slot, &s_ad, &eof); DPRINTF(ADWLK, ("slot %d, eof = %d, flags = %d, len = %d, " "lb_num = %d, part = %d\n", slot, eof, - UDF_EXT_FLAGS(udf_rw32(s_ad.len)), - UDF_EXT_LEN(udf_rw32(s_ad.len)), - udf_rw32(s_ad.loc.lb_num), - udf_rw16(s_ad.loc.part_num))); + UDF_EXT_FLAGS(le32toh(s_ad.len)), + UDF_EXT_LEN(le32toh(s_ad.len)), + le32toh(s_ad.loc.lb_num), + le16toh(s_ad.loc.part_num))); if (eof) { DPRINTF(TRANSLATE, ("Translate file extent " @@ -712,10 +785,10 @@ UDF_UNLOCK_NODE(udf_node, 0); return EINVAL; } - len = udf_rw32(s_ad.len); + len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); len = UDF_EXT_LEN(len); - lb_num = udf_rw32(s_ad.loc.lb_num); + lb_num = le32toh(s_ad.loc.lb_num); if (flags == UDF_EXT_REDIRECT) { slot++; @@ -736,10 +809,10 @@ udf_get_adslot(udf_node, slot, &s_ad, &eof); DPRINTF(ADWLK, ("slot %d, eof = %d, flags = %d, len = %d, " "lb_num = %d, part = %d\n", slot, eof, - UDF_EXT_FLAGS(udf_rw32(s_ad.len)), - UDF_EXT_LEN(udf_rw32(s_ad.len)), - udf_rw32(s_ad.loc.lb_num), - udf_rw16(s_ad.loc.part_num))); + UDF_EXT_FLAGS(le32toh(s_ad.len)), + UDF_EXT_LEN(le32toh(s_ad.len)), + le32toh(s_ad.loc.lb_num), + le16toh(s_ad.loc.part_num))); if (eof) { DPRINTF(TRANSLATE, ("Translate file extent " @@ -748,12 +821,12 @@ return EINVAL; } - len = udf_rw32(s_ad.len); + len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); len = UDF_EXT_LEN(len); - lb_num = udf_rw32(s_ad.loc.lb_num); - vpart_num = udf_rw16(s_ad.loc.part_num); + lb_num = le32toh(s_ad.loc.lb_num); + vpart_num = le16toh(s_ad.loc.part_num); end_foffset = foffset + len; @@ -782,8 +855,8 @@ } break; case UDF_EXT_ALLOCATED : - t_ad.loc.lb_num = udf_rw32(lb_num); - t_ad.loc.part_num = udf_rw16(vpart_num); + t_ad.loc.lb_num = le32toh(lb_num); + t_ad.loc.part_num = le16toh(vpart_num); error = udf_translate_vtop(ump, &t_ad, &transsec32, &translen); transsec = transsec32; @@ -829,7 +902,7 @@ KASSERT(ump); KASSERT(ump->logical_vol); - lb_size = udf_rw32(ump->logical_vol->lb_size); + lb_size = le32toh(ump->logical_vol->lb_size); blob = malloc(lb_size, M_UDFTEMP, M_WAITOK); /* TODO static allocation of search chunk */ @@ -852,7 +925,7 @@ /* search this chunk */ for (entry=0; entry < chunk /4; entry++, lb_num++) { udf_rw32_lbmap = *((uint32_t *) (blob + entry * 4)); - lb_map = udf_rw32(udf_rw32_lbmap); + lb_map = le32toh(udf_rw32_lbmap); if (lb_map == 0xffffffff) { found = 1; break; @@ -872,7 +945,7 @@ } /* mark entry with initialiser just in case */ - lb_map = udf_rw32(0xfffffffe); + lb_map = le32toh(0xfffffffe); udf_vat_write(ump->vat_node, (uint8_t *) &lb_map, 4, ump->vat_offset + lb_num *4); ump->vat_last_free_lb = lb_num; @@ -928,7 +1001,7 @@ lb_num = offset + bit-1; *lmappos++ = lb_num; *num_lb = *num_lb - 1; - // offset = (offset & ~7); + /* offset = (offset & ~7); */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 12:46:17 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 AA0A41065673 for ; Tue, 5 Jun 2012 12:46:15 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 12:46:15 +0000 Date: Tue, 05 Jun 2012 12:46:15 +0000 From: oleksandr@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: <20120605124615.AA0A41065673@hub.freebsd.org> Cc: Subject: socsvn commit: r237135 - soc2012/oleksandr/udf-head/sys/fs/udf2 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: Tue, 05 Jun 2012 12:46:17 -0000 Author: oleksandr Date: Tue Jun 5 12:46:15 2012 New Revision: 237135 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237135 Log: Delete some unused files Added: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_iconv.c Deleted: soc2012/oleksandr/udf-head/sys/fs/udf2/files.udf soc2012/oleksandr/udf-head/sys/fs/udf2/udf_bswap.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_bootstrap.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_direct.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_rmw.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_sequential.c Added: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c Tue Jun 5 12:46:15 2012 (r237135) @@ -0,0 +1,201 @@ +/*- + * Copyright (c) 2012 Will DeVries + * 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 ``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 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 +#include +#include +#include /* printf */ + +#include "ecma167-udf.h" +#include "udf.h" +#include "udf_subr.h" +#include "udf_mount.h" + +extern struct iconv_functions *udf2_iconv; + +static int +udf_to_utf8(char **result, size_t *rrem, uint32_t ch) +{ + int n = 0; + char *rp = *result; + + if ((ch & 0xFFFFFF80) == 0) { + if (*rrem < 1) + return 0; + + n = 1; + rp[0] = ch & 0x7F; + } else if ((ch & 0xFFFFF800) == 0) { + if (*rrem < 2) + return 0; + + n = 2; + rp[0] = 0xC0 | (ch >> 6); + rp[1] = 0x80 | (0x3F & ch); + } else if ((ch & 0xFFFF0000) == 0) { + if (*rrem < 3) + return 0; + + n = 3; + rp[0] = 0xE0 | (ch >> 12); + rp[1] = 0x80 | (0x3F & (ch >> 6)); + rp[2] = 0x80 | (0x3F & ch); + } else if ((ch & 0xFFE00000) == 0) { + if (*rrem < 4) + return 0; + + n = 4; + rp[0] = 0xF0 | (ch >> 18); + rp[1] = 0x80 | (0x3F & (ch >> 12)); + rp[2] = 0x80 | (0x3F & (ch >> 6)); + rp[3] = 0x80 | (0x3F & ch); + } else { + /* do not convert points above 21 bits. */ + return 0; + } + + *rrem -= n; + *result += n; + return n; +} + +static void +udf_convert_str(struct udf_mount *ump, char *result, size_t result_len, int *extloc, + int eightbit, char *id, int id_len) +{ + size_t rrem, chrem; + int i, endi, needsCRC, invalid; + uint32_t uch; + char *rp, ch[2]; + const char *chp; + uint16_t *index; + + index = malloc(id_len * sizeof(uint16_t), M_UDFTEMP, M_WAITOK); + + if (eightbit) + endi = id_len; + else + endi = (id_len - 1 > 0) ? id_len - 1 : 0; + + invalid = 0; + rp = result; + rrem = (size_t)result_len - 1; /* for the null */ + for (i = 0; i < endi;) { + if (eightbit) + uch = id[i]; + else + uch = id[i] << 8 | id[i+1]; + + index[i] = result_len - rrem; + + if (rrem == 0) { + /* no more space, we need to truncate it. */ + needsCRC = 1; + } else if (uch == 0 || uch == 0x2F) { + /* do not allow nulls or slashes */ + invalid++; + } else if (ump->flags & UDFMNT_KICONV && udf2_iconv) { + /* it might be a valid character */ + chrem = 2; + chp = ch; + ch[0] = uch >> 8; + ch[1] = uch & 0x00FF; + udf2_iconv->convchr(ump->iconv_d2l, &chp, &chrem, &rp, &rrem); + if (chrem > 0) { + /* not printable or doesn't fit */ + invalid++; + needsCRC = 1; + } else + invalid = 0; + } else { + /* utf8 output */ + /* it is a valid character */ + if (udf_to_utf8(&rp, &rrem, uch) == 0) { + /* doesn't fit or too large */ + invalid++; + needsCRC = 1; + } else + invalid = 0; + } + + if (uch == 0x002E && i != 1) { + /* record locations of periods where they occur within + 5 char of the end, but not at the end or start */ + if (eightbit && id_len - 6 > i && i + 1 != endi) { + *extloc = i; + } else if (!eightbit && id_len - 11 > i && i + 2 != endi) { + *extloc = i; + } + } + + if (rrem > 0 && invalid == 1) { + uch = 0x5F; + + /* if the result doesn't have space this may not fit */ + if (ump->flags & UDFMNT_KICONV && udf2_iconv) { + chrem = 2; + chp = ch; + ch[0] = uch >> 8; + ch[1] = uch & 0x0F; + udf2_iconv->convchr(ump->iconv_d2l, &chp, &chrem, &rp, &rrem); + } else { + /* utf8 output */ + udf_to_utf8(&rp, &rrem, uch); + } + invalid++; + } + + if (eightbit) + i++; + else + i += 2; + } + + *rp = '\0'; + + free(index, M_UDFTEMP); +} + +void +udf_to_unix_name(struct udf_mount *ump, char *result, int result_len, char *id, int id_len) { + int extloc, eightbit; + + if (id[0] != 8 && id[0] != 16) { + /* this is either invalid or an empty string */ + result_len = 0; + return; + } + + if (id[0] == 8) { + eightbit = 1; + } else { + eightbit = 0; + } + + udf_convert_str(ump, result, result_len, &extloc, eightbit, id+1, id_len-1); + + return; +} Added: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_iconv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_iconv.c Tue Jun 5 12:46:15 2012 (r237135) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2003 Ryuichiro Imura + * 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. + */ + +#include +__FBSDID("$FreeBSD: src/sys/fs/udf/udf_iconv.c,v 1.1 2003/11/05 06:56:08 scottl Exp $"); + +#include +#include +#include +#include +#include + +VFS_DECLARE_ICONV(udf2); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 13:46: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 44F9E106564A for ; Tue, 5 Jun 2012 13:46:20 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 13:46:20 +0000 Date: Tue, 05 Jun 2012 13:46:20 +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: <20120605134620.44F9E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237137 - 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: Tue, 05 Jun 2012 13:46:21 -0000 Author: gpf Date: Tue Jun 5 13:46:19 2012 New Revision: 237137 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237137 Log: - check if our input file list is empty - check if some file entry corresponds to an empty file - check if pefs_next_file_entry encounters an error - handle symlinks: If file in input list is symlink, get the absolute path of the file that it's pointing to. Perform sanity checks on target file. If everything's ok, target file is used throughout the codebase. Which means that .pefs.checksum will have an entry for that target file, not for the symlink. - check for numeric overflows in a few parts Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue Jun 5 12:34:08 2012 (r237136) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue Jun 5 13:46:19 2012 (r237137) @@ -54,7 +54,7 @@ #include "pefs_ctl.h" -#define PEFS_INTEGRITY_DEBUG +//#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -71,6 +71,8 @@ #define PEFS_CFH_SIZE 16 #define PEFS_FH_SIZE 16 +/* XXXgpf: [TODO] check pathname string lengths. Some are MAXPATHLEN + 1, some MAXPATHLEN */ + /* XXXgpf: unions for on disk structs and move to a different header? */ struct checksum_file_header { uint8_t version; @@ -169,8 +171,11 @@ return (PEFS_ERR_SYS); } - /* XXXgpf: shouldn't we also check for empty files? */ resid = sb.st_size; + if (resid == 0) { + pefs_warn("empty files are not allowed: %s", fhp->path); + return (PEFS_ERR_INVALID); + } fd = open(fhp->path, O_RDONLY); if (fd < 0) { @@ -244,7 +249,10 @@ nfiles = 0; while (fgets(buf, sizeof(buf), fpin) != NULL) { - /* XXXgpf: [TODO] check for numeric overflow */ + if (nfiles + 1 < nfiles) { + pefs_warn("numeric overflow while counting file entries"); + return (PEFS_ERR_GENERIC); + } nfiles++; } @@ -253,6 +261,11 @@ return (PEFS_ERR_IO); } + if (nfiles == 0) { + pefs_warn("input file has no entries"); + return (PEFS_ERR_INVALID); + } + fseek(fpin, 0, SEEK_SET); *nelementsp = nfiles; @@ -287,6 +300,10 @@ } else { chtp->size = pefs_next_prime(chtp->size + 1); + if (chtp->size < chtp->nelements) { + pefs_warn("numeric overflow while computing new hash table size"); + return (PEFS_ERR_GENERIC); + } free(chtp->buckets1); free(chtp->buckets2); } @@ -533,10 +550,14 @@ static int pefs_file_semantic_checks(struct file_header *fhp, struct statfs *fsp) { + char parent_dir[MAXPATHLEN]; + char sbuf[MAXPATHLEN]; struct stat sb; struct statfs this_fs; + char *pch; + int nchars; - if (stat(fhp->path, &sb) != 0) { + if (lstat(fhp->path, &sb) != 0) { warn("cannot stat file %s", fhp->path); return (PEFS_ERR_SYS); } @@ -549,6 +570,35 @@ /* * XXXgpf: [TODO] deal with other types of files */ + if (S_ISLNK(sb.st_mode) != 0) { + nchars = readlink(fhp->path, sbuf, sizeof(sbuf)); + if (nchars == -1) { + warn("readlink failed: %s", fhp->path); + return (PEFS_ERR_SYS); + } + + if (nchars > sizeof(sbuf) - 1) + nchars = sizeof(sbuf) - 1; + sbuf[nchars] = '\0'; + /* turn relative paths to absolute paths which are needed for pefs_get_file_id() */ + if (sbuf[0] != '/') { + strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); + pch = strrchr(parent_dir, '/'); + if (pch == NULL) { + pefs_warn("error retrieving parent dir of %s", fhp->path); + return (PEFS_ERR_NOENT); + } + *pch = '\0'; + snprintf(fhp->path, sizeof(fhp->path), "%s/%s", parent_dir, sbuf); + } + else + strlcpy(fhp->path, sbuf, sizeof(fhp->path)); + + if (lstat(fhp->path, &sb) != 0) { + warn("cannot stat file %s", fhp->path); + return (PEFS_ERR_SYS); + } + } if (S_ISREG(sb.st_mode) == 0) { pefs_warn("filename: %s is not a regular file", fhp->path); @@ -652,6 +702,10 @@ TAILQ_INSERT_TAIL(&fh_head, fhp, file_header_entries); } + /* checking I/O error with pefs_next_file()*/ + if (error != 0) + return (error); + cuckoo_insert: TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { error = pefs_add_to_hash_table(chtp, fhp); @@ -667,7 +721,7 @@ return (error); goto cuckoo_insert; } - } + } pefs_print_hash_table(chtp, hash_len); return (error); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 14:26:32 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 E2A5C1065674 for ; Tue, 5 Jun 2012 14:26:31 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 14:26:31 +0000 Date: Tue, 05 Jun 2012 14:26:31 +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: <20120605142631.E2A5C1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r237140 - 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: Tue, 05 Jun 2012 14:26:33 -0000 Author: gpf Date: Tue Jun 5 14:26:30 2012 New Revision: 237140 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237140 Log: change how symlinks are handled. user may want to check integrity for symlink file itself, and not just for the target file that the symlink points to. Therefore, if user wants integrity checking for both symlink & target file, he should provide two separate entries in input file list. one for symlink file, one for target file. However, if symlink is given, normal sanity checks are performed as usual. Todo: print warning if target file of a sylmink does not reside in input file list. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue Jun 5 13:57:02 2012 (r237139) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue Jun 5 14:26:30 2012 (r237140) @@ -93,6 +93,7 @@ uint32_t nhashes; uint64_t file_id; char path[MAXPATHLEN]; + char *target_path; uint32_t offset_to_checksums; struct checksum_head checksums; TAILQ_ENTRY(file_header) file_header_entries; @@ -380,7 +381,7 @@ uint32_t nbucket; nbucket = fhp->file_id % chtp->size; - printf("hash1: goto bucket %d\n", nbucket); + dprintf(("hash1: goto bucket %d\n", nbucket)); return (nbucket); } @@ -390,7 +391,7 @@ uint32_t nbucket; nbucket = fnv_64_buf(&(fhp->file_id), sizeof(fhp->file_id), FNV1_64_INIT) % chtp->size; - printf("hash2: goto bucket %d\n", nbucket); + dprintf(("hash2: goto bucket %d\n", nbucket)); return (nbucket); } @@ -562,11 +563,6 @@ return (PEFS_ERR_SYS); } - if (statfs(fhp->path, &this_fs) == -1) { - pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); - return (PEFS_ERR_SYS); - } - /* * XXXgpf: [TODO] deal with other types of files */ @@ -577,10 +573,22 @@ return (PEFS_ERR_SYS); } - if (nchars > sizeof(sbuf) - 1) - nchars = sizeof(sbuf) - 1; + /* + * XXXgpf: target_path can be used to tell if user has supplied target_file + * in input file-list, since symlinks are not traversed. User will have to + * provide fullpaths for both symlink & target file if he wants integrity + * checking for both. + * [TODO] make sure they are properly free()d and print warning errors + * in case user does not supply separate entry for target_file. + */ + fhp->target_path = malloc(MAXPATHLEN); + if (fhp->target_path == NULL) { + warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + sbuf[nchars] = '\0'; - /* turn relative paths to absolute paths which are needed for pefs_get_file_id() */ + /* turn relative paths to absolute paths */ if (sbuf[0] != '/') { strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); pch = strrchr(parent_dir, '/'); @@ -589,15 +597,38 @@ return (PEFS_ERR_NOENT); } *pch = '\0'; - snprintf(fhp->path, sizeof(fhp->path), "%s/%s", parent_dir, sbuf); + snprintf(fhp->target_path, MAXPATHLEN, "%s/%s", parent_dir, sbuf); } else - strlcpy(fhp->path, sbuf, sizeof(fhp->path)); + strlcpy(fhp->target_path, sbuf, sizeof(fhp->target_path)); - if (lstat(fhp->path, &sb) != 0) { - warn("cannot stat file %s", fhp->path); + /* target file should be in pefs filesystem */ + if (statfs(fhp->target_path, &this_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fhp->target_path, strerror(errno)); return (PEFS_ERR_SYS); } + + if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || + (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { + pefs_warn("symlink target filename: %s does not reside in filesystem %s", + fhp->target_path, fsp->f_mntonname); + return (PEFS_ERR_INVALID); + } + + /* symlink file should be in pefs filesystem */ + if (statfs(fhp->path, &this_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); + return (PEFS_ERR_SYS); + } + + if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || + (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { + pefs_warn("filename: %s does not reside in filesystem %s", + fhp->path, fsp->f_mntonname); + return (PEFS_ERR_INVALID); + } + + return (0); } if (S_ISREG(sb.st_mode) == 0) { @@ -605,6 +636,11 @@ return (PEFS_ERR_INVALID); } + if (statfs(fhp->path, &this_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); + return (PEFS_ERR_SYS); + } + if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { pefs_warn("filename: %s does not reside in filesystem %s", From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 19:47: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 58AB41065670 for ; Tue, 5 Jun 2012 19:47:08 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 19:47:08 +0000 Date: Tue, 05 Jun 2012 19:47:08 +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: <20120605194708.58AB41065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237153 - in soc2012/aleek/beaglexm-armv6/sys: arm/conf arm/ti arm/ti/am37x 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: Tue, 05 Jun 2012 19:47:10 -0000 Author: aleek Date: Tue Jun 5 19:47:07 2012 New Revision: 237153 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237153 Log: added mapping for devices etc. Board boots to initarm():setttb() Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_dmtimer.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_pmic.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_reg.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_scm_padconf.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Deleted: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_timer.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.beagleboardxm soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/std.am37x soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/std.beagleboardxm soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jun 5 18:58:05 2012 (r237152) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jun 5 19:47:07 2012 (r237153) @@ -1,5 +1,5 @@ -# BEAGLEBOARD -- Custom configuration for the BeagleBoard ARM development -# platform, check out www.beaglebaord.org +# BEAGLEBONE -- Custom configuration for the BeagleBone ARM development +# platform, check out http://www.beagleboard.org/bone # # For more information on this file, please read the handbook section on # Kernel Configuration Files: @@ -12,109 +12,114 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ -ident BEAGLEBAORD-XM +ident BEAGLEBOARD-XM -# This probably wants to move somewhere else. Maybe we can create a basic -# OMAP3530 config, then make a BEAGLEBOARD config that includes the basic one, -# adds the start addresses and custom devices plus pulls in this hints file. +include "../ti/am37x/std.beagleboardxm" -#hints "BEAGLEBOARD.hints" - -include "../ti/am37x/std.beagleboardxm" - -#To statically compile in device wiring instead of /boot/device.hints makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" +makeoptions WITHOUT_MODULES="ahc" -makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions WERROR= -options HZ=100 +options HZ=100 +options SCHED_4BSD #4BSD scheduler +#options INET #InterNETworking +#options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options SOFTUPDATES #Enable FFS soft updates support +options UFS_ACL #Support for access control lists +options UFS_DIRHASH #Improve performance on big directories +options MSDOSFS #MSDOS Filesystem +options CD9660 #ISO 9660 Filesystem +options PROCFS #Process filesystem (requires PSEUDOFS) +options PSEUDOFS #Pseudo-filesystem framework +options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] +options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI +options KTRACE #ktrace(1) support +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +options PREEMPTION -options SCHED_4BSD #4BSD scheduler -#options INET #InterNETworking -#options INET6 #IPv6 communications protocols -options FFS #Berkeley Fast Filesystem -options SOFTUPDATES #Enable FFS soft updates support -options UFS_ACL #Support for access control lists -options UFS_DIRHASH #Improve performance on big directories -#options NFSCLIENT #Network Filesystem Client -#options NFSSERVER #Network Filesystem Server -#options NFS_ROOT #NFS usable as /, requires NFSCLIENT -#options MSDOSFS #MSDOS Filesystem -#options CD9660 #ISO 9660 Filesystem -#options PROCFS #Process filesystem (requires PSEUDOFS) -options PSEUDOFS #Pseudo-filesystem framework -options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] -options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI -options KTRACE #ktrace(1) support -options SYSVSHM #SYSV-style shared memory -options SYSVMSG #SYSV-style message queues -options SYSVSEM #SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions -options KBD_INSTALL_CDEV # install a CDEV entry in /dev +# Debugging +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +options BREAK_TO_DEBUGGER +#options VERBOSE_SYSINIT #Enable verbose sysinit messages +options KDB +options DDB #Enable the kernel debugger +options INVARIANTS #Enable calls of extra sanity checking +options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS +options WITNESS #Enable checks to detect deadlocks and cycles +options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed +#options DIAGNOSTIC + +# NFS support +#options NFSCL +#options NFSSERVER #Network Filesystem Server +#options NFSCLIENT #Network Filesystem Client + +# Uncomment this for NFS root +#options NFS_ROOT #NFS usable as /, requires NFSCLIENT +#options BOOTP_NFSROOT +#options BOOTP_COMPAT +#options BOOTP +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=cpsw0 -options PREEMPTION -# MMC/SD/SDIO Card slot support -#device mmc # mmc/sd bus +# MMC/SD/SDIO card slot support +#device mmc # mmc/sd bus #device mmcsd # mmc/sd flash cards -# I2C support -#device iicbus -#device iic - -device loop -#device ether -#device mii -#device smc -#device smcphy -#device uart -#device uart_ns8250 +# Boot device is 2nd slice on MMC/SD card +options ROOTDEVNAME=\"ufs:mmcsd0s2\" +# Console and misc +device uart +device uart_ns8250 device pty - -#device gpio - -# Debugging for use in -current -options VERBOSE_SYSINIT #Enable verbose sysinit messages -options KDB -options DDB #Enable the kernel debugger -#options INVARIANTS #Enable calls of extra sanity checking -#options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -#options WITNESS #Enable checks to detect deadlocks and cycles -#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC -options BREAK_TO_DEBUGGER - +device snp device md +device random # Entropy device -# The following enables MFS as root, this seems similar to an initramfs or initrd -# as used in Linux. -# options MD_ROOT -# options MD_ROOT_SIZE=7560 +# I2C support +#device iicbus +#device iic +#device ti_i2c +#device am37x_pmic # AM335x Power Management IC (TPC65217) -device random # Entropy device +# GPIO +#device gpio # USB support #device usb -#device ohci -#device ehci +#options USB_DEBUG +#options USB_REQ_DEBUG +#options USB_VERBOSE +#device musb #device umass -#device scbus # SCSI bus (required for SCSI) -#device da # Direct Access (disks) +#device scbus # SCSI bus (required for SCSI) +#device da # Direct Access (disks) -# USB Ethernet support, requires miibus +# Ethernet +device loop +#device ether +#device mii +#device smcphy + +# USB ethernet support, requires miibus #device miibus +#device cpsw #device axe # ASIX Electronics USB Ethernet - # Flattened Device Tree -#options FDT -#options FDT_DTB_STATIC -#makeoptions FDT_DTS_FILE=beaglebone.dts +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=beagleboardxm.dts + Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_dmtimer.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_dmtimer.c Tue Jun 5 19:47:07 2012 (r237153) @@ -0,0 +1,385 @@ +/*- + * Copyright (c) 2012 Damjan Marion + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#define AM335X_NUM_TIMERS 8 + +#define DMTIMER_TIDR 0x00 /* Identification Register */ +#define DMTIMER_TIOCP_CFG 0x10 /* Timer OCP Configuration Reg */ +#define DMTIMER_IQR_EOI 0x20 /* Timer IRQ End-Of-Interrupt Reg */ +#define DMTIMER_IRQSTATUS_RAW 0x24 /* Timer IRQSTATUS Raw Reg */ +#define DMTIMER_IRQSTATUS 0x28 /* Timer IRQSTATUS Reg */ +#define DMTIMER_IRQENABLE_SET 0x2c /* Timer IRQSTATUS Set Reg */ +#define DMTIMER_IRQENABLE_CLR 0x30 /* Timer IRQSTATUS Clear Reg */ +#define DMTIMER_IRQWAKEEN 0x34 /* Timer IRQ Wakeup Enable Reg */ +#define DMTIMER_TCLR 0x38 /* Timer Control Register */ +#define DMTIMER_TCRR 0x3C /* Timer Counter Register */ +#define DMTIMER_TLDR 0x40 /* Timer Load Reg */ +#define DMTIMER_TTGR 0x44 /* Timer Trigger Reg */ +#define DMTIMER_TWPS 0x48 /* Timer Write Posted Status Reg */ +#define DMTIMER_TMAR 0x4C /* Timer Match Reg */ +#define DMTIMER_TCAR1 0x50 /* Timer Capture Reg */ +#define DMTIMER_TSICR 0x54 /* Timer Synchr. Interface Control Reg */ +#define DMTIMER_TCAR2 0x48 /* Timer Capture Reg */ + + +struct am335x_dmtimer_softc { + struct resource * tmr_mem_res[AM335X_NUM_TIMERS]; + struct resource * tmr_irq_res[AM335X_NUM_TIMERS]; + uint32_t sysclk_freq; + struct am335x_dmtimer { + bus_space_tag_t bst; + bus_space_handle_t bsh; + struct eventtimer et; + } t[AM335X_NUM_TIMERS]; +}; + +static struct resource_spec am335x_dmtimer_mem_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE }, + { SYS_RES_MEMORY, 2, RF_ACTIVE }, + { SYS_RES_MEMORY, 3, RF_ACTIVE }, + { SYS_RES_MEMORY, 4, RF_ACTIVE }, + { SYS_RES_MEMORY, 5, RF_ACTIVE }, + { SYS_RES_MEMORY, 6, RF_ACTIVE }, + { SYS_RES_MEMORY, 7, RF_ACTIVE }, + { -1, 0, 0 } +}; +static struct resource_spec am335x_dmtimer_irq_spec[] = { + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE }, + { SYS_RES_IRQ, 2, RF_ACTIVE }, + { SYS_RES_IRQ, 3, RF_ACTIVE }, + { SYS_RES_IRQ, 4, RF_ACTIVE }, + { SYS_RES_IRQ, 5, RF_ACTIVE }, + { SYS_RES_IRQ, 6, RF_ACTIVE }, + { SYS_RES_IRQ, 7, RF_ACTIVE }, + { -1, 0, 0 } +}; + +static struct am335x_dmtimer *am335x_dmtimer_tc_tmr = NULL; + +/* Read/Write macros for Timer used as timecounter */ +#define am335x_dmtimer_tc_read_4(reg) \ + bus_space_read_4(am335x_dmtimer_tc_tmr->bst, \ + am335x_dmtimer_tc_tmr->bsh, reg) + +#define am335x_dmtimer_tc_write_4(reg, val) \ + bus_space_write_4(am335x_dmtimer_tc_tmr->bst, \ + am335x_dmtimer_tc_tmr->bsh, reg, val) + +/* Read/Write macros for Timer used as eventtimer */ +#define am335x_dmtimer_et_read_4(reg) \ + bus_space_read_4(tmr->bst, tmr->bsh, reg) + +#define am335x_dmtimer_et_write_4(reg, val) \ + bus_space_write_4(tmr->bst, tmr->bsh, reg, val) + +static unsigned am335x_dmtimer_tc_get_timecount(struct timecounter *); + +static struct timecounter am335x_dmtimer_tc = { + .tc_name = "AM335x Timecouter", + .tc_get_timecount = am335x_dmtimer_tc_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_quality = 1000, +}; + +static unsigned +am335x_dmtimer_tc_get_timecount(struct timecounter *tc) +{ + return am335x_dmtimer_tc_read_4(DMTIMER_TCRR); +} + +static int +am335x_dmtimer_start(struct eventtimer *et, struct bintime *first, + struct bintime *period) +{ + struct am335x_dmtimer *tmr = (struct am335x_dmtimer *)et->et_priv; + uint32_t load, count; + uint32_t tclr = 0; + + if (period != NULL) { + load = (et->et_frequency * (period->frac >> 32)) >> 32; + if (period->sec > 0) + load += et->et_frequency * period->sec; + tclr |= 2; /* autoreload bit */ + panic("periodic timer not implemented\n"); + } else { + load = 0; + } + + if (first != NULL) { + count = (tmr->et.et_frequency * (first->frac >> 32)) >> 32; + if (first->sec != 0) + count += tmr->et.et_frequency * first->sec; + } else { + count = load; + } + + /* Reset Timer */ + am335x_dmtimer_et_write_4(DMTIMER_TSICR, 2); + + /* Wait for reset to complete */ + while (am335x_dmtimer_et_read_4(DMTIMER_TIOCP_CFG) & 1); + + /* set load value */ + am335x_dmtimer_et_write_4(DMTIMER_TLDR, 0xFFFFFFFE - load); + + /* set counter value */ + am335x_dmtimer_et_write_4(DMTIMER_TCRR, 0xFFFFFFFE - count); + + /* enable overflow interrupt */ + am335x_dmtimer_et_write_4(DMTIMER_IRQENABLE_SET, 2); + + /* start timer(ST) */ + tclr |= 1; + am335x_dmtimer_et_write_4(DMTIMER_TCLR, tclr); + + return (0); +} + +static int +am335x_dmtimer_stop(struct eventtimer *et) +{ + struct am335x_dmtimer *tmr = (struct am335x_dmtimer *)et->et_priv; + + /* Disable all interrupts */ + am335x_dmtimer_et_write_4(DMTIMER_IRQENABLE_CLR, 7); + + /* Stop Timer */ + am335x_dmtimer_et_write_4(DMTIMER_TCLR, 0); + + return (0); +} + +static int +am335x_dmtimer_intr(void *arg) +{ + struct am335x_dmtimer *tmr = (struct am335x_dmtimer *)arg; + + /* Ack interrupt */ + am335x_dmtimer_et_write_4(DMTIMER_IRQSTATUS, 7); + if (tmr->et.et_active) + tmr->et.et_event_cb(&tmr->et, tmr->et.et_arg); + + return (FILTER_HANDLED); +} + +static int +am335x_dmtimer_probe(device_t dev) +{ + struct am335x_dmtimer_softc *sc; + sc = (struct am335x_dmtimer_softc *)device_get_softc(dev); + + if (ofw_bus_is_compatible(dev, "ti,am335x-dmtimer")) { + device_set_desc(dev, "AM335x DMTimer"); + return(BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +am335x_dmtimer_attach(device_t dev) +{ + struct am335x_dmtimer_softc *sc = device_get_softc(dev); + void *ihl; + int err; + int i; + + if (am335x_dmtimer_tc_tmr != NULL) + return (EINVAL); + + /* Get the base clock frequency */ + err = ti_prcm_clk_get_source_freq(SYS_CLK, &sc->sysclk_freq); + if (err) { + device_printf(dev, "Error: could not get sysclk frequency\n"); + return (ENXIO); + } + + /* Request the memory resources */ + err = bus_alloc_resources(dev, am335x_dmtimer_mem_spec, + sc->tmr_mem_res); + if (err) { + device_printf(dev, "Error: could not allocate mem resources\n"); + return (ENXIO); + } + + /* Request the IRQ resources */ + err = bus_alloc_resources(dev, am335x_dmtimer_irq_spec, + sc->tmr_irq_res); + if (err) { + device_printf(dev, "Error: could not allocate irq resources\n"); + return (ENXIO); + } + + for(i=0;it[i].bst = rman_get_bustag(sc->tmr_mem_res[i]); + sc->t[i].bsh = rman_get_bushandle(sc->tmr_mem_res[i]); + } + + /* Configure DMTimer2 and DMTimer3 source and enable them */ + err = ti_prcm_clk_set_source(DMTIMER2_CLK, SYSCLK_CLK); + err |= ti_prcm_clk_enable(DMTIMER2_CLK); + err |= ti_prcm_clk_set_source(DMTIMER3_CLK, SYSCLK_CLK); + err |= ti_prcm_clk_enable(DMTIMER3_CLK); + if (err) { + device_printf(dev, "Error: could not setup timer clock\n"); + return (ENXIO); + } + + /* Take DMTimer2 for TC */ + am335x_dmtimer_tc_tmr = &sc->t[2]; + + /* Reset Timer */ + am335x_dmtimer_tc_write_4(DMTIMER_TSICR, 2); + + /* Wait for reset to complete */ + while (am335x_dmtimer_tc_read_4(DMTIMER_TIOCP_CFG) & 1); + + /* set load value */ + am335x_dmtimer_tc_write_4(DMTIMER_TLDR, 0); + + /* set counter value */ + am335x_dmtimer_tc_write_4(DMTIMER_TCRR, 0); + + /* Set Timer autoreload(AR) and start timer(ST) */ + am335x_dmtimer_tc_write_4(DMTIMER_TCLR, 3); + + am335x_dmtimer_tc.tc_frequency = sc->sysclk_freq; + tc_init(&am335x_dmtimer_tc); + + /* Register DMTimer3 as ET */ + + /* Setup and enable the timer */ + if (bus_setup_intr(dev, sc->tmr_irq_res[3], INTR_TYPE_CLK, + am335x_dmtimer_intr, NULL, &sc->t[3], &ihl) != 0) { + bus_release_resources(dev, am335x_dmtimer_irq_spec, + sc->tmr_irq_res); + device_printf(dev, "Unable to setup the clock irq handler.\n"); + return (ENXIO); + } + + sc->t[3].et.et_name = "AM335x Eventtimer0"; + sc->t[3].et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT; + sc->t[3].et.et_quality = 1000; + sc->t[3].et.et_frequency = sc->sysclk_freq; + sc->t[3].et.et_min_period.sec = 0; + sc->t[3].et.et_min_period.frac = + ((0x00000002LLU << 32) / sc->t[3].et.et_frequency) << 32; + sc->t[3].et.et_max_period.sec = 0xfffffff0U / sc->t[3].et.et_frequency; + sc->t[3].et.et_max_period.frac = + ((0xfffffffeLLU << 32) / sc->t[3].et.et_frequency) << 32; + sc->t[3].et.et_start = am335x_dmtimer_start; + sc->t[3].et.et_stop = am335x_dmtimer_stop; + sc->t[3].et.et_priv = &sc->t[3]; + et_register(&sc->t[3].et); + + return (0); +} + +static device_method_t am335x_dmtimer_methods[] = { + DEVMETHOD(device_probe, am335x_dmtimer_probe), + DEVMETHOD(device_attach, am335x_dmtimer_attach), + { 0, 0 } +}; + +static driver_t am335x_dmtimer_driver = { + "am335x_dmtimer", + am335x_dmtimer_methods, + sizeof(struct am335x_dmtimer_softc), +}; + +static devclass_t am335x_dmtimer_devclass; + +DRIVER_MODULE(am335x_dmtimer, simplebus, am335x_dmtimer_driver, am335x_dmtimer_devclass, 0, 0); +MODULE_DEPEND(am335x_dmtimer, am335x_prcm, 1, 1, 1); + +void +cpu_initclocks(void) +{ + cpu_initclocks_bsp(); +} + +void +DELAY(int usec) +{ + int32_t counts; + uint32_t first, last; + + if (am335x_dmtimer_tc_tmr == NULL) { + for (; usec > 0; usec--) + for (counts = 200; counts > 0; counts--) + /* Prevent gcc from optimizing out the loop */ + cpufunc_nullop(); + return; + } + + /* Get the number of times to count */ + counts = usec * ((am335x_dmtimer_tc.tc_frequency / 1000000) + 1);; + + first = am335x_dmtimer_tc_read_4(DMTIMER_TCRR); + + while (counts > 0) { + last = am335x_dmtimer_tc_read_4(DMTIMER_TCRR); + if (last>first) { + counts -= (int32_t)(last - first); + } else { + counts -= (int32_t)((0xFFFFFFFF - first) + last); + } + first = last; + } +} + Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_pmic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_pmic.c Tue Jun 5 19:47:07 2012 (r237153) @@ -0,0 +1,176 @@ +/*- + * Copyright (c) 2012 Damjan Marion + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); +/* +* TPS65217 PMIC companion chip for AM335x SoC sitting on I2C bus +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "iicbus_if.h" + +#define TPS65217A 0x7 +#define TPS65217B 0xF + +/* TPS65217 Reisters */ +#define TPS65217_CHIPID_REG 0x00 +#define TPS65217_STATUS_REG 0x0A + +#define MAX_IIC_DATA_SIZE 2 + + +struct am335x_pmic_softc { + device_t sc_dev; + uint32_t sc_addr; + struct intr_config_hook enum_hook; +}; + +static int +am335x_pmic_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) +{ + struct am335x_pmic_softc *sc = device_get_softc(dev); + struct iic_msg msg[] = { + { sc->sc_addr, IIC_M_WR, 1, &addr }, + { sc->sc_addr, IIC_M_RD, size, data }, + }; + return (iicbus_transfer(dev, msg, 2)); +} + +#ifdef notyet +static int +am335x_pmic_write(device_t dev, uint8_t address, uint8_t *data, uint8_t size) +{ + uint8_t buffer[MAX_IIC_DATA_SIZE + 1]; + struct am335x_pmic_softc *sc = device_get_softc(dev); + struct iic_msg msg[] = { + { sc->sc_addr, IIC_M_WR, size + 1, buffer }, + }; + + if (size > MAX_IIC_DATA_SIZE) + return (ENOMEM); + + buffer[0] = address; + memcpy(buffer + 1, data, size); + + return (iicbus_transfer(dev, msg, 1)); +} +#endif + +static int +am335x_pmic_probe(device_t dev) +{ + struct am335x_pmic_softc *sc; + + if (!ofw_bus_is_compatible(dev, "ti,am335x-pmic")) + return (ENXIO); + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + device_set_desc(dev, "TI TPS65217 Power Management IC"); + + return (0); +} + +static void +am335x_pmic_start(void *xdev) +{ + struct am335x_pmic_softc *sc; + device_t dev = (device_t)xdev; + uint8_t reg; + char name[20]; + char pwr[4][11] = {"Unknown", "USB", "AC", "USB and AC"}; + + sc = device_get_softc(dev); + + am335x_pmic_read(dev, TPS65217_CHIPID_REG, ®, 1); + switch (reg>>4) { + case TPS65217A: + sprintf(name, "TPS65217A ver 1.%u", reg & 0xF); + break; + case TPS65217B: + sprintf(name, "TPS65217B ver 1.%u", reg & 0xF); + break; + default: + sprintf(name, "Unknown PMIC"); + } + + am335x_pmic_read(dev, TPS65217_STATUS_REG, ®, 1); + device_printf(dev, "%s powered by %s\n", name, pwr[(reg>>2)&0x03]); + + config_intrhook_disestablish(&sc->enum_hook); +} + +static int +am335x_pmic_attach(device_t dev) +{ + struct am335x_pmic_softc *sc; + + sc = device_get_softc(dev); + + sc->enum_hook.ich_func = am335x_pmic_start; + sc->enum_hook.ich_arg = dev; + + if (config_intrhook_establish(&sc->enum_hook) != 0) + return (ENOMEM); + + return (0); +} + +static device_method_t am335x_pmic_methods[] = { + DEVMETHOD(device_probe, am335x_pmic_probe), + DEVMETHOD(device_attach, am335x_pmic_attach), + {0, 0}, +}; + +static driver_t am335x_pmic_driver = { + "am335x_pmic", + am335x_pmic_methods, + sizeof(struct am335x_pmic_softc), +}; + +static devclass_t am335x_pmic_devclass; + +DRIVER_MODULE(am335x_pmic, iicbus, am335x_pmic_driver, am335x_pmic_devclass, 0, 0); +MODULE_VERSION(am335x_pmic, 1); +MODULE_DEPEND(am335x_pmic, iicbus, 1, 1, 1); Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Tue Jun 5 19:47:07 2012 (r237153) @@ -0,0 +1,534 @@ +/*- + * Copyright (c) 2012 Damjan Marion + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#define CM_PER 0 +#define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000) +#define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004) +#define CM_PER_L3_CLKSTCTRL (CM_PER + 0x00C) +#define CM_PER_CPGMAC0_CLKCTRL (CM_PER + 0x014) +#define CM_PER_USB0_CLKCTRL (CM_PER + 0x01C) +#define CM_PER_TPTC0_CLKCTRL (CM_PER + 0x024) +#define CM_PER_MMC0_CLKCTRL (CM_PER + 0x03C) +#define CM_PER_I2C2_CLKCTRL (CM_PER + 0x044) +#define CM_PER_I2C1_CLKCTRL (CM_PER + 0x048) +#define CM_PER_TIMER7_CLKCTRL (CM_PER + 0x07C) +#define CM_PER_TIMER2_CLKCTRL (CM_PER + 0x080) +#define CM_PER_TIMER3_CLKCTRL (CM_PER + 0x084) +#define CM_PER_TIMER4_CLKCTRL (CM_PER + 0x088) +#define CM_PER_GPIO1_CLKCTRL (CM_PER + 0x0AC) +#define CM_PER_GPIO2_CLKCTRL (CM_PER + 0x0B0) +#define CM_PER_GPIO3_CLKCTRL (CM_PER + 0x0B4) +#define CM_PER_TPCC_CLKCTRL (CM_PER + 0x0BC) +#define CM_PER_L3_INSTR_CLKCTRL (CM_PER + 0x0DC) +#define CM_PER_L3_CLKCTRL (CM_PER + 0x0E0) +#define CM_PER_TIMER5_CLKCTRL (CM_PER + 0x0EC) +#define CM_PER_TIMER6_CLKCTRL (CM_PER + 0x0F0) +#define CM_PER_MMC1_CLKCTRL (CM_PER + 0x0F4) +#define CM_PER_MMC2_CLKCTRL (CM_PER + 0x0F8) +#define CM_PER_TPTC1_CLKCTRL (CM_PER + 0x0FC) +#define CM_PER_TPTC2_CLKCTRL (CM_PER + 0x100) +#define CM_PER_OCPWP_L3_CLKSTCTRL (CM_PER + 0x12C) +#define CM_PER_OCPWP_CLKCTRL (CM_PER + 0x130) +#define CM_PER_CPSW_CLKSTCTRL (CM_PER + 0x144) + +#define CM_WKUP 0x400 +#define CM_WKUP_CLKSTCTRL (CM_WKUP + 0x000) +#define CM_WKUP_CONTROL_CLKCTRL (CM_WKUP + 0x004) +#define CM_WKUP_GPIO0_CLKCTRL (CM_WKUP + 0x008) +#define CM_WKUP_CM_L3_AON_CLKSTCTRL (CM_WKUP + 0x01C) +#define CM_WKUP_CM_CLKSEL_DPLL_MPU (CM_WKUP + 0x02C) +#define CM_WKUP_CM_CLKDCOLDO_DPLL_PER (CM_WKUP + 0x07C) +#define CM_WKUP_I2C0_CLKCTRL (CM_WKUP + 0x0B8) + +#define CM_DPLL 0x500 +#define CLKSEL_TIMER7_CLK (CM_DPLL + 0x004) +#define CLKSEL_TIMER2_CLK (CM_DPLL + 0x008) +#define CLKSEL_TIMER3_CLK (CM_DPLL + 0x00C) +#define CLKSEL_TIMER4_CLK (CM_DPLL + 0x010) +#define CLKSEL_TIMER5_CLK (CM_DPLL + 0x018) +#define CLKSEL_TIMER6_CLK (CM_DPLL + 0x01C) + +#define PRM_DEVICE_OFFSET 0xF00 +#define PRM_RSTCTRL (PRM_DEVICE_OFFSET + 0x00) + +struct am335x_prcm_softc { + struct resource * res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; +}; + +static struct resource_spec am335x_prcm_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static struct am335x_prcm_softc *am335x_prcm_sc = NULL; + +static int am335x_clk_generic_activate(struct ti_clock_dev *clkdev); +static int am335x_clk_generic_deactivate(struct ti_clock_dev *clkdev); +static int am335x_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); +static int am335x_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static int am335x_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static int am335x_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static void am335x_prcm_reset(void); +static int am335x_clk_cpsw_activate(struct ti_clock_dev *clkdev); +static int am335x_clk_musb0_activate(struct ti_clock_dev *clkdev); + +#define AM335X_GENERIC_CLOCK_DEV(i) \ + { .id = (i), \ + .clk_activate = am335x_clk_generic_activate, \ + .clk_deactivate = am335x_clk_generic_deactivate, \ + .clk_set_source = am335x_clk_generic_set_source, \ + .clk_accessible = NULL, \ + .clk_get_source_freq = NULL \ + } + +#define AM335X_MMCHS_CLOCK_DEV(i) \ + { .id = (i), \ + .clk_activate = am335x_clk_generic_activate, \ + .clk_deactivate = am335x_clk_generic_deactivate, \ + .clk_set_source = am335x_clk_generic_set_source, \ + .clk_accessible = NULL, \ + .clk_get_source_freq = am335x_clk_hsmmc_get_source_freq \ + } + +struct ti_clock_dev ti_clk_devmap[] = { + /* System clocks */ + { .id = SYS_CLK, + .clk_activate = NULL, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = am335x_clk_get_sysclk_freq, + }, + /* MPU (ARM) core clocks */ + { .id = MPU_CLK, + .clk_activate = NULL, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = am335x_clk_get_arm_fclk_freq, + }, + /* CPSW Ethernet Switch core clocks */ + { .id = CPSW_CLK, + .clk_activate = am335x_clk_cpsw_activate, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = NULL, + }, + + /* Mentor USB HS controller core clocks */ + { .id = MUSB0_CLK, + .clk_activate = am335x_clk_musb0_activate, + .clk_deactivate = NULL, + .clk_set_source = NULL, + .clk_accessible = NULL, + .clk_get_source_freq = NULL, + }, + + /* DMTimer */ + AM335X_GENERIC_CLOCK_DEV(DMTIMER2_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER3_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER4_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER5_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER6_CLK), + AM335X_GENERIC_CLOCK_DEV(DMTIMER7_CLK), + + /* GPIO */ + AM335X_GENERIC_CLOCK_DEV(GPIO0_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO1_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO2_CLK), + AM335X_GENERIC_CLOCK_DEV(GPIO3_CLK), + + /* I2C */ + AM335X_GENERIC_CLOCK_DEV(I2C0_CLK), + AM335X_GENERIC_CLOCK_DEV(I2C1_CLK), + AM335X_GENERIC_CLOCK_DEV(I2C2_CLK), + + /* EDMA */ + AM335X_GENERIC_CLOCK_DEV(EDMA_TPCC_CLK), + AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC0_CLK), + AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC1_CLK), + AM335X_GENERIC_CLOCK_DEV(EDMA_TPTC2_CLK), + + /* MMCHS */ + AM335X_MMCHS_CLOCK_DEV(MMC0_CLK), + AM335X_MMCHS_CLOCK_DEV(MMC1_CLK), + AM335X_MMCHS_CLOCK_DEV(MMC2_CLK), + + { INVALID_CLK_IDENT, NULL, NULL, NULL, NULL } +}; + +struct am335x_clk_details { + clk_ident_t id; + uint32_t clkctrl_reg; + uint32_t clksel_reg; +}; + +#define _CLK_DETAIL(i, c, s) \ + { .id = (i), \ + .clkctrl_reg = (c), \ + .clksel_reg = (s), \ + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 20:13: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 35E65106577B for ; Tue, 5 Jun 2012 20:13:02 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 20:13:02 +0000 Date: Tue, 05 Jun 2012 20:13:02 +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: <20120605201303.35E65106577B@hub.freebsd.org> Cc: Subject: socsvn commit: r237159 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 20:13:04 -0000 Author: jhagewood Date: Tue Jun 5 20:13:02 2012 New Revision: 237159 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237159 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 19:59:09 2012 (r237158) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 20:13:02 2012 (r237159) @@ -625,23 +625,28 @@ (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } -/* Removes carriage return from open file. - * TODO: Remove trailing cr only. +/* If file has trailing carriage return, remove it. */ void remove_cr(FILE *f) { char ch; fpos_t position; + fpos_t tcr_pos; - while ( ch != EOF) { + while (ch != EOF) { fgetpos(f, &position); ch = fgetc(f); - if (ch == '\r') { - fsetpos(f, &position); - fputc((int)'\0', f); + if (ch == '\r' && fgetc(f) == EOF) { + tcr_pos = position; + break; } } + + if (tcr_pos != NULL) { + fsetpos(f, &tcr_pos); + fputc((int)'\0', f); + } rewind(f); } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 19:59:09 2012 (r237158) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 20:13:02 2012 (r237159) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 07:53:14.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 20:10:22.000000000 -0400 @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ @@ -110,34 +110,39 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -606,6 +625,26 @@ repos(int nchar) +@@ -606,6 +625,31 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } -+/* Removes carriage return from open file. -+ * TODO: Remove trailing cr only. ++/* If file has trailing carriage return, remove it. + */ +void +remove_cr(FILE *f) { + + char ch; + fpos_t position; ++ fpos_t tcr_pos; + -+ while ( ch != EOF) { ++ while (ch != EOF) { + fgetpos(f, &position); + ch = fgetc(f); -+ if (ch == '\r') { -+ fsetpos(f, &position); -+ fputc((int)'\0', f); ++ if (ch == '\r' && fgetc(f) == EOF) { ++ tcr_pos = position; ++ break; + } + } ++ ++ if (tcr_pos != NULL) { ++ fsetpos(f, &tcr_pos); ++ fputc((int)'\0', f); ++ } + rewind(f); +} + __dead void trouble(void) { -@@ -699,12 +738,38 @@ increase(void) +@@ -699,12 +743,38 @@ increase(void) } From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 20:14: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 6BF65106566B for ; Tue, 5 Jun 2012 20:14:03 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 20:14:03 +0000 Date: Tue, 05 Jun 2012 20:14:03 +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: <20120605201403.6BF65106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237160 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 20:14:05 -0000 Author: jhagewood Date: Tue Jun 5 20:14:03 2012 New Revision: 237160 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237160 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 20:13:02 2012 (r237159) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 20:14:03 2012 (r237160) @@ -625,7 +625,8 @@ (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } -/* If file has trailing carriage return, remove it. +/* + * If file has trailing carriage return, remove it. */ void remove_cr(FILE *f) { Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 20:13:02 2012 (r237159) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 20:14:03 2012 (r237160) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 20:10:22.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 20:13:52.000000000 -0400 @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ @@ -110,11 +110,12 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -606,6 +625,31 @@ repos(int nchar) +@@ -606,6 +625,32 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } -+/* If file has trailing carriage return, remove it. ++/* ++ * If file has trailing carriage return, remove it. + */ +void +remove_cr(FILE *f) { @@ -142,7 +143,7 @@ __dead void trouble(void) { -@@ -699,12 +743,38 @@ increase(void) +@@ -699,12 +744,38 @@ increase(void) } From owner-svn-soc-all@FreeBSD.ORG Tue Jun 5 20:49:17 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 CD223106566C for ; Tue, 5 Jun 2012 20:49:15 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 05 Jun 2012 20:49:15 +0000 Date: Tue, 05 Jun 2012 20:49:15 +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: <20120605204915.CD223106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237161 - in soc2012/jhagewood/diff3: . diff3 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: Tue, 05 Jun 2012 20:49:17 -0000 Author: jhagewood Date: Tue Jun 5 20:49:15 2012 New Revision: 237161 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237161 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 20:14:03 2012 (r237160) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Tue Jun 5 20:49:15 2012 (r237161) @@ -767,7 +767,6 @@ printf ("%s", "\ -v --version Output version info.\n\ --help Output this help.\n\n"); - printf ("If a FILE is `-', read standard input.\n"); } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 20:14:03 2012 (r237160) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Tue Jun 5 20:49:15 2012 (r237161) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 20:13:52.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 20:49:10.000000000 -0400 @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ @@ -143,7 +143,7 @@ __dead void trouble(void) { -@@ -699,12 +744,38 @@ increase(void) +@@ -699,12 +744,37 @@ increase(void) } @@ -171,7 +171,6 @@ + printf ("%s", "\ + -v --version Output version info.\n\ + --help Output this help.\n\n"); -+ printf ("If a FILE is `-', read standard input.\n"); + +} + From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 11:03: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 B98AB106564A for ; Wed, 6 Jun 2012 11:03:05 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 11:03:05 +0000 Date: Wed, 06 Jun 2012 11:03:05 +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: <20120606110305.B98AB106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237202 - 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: Wed, 06 Jun 2012 11:03:08 -0000 Author: gpf Date: Wed Jun 6 11:03:05 2012 New Revision: 237202 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237202 Log: -hardlinks: A rb tree of 'hardlink_counter' structs is used with inodes as keys. This tree is used to print warnings to the user when the number of links found for a specific inode is less than the total number of links. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 10:56:59 2012 (r237201) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 11:03:05 2012 (r237202) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -67,20 +68,32 @@ TAILQ_HEAD(checksum_head, checksum); TAILQ_HEAD(file_header_head, file_header); +TAILQ_HEAD(hardlink_fh_head, file_header); + +RB_HEAD(hardlink_head, hardlink_counter); +RB_PROTOTYPE(hardlink_head, hardlink_counter, hardlink_entries, pefs_rb_cmp); #define PEFS_CFH_SIZE 16 #define PEFS_FH_SIZE 16 +struct hardlink_counter { + ino_t inode; + uint32_t total_links; + uint32_t links_found; + struct hardlink_fh_head file_headers; + RB_ENTRY(hardlink_counter) hardlink_entries; +}; + /* XXXgpf: [TODO] check pathname string lengths. Some are MAXPATHLEN + 1, some MAXPATHLEN */ /* XXXgpf: unions for on disk structs and move to a different header? */ struct checksum_file_header { - uint8_t version; - uint8_t reserved; - uint8_t hash_len; - uint8_t hash_algo[8]; - uint8_t offset_to_hash_table; - uint32_t hash_table_size; + uint8_t version; + uint8_t reserved; + uint8_t hash_len; + uint8_t hash_algo[8]; + uint8_t offset_to_hash_table; + uint32_t hash_table_size; }; struct checksum { @@ -97,6 +110,7 @@ uint32_t offset_to_checksums; struct checksum_head checksums; TAILQ_ENTRY(file_header) file_header_entries; + TAILQ_ENTRY(file_header) fh_hardlink_entries; }; struct bucket { @@ -471,6 +485,7 @@ if (fhp != NULL) { //dprintf(("\tpath=%s\tid = %llu\tnhashes = %d\n", fhp->path, fhp->file_id, fhp->nhashes)); dprintf(("\tid = %llu\tnhashes = %d\n", fhp->file_id, fhp->nhashes)); + dprintf(("\tpath = %s\n", fhp->path)); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { dprintf(("\t\tdigest=")); for (j = 0; j < hash_len; j++) @@ -548,8 +563,87 @@ return (error); } +/* XXXgpf: for debugging purposes */ +static void +pefs_rb_print(struct hardlink_head *hlc_headp) +{ + struct hardlink_counter *hlcp; + struct file_header *fhp; + + dprintf(("\n+++Printing RB tree+++\n\n")); + RB_FOREACH(hlcp, hardlink_head, hlc_headp) { + dprintf(("inode %d\ttotal links %d\tlinks found %d\n", + hlcp->inode, hlcp->total_links, hlcp->links_found)); + TAILQ_FOREACH(fhp, &(hlcp->file_headers), fh_hardlink_entries) { + dprintf(("\tpath: %s\n", fhp->path)); + } + } +} + +static void +pefs_rb_warn(struct hardlink_head *hlc_headp) +{ + struct hardlink_counter *hlcp; + struct file_header *fhp; + int i; + + RB_FOREACH(hlcp, hardlink_head, hlc_headp) { + if (hlcp->total_links > hlcp->links_found) { + pefs_warn("%d hard links of total %d were found in input list for file with inode: %d", + hlcp->links_found, hlcp->total_links, hlcp->inode); + i = 1; + TAILQ_FOREACH(fhp, &(hlcp->file_headers), fh_hardlink_entries) { + pefs_warn("link %d: %s", i++, fhp->path); + } + } + } +} + +/* XXXgpf: [TODO] comments */ +static int +pefs_rb_insert(struct hardlink_head *hlc_headp, struct file_header *fhp, struct stat *sbp) +{ + struct hardlink_counter find, *res, *new_hlcp; + + find.inode = sbp->st_ino; + res = RB_FIND(hardlink_head, hlc_headp, &find); + + if (res != NULL) { + res->links_found++; + TAILQ_INSERT_TAIL(&(res->file_headers), fhp, fh_hardlink_entries); + } + else { + new_hlcp = malloc(sizeof(struct hardlink_counter)); + if (new_hlcp == NULL) { + warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + + new_hlcp->inode = sbp->st_ino; + new_hlcp->total_links = sbp->st_nlink; + new_hlcp->links_found = 1; + TAILQ_INIT(&(new_hlcp->file_headers)); + TAILQ_INSERT_TAIL(&(new_hlcp->file_headers), fhp, fh_hardlink_entries); + + RB_INSERT(hardlink_head, hlc_headp, new_hlcp); + } + + return (0); +} + static int -pefs_file_semantic_checks(struct file_header *fhp, struct statfs *fsp) +pefs_rb_cmp(struct hardlink_counter *hlcp1, struct hardlink_counter *hlcp2) +{ + if (hlcp1->inode < hlcp2->inode) + return -1; + else if (hlcp1->inode > hlcp2->inode) + return 1; + else + return 0; +} + +static int +pefs_file_semantic_checks(struct file_header *fhp, struct statfs *fsp, struct hardlink_head *hlc_headp) { char parent_dir[MAXPATHLEN]; char sbuf[MAXPATHLEN]; @@ -647,6 +741,11 @@ fhp->path, fsp->f_mntonname); return (PEFS_ERR_INVALID); } + + /* Keep all hardlink file headers in a rb tree */ + if (sb.st_nlink > 1) + return (pefs_rb_insert(hlc_headp, fhp, &sb)); + return (0); } @@ -687,16 +786,24 @@ * the checksum file. * A) The total sum of entries is gathered so that the hash tables are allocated. * B) For each file entry: - * B1) semantic checks: file should reside in pefs filesystem & - * file should be regular file + * B1) semantic checks: + * B1a) file should reside in pefs filesystem & file should be regular file. + * B1b) if symlink, acquire and save the absolute path of the symlink's + * target. Try to stat() the target but don't do anything else. + * B1c) If hardlink, save a reference to this file entry in our rb tree. + * rb-tree uses inodes as keys and is used in part C to print warnings. * B2) the file_id is retrieved. * B3) list of checksums is computed for the file's 4k blocks. - * B4) file entry is added to fh_head - * C) Cuckoo insertion: + * B4) file entry is added to universal fh_head. + * C) Print warnings for hardlinks if the number of links found in inputlist isn't + * equal to the number of total inode links. + * D) Cuckoo insertion: * We try to populate our hash tables using the cuckoo algorithm. Should we fall * into an infinite loop during insertion, we re-allocate larger hash tables * and try again until we succeed. The possibility to fail twice in a row is * 1.5% * 1.5% = 0.0225% + * + * XXXgpf: [TODO] more comments */ static int pefs_create_in_memory_db(FILE *fpin, const EVP_MD *md, uint8_t hash_len, @@ -704,6 +811,7 @@ { struct statfs fs; struct file_header_head fh_head; + struct hardlink_head hlc_head; struct file_header *fhp; int error; uint32_t nfiles; @@ -722,8 +830,9 @@ return (error); TAILQ_INIT(&fh_head); + RB_INIT(&hlc_head); while((fhp = pefs_next_file(fpin, &error)) != NULL) { - error = pefs_file_semantic_checks(fhp, &fs); + error = pefs_file_semantic_checks(fhp, &fs, &hlc_head); if (error != 0) return (error); @@ -742,6 +851,12 @@ if (error != 0) return (error); + pefs_rb_print(&hlc_head); + pefs_rb_warn(&hlc_head); + /* + * XXXgpf: [TODO] print warnings for dem hardlinks + */ + cuckoo_insert: TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { error = pefs_add_to_hash_table(chtp, fhp); @@ -1067,3 +1182,5 @@ return (error); } + +RB_GENERATE(hardlink_head, hardlink_counter, hardlink_entries, pefs_rb_cmp); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed Jun 6 10:56:59 2012 (r237201) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed Jun 6 11:03:05 2012 (r237202) @@ -1032,6 +1032,12 @@ int error, i, j; const char *algo; + /* + * XXXgpf: [TODO] Now, all input file entries are kept in a 'global' tail structure + * and insertion into hash table occurs after all of them are read/parsed. Therefore, + * it is possible to have fpin = stdin by default and not require an input file, since + * we will not have to go through the input list twice, thus requiring a rewind(). + */ fpin = NULL; /* by default use sha256 */ algo = supported_digests[0]; From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 12:08: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 F2EF01065670 for ; Wed, 6 Jun 2012 12:08:03 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 12:08:03 +0000 Date: Wed, 06 Jun 2012 12:08:03 +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: <20120606120803.F2EF01065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237205 - 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: Wed, 06 Jun 2012 12:08:05 -0000 Author: gmiller Date: Wed Jun 6 12:08:03 2012 New Revision: 237205 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237205 Log: Add a WIP version of mutex_lookup(), which returns a lock_acquisition object to store profiling stats for the given acquisition point. Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Wed Jun 6 11:46:37 2012 (r237204) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Wed Jun 6 12:08:03 2012 (r237205) @@ -27,12 +27,50 @@ #ifdef LOCK_PROFILING +#include + #include "thr_private.h" +#define LOCK_PROF_HASH_SIZE (4096) + +struct lock_acquisition { + const char *file; + int line; + SLIST_ENTRY(lock_acquisition) acq_next; +}; + +SLIST_HEAD(acq_head, lock_acquisition); + +struct acq_head mutex_hash[LOCK_PROF_HASH_SIZE]; + +static struct lock_acquisition * +mutex_lookup(struct pthread_mutex *m, const char *file, int line) +{ + u_int hash; + struct lock_acquisition *acq; + + hash = ((uintptr_t)file * 31 + line) & (LOCK_PROF_HASH_SIZE - 1); + + SLIST_FOREACH(acq, &mutex_hash[hash], acq_next) { + if (acq->file == file && acq->line == line) { + return acq; + } + } + + acq = malloc(sizeof(struct lock_acquisition)); + acq->file = file; + acq->line = line; + + SLIST_INSERT_HEAD(&mutex_hash[hash], acq, acq_next); + + return acq; +} + void _mutex_obtain_success(struct pthread_mutex *m, struct timespec *waittime, const char *file, int line) { + mutex_lookup(m, file, line); } void From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 12:38:36 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 91C63106564A for ; Wed, 6 Jun 2012 12:38:34 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 12:38:34 +0000 Date: Wed, 06 Jun 2012 12:38:34 +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: <20120606123834.91C63106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237206 - 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: Wed, 06 Jun 2012 12:38:36 -0000 Author: gpf Date: Wed Jun 6 12:38:33 2012 New Revision: 237206 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237206 Log: -change symlink semantic checks once again: We do not require that target file resides in pefs filesystem or that it's a regular file. Also, I don't see a way to check that symlink file itself resides in pefs filesystem, although if it does not, ioctl() calls will fail. - If however target file resides in pefs filesystem AND target file is a regular file or symlink AND target file is not given in user supplied inputlist, then print warning that it wasn't found. User will have to supply 2 entries if he wishes integrity checking for both target file and symlink file. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 12:08:03 2012 (r237205) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 12:38:33 2012 (r237206) @@ -55,7 +55,7 @@ #include "pefs_ctl.h" -//#define PEFS_INTEGRITY_DEBUG +#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -180,6 +180,10 @@ TAILQ_INIT(&(fhp->checksums)); + /* + * XXXgpf: [TODO] deal with symlinks + */ + /* XXXgpf: what happens if file size > 2^64? */ if (stat(fhp->path, &sb) != 0) { warn("cannot stat file %s", fhp->path); @@ -365,6 +369,8 @@ free(csp->hash); free(csp); } + if (fhp->target_path != NULL) + free(fhp->target_path); free(fhp); } } @@ -382,6 +388,8 @@ free(csp->hash); free(csp); } + if (fhp->target_path != NULL) + free(fhp->target_path); free(fhp); } } @@ -410,6 +418,32 @@ return (nbucket); } +static struct file_header * +pefs_cuckoo_lookup(struct cuckoo_hash_table *chtp, struct file_header *fhp) +{ + struct file_header *elem, *elem1, *elem2; + int pos1, pos2; + + elem = fhp; + pos1 = pefs_hash1(chtp, elem); + elem1 = chtp->buckets1[pos1].fhp; + if (elem1 != NULL) { + if (elem1->file_id == elem->file_id) { + return (elem1); + } + } + + pos2 = pefs_hash2(chtp, elem); + elem2 = chtp->buckets2[pos2].fhp; + if (elem2 != NULL) { + if (elem2->file_id == elem->file_id) { + return (elem2); + } + } + + return (NULL); +} + static int pefs_cuckoo_insert(struct cuckoo_hash_table *chtp, struct file_header *fhp) @@ -502,6 +536,7 @@ if (fhp != NULL) { //dprintf(("\tpath=%s\tid = %llu\tnhashes = %d\n", fhp->path, fhp->file_id, fhp->nhashes)); dprintf(("\tid = %llu\tnhashes = %d\n", fhp->file_id, fhp->nhashes)); + dprintf(("\tpath = %s\n", fhp->path)); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { dprintf(("\t\tdigest=")); for (j = 0; j < hash_len; j++) @@ -563,6 +598,53 @@ return (error); } +// XXXgpf: void? +static void +pefs_symlink_warn(struct cuckoo_hash_table *chtp, struct file_header_head *fhhp, + struct statfs *fsp) +{ + struct statfs this_fs; + struct stat sb; + struct file_header targetfh; + struct file_header *fhp, *res; + int error; + + TAILQ_FOREACH(fhp, fhhp, file_header_entries) { + /* + * If fhp == symlink and target file resides in pefs filesystem and + * target file == regular file || symlink, then grab target's filename MAC and + * look it up in our hash table. Print a warning message if it is not found. + */ + if (fhp->target_path != NULL) { + if (statfs(fhp->target_path, &this_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fhp->target_path, strerror(errno)); + continue; + } + + if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || + (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) + continue; + + if (lstat(fhp->target_path, &sb) != 0) { + warn("cannot stat file %s", fhp->target_path); + continue; + } + + if (S_ISLNK(sb.st_mode) == 0 && S_ISREG(sb.st_mode) == 0) + continue; + + strlcpy(targetfh.path, fhp->target_path, sizeof(targetfh.path)); + error = pefs_get_file_id(&targetfh); + if (error == 0) { + res = pefs_cuckoo_lookup(chtp, &targetfh); + if (res == NULL) + pefs_warn("target file %s of symlink %s was not found in inputlist", + targetfh.path, fhp->path); + } + } + } +} + /* XXXgpf: for debugging purposes */ static void pefs_rb_print(struct hardlink_head *hlc_headp) @@ -599,7 +681,6 @@ } } -/* XXXgpf: [TODO] comments */ static int pefs_rb_insert(struct hardlink_head *hlc_headp, struct file_header *fhp, struct stat *sbp) { @@ -650,6 +731,7 @@ struct stat sb; struct statfs this_fs; char *pch; + size_t target_path_size; int nchars; if (lstat(fhp->path, &sb) != 0) { @@ -657,10 +739,9 @@ return (PEFS_ERR_SYS); } - /* - * XXXgpf: [TODO] deal with other types of files - */ if (S_ISLNK(sb.st_mode) != 0) { + fhp->target_path = NULL; + nchars = readlink(fhp->path, sbuf, sizeof(sbuf)); if (nchars == -1) { warn("readlink failed: %s", fhp->path); @@ -668,21 +749,22 @@ } /* - * XXXgpf: target_path can be used to tell if user has supplied target_file + * Target_path can be used to tell if user has supplied target_file * in input file-list, since symlinks are not traversed. User will have to * provide fullpaths for both symlink & target file if he wants integrity - * checking for both. - * [TODO] make sure they are properly free()d and print warning errors - * in case user does not supply separate entry for target_file. + * checking for both. However, we will print warning messages in case + * target file does reside in pefs filesystem but is not provided in + * user supplied input list. */ - fhp->target_path = malloc(MAXPATHLEN); + target_path_size = MAXPATHLEN; + fhp->target_path = malloc(target_path_size); if (fhp->target_path == NULL) { warn("memory allocation error"); return (PEFS_ERR_SYS); } sbuf[nchars] = '\0'; - /* turn relative paths to absolute paths */ + /* turn relative paths to absolute paths which are needed for ioctl() */ if (sbuf[0] != '/') { strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); pch = strrchr(parent_dir, '/'); @@ -691,39 +773,36 @@ return (PEFS_ERR_NOENT); } *pch = '\0'; - snprintf(fhp->target_path, MAXPATHLEN, "%s/%s", parent_dir, sbuf); + snprintf(fhp->target_path, target_path_size, "%s/%s", parent_dir, sbuf); } else - strlcpy(fhp->target_path, sbuf, sizeof(fhp->target_path)); + strlcpy(fhp->target_path, sbuf, target_path_size); - /* target file should be in pefs filesystem */ - if (statfs(fhp->target_path, &this_fs) == -1) { - pefs_warn("statfs failed: %s: %s", fhp->target_path, strerror(errno)); - return (PEFS_ERR_SYS); - } - - if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || - (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { - pefs_warn("symlink target filename: %s does not reside in filesystem %s", - fhp->target_path, fsp->f_mntonname); - return (PEFS_ERR_INVALID); - } - - /* symlink file should be in pefs filesystem */ - if (statfs(fhp->path, &this_fs) == -1) { - pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); + /* + * The only semantic check that is performed on target file is an attempt + * to stat() the file, in order to make sure the file exists. This is + * intentional since target file is allowed to reside on a different + * filesystem or in the same filesystem, but not be a regular file or a + * symlink. + * e.g. a directory + */ + if (lstat(fhp->target_path, &sb) != 0) { + warn("cannot stat symlink's target file %s", fhp->target_path); return (PEFS_ERR_SYS); } - if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || - (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { - pefs_warn("filename: %s does not reside in filesystem %s", - fhp->path, fsp->f_mntonname); - return (PEFS_ERR_INVALID); - } - + /* + * XXXgpf: + * Is there a way to check that symlink file itself exists in pefs filesystem? + * fstatfs() for example requires a fd and we can't open() the symlink without + * either failing, or having to traverse it. + * On the other hand, if the symlink does not reside in pefs fs, then the calls to + * ioctl() later on will fail. + */ return (0); } + else + fhp->target_path = NULL; if (S_ISREG(sb.st_mode) == 0) { pefs_warn("filename: %s is not a regular file", fhp->path); @@ -786,9 +865,9 @@ * the checksum file. * A) The total sum of entries is gathered so that the hash tables are allocated. * B) For each file entry: - * B1) semantic checks: - * B1a) file should reside in pefs filesystem & file should be regular file. - * B1b) if symlink, acquire and save the absolute path of the symlink's + * B1) semantic checks: + * B1a) file should reside in pefs filesystem & file should be regular file. + * B1b) if symlink, acquire and save the absolute path of the symlink's * target. Try to stat() the target but don't do anything else. * B1c) If hardlink, save a reference to this file entry in our rb tree. * rb-tree uses inodes as keys and is used in part C to print warnings. @@ -802,8 +881,8 @@ * into an infinite loop during insertion, we re-allocate larger hash tables * and try again until we succeed. The possibility to fail twice in a row is * 1.5% * 1.5% = 0.0225% - * - * XXXgpf: [TODO] more comments + * E) For each symlink found in input list, print warnings if its target file + * was not found in input list as well since symlinks are not traversed. */ static int pefs_create_in_memory_db(FILE *fpin, const EVP_MD *md, uint8_t hash_len, @@ -853,9 +932,6 @@ pefs_rb_print(&hlc_head); pefs_rb_warn(&hlc_head); - /* - * XXXgpf: [TODO] print warnings for dem hardlinks - */ cuckoo_insert: TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { @@ -874,6 +950,7 @@ } } pefs_print_hash_table(chtp, hash_len); + pefs_symlink_warn(chtp, &fh_head, &fs); return (error); } From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 13:17:57 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 034C0106566B for ; Wed, 6 Jun 2012 13:17:54 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 13:17:54 +0000 Date: Wed, 06 Jun 2012 13:17:54 +0000 From: scher@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: <20120606131754.034C0106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237211 - soc2012/scher/par_ports/head/Mk 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, 06 Jun 2012 13:17:57 -0000 Author: scher Date: Wed Jun 6 13:17:53 2012 New Revision: 237211 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237211 Log: [new_feature] bsd.port.mk - parallel non-blocking build of port's dependecies as background jobs in XXX-depends targets. ${_PROCESS_ACTIVE_BUILDS}: new script that covers most of non-blocking parallel dependency build magic. Controls all spawned background jobs by PIDs which are stored in $${active_builds} array Controls jobs exit codes. Acts accordingly on various jobs exit codes (0, 1, ${_parv_MAKE_LOCK_EXIT_STATUS}). Recheck correct install of lib dependency. Considers parallel dep builds limit as set by ${_parv_PARALLEL_BUILDS_NUMBER}. Waits for a while if it is impossible to spawn new dependency build. Makes attempts to spawn another dependency build, if it is possible. ------------------------------------- Changes in old targets (XXX-depends): Reimplementation of loops in XXX-depends targets for non-blocking purpose: Outer "while" loop replaced "for" loop. Some kind of "round-robin" implementation is used to process port's deps. If some dependency (dep) is locked then it is moved to the end of the deps queue. If some dep is already installed then it is deleted from the deps queue. If some dependency is not found - it's build starts as background process and it's PID is added to $${active_builds} array to control it's evaluation. -------------------------------------- All the above mentioned is actual for non-parallel builds, with the following exception: ${_parv_PARALLEL_BUILDS_NUMBER} is set to 1 in non-parallel case. This perevents from spawning more than one background job. Thus processing of port's deps will be blocked until this job will be ready. Hence we have one background job per time for non-parallel build. Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 6 12:45:48 2012 (r237210) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 6 13:17:53 2012 (r237211) @@ -5028,8 +5028,13 @@ .endif ############### PAR_PORTS SPECIFIC COMMENT LINE ############### -# _INSTALL_DEPENDS script is surrounded by while loop. -# When the port is installed it is necessary to break most inner while loop. +# $${active_builds} - a list of "pid:path:dir[:target]" or "pid:lib:dir[:target]" +# tuples of all currently processed ports, spawned by this make process +# $${notfound} codes : 0 - dep found +# 1 - dep not found +# ${_parv_ON_LOCK_EXIT_STATUS} - dep is locked +# $${spawned} - sets to background process PID if any process was ran +# in background. ############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### _INSTALL_DEPENDS= \ @@ -5048,32 +5053,83 @@ ${PKG_ADD} $${subpkgfile}; \ fi; \ else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) && status=$$? || status=$$?; \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) & spawned=$$!; \ fi; \ else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) && status=$$? || status=$$?; \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) & spawned=$$!; \ fi; \ - if [ ! ${_parv_WANT_PARALLEL_BUILD} ] && [ $${status} != 0 ]; then \ - exit $${status}; \ + +_PROCESS_ACTIVE_BUILDS= \ + echo "debugging_out_here: --- ENTER _PROCESS_ACTIVE_BUILDS SECTION " > ${PORTSDIR}/tmp/log; \ + while true; do \ + builds_num=$$( ${ECHO_CMD} $${active_builds} | wc -w ); \ + if [ $${builds_num} -lt ${_parv_PARALLEL_BUILDS_NUMBER} ] && [ $${\#depends} -ne 0 ]; then \ + echo "debugging_out_here: WE CAN START ANOTHER PAR BUILD " > ${PORTSDIR}/tmp/log; \ + break; \ fi; \ - if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ - if [ $${status} -eq 0 ]; then \ - _parv_next_dep=1; \ - elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - ${ECHO_CMD} $${prog} may be installing now.; \ - sleep 2; \ - continue; \ - else \ - exit $${status}; \ - fi; \ + if [ $${builds_num} -eq 0 ] && [ $${\#depends} -eq 0 ]; then \ + ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ + break; \ fi; \ - ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; + for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ + pid=$${build%%:*}; \ + dep=$${build\#*:}; \ + ps -p $${pid} > /dev/null || { \ + wait $${pid} && status=$$? || status=$$?; \ + if [ $${status} -eq 0 ]; then \ + echo "debugging_out_here: SOME DEP IS INSTALLED ($${dep}) " > ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here: WAS _$${active_builds}_ " > ${PORTSDIR}/tmp/log; \ + active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ + active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + builds_num=$$(( $${builds_num} - 1 )); \ + echo "debugging_out_here: NOW _$${active_builds}_ " > ${PORTSDIR}/tmp/log; \ + if [ ${.TARGET} = "lib-depends" ]; then \ + lib=$${dep%%:*}; \ + pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"; \ + if ! ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ + ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ + ${FALSE}; \ + fi; \ + fi; \ + elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ + echo "debugging_out_here: SOME DEP IS LOCKED ($${dep}) " > ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here: WAS _$${active_builds}_ " > ${PORTSDIR}/tmp/log; \ + active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ + active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + builds_num=$$(( $${builds_num} - 1 )); \ + echo "debugging_out_here: NOW _$${active_builds}_ " > ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here: ADD IT BACK DO DEPENDS LIST " > ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here: WAS _$${depends}_ " > ${PORTSDIR}/tmp/log; \ + depends="$${depends} $${dep}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + echo "debugging_out_here: NOW _$${depends}_ " > ${PORTSDIR}/tmp/log; \ + else \ + ${ECHO_CMD} "Errors occured while building a dependency."; \ + ${ECHO_CMD} "Terminating..."; \ + exit 1; \ + fi; \ + }; \ + done; \ + if { [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ] || \ + ( [ $${builds_num} -gt 0 ] && [ $${\#depends} -eq 0 ] ); }; then \ + echo "debugging_out_here: CAN'T SPAWN MORE DEPS! SLEEP... " > ${PORTSDIR}/tmp/log; \ + sleep 2; \ + fi; \ + done; \ + echo "debugging_out_here: --- LEAVE _PROCESS_ACTIVE_BUILDS SECTION " > ${PORTSDIR}/tmp/log .for deptype in PKG EXTRACT PATCH FETCH BUILD RUN ${deptype:L}-depends: .if defined(${deptype}_DEPENDS) .if !defined(NO_DEPENDS) - @for i in `${ECHO_CMD} "${${deptype}_DEPENDS}"`; do \ + @depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ + active_builds=""; \ + echo "debugging_out_here: ------------------------- " > ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here: ALL DEPS - $${depends}" > ${PORTSDIR}/tmp/log; \ + while [ $${#depends} -ne 0 ]; do \ + i=$${depends%% *}; \ + echo "debugging_out_here: ----- NEW STEP -----" >> ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here CURRENT DEP $${i}" >> ${PORTSDIR}/tmp/log; \ prog=$${i%%:*}; \ if [ -z "$$prog" ]; then \ ${ECHO_MSG} "Error: there is an empty port dependency in ${deptype}_DEPENDS."; \ @@ -5095,8 +5151,6 @@ target="${DEPENDS_TARGET}"; \ depends_args="${DEPENDS_ARGS}"; \ fi; \ - _parv_next_dep=0; \ - while [ $${_parv_next_dep} -eq 0 ]; do \ if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ ( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ); \ fi; \ @@ -5163,10 +5217,9 @@ ( cd $${dir}; ${MAKE} check-lock ) || { \ status=$$?; \ if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ + echo "debugging_out_here: LOCKED $${i}" >> ${PORTSDIR}/tmp/log; \ ${ECHO_CMD} $${prog} may be installing now.; \ - sleep 2; \ - continue; \ + notfound=${_parv_ON_LOCK_EXIT_STATUS}; \ else \ exit $${status}; \ fi; \ @@ -5175,17 +5228,33 @@ if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ fi; \ - if [ $$notfound != 0 ]; then \ + if [ $$notfound -eq 1 ]; then \ ${ECHO_MSG} "===> Verifying $$target for $$prog in $$dir"; \ if [ ! -d "$$dir" ]; then \ ${ECHO_MSG} " => No directory for $$prog. Skipping.."; \ else \ ${_INSTALL_DEPENDS} \ + if [ $${spawned} ]; then \ + echo "debugging_out_here: SPAWNED PID $${spawned}" > ${PORTSDIR}/tmp/log; \ + active_builds="$${active_builds} $${spawned}:$${i}"; \ + depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + spawned=""; \ + echo "debugging_out_here: AFTER TRANSFER TO ACTIVE BUILDS _$${depends}_" >> ${PORTSDIR}/tmp/log; \ + fi; \ + fi; \ + elif [ $${notfound} -eq 0 ]; then \ + depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + echo "debugging_out_here: AFTER DELETE _$${depends}_" >> ${PORTSDIR}/tmp/log; \ + elif [ $${notfound} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + if [ $$( ${ECHO_CMD} $${depends} | wc -w ) -gt 1 ]; then \ + depends="$${depends#* } $${depends%% *}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + echo "debugging_out_here: AFTER CHANGE $${depends}" >> ${PORTSDIR}/tmp/log; \ fi; \ fi; \ - if [ $${notfound} -eq 0 ]; then _parv_next_dep=1; fi; \ - if [ ! ${_parv_WANT_PARALLEL_BUILD} ]; then _parv_next_dep=1; fi; \ - done; \ + ${_PROCESS_ACTIVE_BUILDS}; \ done .endif .else @@ -5195,7 +5264,14 @@ lib-depends: .if defined(LIB_DEPENDS) && !defined(NO_DEPENDS) - @for i in ${LIB_DEPENDS}; do \ + @depends=`${ECHO_CMD} "${LIB_DEPENDS}"`; \ + active_builds=""; \ + echo "debugging_out_here: ------------------------- " > ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here: ALL DEPS - $${depends}" > ${PORTSDIR}/tmp/log; \ + while [ $${#depends} -ne 0 ]; do \ + i=$${depends%% *}; \ + echo "debugging_out_here: ----- NEW STEP -----" >> ${PORTSDIR}/tmp/log; \ + echo "debugging_out_here CURRENT DEP $${i}" >> ${PORTSDIR}/tmp/log; \ lib=$${i%%:*}; \ pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"\ dir=$${i#*:}; \ @@ -5206,12 +5282,10 @@ else \ dir=$${dir%%:*}; \ fi; \ - ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $$lib"; \ - _parv_next_dep=0; \ - while [ $${_parv_next_dep} -eq 0 ]; do \ if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ ( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ); \ fi; \ + ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $$lib"; \ if ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ ${ECHO_MSG} " - found"; \ if [ ${_DEPEND_ALWAYS} = 1 ]; then \ @@ -5228,10 +5302,9 @@ ( cd $${dir}; ${MAKE} check-lock ) || { \ status=$$?; \ if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ - ${ECHO_CMD} $${prog} may be installing now.; \ - sleep 2; \ - continue; \ + echo "debugging_out_here: LOCKED $${i}" >> ${PORTSDIR}/tmp/log; \ + ${ECHO_CMD} $${lib} may be installing now.; \ + notfound=${_parv_ON_LOCK_EXIT_STATUS}; \ else \ exit $${status}; \ fi; \ @@ -5240,21 +5313,33 @@ if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ fi; \ - if [ $$notfound != 0 ]; then \ + if [ $$notfound -eq 1 ]; then \ ${ECHO_MSG} "===> Verifying $$target for $$lib in $$dir"; \ if [ ! -d "$$dir" ]; then \ ${ECHO_MSG} " => No directory for $$lib. Skipping.."; \ else \ ${_INSTALL_DEPENDS} \ - if ! ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ - ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ - ${FALSE}; \ + if [ $${spawned} ]; then \ + echo "debugging_out_here: SPAWNED PID $${spawned}" > ${PORTSDIR}/tmp/log; \ + active_builds="$${active_builds} $${spawned}:$${i}"; \ + depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + spawned=""; \ + echo "debugging_out_here: AFTER TRANSFER TO ACTIVE BUILDS _$${depends}_" >> ${PORTSDIR}/tmp/log; \ fi; \ fi; \ - fi; \ - if [ $${notfound} -eq 0 ]; then _parv_next_dep=1; fi; \ - if [ ! ${_parv_WANT_PARALLEL_BUILD} ]; then _parv_next_dep=1; fi; \ - done; \ + elif [ $${notfound} -eq 0 ]; then \ + depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + echo "debugging_out_here: AFTER DELETE _$${depends}_" >> ${PORTSDIR}/tmp/log; \ + elif [ $${notfound} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + if [ $$( ${ECHO_CMD} $${depends} | wc -w ) -gt 1 ]; then \ + depends="$${depends#* } $${depends%% *}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + echo "debugging_out_here: AFTER CHANGE $${depends}" >> ${PORTSDIR}/tmp/log; \ + fi; \ + fi; \ + ${_PROCESS_ACTIVE_BUILDS}; \ done .endif From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 13:28:44 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 786E2106564A for ; Wed, 6 Jun 2012 13:28:42 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 13:28:42 +0000 Date: Wed, 06 Jun 2012 13:28:42 +0000 From: scher@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: <20120606132842.786E2106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237212 - in soc2012/scher/par_ports/head/fake_ports/with_deps: fake1 fake1a fake2 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, 06 Jun 2012 13:28:44 -0000 Author: scher Date: Wed Jun 6 13:28:41 2012 New Revision: 237212 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237212 Log: [fixed] fake1 fake2 ports' behaviour changed for parallel deps build testing. fake2 has new port fake1a as a dependency port [new_feature] new fake port fake1a Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/pkg-descr Modified: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile Modified: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile ============================================================================== --- soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile Wed Jun 6 13:17:53 2012 (r237211) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile Wed Jun 6 13:28:41 2012 (r237212) @@ -8,8 +8,7 @@ do-install: @echo "Port: "fake1" is installing now" - @echo "Press any key to continue:" - @read i + sleep 6; touch ${PORTSDIR}/tmp/fake1; pre-clean: Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/Makefile Wed Jun 6 13:28:41 2012 (r237212) @@ -0,0 +1,17 @@ +PORTNAME=fake1a +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + + +WRKSRC= ${WRKDIR}/fake-1.0 + +do-install: + @echo "Port: "fake1a" is installing now" + sleep 6; \ + touch ${PORTSDIR}/tmp/fake1a; + +pre-clean: + rm -rf ${PORTSDIR}/tmp/fake1a; + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1a/pkg-descr Wed Jun 6 13:28:41 2012 (r237212) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file Modified: soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile ============================================================================== --- soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile Wed Jun 6 13:17:53 2012 (r237211) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile Wed Jun 6 13:28:41 2012 (r237212) @@ -5,11 +5,15 @@ WRKSRC= ${WRKDIR}/fake-1.0 -FETCH_DEPENDS= ${PORTSDIR}/tmp/fake1:/usr/home/scher/project/fake_ports/with_deps/fake1 +FETCH_DEPENDS= ${PORTSDIR}/tmp/fake1:${PORTSDIR}/fake_ports/with_deps/fake1 \ + ${PORTSDIR}/tmp/fake1a:${PORTSDIR}/fake_ports/with_deps/fake1a NOCLEANDEPENDS= do-install: - @echo "Port: "fake2" is installing now" + @echo "Port: "fake2" is installing now"; \ + echo "Press any key to continue"; \ + read i + .include From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 13:37:49 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 17C261065670 for ; Wed, 6 Jun 2012 13:37:47 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 13:37:47 +0000 Date: Wed, 06 Jun 2012 13:37:47 +0000 From: emc2@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: <20120606133747.17C261065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237213 - soc2012/emc2/experimental 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, 06 Jun 2012 13:37:49 -0000 Author: emc2 Date: Wed Jun 6 13:37:46 2012 New Revision: 237213 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237213 Log: Forgot to commit adding this. For some reason, the linking process seems to be getting the addresses of called functions wrong. This is causing attempts to run anything I produce from this directory, as well as loader.efi to hang. Added: soc2012/emc2/experimental/start.S Modified: soc2012/emc2/experimental/helloworld.c Modified: soc2012/emc2/experimental/helloworld.c ============================================================================== --- soc2012/emc2/experimental/helloworld.c Wed Jun 6 13:28:41 2012 (r237212) +++ soc2012/emc2/experimental/helloworld.c Wed Jun 6 13:37:46 2012 (r237213) @@ -5,8 +5,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systab) { - + /* systab->ConOut->OutputString(systab->ConOut, str); - + */ return EFI_SUCCESS; } Added: soc2012/emc2/experimental/start.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/experimental/start.S Wed Jun 6 13:37:46 2012 (r237213) @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2008-2010 Rui Paulo + * 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. + * + * $FreeBSD: soc2012/emc2/head/sys/boot/i386/efi/start.S 206419 2010-04-07 18:16:05Z rpaulo $ + */ + + .text + +#include + +#define EFI_SUCCESS 0 + +/* + * EFI entry point. + * _start(EFI_IMAGE image_handle, EFI_SYSTEM_TABLE *system_table); + * + * We calculate the base address along with _DYNAMIC, relocate us and finally + * pass control to efi_main. + */ + +ENTRY(_start) + pushl %ebp + movl %esp, %ebp + + pushl 12(%ebp) /* image_handle */ + pushl 8(%ebp) /* system_table */ + call efi_main + leave + ret +END(_start) + + .data + .section .reloc, "a" + .long 0 + .long 10 + .word 0 From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 14:10:50 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 323BE1065677 for ; Wed, 6 Jun 2012 14:10:48 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 14:10:48 +0000 Date: Wed, 06 Jun 2012 14:10:48 +0000 From: emc2@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: <20120606141048.323BE1065677@hub.freebsd.org> Cc: Subject: socsvn commit: r237215 - soc2012/emc2/experimental 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, 06 Jun 2012 14:10:50 -0000 Author: emc2 Date: Wed Jun 6 14:10:47 2012 New Revision: 237215 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237215 Log: One problem solved (sort of). It seems compiling with clang generates bad offsets for calls, for some reason. Compiling with gcc fixes the problem. However, it's still hanging whenever I try to call EFI builtin functions, for some reason. Modified: soc2012/emc2/experimental/Makefile soc2012/emc2/experimental/helloworld.c Modified: soc2012/emc2/experimental/Makefile ============================================================================== --- soc2012/emc2/experimental/Makefile Wed Jun 6 13:35:30 2012 (r237214) +++ soc2012/emc2/experimental/Makefile Wed Jun 6 14:10:47 2012 (r237215) @@ -1,5 +1,5 @@ -CC=clang -CFLAGS=-O2 -m32 -I../head/sys/boot/efi/include/ -I../head/sys/boot/efi/include/i386 +CC=gcc +CFLAGS=-O2 -m32 -I../head/sys/boot/efi/include/ -I../head/sys/boot/efi/include/i386 -fPIC OBJCOPY=objcopy EFIFORMAT=efi-app-ia32 LDSCRIPT=ldscript.i386 Modified: soc2012/emc2/experimental/helloworld.c ============================================================================== --- soc2012/emc2/experimental/helloworld.c Wed Jun 6 13:35:30 2012 (r237214) +++ soc2012/emc2/experimental/helloworld.c Wed Jun 6 14:10:47 2012 (r237215) @@ -5,8 +5,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systab) { - /* - systab->ConOut->OutputString(systab->ConOut, str); - */ + + systab->ConOut->ClearScreen(systab->ConOut); + return EFI_SUCCESS; } From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 16:37: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 E9AFC106566C for ; Wed, 6 Jun 2012 16:37:05 +0000 (UTC) (envelope-from vbotton@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 16:37:05 +0000 Date: Wed, 06 Jun 2012 16:37:05 +0000 From: vbotton@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: <20120606163705.E9AFC106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237218 - soc2012/vbotton/ntfs_apple 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, 06 Jun 2012 16:37:08 -0000 Author: vbotton Date: Wed Jun 6 16:37:05 2012 New Revision: 237218 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237218 Log: Change spinlock and rw_lock calls Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.c soc2012/vbotton/ntfs_apple/ntfs_attr_list.c soc2012/vbotton/ntfs_apple/ntfs_attr_list.h soc2012/vbotton/ntfs_apple/ntfs_compress.c soc2012/vbotton/ntfs_apple/ntfs_debug.c soc2012/vbotton/ntfs_apple/ntfs_dir.c soc2012/vbotton/ntfs_apple/ntfs_index.c soc2012/vbotton/ntfs_apple/ntfs_index.h soc2012/vbotton/ntfs_apple/ntfs_inode.c soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.c soc2012/vbotton/ntfs_apple/ntfs_logfile.c soc2012/vbotton/ntfs_apple/ntfs_mft.c soc2012/vbotton/ntfs_apple/ntfs_page.c soc2012/vbotton/ntfs_apple/ntfs_quota.c soc2012/vbotton/ntfs_apple/ntfs_secure.c soc2012/vbotton/ntfs_apple/ntfs_usnjrnl.c soc2012/vbotton/ntfs_apple/ntfs_vfsops.c soc2012/vbotton/ntfs_apple/ntfs_vnops.c Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr.c Wed Jun 6 15:29:27 2012 (r237217) +++ soc2012/vbotton/ntfs_apple/ntfs_attr.c Wed Jun 6 16:37:05 2012 (r237218) @@ -38,15 +38,12 @@ #include #include #include -/*#include */ +#include +#include +#include +#include -#include -/*#include -#include */ - -//#include -//#include #include "ntfs.h" #include "ntfs_attr.h" @@ -100,7 +97,7 @@ ntfs_debug("Done (resident, nothing to do)."); return 0; } - lck_rw_lock_exclusive(&ni->rl.lock); + rw_wlock(&ni->rl.lock); /* Verify that the runlist is not mapped yet. */ if (ni->rl.alloc && ni->rl.elements) panic("%s(): ni->rl.alloc && ni->rl.elements\n", __FUNCTION__); @@ -165,7 +162,7 @@ ntfs_attr_search_ctx_put(ctx); ntfs_mft_record_unmap(base_ni); err: - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); if (!err) ntfs_debug("Done."); else @@ -260,10 +257,10 @@ panic("%s(): !a->non_resident\n", __FUNCTION__); ctx_is_temporary = FALSE; end_vcn = le64toh(a->highest_vcn); - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); allocated_size_vcn = ni->allocated_size >> ni->vol->cluster_size_shift; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * If we already have the attribute extent containing @vcn in * @ctx, no need to look it up again. We slightly cheat in @@ -449,13 +446,13 @@ panic("%s(): vcn < 0\n", __FUNCTION__); retry_remap: if (!ni->rl.elements) { - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (!ni->allocated_size) { - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); lcn = LCN_ENOENT; goto lcn_enoent; } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (!is_retry) goto try_to_map; lcn = LCN_EIO; @@ -465,7 +462,7 @@ lcn = ntfs_rl_vcn_to_lcn(ni->rl.rl, vcn, clusters); if (lcn >= LCN_HOLE) { if (need_lock_switch) - lck_rw_lock_exclusive_to_shared(&ni->rl.lock); + rw_downgrade(&ni->rl.lock); ntfs_debug("Done (lcn 0x%llx, clusters 0x%llx).", (unsigned long long)lcn, clusters ? (unsigned long long)*clusters : 0); @@ -485,8 +482,8 @@ * fails, need to take the lock for writing and retry * in case the racing process did the mapping for us. */ - if (!lck_rw_lock_shared_to_exclusive(&ni->rl.lock)) { - lck_rw_lock_exclusive(&ni->rl.lock); + if (!rw_upgrade(&ni->rl.lock)) { + rw_wlock(&ni->rl.lock); goto retry_remap; } } @@ -508,7 +505,7 @@ } lcn_eio: if (need_lock_switch) - lck_rw_lock_exclusive_to_shared(&ni->rl.lock); + rw_downgrade(&ni->rl.lock); if (lcn == LCN_ENOENT) { lcn_enoent: ntfs_debug("Done (LCN_ENOENT)."); @@ -593,12 +590,12 @@ panic("%s(): vcn < 0\n", __FUNCTION__); retry_remap: if (!ni->rl.elements) { - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (!ni->allocated_size) { - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); return LCN_ENOENT; } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (!is_retry) goto try_to_map; err = EIO; @@ -705,7 +702,7 @@ { ntfs_attr_search_ctx *ctx; - ctx = OSMalloc(sizeof(ntfs_attr_search_ctx), ntfs_malloc_tag); + ctx = malloc(sizeof(ntfs_attr_search_ctx)); if (ctx) ntfs_attr_search_ctx_init(ctx, ni, m); return ctx; @@ -722,7 +719,7 @@ { if (ctx->base_ni && ctx->ni != ctx->base_ni) ntfs_extent_mft_record_unmap(ctx->ni); - OSFree(ctx, sizeof(ntfs_attr_search_ctx), ntfs_malloc_tag); + free(ctx); } /** @@ -2087,9 +2084,9 @@ goto restart_compressed_size_add; } /* Move the attribute to an extent mft record. */ - lck_rw_lock_shared(&base_ni->attr_list_rl.lock); + rw_rlock(&base_ni->attr_list_rl.lock); err = ntfs_attr_record_move(ctx); - lck_rw_unlock_shared(&base_ni->attr_list_rl.lock); + rw_unlock(&base_ni->attr_list_rl.lock); if (err) { ntfs_error(vol->mp, "Failed to move attribute extent " "from mft record 0x%llx to an extent " @@ -2229,13 +2226,13 @@ * compressed sizes is sufficient in which case we can save a few CPU * cycles by not updating the data and initialized sizes here. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); a->allocated_size = cpu_to_sle64(ni->allocated_size); a->data_size = cpu_to_sle64(ni->data_size); a->initialized_size = cpu_to_sle64(ni->initialized_size); if (a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) a->compressed_size = cpu_to_sle64(ni->compressed_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * If the current mapping pairs array is valid and the first vcn at * which we need to update the mapping pairs array is not in this @@ -2966,12 +2963,12 @@ * The size needs to be aligned to a cluster boundary for allocation * purposes. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); data_size = ni->data_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); new_size = (data_size + vol->cluster_size_mask) & ~vol->cluster_size_mask; - lck_rw_lock_exclusive(&ni->rl.lock); + rw_wlock(&ni->rl.lock); if (ni->rl.elements) panic("%s(): ni->rl.elements\n", __FUNCTION__); upl = NULL; @@ -3169,9 +3166,9 @@ type = ni->type; if (type != AT_STANDARD_INFORMATION && type != AT_INDEX_ROOT && (type != AT_DATA || ni->name_len)) { - lck_rw_lock_shared(&base_ni->attr_list_rl.lock); + rw_rlock(&base_ni->attr_list_rl.lock); err = ntfs_attr_record_move(&ctx); - lck_rw_unlock_shared(&base_ni->attr_list_rl.lock); + rw_unlock(&base_ni->attr_list_rl.lock); if (!err) { /* The attribute has moved so update our variables. */ m = ctx.m; @@ -3441,7 +3438,7 @@ if (err) panic("%s(): err\n", __FUNCTION__); /* Setup the in-memory attribute structure to be non-resident. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->allocated_size = new_size; if (NInoSparse(ni) || NInoCompressed(ni)) { ni->compressed_size = ni->allocated_size; @@ -3459,7 +3456,7 @@ ni->compression_block_clusters = 0; } } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * This needs to be last since we are not allowed to fail once we flip * this switch. @@ -3485,7 +3482,7 @@ NInoSetMrecNeedsDirtying(base_ni); } ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* * We have modified the allocated size. If the ntfs inode is the base * inode, cause the sizes to be written to all the directory index @@ -3545,7 +3542,7 @@ panic("%s(): err2\n", __FUNCTION__); } unl_err: - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); if (err == EINVAL) err = EIO; return err; @@ -3922,7 +3919,7 @@ BOOL data_size_updated = FALSE; #ifdef DEBUG - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ntfs_debug("Entering for mft_no 0x%llx, attribute type 0x%x, old data " "size 0x%llx, old initialized size 0x%llx, new " "initialized size 0x%llx.", @@ -3931,7 +3928,7 @@ (unsigned long long)ni->data_size, (unsigned long long)ni->initialized_size, (unsigned long long)new_init_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); #endif /* DEBUG */ base_ni = ni; if (NInoAttr(ni)) @@ -3953,7 +3950,7 @@ goto put_err; } a = ctx->a; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (new_init_size >= 0) { if (new_init_size < ni->initialized_size) panic("%s(): new_init_size < ni->initialized_size\n", @@ -4001,17 +3998,17 @@ panic("%s(): !NInoNonResident(ni)\n", __FUNCTION__); a->initialized_size = cpu_to_sle64(new_init_size); } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * If this is a directory B+tree index allocation attribute also update * the sizes in the base inode. */ if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); if (data_size_updated) base_ni->data_size = new_init_size; base_ni->initialized_size = new_init_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } /* Mark the mft record dirty to ensure it gets written out. */ NInoSetMrecNeedsDirtying(ctx->ni); @@ -4083,13 +4080,13 @@ unsigned attr_len; BOOL locked, write_locked, is_sparse, mark_sizes_dirty; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (new_init_size > ni->allocated_size) panic("%s(): new_init_size > ni->allocated_size\n", __FUNCTION__); size = ni->data_size; old_init_size = ni->initialized_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (new_init_size <= old_init_size) panic("%s(): new_init_size <= old_init_size\n", __FUNCTION__); @@ -4140,9 +4137,9 @@ bzero(kattr + attr_len, new_init_size - attr_len); a->value_length = cpu_to_le32((u32)new_init_size); /* Update the sizes in the ntfs inode as well as the ubc size. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->initialized_size = ni->data_size = size = new_init_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* Mark the mft record dirty to ensure it gets written out. */ NInoSetMrecNeedsDirtying(ctx->ni); ntfs_attr_search_ctx_put(ctx); @@ -4179,9 +4176,9 @@ panic("%s(): size != le64toh(a->data_size)\n", __FUNCTION__); size = new_init_size; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->data_size = new_init_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); a->data_size = cpu_to_sle64(new_init_size); /* Mark the mft record dirty to ensure it gets written out. */ NInoSetMrecNeedsDirtying(ctx->ni); @@ -4220,7 +4217,7 @@ BOOL have_holes = FALSE; locked = TRUE; - lck_rw_lock_shared(&ni->rl.lock); + rw_rlock(&ni->rl.lock); vcn = ofs >> vol->cluster_size_shift; end_vcn = (new_init_size + vol->cluster_size_mask) >> vol->cluster_size_shift; @@ -4230,9 +4227,9 @@ map_vcn: if (!write_locked) { write_locked = TRUE; - if (!lck_rw_lock_shared_to_exclusive( + if (!rw_upgrade( &ni->rl.lock)) { - lck_rw_lock_exclusive(&ni->rl.lock); + rw_wlock(&ni->rl.lock); goto retry_remap; } } @@ -4287,9 +4284,9 @@ if (ofs > old_init_size) { if (ofs > new_init_size) ofs = new_init_size; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->initialized_size = ofs; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ofs == new_init_size) goto update_done; } @@ -4308,7 +4305,7 @@ */ if (have_holes) { if (write_locked) { - lck_rw_lock_exclusive_to_shared(&ni->rl.lock); + rw_downgrade(&ni->rl.lock); write_locked = FALSE; } /* @@ -4322,9 +4319,9 @@ rl = ni->rl.rl; } else { if (write_locked) - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); else - lck_rw_unlock_shared(&ni->rl.lock); + rw_unlock(&ni->rl.lock); locked = FALSE; is_sparse = FALSE; } @@ -4399,9 +4396,9 @@ */ if (ofs > new_init_size) ofs = new_init_size; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->initialized_size = ofs; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); } else /* if (!is_sparse) */ { upl_t upl; upl_page_info_array_t pl; @@ -4427,7 +4424,7 @@ // not. Or perhaps just remove the warning and use this as the solution. if (locked && write_locked) { write_locked = FALSE; - lck_rw_lock_exclusive_to_shared(&ni->rl.lock); + rw_downgrade(&ni->rl.lock); ntfs_warning(vol->mp, "Switching runlist lock " "to shared to avoid " "deadlock."); @@ -4442,25 +4439,25 @@ ofs += PAGE_SIZE; if (ofs > new_init_size) ofs = new_init_size; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->initialized_size = ofs; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* Set the page dirty so it gets written out. */ ntfs_page_unmap(ni, upl, pl, TRUE); } } while (ofs < new_init_size); - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (ni->initialized_size != new_init_size) panic("%s(): ni->initialized_size != new_init_size\n", __FUNCTION__); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); update_done: /* If we are holding the runlist lock, release it now. */ if (locked) { if (write_locked) - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); else - lck_rw_unlock_shared(&ni->rl.lock); + rw_unlock(&ni->rl.lock); locked = FALSE; } /* Bring up to date the initialized_size in the attribute record. */ @@ -4486,13 +4483,13 @@ unl_err: if (locked) { if (write_locked) - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); else - lck_rw_unlock_shared(&ni->rl.lock); + rw_unlock(&ni->rl.lock); } - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->initialized_size = old_init_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); goto err; put_err: ntfs_attr_search_ctx_put(ctx); @@ -4637,9 +4634,9 @@ * enough space to add the compressed size to the attribute record. */ if (!ntfs_attr_record_is_only_one(m, a)) { - lck_rw_lock_shared(&base_ni->attr_list_rl.lock); + rw_rlock(&base_ni->attr_list_rl.lock); err = ntfs_attr_record_move(ctx); - lck_rw_unlock_shared(&base_ni->attr_list_rl.lock); + rw_unlock(&base_ni->attr_list_rl.lock); if (err) { ntfs_error(vol->mp, "Failed to move attribute extent " "from mft record 0x%llx to an extent " @@ -4738,10 +4735,10 @@ ffs(ni->compression_block_size) - 1; ni->compression_block_clusters = 1U << NTFS_COMPRESSION_UNIT; } - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->compressed_size = ni->allocated_size; a->compressed_size = a->allocated_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); is_compressed: /* Mark both the attribute and the ntfs inode as sparse. */ a->flags |= ATTR_IS_SPARSE; @@ -5111,9 +5108,9 @@ sizeof(a->compressed_size)); /* Set the compression unit to 0. */ a->compression_unit = 0; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->compressed_size = 0; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* Clear the other related fields. */ ni->compression_block_size = 0; ni->compression_block_clusters = @@ -5219,7 +5216,7 @@ base_ni = ni->base_ni; if (!new_end) atomic = TRUE; - lck_rw_lock_shared(&ni->rl.lock); + rw_rlock(&ni->rl.lock); write_locked = FALSE; /* * We have to round down @start to the nearest page boundary and we @@ -5234,11 +5231,11 @@ end_vcn = ((end + PAGE_MASK) & ~PAGE_MASK_64) >> vol->cluster_size_shift; /* Cache the sizes for the attribute so we take the size lock once. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); allocated_size = ni->allocated_size; initialized_size = ni->initialized_size; compressed_size = ni->compressed_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * We have to make sure that we stay within the existing allocated * size when instantiating holes as it would corrupt the attribute if @@ -5254,8 +5251,8 @@ map_vcn: if (!write_locked) { write_locked = TRUE; - if (!lck_rw_lock_shared_to_exclusive(&ni->rl.lock)) { - lck_rw_lock_exclusive(&ni->rl.lock); + if (!rw_upgrade(&ni->rl.lock)) { + rw_wlock(&ni->rl.lock); goto retry_remap; } } @@ -5317,8 +5314,8 @@ */ if (!write_locked) { write_locked = TRUE; - if (!lck_rw_lock_shared_to_exclusive(&ni->rl.lock)) { - lck_rw_lock_exclusive(&ni->rl.lock); + if (!rw_upgrade(&ni->rl.lock)) { + rw_wlock(&ni->rl.lock); goto retry_remap; } } @@ -5510,10 +5507,10 @@ * update the compressed size. */ if (NInoSparse(ni) || NInoCompressed(ni)) { - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->compressed_size = compressed_size; a->compressed_size = cpu_to_sle64(compressed_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); } /* * If this is the unnamed $DATA attribute also need to update @@ -5619,9 +5616,9 @@ * number of extent attribute records needed to a minimum. */ if (!ntfs_attr_record_is_only_one(m, a)) { - lck_rw_lock_shared(&base_ni->attr_list_rl.lock); + rw_rlock(&base_ni->attr_list_rl.lock); err = ntfs_attr_record_move(ctx); - lck_rw_unlock_shared(&base_ni->attr_list_rl.lock); + rw_unlock(&base_ni->attr_list_rl.lock); if (err) { ntfs_error(vol->mp, "Failed to move attribute " "extent from mft record " @@ -5769,9 +5766,9 @@ if (new_end) *new_end = vcn << vol->cluster_size_shift; if (write_locked) - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); else - lck_rw_unlock_shared(&ni->rl.lock); + rw_unlock(&ni->rl.lock); return err; undo_alloc: err2 = ntfs_cluster_free_from_rl(vol, runlist.rl, 0, -1, NULL); @@ -5826,10 +5823,10 @@ } /* Restore the compressed size to the old value. */ compressed_size -= len << vol->cluster_size_shift; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->compressed_size = compressed_size; a->compressed_size = cpu_to_sle64(compressed_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* Ensure the modified mft record is written out. */ NInoSetMrecNeedsDirtying(ctx->ni); if (ni == base_ni) @@ -5961,9 +5958,9 @@ start = data_start; #ifdef DEBUG - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); old_alloc_size = ni->allocated_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); ntfs_debug("Entering for mft_no 0x%llx, attribute type 0x%x, " "old_allocated_size 0x%llx, " "new_allocated_size 0x%llx, new_data_size 0x%llx, " @@ -6000,9 +5997,9 @@ err = ntfs_attr_size_bounds_check(vol, ni->type, new_alloc_size); if (err) { /* Only emit errors when the write will fail completely. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); old_alloc_size = ni->allocated_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (start < 0 || start >= old_alloc_size) { if (err == ERANGE) { ntfs_error(vol->mp, "Cannot extend allocation " @@ -6038,7 +6035,7 @@ * We will be modifying both the runlist (if non-resident) and the mft * record so lock them both down. */ - lck_rw_lock_exclusive(&ni->rl.lock); + rw_wlock(&ni->rl.lock); err = ntfs_mft_record_map(base_ni, &base_m); if (err) { base_m = NULL; @@ -6050,9 +6047,9 @@ err = ENOMEM; goto err_out; } - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); alloc_size = ni->allocated_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * If non-resident, seek to the last extent. If resident, there is * only one extent, so seek to that. @@ -6116,11 +6113,11 @@ * This cannot fail as it is a shrinking * resize. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); err = ntfs_attr_record_resize(m, a, le16toh(a->value_offset) + ni->allocated_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (err) panic("%s(): Failed to shrink " "resident attribute " @@ -6132,14 +6129,14 @@ /* Zero the extended attribute value. */ bzero((u8*)a + le16toh(a->value_offset) + attr_len, (u32)new_data_size - attr_len); - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->initialized_size = ni->data_size = new_data_size; a->value_length = cpu_to_le32((u32)new_data_size); } else - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->allocated_size = le32toh(a->length) - le16toh(a->value_offset); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (new_data_size > attr_len) a->value_length = cpu_to_le32((u32)new_data_size); goto dirty_done; @@ -6150,7 +6147,7 @@ */ ntfs_attr_search_ctx_put(actx); ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* * Not enough space in the mft record, try to make the attribute * non-resident and if successful restart the extension process. @@ -6170,9 +6167,9 @@ * Only emit errors when the write will fail * completely. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); old_alloc_size = ni->allocated_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (start < 0 || start >= old_alloc_size) ntfs_error(vol->mp, "Cannot extend allocation " "of mft_no 0x%llx, attribute " @@ -6221,9 +6218,9 @@ */ if (arec_size > vol->mft_record_size - sizeof(MFT_RECORD)) { /* Only emit errors when the write will fail completely. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); old_alloc_size = ni->allocated_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (start < 0 || start >= old_alloc_size) ntfs_error(vol->mp, "Cannot extend allocation of " "mft_no 0x%llx, attribute type 0x%x, " @@ -6625,7 +6622,7 @@ NVolSetErrors(vol); goto err_out; } - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* Find the index root by walking up the tree path. */ root_ictx = ictx; while (!root_ictx->is_root) { @@ -6793,9 +6790,9 @@ */ if (!ntfs_attr_record_is_only_one(m, a)) { move_attr: - lck_rw_lock_shared(&base_ni->attr_list_rl.lock); + rw_rlock(&base_ni->attr_list_rl.lock); err = ntfs_attr_record_move(actx); - lck_rw_unlock_shared(&base_ni->attr_list_rl.lock); + rw_unlock(&base_ni->attr_list_rl.lock); if (err) { if (start < 0 || start >= alloc_size) ntfs_error(vol->mp, "Failed to move " @@ -7333,7 +7330,7 @@ */ a = actx->a; } - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->allocated_size = new_alloc_size; a->allocated_size = cpu_to_sle64(new_alloc_size); if (NInoSparse(ni) || (ni->type != AT_INDEX_ALLOCATION && @@ -7341,11 +7338,11 @@ ni->compressed_size += nr_allocated << vol->cluster_size_shift; a->compressed_size = cpu_to_sle64(ni->compressed_size); } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); base_ni->allocated_size = new_alloc_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } alloc_done: if (new_data_size > le64toh(a->data_size)) { @@ -7363,14 +7360,14 @@ */ err = EIO; } - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->data_size = new_data_size; a->data_size = cpu_to_sle64(new_data_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); base_ni->data_size = new_data_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } } dirty_done: @@ -7388,7 +7385,7 @@ done: ntfs_attr_search_ctx_put(actx); ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); ntfs_debug("Done, new_allocated_size 0x%llx.", (unsigned long long)new_alloc_size); if (dst_alloc_size) @@ -7515,12 +7512,12 @@ } } undo_do_trunc: - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (alloc_size == ni->allocated_size) { - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); goto undo_skip_update_sizes; } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); ntfs_attr_search_ctx_reinit(actx); /* Look up the first attribute extent. */ if (ntfs_attr_lookup(ni->type, ni->name, ni->name_len, 0, NULL, 0, @@ -7533,7 +7530,7 @@ goto err_out; } a = actx->a; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->allocated_size = alloc_size; a->allocated_size = cpu_to_sle64(alloc_size); if (NInoSparse(ni) || (ni->type != AT_INDEX_ALLOCATION && @@ -7542,11 +7539,11 @@ vol->cluster_size_shift; a->compressed_size = cpu_to_sle64(ni->compressed_size); } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); base_ni->allocated_size = alloc_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } /* Ensure the changes make it to disk. */ if (actx->ni != base_ni) @@ -7564,7 +7561,7 @@ ntfs_attr_search_ctx_put(actx); NInoSetMrecNeedsDirtying(base_ni); ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* * Things are now consistent, try to truncate the attribute back to its * old size which will cause the allocation to be restored to its old @@ -7577,9 +7574,9 @@ * the size in the vnode @ni->vn via ubc_setsize(). */ if (!is_first) { - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ll = ni->data_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ntfs_attr_resize(ni, ll, 0, ictx)) { ntfs_error(vol->mp, "Failed to undo partial " "allocation in inode 0x%llx in error " @@ -7596,7 +7593,7 @@ ntfs_attr_search_ctx_put(actx); if (base_m) ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); goto conv_err_out; trunc_err_out: mp_rebuilt = FALSE; @@ -7719,7 +7716,7 @@ * Lock the runlist for writing and map the mft record to ensure it is * safe to modify the attribute runlist and sizes. */ - lck_rw_lock_exclusive(&ni->rl.lock); + rw_wlock(&ni->rl.lock); err = ntfs_mft_record_map(base_ni, &m); if (err) { ntfs_error(vol->mp, "Failed to map mft record for mft_no " @@ -7765,10 +7762,10 @@ else new_alloc_size = (new_size + 7) & ~7; /* The current allocated size is the old allocated size. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); old_alloc_size = ni->allocated_size; compressed_size = ni->compressed_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * The change in the file size. This will be 0 if no change, >0 if the * size is growing, and <0 if the size is shrinking. @@ -7857,7 +7854,7 @@ !ntfs_resident_attr_value_resize(m, a, new_size)) { /* The resize succeeded! */ NInoSetMrecNeedsDirtying(actx->ni); - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); /* Update the sizes in the ntfs inode and all is done. */ ni->allocated_size = le32toh(a->length) - le16toh(a->value_offset); @@ -7889,7 +7886,7 @@ * deadlocks. */ ni->initialized_size = new_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); goto unm_done; } /* If the above resize failed, this must be an attribute extension. */ @@ -7976,7 +7973,7 @@ panic("%s(): ictx->is_locked\n", __FUNCTION__); if (ictx->is_root) panic("%s(): ictx->is_root\n", __FUNCTION__); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* Find the index root by walking up the tree path. */ root_ictx = ictx; while (!root_ictx->is_root) { @@ -8093,7 +8090,7 @@ */ ntfs_attr_search_ctx_put(actx); ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* * Not enough space in the mft record, try to make the attribute * non-resident and if successful restart the truncation process. @@ -8186,19 +8183,19 @@ * Make the valid size smaller (the UBC size is already * up-to-date). */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); if (new_size < ni->initialized_size) { ni->initialized_size = new_size; a->initialized_size = cpu_to_sle64(new_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); base_ni->initialized_size = new_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } } else - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); /* * If the size is shrinking it makes no sense for the * allocation to be growing. @@ -8233,7 +8230,7 @@ */ ntfs_attr_search_ctx_put(actx); ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); err = ntfs_attr_extend_allocation(ni, new_size, size_change > 0 ? new_size : -1, -1, ictx, NULL, FALSE); @@ -8244,14 +8241,14 @@ /* alloc_change <= 0 */ /* If the actual size is changing need to update it now. */ if (size_change) { - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->data_size = new_size; a->data_size = cpu_to_sle64(new_size); - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); base_ni->data_size = new_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } } /* Ensure the modified mft record is written out. */ @@ -8334,7 +8331,7 @@ ntfs_attr_sparse_clear(base_ni, ni, actx); } /* Update the allocated/compressed size. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); ni->allocated_size = new_alloc_size; a->allocated_size = cpu_to_sle64(new_alloc_size); if (NInoSparse(ni) || (ni->type != AT_INDEX_ALLOCATION && @@ -8347,11 +8344,11 @@ a->compressed_size = cpu_to_sle64(ni->compressed_size); } } - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (ni->name == I30 && ni->type == AT_INDEX_ALLOCATION) { - lck_spin_lock(&base_ni->size_lock); + mtx_lock_spin(&base_ni->size_lock); base_ni->allocated_size = new_alloc_size; - lck_spin_unlock(&base_ni->size_lock); + mtx_unlock_spin(&base_ni->size_lock); } /* * We have the base attribute extent in @actx and we have set it up @@ -8689,7 +8686,7 @@ unm_done: ntfs_attr_search_ctx_put(actx); ntfs_mft_record_unmap(base_ni); - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); /* Set the UBC size if not set yet. */ if (need_ubc_setsize && !ubc_setsize(ni->vn, new_size)) { ntfs_error(vol->mp, "Failed to set the size in UBC."); @@ -8771,7 +8768,7 @@ unm_err: ntfs_mft_record_unmap(base_ni); unl_err: - lck_rw_unlock_exclusive(&ni->rl.lock); + rw_unlock(&ni->rl.lock); err: /* Reset the UBC size. */ if (!ubc_setsize(ni->vn, old_size)) @@ -8840,9 +8837,9 @@ end = ofs + cnt; end_ofs = (unsigned)end & PAGE_MASK; /* If the end is outside the inode size return ESPIPE. */ - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); data_size = ni->data_size; - lck_spin_unlock(&ni->size_lock); + mtx_unlock_spin(&ni->size_lock); if (end > data_size) { ntfs_error(vol->mp, "Request exceeds end of attribute."); return ESPIPE; @@ -8971,7 +8968,7 @@ goto put_err; } a = ctx->a; - lck_spin_lock(&ni->size_lock); + mtx_lock_spin(&ni->size_lock); /* These can happen when we race with a shrinking truncate. */ attr_len = le32toh(a->value_length); if (attr_len > ni->data_size) @@ -8982,7 +8979,7 @@ init_len = attr_len; if (init_len > ni->initialized_size) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 17:05:56 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 B9CA0106566B for ; Wed, 6 Jun 2012 17:05:54 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 17:05:54 +0000 Date: Wed, 06 Jun 2012 17:05:54 +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: <20120606170554.B9CA0106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237225 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/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: Wed, 06 Jun 2012 17:05:56 -0000 Author: gpf Date: Wed Jun 6 17:05:54 2012 New Revision: 237225 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237225 Log: -extend ioctl() so that it can retrieve an encrypted target filename from kerneland in case of symlink. -make sbin/pefs use that ioctl() to generate checksum for encrypted target filename in case of symlink. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 16:51:33 2012 (r237224) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 17:05:54 2012 (r237225) @@ -55,7 +55,7 @@ #include "pefs_ctl.h" -#define PEFS_INTEGRITY_DEBUG +//#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -166,10 +166,83 @@ } static int -pefs_compute_file_checksums(struct file_header *fhp, const EVP_MD *md, +pefs_compute_symlink_checksum(struct file_header *fhp, const EVP_MD *md, uint8_t hash_len) { + struct pefs_xslink_ctext xsl; + char parent_dir[MAXPATHLEN]; + EVP_MD_CTX mdctx; + int error, i, fd, md_len; + struct checksum *csp; + char *pch; + + fhp->nhashes = 0; + + /* feed parent directory to ioctl() */ + strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); + pch = strrchr(parent_dir, '/'); + if (pch == NULL) { + pefs_warn("error retrieving parent dir of %s", fhp->path); + return (PEFS_ERR_NOENT); + } + *pch = '\0'; + + strlcpy(xsl.pxsl_filename, pch + 1, sizeof(xsl.pxsl_filename)); + xsl.pxsl_namelen = strnlen(xsl.pxsl_filename, sizeof(xsl.pxsl_filename)); + + fd = open(parent_dir, O_RDONLY); + if (fd < 0) { + warn("failed to open file: %s", parent_dir); + return (PEFS_ERR_IO); + } + error = ioctl(fd, PEFS_GETSLINKCTEXT, &xsl); + if (error != 0) { + pefs_warn("error retrieving symlink's ciphertext of %s", fhp->path); + close(fd); + return (PEFS_ERR_IO); + } + + dprintf(("read %d bytes from kernel\n\n", xsl.pxsl_slink_len)); + dprintf(("printing contents of buf:")); + for (i=0; i < (int)xsl.pxsl_slink_len; i++) dprintf(("%c", xsl.pxsl_slink[i])); + dprintf(("!\n")); + + EVP_MD_CTX_init(&mdctx); + EVP_DigestInit_ex(&mdctx, md, NULL); + EVP_DigestUpdate(&mdctx, xsl.pxsl_slink, xsl.pxsl_slink_len); + + csp = malloc(sizeof(struct checksum)); + if (csp == NULL) { + pefs_warn("memory allocation error"); + close(fd); + return (PEFS_ERR_SYS); + } + csp->hash = malloc(hash_len); + if (csp->hash == NULL) { + pefs_warn("memory allocation error"); + free(csp); + close(fd); + return (PEFS_ERR_SYS); + } + + EVP_DigestFinal_ex(&mdctx, csp->hash, &md_len); + + dprintf(("Digest is: ")); + for (i = 0; i < md_len; i++) dprintf(("%02x", csp->hash[i])); + dprintf(("\n")); + + EVP_MD_CTX_cleanup(&mdctx); + TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); + fhp->nhashes++; + + return (0); +} + +static int +pefs_compute_file_checksums(struct file_header *fhp, const EVP_MD *md, + uint8_t hash_len) +{ struct pefs_xsector_ctext xsct; EVP_MD_CTX mdctx; struct stat sb; @@ -180,23 +253,22 @@ TAILQ_INIT(&(fhp->checksums)); - /* - * XXXgpf: [TODO] deal with symlinks - */ - /* XXXgpf: what happens if file size > 2^64? */ - if (stat(fhp->path, &sb) != 0) { + if (lstat(fhp->path, &sb) != 0) { warn("cannot stat file %s", fhp->path); return (PEFS_ERR_SYS); } + if (S_ISLNK(sb.st_mode) != 0) + return(pefs_compute_symlink_checksum(fhp, md, hash_len)); + resid = sb.st_size; if (resid == 0) { pefs_warn("empty files are not allowed: %s", fhp->path); return (PEFS_ERR_INVALID); } - fd = open(fhp->path, O_RDONLY); + fd = open(fhp->path, O_RDONLY | O_NOFOLLOW); if (fd < 0) { warn("failed to open file: %s", fhp->path); return (PEFS_ERR_IO); Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Wed Jun 6 16:51:33 2012 (r237224) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Wed Jun 6 17:05:54 2012 (r237225) @@ -61,6 +61,13 @@ char pxsct_ctext[PEFS_SECTOR_SIZE]; }; +struct pefs_xslink_ctext { + uint32_t pxsl_namelen; + uint32_t pxsl_slink_len; + char pxsl_filename[MAXPATHLEN]; + char pxsl_slink[PEFS_SECTOR_SIZE]; +}; + #ifdef _IO #define PEFS_GETKEY _IOWR('p', 0, struct pefs_xkey) #define PEFS_ADDKEY _IOWR('p', 1, struct pefs_xkey) @@ -70,6 +77,7 @@ #define PEFS_GETNODEKEY _IOWR('p', 5, struct pefs_xkey) #define PEFS_GETNAMECSUM _IOWR('p', 6, struct pefs_xnamecsum) #define PEFS_GETSECTORCTEXT _IOWR('p', 7, struct pefs_xsector_ctext) +#define PEFS_GETSLINKCTEXT _IOWR('p', 8, struct pefs_xslink_ctext) #endif #ifdef _KERNEL Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Wed Jun 6 16:51:33 2012 (r237224) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Wed Jun 6 17:05:54 2012 (r237225) @@ -2358,12 +2358,15 @@ struct pefs_enccn enccn; struct componentname cn; struct pefs_chunk pc; + struct vop_cachedlookup_args la; u_quad_t fsize; struct vnode *vp = ap->a_vp; struct vnode *lvp = PEFS_LOWERVP(vp); + struct vnode *svp; struct pefs_xkey *xk = ap->a_data; struct pefs_xnamecsum *xncs = ap->a_data; struct pefs_xsector_ctext *xsct = ap->a_data; + struct pefs_xslink_ctext *xsl = ap->a_data; struct ucred *cred = ap->a_cred; struct thread *td = ap->a_td; struct mount *mp = vp->v_mount; @@ -2531,13 +2534,13 @@ if (strnlen(xncs->pxnc_filename, sizeof(xncs->pxnc_filename)) != xncs->pxnc_namelen) { - printf("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen %d\n", xncs->pxnc_namelen); + printf("pefs_ioctl: PEFS_GETNAMEMAC incorrect pxnc_namelen %d\n", xncs->pxnc_namelen); VOP_UNLOCK(vp, 0); return (EINVAL); } if (strchr(xncs->pxnc_filename, '/') != NULL) { - printf("pefs_ioctl: PEFS_GETNAMEMAC pnm_filename contains '/'\n"); + printf("pefs_ioctl: PEFS_GETNAMEMAC pxnc_filename contains '/'\n"); VOP_UNLOCK(vp, 0); return (EINVAL); } @@ -2580,6 +2583,80 @@ free(buf, M_TEMP); } break; + case PEFS_GETSLINKCTEXT: + vn_lock(vp, LK_EXCLUSIVE); + + if (vp->v_type != VDIR) { + printf("pefs_ioctl: PEFS_GETSLINKCTEXT vp is not a directory\n"); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + if (strnlen(xsl->pxsl_filename, sizeof(xsl->pxsl_filename)) != + xsl->pxsl_namelen) { + printf("pefs_ioctl: PEFS_GETSLINKCTEXT incorrect namelen %d\n", xsl->pxsl_namelen); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + if (strchr(xsl->pxsl_filename, '/') != NULL) { + printf("pefs_ioctl: PEFS_GETSLINKCTEXT filename contains '/'\n"); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + /* pefs_lookup() so that we can grab a vp for our symlink */ + la.a_dvp = vp; + la.a_vpp = &svp; + la.a_cnp = &cn; + + cn.cn_nameiop = LOOKUP; + cn.cn_thread = td; + cn.cn_cred = cred; + cn.cn_lkflags = LK_EXCLUSIVE; + cn.cn_flags = LOCKPARENT | LOCKLEAF | NOFOLLOW; + cn.cn_nameptr = xsl->pxsl_filename; + cn.cn_namelen = xsl->pxsl_namelen; + cn.cn_pnbuf = NULL; + cn.cn_consume = 0; + + /* + * XXXgpf: if lookup succeeds, it should(?) raise reference count for svp + * by one, therefore a vrele is needed before we return? For both svp & lvp? + */ + error = pefs_lookup(&la); + if (error != 0) { + printf("pefs_ioctl: PEFS_GETSLINKCTEXT lookup error %d", error); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + if (svp->v_type != VLNK) { + printf("pefs_ioctl: PEFS_GETSLINKCTEXT svp is not a symlink '/'\n"); + VOP_UNLOCK(svp, 0); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + /* VOP_READLINK our lvp */ + lvp = PEFS_LOWERVP(svp); + pn = VP_TO_PN(svp); + pefs_chunk_create(&pc, pn, MAXPATHLEN); + puio = pefs_chunk_uio(&pc, 0, UIO_READ); + + /* XXXgpf: is this lock really necessary? */ + vn_lock(lvp, LK_EXCLUSIVE); + error = VOP_READLINK(lvp, puio, cred); + VOP_UNLOCK(lvp, 0); + + xsl->pxsl_slink_len = pc.pc_size - pc.pc_uio.uio_resid; + if (error == 0) + memcpy(xsl->pxsl_slink, pc.pc_base, xsl->pxsl_slink_len); + + pefs_chunk_free(&pc, pn); + VOP_UNLOCK(svp, 0); + VOP_UNLOCK(vp, 0); + break; default: error = ENOTTY; break; From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 17:19:49 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 5959D106566C for ; Wed, 6 Jun 2012 17:19:47 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 17:19:47 +0000 Date: Wed, 06 Jun 2012 17:19:47 +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: <20120606171947.5959D106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237226 - 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: Wed, 06 Jun 2012 17:19:49 -0000 Author: gpf Date: Wed Jun 6 17:19:47 2012 New Revision: 237226 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237226 Log: -forgot a close() Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 17:05:54 2012 (r237225) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 6 17:19:47 2012 (r237226) @@ -236,6 +236,7 @@ TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); fhp->nhashes++; + close(fd); return (0); } From owner-svn-soc-all@FreeBSD.ORG Wed Jun 6 18:44:33 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 3B4FA1065670 for ; Wed, 6 Jun 2012 18:44:31 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 06 Jun 2012 18:44:31 +0000 Date: Wed, 06 Jun 2012 18:44:31 +0000 From: scher@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: <20120606184431.3B4FA1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237230 - soc2012/scher/par_ports/head/Mk 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, 06 Jun 2012 18:44:33 -0000 Author: scher Date: Wed Jun 6 18:44:30 2012 New Revision: 237230 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237230 Log: [bugfix] make process (submake) is allowed to work in locked port's if and only if this port's dir was locked by parent make process Hence all submakes can work in port's dir, locked by parent make Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed Jun 6 17:28:46 2012 (r237229) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed Jun 6 18:44:30 2012 (r237230) @@ -121,7 +121,25 @@ if [ $${pid} ]; then \ ps -p $${pid} > /dev/null && status=$$? || status=$$?; \ if [ $${status} -eq 0 ]; then \ - exit ${_parv_ON_LOCK_EXIT_STATUS}; \ + if [ ${_lock_dir} = "LOCK_DIR" ]; then \ + cur_pid=${.MAKE.PID}; \ + while true; do \ + ppid=$$( ps -o ppid -p $${cur_pid} | ${AWK} "NR==2" ); \ + if [ $${ppid} -eq $${pid} ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is locked by parent make process!"; \ + ${ECHO_CMD} "We are allowed to work here"; \ + ${_dparv_END_OUTPUT}; \ + break; \ + elif [ $${ppid} -eq 0 ]; then \ + exit ${_parv_ON_LOCK_EXIT_STATUS}; \ + else \ + cur_pid=$${ppid}; \ + fi; \ + done; \ + else \ + exit ${_parv_ON_LOCK_EXIT_STATUS}; \ + fi; \ else \ ${_dparv_START_OUTPUT}; \ ${ECHO_CMD} "Dir: ${${_lock_dir}} Stalled lock Detected!"; \ @@ -200,18 +218,20 @@ # _parv_LOCK_DIR_DO_UNLOCK # _parv_${_lock_dir}_DO_UNLOCK= \ - lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} \ - ${RM} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} && { \ + lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} ${SH} -c '{ \ + pid=$$(${CAT} ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}); \ + if [ ${.MAKE.PID} -eq $${pid} ]; then \ + ${RM} -rf ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is unlocked"; \ + ${ECHO_CMD} Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} is unlocked; \ ${_dparv_END_OUTPUT}; \ - } || { \ + else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Hard unlock!"; \ - ${RM} -rf ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE}; \ + ${ECHO_CMD} Dir: ${${_lock_dir}}/${_parv_${_lock_dir}_LOCK_FILE} was locked by another process; \ + ${ECHO_CMD} Leave lock file; \ ${_dparv_END_OUTPUT}; \ - } - + fi; \ + }' .endfor # _lock_dir in PKG_DBDIR .CURDIR .undef _parv_${_lock_dir}_LOCK_FILE Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 6 17:28:46 2012 (r237229) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 6 18:44:30 2012 (r237230) @@ -5123,6 +5123,7 @@ .if defined(${deptype}_DEPENDS) .if !defined(NO_DEPENDS) @depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ active_builds=""; \ echo "debugging_out_here: ------------------------- " > ${PORTSDIR}/tmp/log; \ echo "debugging_out_here: ALL DEPS - $${depends}" > ${PORTSDIR}/tmp/log; \ From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 04:52:57 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 BCFF3106567B for ; Thu, 7 Jun 2012 04:52:55 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 04:52:55 +0000 Date: Thu, 07 Jun 2012 04:52:55 +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: <20120607045255.BCFF3106567B@hub.freebsd.org> Cc: Subject: socsvn commit: r237241 - soc2012/jhagewood/mdocml 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, 07 Jun 2012 04:52:57 -0000 Author: jhagewood Date: Thu Jun 7 04:52:54 2012 New Revision: 237241 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237241 Log: Added: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch - copied unchanged from r237240, soc2012/jhagewood/mdocml/hagewood-mdocml.patch Deleted: soc2012/jhagewood/mdocml/hagewood-mdocml.patch Copied: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch (from r237240, soc2012/jhagewood/mdocml/hagewood-mdocml.patch) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Thu Jun 7 04:52:54 2012 (r237241, copy of r237240, soc2012/jhagewood/mdocml/hagewood-mdocml.patch) @@ -0,0 +1,61 @@ +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-04 23:30:15.000000000 -0400 +@@ -43,6 +43,8 @@ enum mant { + MAN_sp, + MAN_nf, + MAN_fi, ++ MAN_ns, ++ MAN_rs, + MAN_RE, + MAN_RS, + MAN_DT, +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-04 23:30:15.000000000 -0400 +@@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); + static int pre_ft(DECL_ARGS); + static int pre_ign(DECL_ARGS); + static int pre_in(DECL_ARGS); ++static int pre_ns(DECL_ARGS); ++static int pre_rs(DECL_ARGS); + static int pre_literal(DECL_ARGS); + static int pre_sp(DECL_ARGS); + +@@ -125,6 +127,8 @@ static const struct termact termacts[MAN + { pre_ign, NULL, 0 }, /* PD */ + { pre_ign, NULL, 0 }, /* AT */ + { pre_in, NULL, MAN_NOTEXT }, /* in */ ++ { pre_ns, NULL, MAN_NOTEXT }, /* ns */ ++ { pre_rs, NULL, MAN_NOTEXT }, /* rs */ + { pre_ft, NULL, MAN_NOTEXT }, /* ft */ + { pre_OP, NULL, 0 }, /* OP */ + }; +@@ -433,6 +437,27 @@ pre_in(DECL_ARGS) + return(0); + } + ++/* ARGSUSED */ ++static int ++pre_ns(DECL_ARGS) ++{ ++ ++ if ( ! (MAN_LINE & n->flags)) ++ p->flags |= TERMP_NOSPACE; ++ return(1); ++} ++ ++/* ARGSUSED */ ++static int ++pre_rs(DECL_ARGS) ++{ ++ /* ++ if (SEC_SEE_ALSO != n->sec) ++ return(1); ++ if (MAN_BLOCK == n->type && n->prev) ++ term_vspace(p); */ ++ return(1); ++} + + /* ARGSUSED */ + static int From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 05:10:51 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 A843D1065670 for ; Thu, 7 Jun 2012 05:10:49 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 05:10:49 +0000 Date: Thu, 07 Jun 2012 05:10:49 +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: <20120607051049.A843D1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237242 - soc2012/jhagewood/mdocml/mdocml-1.12.1 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, 07 Jun 2012 05:10:51 -0000 Author: jhagewood Date: Thu Jun 7 05:10:49 2012 New Revision: 237242 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237242 Log: Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h Thu Jun 7 05:10:49 2012 (r237242) @@ -43,8 +43,6 @@ MAN_sp, MAN_nf, MAN_fi, - MAN_ns, - MAN_rs, MAN_RE, MAN_RS, MAN_DT, Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c Thu Jun 7 05:10:49 2012 (r237242) @@ -82,8 +82,6 @@ static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); static int pre_in(DECL_ARGS); -static int pre_ns(DECL_ARGS); -static int pre_rs(DECL_ARGS); static int pre_literal(DECL_ARGS); static int pre_sp(DECL_ARGS); @@ -127,8 +125,6 @@ { pre_ign, NULL, 0 }, /* PD */ { pre_ign, NULL, 0 }, /* AT */ { pre_in, NULL, MAN_NOTEXT }, /* in */ - { pre_ns, NULL, MAN_NOTEXT }, /* ns */ - { pre_rs, NULL, MAN_NOTEXT }, /* rs */ { pre_ft, NULL, MAN_NOTEXT }, /* ft */ { pre_OP, NULL, 0 }, /* OP */ }; @@ -437,27 +433,6 @@ return(0); } -/* ARGSUSED */ -static int -pre_ns(DECL_ARGS) -{ - - if ( ! (MAN_LINE & n->flags)) - p->flags |= TERMP_NOSPACE; - return(1); -} - -/* ARGSUSED */ -static int -pre_rs(DECL_ARGS) -{ - /* - if (SEC_SEE_ALSO != n->sec) - return(1); - if (MAN_BLOCK == n->type && n->prev) - term_vspace(p); */ - return(1); -} /* ARGSUSED */ static int Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c Thu Jun 7 05:10:49 2012 (r237242) @@ -70,7 +70,7 @@ /* LINTED */ "Dx", "%Q", "br", "sp", /* LINTED */ - "%U", "Ta" + "ti", "%U", "Ta" }; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h Thu Jun 7 05:10:49 2012 (r237242) @@ -136,6 +136,7 @@ MDOC_En, MDOC_Dx, MDOC__Q, + MDOC_ti, MDOC_br, MDOC_sp, MDOC__U, Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c Thu Jun 7 05:10:49 2012 (r237242) @@ -264,6 +264,7 @@ { ARGSFL_NONE, NULL }, /* En */ { ARGSFL_NONE, NULL }, /* Dx */ { ARGSFL_NONE, NULL }, /* %Q */ + { ARGSFL_NONE, NULL }, /* ti */ { ARGSFL_NONE, NULL }, /* br */ { ARGSFL_NONE, NULL }, /* sp */ { ARGSFL_NONE, NULL }, /* %U */ Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c Thu Jun 7 05:10:49 2012 (r237242) @@ -188,6 +188,7 @@ { obsolete, 0 }, /* En */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */ { in_line_eoln, 0 }, /* %Q */ + { in_line_eoln, 0 }, /* ti */ { in_line_eoln, 0 }, /* br */ { in_line_eoln, 0 }, /* sp */ { in_line_eoln, 0 }, /* %U */ Modified: soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c ============================================================================== --- soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c Thu Jun 7 04:52:54 2012 (r237241) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c Thu Jun 7 05:10:49 2012 (r237242) @@ -115,6 +115,7 @@ static int termp_sm_pre(DECL_ARGS); static int termp_sp_pre(DECL_ARGS); static int termp_ss_pre(DECL_ARGS); +static int termp_ti_pre(DECL_ARGS); static int termp_under_pre(DECL_ARGS); static int termp_ud_pre(DECL_ARGS); static int termp_vt_pre(DECL_ARGS); @@ -240,6 +241,7 @@ { NULL, NULL }, /* En */ /* TODO */ { termp_xx_pre, NULL }, /* Dx */ { NULL, termp____post }, /* %Q */ + { termp_ti_pre, NULL } /* ti */ { termp_sp_pre, NULL }, /* br */ { termp_sp_pre, NULL }, /* sp */ { termp_under_pre, termp____post }, /* %U */ @@ -1816,6 +1818,10 @@ term_newln(p); } +static int +termp_ti_pre(DECL_ARGS) { + +} /* ARGSUSED */ static int From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 05:12:13 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 DF99B106564A for ; Thu, 7 Jun 2012 05:12:11 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 05:12:11 +0000 Date: Thu, 07 Jun 2012 05:12:11 +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: <20120607051211.DF99B106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237243 - soc2012/jhagewood/mdocml 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, 07 Jun 2012 05:12:14 -0000 Author: jhagewood Date: Thu Jun 7 05:12:11 2012 New Revision: 237243 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237243 Log: Added: soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch Added: soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch Thu Jun 7 05:12:11 2012 (r237243) @@ -0,0 +1,75 @@ +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c jhagewood/mdocml/mdocml-1.12.1/mdoc.c +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc.c 2012-06-07 04:44:06.000000000 -0400 +@@ -70,7 +70,7 @@ const char *const __mdoc_macronames[MDOC + /* LINTED */ + "Dx", "%Q", "br", "sp", + /* LINTED */ +- "%U", "Ta" ++ "ti", "%U", "Ta" + }; + + const char *const __mdoc_argnames[MDOC_ARG_MAX] = { +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h jhagewood/mdocml/mdocml-1.12.1/mdoc.h +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc.h 2012-06-07 04:44:25.000000000 -0400 +@@ -136,6 +136,7 @@ enum mdoct { + MDOC_En, + MDOC_Dx, + MDOC__Q, ++ MDOC_ti, + MDOC_br, + MDOC_sp, + MDOC__U, +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c 2012-06-07 04:44:51.000000000 -0400 +@@ -264,6 +264,7 @@ static const struct mdocarg mdocargs[MDO + { ARGSFL_NONE, NULL }, /* En */ + { ARGSFL_NONE, NULL }, /* Dx */ + { ARGSFL_NONE, NULL }, /* %Q */ ++ { ARGSFL_NONE, NULL }, /* ti */ + { ARGSFL_NONE, NULL }, /* br */ + { ARGSFL_NONE, NULL }, /* sp */ + { ARGSFL_NONE, NULL }, /* %U */ +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c 2012-06-07 04:51:20.000000000 -0400 +@@ -188,6 +188,7 @@ const struct mdoc_macro __mdoc_macros[MD + { obsolete, 0 }, /* En */ + { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */ + { in_line_eoln, 0 }, /* %Q */ ++ { in_line_eoln, 0 }, /* ti */ + { in_line_eoln, 0 }, /* br */ + { in_line_eoln, 0 }, /* sp */ + { in_line_eoln, 0 }, /* %U */ +diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c 2012-06-04 23:30:13.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c 2012-06-07 05:10:26.000000000 -0400 +@@ -115,6 +115,7 @@ static int termp_sh_pre(DECL_ARGS); + static int termp_sm_pre(DECL_ARGS); + static int termp_sp_pre(DECL_ARGS); + static int termp_ss_pre(DECL_ARGS); ++static int termp_ti_pre(DECL_ARGS); + static int termp_under_pre(DECL_ARGS); + static int termp_ud_pre(DECL_ARGS); + static int termp_vt_pre(DECL_ARGS); +@@ -240,6 +241,7 @@ static const struct termact termacts[MDO + { NULL, NULL }, /* En */ /* TODO */ + { termp_xx_pre, NULL }, /* Dx */ + { NULL, termp____post }, /* %Q */ ++ { termp_ti_pre, NULL } /* ti */ + { termp_sp_pre, NULL }, /* br */ + { termp_sp_pre, NULL }, /* sp */ + { termp_under_pre, termp____post }, /* %U */ +@@ -1816,6 +1818,10 @@ termp_ss_post(DECL_ARGS) + term_newln(p); + } + ++static int ++termp_ti_pre(DECL_ARGS) { ++ ++} + + /* ARGSUSED */ + static int From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 05:45: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 F3F841065677 for ; Thu, 7 Jun 2012 05:45:51 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 05:45:51 +0000 Date: Thu, 07 Jun 2012 05:45:51 +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: <20120607054551.F3F841065677@hub.freebsd.org> Cc: Subject: socsvn commit: r237244 - in soc2012/jhagewood: diff3 diff3/diff3 mdocml 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, 07 Jun 2012 05:45:54 -0000 Author: jhagewood Date: Thu Jun 7 05:45:50 2012 New Revision: 237244 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237244 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Thu Jun 7 05:12:11 2012 (r237243) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Thu Jun 7 05:45:50 2012 (r237244) @@ -638,7 +638,7 @@ while (ch != EOF) { fgetpos(f, &position); ch = fgetc(f); - if (ch == '\r' && fgetc(f) == EOF) { + if ((ch == '\r' || ch == '\n') && fgetc(f) == EOF) { tcr_pos = position; break; } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Thu Jun 7 05:12:11 2012 (r237243) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Thu Jun 7 05:45:50 2012 (r237244) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-05 01:41:11.000000000 -0400 +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-07 05:12:54.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-07 05:12:54.000000000 -0400 @@ -6,6 +6,6 @@ BINDIR= /usr/libexec beforeinstall: @@ -10,8 +10,8 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-04 23:30:11.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-05 20:49:10.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-07 05:12:54.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-07 05:45:37.000000000 -0400 @@ -82,6 +82,9 @@ /* diff3 - 3-way differential file comparison */ @@ -127,7 +127,7 @@ + while (ch != EOF) { + fgetpos(f, &position); + ch = fgetc(f); -+ if (ch == '\r' && fgetc(f) == EOF) { ++ if ((ch == '\r' || ch == '\n') && fgetc(f) == EOF) { + tcr_pos = position; + break; + } Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch Thu Jun 7 05:12:11 2012 (r237243) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ti.patch Thu Jun 7 05:45:50 2012 (r237244) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c jhagewood/mdocml/mdocml-1.12.1/mdoc.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c 2012-06-04 23:30:13.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc.c 2012-06-07 04:44:06.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c 2012-06-07 05:12:55.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc.c 2012-06-07 05:12:56.000000000 -0400 @@ -70,7 +70,7 @@ const char *const __mdoc_macronames[MDOC /* LINTED */ "Dx", "%Q", "br", "sp", @@ -11,8 +11,8 @@ const char *const __mdoc_argnames[MDOC_ARG_MAX] = { diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h jhagewood/mdocml/mdocml-1.12.1/mdoc.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h 2012-06-04 23:30:13.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc.h 2012-06-07 04:44:25.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h 2012-06-07 05:12:55.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc.h 2012-06-07 05:12:56.000000000 -0400 @@ -136,6 +136,7 @@ enum mdoct { MDOC_En, MDOC_Dx, @@ -22,8 +22,8 @@ MDOC_sp, MDOC__U, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c 2012-06-04 23:30:13.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c 2012-06-07 04:44:51.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c 2012-06-07 05:12:55.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c 2012-06-07 05:12:56.000000000 -0400 @@ -264,6 +264,7 @@ static const struct mdocarg mdocargs[MDO { ARGSFL_NONE, NULL }, /* En */ { ARGSFL_NONE, NULL }, /* Dx */ @@ -33,8 +33,8 @@ { ARGSFL_NONE, NULL }, /* sp */ { ARGSFL_NONE, NULL }, /* %U */ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c 2012-06-04 23:30:13.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c 2012-06-07 04:51:20.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c 2012-06-07 05:12:55.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c 2012-06-07 05:12:56.000000000 -0400 @@ -188,6 +188,7 @@ const struct mdoc_macro __mdoc_macros[MD { obsolete, 0 }, /* En */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */ @@ -44,8 +44,8 @@ { in_line_eoln, 0 }, /* sp */ { in_line_eoln, 0 }, /* %U */ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c 2012-06-04 23:30:13.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c 2012-06-07 05:10:26.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c 2012-06-07 05:12:55.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c 2012-06-07 05:12:56.000000000 -0400 @@ -115,6 +115,7 @@ static int termp_sh_pre(DECL_ARGS); static int termp_sm_pre(DECL_ARGS); static int termp_sp_pre(DECL_ARGS); From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 06:34: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 960A4106566B for ; Thu, 7 Jun 2012 06:34:20 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 06:34:20 +0000 Date: Thu, 07 Jun 2012 06:34:20 +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: <20120607063420.960A4106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237247 - 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: Thu, 07 Jun 2012 06:34:22 -0000 Author: gmiller Date: Thu Jun 7 06:34:19 2012 New Revision: 237247 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237247 Log: Implement _lock_profile_init(), _mutex_obtain_success(), and _mutex_obtain_failed(). Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_init.c 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_init.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_init.c Thu Jun 7 05:37:46 2012 (r237246) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_init.c Thu Jun 7 06:34:19 2012 (r237247) @@ -360,6 +360,8 @@ if (_thread_event_mask & TD_CREATE) _thr_report_creation(curthread, curthread); } + + INIT_LOCK_PROFILING(); } /* Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Thu Jun 7 05:37:46 2012 (r237246) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Thu Jun 7 06:34:19 2012 (r237247) @@ -106,6 +106,11 @@ # define STATIC_LIB_REQUIRE(name) __asm (".globl " #name) #endif +#define TIMESPEC_GT(left, right) \ + ((left)->tv_sec > (right)->tv_sec || \ + ((left)->tv_sec == (right)->tv_sec && \ + (left)->tv_nsec > (right)->tv_nsec)) + #define TIMESPEC_ADD(dst, src, val) \ do { \ (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \ @@ -735,7 +740,7 @@ */ __BEGIN_DECLS int _thr_setthreaded(int) __hidden; -int _mutex_cv_lock(struct pthread_mutex *, int count _PROFILE_PARMS) \ +int _mutex_cv_lock(struct pthread_mutex *, int count _PROFILE_PARMS) __hidden; int _mutex_cv_unlock(struct pthread_mutex *, int *count) __hidden; int _mutex_cv_attach(struct pthread_mutex *, int count) __hidden; @@ -743,40 +748,33 @@ 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 _mutex_obtain_failed(struct pthread_mutex *, - struct timespec *waittime, const char *, int) +void _mutex_obtain_failed(struct pthread_mutex *, struct timespec *waittime) __hidden; void _mutex_obtain_success(struct pthread_mutex *, struct timespec *waittime, const char *, int) __hidden; +void _lock_profile_init(void) __hidden; void _lock_profile_exit_thread(struct pthread *curthread) __hidden; void _rwlock_obtain_read_success(struct pthread_rwlock *, - struct timespec *waittime, - const char *file, int line) - __hidden; + struct timespec *waittime, + const char *file, int line) __hidden; void _rwlock_obtain_read_failed(struct pthread_rwlock *, - struct timespec *waittime, - const char *file, int line) - __hidden; + struct timespec *waittime) __hidden; void _rwlock_obtain_write_success(struct pthread_rwlock *, - struct timespec *waittime, - const char *file, int line) - __hidden; + struct timespec *waittime, + const char *file, int line) __hidden; void _rwlock_obtain_write_failed(struct pthread_rwlock *, - struct timespec *waittime, - const char *file, int line) - __hidden; + struct timespec *waittime) __hidden; void _rwlock_release_read(struct pthread_rwlock *, struct timespec *) - __hidden; + __hidden; void _rwlock_release_write(struct pthread_rwlock *, struct timespec *) __hidden; void _mutex_release(struct pthread_mutex *, struct timespec *) __hidden; void _spin_obtain_success(struct pthread_spinlock *, - struct timespec *waittime, - const char *file, int line) __hidden; + struct timespec *waittime, + const char *file, int line) __hidden; void _spin_obtain_failed(struct pthread_spinlock *, - struct timespec *waittime, - const char *file, int line) __hidden; + struct timespec *waittime) __hidden; void _spin_release(struct pthread_spinlock *, struct timespec *) __hidden; void _libpthread_init(struct pthread *) __hidden; struct pthread *_thr_alloc(struct pthread *) __hidden; @@ -823,9 +821,9 @@ void _thr_signal_postfork_child(void) __hidden; void _thr_try_gc(struct pthread *, struct pthread *) __hidden; int _rtp_to_schedparam(const struct rtprio *rtp, int *policy, - struct sched_param *param) __hidden; + struct sched_param *param) __hidden; int _schedparam_to_rtp(int policy, const struct sched_param *param, - struct rtprio *rtp) __hidden; + struct rtprio *rtp) __hidden; void _thread_bp_create(void); void _thread_bp_death(void); int _sched_yield(void); @@ -838,32 +836,35 @@ #ifdef LOCK_PROFILING +#define INIT_LOCK_PROFILING() \ + _lock_profile_init() #define LOCK_PROFILE_EXIT_THREAD(t) \ _lock_profile_exit_thread(t) #define MUTEX_OBTAIN_SUCCESS(m, ts) \ _mutex_obtain_success(m, ts, file, line) #define MUTEX_OBTAIN_FAILED(m, ts) \ - _mutex_obtain_failed(m, ts, file, line) + _mutex_obtain_failed(m, ts) #define MUTEX_RELEASE(m, ts) _mutex_release(m, ts) #define RWLOCK_OBTAIN_READ_SUCCESS(l, ts) \ _rwlock_obtain_read_success(l, ts, file, line) #define RWLOCK_OBTAIN_READ_FAILED(l, ts) \ - _rwlock_obtain_read_failed(l, ts, file, line) + _rwlock_obtain_read_failed(l, ts) #define RWLOCK_OBTAIN_WRITE_SUCCESS(l, ts) \ _rwlock_obtain_write_success(l, ts, file, line) #define RWLOCK_OBTAIN_WRITE_FAILED(l, ts) \ - _rwlock_obtain_write_failed(l, ts, file, line) + _rwlock_obtain_write_failed(l, ts) #define RWLOCK_RELEASE_READ(l, ts) _rwlock_release_read(l, ts) #define RWLOCK_RELEASE_WRITE(l, ts) _rwlock_release_write(l, ts) #define SPIN_OBTAIN_SUCCESS(s, ts) \ _spin_obtain_success(s, ts, file, line) #define SPIN_OBTAIN_FAILED(s, ts) \ - _spin_obtain_failed(s, ts, file, line) + _spin_obtain_failed(s, ts) #define SPIN_RELEASE(s, ts) \ _spin_release(s, ts) #else +#define INIT_LOCK_PROFILING() do { } while (0) #define LOCK_PROFILE_EXIT_THREAD(t) do { } while (0) #define MUTEX_OBTAIN_SUCCESS(m, ts) do { } while (0) #define MUTEX_OBTAIN_FAILED(m, ts) do { } while (0) Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Thu Jun 7 05:37:46 2012 (r237246) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Thu Jun 7 06:34:19 2012 (r237247) @@ -28,26 +28,40 @@ #ifdef LOCK_PROFILING #include +#include #include "thr_private.h" #define LOCK_PROF_HASH_SIZE (4096) -struct lock_acquisition { +struct acquisition { const char *file; int line; - SLIST_ENTRY(lock_acquisition) acq_next; + struct timespec acq_time; + int count; + int ref; + struct timespec waittime; + SLIST_ENTRY(acquisition) acq_next; }; -SLIST_HEAD(acq_head, lock_acquisition); +SLIST_HEAD(acq_head, acquisition); struct acq_head mutex_hash[LOCK_PROF_HASH_SIZE]; -static struct lock_acquisition * +void _lock_profile_init() +{ + int i; + + for (i = 0; i < LOCK_PROF_HASH_SIZE; i++) { + SLIST_INIT(&mutex_hash[i]); + } +} + +static struct acquisition * mutex_lookup(struct pthread_mutex *m, const char *file, int line) { u_int hash; - struct lock_acquisition *acq; + struct acquisition *acq; hash = ((uintptr_t)file * 31 + line) & (LOCK_PROF_HASH_SIZE - 1); @@ -57,7 +71,7 @@ } } - acq = malloc(sizeof(struct lock_acquisition)); + acq = malloc(sizeof(struct acquisition)); acq->file = file; acq->line = line; @@ -70,13 +84,37 @@ _mutex_obtain_success(struct pthread_mutex *m, struct timespec *waittime, const char *file, int line) { - mutex_lookup(m, file, line); + struct pthread *curthread = _get_curthread(); + struct acquisition *acq; + + THR_CRITICAL_ENTER(curthread); + + acq = mutex_lookup(m, file, line); + if (acq != NULL) { + acq->count++; + acq->ref++; + if (acq->ref == 1) { + clock_gettime(CLOCK_REALTIME, &acq->acq_time); + if (waittime->tv_sec != 0 || waittime->tv_nsec != 0) { + if (TIMESPEC_GT(&acq->acq_time, waittime)) { + TIMESPEC_SUB(&acq->waittime, + &acq->acq_time, &acq->acq_time); + } + } else { + bzero(&acq->waittime, sizeof(acq->waittime)); + } + } + } + + THR_CRITICAL_LEAVE(curthread); } void -_mutex_obtain_failed(struct pthread_mutex *m, struct timespec *waittime, - const char *file, int line) +_mutex_obtain_failed(struct pthread_mutex *m, struct timespec *waittime) { + if (waittime->tv_sec == 0 && waittime->tv_nsec == 0) { + clock_gettime(CLOCK_REALTIME, waittime); + } } void @@ -97,9 +135,7 @@ } void -_rwlock_obtain_read_failed(struct pthread_rwlock *l, - struct timespec *waittime, const char *file, - int line) +_rwlock_obtain_read_failed(struct pthread_rwlock *l, struct timespec *waittime) { } @@ -112,8 +148,7 @@ void _rwlock_obtain_write_failed(struct pthread_rwlock *l, - struct timespec *watitime, const char *file, - int line) + struct timespec *watitime) { } @@ -134,8 +169,7 @@ } void -_spin_obtain_failed(struct pthread_spinlock *s, struct timespec *waittime, - const char *file, int line) +_spin_obtain_failed(struct pthread_spinlock *s, struct timespec *waittime) { } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 11:30: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 506FA1065672 for ; Thu, 7 Jun 2012 11:30:19 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 11:30:19 +0000 Date: Thu, 07 Jun 2012 11:30:19 +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: <20120607113019.506FA1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r237258 - soc2012/gpf/pefs_kmod/sys/fs/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: Thu, 07 Jun 2012 11:30:21 -0000 Author: gpf Date: Thu Jun 7 11:30:17 2012 New Revision: 237258 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237258 Log: - avoid messing with lower vp locks. - use vput to node acquired from lookup() to get rid of that reference counter as well Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu Jun 7 10:53:42 2012 (r237257) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu Jun 7 11:30:17 2012 (r237258) @@ -2362,7 +2362,7 @@ u_quad_t fsize; struct vnode *vp = ap->a_vp; struct vnode *lvp = PEFS_LOWERVP(vp); - struct vnode *svp; + struct vnode *svp, *slvp; struct pefs_xkey *xk = ap->a_data; struct pefs_xnamecsum *xncs = ap->a_data; struct pefs_xsector_ctext *xsct = ap->a_data; @@ -2512,10 +2512,8 @@ pefs_chunk_create(&pc, pn, xsct->pxsct_ctext_len); puio = pefs_chunk_uio(&pc, xsct->pxsct_offset, UIO_READ); - /* XXXgpf: is this lock really necessary? */ - vn_lock(lvp, LK_EXCLUSIVE); + error = VOP_READ(lvp, puio, IO_UNIT | IO_NODELOCKED, cred); - VOP_UNLOCK(lvp, 0); if (error == 0) memcpy(xsct->pxsct_ctext, pc.pc_base, xsct->pxsct_ctext_len); @@ -2633,28 +2631,25 @@ if (svp->v_type != VLNK) { printf("pefs_ioctl: PEFS_GETSLINKCTEXT svp is not a symlink '/'\n"); - VOP_UNLOCK(svp, 0); + vput(svp); VOP_UNLOCK(vp, 0); return (EINVAL); } /* VOP_READLINK our lvp */ - lvp = PEFS_LOWERVP(svp); + slvp = PEFS_LOWERVP(svp); pn = VP_TO_PN(svp); pefs_chunk_create(&pc, pn, MAXPATHLEN); puio = pefs_chunk_uio(&pc, 0, UIO_READ); - /* XXXgpf: is this lock really necessary? */ - vn_lock(lvp, LK_EXCLUSIVE); - error = VOP_READLINK(lvp, puio, cred); - VOP_UNLOCK(lvp, 0); + error = VOP_READLINK(slvp, puio, cred); xsl->pxsl_slink_len = pc.pc_size - pc.pc_uio.uio_resid; if (error == 0) memcpy(xsl->pxsl_slink, pc.pc_base, xsl->pxsl_slink_len); pefs_chunk_free(&pc, pn); - VOP_UNLOCK(svp, 0); + vput(svp); VOP_UNLOCK(vp, 0); break; default: From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 11:32:11 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 BB349106566B for ; Thu, 7 Jun 2012 11:32:09 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 11:32:09 +0000 Date: Thu, 07 Jun 2012 11:32:09 +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: <20120607113209.BB349106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237259 - soc2012/gpf/pefs_kmod/sys/fs/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: Thu, 07 Jun 2012 11:32:12 -0000 Author: gpf Date: Thu Jun 7 11:32:09 2012 New Revision: 237259 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237259 Log: -get rid of the xxx comment Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu Jun 7 11:30:17 2012 (r237258) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu Jun 7 11:32:09 2012 (r237259) @@ -2618,10 +2618,6 @@ cn.cn_pnbuf = NULL; cn.cn_consume = 0; - /* - * XXXgpf: if lookup succeeds, it should(?) raise reference count for svp - * by one, therefore a vrele is needed before we return? For both svp & lvp? - */ error = pefs_lookup(&la); if (error != 0) { printf("pefs_ioctl: PEFS_GETSLINKCTEXT lookup error %d", error); From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 12:46:36 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 566D2106564A for ; Thu, 7 Jun 2012 12:46:34 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 12:46:34 +0000 Date: Thu, 07 Jun 2012 12:46:34 +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: <20120607124634.566D2106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237260 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/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: Thu, 07 Jun 2012 12:46:36 -0000 Author: gpf Date: Thu Jun 7 12:46:33 2012 New Revision: 237260 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237260 Log: few minor changes: - read input from stdin by default if inputfile [-f] is not supplied - remove read_counts() and place counter in next_file(). With cuckoo hash, we populate/allocate hash tables after all entries are read/parsed. - make use of cuckoo_lookup() in cuckoo_insert for collision checks instead of doing them by hand. - properly return according to what cuckoo_insert() returns - clearer errors in some cases - update some comments Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu Jun 7 11:32:09 2012 (r237259) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu Jun 7 12:46:33 2012 (r237260) @@ -55,7 +55,7 @@ #include "pefs_ctl.h" -//#define PEFS_INTEGRITY_DEBUG +#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -261,7 +261,7 @@ } if (S_ISLNK(sb.st_mode) != 0) - return(pefs_compute_symlink_checksum(fhp, md, hash_len)); + return (pefs_compute_symlink_checksum(fhp, md, hash_len)); resid = sb.st_size; if (resid == 0) { @@ -298,9 +298,9 @@ EVP_DigestUpdate(&mdctx, xsct.pxsct_ctext, xsct.pxsct_ctext_len); dprintf(("read %d bytes from kernel\n\n", bytes_to_read)); - //dprintf(("printing contents of buffer:")); - //for (i=0; i < (int)bytes_to_read; i++) dprintf(("%c", xsct.pxsct_ctext[i])); - //dprintf(("!\n")); + dprintf(("printing contents of buffer:")); + for (i=0; i < (int)bytes_to_read; i++) dprintf(("%c", xsct.pxsct_ctext[i])); + dprintf(("!\n")); csp = malloc(sizeof(struct checksum)); if (csp == NULL) { @@ -332,38 +332,6 @@ return (0); } -static int -pefs_count_file_entries(FILE *fpin, uint32_t *nelementsp) -{ - char buf[MAXPATHLEN + 1]; - uint32_t nfiles; - - nfiles = 0; - - while (fgets(buf, sizeof(buf), fpin) != NULL) { - if (nfiles + 1 < nfiles) { - pefs_warn("numeric overflow while counting file entries"); - return (PEFS_ERR_GENERIC); - } - nfiles++; - } - - if (feof(fpin) == 0) { - warn("error reading input"); - return (PEFS_ERR_IO); - } - - if (nfiles == 0) { - pefs_warn("input file has no entries"); - return (PEFS_ERR_INVALID); - } - - fseek(fpin, 0, SEEK_SET); - *nelementsp = nfiles; - - return (0); -} - static void pefs_init_hash_table(struct cuckoo_hash_table *chtp) { @@ -521,31 +489,18 @@ pefs_cuckoo_insert(struct cuckoo_hash_table *chtp, struct file_header *fhp) { - struct file_header *elem, *elem1, *elem2; + struct file_header *elem, *elem1, *elem2, *res; uint32_t i, max_tries, pos1, pos2; max_tries = chtp->size; elem = fhp; /* file_id collision check */ - pos1 = pefs_hash1(chtp, elem); - elem1 = chtp->buckets1[pos1].fhp; - pos2 = pefs_hash2(chtp, elem); - elem2 = chtp->buckets2[pos2].fhp; - if (elem1 != NULL) { - if (elem1->file_id == fhp->file_id) { - pefs_warn("file identifier collision detected between files: %s & %s", - fhp->path, elem1->path); - return (PEFS_ERR_EXIST); - } - } - - if (elem2 != NULL) { - if (elem2->file_id == fhp->file_id) { - pefs_warn("file identifier collision detected between files: %s & %s", - fhp->path, elem2->path); - return (PEFS_ERR_EXIST); - } + res = pefs_cuckoo_lookup(chtp, elem); + if (res != NULL) { + pefs_warn("file identifier collision detected between files: %s & %s", + res->path, elem->path); + return (PEFS_ERR_EXIST); } for (i = 0; i < max_tries; i++) { @@ -671,12 +626,9 @@ return (error); } -// XXXgpf: void? static void -pefs_symlink_warn(struct cuckoo_hash_table *chtp, struct file_header_head *fhhp, - struct statfs *fsp) +pefs_symlink_warn(struct cuckoo_hash_table *chtp, struct file_header_head *fhhp) { - struct statfs this_fs; struct stat sb; struct file_header targetfh; struct file_header *fhp, *res; @@ -684,20 +636,17 @@ TAILQ_FOREACH(fhp, fhhp, file_header_entries) { /* - * If fhp == symlink and target file resides in pefs filesystem and - * target file == regular file || symlink, then grab target's filename MAC and - * look it up in our hash table. Print a warning message if it is not found. + * If fhp == symlink and target file == regular file || symlink, + * then grab target's filename MAC and look it up in our hash table. + * Print a warning message if it is not found. + * symlink target referes to the file that is immediately pointed to by + * our symlink. therefore in a syml1->syml2->file example, we only check + * syml2 if we are supplied syml1. This is by choise so that user will + * receive warning for intermediate parts of a symlink chain. + * + * XXXgpf: perhaps relax restrictions on warning messages */ if (fhp->target_path != NULL) { - if (statfs(fhp->target_path, &this_fs) == -1) { - pefs_warn("statfs failed: %s: %s", fhp->target_path, strerror(errno)); - continue; - } - - if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || - (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) - continue; - if (lstat(fhp->target_path, &sb) != 0) { warn("cannot stat file %s", fhp->target_path); continue; @@ -826,8 +775,10 @@ * in input file-list, since symlinks are not traversed. User will have to * provide fullpaths for both symlink & target file if he wants integrity * checking for both. However, we will print warning messages in case - * target file does reside in pefs filesystem but is not provided in - * user supplied input list. + * target file is not provided in user supplied input list. + * + * Target referes to the file immediately pointed to by our symlink, not + * the final target of a possible symlink chain. */ target_path_size = MAXPATHLEN; fhp->target_path = malloc(target_path_size); @@ -853,7 +804,7 @@ /* * The only semantic check that is performed on target file is an attempt - * to stat() the file, in order to make sure the file exists. This is + * to lstat() the file, in order to make sure the file exists. This is * intentional since target file is allowed to reside on a different * filesystem or in the same filesystem, but not be a regular file or a * symlink. @@ -902,7 +853,7 @@ } static struct file_header * -pefs_next_file(FILE *fpin, int *error) +pefs_next_file(FILE *fpin, int *error, int *nfiles) { char buf[MAXPATHLEN + 1]; struct file_header *fhp; @@ -929,6 +880,7 @@ } strlcpy(fhp->path, buf, sizeof(fhp->path)); + (*nfiles)++; return (fhp); } @@ -968,22 +920,15 @@ int error; uint32_t nfiles; + nfiles = 0; if (statfs(fsroot, &fs) == -1) { pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); return (PEFS_ERR_SYS); } - error = pefs_count_file_entries(fpin, &nfiles); - if (error != 0) - return (error); - - error = pefs_allocate_hash_table(chtp, nfiles, 0); - if (error != 0) - return (error); - TAILQ_INIT(&fh_head); RB_INIT(&hlc_head); - while((fhp = pefs_next_file(fpin, &error)) != NULL) { + while((fhp = pefs_next_file(fpin, &error, &nfiles)) != NULL) { error = pefs_file_semantic_checks(fhp, &fs, &hlc_head); if (error != 0) return (error); @@ -1006,15 +951,22 @@ pefs_rb_print(&hlc_head); pefs_rb_warn(&hlc_head); + error = pefs_allocate_hash_table(chtp, nfiles, 0); + if (error != 0) + return (error); + cuckoo_insert: TAILQ_FOREACH(fhp, &fh_head, file_header_entries) { error = pefs_add_to_hash_table(chtp, fhp); + /* collision error */ + if (error == PEFS_ERR_EXIST) + return (error); /* * cuckoo insertion algorithm fell into an infinite loop! * Create new, larger hash tables where size = next_prime(old_size) * and try again. */ - if (error != 0) { + else if (error != 0) { dprintf(("fell into an infinite loop!\n")); error = pefs_allocate_hash_table(chtp, nfiles, 1); if (error != 0) @@ -1023,7 +975,7 @@ } } pefs_print_hash_table(chtp, hash_len); - pefs_symlink_warn(chtp, &fh_head, &fs); + pefs_symlink_warn(chtp, &fh_head); return (error); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Thu Jun 7 11:32:09 2012 (r237259) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Thu Jun 7 12:46:33 2012 (r237260) @@ -1011,8 +1011,8 @@ * hash function; supported algorithms: sha256, sha512. sha256 is * used by default. * - * inputfile contains list of files that need integrity checking. An - * inputfile must be supplied. + * inputfile contains list of files that need integrity checking. If + * the argument is not supplied, input is read from stdin by default. * * path defines where .pefs.checksum should be created. By default, * .pefs.checksum is created under $PWD. path should be a directory, @@ -1032,13 +1032,7 @@ int error, i, j; const char *algo; - /* - * XXXgpf: [TODO] Now, all input file entries are kept in a 'global' tail structure - * and insertion into hash table occurs after all of them are read/parsed. Therefore, - * it is possible to have fpin = stdin by default and not require an input file, since - * we will not have to go through the input list twice, thus requiring a rewind(). - */ - fpin = NULL; + fpin = stdin; /* by default use sha256 */ algo = supported_digests[0]; /* by default create checksum file under $PWD */ @@ -1093,11 +1087,6 @@ argc -= optind; argv += optind; - if (fpin == NULL) { - pefs_warn("please supply an input file [-i]"); - return (PEFS_ERR_USAGE); - } - initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); error = pefs_create_checksum_file(fpin, fsroot, csm_path, algo); Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu Jun 7 11:32:09 2012 (r237259) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu Jun 7 12:46:33 2012 (r237260) @@ -2512,7 +2512,6 @@ pefs_chunk_create(&pc, pn, xsct->pxsct_ctext_len); puio = pefs_chunk_uio(&pc, xsct->pxsct_offset, UIO_READ); - error = VOP_READ(lvp, puio, IO_UNIT | IO_NODELOCKED, cred); if (error == 0) @@ -2527,7 +2526,7 @@ if (vp->v_type != VDIR) { printf("pefs_ioctl: PEFS_GETNAMEMAC vp is not a directory\n"); VOP_UNLOCK(vp, 0); - return (EINVAL); + return (ENOTDIR); } if (strnlen(xncs->pxnc_filename, sizeof(xncs->pxnc_filename)) != @@ -2587,7 +2586,7 @@ if (vp->v_type != VDIR) { printf("pefs_ioctl: PEFS_GETSLINKCTEXT vp is not a directory\n"); VOP_UNLOCK(vp, 0); - return (EINVAL); + return (ENOTDIR); } if (strnlen(xsl->pxsl_filename, sizeof(xsl->pxsl_filename)) != @@ -2618,21 +2617,22 @@ cn.cn_pnbuf = NULL; cn.cn_consume = 0; + /* XXXgpf: gleb says that maybe using namei() would be better */ error = pefs_lookup(&la); if (error != 0) { printf("pefs_ioctl: PEFS_GETSLINKCTEXT lookup error %d", error); VOP_UNLOCK(vp, 0); - return (EINVAL); + return (error); } if (svp->v_type != VLNK) { printf("pefs_ioctl: PEFS_GETSLINKCTEXT svp is not a symlink '/'\n"); vput(svp); VOP_UNLOCK(vp, 0); - return (EINVAL); + return (EFTYPE); } - /* VOP_READLINK our lvp */ + /* VOP_READLINK our slvp */ slvp = PEFS_LOWERVP(svp); pn = VP_TO_PN(svp); pefs_chunk_create(&pc, pn, MAXPATHLEN); From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 15:08: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 4B041106564A for ; Thu, 7 Jun 2012 15:08:05 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 15:08:05 +0000 Date: Thu, 07 Jun 2012 15:08:05 +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: <20120607150805.4B041106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237264 - 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: Thu, 07 Jun 2012 15:08:07 -0000 Author: gpf Date: Thu Jun 7 15:08:05 2012 New Revision: 237264 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237264 Log: - use dirname/basename instead of homegrown solution - open(2) fhp->path as well as fhp->dirpath of parent dir so as to eliminate most race conditions. file descriptors are kept in struct file_header. This is done alongside semantic checks for each file in the now renamed pefs_open_semantic_check(). Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu Jun 7 14:38:43 2012 (r237263) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu Jun 7 15:08:05 2012 (r237264) @@ -28,6 +28,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -84,8 +86,6 @@ RB_ENTRY(hardlink_counter) hardlink_entries; }; -/* XXXgpf: [TODO] check pathname string lengths. Some are MAXPATHLEN + 1, some MAXPATHLEN */ - /* XXXgpf: unions for on disk structs and move to a different header? */ struct checksum_file_header { uint8_t version; @@ -105,9 +105,12 @@ struct file_header { uint32_t nhashes; uint64_t file_id; - char path[MAXPATHLEN]; + char path[MAXPATHLEN + 1]; + char dirpath[MAXPATHLEN + 1]; + char filename[MAXNAMLEN + 1]; char *target_path; uint32_t offset_to_checksums; + int fd, pfd; struct checksum_head checksums; TAILQ_ENTRY(file_header) file_header_entries; TAILQ_ENTRY(file_header) fh_hardlink_entries; @@ -165,41 +168,34 @@ return 0; } +static void +pefs_close_file(struct file_header *fhp) +{ + if (fhp->fd >= 0) + close(fhp->fd); + if (fhp->pfd >= 0) + close(fhp->pfd); +} + static int pefs_compute_symlink_checksum(struct file_header *fhp, const EVP_MD *md, uint8_t hash_len) { struct pefs_xslink_ctext xsl; - char parent_dir[MAXPATHLEN]; EVP_MD_CTX mdctx; - int error, i, fd, md_len; + int error, i, md_len; struct checksum *csp; - char *pch; + TAILQ_INIT(&(fhp->checksums)); fhp->nhashes = 0; /* feed parent directory to ioctl() */ - strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); - pch = strrchr(parent_dir, '/'); - if (pch == NULL) { - pefs_warn("error retrieving parent dir of %s", fhp->path); - return (PEFS_ERR_NOENT); - } - *pch = '\0'; - - strlcpy(xsl.pxsl_filename, pch + 1, sizeof(xsl.pxsl_filename)); + strlcpy(xsl.pxsl_filename, fhp->filename, sizeof(xsl.pxsl_filename)); xsl.pxsl_namelen = strnlen(xsl.pxsl_filename, sizeof(xsl.pxsl_filename)); - fd = open(parent_dir, O_RDONLY); - if (fd < 0) { - warn("failed to open file: %s", parent_dir); - return (PEFS_ERR_IO); - } - - error = ioctl(fd, PEFS_GETSLINKCTEXT, &xsl); + error = ioctl(fhp->pfd, PEFS_GETSLINKCTEXT, &xsl); if (error != 0) { pefs_warn("error retrieving symlink's ciphertext of %s", fhp->path); - close(fd); return (PEFS_ERR_IO); } @@ -215,14 +211,12 @@ csp = malloc(sizeof(struct checksum)); if (csp == NULL) { pefs_warn("memory allocation error"); - close(fd); return (PEFS_ERR_SYS); } csp->hash = malloc(hash_len); if (csp->hash == NULL) { pefs_warn("memory allocation error"); free(csp); - close(fd); return (PEFS_ERR_SYS); } @@ -236,7 +230,6 @@ TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); fhp->nhashes++; - close(fd); return (0); } @@ -249,32 +242,26 @@ struct stat sb; off_t resid; uint32_t bytes_to_read; - int error, i, fd, md_len; + int error, i, md_len; struct checksum *csp; + if (fhp->target_path != NULL) + return (pefs_compute_symlink_checksum(fhp, md, hash_len)); + TAILQ_INIT(&(fhp->checksums)); /* XXXgpf: what happens if file size > 2^64? */ - if (lstat(fhp->path, &sb) != 0) { + if (fstat(fhp->fd, &sb) != 0) { warn("cannot stat file %s", fhp->path); return (PEFS_ERR_SYS); } - if (S_ISLNK(sb.st_mode) != 0) - return (pefs_compute_symlink_checksum(fhp, md, hash_len)); - resid = sb.st_size; if (resid == 0) { pefs_warn("empty files are not allowed: %s", fhp->path); return (PEFS_ERR_INVALID); } - fd = open(fhp->path, O_RDONLY | O_NOFOLLOW); - if (fd < 0) { - warn("failed to open file: %s", fhp->path); - return (PEFS_ERR_IO); - } - fhp->nhashes = 0; xsct.pxsct_offset = 0; while (resid > 0) { @@ -285,10 +272,9 @@ resid-=bytes_to_read; xsct.pxsct_ctext_len = bytes_to_read; - error = ioctl(fd, PEFS_GETSECTORCTEXT, &xsct); + error = ioctl(fhp->fd, PEFS_GETSECTORCTEXT, &xsct); if (error != 0) { pefs_warn("error retrieving ciphertext of %s", fhp->path); - close(fd); return (PEFS_ERR_IO); } xsct.pxsct_offset+= xsct.pxsct_ctext_len; @@ -305,14 +291,12 @@ csp = malloc(sizeof(struct checksum)); if (csp == NULL) { pefs_warn("memory allocation error"); - close(fd); return (PEFS_ERR_SYS); } csp->hash = malloc(hash_len); if (csp->hash == NULL) { pefs_warn("memory allocation error"); free(csp); - close(fd); return (PEFS_ERR_SYS); } @@ -328,7 +312,6 @@ fhp->nhashes++; } - close(fd); return (0); } @@ -586,33 +569,15 @@ static int pefs_get_file_id(struct file_header *fhp) { - char parent_dir[MAXPATHLEN]; struct pefs_xnamecsum xncs; - char *pch; uint64_t temp; - int error, fd; - - /* feed parent directory to ioctl() */ - strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); - pch = strrchr(parent_dir, '/'); - if (pch == NULL) { - pefs_warn("error retrieving parent dir of %s", fhp->path); - return (PEFS_ERR_NOENT); - } - *pch = '\0'; - - fd = open(parent_dir, O_RDONLY); - if (fd < 0) { - warn("unable to open file %s", parent_dir); - return (PEFS_ERR_SYS); - } + int error; - pch = strrchr(fhp->path, '/'); - pch++; - strlcpy(xncs.pxnc_filename, pch, sizeof(xncs.pxnc_filename)); + strlcpy(xncs.pxnc_filename, fhp->filename, sizeof(xncs.pxnc_filename)); xncs.pxnc_namelen = strnlen(xncs.pxnc_filename, sizeof(xncs.pxnc_filename)); - error = ioctl(fd, PEFS_GETNAMECSUM, &xncs); + /* feed parent directory to ioctl() */ + error = ioctl(fhp->pfd, PEFS_GETNAMECSUM, &xncs); if (error == 0) { /* XXXgpf: Is this correct? */ @@ -622,7 +587,6 @@ else pefs_warn("failed to fetch file id from kernel"); - close(fd); return (error); } @@ -631,7 +595,9 @@ { struct stat sb; struct file_header targetfh; + char dirbuf[MAXPATHLEN + 1], namebuf[MAXNAMLEN + 1]; struct file_header *fhp, *res; + char *dirnamep, *namep; int error; TAILQ_FOREACH(fhp, fhhp, file_header_entries) { @@ -655,7 +621,32 @@ if (S_ISLNK(sb.st_mode) == 0 && S_ISREG(sb.st_mode) == 0) continue; + /* retrieve dirpath & filaname */ strlcpy(targetfh.path, fhp->target_path, sizeof(targetfh.path)); + strlcpy(dirbuf, targetfh.path, sizeof(dirbuf)); + strlcpy(namebuf, targetfh.path, sizeof(namebuf)); + + dirnamep = dirname(dirbuf); + if (dirnamep == NULL) { + pefs_warn("failed to extract dirname of %s", targetfh.path); + continue; + } + strlcpy(targetfh.dirpath, dirnamep, sizeof(targetfh.dirpath)); + + namep = basename(namebuf); + if (namep == NULL) { + pefs_warn("failed to extract filename of %s", targetfh.path); + continue; + } + strlcpy(targetfh.filename, namep, sizeof(targetfh.filename)); + + targetfh.pfd = -1; + targetfh.pfd = open(targetfh.dirpath, O_RDONLY); + if (targetfh.pfd < 0) { + warn("cannot open %s", targetfh.dirpath); + continue; + } + error = pefs_get_file_id(&targetfh); if (error == 0) { res = pefs_cuckoo_lookup(chtp, &targetfh); @@ -663,6 +654,7 @@ pefs_warn("target file %s of symlink %s was not found in inputlist", targetfh.path, fhp->path); } + pefs_close_file(&targetfh); } } } @@ -746,16 +738,41 @@ } static int -pefs_file_semantic_checks(struct file_header *fhp, struct statfs *fsp, struct hardlink_head *hlc_headp) +pefs_open_semantic_checks(struct file_header *fhp, struct statfs *fsp, struct hardlink_head *hlc_headp) { - char parent_dir[MAXPATHLEN]; - char sbuf[MAXPATHLEN]; + char dirbuf[MAXPATHLEN + 1], namebuf[MAXNAMLEN + 1]; + char sbuf[MAXPATHLEN + 1]; struct stat sb; struct statfs this_fs; - char *pch; + char *dirnamep, *namep; size_t target_path_size; int nchars; + /* initialize file descriptors in case error occurs */ + fhp->fd = -1; + fhp->pfd = -1; + + /* retrieve dirpath & filename */ + strlcpy(dirbuf, fhp->path, sizeof(dirbuf)); + strlcpy(namebuf, fhp->path, sizeof(namebuf)); + + dirnamep = dirname(dirbuf); + if (dirnamep == NULL) { + pefs_warn("failed to extract dirname of %s", fhp->path); + return (PEFS_ERR_GENERIC); + } + strlcpy(fhp->dirpath, dirnamep, sizeof(fhp->dirpath)); + + + namep = basename(namebuf); + if (namep == NULL) { + pefs_warn("failed to extract filename of %s", fhp->path); + return (PEFS_ERR_GENERIC); + } + strlcpy(fhp->filename, namep, sizeof(fhp->filename)); + + dprintf(("path = %s!\ndirname = %s!\nbasename =%s!\n", fhp->path, fhp->dirpath, fhp->filename)); + if (lstat(fhp->path, &sb) != 0) { warn("cannot stat file %s", fhp->path); return (PEFS_ERR_SYS); @@ -764,6 +781,12 @@ if (S_ISLNK(sb.st_mode) != 0) { fhp->target_path = NULL; + fhp->pfd = open(fhp->dirpath, O_RDONLY); + if (fhp->pfd < 0) { + warn("cannot open %s", fhp->dirpath); + return (PEFS_ERR_IO); + } + nchars = readlink(fhp->path, sbuf, sizeof(sbuf)); if (nchars == -1) { warn("readlink failed: %s", fhp->path); @@ -780,25 +803,17 @@ * Target referes to the file immediately pointed to by our symlink, not * the final target of a possible symlink chain. */ - target_path_size = MAXPATHLEN; + target_path_size = MAXPATHLEN + 1; fhp->target_path = malloc(target_path_size); if (fhp->target_path == NULL) { warn("memory allocation error"); return (PEFS_ERR_SYS); } - sbuf[nchars] = '\0'; - /* turn relative paths to absolute paths which are needed for ioctl() */ - if (sbuf[0] != '/') { - strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); - pch = strrchr(parent_dir, '/'); - if (pch == NULL) { - pefs_warn("error retrieving parent dir of %s", fhp->path); - return (PEFS_ERR_NOENT); - } - *pch = '\0'; - snprintf(fhp->target_path, target_path_size, "%s/%s", parent_dir, sbuf); - } + + /* turn relative paths to absolute paths */ + if (sbuf[0] != '/') + snprintf(fhp->target_path, target_path_size, "%s/%s", fhp->dirpath, sbuf); else strlcpy(fhp->target_path, sbuf, target_path_size); @@ -828,12 +843,29 @@ else fhp->target_path = NULL; + fhp->fd = open(fhp->path, O_RDONLY | O_NOFOLLOW); + if (fhp->fd < 0) { + warn("cannot open %s", fhp->path); + return (PEFS_ERR_IO); + } + + fhp->pfd = open(fhp->dirpath, O_RDONLY); + if (fhp->pfd < 0) { + warn("cannot open %s", fhp->dirpath); + return (PEFS_ERR_IO); + } + + if (fstat(fhp->fd, &sb) != 0) { + warn("cannot stat file %s", fhp->path); + return (PEFS_ERR_SYS); + } + if (S_ISREG(sb.st_mode) == 0) { pefs_warn("filename: %s is not a regular file", fhp->path); return (PEFS_ERR_INVALID); } - if (statfs(fhp->path, &this_fs) == -1) { + if (fstatfs(fhp->fd, &this_fs) == -1) { pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); return (PEFS_ERR_SYS); } @@ -888,19 +920,20 @@ /* * This function creates the in memory database that will be later written to * the checksum file. - * A) The total sum of entries is gathered so that the hash tables are allocated. - * B) For each file entry: - * B1) semantic checks: - * B1a) file should reside in pefs filesystem & file should be regular file. - * B1b) if symlink, acquire and save the absolute path of the symlink's + * A) For each file entry: + * A1) semantic checks: + * A1a) file should reside in pefs filesystem & file should be regular file. + * A1b) if symlink, acquire and save the absolute path of the symlink's * target. Try to stat() the target but don't do anything else. - * B1c) If hardlink, save a reference to this file entry in our rb tree. + * A1c) If hardlink, save a reference to this file entry in our rb tree. * rb-tree uses inodes as keys and is used in part C to print warnings. - * B2) the file_id is retrieved. - * B3) list of checksums is computed for the file's 4k blocks. - * B4) file entry is added to universal fh_head. - * C) Print warnings for hardlinks if the number of links found in inputlist isn't + * A1d) Open and store file descriptors to file & parent_directory. + * A2) the file_id is retrieved. + * A3) list of checksums is computed for the file's 4k blocks. + * A4) file entry is added to universal fh_head. + * B) Print warnings for hardlinks if the number of links found in inputlist isn't * equal to the number of total inode links. + * C) Hash tables are allocated. * D) Cuckoo insertion: * We try to populate our hash tables using the cuckoo algorithm. Should we fall * into an infinite loop during insertion, we re-allocate larger hash tables @@ -929,19 +962,26 @@ TAILQ_INIT(&fh_head); RB_INIT(&hlc_head); while((fhp = pefs_next_file(fpin, &error, &nfiles)) != NULL) { - error = pefs_file_semantic_checks(fhp, &fs, &hlc_head); - if (error != 0) + error = pefs_open_semantic_checks(fhp, &fs, &hlc_head); + if (error != 0) { + pefs_close_file(fhp); return (error); + } error = pefs_get_file_id(fhp); - if (error != 0) + if (error != 0) { + pefs_close_file(fhp); return (error); + } error = pefs_compute_file_checksums(fhp, md, hash_len); - if (error != 0) + if (error != 0) { + pefs_close_file(fhp); return (error); + } TAILQ_INSERT_TAIL(&fh_head, fhp, file_header_entries); + pefs_close_file(fhp); } /* checking I/O error with pefs_next_file()*/ From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 15:32:57 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 95533106566B for ; Thu, 7 Jun 2012 15:32:55 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 15:32:55 +0000 Date: Thu, 07 Jun 2012 15:32:55 +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: <20120607153255.95533106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r237265 - in soc2012/aleek/beaglexm-armv6/sys: arm/arm arm/ti arm/ti/am37x 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: Thu, 07 Jun 2012 15:32:57 -0000 Author: aleek Date: Thu Jun 7 15:32:54 2012 New Revision: 237265 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237265 Log: early uart is extended. Working on bug with pmap Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_early_uart.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_early_uart.h Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/cpufunc_asm_armv7.S soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/arm/cpufunc_asm_armv7.S Thu Jun 7 15:08:05 2012 (r237264) +++ soc2012/aleek/beaglexm-armv6/sys/arm/arm/cpufunc_asm_armv7.S Thu Jun 7 15:32:54 2012 (r237265) @@ -1,8 +1,5 @@ /*- - * Copyright (C) 2011 MARVELL INTERNATIONAL LTD. - * All rights reserved. - * - * Developed by Semihalf. + * Copyright (c) 2010 Per Odlund * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -12,264 +9,150 @@ * 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. - * 3. Neither the name of MARVELL nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * 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. + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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$"); +/* ARMv7 assembly functions for manipulating caches and other core functions. + * Based on cpufuncs for v6 and xscale. + */ -.Lcoherency_level: - .word _C_LABEL(arm_cache_loc) -.Lcache_type: - .word _C_LABEL(arm_cache_type) -.Lway_mask: - .word 0x3ff -.Lmax_index: - .word 0x7fff -.Lpage_mask: - .word 0xfff - -#define PT_NOS (1 << 5) -#define PT_S (1 << 1) -#define PT_INNER_NC 0 -#define PT_INNER_WT (1 << 0) -#define PT_INNER_WB ((1 << 0) | (1 << 6)) -#define PT_INNER_WBWA (1 << 6) -#define PT_OUTER_NC 0 -#define PT_OUTER_WT (2 << 3) -#define PT_OUTER_WB (3 << 3) -#define PT_OUTER_WBWA (1 << 3) - -#ifdef SMP -#define PT_ATTR (PT_S|PT_INNER_WT|PT_OUTER_WT|PT_NOS) -#else -#define PT_ATTR (PT_INNER_WT|PT_OUTER_WT) -#endif -ENTRY(armv7_setttb) - stmdb sp!, {r0, lr} - bl _C_LABEL(armv7_idcache_wbinv_all) /* clean the D cache */ - ldmia sp!, {r0, lr} - dsb - - orr r0, r0, #PT_ATTR - mcr p15, 0, r0, c2, c0, 0 /* Translation Table Base Register 0 (TTBR0) */ - mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */ - dsb - isb - RET - -ENTRY(armv7_tlb_flushID) - dsb -#ifdef SMP - mcr p15, 0, r0, c8, c3, 0 -#else - mcr p15, 0, r0, c8, c7, 0 /* flush I+D tlb */ -#endif - mcr p15, 0, r0, c7, c5, 6 /* flush BTB */ - dsb - isb - mov pc, lr +#include -ENTRY(armv7_tlb_flushID_SE) - ldr r1, .Lpage_mask - bic r0, r0, r1 -#ifdef SMP - mcr p15, 0, r0, c8, c3, 1 /* flush D tlb single entry */ -#else - mcr p15, 0, r0, c8, c7, 1 /* flush D tlb single entry */ -#endif - mcr p15, 0, r0, c7, c5, 6 /* flush BTB */ - dsb - isb - mov pc, lr - -/* Based on algorithm from ARM Architecture Reference Manual */ -ENTRY(armv7_dcache_wbinv_all) - stmdb sp!, {r4, r5, r6, r7, r8, r9} - - /* Get cache level */ - ldr r0, .Lcoherency_level - ldr r3, [r0] - cmp r3, #0 - beq Finished - /* For each cache level */ - mov r8, #0 -Loop1: - /* Get cache type for given level */ - mov r2, r8, lsl #2 - add r2, r2, r2 - ldr r0, .Lcache_type - ldr r1, [r0, r2] - - /* Get line size */ - and r2, r1, #7 - add r2, r2, #4 - - /* Get number of ways */ - ldr r4, .Lway_mask - ands r4, r4, r1, lsr #3 - clz r5, r4 - - /* Get max index */ - ldr r7, .Lmax_index - ands r7, r7, r1, lsr #13 -Loop2: - mov r9, r4 -Loop3: - mov r6, r8, lsl #1 - orr r6, r6, r9, lsl r5 - orr r6, r6, r7, lsl r2 - - /* Clean and invalidate data cache by way/index */ - mcr p15, 0, r6, c7, c14, 2 - subs r9, r9, #1 - bge Loop3 - subs r7, r7, #1 - bge Loop2 -Skip: - add r8, r8, #1 - cmp r3, r8 - bne Loop1 -Finished: - dsb - ldmia sp!, {r4, r5, r6, r7, r8, r9} - RET - -ENTRY(armv7_idcache_wbinv_all) - stmdb sp!, {lr} - bl armv7_dcache_wbinv_all - mcr p15, 0, r0, c7, c5, 0 /* Invalidate all I caches to PoU (ICIALLU) */ - dsb - isb - ldmia sp!, {lr} +#define entrysize #32 + +ENTRY(armv7_cpu_sleep) + tst r0, #0x00000000 /* shouldn't sleep 0 */ RET -/* XXX Temporary set it to 32 for MV cores, however this value should be - * get from Cache Type register - */ -.Larmv7_line_size: - .word 32 -ENTRY(armv7_dcache_wb_range) - ldr ip, .Larmv7_line_size - sub r3, ip, #1 - and r2, r0, r3 - add r1, r1, r2 - bic r0, r0, r3 -.Larmv7_wb_next: - mcr p15, 0, r0, c7, c10, 1 /* Clean D cache SE with VA */ - add r0, r0, ip - subs r1, r1, ip - bhi .Larmv7_wb_next - dsb /* data synchronization barrier */ +ENTRY(armv7_wait) + mrc p15, 0, r0, c2, c0, 0 /* arbitrary read of CP15 */ + add r0, r0, #0 /* a stall */ RET -ENTRY(armv7_dcache_wbinv_range) - ldr ip, .Larmv7_line_size - sub r3, ip, #1 - and r2, r0, r3 - add r1, r1, r2 - bic r0, r0, r3 -.Larmv7_wbinv_next: - mcr p15, 0, r0, c7, c14, 1 /* Purge D cache SE with VA */ - add r0, r0, ip - subs r1, r1, ip - bhi .Larmv7_wbinv_next - dsb /* data synchronization barrier */ + +ENTRY(armv7_context_switch) + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + mcr p15, 0, r0, c2, c0, 0 /* set the new TTB */ + mcr p15, 0, r0, c8, c7, 0 /* flush the I+D */ RET -/* - * Note, we must not invalidate everything. If the range is too big we - * must use wb-inv of the entire cache. - */ -ENTRY(armv7_dcache_inv_range) - ldr ip, .Larmv7_line_size - sub r3, ip, #1 - and r2, r0, r3 - add r1, r1, r2 - bic r0, r0, r3 -.Larmv7_inv_next: - mcr p15, 0, r0, c7, c6, 1 /* Invalidate D cache SE with VA */ - add r0, r0, ip - subs r1, r1, ip - bhi .Larmv7_inv_next - dsb /* data synchronization barrier */ + +ENTRY(armv7_tlb_flushID_SE) + mcr p15, 0, r0, c8, c7, 1 /* flush I+D tlb single entry */ + mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ RET -ENTRY(armv7_idcache_wbinv_range) - ldr ip, .Larmv7_line_size - sub r3, ip, #1 - and r2, r0, r3 - add r1, r1, r2 - bic r0, r0, r3 -.Larmv7_id_wbinv_next: - mcr p15, 0, r0, c7, c5, 1 /* Invalidate I cache SE with VA */ - mcr p15, 0, r0, c7, c14, 1 /* Purge D cache SE with VA */ - add r0, r0, ip - subs r1, r1, ip - bhi .Larmv7_id_wbinv_next - isb /* instruction synchronization barrier */ - dsb /* data synchronization barrier */ + + +ENTRY(armv7_setttb) + stmdb sp!, {r0, lr} + bl _C_LABEL(armv7_idcache_wbinv_all) /* clean the D cache */ + ldmia sp!, {r0, lr} + + mcr p15, 0, r0, c2, c0, 0 /* load new TTB */ + mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */ + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + RET +/* Cache operations. */ + +/* LINTSTUB: void armv7_icache_sync_range(vaddr_t, vsize_t); */ ENTRY_NP(armv7_icache_sync_range) - ldr ip, .Larmv7_line_size -.Larmv7_sync_next: - mcr p15, 0, r0, c7, c5, 1 /* Invalidate I cache SE with VA */ - mcr p15, 0, r0, c7, c10, 1 /* Clean D cache SE with VA */ - add r0, r0, ip - subs r1, r1, ip - bhi .Larmv7_sync_next - isb /* instruction synchronization barrier */ - dsb /* data synchronization barrier */ +1: + mcr p15, 0, r0, c7, c5, 1 /* invalidate the I-Cache line */ + mcr p15, 0, r0, c7, c10, 1 /* wb the D-Cache line */ + add r0, r0, entrysize + subs r1, r1, entrysize + bhi 1b + + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer, BSB */ RET -ENTRY(armv7_cpu_sleep) - dsb /* data synchronization barrier */ - wfi /* wait for interrupt */ + +/* LINTSTUB: void armv7_icache_sync_all(void); */ +ENTRY_NP(armv7_icache_sync_all) + /* + * We assume that the code here can never be out of sync with the + * dcache, so that we can safely flush the Icache and fall through + * into the Dcache cleaning code. + */ + stmdb sp!, {r0, lr} + bl _C_LABEL(armv7_idcache_wbinv_all) /* clean the D cache */ + ldmia sp!, {r0, lr} + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer, BSB */ RET -ENTRY(armv7_context_switch) - dsb - orr r0, r0, #PT_ATTR - - mcr p15, 0, r0, c2, c0, 0 /* set the new TTB */ - mcr p15, 0, r0, c8, c7, 0 /* and flush the I+D tlbs */ - dsb - isb + +/* LINTSTUB: armv7_dcache_wb_range(vaddr_t, vsize_t); */ +ENTRY(armv7_dcache_wb_range) +1: + mcr p15, 0, r0, c7, c10, 1 /* wb the D-Cache */ + add r0, r0, entrysize + subs r1, r1, entrysize + bhi 1b + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer, BSB */ RET -ENTRY(armv7_drain_writebuf) - dsb + +/* LINTSTUB: void armv7_dcache_wbinv_range(vaddr_t, vsize_t); */ +ENTRY(armv7_dcache_wbinv_range) +1: + mcr p15, 0, r0, c7, c14, 1 /* wb and inv the D-Cache line */ + add r0, r0, entrysize + subs r1, r1, entrysize + bhi 1b + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer, BSB */ RET -ENTRY(armv7_sev) - dsb - sev - nop +/* * LINTSTUB: void armv7_dcache_inv_range(vaddr_t, vsize_t); */ +ENTRY(armv7_dcache_inv_range) +1: + mcr p15, 0, r0, c7, c6, 1 /* invalidate the D-Cache line */ + add r0, r0, entrysize + subs r1, r1, entrysize + bhi 1b + + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer, BSB */ RET -ENTRY(armv7_auxctrl) - mrc p15, 0, r2, c1, c0, 1 - bic r3, r2, r0 /* Clear bits */ - eor r3, r3, r1 /* XOR bits */ - teq r2, r3 - mcrne p15, 0, r3, c1, c0, 1 - mov r0, r2 +ENTRY(armv7_idcache_wbinv_range) +1: + mcr p15, 0, r0, c7, c5, 1 /* invalidate the I-Cache line */ + mcr p15, 0, r0, c7, c14, 1 /* wb and inv the D-Cache line */ + add r0, r0, entrysize + subs r1, r1, entrysize + bhi 1b + + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer, BSB */ RET + + +ENTRY_NP(armv7_idcache_wbinv_all) + /* + * We assume that the code here can never be out of sync with the + * dcache, so that we can safely flush the Icache and fall through + * into the Dcache purging code. + */ + mcr p15, 0, r0, c7, c5, 0 + b _C_LABEL(armv7_dcache_wbinv_all) + + +/* + * armv7_dcache_wbinv_all is in cpufunc.c. It's really too long to + * write in assembler. + */ Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_early_uart.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_early_uart.c Thu Jun 7 15:32:54 2012 (r237265) @@ -0,0 +1,200 @@ +/*- + * Copyright (c) 2009 Guillaume Ballet + * 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 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. + */ + +/* + * Debugging functions for early uart for omap3530 and am37x TI SoC's + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +void +arm_early_putc( char c ) +{ + volatile uint32_t *uart = (volatile uint32_t *)0x49020000; + volatile uint32_t *uart_lsr = (volatile uint32_t *)0x49020014; + + while ((*uart_lsr & 0x20) == 0); + *uart = c; + + if( c == '\n' ) + { + while ((*uart_lsr & 0x20) == 0); + *uart = '\r'; + } +} + +void +arm_early_puts(unsigned char *str) +{ + do { + arm_early_putc(*str); + } while (*++str != '\0'); +} + +void +eprintf(const char *fmt,...) +{ + va_list ap; + const char *hex = "0123456789abcdef"; + char buf[10]; + char *s; + unsigned u; + int c; + + va_start(ap, fmt); + while ((c = *fmt++)) { + if (c == '%') { + c = *fmt++; + switch (c) { + case 'c': + arm_early_putc(va_arg(ap, int)); + continue; + case 's': + for (s = va_arg(ap, char *); *s; s++) + arm_early_putc(*s); + continue; + case 'd': /* A lie, always prints unsigned */ + case 'u': + u = va_arg(ap, unsigned); + s = buf; + do + *s++ = '0' + u % 10U; + while (u /= 10U); + dumpbuf:; + while (--s >= buf) + arm_early_putc(*s); + continue; + case 'x': + u = va_arg(ap, unsigned); + s = buf; + do + *s++ = hex[u & 0xfu]; + while (u >>= 4); + goto dumpbuf; + } + } + arm_early_putc(c); + } + va_end(ap); + + return; +} + +void +dump_l2pagetable(uint32_t pta, uint32_t l1) +{ + int i; + volatile uint32_t *pt = (volatile uint32_t*)pta; + + for (i=0; i<256;i++) { + switch (pt[i] & 0x3) { + case 1: + eprintf("0x%x -> 0x%x 64K ",(i<<12) | l1, + pt[i]&0xFFFF0000); + eprintf("l2pt[0x%x]=0x%x ",i, pt[i]); + eprintf("s=%u ", (pt[i]>>10) &0x1); + eprintf("apx=%u ", (pt[i]>> 9) &0x1); + eprintf("tex=%u ", (pt[i]>>12) &0x7); + eprintf("ap=%u ", (pt[i]>> 4) &0x3); + eprintf("c=%u ", (pt[i]>> 3) &0x1); + eprintf("b=%u\n", (pt[i]>> 2) &0x1); + break; + case 2: + case 3: + eprintf("0x%x -> 0x%x 4K ",(i<<12) | l1, + pt[i]&0xFFFFF000); + eprintf("l2pt[0x%x]=0x%x ",i, pt[i]); + eprintf("s=%u ", (pt[i]>>10) &0x1); + eprintf("apx=%u ", (pt[i]>> 9) &0x1); + eprintf("tex=%u ", (pt[i]>> 6) &0x7); + eprintf("ap=%u ", (pt[i]>> 4) &0x3); + eprintf("c=%u ", (pt[i]>> 3) &0x1); + eprintf("b=%u\n", (pt[i]>> 2) &0x1); + break; + } + } +} + +void +dump_l1pagetable(uint32_t pta) +{ + int i; + eprintf("L1 pagetable starts at 0x%x\n",pta); + volatile uint32_t *pt = (volatile uint32_t*)pta; + for (i=0; i<4096;i++) { + switch (pt[i] & 0x3) { + case 1: + eprintf("0x%x -> L2 ",i<<20); + eprintf("l1pt[0x%x]=0x%x ",i, pt[i]); + eprintf("l2desc=0x%x ",pt[i] & 0xFFFFFC00); + eprintf("p=%u ",(pt[i]>>9) &0x1); + eprintf("domain=0x%x\n",(pt[i]>>5) &0xF); + dump_l2pagetable(pt[i] & 0xFFFFFC00, i<<20); + break; + case 2: + if (pt[i] &0x40000) { + eprintf("0x%x -> 0x%x 16M ",i<<20, pt[i] & 0xFF000000); + eprintf("l1pt[0x%x]=0x%x ",i, pt[i]); + eprintf("base=0x%x ", ((pt[i]>>24))); + } else { + eprintf("0x%x -> 0x%x 1M ",i<<20, pt[i] & 0xFFF00000); + eprintf("l1pt[0x%x]=0x%x ",i, pt[i]); + eprintf("base=0x%x ", (pt[i]>>20)); + } + eprintf("nG=%u ", (pt[i]>>17) &0x1); + eprintf("s=%u ", (pt[i]>>16) &0x1); + eprintf("apx=%u ", (pt[i]>>15) &0x1); + eprintf("tex=%u ", (pt[i]>>12) &0x7); + eprintf("ap=%u ", (pt[i]>>10) &0x3); + eprintf("p=%u ", (pt[i]>> 9) &0x1); + eprintf("domain=0x%x ", (pt[i]>> 5) &0xF); + eprintf("xn=%u ", (pt[i]>> 4) &0x1); + eprintf("c=%u ", (pt[i]>> 3) &0x1); + eprintf("b=%u\n", (pt[i]>> 2) &0x1); + break; + case 3: + eprintf("pt[0x%x] 0x%x RESV\n",i, pt[i]); + break; + } + } +} Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_early_uart.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_early_uart.h Thu Jun 7 15:32:54 2012 (r237265) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2009 Guillaume Ballet + * 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 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. + */ + +#ifndef AM37X_EARLY_UART_INC +#define AM37X_EARLY_UART_INC + +void +arm_early_putc( char c ); + +void +arm_early_puts(unsigned char *str); + +void +eprintf(const char *fmt,...); + +void +dump_l1pagetable(uint32_t pta); + +void +dump_l2pagetable(uint32_t pta, uint32_t l1); +#endif /* ----- #ifndef AM37X_EARLY_UART_INC ----- */ Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x Thu Jun 7 15:08:05 2012 (r237264) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x Thu Jun 7 15:32:54 2012 (r237265) @@ -1,9 +1,10 @@ #$FreeBSD$ -arm/ti/aintc.c standard -arm/ti/am37x/am37x_prcm.c standard +arm/ti/aintc.c standard +arm/ti/am37x/am37x_prcm.c standard arm/ti/am37x/am37x_dmtimer.c standard arm/ti/am37x/am37x_scm_padconf.c standard -arm/ti/ti_edma3.c standard -arm/ti/ti_mmchs.c optional mmc -arm/ti/cpsw/if_cpsw.c optional cpsw +arm/ti/ti_edma3.c standard +arm/ti/ti_mmchs.c optional mmc +arm/ti/cpsw/if_cpsw.c optional cpsw +arm/ti/am37x/am37x_early_uart.c standard Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Thu Jun 7 15:08:05 2012 (r237264) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_machdep.c Thu Jun 7 15:32:54 2012 (r237265) @@ -89,6 +89,7 @@ #include #include +#include #define DEBUG #ifdef DEBUG @@ -334,8 +335,7 @@ u_int l1pagetable; int i = 0, j = 0; - - beagle_early_puts( "BeagleBoard-XM revC FreeBSD hababababa booting...\n" ); + arm_early_puts( "BeagleBoard-XM revC FreeBSD hababababa booting...\n" ); kmdp = NULL; lastaddr = 0; @@ -343,9 +343,9 @@ dtbp = (vm_offset_t)NULL; - beagle_early_puts( "set_cpufuncs()..." ); + arm_early_puts( "set_cpufuncs()..." ); set_cpufuncs(); - beagle_early_puts( "done!\n" ); + arm_early_puts( "done!\n" ); /* * Mask metadata pointer: it is supposed to be on page boundary. If @@ -353,7 +353,7 @@ * bootloader must have passed us something else than the metadata * ptr... In this case we want to fall back to some built-in settings. */ - beagle_early_puts( "FDT related stuff..." ); + arm_early_puts( "FDT related stuff..." ); mdp = (void *)((uint32_t)mdp & ~PAGE_MASK); /* Parse metadata and fetch parameters */ @@ -398,16 +398,18 @@ &memsize) != 0) while(1); + eprintf( "Memory size: %d\n", memsize ); + // if (fdt_immr_addr(OMAP44XX_L4_PERIPH_VBASE) != 0) // while (1); - beagle_early_puts( "done!\n" ); + arm_early_puts( "done!\n" ); /* Platform-specific initialisation */ pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE; - beagle_early_puts( "pcpu0_init()..." ); + arm_early_puts( "pcpu0_init()..." ); pcpu0_init(); - beagle_early_puts( "done!\n" ); + arm_early_puts( "done!\n" ); /* Calculate number of L2 tables needed for mapping vm_page_array */ l2size = (memsize / PAGE_SIZE) * sizeof(struct vm_page); @@ -425,7 +427,7 @@ #define KERNEL_TEXT_BASE (KERNBASE) freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK; - beagle_early_puts( "allocing pages..." ); + arm_early_puts( "allocing pages..." ); /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ alloc_pages((var).pv_va, (np)); \ @@ -474,8 +476,8 @@ init_param1(); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); - beagle_early_puts( "done!\n" ); - beagle_early_puts( "pmapping pages..." ); + arm_early_puts( "done!\n" ); + arm_early_puts( "pmapping pages..." ); /* * Now we start construction of the L1 page table @@ -513,7 +515,6 @@ kernel_pt_table[0].pv_pa, L2_TABLE_SIZE_REAL * l2size, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); - beagle_early_puts( "done!\n" ); /* Map allocated DPCPU, stacks and msgbuf */ pmap_map_chunk(l1pagetable, dpcpu.pv_va, dpcpu.pv_pa, @@ -525,30 +526,33 @@ &kernel_pt_table[l2size - 1]); pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE); - beagle_early_puts( "done!\n" ); /* Map pmap_devmap[] entries */ if (platform_devmap_init() != 0) while (1); - beagle_early_puts( "done!\n" ); - beagle_early_puts( "pmap_devmap_bootstrap()..." ); + arm_early_puts( "done!\n" ); + arm_early_puts( "pmap_devmap_bootstrap()..." ); pmap_devmap_bootstrap(l1pagetable, pmap_devmap_bootstrap_table); - beagle_early_puts( "done!\n" ); + arm_early_puts( "done!\n" ); - beagle_early_puts( "cpu_domains()..." ); + arm_early_puts( "cpu_domains()..." ); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); - beagle_early_puts( "done!\n" ); + arm_early_puts( "done!\n" ); pmap_pa = kernel_l1pt.pv_pa; - beagle_early_puts( "settb()..." ); + + arm_early_puts( "Dumping memory layout!\n" ); + dump_l1pagetable( kernel_l1pt.pv_pa ); + + arm_early_puts( "setttb()..." ); setttb(kernel_l1pt.pv_pa); - beagle_early_puts( "done!\n" ); - beagle_early_puts( "cpu_tlb_flushID()..." ); + arm_early_puts( "done!\n" ); + arm_early_puts( "cpu_tlb_flushID()..." ); cpu_tlb_flushID(); - beagle_early_puts( "done!\n" ); - beagle_early_puts( "cpu_domains2()..." ); + arm_early_puts( "done!\n" ); + arm_early_puts( "cpu_domains2()..." ); cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)); - beagle_early_puts( "done!\n" ); + arm_early_puts( "done!\n" ); /* * Only after the SOC registers block is mapped we can perform device @@ -643,7 +647,7 @@ undstack.pv_va + ((UND_STACK_SIZE * PAGE_SIZE) * (cpu + 1))); } -#define FDT_DEVMAP_MAX (2) // FIXME +#define FDT_DEVMAP_MAX (3) // FIXME static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { { 0, 0, 0, 0, 0, } }; @@ -677,6 +681,12 @@ fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; fdt_devmap[i].pd_cache = PTE_DEVICE; i++; + fdt_devmap[i].pd_va = 0xE9000000; + fdt_devmap[i].pd_pa = 0x49000000; + fdt_devmap[i].pd_size = 0x100000; + fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; + fdt_devmap[i].pd_cache = PTE_DEVICE; + i++; #else #error "Unknown SoC" #endif Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Thu Jun 7 15:08:05 2012 (r237264) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Thu Jun 7 15:32:54 2012 (r237265) @@ -27,8 +27,8 @@ /dts-v1/; / { - model = "beaglebone"; - compatible = "beaglebone", "ti,am335x"; + model = "beagleboardxm"; + compatible = "beagleboard", "ti,am37x"; #address-cells = <1>; #size-cells = <1>; From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 23:33: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 A884E1065679 for ; Thu, 7 Jun 2012 23:33:08 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 23:33:08 +0000 Date: Thu, 07 Jun 2012 23:33:08 +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: <20120607233308.A884E1065679@hub.freebsd.org> Cc: Subject: socsvn commit: r237279 - 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: Thu, 07 Jun 2012 23:33:10 -0000 Author: gmiller Date: Thu Jun 7 23:33:07 2012 New Revision: 237279 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237279 Log: Implement _mutex_release(). Modified: 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 Thu Jun 7 22:57:26 2012 (r237278) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Thu Jun 7 23:33:07 2012 (r237279) @@ -748,33 +748,29 @@ 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 _mutex_obtain_failed(struct pthread_mutex *, struct timespec *waittime) - __hidden; -void _mutex_obtain_success(struct pthread_mutex *, - struct timespec *waittime, const char *, int) +void _mutex_obtain_failed(struct pthread_mutex *, struct timespec *) __hidden; +void _mutex_obtain_success(struct pthread_mutex *, struct timespec *, + const char *, int) __hidden; void _lock_profile_init(void) __hidden; void _lock_profile_exit_thread(struct pthread *curthread) __hidden; void _rwlock_obtain_read_success(struct pthread_rwlock *, - struct timespec *waittime, - const char *file, int line) __hidden; + struct timespec *wait_time, const char *file, int line) __hidden; void _rwlock_obtain_read_failed(struct pthread_rwlock *, - struct timespec *waittime) __hidden; + struct timespec *wait_time) __hidden; void _rwlock_obtain_write_success(struct pthread_rwlock *, - struct timespec *waittime, - const char *file, int line) __hidden; + struct timespec *wait_time, const char *file, int line) __hidden; void _rwlock_obtain_write_failed(struct pthread_rwlock *, - struct timespec *waittime) __hidden; + struct timespec *wait_time) __hidden; void _rwlock_release_read(struct pthread_rwlock *, struct timespec *) __hidden; void _rwlock_release_write(struct pthread_rwlock *, struct timespec *) __hidden; void _mutex_release(struct pthread_mutex *, struct timespec *) __hidden; void _spin_obtain_success(struct pthread_spinlock *, - struct timespec *waittime, - const char *file, int line) __hidden; + struct timespec *wait_time, const char *file, int line) __hidden; void _spin_obtain_failed(struct pthread_spinlock *, - struct timespec *waittime) __hidden; + struct timespec *wait_time) __hidden; void _spin_release(struct pthread_spinlock *, struct timespec *) __hidden; void _libpthread_init(struct pthread *) __hidden; struct pthread *_thr_alloc(struct pthread *) __hidden; Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Thu Jun 7 22:57:26 2012 (r237278) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Thu Jun 7 23:33:07 2012 (r237279) @@ -29,26 +29,44 @@ #include #include +#include +#include #include "thr_private.h" #define LOCK_PROF_HASH_SIZE (4096) +struct acquisition_point { + SLIST_ENTRY(acquisition_point) acq_point_next; + const char *file; + int line; + struct timespec wait_max; + struct timespec hold_max; + uintmax_t contest_count; + struct timespec wait_time; + struct timespec hold_time; + int acq_count; +}; + +SLIST_HEAD(acq_point_head, acquisition_point); + struct acquisition { - const char *file; - int line; - struct timespec acq_time; - int count; - int ref; - struct timespec waittime; - SLIST_ENTRY(acquisition) acq_next; + LIST_ENTRY(acquisition) acq_next; + void *lock; + const char *file; + int line; + struct timespec acq_time; + int count; + int ref; + struct timespec wait_time; }; -SLIST_HEAD(acq_head, acquisition); +LIST_HEAD(acq_head, acquisition) acq_head = LIST_HEAD_INITIALIZER(acq_head); -struct acq_head mutex_hash[LOCK_PROF_HASH_SIZE]; +struct acq_point_head mutex_hash[LOCK_PROF_HASH_SIZE]; -void _lock_profile_init() +void +_lock_profile_init() { int i; @@ -58,30 +76,53 @@ } static struct acquisition * -mutex_lookup(struct pthread_mutex *m, const char *file, int line) +mutex_lookup_acq(struct pthread_mutex *m, const char *file, int line) { - u_int hash; struct acquisition *acq; - hash = ((uintptr_t)file * 31 + line) & (LOCK_PROF_HASH_SIZE - 1); - - SLIST_FOREACH(acq, &mutex_hash[hash], acq_next) { + LIST_FOREACH(acq, &acq_head, acq_next) { if (acq->file == file && acq->line == line) { return acq; } } acq = malloc(sizeof(struct acquisition)); + bzero(acq, sizeof(*acq)); + acq->lock = m; acq->file = file; acq->line = line; - SLIST_INSERT_HEAD(&mutex_hash[hash], acq, acq_next); + LIST_INSERT_HEAD(&acq_head, acq, acq_next); + + return (acq); +} + +static struct acquisition_point * +mutex_lookup_acq_point(struct pthread_mutex *m, const char *file, int line) +{ + u_int hash; + struct acquisition_point *acq_point; + + hash = ((uintptr_t)file * 31 + line) & (LOCK_PROF_HASH_SIZE - 1); + + SLIST_FOREACH(acq_point, &mutex_hash[hash], acq_point_next) { + if (acq_point->file == file && acq_point->line == line) { + return (acq_point); + } + } + + acq_point = malloc(sizeof(struct acquisition_point)); + bzero(acq_point, sizeof(*acq_point)); + acq_point->file = file; + acq_point->line = line; - return acq; + SLIST_INSERT_HEAD(&mutex_hash[hash], acq_point, acq_point_next); + + return (acq_point); } void -_mutex_obtain_success(struct pthread_mutex *m, struct timespec *waittime, +_mutex_obtain_success(struct pthread_mutex *m, struct timespec *wait_time, const char *file, int line) { struct pthread *curthread = _get_curthread(); @@ -89,19 +130,20 @@ THR_CRITICAL_ENTER(curthread); - acq = mutex_lookup(m, file, line); + acq = mutex_lookup_acq(m, file, line); if (acq != NULL) { acq->count++; acq->ref++; if (acq->ref == 1) { clock_gettime(CLOCK_REALTIME, &acq->acq_time); - if (waittime->tv_sec != 0 || waittime->tv_nsec != 0) { - if (TIMESPEC_GT(&acq->acq_time, waittime)) { - TIMESPEC_SUB(&acq->waittime, + if (wait_time->tv_sec != 0 || + wait_time->tv_nsec != 0) { + if (TIMESPEC_GT(&acq->acq_time, wait_time)) { + TIMESPEC_SUB(&acq->wait_time, &acq->acq_time, &acq->acq_time); } } else { - bzero(&acq->waittime, sizeof(acq->waittime)); + bzero(&acq->wait_time, sizeof(acq->wait_time)); } } } @@ -110,16 +152,69 @@ } void -_mutex_obtain_failed(struct pthread_mutex *m, struct timespec *waittime) +_mutex_obtain_failed(struct pthread_mutex *m, struct timespec *wait_time) { - if (waittime->tv_sec == 0 && waittime->tv_nsec == 0) { - clock_gettime(CLOCK_REALTIME, waittime); + if (wait_time->tv_sec == 0 && wait_time->tv_nsec == 0) { + clock_gettime(CLOCK_REALTIME, wait_time); } } void -_mutex_release(struct pthread_mutex *m, struct timespec *waittime) +_mutex_release(struct pthread_mutex *m, struct timespec *wait_time) { + struct pthread *curthread = _get_curthread(); + struct acquisition *acq; + struct acquisition_point *acq_point; + struct timespec current_time; + struct timespec hold_time; + + THR_CRITICAL_ENTER(curthread); + + LIST_FOREACH(acq, &acq_head, acq_next) { + if (acq->lock == m) { + break; + } + } + + if (acq != NULL) { + acq->ref--; + if (acq->ref == 0) { + acq_point = mutex_lookup_acq_point(m, acq->file, + acq->line); + clock_gettime(CLOCK_REALTIME, ¤t_time); + if (acq_point != NULL && + TIMESPEC_GT(&acq->acq_time, ¤t_time)) { + TIMESPEC_SUB(&hold_time, ¤t_time, + &acq->acq_time); + if (TIMESPEC_GT(&hold_time, + &acq_point->hold_max)) { + memcpy(&acq_point->hold_max, + &hold_time, + sizeof(struct timespec)); + } + if (TIMESPEC_GT(wait_time, + &acq_point->wait_max)) { + memcpy(&acq_point->wait_max, + 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, wait_time); + acq_point->acq_count += acq->count; + if (wait_time->tv_sec != 0 || + wait_time->tv_nsec != 0) { + acq_point->contest_count++; + } + } + } + + LIST_REMOVE(acq, acq_next); + free(acq); + } + + THR_CRITICAL_LEAVE(curthread); } void @@ -129,19 +224,20 @@ void _rwlock_obtain_read_success(struct pthread_rwlock *l, - struct timespec *waittime, const char *file, + struct timespec *wait_time, const char *file, int line) { } void -_rwlock_obtain_read_failed(struct pthread_rwlock *l, struct timespec *waittime) +_rwlock_obtain_read_failed(struct pthread_rwlock *l, + struct timespec *wait_time) { } void _rwlock_obtain_write_success(struct pthread_rwlock *l, - struct timespec *waittime, const char *file, + struct timespec *wait_time, const char *file, int line) { } @@ -153,28 +249,28 @@ } void -_rwlock_release_read(struct pthread_rwlock *l, struct timespec *waittime) +_rwlock_release_read(struct pthread_rwlock *l, struct timespec *wait_time) { } void -_rwlock_release_write(struct pthread_rwlock *l, struct timespec *waittime) +_rwlock_release_write(struct pthread_rwlock *l, struct timespec *wait_time) { } void -_spin_obtain_success(struct pthread_spinlock *s, struct timespec *waittime, +_spin_obtain_success(struct pthread_spinlock *s, struct timespec *wait_time, const char *file, int line) { } void -_spin_obtain_failed(struct pthread_spinlock *s, struct timespec *waittime) +_spin_obtain_failed(struct pthread_spinlock *s, struct timespec *wait_time) { } void -_spin_release(struct pthread_spinlock *s, struct timespec *waittime) +_spin_release(struct pthread_spinlock *s, struct timespec *wait_time) { } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 7 23:42:34 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 D405A1065673 for ; Thu, 7 Jun 2012 23:42:32 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 07 Jun 2012 23:42:32 +0000 Date: Thu, 07 Jun 2012 23:42:32 +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: <20120607234232.D405A1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r237280 - in soc2012/jhagewood/diff3: . diff3 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, 07 Jun 2012 23:42:35 -0000 Author: jhagewood Date: Thu Jun 7 23:42:32 2012 New Revision: 237280 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237280 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Thu Jun 7 23:33:07 2012 (r237279) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Thu Jun 7 23:42:32 2012 (r237280) @@ -82,7 +82,6 @@ /* diff3 - 3-way differential file comparison */ -extern char const *__progname; char const __version[] = "8.1"; /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] @@ -155,9 +154,8 @@ void remove_cr(FILE *); __dead void trouble(void); void increase(void); -__dead void try_help(void); void help(void); -void usage(void); +__dead void usage(void); enum { HELP_OPT = CHAR_MAX + 1, @@ -225,7 +223,7 @@ oflag = eflag = 1; break; case 'v': - printf("FreeBSD %s %s\n", __progname, __version); + printf("FreeBSD diff3 %s\n" __version); exit(0); case 'x': eflag = 1; @@ -234,7 +232,6 @@ eflag = 2; break; case HELP_OPT: - usage(); help(); exit(0); case STRIPCR_OPT: @@ -743,14 +740,6 @@ szchanges = newsz; } - -__dead void -try_help(void) -{ - fprintf(stderr, "%s: Try `%s --help' for more information.\n", __progname, __progname); - exit(EXIT_FAILURE); -} - void help(void) { @@ -770,11 +759,11 @@ } -void +__dead void usage(void) { - fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " - "/tmp/d3b.?????????? file1 file2 file3\n", __progname); - + fprintf(stderr, "usage: diff3 [-exEX3] /tmp/d3a.?????????? " + "/tmp/d3b.?????????? file1 file2 file3\n"); + exit(EXIT_FAILURE); } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Thu Jun 7 23:33:07 2012 (r237279) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Thu Jun 7 23:42:32 2012 (r237280) @@ -11,28 +11,25 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-07 05:12:54.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-07 05:45:37.000000000 -0400 -@@ -82,6 +82,9 @@ ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-07 23:42:04.000000000 -0400 +@@ -82,6 +82,8 @@ /* diff3 - 3-way differential file comparison */ -+extern char const *__progname; +char const __version[] = "8.1"; + /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * * d13 = diff report on f1 vs f3 -@@ -149,33 +152,38 @@ void prange(struct range *); +@@ -149,33 +151,37 @@ void prange(struct range *); void repos(int); void separate(const char *); __dead void edscript(int); +void remove_cr(FILE *); __dead void trouble(void); void increase(void); --__dead void usage(void); -+__dead void try_help(void); +void help(void); -+void usage(void); + __dead void usage(void); enum { - HELP_OPT = CHAR_MAX + 1, @@ -69,12 +66,12 @@ }; -@@ -216,12 +224,19 @@ main(int argc, char **argv) +@@ -216,12 +222,18 @@ main(int argc, char **argv) case 'X': oflag = eflag = 1; break; + case 'v': -+ printf("FreeBSD %s %s\n", __progname, __version); ++ printf("FreeBSD diff3 %s\n" __version); + exit(0); case 'x': eflag = 1; @@ -83,13 +80,12 @@ eflag = 2; break; + case HELP_OPT: -+ usage(); + help(); + exit(0); case STRIPCR_OPT: strip_cr = 1; break; -@@ -233,8 +248,10 @@ main(int argc, char **argv) +@@ -233,8 +245,10 @@ main(int argc, char **argv) argc -= optind; argv += optind; /* XXX - argc usage seems wrong here */ @@ -101,7 +97,7 @@ if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", -@@ -254,6 +271,8 @@ main(int argc, char **argv) +@@ -254,6 +268,8 @@ main(int argc, char **argv) for (i = 0; i <= 2; i++) { if ((fp[i] = fopen(argv[i + 2], "r")) == NULL) err(EXIT_FAILURE, "can't open %s", argv[i + 2]); @@ -110,7 +106,7 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -606,6 +625,32 @@ repos(int nchar) +@@ -606,6 +622,32 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } @@ -143,18 +139,10 @@ __dead void trouble(void) { -@@ -699,12 +744,37 @@ increase(void) +@@ -698,13 +740,30 @@ increase(void) + szchanges = newsz; } - --__dead void -+__dead void -+try_help(void) -+{ -+ fprintf(stderr, "%s: Try `%s --help' for more information.\n", __progname, __progname); -+ exit(EXIT_FAILURE); -+} -+ +void +help(void) +{ @@ -173,14 +161,15 @@ + --help Output this help.\n\n"); + +} -+ -+void + + __dead void usage(void) { - extern char *__progname; - fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " - "/tmp/d3b.?????????? file1 file2 file3\n", __progname); -- exit(EXIT_FAILURE); -+ +- fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " +- "/tmp/d3b.?????????? file1 file2 file3\n", __progname); ++ fprintf(stderr, "usage: diff3 [-exEX3] /tmp/d3a.?????????? " ++ "/tmp/d3b.?????????? file1 file2 file3\n"); + exit(EXIT_FAILURE); } From owner-svn-soc-all@FreeBSD.ORG Fri Jun 8 08:36:32 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 7596F106566C for ; Fri, 8 Jun 2012 08:36:30 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 08 Jun 2012 08:36:30 +0000 Date: Fri, 08 Jun 2012 08:36:30 +0000 From: oleksandr@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: <20120608083630.7596F106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237289 - soc2012/oleksandr/udf-head/sys/fs/udf2 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: Fri, 08 Jun 2012 08:36:32 -0000 Author: oleksandr Date: Fri Jun 8 08:36:29 2012 New Revision: 237289 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237289 Log: Add some comments and debug section Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Fri Jun 8 07:44:42 2012 (r237288) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Fri Jun 8 08:36:29 2012 (r237289) @@ -32,10 +32,57 @@ /* lets see debug stuff for now */ #define DEBUG +/* debug section */ +extern int udf_verbose; /* undefine UDF_COMPLETE_DELETE to need `purge'; but purge is not implemented */ #define UDF_COMPLETE_DELETE +/* debug categories */ +#define UDF_DEBUG_VOLUMES 0x0000001 +#define UDF_DEBUG_LOCKING 0x0000002 +#define UDF_DEBUG_NODE 0x0000004 +#define UDF_DEBUG_LOOKUP 0x0000008 +#define UDF_DEBUG_READDIR 0x0000010 +#define UDF_DEBUG_FIDS 0x0000020 +#define UDF_DEBUG_DESCRIPTOR 0x0000040 +#define UDF_DEBUG_TRANSLATE 0x0000080 +#define UDF_DEBUG_STRATEGY 0x0000100 +#define UDF_DEBUG_READ 0x0000200 +#define UDF_DEBUG_WRITE 0x0000400 +#define UDF_DEBUG_CALL 0x0000800 +#define UDF_DEBUG_ATTR 0x0001000 +#define UDF_DEBUG_EXTATTR 0x0002000 +#define UDF_DEBUG_ALLOC 0x0004000 +#define UDF_DEBUG_ADWLK 0x0008000 +#define UDF_DEBUG_DIRHASH 0x0010000 +#define UDF_DEBUG_NOTIMPL 0x0020000 +#define UDF_DEBUG_SHEDULE 0x0040000 +#define UDF_DEBUG_ECCLINE 0x0080000 +#define UDF_DEBUG_SYNC 0x0100000 +#define UDF_DEBUG_PARANOIA 0x0200000 +#define UDF_DEBUG_PARANOIDADWLK 0x0400000 +#define UDF_DEBUG_NODEDUMP 0x0800000 +#define UDF_DEBUG_RESERVE 0x1000000 + +/* initial value of udf_verbose */ +#define UDF_DEBUGGING 0 + +#ifdef DEBUG +#define DPRINTF(name, arg) { \ + if (udf_verbose & UDF_DEBUG_##name) {\ + printf arg;\ + };\ + } +#define DPRINTFIF(name, cond, arg) { \ + if (udf_verbose & UDF_DEBUG_##name) { \ + if (cond) printf arg;\ + };\ + } +#else +#define DPRINTF(name, arg) {} +#define DPRINTFIF(name, cond, arg) {} +#endif /* constants to identify what kind of identifier we are dealing with */ #define UDF_REGID_DOMAIN 1 Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h Fri Jun 8 07:44:42 2012 (r237288) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h Fri Jun 8 08:36:29 2012 (r237289) @@ -39,8 +39,7 @@ * Arguments to mount UDF filingsystem. */ -//#define UDFMNT_VERSION 1 -#if 0 +#define UDFMNT_VERSION 1 struct udf_args { uint32_t version; /* version of this structure */ char *fspec; /* mount specifier */ @@ -58,13 +57,12 @@ /* extendable */ uint8_t reserved[32]; }; -#endif /* udf mount options */ -//#define UDFMNT_CLOSESESSION 0x00000001 /* close session on dismount */ -//#define UDFMNT_BITS "\20\1CLOSESESSION" +#define UDFMNT_CLOSESESSION 0x00000001 /* close session on dismount */ +#define UDFMNT_BITS "\20\1CLOSESESSION" #define UDFMNT_KICONV 100 #endif /* !_FS_UDF_UDF_MOUNT_H_ */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 8 07:44:42 2012 (r237288) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 8 08:36:29 2012 (r237289) @@ -34,7 +34,6 @@ #include #include /* We shouldn't be, but are dependent on this header. */ #include - #include "ecma167-udf.h" #include "udf.h" #include "udf_subr.h" @@ -3276,6 +3275,7 @@ dscr = NULL; error = 0; while (fsd_len || error) { + DPRINTF(VOLUMES, ("fsd_len = %d\n", fsd_len)); /* translate fsd_loc to lb_num */ error = udf_translate_vtop(ump, &fsd_loc, &lb_num, &dummy); if (error) @@ -3313,6 +3313,7 @@ /* follow up to fsd->next_ex (long_ad) if its not null */ if (le32toh(ump->fileset_desc->next_ex.len)) { + DPRINTF(VOLUMES, ("follow up FSD extent\n")); fsd_loc = ump->fileset_desc->next_ex; fsd_len = le32toh(ump->fileset_desc->next_ex.len); } @@ -3324,6 +3325,8 @@ if (ump->fileset_desc == NULL) return ENOENT; + DPRINTF(VOLUMES, ("FSD read in fine\n")); + DPRINTF(VOLUMES, ("Updating fsd logical volume id\n")); udf_update_logvolname(ump, ump->logical_vol->logvol_id); /* @@ -3508,7 +3511,7 @@ /* add node to the rb tree */ mutex_enter(&ump->ihash_lock); - rb_tree_insert_node(&ump->udf_node_tree, &udf_node->rbnode); + rb_tree_insert_node(&ump->udf_node_tree, &udf_node->rbnode); mutex_exit(&ump->ihash_lock); } @@ -3520,7 +3523,7 @@ /* remove node from the rb tree */ mutex_enter(&ump->ihash_lock); - rb_tree_remove_node(&ump->udf_node_tree, &udf_node->rbnode); + rb_tree_remove_node(&ump->udf_node_tree, &udf_node->rbnode); mutex_exit(&ump->ihash_lock); } @@ -5573,15 +5576,40 @@ int udf_dispose_node(struct udf_node *udf_node) { + //struct vnode *vp; int extnr; - if (!udf_node) + DPRINTF(NODE, ("udf_dispose_node called on node %p\n", udf_node)); + if (!udf_node) { + DPRINTF(NODE, ("UDF: Dispose node on node NULL, ignoring\n")); return 0; - -/* udf_cleanup_reservation(udf_node); */ + } +#if 0 + vp = udf_node->vnode; +#ifdef DIAGNOSTIC + if (vp->v_numoutput) + panic("disposing UDF node with pending I/O's, udf_node = %p, " + "v_numoutput = %d", udf_node, vp->v_numoutput); +#endif + udf_cleanup_reservation(udf_node); /* TODO extended attributes and streamdir */ + /* remove dirhash if present */ + dirhash_purge(&udf_node->dir_hash); + + /* remove from our hash lookup table */ + udf_deregister_node(udf_node); + + /* destroy our lock */ + mutex_destroy(&udf_node->node_mutex); + cv_destroy(&udf_node->node_lock); + + /* dissociate our udf_node from the vnode */ + genfs_node_destroy(udf_node->vnode); + vp->v_data = NULL; +#endif + /* free associated memory and the node itself */ for (extnr = 0; extnr < udf_node->num_extensions; extnr++) { /*udf_free_logvol_dscr(udf_node->ump, &udf_node->ext_loc[extnr], Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Fri Jun 8 07:44:42 2012 (r237288) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Fri Jun 8 08:36:29 2012 (r237289) @@ -187,11 +187,15 @@ char *fspec; td = curthread; - + DPRINTF(CALL, ("udf_mount called\n")); + /* + * Unconditionally mount as read-only. + */ MNT_ILOCK(mp); mp->mnt_flag |= MNT_RDONLY; MNT_IUNLOCK(mp); + /* No root filesystem support */ if (mp->mnt_flag & MNT_ROOTFS) return (ENOTSUP); @@ -204,6 +208,8 @@ error = vfs_getopt(mp->mnt_optnew, "from", (void **)&fspec, &len); if (!error && fspec[len - 1] != '\0') return (EINVAL); + + /* Check that the mount device exists */ if (fspec == NULL) return (EINVAL); @@ -218,6 +224,7 @@ return (error); } + /* Check the access rights on the mount device */ error = VOP_ACCESS(devvp, VREAD, td->td_ucred, td); if (error) error = priv_check(td, PRIV_VFS_MOUNT_PERM); @@ -236,7 +243,7 @@ } /* successfully mounted */ - + DPRINTF(VOLUMES, ("udf_mount() successfull\n")); #if 0 /* If we're not opened read-only, open its logical volume */ if ((mp->mnt_flag & MNT_RDONLY) == 0) { @@ -281,9 +288,10 @@ udf_unmount(struct mount *mp, int mntflags) { struct udf_mount *ump; - int error, flags; + int error, flags = 0; ump = VFSTOUDF(mp); + if (!ump) panic("UDF unmount: empty ump\n"); @@ -400,6 +408,7 @@ /* setup basic mount information */ + mp->mnt_data = NULL; mp->mnt_stat.f_fsid.val[0] = dev2udev(devvp->v_rdev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; mp->mnt_stat.f_namemax = UDF_MAX_NAMELEN; @@ -413,6 +422,7 @@ MNTK_EXTENDED_SHARED; MNT_IUNLOCK(mp); + /* allocate udf part of mount structure; malloc always succeeds */ ump = malloc(sizeof(struct udf_mount), M_UDFTEMP, M_WAITOK | M_ZERO); #if 0 @@ -422,6 +432,9 @@ mutex_init(&ump->get_node_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&ump->allocate_mutex, MUTEX_DEFAULT, IPL_NONE); cv_init(&ump->dirtynodes_cv, "udfsync2"); + + /* init rbtree for nodes, ordered by their icb address (long_ad) */ + udf_init_nodes_tree(ump); #endif /* set up linkage */ @@ -549,6 +562,9 @@ error = EINVAL; goto fail; } + + /*DPRINTF(VOLUMES, ("Read %d anchors on this disc, session %d\n", + num_anchors, args->sessionnr));*/ /* read in volume descriptor sequence */ if ((error = udf_read_vds_space(ump))) { From owner-svn-soc-all@FreeBSD.ORG Fri Jun 8 14:01:03 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 B3243106566C for ; Fri, 8 Jun 2012 14:01:01 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 08 Jun 2012 14:01:01 +0000 Date: Fri, 08 Jun 2012 14:01:01 +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: <20120608140101.B3243106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237309 - soc2012/gpf/pefs_kmod/sys/fs/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: Fri, 08 Jun 2012 14:01:03 -0000 Author: gpf Date: Fri Jun 8 14:01:01 2012 New Revision: 237309 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237309 Log: - replace call to pefs_lookup() with namei() Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Fri Jun 8 13:27:30 2012 (r237308) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Fri Jun 8 14:01:01 2012 (r237309) @@ -65,6 +65,7 @@ uint32_t pxsl_namelen; uint32_t pxsl_slink_len; char pxsl_filename[MAXPATHLEN]; + /* XXXgpf: rename to target */ char pxsl_slink[PEFS_SECTOR_SIZE]; }; Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Fri Jun 8 13:27:30 2012 (r237308) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Fri Jun 8 14:01:01 2012 (r237309) @@ -2358,7 +2358,7 @@ struct pefs_enccn enccn; struct componentname cn; struct pefs_chunk pc; - struct vop_cachedlookup_args la; + struct nameidata nd, *ndp = &nd; u_quad_t fsize; struct vnode *vp = ap->a_vp; struct vnode *lvp = PEFS_LOWERVP(vp); @@ -2581,8 +2581,6 @@ } break; case PEFS_GETSLINKCTEXT: - vn_lock(vp, LK_EXCLUSIVE); - if (vp->v_type != VDIR) { printf("pefs_ioctl: PEFS_GETSLINKCTEXT vp is not a directory\n"); VOP_UNLOCK(vp, 0); @@ -2602,31 +2600,25 @@ return (EINVAL); } - /* pefs_lookup() so that we can grab a vp for our symlink */ - la.a_dvp = vp; - la.a_vpp = &svp; - la.a_cnp = &cn; - - cn.cn_nameiop = LOOKUP; - cn.cn_thread = td; - cn.cn_cred = cred; - cn.cn_lkflags = LK_EXCLUSIVE; - cn.cn_flags = LOCKPARENT | LOCKLEAF | NOFOLLOW; - cn.cn_nameptr = xsl->pxsl_filename; - cn.cn_namelen = xsl->pxsl_namelen; - cn.cn_pnbuf = NULL; - cn.cn_consume = 0; - - /* XXXgpf: gleb says that maybe using namei() would be better */ - error = pefs_lookup(&la); + /* grab a vnodep for our symlink */ + NDINIT_ATVP(ndp, LOOKUP, MPSAFE | LOCKPARENT | LOCKLEAF | NOFOLLOW, UIO_SYSSPACE, xsl->pxsl_filename, vp, td); + error = namei(ndp); if (error != 0) { - printf("pefs_ioctl: PEFS_GETSLINKCTEXT lookup error %d", error); - VOP_UNLOCK(vp, 0); + printf("pefs_ioctl: PEFS_GETSLINKCTEXT namei error %d\n", error); return (error); } + NDFREE(ndp, NDF_ONLY_PNBUF); + svp = ndp->ni_vp; + + if (ndp->ni_dvp != vp) { + printf("pefs_ioctl: PEFS_GETSLINKCTEXT namei returned wrong parent\n"); + vput(svp); + VOP_UNLOCK(vp, 0); + return (ENOENT); + } if (svp->v_type != VLNK) { - printf("pefs_ioctl: PEFS_GETSLINKCTEXT svp is not a symlink '/'\n"); + printf("pefs_ioctl: PEFS_GETSLINKCTEXT svp is not a symlink\n"); vput(svp); VOP_UNLOCK(vp, 0); return (EFTYPE); @@ -2634,6 +2626,7 @@ /* VOP_READLINK our slvp */ slvp = PEFS_LOWERVP(svp); + pn = VP_TO_PN(svp); pefs_chunk_create(&pc, pn, MAXPATHLEN); puio = pefs_chunk_uio(&pc, 0, UIO_READ); From owner-svn-soc-all@FreeBSD.ORG Fri Jun 8 14:43:48 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 79970106564A for ; Fri, 8 Jun 2012 14:43:47 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 08 Jun 2012 14:43:47 +0000 Date: Fri, 08 Jun 2012 14:43:47 +0000 From: scher@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: <20120608144347.79970106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237310 - soc2012/scher/par_ports/head/Mk 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: Fri, 08 Jun 2012 14:43:48 -0000 Author: scher Date: Fri Jun 8 14:43:46 2012 New Revision: 237310 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237310 Log: [new_feature] correct termination of the whole process tree with background processes starting from parent make process To terminate the whole process tree, starting from some parent make process (pm_pid) one may just use keyboard interrupts in the right terminal (where the make process was started) or send signal to internal make script using pkill(1). e.g. pkill -P pm_pid Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Fri Jun 8 14:01:01 2012 (r237309) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Fri Jun 8 14:43:46 2012 (r237310) @@ -5118,11 +5118,38 @@ done; \ echo "debugging_out_here: --- LEAVE _PROCESS_ACTIVE_BUILDS SECTION " > ${PORTSDIR}/tmp/log +_TERMINATE_PROCESS_TREE= \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Terminating process tree strating from ${.MAKE.PID}; \ + pids_to_kill=${.MAKE.PID}; \ + /bin/kill -STOP ${.MAKE.PID} 2> /dev/null || ${DO_NADA}; \ + ppids=$$( ps -xao pid,ppid | awk "{ if (\$$2==${.MAKE.PID}) {print \$$1} }" ); \ + pids_to_kill="$${pids_to_kill} $${ppids}"; \ + /bin/kill -STOP "$${ppids%%$$$$*} $${ppids\#\#*$$$$}" 2> /dev/null || ${DO_NADA}; \ + while true; do \ + tmp_ppids=$$(${ECHO_CMD} $${ppids}); \ + ppids=""; \ + for ppid in $${tmp_ppids}; do \ + children=$$( ps -xao pid,ppid | awk "{ if (\$$2==$${ppid}) {print \$$1} }" ); \ + if [ $${\#children} -eq 0 ]; then continue; fi; \ + pids_to_kill="$${pids_to_kill} $${children}"; \ + ppids="$${ppids} $${children}"; \ + /bin/kill -STOP $${children} 2> /dev/null || ${DO_NADA}; \ + done; \ + if [ $${\#ppids} -eq 0 ]; then break; fi; \ + done; \ + ${ECHO_CMD} PIDs to kill: $${pids_to_kill}; \ + ${_dparv_START_OUTPUT}; \ + /bin/kill -KILL $${pids_to_kill} 2> /dev/null || ${DO_NADA} + .for deptype in PKG EXTRACT PATCH FETCH BUILD RUN ${deptype:L}-depends: .if defined(${deptype}_DEPENDS) .if !defined(NO_DEPENDS) - @depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ + @if [ ! ${INSTALLS_DEPENDS} ]; then \ + trap '${_TERMINATE_PROCESS_TREE}' INT TERM; \ + fi; \ + depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ active_builds=""; \ echo "debugging_out_here: ------------------------- " > ${PORTSDIR}/tmp/log; \ @@ -5265,7 +5292,11 @@ lib-depends: .if defined(LIB_DEPENDS) && !defined(NO_DEPENDS) - @depends=`${ECHO_CMD} "${LIB_DEPENDS}"`; \ + @if [ ! ${INSTALLS_DEPENDS} ]; then \ + trap '${_TERMINATE_PROCESS_TREE}' INT TERM; \ + fi; \ + depends=`${ECHO_CMD} "${LIB_DEPENDS}"`; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ active_builds=""; \ echo "debugging_out_here: ------------------------- " > ${PORTSDIR}/tmp/log; \ echo "debugging_out_here: ALL DEPS - $${depends}" > ${PORTSDIR}/tmp/log; \ From owner-svn-soc-all@FreeBSD.ORG Fri Jun 8 15:09:33 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 4FEF91065670 for ; Fri, 8 Jun 2012 15:09:31 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 08 Jun 2012 15:09:31 +0000 Date: Fri, 08 Jun 2012 15:09:31 +0000 From: rudot@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: <20120608150931.4FEF91065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237311 - soc2012/rudot/sys/kern 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: Fri, 08 Jun 2012 15:09:33 -0000 Author: rudot Date: Fri Jun 8 15:09:30 2012 New Revision: 237311 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237311 Log: more precise %cpu accounting - use also data for the yet unfinished second Modified: soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Fri Jun 8 14:43:46 2012 (r237310) +++ soc2012/rudot/sys/kern/kern_racct.c Fri Jun 8 15:09:30 2012 (r237311) @@ -55,6 +55,7 @@ #include #include #include +#include #ifdef RCTL #include @@ -272,25 +273,29 @@ racct_getpcpu(struct proc *p) { u_int swtime; - fixpt_t pctcpu; + fixpt_t p_pctcpu, pctcpu, pctcpu_next; struct thread *td; swtime = (ticks - p->p_swtick) / hz; if ((swtime == 0) || ((p->p_flag & P_INMEM) == 0)) return (0); - pctcpu = 0; + p_pctcpu = 0; FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); - pctcpu += sched_pctcpu(td); + pctcpu = sched_pctcpu(td); + /* Count also the yet unfinished second. */ + pctcpu_next = (pctcpu * ccpu_exp[1]) >> FSHIFT; + pctcpu_next += sched_pctcpu_delta(td); + p_pctcpu += max(pctcpu, pctcpu_next); thread_unlock(td); } if (swtime <= CCPU_EXP_MAX) { - return ((100 * pctcpu) / (FSCALE - ccpu_exp[swtime])); + return ((100 * p_pctcpu) / (FSCALE - ccpu_exp[swtime])); } - return ((100 * pctcpu) / FSCALE); + return ((100 * p_pctcpu) / FSCALE); } static void Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Fri Jun 8 14:43:46 2012 (r237310) +++ soc2012/rudot/sys/kern/sched_4bsd.c Fri Jun 8 15:09:30 2012 (r237311) @@ -1545,6 +1545,34 @@ return (ts->ts_pctcpu); } +fixpt_t +sched_pctcpu_delta(struct thread *td) +{ + struct td_sched *ts; + fixpt_t delta; + int realstathz; + + THREAD_LOCK_ASSERT(td, MA_OWNED); + ts = td->td_sched; + delta = 0; + realstathz = stathz ? stathz : hz; + if (ts->ts_cpticks != 0) { +#if (FSHIFT >= CCPU_SHIFT) + delta = (realstathz == 100) + ? ((fixpt_t) ts->ts_cpticks) << + (FSHIFT - CCPU_SHIFT) : + 100 * (((fixpt_t) ts->ts_cpticks) + << (FSHIFT - CCPU_SHIFT)) / realstathz; +#else + delta = ((FSCALE - ccpu) * + (ts->ts_cpticks * + FSCALE / realstathz)) >> FSHIFT; +#endif + } + + return (delta); +} + void sched_tick(int cnt) { From owner-svn-soc-all@FreeBSD.ORG Fri Jun 8 15:10: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 508C61065679 for ; Fri, 8 Jun 2012 15:10:13 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 08 Jun 2012 15:10:13 +0000 Date: Fri, 08 Jun 2012 15:10:13 +0000 From: oleksandr@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: <20120608151013.508C61065679@hub.freebsd.org> Cc: Subject: socsvn commit: r237312 - in soc2012/oleksandr/udf-head/sys/modules: udf2 udf2_iconv 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: Fri, 08 Jun 2012 15:10:15 -0000 Author: oleksandr Date: Fri Jun 8 15:10:13 2012 New Revision: 237312 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237312 Log: Prepare makefiles Added: soc2012/oleksandr/udf-head/sys/modules/udf2_iconv/ soc2012/oleksandr/udf-head/sys/modules/udf2_iconv/Makefile Modified: soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile Modified: soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile ============================================================================== --- soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile Fri Jun 8 15:09:30 2012 (r237311) +++ soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile Fri Jun 8 15:10:13 2012 (r237312) @@ -1,10 +1,12 @@ -# $FreeBSD$ +# $FreeBSD: src/sys/modules/udf2/Makefile,v 1.0 2012/06/08 11:28:50 ru Exp $ .PATH: ${.CURDIR}/../../fs/udf2 - + KMOD= udf2 -SRCS= udf_vfsops.c udf_vnops.c udf_osta.c +SRCS= udf_readwrite.c udf_subr.c udf_allocation.c \ + udf_osta.c udf_vfsops.c udf_vnops.c udf_filenames.c +# udf_strat_bootstrap.c udf_strat_direct.c udf_strat_rmw.c udf_strat_sequential.c SRCS+= vnode_if.h EXPORT_SYMS= udf_iconv Added: soc2012/oleksandr/udf-head/sys/modules/udf2_iconv/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/modules/udf2_iconv/Makefile Fri Jun 8 15:10:13 2012 (r237312) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../fs/udf2 +KMOD= udf2_iconv +SRCS= udf_iconv.c + +CFLAGS+= -I${.CURDIR}/../../ + +.include From owner-svn-soc-all@FreeBSD.ORG Fri Jun 8 15:21:02 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 33F001065670 for ; Fri, 8 Jun 2012 15:21:00 +0000 (UTC) (envelope-from vbotton@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 08 Jun 2012 15:21:00 +0000 Date: Fri, 08 Jun 2012 15:21:00 +0000 From: vbotton@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: <20120608152100.33F001065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237313 - soc2012/vbotton/ntfs_apple 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: Fri, 08 Jun 2012 15:21:02 -0000 Author: vbotton Date: Fri Jun 8 15:20:59 2012 New Revision: 237313 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237313 Log: replace many endianness functions, change ino64_t to ino_t Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.c soc2012/vbotton/ntfs_apple/ntfs_attr_list.c soc2012/vbotton/ntfs_apple/ntfs_collate.c soc2012/vbotton/ntfs_apple/ntfs_collate.h soc2012/vbotton/ntfs_apple/ntfs_compress.c soc2012/vbotton/ntfs_apple/ntfs_debug.c soc2012/vbotton/ntfs_apple/ntfs_dir.c soc2012/vbotton/ntfs_apple/ntfs_hash.c soc2012/vbotton/ntfs_apple/ntfs_index.c soc2012/vbotton/ntfs_apple/ntfs_index.h soc2012/vbotton/ntfs_apple/ntfs_inode.c soc2012/vbotton/ntfs_apple/ntfs_inode.h soc2012/vbotton/ntfs_apple/ntfs_layout.h soc2012/vbotton/ntfs_apple/ntfs_logfile.c soc2012/vbotton/ntfs_apple/ntfs_mft.c soc2012/vbotton/ntfs_apple/ntfs_mst.c soc2012/vbotton/ntfs_apple/ntfs_quota.c soc2012/vbotton/ntfs_apple/ntfs_runlist.c soc2012/vbotton/ntfs_apple/ntfs_secure.c soc2012/vbotton/ntfs_apple/ntfs_secure.h soc2012/vbotton/ntfs_apple/ntfs_types.h soc2012/vbotton/ntfs_apple/ntfs_unistr.c soc2012/vbotton/ntfs_apple/ntfs_usnjrnl.c soc2012/vbotton/ntfs_apple/ntfs_vfsops.c soc2012/vbotton/ntfs_apple/ntfs_vnops.c Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_attr.c Fri Jun 8 15:20:59 2012 (r237313) @@ -1121,7 +1121,7 @@ } else { /* We want an extent record. */ err = ntfs_extent_mft_record_map_ext(base_ni, - le64_to_cpu( + le64toh( al_entry->mft_reference), &ni, &ctx->m, ctx->is_mft_locked); if (err) { @@ -1493,7 +1493,7 @@ memmove(a, (u8*)a + le32toh(a->length), new_muse - ((u8*)a - (u8*)m)); /* Adjust @m to reflect the change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); + m->bytes_in_use = htole32(new_muse); } /** @@ -1726,7 +1726,7 @@ /* Move attributes starting with @a to make space of @size bytes. */ memmove((u8*)a + size, a, muse - ((u8*)a - (u8*)m)); /* Adjust @m to reflect the change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); + m->bytes_in_use = htole32(new_muse); /* Clear the created space so we start with a clean slate. */ bzero(a, size); /* @@ -1734,7 +1734,7 @@ * We do this here so that the caller does not need to worry about * rounding up the size to set the attribute length. */ - a->length = cpu_to_le32(size); + a->length = htole32(size); return 0; } @@ -1775,10 +1775,10 @@ memmove((u8*)a + new_size, (u8*)a + old_size, muse - ((u8*)a - (u8*)m) - old_size); /* Adjust @m to reflect the change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); + m->bytes_in_use = htole32(new_muse); /* Adjust @a to reflect the new size. */ if (new_size >= offsetof(ATTR_REC, length) + sizeof(a->length)) - a->length = cpu_to_le32(new_size); + a->length = htole32(new_size); } return 0; } @@ -2368,7 +2368,7 @@ */ m->next_attr_instance = htole16( (le16toh(m->next_attr_instance) + 1) & 0xffff); - a->value_length = cpu_to_le32(val_len); + a->value_length = htole32(val_len); a->value_offset = htole16(val_ofs); if (type == AT_FILENAME) a->resident_flags = RESIDENT_ATTR_IS_INDEXED; @@ -2590,7 +2590,7 @@ */ m->next_attr_instance = htole16( (le16toh(m->next_attr_instance) + 1) & 0xffff); - a->value_length = cpu_to_le32(val_len); + a->value_length = htole32(val_len); a->value_offset = htole16(val_ofs); if (type == AT_FILENAME) a->resident_flags = RESIDENT_ATTR_IS_INDEXED; @@ -2895,7 +2895,7 @@ bzero((u8*)a + le16toh(a->value_offset) + old_size, new_size - old_size); /* Finally update the length of the attribute value. */ - a->value_length = cpu_to_le32(new_size); + a->value_length = htole32(new_size); return 0; } @@ -3978,7 +3978,7 @@ "le16toh(" "a->value_offset)\n", __FUNCTION__); - a->value_length = cpu_to_le32(new_init_size); + a->value_length = htole32(new_init_size); } data_size_updated = TRUE; if (ni == base_ni && !S_ISDIR(ni->mode)) @@ -4135,7 +4135,7 @@ */ kattr = (u8*)a + le16toh(a->value_offset); bzero(kattr + attr_len, new_init_size - attr_len); - a->value_length = cpu_to_le32((u32)new_init_size); + a->value_length = htole32((u32)new_init_size); /* Update the sizes in the ntfs inode as well as the ubc size. */ mtx_lock_spin(&ni->size_lock); ni->initialized_size = ni->data_size = size = new_init_size; @@ -6131,14 +6131,14 @@ (u32)new_data_size - attr_len); mtx_lock_spin(&ni->size_lock); ni->initialized_size = ni->data_size = new_data_size; - a->value_length = cpu_to_le32((u32)new_data_size); + a->value_length = htole32((u32)new_data_size); } else mtx_lock_spin(&ni->size_lock); ni->allocated_size = le32toh(a->length) - le16toh(a->value_offset); mtx_unlock_spin(&ni->size_lock); if (new_data_size > attr_len) - a->value_length = cpu_to_le32((u32)new_data_size); + a->value_length = htole32((u32)new_data_size); goto dirty_done; } /* @@ -8544,7 +8544,7 @@ } else { /* We want an extent mft record. */ err = ntfs_extent_mft_record_map(base_ni, - le64_to_cpu(al_entry->mft_reference), + le64toh(al_entry->mft_reference), &eni, &m); if (err) { ntfs_error(vol->mp, "Failed to map extent mft " Modified: soc2012/vbotton/ntfs_apple/ntfs_attr_list.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr_list.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_attr_list.c Fri Jun 8 15:20:59 2012 (r237313) @@ -92,7 +92,7 @@ entry = (ATTR_LIST_ENTRY*)al; al_end = (u8*)al + ni->attr_list_size; for (;; entry = (ATTR_LIST_ENTRY*)((u8*)entry + - le16_to_cpu(entry->length))) { + le16toh(entry->length))) { /* Out of bounds check. */ if ((u8*)entry < al || (u8*)entry > al_end) goto err; @@ -278,7 +278,7 @@ mref = MK_LE_MREF(base_ni->mft_no, base_ni->seq_no); /* Maximum number of usable bytes in the mft record. */ bytes_free = le32_to_cpu(m->bytes_allocated) - - le16_to_cpu(m->attrs_offset); + le16toh(m->attrs_offset); do { unsigned al_entry_len, len; @@ -374,7 +374,7 @@ /* Copy the name if the attribute is named. */ if (a->name_length) memcpy(&al_entry->name, - (u8*)a + le16_to_cpu(a->name_offset), + (u8*)a + le16toh(a->name_offset), a->name_length * sizeof(ntfschar)); /* Zero the padding area at the end if it exists. */ if (al_entry_len - len > 0) @@ -416,7 +416,7 @@ attr_len > le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use); al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length))) { + le16toh(al_entry->length))) { /* Get the next attribute in the mft record. */ err = ntfs_attr_find_in_mft_record(AT_UNUSED, NULL, 0, NULL, 0, &al_ctx); @@ -528,7 +528,7 @@ err = ntfs_resident_attr_record_insert_internal(m, a, AT_ATTRIBUTE_LIST, NULL, 0, al_size); if (!err) { - memcpy((u8*)a + le16_to_cpu(a->value_offset), al, + memcpy((u8*)a + le16toh(a->value_offset), al, al_size); /* * If we already allocated some clusters in a previous @@ -720,7 +720,7 @@ * But first find the attribute list entry matching the * attribute record so it can be updated. */ - a_name = (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)); + a_name = (ntfschar*)((u8*)a + le16toh(a->name_offset)); al_entry = (ATTR_LIST_ENTRY*)base_ni->attr_list; do { /* @@ -754,7 +754,7 @@ } /* Go to the next attribute list entry. */ al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length)); + le16toh(al_entry->length)); } while (1); err = ntfs_attr_record_move_for_attr_list_attribute(&al_ctx, al_entry, ctx, NULL); @@ -789,7 +789,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); a->highest_vcn = cpu_to_sle64((attr_len / vol->cluster_size) - 1); a->allocated_size = cpu_to_sle64(attr_len); a->initialized_size = a->data_size = cpu_to_sle64(al_size); @@ -888,7 +888,7 @@ ctx->base_ni = base_ni; ctx->base_m = m; ctx->base_a = (ATTR_RECORD*)((u8*)m + - le16_to_cpu(m->attrs_offset)); + le16toh(m->attrs_offset)); } ntfs_debug("Done."); return 0; @@ -926,7 +926,7 @@ al_end = al + al_size; for (al_entry = (ATTR_LIST_ENTRY*)al; (u8*)al_entry < al_end; al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length))) { + le16toh(al_entry->length))) { ntfs_inode *ni; ntfschar *a_name; u8 *val; @@ -938,7 +938,7 @@ retry_undo_map: /* Find the extent record in the base ntfs inode. */ err2 = ntfs_extent_mft_record_map(base_ni, - le64_to_cpu(al_entry->mft_reference), &ni, &m); + le64toh(al_entry->mft_reference), &ni, &m); if (err2) { if (err2 == ENOMEM) goto retry_undo_map; @@ -969,7 +969,7 @@ continue; } /* Find the attribute record that needs moving back. */ - a = (ATTR_RECORD*)((u8*)m + le16_to_cpu(m->attrs_offset)); + a = (ATTR_RECORD*)((u8*)m + le16toh(m->attrs_offset)); if (a->type == AT_END) panic("%s(): a->type == AT_END\n", __FUNCTION__); while (a->instance != al_entry->instance) { @@ -982,7 +982,7 @@ if (al_entry->type != a->type) panic("%s(): al_entry->type != a->type\n", __FUNCTION__); - a_name = (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)); + a_name = (ntfschar*)((u8*)a + le16toh(a->name_offset)); if (!ntfs_are_names_equal((ntfschar*)((u8*)al_entry + al_entry->name_offset), al_entry->name_length, a_name, a->name_length, TRUE, vol->upcase, @@ -998,7 +998,7 @@ * attribute. */ if (a->type == AT_FILENAME) { - val = (u8*)a + le16_to_cpu(a->value_offset); + val = (u8*)a + le16toh(a->value_offset); val_len = le32_to_cpu(a->value_length); } else { val = NULL; @@ -1038,7 +1038,7 @@ * Increment the next attribute instance number in the mft * record as we consumed the old one. */ - al_ctx.m->next_attr_instance = htole16((le16_to_cpu( + al_ctx.m->next_attr_instance = htole16((le16toh( al_ctx.m->next_attr_instance) + 1) & 0xffff); /* * If this is the only attribute in the extent mft record, free @@ -1181,7 +1181,7 @@ update_resident: /* Update the part of the attribute value that has changed. */ if (start_ofs < ni->attr_list_size) { - memcpy((u8*)a + le16_to_cpu(a->value_offset) + + memcpy((u8*)a + le16toh(a->value_offset) + start_ofs, ni->attr_list + start_ofs, ni->attr_list_size - start_ofs); dirty_mft = TRUE; @@ -1194,20 +1194,20 @@ */ rw_wlock(&ni->attr_list_rl.lock); /* Update the attribute sizes. */ - if (ni->attr_list_size < sle64_to_cpu(a->initialized_size)) + if (ni->attr_list_size < sle64toh(a->initialized_size)) a->initialized_size = cpu_to_sle64(ni->attr_list_size); a->data_size = cpu_to_sle64(ni->attr_list_size); dirty_mft = TRUE; alloc_size = (ni->attr_list_size + vol->cluster_size_mask) & ~vol->cluster_size_mask; - if (alloc_size > sle64_to_cpu(a->allocated_size)) - panic("%s(): alloc_size > sle64_to_cpu(a->allocated_size)\n", + if (alloc_size > sle64toh(a->allocated_size)) + panic("%s(): alloc_size > sle64toh(a->allocated_size)\n", __FUNCTION__); /* * If the attribute allocation has not changed we are done with the * resize and go straight onto the data update. */ - if (alloc_size == sle64_to_cpu(a->allocated_size)) + if (alloc_size == sle64toh(a->allocated_size)) goto update_non_resident; /* * The allocated size has shrunk by at least one cluster thus we need @@ -1246,7 +1246,7 @@ goto err; } err = ntfs_mapping_pairs_build(vol, (s8*)a + - le16_to_cpu(a->mapping_pairs_offset), mp_size, + le16toh(a->mapping_pairs_offset), mp_size, ni->attr_list_rl.rl, 0, -1, NULL); if (err) { ntfs_error(vol->mp, "Cannot shrink attribute list attribute " @@ -1259,7 +1259,7 @@ a->highest_vcn = cpu_to_sle64((alloc_size >> vol->cluster_size_shift) - 1); err = ntfs_attr_record_resize(ctx->m, a, - le16_to_cpu(a->mapping_pairs_offset) + mp_size); + le16toh(a->mapping_pairs_offset) + mp_size); /* Shrinking the attribute record cannot fail. */ if (err) panic("%s(): err (non-resident)\n", __FUNCTION__); @@ -1411,7 +1411,7 @@ * Update the part of the attribute list attribute record value * that has changed. */ - memcpy((u8*)al_a + le16_to_cpu(al_a->value_offset) + al_ofs, + memcpy((u8*)al_a + le16toh(al_a->value_offset) + al_ofs, base_ni->attr_list + al_ofs, base_ni->attr_list_size - al_ofs); goto done; @@ -1429,7 +1429,7 @@ ((le32_to_cpu(al_a->value_length) + 7) & ~7); /* Maximum number of usable bytes in the mft record. */ bytes_free = le32_to_cpu(base_m->bytes_allocated) - - le16_to_cpu(base_m->attrs_offset); + le16toh(base_m->attrs_offset); /* * If the attribute list attribute has become bigger than fits in an * mft record switch it to a non-resident attribute record. @@ -1540,7 +1540,7 @@ * But first find the attribute list entry matching the * attribute record so it can be updated. */ - a_name = (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)); + a_name = (ntfschar*)((u8*)a + le16toh(a->name_offset)); al_entry = (ATTR_LIST_ENTRY*)base_ni->attr_list; al_end = base_ni->attr_list + base_ni->attr_list_size; do { @@ -1590,7 +1590,7 @@ } /* Go to the next attribute list entry. */ al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length)); + le16toh(al_entry->length)); } while (1); err = ntfs_attr_record_move_for_attr_list_attribute(&actx, al_entry, ctx, &remap_needed); @@ -1639,7 +1639,7 @@ * Update the part of the attribute list attribute record value * that has changed. */ - memcpy((u8*)al_a + le16_to_cpu(al_a->value_offset) + al_ofs, + memcpy((u8*)al_a + le16toh(al_a->value_offset) + al_ofs, base_ni->attr_list + al_ofs, base_ni->attr_list_size - al_ofs); /* @@ -1743,7 +1743,7 @@ if (!al_a->non_resident) panic("%s(): !al_a->non_resident\n", __FUNCTION__); /* Allocate more disk space if needed. */ - if (base_ni->attr_list_size <= sle64_to_cpu(al_a->allocated_size)) + if (base_ni->attr_list_size <= sle64toh(al_a->allocated_size)) goto skip_alloc; /* Work out the new allocated size we need. */ alloc_size = (base_ni->attr_list_size + vol->cluster_size_mask) & @@ -1771,9 +1771,9 @@ */ runlist.rl = NULL; runlist.alloc = runlist.elements = 0; - err = ntfs_cluster_alloc(vol, sle64_to_cpu(al_a->allocated_size) >> + err = ntfs_cluster_alloc(vol, sle64toh(al_a->allocated_size) >> vol->cluster_size_shift, (alloc_size - - sle64_to_cpu(al_a->allocated_size)) >> + sle64toh(al_a->allocated_size)) >> vol->cluster_size_shift, lcn, DATA_ZONE, TRUE, &runlist); if (err) { @@ -1781,7 +1781,7 @@ "non-resident attribute list attribute in " "base mft record 0x%llx (error %d).", ((alloc_size - - sle64_to_cpu(al_a->allocated_size)) >> + sle64toh(al_a->allocated_size)) >> vol->cluster_size_shift) > 1 ? "s" : "", (unsigned long long)base_ni->mft_no, err); goto unl_done; @@ -1809,7 +1809,7 @@ if (err) panic("%s(): err (ntfs_get_size_for_mapping_pairs(), " "non-resident)\n", __FUNCTION__); - mp_ofs = le16_to_cpu(al_a->mapping_pairs_offset); + mp_ofs = le16toh(al_a->mapping_pairs_offset); old_arec_size = le32_to_cpu(al_a->length); /* Extend the attribute record to fit the bigger mapping pairs array. */ err = ntfs_attr_record_resize(base_m, al_a, mp_ofs + mp_size); @@ -1975,7 +1975,7 @@ * But first find the attribute list entry matching the * attribute record so it can be updated. */ - a_name = (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)); + a_name = (ntfschar*)((u8*)a + le16toh(a->name_offset)); al_entry = (ATTR_LIST_ENTRY*)base_ni->attr_list; al_end = base_ni->attr_list + base_ni->attr_list_size; do { @@ -2025,7 +2025,7 @@ } /* Go to the next attribute list entry. */ al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length)); + le16toh(al_entry->length)); } while (1); err = ntfs_attr_record_move_for_attr_list_attribute(&actx, al_entry, ctx, &remap_needed); @@ -2187,7 +2187,7 @@ "end_entry offset 0x%lx, bytes to_delete 0x%x.", (unsigned long long)ni->mft_no, le32_to_cpu(start_entry->type), - (unsigned)le16_to_cpu(start_entry->length), + (unsigned)le16toh(start_entry->length), (unsigned long)((u8*)start_entry - ni->attr_list), (unsigned long)((u8*)end_entry - ni->attr_list), to_delete); Modified: soc2012/vbotton/ntfs_apple/ntfs_collate.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_collate.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_collate.c Fri Jun 8 15:20:59 2012 (r237313) @@ -35,6 +35,8 @@ * http://developer.apple.com/opensource/licenses/gpl-2.txt. */ +#include +#include #include "ntfs_collate.h" #include "ntfs_debug.h" @@ -143,8 +145,8 @@ min_len = data2_len; min_len >>= 2; for (i = 0; i < min_len; i++) { - const u32 u1 = le32_to_cpu(p1[i]); - const u32 u2 = le32_to_cpu(p2[i]); + const u32 u1 = le32toh(p1[i]); + const u32 u2 = le32toh(p2[i]); if (u1 > u2) { rc = 1; goto out; @@ -201,7 +203,7 @@ const void *data2, const int data2_len) { int i; - i = le32_to_cpu(cr); + i = le32toh(cr); ntfs_debug("Entering (collation rule 0x%x, data1_len 0x%x, data2_len " "0x%x).", i, data1_len, data2_len); /* Modified: soc2012/vbotton/ntfs_apple/ntfs_collate.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_collate.h Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_collate.h Fri Jun 8 15:20:59 2012 (r237313) @@ -52,7 +52,7 @@ */ if (cr == COLLATION_UNICODE_STRING) return FALSE; - i = le32_to_cpu(cr); + i = le32toh(cr); if (((i >= 0) && (i <= 0x02)) || ((i >= 0x10) && (i <= 0x13))) return TRUE; return FALSE; Modified: soc2012/vbotton/ntfs_apple/ntfs_compress.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_compress.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_compress.c Fri Jun 8 15:20:59 2012 (r237313) @@ -37,18 +37,10 @@ #include #include -#include #include #include -#include - -#include - -#include - -#include -#include +#include #include "ntfs.h" #include "ntfs_attr.h" @@ -378,7 +370,7 @@ * position in the compression block is one byte before its end so the * first two checks do not detect it. */ - if (cb == cb_end || !le16_to_cpup((le16*)cb) || dst == dst_end) { + if (cb == cb_end || !le16tohp((le16*)cb) || dst == dst_end) { ntfs_debug("Done."); return 0; } @@ -393,7 +385,7 @@ goto err; /* Setup the current sub-block source pointers and validate range. */ cb_sb_start = cb; - cb_sb_end = cb + (le16_to_cpup((le16*)cb) & NTFS_SB_SIZE_MASK) + 3; + cb_sb_end = cb + (le16tohp((le16*)cb) & NTFS_SB_SIZE_MASK) + 3; if (cb_sb_end > cb_end) goto err; /* @@ -432,7 +424,7 @@ } } /* Now, we are ready to process the current sub-block. */ - if (!(le16_to_cpup((le16*)cb) & NTFS_SB_IS_COMPRESSED)) { + if (!(le16tohp((le16*)cb) & NTFS_SB_IS_COMPRESSED)) { /* * This sb is not compressed, just copy its data into the * destination buffer. @@ -509,7 +501,7 @@ for (u = dst - dst_sb_start - 1; u >= 0x10; u >>= 1) lg++; /* Get the phrase token. */ - pt = le16_to_cpup((u16*)cb); + pt = le16tohp((u16*)cb); /* * Calculate starting position of the byte sequence in the * destination using the fact that p = (pt >> (12 - lg)) + 1 @@ -814,7 +806,7 @@ */ ntfs_debug("Found compressed compression block."); if (!cb) { - cb = OSMalloc(cb_size, ntfs_malloc_tag); + cb = malloc(cb_size); if (!cb) { ntfs_error(vol->mp, "Not enough memory to allocate " "temporary buffer."); @@ -881,7 +873,7 @@ if (uio) uio_free(uio); if (cb) - OSFree(cb, cb_size, ntfs_malloc_tag); + free(cb); ntfs_debug("Done."); return 0; cl_err: @@ -900,7 +892,7 @@ if (uio) uio_free(uio); if (cb) - OSFree(cb, cb_size, ntfs_malloc_tag); + free(cb); ntfs_error(vol->mp, "Failed (error %d).", err); return err; } Modified: soc2012/vbotton/ntfs_apple/ntfs_debug.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_debug.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_debug.c Fri Jun 8 15:20:59 2012 (r237313) @@ -314,20 +314,20 @@ printf("NTFS-fs DEBUG: Dumping attribute list (size 0x%x):\n", size); for (entry = (ATTR_LIST_ENTRY*)al, u = 1; (u8*)entry < end; entry = (ATTR_LIST_ENTRY*)((u8*)entry + - le16_to_cpu(entry->length)), u++) { + le16toh(entry->length)), u++) { printf("--------------- Entry %u ---------------\n", u); printf("Attribute type: 0x%x\n", (unsigned)le32_to_cpu(entry->type)); printf("Record length: 0x%x\n", - (unsigned)le16_to_cpu(entry->length)); + (unsigned)le16toh(entry->length)); printf("Name length: 0x%x\n", (unsigned)entry->name_length); printf("Name offset: 0x%x\n", (unsigned)entry->name_offset); printf("Starting VCN: 0x%llx\n", (unsigned long long) - sle64_to_cpu(entry->lowest_vcn)); + sle64toh(entry->lowest_vcn)); printf("MFT reference: 0x%llx\n", (unsigned long long) MREF_LE(entry->mft_reference)); printf("Instance: 0x%x\n", - (unsigned)le16_to_cpu(entry->instance)); + (unsigned)le16toh(entry->instance)); } printf("--------------- End of attribute list ---------------\n"); } Modified: soc2012/vbotton/ntfs_apple/ntfs_dir.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_dir.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_dir.c Fri Jun 8 15:20:59 2012 (r237313) @@ -167,7 +167,7 @@ * Get to the index root value (it has been verified in * ntfs_index_inode_read()). */ - ir = (INDEX_ROOT*)((u8*)ctx->a + le16_to_cpu(ctx->a->value_offset)); + ir = (INDEX_ROOT*)((u8*)ctx->a + le16toh(ctx->a->value_offset)); index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); /* The first index entry. */ ie = (INDEX_ENTRY*)((u8*)&ir->index + @@ -176,13 +176,13 @@ * Loop until we exceed valid memory (corruption case) or until we * reach the last entry. */ - for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16toh(ie->length))) { ntfs_debug("In index root, offset 0x%x.", (unsigned)((u8*)ie - (u8*)ir)); /* Bounds checks. */ if ((u8*)ie < (u8*)&ir->index || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || - (u8*)ie + le16_to_cpu(ie->key_length) > + (u8*)ie + le16toh(ie->key_length) > index_end) goto dir_err; /* @@ -228,7 +228,7 @@ goto put_err; } } - name->mref = le64_to_cpu(ie->indexed_file); + name->mref = le64toh(ie->indexed_file); name->type = FILENAME_DOS; name->len = len = ie->key.filename. filename_length; @@ -240,7 +240,7 @@ ntfs_malloc_tag); *res_name = NULL; } - *res_mref = le64_to_cpu(ie->indexed_file); + *res_mref = le64toh(ie->indexed_file); ntfs_attr_search_ctx_put(ctx); ntfs_mft_record_unmap(dir_ni); rw_unlock(&ia_ni->lock); @@ -279,7 +279,7 @@ goto put_err; } } - name->mref = le64_to_cpu(ie->indexed_file); + name->mref = le64toh(ie->indexed_file); name->type = type; name->len = len = ie->key.filename. filename_length; @@ -347,7 +347,7 @@ goto put_err; } /* Get the starting vcn of the index block holding the child node. */ - vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); + vcn = sle64tohp((sle64*)((u8*)ie + le16toh(ie->length) - 8)); /* * We are done with the index root and the mft record. Release them, * otherwise we deadlock with ntfs_page_map(). @@ -387,12 +387,12 @@ (unsigned long long)dir_ni->mft_no); goto page_err; } - if (sle64_to_cpu(ia->index_block_vcn) != vcn) { + if (sle64toh(ia->index_block_vcn) != vcn) { ntfs_error(mp, "Actual VCN (0x%llx) of index buffer is " "different from expected VCN (0x%llx). " "Directory inode 0x%llx is corrupt or driver " "bug.", (unsigned long long) - sle64_to_cpu(ia->index_block_vcn), + sle64toh(ia->index_block_vcn), (unsigned long long)vcn, (unsigned long long)dir_ni->mft_no); goto page_err; @@ -436,11 +436,11 @@ * loop until we exceed valid memory (corruption case) or until we * reach the last entry. */ - for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16toh(ie->length))) { /* Bounds check. */ if ((u8*)ie < (u8*)&ia->index || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || - (u8*)ie + le16_to_cpu(ie->key_length) > + (u8*)ie + le16toh(ie->key_length) > index_end) { ntfs_error(mp, "Index entry out of bounds in " "directory inode 0x%llx.", @@ -490,7 +490,7 @@ goto page_err; } } - name->mref = le64_to_cpu(ie->indexed_file); + name->mref = le64toh(ie->indexed_file); name->type = FILENAME_DOS; name->len = len = ie->key.filename. filename_length; @@ -502,7 +502,7 @@ ntfs_malloc_tag); *res_name = NULL; } - *res_mref = le64_to_cpu(ie->indexed_file); + *res_mref = le64toh(ie->indexed_file); ntfs_page_unmap(ia_ni, upl, pl, FALSE); rw_unlock(&ia_ni->lock); (void)vnode_put(ia_vn); @@ -543,7 +543,7 @@ goto page_err; } } - name->mref = le64_to_cpu(ie->indexed_file); + name->mref = le64toh(ie->indexed_file); name->type = type; name->len = len = ie->key.filename. filename_length; @@ -604,8 +604,8 @@ } /* Child node present, descend into it. */ old_vcn = vcn; - vcn = sle64_to_cpup((sle64*)((u8*)ie + - le16_to_cpu(ie->length) - 8)); + vcn = sle64tohp((sle64*)((u8*)ie + + le16toh(ie->length) - 8)); if (vcn >= 0) { /* * If @vcn is in the same page cache page as @old_vcn @@ -685,7 +685,7 @@ static inline int ntfs_do_dirent(ntfs_volume *vol, INDEX_ENTRY *ie, struct dirent *de, uio_t uio, int *entries) { - ino64_t mref; + ino_t mref; u8 *utf8_name; size_t utf8_size; signed res_size, padding; @@ -1438,7 +1438,7 @@ * old name then reuse its buffer if the two are the same size * and otherwise free the old name first. */ - size = le16_to_cpu(ictx->entry->key_length); + size = le16toh(ictx->entry->key_length); if (dh->fn_size != size) { if (dh->fn_size) OSFree(dh->fn, dh->fn_size, ntfs_malloc_tag); @@ -1581,7 +1581,7 @@ * Get to the index root value (it has been verified in * ntfs_inode_read()). */ - ir = (INDEX_ROOT*)((u8*)ctx->a + le16_to_cpu(ctx->a->value_offset)); + ir = (INDEX_ROOT*)((u8*)ctx->a + le16toh(ctx->a->value_offset)); index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); /* The first index entry. */ ie = (INDEX_ENTRY*)((u8*)&ir->index + @@ -1589,7 +1589,7 @@ /* Bounds checks. */ if ((u8*)ie < (u8*)&ir->index || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || - (u8*)ie + le16_to_cpu(ie->key_length) > index_end) + (u8*)ie + le16toh(ie->key_length) > index_end) goto dir_err; /* * If this is not the end node, it is a filename and thus the directory @@ -1700,13 +1700,13 @@ (unsigned long long)dir_ni->mft_no, es2); goto vol_err; } - if (sle64_to_cpu(ia->index_block_vcn) != (ia_pos & + if (sle64toh(ia->index_block_vcn) != (ia_pos & ~(s64)(ia_ni->block_size - 1)) >> ia_ni->vcn_size_shift) { ntfs_error(vol->mp, "Actual VCN (0x%llx) of index record is " "different from expected VCN (0x%llx)%s%llx%s", (unsigned long long) - sle64_to_cpu(ia->index_block_vcn), + sle64toh(ia->index_block_vcn), (unsigned long long)ia_pos >> ia_ni->vcn_size_shift, es1, (unsigned long long)dir_ni->mft_no, es2); @@ -1719,7 +1719,7 @@ "(%u) differing from the directory specified " "size (%u)%s%llx%s", (unsigned long long) (unsigned long long) - sle64_to_cpu(ia->index_block_vcn), + sle64toh(ia->index_block_vcn), (unsigned)(offsetof(INDEX_BLOCK, index) + le32_to_cpu(ia->index.allocated_size)), (unsigned)ia_ni->block_size, es1, @@ -1733,7 +1733,7 @@ "cannot happen and points either to memory " "corruption or to a driver bug.", (unsigned long long) - sle64_to_cpu(ia->index_block_vcn), + sle64toh(ia->index_block_vcn), (unsigned long long)dir_ni->mft_no); goto vol_err; } @@ -1742,7 +1742,7 @@ ntfs_error(vol->mp, "Size of index block (VCN 0x%llx) " "exceeds maximum size%s%llx%s", (unsigned long long) - sle64_to_cpu(ia->index_block_vcn), es1, + sle64toh(ia->index_block_vcn), es1, (unsigned long long)dir_ni->mft_no, es2); goto vol_err; } @@ -1752,7 +1752,7 @@ /* Bounds checks. */ if ((u8*)ie < (u8*)&ia->index || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || - (u8*)ie + le16_to_cpu(ie->key_length) > index_end) + (u8*)ie + le16toh(ie->key_length) > index_end) goto dir_err; /* * If this is the end node, it is not a filename so we continue to the @@ -1919,8 +1919,8 @@ "parent directory (0x%llx) specified in the " "matching directory index entry. Volume is " "corrupt. Run chkdsk.", (unsigned long long) - le64_to_cpu(fn->parent_directory), - (unsigned long long)le64_to_cpu( + le64toh(fn->parent_directory), + (unsigned long long)le64toh( ie->key.filename.parent_directory)); NVolSetErrors(vol); err = EIO; @@ -1940,7 +1940,7 @@ "chkdsk.", (unsigned long long) MK_MREF(ni->mft_no, ni->seq_no), (unsigned long long) - le64_to_cpu(ie->indexed_file)); + le64toh(ie->indexed_file)); NVolSetErrors(vol); err = EIO; goto put_err; Modified: soc2012/vbotton/ntfs_apple/ntfs_hash.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_hash.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_hash.c Fri Jun 8 15:20:59 2012 (r237313) @@ -111,7 +111,7 @@ * volume @vol. */ static inline unsigned long ntfs_inode_hash(const ntfs_volume *vol, - const ino64_t mft_no) + const ino_t mft_no) { return (vol->dev + mft_no) & ntfs_inode_hash_mask; } @@ -125,7 +125,7 @@ * @mft_no on the volume @vol. */ static inline ntfs_inode_list_head *ntfs_inode_hash_list(const ntfs_volume *vol, - const ino64_t mft_no) + const ino_t mft_no) { return ntfs_inode_hash_table + ntfs_inode_hash(vol, mft_no); } Modified: soc2012/vbotton/ntfs_apple/ntfs_index.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_index.c Fri Jun 8 15:10:13 2012 (r237312) +++ soc2012/vbotton/ntfs_apple/ntfs_index.c Fri Jun 8 15:20:59 2012 (r237313) @@ -204,7 +204,7 @@ le32_to_cpu(actx->m->bytes_in_use); /* Get to the index root value. */ ictx->ir = (INDEX_ROOT*)((u8*)actx->a + - le16_to_cpu(actx->a->value_offset)); + le16toh(actx->a->value_offset)); delta = (u8*)&ictx->ir->index - (u8*)ictx->index; ictx->index = &ictx->ir->index; } else { @@ -378,14 +378,14 @@ * reach the last entry and for each entry place a pointer to it into * our array of entry pointers. */ - for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16toh(ie->length))) { /* Bounds checks. */ if ((u8*)ie < (u8*)index || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || - (u8*)ie + le16_to_cpu(ie->length) > index_end || + (u8*)ie + le16toh(ie->length) > index_end || (u32)sizeof(INDEX_ENTRY_HEADER) + - le16_to_cpu(ie->key_length) > - le16_to_cpu(ie->length)) + le16toh(ie->key_length) > + le16toh(ie->length)) goto err; /* Add this entry to the array of entry pointers. */ if (nr_entries >= max_entries) @@ -396,11 +396,11 @@ break; /* Further bounds checks for view indexes. */ if (is_view && ((u32)sizeof(INDEX_ENTRY_HEADER) + - le16_to_cpu(ie->key_length) > - le16_to_cpu(ie->data_offset) || - (u32)le16_to_cpu(ie->data_offset) + - le16_to_cpu(ie->data_length) > - le16_to_cpu(ie->length))) + le16toh(ie->key_length) > + le16toh(ie->data_offset) || + (u32)le16toh(ie->data_offset) + + le16toh(ie->data_length) > + le16toh(ie->length))) goto err; } /* Except for the index root, leaf nodes are not allowed to be empty. */ @@ -536,7 +536,7 @@ unsigned max_root_entries; max_root_entries = 1 + ((idx_ni->vol->mft_record_size - - le16_to_cpu(m->attrs_offset) - + le16toh(m->attrs_offset) - offsetof(ATTR_RECORD, reservedR) - sizeof(((ATTR_RECORD*)NULL)->reservedR) - sizeof(INDEX_ROOT) - @@ -549,7 +549,7 @@ * Get to the index root value (it has been verified when the inode was * read in ntfs_index_inode_read()). */ - ir = (INDEX_ROOT*)((u8*)actx->a + le16_to_cpu(actx->a->value_offset)); + ir = (INDEX_ROOT*)((u8*)actx->a + le16toh(actx->a->value_offset)); ictx->index = &ir->index; /* * Gather the index entry pointers and finish setting up the index @@ -626,8 +626,8 @@ goto err; } /* Get the starting vcn of the child index block to descend into. */ - vcn = sle64_to_cpup((sle64*)((u8*)ictx->entry + - le16_to_cpu(ictx->entry->length) - sizeof(VCN))); + vcn = sle64tohp((sle64*)((u8*)ictx->entry + + le16toh(ictx->entry->length) - sizeof(VCN))); if (vcn < 0) { ntfs_error(idx_ni->vol->mp, es, "Negative child node VCN", (unsigned long long)idx_ni->mft_no); @@ -697,12 +697,12 @@ (unsigned long long)idx_ni->mft_no); goto unm_err; } - if (sle64_to_cpu(ia->index_block_vcn) != vcn) { + if (sle64toh(ia->index_block_vcn) != vcn) { ntfs_error(idx_ni->vol->mp, "Actual VCN (0x%llx) of index " "buffer is different from expected VCN " "(0x%llx). Inode 0x%llx is corrupt. Run " "chkdsk.", (unsigned long long) - sle64_to_cpu(ia->index_block_vcn), + sle64toh(ia->index_block_vcn), (unsigned long long)vcn, (unsigned long long)idx_ni->mft_no); goto unm_err; @@ -866,7 +866,7 @@ NTFSCHAR_SIZE_SHIFT; ie_match_key = &ie->key.filename.filename; } else { - ie_match_key_len = le16_to_cpu(ie->key_length); + ie_match_key_len = le16toh(ie->key_length); ie_match_key = &ie->key; } /* @@ -888,7 +888,7 @@ * know which way in the B+tree we have to go. */ rc = ntfs_collate(idx_ni->vol, idx_ni->collation_rule, key, - key_len, &ie->key, le16_to_cpu(ie->key_length)); + key_len, &ie->key, le16toh(ie->key_length)); /* * If @key collates before the key of the current entry, need * to search on the left. @@ -1620,7 +1620,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); a->highest_vcn = cpu_to_sle64((idx_ni->allocated_size >> vol->cluster_size_shift) - 1); a->mapping_pairs_offset = htole16(mp_ofs); @@ -1916,14 +1916,14 @@ ia->usa_ofs = htole16(sizeof(INDEX_BLOCK)); ia->usa_count = htole16(1 + (idx_ni->block_size / NTFS_BLOCK_SIZE)); /* Set the update sequence number to 1. */ - *(le16*)((u8*)ia + le16_to_cpu(ia->usa_ofs)) = htole16(1); + *(le16*)((u8*)ia + le16toh(ia->usa_ofs)) = htole16(1); ia->index_block_vcn = cpu_to_sle64(vcn); ih = &ia->index; ie_ofs = (sizeof(INDEX_HEADER) + - (le16_to_cpu(ia->usa_count) << 1) + 7) & ~7; - ih->entries_offset = cpu_to_le32(ie_ofs); - ih->index_length = cpu_to_le32(ie_ofs + sizeof(INDEX_ENTRY_HEADER)); - ih->allocated_size = cpu_to_le32(idx_ni->block_size - + (le16toh(ia->usa_count) << 1) + 7) & ~7; + ih->entries_offset = htole32(ie_ofs); + ih->index_length = htole32(ie_ofs + sizeof(INDEX_ENTRY_HEADER)); + ih->allocated_size = htole32(idx_ni->block_size - offsetof(INDEX_BLOCK, index)); ih->flags = LEAF_NODE; ie = (INDEX_ENTRY*)((u8*)ih + ie_ofs); @@ -2204,14 +2204,14 @@ idx_ni->block_size_shift) & PAGE_MASK)); /* Preserve the update sequence number across the layout. */ usn = 0; - if (le16_to_cpu(ia->usa_ofs) < NTFS_BLOCK_SIZE - sizeof(u16)) - usn = *(le16*)((u8*)ia + le16_to_cpu(ia->usa_ofs)); + if (le16toh(ia->usa_ofs) < NTFS_BLOCK_SIZE - sizeof(u16)) + usn = *(le16*)((u8*)ia + le16toh(ia->usa_ofs)); /* Calculate the index block vcn from the index block number. */ *dst_vcn = bmp_pos = bmp_pos << idx_ni->block_size_shift >> idx_ni->vcn_size_shift; ntfs_index_block_lay_out(idx_ni, bmp_pos, ia); if (usn && usn != htole16(0xffff)) - *(le16*)((u8*)ia + le16_to_cpu(ia->usa_ofs)) = usn; + *(le16*)((u8*)ia + le16toh(ia->usa_ofs)) = usn; *dst_ia = ia; *dst_upl_ofs = upl_ofs; *dst_upl = upl; @@ -2403,11 +2403,11 @@ ia->usa_ofs = htole16(sizeof(INDEX_BLOCK)); ia->usa_count = htole16(1 + (idx_ni->block_size / NTFS_BLOCK_SIZE)); /* Set the update sequence number to 1. */ - *(le16*)((u8*)ia + le16_to_cpu(ia->usa_ofs)) = htole16(1); + *(le16*)((u8*)ia + le16toh(ia->usa_ofs)) = htole16(1); ih = &ia->index; ia_ie_ofs = (sizeof(INDEX_HEADER) + - (le16_to_cpu(ia->usa_count) << 1) + 7) & ~7; - ih->entries_offset = cpu_to_le32(ia_ie_ofs); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Sat Jun 9 03:50: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 89E9B106566C for ; Sat, 9 Jun 2012 03:50:14 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 09 Jun 2012 03:50:14 +0000 Date: Sat, 09 Jun 2012 03:50:14 +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: <20120609035014.89E9B106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237333 - in soc2012/jhagewood/diff3: . diff3 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: Sat, 09 Jun 2012 03:50:16 -0000 Author: jhagewood Date: Sat Jun 9 03:50:13 2012 New Revision: 237333 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237333 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 01:42:55 2012 (r237332) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 03:50:13 2012 (r237333) @@ -64,25 +64,33 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ -#ifdef __FreeBSD__ -#define __dead + +#if 0 +#ifndef lint +static char sccsid[] = "@(#)diff3.c 8.1 (Berkeley) 6/6/93"; #endif +#endif /* not lint */ +#include +__FBSDID("$FreeBSD: diff3prog.c 2012-06-8 23:36:08Z $"); +#include +#include +#include +#include +#include #include #include #include -#include -#include #include -#include -#include -#include #include #include +#ifdef __FreeBSD__ +#define __dead +#endif /* diff3 - 3-way differential file comparison */ -char const __version[] = "8.1"; +char const __version[] = "1.1"; /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 01:42:55 2012 (r237332) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 03:50:13 2012 (r237333) @@ -11,17 +11,50 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-07 05:12:54.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-07 23:42:04.000000000 -0400 -@@ -82,6 +82,8 @@ ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 03:49:17.000000000 -0400 +@@ -64,24 +64,34 @@ + * @(#)diff3.c 8.1 (Berkeley) 6/6/93 + */ +-#ifdef __FreeBSD__ +-#define __dead ++ ++#if 0 ++#ifndef lint ++static char sccsid[] = "@(#)diff3.c 8.1 (Berkeley) 6/6/93"; + #endif ++#endif /* not lint */ ++#include ++__FBSDID("$FreeBSD: diff3prog.c 2012-06-8 23:36:08Z $"); + ++#include ++#include ++#include ++#include ++#include + #include + #include + #include +-#include +-#include + #include +-#include +-#include +-#include + #include + #include + ++#ifdef __FreeBSD__ ++#define __dead ++#endif /* diff3 - 3-way differential file comparison */ -+char const __version[] = "8.1"; ++char const __version[] = "1.1"; + /* diff3 [-ex3EX] d13 d23 f1 f2 f3 [m1 m3] * * d13 = diff report on f1 vs f3 -@@ -149,33 +151,37 @@ void prange(struct range *); +@@ -149,33 +159,37 @@ void prange(struct range *); void repos(int); void separate(const char *); __dead void edscript(int); @@ -66,7 +99,7 @@ }; -@@ -216,12 +222,18 @@ main(int argc, char **argv) +@@ -216,12 +230,18 @@ main(int argc, char **argv) case 'X': oflag = eflag = 1; break; @@ -85,7 +118,7 @@ case STRIPCR_OPT: strip_cr = 1; break; -@@ -233,8 +245,10 @@ main(int argc, char **argv) +@@ -233,8 +253,10 @@ main(int argc, char **argv) argc -= optind; argv += optind; /* XXX - argc usage seems wrong here */ @@ -97,7 +130,7 @@ if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", -@@ -254,6 +268,8 @@ main(int argc, char **argv) +@@ -254,6 +276,8 @@ main(int argc, char **argv) for (i = 0; i <= 2; i++) { if ((fp[i] = fopen(argv[i + 2], "r")) == NULL) err(EXIT_FAILURE, "can't open %s", argv[i + 2]); @@ -106,7 +139,7 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -606,6 +622,32 @@ repos(int nchar) +@@ -606,6 +630,32 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } @@ -139,7 +172,7 @@ __dead void trouble(void) { -@@ -698,13 +740,30 @@ increase(void) +@@ -698,13 +748,30 @@ increase(void) szchanges = newsz; } From owner-svn-soc-all@FreeBSD.ORG Sat Jun 9 04:18:18 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 5EE6E106564A for ; Sat, 9 Jun 2012 04:18:16 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 09 Jun 2012 04:18:16 +0000 Date: Sat, 09 Jun 2012 04:18:16 +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: <20120609041816.5EE6E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237336 - in soc2012/jhagewood/diff3: . diff3 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: Sat, 09 Jun 2012 04:18:18 -0000 Author: jhagewood Date: Sat Jun 9 04:18:15 2012 New Revision: 237336 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237336 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 03:34:34 2012 (r237335) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 04:18:15 2012 (r237336) @@ -231,7 +231,7 @@ oflag = eflag = 1; break; case 'v': - printf("FreeBSD diff3 %s\n" __version); + printf("FreeBSD diff3 %s\n", __version); exit(0); case 'x': eflag = 1; @@ -255,8 +255,7 @@ /* XXX - argc usage seems wrong here */ if (argc < 5) { usage(); - try_help(); - } + } if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", @@ -534,9 +533,7 @@ (void)skip(i, rold->to, " "); } -/* - * print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 - */ +/* print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 */ void prange(struct range *rold) { @@ -630,9 +627,7 @@ (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } -/* - * If file has trailing carriage return, remove it. - */ +/* If file has trailing carriage return, remove it. */ void remove_cr(FILE *f) { @@ -649,7 +644,7 @@ } } - if (tcr_pos != NULL) { + if (&tcr_pos != NULL) { fsetpos(f, &tcr_pos); fputc((int)'\0', f); } Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 03:34:34 2012 (r237335) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 04:18:15 2012 (r237336) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-07 05:12:54.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 03:49:17.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 04:18:03.000000000 -0400 @@ -64,24 +64,34 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -104,7 +104,7 @@ oflag = eflag = 1; break; + case 'v': -+ printf("FreeBSD diff3 %s\n" __version); ++ printf("FreeBSD diff3 %s\n", __version); + exit(0); case 'x': eflag = 1; @@ -118,19 +118,18 @@ case STRIPCR_OPT: strip_cr = 1; break; -@@ -233,8 +253,10 @@ main(int argc, char **argv) +@@ -233,8 +253,9 @@ main(int argc, char **argv) argc -= optind; argv += optind; /* XXX - argc usage seems wrong here */ - if (argc < 5) + if (argc < 5) { usage(); -+ try_help(); -+ } ++ } if (oflag) { (void)snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", -@@ -254,6 +276,8 @@ main(int argc, char **argv) +@@ -254,6 +275,8 @@ main(int argc, char **argv) for (i = 0; i <= 2; i++) { if ((fp[i] = fopen(argv[i + 2], "r")) == NULL) err(EXIT_FAILURE, "can't open %s", argv[i + 2]); @@ -139,13 +138,22 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -606,6 +630,32 @@ repos(int nchar) +@@ -510,9 +533,7 @@ change(int i, struct range *rold, int du + (void)skip(i, rold->to, " "); + } + +-/* +- * print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 +- */ ++/* print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 */ + void + prange(struct range *rold) + { +@@ -606,6 +627,30 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } -+/* -+ * If file has trailing carriage return, remove it. -+ */ ++/* If file has trailing carriage return, remove it. */ +void +remove_cr(FILE *f) { + @@ -162,7 +170,7 @@ + } + } + -+ if (tcr_pos != NULL) { ++ if (&tcr_pos != NULL) { + fsetpos(f, &tcr_pos); + fputc((int)'\0', f); + } @@ -172,7 +180,7 @@ __dead void trouble(void) { -@@ -698,13 +748,30 @@ increase(void) +@@ -698,13 +743,30 @@ increase(void) szchanges = newsz; } From owner-svn-soc-all@FreeBSD.ORG Sat Jun 9 05:11:00 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 07154106566C for ; Sat, 9 Jun 2012 05:10:58 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 09 Jun 2012 05:10:58 +0000 Date: Sat, 09 Jun 2012 05:10:58 +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: <20120609051058.07154106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r237337 - in soc2012/jhagewood/diff3: . diff3 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: Sat, 09 Jun 2012 05:11:00 -0000 Author: jhagewood Date: Sat Jun 9 05:10:57 2012 New Revision: 237337 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237337 Log: Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c soc2012/jhagewood/diff3/hagewood-diff3.patch Modified: soc2012/jhagewood/diff3/diff3/diff3prog.c ============================================================================== --- soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 04:18:15 2012 (r237336) +++ soc2012/jhagewood/diff3/diff3/diff3prog.c Sat Jun 9 05:10:57 2012 (r237337) @@ -390,8 +390,7 @@ d2 = d23; j = 0; - if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) - { + if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) { printf("Binary file detected; comparison failed\n"); exit(EXIT_FAILURE); } @@ -489,24 +488,24 @@ static int asciifile(FILE *f) { - wint_t ch = L'\0'; - size_t i; + wint_t ch = L'\0'; + size_t i; - if (aflag || f == NULL) - return (1); + if (aflag || f == NULL) + return (1); - rewind(f); - errno = 0; - for (i = 0; i <= BUFSIZ; i++) { - if ((ch = fgetwc(f)) == WEOF) { - if (errno == EILSEQ) - return (0); - break; - } - if (!iswspace(ch) && iswcntrl(ch)) - return (0); - } - return (1); + rewind(f); + errno = 0; + for (i = 0; i <= BUFSIZ; i++) { + if ((ch = fgetwc(f)) == WEOF) { + if (errno == EILSEQ) + return (0); + break; + } + if (!iswspace(ch) && iswcntrl(ch)) + return (0); + } + return (1); } void @@ -533,7 +532,10 @@ (void)skip(i, rold->to, " "); } -/* print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 */ +/* + * print the range of line numbers, rold.from thru rold.to, as n1,n2 or + * n1. + */ void prange(struct range *rold) { @@ -629,8 +631,8 @@ /* If file has trailing carriage return, remove it. */ void -remove_cr(FILE *f) { - +remove_cr(FILE *f) +{ char ch; fpos_t position; fpos_t tcr_pos; @@ -765,7 +767,6 @@ __dead void usage(void) { - fprintf(stderr, "usage: diff3 [-exEX3] /tmp/d3a.?????????? " "/tmp/d3b.?????????? file1 file2 file3\n"); exit(EXIT_FAILURE); Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 04:18:15 2012 (r237336) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 9 05:10:57 2012 (r237337) @@ -11,7 +11,7 @@ .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c --- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-07 05:12:54.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 04:18:03.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-09 05:08:37.000000000 -0400 @@ -64,24 +64,34 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -138,25 +138,77 @@ } merge(m, n); exit(EXIT_SUCCESS); -@@ -510,9 +533,7 @@ change(int i, struct range *rold, int du +@@ -367,8 +390,7 @@ merge(int m1, int m2) + d2 = d23; + j = 0; + +- if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) +- { ++ if( (asciifile(fp[0]) && asciifile(fp[1]) && asciifile(fp[2]) ) == 0) { + printf("Binary file detected; comparison failed\n"); + exit(EXIT_FAILURE); + } +@@ -466,24 +488,24 @@ merge(int m1, int m2) + static int + asciifile(FILE *f) + { +- wint_t ch = L'\0'; +- size_t i; ++ wint_t ch = L'\0'; ++ size_t i; + +- if (aflag || f == NULL) +- return (1); ++ if (aflag || f == NULL) ++ return (1); + +- rewind(f); +- errno = 0; +- for (i = 0; i <= BUFSIZ; i++) { +- if ((ch = fgetwc(f)) == WEOF) { +- if (errno == EILSEQ) +- return (0); +- break; +- } +- if (!iswspace(ch) && iswcntrl(ch)) +- return (0); +- } +- return (1); ++ rewind(f); ++ errno = 0; ++ for (i = 0; i <= BUFSIZ; i++) { ++ if ((ch = fgetwc(f)) == WEOF) { ++ if (errno == EILSEQ) ++ return (0); ++ break; ++ } ++ if (!iswspace(ch) && iswcntrl(ch)) ++ return (0); ++ } ++ return (1); + } + + void +@@ -510,8 +532,9 @@ change(int i, struct range *rold, int du (void)skip(i, rold->to, " "); } -/* - * print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 -- */ -+/* print the range of line numbers, rold.from thru rold.to, as n1,n2 or n1 */ ++/* ++ * print the range of line numbers, rold.from thru rold.to, as n1,n2 or ++ * n1. + */ void prange(struct range *rold) - { -@@ -606,6 +627,30 @@ repos(int nchar) +@@ -606,6 +629,30 @@ repos(int nchar) (void)fseek(fp[i], (long)-nchar, SEEK_CUR); } +/* If file has trailing carriage return, remove it. */ +void -+remove_cr(FILE *f) { -+ ++remove_cr(FILE *f) ++{ + char ch; + fpos_t position; + fpos_t tcr_pos; @@ -180,7 +232,7 @@ __dead void trouble(void) { -@@ -698,13 +743,30 @@ increase(void) +@@ -698,13 +745,29 @@ increase(void) szchanges = newsz; } @@ -207,7 +259,7 @@ usage(void) { - extern char *__progname; - +- - fprintf(stderr, "usage: %s [-exEX3] /tmp/d3a.?????????? " - "/tmp/d3b.?????????? file1 file2 file3\n", __progname); + fprintf(stderr, "usage: diff3 [-exEX3] /tmp/d3a.?????????? "