* Fixed names for match our name rules

* Fixed names for match our name rules

--- src/RSignal.h
+++ src/RSignal.h
@@ -33,46 +33,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)() )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)() const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)() )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)() const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit() const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)() )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)() const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)() )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)() const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit() const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -82,10 +82,10 @@

 	void operator() () const
 	{
-		Emit();
-	}
-
-	bool Empty() const
+        emit();
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -104,46 +104,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -153,10 +153,10 @@

 	void operator() ( Param1 p1 ) const
 	{
-		Emit( p1 );
-	}
-
-	bool Empty() const
+        emit( p1 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -175,46 +175,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -224,10 +224,10 @@

 	void operator() ( Param1 p1, Param2 p2 ) const
 	{
-		Emit( p1, p2 );
-	}
-
-	bool Empty() const
+        emit( p1, p2 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -246,46 +246,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2, Param3 p3 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2, Param3 p3 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -295,10 +295,10 @@

 	void operator() ( Param1 p1, Param2 p2, Param3 p3 ) const
 	{
-		Emit( p1, p2, p3 );
-	}
-
-	bool Empty() const
+        emit( p1, p2, p3 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -317,46 +317,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -366,10 +366,10 @@

 	void operator() ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const
 	{
-		Emit( p1, p2, p3, p4 );
-	}
-
-	bool Empty() const
+        emit( p1, p2, p3, p4 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -388,46 +388,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -437,10 +437,10 @@

 	void operator() ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const
 	{
-		Emit( p1, p2, p3, p4, p5 );
-	}
-
-	bool Empty() const
+        emit( p1, p2, p3, p4, p5 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -459,46 +459,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -508,10 +508,10 @@

 	void operator() ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const
 	{
-		Emit( p1, p2, p3, p4, p5, p6 );
-	}
-
-	bool Empty() const
+        emit( p1, p2, p3, p4, p5, p6 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -530,46 +530,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -579,10 +579,10 @@

 	void operator() ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const
 	{
-		Emit( p1, p2, p3, p4, p5, p6, p7 );
-	}
-
-	bool Empty() const
+        emit( p1, p2, p3, p4, p5, p6, p7 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }
@@ -601,46 +601,46 @@
 	DelegateList delegateList;

 public:
-	void Connect( _Delegate delegate )
-	{
-		delegateList.insert( delegate );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const )
-	{
-		delegateList.insert( MakeDelegate( obj, func ) );
-	}
-
-	void Disconnect( _Delegate delegate )
-	{
-		delegateList.erase( delegate );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	template< class X, class Y >
-	void Disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const )
-	{
-		delegateList.erase( MakeDelegate( obj, func ) );
-	}
-
-	void Clear()
-	{
-		delegateList.clear();
-	}
-
-	void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const
+    void connect( _Delegate delegate )
+	{
+		delegateList.insert( delegate );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void connect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const )
+	{
+		delegateList.insert( MakeDelegate( obj, func ) );
+	}
+
+    void disconnect( _Delegate delegate )
+	{
+		delegateList.erase( delegate );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+	template< class X, class Y >
+    void disconnect( Y * obj, void (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const )
+	{
+		delegateList.erase( MakeDelegate( obj, func ) );
+	}
+
+    void clear()
+	{
+        delegateList.clear();
+	}
+
+    void emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const
 	{
 		for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); )
 		{
@@ -650,10 +650,10 @@

 	void operator() ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const
 	{
-		Emit( p1, p2, p3, p4, p5, p6, p7, p8 );
-	}
-
-	bool Empty() const
+        emit( p1, p2, p3, p4, p5, p6, p7, p8 );
+	}
+
+    bool empty() const
 	{
         return delegateList.empty();
     }


OpenPGP: set version for PKCS#15

OpenPGP: set version for PKCS#15

--- src/libopensc/pkcs15-openpgp.c
+++ src/libopensc/pkcs15-openpgp.c
@@ -141,6 +141,7 @@
 	sc_bin_to_hex(buffer, (size_t)r, string, sizeof(string), 0);
 	set_string(&p15card->tokeninfo->serial_number, string);

+	p15card->tokeninfo->version = (card->type == SC_CARD_TYPE_OPENPGP_V2) ? 2 : 1;
 	p15card->tokeninfo->flags = SC_PKCS15_TOKEN_PRN_GENERATION | SC_PKCS15_TOKEN_EID_COMPLIANT;

 	/* Extract preferred language */


pull: override max-conns-per-host to 8, for faster downloads

Modern web browsers are all converging on 6 or 8.  Let's match that.

--- src/libostree/ostree-fetcher.c
+++ src/libostree/ostree-fetcher.c
@@ -188,6 +188,14 @@

   self->requester = (SoupRequester *)soup_session_get_feature (self->session, SOUP_TYPE_REQUESTER);
   g_object_get (self->session, "max-conns-per-host", &max_conns, NULL);
+  if (max_conns <= 8)
+    {
+      // We download a lot of small objects in ostree, so this helps a
+      // lot.  Also matches what most modern browsers do.
+      max_conns = 8;
+      g_object_set (self->session, "max-conns-per-host", max_conns, NULL);
+    }
+
   self->max_outstanding = 3 * max_conns;

   g_signal_connect (self->session, "request-started",


libpcp_pmda: Fixed a memory leak detected by valgrind.

--- src/libpcp_pmda/src/mainloop.c
+++ src/libpcp_pmda/src/mainloop.c
@@ -213,7 +213,7 @@
 		/* Not INTERFACE_4 or later */
 		sts = PM_ERR_NAME;
 	    }
-	    __pmUnpinPDUBuf(namelist);
+	    free(namelist);
 	}
 	if (sts < 0)
 	    __pmSendError(pmda->e_outfd, FROM_ANON, sts);


Range: use free functions std::begin()/std::end()

--- src/librawspeed/common/Range.h
+++ src/librawspeed/common/Range.h
@@ -49,11 +49,11 @@
 template <typename Tr, typename Tv>
 inline constexpr bool __attribute__((const))
 RangeContains(const Tr& r, Tv pos) {
-  if (pos < r.begin())
+  if (pos < std::begin(r))
     return false;

-  assert(pos >= r.begin());
-  return r.end() > pos;
+  assert(pos >= std::begin(r));
+  return std::end(r) > pos;
 }

 template <typename T>
@@ -62,17 +62,17 @@
   if (&lhs == &rhs)
     return true;

-  if (lhs.begin() == rhs.begin())
+  if (std::begin(lhs) == std::begin(rhs))
     return true;

   const std::pair<const T&, const T&> ordered =
       std::minmax(lhs, rhs, [](const T& r0, const T& r1) {
-        assert(r0.begin() != r1.begin());
-        return r0.begin() < r1.begin();
+        assert(std::begin(r0) != std::begin(r1));
+        return std::begin(r0) < std::begin(r1);
       });

-  assert(ordered.first.begin() < ordered.second.begin());
-  return RangeContains(ordered.first, ordered.second.begin());
+  assert(std::begin(ordered.first) < std::begin(ordered.second));
+  return RangeContains(ordered.first, std::begin(ordered.second));
 }

 } // namespace rawspeed


Eliminar process.h

Eliminar process.h

--- code/process.h
+++ code/process.h
@@ -1,61 +0,0 @@
-/*
- * Bloque de control de proceso
- * Cada instancia de esta clase contendr informacin de un proceso asociado
- *
- */
-#ifndef __process_H_
-#define __process_H_
-
-#include "common.h"
-#include "math.h"
-#include "raspberrylib.h"
-#include "gpu2d.h"
-
-//abstract class
-
-class DummyTest{
-public:
-	//Constructor
-	DummyTest(uint32 pid){
-
-	}
-	void main();
-};
-
-class PrintProcess{
-public:
-	//Constructor
-	PrintProcess(Console * pconsole, const char* string, uint32 colour,uint32 times){
-		this->pconsole = pconsole;
-		this->string = string;
-		this->colour = colour;
-		this->times = times;
-
-		//pmain = main;
-	}
-	//Destructor  necesario
-	// ~PrintProcess();
-
-
-	 void main();
-
-private:
-	//Veces que se repetir el texto
-	uint32 times;
-	//Color a imprimir
-	uint32 colour;
-	//Puntero a una cadena constante.
-	const char * string;
-	//Puntero a consola
-	Console * pconsole;
-
-	/*
-	 * ESTO DEBERA HEREDARLO
-	 */
-	//void (* pmain)();
-
-};
-
-
-
-#endif


unlink recorded file end of test to improve readi test's performance

--- apps/examples/testcase/ta_tc/audio/utc/utc_audio_main.c
+++ apps/examples/testcase/ta_tc/audio/utc/utc_audio_main.c
@@ -764,12 +764,9 @@
 	utc_audio_pcm_readi_n();
 	utc_audio_pcm_writei_p();
 	utc_audio_pcm_writei_n();
-#if 0
-	utc_audio_pcm_start_p();
-	utc_audio_pcm_start_n();
-	utc_audio_pcm_stop_p();
-	utc_audio_pcm_stop_n();
-#endif
+
+	unlink(AUDIO_TEST_FILE);
+
 	printf("#########################################\n");
 	printf("           FS TC Result               \n");
 	printf("           PASS : %d FAIL : %d        \n", total_pass, total_fail);


tss2 *: Avoid unnecessary API initialization

Do not initialize TSS API when options --help or --version
are invoked

Signed-off-by: Christian Plappert <b3f20f5332b04b0678ce3c663d8f758ced9252c1@sit.fraunhofer.de>

--- tools/fapi/tss2_template.c
+++ tools/fapi/tss2_template.c
@@ -76,8 +76,7 @@
 static tpm2_option_code tss2_handle_options (
     int            argc,
     char         **argv,
-    tpm2_options **tool_opts,
-    FAPI_CONTEXT  *fctx) {
+    tpm2_options **tool_opts) {
     tpm2_option_code rc = tpm2_option_code_err;
     bool show_help = false, manpager = true, explicit_manpager = false;
     struct option long_options [] = {
@@ -129,38 +128,11 @@
                 fprintf (stderr, "Not enough memory\n");
                 goto out;
             }
-            char *info;
-            TSS2_RC ret = Fapi_GetInfo(fctx, &info);
-            if (ret != TSS2_RC_SUCCESS) {
-                fprintf (stderr, "Fapi_GetInfo returned %u\n", ret);
-                free(prog_name);
-                goto out;
-            }
-
-            char *version = NULL;
-            char *t = strstr(info, "\"version\"");
-            if (t) {
-                t = t + strlen("\"version\"");
-                ret = sscanf(t, "%*[^\"]\"%m[^\"]%*[*]", &version);
-                /* Version string is not larger than 128 characters */
-                if (ret!=1 || strlen(version) > 128 ) {
-                    free(version);
-                    version = "not found";
-                    t = NULL;
-                }
-            }
-            else{
-                version = "not found";
-            }
-            Fapi_Free(info);
-
-            printf("tool=\"%s\" version=\"%s\" fapi-version=\"%s\"\n",
-                basename (prog_name), VERSION, version);
+
+            printf("tool=\"%s\" version=\"%s\"\n", basename (prog_name),
+                VERSION);

             free(prog_name);
-            if (t) {
-                free(version);
-            }
             }
             rc = tpm2_option_code_stop;
             goto out;
@@ -420,6 +392,14 @@
         return 1;
     }
     int ret = 1;
+
+    tpm2_option_code rc = tss2_handle_options (argc, argv, &tool_opts);
+
+    if (rc != tpm2_option_code_continue) {
+        ret = rc == tpm2_option_code_err ? 1 : 0;
+        goto free_opts;
+    }
+
     FAPI_CONTEXT *fctx = ctx_init (NULL);
     if (!fctx)
         goto free_opts;
@@ -433,14 +413,6 @@
     r = Fapi_SetBranchCB (fctx, branch_callback, NULL);
     if (r != TSS2_RC_SUCCESS) {
         fprintf (stderr, "Fapi_SetBranchCB returned %u\n", r);
-        Fapi_Finalize (&fctx);
-        goto free_opts;
-    }
-
-    tpm2_option_code rc = tss2_handle_options (argc, argv, &tool_opts, fctx);
-
-    if (rc != tpm2_option_code_continue) {
-        ret = rc == tpm2_option_code_err ? 1 : 0;
         Fapi_Finalize (&fctx);
         goto free_opts;
     }


tools/decode: don't move around the display register section

Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>

--- tools/intel_error_decode.c
+++ tools/intel_error_decode.c
@@ -315,6 +315,16 @@
 	if (matched != 2) {
 	    unsigned int reg;

+	    /* display reg section is after the ringbuffers, don't mix them */
+	    if (count) {
+		    printf("%s (%s) at 0x%08x:\n",
+			   buffer_type[is_batch],
+			   ring_name,
+			   gtt_offset);
+		    intel_decode (data, count, gtt_offset, devid, 0);
+		    count = 0;
+	    }
+
 	    printf("%s", line);

 	    matched = sscanf (line, "PCI ID: 0x%04x\n", &reg);


fixes issue 913

fixes issue 913

Use outer heap layer for malloc and free callstacks by recording xsp, xbp,
and retaddr at the outer point.  The mcxt is temporarily changed during
callstack recording to use the stored values.  This avoids issues w/
frameless allocator functions without adding the extra overhead of
not trusting the top fp on every single alloc or free.

SVN-Revision: 890

--- common/alloc.c
+++ common/alloc.c
@@ -280,6 +280,14 @@
     app_pc alloc_being_freed; /* handles post-pre-free actions */
     /* record which outer layer was used to allocate (i#123) */
     uint allocator;
+    /* present the outer layer as the top of the allocation call stack,
+     * regardless of how many inner layers we went through (i#913)
+     */
+    app_pc outer_retaddr;
+    reg_t outer_xbp;
+    reg_t outer_xsp;
+    reg_t xbp_tmp;
+    reg_t xsp_tmp;
 #ifdef WINDOWS
     /* avoid deliberate mismatches from _DebugHeapDelete<*> being used instead of
      * operator delete* (i#722,i#655)
@@ -3700,6 +3708,59 @@
     return retaddr;
 }

+static inline void
+record_mc_for_client(cls_alloc_t *pt, void *wrapcxt)
+{
+    /* Present the outer layer as the top of the allocation call stack,
+     * regardless of how many inner layers we went through (i#913).
+     * XXX: before we rarely needed mc on pre-hooks: now that we need it
+     * on many perhaps should move to main hook and pass through?
+     * XXX: this can't go in set_handling_heap_layer() b/c we currently
+     * pass operators through and don't handle until malloc/free!
+     */
+    dr_mcontext_t *mc = drwrap_get_mcontext_ex(wrapcxt, DR_MC_GPR);
+    pt->outer_xsp = mc->xsp;
+    pt->outer_xbp = mc->xbp;
+    pt->outer_retaddr = drwrap_get_retaddr(wrapcxt);
+    LOG(3, "\t@ level=%d recorded xsp="PFX" xbp="PFX" ra="PFX"\n",
+        pt->in_heap_routine, pt->outer_xsp, pt->outer_xbp, pt->outer_retaddr);
+}
+
+/* Returns the top frame pc to pass to the client and temporarily sets
+ * the mc fields so that callstacks appear to end at the outer heap
+ * layer (i#913).
+ * Call restore_mc_for_client() afterward to restore the mc.
+ */
+static inline app_pc
+set_mc_for_client(cls_alloc_t *pt, void *wrapcxt, dr_mcontext_t *mc, app_pc post_call)
+{
+    if (pt->allocator != 0) {
+        pt->xsp_tmp = mc->xsp;
+        pt->xbp_tmp = mc->xbp;
+        mc->xsp = pt->outer_xsp;
+        mc->xbp = pt->outer_xbp;
+        /* XXX i#639: we'd like to have the outer heap routine itself
+         * on the callstack.  However, doing so here can result in missing the
+         * caller frame (i#913).  What we want is to be able to pass multiple
+         * pre-set pcs to the callstack walker, not just the top.
+         */
+        return pt->outer_retaddr;
+    } else if (post_call != NULL)
+        return post_call;
+    else
+        return drwrap_get_retaddr(wrapcxt);
+}
+
+/* Call after calling set_mc_for_client() and then invoking a client routine */
+static inline void
+restore_mc_for_client(cls_alloc_t *pt, void *wrapcxt, dr_mcontext_t *mc)
+{
+    if (pt->allocator != 0) {
+        mc->xsp = pt->xsp_tmp;
+        mc->xbp = pt->xbp_tmp;
+    }
+}
+
 /* RtlAllocateHeap(HANDLE heap, ULONG flags, ULONG size) */
 /* void *malloc(size_t size) */
 #define ARGNUM_MALLOC_SIZE(type) (IF_WINDOWS((type == RTL_ROUTINE_MALLOC) ? 2 :) 0)
@@ -3919,8 +3980,10 @@
  * FREE
  */

-static void
-record_allocator(void *drcontext, cls_alloc_t *pt, alloc_routine_entry_t *routine)
+/* Records allocator as well as the outer layer for reporting any error (i#913) */
+static void
+record_allocator(void *drcontext, cls_alloc_t *pt, alloc_routine_entry_t *routine,
+                 void *wrapcxt)
 {
     /* just record outer layer: leave adjusting to malloc (i#123).
      * XXX: we assume none of the "fake" outer layers like LdrShutdownProcess
@@ -3937,15 +4000,18 @@
         pt->ignore_next_mismatch = false; /* just in case */
 #endif
         LOG(3, "alloc type: %x\n", pt->allocator);
+
+        record_mc_for_client(pt, wrapcxt);
     }
 }

 /* i#123: report mismatch in free/delete/delete[]
  * Caller must hold malloc lock
+ * Also records the outer layer for reporting any error (i#913)
  */
 static bool
-handle_free_check_mismatch(void *drcontext, void *wrapcxt, alloc_routine_entry_t *routine,
-                           malloc_entry_t *entry)
+handle_free_check_mismatch(void *drcontext, cls_alloc_t *pt, void *wrapcxt,
+                           alloc_routine_entry_t *routine, malloc_entry_t *entry)
 {
     /* XXX: safe_read */
 #ifdef WINDOWS
@@ -3958,6 +4024,12 @@
     uint free_type = malloc_allocator_type(routine);
     LOG(3, "alloc/free match test: alloc %x vs free %x %s\n",
         alloc_type, free_type, routine->name);
+
+    /* A convenient place to record outermost layer (even if not handled: we want
+     * operator delete) on free
+     */
+    record_mc_for_client(pt, wrapcxt);
+
     if (entry == NULL && alloc_type == MALLOC_ALLOCATOR_UNKNOWN) {
         /* try 4 bytes back, in case this is an array w/ size passed to delete */
         alloc_type = malloc_alloc_type(base - sizeof(int));
@@ -4057,12 +4129,15 @@
         return;
     }
     if (pt->in_heap_routine == 1/*alread incremented, so outer*/) {
+        /* N.B.: should be called even if not reporting mismatches as it also
+         * records the outer layer (i#913)
+         */
 #ifdef WINDOWS
         if (pt->ignore_next_mismatch)
             pt->ignore_next_mismatch = false;
         else
 #endif
-            handle_free_check_mismatch(drcontext, wrapcxt, routine, entry);
+            handle_free_check_mismatch(drcontext, pt, wrapcxt, routine, entry);
     }
 #ifdef WINDOWS
     else if (pt->ignore_next_mismatch)
@@ -4095,6 +4170,9 @@
         ptr_int_t auxarg;
         int auxargnum;
 #endif
+        app_pc top_pc;
+        dr_mcontext_t *mc = drwrap_get_mcontext_ex(wrapcxt, DR_MC_GPR);
+
         pt->expect_lib_to_fail = false;
         if (redzone_size(routine) > 0) {
             ASSERT(redzone_size(routine) >= sizeof(size_t),
@@ -4142,14 +4220,16 @@
                      (type == HEAP_ROUTINE_FREE_DBG) ? 1 : -1);
         auxarg = (ptr_int_t) (auxargnum == -1 ? NULL : drwrap_get_arg(wrapcxt, auxargnum));
 #endif
+
+        top_pc = set_mc_for_client(pt, wrapcxt, mc, NULL);
         change_base = client_handle_free
             /* if we pass routine->pc, we can miss a frame b/c call_site may
              * be at top of stack with ebp pointing to its parent frame.
              * developer doesn't need to see explicit free() frame, right?
              */
-            (base, size, real_base, real_size,
-             drwrap_get_mcontext_ex(wrapcxt, DR_MC_GPR),
-             drwrap_get_retaddr(wrapcxt), routine->set->client _IF_WINDOWS(&auxarg));
+            (base, size, real_base, real_size, mc, top_pc,
+             routine->set->client _IF_WINDOWS(&auxarg));
+        restore_mc_for_client(pt, wrapcxt, mc);
 #ifdef WINDOWS
         if (auxargnum != -1)
             drwrap_set_arg(wrapcxt, auxargnum, (void *)auxarg);
@@ -4524,8 +4604,10 @@
         handle_alloc_failure(pt->alloc_size, zeroed, realloc, post_call, mc);
     } else {
         if (alloc_ops.record_allocs) {
+            app_pc top_pc = set_mc_for_client(pt, wrapcxt, mc, post_call);
             malloc_add_common(app_base, app_base + pt->alloc_size, real_base+pad_size,
-                              0, 0, mc, post_call, pt->allocator);
+                              0, 0, mc, top_pc, pt->allocator);
+            restore_mc_for_client(pt, wrapcxt, mc);
         }
         client_handle_malloc(drcontext, app_base, pt->alloc_size, real_base,
                              /* if no padded size, use aligned real size */
@@ -4705,10 +4787,12 @@
         if (alloc_ops.record_allocs) {
             /* we can't remove the old one since it could have been
              * re-used already: so we leave it as invalid */
+            app_pc top_pc = set_mc_for_client(pt, wrapcxt, mc, post_call);
             malloc_add_common(app_base, app_base + pt->alloc_size,
                               real_base +
                               (alloc_ops.get_padded_size ? pad_size : real_size),
-                              0, 0, mc, post_call, pt->allocator);
+                              0, 0, mc, top_pc, pt->allocator);
+            restore_mc_for_client(pt, wrapcxt, mc);
             if (pt->alloc_size == 0) {
                 /* PR 493870: if realloc(non-NULL, 0) did allocate a chunk, mark
                  * as pre-us since we did not put a redzone on it
@@ -5064,6 +5148,7 @@
                                       redzone_size(routine))) {
         return;
     }
+    set_handling_heap_layer(pt, base, 0);
     if (redzone_size(routine) > 0) {
         /* BOOLEAN NTAPI RtlValidateHeap(HANDLE Heap, ULONG Flags, PVOID Block)
          * Block is optional
@@ -5264,18 +5349,23 @@
     /* i#123: check for mismatches.  Because of placement new and other
      * complications, new and delete are non-adjusting layers: we just
      * do mismatch checks.
+     * N.B.: record_allocator() should be called even if not reporting
+     * mismatches as it also records the outer layer (i#913)
      */
     if (is_new_routine(type) ||
         is_malloc_routine(type) ||
         is_realloc_routine(type) ||
         is_calloc_routine(type)) {
-        record_allocator(drcontext, pt, routine);
+        record_allocator(drcontext, pt, routine, wrapcxt);
     } else if (is_delete_routine(type) ||
                is_free_routine(type)) {
         if (pt->in_heap_routine == 0) {
             if (is_delete_routine(type)) {
                 /* free() checked in handle_free_pre */
-                handle_free_check_mismatch(drcontext, wrapcxt, routine, NULL);
+                /* N.B.: should be called even if not reporting mismatches as it also
+                 * records the outer layer (i#913)
+                 */
+                handle_free_check_mismatch(drcontext, pt, wrapcxt, routine, NULL);
 #ifdef WINDOWS
                 pt->ignore_next_mismatch = false; /* just in case */
 #endif


flash: Fix bad check for flash_is_erased()

This caused all platforms to check only the first 25% of each page to
see if it's already erased.  Fortunately, we tend to fill flash pages
from the beginning, so in normal usage we don't hit this bug.

BUG=chrome-os-partner:30281
BRANCH=all (if convenient)
TEST=Make sure CONFIG_CMD_FLASH is defined.  Then at the EC console:
  flasherase 0x1f000 0x400
  rw 0x1f3e0 -> 0xffffffff
  flashwrite 0x1f3e0 0x20
  rw 0x1f3e0 -> 0x03020100
  flasherase 0x1f000 0x400
  rw 0x1f3e0 -> 0x03020100 (bad!) or 0xffffffff (good)

Change-Id: If78b08b5e0414993a440bc8cd707b5ce70eb1a0a
Signed-off-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206891
Reviewed-by: Dmitry Torokhov <10a8c465cefc9bdd6c925e26964d23c90f1141cc@chromium.org>
Reviewed-by: Alec Berg <1a4429eeda29095a12e19a73405f80f5b7f37a63@chromium.org>

--- common/flash.c
+++ common/flash.c
@@ -120,7 +120,7 @@
 			  (const char **)&ptr) < 0)
 		return 0;

-	for (size /= sizeof(uint32_t); size > 0; size -= 4, ptr++)
+	for (size /= sizeof(uint32_t); size > 0; size--, ptr++)
 		if (*ptr != CONFIG_FLASH_ERASED_VALUE32)
 			return 0;


common/timer: Disable interrupts when timer is updated

On systems with 32 bit counters, first clksrc_high variable (higher
32 bits) is updated then hardware counter is updated. When interrupts
are enabled then eg. timer overflow could occur during update which
leads to unpredictable behaviour.

To avoid this problem, just make sure that interrupts are disabled
before update. State is restored after timer update is finished.

BUG=b:200828093
BRANCH=none
TEST=make -j buildall
TEST=Compile EC with CONFIG_CMD_FORCETIME enabled. Use 'forcetime'
     command to set time, then use 'timerinfo' to check if correct
     time is set.

Signed-off-by: Patryk Duda <6aed17a362577cf10cb5675888c1635d522769c1@semihalf.com>
Change-Id: I4f36507d20ebd01d1d407812a3c4a2690163ed1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3347658
Reviewed-by: Tom Hughes <fc5c12f30a5ed2baa0581f44ee14ad1eb7b20d83@chromium.org>
Reviewed-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Commit-Queue: Patryk Duda <213d388d1c6ea6afd34b87da9fc4415c3231b04c@google.com>

--- common/timer.c
+++ common/timer.c
@@ -254,8 +254,24 @@
 	if (IS_ENABLED(CONFIG_HWTIMER_64BIT)) {
 		__hw_clock_source_set64(ts.val);
 	} else {
+		/* Save current interrupt state */
+		bool interrupt_enabled = is_interrupt_enabled();
+
+		/*
+		 * Updating timer shouldn't be interrupted (eg. when counter
+		 * overflows) because it could lead to some unintended
+		 * consequences. Please note that this function can be called
+		 * with disabled or enabled interrupts so we need to restore
+		 * the original state later.
+		 */
+		interrupt_disable();
+
 		clksrc_high = ts.le.hi;
 		__hw_clock_source_set(ts.le.lo);
+
+		/* Restore original interrupt state */
+		if (interrupt_enabled)
+			interrupt_enable();
 	}

 	/* some timers might be already expired : process them */


ideviceprovision: Fix date output by adding MAC_EPOCH

--- common/utils.c
+++ common/utils.c
@@ -472,7 +472,7 @@
 	case PLIST_DATE:
 		plist_get_date_val(node, (int32_t*)&tv.tv_sec, (int32_t*)&tv.tv_usec);
 		{
-			time_t ti = (time_t)tv.tv_sec;
+			time_t ti = (time_t)tv.tv_sec + MAC_EPOCH;
 			struct tm *btime = localtime(&ti);
 			if (btime) {
 				s = (char*)malloc(24);


make the where helper class ctors constexpr

--- common/where.h
+++ common/where.h
@@ -37,7 +37,7 @@
         LValue &lhs;

         // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT
-        MaskedLValue(const Mask &m, LValue &l) : mask(m), lhs(l) {}
+        constexpr MaskedLValue(const Mask &m, LValue &l) : mask(m), lhs(l) {}
         MaskedLValue(const MaskedLValue &) = delete;

         /* It is intentional that the assignment operators return void: When a bool is used for the
@@ -70,7 +70,7 @@
         LValue &lhs;

         // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT
-        MaskedLValue(const Mask &m, LValue &l) : mask(m), lhs(l) {}
+        constexpr MaskedLValue(const Mask &m, LValue &l) : mask(m), lhs(l) {}
         MaskedLValue(const MaskedLValue &) = delete;

         template<typename T> Vc_ALWAYS_INLINE void operator  =(T &&rhs) { if (mask) lhs   = std::forward<T>(rhs); }
@@ -96,7 +96,7 @@
         const Mask &mask;

         // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT
-        WhereMask(const Mask &m) : mask(m) {}
+        constexpr WhereMask(const Mask &m) : mask(m) {}
         WhereMask(const WhereMask &) = delete;

         template<typename T> constexpr Vc_WARN_UNUSED_RESULT MaskedLValue<Mask, T> operator|(T &&lhs) const


Tried fixing dmc, didn't work properly.

Tried fixing dmc, didn't work properly.

--- comp/dmcconf.h
+++ comp/dmcconf.h
@@ -1,5 +1,5 @@
 #define VERSION "0.1"
-#define DMCDIR ".dmc"
+#define DMCDIR "/usr/local/mail/"
 #define DIRPERM 0750
 #define EDITOR "ed"
 #define MAXACC 16 /* maximum number of accounts */


compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN

The previous commit swaps the order we check the macros defined by
the compiler and the system headers from the original.  Since the
order of check should not matter (i.e. it is insane to define both
__BIG_ENDIAN and friends and BIG_ENDIAN and friends and in a
conflicting way), it is the most conservative thing to do not to
change it.

Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- compat/bswap.h
+++ compat/bswap.h
@@ -101,17 +101,17 @@
 #undef ntohll
 #undef htonll

-#if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
+#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
+
+# define GIT_BYTE_ORDER __BYTE_ORDER
+# define GIT_LITTLE_ENDIAN __LITTLE_ENDIAN
+# define GIT_BIG_ENDIAN __BIG_ENDIAN
+
+#elif defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)

 # define GIT_BYTE_ORDER BYTE_ORDER
 # define GIT_LITTLE_ENDIAN LITTLE_ENDIAN
 # define GIT_BIG_ENDIAN BIG_ENDIAN
-
-#elif defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
-
-# define GIT_BYTE_ORDER __BYTE_ORDER
-# define GIT_LITTLE_ENDIAN __LITTLE_ENDIAN
-# define GIT_BIG_ENDIAN __BIG_ENDIAN

 #else


reverting limiter to not have the ramping function

git-svn-id: 2b5c7dd64018d64366331a0a575feb7e6b521b9c@37 bc2ad3ca-9a4d-0410-8d14-35da9c29b421

--- ttblue/dsplib/tt_limiter.h
+++ ttblue/dsplib/tt_limiter.h
@@ -13,7 +13,6 @@

 // Include appropriate headers
 #include "tt_audio_base.h"
-#include "tt_ramp.h"		// Used for ramping the preamp value smoothly
 //#include"tt_buffer.h"

@@ -40,8 +39,6 @@
 		double						recip;
 		tt_sample_vector 			buf1, buf2, gain;
 //		tt_buffer					*buffer1, *buffer2, *buffer_gain;
-		tt_ramp						*ob_ramp;
-		tt_audio_signal				*sig_ramp;
 		long 						bp, samps;
 		float 						last;

@@ -91,18 +88,10 @@
 			buf1 = (float *)mem_alloc(MAX_SAMPLES * sizeof(float));
 			buf2 = (float *)mem_alloc(MAX_SAMPLES * sizeof(float));
 			gain = (float *)mem_alloc(MAX_SAMPLES * sizeof(float));
+
 //			buffer1 = new tt_buffer;
 //			buffer2 = new tt_buffer;
 //			buffer_gain = new tt_buffer;
-
-			ob_ramp = new tt_ramp;
-			ob_ramp->set_attr(tt_ramp::k_mode, tt_ramp::k_mode_vector_accurate);
-			ob_ramp->set_attr(tt_ramp::k_current_value, 1.0);	// This is the value of preamp
-			ob_ramp->set_attr(tt_ramp::k_ramp_ms, 100.0);		// default ramp time in ms
-
-			// Allocating a signal for output from the ramp object
-			sig_ramp = new tt_audio_signal(vectorsize);
-
 //			buffer1->set_attr(tt_buffer::k_length_samples, MAX_SAMPLES);
 //			buffer2->set_attr(tt_buffer::k_length_samples, MAX_SAMPLES);
 //			buffer_gain->set_attr(tt_buffer::k_length_samples, MAX_SAMPLES);
@@ -123,10 +112,6 @@
 //			delete buffer1;
 //			delete buffer2;
 //			delete buffer_gain;
-
-			delete ob_ramp;
-			delete sig_ramp;
-
 			mem_free(buf1);
 			mem_free(buf2);
 			mem_free(gain);
@@ -150,8 +135,7 @@
 				    recip = 1.0 / (double)lookahead;
 					break;
 				case k_preamp:
-					//preamp = decibels_to_amplitude(val);
-					ob_ramp->set_attr(tt_ramp::k_destination_value, decibels_to_amplitude(val));
+					preamp = decibels_to_amplitude(val);
 					break;
 				case k_postamp:
 					postamp = decibels_to_amplitude(val);
@@ -243,11 +227,8 @@
 			double left_sample, right_sample, curgain, newgain, inc;
 			double acc, maybe;
 			long ind, flag, bbp, i;
-			char lin = (mode == k_mode_linear);		// done at the vector to save a few cycles
-			temp_vs = in1->vectorsize;
-
-			ob_ramp->dsp_vector_calc(sig_ramp);
-			preamp = *sig_ramp->vector;				// we take only the first value of the vector
+			char lin = (mode == k_mode_linear);			// done at the vector to save a few cycles
+			temp_vs = in1->vectorsize;

 		    while(temp_vs--){
 		    	right_sample = *in1->vector++ * preamp;
@@ -321,9 +302,6 @@
 			char lin = (mode == k_mode_linear);			// done at the vector to save a few cycles
 			temp_vs = in->vectorsize;

-			ob_ramp->dsp_vector_calc(sig_ramp);
-			preamp = *sig_ramp->vector;				// we take only the first value of the vector
-
 		    while (temp_vs--){
 		    	left_sample = right_sample = *in->vector++ * preamp;

@@ -390,9 +368,6 @@
 			long ind, flag, bbp, i;
 			char lin = (mode == k_mode_linear);			// done at the vector to save a few cycles
 			temp_vs = in1->vectorsize;
-
-			ob_ramp->dsp_vector_calc(sig_ramp);
-			preamp = *sig_ramp->vector;				// we take only the first value of the vector

 		    while(temp_vs--){
 		    	right_sample = *in1->vector++ * preamp;
@@ -457,9 +432,6 @@
 			char lin = (mode == k_mode_linear);			// done at the vector to save a few cycles
 			temp_vs = in->vectorsize;

-			ob_ramp->dsp_vector_calc(sig_ramp);
-			preamp = *sig_ramp->vector;				// we take only the first value of the vector
-
 		    while (temp_vs--){
 		    	left_sample = right_sample = *in->vector++ * preamp;


MOD: Post-merge cleanup and fix for ASCII Strings

--- cegui/include/CEGUI/WindowRendererSets/Core/StaticText.h
+++ cegui/include/CEGUI/WindowRendererSets/Core/StaticText.h
@@ -660,18 +660,26 @@
         static inline return_type fromString(const String& str)
         {
             if (str == s_autoString)
+            {
                 return FalagardStaticText::NumOfTextLinesToShow::auto_();
-            float val=0;
-            sscanf(str.c_str(), " %g", &val);
+            }
+
+            float val = 0.0f;
+            std::stringstream sstream;
+            sstream << str;
+            sstream >> val;
             return FalagardStaticText::NumOfTextLinesToShow(val);
         }
         static inline string_return_type toString(pass_type val)
         {
             if (val.isAuto())
+            {
                 return s_autoString;
-            char buff[64];
-            snprintf(buff, sizeof(buff), "%g", val.get());
-            return String(buff);
+            }
+
+            std::stringstream sstream;
+            sstream << val.get();
+            return String(sstream.str());
         }
     };


Add support for aarch64

Add support for aarch64

Nothing controversial here, only the C stubs for the OCaml barrier functions
need updating.

--- lib/bindings/barrier_stubs.c
+++ lib/bindings/barrier_stubs.c
@@ -14,11 +14,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */

-#if 0
-#include <stdint.h>
-#include <assert.h>
-#endif
-
 #include "solo5.h"

 #include <caml/mlvalues.h>
@@ -26,21 +21,23 @@
 #include <caml/memory.h>
 #include <caml/bigarray.h>

-#if 0
-#include <mini-os/os.h>
+#if defined(__x86_64__)
+#define mb()     __asm__ __volatile__("mfence" ::: "memory")
+#define rmb()    __asm__ __volatile__("lfence" ::: "memory")
+#define wmb()    __asm__ __volatile__("sfence" ::: "memory")
+#elif defined(__aarch64__)
+#define dsb(opt) __asm__ __volatile__("dsb " #opt ::: "memory")
+#define mb()     dsb(sy)
+#define rmb()    dsb(ld)
+#define wmb()    dsb(st)
+#else
+#error Unsupported architecture
 #endif
-
-#define mb()    __asm__ __volatile__ ("mfence":::"memory")
-#define rmb()   __asm__ __volatile__ ("lfence":::"memory")
-#define wmb()	__asm__ __volatile__ ("sfence" ::: "memory") /* From CONFIG_UNORDERED_IO (linux) */
-
-#define xen_mb() mb()
-#define xen_wmb() wmb()

 CAMLprim value
 caml_memory_barrier()
 {
-  xen_mb();
+  mb();
   return Val_unit;
 }


bhyve: cleanup bhyveBuildNetArgStr error handling

Use 'goto cleanup'-style error handling instead of explicitly
freeing variables in every error path.

--- src/bhyve/bhyve_command.c
+++ src/bhyve/bhyve_command.c
@@ -52,26 +52,25 @@
     char macaddr[VIR_MAC_STRING_BUFLEN];
     char *realifname = NULL;
     char *brname = NULL;
+    int ret = -1;
     virDomainNetType actualType = virDomainNetGetActualType(net);

     if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
         if (VIR_STRDUP(brname, virDomainNetGetActualBridgeName(net)) < 0)
-            return -1;
+            goto cleanup;
     } else {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Network type %d is not supported"),
                        virDomainNetGetActualType(net));
-        return -1;
+        goto cleanup;
     }

     if (!net->ifname ||
         STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
         strchr(net->ifname, '%')) {
         VIR_FREE(net->ifname);
-        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0) {
-            VIR_FREE(brname);
-            return -1;
-        }
+        if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+            goto cleanup;
     }

     if (!dryRun) {
@@ -80,33 +79,24 @@
                                            virDomainNetGetActualVirtPortProfile(net),
                                            virDomainNetGetActualVlan(net),
                                            VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST) < 0) {
-            VIR_FREE(net->ifname);
-            VIR_FREE(brname);
-            return -1;
+            goto cleanup;
         }

         realifname = virNetDevTapGetRealDeviceName(net->ifname);

-        if (realifname == NULL) {
-            VIR_FREE(net->ifname);
-            VIR_FREE(brname);
-            return -1;
-        }
+        if (realifname == NULL)
+            goto cleanup;

         VIR_DEBUG("%s -> %s", net->ifname, realifname);
         /* hack on top of other hack: we need to set
          * interface to 'UP' again after re-opening to find its
          * name
          */
-        if (virNetDevSetOnline(net->ifname, true) != 0) {
-            VIR_FREE(realifname);
-            VIR_FREE(net->ifname);
-            VIR_FREE(brname);
-            return -1;
-        }
+        if (virNetDevSetOnline(net->ifname, true) != 0)
+            goto cleanup;
     } else {
         if (VIR_STRDUP(realifname, "tap0") < 0)
-            return -1;
+            goto cleanup;
     }

@@ -114,9 +104,15 @@
     virCommandAddArgFormat(cmd, "%d:0,virtio-net,%s,mac=%s",
                            net->info.addr.pci.slot,
                            realifname, virMacAddrFormat(&net->mac, macaddr));
+
+    ret = 0;
+ cleanup:
+    if (ret < 0)
+        VIR_FREE(net->ifname);
+    VIR_FREE(brname);
     VIR_FREE(realifname);

-    return 0;
+    return ret;
 }

 static int


portability++

portability++

--- src/bin/e_fileman_smart.c
+++ src/bin/e_fileman_smart.c
@@ -2,8 +2,8 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 #include "e.h"
+#include <sys/types.h>
 #include <dirent.h>
-#include <sys/types.h>
 #include <pwd.h>
 #include <grp.h>

@@ -1106,8 +1106,8 @@

 	      dir_entry2 = calloc( 1, sizeof(struct dirent));
 	      dir_entry2->d_ino = dir_entry->d_ino;
-	      dir_entry2->d_off = dir_entry->d_off;
-	      dir_entry2->d_reclen = dir_entry->d_reclen;
+	      // dir_entry2->d_off = dir_entry->d_off; // not portable
+	      // dir_entry2->d_reclen = dir_entry->d_reclen; // note portable
 	      dir_entry2->d_type = dir_entry->d_type;
 	      snprintf (dir_entry2->d_name, NAME_MAX+1, dir_entry->d_name);


explicitly tag sandbox gadget instances as such

--- src/bin/e_gadget_runner.c
+++ src/bin/e_gadget_runner.c
@@ -41,6 +41,7 @@
    Eina_Stringshare *cmd;
    void *inst;
    Eina_Bool cmd_changed E_BITFIELD;
+   Eina_Bool sandbox E_BITFIELD;
 } Config_Item;

 typedef struct Tooltip
@@ -900,6 +901,7 @@
         ci->cmd = eina_stringshare_add(ed->exec);
         ci->exit_mode = EXIT_MODE_RESTART;
      }
+   ci->sandbox = 1;
    return gadget_create(parent, ci, id, orient);
 }


Fix core dump in pg_dump --binary-upgrade on zero-column composite type.

This reverts nearly all of commit 28f6cab61ab8958b1a7dfb019724687d92722538
in favor of just using the typrelid we already have in pg_dump's TypeInfo
struct for the composite type.  As coded, it'd crash if the composite type
had no attributes, since then the query would return no rows.

Back-patch to all supported versions.  It seems to not really be a problem
in 9.0 because that version rejects the syntax "create type t as ()", but
we might as well keep the logic similar in all affected branches.

Report and fix by Rushabh Lathia.

--- src/bin/pg_dump/pg_dump.c
+++ src/bin/pg_dump/pg_dump.c
@@ -9273,7 +9273,6 @@
 	int			i_attalign;
 	int			i_attisdropped;
 	int			i_attcollation;
-	int			i_typrelid;
 	int			i;
 	int			actual_atts;

@@ -9294,8 +9293,7 @@
 			"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
 						  "a.attlen, a.attalign, a.attisdropped, "
 						  "CASE WHEN a.attcollation <> at.typcollation "
-						  "THEN a.attcollation ELSE 0 END AS attcollation, "
-						  "ct.typrelid "
+						  "THEN a.attcollation ELSE 0 END AS attcollation "
 						  "FROM pg_catalog.pg_type ct "
 				"JOIN pg_catalog.pg_attribute a ON a.attrelid = ct.typrelid "
 					"LEFT JOIN pg_catalog.pg_type at ON at.oid = a.atttypid "
@@ -9313,8 +9311,7 @@
 		appendPQExpBuffer(query, "SELECT a.attname, "
 			"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
 						  "a.attlen, a.attalign, a.attisdropped, "
-						  "0 AS attcollation, "
-						  "ct.typrelid "
+						  "0 AS attcollation "
 					 "FROM pg_catalog.pg_type ct, pg_catalog.pg_attribute a "
 						  "WHERE ct.oid = '%u'::pg_catalog.oid "
 						  "AND a.attrelid = ct.typrelid "
@@ -9332,15 +9329,12 @@
 	i_attalign = PQfnumber(res, "attalign");
 	i_attisdropped = PQfnumber(res, "attisdropped");
 	i_attcollation = PQfnumber(res, "attcollation");
-	i_typrelid = PQfnumber(res, "typrelid");

 	if (dopt->binary_upgrade)
 	{
-		Oid			typrelid = atooid(PQgetvalue(res, 0, i_typrelid));
-
 		binary_upgrade_set_type_oids_by_type_oid(fout, q,
 												 tyinfo->dobj.catId.oid);
-		binary_upgrade_set_pg_class_oids(fout, q, typrelid, false);
+		binary_upgrade_set_pg_class_oids(fout, q, tyinfo->typrelid, false);
 	}

 	qtypname = pg_strdup(fmtId(tyinfo->dobj.name));


Storage: add MIC variant of IntrinsicType

Signed-off-by: Matthias Kretz <372ea4eca737a13cd010ee806d4ce7b98ee71550@kde.org>

--- common/storage.h
+++ common/storage.h
@@ -58,6 +58,13 @@
         std::is_integral<ValueType>::value, __m128i,
         typename std::conditional<std::is_same<ValueType, double>::value, __m128d,
                                   __m128>::type>::type;
+};
+#elif defined VC_IMPL_MIC
+template <typename ValueType, size_t Size> struct IntrinsicType {
+    using type = typename std::conditional<
+        std::is_integral<ValueType>::value, __m512i,
+        typename std::conditional<std::is_same<ValueType, double>::value, __m512d,
+                                  __m512>::type>::type;
 };
 #else
 template <typename ValueType, size_t Size> struct IntrinsicType {


remove the useless function _globus_gass_cache_lock_file()

--- gass/cache/source/globus_gass_cache.c
+++ gass/cache/source/globus_gass_cache.c
@@ -979,7 +979,7 @@

 /******************************************************************************
-Function: _globus_l_gass_cache_lock_file()
+Function: globus_l_gass_cache_lock_file()

 Description: Create an advisory lock on a file. To methode have been
     implemented: using hard link (if NEW_LOCK is not defined) and
@@ -987,9 +987,6 @@
     ->hard links do not exist on AFS
     -> open(... O_CREAT|O_EXCL) do not work on all version of unix (But
     all the new versions/POSIX [IEEE 1988]
-    This function is identical to globus_l_gass_cache_lock_file(), but return
-    GLOBUS_GASS_CACHE_LOCK_TIMEOUT is the lock timed out and the lock had to
-    be broken. (to be used for test purpose.)

 Parameters: input:
                file_to_be_locked : path to the file to lock
@@ -1006,7 +1003,7 @@

 ******************************************************************************/
 static int
-_globus_l_gass_cache_lock_file(char* file_to_be_locked)
+globus_l_gass_cache_lock_file(char* file_to_be_locked)
 {
     char   lock_file[FILENAME_MAX+1];
     int    lock_file_fd;
@@ -1014,11 +1011,11 @@
     int    uniq_lock_file_fd;
     struct stat file_stat;
     char   hname[MAXHOSTNAMELEN];
+    int    return_code=GLOBUS_SUCCESS;

 #   ifdef LOCK_TOUT
     int    lock_tout=0;
     struct timeval tv;
-    int    return_code=GLOBUS_SUCCESS;
 #   endif

     /* build the name of the file used to lock "file_to_be_locked" */
@@ -1150,183 +1147,9 @@
 	/* try again to lock the file */
     } while ( 1 );

-
-#   ifdef LOCK_TOUT
-    {
-        return(return_code);
-    }
-#   endif
-} /* _globus_l_gass_cache_lock_file */
-
-/******************************************************************************
-Function:globus_l_gass_cache_lock_file()
-
-Description: Create an advisory lock on a file. To methode have been
-    implemented: using hard link (if NEW_LOCK is not defined) and
-    using open(... O_CREAT|O_EXCL) which return an error if file exist.
-    ->hard links do not exist on AFS
-    -> open(... O_CREAT|O_EXCL) do not work on all version of unix (But
-    all the new versions/POSIX [IEEE 1988]
-
-Parameters: input:
-               file_to_be_locked : path to the file to lock
-	    output:
-	        none
-Returns:
-            GLOBUS_SUCCESS or
-	    GLOBUS_GASS_CACHE_ERROR_LOCK_ERROR
-
-Note : If compilled with LOCK_TOUT defined, the lock will timeout after
-       LOCK_TOUT try to get the lock, if the file to lock is older than
-       LOCK_TOUT*LOOP_TIME
-
-******************************************************************************/
-static int
-globus_l_gass_cache_lock_file(char* file_to_be_locked)
-{
-    char   lock_file[FILENAME_MAX+1];
-    int    lock_file_fd;
-    char   uniq_lock_file[FILENAME_MAX+1];
-    int    uniq_lock_file_fd;
-    struct stat file_stat;
-    char   hname[MAXHOSTNAMELEN];
-
-#   ifdef LOCK_TOUT
-    int    lock_tout=0;
-    struct timeval tv;
-#   endif
-
-    /* build the name of the file used to lock "file_to_be_locked" */
-    strcpy(lock_file, file_to_be_locked);
-    strcat(lock_file, GLOBUS_L_GASS_CACHE_LOCK_EXT);
-    /* !!! need to handle multi threaded !!! */
-    globus_libc_gethostname(hname,sizeof(hname));
-
-    globus_libc_sprintf(uniq_lock_file,"%s_%s_%ld:%ld",
-			lock_file,
-			hname,
-			(long) globus_libc_getpid(),
-			(long) globus_thread_self());
-
-    while ( (uniq_lock_file_fd = creat(uniq_lock_file,
-				       GLOBUS_L_GASS_CACHE_STATE_MODE)) < 0 )
-    {
-	if (errno != EINTR)
-	{
-	    CACHE_TRACE2("could not create uniq lock file %s",uniq_lock_file);
-	    return(GLOBUS_GASS_CACHE_ERROR_LOCK_ERROR);
-	}
-    }
-    while (close(uniq_lock_file_fd) < 0 )
-    {
-	if (errno != EINTR)
-	{
-	    CACHE_TRACE2("could not close uniq lock file %s",uniq_lock_file);
-	    return(GLOBUS_GASS_CACHE_ERROR_LOCK_ERROR);
-	}
-    }
-
-    do
-    {
-	while ( link(uniq_lock_file, lock_file) < 0)
-	{
-            /* ENOTEMPTY: I try to ignore it for problems on DFS from a      */
-	    /* Solaris machine                                               */
-	    /* EEXIST : the file is locked by an other process               */
-	    /* EINTR : system call interrupted: retry                        */
-	    if (errno != EEXIST && errno != EINTR  && errno != ENOTEMPTY  )
-	    {
-		CACHE_TRACE3("Lock: Could not link files %s and %s\n",uniq_lock_file, lock_file);
-		CACHE_TRACE2("Lock: Errno :%d\n",errno);
-		return(GLOBUS_GASS_CACHE_ERROR_LOCK_ERROR);
-	    }
-
-#           ifdef LOCK_TOUT
-	    lock_tout++;
-	    if (lock_tout> LOCK_TOUT)
-	    {
-		/* check the age of the file to lock */
-		while ( stat(file_to_be_locked ,&file_stat) != 0)
-		{
-		    if (errno != EINTR)
-		    {
-			CACHE_TRACE2("could not get stat of file %s",
-				     uniq_lock_file);
-			return(GLOBUS_GASS_CACHE_ERROR_LOCK_ERROR);
-		    }
-		}
-		/* get system time */
-		gettimeofday(&tv, 0);
-
-		if ( file_stat.st_ctime + (LOOP_TIME*LOCK_TOUT)/1000000 < tv.tv_sec)
-		{
-		    /* the file has not been accessed for long,
-		       lets break the lock */
-		    /*
-		    CACHE_TRACE2("Lock on %s too old: I BREAK IT !!\n",
-				 file_to_be_locked);
-		    */
-		    while (unlink(lock_file) != 0 )
-		    {
-			if (errno != EINTR && errno != ENOENT )
-			{
-			    CACHE_TRACE2("Could not remove lock file %s",lock_file);
-			    return(GLOBUS_GASS_CACHE_ERROR_CAN_NOT_DEL_LOCK);
-			}
-		    }
-		}
-
-		lock_tout=0;
-	    }
-	    else
-	    {
-		globus_libc_usleep(LOOP_TIME);
-	    }
-#           else
-
-	    globus_libc_usleep(LOOP_TIME);
-#           endif
-	    /* try again to lock the file */
-
-	}
-
-	while ( stat(uniq_lock_file ,&file_stat) != 0)
-	{
-	    if (errno != EINTR)
-	    {
-		CACHE_TRACE("could not get stat of files");
-		return(GLOBUS_GASS_CACHE_ERROR_LOCK_ERROR);
-	    }
-	}
-
-	if  ( file_stat.st_nlink != 2)
-	{
-	    /* we manage to create the file, but it is not a hard link
-	       to the uniq_file, for some wird reasons. let try again */
-	    while (unlink(lock_file) != 0 )
-	    {
-		if (errno != EINTR && errno != ENOENT )
-		{
-		    CACHE_TRACE2("Could not remove lock file %s",lock_file);
-		    return(GLOBUS_GASS_CACHE_ERROR_CAN_NOT_DEL_LOCK);
-		}
-		if (errno == ENOENT )
-		    break;
-	    }
-	}
-	else
-	{
-	    /* we aquired the lock correctly, lets continue */
-	    break;
-	}
-
-	globus_libc_usleep(LOOP_TIME);
-
-	/* try again to lock the file */
-    } while ( 1 );
-
-    return(GLOBUS_SUCCESS);
+    return(return_code);
 } /* globus_l_gass_cache_lock_file */
+

 /******************************************************************************
 Function:globus_l_gass_cache_unlock_file()
@@ -1431,7 +1254,7 @@
     int rc;

     rc =globus_l_gass_cache_lock_file(cache_handle->state_file_path);
-    if ( rc != GLOBUS_SUCCESS)
+    if ( rc != GLOBUS_SUCCESS && rc !=GLOBUS_GASS_CACHE_ERROR_LOCK_TIME_OUT)
     {
 	return(rc);
     }


pgbench: Silence new compiler warnings

pgbench: Silence new compiler warnings

The original coding in 7bafffea647 and previous wasn't all that great
anyway.

Reported by Jeff Janes and Tom Lane

--- src/bin/pgbench/pgbench.c
+++ src/bin/pgbench/pgbench.c
@@ -2649,11 +2649,23 @@
 }

 /*
+ * Initialize a ParsedScript
+ */
+static void
+initParsedScript(ParsedScript *ps, const char *desc, int alloc_num, int weight)
+{
+	ps->commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
+	ps->desc = desc;
+	ps->weight = weight;
+	initStats(&ps->stats, 0.0);
+}
+
+/*
  * Given a file name, read it and return its ParsedScript representation.  "-"
  * means to read stdin.
  */
 static ParsedScript
-process_file(char *filename)
+process_file(char *filename, int weight)
 {
 #define COMMANDS_ALLOC_NUM 128
 	ParsedScript ps;
@@ -2673,8 +2685,7 @@
 	}

 	alloc_num = COMMANDS_ALLOC_NUM;
-	ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
-	ps.desc = filename;
+	initParsedScript(&ps, filename, alloc_num, weight);

 	lineno = 0;
 	index = 0;
@@ -2710,7 +2721,7 @@

 /* Parse the given builtin script and return the parsed representation */
 static ParsedScript
-process_builtin(BuiltinScript *bi)
+process_builtin(BuiltinScript *bi, int weight)
 {
 	int			lineno,
 				index;
@@ -2720,8 +2731,7 @@
 	ParsedScript ps;

 	alloc_num = COMMANDS_ALLOC_NUM;
-	ps.desc = bi->desc;
-	ps.commands = (Command **) pg_malloc(sizeof(Command *) * alloc_num);
+	initParsedScript(&ps, bi->desc, alloc_num, weight);

 	lineno = 0;
 	index = 0;
@@ -2860,7 +2870,7 @@

 /* append a script to the list of scripts to process */
 static void
-addScript(ParsedScript script, int weight)
+addScript(ParsedScript script)
 {
 	if (script.commands == NULL || script.commands[0] == NULL)
 	{
@@ -2875,8 +2885,6 @@
 	}

 	sql_script[num_scripts] = script;
-	sql_script[num_scripts].weight = weight;
-	initStats(&sql_script[num_scripts].stats, 0.0);
 	num_scripts++;
 }

@@ -3251,24 +3259,24 @@
 				}

 				weight = parseScriptWeight(optarg, &script);
-				addScript(process_builtin(findBuiltin(script)), weight);
+				addScript(process_builtin(findBuiltin(script), weight));
 				benchmarking_option_set = true;
 				internal_script_used = true;
 				break;

 			case 'S':
-				addScript(process_builtin(findBuiltin("select-only")), 1);
+				addScript(process_builtin(findBuiltin("select-only"), 1));
 				benchmarking_option_set = true;
 				internal_script_used = true;
 				break;
 			case 'N':
-				addScript(process_builtin(findBuiltin("simple-update")), 1);
+				addScript(process_builtin(findBuiltin("simple-update"), 1));
 				benchmarking_option_set = true;
 				internal_script_used = true;
 				break;
 			case 'f':
 				weight = parseScriptWeight(optarg, &script);
-				addScript(process_file(script), weight);
+				addScript(process_file(script, weight));
 				benchmarking_option_set = true;
 				break;
 			case 'D':
@@ -3406,7 +3414,7 @@
 	/* set default script if none */
 	if (num_scripts == 0 && !is_init_mode)
 	{
-		addScript(process_builtin(findBuiltin("tpcb-like")), 1);
+		addScript(process_builtin(findBuiltin("tpcb-like"), 1));
 		benchmarking_option_set = true;
 		internal_script_used = true;
 	}


Fix i#1256 bug for corner-case where .dynsym ends in an import

SVN-Revision: 2241

--- ext/drsyms/drsyms_unix.c
+++ ext/drsyms/drsyms_unix.c
@@ -317,8 +317,10 @@
                                         &out->end_offs);
         } else
             res = drsym_obj_symbol_offs(mod->obj_info, i, &modoffs, NULL);
-        if (res == DRSYM_ERROR_SYMBOL_NOT_FOUND) /* an import, so skip */
+        if (res == DRSYM_ERROR_SYMBOL_NOT_FOUND) { /* an import, so skip */
+            res = DRSYM_SUCCESS; /* if go off end of loop */
             continue;
+        }
         if (res != DRSYM_SUCCESS)
             break;


drivers/adxl345: update driver to the new I2C API

Signed-off-by: dylad <d56dfe611c7cd6204525c7c9b6afc5e84aed0f5d@mesotic.com>

--- drivers/adxl345/adxl345.c
+++ drivers/adxl345/adxl345.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Mesotic SAS
+ * Copyright (C) 2017-2018 Mesotic SAS
  *
  * This file is subject to the terms and conditions of the GNU Lesser
  * General Public License v2.1. See the file LICENSE in the top level
@@ -29,8 +29,6 @@
 #define ENABLE_DEBUG        (0)
 #include "debug.h"

-#define I2C_SPEED           I2C_SPEED_NORMAL
-
 #define BUS                 (dev->i2c)
 #define ADDR                (dev->addr)

@@ -49,28 +47,21 @@
     /* Acquire exclusive access */
     i2c_acquire(BUS);

-    /* Initialize I2C interface */
-    if (i2c_init_master(BUS, I2C_SPEED) < 0) {
-        i2c_release(BUS);
-        DEBUG("[adxl345] init - error: unable to initialize I2C bus\n");
-        return ADXL345_NOI2C;
-    }
-
     /* test if the target device responds */
-    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_CHIP_ID_REG, &reg);
+    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_CHIP_ID_REG, &reg, 0);
     if (reg != ACCEL_ADXL345_CHIP_ID) {
         i2c_release(BUS);
         DEBUG("[adxl345] init - error: invalid id value [0x%02x]\n", (int)reg);
         return ADXL345_NODEV;
     }
     /* configure the user offset */
-    i2c_write_regs(BUS, ADDR, ACCEL_ADXL345_OFFSET_X, dev->params->offset, 3);
+    i2c_write_regs(BUS, ADDR, ACCEL_ADXL345_OFFSET_X, dev->params->offset, 3, 0);
     /* Basic device setup */
     reg = (dev->params->full_res | dev->params->range);
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_DATA_FORMAT, reg);
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_BW_RATE, dev->params->rate);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_DATA_FORMAT, reg, 0);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_BW_RATE, dev->params->rate, 0);
     /* Put device in measure mode */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, MEASURE_BIT);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, MEASURE_BIT, 0);

     /* Release the bus */
     i2c_release(BUS);
@@ -87,7 +78,7 @@
     assert(dev && data);

     i2c_acquire(BUS);
-    i2c_read_regs(BUS, ADDR, ACCEL_ADXL345_DATA_X0, result, 6);
+    i2c_read_regs(BUS, ADDR, ACCEL_ADXL345_DATA_X0, result, 6, 0);
     i2c_release(BUS);

     data->x = (((result[1] << 8)+result[0]) * dev->scale_factor);
@@ -103,33 +94,33 @@

     i2c_acquire(BUS);
     /* Set threshold */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_TAP, dev->interrupt.thres_tap);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_TAP, dev->interrupt.thres_tap, 0);
     /* Set Map */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_INT_MAP, dev->interrupt.map);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_INT_MAP, dev->interrupt.map, 0);
     /* Set Duration */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_DUR, dev->interrupt.thres_dur);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_DUR, dev->interrupt.thres_dur, 0);
     /* Enable axes */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_AXES, dev->interrupt.tap_axes);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_AXES, dev->interrupt.tap_axes, 0);
     /* Set source */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_INT_SOURCE, dev->interrupt.source);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_INT_SOURCE, dev->interrupt.source, 0);
     /* Set latent threshold */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_LAT, dev->interrupt.thres_latent);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_LAT, dev->interrupt.thres_latent, 0);
     /* Set window threshold */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_WIN, dev->interrupt.thres_window);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TAP_WIN, dev->interrupt.thres_window, 0);
     /* Set activity threshold */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_ACT, dev->interrupt.thres_act);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_ACT, dev->interrupt.thres_act, 0);
     /* Set inactivity threshold */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_INACT, dev->interrupt.thres_inact);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_INACT, dev->interrupt.thres_inact, 0);
     /* Set inactivity time */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TIME_INACT, dev->interrupt.time_inact);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TIME_INACT, dev->interrupt.time_inact, 0);
     /* Set free-fall threshold */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_FF, dev->interrupt.thres_ff);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_THRESH_FF, dev->interrupt.thres_ff, 0);
     /* Set free-fall time */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TIME_FF, dev->interrupt.time_ff);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_TIME_FF, dev->interrupt.time_ff, 0);
     /* Set axis control */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_ACT_INACT_CTL, dev->interrupt.act_inact);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_ACT_INACT_CTL, dev->interrupt.act_inact, 0);
     /* Enable interrupt */
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_INT_ENABLE, dev->interrupt.enable);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_INT_ENABLE, dev->interrupt.enable, 0);

     /* Release the bus */
     i2c_release(BUS);
@@ -144,9 +135,9 @@
     DEBUG("[adxl345] set device to measure mode\n");

     i2c_acquire(BUS);
-    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg);
+    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg, 0);
     reg |= MEASURE_BIT;
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg, 0);
     i2c_release(BUS);
 }

@@ -159,9 +150,9 @@
     DEBUG("[adxl345] set device to standby mode\n");

     i2c_acquire(BUS);
-    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg);
+    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg, 0);
     reg &= ~MEASURE_BIT;
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg, 0);
     i2c_release(BUS);
 }

@@ -174,9 +165,9 @@
     DEBUG("[adxl345] set device to sleep mode\n");

     i2c_acquire(BUS);
-    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg);
+    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg, 0);
     reg |= SLEEP_BIT;
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg, 0);
     i2c_release(BUS);
 }

@@ -189,9 +180,9 @@
     DEBUG("[adxl345] set device to autosleep mode\n");

     i2c_acquire(BUS);
-    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg);
+    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, &reg, 0);
     reg |= AUTOSLEEP_BIT;
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_POWER_CTL, reg, 0);
     i2c_release(BUS);
 }

@@ -204,9 +195,9 @@
     DEBUG("[adxl345] set device rate to %d Hz\n", (int)bw_rate);

     i2c_acquire(BUS);
