From owner-p4-projects@FreeBSD.ORG Wed Oct 9 15:35:10 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3CF3B510; Wed, 9 Oct 2013 15:35:10 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D69BF50E for ; Wed, 9 Oct 2013 15:35:09 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [8.8.178.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C30882F5D for ; Wed, 9 Oct 2013 15:35:09 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id r99FZ9a2010924 for ; Wed, 9 Oct 2013 15:35:09 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.6/Submit) id r99FZ9U9010920 for perforce@freebsd.org; Wed, 9 Oct 2013 15:35:09 GMT (envelope-from brooks@freebsd.org) Date: Wed, 9 Oct 2013 15:35:09 GMT Message-Id: <201310091535.r99FZ9U9010920@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 1020968 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 15:35:10 -0000 http://p4web.freebsd.org/@@1020968?ac=10 Change 1020968 by brooks@brooks_zenith on 2013/10/09 15:34:50 Sync libtesla.h and tesla_update.c with git to supply the required __tesla_prinf symbol. Affected files ... .. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/include/libtesla.h#13 edit .. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_update.c#13 edit Differences ... ==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/include/libtesla.h#13 (text+ko) ==== @@ -111,8 +111,11 @@ /** - * Register a @ref tesla_automaton (which must survive for the lifetime of - * libtesla), receiving a registered @ref tesla_class back. + * Register a @ref tesla_automaton, receiving a @ref tesla_class back. + * + * The @ref tesla_automaton must exist for the lifetime of the TESLA context + * (until thread destruction in the per-thread case, indefinitely in the + * global case). */ int tesla_register(const struct tesla_automaton*, struct tesla_class**); @@ -277,7 +280,7 @@ /** Generic error handler. */ typedef void (*tesla_ev_error)(const struct tesla_automaton *, - int32_t symbol, int32_t errno, const char *message); + int32_t symbol, int32_t errnum, const char *message); /** A @ref tesla_instance has accepted a sequence of events. */ typedef void (*tesla_ev_accept)(struct tesla_class *, @@ -322,6 +325,12 @@ /** Register a set of event handling vectors. */ int tesla_set_event_handlers(struct tesla_event_metahandler *); +/** The type for printf handler functions */ +typedef uint32_t(*printf_type)(const char *, ...); + +/** The function that will be called to log messages. */ +extern printf_type __tesla_printf; + #ifdef _KERNEL #define TESLA_KERN_PRINTF_EV 0x1 #define TESLA_KERN_PRINTERR_EV 0x2 ==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_update.c#13 (text+ko) ==== @@ -38,8 +38,6 @@ #include #endif -#define DEBUG_NAME "libtesla.state.update" -#define PRINT(...) DEBUG(libtesla.state.update, __VA_ARGS__) void tesla_update_state(enum tesla_context tesla_context, @@ -49,43 +47,25 @@ const struct tesla_transitions *trans = autom->ta_transitions + symbol; - if (tesla_debugging(DEBUG_NAME)) { - /* We should never see with multiple <> transitions. */ - int init_count = 0; - for (uint32_t i = 0; i < trans->length; i++) - if (trans->transitions[i].flags & TESLA_TRANS_INIT) - init_count++; +#ifndef NDEBUG + /* We should never see with multiple <> transitions. */ + int init_count = 0; + for (uint32_t i = 0; i < trans->length; i++) + if (trans->transitions[i].flags & TESLA_TRANS_INIT) + init_count++; - assert(init_count < 2); - } + assert(init_count < 2); +#endif - PRINT("\n====\n%s()\n", __func__); - PRINT(" context: %s\n", - (tesla_context == TESLA_CONTEXT_GLOBAL - ? "global" - : "per-thread")); - PRINT(" class: '%s'\n", autom->ta_name); - - PRINT(" transitions: "); - print_transitions(DEBUG_NAME, trans); - PRINT("\n"); - PRINT(" key: "); - print_key(DEBUG_NAME, pattern); - PRINT("\n----\n"); - struct tesla_store *store; int ret = tesla_store_get(tesla_context, TESLA_MAX_CLASSES, TESLA_MAX_INSTANCES, &store); assert(ret == TESLA_SUCCESS); - PRINT("store: 0x%tx\n", (intptr_t) store); - struct tesla_class *class; ret = tesla_class_get(store, autom, &class); assert(ret == TESLA_SUCCESS); - print_class(class); - // Did we match any instances? bool matched_something = false; @@ -227,9 +207,6 @@ if (cleanup_required) tesla_class_reset(class); - print_class(class); - PRINT("\n====\n\n"); - cleanup: tesla_class_put(class); } @@ -332,3 +309,5 @@ else return FAIL; } + +printf_type __tesla_printf = (printf_type)printf;