PERFORCE change 1023081 for review

Jonathan Anderson jonathan at FreeBSD.org
Wed Oct 9 19:34:26 UTC 2013


http://p4web.freebsd.org/@@1023081?ac=10

Change 1023081 by jonathan at jonathan-on-joe on 2013/10/09 19:33:30

	Sync latest 'master' branch from GitHub.
	
	This does *not* include all of the latest refactoring and sunrise/sunset work.

Affected files ...

.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_class.c#10 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_debug.c#8 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_dtrace.c#11 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_internal.h#14 edit
.. //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_notification.c#18 edit

Differences ...

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_class.c#10 (text+ko) ====

@@ -151,7 +151,7 @@
 		return (TESLA_SUCCESS);
 	}
 
-	tesla_assert(0, ("no free instances but tc_free was > 0"));
+	tesla_assert(0 && ("no free instances but tc_free was > 0"));
 	return (TESLA_ERROR_ENOMEM);
 }
 

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_debug.c#8 (text+ko) ====

@@ -208,7 +208,7 @@
 
 	tesla_assert(instance_belongs_to_class,
 		("tesla_instance %x not of class '%s'",
-		 instance, tclass->tc_automaton->ta_name)
+		 instance, tclass->tc_name)
 	       );
 }
 

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_dtrace.c#11 (text+ko) ====

@@ -40,31 +40,26 @@
 
 SDT_PROBE_DEFINE2(tesla, automata, instance, create, create,
     "struct tesla_class *", "struct tesla_instance *");
-
 SDT_PROBE_DEFINE3(tesla, automata, event, transition, state-transition,
     "struct tesla_class *", "struct tesla_instance *",
     "struct tesla_transition *");
-
 SDT_PROBE_DEFINE4(tesla, automata, instance, clone, clone,
     "struct tesla_class *", "struct tesla_instance *",
     "struct tesla_instance *", "struct tesla_transition *");
-
 SDT_PROBE_DEFINE4(tesla, automata, fail, no_instance, no-instance-match,
-    "struct tesla_class *", "const char *", "const char *", "int32_t");
-
+    "struct tesla_class *", "const char *", "const char *",
+    "struct tesla_transitions *");
 SDT_PROBE_DEFINE3(tesla, automata, fail, bad_transition, bad-transition,
-    "struct tesla_class *", "struct tesla_instance *", "int32_t");
-
-SDT_PROBE_DEFINE4(tesla, automata, fail, other_err, other-error,
-    "struct tesla_automaton *", "int32_t", "int32_t", "const char *");
-
+    "struct tesla_class *", "struct tesla_instance *",
+    "struct tesla_transitions *");
+SDT_PROBE_DEFINE3(tesla, automata, fail, other_err, other-error,
+    "struct tesla_class *", "int", "const char *");
 SDT_PROBE_DEFINE2(tesla, automata, success, accept, accept,
     "struct tesla_class *", "struct tesla_instance *");
-
 SDT_PROBE_DEFINE3(tesla, automata, event, ignored, ignored-event,
-    "struct tesla_class *", "int32_t", "struct tesla_key *");
+    "struct tesla_class *", "struct tesla_key *",
+    "struct tesla_transitions *");
 
-
 static void
 new_instance(struct tesla_class *tcp, struct tesla_instance *tip)
 {
@@ -89,8 +84,8 @@
 }
 
 static void
-no_instance(struct tesla_class *tcp, int32_t symbol,
-	    const struct tesla_key *tkp)
+no_instance(struct tesla_class *tcp, const struct tesla_key *tkp,
+    const struct tesla_transitions *ttp)
 {
 	char instbuf[200];
 	char *c = instbuf;
@@ -113,25 +108,22 @@
 	key_string(keybuf, keybuf + sizeof(keybuf), tkp);
 
 	SDT_PROBE(tesla, automata, fail, no_instance,
-		tcp, instbuf, keybuf, symbol, 0);
+		tcp, instbuf, keybuf, ttp, 0);
 }
 
 static void
 bad_transition(struct tesla_class *tcp, struct tesla_instance *tip,
-    int32_t symbol)
+    const struct tesla_transitions *ttp)
 {
 
-	SDT_PROBE(tesla, automata, fail, bad_transition,
-		tcp, tip, symbol, 0, 0);
+	SDT_PROBE(tesla, automata, fail, bad_transition, tcp, tip, ttp, 0, 0);
 }
 
 static void
-err(const struct tesla_automaton * tcp, int32_t symbol, int32_t errno,
-    const char *message)
+err(struct tesla_class *tcp, int errnum, const char *message)
 {
 
-	SDT_PROBE(tesla, automata, fail, other_err,
-		tcp, symbol, errno, message, 0);
+	SDT_PROBE(tesla, automata, fail, other_err, tcp, errnum, message, 0, 0);
 }
 
 static void
@@ -142,11 +134,11 @@
 }
 
 static void
-ignored(const struct tesla_class *tcp,
-	    int32_t symbol, const struct tesla_key *tkp)
+ignored(const struct tesla_class *tcp, const struct tesla_key *tkp,
+    const struct tesla_transitions *ttp)
 {
 
-	SDT_PROBE(tesla, automata, event, ignored, tcp, symbol, tkp, 0, 0);
+	SDT_PROBE(tesla, automata, event, ignored, tcp, tkp, ttp, 0, 0);
 }
 
 const struct tesla_event_handlers dtrace_handlers = {

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_internal.h#14 (text+ko) ====

@@ -82,7 +82,7 @@
 /**
  * Call this if things go catastrophically, unrecoverably wrong.
  */
-void	tesla_die(int32_t errno, const char *event) __attribute__((noreturn));
+void	tesla_die(int32_t errnum, const char *event) __attribute__((noreturn));
 
 /**
  * Reset all automata in a store to the inactive state.
@@ -256,12 +256,13 @@
 	struct tesla_instance	*tc_instances;	/* Instances of this class. */
 
 #ifdef _KERNEL
-	struct mtx		tc_lock;	/* Synchronise tc_table. */
+	struct mtx		 tc_lock;	/* Synchronise tc_table. */
 #else
 	pthread_mutex_t		 tc_lock;	/* Synchronise tc_table. */
 #endif
 };
 
+typedef struct tesla_automaton		tesla_automaton;
 typedef struct tesla_class		tesla_class;
 typedef struct tesla_instance		tesla_instance;
 typedef struct tesla_key		tesla_key;
@@ -341,7 +342,7 @@
 	    const struct tesla_key *);
 void	ev_bad_transition(struct tesla_class *, struct tesla_instance *,
 	    int32_t symbol);
-void	ev_err(const struct tesla_automaton *, int symbol, int errno,
+void	ev_err(const struct tesla_automaton *, int symbol, int errnum,
 	    const char *);
 void	ev_accept(struct tesla_class *, struct tesla_instance *);
 void	ev_ignored(const struct tesla_class *, int32_t symbol,

==== //depot/projects/ctsrd/tesla/src/sys/contrib/tesla/libtesla/tesla_notification.c#18 (text+ko) ====

@@ -159,11 +159,11 @@
 }
 
 void
-ev_err(const struct tesla_automaton *a, int symbol, int errno,
+ev_err(const struct tesla_automaton *a, int symbol, int errnum,
 	const char *message)
 {
 
-	FOREACH_ERROR_HANDLER(teh_err, a, symbol, errno, message);
+	FOREACH_ERROR_HANDLER(teh_err, a, symbol, errnum, message);
 }
 
 void
@@ -204,8 +204,9 @@
 print_new_instance(struct tesla_class *tcp, struct tesla_instance *tip)
 {
 
-	DEBUG(libtesla.instance.new, "new    %td: %d\n",
-		tip - tcp->tc_instances, tip->ti_state);
+	DEBUG(libtesla.instance.new, "new    %td: %d:0x%x ('%s')\n",
+		tip - tcp->tc_instances, tip->ti_state, tip->ti_key.tk_mask,
+		tcp->tc_automaton->ta_name);
 }
 
 static void
@@ -213,8 +214,10 @@
     struct tesla_instance *tip, const struct tesla_transition *transp)
 {
 
-	DEBUG(libtesla.state.transition, "update %td: %d->%d\n",
-		tip - tcp->tc_instances, transp->from, transp->to);
+	DEBUG(libtesla.state.transition, "update %td: %d:0x%x->%d:0x%x\n",
+		tip - tcp->tc_instances,
+		transp->from, transp->from_mask,
+		transp->to, transp->to_mask);
 }
 
 static void
@@ -223,9 +226,11 @@
     const struct tesla_transition *transp)
 {
 
-	DEBUG(libtesla.instance.clone, "clone  %td:%d -> %td:%d\n",
-		old_instance - tcp->tc_instances, transp->from,
-		new_instance - tcp->tc_instances, transp->to);
+	DEBUG(libtesla.instance.clone, "clone  %td:%d:0x%x -> %td:%d:0x%x\n",
+		old_instance - tcp->tc_instances,
+		transp->from, transp->from_mask,
+		new_instance - tcp->tc_instances,
+		transp->to, transp->to_mask);
 }
 
 static void
@@ -262,8 +267,8 @@
 	assert(tcp != NULL);
 	assert(tip != NULL);
 
-	const tesla_transitions *transp
-		= tcp->tc_automaton->ta_transitions + symbol;
+	const tesla_automaton *autom = tcp->tc_automaton;
+	const tesla_transitions *transp = autom->ta_transitions + symbol;
 
 	print_failure_header(tcp);
 
@@ -273,24 +278,29 @@
 
 	SAFE_SPRINTF(next, end,
 		"Instance %td is in state %d\n"
-		"but required to take a transition in ",
-		(tip - tcp->tc_instances), tip->ti_state);
+		"but received event '%s'\n"
+		"(causes transition in: ",
+		(tip - tcp->tc_instances), tip->ti_state,
+		autom->ta_symbol_names[symbol]);
 	assert(next > buffer);
 
 	next = sprint_transitions(next, end, transp);
 	assert(next > buffer);
 
+	SAFE_SPRINTF(next, end, ")\n");
+	assert(next > buffer);
+
 	error("%s", buffer);
 }
 
 static void
-print_error(const struct tesla_automaton *a, int symbol, int errno,
+print_error(const struct tesla_automaton *a, int symbol, int errnum,
 	const char *message)
 {
 
 	DEBUG(libtesla.event, "%s in '%s' %s: %s\n",
 		message, a->ta_name, a->ta_symbol_names[symbol],
-		tesla_strerror(errno));
+		tesla_strerror(errnum));
 }
 
 static void
@@ -359,13 +369,13 @@
 }
 
 static void
-panic_error(const struct tesla_automaton *a, int symbol, int errno,
+panic_error(const struct tesla_automaton *a, int symbol, int errnum,
 	const char *message)
 {
 
 	tesla_panic("TESLA: %s in '%s' %s: %s", message,
 		a->ta_name, a->ta_symbol_names[symbol],
-		tesla_strerror(errno));
+		tesla_strerror(errnum));
 }
 
 static const struct tesla_event_handlers failstop_handlers = {


More information about the p4-projects mailing list