-    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_BW_RATE, &reg);
+    i2c_read_reg(BUS, ADDR, ACCEL_ADXL345_BW_RATE, &reg, 0);
     reg |= bw_rate;
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_BW_RATE, reg);
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_BW_RATE, reg, 0);
     i2c_release(BUS);
 }

@@ -222,6 +213,6 @@

     i2c_acquire(BUS);
     reg = ((mode << FIFO_MODE_POS) | (output << FIFO_TRIGGER_POS) | value);
-    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_FIFO_CTL, reg);
-    i2c_release(BUS);
-}
+    i2c_write_reg(BUS, ADDR, ACCEL_ADXL345_FIFO_CTL, reg, 0);
+    i2c_release(BUS);
+}


Replace two spaces with one space

Replace two spaces with one space

--- ext/redcarpet/markdown.c
+++ ext/redcarpet/markdown.c
@@ -1118,7 +1118,7 @@
 				title_e--;

 			/* checking for closing quote presence */
-			if (data[title_e] != '\'' &&  data[title_e] != '"') {
+			if (data[title_e] != '\'' && data[title_e] != '"') {
 				title_b = title_e = 0;
 				link_e = i;
 			}
@@ -2866,7 +2866,7 @@

 	if (text->size) {
 		/* adding a final newline if not already present */
-		if (text->data[text->size - 1] != '\n' &&  text->data[text->size - 1] != '\r')
+		if (text->data[text->size - 1] != '\n' && text->data[text->size - 1] != '\r')
 			bufputc(text, '\n');

 		parse_block(ob, md, text->data, text->size);


Append null-terminated string to buffer for markdown render

--- ext/redcarpet/markdown.c
+++ ext/redcarpet/markdown.c
@@ -2879,6 +2879,9 @@
 	if (md->cb.doc_footer)
 		md->cb.doc_footer(ob, md->opaque);

+	/* appends null-terminated string */
+	bufcstr(ob);
+
 	/* clean-up */
 	bufrelease(text);
 	free_link_refs(md->refs);


libata: more NONCQ devices

libata: more NONCQ devices

More for the NCQ blacklist.  One hitachi and one raptor.  Other
members of these families of drives are already on the list, so no
surprises.

Signed-off-by: Tejun Heo <ccfba69985e72fbcd9ba8bbb6db43d42971ad06d@gmail.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/ata/libata-core.c
+++ drivers/ata/libata-core.c
@@ -3802,6 +3802,8 @@
 	{ "HTS541010G9SA00",    "MBZOC60D",     ATA_HORKAGE_NONCQ, },
 	/* Drives which do spurious command completion */
 	{ "HTS541680J9SA00",	"SB2IC7EP",	ATA_HORKAGE_NONCQ, },
+	{ "HTS541612J9SA00",	"SBDIC7JP",	ATA_HORKAGE_NONCQ, },
+	{ "WDC WD740ADFD-00NLR1", NULL,		ATA_HORKAGE_NONCQ, },

 	/* Devices with NCQ limits */


fix(plugin): Fix crash in OpenSSL when loaded with an empty certificate

--- plugins/crypto/openssl/securitypolicy_openssl_common.c
+++ plugins/crypto/openssl/securitypolicy_openssl_common.c
@@ -884,6 +884,8 @@
 UA_OpenSSL_LoadPrivateKey(const UA_ByteString *privateKey) {
     const unsigned char * pkData = privateKey->data;
     long len = (long) privateKey->length;
+    if(len == 0)
+        return NULL;

     EVP_PKEY *result = NULL;


libata: fix kernel-doc param name

libata: fix kernel-doc param name

Fix libata kernel-doc parameter name.

Warning(linux-2.6.23-git13//drivers/ata/libata-core.c:1415): No description found for parameter 'sgl'

Signed-off-by: Randy Dunlap <e1d10faa7e2a0c027bf1ff1d20e7fd10154be7ea@oracle.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/ata/libata-core.c
+++ drivers/ata/libata-core.c
@@ -1392,7 +1392,7 @@
  *	@tf: Taskfile registers for the command and the result
  *	@cdb: CDB for packet command
  *	@dma_dir: Data tranfer direction of the command
- *	@sg: sg list for the data buffer of the command
+ *	@sgl: sg list for the data buffer of the command
  *	@n_elem: Number of sg entries
  *	@timeout: Timeout in msecs (0 for default)
  *


Better temperature restrictions in case an eeprom error occurs

--- src/main/Functions_Revision3.h
+++ src/main/Functions_Revision3.h
@@ -393,6 +393,11 @@
     EEPROM.put(BTEMP_SET_EE, BTempSet);
     BTempSetN.setValue(BTempSet);
     UpdateLogistics();
+  } else {
+    BTempSet = 85;
+//    EEPROM.put(BTEMP_SET_EE, BTempSet);
+    BTempSetN.setValue(BTempSet);
+    UpdateLogistics();
   }
 }

@@ -404,6 +409,11 @@
     EEPROM.put(BTEMP_SET_EE, BTempSet);
     BTempSetN.setValue(BTempSet);
     UpdateLogistics();
+  } else {
+    BTempSet = 65;
+    //EEPROM.put(BTEMP_SET_EE, BTempSet);
+    BTempSetN.setValue(BTempSet);
+    UpdateLogistics();
   }
 }

