From owner-p4-projects@FreeBSD.ORG Mon Apr 10 18:40:02 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AD60816A40F; Mon, 10 Apr 2006 18:40:02 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86FDD16A403 for ; Mon, 10 Apr 2006 18:40:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F32E543D70 for ; Mon, 10 Apr 2006 18:39:51 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3AIdpdA026866 for ; Mon, 10 Apr 2006 18:39:51 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3AIdp5O026860 for perforce@freebsd.org; Mon, 10 Apr 2006 18:39:51 GMT (envelope-from jhb@freebsd.org) Date: Mon, 10 Apr 2006 18:39:51 GMT Message-Id: <200604101839.k3AIdp5O026860@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 94932 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2006 18:40:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=94932 Change 94932 by jhb@jhb_slimer on 2006/04/10 18:39:34 Use the kernel linker to lookup our linker set instead of depending on ld(8). Affected files ... .. //depot/projects/smpng/sys/modules/crash/crash.c#30 edit Differences ... ==== //depot/projects/smpng/sys/modules/crash/crash.c#30 (text+ko) ==== @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -61,15 +62,15 @@ void (*ev_handler)(void); }; -SET_DECLARE(crash_event_set, struct crash_event); - #define CRASH_EVENT(name, function) \ static struct crash_event function ## _crash_event = \ { name, function }; \ DATA_SET(crash_event_set, function ## _crash_event) -#define MAX_EVENT SET_COUNT(crash_event_set) +#define MAX_EVENT event_max +static int event_max; +static struct crash_event **event_start, **event_stop; static struct rwlock baz; static struct sx foo, bar, bar2; static struct cv event_cv; @@ -630,12 +631,11 @@ { struct crash_event **ev; - SET_FOREACH(ev, crash_event_set) { + for (ev = event_start; ev < event_stop; ev++) { /* Skip null event 0. */ if ((*ev)->ev_name == NULL) continue; - printf("%4td %s\n", ev - SET_BEGIN(crash_event_set), - (*ev)->ev_name); + printf("%4td %s\n", ev - event_start, (*ev)->ev_name); } } CRASH_EVENT("help", help); @@ -692,7 +692,7 @@ printf("crash: event %d is not defined!\n", event); continue; } - evp = SET_ITEM(crash_event_set, ev); + evp = event_start[ev]; printf("crash: %s\n", evp->ev_name); evp->ev_handler(); } @@ -758,6 +758,10 @@ switch (cmd) { case MOD_LOAD: + error = linker_file_lookup_set(module_file(module), + "crash_event_set", &event_start, &event_stop, &event_max); + if (error) + break; error = load(arg); break; case MOD_UNLOAD: