Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2013 15:35:09 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 1020968 for review
Message-ID:  <201310091535.r99FZ9U9010920@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <inttypes.h>
 #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 <<init>> 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 <<init>> 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310091535.r99FZ9U9010920>