@@ -413,6 +423,11 @@
   if(BHistSet < 30){
     BHistSet++;
     EEPROM.put(BHIST_SET_EE, BHistSet);
+    BHistSetN.setValue(BHistSet);
+    UpdateLogistics();
+  } else {
+    BHistSet = 30;
+    //EEPROM.put(BHIST_SET_EE, BHistSet);
     BHistSetN.setValue(BHistSet);
     UpdateLogistics();
   }
@@ -425,6 +440,11 @@
     EEPROM.put(BHIST_SET_EE, BHistSet);
     BHistSetN.setValue(BHistSet);
     UpdateLogistics();
+  } else {
+    BHistSet = 2;
+    //EEPROM.put(BHIST_SET_EE, BHistSet);
+    BHistSetN.setValue(BHistSet);
+    UpdateLogistics();
   }
 }
 void buttonHTempUpPushCallBack(void *ptr){
@@ -434,6 +454,11 @@
     EEPROM.put(HTEMP_SET_EE, HTempSet);
     HTempSetN.setValue(HTempSet);
     UpdateLogistics();
+  }else {
+    HTempSet = 40;
+    //EEPROM.put(HTEMP_SET_EE, HTempSet);
+    HTempSetN.setValue(HTempSet);
+    UpdateLogistics();
   }
 }

@@ -444,6 +469,11 @@
     EEPROM.put(HTEMP_SET_EE, HTempSet);
     HTempSetN.setValue(HTempSet);
     UpdateLogistics();
+  }else{
+    HTempSet = 30;
+    //EEPROM.put(HTEMP_SET_EE, HTempSet);
+    HTempSetN.setValue(HTempSet);
+    UpdateLogistics();
   }
 }


pata_it821x: fix section mismatch warning

Fix section mismatch when CONFIG_HOTPLUG=n (but functions are used
for resume):

WARNING: drivers/ata/pata_it821x.o(.text+0x3f): Section mismatch: reference to .init.text: (between 'it821x_reinit_one' and 'it821x_program_udma')
WARNING: drivers/ata/pata_it821x.o(.text+0x691): Section mismatch: reference to .init.text: (between 'it821x_init_one' and 'it821x_passthru_set_dmamode')

Signed-off-by: Randy Dunlap <e1d10faa7e2a0c027bf1ff1d20e7fd10154be7ea@oracle.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/ata/pata_it821x.c
+++ drivers/ata/pata_it821x.c
@@ -690,7 +690,7 @@
 	.port_start	= it821x_port_start,
 };

-static void __devinit it821x_disable_raid(struct pci_dev *pdev)
+static void it821x_disable_raid(struct pci_dev *pdev)
 {
 	/* Reset local CPU, and set BIOS not ready */
 	pci_write_config_byte(pdev, 0x5E, 0x01);


[PATCH] remove blkdev_scsi_issue_flush_fn again

This function was removed a while ago, but crept in again via a recent
scsi merge.

Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/block/ll_rw_blk.c
+++ drivers/block/ll_rw_blk.c
@@ -2373,44 +2373,6 @@

 EXPORT_SYMBOL(blkdev_issue_flush);

-/**
- * blkdev_scsi_issue_flush_fn - issue flush for SCSI devices
- * @q:		device queue
- * @disk:	gendisk
- * @error_sector:	error offset
- *
- * Description:
- *    Devices understanding the SCSI command set, can use this function as
- *    a helper for issuing a cache flush. Note: driver is required to store
- *    the error offset (in case of error flushing) in ->sector of struct
- *    request.
- */
-int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk,
-			       sector_t *error_sector)
-{
-	struct request *rq = blk_get_request(q, WRITE, __GFP_WAIT);
-	int ret;
-
-	rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;
-	rq->sector = 0;
-	memset(rq->cmd, 0, sizeof(rq->cmd));
-	rq->cmd[0] = 0x35;
-	rq->cmd_len = 12;
-	rq->data = NULL;
-	rq->data_len = 0;
-	rq->timeout = 60 * HZ;
-
-	ret = blk_execute_rq(q, disk, rq, 0);
-
-	if (ret && error_sector)
-		*error_sector = rq->sector;
-
-	blk_put_request(rq);
-	return ret;
-}
-
-EXPORT_SYMBOL(blkdev_scsi_issue_flush_fn);
-
 static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
 {
 	int rw = rq_data_dir(rq);


dotprod: cleaning up code somewhat

dotprod: cleaning up code somewhat

--- src/dotprod/src/dotprod.c
+++ src/dotprod/src/dotprod.c
@@ -27,24 +27,44 @@
 #include <string.h>
 #include <stdio.h>

+// portable structured dot product object
 struct DOTPROD(_s) {
     TC * h;             // coefficients array
     unsigned int n;     // length
 };

 // basic dot product
+//  _h      :   coefficients array [size: 1 x _n]
+//  _x      :   input array [size: 1 x _n]
+//  _n      :   input lengths
+//  _y      :   output dot product
+void DOTPROD(_run)(TC *_h,
+                   TI *_x,
+                   unsigned int _n,
+                   TO * _y)
+{
+    // initialize accumulator
+    TO r=0;

-void DOTPROD(_run)(TC *_h, TI *_x, unsigned int _n, TO * _y)
-{
-    TO r=0;
     unsigned int i;
     for (i=0; i<_n; i++)
         r += _h[i] * _x[i];
+
+    // return result
     *_y = r;
 }

-void DOTPROD(_run4)(TC *_h, TI *_x, unsigned int _n, TO * _y)
+// basic dotproduct, unrolling loop
+//  _h      :   coefficients array [size: 1 x _n]
+//  _x      :   input array [size: 1 x _n]
+//  _n      :   input lengths
+//  _y      :   output dot product
+void DOTPROD(_run4)(TC *_h,
+                    TI *_x,
+                    unsigned int _n,
+                    TO * _y)
 {
+    // initialize accumulator
     TO r=0;

     // t = 4*(floor(_n/4))
@@ -63,6 +83,7 @@
     for ( ; i<_n; i++)
         r += _h[i] * _x[i];

+    // return result
     *_y = r;
 }

@@ -70,46 +91,77 @@
 // structured dot product
 //

-DOTPROD() DOTPROD(_create)(TC * _h, unsigned int _n)
+// create structured dot product object
+//  _h      :   coefficients array [size: 1 x _n]
+//  _n      :   dot product length
+DOTPROD() DOTPROD(_create)(TC * _h,
+                           unsigned int _n)
 {
     DOTPROD() q = (DOTPROD()) malloc(sizeof(struct DOTPROD(_s)));
     q->n = _n;
+
+    // allocate memory for coefficients
     q->h = (TC*) malloc((q->n)*sizeof(TC));
+
+    // move coefficients
     memmove(q->h, _h, (q->n)*sizeof(TC));
+
+    // return object
     return q;
 }

+// re-create dot product object
+//  _q      :   old dot dot product object
+//  _h      :   new coefficients [size: 1 x _n]
+//  _n      :   new dot product size
 DOTPROD() DOTPROD(_recreate)(DOTPROD() _q,
                              TC * _h,
                              unsigned int _n)
 {
-    // set new length
-    _q->n = _n;
+    // check to see if length has changed
+    if (_q->n != _n) {
+        // set new length
+        _q->n = _n;

-    // re-allocate memory and move new coefficients
-    _q->h = (TC*) realloc(_q->h, (_q->n)*sizeof(TC));
+        // re-allocate memory
+        _q->h = (TC*) realloc(_q->h, (_q->n)*sizeof(TC));
+    }
+
+    // move new coefficients
     memmove(_q->h, _h, (_q->n)*sizeof(TC));

+    // return re-structured object
     return _q;
 }

+// destroy dot product object
 void DOTPROD(_destroy)(DOTPROD() _q)
 {
-    free(_q->h);
-    free(_q);
+    free(_q->h);    // free coefficients memory
+    free(_q);       // free main object memory
 }

+// print dot product object
 void DOTPROD(_print)(DOTPROD() _q)
 {
     printf("dotprod [%u elements]:\n", _q->n);
     unsigned int i;
     for (i=0; i<_q->n; i++) {
-        printf("  %4u: %12.8f + j*%12.8f\n", i, crealf(_q->h[i]), cimagf(_q->h[i]));
+        printf("  %4u: %12.8f + j*%12.8f\n", i,
+                                             crealf(_q->h[i]),
+                                             cimagf(_q->h[i]));
     }
 }

-void DOTPROD(_execute)(DOTPROD() _q, TI * _x, TO * _y)
+// execute structured dot product
+//  _q      :   dot product object
+//  _x      :   input array [size: 1 x _n]
+//  _y      :   output dot product
+void DOTPROD(_execute)(DOTPROD() _q,
+                       TI * _x,
+                       TO * _y)
 {
+    // run basic dot product with unrolled loops
     DOTPROD(_run4)(_q->h, _x, _q->n, _y);
 }


Colocated board.LED and D13 together (GCM4)

--- ports/atmel-samd/boards/grandcentral_m4_express/pins.c
+++ ports/atmel-samd/boards/grandcentral_m4_express/pins.c
@@ -52,6 +52,8 @@
     { MP_OBJ_NEW_QSTR(MP_QSTR_D10),  MP_ROM_PTR(&pin_PB22) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_D11),  MP_ROM_PTR(&pin_PB23) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_D12),  MP_ROM_PTR(&pin_PB00) },
