[Ocfs2-commits] zab commits r1909 - in trunk: . scripts

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Feb 23 12:26:40 CST 2005


Author: zab
Signed-off-by: manish
Date: 2005-02-23 12:26:38 -0600 (Wed, 23 Feb 2005)
New Revision: 1909

Added:
   trunk/scripts/
   trunk/scripts/no-exports-for-you.sh
Log:
o roll a little script that tells us if there are symbols we care about on
  the radar of the export police

Signed-off-by: manish


Added: trunk/scripts/no-exports-for-you.sh
===================================================================
--- trunk/scripts/no-exports-for-you.sh	2005-02-23 05:12:14 UTC (rev 1908)
+++ trunk/scripts/no-exports-for-you.sh	2005-02-23 18:26:38 UTC (rev 1909)
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+#
+# this script grabs arjan's list of ``unused'' symbols and checks to see
+# if any modules in our tree reference them
+#
+
+url="http://www.kernel.org/pub/linux/kernel/people/arjan/unused"
+unused=$(basename $url)
+
+die() {
+	echo $@", exiting" > /dev/stderr
+	exit 1
+}
+
+# temp dir that is setup and torn down for each script run
+tmpdir_template="/tmp/.no-exports-for-you-tmpdir-XXXXXX"
+tmpdir=`mktemp -d $tmpdir_template` || \
+	die "couldn't create tmp dir from template $tmpdir_template"
+cleanup() {
+        [ ${#tmpdir} == ${#tmpdir_template} ] && [ -d $tmpdir ] && \
+                rm -rf $tmpdir
+}
+trap cleanup EXIT
+
+mods=$(find . -name '*.ko')
+
+[ -z "$mods" ] && die "no *.ko modules found in this tree"
+
+nm $mods > $tmpdir/forawk || die "nm couldn't read $mods"
+
+echo fetching $url with wget
+(cd $tmpdir && wget $url) || die "wget failed"
+
+awk '{print "unused", $0}' < $tmpdir/$unused >> $tmpdir/forawk \
+	|| die "awk had trouble prepending 'unused' to the unused file"
+
+awk '
+	($1 == "U") { unres[$2] = 1 }
+	($1 == "unused") { unused[$2] = 1 }
+	END {
+		for (a in unres) {
+			if (unused[a]) {
+				if (!message) {
+					print "symbols we care about in unused:"
+					message = 1
+				}
+				print "	", a
+			}
+		}
+		if (!message) {
+			print "none of our symbols were found in unused"
+		}
+	}' < $tmpdir/forawk || die "awk failed to compare symbols"


Property changes on: trunk/scripts/no-exports-for-you.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the Ocfs2-commits mailing list