+
+    { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB01) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB01) },

     { MP_OBJ_NEW_QSTR(MP_QSTR_TX3), MP_ROM_PTR(&pin_PB16) },
@@ -137,7 +139,6 @@

     { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PC24) },

-    { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB01) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PC31) },
     { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PC30) },
     { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },


nvme: fail SCSI read/write command with unsupported protection bit

Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@fb.com>


cpufreq: Allow stop CPU callback to be used by all cpufreq drivers

Commit 367dc4aa932bfb3 ("cpufreq: Add stop CPU callback to
cpufreq_driver interface") introduced the stop CPU callback for
intel_pstate drivers. During the CPU_DOWN_PREPARE stage, this
callback is invoked so that drivers can take some action on the
pstate of the cpu before it is taken offline. This callback was
assumed to be useful only for those drivers which have implemented
the set_policy CPU callback because they have no other way to take
action about the cpufreq of a CPU which is being hotplugged out
except in the exit callback which is called very late in the offline
process.

The drivers which implement the target/target_index callbacks were
expected to take care of requirements like the ones that commit
367dc4aa addresses in the GOV_STOP notification event. But there
are disadvantages to restricting the usage of stop CPU callback
to cpufreq drivers that implement the set_policy callbacks and who
want to take explicit action on the setting the cpufreq during a
hotplug operation.

1.GOV_STOP gets called for every CPU offline and drivers would usually
want to take action when the last cpu in the policy->cpus mask
is taken offline. As long as there is more than one cpu in the
policy->cpus mask, cpufreq core itself makes sure that the freq
for the other cpus in this mask is set according to the maximum load.
This is sensible and drivers which implement the target_index callback
would mostly not want to modify that. However the cpufreq core leaves a
loose end when the cpu in the policy->cpus mask is the last one to go offline;
it does nothing explicit to the frequency of the core. Drivers may need
a way to take some action here and stop CPU callback mechanism is the
best way to do it today.

2. We cannot implement driver specific actions in the GOV_STOP mechanism.
So we will need another driver callback which is invoked from here which is
unnecessary.

Therefore this patch extends the usage of stop CPU callback to be used
by all cpufreq drivers as long as they have this callback implemented
and irrespective of whether they are set_policy/target_index drivers.
The assumption is if the drivers find the GOV_STOP path to be a suitable
way of implementing what they want to do with the freq of the cpu
going offine,they will not implement the stop CPU callback at all.

Signed-off-by: Preeti U Murthy <437f8f4633f3d09bf55bbcfb98d29bc10a99c7d0@linux.vnet.ibm.com>
Acked-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@linaro.org>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>


[CPUFREQ] drivers/cpufreq/cpufreq.c: Adjust error handling code involving cpufreq_cpu_put

After calling cpufreq_cpu_get, error handling code should call
cpufreq_cpu_put.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r@
expression x,E;
statement S;
position p1,p2,p3;
@@

(
if ((x = cpufreq_cpu_get@p1(...)) == NULL || ...) S
|
x = cpufreq_cpu_get@p1(...)
... when != x
if (x == NULL || ...) S
)
<...
if@p3 (...) { ... when != cpufreq_cpu_put(x)
                  when != if (x) { ... cpufreq_cpu_put(x); ...}
    return@p2 ...;
}
...>
(
return x;
|
return 0;
|
x = E
|
E = x
|
cpufreq_cpu_put(x)
)

@exists@
position r.p1,r.p2,r.p3;
expression x;
int ret != 0;
statement S;
@@

* x = cpufreq_cpu_get@p1(...)
  <...
* if@p3 (...)
  S
  ...>
* return@p2 \(NULL\|ret\);
// </smpl>

Signed-off-by: Julia Lawall <b43b0ad1e8108e7ab870d7a54feac93ae8b8600e@diku.dk>
Signed-off-by: Dave Jones <d5ec0d24602845f6f4b6a35ef729998d1fba5507@redhat.com>

--- drivers/cpufreq/cpufreq.c
+++ drivers/cpufreq/cpufreq.c
@@ -1467,20 +1467,22 @@
 			  unsigned int target_freq,
 			  unsigned int relation)
 {
-	int ret;
+	int ret = -EINVAL;

 	policy = cpufreq_cpu_get(policy->cpu);
 	if (!policy)
-		return -EINVAL;
+		goto no_policy;

 	if (unlikely(lock_policy_rwsem_write(policy->cpu)))
-		return -EINVAL;
+		goto fail;

 	ret = __cpufreq_driver_target(policy, target_freq, relation);

 	unlock_policy_rwsem_write(policy->cpu);

+fail:
 	cpufreq_cpu_put(policy);
+no_policy:
 	return ret;
 }
 EXPORT_SYMBOL_GPL(cpufreq_driver_target);
@@ -1717,13 +1719,17 @@
 {
 	struct cpufreq_policy *data = cpufreq_cpu_get(cpu);
 	struct cpufreq_policy policy;
-	int ret = 0;
-
-	if (!data)
-		return -ENODEV;
-
-	if (unlikely(lock_policy_rwsem_write(cpu)))
-		return -EINVAL;
+	int ret;
+
+	if (!data) {
+		ret = -ENODEV;
+		goto no_policy;
+	}
+
+	if (unlikely(lock_policy_rwsem_write(cpu))) {
+		ret = -EINVAL;
+		goto fail;
+	}

 	dprintk("updating policy for CPU %u\n", cpu);
 	memcpy(&policy, data, sizeof(struct cpufreq_policy));
@@ -1750,7 +1756,9 @@

 	unlock_policy_rwsem_write(cpu);

+fail:
 	cpufreq_cpu_put(data);
+no_policy:
 	return ret;
 }
 EXPORT_SYMBOL(cpufreq_update_policy);


[CPUFREQ] Fix stale cpufreq_cpu_governor pointer

Dave,

Attached is an update of my patch against the cpufreq fixes branch.

Before applying the patch I compiled and booted the tree to see if the panic
was still there -- to my surprise it was not.  This is because of the conversion
of cpufreq_cpu_governor to a char[].

While the panic is kaput, the problem of stale data continues and my patch is
still valid.  It is possible to end up with the wrong governor after hotplug
events because CPUFREQ_DEFAULT_GOVERNOR is statically linked to a default,
while the cpu siblings may have had a different governor assigned by a user.

ie) the patch is still needed in order to keep the governors assigned
properly when hotplugging devices

Signed-off-by: Prarit Bhargava <fe4655370dc87a32329d591d6e8472329333dfad@redhat.com>
Signed-off-by: Dave Jones <d5ec0d24602845f6f4b6a35ef729998d1fba5507@redhat.com>

--- drivers/cpufreq/cpufreq.c
+++ drivers/cpufreq/cpufreq.c
@@ -951,10 +951,13 @@
 static int cpufreq_add_dev(struct sys_device *sys_dev)
 {
 	unsigned int cpu = sys_dev->id;
-	int ret = 0;
+	int ret = 0, found = 0;
 	struct cpufreq_policy *policy;
 	unsigned long flags;
 	unsigned int j;
+#ifdef CONFIG_HOTPLUG_CPU
+	int sibling;
+#endif

 	if (cpu_is_offline(cpu))
 		return 0;
@@ -1001,7 +1004,19 @@
 	INIT_WORK(&policy->update, handle_update);

 	/* Set governor before ->init, so that driver could check it */
-	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
+#ifdef CONFIG_HOTPLUG_CPU
+	for_each_online_cpu(sibling) {
+		struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling);
+		if (cp && cp->governor &&
+		    (cpumask_test_cpu(cpu, cp->related_cpus))) {
+			policy->governor = cp->governor;
+			found = 1;
+			break;
+		}
+	}
+#endif
+	if (!found)
+		policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
 	/* call driver. From then on the cpufreq must be able
 	 * to accept all calls to ->verify and ->setpolicy for this CPU
 	 */
@@ -1610,8 +1625,21 @@

 void cpufreq_unregister_governor(struct cpufreq_governor *governor)
 {
+#ifdef CONFIG_HOTPLUG_CPU
+	int cpu;
+#endif
+
 	if (!governor)
 		return;
+
+#ifdef CONFIG_HOTPLUG_CPU
+	for_each_present_cpu(cpu) {
+		if (cpu_online(cpu))
+			continue;
+		if (!strcmp(per_cpu(cpufreq_cpu_governor, cpu), governor->name))
+			strcpy(per_cpu(cpufreq_cpu_governor, cpu), "\0");
+	}
+#endif

 	mutex_lock(&cpufreq_governor_mutex);
 	list_del(&governor->governor_list);


add missing bd_error to breadcrumbs_decoder.h

--- src/breadcrumbs_decoder.h
+++ src/breadcrumbs_decoder.h
@@ -39,6 +39,7 @@
                               uint32_t *dst_freqs,
                               uint32_t dst_size);

+const char *bd_error(const struct breadcrumbs *bd);
 uint32_t bd_num_cookies(const struct breadcrumbs *bd);
 uint32_t bd_num_loglines(const struct breadcrumbs *bd);
 uint32_t bd_num_fields(const struct breadcrumbs *bd);


Fix OSX build

Fix OSX build

--- external/include/miniz.h
+++ external/include/miniz.h
@@ -4297,7 +4297,7 @@
 #define MZ_FFLUSH fflush
 #define MZ_FREOPEN(f, m, s) freopen(f, m, s)
 #define MZ_DELETE_FILE remove
-#elif defined(__GNUC__) && _LARGEFILE64_SOURCE
+#elif defined(__GNUC__) && _LARGEFILE64_SOURCE && !defined(TC_PLATFORM_OSX)
 #ifndef MINIZ_NO_TIME
 #include <utime.h>
 #endif