code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 3 1.01M |
|---|---|---|---|---|---|
<?php
namespace Pantheon\Terminus\UnitTests\Collections;
use League\Container\Container;
use Robo\Config;
use Pantheon\Terminus\Request\Request;
/**
* Class CollectionTestCase
* @package Pantheon\Terminus\UnitTests\Collections
*/
abstract class CollectionTestCase extends \PHPUnit_Framework_TestCase
{
/**
* @var TerminusCollection
*/
protected $collection;
/**
* @var Config
*/
protected $config;
/**
* @var Request
*/
protected $request;
/**
* @var Container
*/
protected $container;
/**
* @return Config
*/
public function getConfig()
{
return $this->config;
}
/**
* @inheritdoc
*/
protected function setUp()
{
$this->config = $this->getMockBuilder(Config::class)
->disableOriginalConstructor()
->getMock();
$this->request = $this->getMockBuilder(Request::class)
->disableOriginalConstructor()
->getMock();
$this->request->method('getConfig')->willReturn($this->getConfig());
$this->container = $this->getMockBuilder(Container::class)
->disableOriginalConstructor()
->getMock();
}
}
| rloos289/PDXwing | vendor/pantheon-systems/terminus/tests/unit_tests/Collections/CollectionTestCase.php | PHP | gpl-2.0 | 1,230 |
<?php
// redirect to client list page
session_write_close();
header("Location: ../../logout.php");
?> | creative2020/jmc | data/global/lang/index.php | PHP | gpl-2.0 | 103 |
/************************************************************************/
/* author: xy */
/* date: 20110918 */
/************************************************************************/
#ifndef __MRU_CACHE_H_256FCF72_8663_41DC_B98A_B822F6007912__
#define __MRU_CACHE_H_256FCF72_8663_41DC_B98A_B822F6007912__
#include <atlcoll.h>
#include <utility>
////////////////////////////////////////////////////////////////////////////////////////////////////
// XyAtlMap: a moded CAtlMap
template< typename K, typename V, class KTraits = CElementTraits< K >, class VTraits = CElementTraits< V > >
class XyAtlMap
{
public:
typedef typename KTraits::INARGTYPE KINARGTYPE;
typedef typename KTraits::OUTARGTYPE KOUTARGTYPE;
typedef typename VTraits::INARGTYPE VINARGTYPE;
typedef typename VTraits::OUTARGTYPE VOUTARGTYPE;
class CPair :
public __POSITION
{
protected:
CPair(/* _In_ */ KINARGTYPE key) :
m_key( key )
{
}
public:
const K m_key;
V m_value;
};
private:
class CNode :
public CPair
{
public:
CNode(
/* _In_ */ KINARGTYPE key,
_In_ UINT nHash) :
CPair( key ),
m_nHash( nHash )
{
}
public:
UINT GetHash() const throw()
{
return( m_nHash );
}
public:
CNode* m_pNext;
UINT m_nHash;
};
public:
XyAtlMap(
_In_ UINT nBins = 17,
_In_ float fOptimalLoad = 0.75f,
_In_ float fLoThreshold = 0.25f,
_In_ float fHiThreshold = 2.25f,
_In_ UINT nBlockSize = 10) throw();
size_t GetCount() const throw();
bool IsEmpty() const throw();
bool Lookup(
/* _In_ */ KINARGTYPE key,
_Out_ VOUTARGTYPE value) const;
const CPair* Lookup(/* _In_ */ KINARGTYPE key) const throw();
CPair* Lookup(/* _In_ */ KINARGTYPE key) throw();
V& operator[](/* _In_ */ KINARGTYPE key) throw(...);
POSITION SetAtIfNotExists(
/* _In_ */ KINARGTYPE key,
/* _In_ */ VINARGTYPE value,
bool *new_item_added);
POSITION SetAt(
/* _In_ */ KINARGTYPE key,
/* _In_ */ VINARGTYPE value);
void SetValueAt(
_In_ POSITION pos,
/* _In_ */ VINARGTYPE value);
bool RemoveKey(/* _In_ */ KINARGTYPE key) throw();
void RemoveAll();
void RemoveAtPos(_In_ POSITION pos) throw();
POSITION GetStartPosition() const throw();
void GetNextAssoc(
_Inout_ POSITION& pos,
_Out_ KOUTARGTYPE key,
_Out_ VOUTARGTYPE value) const;
const CPair* GetNext(_Inout_ POSITION& pos) const throw();
CPair* GetNext(_Inout_ POSITION& pos) throw();
const K& GetNextKey(_Inout_ POSITION& pos) const;
const V& GetNextValue(_Inout_ POSITION& pos) const;
V& GetNextValue(_Inout_ POSITION& pos);
void GetAt(
_In_ POSITION pos,
_Out_ KOUTARGTYPE key,
_Out_ VOUTARGTYPE value) const;
CPair* GetAt(_In_ POSITION pos) throw();
const CPair* GetAt(_In_ POSITION pos) const throw();
const K& GetKeyAt(_In_ POSITION pos) const;
const V& GetValueAt(_In_ POSITION pos) const;
V& GetValueAt(_In_ POSITION pos);
UINT GetHashTableSize() const throw();
bool InitHashTable(
_In_ UINT nBins,
_In_ bool bAllocNow = true);
void EnableAutoRehash() throw();
void DisableAutoRehash() throw();
void Rehash(_In_ UINT nBins = 0);
void SetOptimalLoad(
_In_ float fOptimalLoad,
_In_ float fLoThreshold,
_In_ float fHiThreshold,
_In_ bool bRehashNow = false);
#ifdef _DEBUG
void AssertValid() const;
#endif // _DEBUG
// Implementation
private:
CNode** m_ppBins;
size_t m_nElements;
UINT m_nBins;
float m_fOptimalLoad;
float m_fLoThreshold;
float m_fHiThreshold;
size_t m_nHiRehashThreshold;
size_t m_nLoRehashThreshold;
ULONG m_nLockCount;
UINT m_nBlockSize;
CAtlPlex* m_pBlocks;
CNode* m_pFree;
private:
bool IsLocked() const throw();
UINT PickSize(_In_ size_t nElements) const throw();
CNode* NewNode(
/* _In_ */ KINARGTYPE key,
_In_ UINT iBin,
_In_ UINT nHash);
void FreeNode(_Inout_ CNode* pNode);
void FreePlexes() throw();
CNode* GetNode(
/* _In_ */ KINARGTYPE key,
_Out_ UINT& iBin,
_Out_ UINT& nHash,
_Deref_out_opt_ CNode*& pPrev) const throw();
CNode* CreateNode(
/* _In_ */ KINARGTYPE key,
_In_ UINT iBin,
_In_ UINT nHash) throw(...);
void RemoveNode(
_In_ CNode* pNode,
_In_opt_ CNode* pPrev) throw();
CNode* FindNextNode(_In_ CNode* pNode) const throw();
void UpdateRehashThresholds() throw();
public:
~XyAtlMap() throw();
private:
// Private to prevent use
XyAtlMap(_In_ const XyAtlMap&) throw();
XyAtlMap& operator=(_In_ const XyAtlMap&) throw();
};
template< typename K, typename V, class KTraits, class VTraits >
inline size_t XyAtlMap< K, V, KTraits, VTraits >::GetCount() const throw()
{
return( m_nElements );
}
template< typename K, typename V, class KTraits, class VTraits >
inline bool XyAtlMap< K, V, KTraits, VTraits >::IsEmpty() const throw()
{
return( m_nElements == 0 );
}
template< typename K, typename V, class KTraits, class VTraits >
inline V& XyAtlMap< K, V, KTraits, VTraits >::operator[](/* _In_ */ KINARGTYPE key) throw(...)
{
CNode* pNode;
UINT iBin;
UINT nHash;
CNode* pPrev;
pNode = GetNode( key, iBin, nHash, pPrev );
if( pNode == NULL )
{
pNode = CreateNode( key, iBin, nHash );
}
return( pNode->m_value );
}
template< typename K, typename V, class KTraits, class VTraits >
inline UINT XyAtlMap< K, V, KTraits, VTraits >::GetHashTableSize() const throw()
{
return( m_nBins );
}
template< typename K, typename V, class KTraits, class VTraits >
inline void XyAtlMap< K, V, KTraits, VTraits >::GetAt(
_In_ POSITION pos,
_Out_ KOUTARGTYPE key,
_Out_ VOUTARGTYPE value) const
{
ATLENSURE( pos != NULL );
CNode* pNode = static_cast< CNode* >( pos );
key = pNode->m_key;
value = pNode->m_value;
}
template< typename K, typename V, class KTraits, class VTraits >
inline typename XyAtlMap< K, V, KTraits, VTraits >::CPair* XyAtlMap< K, V, KTraits, VTraits >::GetAt(
_In_ POSITION pos) throw()
{
ATLASSERT( pos != NULL );
return( static_cast< CPair* >( pos ) );
}
template< typename K, typename V, class KTraits, class VTraits >
inline const typename XyAtlMap< K, V, KTraits, VTraits >::CPair* XyAtlMap< K, V, KTraits, VTraits >::GetAt(
_In_ POSITION pos) const throw()
{
ATLASSERT( pos != NULL );
return( static_cast< const CPair* >( pos ) );
}
template< typename K, typename V, class KTraits, class VTraits >
inline const K& XyAtlMap< K, V, KTraits, VTraits >::GetKeyAt(_In_ POSITION pos) const
{
ATLENSURE( pos != NULL );
CNode* pNode = (CNode*)pos;
return( pNode->m_key );
}
template< typename K, typename V, class KTraits, class VTraits >
inline const V& XyAtlMap< K, V, KTraits, VTraits >::GetValueAt(_In_ POSITION pos) const
{
ATLENSURE( pos != NULL );
CNode* pNode = (CNode*)pos;
return( pNode->m_value );
}
template< typename K, typename V, class KTraits, class VTraits >
inline V& XyAtlMap< K, V, KTraits, VTraits >::GetValueAt(_In_ POSITION pos)
{
ATLENSURE( pos != NULL );
CNode* pNode = (CNode*)pos;
return( pNode->m_value );
}
template< typename K, typename V, class KTraits, class VTraits >
inline void XyAtlMap< K, V, KTraits, VTraits >::DisableAutoRehash() throw()
{
m_nLockCount++;
}
template< typename K, typename V, class KTraits, class VTraits >
inline void XyAtlMap< K, V, KTraits, VTraits >::EnableAutoRehash() throw()
{
ATLASSUME( m_nLockCount > 0 );
m_nLockCount--;
}
template< typename K, typename V, class KTraits, class VTraits >
inline bool XyAtlMap< K, V, KTraits, VTraits >::IsLocked() const throw()
{
return( m_nLockCount != 0 );
}
template< typename K, typename V, class KTraits, class VTraits >
UINT XyAtlMap< K, V, KTraits, VTraits >::PickSize(_In_ size_t nElements) const throw()
{
// List of primes such that s_anPrimes[i] is the smallest prime greater than 2^(5+i/3)
static const UINT s_anPrimes[] =
{
17, 23, 29, 37, 41, 53, 67, 83, 103, 131, 163, 211, 257, 331, 409, 521, 647, 821,
1031, 1291, 1627, 2053, 2591, 3251, 4099, 5167, 6521, 8209, 10331,
13007, 16411, 20663, 26017, 32771, 41299, 52021, 65537, 82571, 104033,
131101, 165161, 208067, 262147, 330287, 416147, 524309, 660563,
832291, 1048583, 1321139, 1664543, 2097169, 2642257, 3329023, 4194319,
5284493, 6658049, 8388617, 10568993, 13316089, UINT_MAX
};
size_t nBins = (size_t)(nElements/m_fOptimalLoad);
UINT nBinsEstimate = UINT( UINT_MAX < nBins ? UINT_MAX : nBins );
// Find the smallest prime greater than our estimate
int iPrime = 0;
while( nBinsEstimate > s_anPrimes[iPrime] )
{
iPrime++;
}
if( s_anPrimes[iPrime] == UINT_MAX )
{
return( nBinsEstimate );
}
else
{
return( s_anPrimes[iPrime] );
}
}
template< typename K, typename V, class KTraits, class VTraits >
typename XyAtlMap< K, V, KTraits, VTraits >::CNode* XyAtlMap< K, V, KTraits, VTraits >::CreateNode(
/* _In_ */ KINARGTYPE key,
_In_ UINT iBin,
_In_ UINT nHash) throw(...)
{
CNode* pNode;
if( m_ppBins == NULL )
{
bool bSuccess;
bSuccess = InitHashTable( m_nBins );
if( !bSuccess )
{
AtlThrow( E_OUTOFMEMORY );
}
}
pNode = NewNode( key, iBin, nHash );
return( pNode );
}
template< typename K, typename V, class KTraits, class VTraits >
POSITION XyAtlMap< K, V, KTraits, VTraits >::GetStartPosition() const throw()
{
if( IsEmpty() )
{
return( NULL );
}
for( UINT iBin = 0; iBin < m_nBins; iBin++ )
{
if( m_ppBins[iBin] != NULL )
{
return( POSITION( m_ppBins[iBin] ) );
}
}
ATLASSERT( false );
return( NULL );
}
template< typename K, typename V, class KTraits, class VTraits >
POSITION XyAtlMap<K, V, KTraits, VTraits>::SetAtIfNotExists( /* _In_ */ KINARGTYPE key, /* _In_ */ VINARGTYPE value,
bool *new_item_added)
{
CNode* pNode;
UINT iBin;
UINT nHash;
CNode* pPrev;
if (new_item_added)
{
*new_item_added = false;
}
pNode = GetNode( key, iBin, nHash, pPrev );
if( pNode == NULL )
{
pNode = CreateNode( key, iBin, nHash );
_ATLTRY
{
pNode->m_value = value;
}
_ATLCATCHALL()
{
RemoveAtPos( POSITION( pNode ) );
_ATLRETHROW;
}
if (new_item_added)
{
*new_item_added = true;
}
}
return( POSITION( pNode ) );
}
template< typename K, typename V, class KTraits, class VTraits >
POSITION XyAtlMap< K, V, KTraits, VTraits >::SetAt(
/* _In_ */ KINARGTYPE key,
/* _In_ */ VINARGTYPE value)
{
CNode* pNode;
UINT iBin;
UINT nHash;
CNode* pPrev;
pNode = GetNode( key, iBin, nHash, pPrev );
if( pNode == NULL )
{
pNode = CreateNode( key, iBin, nHash );
_ATLTRY
{
pNode->m_value = value;
}
_ATLCATCHALL()
{
RemoveAtPos( POSITION( pNode ) );
_ATLRETHROW;
}
}
else
{
pNode->m_value = value;
}
return( POSITION( pNode ) );
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::SetValueAt(
_In_ POSITION pos,
/* _In_ */ VINARGTYPE value)
{
ATLASSUME( pos != NULL );
CNode* pNode = static_cast< CNode* >( pos );
pNode->m_value = value;
}
template< typename K, typename V, class KTraits, class VTraits >
XyAtlMap< K, V, KTraits, VTraits >::XyAtlMap(
_In_ UINT nBins,
_In_ float fOptimalLoad,
_In_ float fLoThreshold,
_In_ float fHiThreshold,
_In_ UINT nBlockSize) throw() :
m_ppBins( NULL ),
m_nBins( nBins ),
m_nElements( 0 ),
m_nLockCount( 0 ), // Start unlocked
m_fOptimalLoad( fOptimalLoad ),
m_fLoThreshold( fLoThreshold ),
m_fHiThreshold( fHiThreshold ),
m_nHiRehashThreshold( UINT_MAX ),
m_nLoRehashThreshold( 0 ),
m_pBlocks( NULL ),
m_pFree( NULL ),
m_nBlockSize( nBlockSize )
{
ATLASSERT( nBins > 0 );
ATLASSERT( nBlockSize > 0 );
SetOptimalLoad( fOptimalLoad, fLoThreshold, fHiThreshold, false );
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::SetOptimalLoad(
_In_ float fOptimalLoad,
_In_ float fLoThreshold,
_In_ float fHiThreshold,
_In_ bool bRehashNow)
{
ATLASSERT( fOptimalLoad > 0 );
ATLASSERT( (fLoThreshold >= 0) && (fLoThreshold < fOptimalLoad) );
ATLASSERT( fHiThreshold > fOptimalLoad );
m_fOptimalLoad = fOptimalLoad;
m_fLoThreshold = fLoThreshold;
m_fHiThreshold = fHiThreshold;
UpdateRehashThresholds();
if( bRehashNow && ((m_nElements > m_nHiRehashThreshold) ||
(m_nElements < m_nLoRehashThreshold)) )
{
Rehash( PickSize( m_nElements ) );
}
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::UpdateRehashThresholds() throw()
{
m_nHiRehashThreshold = size_t( m_fHiThreshold*m_nBins );
m_nLoRehashThreshold = size_t( m_fLoThreshold*m_nBins );
if( m_nLoRehashThreshold < 17 )
{
m_nLoRehashThreshold = 0;
}
}
template< typename K, typename V, class KTraits, class VTraits >
bool XyAtlMap< K, V, KTraits, VTraits >::InitHashTable(_In_ UINT nBins, _In_ bool bAllocNow)
{
ATLASSUME( m_nElements == 0 );
ATLASSERT( nBins > 0 );
if( m_ppBins != NULL )
{
delete[] m_ppBins;
m_ppBins = NULL;
}
if( bAllocNow )
{
ATLTRY( m_ppBins = new CNode*[nBins] );
if( m_ppBins == NULL )
{
return false;
}
ATLENSURE( UINT_MAX / sizeof( CNode* ) >= nBins );
memset( m_ppBins, 0, sizeof( CNode* )*nBins );
}
m_nBins = nBins;
UpdateRehashThresholds();
return true;
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::RemoveAll()
{
DisableAutoRehash();
if( m_ppBins != NULL )
{
for( UINT iBin = 0; iBin < m_nBins; iBin++ )
{
CNode* pNext;
pNext = m_ppBins[iBin];
while( pNext != NULL )
{
CNode* pKill;
pKill = pNext;
pNext = pNext->m_pNext;
FreeNode( pKill );
}
}
}
delete[] m_ppBins;
m_ppBins = NULL;
m_nElements = 0;
if( !IsLocked() )
{
InitHashTable( PickSize( m_nElements ), false );
}
FreePlexes();
EnableAutoRehash();
}
template< typename K, typename V, class KTraits, class VTraits >
XyAtlMap< K, V, KTraits, VTraits >::~XyAtlMap() throw()
{
_ATLTRY
{
RemoveAll();
}
_ATLCATCHALL()
{
ATLASSERT(false);
}
}
#pragma push_macro("new")
#undef new
template< typename K, typename V, class KTraits, class VTraits >
typename XyAtlMap< K, V, KTraits, VTraits >::CNode* XyAtlMap< K, V, KTraits, VTraits >::NewNode(
/* _In_ */ KINARGTYPE key,
_In_ UINT iBin,
_In_ UINT nHash)
{
CNode* pNewNode;
if( m_pFree == NULL )
{
CAtlPlex* pPlex;
CNode* pNode;
pPlex = CAtlPlex::Create( m_pBlocks, m_nBlockSize, sizeof( CNode ) );
if( pPlex == NULL )
{
AtlThrow( E_OUTOFMEMORY );
}
pNode = (CNode*)pPlex->data();
pNode += m_nBlockSize-1;
for( int iBlock = m_nBlockSize-1; iBlock >= 0; iBlock-- )
{
pNode->m_pNext = m_pFree;
m_pFree = pNode;
pNode--;
}
}
ATLENSURE(m_pFree != NULL );
pNewNode = m_pFree;
m_pFree = pNewNode->m_pNext;
_ATLTRY
{
::new( pNewNode ) CNode( key, nHash );
}
_ATLCATCHALL()
{
pNewNode->m_pNext = m_pFree;
m_pFree = pNewNode;
_ATLRETHROW;
}
m_nElements++;
pNewNode->m_pNext = m_ppBins[iBin];
m_ppBins[iBin] = pNewNode;
if( (m_nElements > m_nHiRehashThreshold) && !IsLocked() )
{
Rehash( PickSize( m_nElements ) );
}
return( pNewNode );
}
#pragma pop_macro("new")
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::FreeNode(_Inout_ CNode* pNode)
{
ATLENSURE( pNode != NULL );
pNode->~CNode();
pNode->m_pNext = m_pFree;
m_pFree = pNode;
ATLASSUME( m_nElements > 0 );
m_nElements--;
if( (m_nElements < m_nLoRehashThreshold) && !IsLocked() )
{
Rehash( PickSize( m_nElements ) );
}
if( m_nElements == 0 )
{
FreePlexes();
}
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::FreePlexes() throw()
{
m_pFree = NULL;
if( m_pBlocks != NULL )
{
m_pBlocks->FreeDataChain();
m_pBlocks = NULL;
}
}
template< typename K, typename V, class KTraits, class VTraits >
typename XyAtlMap< K, V, KTraits, VTraits >::CNode* XyAtlMap< K, V, KTraits, VTraits >::GetNode(
/* _In_ */ KINARGTYPE key,
_Out_ UINT& iBin,
_Out_ UINT& nHash,
_Deref_out_opt_ CNode*& pPrev) const throw()
{
CNode* pFollow;
nHash = KTraits::Hash( key );
iBin = nHash%m_nBins;
if( m_ppBins == NULL )
{
return( NULL );
}
pFollow = NULL;
pPrev = NULL;
for( CNode* pNode = m_ppBins[iBin]; pNode != NULL; pNode = pNode->m_pNext )
{
if( (pNode->GetHash() == nHash) && KTraits::CompareElements( pNode->m_key, key ) )
{
pPrev = pFollow;
return( pNode );
}
pFollow = pNode;
}
return( NULL );
}
template< typename K, typename V, class KTraits, class VTraits >
bool XyAtlMap< K, V, KTraits, VTraits >::Lookup(
/* _In_ */ KINARGTYPE key,
_Out_ VOUTARGTYPE value) const
{
UINT iBin;
UINT nHash;
CNode* pNode;
CNode* pPrev;
pNode = GetNode( key, iBin, nHash, pPrev );
if( pNode == NULL )
{
return( false );
}
value = pNode->m_value;
return( true );
}
template< typename K, typename V, class KTraits, class VTraits >
const typename XyAtlMap< K, V, KTraits, VTraits >::CPair* XyAtlMap< K, V, KTraits, VTraits >::Lookup(
/* _In_ */ KINARGTYPE key) const throw()
{
UINT iBin;
UINT nHash;
CNode* pNode;
CNode* pPrev;
pNode = GetNode( key, iBin, nHash, pPrev );
return( pNode );
}
template< typename K, typename V, class KTraits, class VTraits >
typename XyAtlMap< K, V, KTraits, VTraits >::CPair* XyAtlMap< K, V, KTraits, VTraits >::Lookup(
/* _In_ */ KINARGTYPE key) throw()
{
UINT iBin;
UINT nHash;
CNode* pNode;
CNode* pPrev;
pNode = GetNode( key, iBin, nHash, pPrev );
return( pNode );
}
template< typename K, typename V, class KTraits, class VTraits >
bool XyAtlMap< K, V, KTraits, VTraits >::RemoveKey(/* _In_ */ KINARGTYPE key) throw()
{
CNode* pNode;
UINT iBin;
UINT nHash;
CNode* pPrev;
pPrev = NULL;
pNode = GetNode( key, iBin, nHash, pPrev );
if( pNode == NULL )
{
return( false );
}
RemoveNode( pNode, pPrev );
return( true );
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::RemoveNode(
_In_ CNode* pNode,
_In_opt_ CNode* pPrev)
{
ATLENSURE( pNode != NULL );
UINT iBin = pNode->GetHash() % m_nBins;
if( pPrev == NULL )
{
ATLASSUME( m_ppBins[iBin] == pNode );
m_ppBins[iBin] = pNode->m_pNext;
}
else
{
ATLASSERT( pPrev->m_pNext == pNode );
pPrev->m_pNext = pNode->m_pNext;
}
FreeNode( pNode );
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::RemoveAtPos(_In_ POSITION pos)
{
ATLENSURE( pos != NULL );
CNode* pNode = static_cast< CNode* >( pos );
CNode* pPrev = NULL;
UINT iBin = pNode->GetHash() % m_nBins;
ATLASSUME( m_ppBins[iBin] != NULL );
if( pNode == m_ppBins[iBin] )
{
pPrev = NULL;
}
else
{
pPrev = m_ppBins[iBin];
while( pPrev->m_pNext != pNode )
{
pPrev = pPrev->m_pNext;
ATLASSERT( pPrev != NULL );
}
}
RemoveNode( pNode, pPrev );
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::Rehash(_In_ UINT nBins)
{
CNode** ppBins = NULL;
if( nBins == 0 )
{
nBins = PickSize( m_nElements );
}
if( nBins == m_nBins )
{
return;
}
ATLTRACE(atlTraceMap, 2, _T("Rehash: %u bins\n"), nBins );
if( m_ppBins == NULL )
{
// Just set the new number of bins
InitHashTable( nBins, false );
return;
}
ATLTRY(ppBins = new CNode*[nBins]);
if (ppBins == NULL)
{
AtlThrow( E_OUTOFMEMORY );
}
ATLENSURE( UINT_MAX / sizeof( CNode* ) >= nBins );
memset( ppBins, 0, nBins*sizeof( CNode* ) );
// Nothing gets copied. We just rewire the old nodes
// into the new bins.
for( UINT iSrcBin = 0; iSrcBin < m_nBins; iSrcBin++ )
{
CNode* pNode;
pNode = m_ppBins[iSrcBin];
while( pNode != NULL )
{
CNode* pNext;
UINT iDestBin;
pNext = pNode->m_pNext; // Save so we don't trash it
iDestBin = pNode->GetHash()%nBins;
pNode->m_pNext = ppBins[iDestBin];
ppBins[iDestBin] = pNode;
pNode = pNext;
}
}
delete[] m_ppBins;
m_ppBins = ppBins;
m_nBins = nBins;
UpdateRehashThresholds();
}
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::GetNextAssoc(
_Inout_ POSITION& pos,
_Out_ KOUTARGTYPE key,
_Out_ VOUTARGTYPE value) const
{
CNode* pNode;
CNode* pNext;
ATLASSUME( m_ppBins != NULL );
ATLENSURE( pos != NULL );
pNode = (CNode*)pos;
pNext = FindNextNode( pNode );
pos = POSITION( pNext );
key = pNode->m_key;
value = pNode->m_value;
}
template< typename K, typename V, class KTraits, class VTraits >
const typename XyAtlMap< K, V, KTraits, VTraits >::CPair* XyAtlMap< K, V, KTraits, VTraits >::GetNext(
_Inout_ POSITION& pos) const throw()
{
CNode* pNode;
CNode* pNext;
ATLASSUME( m_ppBins != NULL );
ATLASSERT( pos != NULL );
pNode = (CNode*)pos;
pNext = FindNextNode( pNode );
pos = POSITION( pNext );
return( pNode );
}
template< typename K, typename V, class KTraits, class VTraits >
typename XyAtlMap< K, V, KTraits, VTraits >::CPair* XyAtlMap< K, V, KTraits, VTraits >::GetNext(
_Inout_ POSITION& pos) throw()
{
ATLASSUME( m_ppBins != NULL );
ATLASSERT( pos != NULL );
CNode* pNode = static_cast< CNode* >( pos );
CNode* pNext = FindNextNode( pNode );
pos = POSITION( pNext );
return( pNode );
}
template< typename K, typename V, class KTraits, class VTraits >
const K& XyAtlMap< K, V, KTraits, VTraits >::GetNextKey(
_Inout_ POSITION& pos) const
{
CNode* pNode;
CNode* pNext;
ATLASSUME( m_ppBins != NULL );
ATLENSURE( pos != NULL );
pNode = (CNode*)pos;
pNext = FindNextNode( pNode );
pos = POSITION( pNext );
return( pNode->m_key );
}
template< typename K, typename V, class KTraits, class VTraits >
const V& XyAtlMap< K, V, KTraits, VTraits >::GetNextValue(
_Inout_ POSITION& pos) const
{
CNode* pNode;
CNode* pNext;
ATLASSUME( m_ppBins != NULL );
ATLENSURE( pos != NULL );
pNode = (CNode*)pos;
pNext = FindNextNode( pNode );
pos = POSITION( pNext );
return( pNode->m_value );
}
template< typename K, typename V, class KTraits, class VTraits >
V& XyAtlMap< K, V, KTraits, VTraits >::GetNextValue(
_Inout_ POSITION& pos)
{
CNode* pNode;
CNode* pNext;
ATLASSUME( m_ppBins != NULL );
ATLENSURE( pos != NULL );
pNode = (CNode*)pos;
pNext = FindNextNode( pNode );
pos = POSITION( pNext );
return( pNode->m_value );
}
template< typename K, typename V, class KTraits, class VTraits >
typename XyAtlMap< K, V, KTraits, VTraits >::CNode* XyAtlMap< K, V, KTraits, VTraits >::FindNextNode(
_In_ CNode* pNode) const throw()
{
CNode* pNext;
if(pNode == NULL)
{
ATLASSERT(FALSE);
return NULL;
}
if( pNode->m_pNext != NULL )
{
pNext = pNode->m_pNext;
}
else
{
UINT iBin;
pNext = NULL;
iBin = (pNode->GetHash()%m_nBins)+1;
while( (pNext == NULL) && (iBin < m_nBins) )
{
if( m_ppBins[iBin] != NULL )
{
pNext = m_ppBins[iBin];
}
iBin++;
}
}
return( pNext );
}
#ifdef _DEBUG
template< typename K, typename V, class KTraits, class VTraits >
void XyAtlMap< K, V, KTraits, VTraits >::AssertValid() const
{
ATLASSUME( m_nBins > 0 );
// non-empty map should have hash table
ATLASSERT( IsEmpty() || (m_ppBins != NULL) );
}
#endif
#pragma push_macro("new")
#undef new
////////////////////////////////////////////////////////////////////////////////////////////////////
template<
typename K,
typename V,
class KTraits = CElementTraits< K >
>
class XyMru
{
public:
XyMru(std::size_t max_item_num):_max_item_num(max_item_num){}
inline POSITION UpdateCache(POSITION pos)
{
_list.MoveToHead(pos);
return pos;
}
inline POSITION UpdateCache(POSITION pos, const V& value)
{
_list.GetAt(pos).second = value;
_list.MoveToHead(pos);
return pos;
}
inline POSITION UpdateCache(const K& key, const V& value)
{
POSITION pos;
POSITION pos_hash_value = NULL;
bool new_item_added = false;
pos = _hash.SetAtIfNotExists(key, (POSITION)NULL, &new_item_added);
if (new_item_added)
{
pos_hash_value = _list.AddHead( ListItem(pos, value) );
_hash.SetValueAt(pos, pos_hash_value);
}
else
{
pos_hash_value = _hash.GetValueAt(pos);
_list.GetAt(pos_hash_value).second = value;
_list.MoveToHead(pos_hash_value);
}
if(_list.GetCount()>_max_item_num)
{
_hash.RemoveAtPos(_list.GetTail().first);
_list.RemoveTail();
}
return pos_hash_value;
}
inline POSITION AddHeadIfNotExists(const K& key, const V& value, bool *new_item_added)
{
POSITION pos;
POSITION pos_hash_value = NULL;
bool new_hash_item_added = false;
pos = _hash.SetAtIfNotExists(key, (POSITION)NULL, &new_hash_item_added);
if (new_hash_item_added)
{
pos_hash_value = _list.AddHead( ListItem(pos, value) );
_hash.SetValueAt(pos, pos_hash_value);
if (new_item_added)
{
*new_item_added = true;
}
}
else
{
pos_hash_value = _hash.GetValueAt(pos);
if (new_item_added)
{
*new_item_added = false;
}
}
if(_list.GetCount()>_max_item_num)
{
_hash.RemoveAtPos(_list.GetTail().first);
_list.RemoveTail();
}
return pos_hash_value;
}
inline void RemoveAll()
{
_hash.RemoveAll();
_list.RemoveAll();
}
inline void RemoveTail()
{
if (!_list.IsEmpty()) {
_hash.RemoveAtPos(_list.GetTail().first);
_list.RemoveTail();
}
}
inline POSITION Lookup(const K& key) const
{
POSITION pos;
if( _hash.Lookup(key,pos) )
{
return pos;
}
else
{
return NULL;
}
}
inline V& GetAt(POSITION pos)
{
return _list.GetAt(pos).second;
}
inline const V& GetAt(POSITION pos) const
{
return _list.GetAt(pos).second;
}
inline const K& GetKeyAt(POSITION pos) const
{
return _hash.GetKeyAt(_list.GetAt(pos).first);
}
inline std::size_t SetMaxItemNum( std::size_t max_item_num )
{
_max_item_num = max_item_num;
while(_list.GetCount()>_max_item_num)
{
_hash.RemoveAtPos(_list.GetTail().first);
_list.RemoveTail();
}
return _max_item_num;
}
inline std::size_t GetMaxItemNum() const { return _max_item_num; }
inline std::size_t GetCurItemNum() const { return _list.GetCount(); }
protected:
typedef std::pair<POSITION,V> ListItem;
CAtlList<ListItem> _list;
XyAtlMap<K,POSITION,KTraits> _hash;
std::size_t _max_item_num;
};
template<
typename K,
typename V,
class KTraits = CElementTraits< K >
>
class EnhancedXyMru:public XyMru<K,V,KTraits>
{
public:
EnhancedXyMru(std::size_t max_item_num):XyMru(max_item_num),_cache_hit(0),_query_count(0){}
std::size_t SetMaxItemNum( std::size_t max_item_num, bool clear_statistic_info=false )
{
if(clear_statistic_info)
{
_cache_hit = 0;
_query_count = 0;
}
return __super::SetMaxItemNum(max_item_num);
}
void RemoveAll(bool clear_statistic_info=false)
{
if(clear_statistic_info)
{
_cache_hit=0;
_query_count=0;
}
__super::RemoveAll();
}
inline POSITION Lookup(const K& key)
{
_query_count++;
POSITION pos = __super::Lookup(key);
_cache_hit += (pos!=NULL);
return pos;
}
inline POSITION AddHeadIfNotExists(const K& key, const V& value, bool *new_item_added)
{
_query_count++;
bool tmp = false;
POSITION pos = __super::AddHeadIfNotExists(key, value, &tmp);
_cache_hit += (tmp==false);
if(new_item_added)
*new_item_added = tmp;
return pos;
}
inline std::size_t GetCacheHitCount() const { return _cache_hit; }
inline std::size_t GetQueryCount() const { return _query_count; }
protected:
std::size_t _cache_hit;
std::size_t _query_count;
};
template<typename K, typename V, class KTraits = CElementTraits<K>, class VTraits = CElementTraits<V>>
class CTagCache : private CAtlMap<K, POSITION, KTraits>
{
private:
size_t m_maxSize;
struct CPositionValue {
POSITION pos;
V value;
};
CAtlList<CPositionValue> m_list;
public:
CTagCache(size_t maxSize) : m_maxSize(maxSize) {};
bool Lookup(KINARGTYPE key, _Out_ typename VTraits::OUTARGTYPE value) {
POSITION pos;
bool bFound = __super::Lookup(key, pos);
if (bFound) {
m_list.MoveToHead(pos);
value = m_list.GetHead().value;
}
return bFound;
};
POSITION SetAt(KINARGTYPE key, typename VTraits::INARGTYPE value) {
POSITION pos;
bool bFound = __super::Lookup(key, pos);
if (bFound) {
m_list.MoveToHead(pos);
CPositionValue& posVal = m_list.GetHead();
pos = posVal.pos;
posVal.value = value;
} else {
if (m_list.GetCount() >= m_maxSize) {
__super::RemoveAtPos(m_list.GetTail().pos);
m_list.RemoveTailNoReturn();
}
pos = __super::SetAt(key, m_list.AddHead());
CPositionValue& posVal = m_list.GetHead();
posVal.pos = pos;
posVal.value = value;
}
return pos;
};
void Clear() {
m_list.RemoveAll();
__super::RemoveAll();
}
};
template <class Key>
class CKeyTraits : public CElementTraits<Key>
{
public:
static ULONG Hash(_In_ const Key& element) {
return element.GetHash();
};
static bool CompareElements(_In_ const Key& element1, _In_ const Key& element2) {
return (element1 == element2);
};
};
#endif // end of __MRU_CACHE_H_256FCF72_8663_41DC_B98A_B822F6007912__
| Cyberbeing/xy-VSFilter | src/subtitles/mru_cache.h | C | gpl-2.0 | 34,049 |
#include "includes.h"
#include "hardware.h"
#include "card.h"
board *adapter[MAX_CARDS];
int cinst;
static char devname[] = "scX";
const char version[] = "2.0b1";
const char *boardname[] = { "DataCommute/BRI", "DataCommute/PRI", "TeleCommute/BRI" };
/* insmod set parameters */
static unsigned int io[] = {0,0,0,0};
static unsigned char irq[] = {0,0,0,0};
static unsigned long ram[] = {0,0,0,0};
static int do_reset = 0;
static int sup_irq[] = { 11, 10, 9, 5, 12, 14, 7, 3, 4, 6 };
#define MAX_IRQS 10
extern void interrupt_handler(int, void *, struct pt_regs *);
extern int sndpkt(int, int, int, struct sk_buff *);
extern int command(isdn_ctrl *);
extern int indicate_status(int, int, ulong, char*);
extern int reset(int);
int identify_board(unsigned long, unsigned int);
int irq_supported(int irq_x)
{
int i;
for(i=0 ; i < MAX_IRQS ; i++) {
if(sup_irq[i] == irq_x)
return 1;
}
return 0;
}
#ifdef MODULE
MODULE_PARM(io, "1-4i");
MODULE_PARM(irq, "1-4i");
MODULE_PARM(ram, "1-4i");
MODULE_PARM(do_reset, "i");
#define init_sc init_module
#else
/*
Initialization code for non-module version to be included
void sc_setup(char *str, int *ints)
{
}
*/
#endif
int init_sc(void)
{
int b = -1;
int i, j;
int status = -ENODEV;
unsigned long memsize = 0;
unsigned long features = 0;
isdn_if *interface;
unsigned char channels;
unsigned char pgport;
unsigned long magic;
int model;
int last_base = IOBASE_MIN;
int probe_exhasted = 0;
#ifdef MODULE
pr_info("SpellCaster ISA ISDN Adapter Driver rev. %s Loaded\n", version);
#else
pr_info("SpellCaster ISA ISDN Adapter Driver rev. %s\n", version);
#endif
pr_info("Copyright (C) 1996 SpellCaster Telecommunications Inc.\n");
while(b++ < MAX_CARDS - 1) {
pr_debug("Probing for adapter #%d\n", b);
/*
* Initialize reusable variables
*/
model = -1;
magic = 0;
channels = 0;
pgport = 0;
/*
* See if we should probe for IO base
*/
pr_debug("I/O Base for board %d is 0x%x, %s probe\n", b, io[b],
io[b] == 0 ? "will" : "won't");
if(io[b]) {
/*
* No, I/O Base has been provided
*/
for (i = 0 ; i < MAX_IO_REGS - 1 ; i++) {
if(check_region(io[b] + i * 0x400, 1)) {
pr_debug("check_region for 0x%x failed\n", io[b] + i * 0x400);
io[b] = 0;
break;
}
}
/*
* Confirm the I/O Address with a test
*/
if(io[b] == 0) {
pr_debug("I/O Address 0x%x is in use.\n");
continue;
}
outb(0x18, io[b] + 0x400 * EXP_PAGE0);
if(inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) {
pr_debug("I/O Base 0x%x fails test\n");
continue;
}
}
else {
/*
* Yes, probe for I/O Base
*/
if(probe_exhasted) {
pr_debug("All probe addresses exhasted, skipping\n");
continue;
}
pr_debug("Probing for I/O...\n");
for (i = last_base ; i <= IOBASE_MAX ; i += IOBASE_OFFSET) {
int found_io = 1;
if (i == IOBASE_MAX) {
probe_exhasted = 1; /* No more addresses to probe */
pr_debug("End of Probes\n");
}
last_base = i + IOBASE_OFFSET;
pr_debug(" checking 0x%x...", i);
for ( j = 0 ; j < MAX_IO_REGS - 1 ; j++) {
if(check_region(i + j * 0x400, 1)) {
pr_debug("Failed\n");
found_io = 0;
break;
}
}
if(found_io) {
io[b] = i;
outb(0x18, io[b] + 0x400 * EXP_PAGE0);
if(inb(io[b] + 0x400 * EXP_PAGE0) != 0x18) {
pr_debug("Failed by test\n");
continue;
}
pr_debug("Passed\n");
break;
}
}
if(probe_exhasted) {
continue;
}
}
/*
* See if we should probe for shared RAM
*/
if(do_reset) {
pr_debug("Doing a SAFE probe reset\n");
outb(0xFF, io[b] + RESET_OFFSET);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(milliseconds(10000));
}
pr_debug("RAM Base for board %d is 0x%x, %s probe\n", b, ram[b],
ram[b] == 0 ? "will" : "won't");
if(ram[b]) {
/*
* No, the RAM base has been provided
* Just look for a signature and ID the
* board model
*/
if(!check_region(ram[b], SRAM_PAGESIZE)) {
pr_debug("check_region for RAM base 0x%x succeeded\n", ram[b]);
model = identify_board(ram[b], io[b]);
}
}
else {
/*
* Yes, probe for free RAM and look for
* a signature and id the board model
*/
for (i = SRAM_MIN ; i < SRAM_MAX ; i += SRAM_PAGESIZE) {
pr_debug("Checking RAM address 0x%x...\n", i);
if(!check_region(i, SRAM_PAGESIZE)) {
pr_debug(" check_region succeeded\n");
model = identify_board(i, io[b]);
if (model >= 0) {
pr_debug(" Identified a %s\n",
boardname[model]);
ram[b] = i;
break;
}
pr_debug(" Unidentifed or inaccessible\n");
continue;
}
pr_debug(" check_region failed\n");
}
}
/*
* See if we found free RAM and the board model
*/
if(!ram[b] || model < 0) {
/*
* Nope, there was no place in RAM for the
* board, or it couldn't be identified
*/
pr_debug("Failed to find an adapter at 0x%x\n", ram[b]);
continue;
}
/*
* Set the board's magic number, memory size and page register
*/
switch(model) {
case PRI_BOARD:
channels = 23;
magic = 0x20000;
memsize = 0x100000;
features = PRI_FEATURES;
break;
case BRI_BOARD:
case POTS_BOARD:
channels = 2;
magic = 0x60000;
memsize = 0x10000;
features = BRI_FEATURES;
break;
}
switch(ram[b] >> 12 & 0x0F) {
case 0x0:
pr_debug("RAM Page register set to EXP_PAGE0\n");
pgport = EXP_PAGE0;
break;
case 0x4:
pr_debug("RAM Page register set to EXP_PAGE1\n");
pgport = EXP_PAGE1;
break;
case 0x8:
pr_debug("RAM Page register set to EXP_PAGE2\n");
pgport = EXP_PAGE2;
break;
case 0xC:
pr_debug("RAM Page register set to EXP_PAGE3\n");
pgport = EXP_PAGE3;
break;
default:
pr_debug("RAM base address doesn't fall on 16K boundary\n");
continue;
}
pr_debug("current IRQ: %d b: %d\n",irq[b],b);
/*
* See if we should probe for an irq
*/
if(irq[b]) {
/*
* No we were given one
* See that it is supported and free
*/
pr_debug("Trying for IRQ: %d\n",irq[b]);
if (irq_supported(irq[b])) {
if(REQUEST_IRQ(irq[b], interrupt_handler,
SA_PROBE, "sc_probe", NULL)) {
pr_debug("IRQ %d is already in use\n",
irq[b]);
continue;
}
FREE_IRQ(irq[b], NULL);
}
}
else {
/*
* Yes, we need to probe for an IRQ
*/
pr_debug("Probing for IRQ...\n");
for (i = 0; i < MAX_IRQS ; i++) {
if(!REQUEST_IRQ(sup_irq[i], interrupt_handler, SA_PROBE, "sc_probe", NULL)) {
pr_debug("Probed for and found IRQ %d\n", sup_irq[i]);
FREE_IRQ(sup_irq[i], NULL);
irq[b] = sup_irq[i];
break;
}
}
}
/*
* Make sure we got an IRQ
*/
if(!irq[b]) {
/*
* No interrupt could be used
*/
pr_debug("Failed to aquire an IRQ line\n");
continue;
}
/*
* Horray! We found a board, Make sure we can register
* it with ISDN4Linux
*/
interface = kmalloc(sizeof(isdn_if), GFP_KERNEL);
if (interface == NULL) {
/*
* Oops, can't malloc isdn_if
*/
continue;
}
memset(interface, 0, sizeof(isdn_if));
interface->hl_hdrlen = 0;
interface->channels = channels;
interface->maxbufsize = BUFFER_SIZE;
interface->features = features;
interface->writebuf_skb = sndpkt;
interface->writecmd = NULL;
interface->command = command;
strcpy(interface->id, devname);
interface->id[2] = '0' + cinst;
/*
* Allocate the board structure
*/
adapter[cinst] = kmalloc(sizeof(board), GFP_KERNEL);
if (adapter[cinst] == NULL) {
/*
* Oops, can't alloc memory for the board
*/
kfree(interface);
continue;
}
memset(adapter[cinst], 0, sizeof(board));
if(!register_isdn(interface)) {
/*
* Oops, couldn't register for some reason
*/
kfree(interface);
kfree(adapter[cinst]);
continue;
}
adapter[cinst]->card = interface;
adapter[cinst]->driverId = interface->channels;
strcpy(adapter[cinst]->devicename, interface->id);
adapter[cinst]->nChannels = channels;
adapter[cinst]->ramsize = memsize;
adapter[cinst]->shmem_magic = magic;
adapter[cinst]->shmem_pgport = pgport;
adapter[cinst]->StartOnReset = 1;
/*
* Allocate channels status structures
*/
adapter[cinst]->channel = kmalloc(sizeof(bchan) * channels, GFP_KERNEL);
if (adapter[cinst]->channel == NULL) {
/*
* Oops, can't alloc memory for the channels
*/
indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */
kfree(interface);
kfree(adapter[cinst]);
continue;
}
memset(adapter[cinst]->channel, 0, sizeof(bchan) * channels);
/*
* Lock down the hardware resources
*/
adapter[cinst]->interrupt = irq[b];
REQUEST_IRQ(adapter[cinst]->interrupt, interrupt_handler, SA_INTERRUPT,
interface->id, NULL);
adapter[cinst]->iobase = io[b];
for(i = 0 ; i < MAX_IO_REGS - 1 ; i++) {
adapter[cinst]->ioport[i] = io[b] + i * 0x400;
request_region(adapter[cinst]->ioport[i], 1, interface->id);
pr_debug("Requesting I/O Port %#x\n", adapter[cinst]->ioport[i]);
}
adapter[cinst]->ioport[IRQ_SELECT] = io[b] + 0x2;
request_region(adapter[cinst]->ioport[IRQ_SELECT], 1, interface->id);
pr_debug("Requesting I/O Port %#x\n", adapter[cinst]->ioport[IRQ_SELECT]);
adapter[cinst]->rambase = ram[b];
request_region(adapter[cinst]->rambase, SRAM_PAGESIZE, interface->id);
pr_info(" %s (%d) - %s %d channels IRQ %d, I/O Base 0x%x, RAM Base 0x%lx\n",
adapter[cinst]->devicename, adapter[cinst]->driverId,
boardname[model], channels, irq[b], io[b], ram[b]);
/*
* reset the adapter to put things in motion
*/
reset(cinst);
cinst++;
status = 0;
}
if (status)
pr_info("Failed to find any adapters, driver unloaded\n");
return status;
}
#ifdef MODULE
void cleanup_module(void)
{
int i, j;
for(i = 0 ; i < cinst ; i++) {
pr_debug("Cleaning up after adapter %d\n", i);
/*
* kill the timers
*/
del_timer(&(adapter[i]->reset_timer));
del_timer(&(adapter[i]->stat_timer));
/*
* Tell I4L we're toast
*/
indicate_status(i, ISDN_STAT_STOP, 0, NULL);
indicate_status(i, ISDN_STAT_UNLOAD, 0, NULL);
/*
* Release shared RAM
*/
release_region(adapter[i]->rambase, SRAM_PAGESIZE);
/*
* Release the IRQ
*/
FREE_IRQ(adapter[i]->interrupt, NULL);
/*
* Reset for a clean start
*/
outb(0xFF, adapter[i]->ioport[SFT_RESET]);
/*
* Release the I/O Port regions
*/
for(j = 0 ; j < MAX_IO_REGS - 1; j++) {
release_region(adapter[i]->ioport[j], 1);
pr_debug("Releasing I/O Port %#x\n", adapter[i]->ioport[j]);
}
release_region(adapter[i]->ioport[IRQ_SELECT], 1);
pr_debug("Releasing I/O Port %#x\n", adapter[i]->ioport[IRQ_SELECT]);
/*
* Release any memory we alloced
*/
kfree(adapter[i]->channel);
kfree(adapter[i]->card);
kfree(adapter[i]);
}
pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n");
}
#endif
int identify_board(unsigned long rambase, unsigned int iobase)
{
unsigned int pgport;
unsigned long sig;
DualPortMemory *dpm;
RspMessage rcvmsg;
ReqMessage sndmsg;
HWConfig_pl hwci;
int x;
pr_debug("Attempting to identify adapter @ 0x%x io 0x%x\n",
rambase, iobase);
/*
* Enable the base pointer
*/
outb(rambase >> 12, iobase + 0x2c00);
switch(rambase >> 12 & 0x0F) {
case 0x0:
pgport = iobase + PG0_OFFSET;
pr_debug("Page Register offset is 0x%x\n", PG0_OFFSET);
break;
case 0x4:
pgport = iobase + PG1_OFFSET;
pr_debug("Page Register offset is 0x%x\n", PG1_OFFSET);
break;
case 0x8:
pgport = iobase + PG2_OFFSET;
pr_debug("Page Register offset is 0x%x\n", PG2_OFFSET);
break;
case 0xC:
pgport = iobase + PG3_OFFSET;
pr_debug("Page Register offset is 0x%x\n", PG3_OFFSET);
break;
default:
pr_debug("Invalid rambase 0x%lx\n", rambase);
return -1;
}
/*
* Try to identify a PRI card
*/
outb(PRI_BASEPG_VAL, pgport);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(HZ);
sig = readl(rambase + SIG_OFFSET);
pr_debug("Looking for a signature, got 0x%x\n", sig);
#if 0
/*
* For Gary:
* If it's a timing problem, it should be gone with the above schedule()
* Another possible reason may be the missing volatile in the original
* code. readl() does this for us.
*/
printk(""); /* Hack! Doesn't work without this !!!??? */
#endif
if(sig == SIGNATURE)
return PRI_BOARD;
/*
* Try to identify a PRI card
*/
outb(BRI_BASEPG_VAL, pgport);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(HZ);
sig = readl(rambase + SIG_OFFSET);
pr_debug("Looking for a signature, got 0x%x\n", sig);
#if 0
printk(""); /* Hack! Doesn't work without this !!!??? */
#endif
if(sig == SIGNATURE)
return BRI_BOARD;
return -1;
/*
* Try to spot a card
*/
sig = readl(rambase + SIG_OFFSET);
pr_debug("Looking for a signature, got 0x%x\n", sig);
if(sig != SIGNATURE)
return -1;
dpm = (DualPortMemory *) rambase;
memset(&sndmsg, 0, MSG_LEN);
sndmsg.msg_byte_cnt = 3;
sndmsg.type = cmReqType1;
sndmsg.class = cmReqClass0;
sndmsg.code = cmReqHWConfig;
memcpy_toio(&(dpm->req_queue[dpm->req_head++]), &sndmsg, MSG_LEN);
outb(0, iobase + 0x400);
pr_debug("Sent HWConfig message\n");
/*
* Wait for the response
*/
x = 0;
while((inb(iobase + FIFOSTAT_OFFSET) & RF_HAS_DATA) && x < 100) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(1);
x++;
}
if(x == 100) {
pr_debug("Timeout waiting for response\n");
return -1;
}
memcpy_fromio(&rcvmsg, &(dpm->rsp_queue[dpm->rsp_tail]), MSG_LEN);
pr_debug("Got HWConfig response, status = 0x%x\n", rcvmsg.rsp_status);
memcpy(&hwci, &(rcvmsg.msg_data.HWCresponse), sizeof(HWConfig_pl));
pr_debug("Hardware Config: Interface: %s, RAM Size: %d, Serial: %s\n"
" Part: %s, Rev: %s\n",
hwci.st_u_sense ? "S/T" : "U", hwci.ram_size,
hwci.serial_no, hwci.part_no, hwci.rev_no);
if(!strncmp(PRI_PARTNO, hwci.part_no, 6))
return PRI_BOARD;
if(!strncmp(BRI_PARTNO, hwci.part_no, 6))
return BRI_BOARD;
return -1;
}
| jur/linux-2.2.1-ps2 | drivers/isdn/sc/init.c | C | gpl-2.0 | 14,059 |
/***************************************************************************
qgsglobefrustumhighlight.h
--------------------------------------
Date : 27.10.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSGLOBEFRUSTUMHIGHLIGHT_H
#define QGSGLOBEFRUSTUMHIGHLIGHT_H
#include <osg/NodeCallback>
class QgsRubberBand;
namespace osg { class View; }
namespace osgEarth
{
class Terrain;
class SpatialReference;
}
class QgsGlobeFrustumHighlightCallback : public osg::NodeCallback
{
public:
QgsGlobeFrustumHighlightCallback( osg::View *view, osgEarth::Terrain *terrain, QgsMapCanvas *mapCanvas, QColor color );
~QgsGlobeFrustumHighlightCallback();
void operator()( osg::Node *, osg::NodeVisitor * ) override;
private:
osg::View *mView = nullptr;
osgEarth::Terrain *mTerrain = nullptr;
QgsRubberBand *mRubberBand = nullptr;
osgEarth::SpatialReference *mSrs = nullptr;
};
#endif // QGSGLOBEFRUSTUMHIGHLIGHT_H
| myarjunar/QGIS | src/plugins/globe/qgsglobefrustumhighlight.h | C | gpl-2.0 | 1,662 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""Record module signals."""
from blinker import Namespace
_signals = Namespace()
record_viewed = _signals.signal('record-viewed')
"""
This signal is sent when a detailed view of record is displayed.
Parameters:
recid - id of record
id_user - id of user or 0 for guest
request - flask request object
Example subscriber:
.. code-block:: python
def subscriber(sender, recid=0, id_user=0, request=None):
...
"""
before_record_insert = _signals.signal('before-record-insert')
"""Signal sent before a record is inserted.
Example subscriber
.. code-block:: python
def listener(sender, *args, **kwargs):
sender['key'] = sum(args)
from invenio_records.signals import before_record_insert
before_record_insert.connect(
listener
)
"""
after_record_insert = _signals.signal('after-record-insert')
"""Signal sent after a record is inserted.
.. note::
No modification are allowed on record object.
"""
before_record_update = _signals.signal('before-record-update')
"""Signal sent before a record is update."""
after_record_update = _signals.signal('after-record-update')
"""Signal sent after a record is updated."""
before_record_index = _signals.signal('before-record-index')
"""Signal sent before a record is indexed.
Example subscriber
.. code-block:: python
def listener(sender, **kwargs):
info = fetch_some_info_for_recid(sender)
kwargs['json']['more_info'] = info
from invenio_records.signals import before_record_index
before_record_index.connect(
listener
)
"""
after_record_index = _signals.signal('after-record-index')
"""Signal sent after a record is indexed."""
| inspirehep/invenio-records | invenio_records/signals.py | Python | gpl-2.0 | 2,474 |
/**
* @file
* Webform module Gmap admin page script.
*/
(function ($) {
Drupal.behaviors.gmapAdmin = {
attach: function(context, settings) {
var lat = Drupal.settings.gmap.lat;
var lon = Drupal.settings.gmap.lon;
var zoom = Drupal.settings.gmap.zoom;
var icon = Drupal.settings.gmap.path;
var latlng = new google.maps.LatLng(lat, lon);
var myOptions = {
zoom: parseInt(zoom),
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("gmap"), myOptions);
var input = (document.getElementById('MapLocation'));
var autocomplete = new google.maps.places.Autocomplete(input);
autocomplete.bindTo('bounds', map);
google.maps.event.addListener(autocomplete, 'place_changed', function(event) {
var place = autocomplete.getPlace();
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
map.setZoom(17);
}
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
placeMarker(place.geometry.location);
});
var marker = new google.maps.Marker({
position: latlng,
map: map,
icon: icon
});
google.maps.event.addListener(map, 'zoom_changed', function() {
document.getElementById('gmap_zoom').value = map.getZoom();
});
google.maps.event.addListener(map, 'click', function(event) {
placeMarker(event.latLng);
});
function placeMarker(location) {
marker.setPosition(location);
document.getElementById('gmap_lat').value = location.lat();
document.getElementById('gmap_lon').value = location.lng();
}
}
};
})(jQuery);
| kaypro4/cf-openshift | sites/all/modules/webform_gmap_location/js/gmap_admin.js | JavaScript | gpl-2.0 | 2,158 |
#python
import k3d
k3d.check_node_environment(context, "MeshSourceScript")
# Construct a cube mesh primitive ...
cubes = context.output.primitives().create("cube")
matrices = cubes.topology().create("matrices", "k3d::matrix4")
materials = cubes.topology().create("materials", "k3d::imaterial*")
uniform = cubes.attributes().create("uniform")
color = uniform.create("Cs", "k3d::color")
# Add three cubes ...
matrices.append(k3d.translate3(k3d.vector3(-7, 0, 0)))
materials.append(None)
color.append(k3d.color(1, 0, 0))
matrices.append(k3d.translate3(k3d.vector3(0, 0, 0)))
materials.append(None)
color.append(k3d.color(0, 1, 0))
matrices.append(k3d.translate3(k3d.vector3(7, 0, 0)))
materials.append(None)
color.append(k3d.color(0, 0, 1))
print repr(context.output)
| barche/k3d | share/k3d/scripts/MeshSourceScript/cubes.py | Python | gpl-2.0 | 771 |
<?php
// process a grant
require_once("grantfuncs.php");
// try to fetch the grant
$id = $_REQUEST["g"];
if(!isGrantId($id))
{
$id = false;
$GRANT = false;
}
else
{
$sql = "SELECT * FROM \"grant\" WHERE id = " . $db->quote($id);
$GRANT = $db->query($sql)->fetch();
}
$ref = "$masterPath?g=$id";
if($GRANT === false || isGrantExpired($GRANT))
{
$category = ($id === false? 'invalid': ($GRANT === false? 'unknown': 'expired'));
logError("$category grant requested");
includeTemplate("$style/include/nogrant.php", array('id' => $id));
exit();
}
if(hasPassHash($GRANT) && !isset($_SESSION['g'][$id]))
{
$ret = false;
if(!empty($_POST['p']))
{
$ret = checkPassHash('"grant"', $GRANT, $_POST['p']);
logGrantEvent($GRANT, "password attempt: " . ($ret? "success": "fail"),
($ret? LOG_INFO: LOG_ERR));
}
if($ret)
{
// authorize the grant for this session
$_SESSION['g'][$id] = array('pass' => $_POST["p"]);
}
else
{
include("grantp.php");
exit();
}
}
// upload handler
function useGrant($upload, $GRANT, $DATA)
{
global $db;
// populate comment with file list when empty
if(!empty($DATA["cmt"]))
$DATA["cmt"] = trim($DATA["cmt"]);
if(empty($DATA["cmt"]) && count($upload['files']) > 1)
$DATA["cmt"] = T_("Archive contents:") . "\n " . implode("\n ", $upload['files']);
// convert the upload to a ticket
$db->beginTransaction();
$sql = "INSERT INTO ticket (id, user_id, name, path, size, cmt, pass_ph, pass_send"
. ", time, last_time, expire, expire_dln, locale, from_grant) VALUES (";
$sql .= $db->quote($upload['id']);
$sql .= ", " . $GRANT['user_id'];
$sql .= ", " . $db->quote($upload["name"]);
$sql .= ", " . $db->quote($upload["path"]);
$sql .= ", " . $upload["size"];
$sql .= ", " . (empty($DATA["cmt"])? 'NULL': $db->quote($DATA["cmt"]));
$sql .= ", " . (empty($GRANT["pass_ph"])? 'NULL': $db->quote($GRANT["pass_ph"]));
$sql .= ", " . (int)$GRANT["pass_send"];
$sql .= ", " . time();
$sql .= ", " . (empty($GRANT["last_time"])? 'NULL': $GRANT['last_time']);
$sql .= ", " . (empty($GRANT["expire"])? 'NULL': $GRANT['expire']);
$sql .= ", " . (empty($GRANT["expire_dln"])? 'NULL': $GRANT['expire_dln']);
$sql .= ", " . (empty($GRANT["locale"])? 'NULL': $db->quote($GRANT['locale']));
$sql .= ", " . $db->quote($GRANT['id']);
$sql .= ")";
try { $db->exec($sql); }
catch(PDOException $e)
{
logDBError($db, "cannot commit new ticket to database");
return false;
}
// check for validity after upload
++$GRANT["uploads"];
if(isGrantExpired($GRANT))
{
$sql = "DELETE FROM \"grant\" WHERE id = " . $db->quote($GRANT['id']);
$db->exec($sql);
}
else
{
$now = time();
$sql = "UPDATE \"grant\" SET last_stamp = $now"
. ", uploads = uploads + 1 WHERE id = " . $db->quote($GRANT['id']);
$db->exec($sql);
}
try { $db->commit(); }
catch(PDOException $e)
{
logDBError($db, "cannot commit new ticket to database");
return false;
}
// fetch defaults
$sql = "SELECT * FROM ticket WHERE id = " . $db->quote($upload['id']);
$TICKET = $db->query($sql)->fetch();
if(!empty($GRANT['pass'])) $TICKET['pass'] = $GRANT['pass'];
// trigger use hooks
onGrantUse($GRANT, $TICKET);
return array($GRANT, $TICKET);
}
// handle the request
$TICKET = false;
$FILES = uploadedFiles($_FILES["file"]);
if($FILES !== false && validateParams($grantUseParams, $_POST))
{
if(!empty($_SESSION['g'][$id]['pass']))
$GRANT['pass'] = $_SESSION['g'][$id]['pass'];
$DATA = array();
if(!empty($_POST['comment']))
$DATA['cmt'] = $_POST['comment'];
$ret = withUpload($FILES, 'useGrant', array($GRANT, $DATA));
if($ret !== false)
list($GRANT, $TICKET) = $ret;
}
// resulting page
if($TICKET === false)
include("grants.php");
else
{
if(isGrantExpired($GRANT))
unset($ref);
includeTemplate("$style/include/grantr.php");
// kill the session ASAP
if($auth === false)
session_destroy();
}
| DownloadTicketService/dl | htdocs/include/grant.php | PHP | gpl-2.0 | 3,994 |
/*
* kernel/sched/core.c
*
* Kernel scheduler and related syscalls
*
* Copyright (C) 1991-2002 Linus Torvalds
*
* 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and
* make semaphores SMP safe
* 1998-11-19 Implemented schedule_timeout() and related stuff
* by Andrea Arcangeli
* 2002-01-04 New ultra-scalable O(1) scheduler by Ingo Molnar:
* hybrid priority-list and round-robin design with
* an array-switch method of distributing timeslices
* and per-CPU runqueues. Cleanups and useful suggestions
* by Davide Libenzi, preemptible kernel bits by Robert Love.
* 2003-09-03 Interactivity tuning by Con Kolivas.
* 2004-04-02 Scheduler domains code by Nick Piggin
* 2007-04-15 Work begun on replacing all interactivity tuning with a
* fair scheduling design by Con Kolivas.
* 2007-05-05 Load balancing (smp-nice) and other improvements
* by Peter Williams
* 2007-05-06 Interactivity improvements to CFS by Mike Galbraith
* 2007-07-01 Group scheduling enhancements by Srivatsa Vaddagiri
* 2007-11-29 RT balancing improvements by Steven Rostedt, Gregory Haskins,
* Thomas Gleixner, Mike Kravetz
*/
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/nmi.h>
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/highmem.h>
#include <asm/mmu_context.h>
#include <linux/interrupt.h>
#include <linux/capability.h>
#include <linux/completion.h>
#include <linux/kernel_stat.h>
#include <linux/debug_locks.h>
#include <linux/perf_event.h>
#include <linux/security.h>
#include <linux/notifier.h>
#include <linux/profile.h>
#include <linux/freezer.h>
#include <linux/vmalloc.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/pid_namespace.h>
#include <linux/smp.h>
#include <linux/threads.h>
#include <linux/timer.h>
#include <linux/rcupdate.h>
#include <linux/cpu.h>
#include <linux/cpuset.h>
#include <linux/percpu.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/sysctl.h>
#include <linux/syscalls.h>
#include <linux/times.h>
#include <linux/tsacct_kern.h>
#include <linux/kprobes.h>
#include <linux/delayacct.h>
#include <linux/unistd.h>
#include <linux/pagemap.h>
#include <linux/hrtimer.h>
#include <linux/tick.h>
#include <linux/debugfs.h>
#include <linux/ctype.h>
#include <linux/ftrace.h>
#include <linux/slab.h>
#include <linux/init_task.h>
#include <linux/binfmts.h>
#include <asm/switch_to.h>
#include <asm/tlb.h>
#include <asm/irq_regs.h>
#include <asm/mutex.h>
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
#endif
#include "sched.h"
#include "../workqueue_sched.h"
#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period)
{
unsigned long delta;
ktime_t soft, hard, now;
for (;;) {
if (hrtimer_active(period_timer))
break;
now = hrtimer_cb_get_time(period_timer);
hrtimer_forward(period_timer, now, period);
soft = hrtimer_get_softexpires(period_timer);
hard = hrtimer_get_expires(period_timer);
delta = ktime_to_ns(ktime_sub(hard, soft));
__hrtimer_start_range_ns(period_timer, soft, delta,
HRTIMER_MODE_ABS_PINNED, 0);
}
}
DEFINE_MUTEX(sched_domains_mutex);
DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
static void update_rq_clock_task(struct rq *rq, s64 delta);
void update_rq_clock(struct rq *rq)
{
s64 delta;
if (rq->skip_clock_update > 0)
return;
delta = sched_clock_cpu(cpu_of(rq)) - rq->clock;
rq->clock += delta;
update_rq_clock_task(rq, delta);
}
#define SCHED_FEAT(name, enabled) \
(1UL << __SCHED_FEAT_##name) * enabled |
const_debug unsigned int sysctl_sched_features =
#include "features.h"
0;
#undef SCHED_FEAT
#ifdef CONFIG_SCHED_DEBUG
#define SCHED_FEAT(name, enabled) \
#name ,
static __read_mostly char *sched_feat_names[] = {
#include "features.h"
NULL
};
#undef SCHED_FEAT
static int sched_feat_show(struct seq_file *m, void *v)
{
int i;
for (i = 0; i < __SCHED_FEAT_NR; i++) {
if (!(sysctl_sched_features & (1UL << i)))
seq_puts(m, "NO_");
seq_printf(m, "%s ", sched_feat_names[i]);
}
seq_puts(m, "\n");
return 0;
}
#ifdef HAVE_JUMP_LABEL
#define jump_label_key__true STATIC_KEY_INIT_TRUE
#define jump_label_key__false STATIC_KEY_INIT_FALSE
#define SCHED_FEAT(name, enabled) \
jump_label_key__##enabled ,
struct static_key sched_feat_keys[__SCHED_FEAT_NR] = {
#include "features.h"
};
#undef SCHED_FEAT
static void sched_feat_disable(int i)
{
if (static_key_enabled(&sched_feat_keys[i]))
static_key_slow_dec(&sched_feat_keys[i]);
}
static void sched_feat_enable(int i)
{
if (!static_key_enabled(&sched_feat_keys[i]))
static_key_slow_inc(&sched_feat_keys[i]);
}
#else
static void sched_feat_disable(int i) { };
static void sched_feat_enable(int i) { };
#endif
static ssize_t
sched_feat_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
char buf[64];
char *cmp;
int neg = 0;
int i;
if (cnt > 63)
cnt = 63;
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
buf[cnt] = 0;
cmp = strstrip(buf);
if (strncmp(cmp, "NO_", 3) == 0) {
neg = 1;
cmp += 3;
}
for (i = 0; i < __SCHED_FEAT_NR; i++) {
if (strcmp(cmp, sched_feat_names[i]) == 0) {
if (neg) {
sysctl_sched_features &= ~(1UL << i);
sched_feat_disable(i);
} else {
sysctl_sched_features |= (1UL << i);
sched_feat_enable(i);
}
break;
}
}
if (i == __SCHED_FEAT_NR)
return -EINVAL;
*ppos += cnt;
return cnt;
}
static int sched_feat_open(struct inode *inode, struct file *filp)
{
return single_open(filp, sched_feat_show, NULL);
}
static const struct file_operations sched_feat_fops = {
.open = sched_feat_open,
.write = sched_feat_write,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static __init int sched_init_debug(void)
{
debugfs_create_file("sched_features", 0644, NULL, NULL,
&sched_feat_fops);
return 0;
}
late_initcall(sched_init_debug);
#endif
const_debug unsigned int sysctl_sched_nr_migrate = 32;
const_debug unsigned int sysctl_sched_time_avg = MSEC_PER_SEC;
unsigned int sysctl_sched_rt_period = 1000000;
__read_mostly int scheduler_running;
int sysctl_sched_rt_runtime = 950000;
static inline struct rq *__task_rq_lock(struct task_struct *p)
__acquires(rq->lock)
{
struct rq *rq;
lockdep_assert_held(&p->pi_lock);
for (;;) {
rq = task_rq(p);
raw_spin_lock(&rq->lock);
if (likely(rq == task_rq(p)))
return rq;
raw_spin_unlock(&rq->lock);
}
}
static struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags)
__acquires(p->pi_lock)
__acquires(rq->lock)
{
struct rq *rq;
for (;;) {
raw_spin_lock_irqsave(&p->pi_lock, *flags);
rq = task_rq(p);
raw_spin_lock(&rq->lock);
if (likely(rq == task_rq(p)))
return rq;
raw_spin_unlock(&rq->lock);
raw_spin_unlock_irqrestore(&p->pi_lock, *flags);
}
}
static void __task_rq_unlock(struct rq *rq)
__releases(rq->lock)
{
raw_spin_unlock(&rq->lock);
}
static inline void
task_rq_unlock(struct rq *rq, struct task_struct *p, unsigned long *flags)
__releases(rq->lock)
__releases(p->pi_lock)
{
raw_spin_unlock(&rq->lock);
raw_spin_unlock_irqrestore(&p->pi_lock, *flags);
}
static struct rq *this_rq_lock(void)
__acquires(rq->lock)
{
struct rq *rq;
local_irq_disable();
rq = this_rq();
raw_spin_lock(&rq->lock);
return rq;
}
#ifdef CONFIG_SCHED_HRTICK
static void hrtick_clear(struct rq *rq)
{
if (hrtimer_active(&rq->hrtick_timer))
hrtimer_cancel(&rq->hrtick_timer);
}
static enum hrtimer_restart hrtick(struct hrtimer *timer)
{
struct rq *rq = container_of(timer, struct rq, hrtick_timer);
WARN_ON_ONCE(cpu_of(rq) != smp_processor_id());
raw_spin_lock(&rq->lock);
update_rq_clock(rq);
rq->curr->sched_class->task_tick(rq, rq->curr, 1);
raw_spin_unlock(&rq->lock);
return HRTIMER_NORESTART;
}
#ifdef CONFIG_SMP
static void __hrtick_start(void *arg)
{
struct rq *rq = arg;
raw_spin_lock(&rq->lock);
hrtimer_restart(&rq->hrtick_timer);
rq->hrtick_csd_pending = 0;
raw_spin_unlock(&rq->lock);
}
void hrtick_start(struct rq *rq, u64 delay)
{
struct hrtimer *timer = &rq->hrtick_timer;
ktime_t time = ktime_add_ns(timer->base->get_time(), delay);
hrtimer_set_expires(timer, time);
if (rq == this_rq()) {
hrtimer_restart(timer);
} else if (!rq->hrtick_csd_pending) {
__smp_call_function_single(cpu_of(rq), &rq->hrtick_csd, 0);
rq->hrtick_csd_pending = 1;
}
}
static int
hotplug_hrtick(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
int cpu = (int)(long)hcpu;
switch (action) {
case CPU_UP_CANCELED:
case CPU_UP_CANCELED_FROZEN:
case CPU_DOWN_PREPARE:
case CPU_DOWN_PREPARE_FROZEN:
case CPU_DEAD:
case CPU_DEAD_FROZEN:
hrtick_clear(cpu_rq(cpu));
return NOTIFY_OK;
}
return NOTIFY_DONE;
}
static __init void init_hrtick(void)
{
hotcpu_notifier(hotplug_hrtick, 0);
}
#else
void hrtick_start(struct rq *rq, u64 delay)
{
__hrtimer_start_range_ns(&rq->hrtick_timer, ns_to_ktime(delay), 0,
HRTIMER_MODE_REL_PINNED, 0);
}
static inline void init_hrtick(void)
{
}
#endif
static void init_rq_hrtick(struct rq *rq)
{
#ifdef CONFIG_SMP
rq->hrtick_csd_pending = 0;
rq->hrtick_csd.flags = 0;
rq->hrtick_csd.func = __hrtick_start;
rq->hrtick_csd.info = rq;
#endif
hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
rq->hrtick_timer.function = hrtick;
}
#else
static inline void hrtick_clear(struct rq *rq)
{
}
static inline void init_rq_hrtick(struct rq *rq)
{
}
static inline void init_hrtick(void)
{
}
#endif
#ifdef CONFIG_SMP
#ifndef tsk_is_polling
#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
#endif
void resched_task(struct task_struct *p)
{
int cpu;
assert_raw_spin_locked(&task_rq(p)->lock);
if (test_tsk_need_resched(p))
return;
set_tsk_need_resched(p);
cpu = task_cpu(p);
if (cpu == smp_processor_id())
return;
smp_mb();
if (!tsk_is_polling(p))
smp_send_reschedule(cpu);
}
void resched_cpu(int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long flags;
if (!raw_spin_trylock_irqsave(&rq->lock, flags))
return;
resched_task(cpu_curr(cpu));
raw_spin_unlock_irqrestore(&rq->lock, flags);
}
#ifdef CONFIG_NO_HZ
int get_nohz_timer_target(void)
{
int cpu = smp_processor_id();
int i;
struct sched_domain *sd;
rcu_read_lock();
for_each_domain(cpu, sd) {
for_each_cpu(i, sched_domain_span(sd)) {
if (!idle_cpu(i)) {
cpu = i;
goto unlock;
}
}
}
unlock:
rcu_read_unlock();
return cpu;
}
void wake_up_idle_cpu(int cpu)
{
struct rq *rq = cpu_rq(cpu);
if (cpu == smp_processor_id())
return;
if (rq->curr != rq->idle)
return;
set_tsk_need_resched(rq->idle);
smp_mb();
if (!tsk_is_polling(rq->idle))
smp_send_reschedule(cpu);
}
static inline bool got_nohz_idle_kick(void)
{
int cpu = smp_processor_id();
return idle_cpu(cpu) && test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu));
}
#else
static inline bool got_nohz_idle_kick(void)
{
return false;
}
#endif
void sched_avg_update(struct rq *rq)
{
s64 period = sched_avg_period();
while ((s64)(rq->clock - rq->age_stamp) > period) {
asm("" : "+rm" (rq->age_stamp));
rq->age_stamp += period;
rq->rt_avg /= 2;
}
}
#else
void resched_task(struct task_struct *p)
{
assert_raw_spin_locked(&task_rq(p)->lock);
set_tsk_need_resched(p);
}
#endif
#if defined(CONFIG_RT_GROUP_SCHED) || (defined(CONFIG_FAIR_GROUP_SCHED) && \
(defined(CONFIG_SMP) || defined(CONFIG_CFS_BANDWIDTH)))
int walk_tg_tree_from(struct task_group *from,
tg_visitor down, tg_visitor up, void *data)
{
struct task_group *parent, *child;
int ret;
parent = from;
down:
ret = (*down)(parent, data);
if (ret)
goto out;
list_for_each_entry_rcu(child, &parent->children, siblings) {
parent = child;
goto down;
up:
continue;
}
ret = (*up)(parent, data);
if (ret || parent == from)
goto out;
child = parent;
parent = parent->parent;
if (parent)
goto up;
out:
return ret;
}
int tg_nop(struct task_group *tg, void *data)
{
return 0;
}
#endif
void update_cpu_load(struct rq *this_rq);
static void set_load_weight(struct task_struct *p)
{
int prio = p->static_prio - MAX_RT_PRIO;
struct load_weight *load = &p->se.load;
if (p->policy == SCHED_IDLE) {
load->weight = scale_load(WEIGHT_IDLEPRIO);
load->inv_weight = WMULT_IDLEPRIO;
return;
}
load->weight = scale_load(prio_to_weight[prio]);
load->inv_weight = prio_to_wmult[prio];
}
static void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
{
update_rq_clock(rq);
sched_info_queued(p);
p->sched_class->enqueue_task(rq, p, flags);
}
static void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
{
update_rq_clock(rq);
sched_info_dequeued(p);
p->sched_class->dequeue_task(rq, p, flags);
}
void activate_task(struct rq *rq, struct task_struct *p, int flags)
{
if (task_contributes_to_load(p))
rq->nr_uninterruptible--;
enqueue_task(rq, p, flags);
}
void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
{
if (task_contributes_to_load(p))
rq->nr_uninterruptible++;
dequeue_task(rq, p, flags);
}
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
static DEFINE_PER_CPU(u64, cpu_hardirq_time);
static DEFINE_PER_CPU(u64, cpu_softirq_time);
static DEFINE_PER_CPU(u64, irq_start_time);
static int sched_clock_irqtime;
void enable_sched_clock_irqtime(void)
{
sched_clock_irqtime = 1;
}
void disable_sched_clock_irqtime(void)
{
sched_clock_irqtime = 0;
}
#ifndef CONFIG_64BIT
static DEFINE_PER_CPU(seqcount_t, irq_time_seq);
static inline void irq_time_write_begin(void)
{
__this_cpu_inc(irq_time_seq.sequence);
smp_wmb();
}
static inline void irq_time_write_end(void)
{
smp_wmb();
__this_cpu_inc(irq_time_seq.sequence);
}
static inline u64 irq_time_read(int cpu)
{
u64 irq_time;
unsigned seq;
do {
seq = read_seqcount_begin(&per_cpu(irq_time_seq, cpu));
irq_time = per_cpu(cpu_softirq_time, cpu) +
per_cpu(cpu_hardirq_time, cpu);
} while (read_seqcount_retry(&per_cpu(irq_time_seq, cpu), seq));
return irq_time;
}
#else
static inline void irq_time_write_begin(void)
{
}
static inline void irq_time_write_end(void)
{
}
static inline u64 irq_time_read(int cpu)
{
return per_cpu(cpu_softirq_time, cpu) + per_cpu(cpu_hardirq_time, cpu);
}
#endif
void account_system_vtime(struct task_struct *curr)
{
unsigned long flags;
s64 delta;
int cpu;
if (!sched_clock_irqtime)
return;
local_irq_save(flags);
cpu = smp_processor_id();
delta = sched_clock_cpu(cpu) - __this_cpu_read(irq_start_time);
__this_cpu_add(irq_start_time, delta);
irq_time_write_begin();
if (hardirq_count())
__this_cpu_add(cpu_hardirq_time, delta);
else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
__this_cpu_add(cpu_softirq_time, delta);
irq_time_write_end();
local_irq_restore(flags);
}
EXPORT_SYMBOL_GPL(account_system_vtime);
#endif
#ifdef CONFIG_PARAVIRT
static inline u64 steal_ticks(u64 steal)
{
if (unlikely(steal > NSEC_PER_SEC))
return div_u64(steal, TICK_NSEC);
return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
}
#endif
static void update_rq_clock_task(struct rq *rq, s64 delta)
{
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
s64 steal = 0, irq_delta = 0;
#endif
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
if (irq_delta > delta)
irq_delta = delta;
rq->prev_irq_time += irq_delta;
delta -= irq_delta;
#endif
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
if (static_key_false((¶virt_steal_rq_enabled))) {
u64 st;
steal = paravirt_steal_clock(cpu_of(rq));
steal -= rq->prev_steal_time_rq;
if (unlikely(steal > delta))
steal = delta;
st = steal_ticks(steal);
steal = st * TICK_NSEC;
rq->prev_steal_time_rq += steal;
delta -= steal;
}
#endif
rq->clock_task += delta;
#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING)
if ((irq_delta + steal) && sched_feat(NONTASK_POWER))
sched_rt_avg_update(rq, irq_delta + steal);
#endif
}
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
static int irqtime_account_hi_update(void)
{
u64 *cpustat = kcpustat_this_cpu->cpustat;
unsigned long flags;
u64 latest_ns;
int ret = 0;
local_irq_save(flags);
latest_ns = this_cpu_read(cpu_hardirq_time);
if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_IRQ])
ret = 1;
local_irq_restore(flags);
return ret;
}
static int irqtime_account_si_update(void)
{
u64 *cpustat = kcpustat_this_cpu->cpustat;
unsigned long flags;
u64 latest_ns;
int ret = 0;
local_irq_save(flags);
latest_ns = this_cpu_read(cpu_softirq_time);
if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_SOFTIRQ])
ret = 1;
local_irq_restore(flags);
return ret;
}
#else
#define sched_clock_irqtime (0)
#endif
void sched_set_stop_task(int cpu, struct task_struct *stop)
{
struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
struct task_struct *old_stop = cpu_rq(cpu)->stop;
if (stop) {
sched_setscheduler_nocheck(stop, SCHED_FIFO, ¶m);
stop->sched_class = &stop_sched_class;
}
cpu_rq(cpu)->stop = stop;
if (old_stop) {
old_stop->sched_class = &rt_sched_class;
}
}
static inline int __normal_prio(struct task_struct *p)
{
return p->static_prio;
}
static inline int normal_prio(struct task_struct *p)
{
int prio;
if (task_has_rt_policy(p))
prio = MAX_RT_PRIO-1 - p->rt_priority;
else
prio = __normal_prio(p);
return prio;
}
static int effective_prio(struct task_struct *p)
{
p->normal_prio = normal_prio(p);
if (!rt_prio(p->prio))
return p->normal_prio;
return p->prio;
}
inline int task_curr(const struct task_struct *p)
{
return cpu_curr(task_cpu(p)) == p;
}
static inline void check_class_changed(struct rq *rq, struct task_struct *p,
const struct sched_class *prev_class,
int oldprio)
{
if (prev_class != p->sched_class) {
if (prev_class->switched_from)
prev_class->switched_from(rq, p);
p->sched_class->switched_to(rq, p);
} else if (oldprio != p->prio)
p->sched_class->prio_changed(rq, p, oldprio);
}
void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
{
const struct sched_class *class;
if (p->sched_class == rq->curr->sched_class) {
rq->curr->sched_class->check_preempt_curr(rq, p, flags);
} else {
for_each_class(class) {
if (class == rq->curr->sched_class)
break;
if (class == p->sched_class) {
resched_task(rq->curr);
break;
}
}
}
if (rq->curr->on_rq && test_tsk_need_resched(rq->curr))
rq->skip_clock_update = 1;
}
#ifdef CONFIG_SMP
void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
{
#ifdef CONFIG_SCHED_DEBUG
WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING &&
!(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
#ifdef CONFIG_LOCKDEP
WARN_ON_ONCE(debug_locks && !(lockdep_is_held(&p->pi_lock) ||
lockdep_is_held(&task_rq(p)->lock)));
#endif
#endif
trace_sched_migrate_task(p, new_cpu);
if (task_cpu(p) != new_cpu) {
p->se.nr_migrations++;
perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0);
}
__set_task_cpu(p, new_cpu);
}
struct migration_arg {
struct task_struct *task;
int dest_cpu;
};
static int migration_cpu_stop(void *data);
unsigned long wait_task_inactive(struct task_struct *p, long match_state)
{
unsigned long flags;
int running, on_rq;
unsigned long ncsw;
struct rq *rq;
for (;;) {
rq = task_rq(p);
while (task_running(rq, p)) {
if (match_state && unlikely(p->state != match_state))
return 0;
cpu_relax();
}
rq = task_rq_lock(p, &flags);
trace_sched_wait_task(p);
running = task_running(rq, p);
on_rq = p->on_rq;
ncsw = 0;
if (!match_state || p->state == match_state)
ncsw = p->nvcsw | LONG_MIN;
task_rq_unlock(rq, p, &flags);
if (unlikely(!ncsw))
break;
if (unlikely(running)) {
cpu_relax();
continue;
}
if (unlikely(on_rq)) {
ktime_t to = ktime_set(0, NSEC_PER_MSEC);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_hrtimeout(&to, HRTIMER_MODE_REL);
continue;
}
break;
}
return ncsw;
}
void kick_process(struct task_struct *p)
{
int cpu;
preempt_disable();
cpu = task_cpu(p);
if ((cpu != smp_processor_id()) && task_curr(p))
smp_send_reschedule(cpu);
preempt_enable();
}
EXPORT_SYMBOL_GPL(kick_process);
#endif
#ifdef CONFIG_SMP
static int select_fallback_rq(int cpu, struct task_struct *p)
{
const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu));
enum { cpuset, possible, fail } state = cpuset;
int dest_cpu;
for_each_cpu(dest_cpu, nodemask) {
if (!cpu_online(dest_cpu))
continue;
if (!cpu_active(dest_cpu))
continue;
if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
return dest_cpu;
}
for (;;) {
for_each_cpu(dest_cpu, tsk_cpus_allowed(p)) {
if (!cpu_online(dest_cpu))
continue;
if (!cpu_active(dest_cpu))
continue;
goto out;
}
switch (state) {
case cpuset:
cpuset_cpus_allowed_fallback(p);
state = possible;
break;
case possible:
do_set_cpus_allowed(p, cpu_possible_mask);
state = fail;
break;
case fail:
BUG();
break;
}
}
out:
if (state != cpuset) {
if (p->mm && printk_ratelimit()) {
printk_sched("process %d (%s) no longer affine to cpu%d\n",
task_pid_nr(p), p->comm, cpu);
}
}
return dest_cpu;
}
static inline
int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
{
int cpu = p->sched_class->select_task_rq(p, sd_flags, wake_flags);
if (unlikely(!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)) ||
!cpu_online(cpu)))
cpu = select_fallback_rq(task_cpu(p), p);
return cpu;
}
static void update_avg(u64 *avg, u64 sample)
{
s64 diff = sample - *avg;
*avg += diff >> 3;
}
#endif
static void
ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
{
#ifdef CONFIG_SCHEDSTATS
struct rq *rq = this_rq();
#ifdef CONFIG_SMP
int this_cpu = smp_processor_id();
if (cpu == this_cpu) {
schedstat_inc(rq, ttwu_local);
schedstat_inc(p, se.statistics.nr_wakeups_local);
} else {
struct sched_domain *sd;
schedstat_inc(p, se.statistics.nr_wakeups_remote);
rcu_read_lock();
for_each_domain(this_cpu, sd) {
if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
schedstat_inc(sd, ttwu_wake_remote);
break;
}
}
rcu_read_unlock();
}
if (wake_flags & WF_MIGRATED)
schedstat_inc(p, se.statistics.nr_wakeups_migrate);
#endif
schedstat_inc(rq, ttwu_count);
schedstat_inc(p, se.statistics.nr_wakeups);
if (wake_flags & WF_SYNC)
schedstat_inc(p, se.statistics.nr_wakeups_sync);
#endif
}
static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags)
{
activate_task(rq, p, en_flags);
p->on_rq = 1;
if (p->flags & PF_WQ_WORKER)
wq_worker_waking_up(p, cpu_of(rq));
}
static void
ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
{
trace_sched_wakeup(p, true);
check_preempt_curr(rq, p, wake_flags);
p->state = TASK_RUNNING;
#ifdef CONFIG_SMP
if (p->sched_class->task_woken)
p->sched_class->task_woken(rq, p);
if (rq->idle_stamp) {
u64 delta = rq->clock - rq->idle_stamp;
u64 max = 2*sysctl_sched_migration_cost;
if (delta > max)
rq->avg_idle = max;
else
update_avg(&rq->avg_idle, delta);
rq->idle_stamp = 0;
}
#endif
}
static void
ttwu_do_activate(struct rq *rq, struct task_struct *p, int wake_flags)
{
#ifdef CONFIG_SMP
if (p->sched_contributes_to_load)
rq->nr_uninterruptible--;
#endif
ttwu_activate(rq, p, ENQUEUE_WAKEUP | ENQUEUE_WAKING);
ttwu_do_wakeup(rq, p, wake_flags);
}
static int ttwu_remote(struct task_struct *p, int wake_flags)
{
struct rq *rq;
int ret = 0;
rq = __task_rq_lock(p);
if (p->on_rq) {
ttwu_do_wakeup(rq, p, wake_flags);
ret = 1;
}
__task_rq_unlock(rq);
return ret;
}
#ifdef CONFIG_SMP
static void sched_ttwu_pending(void)
{
struct rq *rq = this_rq();
struct llist_node *llist = llist_del_all(&rq->wake_list);
struct task_struct *p;
raw_spin_lock(&rq->lock);
while (llist) {
p = llist_entry(llist, struct task_struct, wake_entry);
llist = llist_next(llist);
ttwu_do_activate(rq, p, 0);
}
raw_spin_unlock(&rq->lock);
}
void scheduler_ipi(void)
{
if (llist_empty(&this_rq()->wake_list) && !got_nohz_idle_kick())
return;
irq_enter();
sched_ttwu_pending();
if (unlikely(got_nohz_idle_kick() && !need_resched())) {
this_rq()->idle_balance = 1;
raise_softirq_irqoff(SCHED_SOFTIRQ);
}
irq_exit();
}
static void ttwu_queue_remote(struct task_struct *p, int cpu)
{
if (llist_add(&p->wake_entry, &cpu_rq(cpu)->wake_list))
smp_send_reschedule(cpu);
}
#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
static int ttwu_activate_remote(struct task_struct *p, int wake_flags)
{
struct rq *rq;
int ret = 0;
rq = __task_rq_lock(p);
if (p->on_cpu) {
ttwu_activate(rq, p, ENQUEUE_WAKEUP);
ttwu_do_wakeup(rq, p, wake_flags);
ret = 1;
}
__task_rq_unlock(rq);
return ret;
}
#endif
bool cpus_share_cache(int this_cpu, int that_cpu)
{
return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu);
}
#endif
static void ttwu_queue(struct task_struct *p, int cpu)
{
struct rq *rq = cpu_rq(cpu);
#if defined(CONFIG_SMP)
if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) {
sched_clock_cpu(cpu);
ttwu_queue_remote(p, cpu);
return;
}
#endif
raw_spin_lock(&rq->lock);
ttwu_do_activate(rq, p, 0);
raw_spin_unlock(&rq->lock);
}
static int
try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
{
unsigned long flags;
int cpu, success = 0;
smp_wmb();
raw_spin_lock_irqsave(&p->pi_lock, flags);
if (!(p->state & state))
goto out;
success = 1;
cpu = task_cpu(p);
if (p->on_rq && ttwu_remote(p, wake_flags))
goto stat;
#ifdef CONFIG_SMP
while (p->on_cpu) {
#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
if (ttwu_activate_remote(p, wake_flags))
goto stat;
#else
cpu_relax();
#endif
}
smp_rmb();
p->sched_contributes_to_load = !!task_contributes_to_load(p);
p->state = TASK_WAKING;
if (p->sched_class->task_waking)
p->sched_class->task_waking(p);
cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
if (task_cpu(p) != cpu) {
wake_flags |= WF_MIGRATED;
set_task_cpu(p, cpu);
}
#endif
ttwu_queue(p, cpu);
stat:
ttwu_stat(p, cpu, wake_flags);
out:
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
return success;
}
static void try_to_wake_up_local(struct task_struct *p)
{
struct rq *rq = task_rq(p);
BUG_ON(rq != this_rq());
BUG_ON(p == current);
lockdep_assert_held(&rq->lock);
if (!raw_spin_trylock(&p->pi_lock)) {
raw_spin_unlock(&rq->lock);
raw_spin_lock(&p->pi_lock);
raw_spin_lock(&rq->lock);
}
if (!(p->state & TASK_NORMAL))
goto out;
if (!p->on_rq)
ttwu_activate(rq, p, ENQUEUE_WAKEUP);
ttwu_do_wakeup(rq, p, 0);
ttwu_stat(p, smp_processor_id(), 0);
out:
raw_spin_unlock(&p->pi_lock);
}
int wake_up_process(struct task_struct *p)
{
return try_to_wake_up(p, TASK_ALL, 0);
}
EXPORT_SYMBOL(wake_up_process);
int wake_up_state(struct task_struct *p, unsigned int state)
{
return try_to_wake_up(p, state, 0);
}
static void __sched_fork(struct task_struct *p)
{
p->on_rq = 0;
p->se.on_rq = 0;
p->se.exec_start = 0;
p->se.sum_exec_runtime = 0;
p->se.prev_sum_exec_runtime = 0;
p->se.nr_migrations = 0;
p->se.vruntime = 0;
INIT_LIST_HEAD(&p->se.group_node);
#ifdef CONFIG_SCHEDSTATS
memset(&p->se.statistics, 0, sizeof(p->se.statistics));
#endif
INIT_LIST_HEAD(&p->rt.run_list);
#ifdef CONFIG_PREEMPT_NOTIFIERS
INIT_HLIST_HEAD(&p->preempt_notifiers);
#endif
}
void sched_fork(struct task_struct *p)
{
unsigned long flags;
int cpu = get_cpu();
__sched_fork(p);
p->state = TASK_RUNNING;
p->prio = current->normal_prio;
if (unlikely(p->sched_reset_on_fork)) {
if (task_has_rt_policy(p)) {
p->policy = SCHED_NORMAL;
p->static_prio = NICE_TO_PRIO(0);
p->rt_priority = 0;
} else if (PRIO_TO_NICE(p->static_prio) < 0)
p->static_prio = NICE_TO_PRIO(0);
p->prio = p->normal_prio = __normal_prio(p);
set_load_weight(p);
p->sched_reset_on_fork = 0;
}
if (!rt_prio(p->prio))
p->sched_class = &fair_sched_class;
if (p->sched_class->task_fork)
p->sched_class->task_fork(p);
raw_spin_lock_irqsave(&p->pi_lock, flags);
set_task_cpu(p, cpu);
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
if (likely(sched_info_on()))
memset(&p->sched_info, 0, sizeof(p->sched_info));
#endif
#if defined(CONFIG_SMP)
p->on_cpu = 0;
#endif
#ifdef CONFIG_PREEMPT_COUNT
task_thread_info(p)->preempt_count = 1;
#endif
#ifdef CONFIG_SMP
plist_node_init(&p->pushable_tasks, MAX_PRIO);
#endif
put_cpu();
}
void wake_up_new_task(struct task_struct *p)
{
unsigned long flags;
struct rq *rq;
raw_spin_lock_irqsave(&p->pi_lock, flags);
#ifdef CONFIG_SMP
set_task_cpu(p, select_task_rq(p, SD_BALANCE_FORK, 0));
#endif
rq = __task_rq_lock(p);
activate_task(rq, p, 0);
p->on_rq = 1;
trace_sched_wakeup_new(p, true);
check_preempt_curr(rq, p, WF_FORK);
#ifdef CONFIG_SMP
if (p->sched_class->task_woken)
p->sched_class->task_woken(rq, p);
#endif
task_rq_unlock(rq, p, &flags);
}
#ifdef CONFIG_PREEMPT_NOTIFIERS
void preempt_notifier_register(struct preempt_notifier *notifier)
{
hlist_add_head(¬ifier->link, ¤t->preempt_notifiers);
}
EXPORT_SYMBOL_GPL(preempt_notifier_register);
void preempt_notifier_unregister(struct preempt_notifier *notifier)
{
hlist_del(¬ifier->link);
}
EXPORT_SYMBOL_GPL(preempt_notifier_unregister);
static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
{
struct preempt_notifier *notifier;
struct hlist_node *node;
hlist_for_each_entry(notifier, node, &curr->preempt_notifiers, link)
notifier->ops->sched_in(notifier, raw_smp_processor_id());
}
static void
fire_sched_out_preempt_notifiers(struct task_struct *curr,
struct task_struct *next)
{
struct preempt_notifier *notifier;
struct hlist_node *node;
hlist_for_each_entry(notifier, node, &curr->preempt_notifiers, link)
notifier->ops->sched_out(notifier, next);
}
#else
static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
{
}
static void
fire_sched_out_preempt_notifiers(struct task_struct *curr,
struct task_struct *next)
{
}
#endif
static inline void
prepare_task_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next)
{
sched_info_switch(prev, next);
perf_event_task_sched_out(prev, next);
fire_sched_out_preempt_notifiers(prev, next);
prepare_lock_switch(rq, next);
prepare_arch_switch(next);
trace_sched_switch(prev, next);
}
static void finish_task_switch(struct rq *rq, struct task_struct *prev)
__releases(rq->lock)
{
struct mm_struct *mm = rq->prev_mm;
long prev_state;
rq->prev_mm = NULL;
prev_state = prev->state;
finish_arch_switch(prev);
#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
local_irq_disable();
#endif
perf_event_task_sched_in(prev, current);
#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
local_irq_enable();
#endif
finish_lock_switch(rq, prev);
finish_arch_post_lock_switch();
fire_sched_in_preempt_notifiers(current);
if (mm)
mmdrop(mm);
if (unlikely(prev_state == TASK_DEAD)) {
kprobe_flush_task(prev);
put_task_struct(prev);
}
}
#ifdef CONFIG_SMP
static inline void pre_schedule(struct rq *rq, struct task_struct *prev)
{
if (prev->sched_class->pre_schedule)
prev->sched_class->pre_schedule(rq, prev);
}
static inline void post_schedule(struct rq *rq)
{
if (rq->post_schedule) {
unsigned long flags;
raw_spin_lock_irqsave(&rq->lock, flags);
if (rq->curr->sched_class->post_schedule)
rq->curr->sched_class->post_schedule(rq);
raw_spin_unlock_irqrestore(&rq->lock, flags);
rq->post_schedule = 0;
}
}
#else
static inline void pre_schedule(struct rq *rq, struct task_struct *p)
{
}
static inline void post_schedule(struct rq *rq)
{
}
#endif
asmlinkage void schedule_tail(struct task_struct *prev)
__releases(rq->lock)
{
struct rq *rq = this_rq();
finish_task_switch(rq, prev);
post_schedule(rq);
#ifdef __ARCH_WANT_UNLOCKED_CTXSW
preempt_enable();
#endif
if (current->set_child_tid)
put_user(task_pid_vnr(current), current->set_child_tid);
}
static inline void
context_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next)
{
struct mm_struct *mm, *oldmm;
prepare_task_switch(rq, prev, next);
mm = next->mm;
oldmm = prev->active_mm;
arch_start_context_switch(prev);
if (!mm) {
next->active_mm = oldmm;
atomic_inc(&oldmm->mm_count);
enter_lazy_tlb(oldmm, next);
} else
switch_mm(oldmm, mm, next);
if (!prev->mm) {
prev->active_mm = NULL;
rq->prev_mm = oldmm;
}
#ifndef __ARCH_WANT_UNLOCKED_CTXSW
spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
#endif
switch_to(prev, next, prev);
barrier();
finish_task_switch(this_rq(), prev);
}
unsigned long nr_running(void)
{
unsigned long i, sum = 0;
for_each_online_cpu(i)
sum += cpu_rq(i)->nr_running;
return sum;
}
unsigned long nr_uninterruptible(void)
{
unsigned long i, sum = 0;
for_each_possible_cpu(i)
sum += cpu_rq(i)->nr_uninterruptible;
if (unlikely((long)sum < 0))
sum = 0;
return sum;
}
unsigned long long nr_context_switches(void)
{
int i;
unsigned long long sum = 0;
for_each_possible_cpu(i)
sum += cpu_rq(i)->nr_switches;
return sum;
}
unsigned long nr_iowait(void)
{
unsigned long i, sum = 0;
for_each_possible_cpu(i)
sum += atomic_read(&cpu_rq(i)->nr_iowait);
return sum;
}
unsigned long nr_iowait_cpu(int cpu)
{
struct rq *this = cpu_rq(cpu);
return atomic_read(&this->nr_iowait);
}
unsigned long this_cpu_load(void)
{
struct rq *this = this_rq();
return this->cpu_load[0];
}
static atomic_long_t calc_load_tasks;
static unsigned long calc_load_update;
unsigned long avenrun[3];
EXPORT_SYMBOL(avenrun);
void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
{
loads[0] = (avenrun[0] + offset) << shift;
loads[1] = (avenrun[1] + offset) << shift;
loads[2] = (avenrun[2] + offset) << shift;
}
static long calc_load_fold_active(struct rq *this_rq)
{
long nr_active, delta = 0;
nr_active = this_rq->nr_running;
nr_active += (long) this_rq->nr_uninterruptible;
if (nr_active != this_rq->calc_load_active) {
delta = nr_active - this_rq->calc_load_active;
this_rq->calc_load_active = nr_active;
}
return delta;
}
static unsigned long
calc_load(unsigned long load, unsigned long exp, unsigned long active)
{
load *= exp;
load += active * (FIXED_1 - exp);
load += 1UL << (FSHIFT - 1);
return load >> FSHIFT;
}
#ifdef CONFIG_NO_HZ
static atomic_long_t calc_load_idle[2];
static int calc_load_idx;
static inline int calc_load_write_idx(void)
{
int idx = calc_load_idx;
smp_rmb();
if (!time_before(jiffies, calc_load_update))
idx++;
return idx & 1;
}
static inline int calc_load_read_idx(void)
{
return calc_load_idx & 1;
}
void calc_load_enter_idle(void)
{
struct rq *this_rq = this_rq();
long delta;
delta = calc_load_fold_active(this_rq);
if (delta) {
int idx = calc_load_write_idx();
atomic_long_add(delta, &calc_load_idle[idx]);
}
}
void calc_load_exit_idle(void)
{
struct rq *this_rq = this_rq();
if (time_before(jiffies, this_rq->calc_load_update))
return;
this_rq->calc_load_update = calc_load_update;
if (time_before(jiffies, this_rq->calc_load_update + 10))
this_rq->calc_load_update += LOAD_FREQ;
}
static long calc_load_fold_idle(void)
{
int idx = calc_load_read_idx();
long delta = 0;
if (atomic_long_read(&calc_load_idle[idx]))
delta = atomic_long_xchg(&calc_load_idle[idx], 0);
return delta;
}
static unsigned long
fixed_power_int(unsigned long x, unsigned int frac_bits, unsigned int n)
{
unsigned long result = 1UL << frac_bits;
if (n) for (;;) {
if (n & 1) {
result *= x;
result += 1UL << (frac_bits - 1);
result >>= frac_bits;
}
n >>= 1;
if (!n)
break;
x *= x;
x += 1UL << (frac_bits - 1);
x >>= frac_bits;
}
return result;
}
static unsigned long
calc_load_n(unsigned long load, unsigned long exp,
unsigned long active, unsigned int n)
{
return calc_load(load, fixed_power_int(exp, FSHIFT, n), active);
}
static void calc_global_nohz(void)
{
long delta, active, n;
if (!time_before(jiffies, calc_load_update + 10)) {
delta = jiffies - calc_load_update - 10;
n = 1 + (delta / LOAD_FREQ);
active = atomic_long_read(&calc_load_tasks);
active = active > 0 ? active * FIXED_1 : 0;
avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
calc_load_update += n * LOAD_FREQ;
}
smp_wmb();
calc_load_idx++;
}
#else
static inline long calc_load_fold_idle(void) { return 0; }
static inline void calc_global_nohz(void) { }
#endif
void calc_global_load(unsigned long ticks)
{
long active, delta;
if (time_before(jiffies, calc_load_update + 10))
return;
delta = calc_load_fold_idle();
if (delta)
atomic_long_add(delta, &calc_load_tasks);
active = atomic_long_read(&calc_load_tasks);
active = active > 0 ? active * FIXED_1 : 0;
avenrun[0] = calc_load(avenrun[0], EXP_1, active);
avenrun[1] = calc_load(avenrun[1], EXP_5, active);
avenrun[2] = calc_load(avenrun[2], EXP_15, active);
calc_load_update += LOAD_FREQ;
calc_global_nohz();
}
static void calc_load_account_active(struct rq *this_rq)
{
long delta;
if (time_before(jiffies, this_rq->calc_load_update))
return;
delta = calc_load_fold_active(this_rq);
if (delta)
atomic_long_add(delta, &calc_load_tasks);
this_rq->calc_load_update += LOAD_FREQ;
}
#define DEGRADE_SHIFT 7
static const unsigned char
degrade_zero_ticks[CPU_LOAD_IDX_MAX] = {0, 8, 32, 64, 128};
static const unsigned char
degrade_factor[CPU_LOAD_IDX_MAX][DEGRADE_SHIFT + 1] = {
{0, 0, 0, 0, 0, 0, 0, 0},
{64, 32, 8, 0, 0, 0, 0, 0},
{96, 72, 40, 12, 1, 0, 0},
{112, 98, 75, 43, 15, 1, 0},
{120, 112, 98, 76, 45, 16, 2} };
static unsigned long
decay_load_missed(unsigned long load, unsigned long missed_updates, int idx)
{
int j = 0;
if (!missed_updates)
return load;
if (missed_updates >= degrade_zero_ticks[idx])
return 0;
if (idx == 1)
return load >> missed_updates;
while (missed_updates) {
if (missed_updates % 2)
load = (load * degrade_factor[idx][j]) >> DEGRADE_SHIFT;
missed_updates >>= 1;
j++;
}
return load;
}
void update_cpu_load(struct rq *this_rq)
{
unsigned long this_load = this_rq->load.weight;
unsigned long curr_jiffies = jiffies;
unsigned long pending_updates;
int i, scale;
this_rq->nr_load_updates++;
if (curr_jiffies == this_rq->last_load_update_tick)
return;
pending_updates = curr_jiffies - this_rq->last_load_update_tick;
this_rq->last_load_update_tick = curr_jiffies;
this_rq->cpu_load[0] = this_load;
for (i = 1, scale = 2; i < CPU_LOAD_IDX_MAX; i++, scale += scale) {
unsigned long old_load, new_load;
old_load = this_rq->cpu_load[i];
old_load = decay_load_missed(old_load, pending_updates - 1, i);
new_load = this_load;
if (new_load > old_load)
new_load += scale - 1;
this_rq->cpu_load[i] = (old_load * (scale - 1) + new_load) >> i;
}
sched_avg_update(this_rq);
}
static void update_cpu_load_active(struct rq *this_rq)
{
update_cpu_load(this_rq);
calc_load_account_active(this_rq);
}
#ifdef CONFIG_SMP
void sched_exec(void)
{
struct task_struct *p = current;
unsigned long flags;
int dest_cpu;
raw_spin_lock_irqsave(&p->pi_lock, flags);
dest_cpu = p->sched_class->select_task_rq(p, SD_BALANCE_EXEC, 0);
if (dest_cpu == smp_processor_id())
goto unlock;
if (likely(cpu_active(dest_cpu))) {
struct migration_arg arg = { p, dest_cpu };
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg);
return;
}
unlock:
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
}
#endif
DEFINE_PER_CPU(struct kernel_stat, kstat);
DEFINE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
EXPORT_PER_CPU_SYMBOL(kstat);
EXPORT_PER_CPU_SYMBOL(kernel_cpustat);
static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq)
{
u64 ns = 0;
if (task_current(rq, p)) {
update_rq_clock(rq);
ns = rq->clock_task - p->se.exec_start;
if ((s64)ns < 0)
ns = 0;
}
return ns;
}
unsigned long long task_delta_exec(struct task_struct *p)
{
unsigned long flags;
struct rq *rq;
u64 ns = 0;
rq = task_rq_lock(p, &flags);
ns = do_task_delta_exec(p, rq);
task_rq_unlock(rq, p, &flags);
return ns;
}
unsigned long long task_sched_runtime(struct task_struct *p)
{
unsigned long flags;
struct rq *rq;
u64 ns = 0;
rq = task_rq_lock(p, &flags);
ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq);
task_rq_unlock(rq, p, &flags);
return ns;
}
#ifdef CONFIG_CGROUP_CPUACCT
struct cgroup_subsys cpuacct_subsys;
struct cpuacct root_cpuacct;
#endif
static inline void task_group_account_field(struct task_struct *p, int index,
u64 tmp)
{
#ifdef CONFIG_CGROUP_CPUACCT
struct kernel_cpustat *kcpustat;
struct cpuacct *ca;
#endif
__get_cpu_var(kernel_cpustat).cpustat[index] += tmp;
#ifdef CONFIG_CGROUP_CPUACCT
if (unlikely(!cpuacct_subsys.active))
return;
rcu_read_lock();
ca = task_ca(p);
while (ca && (ca != &root_cpuacct)) {
kcpustat = this_cpu_ptr(ca->cpustat);
kcpustat->cpustat[index] += tmp;
ca = parent_ca(ca);
}
rcu_read_unlock();
#endif
}
void account_user_time(struct task_struct *p, cputime_t cputime,
cputime_t cputime_scaled)
{
int index;
p->utime += cputime;
p->utimescaled += cputime_scaled;
account_group_user_time(p, cputime);
index = (TASK_NICE(p) > 0) ? CPUTIME_NICE : CPUTIME_USER;
task_group_account_field(p, index, (__force u64) cputime);
acct_update_integrals(p);
}
static void account_guest_time(struct task_struct *p, cputime_t cputime,
cputime_t cputime_scaled)
{
u64 *cpustat = kcpustat_this_cpu->cpustat;
p->utime += cputime;
p->utimescaled += cputime_scaled;
account_group_user_time(p, cputime);
p->gtime += cputime;
if (TASK_NICE(p) > 0) {
cpustat[CPUTIME_NICE] += (__force u64) cputime;
cpustat[CPUTIME_GUEST_NICE] += (__force u64) cputime;
} else {
cpustat[CPUTIME_USER] += (__force u64) cputime;
cpustat[CPUTIME_GUEST] += (__force u64) cputime;
}
}
static inline
void __account_system_time(struct task_struct *p, cputime_t cputime,
cputime_t cputime_scaled, int index)
{
p->stime += cputime;
p->stimescaled += cputime_scaled;
account_group_system_time(p, cputime);
task_group_account_field(p, index, (__force u64) cputime);
acct_update_integrals(p);
}
void account_system_time(struct task_struct *p, int hardirq_offset,
cputime_t cputime, cputime_t cputime_scaled)
{
int index;
if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
account_guest_time(p, cputime, cputime_scaled);
return;
}
if (hardirq_count() - hardirq_offset)
index = CPUTIME_IRQ;
else if (in_serving_softirq())
index = CPUTIME_SOFTIRQ;
else
index = CPUTIME_SYSTEM;
__account_system_time(p, cputime, cputime_scaled, index);
}
void account_steal_time(cputime_t cputime)
{
u64 *cpustat = kcpustat_this_cpu->cpustat;
cpustat[CPUTIME_STEAL] += (__force u64) cputime;
}
void account_idle_time(cputime_t cputime)
{
u64 *cpustat = kcpustat_this_cpu->cpustat;
struct rq *rq = this_rq();
if (atomic_read(&rq->nr_iowait) > 0)
cpustat[CPUTIME_IOWAIT] += (__force u64) cputime;
else
cpustat[CPUTIME_IDLE] += (__force u64) cputime;
}
static __always_inline bool steal_account_process_tick(void)
{
#ifdef CONFIG_PARAVIRT
if (static_key_false(¶virt_steal_enabled)) {
u64 steal, st = 0;
steal = paravirt_steal_clock(smp_processor_id());
steal -= this_rq()->prev_steal_time;
st = steal_ticks(steal);
this_rq()->prev_steal_time += st * TICK_NSEC;
account_steal_time(st);
return st;
}
#endif
return false;
}
#ifndef CONFIG_VIRT_CPU_ACCOUNTING
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
struct rq *rq)
{
cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
u64 *cpustat = kcpustat_this_cpu->cpustat;
if (steal_account_process_tick())
return;
if (irqtime_account_hi_update()) {
cpustat[CPUTIME_IRQ] += (__force u64) cputime_one_jiffy;
} else if (irqtime_account_si_update()) {
cpustat[CPUTIME_SOFTIRQ] += (__force u64) cputime_one_jiffy;
} else if (this_cpu_ksoftirqd() == p) {
__account_system_time(p, cputime_one_jiffy, one_jiffy_scaled,
CPUTIME_SOFTIRQ);
} else if (user_tick) {
account_user_time(p, cputime_one_jiffy, one_jiffy_scaled);
} else if (p == rq->idle) {
account_idle_time(cputime_one_jiffy);
} else if (p->flags & PF_VCPU) {
account_guest_time(p, cputime_one_jiffy, one_jiffy_scaled);
} else {
__account_system_time(p, cputime_one_jiffy, one_jiffy_scaled,
CPUTIME_SYSTEM);
}
}
static void irqtime_account_idle_ticks(int ticks)
{
int i;
struct rq *rq = this_rq();
for (i = 0; i < ticks; i++)
irqtime_account_process_tick(current, 0, rq);
}
#else
static void irqtime_account_idle_ticks(int ticks) {}
static void irqtime_account_process_tick(struct task_struct *p, int user_tick,
struct rq *rq) {}
#endif
void account_process_tick(struct task_struct *p, int user_tick)
{
cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
struct rq *rq = this_rq();
if (sched_clock_irqtime) {
irqtime_account_process_tick(p, user_tick, rq);
return;
}
if (steal_account_process_tick())
return;
if (user_tick)
account_user_time(p, cputime_one_jiffy, one_jiffy_scaled);
else if ((p != rq->idle) || (irq_count() != HARDIRQ_OFFSET))
account_system_time(p, HARDIRQ_OFFSET, cputime_one_jiffy,
one_jiffy_scaled);
else
account_idle_time(cputime_one_jiffy);
}
void account_steal_ticks(unsigned long ticks)
{
account_steal_time(jiffies_to_cputime(ticks));
}
void account_idle_ticks(unsigned long ticks)
{
if (sched_clock_irqtime) {
irqtime_account_idle_ticks(ticks);
return;
}
account_idle_time(jiffies_to_cputime(ticks));
}
#endif
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
{
*ut = p->utime;
*st = p->stime;
}
void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
{
struct task_cputime cputime;
thread_group_cputime(p, &cputime);
*ut = cputime.utime;
*st = cputime.stime;
}
#else
#ifndef nsecs_to_cputime
# define nsecs_to_cputime(__nsecs) nsecs_to_jiffies(__nsecs)
#endif
static cputime_t scale_utime(cputime_t utime, cputime_t rtime, cputime_t total)
{
u64 temp = (__force u64) rtime;
temp *= (__force u64) utime;
if (sizeof(cputime_t) == 4)
temp = div_u64(temp, (__force u32) total);
else
temp = div64_u64(temp, (__force u64) total);
return (__force cputime_t) temp;
}
void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
{
cputime_t rtime, utime = p->utime, total = utime + p->stime;
rtime = nsecs_to_cputime(p->se.sum_exec_runtime);
if (total)
utime = scale_utime(utime, rtime, total);
else
utime = rtime;
p->prev_utime = max(p->prev_utime, utime);
p->prev_stime = max(p->prev_stime, rtime - p->prev_utime);
*ut = p->prev_utime;
*st = p->prev_stime;
}
void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st)
{
struct signal_struct *sig = p->signal;
struct task_cputime cputime;
cputime_t rtime, utime, total;
thread_group_cputime(p, &cputime);
total = cputime.utime + cputime.stime;
rtime = nsecs_to_cputime(cputime.sum_exec_runtime);
if (total)
utime = scale_utime(cputime.utime, rtime, total);
else
utime = rtime;
sig->prev_utime = max(sig->prev_utime, utime);
sig->prev_stime = max(sig->prev_stime, rtime - sig->prev_utime);
*ut = sig->prev_utime;
*st = sig->prev_stime;
}
#endif
void scheduler_tick(void)
{
int cpu = smp_processor_id();
struct rq *rq = cpu_rq(cpu);
struct task_struct *curr = rq->curr;
sched_clock_tick();
raw_spin_lock(&rq->lock);
update_rq_clock(rq);
update_cpu_load_active(rq);
curr->sched_class->task_tick(rq, curr, 0);
raw_spin_unlock(&rq->lock);
perf_event_task_tick();
#ifdef CONFIG_SMP
rq->idle_balance = idle_cpu(cpu);
trigger_load_balance(rq, cpu);
#endif
}
notrace unsigned long get_parent_ip(unsigned long addr)
{
if (in_lock_functions(addr)) {
addr = CALLER_ADDR2;
if (in_lock_functions(addr))
addr = CALLER_ADDR3;
}
return addr;
}
#if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \
defined(CONFIG_PREEMPT_TRACER))
void __kprobes add_preempt_count(int val)
{
#ifdef CONFIG_DEBUG_PREEMPT
if (DEBUG_LOCKS_WARN_ON((preempt_count() < 0)))
return;
#endif
preempt_count() += val;
#ifdef CONFIG_DEBUG_PREEMPT
DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >=
PREEMPT_MASK - 10);
#endif
if (preempt_count() == val)
trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));
}
EXPORT_SYMBOL(add_preempt_count);
void __kprobes sub_preempt_count(int val)
{
#ifdef CONFIG_DEBUG_PREEMPT
if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
return;
if (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&
!(preempt_count() & PREEMPT_MASK)))
return;
#endif
if (preempt_count() == val)
trace_preempt_on(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));
preempt_count() -= val;
}
EXPORT_SYMBOL(sub_preempt_count);
#endif
static noinline void __schedule_bug(struct task_struct *prev)
{
if (oops_in_progress)
return;
printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
prev->comm, prev->pid, preempt_count());
debug_show_held_locks(prev);
print_modules();
if (irqs_disabled())
print_irqtrace_events(prev);
dump_stack();
}
static inline void schedule_debug(struct task_struct *prev)
{
if (unlikely(in_atomic_preempt_off() && !prev->exit_state))
__schedule_bug(prev);
rcu_sleep_check();
profile_hit(SCHED_PROFILING, __builtin_return_address(0));
schedstat_inc(this_rq(), sched_count);
}
static void put_prev_task(struct rq *rq, struct task_struct *prev)
{
if (prev->on_rq || rq->skip_clock_update < 0)
update_rq_clock(rq);
prev->sched_class->put_prev_task(rq, prev);
}
static inline struct task_struct *
pick_next_task(struct rq *rq)
{
const struct sched_class *class;
struct task_struct *p;
if (likely(rq->nr_running == rq->cfs.h_nr_running)) {
p = fair_sched_class.pick_next_task(rq);
if (likely(p))
return p;
}
for_each_class(class) {
p = class->pick_next_task(rq);
if (p)
return p;
}
BUG();
}
static void __sched __schedule(void)
{
struct task_struct *prev, *next;
unsigned long *switch_count;
struct rq *rq;
int cpu;
need_resched:
preempt_disable();
cpu = smp_processor_id();
rq = cpu_rq(cpu);
rcu_note_context_switch(cpu);
prev = rq->curr;
schedule_debug(prev);
if (sched_feat(HRTICK))
hrtick_clear(rq);
raw_spin_lock_irq(&rq->lock);
switch_count = &prev->nivcsw;
if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
if (unlikely(signal_pending_state(prev->state, prev))) {
prev->state = TASK_RUNNING;
} else {
deactivate_task(rq, prev, DEQUEUE_SLEEP);
prev->on_rq = 0;
if (prev->flags & PF_WQ_WORKER) {
struct task_struct *to_wakeup;
to_wakeup = wq_worker_sleeping(prev, cpu);
if (to_wakeup)
try_to_wake_up_local(to_wakeup);
}
}
switch_count = &prev->nvcsw;
}
pre_schedule(rq, prev);
if (unlikely(!rq->nr_running))
idle_balance(cpu, rq);
put_prev_task(rq, prev);
next = pick_next_task(rq);
clear_tsk_need_resched(prev);
rq->skip_clock_update = 0;
if (likely(prev != next)) {
rq->nr_switches++;
rq->curr = next;
++*switch_count;
context_switch(rq, prev, next);
cpu = smp_processor_id();
rq = cpu_rq(cpu);
} else
raw_spin_unlock_irq(&rq->lock);
post_schedule(rq);
sched_preempt_enable_no_resched();
if (need_resched())
goto need_resched;
}
static inline void sched_submit_work(struct task_struct *tsk)
{
if (!tsk->state || tsk_is_pi_blocked(tsk))
return;
if (blk_needs_flush_plug(tsk))
blk_schedule_flush_plug(tsk);
}
asmlinkage void __sched schedule(void)
{
struct task_struct *tsk = current;
sched_submit_work(tsk);
__schedule();
}
EXPORT_SYMBOL(schedule);
void __sched schedule_preempt_disabled(void)
{
sched_preempt_enable_no_resched();
schedule();
preempt_disable();
}
#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
{
if (lock->owner != owner)
return false;
barrier();
return owner->on_cpu;
}
int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner)
{
if (!sched_feat(OWNER_SPIN))
return 0;
rcu_read_lock();
while (owner_running(lock, owner)) {
if (need_resched())
break;
arch_mutex_cpu_relax();
}
rcu_read_unlock();
return lock->owner == NULL;
}
#endif
#ifdef CONFIG_PREEMPT
asmlinkage void __sched notrace preempt_schedule(void)
{
struct thread_info *ti = current_thread_info();
if (likely(ti->preempt_count || irqs_disabled()))
return;
do {
add_preempt_count_notrace(PREEMPT_ACTIVE);
__schedule();
sub_preempt_count_notrace(PREEMPT_ACTIVE);
barrier();
} while (need_resched());
}
EXPORT_SYMBOL(preempt_schedule);
asmlinkage void __sched preempt_schedule_irq(void)
{
struct thread_info *ti = current_thread_info();
BUG_ON(ti->preempt_count || !irqs_disabled());
do {
add_preempt_count(PREEMPT_ACTIVE);
local_irq_enable();
__schedule();
local_irq_disable();
sub_preempt_count(PREEMPT_ACTIVE);
barrier();
} while (need_resched());
}
#endif
int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags,
void *key)
{
return try_to_wake_up(curr->private, mode, wake_flags);
}
EXPORT_SYMBOL(default_wake_function);
static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
int nr_exclusive, int wake_flags, void *key)
{
wait_queue_t *curr, *next;
list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
unsigned flags = curr->flags;
if (curr->func(curr, mode, wake_flags, key) &&
(flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
break;
}
}
void __wake_up(wait_queue_head_t *q, unsigned int mode,
int nr_exclusive, void *key)
{
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
__wake_up_common(q, mode, nr_exclusive, 0, key);
spin_unlock_irqrestore(&q->lock, flags);
}
EXPORT_SYMBOL(__wake_up);
void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr)
{
__wake_up_common(q, mode, nr, 0, NULL);
}
EXPORT_SYMBOL_GPL(__wake_up_locked);
void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key)
{
__wake_up_common(q, mode, 1, 0, key);
}
EXPORT_SYMBOL_GPL(__wake_up_locked_key);
void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode,
int nr_exclusive, void *key)
{
unsigned long flags;
int wake_flags = WF_SYNC;
if (unlikely(!q))
return;
if (unlikely(!nr_exclusive))
wake_flags = 0;
spin_lock_irqsave(&q->lock, flags);
__wake_up_common(q, mode, nr_exclusive, wake_flags, key);
spin_unlock_irqrestore(&q->lock, flags);
}
EXPORT_SYMBOL_GPL(__wake_up_sync_key);
void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
{
__wake_up_sync_key(q, mode, nr_exclusive, NULL);
}
EXPORT_SYMBOL_GPL(__wake_up_sync);
void complete(struct completion *x)
{
unsigned long flags;
spin_lock_irqsave(&x->wait.lock, flags);
x->done++;
__wake_up_common(&x->wait, TASK_NORMAL, 1, 0, NULL);
spin_unlock_irqrestore(&x->wait.lock, flags);
}
EXPORT_SYMBOL(complete);
void complete_all(struct completion *x)
{
unsigned long flags;
spin_lock_irqsave(&x->wait.lock, flags);
x->done += UINT_MAX/2;
__wake_up_common(&x->wait, TASK_NORMAL, 0, 0, NULL);
spin_unlock_irqrestore(&x->wait.lock, flags);
}
EXPORT_SYMBOL(complete_all);
static inline long __sched
do_wait_for_common(struct completion *x, long timeout, int state, int iowait)
{
if (!x->done) {
DECLARE_WAITQUEUE(wait, current);
__add_wait_queue_tail_exclusive(&x->wait, &wait);
do {
if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS;
break;
}
__set_current_state(state);
spin_unlock_irq(&x->wait.lock);
if (iowait)
timeout = io_schedule_timeout(timeout);
else
timeout = schedule_timeout(timeout);
spin_lock_irq(&x->wait.lock);
} while (!x->done && timeout);
__remove_wait_queue(&x->wait, &wait);
if (!x->done)
return timeout;
}
x->done--;
return timeout ?: 1;
}
static long __sched
wait_for_common(struct completion *x, long timeout, int state, int iowait)
{
might_sleep();
spin_lock_irq(&x->wait.lock);
timeout = do_wait_for_common(x, timeout, state, iowait);
spin_unlock_irq(&x->wait.lock);
return timeout;
}
void __sched wait_for_completion(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(wait_for_completion);
void __sched wait_for_completion_io(struct completion *x)
{
wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE, 1);
}
EXPORT_SYMBOL(wait_for_completion_io);
unsigned long __sched
wait_for_completion_timeout(struct completion *x, unsigned long timeout)
{
return wait_for_common(x, timeout, TASK_UNINTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(wait_for_completion_timeout);
int __sched wait_for_completion_interruptible(struct completion *x)
{
long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT,
TASK_INTERRUPTIBLE, 0);
if (t == -ERESTARTSYS)
return t;
return 0;
}
EXPORT_SYMBOL(wait_for_completion_interruptible);
long __sched
wait_for_completion_interruptible_timeout(struct completion *x,
unsigned long timeout)
{
return wait_for_common(x, timeout, TASK_INTERRUPTIBLE, 0);
}
EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);
int __sched wait_for_completion_killable(struct completion *x)
{
long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE, 0);
if (t == -ERESTARTSYS)
return t;
return 0;
}
EXPORT_SYMBOL(wait_for_completion_killable);
long __sched
wait_for_completion_killable_timeout(struct completion *x,
unsigned long timeout)
{
return wait_for_common(x, timeout, TASK_KILLABLE, 0);
}
EXPORT_SYMBOL(wait_for_completion_killable_timeout);
bool try_wait_for_completion(struct completion *x)
{
unsigned long flags;
int ret = 1;
spin_lock_irqsave(&x->wait.lock, flags);
if (!x->done)
ret = 0;
else
x->done--;
spin_unlock_irqrestore(&x->wait.lock, flags);
return ret;
}
EXPORT_SYMBOL(try_wait_for_completion);
bool completion_done(struct completion *x)
{
unsigned long flags;
int ret = 1;
spin_lock_irqsave(&x->wait.lock, flags);
if (!x->done)
ret = 0;
spin_unlock_irqrestore(&x->wait.lock, flags);
return ret;
}
EXPORT_SYMBOL(completion_done);
static long __sched
sleep_on_common(wait_queue_head_t *q, int state, long timeout)
{
unsigned long flags;
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
__set_current_state(state);
spin_lock_irqsave(&q->lock, flags);
__add_wait_queue(q, &wait);
spin_unlock(&q->lock);
timeout = schedule_timeout(timeout);
spin_lock_irq(&q->lock);
__remove_wait_queue(q, &wait);
spin_unlock_irqrestore(&q->lock, flags);
return timeout;
}
void __sched interruptible_sleep_on(wait_queue_head_t *q)
{
sleep_on_common(q, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
}
EXPORT_SYMBOL(interruptible_sleep_on);
long __sched
interruptible_sleep_on_timeout(wait_queue_head_t *q, long timeout)
{
return sleep_on_common(q, TASK_INTERRUPTIBLE, timeout);
}
EXPORT_SYMBOL(interruptible_sleep_on_timeout);
void __sched sleep_on(wait_queue_head_t *q)
{
sleep_on_common(q, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
}
EXPORT_SYMBOL(sleep_on);
long __sched sleep_on_timeout(wait_queue_head_t *q, long timeout)
{
return sleep_on_common(q, TASK_UNINTERRUPTIBLE, timeout);
}
EXPORT_SYMBOL(sleep_on_timeout);
#ifdef CONFIG_RT_MUTEXES
void rt_mutex_setprio(struct task_struct *p, int prio)
{
int oldprio, on_rq, running;
struct rq *rq;
const struct sched_class *prev_class;
BUG_ON(prio < 0 || prio > MAX_PRIO);
rq = __task_rq_lock(p);
if (unlikely(p == rq->idle)) {
WARN_ON(p != rq->curr);
WARN_ON(p->pi_blocked_on);
goto out_unlock;
}
trace_sched_pi_setprio(p, prio);
oldprio = p->prio;
prev_class = p->sched_class;
on_rq = p->on_rq;
running = task_current(rq, p);
if (on_rq)
dequeue_task(rq, p, 0);
if (running)
p->sched_class->put_prev_task(rq, p);
if (rt_prio(prio))
p->sched_class = &rt_sched_class;
else
p->sched_class = &fair_sched_class;
p->prio = prio;
if (running)
p->sched_class->set_curr_task(rq);
if (on_rq)
enqueue_task(rq, p, oldprio < prio ? ENQUEUE_HEAD : 0);
check_class_changed(rq, p, prev_class, oldprio);
out_unlock:
__task_rq_unlock(rq);
}
#endif
void set_user_nice(struct task_struct *p, long nice)
{
int old_prio, delta, on_rq;
unsigned long flags;
struct rq *rq;
if (TASK_NICE(p) == nice || nice < -20 || nice > 19)
return;
rq = task_rq_lock(p, &flags);
if (task_has_rt_policy(p)) {
p->static_prio = NICE_TO_PRIO(nice);
goto out_unlock;
}
on_rq = p->on_rq;
if (on_rq)
dequeue_task(rq, p, 0);
p->static_prio = NICE_TO_PRIO(nice);
set_load_weight(p);
old_prio = p->prio;
p->prio = effective_prio(p);
delta = p->prio - old_prio;
if (on_rq) {
enqueue_task(rq, p, 0);
if (delta < 0 || (delta > 0 && task_running(rq, p)))
resched_task(rq->curr);
}
out_unlock:
task_rq_unlock(rq, p, &flags);
}
EXPORT_SYMBOL(set_user_nice);
int can_nice(const struct task_struct *p, const int nice)
{
int nice_rlim = 20 - nice;
return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
capable(CAP_SYS_NICE));
}
#ifdef __ARCH_WANT_SYS_NICE
SYSCALL_DEFINE1(nice, int, increment)
{
long nice, retval;
if (increment < -40)
increment = -40;
if (increment > 40)
increment = 40;
nice = TASK_NICE(current) + increment;
if (nice < -20)
nice = -20;
if (nice > 19)
nice = 19;
if (increment < 0 && !can_nice(current, nice))
return -EPERM;
retval = security_task_setnice(current, nice);
if (retval)
return retval;
set_user_nice(current, nice);
return 0;
}
#endif
int task_prio(const struct task_struct *p)
{
return p->prio - MAX_RT_PRIO;
}
int task_nice(const struct task_struct *p)
{
return TASK_NICE(p);
}
EXPORT_SYMBOL(task_nice);
int idle_cpu(int cpu)
{
struct rq *rq = cpu_rq(cpu);
if (rq->curr != rq->idle)
return 0;
if (rq->nr_running)
return 0;
#ifdef CONFIG_SMP
if (!llist_empty(&rq->wake_list))
return 0;
#endif
return 1;
}
struct task_struct *idle_task(int cpu)
{
return cpu_rq(cpu)->idle;
}
static struct task_struct *find_process_by_pid(pid_t pid)
{
return pid ? find_task_by_vpid(pid) : current;
}
static void
__setscheduler(struct rq *rq, struct task_struct *p, int policy, int prio)
{
p->policy = policy;
p->rt_priority = prio;
p->normal_prio = normal_prio(p);
p->prio = rt_mutex_getprio(p);
if (rt_prio(p->prio))
p->sched_class = &rt_sched_class;
else
p->sched_class = &fair_sched_class;
set_load_weight(p);
}
static bool check_same_owner(struct task_struct *p)
{
const struct cred *cred = current_cred(), *pcred;
bool match;
rcu_read_lock();
pcred = __task_cred(p);
if (cred->user->user_ns == pcred->user->user_ns)
match = (cred->euid == pcred->euid ||
cred->euid == pcred->uid);
else
match = false;
rcu_read_unlock();
return match;
}
static int __sched_setscheduler(struct task_struct *p, int policy,
const struct sched_param *param, bool user)
{
int retval, oldprio, oldpolicy = -1, on_rq, running;
unsigned long flags;
const struct sched_class *prev_class;
struct rq *rq;
int reset_on_fork;
BUG_ON(in_interrupt());
recheck:
if (policy < 0) {
reset_on_fork = p->sched_reset_on_fork;
policy = oldpolicy = p->policy;
} else {
reset_on_fork = !!(policy & SCHED_RESET_ON_FORK);
policy &= ~SCHED_RESET_ON_FORK;
if (policy != SCHED_FIFO && policy != SCHED_RR &&
policy != SCHED_NORMAL && policy != SCHED_BATCH &&
policy != SCHED_IDLE)
return -EINVAL;
}
if (param->sched_priority < 0 ||
(p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||
(!p->mm && param->sched_priority > MAX_RT_PRIO-1))
return -EINVAL;
if (rt_policy(policy) != (param->sched_priority != 0))
return -EINVAL;
if (user && !capable(CAP_SYS_NICE)) {
if (rt_policy(policy)) {
unsigned long rlim_rtprio =
task_rlimit(p, RLIMIT_RTPRIO);
if (policy != p->policy && !rlim_rtprio)
return -EPERM;
if (param->sched_priority > p->rt_priority &&
param->sched_priority > rlim_rtprio)
return -EPERM;
}
if (p->policy == SCHED_IDLE && policy != SCHED_IDLE) {
if (!can_nice(p, TASK_NICE(p)))
return -EPERM;
}
if (!check_same_owner(p))
return -EPERM;
if (p->sched_reset_on_fork && !reset_on_fork)
return -EPERM;
}
if (user) {
retval = security_task_setscheduler(p);
if (retval)
return retval;
}
rq = task_rq_lock(p, &flags);
if (p == rq->stop) {
task_rq_unlock(rq, p, &flags);
return -EINVAL;
}
if (unlikely(policy == p->policy && (!rt_policy(policy) ||
param->sched_priority == p->rt_priority))) {
__task_rq_unlock(rq);
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
return 0;
}
#ifdef CONFIG_RT_GROUP_SCHED
if (user) {
if (rt_bandwidth_enabled() && rt_policy(policy) &&
task_group(p)->rt_bandwidth.rt_runtime == 0 &&
!task_group_is_autogroup(task_group(p))) {
task_rq_unlock(rq, p, &flags);
return -EPERM;
}
}
#endif
if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
policy = oldpolicy = -1;
task_rq_unlock(rq, p, &flags);
goto recheck;
}
on_rq = p->on_rq;
running = task_current(rq, p);
if (on_rq)
dequeue_task(rq, p, 0);
if (running)
p->sched_class->put_prev_task(rq, p);
p->sched_reset_on_fork = reset_on_fork;
oldprio = p->prio;
prev_class = p->sched_class;
__setscheduler(rq, p, policy, param->sched_priority);
if (running)
p->sched_class->set_curr_task(rq);
if (on_rq)
enqueue_task(rq, p, 0);
check_class_changed(rq, p, prev_class, oldprio);
task_rq_unlock(rq, p, &flags);
rt_mutex_adjust_pi(p);
return 0;
}
int sched_setscheduler(struct task_struct *p, int policy,
const struct sched_param *param)
{
return __sched_setscheduler(p, policy, param, true);
}
EXPORT_SYMBOL_GPL(sched_setscheduler);
int sched_setscheduler_nocheck(struct task_struct *p, int policy,
const struct sched_param *param)
{
return __sched_setscheduler(p, policy, param, false);
}
static int
do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
{
struct sched_param lparam;
struct task_struct *p;
int retval;
if (!param || pid < 0)
return -EINVAL;
if (copy_from_user(&lparam, param, sizeof(struct sched_param)))
return -EFAULT;
rcu_read_lock();
retval = -ESRCH;
p = find_process_by_pid(pid);
if (p != NULL)
retval = sched_setscheduler(p, policy, &lparam);
rcu_read_unlock();
return retval;
}
SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
struct sched_param __user *, param)
{
if (policy < 0)
return -EINVAL;
return do_sched_setscheduler(pid, policy, param);
}
SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
{
return do_sched_setscheduler(pid, -1, param);
}
SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
{
struct task_struct *p;
int retval;
if (pid < 0)
return -EINVAL;
retval = -ESRCH;
rcu_read_lock();
p = find_process_by_pid(pid);
if (p) {
retval = security_task_getscheduler(p);
if (!retval)
retval = p->policy
| (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0);
}
rcu_read_unlock();
return retval;
}
SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
{
struct sched_param lp;
struct task_struct *p;
int retval;
if (!param || pid < 0)
return -EINVAL;
rcu_read_lock();
p = find_process_by_pid(pid);
retval = -ESRCH;
if (!p)
goto out_unlock;
retval = security_task_getscheduler(p);
if (retval)
goto out_unlock;
lp.sched_priority = p->rt_priority;
rcu_read_unlock();
retval = copy_to_user(param, &lp, sizeof(*param)) ? -EFAULT : 0;
return retval;
out_unlock:
rcu_read_unlock();
return retval;
}
long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
{
cpumask_var_t cpus_allowed, new_mask;
struct task_struct *p;
int retval;
get_online_cpus();
rcu_read_lock();
p = find_process_by_pid(pid);
if (!p) {
rcu_read_unlock();
put_online_cpus();
return -ESRCH;
}
get_task_struct(p);
rcu_read_unlock();
if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) {
retval = -ENOMEM;
goto out_put_task;
}
if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) {
retval = -ENOMEM;
goto out_free_cpus_allowed;
}
retval = -EPERM;
if (!check_same_owner(p) && !ns_capable(task_user_ns(p), CAP_SYS_NICE))
goto out_unlock;
retval = security_task_setscheduler(p);
if (retval)
goto out_unlock;
cpuset_cpus_allowed(p, cpus_allowed);
cpumask_and(new_mask, in_mask, cpus_allowed);
again:
retval = set_cpus_allowed_ptr(p, new_mask);
if (!retval) {
cpuset_cpus_allowed(p, cpus_allowed);
if (!cpumask_subset(new_mask, cpus_allowed)) {
cpumask_copy(new_mask, cpus_allowed);
goto again;
}
}
out_unlock:
free_cpumask_var(new_mask);
out_free_cpus_allowed:
free_cpumask_var(cpus_allowed);
out_put_task:
put_task_struct(p);
put_online_cpus();
return retval;
}
static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
struct cpumask *new_mask)
{
if (len < cpumask_size())
cpumask_clear(new_mask);
else if (len > cpumask_size())
len = cpumask_size();
return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0;
}
SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
unsigned long __user *, user_mask_ptr)
{
cpumask_var_t new_mask;
int retval;
if (!alloc_cpumask_var(&new_mask, GFP_KERNEL))
return -ENOMEM;
retval = get_user_cpu_mask(user_mask_ptr, len, new_mask);
if (retval == 0)
retval = sched_setaffinity(pid, new_mask);
free_cpumask_var(new_mask);
return retval;
}
long sched_getaffinity(pid_t pid, struct cpumask *mask)
{
struct task_struct *p;
unsigned long flags;
int retval;
get_online_cpus();
rcu_read_lock();
retval = -ESRCH;
p = find_process_by_pid(pid);
if (!p)
goto out_unlock;
retval = security_task_getscheduler(p);
if (retval)
goto out_unlock;
raw_spin_lock_irqsave(&p->pi_lock, flags);
cpumask_and(mask, &p->cpus_allowed, cpu_online_mask);
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
out_unlock:
rcu_read_unlock();
put_online_cpus();
return retval;
}
SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
unsigned long __user *, user_mask_ptr)
{
int ret;
cpumask_var_t mask;
if ((len * BITS_PER_BYTE) < nr_cpu_ids)
return -EINVAL;
if (len & (sizeof(unsigned long)-1))
return -EINVAL;
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
return -ENOMEM;
ret = sched_getaffinity(pid, mask);
if (ret == 0) {
size_t retlen = min_t(size_t, len, cpumask_size());
if (copy_to_user(user_mask_ptr, mask, retlen))
ret = -EFAULT;
else
ret = retlen;
}
free_cpumask_var(mask);
return ret;
}
SYSCALL_DEFINE0(sched_yield)
{
struct rq *rq = this_rq_lock();
schedstat_inc(rq, yld_count);
current->sched_class->yield_task(rq);
__release(rq->lock);
spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
do_raw_spin_unlock(&rq->lock);
sched_preempt_enable_no_resched();
schedule();
return 0;
}
static inline int should_resched(void)
{
return need_resched() && !(preempt_count() & PREEMPT_ACTIVE);
}
static void __cond_resched(void)
{
add_preempt_count(PREEMPT_ACTIVE);
__schedule();
sub_preempt_count(PREEMPT_ACTIVE);
}
int __sched _cond_resched(void)
{
if (should_resched()) {
__cond_resched();
return 1;
}
return 0;
}
EXPORT_SYMBOL(_cond_resched);
int __cond_resched_lock(spinlock_t *lock)
{
int resched = should_resched();
int ret = 0;
lockdep_assert_held(lock);
if (spin_needbreak(lock) || resched) {
spin_unlock(lock);
if (resched)
__cond_resched();
else
cpu_relax();
ret = 1;
spin_lock(lock);
}
return ret;
}
EXPORT_SYMBOL(__cond_resched_lock);
int __sched __cond_resched_softirq(void)
{
BUG_ON(!in_softirq());
if (should_resched()) {
local_bh_enable();
__cond_resched();
local_bh_disable();
return 1;
}
return 0;
}
EXPORT_SYMBOL(__cond_resched_softirq);
void __sched yield(void)
{
set_current_state(TASK_RUNNING);
sys_sched_yield();
}
EXPORT_SYMBOL(yield);
bool __sched yield_to(struct task_struct *p, bool preempt)
{
struct task_struct *curr = current;
struct rq *rq, *p_rq;
unsigned long flags;
bool yielded = 0;
local_irq_save(flags);
rq = this_rq();
again:
p_rq = task_rq(p);
double_rq_lock(rq, p_rq);
while (task_rq(p) != p_rq) {
double_rq_unlock(rq, p_rq);
goto again;
}
if (!curr->sched_class->yield_to_task)
goto out;
if (curr->sched_class != p->sched_class)
goto out;
if (task_running(p_rq, p) || p->state)
goto out;
yielded = curr->sched_class->yield_to_task(rq, p, preempt);
if (yielded) {
schedstat_inc(rq, yld_count);
if (preempt && rq != p_rq)
resched_task(p_rq->curr);
} else {
rq->skip_clock_update = 0;
}
out:
double_rq_unlock(rq, p_rq);
local_irq_restore(flags);
if (yielded)
schedule();
return yielded;
}
EXPORT_SYMBOL_GPL(yield_to);
void __sched io_schedule(void)
{
struct rq *rq = raw_rq();
delayacct_blkio_start();
atomic_inc(&rq->nr_iowait);
blk_flush_plug(current);
current->in_iowait = 1;
schedule();
current->in_iowait = 0;
atomic_dec(&rq->nr_iowait);
delayacct_blkio_end();
}
EXPORT_SYMBOL(io_schedule);
long __sched io_schedule_timeout(long timeout)
{
struct rq *rq = raw_rq();
long ret;
delayacct_blkio_start();
atomic_inc(&rq->nr_iowait);
blk_flush_plug(current);
current->in_iowait = 1;
ret = schedule_timeout(timeout);
current->in_iowait = 0;
atomic_dec(&rq->nr_iowait);
delayacct_blkio_end();
return ret;
}
SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
{
int ret = -EINVAL;
switch (policy) {
case SCHED_FIFO:
case SCHED_RR:
ret = MAX_USER_RT_PRIO-1;
break;
case SCHED_NORMAL:
case SCHED_BATCH:
case SCHED_IDLE:
ret = 0;
break;
}
return ret;
}
SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
{
int ret = -EINVAL;
switch (policy) {
case SCHED_FIFO:
case SCHED_RR:
ret = 1;
break;
case SCHED_NORMAL:
case SCHED_BATCH:
case SCHED_IDLE:
ret = 0;
}
return ret;
}
SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
struct timespec __user *, interval)
{
struct task_struct *p;
unsigned int time_slice;
unsigned long flags;
struct rq *rq;
int retval;
struct timespec t;
if (pid < 0)
return -EINVAL;
retval = -ESRCH;
rcu_read_lock();
p = find_process_by_pid(pid);
if (!p)
goto out_unlock;
retval = security_task_getscheduler(p);
if (retval)
goto out_unlock;
rq = task_rq_lock(p, &flags);
time_slice = p->sched_class->get_rr_interval(rq, p);
task_rq_unlock(rq, p, &flags);
rcu_read_unlock();
jiffies_to_timespec(time_slice, &t);
retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;
return retval;
out_unlock:
rcu_read_unlock();
return retval;
}
static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
void sched_show_task(struct task_struct *p)
{
unsigned long free = 0;
unsigned state;
state = p->state ? __ffs(p->state) + 1 : 0;
printk(KERN_INFO "%-15.15s %c", p->comm,
state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
#if BITS_PER_LONG == 32
if (state == TASK_RUNNING)
printk(KERN_CONT " running ");
else
printk(KERN_CONT " %08lx ", thread_saved_pc(p));
#else
if (state == TASK_RUNNING)
printk(KERN_CONT " running task ");
else
printk(KERN_CONT " %016lx ", thread_saved_pc(p));
#endif
#ifdef CONFIG_DEBUG_STACK_USAGE
free = stack_not_used(p);
#endif
printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
task_pid_nr(p), task_pid_nr(rcu_dereference(p->real_parent)),
(unsigned long)task_thread_info(p)->flags);
show_stack(p, NULL);
}
void show_state_filter(unsigned long state_filter)
{
struct task_struct *g, *p;
#if BITS_PER_LONG == 32
printk(KERN_INFO
" task PC stack pid father\n");
#else
printk(KERN_INFO
" task PC stack pid father\n");
#endif
rcu_read_lock();
do_each_thread(g, p) {
touch_nmi_watchdog();
if (!state_filter || (p->state & state_filter))
sched_show_task(p);
} while_each_thread(g, p);
touch_all_softlockup_watchdogs();
#ifdef CONFIG_SCHED_DEBUG
sysrq_sched_debug_show();
#endif
rcu_read_unlock();
if (!state_filter)
debug_show_all_locks();
}
void __cpuinit init_idle_bootup_task(struct task_struct *idle)
{
idle->sched_class = &idle_sched_class;
}
void __cpuinit init_idle(struct task_struct *idle, int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long flags;
raw_spin_lock_irqsave(&rq->lock, flags);
__sched_fork(idle);
idle->state = TASK_RUNNING;
idle->se.exec_start = sched_clock();
do_set_cpus_allowed(idle, cpumask_of(cpu));
rcu_read_lock();
__set_task_cpu(idle, cpu);
rcu_read_unlock();
rq->curr = rq->idle = idle;
#if defined(CONFIG_SMP)
idle->on_cpu = 1;
#endif
raw_spin_unlock_irqrestore(&rq->lock, flags);
task_thread_info(idle)->preempt_count = 0;
idle->sched_class = &idle_sched_class;
ftrace_graph_init_idle_task(idle, cpu);
#if defined(CONFIG_SMP)
sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
#endif
}
#ifdef CONFIG_SMP
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
{
if (p->sched_class && p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, new_mask);
cpumask_copy(&p->cpus_allowed, new_mask);
p->rt.nr_cpus_allowed = cpumask_weight(new_mask);
}
int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
{
unsigned long flags;
struct rq *rq;
unsigned int dest_cpu;
int ret = 0;
rq = task_rq_lock(p, &flags);
if (cpumask_equal(&p->cpus_allowed, new_mask))
goto out;
if (!cpumask_intersects(new_mask, cpu_active_mask)) {
ret = -EINVAL;
goto out;
}
if (unlikely((p->flags & PF_THREAD_BOUND) && p != current)) {
ret = -EINVAL;
goto out;
}
do_set_cpus_allowed(p, new_mask);
if (cpumask_test_cpu(task_cpu(p), new_mask))
goto out;
dest_cpu = cpumask_any_and(cpu_active_mask, new_mask);
if (p->on_rq) {
struct migration_arg arg = { p, dest_cpu };
task_rq_unlock(rq, p, &flags);
stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg);
tlb_migrate_finish(p->mm);
return 0;
}
out:
task_rq_unlock(rq, p, &flags);
return ret;
}
EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
{
struct rq *rq_dest, *rq_src;
int ret = 0;
if (unlikely(!cpu_active(dest_cpu)))
return ret;
rq_src = cpu_rq(src_cpu);
rq_dest = cpu_rq(dest_cpu);
raw_spin_lock(&p->pi_lock);
double_rq_lock(rq_src, rq_dest);
if (task_cpu(p) != src_cpu)
goto done;
if (!cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
goto fail;
if (p->on_rq) {
dequeue_task(rq_src, p, 0);
set_task_cpu(p, dest_cpu);
enqueue_task(rq_dest, p, 0);
check_preempt_curr(rq_dest, p, 0);
}
done:
ret = 1;
fail:
double_rq_unlock(rq_src, rq_dest);
raw_spin_unlock(&p->pi_lock);
return ret;
}
static int migration_cpu_stop(void *data)
{
struct migration_arg *arg = data;
local_irq_disable();
__migrate_task(arg->task, raw_smp_processor_id(), arg->dest_cpu);
local_irq_enable();
return 0;
}
#ifdef CONFIG_HOTPLUG_CPU
void idle_task_exit(void)
{
struct mm_struct *mm = current->active_mm;
BUG_ON(cpu_online(smp_processor_id()));
if (mm != &init_mm)
switch_mm(mm, &init_mm, current);
mmdrop(mm);
}
static void migrate_nr_uninterruptible(struct rq *rq_src)
{
struct rq *rq_dest = cpu_rq(cpumask_any(cpu_active_mask));
rq_dest->nr_uninterruptible += rq_src->nr_uninterruptible;
rq_src->nr_uninterruptible = 0;
}
static void calc_global_load_remove(struct rq *rq)
{
atomic_long_sub(rq->calc_load_active, &calc_load_tasks);
rq->calc_load_active = 0;
}
static void migrate_tasks(unsigned int dead_cpu)
{
struct rq *rq = cpu_rq(dead_cpu);
struct task_struct *next, *stop = rq->stop;
int dest_cpu;
rq->stop = NULL;
unthrottle_offline_cfs_rqs(rq);
for ( ; ; ) {
if (rq->nr_running == 1)
break;
next = pick_next_task(rq);
BUG_ON(!next);
next->sched_class->put_prev_task(rq, next);
dest_cpu = select_fallback_rq(dead_cpu, next);
raw_spin_unlock(&rq->lock);
__migrate_task(next, dead_cpu, dest_cpu);
raw_spin_lock(&rq->lock);
}
rq->stop = stop;
}
#endif
#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL)
static struct ctl_table sd_ctl_dir[] = {
{
.procname = "sched_domain",
.mode = 0555,
},
{}
};
static struct ctl_table sd_ctl_root[] = {
{
.procname = "kernel",
.mode = 0555,
.child = sd_ctl_dir,
},
{}
};
static struct ctl_table *sd_alloc_ctl_entry(int n)
{
struct ctl_table *entry =
kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL);
return entry;
}
static void sd_free_ctl_entry(struct ctl_table **tablep)
{
struct ctl_table *entry;
for (entry = *tablep; entry->mode; entry++) {
if (entry->child)
sd_free_ctl_entry(&entry->child);
if (entry->proc_handler == NULL)
kfree(entry->procname);
}
kfree(*tablep);
*tablep = NULL;
}
static void
set_table_entry(struct ctl_table *entry,
const char *procname, void *data, int maxlen,
umode_t mode, proc_handler *proc_handler)
{
entry->procname = procname;
entry->data = data;
entry->maxlen = maxlen;
entry->mode = mode;
entry->proc_handler = proc_handler;
}
static struct ctl_table *
sd_alloc_ctl_domain_table(struct sched_domain *sd)
{
struct ctl_table *table = sd_alloc_ctl_entry(13);
if (table == NULL)
return NULL;
set_table_entry(&table[0], "min_interval", &sd->min_interval,
sizeof(long), 0644, proc_doulongvec_minmax);
set_table_entry(&table[1], "max_interval", &sd->max_interval,
sizeof(long), 0644, proc_doulongvec_minmax);
set_table_entry(&table[2], "busy_idx", &sd->busy_idx,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[3], "idle_idx", &sd->idle_idx,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[4], "newidle_idx", &sd->newidle_idx,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[5], "wake_idx", &sd->wake_idx,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[6], "forkexec_idx", &sd->forkexec_idx,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[7], "busy_factor", &sd->busy_factor,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[8], "imbalance_pct", &sd->imbalance_pct,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[9], "cache_nice_tries",
&sd->cache_nice_tries,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[10], "flags", &sd->flags,
sizeof(int), 0644, proc_dointvec_minmax);
set_table_entry(&table[11], "name", sd->name,
CORENAME_MAX_SIZE, 0444, proc_dostring);
return table;
}
static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
{
struct ctl_table *entry, *table;
struct sched_domain *sd;
int domain_num = 0, i;
char buf[32];
for_each_domain(cpu, sd)
domain_num++;
entry = table = sd_alloc_ctl_entry(domain_num + 1);
if (table == NULL)
return NULL;
i = 0;
for_each_domain(cpu, sd) {
snprintf(buf, 32, "domain%d", i);
entry->procname = kstrdup(buf, GFP_KERNEL);
entry->mode = 0555;
entry->child = sd_alloc_ctl_domain_table(sd);
entry++;
i++;
}
return table;
}
static struct ctl_table_header *sd_sysctl_header;
static void register_sched_domain_sysctl(void)
{
int i, cpu_num = num_possible_cpus();
struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
char buf[32];
WARN_ON(sd_ctl_dir[0].child);
sd_ctl_dir[0].child = entry;
if (entry == NULL)
return;
for_each_possible_cpu(i) {
snprintf(buf, 32, "cpu%d", i);
entry->procname = kstrdup(buf, GFP_KERNEL);
entry->mode = 0555;
entry->child = sd_alloc_ctl_cpu_table(i);
entry++;
}
WARN_ON(sd_sysctl_header);
sd_sysctl_header = register_sysctl_table(sd_ctl_root);
}
static void unregister_sched_domain_sysctl(void)
{
if (sd_sysctl_header)
unregister_sysctl_table(sd_sysctl_header);
sd_sysctl_header = NULL;
if (sd_ctl_dir[0].child)
sd_free_ctl_entry(&sd_ctl_dir[0].child);
}
#else
static void register_sched_domain_sysctl(void)
{
}
static void unregister_sched_domain_sysctl(void)
{
}
#endif
static void set_rq_online(struct rq *rq)
{
if (!rq->online) {
const struct sched_class *class;
cpumask_set_cpu(rq->cpu, rq->rd->online);
rq->online = 1;
for_each_class(class) {
if (class->rq_online)
class->rq_online(rq);
}
}
}
static void set_rq_offline(struct rq *rq)
{
if (rq->online) {
const struct sched_class *class;
for_each_class(class) {
if (class->rq_offline)
class->rq_offline(rq);
}
cpumask_clear_cpu(rq->cpu, rq->rd->online);
rq->online = 0;
}
}
static int __cpuinit
migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
{
int cpu = (long)hcpu;
unsigned long flags;
struct rq *rq = cpu_rq(cpu);
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_UP_PREPARE:
rq->calc_load_update = calc_load_update;
break;
case CPU_ONLINE:
raw_spin_lock_irqsave(&rq->lock, flags);
if (rq->rd) {
BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
set_rq_online(rq);
}
raw_spin_unlock_irqrestore(&rq->lock, flags);
break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_DYING:
sched_ttwu_pending();
raw_spin_lock_irqsave(&rq->lock, flags);
if (rq->rd) {
BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
set_rq_offline(rq);
}
migrate_tasks(cpu);
BUG_ON(rq->nr_running != 1);
raw_spin_unlock_irqrestore(&rq->lock, flags);
migrate_nr_uninterruptible(rq);
calc_global_load_remove(rq);
break;
#endif
}
update_max_interval();
return NOTIFY_OK;
}
static struct notifier_block __cpuinitdata migration_notifier = {
.notifier_call = migration_call,
.priority = CPU_PRI_MIGRATION,
};
static int __cpuinit sched_cpu_active(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_STARTING:
case CPU_DOWN_FAILED:
set_cpu_active((long)hcpu, true);
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
static int __cpuinit sched_cpu_inactive(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DOWN_PREPARE:
set_cpu_active((long)hcpu, false);
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
static int __init migration_init(void)
{
void *cpu = (void *)(long)smp_processor_id();
int err;
err = migration_call(&migration_notifier, CPU_UP_PREPARE, cpu);
BUG_ON(err == NOTIFY_BAD);
migration_call(&migration_notifier, CPU_ONLINE, cpu);
register_cpu_notifier(&migration_notifier);
cpu_notifier(sched_cpu_active, CPU_PRI_SCHED_ACTIVE);
cpu_notifier(sched_cpu_inactive, CPU_PRI_SCHED_INACTIVE);
return 0;
}
early_initcall(migration_init);
#endif
#ifdef CONFIG_SMP
static cpumask_var_t sched_domains_tmpmask;
#ifdef CONFIG_SCHED_DEBUG
static __read_mostly int sched_domain_debug_enabled;
static int __init sched_domain_debug_setup(char *str)
{
sched_domain_debug_enabled = 1;
return 0;
}
early_param("sched_debug", sched_domain_debug_setup);
static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
struct cpumask *groupmask)
{
struct sched_group *group = sd->groups;
char str[256];
cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd));
cpumask_clear(groupmask);
printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
if (!(sd->flags & SD_LOAD_BALANCE)) {
printk("does not load-balance\n");
if (sd->parent)
printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
" has parent");
return -1;
}
printk(KERN_CONT "span %s level %s\n", str, sd->name);
if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
printk(KERN_ERR "ERROR: domain->span does not contain "
"CPU%d\n", cpu);
}
if (!cpumask_test_cpu(cpu, sched_group_cpus(group))) {
printk(KERN_ERR "ERROR: domain->groups does not contain"
" CPU%d\n", cpu);
}
printk(KERN_DEBUG "%*s groups:", level + 1, "");
do {
if (!group) {
printk("\n");
printk(KERN_ERR "ERROR: group is NULL\n");
break;
}
if (!group->sgp->power) {
printk(KERN_CONT "\n");
printk(KERN_ERR "ERROR: domain->cpu_power not "
"set\n");
break;
}
if (!cpumask_weight(sched_group_cpus(group))) {
printk(KERN_CONT "\n");
printk(KERN_ERR "ERROR: empty group\n");
break;
}
if (cpumask_intersects(groupmask, sched_group_cpus(group))) {
printk(KERN_CONT "\n");
printk(KERN_ERR "ERROR: repeated CPUs\n");
break;
}
cpumask_or(groupmask, groupmask, sched_group_cpus(group));
cpulist_scnprintf(str, sizeof(str), sched_group_cpus(group));
printk(KERN_CONT " %s", str);
if (group->sgp->power != SCHED_POWER_SCALE) {
printk(KERN_CONT " (cpu_power = %d)",
group->sgp->power);
}
group = group->next;
} while (group != sd->groups);
printk(KERN_CONT "\n");
if (!cpumask_equal(sched_domain_span(sd), groupmask))
printk(KERN_ERR "ERROR: groups don't span domain->span\n");
if (sd->parent &&
!cpumask_subset(groupmask, sched_domain_span(sd->parent)))
printk(KERN_ERR "ERROR: parent span is not a superset "
"of domain->span\n");
return 0;
}
static void sched_domain_debug(struct sched_domain *sd, int cpu)
{
int level = 0;
if (!sched_domain_debug_enabled)
return;
if (!sd) {
printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
return;
}
printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
for (;;) {
if (sched_domain_debug_one(sd, cpu, level, sched_domains_tmpmask))
break;
level++;
sd = sd->parent;
if (!sd)
break;
}
}
#else
# define sched_domain_debug(sd, cpu) do { } while (0)
#endif
static int sd_degenerate(struct sched_domain *sd)
{
if (cpumask_weight(sched_domain_span(sd)) == 1)
return 1;
if (sd->flags & (SD_LOAD_BALANCE |
SD_BALANCE_NEWIDLE |
SD_BALANCE_FORK |
SD_BALANCE_EXEC |
SD_SHARE_CPUPOWER |
SD_SHARE_PKG_RESOURCES)) {
if (sd->groups != sd->groups->next)
return 0;
}
if (sd->flags & (SD_WAKE_AFFINE))
return 0;
return 1;
}
static int
sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
{
unsigned long cflags = sd->flags, pflags = parent->flags;
if (sd_degenerate(parent))
return 1;
if (!cpumask_equal(sched_domain_span(sd), sched_domain_span(parent)))
return 0;
if (parent->groups == parent->groups->next) {
pflags &= ~(SD_LOAD_BALANCE |
SD_BALANCE_NEWIDLE |
SD_BALANCE_FORK |
SD_BALANCE_EXEC |
SD_SHARE_CPUPOWER |
SD_SHARE_PKG_RESOURCES);
if (nr_node_ids == 1)
pflags &= ~SD_SERIALIZE;
}
if (~cflags & pflags)
return 0;
return 1;
}
static void free_rootdomain(struct rcu_head *rcu)
{
struct root_domain *rd = container_of(rcu, struct root_domain, rcu);
cpupri_cleanup(&rd->cpupri);
free_cpumask_var(rd->rto_mask);
free_cpumask_var(rd->online);
free_cpumask_var(rd->span);
kfree(rd);
}
static void rq_attach_root(struct rq *rq, struct root_domain *rd)
{
struct root_domain *old_rd = NULL;
unsigned long flags;
raw_spin_lock_irqsave(&rq->lock, flags);
if (rq->rd) {
old_rd = rq->rd;
if (cpumask_test_cpu(rq->cpu, old_rd->online))
set_rq_offline(rq);
cpumask_clear_cpu(rq->cpu, old_rd->span);
if (!atomic_dec_and_test(&old_rd->refcount))
old_rd = NULL;
}
atomic_inc(&rd->refcount);
rq->rd = rd;
cpumask_set_cpu(rq->cpu, rd->span);
if (cpumask_test_cpu(rq->cpu, cpu_active_mask))
set_rq_online(rq);
raw_spin_unlock_irqrestore(&rq->lock, flags);
if (old_rd)
call_rcu_sched(&old_rd->rcu, free_rootdomain);
}
static int init_rootdomain(struct root_domain *rd)
{
memset(rd, 0, sizeof(*rd));
if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
goto out;
if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
goto free_span;
if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
goto free_online;
if (cpupri_init(&rd->cpupri) != 0)
goto free_rto_mask;
return 0;
free_rto_mask:
free_cpumask_var(rd->rto_mask);
free_online:
free_cpumask_var(rd->online);
free_span:
free_cpumask_var(rd->span);
out:
return -ENOMEM;
}
struct root_domain def_root_domain;
static void init_defrootdomain(void)
{
init_rootdomain(&def_root_domain);
atomic_set(&def_root_domain.refcount, 1);
}
static struct root_domain *alloc_rootdomain(void)
{
struct root_domain *rd;
rd = kmalloc(sizeof(*rd), GFP_KERNEL);
if (!rd)
return NULL;
if (init_rootdomain(rd) != 0) {
kfree(rd);
return NULL;
}
return rd;
}
static void free_sched_groups(struct sched_group *sg, int free_sgp)
{
struct sched_group *tmp, *first;
if (!sg)
return;
first = sg;
do {
tmp = sg->next;
if (free_sgp && atomic_dec_and_test(&sg->sgp->ref))
kfree(sg->sgp);
kfree(sg);
sg = tmp;
} while (sg != first);
}
static void free_sched_domain(struct rcu_head *rcu)
{
struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu);
if (sd->flags & SD_OVERLAP) {
free_sched_groups(sd->groups, 1);
} else if (atomic_dec_and_test(&sd->groups->ref)) {
kfree(sd->groups->sgp);
kfree(sd->groups);
}
kfree(sd);
}
static void destroy_sched_domain(struct sched_domain *sd, int cpu)
{
call_rcu(&sd->rcu, free_sched_domain);
}
static void destroy_sched_domains(struct sched_domain *sd, int cpu)
{
for (; sd; sd = sd->parent)
destroy_sched_domain(sd, cpu);
}
DEFINE_PER_CPU(struct sched_domain *, sd_llc);
DEFINE_PER_CPU(int, sd_llc_id);
static void update_top_cache_domain(int cpu)
{
struct sched_domain *sd;
int id = cpu;
sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES);
if (sd)
id = cpumask_first(sched_domain_span(sd));
rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
per_cpu(sd_llc_id, cpu) = id;
}
static void
cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
{
struct rq *rq = cpu_rq(cpu);
struct sched_domain *tmp;
for (tmp = sd; tmp; ) {
struct sched_domain *parent = tmp->parent;
if (!parent)
break;
if (sd_parent_degenerate(tmp, parent)) {
tmp->parent = parent->parent;
if (parent->parent)
parent->parent->child = tmp;
destroy_sched_domain(parent, cpu);
} else
tmp = tmp->parent;
}
if (sd && sd_degenerate(sd)) {
tmp = sd;
sd = sd->parent;
destroy_sched_domain(tmp, cpu);
if (sd)
sd->child = NULL;
}
sched_domain_debug(sd, cpu);
rq_attach_root(rq, rd);
tmp = rq->sd;
rcu_assign_pointer(rq->sd, sd);
destroy_sched_domains(tmp, cpu);
update_top_cache_domain(cpu);
}
static cpumask_var_t cpu_isolated_map;
static int __init isolated_cpu_setup(char *str)
{
alloc_bootmem_cpumask_var(&cpu_isolated_map);
cpulist_parse(str, cpu_isolated_map);
return 1;
}
__setup("isolcpus=", isolated_cpu_setup);
#ifdef CONFIG_NUMA
static int find_next_best_node(int node, nodemask_t *used_nodes)
{
int i, n, val, min_val, best_node = -1;
min_val = INT_MAX;
for (i = 0; i < nr_node_ids; i++) {
n = (node + i) % nr_node_ids;
if (!nr_cpus_node(n))
continue;
if (node_isset(n, *used_nodes))
continue;
val = node_distance(node, n);
if (val < min_val) {
min_val = val;
best_node = n;
}
}
if (best_node != -1)
node_set(best_node, *used_nodes);
return best_node;
}
static void sched_domain_node_span(int node, struct cpumask *span)
{
nodemask_t used_nodes;
int i;
cpumask_clear(span);
nodes_clear(used_nodes);
cpumask_or(span, span, cpumask_of_node(node));
node_set(node, used_nodes);
for (i = 1; i < SD_NODES_PER_DOMAIN; i++) {
int next_node = find_next_best_node(node, &used_nodes);
if (next_node < 0)
break;
cpumask_or(span, span, cpumask_of_node(next_node));
}
}
static const struct cpumask *cpu_node_mask(int cpu)
{
lockdep_assert_held(&sched_domains_mutex);
sched_domain_node_span(cpu_to_node(cpu), sched_domains_tmpmask);
return sched_domains_tmpmask;
}
static const struct cpumask *cpu_allnodes_mask(int cpu)
{
return cpu_possible_mask;
}
#endif
static const struct cpumask *cpu_cpu_mask(int cpu)
{
return cpumask_of_node(cpu_to_node(cpu));
}
int sched_smt_power_savings = 0, sched_mc_power_savings = 0;
struct sd_data {
struct sched_domain **__percpu sd;
struct sched_group **__percpu sg;
struct sched_group_power **__percpu sgp;
};
struct s_data {
struct sched_domain ** __percpu sd;
struct root_domain *rd;
};
enum s_alloc {
sa_rootdomain,
sa_sd,
sa_sd_storage,
sa_none,
};
struct sched_domain_topology_level;
typedef struct sched_domain *(*sched_domain_init_f)(struct sched_domain_topology_level *tl, int cpu);
typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
#define SDTL_OVERLAP 0x01
struct sched_domain_topology_level {
sched_domain_init_f init;
sched_domain_mask_f mask;
int flags;
struct sd_data data;
};
static int
build_overlap_sched_groups(struct sched_domain *sd, int cpu)
{
struct sched_group *first = NULL, *last = NULL, *groups = NULL, *sg;
const struct cpumask *span = sched_domain_span(sd);
struct cpumask *covered = sched_domains_tmpmask;
struct sd_data *sdd = sd->private;
struct sched_domain *child;
int i;
cpumask_clear(covered);
for_each_cpu(i, span) {
struct cpumask *sg_span;
if (cpumask_test_cpu(i, covered))
continue;
sg = kzalloc_node(sizeof(struct sched_group) + cpumask_size(),
GFP_KERNEL, cpu_to_node(cpu));
if (!sg)
goto fail;
sg_span = sched_group_cpus(sg);
child = *per_cpu_ptr(sdd->sd, i);
if (child->child) {
child = child->child;
cpumask_copy(sg_span, sched_domain_span(child));
} else
cpumask_set_cpu(i, sg_span);
cpumask_or(covered, covered, sg_span);
sg->sgp = *per_cpu_ptr(sdd->sgp, cpumask_first(sg_span));
atomic_inc(&sg->sgp->ref);
if (cpumask_test_cpu(cpu, sg_span))
groups = sg;
if (!first)
first = sg;
if (last)
last->next = sg;
last = sg;
last->next = first;
}
sd->groups = groups;
return 0;
fail:
free_sched_groups(first, 0);
return -ENOMEM;
}
static int get_group(int cpu, struct sd_data *sdd, struct sched_group **sg)
{
struct sched_domain *sd = *per_cpu_ptr(sdd->sd, cpu);
struct sched_domain *child = sd->child;
if (child)
cpu = cpumask_first(sched_domain_span(child));
if (sg) {
*sg = *per_cpu_ptr(sdd->sg, cpu);
(*sg)->sgp = *per_cpu_ptr(sdd->sgp, cpu);
atomic_set(&(*sg)->sgp->ref, 1);
}
return cpu;
}
static int
build_sched_groups(struct sched_domain *sd, int cpu)
{
struct sched_group *first = NULL, *last = NULL;
struct sd_data *sdd = sd->private;
const struct cpumask *span = sched_domain_span(sd);
struct cpumask *covered;
int i;
get_group(cpu, sdd, &sd->groups);
atomic_inc(&sd->groups->ref);
if (cpu != cpumask_first(sched_domain_span(sd)))
return 0;
lockdep_assert_held(&sched_domains_mutex);
covered = sched_domains_tmpmask;
cpumask_clear(covered);
for_each_cpu(i, span) {
struct sched_group *sg;
int group = get_group(i, sdd, &sg);
int j;
if (cpumask_test_cpu(i, covered))
continue;
cpumask_clear(sched_group_cpus(sg));
sg->sgp->power = 0;
for_each_cpu(j, span) {
if (get_group(j, sdd, NULL) != group)
continue;
cpumask_set_cpu(j, covered);
cpumask_set_cpu(j, sched_group_cpus(sg));
}
if (!first)
first = sg;
if (last)
last->next = sg;
last = sg;
}
if (last)
last->next = first;
return 0;
}
static void init_sched_groups_power(int cpu, struct sched_domain *sd)
{
struct sched_group *sg;
BUG_ON(!sd);
sg = sd->groups;
BUG_ON(!sg);
do {
sg->group_weight = cpumask_weight(sched_group_cpus(sg));
sg = sg->next;
} while (sg != sd->groups);
if (cpu != group_first_cpu(sg))
return;
update_group_power(sd, cpu);
atomic_set(&sg->sgp->nr_busy_cpus, sg->group_weight);
}
int __weak arch_sd_sibling_asym_packing(void)
{
return 0*SD_ASYM_PACKING;
}
#ifdef CONFIG_SCHED_DEBUG
# define SD_INIT_NAME(sd, type) sd->name = #type
#else
# define SD_INIT_NAME(sd, type) do { } while (0)
#endif
#define SD_INIT_FUNC(type) \
static noinline struct sched_domain * \
sd_init_##type(struct sched_domain_topology_level *tl, int cpu) \
{ \
struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu); \
*sd = SD_##type##_INIT; \
SD_INIT_NAME(sd, type); \
sd->private = &tl->data; \
return sd; \
}
SD_INIT_FUNC(CPU)
#ifdef CONFIG_NUMA
SD_INIT_FUNC(ALLNODES)
SD_INIT_FUNC(NODE)
#endif
#ifdef CONFIG_SCHED_SMT
SD_INIT_FUNC(SIBLING)
#endif
#ifdef CONFIG_SCHED_MC
SD_INIT_FUNC(MC)
#endif
#ifdef CONFIG_SCHED_BOOK
SD_INIT_FUNC(BOOK)
#endif
static int default_relax_domain_level = -1;
int sched_domain_level_max;
static int __init setup_relax_domain_level(char *str)
{
if (kstrtoint(str, 0, &default_relax_domain_level))
pr_warn("Unable to set relax_domain_level\n");
return 1;
}
__setup("relax_domain_level=", setup_relax_domain_level);
static void set_domain_attribute(struct sched_domain *sd,
struct sched_domain_attr *attr)
{
int request;
if (!attr || attr->relax_domain_level < 0) {
if (default_relax_domain_level < 0)
return;
else
request = default_relax_domain_level;
} else
request = attr->relax_domain_level;
if (request < sd->level) {
sd->flags &= ~(SD_BALANCE_WAKE|SD_BALANCE_NEWIDLE);
} else {
sd->flags |= (SD_BALANCE_WAKE|SD_BALANCE_NEWIDLE);
}
}
static void __sdt_free(const struct cpumask *cpu_map);
static int __sdt_alloc(const struct cpumask *cpu_map);
static void __free_domain_allocs(struct s_data *d, enum s_alloc what,
const struct cpumask *cpu_map)
{
switch (what) {
case sa_rootdomain:
if (!atomic_read(&d->rd->refcount))
free_rootdomain(&d->rd->rcu);
case sa_sd:
free_percpu(d->sd);
case sa_sd_storage:
__sdt_free(cpu_map);
case sa_none:
break;
}
}
static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
const struct cpumask *cpu_map)
{
memset(d, 0, sizeof(*d));
if (__sdt_alloc(cpu_map))
return sa_sd_storage;
d->sd = alloc_percpu(struct sched_domain *);
if (!d->sd)
return sa_sd_storage;
d->rd = alloc_rootdomain();
if (!d->rd)
return sa_sd;
return sa_rootdomain;
}
static void claim_allocations(int cpu, struct sched_domain *sd)
{
struct sd_data *sdd = sd->private;
WARN_ON_ONCE(*per_cpu_ptr(sdd->sd, cpu) != sd);
*per_cpu_ptr(sdd->sd, cpu) = NULL;
if (atomic_read(&(*per_cpu_ptr(sdd->sg, cpu))->ref))
*per_cpu_ptr(sdd->sg, cpu) = NULL;
if (atomic_read(&(*per_cpu_ptr(sdd->sgp, cpu))->ref))
*per_cpu_ptr(sdd->sgp, cpu) = NULL;
}
#ifdef CONFIG_SCHED_SMT
static const struct cpumask *cpu_smt_mask(int cpu)
{
return topology_thread_cpumask(cpu);
}
#endif
static struct sched_domain_topology_level default_topology[] = {
#ifdef CONFIG_SCHED_SMT
{ sd_init_SIBLING, cpu_smt_mask, },
#endif
#ifdef CONFIG_SCHED_MC
{ sd_init_MC, cpu_coregroup_mask, },
#endif
#ifdef CONFIG_SCHED_BOOK
{ sd_init_BOOK, cpu_book_mask, },
#endif
{ sd_init_CPU, cpu_cpu_mask, },
#ifdef CONFIG_NUMA
{ sd_init_NODE, cpu_node_mask, SDTL_OVERLAP, },
{ sd_init_ALLNODES, cpu_allnodes_mask, },
#endif
{ NULL, },
};
static struct sched_domain_topology_level *sched_domain_topology = default_topology;
static int __sdt_alloc(const struct cpumask *cpu_map)
{
struct sched_domain_topology_level *tl;
int j;
for (tl = sched_domain_topology; tl->init; tl++) {
struct sd_data *sdd = &tl->data;
sdd->sd = alloc_percpu(struct sched_domain *);
if (!sdd->sd)
return -ENOMEM;
sdd->sg = alloc_percpu(struct sched_group *);
if (!sdd->sg)
return -ENOMEM;
sdd->sgp = alloc_percpu(struct sched_group_power *);
if (!sdd->sgp)
return -ENOMEM;
for_each_cpu(j, cpu_map) {
struct sched_domain *sd;
struct sched_group *sg;
struct sched_group_power *sgp;
sd = kzalloc_node(sizeof(struct sched_domain) + cpumask_size(),
GFP_KERNEL, cpu_to_node(j));
if (!sd)
return -ENOMEM;
*per_cpu_ptr(sdd->sd, j) = sd;
sg = kzalloc_node(sizeof(struct sched_group) + cpumask_size(),
GFP_KERNEL, cpu_to_node(j));
if (!sg)
return -ENOMEM;
sg->next = sg;
*per_cpu_ptr(sdd->sg, j) = sg;
sgp = kzalloc_node(sizeof(struct sched_group_power),
GFP_KERNEL, cpu_to_node(j));
if (!sgp)
return -ENOMEM;
*per_cpu_ptr(sdd->sgp, j) = sgp;
}
}
return 0;
}
static void __sdt_free(const struct cpumask *cpu_map)
{
struct sched_domain_topology_level *tl;
int j;
for (tl = sched_domain_topology; tl->init; tl++) {
struct sd_data *sdd = &tl->data;
for_each_cpu(j, cpu_map) {
struct sched_domain *sd;
if (sdd->sd) {
sd = *per_cpu_ptr(sdd->sd, j);
if (sd && (sd->flags & SD_OVERLAP))
free_sched_groups(sd->groups, 0);
kfree(*per_cpu_ptr(sdd->sd, j));
}
if (sdd->sg)
kfree(*per_cpu_ptr(sdd->sg, j));
if (sdd->sgp)
kfree(*per_cpu_ptr(sdd->sgp, j));
}
free_percpu(sdd->sd);
sdd->sd = NULL;
free_percpu(sdd->sg);
sdd->sg = NULL;
free_percpu(sdd->sgp);
sdd->sgp = NULL;
}
}
struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
struct s_data *d, const struct cpumask *cpu_map,
struct sched_domain_attr *attr, struct sched_domain *child,
int cpu)
{
struct sched_domain *sd = tl->init(tl, cpu);
if (!sd)
return child;
cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
if (child) {
sd->level = child->level + 1;
sched_domain_level_max = max(sched_domain_level_max, sd->level);
child->parent = sd;
}
sd->child = child;
set_domain_attribute(sd, attr);
return sd;
}
static int build_sched_domains(const struct cpumask *cpu_map,
struct sched_domain_attr *attr)
{
enum s_alloc alloc_state = sa_none;
struct sched_domain *sd;
struct s_data d;
int i, ret = -ENOMEM;
alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
if (alloc_state != sa_rootdomain)
goto error;
for_each_cpu(i, cpu_map) {
struct sched_domain_topology_level *tl;
sd = NULL;
for (tl = sched_domain_topology; tl->init; tl++) {
sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
if (tl->flags & SDTL_OVERLAP || sched_feat(FORCE_SD_OVERLAP))
sd->flags |= SD_OVERLAP;
if (cpumask_equal(cpu_map, sched_domain_span(sd)))
break;
}
while (sd->child)
sd = sd->child;
*per_cpu_ptr(d.sd, i) = sd;
}
for_each_cpu(i, cpu_map) {
for (sd = *per_cpu_ptr(d.sd, i); sd; sd = sd->parent) {
sd->span_weight = cpumask_weight(sched_domain_span(sd));
if (sd->flags & SD_OVERLAP) {
if (build_overlap_sched_groups(sd, i))
goto error;
} else {
if (build_sched_groups(sd, i))
goto error;
}
}
}
for (i = nr_cpumask_bits-1; i >= 0; i--) {
if (!cpumask_test_cpu(i, cpu_map))
continue;
for (sd = *per_cpu_ptr(d.sd, i); sd; sd = sd->parent) {
claim_allocations(i, sd);
init_sched_groups_power(i, sd);
}
}
rcu_read_lock();
for_each_cpu(i, cpu_map) {
sd = *per_cpu_ptr(d.sd, i);
cpu_attach_domain(sd, d.rd, i);
}
rcu_read_unlock();
ret = 0;
error:
__free_domain_allocs(&d, alloc_state, cpu_map);
return ret;
}
static cpumask_var_t *doms_cur;
static int ndoms_cur;
static struct sched_domain_attr *dattr_cur;
static cpumask_var_t fallback_doms;
int __attribute__((weak)) arch_update_cpu_topology(void)
{
return 0;
}
cpumask_var_t *alloc_sched_domains(unsigned int ndoms)
{
int i;
cpumask_var_t *doms;
doms = kmalloc(sizeof(*doms) * ndoms, GFP_KERNEL);
if (!doms)
return NULL;
for (i = 0; i < ndoms; i++) {
if (!alloc_cpumask_var(&doms[i], GFP_KERNEL)) {
free_sched_domains(doms, i);
return NULL;
}
}
return doms;
}
void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms)
{
unsigned int i;
for (i = 0; i < ndoms; i++)
free_cpumask_var(doms[i]);
kfree(doms);
}
static int init_sched_domains(const struct cpumask *cpu_map)
{
int err;
arch_update_cpu_topology();
ndoms_cur = 1;
doms_cur = alloc_sched_domains(ndoms_cur);
if (!doms_cur)
doms_cur = &fallback_doms;
cpumask_andnot(doms_cur[0], cpu_map, cpu_isolated_map);
dattr_cur = NULL;
err = build_sched_domains(doms_cur[0], NULL);
register_sched_domain_sysctl();
return err;
}
static void detach_destroy_domains(const struct cpumask *cpu_map)
{
int i;
rcu_read_lock();
for_each_cpu(i, cpu_map)
cpu_attach_domain(NULL, &def_root_domain, i);
rcu_read_unlock();
}
static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur,
struct sched_domain_attr *new, int idx_new)
{
struct sched_domain_attr tmp;
if (!new && !cur)
return 1;
tmp = SD_ATTR_INIT;
return !memcmp(cur ? (cur + idx_cur) : &tmp,
new ? (new + idx_new) : &tmp,
sizeof(struct sched_domain_attr));
}
void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
struct sched_domain_attr *dattr_new)
{
int i, j, n;
int new_topology;
mutex_lock(&sched_domains_mutex);
unregister_sched_domain_sysctl();
new_topology = arch_update_cpu_topology();
n = doms_new ? ndoms_new : 0;
for (i = 0; i < ndoms_cur; i++) {
for (j = 0; j < n && !new_topology; j++) {
if (cpumask_equal(doms_cur[i], doms_new[j])
&& dattrs_equal(dattr_cur, i, dattr_new, j))
goto match1;
}
detach_destroy_domains(doms_cur[i]);
match1:
;
}
if (doms_new == NULL) {
ndoms_cur = 0;
doms_new = &fallback_doms;
cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map);
WARN_ON_ONCE(dattr_new);
}
for (i = 0; i < ndoms_new; i++) {
for (j = 0; j < ndoms_cur && !new_topology; j++) {
if (cpumask_equal(doms_new[i], doms_cur[j])
&& dattrs_equal(dattr_new, i, dattr_cur, j))
goto match2;
}
build_sched_domains(doms_new[i], dattr_new ? dattr_new + i : NULL);
match2:
;
}
if (doms_cur != &fallback_doms)
free_sched_domains(doms_cur, ndoms_cur);
kfree(dattr_cur);
doms_cur = doms_new;
dattr_cur = dattr_new;
ndoms_cur = ndoms_new;
register_sched_domain_sysctl();
mutex_unlock(&sched_domains_mutex);
}
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
static void reinit_sched_domains(void)
{
get_online_cpus();
partition_sched_domains(0, NULL, NULL);
rebuild_sched_domains();
put_online_cpus();
}
static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
{
unsigned int level = 0;
if (sscanf(buf, "%u", &level) != 1)
return -EINVAL;
if (level >= MAX_POWERSAVINGS_BALANCE_LEVELS)
return -EINVAL;
if (smt)
sched_smt_power_savings = level;
else
sched_mc_power_savings = level;
reinit_sched_domains();
return count;
}
#ifdef CONFIG_SCHED_MC
static ssize_t sched_mc_power_savings_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%u\n", sched_mc_power_savings);
}
static ssize_t sched_mc_power_savings_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
return sched_power_savings_store(buf, count, 0);
}
static DEVICE_ATTR(sched_mc_power_savings, 0644,
sched_mc_power_savings_show,
sched_mc_power_savings_store);
#endif
#ifdef CONFIG_SCHED_SMT
static ssize_t sched_smt_power_savings_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%u\n", sched_smt_power_savings);
}
static ssize_t sched_smt_power_savings_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
return sched_power_savings_store(buf, count, 1);
}
static DEVICE_ATTR(sched_smt_power_savings, 0644,
sched_smt_power_savings_show,
sched_smt_power_savings_store);
#endif
int __init sched_create_sysfs_power_savings_entries(struct device *dev)
{
int err = 0;
#ifdef CONFIG_SCHED_SMT
if (smt_capable())
err = device_create_file(dev, &dev_attr_sched_smt_power_savings);
#endif
#ifdef CONFIG_SCHED_MC
if (!err && mc_capable())
err = device_create_file(dev, &dev_attr_sched_mc_power_savings);
#endif
return err;
}
#endif
static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
case CPU_DOWN_FAILED:
cpuset_update_active_cpus();
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DOWN_PREPARE:
cpuset_update_active_cpus();
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
void __init sched_init_smp(void)
{
cpumask_var_t non_isolated_cpus;
alloc_cpumask_var(&non_isolated_cpus, GFP_KERNEL);
alloc_cpumask_var(&fallback_doms, GFP_KERNEL);
get_online_cpus();
mutex_lock(&sched_domains_mutex);
init_sched_domains(cpu_active_mask);
cpumask_andnot(non_isolated_cpus, cpu_possible_mask, cpu_isolated_map);
if (cpumask_empty(non_isolated_cpus))
cpumask_set_cpu(smp_processor_id(), non_isolated_cpus);
mutex_unlock(&sched_domains_mutex);
put_online_cpus();
hotcpu_notifier(cpuset_cpu_active, CPU_PRI_CPUSET_ACTIVE);
hotcpu_notifier(cpuset_cpu_inactive, CPU_PRI_CPUSET_INACTIVE);
hotcpu_notifier(update_runtime, 0);
init_hrtick();
if (set_cpus_allowed_ptr(current, non_isolated_cpus) < 0)
BUG();
sched_init_granularity();
free_cpumask_var(non_isolated_cpus);
init_sched_rt_class();
}
#else
void __init sched_init_smp(void)
{
sched_init_granularity();
}
#endif
const_debug unsigned int sysctl_timer_migration = 1;
int in_sched_functions(unsigned long addr)
{
return in_lock_functions(addr) ||
(addr >= (unsigned long)__sched_text_start
&& addr < (unsigned long)__sched_text_end);
}
#ifdef CONFIG_CGROUP_SCHED
struct task_group root_task_group;
LIST_HEAD(task_groups);
#endif
DECLARE_PER_CPU(cpumask_var_t, load_balance_tmpmask);
void __init sched_init(void)
{
int i, j;
unsigned long alloc_size = 0, ptr;
#ifdef CONFIG_FAIR_GROUP_SCHED
alloc_size += 2 * nr_cpu_ids * sizeof(void **);
#endif
#ifdef CONFIG_RT_GROUP_SCHED
alloc_size += 2 * nr_cpu_ids * sizeof(void **);
#endif
#ifdef CONFIG_CPUMASK_OFFSTACK
alloc_size += num_possible_cpus() * cpumask_size();
#endif
if (alloc_size) {
ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT);
#ifdef CONFIG_FAIR_GROUP_SCHED
root_task_group.se = (struct sched_entity **)ptr;
ptr += nr_cpu_ids * sizeof(void **);
root_task_group.cfs_rq = (struct cfs_rq **)ptr;
ptr += nr_cpu_ids * sizeof(void **);
#endif
#ifdef CONFIG_RT_GROUP_SCHED
root_task_group.rt_se = (struct sched_rt_entity **)ptr;
ptr += nr_cpu_ids * sizeof(void **);
root_task_group.rt_rq = (struct rt_rq **)ptr;
ptr += nr_cpu_ids * sizeof(void **);
#endif
#ifdef CONFIG_CPUMASK_OFFSTACK
for_each_possible_cpu(i) {
per_cpu(load_balance_tmpmask, i) = (void *)ptr;
ptr += cpumask_size();
}
#endif
}
#ifdef CONFIG_SMP
init_defrootdomain();
#endif
init_rt_bandwidth(&def_rt_bandwidth,
global_rt_period(), global_rt_runtime());
#ifdef CONFIG_RT_GROUP_SCHED
init_rt_bandwidth(&root_task_group.rt_bandwidth,
global_rt_period(), global_rt_runtime());
#endif
#ifdef CONFIG_CGROUP_SCHED
list_add(&root_task_group.list, &task_groups);
INIT_LIST_HEAD(&root_task_group.children);
INIT_LIST_HEAD(&root_task_group.siblings);
autogroup_init(&init_task);
#endif
#ifdef CONFIG_CGROUP_CPUACCT
root_cpuacct.cpustat = &kernel_cpustat;
root_cpuacct.cpuusage = alloc_percpu(u64);
BUG_ON(!root_cpuacct.cpuusage);
#endif
for_each_possible_cpu(i) {
struct rq *rq;
rq = cpu_rq(i);
raw_spin_lock_init(&rq->lock);
rq->nr_running = 0;
rq->calc_load_active = 0;
rq->calc_load_update = jiffies + LOAD_FREQ;
init_cfs_rq(&rq->cfs);
init_rt_rq(&rq->rt, rq);
#ifdef CONFIG_FAIR_GROUP_SCHED
root_task_group.shares = ROOT_TASK_GROUP_LOAD;
INIT_LIST_HEAD(&rq->leaf_cfs_rq_list);
init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL);
#endif
rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime;
#ifdef CONFIG_RT_GROUP_SCHED
INIT_LIST_HEAD(&rq->leaf_rt_rq_list);
init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, NULL);
#endif
for (j = 0; j < CPU_LOAD_IDX_MAX; j++)
rq->cpu_load[j] = 0;
rq->last_load_update_tick = jiffies;
#ifdef CONFIG_SMP
rq->sd = NULL;
rq->rd = NULL;
rq->cpu_power = SCHED_POWER_SCALE;
rq->post_schedule = 0;
rq->active_balance = 0;
rq->next_balance = jiffies;
rq->push_cpu = 0;
rq->cpu = i;
rq->online = 0;
rq->idle_stamp = 0;
rq->avg_idle = 2*sysctl_sched_migration_cost;
INIT_LIST_HEAD(&rq->cfs_tasks);
rq_attach_root(rq, &def_root_domain);
#ifdef CONFIG_NO_HZ
rq->nohz_flags = 0;
#endif
#endif
init_rq_hrtick(rq);
atomic_set(&rq->nr_iowait, 0);
}
set_load_weight(&init_task);
#ifdef CONFIG_PREEMPT_NOTIFIERS
INIT_HLIST_HEAD(&init_task.preempt_notifiers);
#endif
#ifdef CONFIG_RT_MUTEXES
plist_head_init(&init_task.pi_waiters);
#endif
atomic_inc(&init_mm.mm_count);
enter_lazy_tlb(&init_mm, current);
init_idle(current, smp_processor_id());
calc_load_update = jiffies + LOAD_FREQ;
current->sched_class = &fair_sched_class;
#ifdef CONFIG_SMP
zalloc_cpumask_var(&sched_domains_tmpmask, GFP_NOWAIT);
if (cpu_isolated_map == NULL)
zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
#endif
init_sched_fair_class();
scheduler_running = 1;
}
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
static inline int preempt_count_equals(int preempt_offset)
{
int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
return (nested == preempt_offset);
}
static int __might_sleep_init_called;
int __init __might_sleep_init(void)
{
__might_sleep_init_called = 1;
return 0;
}
early_initcall(__might_sleep_init);
void __might_sleep(const char *file, int line, int preempt_offset)
{
static unsigned long prev_jiffy;
rcu_sleep_check();
if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
oops_in_progress)
return;
if (system_state != SYSTEM_RUNNING &&
(!__might_sleep_init_called || system_state != SYSTEM_BOOTING))
return;
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
return;
prev_jiffy = jiffies;
printk(KERN_ERR
"BUG: sleeping function called from invalid context at %s:%d\n",
file, line);
printk(KERN_ERR
"in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
in_atomic(), irqs_disabled(),
current->pid, current->comm);
debug_show_held_locks(current);
if (irqs_disabled())
print_irqtrace_events(current);
dump_stack();
}
EXPORT_SYMBOL(__might_sleep);
#endif
#ifdef CONFIG_MAGIC_SYSRQ
static void normalize_task(struct rq *rq, struct task_struct *p)
{
const struct sched_class *prev_class = p->sched_class;
int old_prio = p->prio;
int on_rq;
on_rq = p->on_rq;
if (on_rq)
dequeue_task(rq, p, 0);
__setscheduler(rq, p, SCHED_NORMAL, 0);
if (on_rq) {
enqueue_task(rq, p, 0);
resched_task(rq->curr);
}
check_class_changed(rq, p, prev_class, old_prio);
}
void normalize_rt_tasks(void)
{
struct task_struct *g, *p;
unsigned long flags;
struct rq *rq;
read_lock_irqsave(&tasklist_lock, flags);
do_each_thread(g, p) {
if (!p->mm)
continue;
p->se.exec_start = 0;
#ifdef CONFIG_SCHEDSTATS
p->se.statistics.wait_start = 0;
p->se.statistics.sleep_start = 0;
p->se.statistics.block_start = 0;
#endif
if (!rt_task(p)) {
if (TASK_NICE(p) < 0 && p->mm)
set_user_nice(p, 0);
continue;
}
raw_spin_lock(&p->pi_lock);
rq = __task_rq_lock(p);
normalize_task(rq, p);
__task_rq_unlock(rq);
raw_spin_unlock(&p->pi_lock);
} while_each_thread(g, p);
read_unlock_irqrestore(&tasklist_lock, flags);
}
#endif
#if defined(CONFIG_IA64) || defined(CONFIG_KGDB_KDB)
struct task_struct *curr_task(int cpu)
{
return cpu_curr(cpu);
}
#endif
#ifdef CONFIG_IA64
void set_curr_task(int cpu, struct task_struct *p)
{
cpu_curr(cpu) = p;
}
#endif
#ifdef CONFIG_CGROUP_SCHED
static DEFINE_SPINLOCK(task_group_lock);
static void free_sched_group(struct task_group *tg)
{
free_fair_sched_group(tg);
free_rt_sched_group(tg);
autogroup_free(tg);
kfree(tg);
}
struct task_group *sched_create_group(struct task_group *parent)
{
struct task_group *tg;
unsigned long flags;
tg = kzalloc(sizeof(*tg), GFP_KERNEL);
if (!tg)
return ERR_PTR(-ENOMEM);
if (!alloc_fair_sched_group(tg, parent))
goto err;
if (!alloc_rt_sched_group(tg, parent))
goto err;
spin_lock_irqsave(&task_group_lock, flags);
list_add_rcu(&tg->list, &task_groups);
WARN_ON(!parent);
tg->parent = parent;
INIT_LIST_HEAD(&tg->children);
list_add_rcu(&tg->siblings, &parent->children);
spin_unlock_irqrestore(&task_group_lock, flags);
return tg;
err:
free_sched_group(tg);
return ERR_PTR(-ENOMEM);
}
static void free_sched_group_rcu(struct rcu_head *rhp)
{
free_sched_group(container_of(rhp, struct task_group, rcu));
}
void sched_destroy_group(struct task_group *tg)
{
unsigned long flags;
int i;
for_each_possible_cpu(i)
unregister_fair_sched_group(tg, i);
spin_lock_irqsave(&task_group_lock, flags);
list_del_rcu(&tg->list);
list_del_rcu(&tg->siblings);
spin_unlock_irqrestore(&task_group_lock, flags);
call_rcu(&tg->rcu, free_sched_group_rcu);
}
void sched_move_task(struct task_struct *tsk)
{
struct task_group *tg;
int on_rq, running;
unsigned long flags;
struct rq *rq;
rq = task_rq_lock(tsk, &flags);
running = task_current(rq, tsk);
on_rq = tsk->on_rq;
if (on_rq)
dequeue_task(rq, tsk, 0);
if (unlikely(running))
tsk->sched_class->put_prev_task(rq, tsk);
tg = container_of(task_subsys_state_check(tsk, cpu_cgroup_subsys_id,
lockdep_is_held(&tsk->sighand->siglock)),
struct task_group, css);
tg = autogroup_task_group(tsk, tg);
tsk->sched_task_group = tg;
#ifdef CONFIG_FAIR_GROUP_SCHED
if (tsk->sched_class->task_move_group)
tsk->sched_class->task_move_group(tsk, on_rq);
else
#endif
set_task_rq(tsk, task_cpu(tsk));
if (unlikely(running))
tsk->sched_class->set_curr_task(rq);
if (on_rq)
enqueue_task(rq, tsk, 0);
task_rq_unlock(rq, tsk, &flags);
}
#endif
#if defined(CONFIG_RT_GROUP_SCHED) || defined(CONFIG_CFS_BANDWIDTH)
static unsigned long to_ratio(u64 period, u64 runtime)
{
if (runtime == RUNTIME_INF)
return 1ULL << 20;
return div64_u64(runtime << 20, period);
}
#endif
#ifdef CONFIG_RT_GROUP_SCHED
static DEFINE_MUTEX(rt_constraints_mutex);
static inline int tg_has_rt_tasks(struct task_group *tg)
{
struct task_struct *g, *p;
do_each_thread(g, p) {
if (rt_task(p) && task_rq(p)->rt.tg == tg)
return 1;
} while_each_thread(g, p);
return 0;
}
struct rt_schedulable_data {
struct task_group *tg;
u64 rt_period;
u64 rt_runtime;
};
static int tg_rt_schedulable(struct task_group *tg, void *data)
{
struct rt_schedulable_data *d = data;
struct task_group *child;
unsigned long total, sum = 0;
u64 period, runtime;
period = ktime_to_ns(tg->rt_bandwidth.rt_period);
runtime = tg->rt_bandwidth.rt_runtime;
if (tg == d->tg) {
period = d->rt_period;
runtime = d->rt_runtime;
}
if (runtime > period && runtime != RUNTIME_INF)
return -EINVAL;
if (rt_bandwidth_enabled() && !runtime && tg_has_rt_tasks(tg))
return -EBUSY;
total = to_ratio(period, runtime);
if (total > to_ratio(global_rt_period(), global_rt_runtime()))
return -EINVAL;
list_for_each_entry_rcu(child, &tg->children, siblings) {
period = ktime_to_ns(child->rt_bandwidth.rt_period);
runtime = child->rt_bandwidth.rt_runtime;
if (child == d->tg) {
period = d->rt_period;
runtime = d->rt_runtime;
}
sum += to_ratio(period, runtime);
}
if (sum > total)
return -EINVAL;
return 0;
}
static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
{
int ret;
struct rt_schedulable_data data = {
.tg = tg,
.rt_period = period,
.rt_runtime = runtime,
};
rcu_read_lock();
ret = walk_tg_tree(tg_rt_schedulable, tg_nop, &data);
rcu_read_unlock();
return ret;
}
static int tg_set_rt_bandwidth(struct task_group *tg,
u64 rt_period, u64 rt_runtime)
{
int i, err = 0;
mutex_lock(&rt_constraints_mutex);
read_lock(&tasklist_lock);
err = __rt_schedulable(tg, rt_period, rt_runtime);
if (err)
goto unlock;
raw_spin_lock_irq(&tg->rt_bandwidth.rt_runtime_lock);
tg->rt_bandwidth.rt_period = ns_to_ktime(rt_period);
tg->rt_bandwidth.rt_runtime = rt_runtime;
for_each_possible_cpu(i) {
struct rt_rq *rt_rq = tg->rt_rq[i];
raw_spin_lock(&rt_rq->rt_runtime_lock);
rt_rq->rt_runtime = rt_runtime;
raw_spin_unlock(&rt_rq->rt_runtime_lock);
}
raw_spin_unlock_irq(&tg->rt_bandwidth.rt_runtime_lock);
unlock:
read_unlock(&tasklist_lock);
mutex_unlock(&rt_constraints_mutex);
return err;
}
int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us)
{
u64 rt_runtime, rt_period;
rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period);
rt_runtime = (u64)rt_runtime_us * NSEC_PER_USEC;
if (rt_runtime_us < 0)
rt_runtime = RUNTIME_INF;
return tg_set_rt_bandwidth(tg, rt_period, rt_runtime);
}
long sched_group_rt_runtime(struct task_group *tg)
{
u64 rt_runtime_us;
if (tg->rt_bandwidth.rt_runtime == RUNTIME_INF)
return -1;
rt_runtime_us = tg->rt_bandwidth.rt_runtime;
do_div(rt_runtime_us, NSEC_PER_USEC);
return rt_runtime_us;
}
int sched_group_set_rt_period(struct task_group *tg, long rt_period_us)
{
u64 rt_runtime, rt_period;
rt_period = (u64)rt_period_us * NSEC_PER_USEC;
rt_runtime = tg->rt_bandwidth.rt_runtime;
if (rt_period == 0)
return -EINVAL;
return tg_set_rt_bandwidth(tg, rt_period, rt_runtime);
}
long sched_group_rt_period(struct task_group *tg)
{
u64 rt_period_us;
rt_period_us = ktime_to_ns(tg->rt_bandwidth.rt_period);
do_div(rt_period_us, NSEC_PER_USEC);
return rt_period_us;
}
static int sched_rt_global_constraints(void)
{
u64 runtime, period;
int ret = 0;
if (sysctl_sched_rt_period <= 0)
return -EINVAL;
runtime = global_rt_runtime();
period = global_rt_period();
if (runtime > period && runtime != RUNTIME_INF)
return -EINVAL;
mutex_lock(&rt_constraints_mutex);
read_lock(&tasklist_lock);
ret = __rt_schedulable(NULL, 0, 0);
read_unlock(&tasklist_lock);
mutex_unlock(&rt_constraints_mutex);
return ret;
}
int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
{
if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0)
return 0;
return 1;
}
#else
static int sched_rt_global_constraints(void)
{
unsigned long flags;
int i;
if (sysctl_sched_rt_period <= 0)
return -EINVAL;
if (sysctl_sched_rt_runtime == 0)
return -EBUSY;
raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
for_each_possible_cpu(i) {
struct rt_rq *rt_rq = &cpu_rq(i)->rt;
raw_spin_lock(&rt_rq->rt_runtime_lock);
rt_rq->rt_runtime = global_rt_runtime();
raw_spin_unlock(&rt_rq->rt_runtime_lock);
}
raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags);
return 0;
}
#endif
int sched_rt_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
int ret;
int old_period, old_runtime;
static DEFINE_MUTEX(mutex);
mutex_lock(&mutex);
old_period = sysctl_sched_rt_period;
old_runtime = sysctl_sched_rt_runtime;
ret = proc_dointvec(table, write, buffer, lenp, ppos);
if (!ret && write) {
ret = sched_rt_global_constraints();
if (ret) {
sysctl_sched_rt_period = old_period;
sysctl_sched_rt_runtime = old_runtime;
} else {
def_rt_bandwidth.rt_runtime = global_rt_runtime();
def_rt_bandwidth.rt_period =
ns_to_ktime(global_rt_period());
}
}
mutex_unlock(&mutex);
return ret;
}
#ifdef CONFIG_CGROUP_SCHED
static inline struct task_group *cgroup_tg(struct cgroup *cgrp)
{
return container_of(cgroup_subsys_state(cgrp, cpu_cgroup_subsys_id),
struct task_group, css);
}
static struct cgroup_subsys_state *cpu_cgroup_create(struct cgroup *cgrp)
{
struct task_group *tg, *parent;
if (!cgrp->parent) {
return &root_task_group.css;
}
parent = cgroup_tg(cgrp->parent);
tg = sched_create_group(parent);
if (IS_ERR(tg))
return ERR_PTR(-ENOMEM);
return &tg->css;
}
static void cpu_cgroup_destroy(struct cgroup *cgrp)
{
struct task_group *tg = cgroup_tg(cgrp);
sched_destroy_group(tg);
}
static int
cpu_cgroup_allow_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
{
const struct cred *cred = current_cred(), *tcred;
struct task_struct *task;
cgroup_taskset_for_each(task, cgrp, tset) {
tcred = __task_cred(task);
if ((current != task) && !capable(CAP_SYS_NICE) &&
cred->euid != tcred->uid && cred->euid != tcred->suid)
return -EACCES;
}
return 0;
}
static int cpu_cgroup_can_attach(struct cgroup *cgrp,
struct cgroup_taskset *tset)
{
struct task_struct *task;
cgroup_taskset_for_each(task, cgrp, tset) {
#ifdef CONFIG_RT_GROUP_SCHED
if (!sched_rt_can_attach(cgroup_tg(cgrp), task))
return -EINVAL;
#else
if (task->sched_class != &fair_sched_class)
return -EINVAL;
#endif
}
return 0;
}
static void cpu_cgroup_attach(struct cgroup *cgrp,
struct cgroup_taskset *tset)
{
struct task_struct *task;
cgroup_taskset_for_each(task, cgrp, tset)
sched_move_task(task);
}
static void
cpu_cgroup_exit(struct cgroup *cgrp, struct cgroup *old_cgrp,
struct task_struct *task)
{
if (!(task->flags & PF_EXITING))
return;
sched_move_task(task);
}
#ifdef CONFIG_FAIR_GROUP_SCHED
static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype,
u64 shareval)
{
return sched_group_set_shares(cgroup_tg(cgrp), scale_load(shareval));
}
static u64 cpu_shares_read_u64(struct cgroup *cgrp, struct cftype *cft)
{
struct task_group *tg = cgroup_tg(cgrp);
return (u64) scale_load_down(tg->shares);
}
#ifdef CONFIG_CFS_BANDWIDTH
static DEFINE_MUTEX(cfs_constraints_mutex);
const u64 max_cfs_quota_period = 1 * NSEC_PER_SEC;
const u64 min_cfs_quota_period = 1 * NSEC_PER_MSEC;
static int __cfs_schedulable(struct task_group *tg, u64 period, u64 runtime);
static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)
{
int i, ret = 0, runtime_enabled, runtime_was_enabled;
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
if (tg == &root_task_group)
return -EINVAL;
if (quota < min_cfs_quota_period || period < min_cfs_quota_period)
return -EINVAL;
if (period > max_cfs_quota_period)
return -EINVAL;
mutex_lock(&cfs_constraints_mutex);
ret = __cfs_schedulable(tg, period, quota);
if (ret)
goto out_unlock;
runtime_enabled = quota != RUNTIME_INF;
runtime_was_enabled = cfs_b->quota != RUNTIME_INF;
account_cfs_bandwidth_used(runtime_enabled, runtime_was_enabled);
raw_spin_lock_irq(&cfs_b->lock);
cfs_b->period = ns_to_ktime(period);
cfs_b->quota = quota;
__refill_cfs_bandwidth_runtime(cfs_b);
if (runtime_enabled && cfs_b->timer_active) {
cfs_b->timer_active = 0;
__start_cfs_bandwidth(cfs_b);
}
raw_spin_unlock_irq(&cfs_b->lock);
for_each_possible_cpu(i) {
struct cfs_rq *cfs_rq = tg->cfs_rq[i];
struct rq *rq = cfs_rq->rq;
raw_spin_lock_irq(&rq->lock);
cfs_rq->runtime_enabled = runtime_enabled;
cfs_rq->runtime_remaining = 0;
if (cfs_rq->throttled)
unthrottle_cfs_rq(cfs_rq);
raw_spin_unlock_irq(&rq->lock);
}
out_unlock:
mutex_unlock(&cfs_constraints_mutex);
return ret;
}
int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us)
{
u64 quota, period;
period = ktime_to_ns(tg->cfs_bandwidth.period);
if (cfs_quota_us < 0)
quota = RUNTIME_INF;
else
quota = (u64)cfs_quota_us * NSEC_PER_USEC;
return tg_set_cfs_bandwidth(tg, period, quota);
}
long tg_get_cfs_quota(struct task_group *tg)
{
u64 quota_us;
if (tg->cfs_bandwidth.quota == RUNTIME_INF)
return -1;
quota_us = tg->cfs_bandwidth.quota;
do_div(quota_us, NSEC_PER_USEC);
return quota_us;
}
int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
{
u64 quota, period;
period = (u64)cfs_period_us * NSEC_PER_USEC;
quota = tg->cfs_bandwidth.quota;
return tg_set_cfs_bandwidth(tg, period, quota);
}
long tg_get_cfs_period(struct task_group *tg)
{
u64 cfs_period_us;
cfs_period_us = ktime_to_ns(tg->cfs_bandwidth.period);
do_div(cfs_period_us, NSEC_PER_USEC);
return cfs_period_us;
}
static s64 cpu_cfs_quota_read_s64(struct cgroup *cgrp, struct cftype *cft)
{
return tg_get_cfs_quota(cgroup_tg(cgrp));
}
static int cpu_cfs_quota_write_s64(struct cgroup *cgrp, struct cftype *cftype,
s64 cfs_quota_us)
{
return tg_set_cfs_quota(cgroup_tg(cgrp), cfs_quota_us);
}
static u64 cpu_cfs_period_read_u64(struct cgroup *cgrp, struct cftype *cft)
{
return tg_get_cfs_period(cgroup_tg(cgrp));
}
static int cpu_cfs_period_write_u64(struct cgroup *cgrp, struct cftype *cftype,
u64 cfs_period_us)
{
return tg_set_cfs_period(cgroup_tg(cgrp), cfs_period_us);
}
struct cfs_schedulable_data {
struct task_group *tg;
u64 period, quota;
};
static u64 normalize_cfs_quota(struct task_group *tg,
struct cfs_schedulable_data *d)
{
u64 quota, period;
if (tg == d->tg) {
period = d->period;
quota = d->quota;
} else {
period = tg_get_cfs_period(tg);
quota = tg_get_cfs_quota(tg);
}
if (quota == RUNTIME_INF || quota == -1)
return RUNTIME_INF;
return to_ratio(period, quota);
}
static int tg_cfs_schedulable_down(struct task_group *tg, void *data)
{
struct cfs_schedulable_data *d = data;
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
s64 quota = 0, parent_quota = -1;
if (!tg->parent) {
quota = RUNTIME_INF;
} else {
struct cfs_bandwidth *parent_b = &tg->parent->cfs_bandwidth;
quota = normalize_cfs_quota(tg, d);
parent_quota = parent_b->hierarchal_quota;
if (quota == RUNTIME_INF)
quota = parent_quota;
else if (parent_quota != RUNTIME_INF && quota > parent_quota)
return -EINVAL;
}
cfs_b->hierarchal_quota = quota;
return 0;
}
static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota)
{
int ret;
struct cfs_schedulable_data data = {
.tg = tg,
.period = period,
.quota = quota,
};
if (quota != RUNTIME_INF) {
do_div(data.period, NSEC_PER_USEC);
do_div(data.quota, NSEC_PER_USEC);
}
rcu_read_lock();
ret = walk_tg_tree(tg_cfs_schedulable_down, tg_nop, &data);
rcu_read_unlock();
return ret;
}
static int cpu_stats_show(struct cgroup *cgrp, struct cftype *cft,
struct cgroup_map_cb *cb)
{
struct task_group *tg = cgroup_tg(cgrp);
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
cb->fill(cb, "nr_periods", cfs_b->nr_periods);
cb->fill(cb, "nr_throttled", cfs_b->nr_throttled);
cb->fill(cb, "throttled_time", cfs_b->throttled_time);
return 0;
}
#endif
#endif
#ifdef CONFIG_RT_GROUP_SCHED
static int cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft,
s64 val)
{
return sched_group_set_rt_runtime(cgroup_tg(cgrp), val);
}
static s64 cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft)
{
return sched_group_rt_runtime(cgroup_tg(cgrp));
}
static int cpu_rt_period_write_uint(struct cgroup *cgrp, struct cftype *cftype,
u64 rt_period_us)
{
return sched_group_set_rt_period(cgroup_tg(cgrp), rt_period_us);
}
static u64 cpu_rt_period_read_uint(struct cgroup *cgrp, struct cftype *cft)
{
return sched_group_rt_period(cgroup_tg(cgrp));
}
#endif
static struct cftype cpu_files[] = {
#ifdef CONFIG_FAIR_GROUP_SCHED
{
.name = "shares",
.read_u64 = cpu_shares_read_u64,
.write_u64 = cpu_shares_write_u64,
},
#endif
#ifdef CONFIG_CFS_BANDWIDTH
{
.name = "cfs_quota_us",
.read_s64 = cpu_cfs_quota_read_s64,
.write_s64 = cpu_cfs_quota_write_s64,
},
{
.name = "cfs_period_us",
.read_u64 = cpu_cfs_period_read_u64,
.write_u64 = cpu_cfs_period_write_u64,
},
{
.name = "stat",
.read_map = cpu_stats_show,
},
#endif
#ifdef CONFIG_RT_GROUP_SCHED
{
.name = "rt_runtime_us",
.read_s64 = cpu_rt_runtime_read,
.write_s64 = cpu_rt_runtime_write,
},
{
.name = "rt_period_us",
.read_u64 = cpu_rt_period_read_uint,
.write_u64 = cpu_rt_period_write_uint,
},
#endif
};
static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
{
return cgroup_add_files(cont, ss, cpu_files, ARRAY_SIZE(cpu_files));
}
struct cgroup_subsys cpu_cgroup_subsys = {
.name = "cpu",
.create = cpu_cgroup_create,
.destroy = cpu_cgroup_destroy,
.can_attach = cpu_cgroup_can_attach,
.attach = cpu_cgroup_attach,
.allow_attach = cpu_cgroup_allow_attach,
.exit = cpu_cgroup_exit,
.populate = cpu_cgroup_populate,
.subsys_id = cpu_cgroup_subsys_id,
.early_init = 1,
};
#endif
#ifdef CONFIG_CGROUP_CPUACCT
static struct cgroup_subsys_state *cpuacct_create(struct cgroup *cgrp)
{
struct cpuacct *ca;
if (!cgrp->parent)
return &root_cpuacct.css;
ca = kzalloc(sizeof(*ca), GFP_KERNEL);
if (!ca)
goto out;
ca->cpuusage = alloc_percpu(u64);
if (!ca->cpuusage)
goto out_free_ca;
ca->cpustat = alloc_percpu(struct kernel_cpustat);
if (!ca->cpustat)
goto out_free_cpuusage;
return &ca->css;
out_free_cpuusage:
free_percpu(ca->cpuusage);
out_free_ca:
kfree(ca);
out:
return ERR_PTR(-ENOMEM);
}
static void cpuacct_destroy(struct cgroup *cgrp)
{
struct cpuacct *ca = cgroup_ca(cgrp);
free_percpu(ca->cpustat);
free_percpu(ca->cpuusage);
kfree(ca);
}
static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu)
{
u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
u64 data;
#ifndef CONFIG_64BIT
raw_spin_lock_irq(&cpu_rq(cpu)->lock);
data = *cpuusage;
raw_spin_unlock_irq(&cpu_rq(cpu)->lock);
#else
data = *cpuusage;
#endif
return data;
}
static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val)
{
u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
#ifndef CONFIG_64BIT
raw_spin_lock_irq(&cpu_rq(cpu)->lock);
*cpuusage = val;
raw_spin_unlock_irq(&cpu_rq(cpu)->lock);
#else
*cpuusage = val;
#endif
}
static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft)
{
struct cpuacct *ca = cgroup_ca(cgrp);
u64 totalcpuusage = 0;
int i;
for_each_present_cpu(i)
totalcpuusage += cpuacct_cpuusage_read(ca, i);
return totalcpuusage;
}
static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype,
u64 reset)
{
struct cpuacct *ca = cgroup_ca(cgrp);
int err = 0;
int i;
if (reset) {
err = -EINVAL;
goto out;
}
for_each_present_cpu(i)
cpuacct_cpuusage_write(ca, i, 0);
out:
return err;
}
static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft,
struct seq_file *m)
{
struct cpuacct *ca = cgroup_ca(cgroup);
u64 percpu;
int i;
for_each_present_cpu(i) {
percpu = cpuacct_cpuusage_read(ca, i);
seq_printf(m, "%llu ", (unsigned long long) percpu);
}
seq_printf(m, "\n");
return 0;
}
static const char *cpuacct_stat_desc[] = {
[CPUACCT_STAT_USER] = "user",
[CPUACCT_STAT_SYSTEM] = "system",
};
static int cpuacct_stats_show(struct cgroup *cgrp, struct cftype *cft,
struct cgroup_map_cb *cb)
{
struct cpuacct *ca = cgroup_ca(cgrp);
int cpu;
s64 val = 0;
for_each_online_cpu(cpu) {
struct kernel_cpustat *kcpustat = per_cpu_ptr(ca->cpustat, cpu);
val += kcpustat->cpustat[CPUTIME_USER];
val += kcpustat->cpustat[CPUTIME_NICE];
}
val = cputime64_to_clock_t(val);
cb->fill(cb, cpuacct_stat_desc[CPUACCT_STAT_USER], val);
val = 0;
for_each_online_cpu(cpu) {
struct kernel_cpustat *kcpustat = per_cpu_ptr(ca->cpustat, cpu);
val += kcpustat->cpustat[CPUTIME_SYSTEM];
val += kcpustat->cpustat[CPUTIME_IRQ];
val += kcpustat->cpustat[CPUTIME_SOFTIRQ];
}
val = cputime64_to_clock_t(val);
cb->fill(cb, cpuacct_stat_desc[CPUACCT_STAT_SYSTEM], val);
return 0;
}
static struct cftype files[] = {
{
.name = "usage",
.read_u64 = cpuusage_read,
.write_u64 = cpuusage_write,
},
{
.name = "usage_percpu",
.read_seq_string = cpuacct_percpu_seq_read,
},
{
.name = "stat",
.read_map = cpuacct_stats_show,
},
};
static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
{
return cgroup_add_files(cgrp, ss, files, ARRAY_SIZE(files));
}
void cpuacct_charge(struct task_struct *tsk, u64 cputime)
{
struct cpuacct *ca;
int cpu;
if (unlikely(!cpuacct_subsys.active))
return;
cpu = task_cpu(tsk);
rcu_read_lock();
ca = task_ca(tsk);
for (; ca; ca = parent_ca(ca)) {
u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
*cpuusage += cputime;
}
rcu_read_unlock();
}
struct cgroup_subsys cpuacct_subsys = {
.name = "cpuacct",
.create = cpuacct_create,
.destroy = cpuacct_destroy,
.populate = cpuacct_populate,
.subsys_id = cpuacct_subsys_id,
};
#endif
| boa19861105/BOA-Kernel | kernel/sched/core.c | C | gpl-2.0 | 140,285 |
/*
* Copyright (C) 2007-2010 Freescale Semiconductor, Inc. All Rights Reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/mxc_scc2_driver.h>
#include <linux/spi/spi.h>
#include <linux/iram_alloc.h>
#include <mach/gpio.h>
#include <mach/common.h>
#include <mach/hardware.h>
#include <mach/mxc_dptc.h>
#include <mach/mxc_dvfs.h>
#include <mach/sdma.h>
#include "sdma_script_code.h"
#include "crm_regs.h"
/* Flag used to indicate if dvfs_core is active. */
int dvfs_core_is_active;
extern struct dptc_wp dptc_gp_wp_allfreq[DPTC_GP_WP_SUPPORTED];
extern struct dptc_wp dptc_lp_wp_allfreq[DPTC_LP_WP_SUPPORTED];
void mxc_sdma_get_script_info(sdma_script_start_addrs * sdma_script_addr)
{
sdma_script_addr->mxc_sdma_app_2_mcu_addr = app_2_mcu_ADDR;
sdma_script_addr->mxc_sdma_ap_2_ap_addr = ap_2_ap_ADDR;
sdma_script_addr->mxc_sdma_ap_2_bp_addr = -1;
sdma_script_addr->mxc_sdma_bp_2_ap_addr = -1;
sdma_script_addr->mxc_sdma_loopback_on_dsp_side_addr = -1;
sdma_script_addr->mxc_sdma_mcu_2_app_addr = mcu_2_app_ADDR;
sdma_script_addr->mxc_sdma_mcu_2_shp_addr = mcu_2_shp_ADDR;
sdma_script_addr->mxc_sdma_mcu_interrupt_only_addr = -1;
sdma_script_addr->mxc_sdma_shp_2_mcu_addr = shp_2_mcu_ADDR;
sdma_script_addr->mxc_sdma_start_addr = (unsigned short *)sdma_code;
sdma_script_addr->mxc_sdma_uartsh_2_mcu_addr = uartsh_2_mcu_ADDR;
sdma_script_addr->mxc_sdma_uart_2_mcu_addr = uart_2_mcu_ADDR;
sdma_script_addr->mxc_sdma_ram_code_size = RAM_CODE_SIZE;
sdma_script_addr->mxc_sdma_ram_code_start_addr = RAM_CODE_START_ADDR;
sdma_script_addr->mxc_sdma_dptc_dvfs_addr = dptc_dvfs_ADDR;
sdma_script_addr->mxc_sdma_firi_2_mcu_addr = -1;
sdma_script_addr->mxc_sdma_firi_2_per_addr = -1;
sdma_script_addr->mxc_sdma_mshc_2_mcu_addr = -1;
sdma_script_addr->mxc_sdma_per_2_app_addr = -1;
sdma_script_addr->mxc_sdma_per_2_firi_addr = -1;
sdma_script_addr->mxc_sdma_per_2_shp_addr = -1;
sdma_script_addr->mxc_sdma_mcu_2_ata_addr = mcu_2_ata_ADDR;
sdma_script_addr->mxc_sdma_mcu_2_firi_addr = -1;
sdma_script_addr->mxc_sdma_mcu_2_mshc_addr = -1;
sdma_script_addr->mxc_sdma_ata_2_mcu_addr = ata_2_mcu_ADDR;
sdma_script_addr->mxc_sdma_uartsh_2_per_addr = -1;
sdma_script_addr->mxc_sdma_shp_2_per_addr = -1;
sdma_script_addr->mxc_sdma_uart_2_per_addr = -1;
sdma_script_addr->mxc_sdma_app_2_per_addr = -1;
sdma_script_addr->mxc_sdma_mcu_2_spdif_addr = mcu_2_spdif_marley_ADDR;
}
static struct resource sdma_resources[] = {
{
.start = SDMA_BASE_ADDR,
.end = SDMA_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_SDMA,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mxc_dma_device = {
.name = "mxc_sdma",
.dev = {
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.num_resources = ARRAY_SIZE(sdma_resources),
.resource = sdma_resources,
};
static inline void mxc_init_dma(void)
{
(void)platform_device_register(&mxc_dma_device);
}
static void mxc_nop_release(struct device *dev)
{
/* Nothing */
}
#if defined(CONFIG_W1_MASTER_MXC) || defined(CONFIG_W1_MASTER_MXC_MODULE)
static struct mxc_w1_config mxc_w1_data = {
.search_rom_accelerator = 0,
};
static struct platform_device mxc_w1_devices = {
.name = "mxc_w1",
.dev = {
.release = mxc_nop_release,
.platform_data = &mxc_w1_data,
},
.id = 0
};
static void mxc_init_owire(void)
{
(void)platform_device_register(&mxc_w1_devices);
}
#else
static inline void mxc_init_owire(void)
{
}
#endif
#if defined(CONFIG_RTC_DRV_MXC_V2) || defined(CONFIG_RTC_DRV_MXC_V2_MODULE)
static struct mxc_srtc_platform_data srtc_data = {
.srtc_sec_mode_addr = 0xC3FAC80C,
};
static struct resource rtc_resources[] = {
{
.start = SRTC_BASE_ADDR,
.end = SRTC_BASE_ADDR + 0x40,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_SRTC_NTZ,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mxc_rtc_device = {
.name = "mxc_rtc",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &srtc_data,
},
.num_resources = ARRAY_SIZE(rtc_resources),
.resource = rtc_resources,
};
static void mxc_init_rtc(void)
{
(void)platform_device_register(&mxc_rtc_device);
}
#else
static inline void mxc_init_rtc(void)
{
}
#endif
#if defined(CONFIG_MXC_WATCHDOG) || defined(CONFIG_MXC_WATCHDOG_MODULE)
static struct resource wdt_resources[] = {
{
.start = WDOG1_BASE_ADDR,
.end = WDOG1_BASE_ADDR + 0x30,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device mxc_wdt_device = {
.name = "mxc_wdt",
.id = 0,
.dev = {
.release = mxc_nop_release,
},
.num_resources = ARRAY_SIZE(wdt_resources),
.resource = wdt_resources,
};
static void mxc_init_wdt(void)
{
(void)platform_device_register(&mxc_wdt_device);
}
#else
static inline void mxc_init_wdt(void)
{
}
#endif
#if defined(CONFIG_MXC_IPU_V3) || defined(CONFIG_MXC_IPU_V3_MODULE)
/*!
* This function resets IPU
*/
void mx37_ipu_reset(void)
{
u32 *reg;
u32 value;
reg = ioremap(SRC_BASE_ADDR, PAGE_SIZE);
value = __raw_readl(reg);
value = value | 0x8;
__raw_writel(value, reg);
iounmap(reg);
}
static struct mxc_ipu_config mxc_ipu_data = {
.rev = 1,
.reset = mx37_ipu_reset,
};
static struct resource ipu_resources[] = {
{
.start = IPU_CTRL_BASE_ADDR,
.end = IPU_CTRL_BASE_ADDR + SZ_512M,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_IPU_SYN,
.flags = IORESOURCE_IRQ,
},
{
.start = MXC_INT_IPU_ERR,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mxc_ipu_device = {
.name = "mxc_ipu",
.id = -1,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxc_ipu_data,
},
.num_resources = ARRAY_SIZE(ipu_resources),
.resource = ipu_resources,
};
static void mxc_init_ipu(void)
{
mxc_ipu_data.di_clk[1] = clk_get(NULL, "ipu_di_clk");
platform_device_register(&mxc_ipu_device);
}
#else
static inline void mxc_init_ipu(void)
{
}
#endif
static struct resource scc_resources[] = {
{
.start = SCC_BASE_ADDR,
.end = SCC_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = IRAM_BASE_ADDR,
.end = IRAM_BASE_ADDR + IRAM_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
/*!
* This is platform device structure for adding SCC
*/
static struct platform_device mxc_scc_device = {
.name = "mxc_scc",
.id = 0,
.num_resources = ARRAY_SIZE(scc_resources),
.resource = scc_resources,
};
static inline void mxc_init_scc(void)
{
uint32_t reg_value;
uint8_t *UMID_base;
uint32_t *MAP_base;
uint8_t i;
uint32_t partition_no;
uint32_t scc_partno;
void *scm_ram_base;
void *scc_base;
scc_base = ioremap((uint32_t) SCC_BASE_ADDR, 0x140);
if (scc_base == NULL) {
printk(KERN_ERR "FAILED TO MAP IRAM REGS\n");
return;
}
scm_ram_base = ioremap((uint32_t) IRAM_BASE_ADDR, IRAM_SIZE);
if (scm_ram_base == NULL) {
printk(KERN_ERR "FAILED TO MAP IRAM\n");
return;
}
for (partition_no = 0; partition_no < 9; partition_no++) {
reg_value = ((partition_no << SCM_ZCMD_PART_SHIFT) &
SCM_ZCMD_PART_MASK) | ((0x03 <<
SCM_ZCMD_CCMD_SHIFT)
& SCM_ZCMD_CCMD_MASK);
__raw_writel(reg_value, scc_base + SCM_ZCMD_REG);
while ((__raw_readl(scc_base + SCM_STATUS_REG) &
SCM_STATUS_SRS_READY) != SCM_STATUS_SRS_READY) ;
__raw_writel(0, scc_base + (SCM_SMID0_REG + 8 * partition_no));
reg_value = __raw_readl(scc_base + SCM_PART_OWNERS_REG);
if (((reg_value >> (2 * (partition_no))) & 3) != 3) {
printk(KERN_ERR "FAILED TO ACQUIRE IRAM PARTITION\n");
iounmap(scm_ram_base);
return;
}
MAP_base = scm_ram_base + (partition_no * 0x2000);
UMID_base = (uint8_t *) MAP_base + 0x10;
for (i = 0; i < 16; i++)
UMID_base[i] = 0;
MAP_base[0] = SCM_PERM_NO_ZEROIZE | SCM_PERM_HD_SUP_DISABLE |
SCM_PERM_HD_READ | SCM_PERM_HD_WRITE |
SCM_PERM_TH_READ | SCM_PERM_TH_WRITE;
}
/*Freeing 2 partitions for SCC2 */
scc_partno = 9 - (SCC_IRAM_SIZE / SZ_8K);
for (partition_no = scc_partno; partition_no < 9; partition_no++) {
reg_value = ((partition_no << SCM_ZCMD_PART_SHIFT) &
SCM_ZCMD_PART_MASK) | ((0x03 <<
SCM_ZCMD_CCMD_SHIFT)
& SCM_ZCMD_CCMD_MASK);
__raw_writel(reg_value, scc_base + SCM_ZCMD_REG);
while ((__raw_readl(scc_base + SCM_STATUS_REG) &
SCM_STATUS_SRS_READY) != SCM_STATUS_SRS_READY) ;
}
/* Register the SCC device */
platform_device_register(&mxc_scc_device);
iounmap(scm_ram_base);
iounmap(scc_base);
printk(KERN_INFO "IRAM READY\n");
}
/* SPI controller and device data */
#if defined(CONFIG_SPI_MXC) || defined(CONFIG_SPI_MXC_MODULE)
#ifdef CONFIG_SPI_MXC_SELECT1
/*!
* Resource definition for the CSPI1
*/
static struct resource mxcspi1_resources[] = {
[0] = {
.start = CSPI1_BASE_ADDR,
.end = CSPI1_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_CSPI1,
.end = MXC_INT_CSPI1,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC CSPI1 */
static struct mxc_spi_master mxcspi1_data = {
.maxchipselect = 4,
.spi_version = 23,
};
/*! Device Definition for MXC CSPI1 */
static struct platform_device mxcspi1_device = {
.name = "mxc_spi",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxcspi1_data,
},
.num_resources = ARRAY_SIZE(mxcspi1_resources),
.resource = mxcspi1_resources,
};
#endif /* CONFIG_SPI_MXC_SELECT1 */
#ifdef CONFIG_SPI_MXC_SELECT2
/*!
* Resource definition for the CSPI2
*/
static struct resource mxcspi2_resources[] = {
[0] = {
.start = CSPI2_BASE_ADDR,
.end = CSPI2_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_CSPI2,
.end = MXC_INT_CSPI2,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC CSPI2 */
static struct mxc_spi_master mxcspi2_data = {
.maxchipselect = 4,
.spi_version = 23,
};
/*! Device Definition for MXC CSPI2 */
static struct platform_device mxcspi2_device = {
.name = "mxc_spi",
.id = 1,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxcspi2_data,
},
.num_resources = ARRAY_SIZE(mxcspi2_resources),
.resource = mxcspi2_resources,
};
#endif /* CONFIG_SPI_MXC_SELECT2 */
#ifdef CONFIG_SPI_MXC_SELECT3
/*!
* Resource definition for the CSPI3
*/
static struct resource mxcspi3_resources[] = {
[0] = {
.start = CSPI3_BASE_ADDR,
.end = CSPI3_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_CSPI3,
.end = MXC_INT_CSPI3,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC CSPI3 */
static struct mxc_spi_master mxcspi3_data = {
.maxchipselect = 4,
.spi_version = 23,
};
/*! Device Definition for MXC CSPI3 */
static struct platform_device mxcspi3_device = {
.name = "mxc_spi",
.id = 2,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxcspi3_data,
},
.num_resources = ARRAY_SIZE(mxcspi3_resources),
.resource = mxcspi3_resources,
};
#endif /* CONFIG_SPI_MXC_SELECT3 */
void __init mxc_init_spi(void)
{
#ifdef CONFIG_SPI_MXC_SELECT1
if (platform_device_register(&mxcspi1_device) < 0)
printk("Error: Registering the SPI Controller_1\n");
#endif /* CONFIG_SPI_MXC_SELECT1 */
#ifdef CONFIG_SPI_MXC_SELECT2
if (platform_device_register(&mxcspi2_device) < 0)
printk("Error: Registering the SPI Controller_2\n");
#endif /* CONFIG_SPI_MXC_SELECT2 */
#ifdef CONFIG_SPI_MXC_SELECT3
if (platform_device_register(&mxcspi3_device) < 0)
printk("Error: Registering the SPI Controller_3\n");
#endif /* CONFIG_SPI_MXC_SELECT3 */
}
#else
void __init mxc_init_spi(void)
{
}
#endif
/* I2C controller and device data */
#if defined(CONFIG_I2C_MXC) || defined(CONFIG_I2C_MXC_MODULE)
#ifdef CONFIG_I2C_MXC_SELECT1
/*!
* Resource definition for the I2C1
*/
static struct resource mxci2c1_resources[] = {
[0] = {
.start = I2C_BASE_ADDR,
.end = I2C_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_I2C,
.end = MXC_INT_I2C,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC I2C */
static struct mxc_i2c_platform_data mxci2c1_data = {
.i2c_clk = 100000,
};
#endif
#ifdef CONFIG_I2C_MXC_SELECT2
/*!
* Resource definition for the I2C2
*/
static struct resource mxci2c2_resources[] = {
[0] = {
.start = I2C2_BASE_ADDR,
.end = I2C2_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_I2C2,
.end = MXC_INT_I2C2,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC I2C */
static struct mxc_i2c_platform_data mxci2c2_data = {
.i2c_clk = 100000,
};
#endif
#ifdef CONFIG_I2C_MXC_SELECT3
/*!
* Resource definition for the I2C3
*/
static struct resource mxci2c3_resources[] = {
[0] = {
.start = I2C3_BASE_ADDR,
.end = I2C3_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_I2C3,
.end = MXC_INT_I2C3,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC I2C */
static struct mxc_i2c_platform_data mxci2c3_data = {
.i2c_clk = 100000,
};
#endif
/*! Device Definition for MXC I2C1 */
static struct platform_device mxci2c_devices[] = {
#ifdef CONFIG_I2C_MXC_SELECT1
{
.name = "mxc_i2c",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxci2c1_data,
},
.num_resources = ARRAY_SIZE(mxci2c1_resources),
.resource = mxci2c1_resources,},
#endif
#ifdef CONFIG_I2C_MXC_SELECT2
{
.name = "mxc_i2c",
.id = 1,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxci2c2_data,
},
.num_resources = ARRAY_SIZE(mxci2c2_resources),
.resource = mxci2c2_resources,},
#endif
#ifdef CONFIG_I2C_MXC_SELECT3
{
.name = "mxc_i2c",
.id = 2,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxci2c3_data,
},
.num_resources = ARRAY_SIZE(mxci2c3_resources),
.resource = mxci2c3_resources,},
#endif
};
static inline void mxc_init_i2c(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(mxci2c_devices); i++) {
if (platform_device_register(&mxci2c_devices[i]) < 0)
dev_err(&mxci2c_devices[i].dev,
"Unable to register I2C device\n");
}
}
#else
static inline void mxc_init_i2c(void)
{
}
#endif
struct tve_platform_data tve_data = {
.dac_reg = "VVIDEO",
.dig_reg = "VDIG",
};
static struct resource tve_resources[] = {
{
.start = TVE_BASE_ADDR,
.end = TVE_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_TVOUT,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mxc_tve_device = {
.name = "tve",
.dev = {
.release = mxc_nop_release,
.platform_data = &tve_data,
},
.num_resources = ARRAY_SIZE(tve_resources),
.resource = tve_resources,
};
void __init mxc_init_tve(void)
{
platform_device_register(&mxc_tve_device);
}
/*!
* Resource definition for the DVFS CORE
*/
static struct resource dvfs_core_resources[] = {
[0] = {
.start = MXC_DVFS_CORE_BASE,
.end = MXC_DVFS_CORE_BASE + 4 * SZ_16 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_GPC1,
.end = MXC_INT_GPC1,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for DVFS CORE */
struct mxc_dvfs_platform_data dvfs_core_data = {
.reg_id = "SW1",
.clk1_id = "cpu_clk",
.clk2_id = "gpc_dvfs_clk",
.gpc_cntr_reg_addr = MXC_GPC_CNTR,
.gpc_vcr_reg_addr = MXC_GPC_VCR,
.ccm_cdcr_reg_addr = MXC_CCM_CDCR,
.ccm_cacrr_reg_addr = MXC_CCM_CACRR,
.ccm_cdhipr_reg_addr = MXC_CCM_CDHIPR,
.dvfs_thrs_reg_addr = MXC_DVFSTHRS,
.dvfs_coun_reg_addr = MXC_DVFSCOUN,
.dvfs_emac_reg_addr = MXC_DVFSEMAC,
.dvfs_cntr_reg_addr = MXC_DVFSCNTR,
.prediv_mask = 0x3800,
.prediv_offset = 11,
.prediv_val = 1,
.div3ck_mask = 0x00000006,
.div3ck_offset = 1,
.div3ck_val = 3,
.emac_val = 0x08,
.upthr_val = 30,
.dnthr_val = 10,
.pncthr_val = 33,
.upcnt_val = 5,
.dncnt_val = 5,
.delay_time = 100,
.num_wp = 3,
};
/*! Device Definition for MXC DVFS core */
static struct platform_device mxc_dvfs_core_device = {
.name = "mxc_dvfs_core",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &dvfs_core_data,
},
.num_resources = ARRAY_SIZE(dvfs_core_resources),
.resource = dvfs_core_resources,
};
static inline void mxc_init_dvfs_core(void)
{
if (platform_device_register(&mxc_dvfs_core_device) < 0)
dev_err(&mxc_dvfs_core_device.dev,
"Unable to register DVFS core device\n");
}
/*!
* Resource definition for the DPTC GP
*/
static struct resource dptc_gp_resources[] = {
[0] = {
.start = MXC_DPTC_GP_BASE,
.end = MXC_DPTC_GP_BASE + 8 * SZ_16 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_GPC1,
.end = MXC_INT_GPC1,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for DPTC GP */
struct mxc_dptc_data dptc_gp_data = {
.reg_id = "SW1",
.clk_id = "cpu_clk",
.dptccr_reg_addr = MXC_GP_DPTCCR,
.dcvr0_reg_addr = MXC_GP_DCVR0,
.gpc_cntr_reg_addr = MXC_GPC_CNTR,
.dptccr = MXC_GPCCNTR_DPTC0CR,
.dptc_wp_supported = DPTC_GP_WP_SUPPORTED,
.dptc_wp_allfreq = dptc_gp_wp_allfreq,
.clk_max_val = 532000000,
.gpc_adu = MXC_GPCCNTR_ADU,
.vai_mask = MXC_DPTCCR_VAI_MASK,
.vai_offset = MXC_DPTCCR_VAI_OFFSET,
.dptc_enable_bit = MXC_DPTCCR_DEN,
.irq_mask = MXC_DPTCCR_VAIM,
.dptc_nvcr_bit = MXC_DPTCCR_DPNVCR,
.gpc_irq_bit = MXC_GPCCNTR_GPCIRQ,
.init_config =
MXC_DPTCCR_DRCE0 | MXC_DPTCCR_DRCE1 | MXC_DPTCCR_DRCE2 |
MXC_DPTCCR_DRCE3 | MXC_DPTCCR_DCR_128 | MXC_DPTCCR_DPNVCR |
MXC_DPTCCR_DPVV,
.enable_config =
MXC_DPTCCR_DEN | MXC_DPTCCR_DPNVCR | MXC_DPTCCR_DPVV |
MXC_DPTCCR_DSMM,
.dcr_mask = MXC_DPTCCR_DCR_256,
};
/*!
* Resource definition for the DPTC LP
*/
static struct resource dptc_lp_resources[] = {
[0] = {
.start = MXC_DPTC_LP_BASE,
.end = MXC_DPTC_LP_BASE + 8 * SZ_16 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_GPC1,
.end = MXC_INT_GPC1,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC DPTC LP */
struct mxc_dptc_data dptc_lp_data = {
.reg_id = "SW2",
.clk_id = "ahb_clk",
.dptccr_reg_addr = MXC_LP_DPTCCR,
.dcvr0_reg_addr = MXC_LP_DCVR0,
.gpc_cntr_reg_addr = MXC_GPC_CNTR,
.dptccr = MXC_GPCCNTR_DPTC1CR,
.dptc_wp_supported = DPTC_LP_WP_SUPPORTED,
.dptc_wp_allfreq = dptc_lp_wp_allfreq,
.clk_max_val = 133000000,
.gpc_adu = 0x0,
.vai_mask = MXC_DPTCCR_VAI_MASK,
.vai_offset = MXC_DPTCCR_VAI_OFFSET,
.dptc_enable_bit = MXC_DPTCCR_DEN,
.irq_mask = MXC_DPTCCR_VAIM,
.dptc_nvcr_bit = MXC_DPTCCR_DPNVCR,
.gpc_irq_bit = MXC_GPCCNTR_GPCIRQ,
.init_config =
MXC_DPTCCR_DRCE0 | MXC_DPTCCR_DRCE1 | MXC_DPTCCR_DRCE2 |
MXC_DPTCCR_DRCE3 | MXC_DPTCCR_DCR_128 | MXC_DPTCCR_DPNVCR |
MXC_DPTCCR_DPVV,
.enable_config =
MXC_DPTCCR_DEN | MXC_DPTCCR_DPNVCR | MXC_DPTCCR_DPVV |
MXC_DPTCCR_DSMM,
.dcr_mask = MXC_DPTCCR_DCR_256,
};
/*! Device Definition for MXC DPTC */
static struct platform_device mxc_dptc_devices[] = {
{
.name = "mxc_dptc",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &dptc_gp_data,
},
.num_resources = ARRAY_SIZE(dptc_gp_resources),
.resource = dptc_gp_resources,
},
{
.name = "mxc_dptc",
.id = 1,
.dev = {
.release = mxc_nop_release,
.platform_data = &dptc_lp_data,
},
.num_resources = ARRAY_SIZE(dptc_lp_resources),
.resource = dptc_lp_resources,
},
};
static inline void mxc_init_dptc(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(mxc_dptc_devices); i++) {
if (platform_device_register(&mxc_dptc_devices[i]) < 0)
dev_err(&mxc_dptc_devices[i].dev,
"Unable to register DPTC device\n");
}
}
struct mxc_gpio_port mxc_gpio_ports[] = {
[0] = {
.chip.label = "gpio-0",
.base = IO_ADDRESS(GPIO1_BASE_ADDR),
.irq = MXC_INT_GPIO1_LOW,
.irq_high = MXC_INT_GPIO1_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START
},
[1] = {
.chip.label = "gpio-1",
.base = IO_ADDRESS(GPIO2_BASE_ADDR),
.irq = MXC_INT_GPIO2_LOW,
.irq_high = MXC_INT_GPIO2_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32
},
[2] = {
.chip.label = "gpio-2",
.base = IO_ADDRESS(GPIO3_BASE_ADDR),
.irq = MXC_INT_GPIO3_LOW,
.irq_high = MXC_INT_GPIO3_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
}
};
int __init mxc_register_gpios(void)
{
return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
}
#if defined(CONFIG_MXC_VPU) || defined(CONFIG_MXC_VPU_MODULE)
static struct resource vpu_resources[] = {
[0] = {
.start = VPU_BASE_ADDR,
.end = VPU_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_VPU,
.end = MXC_INT_VPU,
.flags = IORESOURCE_IRQ,
},
};
extern void mx37_vpu_reset(void);
static struct mxc_vpu_platform_data mxc_vpu_data = {
.reset = mx37_vpu_reset,
};
/*! Platform Data for MXC VPU */
static struct platform_device mxcvpu_device = {
.name = "mxc_vpu",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxc_vpu_data,
},
.num_resources = ARRAY_SIZE(vpu_resources),
.resource = vpu_resources,
};
static inline void mxc_init_vpu(void)
{
if (platform_device_register(&mxcvpu_device) < 0)
printk(KERN_ERR "Error: Registering the VPU.\n");
}
#else
static inline void mxc_init_vpu(void)
{
}
#endif
static struct resource spdif_resources[] = {
{
.start = SPDIF_BASE_ADDR,
.end = SPDIF_BASE_ADDR + 0x50,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_SPDIF,
.end = MXC_INT_SPDIF,
.flags = IORESOURCE_IRQ,
},
};
static struct mxc_spdif_platform_data mxc_spdif_data = {
.spdif_tx = 1,
.spdif_rx = 0,
.spdif_clk_44100 = 0,
.spdif_clk_48000 = 3,
.spdif_clk = NULL,
.spdif_core_clk = NULL,
};
static struct platform_device mxc_alsa_spdif_device = {
.name = "mxc_alsa_spdif",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &mxc_spdif_data,
},
.num_resources = ARRAY_SIZE(spdif_resources),
.resource = spdif_resources,
};
static inline void mxc_init_spdif(void)
{
struct clk *ckih_clk;
ckih_clk = clk_get(NULL, "ckih");
mxc_spdif_data.spdif_core_clk = clk_get(NULL, "spdif_xtal_clk");
clk_set_parent(mxc_spdif_data.spdif_core_clk, ckih_clk);
clk_put(ckih_clk);
clk_put(mxc_spdif_data.spdif_core_clk);
platform_device_register(&mxc_alsa_spdif_device);
}
static struct platform_device mx37_lpmode_device = {
.name = "mx37_lpmode",
.id = 0,
.dev = {
.release = mxc_nop_release,
},
};
static inline void mx37_init_lpmode(void)
{
(void)platform_device_register(&mx37_lpmode_device);
}
static struct platform_device busfreq_device = {
.name = "busfreq",
.id = 0,
.dev = {
.release = mxc_nop_release,
},
};
static inline void mxc_init_busfreq(void)
{
(void)platform_device_register(&busfreq_device);
}
/*!
* Resource definition for the DVFS PER
*/
static struct resource dvfs_per_resources[] = {
[0] = {
.start = DVFSPER_BASE_ADDR,
.end = DVFSPER_BASE_ADDR + 2 * SZ_16 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = MXC_INT_GPC1,
.end = MXC_INT_GPC1,
.flags = IORESOURCE_IRQ,
},
};
/*! Platform Data for MXC DVFS Peripheral */
struct mxc_dvfsper_data dvfs_per_data = {
.reg_id = "SW2",
.clk_id = "gpc_dvfs_clk",
.gpc_cntr_reg_addr = MXC_GPC_CNTR,
.gpc_vcr_reg_addr = MXC_GPC_VCR,
.gpc_adu = 0x0,
.vai_mask = MXC_DVFSPMCR0_FSVAI_MASK,
.vai_offset = MXC_DVFSPMCR0_FSVAI_OFFSET,
.dvfs_enable_bit = MXC_DVFSPMCR0_DVFEN,
.irq_mask = MXC_DVFSPMCR0_FSVAIM,
.div3_offset = 1,
.div3_mask = 0x3,
.div3_div = 3,
.lp_high = 1200000,
.lp_low = 1050000,
};
/*! Device Definition for MXC DVFS Peripheral */
static struct platform_device mxc_dvfs_per_device = {
.name = "mxc_dvfsper",
.id = 0,
.dev = {
.release = mxc_nop_release,
.platform_data = &dvfs_per_data,
},
.num_resources = ARRAY_SIZE(dvfs_per_resources),
.resource = dvfs_per_resources,
};
static inline void mxc_init_dvfs_per(void)
{
if (platform_device_register(&mxc_dvfs_per_device) < 0) {
dev_err(&mxc_dvfs_per_device.dev,
"Unable to register DVFS Peripheral device\n");
} else {
printk(KERN_INFO "mxc_init_dvfs_per initialised\n");
}
return;
}
#if defined(CONFIG_HW_RANDOM_FSL_RNGC) || \
defined(CONFIG_HW_RANDOM_FSL_RNGC_MODULE)
static struct resource rngc_resources[] = {
{
.start = RNGC_BASE_ADDR,
.end = RNGC_BASE_ADDR + 0x34,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_RNG,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device fsl_rngc_device = {
.name = "fsl_rngc",
.id = -1,
.num_resources = ARRAY_SIZE(rngc_resources),
.resource = rngc_resources,
};
static inline void mxc_init_rngc(void)
{
platform_device_register(&fsl_rngc_device);
}
#else
static inline void mxc_init_rngc(void)
{
}
#endif
#if defined(CONFIG_MXC_IIM) || defined(CONFIG_MXC_IIM_MODULE)
static struct resource mxc_iim_resources[] = {
{
.start = IIM_BASE_ADDR,
.end = IIM_BASE_ADDR + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device mxc_iim_device = {
.name = "mxc_iim",
.id = 0,
.dev = {
.release = mxc_nop_release,
},
.num_resources = ARRAY_SIZE(mxc_iim_resources),
.resource = mxc_iim_resources
};
static inline void mxc_init_iim(void)
{
if (platform_device_register(&mxc_iim_device) < 0)
dev_err(&mxc_iim_device.dev,
"Unable to register mxc iim device\n");
}
#else
static inline void mxc_init_iim(void)
{
}
#endif
int __init mxc_init_srpgconfig(void)
{
struct clk *gpcclk = clk_get(NULL, "gpc_dvfs_clk");
clk_enable(gpcclk);
/* Setup the number of clock cycles to wait for SRPG
* power up and power down requests.
*/
__raw_writel(0x03023030, MXC_SRPGC_ARM_PUPSCR);
__raw_writel(0x50, MXC_EMPGC0_ARM_PUPSCR);
__raw_writel(0x30033030, MXC_SRPGC_ARM_PDNSCR);
__raw_writel(0x50, MXC_EMPGC0_ARM_PDNSCR);
clk_disable(gpcclk);
clk_put(gpcclk);
return 0;
}
void __init mx37_init_irq(void)
{
mxc_tzic_init_irq(TZIC_BASE_ADDR);
}
#if defined(CONFIG_SND_MXC_SOC_SSI) || defined(CONFIG_SND_MXC_SOC_SSI_MODULE)
static struct resource ssi1_resources[] = {
{
.start = SSI1_BASE_ADDR,
.end = SSI1_BASE_ADDR + 0x5C,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_SSI1,
.end = MXC_INT_SSI1,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mxc_alsa_ssi1_device = {
.name = "mxc_ssi",
.id = 0,
.dev = {
.release = mxc_nop_release,
},
.num_resources = ARRAY_SIZE(ssi1_resources),
.resource = ssi1_resources,
};
static struct resource ssi2_resources[] = {
{
.start = SSI2_BASE_ADDR,
.end = SSI2_BASE_ADDR + 0x5C,
.flags = IORESOURCE_MEM,
},
{
.start = MXC_INT_SSI2,
.end = MXC_INT_SSI2,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device mxc_alsa_ssi2_device = {
.name = "mxc_ssi",
.id = 1,
.dev = {
.release = mxc_nop_release,
},
.num_resources = ARRAY_SIZE(ssi2_resources),
.resource = ssi2_resources,
};
static inline void mxc_init_ssi(void)
{
platform_device_register(&mxc_alsa_ssi1_device);
platform_device_register(&mxc_alsa_ssi2_device);
}
#else
static inline void mxc_init_ssi(void)
{
}
#endif /* CONFIG_SND_MXC_SOC_SSI */
int __init mxc_init_devices(void)
{
mxc_init_wdt();
mxc_init_ipu();
mxc_init_spi();
mxc_init_i2c();
mxc_init_rtc();
mxc_init_owire();
mxc_init_scc();
mxc_init_dma();
mxc_init_vpu();
mxc_init_spdif();
mxc_init_tve();
mx37_init_lpmode();
mxc_init_busfreq();
mxc_init_dvfs_core();
mxc_init_dvfs_per();
mxc_init_dptc();
mxc_init_rngc();
mxc_init_iim();
mxc_init_ssi();
return 0;
}
| houzhenggang/linux-2.6 | arch/arm/mach-mx37/devices.c | C | gpl-2.0 | 27,923 |
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Sun8i platform dram controller register and constant defines
*
* (C) Copyright 2007-2015 Allwinner Technology Co.
* Jerry Wang <wangflord@allwinnertech.com>
* (C) Copyright 2016 Theobroma Systems Design und Consulting GmbH
* Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
*/
#ifndef _SUNXI_DRAM_SUN9I_H
#define _SUNXI_DRAM_SUN9I_H
struct sunxi_mctl_com_reg {
u32 cr; /* 0x00 */
u32 ccr; /* 0x04 controller configuration register */
u32 dbgcr; /* 0x08 */
u32 dbgcr1; /* 0x0c */
u32 rmcr; /* 0x10 */
u8 res1[0x1c]; /* 0x14 */
u32 mmcr; /* 0x30 */
u8 res2[0x3c]; /* 0x34 */
u32 mbagcr; /* 0x70 */
u32 mbacr; /* 0x74 */
u8 res3[0x10]; /* 0x78 */
u32 maer; /* 0x88 */
u8 res4[0x74]; /* 0x8c */
u32 mdfscr; /* 0x100 */
u32 mdfsmer; /* 0x104 */
u32 mdfsmrmr; /* 0x108 */
u32 mdfstr[4]; /* 0x10c */
u32 mdfsgcr; /* 0x11c */
u8 res5[0x1c]; /* 0x120 */
u32 mdfsivr; /* 0x13c */
u8 res6[0xc]; /* 0x140 */
u32 mdfstcr; /* 0x14c */
};
struct sunxi_mctl_ctl_reg {
u32 mstr; /* 0x00 master register */
u32 stat; /* 0x04 operating mode status register */
u8 res1[0x8]; /* 0x08 */
u32 mrctrl[2]; /* 0x10 mode register read/write control reg */
u32 mstat; /* 0x18 mode register read/write status reg */
u8 res2[0x4]; /* 0x1c */
u32 derateen; /* 0x20 temperature derate enable register */
u32 derateint; /* 0x24 temperature derate interval register */
u8 res3[0x8]; /* 0x28 */
u32 pwrctl; /* 0x30 low power control register */
u32 pwrtmg; /* 0x34 low power timing register */
u8 res4[0x18]; /* 0x38 */
u32 rfshctl0; /* 0x50 refresh control register 0 */
u32 rfshctl1; /* 0x54 refresh control register 1 */
u8 res5[0x8]; /* 0x58 */
u32 rfshctl3; /* 0x60 refresh control register 3 */
u32 rfshtmg; /* 0x64 refresh timing register */
u8 res6[0x68]; /* 0x68 */
u32 init[6]; /* 0xd0 SDRAM initialisation register */
u8 res7[0xc]; /* 0xe8 */
u32 rankctl; /* 0xf4 rank control register */
u8 res8[0x8]; /* 0xf8 */
u32 dramtmg[9]; /* 0x100 DRAM timing register */
u8 res9[0x5c]; /* 0x124 */
u32 zqctrl[3]; /* 0x180 ZQ control register */
u32 zqstat; /* 0x18c ZQ status register */
u32 dfitmg[2]; /* 0x190 DFI timing register */
u32 dfilpcfg; /* 0x198 DFI low power configuration register */
u8 res10[0x4]; /* 0x19c */
u32 dfiupd[4]; /* 0x1a0 DFI update register */
u32 dfimisc; /* 0x1b0 DFI miscellaneous control register */
u8 res11[0x1c]; /* 0x1b4 */
u32 trainctl[3]; /* 0x1d0 */
u32 trainstat; /* 0x1dc */
u8 res12[0x20]; /* 0x1e0 */
u32 addrmap[7]; /* 0x200 address map register */
u8 res13[0x24]; /* 0x21c */
u32 odtcfg; /* 0x240 ODT configuration register */
u32 odtmap; /* 0x244 ODT/rank map register */
u8 res14[0x8]; /* 0x248 */
u32 sched; /* 0x250 scheduler control register */
u8 res15[0x4]; /* 0x254 */
u32 perfhpr0; /* 0x258 high priority read CAM register 0 */
u32 perfhpr1; /* 0x25c high priority read CAM register 1 */
u32 perflpr0; /* 0x260 low priority read CAM register 0 */
u32 perflpr1; /* 0x264 low priority read CAM register 1 */
u32 perfwr0; /* 0x268 write CAM register 0 */
u32 perfwr1; /* 0x26c write CAM register 1 */
};
struct sunxi_mctl_phy_reg {
u8 res0[0x04]; /* 0x00 revision id ??? */
u32 pir; /* 0x04 PHY initialisation register */
u32 pgcr[4]; /* 0x08 PHY general configuration register */
u32 pgsr[2]; /* 0x18 PHY general status register */
u32 pllcr; /* 0x20 PLL control register */
u32 ptr[5]; /* 0x24 PHY timing register */
u32 acmdlr; /* 0x38 AC master delay line register */
u32 aclcdlr; /* 0x3c AC local calibrated delay line reg */
u32 acbdlr[10]; /* 0x40 AC bit delay line register */
u32 aciocr[6]; /* 0x68 AC IO configuration register */
u32 dxccr; /* 0x80 DATX8 common configuration register */
u32 dsgcr; /* 0x84 DRAM system general config register */
u32 dcr; /* 0x88 DRAM configuration register */
u32 dtpr[4]; /* 0x8c DRAM timing parameters register */
u32 mr0; /* 0x9c mode register 0 */
u32 mr1; /* 0xa0 mode register 1 */
u32 mr2; /* 0xa4 mode register 2 */
u32 mr3; /* 0xa8 mode register 3 */
u32 odtcr; /* 0xac ODT configuration register */
u32 dtcr; /* 0xb0 data training configuration register */
u32 dtar[4]; /* 0xb4 data training address register */
u32 dtdr[2]; /* 0xc4 data training data register */
u32 dtedr[2]; /* 0xcc data training eye data register */
u32 rdimmgcr[2]; /* 0xd4 RDIMM general configuration register */
u32 rdimmcr[2]; /* 0xdc RDIMM control register */
u32 gpr[2]; /* 0xe4 general purpose register */
u32 catr[2]; /* 0xec CA training register */
u32 dqdsr; /* 0xf4 DQS drift register */
u8 res1[0xc8]; /* 0xf8 */
u32 bistrr; /* 0x1c0 BIST run register */
u32 bistwcr; /* 0x1c4 BIST word count register */
u32 bistmskr[3]; /* 0x1c8 BIST mask register */
u32 bistlsr; /* 0x1d4 BIST LFSR seed register */
u32 bistar[3]; /* 0x1d8 BIST address register */
u32 bistupdr; /* 0x1e4 BIST user pattern data register */
u32 bistgsr; /* 0x1e8 BIST general status register */
u32 bistwer; /* 0x1dc BIST word error register */
u32 bistber[4]; /* 0x1f0 BIST bit error register */
u32 bistwcsr; /* 0x200 BIST word count status register */
u32 bistfwr[3]; /* 0x204 BIST fail word register */
u8 res2[0x28]; /* 0x210 */
u32 iovcr[2]; /* 0x238 IO VREF control register */
struct ddrphy_zq {
u32 cr; /* impedance control register */
u32 pr; /* impedance control data register */
u32 dr; /* impedance control data register */
u32 sr; /* impedance control status register */
} zq[4]; /* 0x240, 0x250, 0x260, 0x270 */
struct ddrphy_dx {
u32 gcr[4]; /* DATX8 general configuration register */
u32 gsr[3]; /* DATX8 general status register */
u32 bdlr[7]; /* DATX8 bit delay line register */
u32 lcdlr[3]; /* DATX8 local calibrated delay line reg */
u32 mdlr; /* DATX8 master delay line register */
u32 gtr; /* DATX8 general timing register */
u8 res[0x34];
} dx[4]; /* 0x280, 0x300, 0x380, 0x400 */
};
/*
* DRAM common (sunxi_mctl_com_reg) register constants.
*/
#define MCTL_CR_RANK_MASK (3 << 0)
#define MCTL_CR_RANK(x) (((x) - 1) << 0)
#define MCTL_CR_BANK_MASK (3 << 2)
#define MCTL_CR_BANK(x) ((x) << 2)
#define MCTL_CR_ROW_MASK (0xf << 4)
#define MCTL_CR_ROW(x) (((x) - 1) << 4)
#define MCTL_CR_PAGE_SIZE_MASK (0xf << 8)
#define MCTL_CR_PAGE_SIZE(x) ((fls(x) - 4) << 8)
#define MCTL_CR_BUSW_MASK (3 << 12)
#define MCTL_CR_BUSW16 (1 << 12)
#define MCTL_CR_BUSW32 (3 << 12)
#define MCTL_CR_DRAMTYPE_MASK (7 << 16)
#define MCTL_CR_DRAMTYPE_DDR2 (2 << 16)
#define MCTL_CR_DRAMTYPE_DDR3 (3 << 16)
#define MCTL_CR_DRAMTYPE_LPDDR2 (6 << 16)
#define MCTL_CR_CHANNEL_MASK ((1 << 22) | (1 << 20) | (1 << 19))
#define MCTL_CR_CHANNEL_SINGLE (1 << 22)
#define MCTL_CR_CHANNEL_DUAL ((1 << 22) | (1 << 20) | (1 << 19))
#define MCTL_CCR_CH0_CLK_EN (1 << 15)
#define MCTL_CCR_CH1_CLK_EN (1 << 31)
/*
* post_cke_x1024 [bits 16..25]: Cycles to wait after driving CKE high
* to start the SDRAM initialization sequence (in 1024s of cycles).
*/
#define MCTL_INIT0_POST_CKE_x1024(n) ((n & 0x0fff) << 16)
/*
* pre_cke_x1024 [bits 0..11] Cycles to wait after reset before driving
* CKE high to start the SDRAM initialization (in 1024s of cycles)
*/
#define MCTL_INIT0_PRE_CKE_x1024(n) ((n & 0x0fff) << 0)
#define MCTL_INIT1_DRAM_RSTN_x1024(n) ((n & 0xff) << 16)
#define MCTL_INIT1_FINAL_WAIT_x32(n) ((n & 0x3f) << 8)
#define MCTL_INIT1_PRE_OCD_x32(n) ((n & 0x0f) << 0)
#define MCTL_INIT2_IDLE_AFTER_RESET_x32(n) ((n & 0xff) << 8)
#define MCTL_INIT2_MIN_STABLE_CLOCK_x1(n) ((n & 0x0f) << 0)
#define MCTL_INIT3_MR(n) ((n & 0xffff) << 16)
#define MCTL_INIT3_EMR(n) ((n & 0xffff) << 0)
#define MCTL_INIT4_EMR2(n) ((n & 0xffff) << 16)
#define MCTL_INIT4_EMR3(n) ((n & 0xffff) << 0)
#define MCTL_INIT5_DEV_ZQINIT_x32(n) ((n & 0x00ff) << 16)
#define MCTL_INIT5_MAX_AUTO_INIT_x1024(n) ((n & 0x03ff) << 0);
#define MCTL_DFIMISC_DFI_INIT_COMPLETE_EN (1 << 0)
#define MCTL_DFIUPD0_DIS_AUTO_CTRLUPD (1 << 31)
#define MCTL_MSTR_DEVICETYPE_DDR3 1
#define MCTL_MSTR_DEVICETYPE_LPDDR2 4
#define MCTL_MSTR_DEVICETYPE_LPDDR3 8
#define MCTL_MSTR_DEVICETYPE(type) \
((type == DRAM_TYPE_DDR3) ? MCTL_MSTR_DEVICETYPE_DDR3 : \
((type == DRAM_TYPE_LPDDR2) ? MCTL_MSTR_DEVICETYPE_LPDDR2 : \
MCTL_MSTR_DEVICETYPE_LPDDR3))
#define MCTL_MSTR_BURSTLENGTH4 (2 << 16)
#define MCTL_MSTR_BURSTLENGTH8 (4 << 16)
#define MCTL_MSTR_BURSTLENGTH16 (8 << 16)
#define MCTL_MSTR_BURSTLENGTH(type) \
((type == DRAM_TYPE_DDR3) ? MCTL_MSTR_BURSTLENGTH8 : \
((type == DRAM_TYPE_LPDDR2) ? MCTL_MSTR_BURSTLENGTH4 : \
MCTL_MSTR_BURSTLENGTH8))
#define MCTL_MSTR_ACTIVERANKS(x) (((x == 2) ? 3 : 1) << 24)
#define MCTL_MSTR_BUSWIDTH8 (2 << 12)
#define MCTL_MSTR_BUSWIDTH16 (1 << 12)
#define MCTL_MSTR_BUSWIDTH32 (0 << 12)
#define MCTL_MSTR_2TMODE (1 << 10)
#define MCTL_RFSHCTL3_DIS_AUTO_REFRESH (1 << 0)
#define MCTL_ZQCTRL0_TZQCS(x) (x << 0)
#define MCTL_ZQCTRL0_TZQCL(x) (x << 16)
#define MCTL_ZQCTRL0_ZQCL_DIS (1 << 30)
#define MCTL_ZQCTRL0_ZQCS_DIS (1 << 31)
#define MCTL_ZQCTRL1_TZQRESET(x) (x << 20)
#define MCTL_ZQCTRL1_TZQSI_x1024(x) (x << 0)
#define MCTL_ZQCTRL2_TZRESET_TRIGGER (1 << 0)
#define MCTL_PHY_DCR_BYTEMASK (1 << 10)
#define MCTL_PHY_DCR_2TMODE (1 << 28)
#define MCTL_PHY_DCR_DDR8BNK (1 << 3)
#define MCTL_PHY_DRAMMODE_DDR3 3
#define MCTL_PHY_DRAMMODE_LPDDR2 0
#define MCTL_PHY_DRAMMODE_LPDDR3 1
#define MCTL_DTCR_DEFAULT 0x00003007
#define MCTL_DTCR_RANKEN(n) (((n == 2) ? 3 : 1) << 24)
#define MCTL_PGCR1_ZCKSEL_MASK (3 << 23)
#define MCTL_PGCR1_IODDRM_MASK (3 << 7)
#define MCTL_PGCR1_IODDRM_DDR3 (1 << 7)
#define MCTL_PGCR1_IODDRM_DDR3L (2 << 7)
#define MCTL_PGCR1_INHVT_EN (1 << 26)
#define MCTL_PLLGCR_PLL_BYPASS (1 << 31)
#define MCTL_PLLGCR_PLL_POWERDOWN (1 << 29)
#define MCTL_PIR_PLL_BYPASS (1 << 17)
#define MCTL_PIR_MASK (~(1 << 17))
#define MCTL_PIR_INIT (1 << 0)
#define MCTL_PGSR0_ERRORS (0x1ff << 20)
/* Constants for assembling MR0 */
#define DDR3_MR0_PPD_FAST_EXIT (1 << 12)
#define DDR3_MR0_WR(n) \
((n <= 8) ? ((n - 4) << 9) : (((n >> 1) & 0x7) << 9))
#define DDR3_MR0_CL(n) \
((((n - 4) & 0x7) << 4) | (((n - 4) & 0x8) >> 2))
#define DDR3_MR0_BL8 (0 << 0)
#define DDR3_MR1_RTT120OHM ((0 << 9) | (1 << 6) | (0 << 2))
#define DDR3_MR2_TWL(n) \
(((n - 5) & 0x7) << 3)
#define MCTL_NS2CYCLES_CEIL(ns) ((ns * (CONFIG_DRAM_CLK / 2) + 999) / 1000)
#define DRAM_TYPE_DDR3 3
#define DRAM_TYPE_LPDDR2 6
#define DRAM_TYPE_LPDDR3 7
#endif
| ev3dev/u-boot | arch/arm/include/asm/arch-sunxi/dram_sun9i.h | C | gpl-2.0 | 11,371 |
<?php
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* Service definition for PlusDomains (v1).
*
* <p>
* The Google+ API enables developers to build on top of the Google+ platform.
* </p>
*
* <p>
* For more information about this service, see the API
* <a href="https://developers.google.com/+/domains/" target="_blank">Documentation</a>
* </p>
*
* @author Google, Inc.
*/
if (!class_exists('Google_Service_PlusDomains')) {
class Google_Service_PlusDomains extends Google_Service
{
/** View your circles and the people and pages in them. */
const PLUS_CIRCLES_READ = "https://www.googleapis.com/auth/plus.circles.read";
/** Manage your circles and add people and pages, who will be notified and may appear on your public Google+ profile. */
const PLUS_CIRCLES_WRITE = "https://www.googleapis.com/auth/plus.circles.write";
/** Know your basic profile info and list of people in your circles.. */
const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
/** Know who you are on Google. */
const PLUS_ME = "https://www.googleapis.com/auth/plus.me";
/** Send your photos and videos to Google+. */
const PLUS_MEDIA_UPLOAD = "https://www.googleapis.com/auth/plus.media.upload";
/** View your own Google+ profile and profiles visible to you. */
const PLUS_PROFILES_READ = "https://www.googleapis.com/auth/plus.profiles.read";
/** View your Google+ posts, comments, and stream. */
const PLUS_STREAM_READ = "https://www.googleapis.com/auth/plus.stream.read";
/** Manage your Google+ posts, comments, and stream. */
const PLUS_STREAM_WRITE = "https://www.googleapis.com/auth/plus.stream.write";
/** View your email address. */
const USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email";
/** View basic information about your account. */
const USERINFO_PROFILE = "https://www.googleapis.com/auth/userinfo.profile";
public $activities;
public $audiences;
public $circles;
public $comments;
public $media;
public $people;
/**
* Constructs the internal representation of the PlusDomains service.
*
* @param Google_Client $client
*/
public function __construct(Google_Client $client)
{
parent::__construct($client);
$this->servicePath = 'plusDomains/v1/';
$this->version = 'v1';
$this->serviceName = 'plusDomains';
$this->activities = new Google_Service_PlusDomains_Activities_Resource(
$this,
$this->serviceName,
'activities',
array(
'methods' => array(
'get' => array(
'path' => 'activities/{activityId}',
'httpMethod' => 'GET',
'parameters' => array(
'activityId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'insert' => array(
'path' => 'people/{userId}/activities',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'preview' => array(
'location' => 'query',
'type' => 'boolean',
),
),
),'list' => array(
'path' => 'people/{userId}/activities/{collection}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'collection' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),
)
)
);
$this->audiences = new Google_Service_PlusDomains_Audiences_Resource(
$this,
$this->serviceName,
'audiences',
array(
'methods' => array(
'list' => array(
'path' => 'people/{userId}/audiences',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),
)
)
);
$this->circles = new Google_Service_PlusDomains_Circles_Resource(
$this,
$this->serviceName,
'circles',
array(
'methods' => array(
'addPeople' => array(
'path' => 'circles/{circleId}/people',
'httpMethod' => 'PUT',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'userId' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'email' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
),
),'get' => array(
'path' => 'circles/{circleId}',
'httpMethod' => 'GET',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'insert' => array(
'path' => 'people/{userId}/circles',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'list' => array(
'path' => 'people/{userId}/circles',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),'patch' => array(
'path' => 'circles/{circleId}',
'httpMethod' => 'PATCH',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'remove' => array(
'path' => 'circles/{circleId}',
'httpMethod' => 'DELETE',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'removePeople' => array(
'path' => 'circles/{circleId}/people',
'httpMethod' => 'DELETE',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'userId' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'email' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
),
),'update' => array(
'path' => 'circles/{circleId}',
'httpMethod' => 'PUT',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),
)
)
);
$this->comments = new Google_Service_PlusDomains_Comments_Resource(
$this,
$this->serviceName,
'comments',
array(
'methods' => array(
'get' => array(
'path' => 'comments/{commentId}',
'httpMethod' => 'GET',
'parameters' => array(
'commentId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'insert' => array(
'path' => 'activities/{activityId}/comments',
'httpMethod' => 'POST',
'parameters' => array(
'activityId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'list' => array(
'path' => 'activities/{activityId}/comments',
'httpMethod' => 'GET',
'parameters' => array(
'activityId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'sortOrder' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),
)
)
);
$this->media = new Google_Service_PlusDomains_Media_Resource(
$this,
$this->serviceName,
'media',
array(
'methods' => array(
'insert' => array(
'path' => 'people/{userId}/media/{collection}',
'httpMethod' => 'POST',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'collection' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),
)
)
);
$this->people = new Google_Service_PlusDomains_People_Resource(
$this,
$this->serviceName,
'people',
array(
'methods' => array(
'get' => array(
'path' => 'people/{userId}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
),
),'list' => array(
'path' => 'people/{userId}/people/{collection}',
'httpMethod' => 'GET',
'parameters' => array(
'userId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'collection' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'orderBy' => array(
'location' => 'query',
'type' => 'string',
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),'listByActivity' => array(
'path' => 'activities/{activityId}/people/{collection}',
'httpMethod' => 'GET',
'parameters' => array(
'activityId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'collection' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),'listByCircle' => array(
'path' => 'circles/{circleId}/people',
'httpMethod' => 'GET',
'parameters' => array(
'circleId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'pageToken' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
),
),
)
)
);
}
}
/**
* The "activities" collection of methods.
* Typical usage is:
* <code>
* $plusDomainsService = new Google_Service_PlusDomains(...);
* $activities = $plusDomainsService->activities;
* </code>
*/
class Google_Service_PlusDomains_Activities_Resource extends Google_Service_Resource
{
/**
* Get an activity. (activities.get)
*
* @param string $activityId
* The ID of the activity to get.
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Activity
*/
public function get($activityId, $optParams = array())
{
$params = array('activityId' => $activityId);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_PlusDomains_Activity");
}
/**
* Create a new activity for the authenticated user. (activities.insert)
*
* @param string $userId
* The ID of the user to create the activity on behalf of. Its value should be "me", to indicate
* the authenticated user.
* @param Google_Activity $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool preview
* If "true", extract the potential media attachments for a URL. The response will include all
* possible attachments for a URL, including video, photos, and articles based on the content of
* the page.
* @return Google_Service_PlusDomains_Activity
*/
public function insert($userId, Google_Service_PlusDomains_Activity $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('insert', array($params), "Google_Service_PlusDomains_Activity");
}
/**
* List all of the activities in the specified collection for a particular user.
* (activities.listActivities)
*
* @param string $userId
* The ID of the user to get activities for. The special value "me" can be used to indicate the
* authenticated user.
* @param string $collection
* The collection of activities to list.
* @param array $optParams Optional parameters.
*
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string maxResults
* The maximum number of activities to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_ActivityFeed
*/
public function listActivities($userId, $collection, $optParams = array())
{
$params = array('userId' => $userId, 'collection' => $collection);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_PlusDomains_ActivityFeed");
}
}
/**
* The "audiences" collection of methods.
* Typical usage is:
* <code>
* $plusDomainsService = new Google_Service_PlusDomains(...);
* $audiences = $plusDomainsService->audiences;
* </code>
*/
class Google_Service_PlusDomains_Audiences_Resource extends Google_Service_Resource
{
/**
* List all of the audiences to which a user can share.
* (audiences.listAudiences)
*
* @param string $userId
* The ID of the user to get audiences for. The special value "me" can be used to indicate the
* authenticated user.
* @param array $optParams Optional parameters.
*
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string maxResults
* The maximum number of circles to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_AudiencesFeed
*/
public function listAudiences($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_PlusDomains_AudiencesFeed");
}
}
/**
* The "circles" collection of methods.
* Typical usage is:
* <code>
* $plusDomainsService = new Google_Service_PlusDomains(...);
* $circles = $plusDomainsService->circles;
* </code>
*/
class Google_Service_PlusDomains_Circles_Resource extends Google_Service_Resource
{
/**
* Add a person to a circle. Google+ limits certain circle operations, including
* the number of circle adds. Learn More. (circles.addPeople)
*
* @param string $circleId
* The ID of the circle to add the person to.
* @param array $optParams Optional parameters.
*
* @opt_param string userId
* IDs of the people to add to the circle. Optional, can be repeated.
* @opt_param string email
* Email of the people to add to the circle. Optional, can be repeated.
* @return Google_Service_PlusDomains_Circle
*/
public function addPeople($circleId, $optParams = array())
{
$params = array('circleId' => $circleId);
$params = array_merge($params, $optParams);
return $this->call('addPeople', array($params), "Google_Service_PlusDomains_Circle");
}
/**
* Get a circle. (circles.get)
*
* @param string $circleId
* The ID of the circle to get.
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Circle
*/
public function get($circleId, $optParams = array())
{
$params = array('circleId' => $circleId);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_PlusDomains_Circle");
}
/**
* Create a new circle for the authenticated user. (circles.insert)
*
* @param string $userId
* The ID of the user to create the circle on behalf of. The value "me" can be used to indicate the
* authenticated user.
* @param Google_Circle $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Circle
*/
public function insert($userId, Google_Service_PlusDomains_Circle $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('insert', array($params), "Google_Service_PlusDomains_Circle");
}
/**
* List all of the circles for a user. (circles.listCircles)
*
* @param string $userId
* The ID of the user to get circles for. The special value "me" can be used to indicate the
* authenticated user.
* @param array $optParams Optional parameters.
*
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string maxResults
* The maximum number of circles to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_CircleFeed
*/
public function listCircles($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_PlusDomains_CircleFeed");
}
/**
* Update a circle's description. This method supports patch semantics.
* (circles.patch)
*
* @param string $circleId
* The ID of the circle to update.
* @param Google_Circle $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Circle
*/
public function patch($circleId, Google_Service_PlusDomains_Circle $postBody, $optParams = array())
{
$params = array('circleId' => $circleId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('patch', array($params), "Google_Service_PlusDomains_Circle");
}
/**
* Delete a circle. (circles.remove)
*
* @param string $circleId
* The ID of the circle to delete.
* @param array $optParams Optional parameters.
*/
public function remove($circleId, $optParams = array())
{
$params = array('circleId' => $circleId);
$params = array_merge($params, $optParams);
return $this->call('remove', array($params));
}
/**
* Remove a person from a circle. (circles.removePeople)
*
* @param string $circleId
* The ID of the circle to remove the person from.
* @param array $optParams Optional parameters.
*
* @opt_param string userId
* IDs of the people to remove from the circle. Optional, can be repeated.
* @opt_param string email
* Email of the people to add to the circle. Optional, can be repeated.
*/
public function removePeople($circleId, $optParams = array())
{
$params = array('circleId' => $circleId);
$params = array_merge($params, $optParams);
return $this->call('removePeople', array($params));
}
/**
* Update a circle's description. (circles.update)
*
* @param string $circleId
* The ID of the circle to update.
* @param Google_Circle $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Circle
*/
public function update($circleId, Google_Service_PlusDomains_Circle $postBody, $optParams = array())
{
$params = array('circleId' => $circleId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('update', array($params), "Google_Service_PlusDomains_Circle");
}
}
/**
* The "comments" collection of methods.
* Typical usage is:
* <code>
* $plusDomainsService = new Google_Service_PlusDomains(...);
* $comments = $plusDomainsService->comments;
* </code>
*/
class Google_Service_PlusDomains_Comments_Resource extends Google_Service_Resource
{
/**
* Get a comment. (comments.get)
*
* @param string $commentId
* The ID of the comment to get.
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Comment
*/
public function get($commentId, $optParams = array())
{
$params = array('commentId' => $commentId);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_PlusDomains_Comment");
}
/**
* Create a new comment in reply to an activity. (comments.insert)
*
* @param string $activityId
* The ID of the activity to reply to.
* @param Google_Comment $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Comment
*/
public function insert($activityId, Google_Service_PlusDomains_Comment $postBody, $optParams = array())
{
$params = array('activityId' => $activityId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('insert', array($params), "Google_Service_PlusDomains_Comment");
}
/**
* List all of the comments for an activity. (comments.listComments)
*
* @param string $activityId
* The ID of the activity to get comments for.
* @param array $optParams Optional parameters.
*
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string sortOrder
* The order in which to sort the list of comments.
* @opt_param string maxResults
* The maximum number of comments to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_CommentFeed
*/
public function listComments($activityId, $optParams = array())
{
$params = array('activityId' => $activityId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_PlusDomains_CommentFeed");
}
}
/**
* The "media" collection of methods.
* Typical usage is:
* <code>
* $plusDomainsService = new Google_Service_PlusDomains(...);
* $media = $plusDomainsService->media;
* </code>
*/
class Google_Service_PlusDomains_Media_Resource extends Google_Service_Resource
{
/**
* Add a new media item to an album. The current upload size limitations are
* 36MB for a photo and 1GB for a video. Uploads do not count against quota if
* photos are less than 2048 pixels on their longest side or videos are less
* than 15 minutes in length. (media.insert)
*
* @param string $userId
* The ID of the user to create the activity on behalf of.
* @param string $collection
*
* @param Google_Media $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Media
*/
public function insert($userId, $collection, Google_Service_PlusDomains_Media $postBody, $optParams = array())
{
$params = array('userId' => $userId, 'collection' => $collection, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('insert', array($params), "Google_Service_PlusDomains_Media");
}
}
/**
* The "people" collection of methods.
* Typical usage is:
* <code>
* $plusDomainsService = new Google_Service_PlusDomains(...);
* $people = $plusDomainsService->people;
* </code>
*/
class Google_Service_PlusDomains_People_Resource extends Google_Service_Resource
{
/**
* Get a person's profile. (people.get)
*
* @param string $userId
* The ID of the person to get the profile for. The special value "me" can be used to indicate the
* authenticated user.
* @param array $optParams Optional parameters.
* @return Google_Service_PlusDomains_Person
*/
public function get($userId, $optParams = array())
{
$params = array('userId' => $userId);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_PlusDomains_Person");
}
/**
* List all of the people in the specified collection. (people.listPeople)
*
* @param string $userId
* Get the collection of people for the person identified. Use "me" to indicate the authenticated
* user.
* @param string $collection
* The collection of people to list.
* @param array $optParams Optional parameters.
*
* @opt_param string orderBy
* The order to return people in.
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string maxResults
* The maximum number of people to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_PeopleFeed
*/
public function listPeople($userId, $collection, $optParams = array())
{
$params = array('userId' => $userId, 'collection' => $collection);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_PlusDomains_PeopleFeed");
}
/**
* List all of the people in the specified collection for a particular activity.
* (people.listByActivity)
*
* @param string $activityId
* The ID of the activity to get the list of people for.
* @param string $collection
* The collection of people to list.
* @param array $optParams Optional parameters.
*
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string maxResults
* The maximum number of people to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_PeopleFeed
*/
public function listByActivity($activityId, $collection, $optParams = array())
{
$params = array('activityId' => $activityId, 'collection' => $collection);
$params = array_merge($params, $optParams);
return $this->call('listByActivity', array($params), "Google_Service_PlusDomains_PeopleFeed");
}
/**
* List all of the people who are members of a circle. (people.listByCircle)
*
* @param string $circleId
* The ID of the circle to get the members of.
* @param array $optParams Optional parameters.
*
* @opt_param string pageToken
* The continuation token, which is used to page through large result sets. To get the next page of
* results, set this parameter to the value of "nextPageToken" from the previous response.
* @opt_param string maxResults
* The maximum number of people to include in the response, which is used for paging. For any
* response, the actual number returned might be less than the specified maxResults.
* @return Google_Service_PlusDomains_PeopleFeed
*/
public function listByCircle($circleId, $optParams = array())
{
$params = array('circleId' => $circleId);
$params = array_merge($params, $optParams);
return $this->call('listByCircle', array($params), "Google_Service_PlusDomains_PeopleFeed");
}
}
class Google_Service_PlusDomains_Acl extends Google_Collection
{
public $description;
public $domainRestricted;
protected $itemsType = 'Google_Service_PlusDomains_PlusDomainsAclentryResource';
protected $itemsDataType = 'array';
public $kind;
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setDomainRestricted($domainRestricted)
{
$this->domainRestricted = $domainRestricted;
}
public function getDomainRestricted()
{
return $this->domainRestricted;
}
public function setItems($items)
{
$this->items = $items;
}
public function getItems()
{
return $this->items;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
}
class Google_Service_PlusDomains_Activity extends Google_Model
{
protected $accessType = 'Google_Service_PlusDomains_Acl';
protected $accessDataType = '';
protected $actorType = 'Google_Service_PlusDomains_ActivityActor';
protected $actorDataType = '';
public $address;
public $annotation;
public $crosspostSource;
public $etag;
public $geocode;
public $id;
public $kind;
protected $locationType = 'Google_Service_PlusDomains_Place';
protected $locationDataType = '';
protected $objectType = 'Google_Service_PlusDomains_ActivityObject';
protected $objectDataType = '';
public $placeId;
public $placeName;
protected $providerType = 'Google_Service_PlusDomains_ActivityProvider';
protected $providerDataType = '';
public $published;
public $radius;
public $title;
public $updated;
public $url;
public $verb;
public function setAccess(Google_Service_PlusDomains_Acl $access)
{
$this->access = $access;
}
public function getAccess()
{
return $this->access;
}
public function setActor(Google_Service_PlusDomains_ActivityActor $actor)
{
$this->actor = $actor;
}
public function getActor()
{
return $this->actor;
}
public function setAddress($address)
{
$this->address = $address;
}
public function getAddress()
{
return $this->address;
}
public function setAnnotation($annotation)
{
$this->annotation = $annotation;
}
public function getAnnotation()
{
return $this->annotation;
}
public function setCrosspostSource($crosspostSource)
{
$this->crosspostSource = $crosspostSource;
}
public function getCrosspostSource()
{
return $this->crosspostSource;
}
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setGeocode($geocode)
{
$this->geocode = $geocode;
}
public function getGeocode()
{
return $this->geocode;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setLocation(Google_Service_PlusDomains_Place $location)
{
$this->location = $location;
}
public function getLocation()
{
return $this->location;
}
public function setObject(Google_Service_PlusDomains_ActivityObject $object)
{
$this->object = $object;
}
public function getObject()
{
return $this->object;
}
public function setPlaceId($placeId)
{
$this->placeId = $placeId;
}
public function getPlaceId()
{
return $this->placeId;
}
public function setPlaceName($placeName)
{
$this->placeName = $placeName;
}
public function getPlaceName()
{
return $this->placeName;
}
public function setProvider(Google_Service_PlusDomains_ActivityProvider $provider)
{
$this->provider = $provider;
}
public function getProvider()
{
return $this->provider;
}
public function setPublished($published)
{
$this->published = $published;
}
public function getPublished()
{
return $this->published;
}
public function setRadius($radius)
{
$this->radius = $radius;
}
public function getRadius()
{
return $this->radius;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
public function setUpdated($updated)
{
$this->updated = $updated;
}
public function getUpdated()
{
return $this->updated;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setVerb($verb)
{
$this->verb = $verb;
}
public function getVerb()
{
return $this->verb;
}
}
class Google_Service_PlusDomains_ActivityActor extends Google_Model
{
public $displayName;
public $id;
protected $imageType = 'Google_Service_PlusDomains_ActivityActorImage';
protected $imageDataType = '';
protected $nameType = 'Google_Service_PlusDomains_ActivityActorName';
protected $nameDataType = '';
public $url;
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setImage(Google_Service_PlusDomains_ActivityActorImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setName(Google_Service_PlusDomains_ActivityActorName $name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityActorImage extends Google_Model
{
public $url;
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityActorName extends Google_Model
{
public $familyName;
public $givenName;
public function setFamilyName($familyName)
{
$this->familyName = $familyName;
}
public function getFamilyName()
{
return $this->familyName;
}
public function setGivenName($givenName)
{
$this->givenName = $givenName;
}
public function getGivenName()
{
return $this->givenName;
}
}
class Google_Service_PlusDomains_ActivityFeed extends Google_Collection
{
public $etag;
public $id;
protected $itemsType = 'Google_Service_PlusDomains_Activity';
protected $itemsDataType = 'array';
public $kind;
public $nextLink;
public $nextPageToken;
public $selfLink;
public $title;
public $updated;
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setItems($items)
{
$this->items = $items;
}
public function getItems()
{
return $this->items;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setNextLink($nextLink)
{
$this->nextLink = $nextLink;
}
public function getNextLink()
{
return $this->nextLink;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
public function setUpdated($updated)
{
$this->updated = $updated;
}
public function getUpdated()
{
return $this->updated;
}
}
class Google_Service_PlusDomains_ActivityObject extends Google_Collection
{
protected $actorType = 'Google_Service_PlusDomains_ActivityObjectActor';
protected $actorDataType = '';
protected $attachmentsType = 'Google_Service_PlusDomains_ActivityObjectAttachments';
protected $attachmentsDataType = 'array';
public $content;
public $id;
public $objectType;
public $originalContent;
protected $plusonersType = 'Google_Service_PlusDomains_ActivityObjectPlusoners';
protected $plusonersDataType = '';
protected $repliesType = 'Google_Service_PlusDomains_ActivityObjectReplies';
protected $repliesDataType = '';
protected $resharersType = 'Google_Service_PlusDomains_ActivityObjectResharers';
protected $resharersDataType = '';
protected $statusForViewerType = 'Google_Service_PlusDomains_ActivityObjectStatusForViewer';
protected $statusForViewerDataType = '';
public $url;
public function setActor(Google_Service_PlusDomains_ActivityObjectActor $actor)
{
$this->actor = $actor;
}
public function getActor()
{
return $this->actor;
}
public function setAttachments($attachments)
{
$this->attachments = $attachments;
}
public function getAttachments()
{
return $this->attachments;
}
public function setContent($content)
{
$this->content = $content;
}
public function getContent()
{
return $this->content;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setObjectType($objectType)
{
$this->objectType = $objectType;
}
public function getObjectType()
{
return $this->objectType;
}
public function setOriginalContent($originalContent)
{
$this->originalContent = $originalContent;
}
public function getOriginalContent()
{
return $this->originalContent;
}
public function setPlusoners(Google_Service_PlusDomains_ActivityObjectPlusoners $plusoners)
{
$this->plusoners = $plusoners;
}
public function getPlusoners()
{
return $this->plusoners;
}
public function setReplies(Google_Service_PlusDomains_ActivityObjectReplies $replies)
{
$this->replies = $replies;
}
public function getReplies()
{
return $this->replies;
}
public function setResharers(Google_Service_PlusDomains_ActivityObjectResharers $resharers)
{
$this->resharers = $resharers;
}
public function getResharers()
{
return $this->resharers;
}
public function setStatusForViewer(Google_Service_PlusDomains_ActivityObjectStatusForViewer $statusForViewer)
{
$this->statusForViewer = $statusForViewer;
}
public function getStatusForViewer()
{
return $this->statusForViewer;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectActor extends Google_Model
{
public $displayName;
public $id;
protected $imageType = 'Google_Service_PlusDomains_ActivityObjectActorImage';
protected $imageDataType = '';
public $url;
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setImage(Google_Service_PlusDomains_ActivityObjectActorImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectActorImage extends Google_Model
{
public $url;
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachments extends Google_Collection
{
public $content;
public $displayName;
protected $embedType = 'Google_Service_PlusDomains_ActivityObjectAttachmentsEmbed';
protected $embedDataType = '';
protected $fullImageType = 'Google_Service_PlusDomains_ActivityObjectAttachmentsFullImage';
protected $fullImageDataType = '';
public $id;
protected $imageType = 'Google_Service_PlusDomains_ActivityObjectAttachmentsImage';
protected $imageDataType = '';
public $objectType;
protected $previewThumbnailsType = 'Google_Service_PlusDomains_ActivityObjectAttachmentsPreviewThumbnails';
protected $previewThumbnailsDataType = 'array';
protected $thumbnailsType = 'Google_Service_PlusDomains_ActivityObjectAttachmentsThumbnails';
protected $thumbnailsDataType = 'array';
public $url;
public function setContent($content)
{
$this->content = $content;
}
public function getContent()
{
return $this->content;
}
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setEmbed(Google_Service_PlusDomains_ActivityObjectAttachmentsEmbed $embed)
{
$this->embed = $embed;
}
public function getEmbed()
{
return $this->embed;
}
public function setFullImage(Google_Service_PlusDomains_ActivityObjectAttachmentsFullImage $fullImage)
{
$this->fullImage = $fullImage;
}
public function getFullImage()
{
return $this->fullImage;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setImage(Google_Service_PlusDomains_ActivityObjectAttachmentsImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setObjectType($objectType)
{
$this->objectType = $objectType;
}
public function getObjectType()
{
return $this->objectType;
}
public function setPreviewThumbnails($previewThumbnails)
{
$this->previewThumbnails = $previewThumbnails;
}
public function getPreviewThumbnails()
{
return $this->previewThumbnails;
}
public function setThumbnails($thumbnails)
{
$this->thumbnails = $thumbnails;
}
public function getThumbnails()
{
return $this->thumbnails;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachmentsEmbed extends Google_Model
{
public $type;
public $url;
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachmentsFullImage extends Google_Model
{
public $height;
public $type;
public $url;
public $width;
public function setHeight($height)
{
$this->height = $height;
}
public function getHeight()
{
return $this->height;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setWidth($width)
{
$this->width = $width;
}
public function getWidth()
{
return $this->width;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachmentsImage extends Google_Model
{
public $height;
public $type;
public $url;
public $width;
public function setHeight($height)
{
$this->height = $height;
}
public function getHeight()
{
return $this->height;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setWidth($width)
{
$this->width = $width;
}
public function getWidth()
{
return $this->width;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachmentsPreviewThumbnails extends Google_Model
{
public $url;
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachmentsThumbnails extends Google_Model
{
public $description;
protected $imageType = 'Google_Service_PlusDomains_ActivityObjectAttachmentsThumbnailsImage';
protected $imageDataType = '';
public $url;
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setImage(Google_Service_PlusDomains_ActivityObjectAttachmentsThumbnailsImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_ActivityObjectAttachmentsThumbnailsImage extends Google_Model
{
public $height;
public $type;
public $url;
public $width;
public function setHeight($height)
{
$this->height = $height;
}
public function getHeight()
{
return $this->height;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setWidth($width)
{
$this->width = $width;
}
public function getWidth()
{
return $this->width;
}
}
class Google_Service_PlusDomains_ActivityObjectPlusoners extends Google_Model
{
public $selfLink;
public $totalItems;
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_ActivityObjectReplies extends Google_Model
{
public $selfLink;
public $totalItems;
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_ActivityObjectResharers extends Google_Model
{
public $selfLink;
public $totalItems;
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_ActivityObjectStatusForViewer extends Google_Model
{
public $canComment;
public $canPlusone;
public $canUpdate;
public $isPlusOned;
public $resharingDisabled;
public function setCanComment($canComment)
{
$this->canComment = $canComment;
}
public function getCanComment()
{
return $this->canComment;
}
public function setCanPlusone($canPlusone)
{
$this->canPlusone = $canPlusone;
}
public function getCanPlusone()
{
return $this->canPlusone;
}
public function setCanUpdate($canUpdate)
{
$this->canUpdate = $canUpdate;
}
public function getCanUpdate()
{
return $this->canUpdate;
}
public function setIsPlusOned($isPlusOned)
{
$this->isPlusOned = $isPlusOned;
}
public function getIsPlusOned()
{
return $this->isPlusOned;
}
public function setResharingDisabled($resharingDisabled)
{
$this->resharingDisabled = $resharingDisabled;
}
public function getResharingDisabled()
{
return $this->resharingDisabled;
}
}
class Google_Service_PlusDomains_ActivityProvider extends Google_Model
{
public $title;
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
}
class Google_Service_PlusDomains_Audience extends Google_Model
{
public $etag;
protected $itemType = 'Google_Service_PlusDomains_PlusDomainsAclentryResource';
protected $itemDataType = '';
public $kind;
public $memberCount;
public $visibility;
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setItem(Google_Service_PlusDomains_PlusDomainsAclentryResource $item)
{
$this->item = $item;
}
public function getItem()
{
return $this->item;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setMemberCount($memberCount)
{
$this->memberCount = $memberCount;
}
public function getMemberCount()
{
return $this->memberCount;
}
public function setVisibility($visibility)
{
$this->visibility = $visibility;
}
public function getVisibility()
{
return $this->visibility;
}
}
class Google_Service_PlusDomains_AudiencesFeed extends Google_Collection
{
public $etag;
protected $itemsType = 'Google_Service_PlusDomains_Audience';
protected $itemsDataType = 'array';
public $kind;
public $nextPageToken;
public $totalItems;
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setItems($items)
{
$this->items = $items;
}
public function getItems()
{
return $this->items;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_Circle extends Google_Model
{
public $description;
public $displayName;
public $etag;
public $id;
public $kind;
protected $peopleType = 'Google_Service_PlusDomains_CirclePeople';
protected $peopleDataType = '';
public $selfLink;
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setPeople(Google_Service_PlusDomains_CirclePeople $people)
{
$this->people = $people;
}
public function getPeople()
{
return $this->people;
}
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
}
class Google_Service_PlusDomains_CircleFeed extends Google_Collection
{
public $etag;
protected $itemsType = 'Google_Service_PlusDomains_Circle';
protected $itemsDataType = 'array';
public $kind;
public $nextLink;
public $nextPageToken;
public $selfLink;
public $title;
public $totalItems;
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setItems($items)
{
$this->items = $items;
}
public function getItems()
{
return $this->items;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setNextLink($nextLink)
{
$this->nextLink = $nextLink;
}
public function getNextLink()
{
return $this->nextLink;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_CirclePeople extends Google_Model
{
public $totalItems;
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_Comment extends Google_Collection
{
protected $actorType = 'Google_Service_PlusDomains_CommentActor';
protected $actorDataType = '';
public $etag;
public $id;
protected $inReplyToType = 'Google_Service_PlusDomains_CommentInReplyTo';
protected $inReplyToDataType = 'array';
public $kind;
protected $objectType = 'Google_Service_PlusDomains_CommentObject';
protected $objectDataType = '';
protected $plusonersType = 'Google_Service_PlusDomains_CommentPlusoners';
protected $plusonersDataType = '';
public $published;
public $selfLink;
public $updated;
public $verb;
public function setActor(Google_Service_PlusDomains_CommentActor $actor)
{
$this->actor = $actor;
}
public function getActor()
{
return $this->actor;
}
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setInReplyTo($inReplyTo)
{
$this->inReplyTo = $inReplyTo;
}
public function getInReplyTo()
{
return $this->inReplyTo;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setObject(Google_Service_PlusDomains_CommentObject $object)
{
$this->object = $object;
}
public function getObject()
{
return $this->object;
}
public function setPlusoners(Google_Service_PlusDomains_CommentPlusoners $plusoners)
{
$this->plusoners = $plusoners;
}
public function getPlusoners()
{
return $this->plusoners;
}
public function setPublished($published)
{
$this->published = $published;
}
public function getPublished()
{
return $this->published;
}
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setUpdated($updated)
{
$this->updated = $updated;
}
public function getUpdated()
{
return $this->updated;
}
public function setVerb($verb)
{
$this->verb = $verb;
}
public function getVerb()
{
return $this->verb;
}
}
class Google_Service_PlusDomains_CommentActor extends Google_Model
{
public $displayName;
public $id;
protected $imageType = 'Google_Service_PlusDomains_CommentActorImage';
protected $imageDataType = '';
public $url;
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setImage(Google_Service_PlusDomains_CommentActorImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_CommentActorImage extends Google_Model
{
public $url;
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_CommentFeed extends Google_Collection
{
public $etag;
public $id;
protected $itemsType = 'Google_Service_PlusDomains_Comment';
protected $itemsDataType = 'array';
public $kind;
public $nextLink;
public $nextPageToken;
public $title;
public $updated;
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setItems($items)
{
$this->items = $items;
}
public function getItems()
{
return $this->items;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setNextLink($nextLink)
{
$this->nextLink = $nextLink;
}
public function getNextLink()
{
return $this->nextLink;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
public function setUpdated($updated)
{
$this->updated = $updated;
}
public function getUpdated()
{
return $this->updated;
}
}
class Google_Service_PlusDomains_CommentInReplyTo extends Google_Model
{
public $id;
public $url;
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_CommentObject extends Google_Model
{
public $content;
public $objectType;
public $originalContent;
public function setContent($content)
{
$this->content = $content;
}
public function getContent()
{
return $this->content;
}
public function setObjectType($objectType)
{
$this->objectType = $objectType;
}
public function getObjectType()
{
return $this->objectType;
}
public function setOriginalContent($originalContent)
{
$this->originalContent = $originalContent;
}
public function getOriginalContent()
{
return $this->originalContent;
}
}
class Google_Service_PlusDomains_CommentPlusoners extends Google_Model
{
public $totalItems;
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_Media extends Google_Collection
{
protected $authorType = 'Google_Service_PlusDomains_MediaAuthor';
protected $authorDataType = '';
public $displayName;
public $etag;
protected $exifType = 'Google_Service_PlusDomains_MediaExif';
protected $exifDataType = '';
public $height;
public $id;
public $kind;
public $mediaCreatedTime;
public $mediaUrl;
public $published;
public $sizeBytes;
protected $streamsType = 'Google_Service_PlusDomains_Videostream';
protected $streamsDataType = 'array';
public $summary;
public $updated;
public $url;
public $videoDuration;
public $videoStatus;
public $width;
public function setAuthor(Google_Service_PlusDomains_MediaAuthor $author)
{
$this->author = $author;
}
public function getAuthor()
{
return $this->author;
}
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setExif(Google_Service_PlusDomains_MediaExif $exif)
{
$this->exif = $exif;
}
public function getExif()
{
return $this->exif;
}
public function setHeight($height)
{
$this->height = $height;
}
public function getHeight()
{
return $this->height;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setMediaCreatedTime($mediaCreatedTime)
{
$this->mediaCreatedTime = $mediaCreatedTime;
}
public function getMediaCreatedTime()
{
return $this->mediaCreatedTime;
}
public function setMediaUrl($mediaUrl)
{
$this->mediaUrl = $mediaUrl;
}
public function getMediaUrl()
{
return $this->mediaUrl;
}
public function setPublished($published)
{
$this->published = $published;
}
public function getPublished()
{
return $this->published;
}
public function setSizeBytes($sizeBytes)
{
$this->sizeBytes = $sizeBytes;
}
public function getSizeBytes()
{
return $this->sizeBytes;
}
public function setStreams($streams)
{
$this->streams = $streams;
}
public function getStreams()
{
return $this->streams;
}
public function setSummary($summary)
{
$this->summary = $summary;
}
public function getSummary()
{
return $this->summary;
}
public function setUpdated($updated)
{
$this->updated = $updated;
}
public function getUpdated()
{
return $this->updated;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setVideoDuration($videoDuration)
{
$this->videoDuration = $videoDuration;
}
public function getVideoDuration()
{
return $this->videoDuration;
}
public function setVideoStatus($videoStatus)
{
$this->videoStatus = $videoStatus;
}
public function getVideoStatus()
{
return $this->videoStatus;
}
public function setWidth($width)
{
$this->width = $width;
}
public function getWidth()
{
return $this->width;
}
}
class Google_Service_PlusDomains_MediaAuthor extends Google_Model
{
public $displayName;
public $id;
protected $imageType = 'Google_Service_PlusDomains_MediaAuthorImage';
protected $imageDataType = '';
public $url;
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setImage(Google_Service_PlusDomains_MediaAuthorImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_MediaAuthorImage extends Google_Model
{
public $url;
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_MediaExif extends Google_Model
{
public $time;
public function setTime($time)
{
$this->time = $time;
}
public function getTime()
{
return $this->time;
}
}
class Google_Service_PlusDomains_PeopleFeed extends Google_Collection
{
public $etag;
protected $itemsType = 'Google_Service_PlusDomains_Person';
protected $itemsDataType = 'array';
public $kind;
public $nextPageToken;
public $selfLink;
public $title;
public $totalItems;
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setItems($items)
{
$this->items = $items;
}
public function getItems()
{
return $this->items;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setSelfLink($selfLink)
{
$this->selfLink = $selfLink;
}
public function getSelfLink()
{
return $this->selfLink;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
class Google_Service_PlusDomains_Person extends Google_Collection
{
public $aboutMe;
public $birthday;
public $braggingRights;
public $circledByCount;
protected $coverType = 'Google_Service_PlusDomains_PersonCover';
protected $coverDataType = '';
public $currentLocation;
public $displayName;
public $domain;
protected $emailsType = 'Google_Service_PlusDomains_PersonEmails';
protected $emailsDataType = 'array';
public $etag;
public $gender;
public $id;
protected $imageType = 'Google_Service_PlusDomains_PersonImage';
protected $imageDataType = '';
public $isPlusUser;
public $kind;
protected $nameType = 'Google_Service_PlusDomains_PersonName';
protected $nameDataType = '';
public $nickname;
public $objectType;
public $occupation;
protected $organizationsType = 'Google_Service_PlusDomains_PersonOrganizations';
protected $organizationsDataType = 'array';
protected $placesLivedType = 'Google_Service_PlusDomains_PersonPlacesLived';
protected $placesLivedDataType = 'array';
public $plusOneCount;
public $relationshipStatus;
public $skills;
public $tagline;
public $url;
protected $urlsType = 'Google_Service_PlusDomains_PersonUrls';
protected $urlsDataType = 'array';
public $verified;
public function setAboutMe($aboutMe)
{
$this->aboutMe = $aboutMe;
}
public function getAboutMe()
{
return $this->aboutMe;
}
public function setBirthday($birthday)
{
$this->birthday = $birthday;
}
public function getBirthday()
{
return $this->birthday;
}
public function setBraggingRights($braggingRights)
{
$this->braggingRights = $braggingRights;
}
public function getBraggingRights()
{
return $this->braggingRights;
}
public function setCircledByCount($circledByCount)
{
$this->circledByCount = $circledByCount;
}
public function getCircledByCount()
{
return $this->circledByCount;
}
public function setCover(Google_Service_PlusDomains_PersonCover $cover)
{
$this->cover = $cover;
}
public function getCover()
{
return $this->cover;
}
public function setCurrentLocation($currentLocation)
{
$this->currentLocation = $currentLocation;
}
public function getCurrentLocation()
{
return $this->currentLocation;
}
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setDomain($domain)
{
$this->domain = $domain;
}
public function getDomain()
{
return $this->domain;
}
public function setEmails($emails)
{
$this->emails = $emails;
}
public function getEmails()
{
return $this->emails;
}
public function setEtag($etag)
{
$this->etag = $etag;
}
public function getEtag()
{
return $this->etag;
}
public function setGender($gender)
{
$this->gender = $gender;
}
public function getGender()
{
return $this->gender;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setImage(Google_Service_PlusDomains_PersonImage $image)
{
$this->image = $image;
}
public function getImage()
{
return $this->image;
}
public function setIsPlusUser($isPlusUser)
{
$this->isPlusUser = $isPlusUser;
}
public function getIsPlusUser()
{
return $this->isPlusUser;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setName(Google_Service_PlusDomains_PersonName $name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setNickname($nickname)
{
$this->nickname = $nickname;
}
public function getNickname()
{
return $this->nickname;
}
public function setObjectType($objectType)
{
$this->objectType = $objectType;
}
public function getObjectType()
{
return $this->objectType;
}
public function setOccupation($occupation)
{
$this->occupation = $occupation;
}
public function getOccupation()
{
return $this->occupation;
}
public function setOrganizations($organizations)
{
$this->organizations = $organizations;
}
public function getOrganizations()
{
return $this->organizations;
}
public function setPlacesLived($placesLived)
{
$this->placesLived = $placesLived;
}
public function getPlacesLived()
{
return $this->placesLived;
}
public function setPlusOneCount($plusOneCount)
{
$this->plusOneCount = $plusOneCount;
}
public function getPlusOneCount()
{
return $this->plusOneCount;
}
public function setRelationshipStatus($relationshipStatus)
{
$this->relationshipStatus = $relationshipStatus;
}
public function getRelationshipStatus()
{
return $this->relationshipStatus;
}
public function setSkills($skills)
{
$this->skills = $skills;
}
public function getSkills()
{
return $this->skills;
}
public function setTagline($tagline)
{
$this->tagline = $tagline;
}
public function getTagline()
{
return $this->tagline;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setUrls($urls)
{
$this->urls = $urls;
}
public function getUrls()
{
return $this->urls;
}
public function setVerified($verified)
{
$this->verified = $verified;
}
public function getVerified()
{
return $this->verified;
}
}
class Google_Service_PlusDomains_PersonCover extends Google_Model
{
protected $coverInfoType = 'Google_Service_PlusDomains_PersonCoverCoverInfo';
protected $coverInfoDataType = '';
protected $coverPhotoType = 'Google_Service_PlusDomains_PersonCoverCoverPhoto';
protected $coverPhotoDataType = '';
public $layout;
public function setCoverInfo(Google_Service_PlusDomains_PersonCoverCoverInfo $coverInfo)
{
$this->coverInfo = $coverInfo;
}
public function getCoverInfo()
{
return $this->coverInfo;
}
public function setCoverPhoto(Google_Service_PlusDomains_PersonCoverCoverPhoto $coverPhoto)
{
$this->coverPhoto = $coverPhoto;
}
public function getCoverPhoto()
{
return $this->coverPhoto;
}
public function setLayout($layout)
{
$this->layout = $layout;
}
public function getLayout()
{
return $this->layout;
}
}
class Google_Service_PlusDomains_PersonCoverCoverInfo extends Google_Model
{
public $leftImageOffset;
public $topImageOffset;
public function setLeftImageOffset($leftImageOffset)
{
$this->leftImageOffset = $leftImageOffset;
}
public function getLeftImageOffset()
{
return $this->leftImageOffset;
}
public function setTopImageOffset($topImageOffset)
{
$this->topImageOffset = $topImageOffset;
}
public function getTopImageOffset()
{
return $this->topImageOffset;
}
}
class Google_Service_PlusDomains_PersonCoverCoverPhoto extends Google_Model
{
public $height;
public $url;
public $width;
public function setHeight($height)
{
$this->height = $height;
}
public function getHeight()
{
return $this->height;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setWidth($width)
{
$this->width = $width;
}
public function getWidth()
{
return $this->width;
}
}
class Google_Service_PlusDomains_PersonEmails extends Google_Model
{
public $type;
public $value;
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setValue($value)
{
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}
class Google_Service_PlusDomains_PersonImage extends Google_Model
{
public $url;
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
}
class Google_Service_PlusDomains_PersonName extends Google_Model
{
public $familyName;
public $formatted;
public $givenName;
public $honorificPrefix;
public $honorificSuffix;
public $middleName;
public function setFamilyName($familyName)
{
$this->familyName = $familyName;
}
public function getFamilyName()
{
return $this->familyName;
}
public function setFormatted($formatted)
{
$this->formatted = $formatted;
}
public function getFormatted()
{
return $this->formatted;
}
public function setGivenName($givenName)
{
$this->givenName = $givenName;
}
public function getGivenName()
{
return $this->givenName;
}
public function setHonorificPrefix($honorificPrefix)
{
$this->honorificPrefix = $honorificPrefix;
}
public function getHonorificPrefix()
{
return $this->honorificPrefix;
}
public function setHonorificSuffix($honorificSuffix)
{
$this->honorificSuffix = $honorificSuffix;
}
public function getHonorificSuffix()
{
return $this->honorificSuffix;
}
public function setMiddleName($middleName)
{
$this->middleName = $middleName;
}
public function getMiddleName()
{
return $this->middleName;
}
}
class Google_Service_PlusDomains_PersonOrganizations extends Google_Model
{
public $department;
public $description;
public $endDate;
public $location;
public $name;
public $primary;
public $startDate;
public $title;
public $type;
public function setDepartment($department)
{
$this->department = $department;
}
public function getDepartment()
{
return $this->department;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setEndDate($endDate)
{
$this->endDate = $endDate;
}
public function getEndDate()
{
return $this->endDate;
}
public function setLocation($location)
{
$this->location = $location;
}
public function getLocation()
{
return $this->location;
}
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
public function setPrimary($primary)
{
$this->primary = $primary;
}
public function getPrimary()
{
return $this->primary;
}
public function setStartDate($startDate)
{
$this->startDate = $startDate;
}
public function getStartDate()
{
return $this->startDate;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getTitle()
{
return $this->title;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
}
class Google_Service_PlusDomains_PersonPlacesLived extends Google_Model
{
public $primary;
public $value;
public function setPrimary($primary)
{
$this->primary = $primary;
}
public function getPrimary()
{
return $this->primary;
}
public function setValue($value)
{
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}
class Google_Service_PlusDomains_PersonUrls extends Google_Model
{
public $label;
public $type;
public $value;
public function setLabel($label)
{
$this->label = $label;
}
public function getLabel()
{
return $this->label;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setValue($value)
{
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}
class Google_Service_PlusDomains_Place extends Google_Model
{
protected $addressType = 'Google_Service_PlusDomains_PlaceAddress';
protected $addressDataType = '';
public $displayName;
public $kind;
protected $positionType = 'Google_Service_PlusDomains_PlacePosition';
protected $positionDataType = '';
public function setAddress(Google_Service_PlusDomains_PlaceAddress $address)
{
$this->address = $address;
}
public function getAddress()
{
return $this->address;
}
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setPosition(Google_Service_PlusDomains_PlacePosition $position)
{
$this->position = $position;
}
public function getPosition()
{
return $this->position;
}
}
class Google_Service_PlusDomains_PlaceAddress extends Google_Model
{
public $formatted;
public function setFormatted($formatted)
{
$this->formatted = $formatted;
}
public function getFormatted()
{
return $this->formatted;
}
}
class Google_Service_PlusDomains_PlacePosition extends Google_Model
{
public $latitude;
public $longitude;
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
public function getLatitude()
{
return $this->latitude;
}
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
public function getLongitude()
{
return $this->longitude;
}
}
class Google_Service_PlusDomains_PlusDomainsAclentryResource extends Google_Model
{
public $displayName;
public $id;
public $type;
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
public function getDisplayName()
{
return $this->displayName;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
}
class Google_Service_PlusDomains_Videostream extends Google_Model
{
public $height;
public $type;
public $url;
public $width;
public function setHeight($height)
{
$this->height = $height;
}
public function getHeight()
{
return $this->height;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setUrl($url)
{
$this->url = $url;
}
public function getUrl()
{
return $this->url;
}
public function setWidth($width)
{
$this->width = $width;
}
public function getWidth()
{
return $this->width;
}
}
} | jmstar003/pronegosyo-local-mu | wp-content/plugins/snapshot/lib/destinations/google-drive/Google/Service/PlusDomains.php | PHP | gpl-2.0 | 85,047 |
/*
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package javax.media.j3d;
/**
* Abstract base class that defines a 2D array of depth (Z) values.
*/
abstract class DepthComponentRetained extends NodeComponentRetained {
// depth component types
static final int DEPTH_COMPONENT_TYPE_INT = 1;
static final int DEPTH_COMPONENT_TYPE_FLOAT = 2;
static final int DEPTH_COMPONENT_TYPE_NATIVE = DEPTH_COMPONENT_TYPE_INT;
// Width and height of DepthComponent---set by subclasses
int width;
int height;
int type;
/**
* Retrieves the width of this depth component object
* @return the width of the array of depth values
*/
int getWidth() {
return width;
}
/**
* Retrieves the height of this depth component object
* @return the height of the array of depth values
*/
int getHeight() {
return height;
}
}
| kephale/java3d-core | src/classes/share/javax/media/j3d/DepthComponentRetained.java | Java | gpl-2.0 | 2,057 |
#ifndef __ardour_mackie_control_protocol_fader_h__
#define __ardour_mackie_control_protocol_fader_h__
#include "controls.h"
namespace Mackie {
class Fader : public Control
{
public:
Fader (int id, std::string name, Group & group)
: Control (id, name, group)
, position (0.0)
{
}
MidiByteArray set_position (float);
MidiByteArray zero() { return set_position (0.0); }
MidiByteArray update_message ();
static Control* factory (Surface&, int id, const char*, Group&);
private:
float position;
};
}
#endif
| cth103/ardour-cth103 | libs/surfaces/mackie/fader.h | C | gpl-2.0 | 531 |
/**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2017 Paco Avila & Josep Llort
* <p>
* No bytes were intentionally harmed during the development of this application.
* <p>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.openkm.frontend.client.bean.form;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author jllort
*
*/
public class GWTSeparator extends GWTFormElement implements IsSerializable {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("label=");
sb.append(label);
sb.append(", name=");
sb.append(name);
sb.append(", width=");
sb.append(width);
sb.append(", height=");
sb.append(height);
sb.append("}");
return sb.toString();
}
} | Beau-M/document-management-system | src/main/java/com/openkm/frontend/client/bean/form/GWTSeparator.java | Java | gpl-2.0 | 1,470 |
/*
* @test
* @summary Test for Issue #1055
* @library .
* @compile NonN.java
* @compile -XDrawDiagnostics -processor org.checkerframework.checker.nullness.NullnessChecker -Astubs=NonN.astub Wildcards.java
*/
class Wildcards {
NonN<?> f = new NonN<Object>();
class LocalNonN<T extends Object> {}
LocalNonN<?> g = new LocalNonN<Object>();
}
| CharlesZ-Chen/checker-framework | checker/jtreg/stubs/wildcards/Wildcards.java | Java | gpl-2.0 | 360 |
/*
* f_fs.c -- user mode file system API for USB composite function controllers
*
* Copyright (C) 2010 Samsung Electronics
* Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
*
* Author: Michal Nazarewicz <mina86@mina86.com>
*
* Based on inode.c (GadgetFS) which was:
* Copyright (C) 2003-2004 David Brownell
* Copyright (C) 2003 Agilent Technologies
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
/* #define DEBUG */
/* #define VERBOSE_DEBUG */
#include <linux/blkdev.h>
#include <linux/pagemap.h>
#include <linux/export.h>
#include <linux/hid.h>
#include <asm/unaligned.h>
#include <linux/usb/composite.h>
#include <linux/usb/functionfs.h>
#define FUNCTIONFS_MAGIC 0xa647361 /* Chosen by a honest dice roll ;) */
/* Debugging ****************************************************************/
#ifdef VERBOSE_DEBUG
#ifndef pr_vdebug
# define pr_vdebug pr_debug
#endif /* pr_vdebug */
# define ffs_dump_mem(prefix, ptr, len) \
print_hex_dump_bytes(pr_fmt(prefix ": "), DUMP_PREFIX_NONE, ptr, len)
#else
#ifndef pr_vdebug
# define pr_vdebug(...) do { } while (0)
#endif /* pr_vdebug */
# define ffs_dump_mem(prefix, ptr, len) do { } while (0)
#endif /* VERBOSE_DEBUG */
#define ENTER() pr_vdebug("%s()\n", __func__)
/* The data structure and setup file ****************************************/
enum ffs_state {
/*
* Waiting for descriptors and strings.
*
* In this state no open(2), read(2) or write(2) on epfiles
* may succeed (which should not be the problem as there
* should be no such files opened in the first place).
*/
FFS_READ_DESCRIPTORS,
FFS_READ_STRINGS,
/*
* We've got descriptors and strings. We are or have called
* functionfs_ready_callback(). functionfs_bind() may have
* been called but we don't know.
*
* This is the only state in which operations on epfiles may
* succeed.
*/
FFS_ACTIVE,
/*
* All endpoints have been closed. This state is also set if
* we encounter an unrecoverable error. The only
* unrecoverable error is situation when after reading strings
* from user space we fail to initialise epfiles or
* functionfs_ready_callback() returns with error (<0).
*
* In this state no open(2), read(2) or write(2) (both on ep0
* as well as epfile) may succeed (at this point epfiles are
* unlinked and all closed so this is not a problem; ep0 is
* also closed but ep0 file exists and so open(2) on ep0 must
* fail).
*/
FFS_CLOSING
};
enum ffs_setup_state {
/* There is no setup request pending. */
FFS_NO_SETUP,
/*
* User has read events and there was a setup request event
* there. The next read/write on ep0 will handle the
* request.
*/
FFS_SETUP_PENDING,
/*
* There was event pending but before user space handled it
* some other event was introduced which canceled existing
* setup. If this state is set read/write on ep0 return
* -EIDRM. This state is only set when adding event.
*/
FFS_SETUP_CANCELED
};
struct ffs_epfile;
struct ffs_function;
struct ffs_data {
struct usb_gadget *gadget;
/*
* Protect access read/write operations, only one read/write
* at a time. As a consequence protects ep0req and company.
* While setup request is being processed (queued) this is
* held.
*/
struct mutex mutex;
/*
* Protect access to endpoint related structures (basically
* usb_ep_queue(), usb_ep_dequeue(), etc. calls) except for
* endpoint zero.
*/
spinlock_t eps_lock;
/*
* XXX REVISIT do we need our own request? Since we are not
* handling setup requests immediately user space may be so
* slow that another setup will be sent to the gadget but this
* time not to us but another function and then there could be
* a race. Is that the case? Or maybe we can use cdev->req
* after all, maybe we just need some spinlock for that?
*/
struct usb_request *ep0req; /* P: mutex */
struct completion ep0req_completion; /* P: mutex */
int ep0req_status; /* P: mutex */
/* reference counter */
atomic_t ref;
/* how many files are opened (EP0 and others) */
atomic_t opened;
/* EP0 state */
enum ffs_state state;
/*
* Possible transitions:
* + FFS_NO_SETUP -> FFS_SETUP_PENDING -- P: ev.waitq.lock
* happens only in ep0 read which is P: mutex
* + FFS_SETUP_PENDING -> FFS_NO_SETUP -- P: ev.waitq.lock
* happens only in ep0 i/o which is P: mutex
* + FFS_SETUP_PENDING -> FFS_SETUP_CANCELED -- P: ev.waitq.lock
* + FFS_SETUP_CANCELED -> FFS_NO_SETUP -- cmpxchg
*/
enum ffs_setup_state setup_state;
#define FFS_SETUP_STATE(ffs) \
((enum ffs_setup_state)cmpxchg(&(ffs)->setup_state, \
FFS_SETUP_CANCELED, FFS_NO_SETUP))
/* Events & such. */
struct {
u8 types[4];
unsigned short count;
/* XXX REVISIT need to update it in some places, or do we? */
unsigned short can_stall;
struct usb_ctrlrequest setup;
wait_queue_head_t waitq;
} ev; /* the whole structure, P: ev.waitq.lock */
/* Flags */
unsigned long flags;
#define FFS_FL_CALL_CLOSED_CALLBACK 0
#define FFS_FL_BOUND 1
/* Active function */
struct ffs_function *func;
/*
* Device name, write once when file system is mounted.
* Intended for user to read if she wants.
*/
const char *dev_name;
/* Private data for our user (ie. gadget). Managed by user. */
void *private_data;
/* filled by __ffs_data_got_descs() */
/*
* Real descriptors are 16 bytes after raw_descs (so you need
* to skip 16 bytes (ie. ffs->raw_descs + 16) to get to the
* first full speed descriptor).
* raw_[fs/hs/ss]_descs_length does not have those 16 bytes added.
* ss_descs are 8 bytes (ss_magic + count) pass the hs_descs
*/
const void *raw_descs;
const void *fs_descs;
const void *hs_descs;
const void *ss_descs;
unsigned raw_descs_length;
unsigned raw_fs_descs_length;
unsigned raw_hs_descs_length;
unsigned raw_ss_descs_length;
unsigned fs_descs_count;
unsigned hs_descs_count;
unsigned ss_descs_count;
unsigned short strings_count;
unsigned short interfaces_count;
unsigned short eps_count;
unsigned short _pad1;
/* filled by __ffs_data_got_strings() */
/* ids in stringtabs are set in functionfs_bind() */
const void *raw_strings;
struct usb_gadget_strings **stringtabs;
/*
* File system's super block, write once when file system is
* mounted.
*/
struct super_block *sb;
/* File permissions, written once when fs is mounted */
struct ffs_file_perms {
umode_t mode;
kuid_t uid;
kgid_t gid;
} file_perms;
/*
* The endpoint files, filled by ffs_epfiles_create(),
* destroyed by ffs_epfiles_destroy().
*/
struct ffs_epfile *epfiles;
};
/* Reference counter handling */
static void ffs_data_get(struct ffs_data *ffs);
static void ffs_data_put(struct ffs_data *ffs);
/* Creates new ffs_data object. */
static struct ffs_data *__must_check ffs_data_new(void) __attribute__((malloc));
/* Opened counter handling. */
static void ffs_data_opened(struct ffs_data *ffs);
static void ffs_data_closed(struct ffs_data *ffs);
/* Called with ffs->mutex held; take over ownership of data. */
static int __must_check
__ffs_data_got_descs(struct ffs_data *ffs, char *data, size_t len);
static int __must_check
__ffs_data_got_strings(struct ffs_data *ffs, char *data, size_t len);
/* The function structure ***************************************************/
struct ffs_ep;
struct ffs_function {
struct usb_configuration *conf;
struct usb_gadget *gadget;
struct ffs_data *ffs;
struct ffs_ep *eps;
u8 eps_revmap[16];
short *interfaces_nums;
struct usb_function function;
};
static struct ffs_function *ffs_func_from_usb(struct usb_function *f)
{
return container_of(f, struct ffs_function, function);
}
static void ffs_func_free(struct ffs_function *func);
static void ffs_func_eps_disable(struct ffs_function *func);
static int __must_check ffs_func_eps_enable(struct ffs_function *func);
static int ffs_func_bind(struct usb_configuration *,
struct usb_function *);
static void ffs_func_unbind(struct usb_configuration *,
struct usb_function *);
static int ffs_func_set_alt(struct usb_function *, unsigned, unsigned);
static void ffs_func_disable(struct usb_function *);
static int ffs_func_setup(struct usb_function *,
const struct usb_ctrlrequest *);
static void ffs_func_suspend(struct usb_function *);
static void ffs_func_resume(struct usb_function *);
static int ffs_func_revmap_ep(struct ffs_function *func, u8 num);
static int ffs_func_revmap_intf(struct ffs_function *func, u8 intf);
/* The endpoints structures *************************************************/
struct ffs_ep {
struct usb_ep *ep; /* P: ffs->eps_lock */
struct usb_request *req; /* P: epfile->mutex */
/* [0]: full speed, [1]: high speed, [2]: super speed */
struct usb_endpoint_descriptor *descs[3];
u8 num;
int status; /* P: epfile->mutex */
};
struct ffs_epfile {
/* Protects ep->ep and ep->req. */
struct mutex mutex;
wait_queue_head_t wait;
struct ffs_data *ffs;
struct ffs_ep *ep; /* P: ffs->eps_lock */
struct dentry *dentry;
char name[5];
unsigned char in; /* P: ffs->eps_lock */
unsigned char isoc; /* P: ffs->eps_lock */
unsigned char _pad;
};
static int __must_check ffs_epfiles_create(struct ffs_data *ffs);
static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count);
static struct inode *__must_check
ffs_sb_create_file(struct super_block *sb, const char *name, void *data,
const struct file_operations *fops,
struct dentry **dentry_p);
/* Misc helper functions ****************************************************/
static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)
__attribute__((warn_unused_result, nonnull));
static char *ffs_prepare_buffer(const char __user *buf, size_t len)
__attribute__((warn_unused_result, nonnull));
/* Control file aka ep0 *****************************************************/
static void ffs_ep0_complete(struct usb_ep *ep, struct usb_request *req)
{
struct ffs_data *ffs = req->context;
complete_all(&ffs->ep0req_completion);
}
static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)
{
struct usb_request *req = ffs->ep0req;
int ret;
req->zero = len < le16_to_cpu(ffs->ev.setup.wLength);
spin_unlock_irq(&ffs->ev.waitq.lock);
req->buf = data;
req->length = len;
/*
* UDC layer requires to provide a buffer even for ZLP, but should
* not use it at all. Let's provide some poisoned pointer to catch
* possible bug in the driver.
*/
if (req->buf == NULL)
req->buf = (void *)0xDEADBABE;
INIT_COMPLETION(ffs->ep0req_completion);
ret = usb_ep_queue(ffs->gadget->ep0, req, GFP_ATOMIC);
if (unlikely(ret < 0))
return ret;
ret = wait_for_completion_interruptible(&ffs->ep0req_completion);
if (unlikely(ret)) {
usb_ep_dequeue(ffs->gadget->ep0, req);
return -EINTR;
}
ffs->setup_state = FFS_NO_SETUP;
return ffs->ep0req_status;
}
static int __ffs_ep0_stall(struct ffs_data *ffs)
{
if (ffs->ev.can_stall) {
pr_vdebug("ep0 stall\n");
usb_ep_set_halt(ffs->gadget->ep0);
ffs->setup_state = FFS_NO_SETUP;
return -EL2HLT;
} else {
pr_debug("bogus ep0 stall!\n");
return -ESRCH;
}
}
static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
size_t len, loff_t *ptr)
{
struct ffs_data *ffs = file->private_data;
ssize_t ret;
char *data;
ENTER();
/* Fast check if setup was canceled */
if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELED)
return -EIDRM;
/* Acquire mutex */
ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);
if (unlikely(ret < 0))
return ret;
/* Check state */
switch (ffs->state) {
case FFS_READ_DESCRIPTORS:
case FFS_READ_STRINGS:
/* Copy data */
if (unlikely(len < 16)) {
ret = -EINVAL;
break;
}
data = ffs_prepare_buffer(buf, len);
if (IS_ERR(data)) {
ret = PTR_ERR(data);
break;
}
/* Handle data */
if (ffs->state == FFS_READ_DESCRIPTORS) {
pr_info("read descriptors\n");
ret = __ffs_data_got_descs(ffs, data, len);
if (unlikely(ret < 0))
break;
ffs->state = FFS_READ_STRINGS;
ret = len;
} else {
pr_info("read strings\n");
ret = __ffs_data_got_strings(ffs, data, len);
if (unlikely(ret < 0))
break;
ret = ffs_epfiles_create(ffs);
if (unlikely(ret)) {
ffs->state = FFS_CLOSING;
break;
}
ffs->state = FFS_ACTIVE;
mutex_unlock(&ffs->mutex);
ret = functionfs_ready_callback(ffs);
if (unlikely(ret < 0)) {
ffs->state = FFS_CLOSING;
return ret;
}
set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);
return len;
}
break;
case FFS_ACTIVE:
data = NULL;
/*
* We're called from user space, we can use _irq
* rather then _irqsave
*/
spin_lock_irq(&ffs->ev.waitq.lock);
switch (FFS_SETUP_STATE(ffs)) {
case FFS_SETUP_CANCELED:
ret = -EIDRM;
goto done_spin;
case FFS_NO_SETUP:
ret = -ESRCH;
goto done_spin;
case FFS_SETUP_PENDING:
break;
}
/* FFS_SETUP_PENDING */
if (!(ffs->ev.setup.bRequestType & USB_DIR_IN)) {
spin_unlock_irq(&ffs->ev.waitq.lock);
ret = __ffs_ep0_stall(ffs);
break;
}
/* FFS_SETUP_PENDING and not stall */
len = min(len, (size_t)le16_to_cpu(ffs->ev.setup.wLength));
spin_unlock_irq(&ffs->ev.waitq.lock);
data = ffs_prepare_buffer(buf, len);
if (IS_ERR(data)) {
ret = PTR_ERR(data);
break;
}
spin_lock_irq(&ffs->ev.waitq.lock);
/*
* We are guaranteed to be still in FFS_ACTIVE state
* but the state of setup could have changed from
* FFS_SETUP_PENDING to FFS_SETUP_CANCELED so we need
* to check for that. If that happened we copied data
* from user space in vain but it's unlikely.
*
* For sure we are not in FFS_NO_SETUP since this is
* the only place FFS_SETUP_PENDING -> FFS_NO_SETUP
* transition can be performed and it's protected by
* mutex.
*/
if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELED) {
ret = -EIDRM;
done_spin:
spin_unlock_irq(&ffs->ev.waitq.lock);
} else {
/* unlocks spinlock */
ret = __ffs_ep0_queue_wait(ffs, data, len);
}
kfree(data);
break;
default:
ret = -EBADFD;
break;
}
mutex_unlock(&ffs->mutex);
return ret;
}
static ssize_t __ffs_ep0_read_events(struct ffs_data *ffs, char __user *buf,
size_t n)
{
/*
* We are holding ffs->ev.waitq.lock and ffs->mutex and we need
* to release them.
*/
struct usb_functionfs_event events[n];
unsigned i = 0;
memset(events, 0, sizeof events);
do {
events[i].type = ffs->ev.types[i];
if (events[i].type == FUNCTIONFS_SETUP) {
events[i].u.setup = ffs->ev.setup;
ffs->setup_state = FFS_SETUP_PENDING;
}
} while (++i < n);
if (n < ffs->ev.count) {
ffs->ev.count -= n;
memmove(ffs->ev.types, ffs->ev.types + n,
ffs->ev.count * sizeof *ffs->ev.types);
} else {
ffs->ev.count = 0;
}
spin_unlock_irq(&ffs->ev.waitq.lock);
mutex_unlock(&ffs->mutex);
return unlikely(__copy_to_user(buf, events, sizeof events))
? -EFAULT : sizeof events;
}
static ssize_t ffs_ep0_read(struct file *file, char __user *buf,
size_t len, loff_t *ptr)
{
struct ffs_data *ffs = file->private_data;
char *data = NULL;
size_t n;
int ret;
ENTER();
/* Fast check if setup was canceled */
if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELED)
return -EIDRM;
/* Acquire mutex */
ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK);
if (unlikely(ret < 0))
return ret;
/* Check state */
if (ffs->state != FFS_ACTIVE) {
ret = -EBADFD;
goto done_mutex;
}
/*
* We're called from user space, we can use _irq rather then
* _irqsave
*/
spin_lock_irq(&ffs->ev.waitq.lock);
switch (FFS_SETUP_STATE(ffs)) {
case FFS_SETUP_CANCELED:
ret = -EIDRM;
break;
case FFS_NO_SETUP:
n = len / sizeof(struct usb_functionfs_event);
if (unlikely(!n)) {
ret = -EINVAL;
break;
}
if ((file->f_flags & O_NONBLOCK) && !ffs->ev.count) {
ret = -EAGAIN;
break;
}
if (wait_event_interruptible_exclusive_locked_irq(ffs->ev.waitq,
ffs->ev.count)) {
ret = -EINTR;
break;
}
return __ffs_ep0_read_events(ffs, buf,
min(n, (size_t)ffs->ev.count));
case FFS_SETUP_PENDING:
if (ffs->ev.setup.bRequestType & USB_DIR_IN) {
spin_unlock_irq(&ffs->ev.waitq.lock);
ret = __ffs_ep0_stall(ffs);
goto done_mutex;
}
len = min(len, (size_t)le16_to_cpu(ffs->ev.setup.wLength));
spin_unlock_irq(&ffs->ev.waitq.lock);
if (likely(len)) {
data = kmalloc(len, GFP_KERNEL);
if (unlikely(!data)) {
ret = -ENOMEM;
goto done_mutex;
}
}
spin_lock_irq(&ffs->ev.waitq.lock);
/* See ffs_ep0_write() */
if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELED) {
ret = -EIDRM;
break;
}
/* unlocks spinlock */
ret = __ffs_ep0_queue_wait(ffs, data, len);
if (likely(ret > 0) && unlikely(__copy_to_user(buf, data, len)))
ret = -EFAULT;
goto done_mutex;
default:
ret = -EBADFD;
break;
}
spin_unlock_irq(&ffs->ev.waitq.lock);
done_mutex:
mutex_unlock(&ffs->mutex);
kfree(data);
return ret;
}
static int ffs_ep0_open(struct inode *inode, struct file *file)
{
struct ffs_data *ffs = inode->i_private;
ENTER();
if (unlikely(ffs->state == FFS_CLOSING))
return -EBUSY;
file->private_data = ffs;
ffs_data_opened(ffs);
return 0;
}
static int ffs_ep0_release(struct inode *inode, struct file *file)
{
struct ffs_data *ffs = file->private_data;
ENTER();
ffs_data_closed(ffs);
return 0;
}
static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
{
struct ffs_data *ffs = file->private_data;
struct usb_gadget *gadget = ffs->gadget;
long ret;
ENTER();
if (code == FUNCTIONFS_INTERFACE_REVMAP) {
struct ffs_function *func = ffs->func;
ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
} else if (gadget && gadget->ops->ioctl) {
ret = gadget->ops->ioctl(gadget, code, value);
} else {
ret = -ENOTTY;
}
return ret;
}
static const struct file_operations ffs_ep0_operations = {
.llseek = no_llseek,
.open = ffs_ep0_open,
.write = ffs_ep0_write,
.read = ffs_ep0_read,
.release = ffs_ep0_release,
.unlocked_ioctl = ffs_ep0_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ffs_ep0_ioctl,
#endif
};
/* "Normal" endpoints operations ********************************************/
static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req)
{
ENTER();
if (likely(req->context)) {
struct ffs_ep *ep = _ep->driver_data;
ep->status = req->status ? req->status : req->actual;
complete(req->context);
}
}
static ssize_t ffs_epfile_io(struct file *file,
char __user *buf, size_t len, int read)
{
struct ffs_epfile *epfile = file->private_data;
struct ffs_ep *ep;
char *data = NULL;
ssize_t ret;
int halt;
goto first_try;
do {
spin_unlock_irq(&epfile->ffs->eps_lock);
mutex_unlock(&epfile->mutex);
first_try:
/* Are we still active? */
if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) {
ret = -ENODEV;
goto error;
}
/* Wait for endpoint to be enabled */
ep = epfile->ep;
if (!ep) {
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
goto error;
}
if (wait_event_interruptible(epfile->wait,
(ep = epfile->ep))) {
ret = -EINTR;
goto error;
}
}
/* Do we halt? */
halt = !read == !epfile->in;
if (halt && epfile->isoc) {
ret = -EINVAL;
goto error;
}
/* Allocate & copy */
if (!halt && !data) {
data = kzalloc(len, GFP_KERNEL);
if (unlikely(!data))
return -ENOMEM;
if (!read &&
unlikely(__copy_from_user(data, buf, len))) {
ret = -EFAULT;
goto error;
}
}
/* We will be using request */
ret = ffs_mutex_lock(&epfile->mutex,
file->f_flags & O_NONBLOCK);
if (unlikely(ret))
goto error;
/*
* We're called from user space, we can use _irq rather then
* _irqsave
*/
spin_lock_irq(&epfile->ffs->eps_lock);
/*
* While we were acquiring mutex endpoint got disabled
* or changed?
*/
} while (unlikely(epfile->ep != ep));
/* Halt */
if (unlikely(halt)) {
if (likely(epfile->ep == ep) && !WARN_ON(!ep->ep))
usb_ep_set_halt(ep->ep);
spin_unlock_irq(&epfile->ffs->eps_lock);
ret = -EBADMSG;
} else {
/* Fire the request */
DECLARE_COMPLETION_ONSTACK(done);
struct usb_request *req = ep->req;
req->context = &done;
req->complete = ffs_epfile_io_complete;
req->buf = data;
req->length = len;
ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
spin_unlock_irq(&epfile->ffs->eps_lock);
if (unlikely(ret < 0)) {
/* nop */
} else if (unlikely(wait_for_completion_interruptible(&done))) {
ret = -EINTR;
usb_ep_dequeue(ep->ep, req);
} else {
ret = ep->status;
if (read && ret > 0 &&
unlikely(copy_to_user(buf, data, ret)))
ret = -EFAULT;
}
}
mutex_unlock(&epfile->mutex);
error:
kfree(data);
return ret;
}
static ssize_t
ffs_epfile_write(struct file *file, const char __user *buf, size_t len,
loff_t *ptr)
{
ENTER();
return ffs_epfile_io(file, (char __user *)buf, len, 0);
}
static ssize_t
ffs_epfile_read(struct file *file, char __user *buf, size_t len, loff_t *ptr)
{
ENTER();
return ffs_epfile_io(file, buf, len, 1);
}
static int
ffs_epfile_open(struct inode *inode, struct file *file)
{
struct ffs_epfile *epfile = inode->i_private;
ENTER();
if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
return -ENODEV;
file->private_data = epfile;
ffs_data_opened(epfile->ffs);
return 0;
}
static int
ffs_epfile_release(struct inode *inode, struct file *file)
{
struct ffs_epfile *epfile = inode->i_private;
ENTER();
ffs_data_closed(epfile->ffs);
return 0;
}
static long ffs_epfile_ioctl(struct file *file, unsigned code,
unsigned long value)
{
struct ffs_epfile *epfile = file->private_data;
int ret;
ENTER();
if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
return -ENODEV;
spin_lock_irq(&epfile->ffs->eps_lock);
if (likely(epfile->ep)) {
switch (code) {
case FUNCTIONFS_FIFO_STATUS:
ret = usb_ep_fifo_status(epfile->ep->ep);
break;
case FUNCTIONFS_FIFO_FLUSH:
usb_ep_fifo_flush(epfile->ep->ep);
ret = 0;
break;
case FUNCTIONFS_CLEAR_HALT:
ret = usb_ep_clear_halt(epfile->ep->ep);
break;
case FUNCTIONFS_ENDPOINT_REVMAP:
ret = epfile->ep->num;
break;
default:
ret = -ENOTTY;
}
} else {
ret = -ENODEV;
}
spin_unlock_irq(&epfile->ffs->eps_lock);
return ret;
}
static const struct file_operations ffs_epfile_operations = {
.llseek = no_llseek,
.open = ffs_epfile_open,
.write = ffs_epfile_write,
.read = ffs_epfile_read,
.release = ffs_epfile_release,
.unlocked_ioctl = ffs_epfile_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ffs_epfile_ioctl,
#endif
};
/* File system and super block operations ***********************************/
/*
* Mounting the file system creates a controller file, used first for
* function configuration then later for event monitoring.
*/
static struct inode *__must_check
ffs_sb_make_inode(struct super_block *sb, void *data,
const struct file_operations *fops,
const struct inode_operations *iops,
struct ffs_file_perms *perms)
{
struct inode *inode;
ENTER();
inode = new_inode(sb);
if (likely(inode)) {
struct timespec current_time = CURRENT_TIME;
inode->i_ino = get_next_ino();
inode->i_mode = perms->mode;
inode->i_uid = perms->uid;
inode->i_gid = perms->gid;
inode->i_atime = current_time;
inode->i_mtime = current_time;
inode->i_ctime = current_time;
inode->i_private = data;
if (fops)
inode->i_fop = fops;
if (iops)
inode->i_op = iops;
}
return inode;
}
/* Create "regular" file */
static struct inode *ffs_sb_create_file(struct super_block *sb,
const char *name, void *data,
const struct file_operations *fops,
struct dentry **dentry_p)
{
struct ffs_data *ffs = sb->s_fs_info;
struct dentry *dentry;
struct inode *inode;
ENTER();
dentry = d_alloc_name(sb->s_root, name);
if (unlikely(!dentry))
return NULL;
inode = ffs_sb_make_inode(sb, data, fops, NULL, &ffs->file_perms);
if (unlikely(!inode)) {
dput(dentry);
return NULL;
}
d_add(dentry, inode);
if (dentry_p)
*dentry_p = dentry;
return inode;
}
/* Super block */
static const struct super_operations ffs_sb_operations = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
};
struct ffs_sb_fill_data {
struct ffs_file_perms perms;
umode_t root_mode;
const char *dev_name;
struct ffs_data *ffs_data;
};
static int ffs_sb_fill(struct super_block *sb, void *_data, int silent)
{
struct ffs_sb_fill_data *data = _data;
struct inode *inode;
struct ffs_data *ffs = data->ffs_data;
ENTER();
ffs->sb = sb;
data->ffs_data = NULL;
sb->s_fs_info = ffs;
sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = FUNCTIONFS_MAGIC;
sb->s_op = &ffs_sb_operations;
sb->s_time_gran = 1;
/* Root inode */
data->perms.mode = data->root_mode;
inode = ffs_sb_make_inode(sb, NULL,
&simple_dir_operations,
&simple_dir_inode_operations,
&data->perms);
sb->s_root = d_make_root(inode);
if (unlikely(!sb->s_root))
return -ENOMEM;
/* EP0 file */
if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs,
&ffs_ep0_operations, NULL)))
return -ENOMEM;
return 0;
}
static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
{
ENTER();
if (!opts || !*opts)
return 0;
for (;;) {
unsigned long value;
char *eq, *comma;
/* Option limit */
comma = strchr(opts, ',');
if (comma)
*comma = 0;
/* Value limit */
eq = strchr(opts, '=');
if (unlikely(!eq)) {
pr_err("'=' missing in %s\n", opts);
return -EINVAL;
}
*eq = 0;
/* Parse value */
if (kstrtoul(eq + 1, 0, &value)) {
pr_err("%s: invalid value: %s\n", opts, eq + 1);
return -EINVAL;
}
/* Interpret option */
switch (eq - opts) {
case 5:
if (!memcmp(opts, "rmode", 5))
data->root_mode = (value & 0555) | S_IFDIR;
else if (!memcmp(opts, "fmode", 5))
data->perms.mode = (value & 0666) | S_IFREG;
else
goto invalid;
break;
case 4:
if (!memcmp(opts, "mode", 4)) {
data->root_mode = (value & 0555) | S_IFDIR;
data->perms.mode = (value & 0666) | S_IFREG;
} else {
goto invalid;
}
break;
case 3:
if (!memcmp(opts, "uid", 3)) {
data->perms.uid = make_kuid(current_user_ns(), value);
if (!uid_valid(data->perms.uid)) {
pr_err("%s: unmapped value: %lu\n", opts, value);
return -EINVAL;
}
} else if (!memcmp(opts, "gid", 3)) {
data->perms.gid = make_kgid(current_user_ns(), value);
if (!gid_valid(data->perms.gid)) {
pr_err("%s: unmapped value: %lu\n", opts, value);
return -EINVAL;
}
} else {
goto invalid;
}
break;
default:
invalid:
pr_err("%s: invalid option\n", opts);
return -EINVAL;
}
/* Next iteration */
if (!comma)
break;
opts = comma + 1;
}
return 0;
}
/* "mount -t functionfs dev_name /dev/function" ends up here */
static struct dentry *
ffs_fs_mount(struct file_system_type *t, int flags,
const char *dev_name, void *opts)
{
struct ffs_sb_fill_data data = {
.perms = {
.mode = S_IFREG | 0600,
.uid = GLOBAL_ROOT_UID,
.gid = GLOBAL_ROOT_GID,
},
.root_mode = S_IFDIR | 0500,
};
struct dentry *rv;
int ret;
void *ffs_dev;
struct ffs_data *ffs;
ENTER();
ret = ffs_fs_parse_opts(&data, opts);
if (unlikely(ret < 0))
return ERR_PTR(ret);
ffs = ffs_data_new();
if (unlikely(!ffs))
return ERR_PTR(-ENOMEM);
ffs->file_perms = data.perms;
ffs->dev_name = kstrdup(dev_name, GFP_KERNEL);
if (unlikely(!ffs->dev_name)) {
ffs_data_put(ffs);
return ERR_PTR(-ENOMEM);
}
ffs_dev = functionfs_acquire_dev_callback(dev_name);
if (IS_ERR(ffs_dev)) {
ffs_data_put(ffs);
return ERR_CAST(ffs_dev);
}
ffs->private_data = ffs_dev;
data.ffs_data = ffs;
rv = mount_nodev(t, flags, &data, ffs_sb_fill);
if (IS_ERR(rv) && data.ffs_data) {
functionfs_release_dev_callback(data.ffs_data);
ffs_data_put(data.ffs_data);
}
return rv;
}
static void
ffs_fs_kill_sb(struct super_block *sb)
{
ENTER();
kill_litter_super(sb);
if (sb->s_fs_info) {
functionfs_release_dev_callback(sb->s_fs_info);
ffs_data_put(sb->s_fs_info);
}
}
static struct file_system_type ffs_fs_type = {
.owner = THIS_MODULE,
.name = "functionfs",
.mount = ffs_fs_mount,
.kill_sb = ffs_fs_kill_sb,
};
MODULE_ALIAS_FS("functionfs");
/* Driver's main init/cleanup functions *************************************/
static int functionfs_init(void)
{
int ret;
ENTER();
ret = register_filesystem(&ffs_fs_type);
if (likely(!ret))
pr_info("file system registered\n");
else
pr_err("failed registering file system (%d)\n", ret);
return ret;
}
static void functionfs_cleanup(void)
{
ENTER();
pr_info("unloading\n");
unregister_filesystem(&ffs_fs_type);
}
/* ffs_data and ffs_function construction and destruction code **************/
static void ffs_data_clear(struct ffs_data *ffs);
static void ffs_data_reset(struct ffs_data *ffs);
static void ffs_data_get(struct ffs_data *ffs)
{
ENTER();
atomic_inc(&ffs->ref);
}
static void ffs_data_opened(struct ffs_data *ffs)
{
ENTER();
atomic_inc(&ffs->ref);
atomic_inc(&ffs->opened);
}
static void ffs_data_put(struct ffs_data *ffs)
{
ENTER();
if (unlikely(atomic_dec_and_test(&ffs->ref))) {
pr_info("%s(): freeing\n", __func__);
ffs_data_clear(ffs);
BUG_ON(waitqueue_active(&ffs->ev.waitq) ||
waitqueue_active(&ffs->ep0req_completion.wait));
kfree(ffs->dev_name);
kfree(ffs);
}
}
static void ffs_data_closed(struct ffs_data *ffs)
{
ENTER();
if (atomic_dec_and_test(&ffs->opened)) {
ffs->state = FFS_CLOSING;
ffs_data_reset(ffs);
}
ffs_data_put(ffs);
}
static struct ffs_data *ffs_data_new(void)
{
struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);
if (unlikely(!ffs))
return 0;
ENTER();
atomic_set(&ffs->ref, 1);
atomic_set(&ffs->opened, 0);
ffs->state = FFS_READ_DESCRIPTORS;
mutex_init(&ffs->mutex);
spin_lock_init(&ffs->eps_lock);
init_waitqueue_head(&ffs->ev.waitq);
init_completion(&ffs->ep0req_completion);
/* XXX REVISIT need to update it in some places, or do we? */
ffs->ev.can_stall = 1;
return ffs;
}
static void ffs_data_clear(struct ffs_data *ffs)
{
ENTER();
if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags))
functionfs_closed_callback(ffs);
BUG_ON(ffs->gadget);
if (ffs->epfiles)
ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
kfree(ffs->raw_descs);
kfree(ffs->raw_strings);
kfree(ffs->stringtabs);
}
static void ffs_data_reset(struct ffs_data *ffs)
{
ENTER();
ffs_data_clear(ffs);
ffs->epfiles = NULL;
ffs->raw_descs = NULL;
ffs->raw_strings = NULL;
ffs->stringtabs = NULL;
ffs->raw_descs_length = 0;
ffs->raw_fs_descs_length = 0;
ffs->fs_descs_count = 0;
ffs->hs_descs_count = 0;
ffs->ss_descs_count = 0;
ffs->strings_count = 0;
ffs->interfaces_count = 0;
ffs->eps_count = 0;
ffs->ev.count = 0;
ffs->state = FFS_READ_DESCRIPTORS;
ffs->setup_state = FFS_NO_SETUP;
ffs->flags = 0;
}
static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
{
struct usb_gadget_strings **lang;
int first_id;
ENTER();
if (WARN_ON(ffs->state != FFS_ACTIVE
|| test_and_set_bit(FFS_FL_BOUND, &ffs->flags)))
return -EBADFD;
first_id = usb_string_ids_n(cdev, ffs->strings_count);
if (unlikely(first_id < 0))
return first_id;
ffs->ep0req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
if (unlikely(!ffs->ep0req))
return -ENOMEM;
ffs->ep0req->complete = ffs_ep0_complete;
ffs->ep0req->context = ffs;
lang = ffs->stringtabs;
if (lang) {
for (; *lang; ++lang) {
struct usb_string *str = (*lang)->strings;
int id = first_id;
for (; str->s; ++id, ++str)
str->id = id;
}
}
ffs->gadget = cdev->gadget;
ffs_data_get(ffs);
return 0;
}
static void functionfs_unbind(struct ffs_data *ffs)
{
ENTER();
if (!WARN_ON(!ffs->gadget)) {
usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);
ffs->ep0req = NULL;
ffs->gadget = NULL;
ffs_data_put(ffs);
clear_bit(FFS_FL_BOUND, &ffs->flags);
}
}
static int ffs_epfiles_create(struct ffs_data *ffs)
{
struct ffs_epfile *epfile, *epfiles;
unsigned i, count;
ENTER();
count = ffs->eps_count;
epfiles = kcalloc(count, sizeof(*epfiles), GFP_KERNEL);
if (!epfiles)
return -ENOMEM;
epfile = epfiles;
for (i = 1; i <= count; ++i, ++epfile) {
epfile->ffs = ffs;
mutex_init(&epfile->mutex);
init_waitqueue_head(&epfile->wait);
sprintf(epfiles->name, "ep%u", i);
if (!unlikely(ffs_sb_create_file(ffs->sb, epfiles->name, epfile,
&ffs_epfile_operations,
&epfile->dentry))) {
ffs_epfiles_destroy(epfiles, i - 1);
return -ENOMEM;
}
}
ffs->epfiles = epfiles;
return 0;
}
static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count)
{
struct ffs_epfile *epfile = epfiles;
ENTER();
for (; count; --count, ++epfile) {
BUG_ON(mutex_is_locked(&epfile->mutex) ||
waitqueue_active(&epfile->wait));
if (epfile->dentry) {
d_delete(epfile->dentry);
dput(epfile->dentry);
epfile->dentry = NULL;
}
}
kfree(epfiles);
}
static int functionfs_bind_config(struct usb_composite_dev *cdev,
struct usb_configuration *c,
struct ffs_data *ffs)
{
struct ffs_function *func;
int ret;
ENTER();
func = kzalloc(sizeof *func, GFP_KERNEL);
if (unlikely(!func))
return -ENOMEM;
func->function.name = "Function FS Gadget";
func->function.strings = ffs->stringtabs;
func->function.bind = ffs_func_bind;
func->function.unbind = ffs_func_unbind;
func->function.set_alt = ffs_func_set_alt;
func->function.disable = ffs_func_disable;
func->function.setup = ffs_func_setup;
func->function.suspend = ffs_func_suspend;
func->function.resume = ffs_func_resume;
func->conf = c;
func->gadget = cdev->gadget;
func->ffs = ffs;
ffs_data_get(ffs);
ret = usb_add_function(c, &func->function);
if (unlikely(ret))
ffs_func_free(func);
return ret;
}
static void ffs_func_free(struct ffs_function *func)
{
struct ffs_ep *ep = func->eps;
unsigned count = func->ffs->eps_count;
unsigned long flags;
ENTER();
/* cleanup after autoconfig */
spin_lock_irqsave(&func->ffs->eps_lock, flags);
do {
if (ep->ep && ep->req)
usb_ep_free_request(ep->ep, ep->req);
ep->req = NULL;
++ep;
} while (--count);
spin_unlock_irqrestore(&func->ffs->eps_lock, flags);
ffs_data_put(func->ffs);
kfree(func->eps);
/*
* eps and interfaces_nums are allocated in the same chunk so
* only one free is required. Descriptors are also allocated
* in the same chunk.
*/
kfree(func);
}
static void ffs_func_eps_disable(struct ffs_function *func)
{
struct ffs_ep *ep = func->eps;
struct ffs_epfile *epfile = func->ffs->epfiles;
unsigned count = func->ffs->eps_count;
unsigned long flags;
spin_lock_irqsave(&func->ffs->eps_lock, flags);
do {
/* pending requests get nuked */
if (likely(ep->ep))
usb_ep_disable(ep->ep);
epfile->ep = NULL;
++ep;
++epfile;
} while (--count);
spin_unlock_irqrestore(&func->ffs->eps_lock, flags);
}
static int ffs_func_eps_enable(struct ffs_function *func)
{
struct ffs_data *ffs = func->ffs;
struct ffs_ep *ep = func->eps;
struct ffs_epfile *epfile = ffs->epfiles;
unsigned count = ffs->eps_count;
unsigned long flags;
int ret = 0;
spin_lock_irqsave(&func->ffs->eps_lock, flags);
do {
struct usb_endpoint_descriptor *ds;
int desc_idx;
if (ffs->gadget->speed == USB_SPEED_SUPER)
desc_idx = 2;
else if (ffs->gadget->speed == USB_SPEED_HIGH)
desc_idx = 1;
else
desc_idx = 0;
/* fall-back to lower speed if desc missing for current speed */
do {
ds = ep->descs[desc_idx];
} while (!ds && --desc_idx >= 0);
if (!ds) {
ret = -EINVAL;
break;
}
ep->ep->driver_data = ep;
ep->ep->desc = ds;
config_ep_by_speed(ffs->gadget, &func->function, ep->ep);
ret = usb_ep_enable(ep->ep);
if (likely(!ret)) {
epfile->ep = ep;
epfile->in = usb_endpoint_dir_in(ds);
epfile->isoc = usb_endpoint_xfer_isoc(ds);
} else {
break;
}
wake_up(&epfile->wait);
++ep;
++epfile;
} while (--count);
spin_unlock_irqrestore(&func->ffs->eps_lock, flags);
return ret;
}
/* Parsing and building descriptors and strings *****************************/
/*
* This validates if data pointed by data is a valid USB descriptor as
* well as record how many interfaces, endpoints and strings are
* required by given configuration. Returns address after the
* descriptor or NULL if data is invalid.
*/
enum ffs_entity_type {
FFS_DESCRIPTOR, FFS_INTERFACE, FFS_STRING, FFS_ENDPOINT
};
typedef int (*ffs_entity_callback)(enum ffs_entity_type entity,
u8 *valuep,
struct usb_descriptor_header *desc,
void *priv);
static int __must_check ffs_do_desc(char *data, unsigned len,
ffs_entity_callback entity, void *priv)
{
struct usb_descriptor_header *_ds = (void *)data;
u8 length;
int ret;
ENTER();
/* At least two bytes are required: length and type */
if (len < 2) {
pr_vdebug("descriptor too short\n");
return -EINVAL;
}
/* If we have at least as many bytes as the descriptor takes? */
length = _ds->bLength;
if (len < length) {
pr_vdebug("descriptor longer then available data\n");
return -EINVAL;
}
#define __entity_check_INTERFACE(val) 1
#define __entity_check_STRING(val) (val)
#define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK)
#define __entity(type, val) do { \
pr_vdebug("entity " #type "(%02x)\n", (val)); \
if (unlikely(!__entity_check_ ##type(val))) { \
pr_vdebug("invalid entity's value\n"); \
return -EINVAL; \
} \
ret = entity(FFS_ ##type, &val, _ds, priv); \
if (unlikely(ret < 0)) { \
pr_debug("entity " #type "(%02x); ret = %d\n", \
(val), ret); \
return ret; \
} \
} while (0)
/* Parse descriptor depending on type. */
switch (_ds->bDescriptorType) {
case USB_DT_DEVICE:
case USB_DT_CONFIG:
case USB_DT_STRING:
case USB_DT_DEVICE_QUALIFIER:
/* function can't have any of those */
pr_vdebug("descriptor reserved for gadget: %d\n",
_ds->bDescriptorType);
return -EINVAL;
case USB_DT_INTERFACE: {
struct usb_interface_descriptor *ds = (void *)_ds;
pr_vdebug("interface descriptor\n");
if (length != sizeof *ds)
goto inv_length;
__entity(INTERFACE, ds->bInterfaceNumber);
if (ds->iInterface)
__entity(STRING, ds->iInterface);
}
break;
case USB_DT_ENDPOINT: {
struct usb_endpoint_descriptor *ds = (void *)_ds;
pr_vdebug("endpoint descriptor\n");
if (length != USB_DT_ENDPOINT_SIZE &&
length != USB_DT_ENDPOINT_AUDIO_SIZE)
goto inv_length;
__entity(ENDPOINT, ds->bEndpointAddress);
}
break;
case HID_DT_HID:
pr_vdebug("hid descriptor\n");
if (length != sizeof(struct hid_descriptor))
goto inv_length;
break;
case USB_DT_OTG:
if (length != sizeof(struct usb_otg_descriptor))
goto inv_length;
break;
case USB_DT_INTERFACE_ASSOCIATION: {
struct usb_interface_assoc_descriptor *ds = (void *)_ds;
pr_vdebug("interface association descriptor\n");
if (length != sizeof *ds)
goto inv_length;
if (ds->iFunction)
__entity(STRING, ds->iFunction);
}
break;
case USB_DT_SS_ENDPOINT_COMP:
pr_vdebug("EP SS companion descriptor\n");
if (length != sizeof(struct usb_ss_ep_comp_descriptor))
goto inv_length;
break;
case USB_DT_OTHER_SPEED_CONFIG:
case USB_DT_INTERFACE_POWER:
case USB_DT_DEBUG:
case USB_DT_SECURITY:
case USB_DT_CS_RADIO_CONTROL:
/* TODO */
pr_vdebug("unimplemented descriptor: %d\n", _ds->bDescriptorType);
return -EINVAL;
default:
/* We should never be here */
pr_vdebug("unknown descriptor: %d\n", _ds->bDescriptorType);
return -EINVAL;
inv_length:
pr_vdebug("invalid length: %d (descriptor %d)\n",
_ds->bLength, _ds->bDescriptorType);
return -EINVAL;
}
#undef __entity
#undef __entity_check_DESCRIPTOR
#undef __entity_check_INTERFACE
#undef __entity_check_STRING
#undef __entity_check_ENDPOINT
return length;
}
static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len,
ffs_entity_callback entity, void *priv)
{
const unsigned _len = len;
unsigned long num = 0;
ENTER();
for (;;) {
int ret;
if (num == count)
data = NULL;
/* Record "descriptor" entity */
ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv);
if (unlikely(ret < 0)) {
pr_debug("entity DESCRIPTOR(%02lx); ret = %d\n",
num, ret);
return ret;
}
if (!data)
return _len - len;
ret = ffs_do_desc(data, len, entity, priv);
if (unlikely(ret < 0)) {
pr_debug("%s returns %d\n", __func__, ret);
return ret;
}
len -= ret;
data += ret;
++num;
}
}
static int __ffs_data_do_entity(enum ffs_entity_type type,
u8 *valuep, struct usb_descriptor_header *desc,
void *priv)
{
struct ffs_data *ffs = priv;
ENTER();
switch (type) {
case FFS_DESCRIPTOR:
break;
case FFS_INTERFACE:
/*
* Interfaces are indexed from zero so if we
* encountered interface "n" then there are at least
* "n+1" interfaces.
*/
if (*valuep >= ffs->interfaces_count)
ffs->interfaces_count = *valuep + 1;
break;
case FFS_STRING:
/*
* Strings are indexed from 1 (0 is magic ;) reserved
* for languages list or some such)
*/
if (*valuep > ffs->strings_count)
ffs->strings_count = *valuep;
break;
case FFS_ENDPOINT:
/* Endpoints are indexed from 1 as well. */
if ((*valuep & USB_ENDPOINT_NUMBER_MASK) > ffs->eps_count)
ffs->eps_count = (*valuep & USB_ENDPOINT_NUMBER_MASK);
break;
}
return 0;
}
static int __ffs_data_got_descs(struct ffs_data *ffs,
char *const _data, size_t len)
{
unsigned fs_count, hs_count, ss_count = 0;
int fs_len, hs_len, ss_len, ver, ret = -EINVAL;
char *data = _data;
ENTER();
if (get_unaligned_le32(data + 4) != len)
goto error;
ver = get_unaligned_le32(data);
switch (ver) {
case FUNCTIONFS_DESCRIPTORS_MAGIC:
fs_count = get_unaligned_le32(data + 8);
hs_count = get_unaligned_le32(data + 12);
if (!fs_count && !hs_count)
goto einval;
ffs->raw_descs_length = len;
ffs->raw_descs = _data;
data += 16;
len -= 16;
break;
case FUNCTIONFS_DESCRIPTORS_MAGIC_V2:
fs_count = get_unaligned_le32(data + 12);
hs_count = get_unaligned_le32(data + 16);
ss_count = get_unaligned_le32(data + 20);
if (!fs_count && !hs_count && !ss_count)
goto einval;
ffs->raw_descs_length = len;
ffs->raw_descs = _data;
data += 28;
len -= 28;
break;
default:
goto error;
}
if (likely(fs_count)) {
fs_len = ffs_do_descs(fs_count, data, len,
__ffs_data_do_entity, ffs);
if (unlikely(fs_len < 0)) {
ret = fs_len;
goto error;
}
ffs->fs_descs_count = fs_count;
ffs->raw_fs_descs_length = fs_len;
ffs->fs_descs = data;
data += fs_len;
len -= fs_len;
} else {
fs_len = 0;
}
if (likely(hs_count)) {
hs_len = ffs_do_descs(hs_count, data, len,
__ffs_data_do_entity, ffs);
if (unlikely(hs_len < 0)) {
ret = hs_len;
goto error;
}
ffs->hs_descs_count = hs_count;
ffs->raw_hs_descs_length = hs_len;
ffs->hs_descs = data;
data += hs_len;
len -= hs_len;
} else {
hs_len = 0;
}
if (ver == FUNCTIONFS_DESCRIPTORS_MAGIC && len >= 8) {
if (get_unaligned_le32(data) !=
FUNCTIONFS_SS_DESC_MAGIC)
goto einval;
ss_count = get_unaligned_le32(data + 4);
data += 8;
len -= 8;
}
if (likely(ss_count)) {
ss_len = ffs_do_descs(ss_count, data, len,
__ffs_data_do_entity, ffs);
if (unlikely(ss_len < 0)) {
ret = ss_len;
goto error;
}
ffs->ss_descs_count = ss_count;
ffs->raw_ss_descs_length = ss_len;
ffs->ss_descs = data;
ret = ss_len;
} else {
ss_len = 0;
ret = 0;
}
return 0;
einval:
ffs->raw_fs_descs_length = 0;
ffs->raw_hs_descs_length = 0;
ffs->raw_ss_descs_length = 0;
ffs->raw_descs_length = 0;
ffs->raw_descs = NULL;
ffs->fs_descs = NULL;
ffs->hs_descs = NULL;
ffs->ss_descs = NULL;
ffs->fs_descs_count = 0;
ffs->hs_descs_count = 0;
ffs->ss_descs_count = 0;
ret = -EINVAL;
error:
kfree(_data);
return ret;
}
static int __ffs_data_got_strings(struct ffs_data *ffs,
char *const _data, size_t len)
{
u32 str_count, needed_count, lang_count;
struct usb_gadget_strings **stringtabs, *t;
struct usb_string *strings, *s;
const char *data = _data;
ENTER();
if (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||
get_unaligned_le32(data + 4) != len))
goto error;
str_count = get_unaligned_le32(data + 8);
lang_count = get_unaligned_le32(data + 12);
/* if one is zero the other must be zero */
if (unlikely(!str_count != !lang_count))
goto error;
/* Do we have at least as many strings as descriptors need? */
needed_count = ffs->strings_count;
if (unlikely(str_count < needed_count))
goto error;
/*
* If we don't need any strings just return and free all
* memory.
*/
if (!needed_count) {
kfree(_data);
return 0;
}
/* Allocate everything in one chunk so there's less maintenance. */
{
struct {
struct usb_gadget_strings *stringtabs[lang_count + 1];
struct usb_gadget_strings stringtab[lang_count];
struct usb_string strings[lang_count*(needed_count+1)];
} *d;
unsigned i = 0;
d = kmalloc(sizeof *d, GFP_KERNEL);
if (unlikely(!d)) {
kfree(_data);
return -ENOMEM;
}
stringtabs = d->stringtabs;
t = d->stringtab;
i = lang_count;
do {
*stringtabs++ = t++;
} while (--i);
*stringtabs = NULL;
stringtabs = d->stringtabs;
t = d->stringtab;
s = d->strings;
strings = s;
}
/* For each language */
data += 16;
len -= 16;
do { /* lang_count > 0 so we can use do-while */
unsigned needed = needed_count;
if (unlikely(len < 3))
goto error_free;
t->language = get_unaligned_le16(data);
t->strings = s;
++t;
data += 2;
len -= 2;
/* For each string */
do { /* str_count > 0 so we can use do-while */
size_t length = strnlen(data, len);
if (unlikely(length == len))
goto error_free;
/*
* User may provide more strings then we need,
* if that's the case we simply ignore the
* rest
*/
if (likely(needed)) {
/*
* s->id will be set while adding
* function to configuration so for
* now just leave garbage here.
*/
s->s = data;
--needed;
++s;
}
data += length + 1;
len -= length + 1;
} while (--str_count);
s->id = 0; /* terminator */
s->s = NULL;
++s;
} while (--lang_count);
/* Some garbage left? */
if (unlikely(len))
goto error_free;
/* Done! */
ffs->stringtabs = stringtabs;
ffs->raw_strings = _data;
return 0;
error_free:
kfree(stringtabs);
error:
kfree(_data);
return -EINVAL;
}
/* Events handling and management *******************************************/
static void __ffs_event_add(struct ffs_data *ffs,
enum usb_functionfs_event_type type)
{
enum usb_functionfs_event_type rem_type1, rem_type2 = type;
int neg = 0;
/*
* Abort any unhandled setup
*
* We do not need to worry about some cmpxchg() changing value
* of ffs->setup_state without holding the lock because when
* state is FFS_SETUP_PENDING cmpxchg() in several places in
* the source does nothing.
*/
if (ffs->setup_state == FFS_SETUP_PENDING)
ffs->setup_state = FFS_SETUP_CANCELED;
switch (type) {
case FUNCTIONFS_RESUME:
rem_type2 = FUNCTIONFS_SUSPEND;
/* FALL THROUGH */
case FUNCTIONFS_SUSPEND:
case FUNCTIONFS_SETUP:
rem_type1 = type;
/* Discard all similar events */
break;
case FUNCTIONFS_BIND:
case FUNCTIONFS_UNBIND:
case FUNCTIONFS_DISABLE:
case FUNCTIONFS_ENABLE:
/* Discard everything other then power management. */
rem_type1 = FUNCTIONFS_SUSPEND;
rem_type2 = FUNCTIONFS_RESUME;
neg = 1;
break;
default:
BUG();
}
{
u8 *ev = ffs->ev.types, *out = ev;
unsigned n = ffs->ev.count;
for (; n; --n, ++ev)
if ((*ev == rem_type1 || *ev == rem_type2) == neg)
*out++ = *ev;
else
pr_vdebug("purging event %d\n", *ev);
ffs->ev.count = out - ffs->ev.types;
}
pr_vdebug("adding event %d\n", type);
ffs->ev.types[ffs->ev.count++] = type;
wake_up_locked(&ffs->ev.waitq);
}
static void ffs_event_add(struct ffs_data *ffs,
enum usb_functionfs_event_type type)
{
unsigned long flags;
spin_lock_irqsave(&ffs->ev.waitq.lock, flags);
__ffs_event_add(ffs, type);
spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);
}
/* Bind/unbind USB function hooks *******************************************/
static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep,
struct usb_descriptor_header *desc,
void *priv)
{
struct usb_endpoint_descriptor *ds = (void *)desc;
struct ffs_function *func = priv;
struct ffs_ep *ffs_ep;
unsigned ep_desc_id, idx;
static const char * const speed_names[] = { "full", "high", "super" };
if (type != FFS_DESCRIPTOR)
return 0;
/*
* If ss_descriptors is not NULL, we are reading super speed
* descriptors; if hs_descriptors is not NULL, we are reading high
* speed descriptors; otherwise, we are reading full speed
* descriptors.
*/
if (func->function.ss_descriptors) {
ep_desc_id = 2;
func->function.ss_descriptors[(long)valuep] = desc;
} else if (func->function.hs_descriptors) {
ep_desc_id = 1;
func->function.hs_descriptors[(long)valuep] = desc;
} else {
ep_desc_id = 0;
func->function.fs_descriptors[(long)valuep] = desc;
}
if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT)
return 0;
idx = (ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) - 1;
ffs_ep = func->eps + idx;
if (unlikely(ffs_ep->descs[ep_desc_id])) {
pr_err("two %sspeed descriptors for EP %d\n",
speed_names[ep_desc_id],
ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
return -EINVAL;
}
ffs_ep->descs[ep_desc_id] = ds;
ffs_dump_mem(": Original ep desc", ds, ds->bLength);
if (ffs_ep->ep) {
ds->bEndpointAddress = ffs_ep->descs[0]->bEndpointAddress;
if (!ds->wMaxPacketSize)
ds->wMaxPacketSize = ffs_ep->descs[0]->wMaxPacketSize;
} else {
struct usb_request *req;
struct usb_ep *ep;
pr_vdebug("autoconfig\n");
ep = usb_ep_autoconfig(func->gadget, ds);
if (unlikely(!ep))
return -ENOTSUPP;
ep->driver_data = func->eps + idx;
req = usb_ep_alloc_request(ep, GFP_KERNEL);
if (unlikely(!req))
return -ENOMEM;
ffs_ep->ep = ep;
ffs_ep->req = req;
func->eps_revmap[ds->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK] = idx + 1;
}
ffs_dump_mem(": Rewritten ep desc", ds, ds->bLength);
return 0;
}
static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep,
struct usb_descriptor_header *desc,
void *priv)
{
struct ffs_function *func = priv;
unsigned idx;
u8 newValue;
switch (type) {
default:
case FFS_DESCRIPTOR:
/* Handled in previous pass by __ffs_func_bind_do_descs() */
return 0;
case FFS_INTERFACE:
idx = *valuep;
if (func->interfaces_nums[idx] < 0) {
int id = usb_interface_id(func->conf, &func->function);
if (unlikely(id < 0))
return id;
func->interfaces_nums[idx] = id;
}
newValue = func->interfaces_nums[idx];
break;
case FFS_STRING:
/* String' IDs are allocated when fsf_data is bound to cdev */
newValue = func->ffs->stringtabs[0]->strings[*valuep - 1].id;
break;
case FFS_ENDPOINT:
/*
* USB_DT_ENDPOINT are handled in
* __ffs_func_bind_do_descs().
*/
if (desc->bDescriptorType == USB_DT_ENDPOINT)
return 0;
idx = (*valuep & USB_ENDPOINT_NUMBER_MASK) - 1;
if (unlikely(!func->eps[idx].ep))
return -EINVAL;
{
struct usb_endpoint_descriptor **descs;
descs = func->eps[idx].descs;
newValue = descs[descs[0] ? 0 : 1]->bEndpointAddress;
}
break;
}
pr_vdebug("%02x -> %02x\n", *valuep, newValue);
*valuep = newValue;
return 0;
}
static int ffs_func_bind(struct usb_configuration *c,
struct usb_function *f)
{
struct ffs_function *func = ffs_func_from_usb(f);
struct ffs_data *ffs = func->ffs;
const int full = !!func->ffs->fs_descs_count;
const int high = gadget_is_dualspeed(func->gadget) &&
func->ffs->hs_descs_count;
const int super = gadget_is_superspeed(func->gadget) &&
func->ffs->ss_descs_count;
int ret;
char *p;
int n;
unsigned raw_descs_length = (full ? ffs->raw_fs_descs_length : 0) +
(high ? ffs->raw_hs_descs_length : 0) +
(super ? ffs->raw_ss_descs_length : 0);
/* Make it a single chunk, less management later on */
struct {
struct ffs_ep eps[ffs->eps_count];
struct usb_descriptor_header
*fs_descs[full ? ffs->fs_descs_count + 1 : 0];
struct usb_descriptor_header
*hs_descs[high ? ffs->hs_descs_count + 1 : 0];
struct usb_descriptor_header
*ss_descs[super ? ffs->ss_descs_count + 1 : 0];
short inums[ffs->interfaces_count];
char raw_descs[raw_descs_length];
} *data;
ENTER();
/* Only high speed but not supported by gadget? */
if (unlikely(!(full | high | super)))
return -ENOTSUPP;
/* Allocate */
data = kmalloc(sizeof *data, GFP_KERNEL);
if (unlikely(!data))
return -ENOMEM;
/* Zero */
memset(data->eps, 0, sizeof data->eps);
memset(data->inums, 0xff, sizeof data->inums);
for (ret = ffs->eps_count; ret; --ret)
data->eps[ret].num = -1;
/* Save pointers */
func->eps = data->eps;
func->interfaces_nums = data->inums;
/* make a copy of descriptors */
p = data->raw_descs;
if (likely(full)) {
memcpy(p, ffs->fs_descs, ffs->raw_fs_descs_length);
p += ffs->raw_fs_descs_length;
}
if (likely(high)) {
memcpy(p, ffs->hs_descs, ffs->raw_hs_descs_length);
p += ffs->raw_hs_descs_length;
}
if (likely(super)) {
memcpy(p, ffs->ss_descs, ffs->raw_ss_descs_length);
p += ffs->raw_ss_descs_length;
}
/*
* Go through all the endpoint descriptors and allocate
* endpoints first, so that later we can rewrite the endpoint
* numbers without worrying that it may be described later on.
*/
p = data->raw_descs;
n = raw_descs_length;
if (likely(full)) {
func->function.fs_descriptors = data->fs_descs;
ret = ffs_do_descs(ffs->fs_descs_count,
p,
n,
__ffs_func_bind_do_descs, func);
if (unlikely(ret < 0))
goto error;
n -= ret;
p += ret;
}
if (likely(high)) {
func->function.hs_descriptors = data->hs_descs;
ret = ffs_do_descs(ffs->hs_descs_count,
p,
n,
__ffs_func_bind_do_descs, func);
if (unlikely(ret < 0))
goto error;
n -= ret;
p += ret;
}
if (likely(super)) {
func->function.ss_descriptors = data->ss_descs;
ret = ffs_do_descs(ffs->ss_descs_count,
p,
n,
__ffs_func_bind_do_descs, func);
if (unlikely(ret < 0))
goto error;
n -= ret;
p += ret;
}
/*
* Now handle interface numbers allocation and interface and
* endpoint numbers rewriting. We can do that in one go
* now.
*/
ret = ffs_do_descs((full ? ffs->fs_descs_count : 0) +
(high ? ffs->hs_descs_count : 0) +
(super ? ffs->ss_descs_count : 0),
data->raw_descs, raw_descs_length,
__ffs_func_bind_do_nums, func);
if (unlikely(ret < 0))
goto error;
/* And we're done */
ffs_event_add(ffs, FUNCTIONFS_BIND);
return 0;
error:
/* XXX Do we need to release all claimed endpoints here? */
return ret;
}
/* Other USB function hooks *************************************************/
static void ffs_func_unbind(struct usb_configuration *c,
struct usb_function *f)
{
struct ffs_function *func = ffs_func_from_usb(f);
struct ffs_data *ffs = func->ffs;
ENTER();
if (ffs->func == func) {
ffs_func_eps_disable(func);
ffs->func = NULL;
}
ffs_event_add(ffs, FUNCTIONFS_UNBIND);
ffs_func_free(func);
}
static int ffs_func_set_alt(struct usb_function *f,
unsigned interface, unsigned alt)
{
struct ffs_function *func = ffs_func_from_usb(f);
struct ffs_data *ffs = func->ffs;
int ret = 0, intf;
if (alt != (unsigned)-1) {
intf = ffs_func_revmap_intf(func, interface);
if (unlikely(intf < 0))
return intf;
}
if (ffs->func)
ffs_func_eps_disable(ffs->func);
if (ffs->state != FFS_ACTIVE)
return -ENODEV;
if (alt == (unsigned)-1) {
ffs->func = NULL;
ffs_event_add(ffs, FUNCTIONFS_DISABLE);
return 0;
}
ffs->func = func;
ret = ffs_func_eps_enable(func);
if (likely(ret >= 0))
ffs_event_add(ffs, FUNCTIONFS_ENABLE);
return ret;
}
static void ffs_func_disable(struct usb_function *f)
{
ffs_func_set_alt(f, 0, (unsigned)-1);
}
static int ffs_func_setup(struct usb_function *f,
const struct usb_ctrlrequest *creq)
{
struct ffs_function *func = ffs_func_from_usb(f);
struct ffs_data *ffs = func->ffs;
unsigned long flags;
int ret;
ENTER();
pr_vdebug("creq->bRequestType = %02x\n", creq->bRequestType);
pr_vdebug("creq->bRequest = %02x\n", creq->bRequest);
pr_vdebug("creq->wValue = %04x\n", le16_to_cpu(creq->wValue));
pr_vdebug("creq->wIndex = %04x\n", le16_to_cpu(creq->wIndex));
pr_vdebug("creq->wLength = %04x\n", le16_to_cpu(creq->wLength));
/*
* Most requests directed to interface go through here
* (notable exceptions are set/get interface) so we need to
* handle them. All other either handled by composite or
* passed to usb_configuration->setup() (if one is set). No
* matter, we will handle requests directed to endpoint here
* as well (as it's straightforward) but what to do with any
* other request?
*/
if (ffs->state != FFS_ACTIVE)
return -ENODEV;
switch (creq->bRequestType & USB_RECIP_MASK) {
case USB_RECIP_INTERFACE:
ret = ffs_func_revmap_intf(func, le16_to_cpu(creq->wIndex));
if (unlikely(ret < 0))
return ret;
break;
case USB_RECIP_ENDPOINT:
ret = ffs_func_revmap_ep(func, le16_to_cpu(creq->wIndex));
if (unlikely(ret < 0))
return ret;
break;
default:
return -EOPNOTSUPP;
}
spin_lock_irqsave(&ffs->ev.waitq.lock, flags);
ffs->ev.setup = *creq;
ffs->ev.setup.wIndex = cpu_to_le16(ret);
__ffs_event_add(ffs, FUNCTIONFS_SETUP);
spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);
return 0;
}
static void ffs_func_suspend(struct usb_function *f)
{
ENTER();
ffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_SUSPEND);
}
static void ffs_func_resume(struct usb_function *f)
{
ENTER();
ffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_RESUME);
}
/* Endpoint and interface numbers reverse mapping ***************************/
static int ffs_func_revmap_ep(struct ffs_function *func, u8 num)
{
num = func->eps_revmap[num & USB_ENDPOINT_NUMBER_MASK];
return num ? num : -EDOM;
}
static int ffs_func_revmap_intf(struct ffs_function *func, u8 intf)
{
short *nums = func->interfaces_nums;
unsigned count = func->ffs->interfaces_count;
for (; count; --count, ++nums) {
if (*nums >= 0 && *nums == intf)
return nums - func->interfaces_nums;
}
return -EDOM;
}
/* Misc helper functions ****************************************************/
static int ffs_mutex_lock(struct mutex *mutex, unsigned nonblock)
{
return nonblock
? likely(mutex_trylock(mutex)) ? 0 : -EAGAIN
: mutex_lock_interruptible(mutex);
}
static char *ffs_prepare_buffer(const char __user *buf, size_t len)
{
char *data;
if (unlikely(!len))
return NULL;
data = kmalloc(len, GFP_KERNEL);
if (unlikely(!data))
return ERR_PTR(-ENOMEM);
if (unlikely(__copy_from_user(data, buf, len))) {
kfree(data);
return ERR_PTR(-EFAULT);
}
pr_vdebug("Buffer from user space:\n");
ffs_dump_mem("", data, len);
return data;
}
| Jetson-TX1-AndroidTV/android_kernel_shield_tv_video4linux | drivers/usb/gadget/f_fs.c | C | gpl-2.0 | 59,951 |
/* Copyright (c) 2002-2011 by XMLVM.org
*
* Project Info: http://www.xmlvm.org
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
#import "xmlvm.h"
#import "org_xmlvm_iphone_UIView.h"
#import "org_xmlvm_iphone_CGPoint.h"
#import "java_lang_Object.h"
#import "org_xmlvm_iphone_MKAnnotation.h"
#import "java_lang_String.h"
#import "org_xmlvm_iphone_UIImage.h"
#import <MapKit/MKAnnotationView.h>
typedef MKAnnotationView org_xmlvm_iphone_MKAnnotationView;
@interface MKAnnotationView (cat_org_xmlvm_iphone_MKAnnotationView)
- (void) __init_org_xmlvm_iphone_MKAnnotationView___org_xmlvm_iphone_MKAnnotation_java_lang_String :(org_xmlvm_iphone_MKAnnotation*)n1 :(java_lang_String*)n2;
- (void) prepareForReuse__;
- (int) isEnabled__;
- (void) setEnabled___boolean :(int)n1;
- (org_xmlvm_iphone_MKAnnotation*) getAnnotation__;
- (void) setAnnotation___org_xmlvm_iphone_MKAnnotation :(org_xmlvm_iphone_MKAnnotation*)n1;
- (org_xmlvm_iphone_CGPoint*) getCalloutOffset__;
- (void) setCalloutOffset___org_xmlvm_iphone_CGPoint :(org_xmlvm_iphone_CGPoint*)n1;
- (org_xmlvm_iphone_CGPoint*) getCenterOffset__;
- (void) setCenterOffset___org_xmlvm_iphone_CGPoint :(org_xmlvm_iphone_CGPoint*)n1;
- (int) isHighlighted__;
- (void) setHighlighted___boolean :(int)n1;
- (org_xmlvm_iphone_UIImage*) getImage__;
- (void) setImage___org_xmlvm_iphone_UIImage :(org_xmlvm_iphone_UIImage*)n1;
- (java_lang_String*) getReuseIdentifier__;
- (int) isSelected__;
- (void) setSelected___boolean :(int)n1;
- (void) setSelected___boolean_boolean :(int)n1 :(int)n2;
- (int) isCanShowCallout__;
- (void) setCanShowCallout___boolean :(int)n1;
- (org_xmlvm_iphone_UIView*) getLeftCalloutAccessoryView__;
- (void) setLeftCalloutAccessoryView___org_xmlvm_iphone_UIView :(org_xmlvm_iphone_UIView*)n1;
- (org_xmlvm_iphone_UIView*) getRightCalloutAccessoryView__;
- (void) setRightCalloutAccessoryView___org_xmlvm_iphone_UIView :(org_xmlvm_iphone_UIView*)n1;
- (int) getDragState__;
- (void) setDragState___int :(int)n1;
- (void) setDragState___int_boolean :(int)n1 :(int)n2;
- (int) isDraggable__;
- (void) setDraggable___boolean :(int)n1;
@end
| skyHALud/codenameone | Ports/iOSPort/xmlvm/src/xmlvm2objc/compat-lib/objc/org_xmlvm_iphone_MKAnnotationView.h | C | gpl-2.0 | 2,816 |
<?php
// ===================================================================================================
// _ __ _ _
// | |/ /__ _| | |_ _ _ _ _ __ _
// | ' </ _` | | _| || | '_/ _` |
// |_|\_\__,_|_|\__|\_,_|_| \__,_|
//
// This file is part of the Kaltura Collaborative Media Suite which allows users
// to do with audio, video, and animation what Wiki platfroms allow them to do with
// text.
//
// Copyright (C) 2006-2011 Kaltura Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// @ignore
// ===================================================================================================
/**
* @package Kaltura
* @subpackage Client
*/
class Kaltura_Client_Enum_AdminUserOrderBy
{
const CREATED_AT_ASC = "+createdAt";
const ID_ASC = "+id";
const CREATED_AT_DESC = "-createdAt";
const ID_DESC = "-id";
}
| CoordCulturaDigital-Minc/culturadigital.br | wp-content/plugins/all-in-one-video-pack/lib/Kaltura/Client/Enum/AdminUserOrderBy.php | PHP | gpl-2.0 | 1,562 |
# change engine to InnoDB
ALTER TABLE `cart_inventory` ENGINE = InnoDB;
ALTER TABLE `char_data` ENGINE = InnoDB;
ALTER TABLE `charlog` ENGINE = InnoDB;
ALTER TABLE `worldreg` ENGINE = InnoDB;
ALTER TABLE `accountreg` ENGINE = InnoDB;
ALTER TABLE `globalreg` ENGINE = InnoDB;
ALTER TABLE `guild` ENGINE = InnoDB;
ALTER TABLE `guild_alliance` ENGINE = InnoDB;
ALTER TABLE `guild_castle` ENGINE = InnoDB;
ALTER TABLE `guild_expulsion` ENGINE = InnoDB;
ALTER TABLE `guild_member` ENGINE = InnoDB;
ALTER TABLE `guild_position` ENGINE = InnoDB;
ALTER TABLE `guild_skill` ENGINE = InnoDB;
ALTER TABLE `guild_storage` ENGINE = InnoDB;
ALTER TABLE `interlog` ENGINE = InnoDB;
ALTER TABLE `inventory` ENGINE = InnoDB;
ALTER TABLE `login` ENGINE = InnoDB;
ALTER TABLE `loginlog` ENGINE = InnoDB;
ALTER TABLE `memo` ENGINE = InnoDB;
ALTER TABLE `party` ENGINE = InnoDB;
ALTER TABLE `pet` ENGINE = InnoDB;
ALTER TABLE `skill` ENGINE = InnoDB;
ALTER TABLE `storage` ENGINE = InnoDB;
ALTER TABLE `friend` ENGINE = InnoDB;
ALTER TABLE `homunculus` ENGINE = InnoDB;
ALTER TABLE `homunculus_skill` ENGINE = InnoDB;
ALTER TABLE `status_change` ENGINE = InnoDB;
ALTER TABLE `mail` ENGINE = InnoDB;
ALTER TABLE `mail_data` ENGINE = InnoDB;
ALTER TABLE `mapreg` ENGINE = InnoDB;
ALTER TABLE `feel_info` ENGINE = InnoDB;
ALTER TABLE `hotkey` ENGINE = InnoDB;
ALTER TABLE `mercenary` ENGINE = InnoDB;
ALTER TABLE `mercenary_employ` ENGINE = InnoDB;
ALTER TABLE `quest` ENGINE = InnoDB;
ALTER TABLE `elemental` ENGINE = InnoDB;
| AurigaProject/root | sql-files/utils/convert_engine_innodb.sql | SQL | gpl-2.0 | 1,504 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Member List</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul></div>
<h1>tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator > Member List</h1>This is the complete list of members for <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>, including all inherited members.<p><table>
<tr bgcolor="#f0f0f0"><td><b>allocator_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>begin</b>() (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>begin</b>() const (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#af34cb91b1d0f36a885a1a3432dd9af1">bucket_count</a>() const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#220686fe17b197eedf19dd856cd02e36">clear</a>()</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#1ad413f5b666176e7669bf4c87d1ff3f">concurrent_hash_map</a>(const allocator_type &a=allocator_type())</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#46b9896317662c3cfa3c876ad7592a7c">concurrent_hash_map</a>(size_type n, const allocator_type &a=allocator_type())</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#6fb14710893308fb47aaeee55ee30dc3">concurrent_hash_map</a>(const concurrent_hash_map &table, const allocator_type &a=allocator_type())</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#83c40f2053f208861b90390e12a36436">concurrent_hash_map</a>(I first, I last, const allocator_type &a=allocator_type())</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>const_accessor</b> (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [friend]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>const_iterator</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>const_pointer</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>const_range_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>const_reference</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#6968eb6feed2df36be421df0464297af">count</a>(const Key &key) const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>delete_node</b>(node_base *n) (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline, protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>difference_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#61ff2e5bb44e5469366fd5295e5d0ebe">empty</a>() const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>end</b>() (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>end</b>() const (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>equal_range</b>(const Key &key) (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>equal_range</b>(const Key &key) const (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#f27802b3a8d1863c29e743e9c6b4e870">erase</a>(const Key &key)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#e698ef3d70b2d1a29a7a5551784d3653">erase</a>(const_accessor &item_accessor)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#5f12d150d421420965db07368666a84f">erase</a>(accessor &item_accessor)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#0c964214eb38f54603aa75fdff6d2709">exclude</a>(const_accessor &item_accessor)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#2afcc33dade7bb24e008d60c0df38230">find</a>(const_accessor &result, const Key &key) const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#7bc475d1968f7f0af3d736d7e8a0d7df">find</a>(accessor &result, const Key &key)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#6cbcacb4a256a85bf89576c101373ca7">get_allocator</a>() const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#47fe0e60151a9bd7a444db827772a4e6">insert</a>(const_accessor &result, const Key &key)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#54e0955ecd11575b4c07166838a72893">insert</a>(accessor &result, const Key &key)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#091efd2d12fdad4fe9e54d9629a9dfc3">insert</a>(const_accessor &result, const value_type &value)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#39183d78d6e8425917555ab542ab92de">insert</a>(accessor &result, const value_type &value)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#3f121a316af8135de476a30fae6d7c07">insert</a>(const value_type &value)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#1dd37fad87e561151ba1e242ca94bcc1">insert</a>(I first, I last)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>internal::hash_map_iterator</b> (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [friend]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>internal::hash_map_range</b> (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [friend]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#72c9c9e9655fcf096f5f0ed9c8ba6669">internal_copy</a>(const concurrent_hash_map &source)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>internal_copy</b>(I first, I last) (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#8f5373b8e1864619d1ffcf3bf3f1f13d">internal_equal_range</a>(const Key &key, I end) const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#2f76ed101a0ccc8875b846c2f747897e">internal_fast_find</a>(const Key &key) const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline, protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>iterator</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>key_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#3f3413264a99174a224ef96f6c4ea769">lookup</a>(bool op_insert, const Key &key, const T *t, const_accessor *result, bool write)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>mapped_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#2bce57fe9b594abe1e6d2568aea8b357">max_size</a>() const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>my_allocator</b> (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>my_hash_compare</b> (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>node_allocator_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#088d1aaccc816884a49e38f7065622c8">operator=</a>(const concurrent_hash_map &table)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>pointer</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>range</b>(size_type grainsize=1) (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>range</b>(size_type grainsize=1) const (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>range_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>reference</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#94758113d8993cfe5afdf2d63a728869">rehash</a>(size_type n=0)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>rehash_bucket</b>(bucket *b_new, const hashcode_t h) (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline, protected]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>search_bucket</b>(const key_type &key, bucket *b) const (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline, protected]</code></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#6aa56a8b5a25e61a97fa0b54fe2b5659">size</a>() const </td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
<tr bgcolor="#f0f0f0"><td><b>size_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#076f8d9e16110aac5f558777aa744eb6">swap</a>(concurrent_hash_map &table)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr bgcolor="#f0f0f0"><td><b>value_type</b> typedef (defined in <a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a>)</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="a00269.html#2aa8e2d28d5af1284cf78d20a9c22731">~concurrent_hash_map</a>()</td><td><a class="el" href="a00269.html">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, Allocator ></a></td><td><code> [inline]</code></td></tr>
</table><hr>
<p></p>
Copyright © 2005-2012 Intel Corporation. All Rights Reserved.
<p></p>
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
<p></p>
* Other names and brands may be claimed as the property of others.
| jckarter/tbb | doc/html/a00019.html | HTML | gpl-2.0 | 21,919 |
<?php
function browser()
{
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') )
{
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Netscape') )
{
$browser = 'Netscape';
}
else if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') )
{
$browser = 'Firefox';
}
else
{
$browser = 'Mozilla';
}
}
else if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') )
{
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') )
{
$browser = 'Opera';
}
else
{
$browser = 'IE';
}
}
else
{
$browser = 'Others browsers';
}
return $browser;
}
?> | mehulsbhatt/opensis | functions/browser.fnc.php | PHP | gpl-2.0 | 578 |
/*
* Automatically generated C config: don't edit
* Busybox version: 1.21.1-jb
*/
#define AUTOCONF_TIMESTAMP "2013-07-01 01:04 +0200"
#define CONFIG_HAVE_DOT_CONFIG 1
#define ENABLE_HAVE_DOT_CONFIG 1
#define IF_HAVE_DOT_CONFIG(...) __VA_ARGS__
#define IF_NOT_HAVE_DOT_CONFIG(...)
/*
* Busybox Settings
*/
/*
* General Configuration
*/
#undef CONFIG_DESKTOP
#define ENABLE_DESKTOP 0
#define IF_DESKTOP(...)
#define IF_NOT_DESKTOP(...) __VA_ARGS__
#undef CONFIG_EXTRA_COMPAT
#define ENABLE_EXTRA_COMPAT 0
#define IF_EXTRA_COMPAT(...)
#define IF_NOT_EXTRA_COMPAT(...) __VA_ARGS__
#undef CONFIG_INCLUDE_SUSv2
#define ENABLE_INCLUDE_SUSv2 0
#define IF_INCLUDE_SUSv2(...)
#define IF_NOT_INCLUDE_SUSv2(...) __VA_ARGS__
#undef CONFIG_USE_PORTABLE_CODE
#define ENABLE_USE_PORTABLE_CODE 0
#define IF_USE_PORTABLE_CODE(...)
#define IF_NOT_USE_PORTABLE_CODE(...) __VA_ARGS__
#define CONFIG_PLATFORM_LINUX 1
#define ENABLE_PLATFORM_LINUX 1
#define IF_PLATFORM_LINUX(...) __VA_ARGS__
#define IF_NOT_PLATFORM_LINUX(...)
#define CONFIG_FEATURE_BUFFERS_USE_MALLOC 1
#define ENABLE_FEATURE_BUFFERS_USE_MALLOC 1
#define IF_FEATURE_BUFFERS_USE_MALLOC(...) __VA_ARGS__
#define IF_NOT_FEATURE_BUFFERS_USE_MALLOC(...)
#undef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
#define ENABLE_FEATURE_BUFFERS_GO_ON_STACK 0
#define IF_FEATURE_BUFFERS_GO_ON_STACK(...)
#define IF_NOT_FEATURE_BUFFERS_GO_ON_STACK(...) __VA_ARGS__
#undef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
#define ENABLE_FEATURE_BUFFERS_GO_IN_BSS 0
#define IF_FEATURE_BUFFERS_GO_IN_BSS(...)
#define IF_NOT_FEATURE_BUFFERS_GO_IN_BSS(...) __VA_ARGS__
#define CONFIG_SHOW_USAGE 1
#define ENABLE_SHOW_USAGE 1
#define IF_SHOW_USAGE(...) __VA_ARGS__
#define IF_NOT_SHOW_USAGE(...)
#define CONFIG_FEATURE_VERBOSE_USAGE 1
#define ENABLE_FEATURE_VERBOSE_USAGE 1
#define IF_FEATURE_VERBOSE_USAGE(...) __VA_ARGS__
#define IF_NOT_FEATURE_VERBOSE_USAGE(...)
#define CONFIG_FEATURE_COMPRESS_USAGE 1
#define ENABLE_FEATURE_COMPRESS_USAGE 1
#define IF_FEATURE_COMPRESS_USAGE(...) __VA_ARGS__
#define IF_NOT_FEATURE_COMPRESS_USAGE(...)
#undef CONFIG_FEATURE_INSTALLER
#define ENABLE_FEATURE_INSTALLER 0
#define IF_FEATURE_INSTALLER(...)
#define IF_NOT_FEATURE_INSTALLER(...) __VA_ARGS__
#define CONFIG_INSTALL_NO_USR 1
#define ENABLE_INSTALL_NO_USR 1
#define IF_INSTALL_NO_USR(...) __VA_ARGS__
#define IF_NOT_INSTALL_NO_USR(...)
#undef CONFIG_LOCALE_SUPPORT
#define ENABLE_LOCALE_SUPPORT 0
#define IF_LOCALE_SUPPORT(...)
#define IF_NOT_LOCALE_SUPPORT(...) __VA_ARGS__
#define CONFIG_UNICODE_SUPPORT 1
#define ENABLE_UNICODE_SUPPORT 1
#define IF_UNICODE_SUPPORT(...) __VA_ARGS__
#define IF_NOT_UNICODE_SUPPORT(...)
#undef CONFIG_UNICODE_USING_LOCALE
#define ENABLE_UNICODE_USING_LOCALE 0
#define IF_UNICODE_USING_LOCALE(...)
#define IF_NOT_UNICODE_USING_LOCALE(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHECK_UNICODE_IN_ENV
#define ENABLE_FEATURE_CHECK_UNICODE_IN_ENV 0
#define IF_FEATURE_CHECK_UNICODE_IN_ENV(...)
#define IF_NOT_FEATURE_CHECK_UNICODE_IN_ENV(...) __VA_ARGS__
#define CONFIG_SUBST_WCHAR 63
#define ENABLE_SUBST_WCHAR 1
#define IF_SUBST_WCHAR(...) __VA_ARGS__
#define IF_NOT_SUBST_WCHAR(...)
#define CONFIG_LAST_SUPPORTED_WCHAR 0
#define ENABLE_LAST_SUPPORTED_WCHAR 1
#define IF_LAST_SUPPORTED_WCHAR(...) __VA_ARGS__
#define IF_NOT_LAST_SUPPORTED_WCHAR(...)
#undef CONFIG_UNICODE_COMBINING_WCHARS
#define ENABLE_UNICODE_COMBINING_WCHARS 0
#define IF_UNICODE_COMBINING_WCHARS(...)
#define IF_NOT_UNICODE_COMBINING_WCHARS(...) __VA_ARGS__
#define CONFIG_UNICODE_WIDE_WCHARS 1
#define ENABLE_UNICODE_WIDE_WCHARS 1
#define IF_UNICODE_WIDE_WCHARS(...) __VA_ARGS__
#define IF_NOT_UNICODE_WIDE_WCHARS(...)
#undef CONFIG_UNICODE_BIDI_SUPPORT
#define ENABLE_UNICODE_BIDI_SUPPORT 0
#define IF_UNICODE_BIDI_SUPPORT(...)
#define IF_NOT_UNICODE_BIDI_SUPPORT(...) __VA_ARGS__
#undef CONFIG_UNICODE_NEUTRAL_TABLE
#define ENABLE_UNICODE_NEUTRAL_TABLE 0
#define IF_UNICODE_NEUTRAL_TABLE(...)
#define IF_NOT_UNICODE_NEUTRAL_TABLE(...) __VA_ARGS__
#define CONFIG_UNICODE_PRESERVE_BROKEN 1
#define ENABLE_UNICODE_PRESERVE_BROKEN 1
#define IF_UNICODE_PRESERVE_BROKEN(...) __VA_ARGS__
#define IF_NOT_UNICODE_PRESERVE_BROKEN(...)
#define CONFIG_LONG_OPTS 1
#define ENABLE_LONG_OPTS 1
#define IF_LONG_OPTS(...) __VA_ARGS__
#define IF_NOT_LONG_OPTS(...)
#define CONFIG_FEATURE_DEVPTS 1
#define ENABLE_FEATURE_DEVPTS 1
#define IF_FEATURE_DEVPTS(...) __VA_ARGS__
#define IF_NOT_FEATURE_DEVPTS(...)
#undef CONFIG_FEATURE_CLEAN_UP
#define ENABLE_FEATURE_CLEAN_UP 0
#define IF_FEATURE_CLEAN_UP(...)
#define IF_NOT_FEATURE_CLEAN_UP(...) __VA_ARGS__
#undef CONFIG_FEATURE_UTMP
#define ENABLE_FEATURE_UTMP 0
#define IF_FEATURE_UTMP(...)
#define IF_NOT_FEATURE_UTMP(...) __VA_ARGS__
#undef CONFIG_FEATURE_WTMP
#define ENABLE_FEATURE_WTMP 0
#define IF_FEATURE_WTMP(...)
#define IF_NOT_FEATURE_WTMP(...) __VA_ARGS__
#undef CONFIG_FEATURE_PIDFILE
#define ENABLE_FEATURE_PIDFILE 0
#define IF_FEATURE_PIDFILE(...)
#define IF_NOT_FEATURE_PIDFILE(...) __VA_ARGS__
#define CONFIG_PID_FILE_PATH ""
#define ENABLE_PID_FILE_PATH 1
#define IF_PID_FILE_PATH(...) __VA_ARGS__
#define IF_NOT_PID_FILE_PATH(...)
#define CONFIG_FEATURE_SUID 1
#define ENABLE_FEATURE_SUID 1
#define IF_FEATURE_SUID(...) __VA_ARGS__
#define IF_NOT_FEATURE_SUID(...)
#undef CONFIG_FEATURE_SUID_CONFIG
#define ENABLE_FEATURE_SUID_CONFIG 0
#define IF_FEATURE_SUID_CONFIG(...)
#define IF_NOT_FEATURE_SUID_CONFIG(...) __VA_ARGS__
#undef CONFIG_FEATURE_SUID_CONFIG_QUIET
#define ENABLE_FEATURE_SUID_CONFIG_QUIET 0
#define IF_FEATURE_SUID_CONFIG_QUIET(...)
#define IF_NOT_FEATURE_SUID_CONFIG_QUIET(...) __VA_ARGS__
#undef CONFIG_SELINUX
#define ENABLE_SELINUX 0
#define IF_SELINUX(...)
#define IF_NOT_SELINUX(...) __VA_ARGS__
#undef CONFIG_FEATURE_PREFER_APPLETS
#define ENABLE_FEATURE_PREFER_APPLETS 0
#define IF_FEATURE_PREFER_APPLETS(...)
#define IF_NOT_FEATURE_PREFER_APPLETS(...) __VA_ARGS__
#define CONFIG_BUSYBOX_EXEC_PATH "/proc/self/exe"
#define ENABLE_BUSYBOX_EXEC_PATH 1
#define IF_BUSYBOX_EXEC_PATH(...) __VA_ARGS__
#define IF_NOT_BUSYBOX_EXEC_PATH(...)
#define CONFIG_FEATURE_SYSLOG 1
#define ENABLE_FEATURE_SYSLOG 1
#define IF_FEATURE_SYSLOG(...) __VA_ARGS__
#define IF_NOT_FEATURE_SYSLOG(...)
#define CONFIG_FEATURE_HAVE_RPC 1
#define ENABLE_FEATURE_HAVE_RPC 1
#define IF_FEATURE_HAVE_RPC(...) __VA_ARGS__
#define IF_NOT_FEATURE_HAVE_RPC(...)
/*
* Build Options
*/
#undef CONFIG_STATIC
#define ENABLE_STATIC 0
#define IF_STATIC(...)
#define IF_NOT_STATIC(...) __VA_ARGS__
#undef CONFIG_PIE
#define ENABLE_PIE 0
#define IF_PIE(...)
#define IF_NOT_PIE(...) __VA_ARGS__
#undef CONFIG_NOMMU
#define ENABLE_NOMMU 0
#define IF_NOMMU(...)
#define IF_NOT_NOMMU(...) __VA_ARGS__
#undef CONFIG_BUILD_LIBBUSYBOX
#define ENABLE_BUILD_LIBBUSYBOX 0
#define IF_BUILD_LIBBUSYBOX(...)
#define IF_NOT_BUILD_LIBBUSYBOX(...) __VA_ARGS__
#undef CONFIG_FEATURE_INDIVIDUAL
#define ENABLE_FEATURE_INDIVIDUAL 0
#define IF_FEATURE_INDIVIDUAL(...)
#define IF_NOT_FEATURE_INDIVIDUAL(...) __VA_ARGS__
#undef CONFIG_FEATURE_SHARED_BUSYBOX
#define ENABLE_FEATURE_SHARED_BUSYBOX 0
#define IF_FEATURE_SHARED_BUSYBOX(...)
#define IF_NOT_FEATURE_SHARED_BUSYBOX(...) __VA_ARGS__
#undef CONFIG_LFS
#define ENABLE_LFS 0
#define IF_LFS(...)
#define IF_NOT_LFS(...) __VA_ARGS__
#define CONFIG_CROSS_COMPILER_PREFIX "arm-eabi-"
#define ENABLE_CROSS_COMPILER_PREFIX 1
#define IF_CROSS_COMPILER_PREFIX(...) __VA_ARGS__
#define IF_NOT_CROSS_COMPILER_PREFIX(...)
#define CONFIG_SYSROOT ""
#define ENABLE_SYSROOT 1
#define IF_SYSROOT(...) __VA_ARGS__
#define IF_NOT_SYSROOT(...)
#define CONFIG_EXTRA_CFLAGS "-Os -fno-short-enums -fgcse-after-reload -frerun-cse-after-loop -frename-registers"
#define ENABLE_EXTRA_CFLAGS 1
#define IF_EXTRA_CFLAGS(...) __VA_ARGS__
#define IF_NOT_EXTRA_CFLAGS(...)
#define CONFIG_EXTRA_LDFLAGS ""
#define ENABLE_EXTRA_LDFLAGS 1
#define IF_EXTRA_LDFLAGS(...) __VA_ARGS__
#define IF_NOT_EXTRA_LDFLAGS(...)
#define CONFIG_EXTRA_LDLIBS ""
#define ENABLE_EXTRA_LDLIBS 1
#define IF_EXTRA_LDLIBS(...) __VA_ARGS__
#define IF_NOT_EXTRA_LDLIBS(...)
/*
* Debugging Options
*/
#undef CONFIG_DEBUG
#define ENABLE_DEBUG 0
#define IF_DEBUG(...)
#define IF_NOT_DEBUG(...) __VA_ARGS__
#undef CONFIG_DEBUG_PESSIMIZE
#define ENABLE_DEBUG_PESSIMIZE 0
#define IF_DEBUG_PESSIMIZE(...)
#define IF_NOT_DEBUG_PESSIMIZE(...) __VA_ARGS__
#undef CONFIG_WERROR
#define ENABLE_WERROR 0
#define IF_WERROR(...)
#define IF_NOT_WERROR(...) __VA_ARGS__
#define CONFIG_NO_DEBUG_LIB 1
#define ENABLE_NO_DEBUG_LIB 1
#define IF_NO_DEBUG_LIB(...) __VA_ARGS__
#define IF_NOT_NO_DEBUG_LIB(...)
#undef CONFIG_DMALLOC
#define ENABLE_DMALLOC 0
#define IF_DMALLOC(...)
#define IF_NOT_DMALLOC(...) __VA_ARGS__
#undef CONFIG_EFENCE
#define ENABLE_EFENCE 0
#define IF_EFENCE(...)
#define IF_NOT_EFENCE(...) __VA_ARGS__
/*
* Installation Options ("make install" behavior)
*/
#define CONFIG_INSTALL_APPLET_SYMLINKS 1
#define ENABLE_INSTALL_APPLET_SYMLINKS 1
#define IF_INSTALL_APPLET_SYMLINKS(...) __VA_ARGS__
#define IF_NOT_INSTALL_APPLET_SYMLINKS(...)
#undef CONFIG_INSTALL_APPLET_HARDLINKS
#define ENABLE_INSTALL_APPLET_HARDLINKS 0
#define IF_INSTALL_APPLET_HARDLINKS(...)
#define IF_NOT_INSTALL_APPLET_HARDLINKS(...) __VA_ARGS__
#undef CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS
#define ENABLE_INSTALL_APPLET_SCRIPT_WRAPPERS 0
#define IF_INSTALL_APPLET_SCRIPT_WRAPPERS(...)
#define IF_NOT_INSTALL_APPLET_SCRIPT_WRAPPERS(...) __VA_ARGS__
#undef CONFIG_INSTALL_APPLET_DONT
#define ENABLE_INSTALL_APPLET_DONT 0
#define IF_INSTALL_APPLET_DONT(...)
#define IF_NOT_INSTALL_APPLET_DONT(...) __VA_ARGS__
#undef CONFIG_INSTALL_SH_APPLET_SYMLINK
#define ENABLE_INSTALL_SH_APPLET_SYMLINK 0
#define IF_INSTALL_SH_APPLET_SYMLINK(...)
#define IF_NOT_INSTALL_SH_APPLET_SYMLINK(...) __VA_ARGS__
#undef CONFIG_INSTALL_SH_APPLET_HARDLINK
#define ENABLE_INSTALL_SH_APPLET_HARDLINK 0
#define IF_INSTALL_SH_APPLET_HARDLINK(...)
#define IF_NOT_INSTALL_SH_APPLET_HARDLINK(...) __VA_ARGS__
#undef CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER
#define ENABLE_INSTALL_SH_APPLET_SCRIPT_WRAPPER 0
#define IF_INSTALL_SH_APPLET_SCRIPT_WRAPPER(...)
#define IF_NOT_INSTALL_SH_APPLET_SCRIPT_WRAPPER(...) __VA_ARGS__
#define CONFIG_PREFIX "./_install"
#define ENABLE_PREFIX 1
#define IF_PREFIX(...) __VA_ARGS__
#define IF_NOT_PREFIX(...)
/*
* Busybox Library Tuning
*/
#undef CONFIG_FEATURE_SYSTEMD
#define ENABLE_FEATURE_SYSTEMD 0
#define IF_FEATURE_SYSTEMD(...)
#define IF_NOT_FEATURE_SYSTEMD(...) __VA_ARGS__
#define CONFIG_FEATURE_RTMINMAX 1
#define ENABLE_FEATURE_RTMINMAX 1
#define IF_FEATURE_RTMINMAX(...) __VA_ARGS__
#define IF_NOT_FEATURE_RTMINMAX(...)
#define CONFIG_PASSWORD_MINLEN 6
#define ENABLE_PASSWORD_MINLEN 1
#define IF_PASSWORD_MINLEN(...) __VA_ARGS__
#define IF_NOT_PASSWORD_MINLEN(...)
#define CONFIG_MD5_SMALL 1
#define ENABLE_MD5_SMALL 1
#define IF_MD5_SMALL(...) __VA_ARGS__
#define IF_NOT_MD5_SMALL(...)
#define CONFIG_SHA3_SMALL 1
#define ENABLE_SHA3_SMALL 1
#define IF_SHA3_SMALL(...) __VA_ARGS__
#define IF_NOT_SHA3_SMALL(...)
#define CONFIG_FEATURE_FAST_TOP 1
#define ENABLE_FEATURE_FAST_TOP 1
#define IF_FEATURE_FAST_TOP(...) __VA_ARGS__
#define IF_NOT_FEATURE_FAST_TOP(...)
#undef CONFIG_FEATURE_ETC_NETWORKS
#define ENABLE_FEATURE_ETC_NETWORKS 0
#define IF_FEATURE_ETC_NETWORKS(...)
#define IF_NOT_FEATURE_ETC_NETWORKS(...) __VA_ARGS__
#define CONFIG_FEATURE_USE_TERMIOS 1
#define ENABLE_FEATURE_USE_TERMIOS 1
#define IF_FEATURE_USE_TERMIOS(...) __VA_ARGS__
#define IF_NOT_FEATURE_USE_TERMIOS(...)
#define CONFIG_FEATURE_EDITING 1
#define ENABLE_FEATURE_EDITING 1
#define IF_FEATURE_EDITING(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING(...)
#define CONFIG_FEATURE_EDITING_MAX_LEN 1024
#define ENABLE_FEATURE_EDITING_MAX_LEN 1
#define IF_FEATURE_EDITING_MAX_LEN(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING_MAX_LEN(...)
#define CONFIG_FEATURE_EDITING_VI 1
#define ENABLE_FEATURE_EDITING_VI 1
#define IF_FEATURE_EDITING_VI(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING_VI(...)
#define CONFIG_FEATURE_EDITING_HISTORY 256
#define ENABLE_FEATURE_EDITING_HISTORY 1
#define IF_FEATURE_EDITING_HISTORY(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING_HISTORY(...)
#define CONFIG_FEATURE_EDITING_SAVEHISTORY 1
#define ENABLE_FEATURE_EDITING_SAVEHISTORY 1
#define IF_FEATURE_EDITING_SAVEHISTORY(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING_SAVEHISTORY(...)
#undef CONFIG_FEATURE_EDITING_SAVE_ON_EXIT
#define ENABLE_FEATURE_EDITING_SAVE_ON_EXIT 0
#define IF_FEATURE_EDITING_SAVE_ON_EXIT(...)
#define IF_NOT_FEATURE_EDITING_SAVE_ON_EXIT(...) __VA_ARGS__
#define CONFIG_FEATURE_REVERSE_SEARCH 1
#define ENABLE_FEATURE_REVERSE_SEARCH 1
#define IF_FEATURE_REVERSE_SEARCH(...) __VA_ARGS__
#define IF_NOT_FEATURE_REVERSE_SEARCH(...)
#define CONFIG_FEATURE_TAB_COMPLETION 1
#define ENABLE_FEATURE_TAB_COMPLETION 1
#define IF_FEATURE_TAB_COMPLETION(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAB_COMPLETION(...)
#undef CONFIG_FEATURE_USERNAME_COMPLETION
#define ENABLE_FEATURE_USERNAME_COMPLETION 0
#define IF_FEATURE_USERNAME_COMPLETION(...)
#define IF_NOT_FEATURE_USERNAME_COMPLETION(...) __VA_ARGS__
#define CONFIG_FEATURE_EDITING_FANCY_PROMPT 1
#define ENABLE_FEATURE_EDITING_FANCY_PROMPT 1
#define IF_FEATURE_EDITING_FANCY_PROMPT(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING_FANCY_PROMPT(...)
#define CONFIG_FEATURE_EDITING_ASK_TERMINAL 1
#define ENABLE_FEATURE_EDITING_ASK_TERMINAL 1
#define IF_FEATURE_EDITING_ASK_TERMINAL(...) __VA_ARGS__
#define IF_NOT_FEATURE_EDITING_ASK_TERMINAL(...)
#define CONFIG_FEATURE_NON_POSIX_CP 1
#define ENABLE_FEATURE_NON_POSIX_CP 1
#define IF_FEATURE_NON_POSIX_CP(...) __VA_ARGS__
#define IF_NOT_FEATURE_NON_POSIX_CP(...)
#undef CONFIG_FEATURE_VERBOSE_CP_MESSAGE
#define ENABLE_FEATURE_VERBOSE_CP_MESSAGE 0
#define IF_FEATURE_VERBOSE_CP_MESSAGE(...)
#define IF_NOT_FEATURE_VERBOSE_CP_MESSAGE(...) __VA_ARGS__
#define CONFIG_FEATURE_COPYBUF_KB 4
#define ENABLE_FEATURE_COPYBUF_KB 1
#define IF_FEATURE_COPYBUF_KB(...) __VA_ARGS__
#define IF_NOT_FEATURE_COPYBUF_KB(...)
#define CONFIG_FEATURE_SKIP_ROOTFS 1
#define ENABLE_FEATURE_SKIP_ROOTFS 1
#define IF_FEATURE_SKIP_ROOTFS(...) __VA_ARGS__
#define IF_NOT_FEATURE_SKIP_ROOTFS(...)
#define CONFIG_MONOTONIC_SYSCALL 1
#define ENABLE_MONOTONIC_SYSCALL 1
#define IF_MONOTONIC_SYSCALL(...) __VA_ARGS__
#define IF_NOT_MONOTONIC_SYSCALL(...)
#define CONFIG_IOCTL_HEX2STR_ERROR 1
#define ENABLE_IOCTL_HEX2STR_ERROR 1
#define IF_IOCTL_HEX2STR_ERROR(...) __VA_ARGS__
#define IF_NOT_IOCTL_HEX2STR_ERROR(...)
#undef CONFIG_FEATURE_HWIB
#define ENABLE_FEATURE_HWIB 0
#define IF_FEATURE_HWIB(...)
#define IF_NOT_FEATURE_HWIB(...) __VA_ARGS__
/*
* Applets
*/
/*
* Archival Utilities
*/
#define CONFIG_FEATURE_SEAMLESS_XZ 1
#define ENABLE_FEATURE_SEAMLESS_XZ 1
#define IF_FEATURE_SEAMLESS_XZ(...) __VA_ARGS__
#define IF_NOT_FEATURE_SEAMLESS_XZ(...)
#define CONFIG_FEATURE_SEAMLESS_LZMA 1
#define ENABLE_FEATURE_SEAMLESS_LZMA 1
#define IF_FEATURE_SEAMLESS_LZMA(...) __VA_ARGS__
#define IF_NOT_FEATURE_SEAMLESS_LZMA(...)
#define CONFIG_FEATURE_SEAMLESS_BZ2 1
#define ENABLE_FEATURE_SEAMLESS_BZ2 1
#define IF_FEATURE_SEAMLESS_BZ2(...) __VA_ARGS__
#define IF_NOT_FEATURE_SEAMLESS_BZ2(...)
#define CONFIG_FEATURE_SEAMLESS_GZ 1
#define ENABLE_FEATURE_SEAMLESS_GZ 1
#define IF_FEATURE_SEAMLESS_GZ(...) __VA_ARGS__
#define IF_NOT_FEATURE_SEAMLESS_GZ(...)
#undef CONFIG_FEATURE_SEAMLESS_Z
#define ENABLE_FEATURE_SEAMLESS_Z 0
#define IF_FEATURE_SEAMLESS_Z(...)
#define IF_NOT_FEATURE_SEAMLESS_Z(...) __VA_ARGS__
#undef CONFIG_AR
#define ENABLE_AR 0
#define IF_AR(...)
#define IF_NOT_AR(...) __VA_ARGS__
#undef CONFIG_FEATURE_AR_LONG_FILENAMES
#define ENABLE_FEATURE_AR_LONG_FILENAMES 0
#define IF_FEATURE_AR_LONG_FILENAMES(...)
#define IF_NOT_FEATURE_AR_LONG_FILENAMES(...) __VA_ARGS__
#undef CONFIG_FEATURE_AR_CREATE
#define ENABLE_FEATURE_AR_CREATE 0
#define IF_FEATURE_AR_CREATE(...)
#define IF_NOT_FEATURE_AR_CREATE(...) __VA_ARGS__
#define CONFIG_BUNZIP2 1
#define ENABLE_BUNZIP2 1
#define IF_BUNZIP2(...) __VA_ARGS__
#define IF_NOT_BUNZIP2(...)
#define CONFIG_BZIP2 1
#define ENABLE_BZIP2 1
#define IF_BZIP2(...) __VA_ARGS__
#define IF_NOT_BZIP2(...)
#define CONFIG_CPIO 1
#define ENABLE_CPIO 1
#define IF_CPIO(...) __VA_ARGS__
#define IF_NOT_CPIO(...)
#define CONFIG_FEATURE_CPIO_O 1
#define ENABLE_FEATURE_CPIO_O 1
#define IF_FEATURE_CPIO_O(...) __VA_ARGS__
#define IF_NOT_FEATURE_CPIO_O(...)
#define CONFIG_FEATURE_CPIO_P 1
#define ENABLE_FEATURE_CPIO_P 1
#define IF_FEATURE_CPIO_P(...) __VA_ARGS__
#define IF_NOT_FEATURE_CPIO_P(...)
#undef CONFIG_DPKG
#define ENABLE_DPKG 0
#define IF_DPKG(...)
#define IF_NOT_DPKG(...) __VA_ARGS__
#undef CONFIG_DPKG_DEB
#define ENABLE_DPKG_DEB 0
#define IF_DPKG_DEB(...)
#define IF_NOT_DPKG_DEB(...) __VA_ARGS__
#undef CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY
#define ENABLE_FEATURE_DPKG_DEB_EXTRACT_ONLY 0
#define IF_FEATURE_DPKG_DEB_EXTRACT_ONLY(...)
#define IF_NOT_FEATURE_DPKG_DEB_EXTRACT_ONLY(...) __VA_ARGS__
#define CONFIG_GUNZIP 1
#define ENABLE_GUNZIP 1
#define IF_GUNZIP(...) __VA_ARGS__
#define IF_NOT_GUNZIP(...)
#define CONFIG_GZIP 1
#define ENABLE_GZIP 1
#define IF_GZIP(...) __VA_ARGS__
#define IF_NOT_GZIP(...)
#define CONFIG_FEATURE_GZIP_LONG_OPTIONS 1
#define ENABLE_FEATURE_GZIP_LONG_OPTIONS 1
#define IF_FEATURE_GZIP_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_GZIP_LONG_OPTIONS(...)
#define CONFIG_GZIP_FAST 2
#define ENABLE_GZIP_FAST 1
#define IF_GZIP_FAST(...) __VA_ARGS__
#define IF_NOT_GZIP_FAST(...)
#define CONFIG_LZOP 1
#define ENABLE_LZOP 1
#define IF_LZOP(...) __VA_ARGS__
#define IF_NOT_LZOP(...)
#undef CONFIG_LZOP_COMPR_HIGH
#define ENABLE_LZOP_COMPR_HIGH 0
#define IF_LZOP_COMPR_HIGH(...)
#define IF_NOT_LZOP_COMPR_HIGH(...) __VA_ARGS__
#undef CONFIG_RPM2CPIO
#define ENABLE_RPM2CPIO 0
#define IF_RPM2CPIO(...)
#define IF_NOT_RPM2CPIO(...) __VA_ARGS__
#undef CONFIG_RPM
#define ENABLE_RPM 0
#define IF_RPM(...)
#define IF_NOT_RPM(...) __VA_ARGS__
#define CONFIG_TAR 1
#define ENABLE_TAR 1
#define IF_TAR(...) __VA_ARGS__
#define IF_NOT_TAR(...)
#define CONFIG_FEATURE_TAR_CREATE 1
#define ENABLE_FEATURE_TAR_CREATE 1
#define IF_FEATURE_TAR_CREATE(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_CREATE(...)
#define CONFIG_FEATURE_TAR_AUTODETECT 1
#define ENABLE_FEATURE_TAR_AUTODETECT 1
#define IF_FEATURE_TAR_AUTODETECT(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_AUTODETECT(...)
#define CONFIG_FEATURE_TAR_FROM 1
#define ENABLE_FEATURE_TAR_FROM 1
#define IF_FEATURE_TAR_FROM(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_FROM(...)
#undef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
#define ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY 0
#define IF_FEATURE_TAR_OLDGNU_COMPATIBILITY(...)
#define IF_NOT_FEATURE_TAR_OLDGNU_COMPATIBILITY(...) __VA_ARGS__
#undef CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY
#define ENABLE_FEATURE_TAR_OLDSUN_COMPATIBILITY 0
#define IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(...)
#define IF_NOT_FEATURE_TAR_OLDSUN_COMPATIBILITY(...) __VA_ARGS__
#define CONFIG_FEATURE_TAR_GNU_EXTENSIONS 1
#define ENABLE_FEATURE_TAR_GNU_EXTENSIONS 1
#define IF_FEATURE_TAR_GNU_EXTENSIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_GNU_EXTENSIONS(...)
#define CONFIG_FEATURE_TAR_LONG_OPTIONS 1
#define ENABLE_FEATURE_TAR_LONG_OPTIONS 1
#define IF_FEATURE_TAR_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_LONG_OPTIONS(...)
#define CONFIG_FEATURE_TAR_TO_COMMAND 1
#define ENABLE_FEATURE_TAR_TO_COMMAND 1
#define IF_FEATURE_TAR_TO_COMMAND(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_TO_COMMAND(...)
#define CONFIG_FEATURE_TAR_UNAME_GNAME 1
#define ENABLE_FEATURE_TAR_UNAME_GNAME 1
#define IF_FEATURE_TAR_UNAME_GNAME(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_UNAME_GNAME(...)
#define CONFIG_FEATURE_TAR_NOPRESERVE_TIME 1
#define ENABLE_FEATURE_TAR_NOPRESERVE_TIME 1
#define IF_FEATURE_TAR_NOPRESERVE_TIME(...) __VA_ARGS__
#define IF_NOT_FEATURE_TAR_NOPRESERVE_TIME(...)
#undef CONFIG_FEATURE_TAR_SELINUX
#define ENABLE_FEATURE_TAR_SELINUX 0
#define IF_FEATURE_TAR_SELINUX(...)
#define IF_NOT_FEATURE_TAR_SELINUX(...) __VA_ARGS__
#define CONFIG_UNCOMPRESS 1
#define ENABLE_UNCOMPRESS 1
#define IF_UNCOMPRESS(...) __VA_ARGS__
#define IF_NOT_UNCOMPRESS(...)
#define CONFIG_UNLZMA 1
#define ENABLE_UNLZMA 1
#define IF_UNLZMA(...) __VA_ARGS__
#define IF_NOT_UNLZMA(...)
#define CONFIG_FEATURE_LZMA_FAST 1
#define ENABLE_FEATURE_LZMA_FAST 1
#define IF_FEATURE_LZMA_FAST(...) __VA_ARGS__
#define IF_NOT_FEATURE_LZMA_FAST(...)
#define CONFIG_LZMA 1
#define ENABLE_LZMA 1
#define IF_LZMA(...) __VA_ARGS__
#define IF_NOT_LZMA(...)
#define CONFIG_UNXZ 1
#define ENABLE_UNXZ 1
#define IF_UNXZ(...) __VA_ARGS__
#define IF_NOT_UNXZ(...)
#define CONFIG_XZ 1
#define ENABLE_XZ 1
#define IF_XZ(...) __VA_ARGS__
#define IF_NOT_XZ(...)
#define CONFIG_UNZIP 1
#define ENABLE_UNZIP 1
#define IF_UNZIP(...) __VA_ARGS__
#define IF_NOT_UNZIP(...)
/*
* Coreutils
*/
#define CONFIG_BASENAME 1
#define ENABLE_BASENAME 1
#define IF_BASENAME(...) __VA_ARGS__
#define IF_NOT_BASENAME(...)
#define CONFIG_CAT 1
#define ENABLE_CAT 1
#define IF_CAT(...) __VA_ARGS__
#define IF_NOT_CAT(...)
#define CONFIG_DATE 1
#define ENABLE_DATE 1
#define IF_DATE(...) __VA_ARGS__
#define IF_NOT_DATE(...)
#define CONFIG_FEATURE_DATE_ISOFMT 1
#define ENABLE_FEATURE_DATE_ISOFMT 1
#define IF_FEATURE_DATE_ISOFMT(...) __VA_ARGS__
#define IF_NOT_FEATURE_DATE_ISOFMT(...)
#undef CONFIG_FEATURE_DATE_NANO
#define ENABLE_FEATURE_DATE_NANO 0
#define IF_FEATURE_DATE_NANO(...)
#define IF_NOT_FEATURE_DATE_NANO(...) __VA_ARGS__
#define CONFIG_FEATURE_DATE_COMPAT 1
#define ENABLE_FEATURE_DATE_COMPAT 1
#define IF_FEATURE_DATE_COMPAT(...) __VA_ARGS__
#define IF_NOT_FEATURE_DATE_COMPAT(...)
#undef CONFIG_HOSTID
#define ENABLE_HOSTID 0
#define IF_HOSTID(...)
#define IF_NOT_HOSTID(...) __VA_ARGS__
#define CONFIG_ID 1
#define ENABLE_ID 1
#define IF_ID(...) __VA_ARGS__
#define IF_NOT_ID(...)
#define CONFIG_GROUPS 1
#define ENABLE_GROUPS 1
#define IF_GROUPS(...) __VA_ARGS__
#define IF_NOT_GROUPS(...)
#define CONFIG_TEST 1
#define ENABLE_TEST 1
#define IF_TEST(...) __VA_ARGS__
#define IF_NOT_TEST(...)
#undef CONFIG_FEATURE_TEST_64
#define ENABLE_FEATURE_TEST_64 0
#define IF_FEATURE_TEST_64(...)
#define IF_NOT_FEATURE_TEST_64(...) __VA_ARGS__
#define CONFIG_TOUCH 1
#define ENABLE_TOUCH 1
#define IF_TOUCH(...) __VA_ARGS__
#define IF_NOT_TOUCH(...)
#define CONFIG_FEATURE_TOUCH_SUSV3 1
#define ENABLE_FEATURE_TOUCH_SUSV3 1
#define IF_FEATURE_TOUCH_SUSV3(...) __VA_ARGS__
#define IF_NOT_FEATURE_TOUCH_SUSV3(...)
#define CONFIG_TR 1
#define ENABLE_TR 1
#define IF_TR(...) __VA_ARGS__
#define IF_NOT_TR(...)
#define CONFIG_FEATURE_TR_CLASSES 1
#define ENABLE_FEATURE_TR_CLASSES 1
#define IF_FEATURE_TR_CLASSES(...) __VA_ARGS__
#define IF_NOT_FEATURE_TR_CLASSES(...)
#undef CONFIG_FEATURE_TR_EQUIV
#define ENABLE_FEATURE_TR_EQUIV 0
#define IF_FEATURE_TR_EQUIV(...)
#define IF_NOT_FEATURE_TR_EQUIV(...) __VA_ARGS__
#define CONFIG_BASE64 1
#define ENABLE_BASE64 1
#define IF_BASE64(...) __VA_ARGS__
#define IF_NOT_BASE64(...)
#undef CONFIG_WHO
#define ENABLE_WHO 0
#define IF_WHO(...)
#define IF_NOT_WHO(...) __VA_ARGS__
#undef CONFIG_USERS
#define ENABLE_USERS 0
#define IF_USERS(...)
#define IF_NOT_USERS(...) __VA_ARGS__
#define CONFIG_CAL 1
#define ENABLE_CAL 1
#define IF_CAL(...) __VA_ARGS__
#define IF_NOT_CAL(...)
#define CONFIG_CATV 1
#define ENABLE_CATV 1
#define IF_CATV(...) __VA_ARGS__
#define IF_NOT_CATV(...)
#define CONFIG_CHGRP 1
#define ENABLE_CHGRP 1
#define IF_CHGRP(...) __VA_ARGS__
#define IF_NOT_CHGRP(...)
#define CONFIG_CHMOD 1
#define ENABLE_CHMOD 1
#define IF_CHMOD(...) __VA_ARGS__
#define IF_NOT_CHMOD(...)
#define CONFIG_CHOWN 1
#define ENABLE_CHOWN 1
#define IF_CHOWN(...) __VA_ARGS__
#define IF_NOT_CHOWN(...)
#define CONFIG_FEATURE_CHOWN_LONG_OPTIONS 1
#define ENABLE_FEATURE_CHOWN_LONG_OPTIONS 1
#define IF_FEATURE_CHOWN_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_CHOWN_LONG_OPTIONS(...)
#define CONFIG_CHROOT 1
#define ENABLE_CHROOT 1
#define IF_CHROOT(...) __VA_ARGS__
#define IF_NOT_CHROOT(...)
#undef CONFIG_CKSUM
#define ENABLE_CKSUM 0
#define IF_CKSUM(...)
#define IF_NOT_CKSUM(...) __VA_ARGS__
#define CONFIG_COMM 1
#define ENABLE_COMM 1
#define IF_COMM(...) __VA_ARGS__
#define IF_NOT_COMM(...)
#define CONFIG_CP 1
#define ENABLE_CP 1
#define IF_CP(...) __VA_ARGS__
#define IF_NOT_CP(...)
#define CONFIG_FEATURE_CP_LONG_OPTIONS 1
#define ENABLE_FEATURE_CP_LONG_OPTIONS 1
#define IF_FEATURE_CP_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_CP_LONG_OPTIONS(...)
#define CONFIG_CUT 1
#define ENABLE_CUT 1
#define IF_CUT(...) __VA_ARGS__
#define IF_NOT_CUT(...)
#define CONFIG_DD 1
#define ENABLE_DD 1
#define IF_DD(...) __VA_ARGS__
#define IF_NOT_DD(...)
#define CONFIG_FEATURE_DD_SIGNAL_HANDLING 1
#define ENABLE_FEATURE_DD_SIGNAL_HANDLING 1
#define IF_FEATURE_DD_SIGNAL_HANDLING(...) __VA_ARGS__
#define IF_NOT_FEATURE_DD_SIGNAL_HANDLING(...)
#define CONFIG_FEATURE_DD_THIRD_STATUS_LINE 1
#define ENABLE_FEATURE_DD_THIRD_STATUS_LINE 1
#define IF_FEATURE_DD_THIRD_STATUS_LINE(...) __VA_ARGS__
#define IF_NOT_FEATURE_DD_THIRD_STATUS_LINE(...)
#define CONFIG_FEATURE_DD_IBS_OBS 1
#define ENABLE_FEATURE_DD_IBS_OBS 1
#define IF_FEATURE_DD_IBS_OBS(...) __VA_ARGS__
#define IF_NOT_FEATURE_DD_IBS_OBS(...)
#define CONFIG_DF 1
#define ENABLE_DF 1
#define IF_DF(...) __VA_ARGS__
#define IF_NOT_DF(...)
#define CONFIG_FEATURE_DF_FANCY 1
#define ENABLE_FEATURE_DF_FANCY 1
#define IF_FEATURE_DF_FANCY(...) __VA_ARGS__
#define IF_NOT_FEATURE_DF_FANCY(...)
#define CONFIG_DIRNAME 1
#define ENABLE_DIRNAME 1
#define IF_DIRNAME(...) __VA_ARGS__
#define IF_NOT_DIRNAME(...)
#define CONFIG_DOS2UNIX 1
#define ENABLE_DOS2UNIX 1
#define IF_DOS2UNIX(...) __VA_ARGS__
#define IF_NOT_DOS2UNIX(...)
#define CONFIG_UNIX2DOS 1
#define ENABLE_UNIX2DOS 1
#define IF_UNIX2DOS(...) __VA_ARGS__
#define IF_NOT_UNIX2DOS(...)
#define CONFIG_DU 1
#define ENABLE_DU 1
#define IF_DU(...) __VA_ARGS__
#define IF_NOT_DU(...)
#define CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K 1
#define ENABLE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K 1
#define IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(...) __VA_ARGS__
#define IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(...)
#define CONFIG_ECHO 1
#define ENABLE_ECHO 1
#define IF_ECHO(...) __VA_ARGS__
#define IF_NOT_ECHO(...)
#define CONFIG_FEATURE_FANCY_ECHO 1
#define ENABLE_FEATURE_FANCY_ECHO 1
#define IF_FEATURE_FANCY_ECHO(...) __VA_ARGS__
#define IF_NOT_FEATURE_FANCY_ECHO(...)
#define CONFIG_ENV 1
#define ENABLE_ENV 1
#define IF_ENV(...) __VA_ARGS__
#define IF_NOT_ENV(...)
#define CONFIG_FEATURE_ENV_LONG_OPTIONS 1
#define ENABLE_FEATURE_ENV_LONG_OPTIONS 1
#define IF_FEATURE_ENV_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_ENV_LONG_OPTIONS(...)
#define CONFIG_EXPAND 1
#define ENABLE_EXPAND 1
#define IF_EXPAND(...) __VA_ARGS__
#define IF_NOT_EXPAND(...)
#define CONFIG_FEATURE_EXPAND_LONG_OPTIONS 1
#define ENABLE_FEATURE_EXPAND_LONG_OPTIONS 1
#define IF_FEATURE_EXPAND_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_EXPAND_LONG_OPTIONS(...)
#define CONFIG_EXPR 1
#define ENABLE_EXPR 1
#define IF_EXPR(...) __VA_ARGS__
#define IF_NOT_EXPR(...)
#define CONFIG_EXPR_MATH_SUPPORT_64 1
#define ENABLE_EXPR_MATH_SUPPORT_64 1
#define IF_EXPR_MATH_SUPPORT_64(...) __VA_ARGS__
#define IF_NOT_EXPR_MATH_SUPPORT_64(...)
#define CONFIG_FALSE 1
#define ENABLE_FALSE 1
#define IF_FALSE(...) __VA_ARGS__
#define IF_NOT_FALSE(...)
#define CONFIG_FOLD 1
#define ENABLE_FOLD 1
#define IF_FOLD(...) __VA_ARGS__
#define IF_NOT_FOLD(...)
#define CONFIG_FSYNC 1
#define ENABLE_FSYNC 1
#define IF_FSYNC(...) __VA_ARGS__
#define IF_NOT_FSYNC(...)
#define CONFIG_HEAD 1
#define ENABLE_HEAD 1
#define IF_HEAD(...) __VA_ARGS__
#define IF_NOT_HEAD(...)
#define CONFIG_FEATURE_FANCY_HEAD 1
#define ENABLE_FEATURE_FANCY_HEAD 1
#define IF_FEATURE_FANCY_HEAD(...) __VA_ARGS__
#define IF_NOT_FEATURE_FANCY_HEAD(...)
#define CONFIG_INSTALL 1
#define ENABLE_INSTALL 1
#define IF_INSTALL(...) __VA_ARGS__
#define IF_NOT_INSTALL(...)
#define CONFIG_FEATURE_INSTALL_LONG_OPTIONS 1
#define ENABLE_FEATURE_INSTALL_LONG_OPTIONS 1
#define IF_FEATURE_INSTALL_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_INSTALL_LONG_OPTIONS(...)
#define CONFIG_LN 1
#define ENABLE_LN 1
#define IF_LN(...) __VA_ARGS__
#define IF_NOT_LN(...)
#undef CONFIG_LOGNAME
#define ENABLE_LOGNAME 0
#define IF_LOGNAME(...)
#define IF_NOT_LOGNAME(...) __VA_ARGS__
#define CONFIG_LS 1
#define ENABLE_LS 1
#define IF_LS(...) __VA_ARGS__
#define IF_NOT_LS(...)
#define CONFIG_FEATURE_LS_FILETYPES 1
#define ENABLE_FEATURE_LS_FILETYPES 1
#define IF_FEATURE_LS_FILETYPES(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_FILETYPES(...)
#define CONFIG_FEATURE_LS_FOLLOWLINKS 1
#define ENABLE_FEATURE_LS_FOLLOWLINKS 1
#define IF_FEATURE_LS_FOLLOWLINKS(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_FOLLOWLINKS(...)
#define CONFIG_FEATURE_LS_RECURSIVE 1
#define ENABLE_FEATURE_LS_RECURSIVE 1
#define IF_FEATURE_LS_RECURSIVE(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_RECURSIVE(...)
#define CONFIG_FEATURE_LS_SORTFILES 1
#define ENABLE_FEATURE_LS_SORTFILES 1
#define IF_FEATURE_LS_SORTFILES(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_SORTFILES(...)
#define CONFIG_FEATURE_LS_TIMESTAMPS 1
#define ENABLE_FEATURE_LS_TIMESTAMPS 1
#define IF_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_TIMESTAMPS(...)
#define CONFIG_FEATURE_LS_USERNAME 1
#define ENABLE_FEATURE_LS_USERNAME 1
#define IF_FEATURE_LS_USERNAME(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_USERNAME(...)
#define CONFIG_FEATURE_LS_COLOR 1
#define ENABLE_FEATURE_LS_COLOR 1
#define IF_FEATURE_LS_COLOR(...) __VA_ARGS__
#define IF_NOT_FEATURE_LS_COLOR(...)
#undef CONFIG_FEATURE_LS_COLOR_IS_DEFAULT
#define ENABLE_FEATURE_LS_COLOR_IS_DEFAULT 0
#define IF_FEATURE_LS_COLOR_IS_DEFAULT(...)
#define IF_NOT_FEATURE_LS_COLOR_IS_DEFAULT(...) __VA_ARGS__
#define CONFIG_MD5SUM 1
#define ENABLE_MD5SUM 1
#define IF_MD5SUM(...) __VA_ARGS__
#define IF_NOT_MD5SUM(...)
#define CONFIG_MKDIR 1
#define ENABLE_MKDIR 1
#define IF_MKDIR(...) __VA_ARGS__
#define IF_NOT_MKDIR(...)
#define CONFIG_FEATURE_MKDIR_LONG_OPTIONS 1
#define ENABLE_FEATURE_MKDIR_LONG_OPTIONS 1
#define IF_FEATURE_MKDIR_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MKDIR_LONG_OPTIONS(...)
#define CONFIG_MKFIFO 1
#define ENABLE_MKFIFO 1
#define IF_MKFIFO(...) __VA_ARGS__
#define IF_NOT_MKFIFO(...)
#define CONFIG_MKNOD 1
#define ENABLE_MKNOD 1
#define IF_MKNOD(...) __VA_ARGS__
#define IF_NOT_MKNOD(...)
#define CONFIG_MV 1
#define ENABLE_MV 1
#define IF_MV(...) __VA_ARGS__
#define IF_NOT_MV(...)
#define CONFIG_FEATURE_MV_LONG_OPTIONS 1
#define ENABLE_FEATURE_MV_LONG_OPTIONS 1
#define IF_FEATURE_MV_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MV_LONG_OPTIONS(...)
#define CONFIG_NICE 1
#define ENABLE_NICE 1
#define IF_NICE(...) __VA_ARGS__
#define IF_NOT_NICE(...)
#define CONFIG_NOHUP 1
#define ENABLE_NOHUP 1
#define IF_NOHUP(...) __VA_ARGS__
#define IF_NOT_NOHUP(...)
#define CONFIG_OD 1
#define ENABLE_OD 1
#define IF_OD(...) __VA_ARGS__
#define IF_NOT_OD(...)
#define CONFIG_PRINTENV 1
#define ENABLE_PRINTENV 1
#define IF_PRINTENV(...) __VA_ARGS__
#define IF_NOT_PRINTENV(...)
#define CONFIG_PRINTF 1
#define ENABLE_PRINTF 1
#define IF_PRINTF(...) __VA_ARGS__
#define IF_NOT_PRINTF(...)
#define CONFIG_PWD 1
#define ENABLE_PWD 1
#define IF_PWD(...) __VA_ARGS__
#define IF_NOT_PWD(...)
#define CONFIG_READLINK 1
#define ENABLE_READLINK 1
#define IF_READLINK(...) __VA_ARGS__
#define IF_NOT_READLINK(...)
#define CONFIG_FEATURE_READLINK_FOLLOW 1
#define ENABLE_FEATURE_READLINK_FOLLOW 1
#define IF_FEATURE_READLINK_FOLLOW(...) __VA_ARGS__
#define IF_NOT_FEATURE_READLINK_FOLLOW(...)
#define CONFIG_REALPATH 1
#define ENABLE_REALPATH 1
#define IF_REALPATH(...) __VA_ARGS__
#define IF_NOT_REALPATH(...)
#define CONFIG_RM 1
#define ENABLE_RM 1
#define IF_RM(...) __VA_ARGS__
#define IF_NOT_RM(...)
#define CONFIG_RMDIR 1
#define ENABLE_RMDIR 1
#define IF_RMDIR(...) __VA_ARGS__
#define IF_NOT_RMDIR(...)
#define CONFIG_FEATURE_RMDIR_LONG_OPTIONS 1
#define ENABLE_FEATURE_RMDIR_LONG_OPTIONS 1
#define IF_FEATURE_RMDIR_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_RMDIR_LONG_OPTIONS(...)
#define CONFIG_SEQ 1
#define ENABLE_SEQ 1
#define IF_SEQ(...) __VA_ARGS__
#define IF_NOT_SEQ(...)
#define CONFIG_SHA1SUM 1
#define ENABLE_SHA1SUM 1
#define IF_SHA1SUM(...) __VA_ARGS__
#define IF_NOT_SHA1SUM(...)
#define CONFIG_SHA256SUM 1
#define ENABLE_SHA256SUM 1
#define IF_SHA256SUM(...) __VA_ARGS__
#define IF_NOT_SHA256SUM(...)
#define CONFIG_SHA512SUM 1
#define ENABLE_SHA512SUM 1
#define IF_SHA512SUM(...) __VA_ARGS__
#define IF_NOT_SHA512SUM(...)
#define CONFIG_SHA3SUM 1
#define ENABLE_SHA3SUM 1
#define IF_SHA3SUM(...) __VA_ARGS__
#define IF_NOT_SHA3SUM(...)
#define CONFIG_SLEEP 1
#define ENABLE_SLEEP 1
#define IF_SLEEP(...) __VA_ARGS__
#define IF_NOT_SLEEP(...)
#define CONFIG_FEATURE_FANCY_SLEEP 1
#define ENABLE_FEATURE_FANCY_SLEEP 1
#define IF_FEATURE_FANCY_SLEEP(...) __VA_ARGS__
#define IF_NOT_FEATURE_FANCY_SLEEP(...)
#define CONFIG_FEATURE_FLOAT_SLEEP 1
#define ENABLE_FEATURE_FLOAT_SLEEP 1
#define IF_FEATURE_FLOAT_SLEEP(...) __VA_ARGS__
#define IF_NOT_FEATURE_FLOAT_SLEEP(...)
#define CONFIG_SORT 1
#define ENABLE_SORT 1
#define IF_SORT(...) __VA_ARGS__
#define IF_NOT_SORT(...)
#define CONFIG_FEATURE_SORT_BIG 1
#define ENABLE_FEATURE_SORT_BIG 1
#define IF_FEATURE_SORT_BIG(...) __VA_ARGS__
#define IF_NOT_FEATURE_SORT_BIG(...)
#define CONFIG_SPLIT 1
#define ENABLE_SPLIT 1
#define IF_SPLIT(...) __VA_ARGS__
#define IF_NOT_SPLIT(...)
#define CONFIG_FEATURE_SPLIT_FANCY 1
#define ENABLE_FEATURE_SPLIT_FANCY 1
#define IF_FEATURE_SPLIT_FANCY(...) __VA_ARGS__
#define IF_NOT_FEATURE_SPLIT_FANCY(...)
#define CONFIG_STAT 1
#define ENABLE_STAT 1
#define IF_STAT(...) __VA_ARGS__
#define IF_NOT_STAT(...)
#undef CONFIG_FEATURE_STAT_FORMAT
#define ENABLE_FEATURE_STAT_FORMAT 0
#define IF_FEATURE_STAT_FORMAT(...)
#define IF_NOT_FEATURE_STAT_FORMAT(...) __VA_ARGS__
#define CONFIG_STTY 1
#define ENABLE_STTY 1
#define IF_STTY(...) __VA_ARGS__
#define IF_NOT_STTY(...)
#define CONFIG_SUM 1
#define ENABLE_SUM 1
#define IF_SUM(...) __VA_ARGS__
#define IF_NOT_SUM(...)
#define CONFIG_SYNC 1
#define ENABLE_SYNC 1
#define IF_SYNC(...) __VA_ARGS__
#define IF_NOT_SYNC(...)
#define CONFIG_TAC 1
#define ENABLE_TAC 1
#define IF_TAC(...) __VA_ARGS__
#define IF_NOT_TAC(...)
#define CONFIG_TAIL 1
#define ENABLE_TAIL 1
#define IF_TAIL(...) __VA_ARGS__
#define IF_NOT_TAIL(...)
#define CONFIG_FEATURE_FANCY_TAIL 1
#define ENABLE_FEATURE_FANCY_TAIL 1
#define IF_FEATURE_FANCY_TAIL(...) __VA_ARGS__
#define IF_NOT_FEATURE_FANCY_TAIL(...)
#define CONFIG_TEE 1
#define ENABLE_TEE 1
#define IF_TEE(...) __VA_ARGS__
#define IF_NOT_TEE(...)
#define CONFIG_FEATURE_TEE_USE_BLOCK_IO 1
#define ENABLE_FEATURE_TEE_USE_BLOCK_IO 1
#define IF_FEATURE_TEE_USE_BLOCK_IO(...) __VA_ARGS__
#define IF_NOT_FEATURE_TEE_USE_BLOCK_IO(...)
#define CONFIG_TRUE 1
#define ENABLE_TRUE 1
#define IF_TRUE(...) __VA_ARGS__
#define IF_NOT_TRUE(...)
#undef CONFIG_TTY
#define ENABLE_TTY 0
#define IF_TTY(...)
#define IF_NOT_TTY(...) __VA_ARGS__
#define CONFIG_UNAME 1
#define ENABLE_UNAME 1
#define IF_UNAME(...) __VA_ARGS__
#define IF_NOT_UNAME(...)
#define CONFIG_UNEXPAND 1
#define ENABLE_UNEXPAND 1
#define IF_UNEXPAND(...) __VA_ARGS__
#define IF_NOT_UNEXPAND(...)
#define CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS 1
#define ENABLE_FEATURE_UNEXPAND_LONG_OPTIONS 1
#define IF_FEATURE_UNEXPAND_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_UNEXPAND_LONG_OPTIONS(...)
#define CONFIG_UNIQ 1
#define ENABLE_UNIQ 1
#define IF_UNIQ(...) __VA_ARGS__
#define IF_NOT_UNIQ(...)
#define CONFIG_USLEEP 1
#define ENABLE_USLEEP 1
#define IF_USLEEP(...) __VA_ARGS__
#define IF_NOT_USLEEP(...)
#define CONFIG_UUDECODE 1
#define ENABLE_UUDECODE 1
#define IF_UUDECODE(...) __VA_ARGS__
#define IF_NOT_UUDECODE(...)
#define CONFIG_UUENCODE 1
#define ENABLE_UUENCODE 1
#define IF_UUENCODE(...) __VA_ARGS__
#define IF_NOT_UUENCODE(...)
#define CONFIG_WC 1
#define ENABLE_WC 1
#define IF_WC(...) __VA_ARGS__
#define IF_NOT_WC(...)
#undef CONFIG_FEATURE_WC_LARGE
#define ENABLE_FEATURE_WC_LARGE 0
#define IF_FEATURE_WC_LARGE(...)
#define IF_NOT_FEATURE_WC_LARGE(...) __VA_ARGS__
#define CONFIG_WHOAMI 1
#define ENABLE_WHOAMI 1
#define IF_WHOAMI(...) __VA_ARGS__
#define IF_NOT_WHOAMI(...)
#define CONFIG_YES 1
#define ENABLE_YES 1
#define IF_YES(...) __VA_ARGS__
#define IF_NOT_YES(...)
/*
* Common options for cp and mv
*/
#define CONFIG_FEATURE_PRESERVE_HARDLINKS 1
#define ENABLE_FEATURE_PRESERVE_HARDLINKS 1
#define IF_FEATURE_PRESERVE_HARDLINKS(...) __VA_ARGS__
#define IF_NOT_FEATURE_PRESERVE_HARDLINKS(...)
/*
* Common options for ls, more and telnet
*/
#define CONFIG_FEATURE_AUTOWIDTH 1
#define ENABLE_FEATURE_AUTOWIDTH 1
#define IF_FEATURE_AUTOWIDTH(...) __VA_ARGS__
#define IF_NOT_FEATURE_AUTOWIDTH(...)
/*
* Common options for df, du, ls
*/
#define CONFIG_FEATURE_HUMAN_READABLE 1
#define ENABLE_FEATURE_HUMAN_READABLE 1
#define IF_FEATURE_HUMAN_READABLE(...) __VA_ARGS__
#define IF_NOT_FEATURE_HUMAN_READABLE(...)
/*
* Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
*/
#define CONFIG_FEATURE_MD5_SHA1_SUM_CHECK 1
#define ENABLE_FEATURE_MD5_SHA1_SUM_CHECK 1
#define IF_FEATURE_MD5_SHA1_SUM_CHECK(...) __VA_ARGS__
#define IF_NOT_FEATURE_MD5_SHA1_SUM_CHECK(...)
/*
* Console Utilities
*/
#undef CONFIG_CHVT
#define ENABLE_CHVT 0
#define IF_CHVT(...)
#define IF_NOT_CHVT(...) __VA_ARGS__
#undef CONFIG_FGCONSOLE
#define ENABLE_FGCONSOLE 0
#define IF_FGCONSOLE(...)
#define IF_NOT_FGCONSOLE(...) __VA_ARGS__
#define CONFIG_CLEAR 1
#define ENABLE_CLEAR 1
#define IF_CLEAR(...) __VA_ARGS__
#define IF_NOT_CLEAR(...)
#undef CONFIG_DEALLOCVT
#define ENABLE_DEALLOCVT 0
#define IF_DEALLOCVT(...)
#define IF_NOT_DEALLOCVT(...) __VA_ARGS__
#undef CONFIG_DUMPKMAP
#define ENABLE_DUMPKMAP 0
#define IF_DUMPKMAP(...)
#define IF_NOT_DUMPKMAP(...) __VA_ARGS__
#undef CONFIG_KBD_MODE
#define ENABLE_KBD_MODE 0
#define IF_KBD_MODE(...)
#define IF_NOT_KBD_MODE(...) __VA_ARGS__
#undef CONFIG_LOADFONT
#define ENABLE_LOADFONT 0
#define IF_LOADFONT(...)
#define IF_NOT_LOADFONT(...) __VA_ARGS__
#undef CONFIG_LOADKMAP
#define ENABLE_LOADKMAP 0
#define IF_LOADKMAP(...)
#define IF_NOT_LOADKMAP(...) __VA_ARGS__
#undef CONFIG_OPENVT
#define ENABLE_OPENVT 0
#define IF_OPENVT(...)
#define IF_NOT_OPENVT(...) __VA_ARGS__
#define CONFIG_RESET 1
#define ENABLE_RESET 1
#define IF_RESET(...) __VA_ARGS__
#define IF_NOT_RESET(...)
#define CONFIG_RESIZE 1
#define ENABLE_RESIZE 1
#define IF_RESIZE(...) __VA_ARGS__
#define IF_NOT_RESIZE(...)
#undef CONFIG_FEATURE_RESIZE_PRINT
#define ENABLE_FEATURE_RESIZE_PRINT 0
#define IF_FEATURE_RESIZE_PRINT(...)
#define IF_NOT_FEATURE_RESIZE_PRINT(...) __VA_ARGS__
#define CONFIG_SETCONSOLE 1
#define ENABLE_SETCONSOLE 1
#define IF_SETCONSOLE(...) __VA_ARGS__
#define IF_NOT_SETCONSOLE(...)
#undef CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS
#define ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS 0
#define IF_FEATURE_SETCONSOLE_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_SETCONSOLE_LONG_OPTIONS(...) __VA_ARGS__
#undef CONFIG_SETFONT
#define ENABLE_SETFONT 0
#define IF_SETFONT(...)
#define IF_NOT_SETFONT(...) __VA_ARGS__
#undef CONFIG_FEATURE_SETFONT_TEXTUAL_MAP
#define ENABLE_FEATURE_SETFONT_TEXTUAL_MAP 0
#define IF_FEATURE_SETFONT_TEXTUAL_MAP(...)
#define IF_NOT_FEATURE_SETFONT_TEXTUAL_MAP(...) __VA_ARGS__
#define CONFIG_DEFAULT_SETFONT_DIR ""
#define ENABLE_DEFAULT_SETFONT_DIR 1
#define IF_DEFAULT_SETFONT_DIR(...) __VA_ARGS__
#define IF_NOT_DEFAULT_SETFONT_DIR(...)
#undef CONFIG_SETKEYCODES
#define ENABLE_SETKEYCODES 0
#define IF_SETKEYCODES(...)
#define IF_NOT_SETKEYCODES(...) __VA_ARGS__
#undef CONFIG_SETLOGCONS
#define ENABLE_SETLOGCONS 0
#define IF_SETLOGCONS(...)
#define IF_NOT_SETLOGCONS(...) __VA_ARGS__
#undef CONFIG_SHOWKEY
#define ENABLE_SHOWKEY 0
#define IF_SHOWKEY(...)
#define IF_NOT_SHOWKEY(...) __VA_ARGS__
#undef CONFIG_FEATURE_LOADFONT_PSF2
#define ENABLE_FEATURE_LOADFONT_PSF2 0
#define IF_FEATURE_LOADFONT_PSF2(...)
#define IF_NOT_FEATURE_LOADFONT_PSF2(...) __VA_ARGS__
#undef CONFIG_FEATURE_LOADFONT_RAW
#define ENABLE_FEATURE_LOADFONT_RAW 0
#define IF_FEATURE_LOADFONT_RAW(...)
#define IF_NOT_FEATURE_LOADFONT_RAW(...) __VA_ARGS__
/*
* Debian Utilities
*/
#define CONFIG_MKTEMP 1
#define ENABLE_MKTEMP 1
#define IF_MKTEMP(...) __VA_ARGS__
#define IF_NOT_MKTEMP(...)
#define CONFIG_PIPE_PROGRESS 1
#define ENABLE_PIPE_PROGRESS 1
#define IF_PIPE_PROGRESS(...) __VA_ARGS__
#define IF_NOT_PIPE_PROGRESS(...)
#define CONFIG_RUN_PARTS 1
#define ENABLE_RUN_PARTS 1
#define IF_RUN_PARTS(...) __VA_ARGS__
#define IF_NOT_RUN_PARTS(...)
#define CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS 1
#define ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS 1
#define IF_FEATURE_RUN_PARTS_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_RUN_PARTS_LONG_OPTIONS(...)
#define CONFIG_FEATURE_RUN_PARTS_FANCY 1
#define ENABLE_FEATURE_RUN_PARTS_FANCY 1
#define IF_FEATURE_RUN_PARTS_FANCY(...) __VA_ARGS__
#define IF_NOT_FEATURE_RUN_PARTS_FANCY(...)
#undef CONFIG_START_STOP_DAEMON
#define ENABLE_START_STOP_DAEMON 0
#define IF_START_STOP_DAEMON(...)
#define IF_NOT_START_STOP_DAEMON(...) __VA_ARGS__
#undef CONFIG_FEATURE_START_STOP_DAEMON_FANCY
#define ENABLE_FEATURE_START_STOP_DAEMON_FANCY 0
#define IF_FEATURE_START_STOP_DAEMON_FANCY(...)
#define IF_NOT_FEATURE_START_STOP_DAEMON_FANCY(...) __VA_ARGS__
#undef CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
#define ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS 0
#define IF_FEATURE_START_STOP_DAEMON_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_START_STOP_DAEMON_LONG_OPTIONS(...) __VA_ARGS__
#define CONFIG_WHICH 1
#define ENABLE_WHICH 1
#define IF_WHICH(...) __VA_ARGS__
#define IF_NOT_WHICH(...)
/*
* Editors
*/
#define CONFIG_PATCH 1
#define ENABLE_PATCH 1
#define IF_PATCH(...) __VA_ARGS__
#define IF_NOT_PATCH(...)
#define CONFIG_VI 1
#define ENABLE_VI 1
#define IF_VI(...) __VA_ARGS__
#define IF_NOT_VI(...)
#define CONFIG_FEATURE_VI_MAX_LEN 256
#define ENABLE_FEATURE_VI_MAX_LEN 1
#define IF_FEATURE_VI_MAX_LEN(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_MAX_LEN(...)
#define CONFIG_FEATURE_VI_8BIT 1
#define ENABLE_FEATURE_VI_8BIT 1
#define IF_FEATURE_VI_8BIT(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_8BIT(...)
#define CONFIG_FEATURE_VI_COLON 1
#define ENABLE_FEATURE_VI_COLON 1
#define IF_FEATURE_VI_COLON(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_COLON(...)
#define CONFIG_FEATURE_VI_YANKMARK 1
#define ENABLE_FEATURE_VI_YANKMARK 1
#define IF_FEATURE_VI_YANKMARK(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_YANKMARK(...)
#define CONFIG_FEATURE_VI_SEARCH 1
#define ENABLE_FEATURE_VI_SEARCH 1
#define IF_FEATURE_VI_SEARCH(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_SEARCH(...)
#define CONFIG_FEATURE_VI_REGEX_SEARCH 1
#define ENABLE_FEATURE_VI_REGEX_SEARCH 1
#define IF_FEATURE_VI_REGEX_SEARCH(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_REGEX_SEARCH(...)
#define CONFIG_FEATURE_VI_USE_SIGNALS 1
#define ENABLE_FEATURE_VI_USE_SIGNALS 1
#define IF_FEATURE_VI_USE_SIGNALS(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_USE_SIGNALS(...)
#define CONFIG_FEATURE_VI_DOT_CMD 1
#define ENABLE_FEATURE_VI_DOT_CMD 1
#define IF_FEATURE_VI_DOT_CMD(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_DOT_CMD(...)
#define CONFIG_FEATURE_VI_READONLY 1
#define ENABLE_FEATURE_VI_READONLY 1
#define IF_FEATURE_VI_READONLY(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_READONLY(...)
#define CONFIG_FEATURE_VI_SETOPTS 1
#define ENABLE_FEATURE_VI_SETOPTS 1
#define IF_FEATURE_VI_SETOPTS(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_SETOPTS(...)
#define CONFIG_FEATURE_VI_SET 1
#define ENABLE_FEATURE_VI_SET 1
#define IF_FEATURE_VI_SET(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_SET(...)
#define CONFIG_FEATURE_VI_WIN_RESIZE 1
#define ENABLE_FEATURE_VI_WIN_RESIZE 1
#define IF_FEATURE_VI_WIN_RESIZE(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_WIN_RESIZE(...)
#define CONFIG_FEATURE_VI_ASK_TERMINAL 1
#define ENABLE_FEATURE_VI_ASK_TERMINAL 1
#define IF_FEATURE_VI_ASK_TERMINAL(...) __VA_ARGS__
#define IF_NOT_FEATURE_VI_ASK_TERMINAL(...)
#define CONFIG_AWK 1
#define ENABLE_AWK 1
#define IF_AWK(...) __VA_ARGS__
#define IF_NOT_AWK(...)
#define CONFIG_FEATURE_AWK_LIBM 1
#define ENABLE_FEATURE_AWK_LIBM 1
#define IF_FEATURE_AWK_LIBM(...) __VA_ARGS__
#define IF_NOT_FEATURE_AWK_LIBM(...)
#define CONFIG_CMP 1
#define ENABLE_CMP 1
#define IF_CMP(...) __VA_ARGS__
#define IF_NOT_CMP(...)
#define CONFIG_DIFF 1
#define ENABLE_DIFF 1
#define IF_DIFF(...) __VA_ARGS__
#define IF_NOT_DIFF(...)
#define CONFIG_FEATURE_DIFF_LONG_OPTIONS 1
#define ENABLE_FEATURE_DIFF_LONG_OPTIONS 1
#define IF_FEATURE_DIFF_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_DIFF_LONG_OPTIONS(...)
#define CONFIG_FEATURE_DIFF_DIR 1
#define ENABLE_FEATURE_DIFF_DIR 1
#define IF_FEATURE_DIFF_DIR(...) __VA_ARGS__
#define IF_NOT_FEATURE_DIFF_DIR(...)
#define CONFIG_ED 1
#define ENABLE_ED 1
#define IF_ED(...) __VA_ARGS__
#define IF_NOT_ED(...)
#define CONFIG_SED 1
#define ENABLE_SED 1
#define IF_SED(...) __VA_ARGS__
#define IF_NOT_SED(...)
#define CONFIG_FEATURE_ALLOW_EXEC 1
#define ENABLE_FEATURE_ALLOW_EXEC 1
#define IF_FEATURE_ALLOW_EXEC(...) __VA_ARGS__
#define IF_NOT_FEATURE_ALLOW_EXEC(...)
/*
* Finding Utilities
*/
#define CONFIG_FIND 1
#define ENABLE_FIND 1
#define IF_FIND(...) __VA_ARGS__
#define IF_NOT_FIND(...)
#define CONFIG_FEATURE_FIND_PRINT0 1
#define ENABLE_FEATURE_FIND_PRINT0 1
#define IF_FEATURE_FIND_PRINT0(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_PRINT0(...)
#define CONFIG_FEATURE_FIND_MTIME 1
#define ENABLE_FEATURE_FIND_MTIME 1
#define IF_FEATURE_FIND_MTIME(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_MTIME(...)
#define CONFIG_FEATURE_FIND_MMIN 1
#define ENABLE_FEATURE_FIND_MMIN 1
#define IF_FEATURE_FIND_MMIN(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_MMIN(...)
#define CONFIG_FEATURE_FIND_PERM 1
#define ENABLE_FEATURE_FIND_PERM 1
#define IF_FEATURE_FIND_PERM(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_PERM(...)
#define CONFIG_FEATURE_FIND_TYPE 1
#define ENABLE_FEATURE_FIND_TYPE 1
#define IF_FEATURE_FIND_TYPE(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_TYPE(...)
#define CONFIG_FEATURE_FIND_XDEV 1
#define ENABLE_FEATURE_FIND_XDEV 1
#define IF_FEATURE_FIND_XDEV(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_XDEV(...)
#define CONFIG_FEATURE_FIND_MAXDEPTH 1
#define ENABLE_FEATURE_FIND_MAXDEPTH 1
#define IF_FEATURE_FIND_MAXDEPTH(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_MAXDEPTH(...)
#define CONFIG_FEATURE_FIND_NEWER 1
#define ENABLE_FEATURE_FIND_NEWER 1
#define IF_FEATURE_FIND_NEWER(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_NEWER(...)
#undef CONFIG_FEATURE_FIND_INUM
#define ENABLE_FEATURE_FIND_INUM 0
#define IF_FEATURE_FIND_INUM(...)
#define IF_NOT_FEATURE_FIND_INUM(...) __VA_ARGS__
#define CONFIG_FEATURE_FIND_EXEC 1
#define ENABLE_FEATURE_FIND_EXEC 1
#define IF_FEATURE_FIND_EXEC(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_EXEC(...)
#define CONFIG_FEATURE_FIND_USER 1
#define ENABLE_FEATURE_FIND_USER 1
#define IF_FEATURE_FIND_USER(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_USER(...)
#define CONFIG_FEATURE_FIND_GROUP 1
#define ENABLE_FEATURE_FIND_GROUP 1
#define IF_FEATURE_FIND_GROUP(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_GROUP(...)
#define CONFIG_FEATURE_FIND_NOT 1
#define ENABLE_FEATURE_FIND_NOT 1
#define IF_FEATURE_FIND_NOT(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_NOT(...)
#define CONFIG_FEATURE_FIND_DEPTH 1
#define ENABLE_FEATURE_FIND_DEPTH 1
#define IF_FEATURE_FIND_DEPTH(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_DEPTH(...)
#define CONFIG_FEATURE_FIND_PAREN 1
#define ENABLE_FEATURE_FIND_PAREN 1
#define IF_FEATURE_FIND_PAREN(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_PAREN(...)
#define CONFIG_FEATURE_FIND_SIZE 1
#define ENABLE_FEATURE_FIND_SIZE 1
#define IF_FEATURE_FIND_SIZE(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_SIZE(...)
#define CONFIG_FEATURE_FIND_PRUNE 1
#define ENABLE_FEATURE_FIND_PRUNE 1
#define IF_FEATURE_FIND_PRUNE(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_PRUNE(...)
#undef CONFIG_FEATURE_FIND_DELETE
#define ENABLE_FEATURE_FIND_DELETE 0
#define IF_FEATURE_FIND_DELETE(...)
#define IF_NOT_FEATURE_FIND_DELETE(...) __VA_ARGS__
#define CONFIG_FEATURE_FIND_PATH 1
#define ENABLE_FEATURE_FIND_PATH 1
#define IF_FEATURE_FIND_PATH(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_PATH(...)
#define CONFIG_FEATURE_FIND_REGEX 1
#define ENABLE_FEATURE_FIND_REGEX 1
#define IF_FEATURE_FIND_REGEX(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_REGEX(...)
#undef CONFIG_FEATURE_FIND_CONTEXT
#define ENABLE_FEATURE_FIND_CONTEXT 0
#define IF_FEATURE_FIND_CONTEXT(...)
#define IF_NOT_FEATURE_FIND_CONTEXT(...) __VA_ARGS__
#define CONFIG_FEATURE_FIND_LINKS 1
#define ENABLE_FEATURE_FIND_LINKS 1
#define IF_FEATURE_FIND_LINKS(...) __VA_ARGS__
#define IF_NOT_FEATURE_FIND_LINKS(...)
#define CONFIG_GREP 1
#define ENABLE_GREP 1
#define IF_GREP(...) __VA_ARGS__
#define IF_NOT_GREP(...)
#define CONFIG_FEATURE_GREP_EGREP_ALIAS 1
#define ENABLE_FEATURE_GREP_EGREP_ALIAS 1
#define IF_FEATURE_GREP_EGREP_ALIAS(...) __VA_ARGS__
#define IF_NOT_FEATURE_GREP_EGREP_ALIAS(...)
#define CONFIG_FEATURE_GREP_FGREP_ALIAS 1
#define ENABLE_FEATURE_GREP_FGREP_ALIAS 1
#define IF_FEATURE_GREP_FGREP_ALIAS(...) __VA_ARGS__
#define IF_NOT_FEATURE_GREP_FGREP_ALIAS(...)
#define CONFIG_FEATURE_GREP_CONTEXT 1
#define ENABLE_FEATURE_GREP_CONTEXT 1
#define IF_FEATURE_GREP_CONTEXT(...) __VA_ARGS__
#define IF_NOT_FEATURE_GREP_CONTEXT(...)
#define CONFIG_XARGS 1
#define ENABLE_XARGS 1
#define IF_XARGS(...) __VA_ARGS__
#define IF_NOT_XARGS(...)
#define CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION 1
#define ENABLE_FEATURE_XARGS_SUPPORT_CONFIRMATION 1
#define IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(...) __VA_ARGS__
#define IF_NOT_FEATURE_XARGS_SUPPORT_CONFIRMATION(...)
#define CONFIG_FEATURE_XARGS_SUPPORT_QUOTES 1
#define ENABLE_FEATURE_XARGS_SUPPORT_QUOTES 1
#define IF_FEATURE_XARGS_SUPPORT_QUOTES(...) __VA_ARGS__
#define IF_NOT_FEATURE_XARGS_SUPPORT_QUOTES(...)
#define CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT 1
#define ENABLE_FEATURE_XARGS_SUPPORT_TERMOPT 1
#define IF_FEATURE_XARGS_SUPPORT_TERMOPT(...) __VA_ARGS__
#define IF_NOT_FEATURE_XARGS_SUPPORT_TERMOPT(...)
#define CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM 1
#define ENABLE_FEATURE_XARGS_SUPPORT_ZERO_TERM 1
#define IF_FEATURE_XARGS_SUPPORT_ZERO_TERM(...) __VA_ARGS__
#define IF_NOT_FEATURE_XARGS_SUPPORT_ZERO_TERM(...)
/*
* Init Utilities
*/
#undef CONFIG_BOOTCHARTD
#define ENABLE_BOOTCHARTD 0
#define IF_BOOTCHARTD(...)
#define IF_NOT_BOOTCHARTD(...) __VA_ARGS__
#undef CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER
#define ENABLE_FEATURE_BOOTCHARTD_BLOATED_HEADER 0
#define IF_FEATURE_BOOTCHARTD_BLOATED_HEADER(...)
#define IF_NOT_FEATURE_BOOTCHARTD_BLOATED_HEADER(...) __VA_ARGS__
#undef CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE
#define ENABLE_FEATURE_BOOTCHARTD_CONFIG_FILE 0
#define IF_FEATURE_BOOTCHARTD_CONFIG_FILE(...)
#define IF_NOT_FEATURE_BOOTCHARTD_CONFIG_FILE(...) __VA_ARGS__
#define CONFIG_HALT 1
#define ENABLE_HALT 1
#define IF_HALT(...) __VA_ARGS__
#define IF_NOT_HALT(...)
#undef CONFIG_FEATURE_CALL_TELINIT
#define ENABLE_FEATURE_CALL_TELINIT 0
#define IF_FEATURE_CALL_TELINIT(...)
#define IF_NOT_FEATURE_CALL_TELINIT(...) __VA_ARGS__
#define CONFIG_TELINIT_PATH ""
#define ENABLE_TELINIT_PATH 1
#define IF_TELINIT_PATH(...) __VA_ARGS__
#define IF_NOT_TELINIT_PATH(...)
#undef CONFIG_INIT
#define ENABLE_INIT 0
#define IF_INIT(...)
#define IF_NOT_INIT(...) __VA_ARGS__
#undef CONFIG_FEATURE_USE_INITTAB
#define ENABLE_FEATURE_USE_INITTAB 0
#define IF_FEATURE_USE_INITTAB(...)
#define IF_NOT_FEATURE_USE_INITTAB(...) __VA_ARGS__
#undef CONFIG_FEATURE_KILL_REMOVED
#define ENABLE_FEATURE_KILL_REMOVED 0
#define IF_FEATURE_KILL_REMOVED(...)
#define IF_NOT_FEATURE_KILL_REMOVED(...) __VA_ARGS__
#define CONFIG_FEATURE_KILL_DELAY 0
#define ENABLE_FEATURE_KILL_DELAY 1
#define IF_FEATURE_KILL_DELAY(...) __VA_ARGS__
#define IF_NOT_FEATURE_KILL_DELAY(...)
#undef CONFIG_FEATURE_INIT_SCTTY
#define ENABLE_FEATURE_INIT_SCTTY 0
#define IF_FEATURE_INIT_SCTTY(...)
#define IF_NOT_FEATURE_INIT_SCTTY(...) __VA_ARGS__
#undef CONFIG_FEATURE_INIT_SYSLOG
#define ENABLE_FEATURE_INIT_SYSLOG 0
#define IF_FEATURE_INIT_SYSLOG(...)
#define IF_NOT_FEATURE_INIT_SYSLOG(...) __VA_ARGS__
#undef CONFIG_FEATURE_EXTRA_QUIET
#define ENABLE_FEATURE_EXTRA_QUIET 0
#define IF_FEATURE_EXTRA_QUIET(...)
#define IF_NOT_FEATURE_EXTRA_QUIET(...) __VA_ARGS__
#undef CONFIG_FEATURE_INIT_COREDUMPS
#define ENABLE_FEATURE_INIT_COREDUMPS 0
#define IF_FEATURE_INIT_COREDUMPS(...)
#define IF_NOT_FEATURE_INIT_COREDUMPS(...) __VA_ARGS__
#undef CONFIG_FEATURE_INITRD
#define ENABLE_FEATURE_INITRD 0
#define IF_FEATURE_INITRD(...)
#define IF_NOT_FEATURE_INITRD(...) __VA_ARGS__
#define CONFIG_INIT_TERMINAL_TYPE ""
#define ENABLE_INIT_TERMINAL_TYPE 1
#define IF_INIT_TERMINAL_TYPE(...) __VA_ARGS__
#define IF_NOT_INIT_TERMINAL_TYPE(...)
#define CONFIG_MESG 1
#define ENABLE_MESG 1
#define IF_MESG(...) __VA_ARGS__
#define IF_NOT_MESG(...)
#define CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP 1
#define ENABLE_FEATURE_MESG_ENABLE_ONLY_GROUP 1
#define IF_FEATURE_MESG_ENABLE_ONLY_GROUP(...) __VA_ARGS__
#define IF_NOT_FEATURE_MESG_ENABLE_ONLY_GROUP(...)
/*
* Login/Password Management Utilities
*/
#undef CONFIG_ADD_SHELL
#define ENABLE_ADD_SHELL 0
#define IF_ADD_SHELL(...)
#define IF_NOT_ADD_SHELL(...) __VA_ARGS__
#undef CONFIG_REMOVE_SHELL
#define ENABLE_REMOVE_SHELL 0
#define IF_REMOVE_SHELL(...)
#define IF_NOT_REMOVE_SHELL(...) __VA_ARGS__
#undef CONFIG_FEATURE_SHADOWPASSWDS
#define ENABLE_FEATURE_SHADOWPASSWDS 0
#define IF_FEATURE_SHADOWPASSWDS(...)
#define IF_NOT_FEATURE_SHADOWPASSWDS(...) __VA_ARGS__
#undef CONFIG_USE_BB_PWD_GRP
#define ENABLE_USE_BB_PWD_GRP 0
#define IF_USE_BB_PWD_GRP(...)
#define IF_NOT_USE_BB_PWD_GRP(...) __VA_ARGS__
#undef CONFIG_USE_BB_SHADOW
#define ENABLE_USE_BB_SHADOW 0
#define IF_USE_BB_SHADOW(...)
#define IF_NOT_USE_BB_SHADOW(...) __VA_ARGS__
#define CONFIG_USE_BB_CRYPT 1
#define ENABLE_USE_BB_CRYPT 1
#define IF_USE_BB_CRYPT(...) __VA_ARGS__
#define IF_NOT_USE_BB_CRYPT(...)
#undef CONFIG_USE_BB_CRYPT_SHA
#define ENABLE_USE_BB_CRYPT_SHA 0
#define IF_USE_BB_CRYPT_SHA(...)
#define IF_NOT_USE_BB_CRYPT_SHA(...) __VA_ARGS__
#undef CONFIG_ADDUSER
#define ENABLE_ADDUSER 0
#define IF_ADDUSER(...)
#define IF_NOT_ADDUSER(...) __VA_ARGS__
#undef CONFIG_FEATURE_ADDUSER_LONG_OPTIONS
#define ENABLE_FEATURE_ADDUSER_LONG_OPTIONS 0
#define IF_FEATURE_ADDUSER_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_ADDUSER_LONG_OPTIONS(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHECK_NAMES
#define ENABLE_FEATURE_CHECK_NAMES 0
#define IF_FEATURE_CHECK_NAMES(...)
#define IF_NOT_FEATURE_CHECK_NAMES(...) __VA_ARGS__
#define CONFIG_FIRST_SYSTEM_ID 0
#define ENABLE_FIRST_SYSTEM_ID 1
#define IF_FIRST_SYSTEM_ID(...) __VA_ARGS__
#define IF_NOT_FIRST_SYSTEM_ID(...)
#define CONFIG_LAST_SYSTEM_ID 0
#define ENABLE_LAST_SYSTEM_ID 1
#define IF_LAST_SYSTEM_ID(...) __VA_ARGS__
#define IF_NOT_LAST_SYSTEM_ID(...)
#undef CONFIG_ADDGROUP
#define ENABLE_ADDGROUP 0
#define IF_ADDGROUP(...)
#define IF_NOT_ADDGROUP(...) __VA_ARGS__
#undef CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS
#define ENABLE_FEATURE_ADDGROUP_LONG_OPTIONS 0
#define IF_FEATURE_ADDGROUP_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_ADDGROUP_LONG_OPTIONS(...) __VA_ARGS__
#undef CONFIG_FEATURE_ADDUSER_TO_GROUP
#define ENABLE_FEATURE_ADDUSER_TO_GROUP 0
#define IF_FEATURE_ADDUSER_TO_GROUP(...)
#define IF_NOT_FEATURE_ADDUSER_TO_GROUP(...) __VA_ARGS__
#undef CONFIG_DELUSER
#define ENABLE_DELUSER 0
#define IF_DELUSER(...)
#define IF_NOT_DELUSER(...) __VA_ARGS__
#undef CONFIG_DELGROUP
#define ENABLE_DELGROUP 0
#define IF_DELGROUP(...)
#define IF_NOT_DELGROUP(...) __VA_ARGS__
#undef CONFIG_FEATURE_DEL_USER_FROM_GROUP
#define ENABLE_FEATURE_DEL_USER_FROM_GROUP 0
#define IF_FEATURE_DEL_USER_FROM_GROUP(...)
#define IF_NOT_FEATURE_DEL_USER_FROM_GROUP(...) __VA_ARGS__
#undef CONFIG_GETTY
#define ENABLE_GETTY 0
#define IF_GETTY(...)
#define IF_NOT_GETTY(...) __VA_ARGS__
#undef CONFIG_LOGIN
#define ENABLE_LOGIN 0
#define IF_LOGIN(...)
#define IF_NOT_LOGIN(...) __VA_ARGS__
#undef CONFIG_LOGIN_SESSION_AS_CHILD
#define ENABLE_LOGIN_SESSION_AS_CHILD 0
#define IF_LOGIN_SESSION_AS_CHILD(...)
#define IF_NOT_LOGIN_SESSION_AS_CHILD(...) __VA_ARGS__
#undef CONFIG_PAM
#define ENABLE_PAM 0
#define IF_PAM(...)
#define IF_NOT_PAM(...) __VA_ARGS__
#undef CONFIG_LOGIN_SCRIPTS
#define ENABLE_LOGIN_SCRIPTS 0
#define IF_LOGIN_SCRIPTS(...)
#define IF_NOT_LOGIN_SCRIPTS(...) __VA_ARGS__
#undef CONFIG_FEATURE_NOLOGIN
#define ENABLE_FEATURE_NOLOGIN 0
#define IF_FEATURE_NOLOGIN(...)
#define IF_NOT_FEATURE_NOLOGIN(...) __VA_ARGS__
#undef CONFIG_FEATURE_SECURETTY
#define ENABLE_FEATURE_SECURETTY 0
#define IF_FEATURE_SECURETTY(...)
#define IF_NOT_FEATURE_SECURETTY(...) __VA_ARGS__
#undef CONFIG_PASSWD
#define ENABLE_PASSWD 0
#define IF_PASSWD(...)
#define IF_NOT_PASSWD(...) __VA_ARGS__
#undef CONFIG_FEATURE_PASSWD_WEAK_CHECK
#define ENABLE_FEATURE_PASSWD_WEAK_CHECK 0
#define IF_FEATURE_PASSWD_WEAK_CHECK(...)
#define IF_NOT_FEATURE_PASSWD_WEAK_CHECK(...) __VA_ARGS__
#undef CONFIG_CRYPTPW
#define ENABLE_CRYPTPW 0
#define IF_CRYPTPW(...)
#define IF_NOT_CRYPTPW(...) __VA_ARGS__
#undef CONFIG_CHPASSWD
#define ENABLE_CHPASSWD 0
#define IF_CHPASSWD(...)
#define IF_NOT_CHPASSWD(...) __VA_ARGS__
#define CONFIG_FEATURE_DEFAULT_PASSWD_ALGO ""
#define ENABLE_FEATURE_DEFAULT_PASSWD_ALGO 1
#define IF_FEATURE_DEFAULT_PASSWD_ALGO(...) __VA_ARGS__
#define IF_NOT_FEATURE_DEFAULT_PASSWD_ALGO(...)
#undef CONFIG_SU
#define ENABLE_SU 0
#define IF_SU(...)
#define IF_NOT_SU(...) __VA_ARGS__
#undef CONFIG_FEATURE_SU_SYSLOG
#define ENABLE_FEATURE_SU_SYSLOG 0
#define IF_FEATURE_SU_SYSLOG(...)
#define IF_NOT_FEATURE_SU_SYSLOG(...) __VA_ARGS__
#undef CONFIG_FEATURE_SU_CHECKS_SHELLS
#define ENABLE_FEATURE_SU_CHECKS_SHELLS 0
#define IF_FEATURE_SU_CHECKS_SHELLS(...)
#define IF_NOT_FEATURE_SU_CHECKS_SHELLS(...) __VA_ARGS__
#undef CONFIG_SULOGIN
#define ENABLE_SULOGIN 0
#define IF_SULOGIN(...)
#define IF_NOT_SULOGIN(...) __VA_ARGS__
#undef CONFIG_VLOCK
#define ENABLE_VLOCK 0
#define IF_VLOCK(...)
#define IF_NOT_VLOCK(...) __VA_ARGS__
/*
* Linux Ext2 FS Progs
*/
#define CONFIG_CHATTR 1
#define ENABLE_CHATTR 1
#define IF_CHATTR(...) __VA_ARGS__
#define IF_NOT_CHATTR(...)
#undef CONFIG_FSCK
#define ENABLE_FSCK 0
#define IF_FSCK(...)
#define IF_NOT_FSCK(...) __VA_ARGS__
#define CONFIG_LSATTR 1
#define ENABLE_LSATTR 1
#define IF_LSATTR(...) __VA_ARGS__
#define IF_NOT_LSATTR(...)
#define CONFIG_TUNE2FS 1
#define ENABLE_TUNE2FS 1
#define IF_TUNE2FS(...) __VA_ARGS__
#define IF_NOT_TUNE2FS(...)
/*
* Linux Module Utilities
*/
#define CONFIG_MODINFO 1
#define ENABLE_MODINFO 1
#define IF_MODINFO(...) __VA_ARGS__
#define IF_NOT_MODINFO(...)
#undef CONFIG_MODPROBE_SMALL
#define ENABLE_MODPROBE_SMALL 0
#define IF_MODPROBE_SMALL(...)
#define IF_NOT_MODPROBE_SMALL(...) __VA_ARGS__
#define CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE 1
#define ENABLE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE 1
#define IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(...) __VA_ARGS__
#define IF_NOT_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(...)
#define CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED 1
#define ENABLE_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED 1
#define IF_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED(...) __VA_ARGS__
#define IF_NOT_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED(...)
#define CONFIG_INSMOD 1
#define ENABLE_INSMOD 1
#define IF_INSMOD(...) __VA_ARGS__
#define IF_NOT_INSMOD(...)
#define CONFIG_RMMOD 1
#define ENABLE_RMMOD 1
#define IF_RMMOD(...) __VA_ARGS__
#define IF_NOT_RMMOD(...)
#define CONFIG_LSMOD 1
#define ENABLE_LSMOD 1
#define IF_LSMOD(...) __VA_ARGS__
#define IF_NOT_LSMOD(...)
#define CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT 1
#define ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT 1
#define IF_FEATURE_LSMOD_PRETTY_2_6_OUTPUT(...) __VA_ARGS__
#define IF_NOT_FEATURE_LSMOD_PRETTY_2_6_OUTPUT(...)
#define CONFIG_MODPROBE 1
#define ENABLE_MODPROBE 1
#define IF_MODPROBE(...) __VA_ARGS__
#define IF_NOT_MODPROBE(...)
#undef CONFIG_FEATURE_MODPROBE_BLACKLIST
#define ENABLE_FEATURE_MODPROBE_BLACKLIST 0
#define IF_FEATURE_MODPROBE_BLACKLIST(...)
#define IF_NOT_FEATURE_MODPROBE_BLACKLIST(...) __VA_ARGS__
#define CONFIG_DEPMOD 1
#define ENABLE_DEPMOD 1
#define IF_DEPMOD(...) __VA_ARGS__
#define IF_NOT_DEPMOD(...)
/*
* Options common to multiple modutils
*/
#undef CONFIG_FEATURE_2_4_MODULES
#define ENABLE_FEATURE_2_4_MODULES 0
#define IF_FEATURE_2_4_MODULES(...)
#define IF_NOT_FEATURE_2_4_MODULES(...) __VA_ARGS__
#define CONFIG_FEATURE_INSMOD_TRY_MMAP 1
#define ENABLE_FEATURE_INSMOD_TRY_MMAP 1
#define IF_FEATURE_INSMOD_TRY_MMAP(...) __VA_ARGS__
#define IF_NOT_FEATURE_INSMOD_TRY_MMAP(...)
#undef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
#define ENABLE_FEATURE_INSMOD_VERSION_CHECKING 0
#define IF_FEATURE_INSMOD_VERSION_CHECKING(...)
#define IF_NOT_FEATURE_INSMOD_VERSION_CHECKING(...) __VA_ARGS__
#undef CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS
#define ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS 0
#define IF_FEATURE_INSMOD_KSYMOOPS_SYMBOLS(...)
#define IF_NOT_FEATURE_INSMOD_KSYMOOPS_SYMBOLS(...) __VA_ARGS__
#undef CONFIG_FEATURE_INSMOD_LOADINKMEM
#define ENABLE_FEATURE_INSMOD_LOADINKMEM 0
#define IF_FEATURE_INSMOD_LOADINKMEM(...)
#define IF_NOT_FEATURE_INSMOD_LOADINKMEM(...) __VA_ARGS__
#undef CONFIG_FEATURE_INSMOD_LOAD_MAP
#define ENABLE_FEATURE_INSMOD_LOAD_MAP 0
#define IF_FEATURE_INSMOD_LOAD_MAP(...)
#define IF_NOT_FEATURE_INSMOD_LOAD_MAP(...) __VA_ARGS__
#undef CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL
#define ENABLE_FEATURE_INSMOD_LOAD_MAP_FULL 0
#define IF_FEATURE_INSMOD_LOAD_MAP_FULL(...)
#define IF_NOT_FEATURE_INSMOD_LOAD_MAP_FULL(...) __VA_ARGS__
#define CONFIG_FEATURE_CHECK_TAINTED_MODULE 1
#define ENABLE_FEATURE_CHECK_TAINTED_MODULE 1
#define IF_FEATURE_CHECK_TAINTED_MODULE(...) __VA_ARGS__
#define IF_NOT_FEATURE_CHECK_TAINTED_MODULE(...)
#define CONFIG_FEATURE_MODUTILS_ALIAS 1
#define ENABLE_FEATURE_MODUTILS_ALIAS 1
#define IF_FEATURE_MODUTILS_ALIAS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MODUTILS_ALIAS(...)
#define CONFIG_FEATURE_MODUTILS_SYMBOLS 1
#define ENABLE_FEATURE_MODUTILS_SYMBOLS 1
#define IF_FEATURE_MODUTILS_SYMBOLS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MODUTILS_SYMBOLS(...)
#define CONFIG_DEFAULT_DEPMOD_FILE "modules.dep"
#define ENABLE_DEFAULT_DEPMOD_FILE 1
#define IF_DEFAULT_DEPMOD_FILE(...) __VA_ARGS__
#define IF_NOT_DEFAULT_DEPMOD_FILE(...)
/*
* Linux System Utilities
*/
#define CONFIG_BLOCKDEV 1
#define ENABLE_BLOCKDEV 1
#define IF_BLOCKDEV(...) __VA_ARGS__
#define IF_NOT_BLOCKDEV(...)
#undef CONFIG_MDEV
#define ENABLE_MDEV 0
#define IF_MDEV(...)
#define IF_NOT_MDEV(...) __VA_ARGS__
#undef CONFIG_FEATURE_MDEV_CONF
#define ENABLE_FEATURE_MDEV_CONF 0
#define IF_FEATURE_MDEV_CONF(...)
#define IF_NOT_FEATURE_MDEV_CONF(...) __VA_ARGS__
#undef CONFIG_FEATURE_MDEV_RENAME
#define ENABLE_FEATURE_MDEV_RENAME 0
#define IF_FEATURE_MDEV_RENAME(...)
#define IF_NOT_FEATURE_MDEV_RENAME(...) __VA_ARGS__
#undef CONFIG_FEATURE_MDEV_RENAME_REGEXP
#define ENABLE_FEATURE_MDEV_RENAME_REGEXP 0
#define IF_FEATURE_MDEV_RENAME_REGEXP(...)
#define IF_NOT_FEATURE_MDEV_RENAME_REGEXP(...) __VA_ARGS__
#undef CONFIG_FEATURE_MDEV_EXEC
#define ENABLE_FEATURE_MDEV_EXEC 0
#define IF_FEATURE_MDEV_EXEC(...)
#define IF_NOT_FEATURE_MDEV_EXEC(...) __VA_ARGS__
#undef CONFIG_FEATURE_MDEV_LOAD_FIRMWARE
#define ENABLE_FEATURE_MDEV_LOAD_FIRMWARE 0
#define IF_FEATURE_MDEV_LOAD_FIRMWARE(...)
#define IF_NOT_FEATURE_MDEV_LOAD_FIRMWARE(...) __VA_ARGS__
#define CONFIG_REV 1
#define ENABLE_REV 1
#define IF_REV(...) __VA_ARGS__
#define IF_NOT_REV(...)
#undef CONFIG_ACPID
#define ENABLE_ACPID 0
#define IF_ACPID(...)
#define IF_NOT_ACPID(...) __VA_ARGS__
#undef CONFIG_FEATURE_ACPID_COMPAT
#define ENABLE_FEATURE_ACPID_COMPAT 0
#define IF_FEATURE_ACPID_COMPAT(...)
#define IF_NOT_FEATURE_ACPID_COMPAT(...) __VA_ARGS__
#define CONFIG_BLKID 1
#define ENABLE_BLKID 1
#define IF_BLKID(...) __VA_ARGS__
#define IF_NOT_BLKID(...)
#define CONFIG_FEATURE_BLKID_TYPE 1
#define ENABLE_FEATURE_BLKID_TYPE 1
#define IF_FEATURE_BLKID_TYPE(...) __VA_ARGS__
#define IF_NOT_FEATURE_BLKID_TYPE(...)
#define CONFIG_DMESG 1
#define ENABLE_DMESG 1
#define IF_DMESG(...) __VA_ARGS__
#define IF_NOT_DMESG(...)
#undef CONFIG_FEATURE_DMESG_PRETTY
#define ENABLE_FEATURE_DMESG_PRETTY 0
#define IF_FEATURE_DMESG_PRETTY(...)
#define IF_NOT_FEATURE_DMESG_PRETTY(...) __VA_ARGS__
#undef CONFIG_FBSET
#define ENABLE_FBSET 0
#define IF_FBSET(...)
#define IF_NOT_FBSET(...) __VA_ARGS__
#undef CONFIG_FEATURE_FBSET_FANCY
#define ENABLE_FEATURE_FBSET_FANCY 0
#define IF_FEATURE_FBSET_FANCY(...)
#define IF_NOT_FEATURE_FBSET_FANCY(...) __VA_ARGS__
#undef CONFIG_FEATURE_FBSET_READMODE
#define ENABLE_FEATURE_FBSET_READMODE 0
#define IF_FEATURE_FBSET_READMODE(...)
#define IF_NOT_FEATURE_FBSET_READMODE(...) __VA_ARGS__
#undef CONFIG_FDFLUSH
#define ENABLE_FDFLUSH 0
#define IF_FDFLUSH(...)
#define IF_NOT_FDFLUSH(...) __VA_ARGS__
#undef CONFIG_FDFORMAT
#define ENABLE_FDFORMAT 0
#define IF_FDFORMAT(...)
#define IF_NOT_FDFORMAT(...) __VA_ARGS__
#define CONFIG_FDISK 1
#define ENABLE_FDISK 1
#define IF_FDISK(...) __VA_ARGS__
#define IF_NOT_FDISK(...)
#define CONFIG_FDISK_SUPPORT_LARGE_DISKS 1
#define ENABLE_FDISK_SUPPORT_LARGE_DISKS 1
#define IF_FDISK_SUPPORT_LARGE_DISKS(...) __VA_ARGS__
#define IF_NOT_FDISK_SUPPORT_LARGE_DISKS(...)
#define CONFIG_FEATURE_FDISK_WRITABLE 1
#define ENABLE_FEATURE_FDISK_WRITABLE 1
#define IF_FEATURE_FDISK_WRITABLE(...) __VA_ARGS__
#define IF_NOT_FEATURE_FDISK_WRITABLE(...)
#undef CONFIG_FEATURE_AIX_LABEL
#define ENABLE_FEATURE_AIX_LABEL 0
#define IF_FEATURE_AIX_LABEL(...)
#define IF_NOT_FEATURE_AIX_LABEL(...) __VA_ARGS__
#undef CONFIG_FEATURE_SGI_LABEL
#define ENABLE_FEATURE_SGI_LABEL 0
#define IF_FEATURE_SGI_LABEL(...)
#define IF_NOT_FEATURE_SGI_LABEL(...) __VA_ARGS__
#undef CONFIG_FEATURE_SUN_LABEL
#define ENABLE_FEATURE_SUN_LABEL 0
#define IF_FEATURE_SUN_LABEL(...)
#define IF_NOT_FEATURE_SUN_LABEL(...) __VA_ARGS__
#undef CONFIG_FEATURE_OSF_LABEL
#define ENABLE_FEATURE_OSF_LABEL 0
#define IF_FEATURE_OSF_LABEL(...)
#define IF_NOT_FEATURE_OSF_LABEL(...) __VA_ARGS__
#undef CONFIG_FEATURE_GPT_LABEL
#define ENABLE_FEATURE_GPT_LABEL 0
#define IF_FEATURE_GPT_LABEL(...)
#define IF_NOT_FEATURE_GPT_LABEL(...) __VA_ARGS__
#undef CONFIG_FEATURE_FDISK_ADVANCED
#define ENABLE_FEATURE_FDISK_ADVANCED 0
#define IF_FEATURE_FDISK_ADVANCED(...)
#define IF_NOT_FEATURE_FDISK_ADVANCED(...) __VA_ARGS__
#undef CONFIG_FINDFS
#define ENABLE_FINDFS 0
#define IF_FINDFS(...)
#define IF_NOT_FINDFS(...) __VA_ARGS__
#define CONFIG_FLOCK 1
#define ENABLE_FLOCK 1
#define IF_FLOCK(...) __VA_ARGS__
#define IF_NOT_FLOCK(...)
#define CONFIG_FREERAMDISK 1
#define ENABLE_FREERAMDISK 1
#define IF_FREERAMDISK(...) __VA_ARGS__
#define IF_NOT_FREERAMDISK(...)
#undef CONFIG_FSCK_MINIX
#define ENABLE_FSCK_MINIX 0
#define IF_FSCK_MINIX(...)
#define IF_NOT_FSCK_MINIX(...) __VA_ARGS__
#define CONFIG_FSTRIM 1
#define ENABLE_FSTRIM 1
#define IF_FSTRIM(...) __VA_ARGS__
#define IF_NOT_FSTRIM(...)
#define CONFIG_MKFS_EXT2 1
#define ENABLE_MKFS_EXT2 1
#define IF_MKFS_EXT2(...) __VA_ARGS__
#define IF_NOT_MKFS_EXT2(...)
#undef CONFIG_MKFS_MINIX
#define ENABLE_MKFS_MINIX 0
#define IF_MKFS_MINIX(...)
#define IF_NOT_MKFS_MINIX(...) __VA_ARGS__
#undef CONFIG_FEATURE_MINIX2
#define ENABLE_FEATURE_MINIX2 0
#define IF_FEATURE_MINIX2(...)
#define IF_NOT_FEATURE_MINIX2(...) __VA_ARGS__
#undef CONFIG_MKFS_REISER
#define ENABLE_MKFS_REISER 0
#define IF_MKFS_REISER(...)
#define IF_NOT_MKFS_REISER(...) __VA_ARGS__
#define CONFIG_MKFS_VFAT 1
#define ENABLE_MKFS_VFAT 1
#define IF_MKFS_VFAT(...) __VA_ARGS__
#define IF_NOT_MKFS_VFAT(...)
#define CONFIG_GETOPT 1
#define ENABLE_GETOPT 1
#define IF_GETOPT(...) __VA_ARGS__
#define IF_NOT_GETOPT(...)
#define CONFIG_FEATURE_GETOPT_LONG 1
#define ENABLE_FEATURE_GETOPT_LONG 1
#define IF_FEATURE_GETOPT_LONG(...) __VA_ARGS__
#define IF_NOT_FEATURE_GETOPT_LONG(...)
#define CONFIG_HEXDUMP 1
#define ENABLE_HEXDUMP 1
#define IF_HEXDUMP(...) __VA_ARGS__
#define IF_NOT_HEXDUMP(...)
#define CONFIG_FEATURE_HEXDUMP_REVERSE 1
#define ENABLE_FEATURE_HEXDUMP_REVERSE 1
#define IF_FEATURE_HEXDUMP_REVERSE(...) __VA_ARGS__
#define IF_NOT_FEATURE_HEXDUMP_REVERSE(...)
#undef CONFIG_HD
#define ENABLE_HD 0
#define IF_HD(...)
#define IF_NOT_HD(...) __VA_ARGS__
#undef CONFIG_HWCLOCK
#define ENABLE_HWCLOCK 0
#define IF_HWCLOCK(...)
#define IF_NOT_HWCLOCK(...) __VA_ARGS__
#undef CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS
#define ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS 0
#define IF_FEATURE_HWCLOCK_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_HWCLOCK_LONG_OPTIONS(...) __VA_ARGS__
#undef CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS
#define ENABLE_FEATURE_HWCLOCK_ADJTIME_FHS 0
#define IF_FEATURE_HWCLOCK_ADJTIME_FHS(...)
#define IF_NOT_FEATURE_HWCLOCK_ADJTIME_FHS(...) __VA_ARGS__
#undef CONFIG_IPCRM
#define ENABLE_IPCRM 0
#define IF_IPCRM(...)
#define IF_NOT_IPCRM(...) __VA_ARGS__
#undef CONFIG_IPCS
#define ENABLE_IPCS 0
#define IF_IPCS(...)
#define IF_NOT_IPCS(...) __VA_ARGS__
#define CONFIG_LOSETUP 1
#define ENABLE_LOSETUP 1
#define IF_LOSETUP(...) __VA_ARGS__
#define IF_NOT_LOSETUP(...)
#undef CONFIG_LSPCI
#define ENABLE_LSPCI 0
#define IF_LSPCI(...)
#define IF_NOT_LSPCI(...) __VA_ARGS__
#define CONFIG_LSUSB 1
#define ENABLE_LSUSB 1
#define IF_LSUSB(...) __VA_ARGS__
#define IF_NOT_LSUSB(...)
#define CONFIG_MKSWAP 1
#define ENABLE_MKSWAP 1
#define IF_MKSWAP(...) __VA_ARGS__
#define IF_NOT_MKSWAP(...)
#undef CONFIG_FEATURE_MKSWAP_UUID
#define ENABLE_FEATURE_MKSWAP_UUID 0
#define IF_FEATURE_MKSWAP_UUID(...)
#define IF_NOT_FEATURE_MKSWAP_UUID(...) __VA_ARGS__
#define CONFIG_MORE 1
#define ENABLE_MORE 1
#define IF_MORE(...) __VA_ARGS__
#define IF_NOT_MORE(...)
#define CONFIG_MOUNT 1
#define ENABLE_MOUNT 1
#define IF_MOUNT(...) __VA_ARGS__
#define IF_NOT_MOUNT(...)
#define CONFIG_FEATURE_MOUNT_FAKE 1
#define ENABLE_FEATURE_MOUNT_FAKE 1
#define IF_FEATURE_MOUNT_FAKE(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_FAKE(...)
#define CONFIG_FEATURE_MOUNT_VERBOSE 1
#define ENABLE_FEATURE_MOUNT_VERBOSE 1
#define IF_FEATURE_MOUNT_VERBOSE(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_VERBOSE(...)
#undef CONFIG_FEATURE_MOUNT_HELPERS
#define ENABLE_FEATURE_MOUNT_HELPERS 0
#define IF_FEATURE_MOUNT_HELPERS(...)
#define IF_NOT_FEATURE_MOUNT_HELPERS(...) __VA_ARGS__
#define CONFIG_FEATURE_MOUNT_LABEL 1
#define ENABLE_FEATURE_MOUNT_LABEL 1
#define IF_FEATURE_MOUNT_LABEL(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_LABEL(...)
#define CONFIG_FEATURE_MOUNT_NFS 1
#define ENABLE_FEATURE_MOUNT_NFS 1
#define IF_FEATURE_MOUNT_NFS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_NFS(...)
#define CONFIG_FEATURE_MOUNT_CIFS 1
#define ENABLE_FEATURE_MOUNT_CIFS 1
#define IF_FEATURE_MOUNT_CIFS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_CIFS(...)
#define CONFIG_FEATURE_MOUNT_FLAGS 1
#define ENABLE_FEATURE_MOUNT_FLAGS 1
#define IF_FEATURE_MOUNT_FLAGS(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_FLAGS(...)
#define CONFIG_FEATURE_MOUNT_FSTAB 1
#define ENABLE_FEATURE_MOUNT_FSTAB 1
#define IF_FEATURE_MOUNT_FSTAB(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_FSTAB(...)
#undef CONFIG_PIVOT_ROOT
#define ENABLE_PIVOT_ROOT 0
#define IF_PIVOT_ROOT(...)
#define IF_NOT_PIVOT_ROOT(...) __VA_ARGS__
#undef CONFIG_RDATE
#define ENABLE_RDATE 0
#define IF_RDATE(...)
#define IF_NOT_RDATE(...) __VA_ARGS__
#define CONFIG_RDEV 1
#define ENABLE_RDEV 1
#define IF_RDEV(...) __VA_ARGS__
#define IF_NOT_RDEV(...)
#undef CONFIG_READPROFILE
#define ENABLE_READPROFILE 0
#define IF_READPROFILE(...)
#define IF_NOT_READPROFILE(...) __VA_ARGS__
#undef CONFIG_RTCWAKE
#define ENABLE_RTCWAKE 0
#define IF_RTCWAKE(...)
#define IF_NOT_RTCWAKE(...) __VA_ARGS__
#undef CONFIG_SCRIPT
#define ENABLE_SCRIPT 0
#define IF_SCRIPT(...)
#define IF_NOT_SCRIPT(...) __VA_ARGS__
#undef CONFIG_SCRIPTREPLAY
#define ENABLE_SCRIPTREPLAY 0
#define IF_SCRIPTREPLAY(...)
#define IF_NOT_SCRIPTREPLAY(...) __VA_ARGS__
#undef CONFIG_SETARCH
#define ENABLE_SETARCH 0
#define IF_SETARCH(...)
#define IF_NOT_SETARCH(...) __VA_ARGS__
#define CONFIG_SWAPONOFF 1
#define ENABLE_SWAPONOFF 1
#define IF_SWAPONOFF(...) __VA_ARGS__
#define IF_NOT_SWAPONOFF(...)
#undef CONFIG_FEATURE_SWAPON_PRI
#define ENABLE_FEATURE_SWAPON_PRI 0
#define IF_FEATURE_SWAPON_PRI(...)
#define IF_NOT_FEATURE_SWAPON_PRI(...) __VA_ARGS__
#undef CONFIG_SWITCH_ROOT
#define ENABLE_SWITCH_ROOT 0
#define IF_SWITCH_ROOT(...)
#define IF_NOT_SWITCH_ROOT(...) __VA_ARGS__
#define CONFIG_UMOUNT 1
#define ENABLE_UMOUNT 1
#define IF_UMOUNT(...) __VA_ARGS__
#define IF_NOT_UMOUNT(...)
#define CONFIG_FEATURE_UMOUNT_ALL 1
#define ENABLE_FEATURE_UMOUNT_ALL 1
#define IF_FEATURE_UMOUNT_ALL(...) __VA_ARGS__
#define IF_NOT_FEATURE_UMOUNT_ALL(...)
/*
* Common options for mount/umount
*/
#define CONFIG_FEATURE_MOUNT_LOOP 1
#define ENABLE_FEATURE_MOUNT_LOOP 1
#define IF_FEATURE_MOUNT_LOOP(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_LOOP(...)
#define CONFIG_FEATURE_MOUNT_LOOP_CREATE 1
#define ENABLE_FEATURE_MOUNT_LOOP_CREATE 1
#define IF_FEATURE_MOUNT_LOOP_CREATE(...) __VA_ARGS__
#define IF_NOT_FEATURE_MOUNT_LOOP_CREATE(...)
#undef CONFIG_FEATURE_MTAB_SUPPORT
#define ENABLE_FEATURE_MTAB_SUPPORT 0
#define IF_FEATURE_MTAB_SUPPORT(...)
#define IF_NOT_FEATURE_MTAB_SUPPORT(...) __VA_ARGS__
#define CONFIG_VOLUMEID 1
#define ENABLE_VOLUMEID 1
#define IF_VOLUMEID(...) __VA_ARGS__
#define IF_NOT_VOLUMEID(...)
/*
* Filesystem/Volume identification
*/
#define CONFIG_FEATURE_VOLUMEID_EXT 1
#define ENABLE_FEATURE_VOLUMEID_EXT 1
#define IF_FEATURE_VOLUMEID_EXT(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_EXT(...)
#undef CONFIG_FEATURE_VOLUMEID_BTRFS
#define ENABLE_FEATURE_VOLUMEID_BTRFS 0
#define IF_FEATURE_VOLUMEID_BTRFS(...)
#define IF_NOT_FEATURE_VOLUMEID_BTRFS(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_REISERFS
#define ENABLE_FEATURE_VOLUMEID_REISERFS 0
#define IF_FEATURE_VOLUMEID_REISERFS(...)
#define IF_NOT_FEATURE_VOLUMEID_REISERFS(...) __VA_ARGS__
#define CONFIG_FEATURE_VOLUMEID_FAT 1
#define ENABLE_FEATURE_VOLUMEID_FAT 1
#define IF_FEATURE_VOLUMEID_FAT(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_FAT(...)
#define CONFIG_FEATURE_VOLUMEID_EXFAT 1
#define ENABLE_FEATURE_VOLUMEID_EXFAT 1
#define IF_FEATURE_VOLUMEID_EXFAT(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_EXFAT(...)
#undef CONFIG_FEATURE_VOLUMEID_HFS
#define ENABLE_FEATURE_VOLUMEID_HFS 0
#define IF_FEATURE_VOLUMEID_HFS(...)
#define IF_NOT_FEATURE_VOLUMEID_HFS(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_JFS
#define ENABLE_FEATURE_VOLUMEID_JFS 0
#define IF_FEATURE_VOLUMEID_JFS(...)
#define IF_NOT_FEATURE_VOLUMEID_JFS(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_XFS
#define ENABLE_FEATURE_VOLUMEID_XFS 0
#define IF_FEATURE_VOLUMEID_XFS(...)
#define IF_NOT_FEATURE_VOLUMEID_XFS(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_NILFS
#define ENABLE_FEATURE_VOLUMEID_NILFS 0
#define IF_FEATURE_VOLUMEID_NILFS(...)
#define IF_NOT_FEATURE_VOLUMEID_NILFS(...) __VA_ARGS__
#define CONFIG_FEATURE_VOLUMEID_NTFS 1
#define ENABLE_FEATURE_VOLUMEID_NTFS 1
#define IF_FEATURE_VOLUMEID_NTFS(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_NTFS(...)
#define CONFIG_FEATURE_VOLUMEID_ISO9660 1
#define ENABLE_FEATURE_VOLUMEID_ISO9660 1
#define IF_FEATURE_VOLUMEID_ISO9660(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_ISO9660(...)
#undef CONFIG_FEATURE_VOLUMEID_UDF
#define ENABLE_FEATURE_VOLUMEID_UDF 0
#define IF_FEATURE_VOLUMEID_UDF(...)
#define IF_NOT_FEATURE_VOLUMEID_UDF(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_LUKS
#define ENABLE_FEATURE_VOLUMEID_LUKS 0
#define IF_FEATURE_VOLUMEID_LUKS(...)
#define IF_NOT_FEATURE_VOLUMEID_LUKS(...) __VA_ARGS__
#define CONFIG_FEATURE_VOLUMEID_LINUXSWAP 1
#define ENABLE_FEATURE_VOLUMEID_LINUXSWAP 1
#define IF_FEATURE_VOLUMEID_LINUXSWAP(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_LINUXSWAP(...)
#undef CONFIG_FEATURE_VOLUMEID_CRAMFS
#define ENABLE_FEATURE_VOLUMEID_CRAMFS 0
#define IF_FEATURE_VOLUMEID_CRAMFS(...)
#define IF_NOT_FEATURE_VOLUMEID_CRAMFS(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_ROMFS
#define ENABLE_FEATURE_VOLUMEID_ROMFS 0
#define IF_FEATURE_VOLUMEID_ROMFS(...)
#define IF_NOT_FEATURE_VOLUMEID_ROMFS(...) __VA_ARGS__
#define CONFIG_FEATURE_VOLUMEID_SQUASHFS 1
#define ENABLE_FEATURE_VOLUMEID_SQUASHFS 1
#define IF_FEATURE_VOLUMEID_SQUASHFS(...) __VA_ARGS__
#define IF_NOT_FEATURE_VOLUMEID_SQUASHFS(...)
#undef CONFIG_FEATURE_VOLUMEID_SYSV
#define ENABLE_FEATURE_VOLUMEID_SYSV 0
#define IF_FEATURE_VOLUMEID_SYSV(...)
#define IF_NOT_FEATURE_VOLUMEID_SYSV(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_OCFS2
#define ENABLE_FEATURE_VOLUMEID_OCFS2 0
#define IF_FEATURE_VOLUMEID_OCFS2(...)
#define IF_NOT_FEATURE_VOLUMEID_OCFS2(...) __VA_ARGS__
#undef CONFIG_FEATURE_VOLUMEID_LINUXRAID
#define ENABLE_FEATURE_VOLUMEID_LINUXRAID 0
#define IF_FEATURE_VOLUMEID_LINUXRAID(...)
#define IF_NOT_FEATURE_VOLUMEID_LINUXRAID(...) __VA_ARGS__
/*
* Miscellaneous Utilities
*/
#undef CONFIG_CONSPY
#define ENABLE_CONSPY 0
#define IF_CONSPY(...)
#define IF_NOT_CONSPY(...) __VA_ARGS__
#define CONFIG_LESS 1
#define ENABLE_LESS 1
#define IF_LESS(...) __VA_ARGS__
#define IF_NOT_LESS(...)
#define CONFIG_FEATURE_LESS_MAXLINES 65536
#define ENABLE_FEATURE_LESS_MAXLINES 1
#define IF_FEATURE_LESS_MAXLINES(...) __VA_ARGS__
#define IF_NOT_FEATURE_LESS_MAXLINES(...)
#undef CONFIG_FEATURE_LESS_BRACKETS
#define ENABLE_FEATURE_LESS_BRACKETS 0
#define IF_FEATURE_LESS_BRACKETS(...)
#define IF_NOT_FEATURE_LESS_BRACKETS(...) __VA_ARGS__
#undef CONFIG_FEATURE_LESS_FLAGS
#define ENABLE_FEATURE_LESS_FLAGS 0
#define IF_FEATURE_LESS_FLAGS(...)
#define IF_NOT_FEATURE_LESS_FLAGS(...) __VA_ARGS__
#define CONFIG_FEATURE_LESS_MARKS 1
#define ENABLE_FEATURE_LESS_MARKS 1
#define IF_FEATURE_LESS_MARKS(...) __VA_ARGS__
#define IF_NOT_FEATURE_LESS_MARKS(...)
#define CONFIG_FEATURE_LESS_REGEXP 1
#define ENABLE_FEATURE_LESS_REGEXP 1
#define IF_FEATURE_LESS_REGEXP(...) __VA_ARGS__
#define IF_NOT_FEATURE_LESS_REGEXP(...)
#define CONFIG_FEATURE_LESS_WINCH 1
#define ENABLE_FEATURE_LESS_WINCH 1
#define IF_FEATURE_LESS_WINCH(...) __VA_ARGS__
#define IF_NOT_FEATURE_LESS_WINCH(...)
#define CONFIG_FEATURE_LESS_ASK_TERMINAL 1
#define ENABLE_FEATURE_LESS_ASK_TERMINAL 1
#define IF_FEATURE_LESS_ASK_TERMINAL(...) __VA_ARGS__
#define IF_NOT_FEATURE_LESS_ASK_TERMINAL(...)
#undef CONFIG_FEATURE_LESS_DASHCMD
#define ENABLE_FEATURE_LESS_DASHCMD 0
#define IF_FEATURE_LESS_DASHCMD(...)
#define IF_NOT_FEATURE_LESS_DASHCMD(...) __VA_ARGS__
#undef CONFIG_FEATURE_LESS_LINENUMS
#define ENABLE_FEATURE_LESS_LINENUMS 0
#define IF_FEATURE_LESS_LINENUMS(...)
#define IF_NOT_FEATURE_LESS_LINENUMS(...) __VA_ARGS__
#define CONFIG_NANDWRITE 1
#define ENABLE_NANDWRITE 1
#define IF_NANDWRITE(...) __VA_ARGS__
#define IF_NOT_NANDWRITE(...)
#define CONFIG_NANDDUMP 1
#define ENABLE_NANDDUMP 1
#define IF_NANDDUMP(...) __VA_ARGS__
#define IF_NOT_NANDDUMP(...)
#define CONFIG_SETSERIAL 1
#define ENABLE_SETSERIAL 1
#define IF_SETSERIAL(...) __VA_ARGS__
#define IF_NOT_SETSERIAL(...)
#undef CONFIG_UBIATTACH
#define ENABLE_UBIATTACH 0
#define IF_UBIATTACH(...)
#define IF_NOT_UBIATTACH(...) __VA_ARGS__
#undef CONFIG_UBIDETACH
#define ENABLE_UBIDETACH 0
#define IF_UBIDETACH(...)
#define IF_NOT_UBIDETACH(...) __VA_ARGS__
#undef CONFIG_UBIMKVOL
#define ENABLE_UBIMKVOL 0
#define IF_UBIMKVOL(...)
#define IF_NOT_UBIMKVOL(...) __VA_ARGS__
#undef CONFIG_UBIRMVOL
#define ENABLE_UBIRMVOL 0
#define IF_UBIRMVOL(...)
#define IF_NOT_UBIRMVOL(...) __VA_ARGS__
#undef CONFIG_UBIRSVOL
#define ENABLE_UBIRSVOL 0
#define IF_UBIRSVOL(...)
#define IF_NOT_UBIRSVOL(...) __VA_ARGS__
#undef CONFIG_UBIUPDATEVOL
#define ENABLE_UBIUPDATEVOL 0
#define IF_UBIUPDATEVOL(...)
#define IF_NOT_UBIUPDATEVOL(...) __VA_ARGS__
#define CONFIG_ADJTIMEX 1
#define ENABLE_ADJTIMEX 1
#define IF_ADJTIMEX(...) __VA_ARGS__
#define IF_NOT_ADJTIMEX(...)
#define CONFIG_BBCONFIG 1
#define ENABLE_BBCONFIG 1
#define IF_BBCONFIG(...) __VA_ARGS__
#define IF_NOT_BBCONFIG(...)
#define CONFIG_FEATURE_COMPRESS_BBCONFIG 1
#define ENABLE_FEATURE_COMPRESS_BBCONFIG 1
#define IF_FEATURE_COMPRESS_BBCONFIG(...) __VA_ARGS__
#define IF_NOT_FEATURE_COMPRESS_BBCONFIG(...)
#undef CONFIG_BEEP
#define ENABLE_BEEP 0
#define IF_BEEP(...)
#define IF_NOT_BEEP(...) __VA_ARGS__
#define CONFIG_FEATURE_BEEP_FREQ 0
#define ENABLE_FEATURE_BEEP_FREQ 1
#define IF_FEATURE_BEEP_FREQ(...) __VA_ARGS__
#define IF_NOT_FEATURE_BEEP_FREQ(...)
#define CONFIG_FEATURE_BEEP_LENGTH_MS 0
#define ENABLE_FEATURE_BEEP_LENGTH_MS 1
#define IF_FEATURE_BEEP_LENGTH_MS(...) __VA_ARGS__
#define IF_NOT_FEATURE_BEEP_LENGTH_MS(...)
#undef CONFIG_CHAT
#define ENABLE_CHAT 0
#define IF_CHAT(...)
#define IF_NOT_CHAT(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_NOFAIL
#define ENABLE_FEATURE_CHAT_NOFAIL 0
#define IF_FEATURE_CHAT_NOFAIL(...)
#define IF_NOT_FEATURE_CHAT_NOFAIL(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_TTY_HIFI
#define ENABLE_FEATURE_CHAT_TTY_HIFI 0
#define IF_FEATURE_CHAT_TTY_HIFI(...)
#define IF_NOT_FEATURE_CHAT_TTY_HIFI(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_IMPLICIT_CR
#define ENABLE_FEATURE_CHAT_IMPLICIT_CR 0
#define IF_FEATURE_CHAT_IMPLICIT_CR(...)
#define IF_NOT_FEATURE_CHAT_IMPLICIT_CR(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_SWALLOW_OPTS
#define ENABLE_FEATURE_CHAT_SWALLOW_OPTS 0
#define IF_FEATURE_CHAT_SWALLOW_OPTS(...)
#define IF_NOT_FEATURE_CHAT_SWALLOW_OPTS(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_SEND_ESCAPES
#define ENABLE_FEATURE_CHAT_SEND_ESCAPES 0
#define IF_FEATURE_CHAT_SEND_ESCAPES(...)
#define IF_NOT_FEATURE_CHAT_SEND_ESCAPES(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_VAR_ABORT_LEN
#define ENABLE_FEATURE_CHAT_VAR_ABORT_LEN 0
#define IF_FEATURE_CHAT_VAR_ABORT_LEN(...)
#define IF_NOT_FEATURE_CHAT_VAR_ABORT_LEN(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHAT_CLR_ABORT
#define ENABLE_FEATURE_CHAT_CLR_ABORT 0
#define IF_FEATURE_CHAT_CLR_ABORT(...)
#define IF_NOT_FEATURE_CHAT_CLR_ABORT(...) __VA_ARGS__
#undef CONFIG_CHRT
#define ENABLE_CHRT 0
#define IF_CHRT(...)
#define IF_NOT_CHRT(...) __VA_ARGS__
#define CONFIG_CROND 1
#define ENABLE_CROND 1
#define IF_CROND(...) __VA_ARGS__
#define IF_NOT_CROND(...)
#undef CONFIG_FEATURE_CROND_D
#define ENABLE_FEATURE_CROND_D 0
#define IF_FEATURE_CROND_D(...)
#define IF_NOT_FEATURE_CROND_D(...) __VA_ARGS__
#undef CONFIG_FEATURE_CROND_CALL_SENDMAIL
#define ENABLE_FEATURE_CROND_CALL_SENDMAIL 0
#define IF_FEATURE_CROND_CALL_SENDMAIL(...)
#define IF_NOT_FEATURE_CROND_CALL_SENDMAIL(...) __VA_ARGS__
#define CONFIG_FEATURE_CROND_DIR "/system/etc/cron.d"
#define ENABLE_FEATURE_CROND_DIR 1
#define IF_FEATURE_CROND_DIR(...) __VA_ARGS__
#define IF_NOT_FEATURE_CROND_DIR(...)
#define CONFIG_CRONTAB 1
#define ENABLE_CRONTAB 1
#define IF_CRONTAB(...) __VA_ARGS__
#define IF_NOT_CRONTAB(...)
#define CONFIG_DC 1
#define ENABLE_DC 1
#define IF_DC(...) __VA_ARGS__
#define IF_NOT_DC(...)
#define CONFIG_FEATURE_DC_LIBM 1
#define ENABLE_FEATURE_DC_LIBM 1
#define IF_FEATURE_DC_LIBM(...) __VA_ARGS__
#define IF_NOT_FEATURE_DC_LIBM(...)
#undef CONFIG_DEVFSD
#define ENABLE_DEVFSD 0
#define IF_DEVFSD(...)
#define IF_NOT_DEVFSD(...) __VA_ARGS__
#undef CONFIG_DEVFSD_MODLOAD
#define ENABLE_DEVFSD_MODLOAD 0
#define IF_DEVFSD_MODLOAD(...)
#define IF_NOT_DEVFSD_MODLOAD(...) __VA_ARGS__
#undef CONFIG_DEVFSD_FG_NP
#define ENABLE_DEVFSD_FG_NP 0
#define IF_DEVFSD_FG_NP(...)
#define IF_NOT_DEVFSD_FG_NP(...) __VA_ARGS__
#undef CONFIG_DEVFSD_VERBOSE
#define ENABLE_DEVFSD_VERBOSE 0
#define IF_DEVFSD_VERBOSE(...)
#define IF_NOT_DEVFSD_VERBOSE(...) __VA_ARGS__
#undef CONFIG_FEATURE_DEVFS
#define ENABLE_FEATURE_DEVFS 0
#define IF_FEATURE_DEVFS(...)
#define IF_NOT_FEATURE_DEVFS(...) __VA_ARGS__
#define CONFIG_DEVMEM 1
#define ENABLE_DEVMEM 1
#define IF_DEVMEM(...) __VA_ARGS__
#define IF_NOT_DEVMEM(...)
#undef CONFIG_EJECT
#define ENABLE_EJECT 0
#define IF_EJECT(...)
#define IF_NOT_EJECT(...) __VA_ARGS__
#undef CONFIG_FEATURE_EJECT_SCSI
#define ENABLE_FEATURE_EJECT_SCSI 0
#define IF_FEATURE_EJECT_SCSI(...)
#define IF_NOT_FEATURE_EJECT_SCSI(...) __VA_ARGS__
#define CONFIG_FBSPLASH 1
#define ENABLE_FBSPLASH 1
#define IF_FBSPLASH(...) __VA_ARGS__
#define IF_NOT_FBSPLASH(...)
#define CONFIG_FLASHCP 1
#define ENABLE_FLASHCP 1
#define IF_FLASHCP(...) __VA_ARGS__
#define IF_NOT_FLASHCP(...)
#define CONFIG_FLASH_LOCK 1
#define ENABLE_FLASH_LOCK 1
#define IF_FLASH_LOCK(...) __VA_ARGS__
#define IF_NOT_FLASH_LOCK(...)
#define CONFIG_FLASH_UNLOCK 1
#define ENABLE_FLASH_UNLOCK 1
#define IF_FLASH_UNLOCK(...) __VA_ARGS__
#define IF_NOT_FLASH_UNLOCK(...)
#undef CONFIG_FLASH_ERASEALL
#define ENABLE_FLASH_ERASEALL 0
#define IF_FLASH_ERASEALL(...)
#define IF_NOT_FLASH_ERASEALL(...) __VA_ARGS__
#define CONFIG_IONICE 1
#define ENABLE_IONICE 1
#define IF_IONICE(...) __VA_ARGS__
#define IF_NOT_IONICE(...)
#undef CONFIG_INOTIFYD
#define ENABLE_INOTIFYD 0
#define IF_INOTIFYD(...)
#define IF_NOT_INOTIFYD(...) __VA_ARGS__
#undef CONFIG_LAST
#define ENABLE_LAST 0
#define IF_LAST(...)
#define IF_NOT_LAST(...) __VA_ARGS__
#undef CONFIG_FEATURE_LAST_SMALL
#define ENABLE_FEATURE_LAST_SMALL 0
#define IF_FEATURE_LAST_SMALL(...)
#define IF_NOT_FEATURE_LAST_SMALL(...) __VA_ARGS__
#undef CONFIG_FEATURE_LAST_FANCY
#define ENABLE_FEATURE_LAST_FANCY 0
#define IF_FEATURE_LAST_FANCY(...)
#define IF_NOT_FEATURE_LAST_FANCY(...) __VA_ARGS__
#undef CONFIG_HDPARM
#define ENABLE_HDPARM 0
#define IF_HDPARM(...)
#define IF_NOT_HDPARM(...) __VA_ARGS__
#undef CONFIG_FEATURE_HDPARM_GET_IDENTITY
#define ENABLE_FEATURE_HDPARM_GET_IDENTITY 0
#define IF_FEATURE_HDPARM_GET_IDENTITY(...)
#define IF_NOT_FEATURE_HDPARM_GET_IDENTITY(...) __VA_ARGS__
#undef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
#define ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF 0
#define IF_FEATURE_HDPARM_HDIO_SCAN_HWIF(...)
#define IF_NOT_FEATURE_HDPARM_HDIO_SCAN_HWIF(...) __VA_ARGS__
#undef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
#define ENABLE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF 0
#define IF_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(...)
#define IF_NOT_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF(...) __VA_ARGS__
#undef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
#define ENABLE_FEATURE_HDPARM_HDIO_DRIVE_RESET 0
#define IF_FEATURE_HDPARM_HDIO_DRIVE_RESET(...)
#define IF_NOT_FEATURE_HDPARM_HDIO_DRIVE_RESET(...) __VA_ARGS__
#undef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
#define ENABLE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF 0
#define IF_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(...)
#define IF_NOT_FEATURE_HDPARM_HDIO_TRISTATE_HWIF(...) __VA_ARGS__
#undef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
#define ENABLE_FEATURE_HDPARM_HDIO_GETSET_DMA 0
#define IF_FEATURE_HDPARM_HDIO_GETSET_DMA(...)
#define IF_NOT_FEATURE_HDPARM_HDIO_GETSET_DMA(...) __VA_ARGS__
#undef CONFIG_MAKEDEVS
#define ENABLE_MAKEDEVS 0
#define IF_MAKEDEVS(...)
#define IF_NOT_MAKEDEVS(...) __VA_ARGS__
#undef CONFIG_FEATURE_MAKEDEVS_LEAF
#define ENABLE_FEATURE_MAKEDEVS_LEAF 0
#define IF_FEATURE_MAKEDEVS_LEAF(...)
#define IF_NOT_FEATURE_MAKEDEVS_LEAF(...) __VA_ARGS__
#undef CONFIG_FEATURE_MAKEDEVS_TABLE
#define ENABLE_FEATURE_MAKEDEVS_TABLE 0
#define IF_FEATURE_MAKEDEVS_TABLE(...)
#define IF_NOT_FEATURE_MAKEDEVS_TABLE(...) __VA_ARGS__
#define CONFIG_MAN 1
#define ENABLE_MAN 1
#define IF_MAN(...) __VA_ARGS__
#define IF_NOT_MAN(...)
#undef CONFIG_MICROCOM
#define ENABLE_MICROCOM 0
#define IF_MICROCOM(...)
#define IF_NOT_MICROCOM(...) __VA_ARGS__
#define CONFIG_MOUNTPOINT 1
#define ENABLE_MOUNTPOINT 1
#define IF_MOUNTPOINT(...) __VA_ARGS__
#define IF_NOT_MOUNTPOINT(...)
#undef CONFIG_MT
#define ENABLE_MT 0
#define IF_MT(...)
#define IF_NOT_MT(...) __VA_ARGS__
#undef CONFIG_RAIDAUTORUN
#define ENABLE_RAIDAUTORUN 0
#define IF_RAIDAUTORUN(...)
#define IF_NOT_RAIDAUTORUN(...) __VA_ARGS__
#undef CONFIG_READAHEAD
#define ENABLE_READAHEAD 0
#define IF_READAHEAD(...)
#define IF_NOT_READAHEAD(...) __VA_ARGS__
#undef CONFIG_RFKILL
#define ENABLE_RFKILL 0
#define IF_RFKILL(...)
#define IF_NOT_RFKILL(...) __VA_ARGS__
#undef CONFIG_RUNLEVEL
#define ENABLE_RUNLEVEL 0
#define IF_RUNLEVEL(...)
#define IF_NOT_RUNLEVEL(...) __VA_ARGS__
#define CONFIG_RX 1
#define ENABLE_RX 1
#define IF_RX(...) __VA_ARGS__
#define IF_NOT_RX(...)
#define CONFIG_SETSID 1
#define ENABLE_SETSID 1
#define IF_SETSID(...) __VA_ARGS__
#define IF_NOT_SETSID(...)
#define CONFIG_STRINGS 1
#define ENABLE_STRINGS 1
#define IF_STRINGS(...) __VA_ARGS__
#define IF_NOT_STRINGS(...)
#define CONFIG_TASKSET 1
#define ENABLE_TASKSET 1
#define IF_TASKSET(...) __VA_ARGS__
#define IF_NOT_TASKSET(...)
#define CONFIG_FEATURE_TASKSET_FANCY 1
#define ENABLE_FEATURE_TASKSET_FANCY 1
#define IF_FEATURE_TASKSET_FANCY(...) __VA_ARGS__
#define IF_NOT_FEATURE_TASKSET_FANCY(...)
#define CONFIG_TIME 1
#define ENABLE_TIME 1
#define IF_TIME(...) __VA_ARGS__
#define IF_NOT_TIME(...)
#define CONFIG_TIMEOUT 1
#define ENABLE_TIMEOUT 1
#define IF_TIMEOUT(...) __VA_ARGS__
#define IF_NOT_TIMEOUT(...)
#define CONFIG_TTYSIZE 1
#define ENABLE_TTYSIZE 1
#define IF_TTYSIZE(...) __VA_ARGS__
#define IF_NOT_TTYSIZE(...)
#undef CONFIG_VOLNAME
#define ENABLE_VOLNAME 0
#define IF_VOLNAME(...)
#define IF_NOT_VOLNAME(...) __VA_ARGS__
#undef CONFIG_WALL
#define ENABLE_WALL 0
#define IF_WALL(...)
#define IF_NOT_WALL(...) __VA_ARGS__
#undef CONFIG_WATCHDOG
#define ENABLE_WATCHDOG 0
#define IF_WATCHDOG(...)
#define IF_NOT_WATCHDOG(...) __VA_ARGS__
/*
* Networking Utilities
*/
#undef CONFIG_NAMEIF
#define ENABLE_NAMEIF 0
#define IF_NAMEIF(...)
#define IF_NOT_NAMEIF(...) __VA_ARGS__
#undef CONFIG_FEATURE_NAMEIF_EXTENDED
#define ENABLE_FEATURE_NAMEIF_EXTENDED 0
#define IF_FEATURE_NAMEIF_EXTENDED(...)
#define IF_NOT_FEATURE_NAMEIF_EXTENDED(...) __VA_ARGS__
#define CONFIG_NBDCLIENT 1
#define ENABLE_NBDCLIENT 1
#define IF_NBDCLIENT(...) __VA_ARGS__
#define IF_NOT_NBDCLIENT(...)
#define CONFIG_NC 1
#define ENABLE_NC 1
#define IF_NC(...) __VA_ARGS__
#define IF_NOT_NC(...)
#define CONFIG_NC_SERVER 1
#define ENABLE_NC_SERVER 1
#define IF_NC_SERVER(...) __VA_ARGS__
#define IF_NOT_NC_SERVER(...)
#define CONFIG_NC_EXTRA 1
#define ENABLE_NC_EXTRA 1
#define IF_NC_EXTRA(...) __VA_ARGS__
#define IF_NOT_NC_EXTRA(...)
#undef CONFIG_NC_110_COMPAT
#define ENABLE_NC_110_COMPAT 0
#define IF_NC_110_COMPAT(...)
#define IF_NOT_NC_110_COMPAT(...) __VA_ARGS__
#define CONFIG_PING 1
#define ENABLE_PING 1
#define IF_PING(...) __VA_ARGS__
#define IF_NOT_PING(...)
#undef CONFIG_PING6
#define ENABLE_PING6 0
#define IF_PING6(...)
#define IF_NOT_PING6(...) __VA_ARGS__
#define CONFIG_FEATURE_FANCY_PING 1
#define ENABLE_FEATURE_FANCY_PING 1
#define IF_FEATURE_FANCY_PING(...) __VA_ARGS__
#define IF_NOT_FEATURE_FANCY_PING(...)
#undef CONFIG_WHOIS
#define ENABLE_WHOIS 0
#define IF_WHOIS(...)
#define IF_NOT_WHOIS(...) __VA_ARGS__
#define CONFIG_FEATURE_IPV6 1
#define ENABLE_FEATURE_IPV6 1
#define IF_FEATURE_IPV6(...) __VA_ARGS__
#define IF_NOT_FEATURE_IPV6(...)
#undef CONFIG_FEATURE_UNIX_LOCAL
#define ENABLE_FEATURE_UNIX_LOCAL 0
#define IF_FEATURE_UNIX_LOCAL(...)
#define IF_NOT_FEATURE_UNIX_LOCAL(...) __VA_ARGS__
#define CONFIG_FEATURE_PREFER_IPV4_ADDRESS 1
#define ENABLE_FEATURE_PREFER_IPV4_ADDRESS 1
#define IF_FEATURE_PREFER_IPV4_ADDRESS(...) __VA_ARGS__
#define IF_NOT_FEATURE_PREFER_IPV4_ADDRESS(...)
#undef CONFIG_VERBOSE_RESOLUTION_ERRORS
#define ENABLE_VERBOSE_RESOLUTION_ERRORS 0
#define IF_VERBOSE_RESOLUTION_ERRORS(...)
#define IF_NOT_VERBOSE_RESOLUTION_ERRORS(...) __VA_ARGS__
#define CONFIG_ARP 1
#define ENABLE_ARP 1
#define IF_ARP(...) __VA_ARGS__
#define IF_NOT_ARP(...)
#undef CONFIG_ARPING
#define ENABLE_ARPING 0
#define IF_ARPING(...)
#define IF_NOT_ARPING(...) __VA_ARGS__
#define CONFIG_BRCTL 1
#define ENABLE_BRCTL 1
#define IF_BRCTL(...) __VA_ARGS__
#define IF_NOT_BRCTL(...)
#define CONFIG_FEATURE_BRCTL_FANCY 1
#define ENABLE_FEATURE_BRCTL_FANCY 1
#define IF_FEATURE_BRCTL_FANCY(...) __VA_ARGS__
#define IF_NOT_FEATURE_BRCTL_FANCY(...)
#define CONFIG_FEATURE_BRCTL_SHOW 1
#define ENABLE_FEATURE_BRCTL_SHOW 1
#define IF_FEATURE_BRCTL_SHOW(...) __VA_ARGS__
#define IF_NOT_FEATURE_BRCTL_SHOW(...)
#define CONFIG_DNSD 1
#define ENABLE_DNSD 1
#define IF_DNSD(...) __VA_ARGS__
#define IF_NOT_DNSD(...)
#undef CONFIG_ETHER_WAKE
#define ENABLE_ETHER_WAKE 0
#define IF_ETHER_WAKE(...)
#define IF_NOT_ETHER_WAKE(...) __VA_ARGS__
#undef CONFIG_FAKEIDENTD
#define ENABLE_FAKEIDENTD 0
#define IF_FAKEIDENTD(...)
#define IF_NOT_FAKEIDENTD(...) __VA_ARGS__
#undef CONFIG_FTPD
#define ENABLE_FTPD 0
#define IF_FTPD(...)
#define IF_NOT_FTPD(...) __VA_ARGS__
#undef CONFIG_FEATURE_FTP_WRITE
#define ENABLE_FEATURE_FTP_WRITE 0
#define IF_FEATURE_FTP_WRITE(...)
#define IF_NOT_FEATURE_FTP_WRITE(...) __VA_ARGS__
#undef CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST
#define ENABLE_FEATURE_FTPD_ACCEPT_BROKEN_LIST 0
#define IF_FEATURE_FTPD_ACCEPT_BROKEN_LIST(...)
#define IF_NOT_FEATURE_FTPD_ACCEPT_BROKEN_LIST(...) __VA_ARGS__
#define CONFIG_FTPGET 1
#define ENABLE_FTPGET 1
#define IF_FTPGET(...) __VA_ARGS__
#define IF_NOT_FTPGET(...)
#define CONFIG_FTPPUT 1
#define ENABLE_FTPPUT 1
#define IF_FTPPUT(...) __VA_ARGS__
#define IF_NOT_FTPPUT(...)
#define CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS 1
#define ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS 1
#define IF_FEATURE_FTPGETPUT_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS(...)
#undef CONFIG_HOSTNAME
#define ENABLE_HOSTNAME 0
#define IF_HOSTNAME(...)
#define IF_NOT_HOSTNAME(...) __VA_ARGS__
#undef CONFIG_HTTPD
#define ENABLE_HTTPD 0
#define IF_HTTPD(...)
#define IF_NOT_HTTPD(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_RANGES
#define ENABLE_FEATURE_HTTPD_RANGES 0
#define IF_FEATURE_HTTPD_RANGES(...)
#define IF_NOT_FEATURE_HTTPD_RANGES(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_USE_SENDFILE
#define ENABLE_FEATURE_HTTPD_USE_SENDFILE 0
#define IF_FEATURE_HTTPD_USE_SENDFILE(...)
#define IF_NOT_FEATURE_HTTPD_USE_SENDFILE(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_SETUID
#define ENABLE_FEATURE_HTTPD_SETUID 0
#define IF_FEATURE_HTTPD_SETUID(...)
#define IF_NOT_FEATURE_HTTPD_SETUID(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_BASIC_AUTH
#define ENABLE_FEATURE_HTTPD_BASIC_AUTH 0
#define IF_FEATURE_HTTPD_BASIC_AUTH(...)
#define IF_NOT_FEATURE_HTTPD_BASIC_AUTH(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_AUTH_MD5
#define ENABLE_FEATURE_HTTPD_AUTH_MD5 0
#define IF_FEATURE_HTTPD_AUTH_MD5(...)
#define IF_NOT_FEATURE_HTTPD_AUTH_MD5(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_CGI
#define ENABLE_FEATURE_HTTPD_CGI 0
#define IF_FEATURE_HTTPD_CGI(...)
#define IF_NOT_FEATURE_HTTPD_CGI(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
#define ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR 0
#define IF_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR(...)
#define IF_NOT_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
#define ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV 0
#define IF_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV(...)
#define IF_NOT_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR
#define ENABLE_FEATURE_HTTPD_ENCODE_URL_STR 0
#define IF_FEATURE_HTTPD_ENCODE_URL_STR(...)
#define IF_NOT_FEATURE_HTTPD_ENCODE_URL_STR(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_ERROR_PAGES
#define ENABLE_FEATURE_HTTPD_ERROR_PAGES 0
#define IF_FEATURE_HTTPD_ERROR_PAGES(...)
#define IF_NOT_FEATURE_HTTPD_ERROR_PAGES(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_PROXY
#define ENABLE_FEATURE_HTTPD_PROXY 0
#define IF_FEATURE_HTTPD_PROXY(...)
#define IF_NOT_FEATURE_HTTPD_PROXY(...) __VA_ARGS__
#undef CONFIG_FEATURE_HTTPD_GZIP
#define ENABLE_FEATURE_HTTPD_GZIP 0
#define IF_FEATURE_HTTPD_GZIP(...)
#define IF_NOT_FEATURE_HTTPD_GZIP(...) __VA_ARGS__
#define CONFIG_IFCONFIG 1
#define ENABLE_IFCONFIG 1
#define IF_IFCONFIG(...) __VA_ARGS__
#define IF_NOT_IFCONFIG(...)
#define CONFIG_FEATURE_IFCONFIG_STATUS 1
#define ENABLE_FEATURE_IFCONFIG_STATUS 1
#define IF_FEATURE_IFCONFIG_STATUS(...) __VA_ARGS__
#define IF_NOT_FEATURE_IFCONFIG_STATUS(...)
#undef CONFIG_FEATURE_IFCONFIG_SLIP
#define ENABLE_FEATURE_IFCONFIG_SLIP 0
#define IF_FEATURE_IFCONFIG_SLIP(...)
#define IF_NOT_FEATURE_IFCONFIG_SLIP(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
#define ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ 0
#define IF_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ(...)
#define IF_NOT_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ(...) __VA_ARGS__
#define CONFIG_FEATURE_IFCONFIG_HW 1
#define ENABLE_FEATURE_IFCONFIG_HW 1
#define IF_FEATURE_IFCONFIG_HW(...) __VA_ARGS__
#define IF_NOT_FEATURE_IFCONFIG_HW(...)
#undef CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS
#define ENABLE_FEATURE_IFCONFIG_BROADCAST_PLUS 0
#define IF_FEATURE_IFCONFIG_BROADCAST_PLUS(...)
#define IF_NOT_FEATURE_IFCONFIG_BROADCAST_PLUS(...) __VA_ARGS__
#undef CONFIG_IFENSLAVE
#define ENABLE_IFENSLAVE 0
#define IF_IFENSLAVE(...)
#define IF_NOT_IFENSLAVE(...) __VA_ARGS__
#undef CONFIG_IFPLUGD
#define ENABLE_IFPLUGD 0
#define IF_IFPLUGD(...)
#define IF_NOT_IFPLUGD(...) __VA_ARGS__
#undef CONFIG_IFUPDOWN
#define ENABLE_IFUPDOWN 0
#define IF_IFUPDOWN(...)
#define IF_NOT_IFUPDOWN(...) __VA_ARGS__
#define CONFIG_IFUPDOWN_IFSTATE_PATH ""
#define ENABLE_IFUPDOWN_IFSTATE_PATH 1
#define IF_IFUPDOWN_IFSTATE_PATH(...) __VA_ARGS__
#define IF_NOT_IFUPDOWN_IFSTATE_PATH(...)
#undef CONFIG_FEATURE_IFUPDOWN_IP
#define ENABLE_FEATURE_IFUPDOWN_IP 0
#define IF_FEATURE_IFUPDOWN_IP(...)
#define IF_NOT_FEATURE_IFUPDOWN_IP(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN
#define ENABLE_FEATURE_IFUPDOWN_IP_BUILTIN 0
#define IF_FEATURE_IFUPDOWN_IP_BUILTIN(...)
#define IF_NOT_FEATURE_IFUPDOWN_IP_BUILTIN(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN
#define ENABLE_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN 0
#define IF_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN(...)
#define IF_NOT_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFUPDOWN_IPV4
#define ENABLE_FEATURE_IFUPDOWN_IPV4 0
#define IF_FEATURE_IFUPDOWN_IPV4(...)
#define IF_NOT_FEATURE_IFUPDOWN_IPV4(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFUPDOWN_IPV6
#define ENABLE_FEATURE_IFUPDOWN_IPV6 0
#define IF_FEATURE_IFUPDOWN_IPV6(...)
#define IF_NOT_FEATURE_IFUPDOWN_IPV6(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFUPDOWN_MAPPING
#define ENABLE_FEATURE_IFUPDOWN_MAPPING 0
#define IF_FEATURE_IFUPDOWN_MAPPING(...)
#define IF_NOT_FEATURE_IFUPDOWN_MAPPING(...) __VA_ARGS__
#undef CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP
#define ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 0
#define IF_FEATURE_IFUPDOWN_EXTERNAL_DHCP(...)
#define IF_NOT_FEATURE_IFUPDOWN_EXTERNAL_DHCP(...) __VA_ARGS__
#define CONFIG_INETD 1
#define ENABLE_INETD 1
#define IF_INETD(...) __VA_ARGS__
#define IF_NOT_INETD(...)
#define CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO 1
#define ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_ECHO 1
#define IF_FEATURE_INETD_SUPPORT_BUILTIN_ECHO(...) __VA_ARGS__
#define IF_NOT_FEATURE_INETD_SUPPORT_BUILTIN_ECHO(...)
#undef CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD
#define ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD 0
#define IF_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD(...)
#define IF_NOT_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD(...) __VA_ARGS__
#define CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME 1
#define ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_TIME 1
#define IF_FEATURE_INETD_SUPPORT_BUILTIN_TIME(...) __VA_ARGS__
#define IF_NOT_FEATURE_INETD_SUPPORT_BUILTIN_TIME(...)
#define CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME 1
#define ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME 1
#define IF_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME(...) __VA_ARGS__
#define IF_NOT_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME(...)
#undef CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN
#define ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN 0
#define IF_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN(...)
#define IF_NOT_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN(...) __VA_ARGS__
#undef CONFIG_FEATURE_INETD_RPC
#define ENABLE_FEATURE_INETD_RPC 0
#define IF_FEATURE_INETD_RPC(...)
#define IF_NOT_FEATURE_INETD_RPC(...) __VA_ARGS__
#define CONFIG_IP 1
#define ENABLE_IP 1
#define IF_IP(...) __VA_ARGS__
#define IF_NOT_IP(...)
#define CONFIG_FEATURE_IP_ADDRESS 1
#define ENABLE_FEATURE_IP_ADDRESS 1
#define IF_FEATURE_IP_ADDRESS(...) __VA_ARGS__
#define IF_NOT_FEATURE_IP_ADDRESS(...)
#define CONFIG_FEATURE_IP_LINK 1
#define ENABLE_FEATURE_IP_LINK 1
#define IF_FEATURE_IP_LINK(...) __VA_ARGS__
#define IF_NOT_FEATURE_IP_LINK(...)
#define CONFIG_FEATURE_IP_ROUTE 1
#define ENABLE_FEATURE_IP_ROUTE 1
#define IF_FEATURE_IP_ROUTE(...) __VA_ARGS__
#define IF_NOT_FEATURE_IP_ROUTE(...)
#undef CONFIG_FEATURE_IP_TUNNEL
#define ENABLE_FEATURE_IP_TUNNEL 0
#define IF_FEATURE_IP_TUNNEL(...)
#define IF_NOT_FEATURE_IP_TUNNEL(...) __VA_ARGS__
#define CONFIG_FEATURE_IP_RULE 1
#define ENABLE_FEATURE_IP_RULE 1
#define IF_FEATURE_IP_RULE(...) __VA_ARGS__
#define IF_NOT_FEATURE_IP_RULE(...)
#undef CONFIG_FEATURE_IP_SHORT_FORMS
#define ENABLE_FEATURE_IP_SHORT_FORMS 0
#define IF_FEATURE_IP_SHORT_FORMS(...)
#define IF_NOT_FEATURE_IP_SHORT_FORMS(...) __VA_ARGS__
#undef CONFIG_FEATURE_IP_RARE_PROTOCOLS
#define ENABLE_FEATURE_IP_RARE_PROTOCOLS 0
#define IF_FEATURE_IP_RARE_PROTOCOLS(...)
#define IF_NOT_FEATURE_IP_RARE_PROTOCOLS(...) __VA_ARGS__
#undef CONFIG_IPADDR
#define ENABLE_IPADDR 0
#define IF_IPADDR(...)
#define IF_NOT_IPADDR(...) __VA_ARGS__
#undef CONFIG_IPLINK
#define ENABLE_IPLINK 0
#define IF_IPLINK(...)
#define IF_NOT_IPLINK(...) __VA_ARGS__
#undef CONFIG_IPROUTE
#define ENABLE_IPROUTE 0
#define IF_IPROUTE(...)
#define IF_NOT_IPROUTE(...) __VA_ARGS__
#undef CONFIG_IPTUNNEL
#define ENABLE_IPTUNNEL 0
#define IF_IPTUNNEL(...)
#define IF_NOT_IPTUNNEL(...) __VA_ARGS__
#undef CONFIG_IPRULE
#define ENABLE_IPRULE 0
#define IF_IPRULE(...)
#define IF_NOT_IPRULE(...) __VA_ARGS__
#undef CONFIG_IPCALC
#define ENABLE_IPCALC 0
#define IF_IPCALC(...)
#define IF_NOT_IPCALC(...) __VA_ARGS__
#undef CONFIG_FEATURE_IPCALC_FANCY
#define ENABLE_FEATURE_IPCALC_FANCY 0
#define IF_FEATURE_IPCALC_FANCY(...)
#define IF_NOT_FEATURE_IPCALC_FANCY(...) __VA_ARGS__
#undef CONFIG_FEATURE_IPCALC_LONG_OPTIONS
#define ENABLE_FEATURE_IPCALC_LONG_OPTIONS 0
#define IF_FEATURE_IPCALC_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_IPCALC_LONG_OPTIONS(...) __VA_ARGS__
#define CONFIG_NETSTAT 1
#define ENABLE_NETSTAT 1
#define IF_NETSTAT(...) __VA_ARGS__
#define IF_NOT_NETSTAT(...)
#define CONFIG_FEATURE_NETSTAT_WIDE 1
#define ENABLE_FEATURE_NETSTAT_WIDE 1
#define IF_FEATURE_NETSTAT_WIDE(...) __VA_ARGS__
#define IF_NOT_FEATURE_NETSTAT_WIDE(...)
#define CONFIG_FEATURE_NETSTAT_PRG 1
#define ENABLE_FEATURE_NETSTAT_PRG 1
#define IF_FEATURE_NETSTAT_PRG(...) __VA_ARGS__
#define IF_NOT_FEATURE_NETSTAT_PRG(...)
#define CONFIG_NSLOOKUP 1
#define ENABLE_NSLOOKUP 1
#define IF_NSLOOKUP(...) __VA_ARGS__
#define IF_NOT_NSLOOKUP(...)
#define CONFIG_NTPD 1
#define ENABLE_NTPD 1
#define IF_NTPD(...) __VA_ARGS__
#define IF_NOT_NTPD(...)
#undef CONFIG_FEATURE_NTPD_SERVER
#define ENABLE_FEATURE_NTPD_SERVER 0
#define IF_FEATURE_NTPD_SERVER(...)
#define IF_NOT_FEATURE_NTPD_SERVER(...) __VA_ARGS__
#undef CONFIG_PSCAN
#define ENABLE_PSCAN 0
#define IF_PSCAN(...)
#define IF_NOT_PSCAN(...) __VA_ARGS__
#define CONFIG_ROUTE 1
#define ENABLE_ROUTE 1
#define IF_ROUTE(...) __VA_ARGS__
#define IF_NOT_ROUTE(...)
#undef CONFIG_SLATTACH
#define ENABLE_SLATTACH 0
#define IF_SLATTACH(...)
#define IF_NOT_SLATTACH(...) __VA_ARGS__
#undef CONFIG_TCPSVD
#define ENABLE_TCPSVD 0
#define IF_TCPSVD(...)
#define IF_NOT_TCPSVD(...) __VA_ARGS__
#define CONFIG_TELNET 1
#define ENABLE_TELNET 1
#define IF_TELNET(...) __VA_ARGS__
#define IF_NOT_TELNET(...)
#define CONFIG_FEATURE_TELNET_TTYPE 1
#define ENABLE_FEATURE_TELNET_TTYPE 1
#define IF_FEATURE_TELNET_TTYPE(...) __VA_ARGS__
#define IF_NOT_FEATURE_TELNET_TTYPE(...)
#undef CONFIG_FEATURE_TELNET_AUTOLOGIN
#define ENABLE_FEATURE_TELNET_AUTOLOGIN 0
#define IF_FEATURE_TELNET_AUTOLOGIN(...)
#define IF_NOT_FEATURE_TELNET_AUTOLOGIN(...) __VA_ARGS__
#define CONFIG_TELNETD 1
#define ENABLE_TELNETD 1
#define IF_TELNETD(...) __VA_ARGS__
#define IF_NOT_TELNETD(...)
#define CONFIG_FEATURE_TELNETD_STANDALONE 1
#define ENABLE_FEATURE_TELNETD_STANDALONE 1
#define IF_FEATURE_TELNETD_STANDALONE(...) __VA_ARGS__
#define IF_NOT_FEATURE_TELNETD_STANDALONE(...)
#define CONFIG_FEATURE_TELNETD_INETD_WAIT 1
#define ENABLE_FEATURE_TELNETD_INETD_WAIT 1
#define IF_FEATURE_TELNETD_INETD_WAIT(...) __VA_ARGS__
#define IF_NOT_FEATURE_TELNETD_INETD_WAIT(...)
#define CONFIG_TFTP 1
#define ENABLE_TFTP 1
#define IF_TFTP(...) __VA_ARGS__
#define IF_NOT_TFTP(...)
#define CONFIG_TFTPD 1
#define ENABLE_TFTPD 1
#define IF_TFTPD(...) __VA_ARGS__
#define IF_NOT_TFTPD(...)
/*
* Common options for tftp/tftpd
*/
#define CONFIG_FEATURE_TFTP_GET 1
#define ENABLE_FEATURE_TFTP_GET 1
#define IF_FEATURE_TFTP_GET(...) __VA_ARGS__
#define IF_NOT_FEATURE_TFTP_GET(...)
#define CONFIG_FEATURE_TFTP_PUT 1
#define ENABLE_FEATURE_TFTP_PUT 1
#define IF_FEATURE_TFTP_PUT(...) __VA_ARGS__
#define IF_NOT_FEATURE_TFTP_PUT(...)
#undef CONFIG_FEATURE_TFTP_BLOCKSIZE
#define ENABLE_FEATURE_TFTP_BLOCKSIZE 0
#define IF_FEATURE_TFTP_BLOCKSIZE(...)
#define IF_NOT_FEATURE_TFTP_BLOCKSIZE(...) __VA_ARGS__
#undef CONFIG_FEATURE_TFTP_PROGRESS_BAR
#define ENABLE_FEATURE_TFTP_PROGRESS_BAR 0
#define IF_FEATURE_TFTP_PROGRESS_BAR(...)
#define IF_NOT_FEATURE_TFTP_PROGRESS_BAR(...) __VA_ARGS__
#undef CONFIG_TFTP_DEBUG
#define ENABLE_TFTP_DEBUG 0
#define IF_TFTP_DEBUG(...)
#define IF_NOT_TFTP_DEBUG(...) __VA_ARGS__
#define CONFIG_TRACEROUTE 1
#define ENABLE_TRACEROUTE 1
#define IF_TRACEROUTE(...) __VA_ARGS__
#define IF_NOT_TRACEROUTE(...)
#undef CONFIG_TRACEROUTE6
#define ENABLE_TRACEROUTE6 0
#define IF_TRACEROUTE6(...)
#define IF_NOT_TRACEROUTE6(...) __VA_ARGS__
#define CONFIG_FEATURE_TRACEROUTE_VERBOSE 1
#define ENABLE_FEATURE_TRACEROUTE_VERBOSE 1
#define IF_FEATURE_TRACEROUTE_VERBOSE(...) __VA_ARGS__
#define IF_NOT_FEATURE_TRACEROUTE_VERBOSE(...)
#undef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE
#define ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE 0
#define IF_FEATURE_TRACEROUTE_SOURCE_ROUTE(...)
#define IF_NOT_FEATURE_TRACEROUTE_SOURCE_ROUTE(...) __VA_ARGS__
#undef CONFIG_FEATURE_TRACEROUTE_USE_ICMP
#define ENABLE_FEATURE_TRACEROUTE_USE_ICMP 0
#define IF_FEATURE_TRACEROUTE_USE_ICMP(...)
#define IF_NOT_FEATURE_TRACEROUTE_USE_ICMP(...) __VA_ARGS__
#undef CONFIG_TUNCTL
#define ENABLE_TUNCTL 0
#define IF_TUNCTL(...)
#define IF_NOT_TUNCTL(...) __VA_ARGS__
#undef CONFIG_FEATURE_TUNCTL_UG
#define ENABLE_FEATURE_TUNCTL_UG 0
#define IF_FEATURE_TUNCTL_UG(...)
#define IF_NOT_FEATURE_TUNCTL_UG(...) __VA_ARGS__
#undef CONFIG_UDHCPC6
#define ENABLE_UDHCPC6 0
#define IF_UDHCPC6(...)
#define IF_NOT_UDHCPC6(...) __VA_ARGS__
#undef CONFIG_UDHCPD
#define ENABLE_UDHCPD 0
#define IF_UDHCPD(...)
#define IF_NOT_UDHCPD(...) __VA_ARGS__
#undef CONFIG_DHCPRELAY
#define ENABLE_DHCPRELAY 0
#define IF_DHCPRELAY(...)
#define IF_NOT_DHCPRELAY(...) __VA_ARGS__
#undef CONFIG_DUMPLEASES
#define ENABLE_DUMPLEASES 0
#define IF_DUMPLEASES(...)
#define IF_NOT_DUMPLEASES(...) __VA_ARGS__
#undef CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY
#define ENABLE_FEATURE_UDHCPD_WRITE_LEASES_EARLY 0
#define IF_FEATURE_UDHCPD_WRITE_LEASES_EARLY(...)
#define IF_NOT_FEATURE_UDHCPD_WRITE_LEASES_EARLY(...) __VA_ARGS__
#undef CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC
#define ENABLE_FEATURE_UDHCPD_BASE_IP_ON_MAC 0
#define IF_FEATURE_UDHCPD_BASE_IP_ON_MAC(...)
#define IF_NOT_FEATURE_UDHCPD_BASE_IP_ON_MAC(...) __VA_ARGS__
#define CONFIG_DHCPD_LEASES_FILE ""
#define ENABLE_DHCPD_LEASES_FILE 1
#define IF_DHCPD_LEASES_FILE(...) __VA_ARGS__
#define IF_NOT_DHCPD_LEASES_FILE(...)
#undef CONFIG_UDHCPC
#define ENABLE_UDHCPC 0
#define IF_UDHCPC(...)
#define IF_NOT_UDHCPC(...) __VA_ARGS__
#undef CONFIG_FEATURE_UDHCPC_ARPING
#define ENABLE_FEATURE_UDHCPC_ARPING 0
#define IF_FEATURE_UDHCPC_ARPING(...)
#define IF_NOT_FEATURE_UDHCPC_ARPING(...) __VA_ARGS__
#undef CONFIG_FEATURE_UDHCP_PORT
#define ENABLE_FEATURE_UDHCP_PORT 0
#define IF_FEATURE_UDHCP_PORT(...)
#define IF_NOT_FEATURE_UDHCP_PORT(...) __VA_ARGS__
#define CONFIG_UDHCP_DEBUG 0
#define ENABLE_UDHCP_DEBUG 1
#define IF_UDHCP_DEBUG(...) __VA_ARGS__
#define IF_NOT_UDHCP_DEBUG(...)
#undef CONFIG_FEATURE_UDHCP_RFC3397
#define ENABLE_FEATURE_UDHCP_RFC3397 0
#define IF_FEATURE_UDHCP_RFC3397(...)
#define IF_NOT_FEATURE_UDHCP_RFC3397(...) __VA_ARGS__
#undef CONFIG_FEATURE_UDHCP_8021Q
#define ENABLE_FEATURE_UDHCP_8021Q 0
#define IF_FEATURE_UDHCP_8021Q(...)
#define IF_NOT_FEATURE_UDHCP_8021Q(...) __VA_ARGS__
#define CONFIG_UDHCPC_DEFAULT_SCRIPT ""
#define ENABLE_UDHCPC_DEFAULT_SCRIPT 1
#define IF_UDHCPC_DEFAULT_SCRIPT(...) __VA_ARGS__
#define IF_NOT_UDHCPC_DEFAULT_SCRIPT(...)
#define CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS 0
#define ENABLE_UDHCPC_SLACK_FOR_BUGGY_SERVERS 1
#define IF_UDHCPC_SLACK_FOR_BUGGY_SERVERS(...) __VA_ARGS__
#define IF_NOT_UDHCPC_SLACK_FOR_BUGGY_SERVERS(...)
#define CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS ""
#define ENABLE_IFUPDOWN_UDHCPC_CMD_OPTIONS 1
#define IF_IFUPDOWN_UDHCPC_CMD_OPTIONS(...) __VA_ARGS__
#define IF_NOT_IFUPDOWN_UDHCPC_CMD_OPTIONS(...)
#undef CONFIG_UDPSVD
#define ENABLE_UDPSVD 0
#define IF_UDPSVD(...)
#define IF_NOT_UDPSVD(...) __VA_ARGS__
#undef CONFIG_VCONFIG
#define ENABLE_VCONFIG 0
#define IF_VCONFIG(...)
#define IF_NOT_VCONFIG(...) __VA_ARGS__
#define CONFIG_WGET 1
#define ENABLE_WGET 1
#define IF_WGET(...) __VA_ARGS__
#define IF_NOT_WGET(...)
#define CONFIG_FEATURE_WGET_STATUSBAR 1
#define ENABLE_FEATURE_WGET_STATUSBAR 1
#define IF_FEATURE_WGET_STATUSBAR(...) __VA_ARGS__
#define IF_NOT_FEATURE_WGET_STATUSBAR(...)
#define CONFIG_FEATURE_WGET_AUTHENTICATION 1
#define ENABLE_FEATURE_WGET_AUTHENTICATION 1
#define IF_FEATURE_WGET_AUTHENTICATION(...) __VA_ARGS__
#define IF_NOT_FEATURE_WGET_AUTHENTICATION(...)
#define CONFIG_FEATURE_WGET_LONG_OPTIONS 1
#define ENABLE_FEATURE_WGET_LONG_OPTIONS 1
#define IF_FEATURE_WGET_LONG_OPTIONS(...) __VA_ARGS__
#define IF_NOT_FEATURE_WGET_LONG_OPTIONS(...)
#define CONFIG_FEATURE_WGET_TIMEOUT 1
#define ENABLE_FEATURE_WGET_TIMEOUT 1
#define IF_FEATURE_WGET_TIMEOUT(...) __VA_ARGS__
#define IF_NOT_FEATURE_WGET_TIMEOUT(...)
#undef CONFIG_ZCIP
#define ENABLE_ZCIP 0
#define IF_ZCIP(...)
#define IF_NOT_ZCIP(...) __VA_ARGS__
/*
* Print Utilities
*/
#undef CONFIG_LPD
#define ENABLE_LPD 0
#define IF_LPD(...)
#define IF_NOT_LPD(...) __VA_ARGS__
#undef CONFIG_LPR
#define ENABLE_LPR 0
#define IF_LPR(...)
#define IF_NOT_LPR(...) __VA_ARGS__
#undef CONFIG_LPQ
#define ENABLE_LPQ 0
#define IF_LPQ(...)
#define IF_NOT_LPQ(...) __VA_ARGS__
/*
* Mail Utilities
*/
#undef CONFIG_MAKEMIME
#define ENABLE_MAKEMIME 0
#define IF_MAKEMIME(...)
#define IF_NOT_MAKEMIME(...) __VA_ARGS__
#define CONFIG_FEATURE_MIME_CHARSET ""
#define ENABLE_FEATURE_MIME_CHARSET 1
#define IF_FEATURE_MIME_CHARSET(...) __VA_ARGS__
#define IF_NOT_FEATURE_MIME_CHARSET(...)
#undef CONFIG_POPMAILDIR
#define ENABLE_POPMAILDIR 0
#define IF_POPMAILDIR(...)
#define IF_NOT_POPMAILDIR(...) __VA_ARGS__
#undef CONFIG_FEATURE_POPMAILDIR_DELIVERY
#define ENABLE_FEATURE_POPMAILDIR_DELIVERY 0
#define IF_FEATURE_POPMAILDIR_DELIVERY(...)
#define IF_NOT_FEATURE_POPMAILDIR_DELIVERY(...) __VA_ARGS__
#undef CONFIG_REFORMIME
#define ENABLE_REFORMIME 0
#define IF_REFORMIME(...)
#define IF_NOT_REFORMIME(...) __VA_ARGS__
#undef CONFIG_FEATURE_REFORMIME_COMPAT
#define ENABLE_FEATURE_REFORMIME_COMPAT 0
#define IF_FEATURE_REFORMIME_COMPAT(...)
#define IF_NOT_FEATURE_REFORMIME_COMPAT(...) __VA_ARGS__
#undef CONFIG_SENDMAIL
#define ENABLE_SENDMAIL 0
#define IF_SENDMAIL(...)
#define IF_NOT_SENDMAIL(...) __VA_ARGS__
/*
* Process Utilities
*/
#define CONFIG_IOSTAT 1
#define ENABLE_IOSTAT 1
#define IF_IOSTAT(...) __VA_ARGS__
#define IF_NOT_IOSTAT(...)
#define CONFIG_LSOF 1
#define ENABLE_LSOF 1
#define IF_LSOF(...) __VA_ARGS__
#define IF_NOT_LSOF(...)
#define CONFIG_MPSTAT 1
#define ENABLE_MPSTAT 1
#define IF_MPSTAT(...) __VA_ARGS__
#define IF_NOT_MPSTAT(...)
#undef CONFIG_NMETER
#define ENABLE_NMETER 0
#define IF_NMETER(...)
#define IF_NOT_NMETER(...) __VA_ARGS__
#define CONFIG_PMAP 1
#define ENABLE_PMAP 1
#define IF_PMAP(...) __VA_ARGS__
#define IF_NOT_PMAP(...)
#undef CONFIG_POWERTOP
#define ENABLE_POWERTOP 0
#define IF_POWERTOP(...)
#define IF_NOT_POWERTOP(...) __VA_ARGS__
#define CONFIG_PSTREE 1
#define ENABLE_PSTREE 1
#define IF_PSTREE(...) __VA_ARGS__
#define IF_NOT_PSTREE(...)
#define CONFIG_PWDX 1
#define ENABLE_PWDX 1
#define IF_PWDX(...) __VA_ARGS__
#define IF_NOT_PWDX(...)
#undef CONFIG_SMEMCAP
#define ENABLE_SMEMCAP 0
#define IF_SMEMCAP(...)
#define IF_NOT_SMEMCAP(...) __VA_ARGS__
#define CONFIG_TOP 1
#define ENABLE_TOP 1
#define IF_TOP(...) __VA_ARGS__
#define IF_NOT_TOP(...)
#define CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE 1
#define ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE 1
#define IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(...) __VA_ARGS__
#define IF_NOT_FEATURE_TOP_CPU_USAGE_PERCENTAGE(...)
#define CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS 1
#define ENABLE_FEATURE_TOP_CPU_GLOBAL_PERCENTS 1
#define IF_FEATURE_TOP_CPU_GLOBAL_PERCENTS(...) __VA_ARGS__
#define IF_NOT_FEATURE_TOP_CPU_GLOBAL_PERCENTS(...)
#define CONFIG_FEATURE_TOP_SMP_CPU 1
#define ENABLE_FEATURE_TOP_SMP_CPU 1
#define IF_FEATURE_TOP_SMP_CPU(...) __VA_ARGS__
#define IF_NOT_FEATURE_TOP_SMP_CPU(...)
#define CONFIG_FEATURE_TOP_DECIMALS 1
#define ENABLE_FEATURE_TOP_DECIMALS 1
#define IF_FEATURE_TOP_DECIMALS(...) __VA_ARGS__
#define IF_NOT_FEATURE_TOP_DECIMALS(...)
#undef CONFIG_FEATURE_TOP_SMP_PROCESS
#define ENABLE_FEATURE_TOP_SMP_PROCESS 0
#define IF_FEATURE_TOP_SMP_PROCESS(...)
#define IF_NOT_FEATURE_TOP_SMP_PROCESS(...) __VA_ARGS__
#define CONFIG_FEATURE_TOPMEM 1
#define ENABLE_FEATURE_TOPMEM 1
#define IF_FEATURE_TOPMEM(...) __VA_ARGS__
#define IF_NOT_FEATURE_TOPMEM(...)
#define CONFIG_UPTIME 1
#define ENABLE_UPTIME 1
#define IF_UPTIME(...) __VA_ARGS__
#define IF_NOT_UPTIME(...)
#undef CONFIG_FEATURE_UPTIME_UTMP_SUPPORT
#define ENABLE_FEATURE_UPTIME_UTMP_SUPPORT 0
#define IF_FEATURE_UPTIME_UTMP_SUPPORT(...)
#define IF_NOT_FEATURE_UPTIME_UTMP_SUPPORT(...) __VA_ARGS__
#define CONFIG_FREE 1
#define ENABLE_FREE 1
#define IF_FREE(...) __VA_ARGS__
#define IF_NOT_FREE(...)
#define CONFIG_FUSER 1
#define ENABLE_FUSER 1
#define IF_FUSER(...) __VA_ARGS__
#define IF_NOT_FUSER(...)
#define CONFIG_KILL 1
#define ENABLE_KILL 1
#define IF_KILL(...) __VA_ARGS__
#define IF_NOT_KILL(...)
#define CONFIG_KILLALL 1
#define ENABLE_KILLALL 1
#define IF_KILLALL(...) __VA_ARGS__
#define IF_NOT_KILLALL(...)
#define CONFIG_KILLALL5 1
#define ENABLE_KILLALL5 1
#define IF_KILLALL5(...) __VA_ARGS__
#define IF_NOT_KILLALL5(...)
#define CONFIG_PGREP 1
#define ENABLE_PGREP 1
#define IF_PGREP(...) __VA_ARGS__
#define IF_NOT_PGREP(...)
#define CONFIG_PIDOF 1
#define ENABLE_PIDOF 1
#define IF_PIDOF(...) __VA_ARGS__
#define IF_NOT_PIDOF(...)
#define CONFIG_FEATURE_PIDOF_SINGLE 1
#define ENABLE_FEATURE_PIDOF_SINGLE 1
#define IF_FEATURE_PIDOF_SINGLE(...) __VA_ARGS__
#define IF_NOT_FEATURE_PIDOF_SINGLE(...)
#define CONFIG_FEATURE_PIDOF_OMIT 1
#define ENABLE_FEATURE_PIDOF_OMIT 1
#define IF_FEATURE_PIDOF_OMIT(...) __VA_ARGS__
#define IF_NOT_FEATURE_PIDOF_OMIT(...)
#define CONFIG_PKILL 1
#define ENABLE_PKILL 1
#define IF_PKILL(...) __VA_ARGS__
#define IF_NOT_PKILL(...)
#define CONFIG_PS 1
#define ENABLE_PS 1
#define IF_PS(...) __VA_ARGS__
#define IF_NOT_PS(...)
#define CONFIG_FEATURE_PS_WIDE 1
#define ENABLE_FEATURE_PS_WIDE 1
#define IF_FEATURE_PS_WIDE(...) __VA_ARGS__
#define IF_NOT_FEATURE_PS_WIDE(...)
#define CONFIG_FEATURE_PS_LONG 1
#define ENABLE_FEATURE_PS_LONG 1
#define IF_FEATURE_PS_LONG(...) __VA_ARGS__
#define IF_NOT_FEATURE_PS_LONG(...)
#undef CONFIG_FEATURE_PS_TIME
#define ENABLE_FEATURE_PS_TIME 0
#define IF_FEATURE_PS_TIME(...)
#define IF_NOT_FEATURE_PS_TIME(...) __VA_ARGS__
#undef CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS
#define ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS 0
#define IF_FEATURE_PS_ADDITIONAL_COLUMNS(...)
#define IF_NOT_FEATURE_PS_ADDITIONAL_COLUMNS(...) __VA_ARGS__
#undef CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS
#define ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS 0
#define IF_FEATURE_PS_UNUSUAL_SYSTEMS(...)
#define IF_NOT_FEATURE_PS_UNUSUAL_SYSTEMS(...) __VA_ARGS__
#define CONFIG_RENICE 1
#define ENABLE_RENICE 1
#define IF_RENICE(...) __VA_ARGS__
#define IF_NOT_RENICE(...)
#define CONFIG_BB_SYSCTL 1
#define ENABLE_BB_SYSCTL 1
#define IF_BB_SYSCTL(...) __VA_ARGS__
#define IF_NOT_BB_SYSCTL(...)
#define CONFIG_FEATURE_SHOW_THREADS 1
#define ENABLE_FEATURE_SHOW_THREADS 1
#define IF_FEATURE_SHOW_THREADS(...) __VA_ARGS__
#define IF_NOT_FEATURE_SHOW_THREADS(...)
#define CONFIG_WATCH 1
#define ENABLE_WATCH 1
#define IF_WATCH(...) __VA_ARGS__
#define IF_NOT_WATCH(...)
/*
* Runit Utilities
*/
#undef CONFIG_RUNSV
#define ENABLE_RUNSV 0
#define IF_RUNSV(...)
#define IF_NOT_RUNSV(...) __VA_ARGS__
#undef CONFIG_RUNSVDIR
#define ENABLE_RUNSVDIR 0
#define IF_RUNSVDIR(...)
#define IF_NOT_RUNSVDIR(...) __VA_ARGS__
#undef CONFIG_FEATURE_RUNSVDIR_LOG
#define ENABLE_FEATURE_RUNSVDIR_LOG 0
#define IF_FEATURE_RUNSVDIR_LOG(...)
#define IF_NOT_FEATURE_RUNSVDIR_LOG(...) __VA_ARGS__
#undef CONFIG_SV
#define ENABLE_SV 0
#define IF_SV(...)
#define IF_NOT_SV(...) __VA_ARGS__
#define CONFIG_SV_DEFAULT_SERVICE_DIR ""
#define ENABLE_SV_DEFAULT_SERVICE_DIR 1
#define IF_SV_DEFAULT_SERVICE_DIR(...) __VA_ARGS__
#define IF_NOT_SV_DEFAULT_SERVICE_DIR(...)
#undef CONFIG_SVLOGD
#define ENABLE_SVLOGD 0
#define IF_SVLOGD(...)
#define IF_NOT_SVLOGD(...) __VA_ARGS__
#undef CONFIG_CHPST
#define ENABLE_CHPST 0
#define IF_CHPST(...)
#define IF_NOT_CHPST(...) __VA_ARGS__
#undef CONFIG_SETUIDGID
#define ENABLE_SETUIDGID 0
#define IF_SETUIDGID(...)
#define IF_NOT_SETUIDGID(...) __VA_ARGS__
#undef CONFIG_ENVUIDGID
#define ENABLE_ENVUIDGID 0
#define IF_ENVUIDGID(...)
#define IF_NOT_ENVUIDGID(...) __VA_ARGS__
#undef CONFIG_ENVDIR
#define ENABLE_ENVDIR 0
#define IF_ENVDIR(...)
#define IF_NOT_ENVDIR(...) __VA_ARGS__
#undef CONFIG_SOFTLIMIT
#define ENABLE_SOFTLIMIT 0
#define IF_SOFTLIMIT(...)
#define IF_NOT_SOFTLIMIT(...) __VA_ARGS__
#undef CONFIG_CHCON
#define ENABLE_CHCON 0
#define IF_CHCON(...)
#define IF_NOT_CHCON(...) __VA_ARGS__
#undef CONFIG_FEATURE_CHCON_LONG_OPTIONS
#define ENABLE_FEATURE_CHCON_LONG_OPTIONS 0
#define IF_FEATURE_CHCON_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_CHCON_LONG_OPTIONS(...) __VA_ARGS__
#undef CONFIG_GETENFORCE
#define ENABLE_GETENFORCE 0
#define IF_GETENFORCE(...)
#define IF_NOT_GETENFORCE(...) __VA_ARGS__
#undef CONFIG_GETSEBOOL
#define ENABLE_GETSEBOOL 0
#define IF_GETSEBOOL(...)
#define IF_NOT_GETSEBOOL(...) __VA_ARGS__
#undef CONFIG_LOAD_POLICY
#define ENABLE_LOAD_POLICY 0
#define IF_LOAD_POLICY(...)
#define IF_NOT_LOAD_POLICY(...) __VA_ARGS__
#undef CONFIG_MATCHPATHCON
#define ENABLE_MATCHPATHCON 0
#define IF_MATCHPATHCON(...)
#define IF_NOT_MATCHPATHCON(...) __VA_ARGS__
#undef CONFIG_RESTORECON
#define ENABLE_RESTORECON 0
#define IF_RESTORECON(...)
#define IF_NOT_RESTORECON(...) __VA_ARGS__
#undef CONFIG_RUNCON
#define ENABLE_RUNCON 0
#define IF_RUNCON(...)
#define IF_NOT_RUNCON(...) __VA_ARGS__
#undef CONFIG_FEATURE_RUNCON_LONG_OPTIONS
#define ENABLE_FEATURE_RUNCON_LONG_OPTIONS 0
#define IF_FEATURE_RUNCON_LONG_OPTIONS(...)
#define IF_NOT_FEATURE_RUNCON_LONG_OPTIONS(...) __VA_ARGS__
#undef CONFIG_SELINUXENABLED
#define ENABLE_SELINUXENABLED 0
#define IF_SELINUXENABLED(...)
#define IF_NOT_SELINUXENABLED(...) __VA_ARGS__
#undef CONFIG_SETENFORCE
#define ENABLE_SETENFORCE 0
#define IF_SETENFORCE(...)
#define IF_NOT_SETENFORCE(...) __VA_ARGS__
#undef CONFIG_SETFILES
#define ENABLE_SETFILES 0
#define IF_SETFILES(...)
#define IF_NOT_SETFILES(...) __VA_ARGS__
#undef CONFIG_FEATURE_SETFILES_CHECK_OPTION
#define ENABLE_FEATURE_SETFILES_CHECK_OPTION 0
#define IF_FEATURE_SETFILES_CHECK_OPTION(...)
#define IF_NOT_FEATURE_SETFILES_CHECK_OPTION(...) __VA_ARGS__
#undef CONFIG_SETSEBOOL
#define ENABLE_SETSEBOOL 0
#define IF_SETSEBOOL(...)
#define IF_NOT_SETSEBOOL(...) __VA_ARGS__
#undef CONFIG_SESTATUS
#define ENABLE_SESTATUS 0
#define IF_SESTATUS(...)
#define IF_NOT_SESTATUS(...) __VA_ARGS__
/*
* Shells
*/
#define CONFIG_ASH 1
#define ENABLE_ASH 1
#define IF_ASH(...) __VA_ARGS__
#define IF_NOT_ASH(...)
#define CONFIG_ASH_BASH_COMPAT 1
#define ENABLE_ASH_BASH_COMPAT 1
#define IF_ASH_BASH_COMPAT(...) __VA_ARGS__
#define IF_NOT_ASH_BASH_COMPAT(...)
#undef CONFIG_ASH_IDLE_TIMEOUT
#define ENABLE_ASH_IDLE_TIMEOUT 0
#define IF_ASH_IDLE_TIMEOUT(...)
#define IF_NOT_ASH_IDLE_TIMEOUT(...) __VA_ARGS__
#define CONFIG_ASH_JOB_CONTROL 1
#define ENABLE_ASH_JOB_CONTROL 1
#define IF_ASH_JOB_CONTROL(...) __VA_ARGS__
#define IF_NOT_ASH_JOB_CONTROL(...)
#define CONFIG_ASH_ALIAS 1
#define ENABLE_ASH_ALIAS 1
#define IF_ASH_ALIAS(...) __VA_ARGS__
#define IF_NOT_ASH_ALIAS(...)
#undef CONFIG_ASH_GETOPTS
#define ENABLE_ASH_GETOPTS 0
#define IF_ASH_GETOPTS(...)
#define IF_NOT_ASH_GETOPTS(...) __VA_ARGS__
#define CONFIG_ASH_BUILTIN_ECHO 1
#define ENABLE_ASH_BUILTIN_ECHO 1
#define IF_ASH_BUILTIN_ECHO(...) __VA_ARGS__
#define IF_NOT_ASH_BUILTIN_ECHO(...)
#define CONFIG_ASH_BUILTIN_PRINTF 1
#define ENABLE_ASH_BUILTIN_PRINTF 1
#define IF_ASH_BUILTIN_PRINTF(...) __VA_ARGS__
#define IF_NOT_ASH_BUILTIN_PRINTF(...)
#define CONFIG_ASH_BUILTIN_TEST 1
#define ENABLE_ASH_BUILTIN_TEST 1
#define IF_ASH_BUILTIN_TEST(...) __VA_ARGS__
#define IF_NOT_ASH_BUILTIN_TEST(...)
#define CONFIG_ASH_CMDCMD 1
#define ENABLE_ASH_CMDCMD 1
#define IF_ASH_CMDCMD(...) __VA_ARGS__
#define IF_NOT_ASH_CMDCMD(...)
#undef CONFIG_ASH_MAIL
#define ENABLE_ASH_MAIL 0
#define IF_ASH_MAIL(...)
#define IF_NOT_ASH_MAIL(...) __VA_ARGS__
#define CONFIG_ASH_OPTIMIZE_FOR_SIZE 1
#define ENABLE_ASH_OPTIMIZE_FOR_SIZE 1
#define IF_ASH_OPTIMIZE_FOR_SIZE(...) __VA_ARGS__
#define IF_NOT_ASH_OPTIMIZE_FOR_SIZE(...)
#define CONFIG_ASH_RANDOM_SUPPORT 1
#define ENABLE_ASH_RANDOM_SUPPORT 1
#define IF_ASH_RANDOM_SUPPORT(...) __VA_ARGS__
#define IF_NOT_ASH_RANDOM_SUPPORT(...)
#define CONFIG_ASH_EXPAND_PRMT 1
#define ENABLE_ASH_EXPAND_PRMT 1
#define IF_ASH_EXPAND_PRMT(...) __VA_ARGS__
#define IF_NOT_ASH_EXPAND_PRMT(...)
#undef CONFIG_CTTYHACK
#define ENABLE_CTTYHACK 0
#define IF_CTTYHACK(...)
#define IF_NOT_CTTYHACK(...) __VA_ARGS__
#undef CONFIG_HUSH
#define ENABLE_HUSH 0
#define IF_HUSH(...)
#define IF_NOT_HUSH(...) __VA_ARGS__
#undef CONFIG_HUSH_BASH_COMPAT
#define ENABLE_HUSH_BASH_COMPAT 0
#define IF_HUSH_BASH_COMPAT(...)
#define IF_NOT_HUSH_BASH_COMPAT(...) __VA_ARGS__
#undef CONFIG_HUSH_BRACE_EXPANSION
#define ENABLE_HUSH_BRACE_EXPANSION 0
#define IF_HUSH_BRACE_EXPANSION(...)
#define IF_NOT_HUSH_BRACE_EXPANSION(...) __VA_ARGS__
#undef CONFIG_HUSH_HELP
#define ENABLE_HUSH_HELP 0
#define IF_HUSH_HELP(...)
#define IF_NOT_HUSH_HELP(...) __VA_ARGS__
#undef CONFIG_HUSH_INTERACTIVE
#define ENABLE_HUSH_INTERACTIVE 0
#define IF_HUSH_INTERACTIVE(...)
#define IF_NOT_HUSH_INTERACTIVE(...) __VA_ARGS__
#undef CONFIG_HUSH_SAVEHISTORY
#define ENABLE_HUSH_SAVEHISTORY 0
#define IF_HUSH_SAVEHISTORY(...)
#define IF_NOT_HUSH_SAVEHISTORY(...) __VA_ARGS__
#undef CONFIG_HUSH_JOB
#define ENABLE_HUSH_JOB 0
#define IF_HUSH_JOB(...)
#define IF_NOT_HUSH_JOB(...) __VA_ARGS__
#undef CONFIG_HUSH_TICK
#define ENABLE_HUSH_TICK 0
#define IF_HUSH_TICK(...)
#define IF_NOT_HUSH_TICK(...) __VA_ARGS__
#undef CONFIG_HUSH_IF
#define ENABLE_HUSH_IF 0
#define IF_HUSH_IF(...)
#define IF_NOT_HUSH_IF(...) __VA_ARGS__
#undef CONFIG_HUSH_LOOPS
#define ENABLE_HUSH_LOOPS 0
#define IF_HUSH_LOOPS(...)
#define IF_NOT_HUSH_LOOPS(...) __VA_ARGS__
#undef CONFIG_HUSH_CASE
#define ENABLE_HUSH_CASE 0
#define IF_HUSH_CASE(...)
#define IF_NOT_HUSH_CASE(...) __VA_ARGS__
#undef CONFIG_HUSH_FUNCTIONS
#define ENABLE_HUSH_FUNCTIONS 0
#define IF_HUSH_FUNCTIONS(...)
#define IF_NOT_HUSH_FUNCTIONS(...) __VA_ARGS__
#undef CONFIG_HUSH_LOCAL
#define ENABLE_HUSH_LOCAL 0
#define IF_HUSH_LOCAL(...)
#define IF_NOT_HUSH_LOCAL(...) __VA_ARGS__
#undef CONFIG_HUSH_RANDOM_SUPPORT
#define ENABLE_HUSH_RANDOM_SUPPORT 0
#define IF_HUSH_RANDOM_SUPPORT(...)
#define IF_NOT_HUSH_RANDOM_SUPPORT(...) __VA_ARGS__
#undef CONFIG_HUSH_EXPORT_N
#define ENABLE_HUSH_EXPORT_N 0
#define IF_HUSH_EXPORT_N(...)
#define IF_NOT_HUSH_EXPORT_N(...) __VA_ARGS__
#undef CONFIG_HUSH_MODE_X
#define ENABLE_HUSH_MODE_X 0
#define IF_HUSH_MODE_X(...)
#define IF_NOT_HUSH_MODE_X(...) __VA_ARGS__
#undef CONFIG_MSH
#define ENABLE_MSH 0
#define IF_MSH(...)
#define IF_NOT_MSH(...) __VA_ARGS__
#define CONFIG_FEATURE_SH_IS_ASH 1
#define ENABLE_FEATURE_SH_IS_ASH 1
#define IF_FEATURE_SH_IS_ASH(...) __VA_ARGS__
#define IF_NOT_FEATURE_SH_IS_ASH(...)
#undef CONFIG_FEATURE_SH_IS_HUSH
#define ENABLE_FEATURE_SH_IS_HUSH 0
#define IF_FEATURE_SH_IS_HUSH(...)
#define IF_NOT_FEATURE_SH_IS_HUSH(...) __VA_ARGS__
#undef CONFIG_FEATURE_SH_IS_NONE
#define ENABLE_FEATURE_SH_IS_NONE 0
#define IF_FEATURE_SH_IS_NONE(...)
#define IF_NOT_FEATURE_SH_IS_NONE(...) __VA_ARGS__
#undef CONFIG_FEATURE_BASH_IS_ASH
#define ENABLE_FEATURE_BASH_IS_ASH 0
#define IF_FEATURE_BASH_IS_ASH(...)
#define IF_NOT_FEATURE_BASH_IS_ASH(...) __VA_ARGS__
#undef CONFIG_FEATURE_BASH_IS_HUSH
#define ENABLE_FEATURE_BASH_IS_HUSH 0
#define IF_FEATURE_BASH_IS_HUSH(...)
#define IF_NOT_FEATURE_BASH_IS_HUSH(...) __VA_ARGS__
#define CONFIG_FEATURE_BASH_IS_NONE 1
#define ENABLE_FEATURE_BASH_IS_NONE 1
#define IF_FEATURE_BASH_IS_NONE(...) __VA_ARGS__
#define IF_NOT_FEATURE_BASH_IS_NONE(...)
#define CONFIG_SH_MATH_SUPPORT 1
#define ENABLE_SH_MATH_SUPPORT 1
#define IF_SH_MATH_SUPPORT(...) __VA_ARGS__
#define IF_NOT_SH_MATH_SUPPORT(...)
#define CONFIG_SH_MATH_SUPPORT_64 1
#define ENABLE_SH_MATH_SUPPORT_64 1
#define IF_SH_MATH_SUPPORT_64(...) __VA_ARGS__
#define IF_NOT_SH_MATH_SUPPORT_64(...)
#define CONFIG_FEATURE_SH_EXTRA_QUIET 1
#define ENABLE_FEATURE_SH_EXTRA_QUIET 1
#define IF_FEATURE_SH_EXTRA_QUIET(...) __VA_ARGS__
#define IF_NOT_FEATURE_SH_EXTRA_QUIET(...)
#undef CONFIG_FEATURE_SH_STANDALONE
#define ENABLE_FEATURE_SH_STANDALONE 0
#define IF_FEATURE_SH_STANDALONE(...)
#define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
#undef CONFIG_FEATURE_SH_NOFORK
#define ENABLE_FEATURE_SH_NOFORK 0
#define IF_FEATURE_SH_NOFORK(...)
#define IF_NOT_FEATURE_SH_NOFORK(...) __VA_ARGS__
#undef CONFIG_FEATURE_SH_HISTFILESIZE
#define ENABLE_FEATURE_SH_HISTFILESIZE 0
#define IF_FEATURE_SH_HISTFILESIZE(...)
#define IF_NOT_FEATURE_SH_HISTFILESIZE(...) __VA_ARGS__
/*
* System Logging Utilities
*/
#undef CONFIG_SYSLOGD
#define ENABLE_SYSLOGD 0
#define IF_SYSLOGD(...)
#define IF_NOT_SYSLOGD(...) __VA_ARGS__
#undef CONFIG_FEATURE_ROTATE_LOGFILE
#define ENABLE_FEATURE_ROTATE_LOGFILE 0
#define IF_FEATURE_ROTATE_LOGFILE(...)
#define IF_NOT_FEATURE_ROTATE_LOGFILE(...) __VA_ARGS__
#undef CONFIG_FEATURE_REMOTE_LOG
#define ENABLE_FEATURE_REMOTE_LOG 0
#define IF_FEATURE_REMOTE_LOG(...)
#define IF_NOT_FEATURE_REMOTE_LOG(...) __VA_ARGS__
#undef CONFIG_FEATURE_SYSLOGD_DUP
#define ENABLE_FEATURE_SYSLOGD_DUP 0
#define IF_FEATURE_SYSLOGD_DUP(...)
#define IF_NOT_FEATURE_SYSLOGD_DUP(...) __VA_ARGS__
#undef CONFIG_FEATURE_SYSLOGD_CFG
#define ENABLE_FEATURE_SYSLOGD_CFG 0
#define IF_FEATURE_SYSLOGD_CFG(...)
#define IF_NOT_FEATURE_SYSLOGD_CFG(...) __VA_ARGS__
#define CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE 0
#define ENABLE_FEATURE_SYSLOGD_READ_BUFFER_SIZE 1
#define IF_FEATURE_SYSLOGD_READ_BUFFER_SIZE(...) __VA_ARGS__
#define IF_NOT_FEATURE_SYSLOGD_READ_BUFFER_SIZE(...)
#undef CONFIG_FEATURE_IPC_SYSLOG
#define ENABLE_FEATURE_IPC_SYSLOG 0
#define IF_FEATURE_IPC_SYSLOG(...)
#define IF_NOT_FEATURE_IPC_SYSLOG(...) __VA_ARGS__
#define CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE 0
#define ENABLE_FEATURE_IPC_SYSLOG_BUFFER_SIZE 1
#define IF_FEATURE_IPC_SYSLOG_BUFFER_SIZE(...) __VA_ARGS__
#define IF_NOT_FEATURE_IPC_SYSLOG_BUFFER_SIZE(...)
#undef CONFIG_LOGREAD
#define ENABLE_LOGREAD 0
#define IF_LOGREAD(...)
#define IF_NOT_LOGREAD(...) __VA_ARGS__
#undef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
#define ENABLE_FEATURE_LOGREAD_REDUCED_LOCKING 0
#define IF_FEATURE_LOGREAD_REDUCED_LOCKING(...)
#define IF_NOT_FEATURE_LOGREAD_REDUCED_LOCKING(...) __VA_ARGS__
#undef CONFIG_FEATURE_KMSG_SYSLOG
#define ENABLE_FEATURE_KMSG_SYSLOG 0
#define IF_FEATURE_KMSG_SYSLOG(...)
#define IF_NOT_FEATURE_KMSG_SYSLOG(...) __VA_ARGS__
#undef CONFIG_KLOGD
#define ENABLE_KLOGD 0
#define IF_KLOGD(...)
#define IF_NOT_KLOGD(...) __VA_ARGS__
#undef CONFIG_FEATURE_KLOGD_KLOGCTL
#define ENABLE_FEATURE_KLOGD_KLOGCTL 0
#define IF_FEATURE_KLOGD_KLOGCTL(...)
#define IF_NOT_FEATURE_KLOGD_KLOGCTL(...) __VA_ARGS__
#undef CONFIG_LOGGER
#define ENABLE_LOGGER 0
#define IF_LOGGER(...)
#define IF_NOT_LOGGER(...) __VA_ARGS__
| MIRAGE-Dev/android_external_busybox | include-full/autoconf.h | C | gpl-2.0 | 127,698 |
# Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class SearchController < ApplicationController
before_filter :find_optional_project
helper :messages
include MessagesHelper
def index
@question = params[:q] || ""
@question.strip!
@all_words = params[:all_words] ? params[:all_words].present? : true
@titles_only = params[:titles_only] ? params[:titles_only].present? : false
projects_to_search =
case params[:scope]
when 'all'
nil
when 'my_projects'
User.current.memberships.collect(&:project)
when 'subprojects'
@project ? (@project.self_and_descendants.active.all) : nil
else
@project
end
offset = nil
begin; offset = params[:offset].to_time if params[:offset]; rescue; end
# quick jump to an issue
if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1.to_i)
redirect_to :controller => "issues", :action => "show", :id => $1
return
end
@object_types = Redmine::Search.available_search_types.dup
if projects_to_search.is_a? Project
# don't search projects
@object_types.delete('projects')
# only show what the user is allowed to view
@object_types = @object_types.select {|o| User.current.allowed_to?("view_#{o}".to_sym, projects_to_search)}
end
@scope = @object_types.select {|t| params[t]}
@scope = @object_types if @scope.empty?
# extract tokens from the question
# eg. hello "bye bye" => ["hello", "bye bye"]
@tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')}
# tokens must be at least 2 characters long
@tokens = @tokens.uniq.select {|w| w.length > 1 }
if !@tokens.empty?
# no more than 5 tokens to search for
@tokens.slice! 5..-1 if @tokens.size > 5
@results = []
@results_by_type = Hash.new {|h,k| h[k] = 0}
limit = 10
@scope.each do |s|
r, c = s.singularize.camelcase.constantize.search(@tokens, projects_to_search,
:all_words => @all_words,
:titles_only => @titles_only,
:limit => (limit+1),
:offset => offset,
:before => params[:previous].nil?)
@results += r
@results_by_type[s] += c
end
@results = @results.sort {|a,b| b.event_datetime <=> a.event_datetime}
if params[:previous].nil?
@pagination_previous_date = @results[0].event_datetime if offset && @results[0]
if @results.size > limit
@pagination_next_date = @results[limit-1].event_datetime
@results = @results[0, limit]
end
else
@pagination_next_date = @results[-1].event_datetime if offset && @results[-1]
if @results.size > limit
@pagination_previous_date = @results[-(limit)].event_datetime
@results = @results[-(limit), limit]
end
end
else
@question = ""
end
render :layout => false if request.xhr?
end
private
def find_optional_project
return true unless params[:id]
@project = Project.find(params[:id])
check_project_privacy
rescue ActiveRecord::RecordNotFound
render_404
end
end
| veritazx/escience | app/controllers/search_controller.rb | Ruby | gpl-2.0 | 4,063 |
#include <stdio.h>
#include "main_begin.h"
/*-------------------------------------------------------------
* BILGILER
*------------------------------------------------------------*/
// TODO: Ogrenci numaranizi asagidaki degiskene atayin
const long OGRENCI_NO = 130201108;
// TODO: Terminal numaranizi asagidaki degiskene atayin
const int TERM_NO = 21;
/*-------------------------------------------------------------
* AYARLAR
*------------------------------------------------------------*/
/*
soruyu gecersiz yapmak icin ilgili satiri yorum yapabilirsiniz
ornek:
// #define SORU_123
*/
#define SORU_1
#define SORU_2
#define SORU_3
#define SORU_4
#define SORU_5
#define SORU_6
#define SORU_7
/*-------------------------------------------------------------
* SORU 1
*------------------------------------------------------------*/
#ifdef SORU_1
void soru_1() {
// TODO: dizinin ilk 5 elemanina sirasiyla 1, 2, 3, 4, 5 degerlerini atayin.
int dizi[100]={1,2,3,4,5};
// ------------ ASAGIDAKI KODU DEGISTIRMEYIN ----------------
_test_1(dizi);
}
#endif /* SORU_ 1 */
/*-------------------------------------------------------------
* SORU 2
*------------------------------------------------------------*/
#ifdef SORU_2
void soru_2(int dizi[], int N) {
// TODO: dizinin ilk elemanini asagidaki degiskene atayin
int ilk=dizi[0];
// TODO: dizinin ucuncu elemanini asagidaki degiskene atayin
int bastan_ucuncu=dizi[2];
// TODO: dizinin son elemanini asagidaki degiskene atayin
int son=dizi[N-1];
// TODO: dizinin sondan ikinci elemanini asagidaki degiskene atayin
int sondan_ikinci=dizi[N-2];
// ------------ ASAGIDAKI KODU DEGISTIRMEYIN ----------------
_test_2(dizi, N, ilk, bastan_ucuncu, son, sondan_ikinci);
}
#endif /* SORU_2 */
#ifdef SORU_3
/*-------------------------------------------------------------
* SORU 3
*------------------------------------------------------------*/
int soru_3(int dizi[], int N) {
// TODO: dizinin elemanlarinin toplamini bulun ve fonksiyondan dondurun
int i,toplam=0;
for(i=0;i<=N-1;i++) {
toplam+=dizi[i];
}
return toplam;
}
#endif /* SORU_3 */
/*-------------------------------------------------------------
* SORU 4
*------------------------------------------------------------*/
#ifdef SORU_4
void soru_4(int dizi[], int N) {
/*
- @dizi 'yi kucukten buyuge dogru siralayan kodu yaziniz
*/
int i,j;
// TODO: diziyi kucukten buyuge dogru siralayiniz
for(j=1;j<N;j++) {
for(i=0;i<N-1;i++) {
if(dizi[i]>dizi[i+1]) {
dizi[i]^=dizi[i+1];
dizi[i+1]^=dizi[i];
dizi[i]^=dizi[i+1];
}
}
}
}
#endif /* SORU_4 */
/*-------------------------------------------------------------
* SORU 5
*------------------------------------------------------------*/
#ifdef SORU_5
/**
* girilen diziyi buyukten kucuge siralar
* NOT: Bu fonksiya kod yazmayin. Kodlari size hazir olarak verildi.
*/
extern void sirala_s5(int dizi[], int N);
int soru_5(int dizi[], int N) {
/*
- dizideki en buyuk 5 elemanin toplamini bulunuz
- en buyuk X tane elemani bulmanin en kolay yolu, dizinin buyukten kucuge
siralanarak ilk X tane elemanin alinmasidir.
*/
// TODO: diziyi buyukten kucuge siralayiniz
// bunun icin yukarida verilen hazir fonksiyonu (sirala_s5) kullaniniz
sirala_s5(dizi,N);
int toplam=0,i;
// TODO: en buyuk 5 elemaninin toplamini bulun ve fonksiyondan dondurunuz
for(i=0;i<5;i++){
toplam+=dizi[i];
}
return toplam;
}
#endif /* SORU_5 */
/*-------------------------------------------------------------
* SORU 6
*------------------------------------------------------------*/
#ifdef SORU_6
int soru_6(int dizi[], int N, int aranan) {
/*
- @aranan degerine sahip elemanlardan @dizi 'de kac tane oldugunu bulan
fonksiyonu yaziniz. @N dizinin eleman sayisidir
- ORNEK: {1,2,3,1,2,2,2}
aranan: 1 -> 2 dondurur
aranan: 2 -> 4 dondurur
aranan: 4 -> 0 dondurur
*/
int i, tane=0;
// TODO: sonucu bulun ve fonksiyondan dondurun
for(i=0;i<N;i++) {
if(dizi[i]==aranan) {
tane++;
}
}
return tane;
}
#endif /* SORU_6 */
/*-------------------------------------------------------------
* SORU 7
*------------------------------------------------------------*/
#ifdef SORU_7
void soru_7(int dizi[], int N) {
/*
- dizide en cok olan elemani ve kac tane oldugunu bulunuz
- ornek: {1, 1, 2, 2, 2, 3, 4}
EN_COK: 2
EN_COK_TANE: 3
- ornek: {1, 2, 3, 1} -> 2
EN_COK: 1
EN_COK_TANE: 2
*/
// TODO: soruda anlatilan islemi yapin
// TODO: en cok bulunan elemanin degerini bu degiskene atayin
int EN_COK = 0;
// TODO: en cok bulunan elemanin kac kere bulundugu bu degiskene atayin
int EN_COK_TANE = 0;
int i,j;
for(j=1;j<N;j++) {
for(i=0;i<N-1;i++) {
if(dizi[i]>dizi[i+1]) {
dizi[i]^=dizi[i+1];
dizi[i+1]^=dizi[i];
dizi[i]^=dizi[i+1];
}
}
}
int sayac=0,sayacyedek=0;
int encok=0,encokyedek=0;
encok = dizi[0];
for(i=1;i<N;i++) {
if(encok==dizi[i]) {
sayac++;
} else {
sayacyedek=sayac;
sayac=1;
encokyedek=encok;
encok=dizi[i];
}
}
if(sayac>sayacyedek) {
EN_COK=encok;
EN_COK_TANE=sayac;
} else {
EN_COK=encokyedek;
EN_COK_TANE=sayacyedek;
}
// ------------ ASAGIDAKI KODU DEGISTIRMEYIN ----------------
_test_7(dizi, N, EN_COK, EN_COK_TANE);
}
#endif /* SORU_7 */
/*-------------------------------------------------------------
* SORULAR BITTI
*------------------------------------------------------------*/
// ------------ ASAGIDAKI KODU DEGISTIRMEYIN ----------------
#include "main_end.h"
| ataniazov/KOU | Trash/billab_bdu_beta_1-linux_gcc_x86_64/main.c | C | gpl-2.0 | 5,595 |
/* include/linux/android_pmem.h
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _ANDROID_PMEM_H_
#define _ANDROID_PMEM_H_
#include <linux/fs.h>
#define PMEM_KERNEL_TEST_MAGIC 0xc0
#define PMEM_KERNEL_TEST_NOMINAL_TEST_IOCTL \
_IO(PMEM_KERNEL_TEST_MAGIC, 1)
#define PMEM_KERNEL_TEST_ADVERSARIAL_TEST_IOCTL \
_IO(PMEM_KERNEL_TEST_MAGIC, 2)
#define PMEM_KERNEL_TEST_HUGE_ALLOCATION_TEST_IOCTL \
_IO(PMEM_KERNEL_TEST_MAGIC, 3)
#define PMEM_KERNEL_TEST_FREE_UNALLOCATED_TEST_IOCTL \
_IO(PMEM_KERNEL_TEST_MAGIC, 4)
#define PMEM_KERNEL_TEST_LARGE_REGION_NUMBER_TEST_IOCTL \
_IO(PMEM_KERNEL_TEST_MAGIC, 5)
#define PMEM_IOCTL_MAGIC 'p'
#define PMEM_GET_PHYS _IOW(PMEM_IOCTL_MAGIC, 1, unsigned int)
#define PMEM_MAP _IOW(PMEM_IOCTL_MAGIC, 2, unsigned int)
#define PMEM_GET_SIZE _IOW(PMEM_IOCTL_MAGIC, 3, unsigned int)
#define PMEM_UNMAP _IOW(PMEM_IOCTL_MAGIC, 4, unsigned int)
/* This ioctl will allocate pmem space, backing the file, it will fail
* if the file already has an allocation, pass it the len as the argument
* to the ioctl */
#define PMEM_ALLOCATE _IOW(PMEM_IOCTL_MAGIC, 5, unsigned int)
/* This will connect a one pmem file to another, pass the file that is already
* backed in memory as the argument to the ioctl
*/
#define PMEM_CONNECT _IOW(PMEM_IOCTL_MAGIC, 6, unsigned int)
/* Returns the total size of the pmem region it is sent to as a pmem_region
* struct (with offset set to 0).
*/
#define PMEM_GET_TOTAL_SIZE _IOW(PMEM_IOCTL_MAGIC, 7, unsigned int)
#define PMEM_CACHE_FLUSH _IOW(PMEM_IOCTL_MAGIC, 8, unsigned int)
#define PMEM_CLEAN_INV_CACHES _IOW(PMEM_IOCTL_MAGIC, 11, unsigned int)
#define PMEM_CLEAN_CACHES _IOW(PMEM_IOCTL_MAGIC, 12, unsigned int)
#define PMEM_INV_CACHES _IOW(PMEM_IOCTL_MAGIC, 13, unsigned int)
#define PMEM_GET_FREE_SPACE _IOW(PMEM_IOCTL_MAGIC, 14, unsigned int)
#define PMEM_ALLOCATE_ALIGNED _IOW(PMEM_IOCTL_MAGIC, 15, unsigned int)
struct pmem_region {
unsigned long offset;
unsigned long len;
};
struct pmem_addr {
unsigned long vaddr;
unsigned long offset;
unsigned long length;
};
struct pmem_freespace {
unsigned long total;
unsigned long largest;
};
struct pmem_allocation {
unsigned long size;
unsigned int align;
};
#ifdef __KERNEL__
void put_pmem_fd(int fd);
void flush_pmem_fd(int fd, unsigned long start, unsigned long len);
enum pmem_allocator_type {
/* Zero is a default in platform PMEM structures in the board files,
* when the "allocator_type" structure element is not explicitly
* defined
*/
PMEM_ALLOCATORTYPE_BITMAP = 0, /* forced to be zero here */
PMEM_ALLOCATORTYPE_SYSTEM,
PMEM_ALLOCATORTYPE_ALLORNOTHING,
PMEM_ALLOCATORTYPE_BUDDYBESTFIT,
PMEM_ALLOCATORTYPE_MAX,
};
#define PMEM_MEMTYPE_MASK 0x7
#define PMEM_INVALID_MEMTYPE 0x0
#define PMEM_MEMTYPE_EBI1 0x1
#define PMEM_MEMTYPE_SMI 0x2
#define PMEM_MEMTYPE_RESERVED_INVALID2 0x3
#define PMEM_MEMTYPE_RESERVED_INVALID3 0x4
#define PMEM_MEMTYPE_RESERVED_INVALID4 0x5
#define PMEM_MEMTYPE_RESERVED_INVALID5 0x6
#define PMEM_MEMTYPE_RESERVED_INVALID6 0x7
#define PMEM_ALIGNMENT_MASK 0x18
#define PMEM_ALIGNMENT_RESERVED_INVALID1 0x0
#define PMEM_ALIGNMENT_4K 0x8 /* the default */
#define PMEM_ALIGNMENT_1M 0x10
#define PMEM_ALIGNMENT_RESERVED_INVALID2 0x18
/* kernel api names for board specific data structures */
#define PMEM_KERNEL_EBI1_DATA_NAME "pmem_kernel_ebi1"
#define PMEM_KERNEL_SMI_DATA_NAME "pmem_kernel_smi"
struct android_pmem_platform_data
{
const char* name;
/* starting physical address of memory region */
unsigned long start;
/* size of memory region */
unsigned long size;
enum pmem_allocator_type allocator_type;
/* set to indicate the region should not be managed with an allocator */
enum pmem_allocator_type no_allocator;
/* treated as a 'hidden' variable in the board files. Can be
* set, but default is the system init value of 0 which becomes a
* quantum of 4K pages.
*/
unsigned int quantum;
/* set to indicate maps of this region should be cached, if a mix of
* cached and uncached is desired, set this and open the device with
* O_SYNC to get an uncached region */
unsigned cached;
/* The MSM7k has bits to enable a write buffer in the bus controller*/
unsigned buffered;
/* This PMEM is on memory that may be powered off */
unsigned unstable;
};
/* flags in the following function defined as above. */
int32_t pmem_kalloc(const size_t size, const uint32_t flags);
int32_t pmem_kfree(const int32_t physaddr);
#ifdef CONFIG_ANDROID_PMEM
#ifndef CONFIG_ARCH_MSM8X60
int is_pmem_file(struct file *file);
#endif
unsigned long get_pmem_id_addr(int id);
int get_pmem_file(unsigned int fd, unsigned long *start, unsigned long *vstart,
unsigned long *end, struct file **filp);
int get_pmem_user_addr(struct file *file, unsigned long *start,
unsigned long *end);
void put_pmem_file(struct file* file);
void flush_pmem_file(struct file *file, unsigned long start, unsigned long len);
int pmem_setup(struct android_pmem_platform_data *pdata,
long (*ioctl)(struct file *, unsigned int, unsigned long),
int (*release)(struct inode *, struct file *));
int pmem_remap(struct pmem_region *region, struct file *file,
unsigned operation);
#else
static inline int is_pmem_file(struct file *file) { return 0; }
static inline int get_pmem_file(int fd, unsigned long *start,
unsigned long *vstart, unsigned long *end,
struct file **filp) { return -ENOSYS; }
static inline int get_pmem_user_addr(struct file *file, unsigned long *start,
unsigned long *end) { return -ENOSYS; }
static inline void put_pmem_file(struct file* file) { return; }
static inline void flush_pmem_file(struct file *file, unsigned long start,
unsigned long len) { return; }
static inline int pmem_setup(struct android_pmem_platform_data *pdata,
long (*ioctl)(struct file *, unsigned int, unsigned long),
int (*release)(struct inode *, struct file *)) { return -ENOSYS; }
static inline int pmem_remap(struct pmem_region *region, struct file *file,
unsigned operation) { return -ENOSYS; }
#endif
#endif //_ANDROID_PPP_H_
#endif
| TeamFreedom/mecha-2.6.35-gb-mr | include/linux/android_pmem.h | C | gpl-2.0 | 6,623 |
/**
Driver for 3DLabs Permedia 2.
Copyright (C) 2002 Måns Rullgård
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
#include <unistd.h>
#include "vidix.h"
#include "fourcc.h"
#include "libdha.h"
#include "pci_ids.h"
#include "pci_names.h"
#include "glint_regs.h"
#define VIDIX_STATIC pm2_
/* MBytes of video memory to use */
#define PM2_VIDMEM 6
#if 0
#define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
#define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
#else
#define TRACE_ENTER()
#define TRACE_EXIT()
#endif
#define WRITE_REG(offset,val) \
*(volatile u_long *)(((u_char *)(pm2_reg_base)) + offset) = (val)
#define READ_REG(offset) \
*(volatile unsigned long *)(((unsigned char *)(pm2_reg_base)) + offset)
pciinfo_t pci_info;
void *pm2_reg_base;
void *pm2_mem;
int pm2_vidmem = PM2_VIDMEM;
static vidix_capability_t pm2_cap =
{
"3DLabs Permedia2 driver",
"Måns Rullgård <mru@users.sf.net>",
TYPE_OUTPUT,
{ 0, 0, 0, 0 },
2048,
2048,
4,
4,
-1,
FLAG_UPSCALER|FLAG_DOWNSCALER,
VENDOR_3DLABS,
-1,
{ 0, 0, 0, 0 }
};
unsigned int VIDIX_NAME(vixGetVersion)(void)
{
return(VIDIX_VERSION);
}
static u_int pm2_card_ids[] =
{
(VENDOR_3DLABS << 16) | DEVICE_3DLABS_PERMEDIA2,
(VENDOR_TEXAS << 16) | DEVICE_TEXAS_TVP4020_PERMEDIA_2
};
static int find_chip(u_int vendor, u_int chip_id)
{
u_int vci = (vendor << 16) | chip_id;
unsigned i;
for(i = 0; i < sizeof(pm2_card_ids)/sizeof(u_int); i++){
if(vci == pm2_card_ids[i]) return i;
}
return -1;
}
int VIDIX_NAME(vixProbe)(int verbose, int force)
{
pciinfo_t lst[MAX_PCI_DEVICES];
unsigned i,num_pci;
int err;
err = pci_scan(lst,&num_pci);
if(err)
{
printf("[pm2] Error occured during pci scan: %s\n",strerror(err));
return err;
}
else
{
err = ENXIO;
for(i=0; i < num_pci; i++)
{
int idx;
const char *dname;
idx = find_chip(lst[i].vendor, lst[i].device);
if(idx == -1)
continue;
dname = pci_device_name(lst[i].vendor, lst[i].device);
dname = dname ? dname : "Unknown chip";
printf("[pm2] Found chip: %s\n", dname);
pm2_cap.device_id = lst[i].device;
err = 0;
memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
break;
}
}
if(err && verbose) printf("[pm2] Can't find chip.\n");
return err;
}
#define PRINT_REG(reg) \
{ \
long _foo = READ_REG(reg); \
printf("[pm2] " #reg " (%x) = %#lx (%li)\n", reg, _foo, _foo); \
}
int VIDIX_NAME(vixInit)(const char *args)
{
char *vm;
pm2_reg_base = map_phys_mem(pci_info.base0, 0x10000);
pm2_mem = map_phys_mem(pci_info.base1, 1 << 23);
if((vm = getenv("PM2_VIDMEM"))){
pm2_vidmem = strtol(vm, NULL, 0);
}
return 0;
}
void VIDIX_NAME(vixDestroy)(void)
{
unmap_phys_mem(pm2_reg_base, 0x10000);
unmap_phys_mem(pm2_mem, 1 << 23);
}
int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to)
{
memcpy(to, &pm2_cap, sizeof(vidix_capability_t));
return 0;
}
static int is_supported_fourcc(uint32_t fourcc)
{
switch(fourcc){
case IMGFMT_YUY2:
return 1;
default:
return 0;
}
}
int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to)
{
if(is_supported_fourcc(to->fourcc))
{
to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
VID_DEPTH_4BPP | VID_DEPTH_8BPP |
VID_DEPTH_12BPP| VID_DEPTH_15BPP|
VID_DEPTH_16BPP| VID_DEPTH_24BPP|
VID_DEPTH_32BPP;
to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
return 0;
}
else to->depth = to->flags = 0;
return ENOSYS;
}
#define FORMAT_YUV422 ((1 << 6) | 3 | (1 << 4))
#define PPROD(a,b,c) (a | (b << 3) | (c << 6))
static u_int ppcodes[][2] = {
{0, 0},
{32, PPROD(1, 0, 0)},
{64, PPROD(1, 1, 0)},
{96, PPROD(1, 1, 1)},
{128, PPROD(2, 1, 1)},
{160, PPROD(2, 2, 1)},
{192, PPROD(2, 2, 2)},
{224, PPROD(3, 2, 1)},
{256, PPROD(3, 2, 2)},
{288, PPROD(3, 3, 1)},
{320, PPROD(3, 3, 2)},
{384, PPROD(3, 3, 3)},
{416, PPROD(4, 3, 1)},
{448, PPROD(4, 3, 2)},
{512, PPROD(4, 3, 3)},
{544, PPROD(4, 4, 1)},
{576, PPROD(4, 4, 2)},
{640, PPROD(4, 4, 3)},
{768, PPROD(4, 4, 4)},
{800, PPROD(5, 4, 1)},
{832, PPROD(5, 4, 2)},
{896, PPROD(5, 4, 3)},
{1024, PPROD(5, 4, 4)},
{1056, PPROD(5, 5, 1)},
{1088, PPROD(5, 5, 2)},
{1152, PPROD(5, 5, 3)},
{1280, PPROD(5, 5, 4)},
{1536, PPROD(5, 5, 5)},
{1568, PPROD(6, 5, 1)},
{1600, PPROD(6, 5, 2)},
{1664, PPROD(6, 5, 3)},
{1792, PPROD(6, 5, 4)},
{2048, PPROD(6, 5, 5)}
};
static int frames[VID_PLAY_MAXFRAMES];
int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info)
{
u_int src_w, drw_w;
u_int src_h, drw_h;
long base0;
u_int stride, sstr;
u_int format;
unsigned int i;
u_int ppcode = 0, sppc = 0;
u_int pitch = 0;
TRACE_ENTER();
switch(info->fourcc){
case IMGFMT_YUY2:
format = FORMAT_YUV422;
break;
default:
return -1;
}
src_w = info->src.w;
src_h = info->src.h;
drw_w = info->dest.w;
drw_h = info->dest.h;
sstr = READ_REG(PMScreenStride) * 2;
stride = 0;
for(i = 1; i < sizeof(ppcodes) / sizeof(ppcodes[0]); i++){
if((!stride) && (ppcodes[i][0] >= src_w)){
stride = ppcodes[i][0];
ppcode = ppcodes[i][1];
pitch = ppcodes[i][0] - ppcodes[i-1][0];
}
if(ppcodes[i][0] == sstr)
sppc = ppcodes[i][1];
}
if(!stride)
return -1;
info->num_frames = pm2_vidmem*1024*1024 / (stride * src_h * 2);
if(info->num_frames > VID_PLAY_MAXFRAMES)
info->num_frames = VID_PLAY_MAXFRAMES;
/* Use end of video memory. Assume the card has 8 MB */
base0 = (8 - pm2_vidmem)*1024*1024;
info->dga_addr = pm2_mem + base0;
info->dest.pitch.y = pitch*2;
info->dest.pitch.u = 0;
info->dest.pitch.v = 0;
info->offset.y = 0;
info->offset.v = 0;
info->offset.u = 0;
info->frame_size = stride * src_h * 2;
for(i = 0; i < info->num_frames; i++){
info->offsets[i] = info->frame_size * i;
frames[i] = (base0 + info->offsets[i]) >> 1;
}
WRITE_REG(WindowOrigin, 0);
WRITE_REG(dY, 1 << 16);
WRITE_REG(RasterizerMode, 0);
WRITE_REG(ScissorMode, 0);
WRITE_REG(AreaStippleMode, 0);
WRITE_REG(StencilMode, 0);
WRITE_REG(TextureAddressMode, 1);
WRITE_REG(dSdyDom, 0);
WRITE_REG(dTdx, 0);
WRITE_REG(PMTextureMapFormat, (1 << 19) | ppcode);
WRITE_REG(PMTextureDataFormat, format);
WRITE_REG(PMTextureReadMode, (1 << 17) | /* FilterMode */
(11 << 13) | (11 << 9) /* TextureSize log2 */ | 1);
WRITE_REG(ColorDDAMode, 0);
WRITE_REG(TextureColorMode, (0 << 4) /* RGB */ | (3 << 1) /* Copy */ | 1);
WRITE_REG(AlphaBlendMode, 0);
WRITE_REG(DitherMode, (1 << 10) | 1);
WRITE_REG(LogicalOpMode, 0);
WRITE_REG(FBReadMode, sppc);
WRITE_REG(FBHardwareWriteMask, 0xFFFFFFFF);
WRITE_REG(FBWriteMode, 1);
WRITE_REG(YUVMode, 1);
WRITE_REG(SStart, 0);
WRITE_REG(TStart, 0);
WRITE_REG(dSdx, (src_w << 20) / drw_w);
WRITE_REG(dTdyDom, (src_h << 20) / drw_h);
WRITE_REG(RectangleOrigin, info->dest.x | (info->dest.y << 16));
WRITE_REG(RectangleSize, (drw_h << 16) | drw_w);
TRACE_EXIT();
return 0;
}
int VIDIX_NAME(vixPlaybackOn)(void)
{
TRACE_ENTER();
TRACE_EXIT();
return 0;
}
int VIDIX_NAME(vixPlaybackOff)(void)
{
WRITE_REG(YUVMode, 0);
WRITE_REG(TextureColorMode, 0);
WRITE_REG(TextureAddressMode, 0);
WRITE_REG(TextureReadMode, 0);
return 0;
}
int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame)
{
WRITE_REG(PMTextureBaseAddress, frames[frame]);
WRITE_REG(Render, PrimitiveRectangle | XPositive | YPositive |
TextureEnable);
return 0;
}
| huceke/xine-lib-vaapi | contrib/vidix/drivers/pm2_vid.c | C | gpl-2.0 | 8,632 |
<?php
global $iclTranslationManagement;
$selected_translator = $iclTranslationManagement->get_selected_translator();
?>
<div class="wrap">
<div id="icon-wpml" class="icon32"><br /></div>
<h2><?php echo __('Translation management', 'wpml-translation-management') ?></h2>
<?php do_action('icl_tm_messages'); ?>
<a class="nav-tab <?php if(!isset($_GET['sm']) || (isset($_GET['sm']) && $_GET['sm']=='dashboard')): ?> nav-tab-active<?php endif;?>"
href="admin.php?page=<?php echo WPML_TM_FOLDER ?>/menu/main.php&sm=dashboard"><?php _e('Translation Dashboard', 'wpml-translation-management') ?></a>
<?php if ( current_user_can('list_users')): ?>
<a class="nav-tab<?php if(isset($_GET['sm']) && $_GET['sm']=='translators'): ?> nav-tab-active<?php endif;?>"
href="admin.php?page=<?php echo WPML_TM_FOLDER ?>/menu/main.php&sm=translators"><?php _e('Translators', 'wpml-translation-management') ?></a>
<?php endif; ?>
<a class="nav-tab <?php if(isset($_GET['sm']) && $_GET['sm']=='jobs'): ?> nav-tab-active<?php endif;?>"
href="admin.php?page=<?php echo WPML_TM_FOLDER ?>/menu/main.php&sm=jobs"><?php _e('Translation Jobs', 'wpml-translation-management') ?></a>
<a class="nav-tab <?php if(isset($_GET['sm']) && $_GET['sm']=='mcsetup'): ?> nav-tab-active<?php endif;?>"
href="admin.php?page=<?php echo WPML_TM_FOLDER ?>/menu/main.php&sm=mcsetup"><?php _e('Multilingual Content Setup', 'wpml-translation-management') ?></a>
<a class="nav-tab <?php if(isset($_GET['sm']) && $_GET['sm']=='notifications'): ?> nav-tab-active<?php endif;?>"
href="admin.php?page=<?php echo WPML_TM_FOLDER ?>/menu/main.php&sm=notifications"><?php _e('Translation Notifications', 'wpml-translation-management') ?></a>
<div class="icl_tm_wrap">
<?php
switch(@$_GET['sm']){
case 'translators':
include dirname(__FILE__) . '/sub/translators.php';
break;
case 'jobs':
include dirname(__FILE__) . '/sub/jobs.php';
break;
case 'mcsetup':
include dirname(__FILE__) . '/sub/mcsetup.php';
break;
case 'notifications':
include dirname(__FILE__) . '/sub/notifications.php';
break;
default:
include dirname(__FILE__) . '/sub/dashboard.php';
}
?>
</div>
</div>
| RemanenceStudio/StudioSon | wp-content/plugins/wpml-translation-management/menu/main.php | PHP | gpl-2.0 | 2,510 |
/** \file server/main.c
* Contains main(), plus signal callback functions and a help screen.
*
* Program init, command-line handling, and the main loop are
* implemented here. Also, minimal data about the program such as
* the revision number.
*
* Some of this stuff should probably be move elsewhere eventually,
* such as command-line handling and the main loop. main() is supposed
* to be "dumb".
*/
/* This file is part of LCDd, the lcdproc server.
*
* This file is released under the GNU General Public License.
* Refer to the COPYING file distributed with this package.
*
* Copyright (c) 1999, William Ferrell, Selene Scriven
* 2001, Joris Robijn
* 2001, Rene Wagner
* 2002, Mike Patnode
* 2002, Guillaume Filion
* 2005-2006, Peter Marschall (cleanup)
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/wait.h>
#include <errno.h>
#include <math.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/types.h>
#include <limits.h>
#include "getopt.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
/* TODO: fill in what to include otherwise */
#include "shared/report.h"
#include "shared/defines.h"
#include "drivers.h"
#include "sock.h"
#include "clients.h"
#include "screen.h"
#include "screenlist.h"
#include "parse.h"
#include "render.h"
#include "serverscreens.h"
#include "menuscreens.h"
#include "input.h"
#include "shared/configfile.h"
#include "drivers.h"
#include "main.h"
#if !defined(SYSCONFDIR)
# define SYSCONFDIR "/etc"
#endif
#define DEFAULT_BIND_ADDR "127.0.0.1"
#define DEFAULT_BIND_PORT LCDPORT
#define DEFAULT_CONFIGFILE SYSCONFDIR "/LCDd.conf"
#define DEFAULT_USER "nobody"
#define DEFAULT_DRIVER "curses"
#define DEFAULT_DRIVER_PATH "" /* not needed */
#define MAX_DRIVERS 8
#define DEFAULT_FOREGROUND_MODE 0
#define DEFAULT_ROTATE_SERVER_SCREEN SERVERSCREEN_ON
#define DEFAULT_REPORTDEST RPT_DEST_STDERR
#define DEFAULT_REPORTLEVEL RPT_WARNING
#define DEFAULT_SCREEN_DURATION 32
#define DEFAULT_BACKLIGHT BACKLIGHT_OPEN
#define DEFAULT_HEARTBEAT HEARTBEAT_OPEN
#define DEFAULT_TITLESPEED TITLESPEED_MAX
#define DEFAULT_AUTOROTATE AUTOROTATE_ON
/* Socket to bind to...
Using loopback is much more secure; it means that this port is
accessible only to programs running locally on the same host as LCDd.
Using variables for these means that (later) we can select which port
and which address to bind to at run time. */
/* Store some standard defines into vars... */
char *version = VERSION;
char *protocol_version = PROTOCOL_VERSION;
char *api_version = API_VERSION;
char *build_date = __DATE__;
/**** Configuration variables ****/
/* Some variables are settable on the command line. This are variables that
* change the mode of operation. This includes settings that you can use to
* enable debugging: driver selection, report settings, bind address etc.
* These variables should be in main.h and main.c (below).
*
* All other settings do not need to be settable from the command line. They
* also do not necesarily need to be read in main.c but can better be read in
* in the file concerned.
*/
unsigned int bind_port = UNSET_INT;
char bind_addr[64]; /* Do not preinit these strings as they will occupy */
char configfile[256]; /* a lot of space in the executable. */
char user[64]; /* The values will be overwritten anyway... */
/* The drivers and their driver parameters */
char *drivernames[MAX_DRIVERS];
int num_drivers = 0;
/* End of configuration variables */
/* Local variables */
static int foreground_mode = UNSET_INT;
static int report_dest = UNSET_INT;
static int report_level = UNSET_INT;
static int stored_argc;
static char **stored_argv;
static volatile short got_reload_signal = 0;
/* Local exported variables */
long timer = 0;
/**** Local functions ****/
static void clear_settings(void);
static int process_command_line(int argc, char **argv);
static int process_configfile(char *cfgfile);
static void set_default_settings(void);
static void install_signal_handlers(int allow_reload);
static void child_ok_func(int signal);
static pid_t daemonize(void);
static int wave_to_parent(pid_t parent_pid);
static int init_drivers(void);
static int drop_privs(char *user);
static void do_reload(void);
static void do_mainloop(void);
static void exit_program(int val);
static void catch_reload_signal(int val);
static int interpret_boolean_arg(char *s);
static void output_help_screen(void);
static void output_GPL_notice(void);
#define CHAIN(e,f) { if (e>=0) { e=(f); }}
#define CHAIN_END(e,msg) { if (e<0) { report(RPT_CRIT,(msg)); exit(EXIT_FAILURE); }}
int
main(int argc, char **argv)
{
int e = 0;
pid_t parent_pid = 0;
stored_argc = argc;
stored_argv = argv;
/*
* Settings in order of preference:
*
* 1: Settings specified in command line options...
* 2: Settings specified in configuration file...
* 3: Default settings
*
* Because of this, and because one option (-c) specifies where
* the configuration file is, things are done in this order:
*
* 1. Read and set options.
* 2. Read configuration file; if option is read in configuration
* file and not already set, then set it.
* 3. Having read configuration file, if parameter is not set,
* set it to the default value.
*
* It is for this reason that the default values are **NOT** set
* in the variable declaration...
*/
/* Report that server is starting (report will be delayed) */
report(RPT_NOTICE, "LCDd version %s starting", version);
report(RPT_INFO, "Built on %s, protocol version %s, API version %s",
build_date, protocol_version, api_version);
clear_settings();
/* Read command line*/
CHAIN(e, process_command_line(argc, argv));
/* Read config file
* If config file was not given on command line use default */
if (strcmp(configfile, UNSET_STR) == 0)
strncpy(configfile, DEFAULT_CONFIGFILE, sizeof(configfile));
CHAIN(e, process_configfile(configfile));
/* Set default values*/
set_default_settings();
/* Set reporting settings (will also flush delayed reports) */
set_reporting("LCDd", report_level, report_dest);
report(RPT_INFO, "Set report level to %d, output to %s", report_level,
((report_dest == RPT_DEST_SYSLOG) ? "syslog" : "stderr"));
CHAIN_END(e, "Critical error while processing settings, abort.");
/* Now, go into daemon mode (if we should)...
* We wait for the child to report it is running OK. This mechanism
* is used because forking after starting the drivers causes the
* child to loose the (LPT) port access. */
if (!foreground_mode) {
report(RPT_INFO, "Server forking to background");
CHAIN(e, parent_pid = daemonize());
} else {
output_GPL_notice();
report(RPT_INFO, "Server running in foreground");
}
install_signal_handlers(!foreground_mode);
/* Only catch SIGHUP if not in foreground mode */
/* Startup the subparts of the server */
CHAIN(e, sock_init(bind_addr, bind_port));
CHAIN(e, screenlist_init());
CHAIN(e, init_drivers());
CHAIN(e, clients_init());
CHAIN(e, input_init());
CHAIN(e, menuscreens_init());
CHAIN(e, server_screen_init());
CHAIN_END(e, "Critical error while initializing, abort.");
if (!foreground_mode) {
/* Tell to parent that startup went OK. */
wave_to_parent(parent_pid);
}
drop_privs(user); /* This can't be done before, because sending a
signal to a process of a different user will fail */
do_mainloop();
/* This loop never stops; we'll get out only with a signal...*/
return 0;
}
static void
clear_settings(void)
{
int i;
debug(RPT_DEBUG, "%s()", __FUNCTION__);
bind_port = UNSET_INT;
strncpy(bind_addr, UNSET_STR, sizeof(bind_addr));
strncpy(configfile, UNSET_STR, sizeof(configfile));
strncpy(user, UNSET_STR, sizeof(user));
foreground_mode = UNSET_INT;
rotate_server_screen = UNSET_INT;
backlight = UNSET_INT;
heartbeat = UNSET_INT;
titlespeed = UNSET_INT;
default_duration = UNSET_INT;
report_dest = UNSET_INT;
report_level = UNSET_INT;
for (i = 0; i < num_drivers; i++) {
free(drivernames[i]);
drivernames[i] = NULL;
}
num_drivers = 0;
}
/* parses arguments given on command line */
static int
process_command_line(int argc, char **argv)
{
int c, b;
int e = 0, help = 0;
debug(RPT_DEBUG, "%s(argc=%d, argv=...)", __FUNCTION__, argc);
/* Reset getopt */
opterr = 0; /* Prevent some messages to stderr */
/* Analyze options here.. (please try to keep list of options the
* same everywhere) */
while ((c = getopt(argc, argv, "hc:d:fa:p:u:w:s:r:i:")) > 0) {
switch(c) {
case 'h':
help = 1; /* Continue to process the other
* options */
break;
case 'c':
strncpy(configfile, optarg, sizeof(configfile));
configfile[sizeof(configfile)-1] = '\0'; /* Terminate string */
break;
case 'd':
/* Add to a list of drivers to be initialized later...*/
if (num_drivers < MAX_DRIVERS) {
drivernames[num_drivers] = strdup(optarg);
if (drivernames[num_drivers] != NULL) {
num_drivers++;
}
else {
report(RPT_ERR, "alloc error storing driver name: %s", optarg);
e = -1;
}
} else {
report(RPT_ERR, "Too many drivers!");
e = -1;
}
break;
case 'f':
foreground_mode = 1;
break;
case 'a':
strncpy(bind_addr, optarg, sizeof(bind_addr));
bind_addr[sizeof(bind_addr)-1] = '\0'; /* Terminate string */
break;
case 'p':
bind_port = atoi(optarg);
break;
case 'u':
strncpy(user, optarg, sizeof(user));
user[sizeof(user)-1] = '\0'; /* Terminate string */
break;
case 'w':
default_duration = (int) (atof(optarg) * 1e6 / TIME_UNIT);
if (default_duration * TIME_UNIT < 2e6) {
report(RPT_ERR, "Waittime should be at least 2 (seconds), not %.8s", optarg);
e = -1;
}
break;
case 's':
b = interpret_boolean_arg(optarg);
if (b == -1) {
report(RPT_ERR, "Not a boolean value: '%s'", optarg);
e = -1;
} else {
report_dest = (b) ? RPT_DEST_SYSLOG : RPT_DEST_STDERR;
}
break;
case 'r':
report_level = atoi(optarg);
break;
case 'i':
b = interpret_boolean_arg(optarg);
if (b == -1) {
report(RPT_ERR, "Not a boolean value: '%s'", optarg);
e = -1;
} else {
rotate_server_screen = b;
}
break;
case '?':
/* For some reason getopt also returns an '?'
* when an option argument is mission... */
report(RPT_ERR, "Unknown option: '%c'", optopt);
e = -1;
break;
case ':':
report(RPT_ERR, "Missing option argument!");
e = -1;
break;
}
}
if (optind < argc) {
report(RPT_ERR, "Non-option arguments on the command line !");
e = -1;
}
if (help) {
output_help_screen();
e = -1;
}
return e;
}
/* reads and parses configuration file */
static int
process_configfile(char *configfile)
{
debug(RPT_DEBUG, "%s()", __FUNCTION__);
/* Read server settings*/
if (config_read_file(configfile) != 0) {
report(RPT_CRIT, "Could not read config file: %s", configfile);
return -1;
}
if (bind_port == UNSET_INT)
bind_port = config_get_int("Server", "Port", 0, UNSET_INT);
if (strcmp(bind_addr, UNSET_STR) == 0)
strncpy(bind_addr, config_get_string("Server", "Bind", 0, UNSET_STR), sizeof(bind_addr));
if (strcmp(user, UNSET_STR) == 0)
strncpy(user, config_get_string("Server", "User", 0, UNSET_STR), sizeof(user));
if (default_duration == UNSET_INT) {
default_duration = (config_get_float("Server", "WaitTime", 0, 0) * 1e6 / TIME_UNIT);
if (default_duration == 0)
default_duration = UNSET_INT;
else if (default_duration * TIME_UNIT < 2e6) {
report(RPT_WARNING, "Waittime should be at least 2 (seconds). Set to 2 seconds.");
default_duration = 2e6 / TIME_UNIT;
}
}
if (foreground_mode == UNSET_INT) {
int fg = config_get_bool("Server", "Foreground", 0, UNSET_INT);
if (fg != UNSET_INT)
foreground_mode = fg;
}
if (rotate_server_screen == UNSET_INT) {
rotate_server_screen = config_get_tristate("Server", "ServerScreen", 0, "blank", UNSET_INT);
}
if (backlight == UNSET_INT) {
backlight = config_get_tristate("Server", "Backlight", 0, "open", UNSET_INT);
}
if (heartbeat == UNSET_INT) {
heartbeat = config_get_tristate("Server", "Heartbeat", 0, "open", UNSET_INT);
}
if (autorotate == UNSET_INT) {
autorotate = config_get_bool("Server", "AutoRotate", 0, DEFAULT_AUTOROTATE);
}
if (titlespeed == UNSET_INT) {
int speed = config_get_int("Server", "TitleSpeed", 0, DEFAULT_TITLESPEED);
/* set titlespeed */
titlespeed = (speed <= TITLESPEED_NO)
? TITLESPEED_NO
: min(speed, TITLESPEED_MAX);
}
if (report_dest == UNSET_INT) {
int rs = config_get_bool("Server", "ReportToSyslog", 0, UNSET_INT);
if (rs != UNSET_INT)
report_dest = (rs) ? RPT_DEST_SYSLOG : RPT_DEST_STDERR;
}
if (report_level == UNSET_INT) {
report_level = config_get_int("Server", "ReportLevel", 0, UNSET_INT);
}
/* Read drivers */
/* If drivers have been specified on the command line, then do not
* use the driver list from the config file.
*/
if (num_drivers == 0) {
/* loop over all the Driver= directives to read the driver names */
while (1) {
const char *s = config_get_string("Server", "Driver", num_drivers, NULL);
if (s == NULL)
break;
if (s[0] != '\0') {
drivernames[num_drivers] = strdup(s);
if (drivernames[num_drivers] == NULL) {
report(RPT_ERR, "alloc error storing driver name: %s", s);
exit(EXIT_FAILURE);
}
num_drivers++;
}
}
}
return 0;
}
static void
set_default_settings(void)
{
debug(RPT_DEBUG, "%s()", __FUNCTION__);
/* Set defaults into unfilled variables... */
if (bind_port == UNSET_INT)
bind_port = DEFAULT_BIND_PORT;
if (strcmp(bind_addr, UNSET_STR) == 0)
strncpy(bind_addr, DEFAULT_BIND_ADDR, sizeof(bind_addr));
if (strcmp(user, UNSET_STR) == 0)
strncpy(user, DEFAULT_USER, sizeof(user));
if (foreground_mode == UNSET_INT)
foreground_mode = DEFAULT_FOREGROUND_MODE;
if (rotate_server_screen == UNSET_INT)
rotate_server_screen = DEFAULT_ROTATE_SERVER_SCREEN;
if (default_duration == UNSET_INT)
default_duration = DEFAULT_SCREEN_DURATION;
if (backlight == UNSET_INT)
backlight = DEFAULT_BACKLIGHT;
if (heartbeat == UNSET_INT)
heartbeat = DEFAULT_HEARTBEAT;
if (titlespeed == UNSET_INT)
titlespeed = DEFAULT_TITLESPEED;
if (report_dest == UNSET_INT)
report_dest = DEFAULT_REPORTDEST;
if (report_level == UNSET_INT)
report_level = DEFAULT_REPORTLEVEL;
/* Use default driver */
if (num_drivers == 0) {
drivernames[0] = strdup(DEFAULT_DRIVER);
if (drivernames[0] == NULL) {
report(RPT_ERR, "alloc error storing driver name: %s", DEFAULT_DRIVER);
exit(EXIT_FAILURE);
}
num_drivers = 1;
}
}
static void
install_signal_handlers(int allow_reload)
{
/* Installs signal handlers so that the program does clean exit and
* can also receive a reload signal.
* sigaction() is favoured over signal() */
struct sigaction sa;
debug(RPT_DEBUG, "%s(allow_reload=%d)", __FUNCTION__, allow_reload);
sigemptyset(&(sa.sa_mask));
/* Clients can cause SIGPIPE if they quit unexpectedly, and the
* default action is to kill the server. Just ignore it. */
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, NULL);
sa.sa_handler = exit_program;
#ifdef HAVE_SA_RESTART
sa.sa_flags = SA_RESTART;
#endif
sigaction(SIGINT, &sa, NULL); /* Ctrl-C will cause a clean exit...*/
sigaction(SIGTERM, &sa, NULL); /* and "kill"...*/
if (allow_reload) {
sa.sa_handler = catch_reload_signal;
/* On SIGHUP reread config and restart the drivers ! */
}
else {
/* Treat this signal just like INT and TERM */
}
sigaction(SIGHUP, &sa, NULL);
}
static void
child_ok_func(int signal)
{
/* We only catch this signal to be sure the child runs OK. */
debug(RPT_INFO, "%s(signal=%d)", __FUNCTION__, signal);
/* Exit now ! because of bug? in wait() */
_exit(EXIT_SUCCESS); /* Parent exits normally. */
}
static pid_t
daemonize(void)
{
pid_t child;
pid_t parent;
int child_status;
struct sigaction sa;
debug(RPT_DEBUG, "%s()", __FUNCTION__);
parent = getpid();
debug(RPT_INFO, "parent = %d", parent);
/* Install handler at parent for child's signal */
/* sigaction should be more portable than signal, but it does not
* work for some reason. */
sa.sa_handler = child_ok_func;
sigemptyset(&(sa.sa_mask));
sa.sa_flags = SA_RESTART;
sigaction(SIGUSR1, &sa, NULL);
/* Do the fork */
switch ((child = fork())) {
case -1:
report(RPT_ERR, "Could not fork");
return -1;
case 0: /* We are the child */
break;
default: /* We are the parent */
debug(RPT_INFO, "child = %d", child);
wait(&child_status);
/* BUG? According to the man page wait() should also return
* when a signal comes in that is caught. Instead it
* continues to wait. */
if (WIFEXITED(child_status)) {
/* Child exited normally, probably because of some
* error. */
debug(RPT_INFO, "Child has terminated!");
exit(WEXITSTATUS(child_status));
/* Parent exits with same status as child did... */
}
/* Child is still running and has signalled it's OK.
* This means the parent can now rest in peace. */
debug(RPT_INFO, "Got OK signal from child.");
exit(EXIT_SUCCESS); /* Parent exits normally. */
}
/* At this point we are always the child. */
/* Reset signal handler */
sa.sa_handler = SIG_DFL;
sigaction(SIGUSR1, &sa, NULL);
setsid(); /* Create a new session because otherwise we'll
* catch a SIGHUP when the shell is closed. */
return parent;
}
static int
wave_to_parent(pid_t parent_pid)
{
debug(RPT_DEBUG, "%s(parent_pid=%d)", __FUNCTION__, parent_pid);
kill(parent_pid, SIGUSR1);
return 0;
}
static int
init_drivers(void)
{
int i, res;
int output_loaded = 0;
debug(RPT_DEBUG, "%s()", __FUNCTION__);
for (i = 0; i < num_drivers; i++) {
res = drivers_load_driver(drivernames[i]);
if (res >= 0) {
/* Load went OK */
switch(res) {
case 0: /* Driver does input only */
break;
case 1: /* Driver does output */
output_loaded = 1;
break;
case 2: /* Driver does output in foreground (don't daemonize) */
foreground_mode = 1;
output_loaded = 1;
break;
}
} else {
report(RPT_ERR, "Could not load driver %.40s", drivernames[i]);
}
}
/* Do we have a running output driver ?*/
if (output_loaded) {
return 0;
} else {
report(RPT_ERR, "There is no output driver");
return -1;
}
}
static int
drop_privs(char *user)
{
struct passwd *pwent;
debug(RPT_DEBUG, "%s(user=\"%.40s\")", __FUNCTION__, user);
if (getuid() == 0 || geteuid() == 0) {
if ((pwent = getpwnam(user)) == NULL) {
report(RPT_ERR, "User %.40s not a valid user!", user);
return -1;
} else {
if (setuid(pwent->pw_uid) < 0) {
report(RPT_ERR, "Unable to switch to user %.40s", user);
return -1;
}
}
}
return 0;
}
static void
do_reload(void)
{
int e = 0;
drivers_unload_all(); /* Close all drivers */
config_clear();
clear_settings();
/* Reread command line*/
CHAIN(e, process_command_line(stored_argc, stored_argv));
/* Reread config file */
if (strcmp(configfile, UNSET_STR)==0)
strncpy(configfile, DEFAULT_CONFIGFILE, sizeof(configfile));
CHAIN(e, process_configfile(configfile));
/* Set default values */
CHAIN(e, (set_default_settings(), 0));
/* Set reporting values */
CHAIN(e, set_reporting("LCDd", report_level, report_dest));
CHAIN(e, (report(RPT_INFO, "Set report level to %d, output to %s", report_level,
((report_dest == RPT_DEST_SYSLOG) ? "syslog" : "stderr")), 0));
/* And restart the drivers */
CHAIN(e, init_drivers());
CHAIN_END(e, "Critical error while reloading, abort.");
}
static void
do_mainloop(void)
{
Screen *s;
struct timeval t;
struct timeval last_t;
int sleeptime;
long int process_lag = 0;
long int render_lag = 0;
long int t_diff;
debug(RPT_DEBUG, "%s()", __FUNCTION__);
gettimeofday(&t, NULL); /* Get initial time */
while (1) {
/* Get current time */
last_t = t;
gettimeofday(&t, NULL);
t_diff = t.tv_sec - last_t.tv_sec;
if ( ((t_diff + 1) > (LONG_MAX / 1e6)) || (t_diff < 0) ) {
/* We're going to overflow the calculation - probably been to sleep, fudge the values */
t_diff = 0;
process_lag = 1;
render_lag = (1e6/RENDER_FREQ);
} else {
t_diff *= 1e6;
t_diff += t.tv_usec - last_t.tv_usec;
}
process_lag += t_diff;
if (process_lag > 0) {
/* Time for a processing stroke */
sock_poll_clients(); /* poll clients for input*/
parse_all_client_messages(); /* analyze input from network clients*/
handle_input(); /* handle key input from devices*/
/* We've done the job... */
process_lag = 0 - (1e6/PROCESS_FREQ);
/* Note : this does not make a fixed frequency */
}
render_lag += t_diff;
if (render_lag > 0) {
/* Time for a rendering stroke */
timer ++;
screenlist_process();
s = screenlist_current();
/* TODO: Move this call to every client connection
* and every screen add...
*/
if (s == server_screen) {
update_server_screen();
}
render_screen(s, timer);
/* We've done the job... */
if (render_lag > (1e6/RENDER_FREQ) * MAX_RENDER_LAG_FRAMES) {
/* Cause rendering slowdown because too much lag */
render_lag = (1e6/RENDER_FREQ) * MAX_RENDER_LAG_FRAMES;
}
render_lag -= (1e6/RENDER_FREQ);
/* Note: this DOES make a fixed frequency (except with slowdown) */
}
/* Sleep just as long as needed */
sleeptime = min(0-process_lag, 0-render_lag);
if (sleeptime > 0) {
usleep(sleeptime);
}
/* Check if a SIGHUP has been caught */
if (got_reload_signal) {
got_reload_signal = 0;
do_reload();
}
}
/* Quit! */
exit_program(0);
}
static void
exit_program(int val)
{
char buf[64];
debug(RPT_DEBUG, "%s(val=%d)", __FUNCTION__, val);
/* TODO: These things shouldn't be so interdependent. The order
* things are shut down in shouldn't matter...
*/
if (val > 0) {
strncpy(buf, "Server shutting down on ", sizeof(buf));
switch(val) {
case 1: strcat(buf, "SIGHUP"); break;
case 2: strcat(buf, "SIGINT"); break;
case 15: strcat(buf, "SIGTERM"); break;
default: snprintf(buf, sizeof(buf), "Server shutting down on signal %d", val); break;
/* Other values should not be seen, but just in case.. */
}
report(RPT_NOTICE, buf); /* report it */
}
/* Set emergency reporting and flush all messages if not done already. */
if (report_level == UNSET_INT)
report_level = DEFAULT_REPORTLEVEL;
if (report_dest == UNSET_INT)
report_dest = DEFAULT_REPORTDEST;
set_reporting("LCDd", report_level, report_dest);
goodbye_screen(); /* display goodbye screen on LCD display */
drivers_unload_all(); /* release driver memory and file descriptors */
/* Shutdown things if server start was complete */
clients_shutdown(); /* shutdown clients (must come first) */
menuscreens_shutdown();
screenlist_shutdown(); /* shutdown screens (must come after client_shutdown) */
input_shutdown(); /* shutdown key input part */
sock_shutdown(); /* shutdown the sockets server */
report(RPT_INFO, "Exiting.");
_exit(EXIT_SUCCESS);
}
static void
catch_reload_signal(int val)
{
debug(RPT_DEBUG, "%s(val=%d)", __FUNCTION__, val);
got_reload_signal = 1;
}
static int
interpret_boolean_arg(char *s)
{
/* keep these checks consistent with config_get_boolean() */
if (strcasecmp(s, "0") == 0 || strcasecmp(s, "false") == 0
|| strcasecmp(s, "n") == 0 || strcasecmp(s, "no") == 0
|| strcasecmp(s, "off") == 0) {
return 0;
}
if (strcasecmp(s, "1") == 0 || strcasecmp(s, "true") == 0
|| strcasecmp(s, "y") == 0 || strcasecmp(s, "yes") == 0
|| strcasecmp(s, "on") == 0) {
return 1;
}
/* no legal boolean string given */
return -1;
}
static void
output_GPL_notice(void)
{
/* This will only be invoked when running in foreground
* So, directly output to stderr
*/
fprintf(stderr, "LCDd %s, LCDproc Protocol %s\n", VERSION, PROTOCOL_VERSION);
fprintf(stderr, "Part of the LCDproc suite\n");
fprintf(stderr, "Copyright (C) 1998-2012 William Ferrell, Selene Scriven\n"
" and many other contributors\n\n");
fprintf(stderr, "This program is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public License\n"
"as published by the Free Software Foundation; either version 2\n"
"of the License, or (at your option) any later version.\n\n");
fprintf(stderr, "This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n\n");
fprintf(stderr, "You should have received a copy of the GNU General Public License\n"
"along with this program; if not, write to the Free Software Foundation,\n"
"Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n");
}
static void
output_help_screen(void)
{
/* Help screen is printed to stdout on purpose. No reason to have
* this in syslog...
*/
debug(RPT_DEBUG, "%s()", __FUNCTION__);
fprintf(stdout, "LCDd - LCDproc Server Daemon, %s\n\n", version);
fprintf(stdout, "Copyright (c) 1998-2012 Selene Scriven, William Ferrell, and misc. contributors.\n");
fprintf(stdout, "This program is released under the terms of the GNU General Public License.\n\n");
fprintf(stdout, "Usage: LCDd [<options>]\n");
fprintf(stdout, " where <options> are:\n");
fprintf(stdout, " -h Display this help screen\n");
fprintf(stdout, " -c <config> Use a configuration file other than %s\n",
DEFAULT_CONFIGFILE);
fprintf(stdout, " -d <driver> Add a driver to use (overrides drivers in config file) [%s]\n",
DEFAULT_DRIVER);
fprintf(stdout, " -f Run in the foreground\n");
fprintf(stdout, " -a <addr> Network (IP) address to bind to [%s]\n",
DEFAULT_BIND_ADDR);
fprintf(stdout, " -p <port> Network port to listen for connections on [%i]\n",
DEFAULT_BIND_PORT);
fprintf(stdout, " -u <user> User to run as [%s]\n",
DEFAULT_USER);
fprintf(stdout, " -w <waittime> Time to pause at each screen (in seconds) [%d]\n",
DEFAULT_SCREEN_DURATION/RENDER_FREQ);
fprintf(stdout, " -s <bool> If set, reporting will be done using syslog\n");
fprintf(stdout, " -r <level> Report level [%d]\n",
DEFAULT_REPORTLEVEL);
fprintf(stdout, " -i <bool> Whether to rotate the server info screen\n");
/* Error messages will be flushed to the configured output after this
* help message.
*/
}
| FamousBonecrusher/lcdproc-0.5.6_MCP23008 | server/main.c | C | gpl-2.0 | 27,057 |
package com.oracle.wsclient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for countResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="countResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="return" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "countResponse", propOrder = {
"_return"
})
public class CountResponse {
@XmlElement(name = "return")
protected int _return;
/**
* Gets the value of the return property.
*
*/
public int getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
*/
public void setReturn(int value) {
this._return = value;
}
}
| brunoborges/glassfish2weblogic | samples/bookmark-javaee6-wsclient/src/main/java/com/oracle/wsclient/CountResponse.java | Java | gpl-2.0 | 1,219 |
CREATE TABLE `wp_aryo_activity_log` ( `histid` int(11) NOT NULL AUTO_INCREMENT, `user_caps` varchar(70) NOT NULL DEFAULT 'guest', `action` varchar(255) NOT NULL, `object_type` varchar(255) NOT NULL, `object_subtype` varchar(255) NOT NULL DEFAULT '', `object_name` varchar(255) NOT NULL, `object_id` int(11) NOT NULL DEFAULT '0', `user_id` int(11) NOT NULL DEFAULT '0', `hist_ip` varchar(55) NOT NULL DEFAULT '127.0.0.1', `hist_time` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`histid`)) ENGINE=InnoDB AUTO_INCREMENT=3838 DEFAULT CHARSET=utf8;
/*!40000 ALTER TABLE `wp_aryo_activity_log` DISABLE KEYS */;
INSERT INTO `wp_aryo_activity_log` VALUES('2472', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.125.148', '1440715358');
INSERT INTO `wp_aryo_activity_log` VALUES('2473', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1440715369');
INSERT INTO `wp_aryo_activity_log` VALUES('2474', 'administrator', 'created', 'Post', 'product', '(no title)', '24010', '4', '190.211.125.148', '1440715621');
INSERT INTO `wp_aryo_activity_log` VALUES('2475', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(', '24010', '4', '190.211.125.148', '1440715690');
INSERT INTO `wp_aryo_activity_log` VALUES('2476', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440715773');
INSERT INTO `wp_aryo_activity_log` VALUES('2477', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440715841');
INSERT INTO `wp_aryo_activity_log` VALUES('2478', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440715920');
INSERT INTO `wp_aryo_activity_log` VALUES('2479', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440716008');
INSERT INTO `wp_aryo_activity_log` VALUES('2480', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440716074');
INSERT INTO `wp_aryo_activity_log` VALUES('2481', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440716145');
INSERT INTO `wp_aryo_activity_log` VALUES('2482', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440716220');
INSERT INTO `wp_aryo_activity_log` VALUES('2483', 'administrator', 'added', 'Attachment', 'attachment', 'tamarindo arenal', '24011', '4', '190.211.125.148', '1440716232');
INSERT INTO `wp_aryo_activity_log` VALUES('2484', 'administrator', 'added', 'Attachment', 'attachment', 'tamarindo diria', '24012', '4', '190.211.125.148', '1440716278');
INSERT INTO `wp_aryo_activity_log` VALUES('2485', 'administrator', 'added', 'Attachment', 'attachment', 'tamarindo-diria', '24013', '4', '190.211.125.148', '1440716306');
INSERT INTO `wp_aryo_activity_log` VALUES('2486', 'administrator', 'added', 'Attachment', 'attachment', 'tamarindo-diria-resort-', '24014', '4', '190.211.125.148', '1440716312');
INSERT INTO `wp_aryo_activity_log` VALUES('2487', 'administrator', 'added', 'Attachment', 'attachment', 'OLYMPUS DIGITAL CAMERA', '24015', '4', '190.211.125.148', '1440716333');
INSERT INTO `wp_aryo_activity_log` VALUES('2488', 'administrator', 'added', 'Attachment', 'attachment', 'kayaking', '24016', '4', '190.211.125.148', '1440716343');
INSERT INTO `wp_aryo_activity_log` VALUES('2489', 'administrator', 'added', 'Attachment', 'attachment', 'kayaking-at-tamarindo', '24017', '4', '190.211.125.148', '1440716348');
INSERT INTO `wp_aryo_activity_log` VALUES('2490', 'administrator', 'added', 'Attachment', 'attachment', 'atv (2)', '24018', '4', '190.211.125.148', '1440716354');
INSERT INTO `wp_aryo_activity_log` VALUES('2491', 'administrator', 'added', 'Attachment', 'attachment', 'atv', '24019', '4', '190.211.125.148', '1440716360');
INSERT INTO `wp_aryo_activity_log` VALUES('2492', 'administrator', 'added', 'Attachment', 'attachment', 'beach-atv-tours', '24020', '4', '190.211.125.148', '1440716365');
INSERT INTO `wp_aryo_activity_log` VALUES('2493', 'administrator', 'added', 'Attachment', 'attachment', 'canopy (2)', '24021', '4', '190.211.125.148', '1440716370');
INSERT INTO `wp_aryo_activity_log` VALUES('2494', 'administrator', 'added', 'Attachment', 'attachment', 'ANIMADOR DEL FESTIVAL DE VIÑA 2012 RAFAEL ARANEDA', '24022', '4', '190.211.125.148', '1440716376');
INSERT INTO `wp_aryo_activity_log` VALUES('2495', 'administrator', 'added', 'Attachment', 'attachment', 'hotel_arenal_manoa', '24023', '4', '190.211.125.148', '1440716382');
INSERT INTO `wp_aryo_activity_log` VALUES('2496', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-tamarindo-diria-beach', '24024', '4', '190.211.125.148', '1440716388');
INSERT INTO `wp_aryo_activity_log` VALUES('2497', 'administrator', 'added', 'Attachment', 'attachment', 'arenal manoa (2)', '24025', '4', '190.211.125.148', '1440716615');
INSERT INTO `wp_aryo_activity_log` VALUES('2498', 'administrator', 'added', 'Attachment', 'attachment', 'arenal manoa', '24026', '4', '190.211.125.148', '1440716766');
INSERT INTO `wp_aryo_activity_log` VALUES('2499', 'administrator', 'added', 'Attachment', 'attachment', 'arenal-manoa-9', '24027', '4', '190.211.125.148', '1440716772');
INSERT INTO `wp_aryo_activity_log` VALUES('2500', 'administrator', 'added', 'Attachment', 'attachment', 'She pays the price in the front but doesn’t fall off.', '24028', '4', '190.211.125.148', '1440716786');
INSERT INTO `wp_aryo_activity_log` VALUES('2501', 'administrator', 'added', 'Attachment', 'attachment', 'rafting1', '24029', '4', '190.211.125.148', '1440716793');
INSERT INTO `wp_aryo_activity_log` VALUES('2502', 'administrator', 'added', 'Attachment', 'attachment', 'stand_up_padding1b', '24030', '4', '190.211.125.148', '1440716799');
INSERT INTO `wp_aryo_activity_log` VALUES('2503', 'administrator', 'added', 'Attachment', 'attachment', 'stand_up_padding2b', '24031', '4', '190.211.125.148', '1440716803');
INSERT INTO `wp_aryo_activity_log` VALUES('2504', 'administrator', 'added', 'Attachment', 'attachment', 'She pays the price in the front but doesn’t fall off.', '24032', '4', '190.211.125.148', '1440716929');
INSERT INTO `wp_aryo_activity_log` VALUES('2505', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717067');
INSERT INTO `wp_aryo_activity_log` VALUES('2506', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717108');
INSERT INTO `wp_aryo_activity_log` VALUES('2507', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717162');
INSERT INTO `wp_aryo_activity_log` VALUES('2508', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717262');
INSERT INTO `wp_aryo_activity_log` VALUES('2509', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717434');
INSERT INTO `wp_aryo_activity_log` VALUES('2510', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717594');
INSERT INTO `wp_aryo_activity_log` VALUES('2511', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.125.148', '1440717877');
INSERT INTO `wp_aryo_activity_log` VALUES('2512', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1440718356');
INSERT INTO `wp_aryo_activity_log` VALUES('2513', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440773897');
INSERT INTO `wp_aryo_activity_log` VALUES('2514', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.121.83', '1440774181');
INSERT INTO `wp_aryo_activity_log` VALUES('2515', 'guest', 'wrong_password', 'User', '', 'Admin', '0', '0', '201.193.55.54', '1440784736');
INSERT INTO `wp_aryo_activity_log` VALUES('2516', 'guest', 'wrong_password', 'User', '', 'Admin', '0', '0', '201.193.55.54', '1440784816');
INSERT INTO `wp_aryo_activity_log` VALUES('2517', 'guest', 'logged_in', 'User', '', 'admin', '1', '1', '201.193.55.54', '1440785153');
INSERT INTO `wp_aryo_activity_log` VALUES('2518', 'administrator', 'deactivated', 'Plugin', '', 'WooCommerce', '0', '1', '201.193.55.54', '1440785272');
INSERT INTO `wp_aryo_activity_log` VALUES('2519', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.121.83', '1440786389');
INSERT INTO `wp_aryo_activity_log` VALUES('2520', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440786409');
INSERT INTO `wp_aryo_activity_log` VALUES('2521', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.121.83', '1440786677');
INSERT INTO `wp_aryo_activity_log` VALUES('2522', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.121.83', '1440787439');
INSERT INTO `wp_aryo_activity_log` VALUES('2523', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.121.83', '1440788168');
INSERT INTO `wp_aryo_activity_log` VALUES('2524', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.121.83', '1440788269');
INSERT INTO `wp_aryo_activity_log` VALUES('2525', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.121.83', '1440788485');
INSERT INTO `wp_aryo_activity_log` VALUES('2526', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.121.83', '1440788938');
INSERT INTO `wp_aryo_activity_log` VALUES('2527', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.121.83', '1440789143');
INSERT INTO `wp_aryo_activity_log` VALUES('2528', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440789252');
INSERT INTO `wp_aryo_activity_log` VALUES('2529', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440789254');
INSERT INTO `wp_aryo_activity_log` VALUES('2530', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440789361');
INSERT INTO `wp_aryo_activity_log` VALUES('2531', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.121.83', '1440790904');
INSERT INTO `wp_aryo_activity_log` VALUES('2532', 'administrator', 'activated', 'Plugin', '', 'WooCommerce', '0', '1', '201.193.55.54', '1440791824');
INSERT INTO `wp_aryo_activity_log` VALUES('2533', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.121.83', '1440791957');
INSERT INTO `wp_aryo_activity_log` VALUES('2534', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.121.83', '1440791989');
INSERT INTO `wp_aryo_activity_log` VALUES('2535', 'administrator', 'file_updated', 'Plugin', 'BackupBuddy', 'backupbuddy/backupbuddy.php', '0', '1', '201.193.55.54', '1440791999');
INSERT INTO `wp_aryo_activity_log` VALUES('2536', 'administrator', 'activated', 'Plugin', '', 'BackupBuddy', '0', '1', '201.193.55.54', '1440792009');
INSERT INTO `wp_aryo_activity_log` VALUES('2537', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440793007');
INSERT INTO `wp_aryo_activity_log` VALUES('2538', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.121.83', '1440793044');
INSERT INTO `wp_aryo_activity_log` VALUES('2539', 'administrator', 'created', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.121.83', '1440793373');
INSERT INTO `wp_aryo_activity_log` VALUES('2540', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.121.83', '1440793831');
INSERT INTO `wp_aryo_activity_log` VALUES('2541', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate-tour 1', '24042', '4', '190.211.121.83', '1440793888');
INSERT INTO `wp_aryo_activity_log` VALUES('2542', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.121.83', '1440793910');
INSERT INTO `wp_aryo_activity_log` VALUES('2543', 'administrator', 'added', 'Attachment', 'attachment', 'arenal-chocolate-tour', '24043', '4', '190.211.121.83', '1440793935');
INSERT INTO `wp_aryo_activity_log` VALUES('2544', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate 1', '24044', '4', '190.211.121.83', '1440793953');
INSERT INTO `wp_aryo_activity_log` VALUES('2545', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate tour (2)', '24045', '4', '190.211.121.83', '1440793963');
INSERT INTO `wp_aryo_activity_log` VALUES('2546', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate tour 2', '24046', '4', '190.211.121.83', '1440793970');
INSERT INTO `wp_aryo_activity_log` VALUES('2547', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate tour 3', '24047', '4', '190.211.121.83', '1440793982');
INSERT INTO `wp_aryo_activity_log` VALUES('2548', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate tour', '24048', '4', '190.211.121.83', '1440794003');
INSERT INTO `wp_aryo_activity_log` VALUES('2549', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate tour4', '24049', '4', '190.211.121.83', '1440794013');
INSERT INTO `wp_aryo_activity_log` VALUES('2550', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate', '24050', '4', '190.211.121.83', '1440794022');
INSERT INTO `wp_aryo_activity_log` VALUES('2551', 'administrator', 'added', 'Attachment', 'attachment', 'chocolate-tour 1', '24051', '4', '190.211.121.83', '1440794029');
INSERT INTO `wp_aryo_activity_log` VALUES('2552', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.121.83', '1440794044');
INSERT INTO `wp_aryo_activity_log` VALUES('2553', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.121.83', '1440794080');
INSERT INTO `wp_aryo_activity_log` VALUES('2554', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.121.83', '1440794610');
INSERT INTO `wp_aryo_activity_log` VALUES('2555', 'administrator', 'created', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.121.83', '1440794952');
INSERT INTO `wp_aryo_activity_log` VALUES('2556', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.121.83', '1440795067');
INSERT INTO `wp_aryo_activity_log` VALUES('2557', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.121.83', '1440795292');
INSERT INTO `wp_aryo_activity_log` VALUES('2558', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.121.83', '1440795367');
INSERT INTO `wp_aryo_activity_log` VALUES('2559', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.121.83', '1440795373');
INSERT INTO `wp_aryo_activity_log` VALUES('2560', 'administrator', 'updated', 'Post', 'page', 'Home Principal', '19843', '4', '190.211.121.83', '1440796323');
INSERT INTO `wp_aryo_activity_log` VALUES('2561', 'administrator', 'updated', 'Post', 'page', 'Home Principal', '19843', '4', '190.211.121.83', '1440796406');
INSERT INTO `wp_aryo_activity_log` VALUES('2562', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.121.83', '1440796518');
INSERT INTO `wp_aryo_activity_log` VALUES('2563', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.124.242', '1440870001');
INSERT INTO `wp_aryo_activity_log` VALUES('2564', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.124.242', '1440870011');
INSERT INTO `wp_aryo_activity_log` VALUES('2565', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.124.242', '1440870024');
INSERT INTO `wp_aryo_activity_log` VALUES('2566', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '190.211.124.242', '1440871794');
INSERT INTO `wp_aryo_activity_log` VALUES('2567', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '190.211.124.242', '1440871933');
INSERT INTO `wp_aryo_activity_log` VALUES('2568', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '190.211.124.242', '1440871973');
INSERT INTO `wp_aryo_activity_log` VALUES('2569', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '190.211.124.242', '1440872431');
INSERT INTO `wp_aryo_activity_log` VALUES('2570', 'administrator', 'updated', 'Post', 'product', 'Paseo de las Damas Inn', '23071', '4', '190.211.124.242', '1440872700');
INSERT INTO `wp_aryo_activity_log` VALUES('2571', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '186.26.115.154', '1440877165');
INSERT INTO `wp_aryo_activity_log` VALUES('2572', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '201.199.90.211', '1440877200');
INSERT INTO `wp_aryo_activity_log` VALUES('2573', 'administrator', 'updated', 'Menu', '', 'side_menu - Inglés0', '0', '4', '186.26.115.154', '1440877728');
INSERT INTO `wp_aryo_activity_log` VALUES('2574', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Paquete de aventura', '63', '4', '186.26.115.154', '1440877879');
INSERT INTO `wp_aryo_activity_log` VALUES('2575', 'administrator', 'updated', 'Menu', '', 'side_menu', '0', '4', '186.26.115.154', '1440877900');
INSERT INTO `wp_aryo_activity_log` VALUES('2576', 'administrator', 'updated', 'Menu', '', 'side_menu', '0', '4', '186.26.115.154', '1440877901');
INSERT INTO `wp_aryo_activity_log` VALUES('2577', 'administrator', 'updated', 'Post', 'product', 'water rafting 2/3:', '23119', '4', '186.26.115.154', '1440878093');
INSERT INTO `wp_aryo_activity_log` VALUES('2578', 'administrator', 'updated', 'Post', 'product', 'tour de rafting 2/3', '23120', '4', '186.26.115.154', '1440878268');
INSERT INTO `wp_aryo_activity_log` VALUES('2579', 'administrator', 'created', 'Post', 'product', '(no title)', '24055', '4', '201.199.90.211', '1440878846');
INSERT INTO `wp_aryo_activity_log` VALUES('2580', 'administrator', 'deleted', 'Post', 'product', '(no title)', '24055', '4', '186.26.115.235', '1440879060');
INSERT INTO `wp_aryo_activity_log` VALUES('2581', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440881027');
INSERT INTO `wp_aryo_activity_log` VALUES('2582', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440881270');
INSERT INTO `wp_aryo_activity_log` VALUES('2583', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440881406');
INSERT INTO `wp_aryo_activity_log` VALUES('2584', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440881542');
INSERT INTO `wp_aryo_activity_log` VALUES('2585', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440881717');
INSERT INTO `wp_aryo_activity_log` VALUES('2586', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440882020');
INSERT INTO `wp_aryo_activity_log` VALUES('2587', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440882170');
INSERT INTO `wp_aryo_activity_log` VALUES('2588', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440882202');
INSERT INTO `wp_aryo_activity_log` VALUES('2589', 'administrator', 'file_updated', 'Theme', 'stockholm', 'style.css', '0', '4', '186.26.115.200', '1440882356');
INSERT INTO `wp_aryo_activity_log` VALUES('2590', 'administrator', 'updated', 'Post', 'safecss', 'safecss', '24056', '4', '186.26.115.55', '1440883843');
INSERT INTO `wp_aryo_activity_log` VALUES('2591', 'administrator', 'updated', 'Options', '', 'admin_email', '0', '4', '186.26.115.55', '1440885562');
INSERT INTO `wp_aryo_activity_log` VALUES('2592', 'administrator', 'updated', 'Widget', 'footer_column_1', 'text', '0', '4', '186.26.115.55', '1440885595');
INSERT INTO `wp_aryo_activity_log` VALUES('2593', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '201.199.90.211', '1440885730');
INSERT INTO `wp_aryo_activity_log` VALUES('2594', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '201.199.90.211', '1440885814');
INSERT INTO `wp_aryo_activity_log` VALUES('2595', 'administrator', 'updated', 'Post', 'product', 'Rappel', '23118', '4', '201.199.90.211', '1440886041');
INSERT INTO `wp_aryo_activity_log` VALUES('2596', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '201.199.90.211', '1440887462');
INSERT INTO `wp_aryo_activity_log` VALUES('2597', 'guest', 'deleted', 'Post', 'product', 'Hotel Balmoral', '23572', '0', '173.254.80.240', '1440966865');
INSERT INTO `wp_aryo_activity_log` VALUES('2598', 'guest', 'deleted', 'Post', 'testimonials', '(no title)', '23526', '0', '173.254.80.240', '1440966865');
INSERT INTO `wp_aryo_activity_log` VALUES('2599', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.125.148', '1440969074');
INSERT INTO `wp_aryo_activity_log` VALUES('2600', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1440969111');
INSERT INTO `wp_aryo_activity_log` VALUES('2601', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '201.199.90.211', '1440969955');
INSERT INTO `wp_aryo_activity_log` VALUES('2602', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '201.199.90.211', '1440970041');
INSERT INTO `wp_aryo_activity_log` VALUES('2603', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '201.199.90.211', '1440970045');
INSERT INTO `wp_aryo_activity_log` VALUES('2604', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441034769');
INSERT INTO `wp_aryo_activity_log` VALUES('2605', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.108.34', '1441035090');
INSERT INTO `wp_aryo_activity_log` VALUES('2606', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.108.34', '1441035271');
INSERT INTO `wp_aryo_activity_log` VALUES('2607', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.108.34', '1441035506');
INSERT INTO `wp_aryo_activity_log` VALUES('2608', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.108.34', '1441035752');
INSERT INTO `wp_aryo_activity_log` VALUES('2609', 'administrator', 'updated', 'Post', 'product', 'Rappel', '23117', '4', '190.211.108.34', '1441037036');
INSERT INTO `wp_aryo_activity_log` VALUES('2610', 'administrator', 'updated', 'Post', 'product', 'Rappel', '23118', '4', '190.211.108.34', '1441037037');
INSERT INTO `wp_aryo_activity_log` VALUES('2611', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441038666');
INSERT INTO `wp_aryo_activity_log` VALUES('2612', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441038738');
INSERT INTO `wp_aryo_activity_log` VALUES('2613', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441038827');
INSERT INTO `wp_aryo_activity_log` VALUES('2614', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441038912');
INSERT INTO `wp_aryo_activity_log` VALUES('2615', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441038983');
INSERT INTO `wp_aryo_activity_log` VALUES('2616', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441039036');
INSERT INTO `wp_aryo_activity_log` VALUES('2617', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441039059');
INSERT INTO `wp_aryo_activity_log` VALUES('2618', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441039082');
INSERT INTO `wp_aryo_activity_log` VALUES('2619', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441039110');
INSERT INTO `wp_aryo_activity_log` VALUES('2620', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1441039304');
INSERT INTO `wp_aryo_activity_log` VALUES('2621', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441043383');
INSERT INTO `wp_aryo_activity_log` VALUES('2622', 'administrator', 'updated', 'Post', 'product', 'Zipline', '23115', '4', '190.211.108.34', '1441043485');
INSERT INTO `wp_aryo_activity_log` VALUES('2623', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441043660');
INSERT INTO `wp_aryo_activity_log` VALUES('2624', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441043745');
INSERT INTO `wp_aryo_activity_log` VALUES('2625', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441047494');
INSERT INTO `wp_aryo_activity_log` VALUES('2626', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441047599');
INSERT INTO `wp_aryo_activity_log` VALUES('2627', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441047624');
INSERT INTO `wp_aryo_activity_log` VALUES('2628', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441047653');
INSERT INTO `wp_aryo_activity_log` VALUES('2629', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441047675');
INSERT INTO `wp_aryo_activity_log` VALUES('2630', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.108.34', '1441047710');
INSERT INTO `wp_aryo_activity_log` VALUES('2631', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441047915');
INSERT INTO `wp_aryo_activity_log` VALUES('2632', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441047972');
INSERT INTO `wp_aryo_activity_log` VALUES('2633', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441048154');
INSERT INTO `wp_aryo_activity_log` VALUES('2634', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441048231');
INSERT INTO `wp_aryo_activity_log` VALUES('2635', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441048283');
INSERT INTO `wp_aryo_activity_log` VALUES('2636', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441048316');
INSERT INTO `wp_aryo_activity_log` VALUES('2637', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '21972', '4', '190.211.108.34', '1441048426');
INSERT INTO `wp_aryo_activity_log` VALUES('2638', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441048427');
INSERT INTO `wp_aryo_activity_log` VALUES('2639', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '21972', '4', '190.211.108.34', '1441048729');
INSERT INTO `wp_aryo_activity_log` VALUES('2640', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.108.34', '1441048731');
INSERT INTO `wp_aryo_activity_log` VALUES('2641', 'administrator', 'updated', 'Post', 'product', 'safari en bote', '21960', '4', '190.211.108.34', '1441048975');
INSERT INTO `wp_aryo_activity_log` VALUES('2642', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23113', '4', '190.211.108.34', '1441049216');
INSERT INTO `wp_aryo_activity_log` VALUES('2643', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.108.34', '1441050368');
INSERT INTO `wp_aryo_activity_log` VALUES('2644', 'administrator', 'created', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal', '24061', '4', '190.211.108.34', '1441050758');
INSERT INTO `wp_aryo_activity_log` VALUES('2645', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias', '24061', '4', '190.211.108.34', '1441050814');
INSERT INTO `wp_aryo_activity_log` VALUES('2646', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441050820');
INSERT INTO `wp_aryo_activity_log` VALUES('2647', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441051066');
INSERT INTO `wp_aryo_activity_log` VALUES('2648', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441051142');
INSERT INTO `wp_aryo_activity_log` VALUES('2649', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441051226');
INSERT INTO `wp_aryo_activity_log` VALUES('2650', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441051272');
INSERT INTO `wp_aryo_activity_log` VALUES('2651', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441051391');
INSERT INTO `wp_aryo_activity_log` VALUES('2652', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441051902');
INSERT INTO `wp_aryo_activity_log` VALUES('2653', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1441052536');
INSERT INTO `wp_aryo_activity_log` VALUES('2654', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441052985');
INSERT INTO `wp_aryo_activity_log` VALUES('2655', 'administrator', 'updated', 'Post', 'product', '1 night in San Jose – 3 nights In tamarindo -3 nights in La Fortuna, Arenal(7 nights /8 days )', '24010', '4', '190.211.108.34', '1441053119');
INSERT INTO `wp_aryo_activity_log` VALUES('2656', 'administrator', 'updated', 'Post', 'product', '3 nights at Arenal Volcano, 4 nights at jaco Beach (8 Days/ 7 Nights)', '23968', '4', '190.211.108.34', '1441053272');
INSERT INTO `wp_aryo_activity_log` VALUES('2657', 'administrator', 'updated', 'Post', 'product', '2 nights at Arenal, 3 nights at Manuel Antonio Beach (6 Days/ 5 Nights)', '23100', '4', '190.211.108.34', '1441053664');
INSERT INTO `wp_aryo_activity_log` VALUES('2658', 'administrator', 'updated', 'Post', 'product', '2 noches en Arenal , 3 noches en Playa Manuel Antonio (6dias /5noches)', '21914', '4', '190.211.108.34', '1441053823');
INSERT INTO `wp_aryo_activity_log` VALUES('2659', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441064239');
INSERT INTO `wp_aryo_activity_log` VALUES('2660', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.125.148', '1441066266');
INSERT INTO `wp_aryo_activity_log` VALUES('2661', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.125.148', '1441066515');
INSERT INTO `wp_aryo_activity_log` VALUES('2662', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441074791');
INSERT INTO `wp_aryo_activity_log` VALUES('2663', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '22707', '4', '190.211.125.148', '1441075570');
INSERT INTO `wp_aryo_activity_log` VALUES('2664', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '22707', '4', '190.211.125.148', '1441075704');
INSERT INTO `wp_aryo_activity_log` VALUES('2665', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '22707', '4', '190.211.125.148', '1441075885');
INSERT INTO `wp_aryo_activity_log` VALUES('2666', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1441076438');
INSERT INTO `wp_aryo_activity_log` VALUES('2667', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441076884');
INSERT INTO `wp_aryo_activity_log` VALUES('2668', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Aeropuerto', '77', '4', '190.211.125.148', '1441077496');
INSERT INTO `wp_aryo_activity_log` VALUES('2669', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Arenal', '78', '4', '190.211.125.148', '1441077744');
INSERT INTO `wp_aryo_activity_log` VALUES('2670', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Guanacaste', '79', '4', '190.211.125.148', '1441077821');
INSERT INTO `wp_aryo_activity_log` VALUES('2671', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Jaco', '80', '4', '190.211.125.148', '1441077906');
INSERT INTO `wp_aryo_activity_log` VALUES('2672', 'administrator', 'added', 'Attachment', 'attachment', 'limon', '24068', '4', '190.211.125.148', '1441078459');
INSERT INTO `wp_aryo_activity_log` VALUES('2673', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Limon', '81', '4', '190.211.125.148', '1441078475');
INSERT INTO `wp_aryo_activity_log` VALUES('2674', 'administrator', 'added', 'Attachment', 'attachment', 'monteverde', '24069', '4', '190.211.125.148', '1441078832');
INSERT INTO `wp_aryo_activity_log` VALUES('2675', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Monteverde', '76', '4', '190.211.125.148', '1441078845');
INSERT INTO `wp_aryo_activity_log` VALUES('2676', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Manuel Antonio', '83', '4', '190.211.125.148', '1441079106');
INSERT INTO `wp_aryo_activity_log` VALUES('2677', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'San Jose', '82', '4', '190.211.125.148', '1441079201');
INSERT INTO `wp_aryo_activity_log` VALUES('2678', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Tortuguero', '111', '4', '190.211.125.148', '1441079273');
INSERT INTO `wp_aryo_activity_log` VALUES('2679', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1441079383');
INSERT INTO `wp_aryo_activity_log` VALUES('2680', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441120635');
INSERT INTO `wp_aryo_activity_log` VALUES('2681', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441120640');
INSERT INTO `wp_aryo_activity_log` VALUES('2682', 'administrator', 'added', 'Attachment', 'attachment', 'nayara', '24071', '4', '190.211.108.34', '1441125151');
INSERT INTO `wp_aryo_activity_log` VALUES('2683', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441125248');
INSERT INTO `wp_aryo_activity_log` VALUES('2684', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441125600');
INSERT INTO `wp_aryo_activity_log` VALUES('2685', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441125771');
INSERT INTO `wp_aryo_activity_log` VALUES('2686', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441125887');
INSERT INTO `wp_aryo_activity_log` VALUES('2687', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126055');
INSERT INTO `wp_aryo_activity_log` VALUES('2688', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126327');
INSERT INTO `wp_aryo_activity_log` VALUES('2689', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126512');
INSERT INTO `wp_aryo_activity_log` VALUES('2690', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126591');
INSERT INTO `wp_aryo_activity_log` VALUES('2691', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126664');
INSERT INTO `wp_aryo_activity_log` VALUES('2692', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126705');
INSERT INTO `wp_aryo_activity_log` VALUES('2693', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441126894');
INSERT INTO `wp_aryo_activity_log` VALUES('2694', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441127179');
INSERT INTO `wp_aryo_activity_log` VALUES('2695', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441127373');
INSERT INTO `wp_aryo_activity_log` VALUES('2696', 'administrator', 'added', 'Attachment', 'attachment', 'nayara', '24073', '4', '190.211.108.34', '1441128457');
INSERT INTO `wp_aryo_activity_log` VALUES('2697', 'administrator', 'updated', 'Post', 'product', 'Nayara', '22730', '4', '190.211.108.34', '1441128494');
INSERT INTO `wp_aryo_activity_log` VALUES('2698', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441128495');
INSERT INTO `wp_aryo_activity_log` VALUES('2699', 'administrator', 'updated', 'Post', 'product', 'Nayara', '22730', '4', '190.211.108.34', '1441128628');
INSERT INTO `wp_aryo_activity_log` VALUES('2700', 'administrator', 'updated', 'Post', 'product', 'Nayara', '23038', '4', '190.211.108.34', '1441128629');
INSERT INTO `wp_aryo_activity_log` VALUES('2701', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.108.34', '1441129113');
INSERT INTO `wp_aryo_activity_log` VALUES('2702', 'administrator', 'updated', 'Post', 'product', 'Nayara', '22730', '4', '190.211.108.34', '1441129615');
INSERT INTO `wp_aryo_activity_log` VALUES('2703', 'administrator', 'updated', 'Post', 'product', 'Monte Real', '23057', '4', '190.211.108.34', '1441133267');
INSERT INTO `wp_aryo_activity_log` VALUES('2704', 'administrator', 'updated', 'Post', 'product', '1 noche en San José – 3 noches en Tamarindo -3 noches en La Fortuna , Arenal(7 noches /8 dias)', '24061', '4', '190.211.108.34', '1441134113');
INSERT INTO `wp_aryo_activity_log` VALUES('2705', 'administrator', 'updated', 'Post', 'product', 'Monte Real', '22729', '4', '190.211.108.34', '1441134885');
INSERT INTO `wp_aryo_activity_log` VALUES('2706', 'administrator', 'updated', 'Post', 'product', 'Monte Real', '23057', '4', '190.211.108.34', '1441134886');
INSERT INTO `wp_aryo_activity_log` VALUES('2707', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441137094');
INSERT INTO `wp_aryo_activity_log` VALUES('2708', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441137511');
INSERT INTO `wp_aryo_activity_log` VALUES('2709', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441137605');
INSERT INTO `wp_aryo_activity_log` VALUES('2710', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '22728', '4', '190.211.108.34', '1441138756');
INSERT INTO `wp_aryo_activity_log` VALUES('2711', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '22728', '4', '190.211.108.34', '1441139189');
INSERT INTO `wp_aryo_activity_log` VALUES('2712', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441139190');
INSERT INTO `wp_aryo_activity_log` VALUES('2713', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '22728', '4', '190.211.108.34', '1441139280');
INSERT INTO `wp_aryo_activity_log` VALUES('2714', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441139281');
INSERT INTO `wp_aryo_activity_log` VALUES('2715', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441139765');
INSERT INTO `wp_aryo_activity_log` VALUES('2716', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441141164');
INSERT INTO `wp_aryo_activity_log` VALUES('2717', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441141319');
INSERT INTO `wp_aryo_activity_log` VALUES('2718', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441141647');
INSERT INTO `wp_aryo_activity_log` VALUES('2719', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '22728', '4', '190.211.108.34', '1441142026');
INSERT INTO `wp_aryo_activity_log` VALUES('2720', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441142027');
INSERT INTO `wp_aryo_activity_log` VALUES('2721', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '22728', '4', '190.211.108.34', '1441142206');
INSERT INTO `wp_aryo_activity_log` VALUES('2722', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '22728', '4', '190.211.108.34', '1441142529');
INSERT INTO `wp_aryo_activity_log` VALUES('2723', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1441143347');
INSERT INTO `wp_aryo_activity_log` VALUES('2724', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '109.161.237.103', '1441156079');
INSERT INTO `wp_aryo_activity_log` VALUES('2725', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441220484');
INSERT INTO `wp_aryo_activity_log` VALUES('2726', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441220495');
INSERT INTO `wp_aryo_activity_log` VALUES('2727', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441222189');
INSERT INTO `wp_aryo_activity_log` VALUES('2728', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441222268');
INSERT INTO `wp_aryo_activity_log` VALUES('2729', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441222881');
INSERT INTO `wp_aryo_activity_log` VALUES('2730', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441223173');
INSERT INTO `wp_aryo_activity_log` VALUES('2731', 'administrator', 'updated', 'Post', 'product', 'Hotel Los lagos', '23058', '4', '190.211.108.34', '1441223310');
INSERT INTO `wp_aryo_activity_log` VALUES('2732', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441228405');
INSERT INTO `wp_aryo_activity_log` VALUES('2733', 'administrator', 'updated', 'Post', 'product', 'Hotel volcano inn', '23059', '4', '190.211.108.34', '1441228987');
INSERT INTO `wp_aryo_activity_log` VALUES('2734', 'administrator', 'updated', 'Post', 'product', 'Hotel volcano inn', '23059', '4', '190.211.108.34', '1441229214');
INSERT INTO `wp_aryo_activity_log` VALUES('2735', 'administrator', 'updated', 'Post', 'product', 'Hotel volcano inn', '23059', '4', '190.211.108.34', '1441229493');
INSERT INTO `wp_aryo_activity_log` VALUES('2736', 'administrator', 'updated', 'Post', 'product', 'Hotel volcano inn', '22727', '4', '190.211.108.34', '1441232000');
INSERT INTO `wp_aryo_activity_log` VALUES('2737', 'administrator', 'updated', 'Post', 'product', 'Hotel volcano inn', '22727', '4', '190.211.108.34', '1441232736');
INSERT INTO `wp_aryo_activity_log` VALUES('2738', 'administrator', 'updated', 'Post', 'product', 'Hotel volcano inn', '22727', '4', '190.211.108.34', '1441232906');
INSERT INTO `wp_aryo_activity_log` VALUES('2739', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '23060', '4', '190.211.108.34', '1441239269');
INSERT INTO `wp_aryo_activity_log` VALUES('2740', 'guest', 'wrong_password', 'User', '', 'Admin', '0', '0', '201.191.198.175', '1441264437');
INSERT INTO `wp_aryo_activity_log` VALUES('2741', 'guest', 'logged_in', 'User', '', 'admin', '1', '1', '201.191.198.175', '1441264464');
INSERT INTO `wp_aryo_activity_log` VALUES('2742', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '212.192.74.100', '1441295897');
INSERT INTO `wp_aryo_activity_log` VALUES('2743', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '186.26.115.110', '1441310901');
INSERT INTO `wp_aryo_activity_log` VALUES('2744', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '178.89.2.110', '1441330517');
INSERT INTO `wp_aryo_activity_log` VALUES('2745', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '62.149.25.15', '1441330517');
INSERT INTO `wp_aryo_activity_log` VALUES('2746', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '62.149.25.15', '1441330519');
INSERT INTO `wp_aryo_activity_log` VALUES('2747', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '162.247.73.204', '1441362624');
INSERT INTO `wp_aryo_activity_log` VALUES('2748', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.127.133', '1441389766');
INSERT INTO `wp_aryo_activity_log` VALUES('2749', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '91.200.85.68', '1441397154');
INSERT INTO `wp_aryo_activity_log` VALUES('2750', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.127.133', '1441403586');
INSERT INTO `wp_aryo_activity_log` VALUES('2751', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '86.146.213.47', '1441430469');
INSERT INTO `wp_aryo_activity_log` VALUES('2752', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '95.163.107.16', '1441430469');
INSERT INTO `wp_aryo_activity_log` VALUES('2753', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441470067');
INSERT INTO `wp_aryo_activity_log` VALUES('2754', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.108.34', '1441473903');
INSERT INTO `wp_aryo_activity_log` VALUES('2755', 'administrator', 'updated', 'Post', 'page', 'Home Default', '22913', '4', '190.211.108.34', '1441477757');
INSERT INTO `wp_aryo_activity_log` VALUES('2756', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '22726', '4', '190.211.108.34', '1441484424');
INSERT INTO `wp_aryo_activity_log` VALUES('2757', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1441484594');
INSERT INTO `wp_aryo_activity_log` VALUES('2758', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '186.26.115.159', '1441495012');
INSERT INTO `wp_aryo_activity_log` VALUES('2759', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Arenal', '114', '4', '186.26.115.159', '1441495346');
INSERT INTO `wp_aryo_activity_log` VALUES('2760', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Arenal', '114', '4', '186.26.115.159', '1441495478');
INSERT INTO `wp_aryo_activity_log` VALUES('2761', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Arenal', '115', '4', '186.26.115.159', '1441495536');
INSERT INTO `wp_aryo_activity_log` VALUES('2762', 'administrator', 'updated', 'Post', 'product', 'Early bird walk', '23868', '4', '186.26.115.159', '1441495881');
INSERT INTO `wp_aryo_activity_log` VALUES('2763', 'administrator', 'updated', 'Post', 'product', 'Early bird walk', '23868', '4', '186.26.115.159', '1441495979');
INSERT INTO `wp_aryo_activity_log` VALUES('2764', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Guanacaste', '116', '4', '186.26.115.159', '1441496314');
INSERT INTO `wp_aryo_activity_log` VALUES('2765', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Monteverde', '117', '4', '186.26.115.159', '1441496460');
INSERT INTO `wp_aryo_activity_log` VALUES('2766', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Tortuguero', '118', '4', '186.26.115.159', '1441496514');
INSERT INTO `wp_aryo_activity_log` VALUES('2767', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Limón', '119', '4', '186.26.115.159', '1441496581');
INSERT INTO `wp_aryo_activity_log` VALUES('2768', 'administrator', 'created', 'Taxonomy', 'product_cat', 'San José', '120', '4', '186.26.115.159', '1441496610');
INSERT INTO `wp_aryo_activity_log` VALUES('2769', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Manuel Antonio', '121', '4', '186.26.115.159', '1441496691');
INSERT INTO `wp_aryo_activity_log` VALUES('2770', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Jacó', '122', '4', '186.26.115.159', '1441496733');
INSERT INTO `wp_aryo_activity_log` VALUES('2771', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Santa Teresa', '123', '4', '186.26.115.159', '1441496776');
INSERT INTO `wp_aryo_activity_log` VALUES('2772', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Península de Osa', '124', '4', '186.26.115.159', '1441496924');
INSERT INTO `wp_aryo_activity_log` VALUES('2773', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Tortuguero', '125', '4', '186.26.115.159', '1441497081');
INSERT INTO `wp_aryo_activity_log` VALUES('2774', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Santa Teresa', '126', '4', '186.26.115.159', '1441497118');
INSERT INTO `wp_aryo_activity_log` VALUES('2775', 'administrator', 'created', 'Taxonomy', 'product_cat', 'San Jose', '127', '4', '186.26.115.159', '1441497163');
INSERT INTO `wp_aryo_activity_log` VALUES('2776', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'San Jose', '127', '4', '186.26.115.159', '1441497283');
INSERT INTO `wp_aryo_activity_log` VALUES('2777', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Península de Osa', '128', '4', '186.26.115.159', '1441497312');
INSERT INTO `wp_aryo_activity_log` VALUES('2778', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Guanacaste', '129', '4', '186.26.115.159', '1441497473');
INSERT INTO `wp_aryo_activity_log` VALUES('2779', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Jacó', '130', '4', '186.26.115.159', '1441497490');
INSERT INTO `wp_aryo_activity_log` VALUES('2780', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Limón', '131', '4', '186.26.115.159', '1441497506');
INSERT INTO `wp_aryo_activity_log` VALUES('2781', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Manuel Antonio', '132', '4', '186.26.115.159', '1441497532');
INSERT INTO `wp_aryo_activity_log` VALUES('2782', 'administrator', 'created', 'Taxonomy', 'product_cat', 'Monteverde', '133', '4', '186.26.115.159', '1441497551');
INSERT INTO `wp_aryo_activity_log` VALUES('2783', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.125.148', '1441567367');
INSERT INTO `wp_aryo_activity_log` VALUES('2784', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.125.148', '1441567380');
INSERT INTO `wp_aryo_activity_log` VALUES('2785', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441567396');
INSERT INTO `wp_aryo_activity_log` VALUES('2786', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441567399');
INSERT INTO `wp_aryo_activity_log` VALUES('2787', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1441568408');
INSERT INTO `wp_aryo_activity_log` VALUES('2788', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441598393');
INSERT INTO `wp_aryo_activity_log` VALUES('2789', 'administrator', 'added', 'Attachment', 'attachment', 'royal corin', '24085', '4', '190.211.125.148', '1441599763');
INSERT INTO `wp_aryo_activity_log` VALUES('2790', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '23060', '4', '190.211.125.148', '1441599790');
INSERT INTO `wp_aryo_activity_log` VALUES('2791', 'administrator', 'added', 'Attachment', 'attachment', 'rancho margot', '24086', '4', '190.211.125.148', '1441600143');
INSERT INTO `wp_aryo_activity_log` VALUES('2792', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '23061', '4', '190.211.125.148', '1441600235');
INSERT INTO `wp_aryo_activity_log` VALUES('2793', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '22725', '4', '190.211.125.148', '1441600304');
INSERT INTO `wp_aryo_activity_log` VALUES('2794', 'administrator', 'added', 'Attachment', 'attachment', 'mountain paradise', '24087', '4', '190.211.125.148', '1441600669');
INSERT INTO `wp_aryo_activity_log` VALUES('2795', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.125.148', '1441600728');
INSERT INTO `wp_aryo_activity_log` VALUES('2796', 'administrator', 'added', 'Attachment', 'attachment', 'arenal manoa', '24088', '4', '190.211.125.148', '1441601365');
INSERT INTO `wp_aryo_activity_log` VALUES('2797', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '23063', '4', '190.211.125.148', '1441601392');
INSERT INTO `wp_aryo_activity_log` VALUES('2798', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '22723', '4', '190.211.125.148', '1441601495');
INSERT INTO `wp_aryo_activity_log` VALUES('2799', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '23063', '4', '190.211.125.148', '1441601496');
INSERT INTO `wp_aryo_activity_log` VALUES('2800', 'administrator', 'added', 'Attachment', 'attachment', 'green lagon', '24089', '4', '190.211.125.148', '1441601966');
INSERT INTO `wp_aryo_activity_log` VALUES('2801', 'administrator', 'updated', 'Post', 'product', 'Hotel Greenlagoon', '23065', '4', '190.211.125.148', '1441602252');
INSERT INTO `wp_aryo_activity_log` VALUES('2802', 'administrator', 'added', 'Attachment', 'attachment', 'Arenal-Springs-photos-Exterior', '24090', '4', '190.211.125.148', '1441603130');
INSERT INTO `wp_aryo_activity_log` VALUES('2803', 'administrator', 'added', 'Attachment', 'attachment', 'arenal springs', '24091', '4', '190.211.125.148', '1441603207');
INSERT INTO `wp_aryo_activity_log` VALUES('2804', 'administrator', 'added', 'Attachment', 'attachment', 'arenal springs', '24092', '4', '190.211.125.148', '1441603274');
INSERT INTO `wp_aryo_activity_log` VALUES('2805', 'administrator', 'added', 'Attachment', 'attachment', 'arenal_springs2', '24093', '4', '190.211.125.148', '1441603280');
INSERT INTO `wp_aryo_activity_log` VALUES('2806', 'administrator', 'added', 'Attachment', 'attachment', 'arenal-springs1', '24094', '4', '190.211.125.148', '1441603285');
INSERT INTO `wp_aryo_activity_log` VALUES('2807', 'administrator', 'added', 'Attachment', 'attachment', 'Arenal-Springs-photos-Exterior', '24095', '4', '190.211.125.148', '1441603290');
INSERT INTO `wp_aryo_activity_log` VALUES('2808', 'administrator', 'added', 'Attachment', 'attachment', 'arenal-springs-resort-meal', '24096', '4', '190.211.125.148', '1441603324');
INSERT INTO `wp_aryo_activity_log` VALUES('2809', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel_Arenal_Springs_I_', '24097', '4', '190.211.125.148', '1441603339');
INSERT INTO `wp_aryo_activity_log` VALUES('2810', 'administrator', 'added', 'Attachment', 'attachment', 'mastersuite arenal springs', '24098', '4', '190.211.125.148', '1441603357');
INSERT INTO `wp_aryo_activity_log` VALUES('2811', 'administrator', 'added', 'Attachment', 'attachment', 'room-arenal-spring-1gr', '24099', '4', '190.211.125.148', '1441603376');
INSERT INTO `wp_aryo_activity_log` VALUES('2812', 'administrator', 'added', 'Attachment', 'attachment', 'arenal springs 1', '24100', '4', '190.211.125.148', '1441603387');
INSERT INTO `wp_aryo_activity_log` VALUES('2813', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.125.148', '1441603480');
INSERT INTO `wp_aryo_activity_log` VALUES('2814', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '22718', '4', '190.211.125.148', '1441603804');
INSERT INTO `wp_aryo_activity_log` VALUES('2815', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '22704', '4', '190.211.125.148', '1441604185');
INSERT INTO `wp_aryo_activity_log` VALUES('2816', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel Brillasol 9', '24101', '4', '190.211.125.148', '1441604284');
INSERT INTO `wp_aryo_activity_log` VALUES('2817', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '22704', '4', '190.211.125.148', '1441604317');
INSERT INTO `wp_aryo_activity_log` VALUES('2818', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge', '24102', '4', '190.211.125.148', '1441604822');
INSERT INTO `wp_aryo_activity_log` VALUES('2819', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '23074', '4', '190.211.125.148', '1441604859');
INSERT INTO `wp_aryo_activity_log` VALUES('2820', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-asclepios', '24103', '4', '190.211.125.148', '1441605136');
INSERT INTO `wp_aryo_activity_log` VALUES('2821', 'administrator', 'updated', 'Post', 'product', 'Hotel Asclepios', '23073', '4', '190.211.125.148', '1441605160');
INSERT INTO `wp_aryo_activity_log` VALUES('2822', 'administrator', 'added', 'Attachment', 'attachment', 'santa maria inn', '24104', '4', '190.211.125.148', '1441605670');
INSERT INTO `wp_aryo_activity_log` VALUES('2823', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '22707', '4', '190.211.125.148', '1441605693');
INSERT INTO `wp_aryo_activity_log` VALUES('2824', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.125.148', '1441605694');
INSERT INTO `wp_aryo_activity_log` VALUES('2825', 'administrator', 'added', 'Attachment', 'attachment', 'paseo inn', '24105', '4', '190.211.125.148', '1441606088');
INSERT INTO `wp_aryo_activity_log` VALUES('2826', 'administrator', 'updated', 'Post', 'product', 'Paseo de las Damas Inn', '23071', '4', '190.211.125.148', '1441606124');
INSERT INTO `wp_aryo_activity_log` VALUES('2827', 'administrator', 'added', 'Attachment', 'attachment', 'hotelSugarbeach', '24106', '4', '190.211.125.148', '1441606426');
INSERT INTO `wp_aryo_activity_log` VALUES('2828', 'administrator', 'updated', 'Post', 'product', 'Hotel Sugar Beach', '23315', '4', '190.211.125.148', '1441606449');
INSERT INTO `wp_aryo_activity_log` VALUES('2829', 'administrator', 'updated', 'Post', 'product', 'Hotel Sugar Beach', '23332', '4', '190.211.125.148', '1441606451');
INSERT INTO `wp_aryo_activity_log` VALUES('2830', 'administrator', 'added', 'Attachment', 'attachment', 'flamingo', '24107', '4', '190.211.125.148', '1441606762');
INSERT INTO `wp_aryo_activity_log` VALUES('2831', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.125.148', '1441606788');
INSERT INTO `wp_aryo_activity_log` VALUES('2832', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23263', '4', '190.211.125.148', '1441606868');
INSERT INTO `wp_aryo_activity_log` VALUES('2833', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.125.148', '1441606869');
INSERT INTO `wp_aryo_activity_log` VALUES('2834', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23263', '4', '190.211.125.148', '1441606903');
INSERT INTO `wp_aryo_activity_log` VALUES('2835', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1441606928');
INSERT INTO `wp_aryo_activity_log` VALUES('2836', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '149.202.98.161', '1441637818');
INSERT INTO `wp_aryo_activity_log` VALUES('2837', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '94.242.246.24', '1441637818');
INSERT INTO `wp_aryo_activity_log` VALUES('2838', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '91.109.247.173', '1441637818');
INSERT INTO `wp_aryo_activity_log` VALUES('2839', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '185.65.135.228', '1441637822');
INSERT INTO `wp_aryo_activity_log` VALUES('2840', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '96.44.189.100', '1441637830');
INSERT INTO `wp_aryo_activity_log` VALUES('2841', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441643462');
INSERT INTO `wp_aryo_activity_log` VALUES('2842', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '23061', '4', '190.211.108.34', '1441643758');
INSERT INTO `wp_aryo_activity_log` VALUES('2843', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '23061', '4', '190.211.108.34', '1441644024');
INSERT INTO `wp_aryo_activity_log` VALUES('2844', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '23061', '4', '190.211.108.34', '1441644057');
INSERT INTO `wp_aryo_activity_log` VALUES('2845', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '23061', '4', '190.211.108.34', '1441644119');
INSERT INTO `wp_aryo_activity_log` VALUES('2846', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '22725', '4', '190.211.108.34', '1441645479');
INSERT INTO `wp_aryo_activity_log` VALUES('2847', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '22725', '4', '190.211.108.34', '1441646080');
INSERT INTO `wp_aryo_activity_log` VALUES('2848', 'administrator', 'updated', 'Post', 'product', 'Hotel Rancho Margot', '22725', '4', '190.211.108.34', '1441646153');
INSERT INTO `wp_aryo_activity_log` VALUES('2849', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '23062', '4', '190.211.108.34', '1441647997');
INSERT INTO `wp_aryo_activity_log` VALUES('2850', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '23062', '4', '190.211.108.34', '1441648132');
INSERT INTO `wp_aryo_activity_log` VALUES('2851', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.108.34', '1441650447');
INSERT INTO `wp_aryo_activity_log` VALUES('2852', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1441650503');
INSERT INTO `wp_aryo_activity_log` VALUES('2853', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441662492');
INSERT INTO `wp_aryo_activity_log` VALUES('2854', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.125.148', '1441664712');
INSERT INTO `wp_aryo_activity_log` VALUES('2855', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.125.148', '1441665076');
INSERT INTO `wp_aryo_activity_log` VALUES('2856', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.125.148', '1441665159');
INSERT INTO `wp_aryo_activity_log` VALUES('2857', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.125.148', '1441665293');
INSERT INTO `wp_aryo_activity_log` VALUES('2858', 'administrator', 'updated', 'Post', 'product', 'Hotel Mountain Paradise', '22724', '4', '190.211.125.148', '1441665343');
INSERT INTO `wp_aryo_activity_log` VALUES('2859', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '23063', '4', '190.211.125.148', '1441667607');
INSERT INTO `wp_aryo_activity_log` VALUES('2860', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Manoa', '23063', '4', '190.211.125.148', '1441667786');
INSERT INTO `wp_aryo_activity_log` VALUES('2861', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Manoa', '23063', '4', '190.211.125.148', '1441668076');
INSERT INTO `wp_aryo_activity_log` VALUES('2862', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Manoa', '23063', '4', '190.211.125.148', '1441668242');
INSERT INTO `wp_aryo_activity_log` VALUES('2863', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '22723', '4', '190.211.125.148', '1441670474');
INSERT INTO `wp_aryo_activity_log` VALUES('2864', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '23063', '4', '190.211.125.148', '1441670475');
INSERT INTO `wp_aryo_activity_log` VALUES('2865', 'administrator', 'updated', 'Post', 'product', 'Hotel Manoa', '22723', '4', '190.211.125.148', '1441671082');
INSERT INTO `wp_aryo_activity_log` VALUES('2866', 'administrator', 'updated', 'Post', 'product', 'Hotel Greenlagoon', '23065', '4', '190.211.125.148', '1441672566');
INSERT INTO `wp_aryo_activity_log` VALUES('2867', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.125.148', '1441672622');
INSERT INTO `wp_aryo_activity_log` VALUES('2868', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.125.148', '1441672741');
INSERT INTO `wp_aryo_activity_log` VALUES('2869', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.125.148', '1441673019');
INSERT INTO `wp_aryo_activity_log` VALUES('2870', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.125.148', '1441673149');
INSERT INTO `wp_aryo_activity_log` VALUES('2871', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1441673185');
INSERT INTO `wp_aryo_activity_log` VALUES('2872', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '77.244.254.227', '1441707323');
INSERT INTO `wp_aryo_activity_log` VALUES('2873', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441726307');
INSERT INTO `wp_aryo_activity_log` VALUES('2874', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441726312');
INSERT INTO `wp_aryo_activity_log` VALUES('2875', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '22726', '4', '190.211.108.34', '1441727008');
INSERT INTO `wp_aryo_activity_log` VALUES('2876', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '22726', '4', '190.211.108.34', '1441727770');
INSERT INTO `wp_aryo_activity_log` VALUES('2877', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '22726', '4', '190.211.108.34', '1441728115');
INSERT INTO `wp_aryo_activity_log` VALUES('2878', 'administrator', 'updated', 'Post', 'product', 'Hotel Royal Corin', '22726', '4', '190.211.108.34', '1441728208');
INSERT INTO `wp_aryo_activity_log` VALUES('2879', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.108.34', '1441729052');
INSERT INTO `wp_aryo_activity_log` VALUES('2880', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.108.34', '1441730327');
INSERT INTO `wp_aryo_activity_log` VALUES('2881', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.108.34', '1441730370');
INSERT INTO `wp_aryo_activity_log` VALUES('2882', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.108.34', '1441730725');
INSERT INTO `wp_aryo_activity_log` VALUES('2883', 'administrator', 'updated', 'Post', 'product', 'Hotel Greenlagoon', '22722', '4', '190.211.108.34', '1441731692');
INSERT INTO `wp_aryo_activity_log` VALUES('2884', 'administrator', 'updated', 'Post', 'product', 'Hotel Greenlagoon', '23065', '4', '190.211.108.34', '1441731695');
INSERT INTO `wp_aryo_activity_log` VALUES('2885', 'administrator', 'updated', 'Post', 'product', 'Hotel Greenlagoon', '22722', '4', '190.211.108.34', '1441732012');
INSERT INTO `wp_aryo_activity_log` VALUES('2886', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '22722', '4', '190.211.108.34', '1441732260');
INSERT INTO `wp_aryo_activity_log` VALUES('2887', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '22722', '4', '190.211.108.34', '1441732298');
INSERT INTO `wp_aryo_activity_log` VALUES('2888', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '22722', '4', '190.211.108.34', '1441732692');
INSERT INTO `wp_aryo_activity_log` VALUES('2889', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '22722', '4', '190.211.108.34', '1441732753');
INSERT INTO `wp_aryo_activity_log` VALUES('2890', 'administrator', 'updated', 'Post', 'product', 'Hotel Green lagoon', '23065', '4', '190.211.108.34', '1441732754');
INSERT INTO `wp_aryo_activity_log` VALUES('2891', 'administrator', 'added', 'Attachment', 'attachment', 'casa luna 1', '24117', '4', '190.211.108.34', '1441736117');
INSERT INTO `wp_aryo_activity_log` VALUES('2892', 'administrator', 'added', 'Attachment', 'attachment', 'casa luna 3', '24118', '4', '190.211.108.34', '1441736126');
INSERT INTO `wp_aryo_activity_log` VALUES('2893', 'administrator', 'added', 'Attachment', 'attachment', 'casa luna 4', '24119', '4', '190.211.108.34', '1441736139');
INSERT INTO `wp_aryo_activity_log` VALUES('2894', 'administrator', 'added', 'Attachment', 'attachment', 'casa-luna-hotel-spa', '24120', '4', '190.211.108.34', '1441736155');
INSERT INTO `wp_aryo_activity_log` VALUES('2895', 'administrator', 'added', 'Attachment', 'attachment', 'casa luna 7', '24121', '4', '190.211.108.34', '1441736830');
INSERT INTO `wp_aryo_activity_log` VALUES('2896', 'administrator', 'added', 'Attachment', 'attachment', 'casa luna 10', '24122', '4', '190.211.108.34', '1441736853');
INSERT INTO `wp_aryo_activity_log` VALUES('2897', 'administrator', 'added', 'Attachment', 'attachment', 'casa luna 12', '24123', '4', '190.211.108.34', '1441736861');
INSERT INTO `wp_aryo_activity_log` VALUES('2898', 'administrator', 'updated', 'Post', 'product', 'Hotel Casa Luna', '23066', '4', '190.211.108.34', '1441736921');
INSERT INTO `wp_aryo_activity_log` VALUES('2899', 'administrator', 'added', 'Attachment', 'attachment', 'casa_luna', '24124', '4', '190.211.108.34', '1441737359');
INSERT INTO `wp_aryo_activity_log` VALUES('2900', 'administrator', 'added', 'Attachment', 'attachment', 'casa-luna-hotel-spa', '24125', '4', '190.211.108.34', '1441737374');
INSERT INTO `wp_aryo_activity_log` VALUES('2901', 'administrator', 'added', 'Attachment', 'attachment', 'restaurant casa luna', '24126', '4', '190.211.108.34', '1441737381');
INSERT INTO `wp_aryo_activity_log` VALUES('2902', 'administrator', 'wrong_password', 'User', '', 'Management', '0', '4', '190.211.108.34', '1441738199');
INSERT INTO `wp_aryo_activity_log` VALUES('2903', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441738237');
INSERT INTO `wp_aryo_activity_log` VALUES('2904', 'administrator', 'added', 'Attachment', 'attachment', 'casa-luna-hotel-spa', '24127', '4', '190.211.108.34', '1441738605');
INSERT INTO `wp_aryo_activity_log` VALUES('2905', 'administrator', 'added', 'Attachment', 'attachment', 'restaurant casa luna', '24128', '4', '190.211.108.34', '1441738611');
INSERT INTO `wp_aryo_activity_log` VALUES('2906', 'administrator', 'updated', 'Post', 'product', 'Hotel Casa Luna', '23066', '4', '190.211.108.34', '1441738647');
INSERT INTO `wp_aryo_activity_log` VALUES('2907', 'administrator', 'updated', 'Post', 'product', 'Hotel Casa Luna', '22720', '4', '190.211.108.34', '1441739475');
INSERT INTO `wp_aryo_activity_log` VALUES('2908', 'administrator', 'updated', 'Post', 'product', 'Hotel Casa Luna', '22720', '4', '190.211.108.34', '1441739773');
INSERT INTO `wp_aryo_activity_log` VALUES('2909', 'administrator', 'updated', 'Post', 'product', 'The Baldi Resort and Spa', '23067', '4', '190.211.108.34', '1441741665');
INSERT INTO `wp_aryo_activity_log` VALUES('2910', 'administrator', 'updated', 'Post', 'product', 'The Baldi Resort and Spa', '23067', '4', '190.211.108.34', '1441742616');
INSERT INTO `wp_aryo_activity_log` VALUES('2911', 'administrator', 'updated', 'Post', 'product', 'Hotel Baldi', '22719', '4', '190.211.108.34', '1441744440');
INSERT INTO `wp_aryo_activity_log` VALUES('2912', 'administrator', 'updated', 'Post', 'product', 'Hotel Baldi', '23067', '4', '190.211.108.34', '1441744441');
INSERT INTO `wp_aryo_activity_log` VALUES('2913', 'administrator', 'updated', 'Post', 'product', 'Baldi Resort and Spa', '22719', '4', '190.211.108.34', '1441744615');
INSERT INTO `wp_aryo_activity_log` VALUES('2914', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441744952');
INSERT INTO `wp_aryo_activity_log` VALUES('2915', 'administrator', 'updated', 'Post', 'product', 'Baldi Resort and Spa', '22719', '4', '190.211.108.34', '1441745348');
INSERT INTO `wp_aryo_activity_log` VALUES('2916', 'administrator', 'updated', 'Post', 'product', 'Baldi Resort and Spa', '22719', '4', '190.211.108.34', '1441745464');
INSERT INTO `wp_aryo_activity_log` VALUES('2917', 'administrator', 'updated', 'Post', 'product', 'Baldi Resort and Spa', '23067', '4', '190.211.108.34', '1441745465');
INSERT INTO `wp_aryo_activity_log` VALUES('2918', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441746361');
INSERT INTO `wp_aryo_activity_log` VALUES('2919', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441746489');
INSERT INTO `wp_aryo_activity_log` VALUES('2920', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441746893');
INSERT INTO `wp_aryo_activity_log` VALUES('2921', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441753523');
INSERT INTO `wp_aryo_activity_log` VALUES('2922', 'administrator', 'added', 'Attachment', 'attachment', 'Slow-Journey-Leatherback-Turtle-Costa-Rica', '24132', '4', '190.211.108.34', '1441753594');
INSERT INTO `wp_aryo_activity_log` VALUES('2923', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '91.219.236.232', '1441778538');
INSERT INTO `wp_aryo_activity_log` VALUES('2924', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441806529');
INSERT INTO `wp_aryo_activity_log` VALUES('2925', 'administrator', 'added', 'Attachment', 'attachment', '1381693212', '24133', '4', '190.211.108.34', '1441806819');
INSERT INTO `wp_aryo_activity_log` VALUES('2926', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.108.34', '1441810306');
INSERT INTO `wp_aryo_activity_log` VALUES('2927', 'administrator', 'added', 'Attachment', 'attachment', 'Arenal-Springs-', '24135', '4', '190.211.108.34', '1441811919');
INSERT INTO `wp_aryo_activity_log` VALUES('2928', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.108.34', '1441812007');
INSERT INTO `wp_aryo_activity_log` VALUES('2929', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.108.34', '1441813939');
INSERT INTO `wp_aryo_activity_log` VALUES('2930', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.108.34', '1441814207');
INSERT INTO `wp_aryo_activity_log` VALUES('2931', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.108.34', '1441814240');
INSERT INTO `wp_aryo_activity_log` VALUES('2932', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '22718', '4', '190.211.108.34', '1441816641');
INSERT INTO `wp_aryo_activity_log` VALUES('2933', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '22718', '4', '190.211.108.34', '1441816757');
INSERT INTO `wp_aryo_activity_log` VALUES('2934', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '22718', '4', '190.211.108.34', '1441817575');
INSERT INTO `wp_aryo_activity_log` VALUES('2935', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Springs', '23069', '4', '190.211.108.34', '1441817577');
INSERT INTO `wp_aryo_activity_log` VALUES('2936', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Lodge', '23070', '4', '190.211.108.34', '1441825497');
INSERT INTO `wp_aryo_activity_log` VALUES('2937', 'administrator', 'added', 'Attachment', 'attachment', 'ARENAL LODGE', '24138', '4', '190.211.108.34', '1441825654');
INSERT INTO `wp_aryo_activity_log` VALUES('2938', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Lodge', '23070', '4', '190.211.108.34', '1441825681');
INSERT INTO `wp_aryo_activity_log` VALUES('2939', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1441826820');
INSERT INTO `wp_aryo_activity_log` VALUES('2940', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1441832443');
INSERT INTO `wp_aryo_activity_log` VALUES('2941', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Lodge', '22717', '4', '190.211.125.148', '1441836817');
INSERT INTO `wp_aryo_activity_log` VALUES('2942', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Lodge', '22717', '4', '190.211.125.148', '1441837080');
INSERT INTO `wp_aryo_activity_log` VALUES('2943', 'administrator', 'updated', 'Post', 'product', 'Hotel Arenal Lodge', '23070', '4', '190.211.125.148', '1441837081');
INSERT INTO `wp_aryo_activity_log` VALUES('2944', 'administrator', 'deleted', 'Post', 'product', 'Paseo de las Damas Inn', '22716', '4', '190.211.125.148', '1441837630');
INSERT INTO `wp_aryo_activity_log` VALUES('2945', 'administrator', 'deleted', 'Post', 'product', 'Paseo de las Damas Inn', '23071', '4', '190.211.125.148', '1441837665');
INSERT INTO `wp_aryo_activity_log` VALUES('2946', 'administrator', 'updated', 'Post', 'product', 'Hotel Asclepios', '22706', '4', '190.211.125.148', '1441838384');
INSERT INTO `wp_aryo_activity_log` VALUES('2947', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '22705', '4', '190.211.125.148', '1441838628');
INSERT INTO `wp_aryo_activity_log` VALUES('2948', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '23074', '4', '190.211.125.148', '1441838629');
INSERT INTO `wp_aryo_activity_log` VALUES('2949', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840020');
INSERT INTO `wp_aryo_activity_log` VALUES('2950', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840227');
INSERT INTO `wp_aryo_activity_log` VALUES('2951', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840313');
INSERT INTO `wp_aryo_activity_log` VALUES('2952', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840542');
INSERT INTO `wp_aryo_activity_log` VALUES('2953', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840640');
INSERT INTO `wp_aryo_activity_log` VALUES('2954', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840766');
INSERT INTO `wp_aryo_activity_log` VALUES('2955', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840833');
INSERT INTO `wp_aryo_activity_log` VALUES('2956', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441840931');
INSERT INTO `wp_aryo_activity_log` VALUES('2957', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441841118');
INSERT INTO `wp_aryo_activity_log` VALUES('2958', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441842665');
INSERT INTO `wp_aryo_activity_log` VALUES('2959', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441842786');
INSERT INTO `wp_aryo_activity_log` VALUES('2960', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441843013');
INSERT INTO `wp_aryo_activity_log` VALUES('2961', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441843660');
INSERT INTO `wp_aryo_activity_log` VALUES('2962', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441843979');
INSERT INTO `wp_aryo_activity_log` VALUES('2963', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '22704', '4', '190.211.125.148', '1441846407');
INSERT INTO `wp_aryo_activity_log` VALUES('2964', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '22704', '4', '190.211.125.148', '1441846795');
INSERT INTO `wp_aryo_activity_log` VALUES('2965', 'administrator', 'updated', 'Post', 'product', 'Hotel Brillasol', '23075', '4', '190.211.125.148', '1441847707');
INSERT INTO `wp_aryo_activity_log` VALUES('2966', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1441847854');
INSERT INTO `wp_aryo_activity_log` VALUES('2967', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '128.199.165.212', '1441853347');
INSERT INTO `wp_aryo_activity_log` VALUES('2968', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '104.167.103.52', '1441965274');
INSERT INTO `wp_aryo_activity_log` VALUES('2969', 'guest', 'logged_in', 'User', '', 'admin', '1', '1', '201.193.55.54', '1441994167');
INSERT INTO `wp_aryo_activity_log` VALUES('2970', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1441995978');
INSERT INTO `wp_aryo_activity_log` VALUES('2971', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.108.34', '1441997861');
INSERT INTO `wp_aryo_activity_log` VALUES('2972', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.108.34', '1441997958');
INSERT INTO `wp_aryo_activity_log` VALUES('2973', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.108.34', '1441998431');
INSERT INTO `wp_aryo_activity_log` VALUES('2974', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '23072', '4', '190.211.108.34', '1441998793');
INSERT INTO `wp_aryo_activity_log` VALUES('2975', 'administrator', 'updated', 'Post', 'product', 'Hotel Santa Maria Inn', '22707', '4', '190.211.108.34', '1442000355');
INSERT INTO `wp_aryo_activity_log` VALUES('2976', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1442001950');
INSERT INTO `wp_aryo_activity_log` VALUES('2977', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '91.219.236.232', '1442002802');
INSERT INTO `wp_aryo_activity_log` VALUES('2978', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '85.93.218.204', '1442002802');
INSERT INTO `wp_aryo_activity_log` VALUES('2979', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '85.93.218.204', '1442002806');
INSERT INTO `wp_aryo_activity_log` VALUES('2980', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1442005456');
INSERT INTO `wp_aryo_activity_log` VALUES('2981', 'administrator', 'added', 'Attachment', 'attachment', 'DSC00081', '24144', '4', '190.211.108.34', '1442005572');
INSERT INTO `wp_aryo_activity_log` VALUES('2982', 'administrator', 'updated', 'Attachment', 'attachment', 'DSC00081', '24144', '4', '190.211.108.34', '1442005687');
INSERT INTO `wp_aryo_activity_log` VALUES('2983', 'administrator', 'added', 'Attachment', 'attachment', 'DSC00090', '24145', '4', '190.211.108.34', '1442006070');
INSERT INTO `wp_aryo_activity_log` VALUES('2984', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista 1', '24146', '4', '190.211.108.34', '1442006294');
INSERT INTO `wp_aryo_activity_log` VALUES('2985', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge 4', '24147', '4', '190.211.108.34', '1442006303');
INSERT INTO `wp_aryo_activity_log` VALUES('2986', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge 6', '24148', '4', '190.211.108.34', '1442006309');
INSERT INTO `wp_aryo_activity_log` VALUES('2987', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge 7', '24149', '4', '190.211.108.34', '1442006318');
INSERT INTO `wp_aryo_activity_log` VALUES('2988', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge 9', '24150', '4', '190.211.108.34', '1442006325');
INSERT INTO `wp_aryo_activity_log` VALUES('2989', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge', '24151', '4', '190.211.108.34', '1442006340');
INSERT INTO `wp_aryo_activity_log` VALUES('2990', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge2', '24152', '4', '190.211.108.34', '1442006355');
INSERT INTO `wp_aryo_activity_log` VALUES('2991', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista lodge3', '24153', '4', '190.211.108.34', '1442006364');
INSERT INTO `wp_aryo_activity_log` VALUES('2992', 'administrator', 'added', 'Attachment', 'attachment', 'buena vista restaurant', '24154', '4', '190.211.108.34', '1442006372');
INSERT INTO `wp_aryo_activity_log` VALUES('2993', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '23074', '4', '190.211.108.34', '1442006515');
INSERT INTO `wp_aryo_activity_log` VALUES('2994', 'administrator', 'deleted', 'Attachment', 'attachment', 'DSC00081', '24144', '4', '190.211.108.34', '1442006518');
INSERT INTO `wp_aryo_activity_log` VALUES('2995', 'administrator', 'deleted', 'Attachment', 'attachment', 'DSC00090', '24145', '4', '190.211.108.34', '1442006523');
INSERT INTO `wp_aryo_activity_log` VALUES('2996', 'administrator', 'added', 'Attachment', 'attachment', 'DSC00081-001', '24155', '4', '190.211.108.34', '1442006545');
INSERT INTO `wp_aryo_activity_log` VALUES('2997', 'administrator', 'added', 'Attachment', 'attachment', 'Slow-Journey-Leatherback-Turtle-Costa-Rica1', '24156', '4', '190.211.108.34', '1442006732');
INSERT INTO `wp_aryo_activity_log` VALUES('2998', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '23074', '4', '190.211.108.34', '1442006762');
INSERT INTO `wp_aryo_activity_log` VALUES('2999', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '23074', '4', '190.211.108.34', '1442006830');
INSERT INTO `wp_aryo_activity_log` VALUES('3000', 'administrator', 'added', 'Attachment', 'attachment', 'DSC00089', '24158', '4', '190.211.108.34', '1442007433');
INSERT INTO `wp_aryo_activity_log` VALUES('3001', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel copa de arbol 03', '24159', '4', '190.211.108.34', '1442007665');
INSERT INTO `wp_aryo_activity_log` VALUES('3002', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel Puntarenas Beach 04', '24160', '4', '190.211.108.34', '1442007760');
INSERT INTO `wp_aryo_activity_log` VALUES('3003', 'administrator', 'deleted', 'Attachment', 'attachment', 'DSC00089', '24158', '4', '190.211.108.34', '1442007882');
INSERT INTO `wp_aryo_activity_log` VALUES('3004', 'administrator', 'deleted', 'Attachment', 'attachment', 'DSC00081-001', '24155', '4', '190.211.108.34', '1442007884');
INSERT INTO `wp_aryo_activity_log` VALUES('3005', 'administrator', 'deleted', 'Attachment', 'attachment', 'Hotel copa de arbol 03', '24159', '4', '190.211.108.34', '1442007886');
INSERT INTO `wp_aryo_activity_log` VALUES('3006', 'administrator', 'deleted', 'Attachment', 'attachment', 'Hotel Puntarenas Beach 04', '24160', '4', '190.211.108.34', '1442007891');
INSERT INTO `wp_aryo_activity_log` VALUES('3007', 'administrator', 'added', 'Attachment', 'attachment', 'hotel hilto garden 07', '24161', '4', '190.211.108.34', '1442007923');
INSERT INTO `wp_aryo_activity_log` VALUES('3008', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '22705', '4', '190.211.108.34', '1442008120');
INSERT INTO `wp_aryo_activity_log` VALUES('3009', 'administrator', 'added', 'Attachment', 'attachment', '_MG_0025', '24162', '4', '190.211.108.34', '1442008179');
INSERT INTO `wp_aryo_activity_log` VALUES('3010', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '22705', '4', '190.211.108.34', '1442008339');
INSERT INTO `wp_aryo_activity_log` VALUES('3011', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel copa de arbol 06', '24163', '4', '190.211.108.34', '1442008366');
INSERT INTO `wp_aryo_activity_log` VALUES('3012', 'administrator', 'updated', 'Post', 'product', 'Buena Vista Lodge', '23074', '4', '190.211.108.34', '1442008544');
INSERT INTO `wp_aryo_activity_log` VALUES('3013', 'administrator', 'updated', 'Post', 'product', 'Hotel Asclepios', '23073', '4', '190.211.108.34', '1442011029');
INSERT INTO `wp_aryo_activity_log` VALUES('3014', 'administrator', 'updated', 'Post', 'product', 'Hotel Asclepios', '23073', '4', '190.211.108.34', '1442011155');
INSERT INTO `wp_aryo_activity_log` VALUES('3015', 'administrator', 'updated', 'Post', 'product', 'Hotel Asclepios', '23073', '4', '190.211.108.34', '1442011223');
INSERT INTO `wp_aryo_activity_log` VALUES('3016', 'administrator', 'updated', 'Post', 'product', 'Hotel Asclepios', '22706', '4', '190.211.108.34', '1442012021');
INSERT INTO `wp_aryo_activity_log` VALUES('3017', 'administrator', 'created', 'Post', 'product', 'Xandari Resort', '24166', '4', '190.211.108.34', '1442012793');
INSERT INTO `wp_aryo_activity_log` VALUES('3018', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442012813');
INSERT INTO `wp_aryo_activity_log` VALUES('3019', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442012840');
INSERT INTO `wp_aryo_activity_log` VALUES('3020', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442012934');
INSERT INTO `wp_aryo_activity_log` VALUES('3021', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013039');
INSERT INTO `wp_aryo_activity_log` VALUES('3022', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013108');
INSERT INTO `wp_aryo_activity_log` VALUES('3023', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013183');
INSERT INTO `wp_aryo_activity_log` VALUES('3024', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013258');
INSERT INTO `wp_aryo_activity_log` VALUES('3025', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013337');
INSERT INTO `wp_aryo_activity_log` VALUES('3026', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013410');
INSERT INTO `wp_aryo_activity_log` VALUES('3027', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013561');
INSERT INTO `wp_aryo_activity_log` VALUES('3028', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013636');
INSERT INTO `wp_aryo_activity_log` VALUES('3029', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013701');
INSERT INTO `wp_aryo_activity_log` VALUES('3030', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013777');
INSERT INTO `wp_aryo_activity_log` VALUES('3031', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013854');
INSERT INTO `wp_aryo_activity_log` VALUES('3032', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442013929');
INSERT INTO `wp_aryo_activity_log` VALUES('3033', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442014006');
INSERT INTO `wp_aryo_activity_log` VALUES('3034', 'administrator', 'added', 'Attachment', 'attachment', 'xandari6', '24167', '4', '190.211.108.34', '1442014464');
INSERT INTO `wp_aryo_activity_log` VALUES('3035', 'administrator', 'added', 'Attachment', 'attachment', 'xandari 1', '24168', '4', '190.211.108.34', '1442014493');
INSERT INTO `wp_aryo_activity_log` VALUES('3036', 'administrator', 'added', 'Attachment', 'attachment', 'xandari room', '24169', '4', '190.211.108.34', '1442014500');
INSERT INTO `wp_aryo_activity_log` VALUES('3037', 'administrator', 'added', 'Attachment', 'attachment', 'xandari-2', '24170', '4', '190.211.108.34', '1442014512');
INSERT INTO `wp_aryo_activity_log` VALUES('3038', 'administrator', 'added', 'Attachment', 'attachment', 'xandari3', '24171', '4', '190.211.108.34', '1442014520');
INSERT INTO `wp_aryo_activity_log` VALUES('3039', 'administrator', 'added', 'Attachment', 'attachment', 'xandari6', '24172', '4', '190.211.108.34', '1442014529');
INSERT INTO `wp_aryo_activity_log` VALUES('3040', 'administrator', 'added', 'Attachment', 'attachment', 'xandari-resort-spa', '24173', '4', '190.211.108.34', '1442014534');
INSERT INTO `wp_aryo_activity_log` VALUES('3041', 'administrator', 'added', 'Attachment', 'attachment', 'xandari-spa', '24174', '4', '190.211.108.34', '1442014543');
INSERT INTO `wp_aryo_activity_log` VALUES('3042', 'administrator', 'added', 'Attachment', 'attachment', 'Xandari-Villa', '24175', '4', '190.211.108.34', '1442014549');
INSERT INTO `wp_aryo_activity_log` VALUES('3043', 'administrator', 'added', 'Attachment', 'attachment', 'xandari7', '24176', '4', '190.211.108.34', '1442014626');
INSERT INTO `wp_aryo_activity_log` VALUES('3044', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442014654');
INSERT INTO `wp_aryo_activity_log` VALUES('3045', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24166', '4', '190.211.108.34', '1442014909');
INSERT INTO `wp_aryo_activity_log` VALUES('3046', 'administrator', 'created', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015064');
INSERT INTO `wp_aryo_activity_log` VALUES('3047', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015188');
INSERT INTO `wp_aryo_activity_log` VALUES('3048', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015252');
INSERT INTO `wp_aryo_activity_log` VALUES('3049', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015328');
INSERT INTO `wp_aryo_activity_log` VALUES('3050', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015404');
INSERT INTO `wp_aryo_activity_log` VALUES('3051', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015473');
INSERT INTO `wp_aryo_activity_log` VALUES('3052', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015568');
INSERT INTO `wp_aryo_activity_log` VALUES('3053', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015646');
INSERT INTO `wp_aryo_activity_log` VALUES('3054', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015724');
INSERT INTO `wp_aryo_activity_log` VALUES('3055', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015842');
INSERT INTO `wp_aryo_activity_log` VALUES('3056', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015918');
INSERT INTO `wp_aryo_activity_log` VALUES('3057', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442015993');
INSERT INTO `wp_aryo_activity_log` VALUES('3058', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442016061');
INSERT INTO `wp_aryo_activity_log` VALUES('3059', 'administrator', 'updated', 'Post', 'product', 'Xandari Resort and Spa', '24177', '4', '190.211.108.34', '1442016187');
INSERT INTO `wp_aryo_activity_log` VALUES('3060', 'administrator', 'created', 'Post', 'product', 'Trapp Family Country Inn', '24178', '4', '190.211.108.34', '1442016577');
INSERT INTO `wp_aryo_activity_log` VALUES('3061', 'administrator', 'created', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442016696');
INSERT INTO `wp_aryo_activity_log` VALUES('3062', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442016786');
INSERT INTO `wp_aryo_activity_log` VALUES('3063', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442016880');
INSERT INTO `wp_aryo_activity_log` VALUES('3064', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442017150');
INSERT INTO `wp_aryo_activity_log` VALUES('3065', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442017226');
INSERT INTO `wp_aryo_activity_log` VALUES('3066', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442017338');
INSERT INTO `wp_aryo_activity_log` VALUES('3067', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442017432');
INSERT INTO `wp_aryo_activity_log` VALUES('3068', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442017506');
INSERT INTO `wp_aryo_activity_log` VALUES('3069', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442017550');
INSERT INTO `wp_aryo_activity_log` VALUES('3070', 'administrator', 'added', 'Attachment', 'attachment', 'trap family 5', '24180', '4', '190.211.108.34', '1442018025');
INSERT INTO `wp_aryo_activity_log` VALUES('3071', 'administrator', 'added', 'Attachment', 'attachment', 'The-Trapp-Family-', '24181', '4', '190.211.108.34', '1442018078');
INSERT INTO `wp_aryo_activity_log` VALUES('3072', 'administrator', 'added', 'Attachment', 'attachment', 'trap family 3', '24182', '4', '190.211.108.34', '1442018085');
INSERT INTO `wp_aryo_activity_log` VALUES('3073', 'administrator', 'added', 'Attachment', 'attachment', 'trap family 5', '24183', '4', '190.211.108.34', '1442018094');
INSERT INTO `wp_aryo_activity_log` VALUES('3074', 'administrator', 'added', 'Attachment', 'attachment', 'trap family 6', '24184', '4', '190.211.108.34', '1442018102');
INSERT INTO `wp_aryo_activity_log` VALUES('3075', 'administrator', 'added', 'Attachment', 'attachment', 'trap family 7', '24185', '4', '190.211.108.34', '1442018107');
INSERT INTO `wp_aryo_activity_log` VALUES('3076', 'administrator', 'added', 'Attachment', 'attachment', 'trap family', '24186', '4', '190.211.108.34', '1442018114');
INSERT INTO `wp_aryo_activity_log` VALUES('3077', 'administrator', 'added', 'Attachment', 'attachment', 'trap family1', '24187', '4', '190.211.108.34', '1442018119');
INSERT INTO `wp_aryo_activity_log` VALUES('3078', 'administrator', 'added', 'Attachment', 'attachment', 'Trapp_Family_Country_Inn', '24188', '4', '190.211.108.34', '1442018125');
INSERT INTO `wp_aryo_activity_log` VALUES('3079', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel_Trapp_Family_Country_Inn_restaurant_1', '24189', '4', '190.211.108.34', '1442018149');
INSERT INTO `wp_aryo_activity_log` VALUES('3080', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-trapp-family-country', '24190', '4', '190.211.108.34', '1442018154');
INSERT INTO `wp_aryo_activity_log` VALUES('3081', 'administrator', 'added', 'Attachment', 'attachment', 'trap family10', '24191', '4', '190.211.108.34', '1442018286');
INSERT INTO `wp_aryo_activity_log` VALUES('3082', 'administrator', 'added', 'Attachment', 'attachment', 'Trapp-Family 9', '24192', '4', '190.211.108.34', '1442018293');
INSERT INTO `wp_aryo_activity_log` VALUES('3083', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24179', '4', '190.211.108.34', '1442018310');
INSERT INTO `wp_aryo_activity_log` VALUES('3084', 'administrator', 'created', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018502');
INSERT INTO `wp_aryo_activity_log` VALUES('3085', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018530');
INSERT INTO `wp_aryo_activity_log` VALUES('3086', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018603');
INSERT INTO `wp_aryo_activity_log` VALUES('3087', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018741');
INSERT INTO `wp_aryo_activity_log` VALUES('3088', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018816');
INSERT INTO `wp_aryo_activity_log` VALUES('3089', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018891');
INSERT INTO `wp_aryo_activity_log` VALUES('3090', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442018967');
INSERT INTO `wp_aryo_activity_log` VALUES('3091', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442019033');
INSERT INTO `wp_aryo_activity_log` VALUES('3092', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442019124');
INSERT INTO `wp_aryo_activity_log` VALUES('3093', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442019198');
INSERT INTO `wp_aryo_activity_log` VALUES('3094', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442019223');
INSERT INTO `wp_aryo_activity_log` VALUES('3095', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442019614');
INSERT INTO `wp_aryo_activity_log` VALUES('3096', 'administrator', 'updated', 'Post', 'product', 'Trapp Family Country Inn', '24193', '4', '190.211.108.34', '1442019658');
INSERT INTO `wp_aryo_activity_log` VALUES('3097', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1442019789');
INSERT INTO `wp_aryo_activity_log` VALUES('3098', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442024905');
INSERT INTO `wp_aryo_activity_log` VALUES('3099', 'administrator', 'updated', 'Post', 'product', 'Villagio flor del pacífico', '23334', '4', '190.211.125.148', '1442027342');
INSERT INTO `wp_aryo_activity_log` VALUES('3100', 'administrator', 'updated', 'Post', 'product', 'Villagio flor del pacífico', '23343', '4', '190.211.125.148', '1442027343');
INSERT INTO `wp_aryo_activity_log` VALUES('3101', 'administrator', 'updated', 'Post', 'product', 'Villagio flor del pacífico', '23343', '4', '190.211.125.148', '1442028668');
INSERT INTO `wp_aryo_activity_log` VALUES('3102', 'administrator', 'updated', 'Post', 'product', 'Villagio flor del pacífico', '23343', '4', '190.211.125.148', '1442029155');
INSERT INTO `wp_aryo_activity_log` VALUES('3103', 'administrator', 'updated', 'Post', 'product', 'Sugar Beach Hotel', '23315', '4', '190.211.125.148', '1442030694');
INSERT INTO `wp_aryo_activity_log` VALUES('3104', 'administrator', 'updated', 'Post', 'product', 'Sugar Beach Hotel', '23332', '4', '190.211.125.148', '1442030697');
INSERT INTO `wp_aryo_activity_log` VALUES('3105', 'administrator', 'updated', 'Post', 'product', 'Sugar Beach Hotel', '23332', '4', '190.211.125.148', '1442032964');
INSERT INTO `wp_aryo_activity_log` VALUES('3106', 'administrator', 'updated', 'Post', 'product', 'Sugar Beach Hotel', '23332', '4', '190.211.125.148', '1442033512');
INSERT INTO `wp_aryo_activity_log` VALUES('3107', 'administrator', 'updated', 'Post', 'product', 'Sugar Beach Hotel', '23332', '4', '190.211.125.148', '1442033654');
INSERT INTO `wp_aryo_activity_log` VALUES('3108', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1442033757');
INSERT INTO `wp_aryo_activity_log` VALUES('3109', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '162.221.202.230', '1442038447');
INSERT INTO `wp_aryo_activity_log` VALUES('3110', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1442069904');
INSERT INTO `wp_aryo_activity_log` VALUES('3111', 'administrator', 'logged_in', 'User', '', 'management', '4', '4', '190.211.108.34', '1442069911');
INSERT INTO `wp_aryo_activity_log` VALUES('3112', 'administrator', 'updated', 'Post', 'product', 'Hotel Giada', '23305', '4', '190.211.108.34', '1442074527');
INSERT INTO `wp_aryo_activity_log` VALUES('3113', 'administrator', 'updated', 'Post', 'product', 'Hotel Giada', '23314', '4', '190.211.108.34', '1442074528');
INSERT INTO `wp_aryo_activity_log` VALUES('3114', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24041', '4', '190.211.108.34', '1442076566');
INSERT INTO `wp_aryo_activity_log` VALUES('3115', 'administrator', 'updated', 'Post', 'product', 'Hotel Giada', '23314', '4', '190.211.108.34', '1442079020');
INSERT INTO `wp_aryo_activity_log` VALUES('3116', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23263', '4', '190.211.108.34', '1442081755');
INSERT INTO `wp_aryo_activity_log` VALUES('3117', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442081756');
INSERT INTO `wp_aryo_activity_log` VALUES('3118', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23263', '4', '190.211.108.34', '1442082044');
INSERT INTO `wp_aryo_activity_log` VALUES('3119', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23263', '4', '190.211.108.34', '1442082117');
INSERT INTO `wp_aryo_activity_log` VALUES('3120', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442086207');
INSERT INTO `wp_aryo_activity_log` VALUES('3121', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442086310');
INSERT INTO `wp_aryo_activity_log` VALUES('3122', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442086425');
INSERT INTO `wp_aryo_activity_log` VALUES('3123', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442086577');
INSERT INTO `wp_aryo_activity_log` VALUES('3124', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442086734');
INSERT INTO `wp_aryo_activity_log` VALUES('3125', 'administrator', 'updated', 'Post', 'product', 'Hotel Flamingo Beach', '23279', '4', '190.211.108.34', '1442086837');
INSERT INTO `wp_aryo_activity_log` VALUES('3126', 'administrator', 'updated', 'Post', 'product', 'Hotel Ecoplaya', '23245', '4', '190.211.108.34', '1442088096');
INSERT INTO `wp_aryo_activity_log` VALUES('3127', 'administrator', 'added', 'Attachment', 'attachment', 'ecoplaya-guanacaste-costa', '24201', '4', '190.211.108.34', '1442088624');
INSERT INTO `wp_aryo_activity_log` VALUES('3128', 'administrator', 'added', 'Attachment', 'attachment', 'Ecoplaya-Beach', '24202', '4', '190.211.108.34', '1442088664');
INSERT INTO `wp_aryo_activity_log` VALUES('3129', 'administrator', 'added', 'Attachment', 'attachment', 'ecoplaya-beach-resort', '24203', '4', '190.211.108.34', '1442088672');
INSERT INTO `wp_aryo_activity_log` VALUES('3130', 'administrator', 'added', 'Attachment', 'attachment', 'Piscina__Restaurante_Ecoplaya_J', '24204', '4', '190.211.108.34', '1442088676');
INSERT INTO `wp_aryo_activity_log` VALUES('3131', 'administrator', 'updated', 'Post', 'product', 'Hotel Ecoplaya', '23245', '4', '190.211.108.34', '1442088705');
INSERT INTO `wp_aryo_activity_log` VALUES('3132', 'administrator', 'updated', 'Post', 'product', 'Hotel Ecoplaya', '23245', '4', '190.211.108.34', '1442088857');
INSERT INTO `wp_aryo_activity_log` VALUES('3133', 'administrator', 'updated', 'Post', 'product', 'Hotel Ecoplaya', '23261', '4', '190.211.108.34', '1442088858');
INSERT INTO `wp_aryo_activity_log` VALUES('3134', 'administrator', 'updated', 'Post', 'product', 'Hotel Ecoplaya', '23261', '4', '190.211.108.34', '1442089584');
INSERT INTO `wp_aryo_activity_log` VALUES('3135', 'administrator', 'updated', 'Post', 'product', 'Hotel Ecoplaya', '23261', '4', '190.211.108.34', '1442089641');
INSERT INTO `wp_aryo_activity_log` VALUES('3136', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.108.34', '1442089807');
INSERT INTO `wp_aryo_activity_log` VALUES('3137', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '188.214.135.68', '1442113210');
INSERT INTO `wp_aryo_activity_log` VALUES('3138', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442117030');
INSERT INTO `wp_aryo_activity_log` VALUES('3139', 'administrator', 'updated', 'Post', 'product', 'Early bird walk', '23868', '4', '190.211.125.148', '1442117256');
INSERT INTO `wp_aryo_activity_log` VALUES('3140', 'administrator', 'added', 'Attachment', 'attachment', 'la_fortuna_park', '24206', '4', '190.211.125.148', '1442117654');
INSERT INTO `wp_aryo_activity_log` VALUES('3141', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Arenal', '114', '4', '190.211.125.148', '1442117689');
INSERT INTO `wp_aryo_activity_log` VALUES('3142', 'administrator', 'updated', 'Post', 'product', 'Hiking to celeste river', '23852', '4', '190.211.125.148', '1442117882');
INSERT INTO `wp_aryo_activity_log` VALUES('3143', 'administrator', 'updated', 'Post', 'product', 'Hiking to celeste river', '23852', '4', '190.211.125.148', '1442118048');
INSERT INTO `wp_aryo_activity_log` VALUES('3144', 'administrator', 'updated', 'Post', 'product', 'Horseback riding', '23122', '4', '190.211.125.148', '1442118346');
INSERT INTO `wp_aryo_activity_log` VALUES('3145', 'administrator', 'updated', 'Post', 'product', 'Horseback riding', '23122', '4', '190.211.125.148', '1442118453');
INSERT INTO `wp_aryo_activity_log` VALUES('3146', 'administrator', 'updated', 'Post', 'product', 'Horseback riding', '23122', '4', '190.211.125.148', '1442118493');
INSERT INTO `wp_aryo_activity_log` VALUES('3147', 'administrator', 'updated', 'Post', 'product', 'water rafting 2/3:', '23119', '4', '190.211.125.148', '1442118635');
INSERT INTO `wp_aryo_activity_log` VALUES('3148', 'administrator', 'updated', 'Post', 'product', 'Rappel', '23118', '4', '190.211.125.148', '1442119164');
INSERT INTO `wp_aryo_activity_log` VALUES('3149', 'administrator', 'updated', 'Post', 'product', 'Zipline', '23115', '4', '190.211.125.148', '1442119318');
INSERT INTO `wp_aryo_activity_log` VALUES('3150', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23114', '4', '190.211.125.148', '1442119865');
INSERT INTO `wp_aryo_activity_log` VALUES('3151', 'administrator', 'updated', 'Post', 'product', 'Venado Caves', '23111', '4', '190.211.125.148', '1442120072');
INSERT INTO `wp_aryo_activity_log` VALUES('3152', 'administrator', 'updated', 'Post', 'product', 'Venado Caves', '23111', '4', '190.211.125.148', '1442120158');
INSERT INTO `wp_aryo_activity_log` VALUES('3153', 'administrator', 'updated', 'Post', 'product', 'Cerro Chato', '23110', '4', '190.211.125.148', '1442120792');
INSERT INTO `wp_aryo_activity_log` VALUES('3154', 'administrator', 'updated', 'Post', 'product', 'Hanging Bridges', '23106', '4', '190.211.125.148', '1442121046');
INSERT INTO `wp_aryo_activity_log` VALUES('3155', 'administrator', 'updated', 'Post', 'product', 'Volcano Hike', '23102', '4', '190.211.125.148', '1442121382');
INSERT INTO `wp_aryo_activity_log` VALUES('3156', 'administrator', 'updated', 'Post', 'product', 'Volcano Hike', '23103', '4', '190.211.125.148', '1442121383');
INSERT INTO `wp_aryo_activity_log` VALUES('3157', 'administrator', 'updated', 'Post', 'product', 'ATV QUAS', '23082', '4', '190.211.125.148', '1442121632');
INSERT INTO `wp_aryo_activity_log` VALUES('3158', 'administrator', 'updated', 'Post', 'product', 'Caño Negro', '23084', '4', '190.211.125.148', '1442121899');
INSERT INTO `wp_aryo_activity_log` VALUES('3159', 'administrator', 'updated', 'Post', 'product', 'Caño Negro', '23084', '4', '190.211.125.148', '1442121992');
INSERT INTO `wp_aryo_activity_log` VALUES('3160', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.125.148', '1442122240');
INSERT INTO `wp_aryo_activity_log` VALUES('3161', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '23096', '4', '190.211.125.148', '1442122344');
INSERT INTO `wp_aryo_activity_log` VALUES('3162', 'administrator', 'updated', 'Post', 'product', 'safari float', '23094', '4', '190.211.125.148', '1442122485');
INSERT INTO `wp_aryo_activity_log` VALUES('3163', 'administrator', 'updated', 'Post', 'product', 'Sunsent lake', '23098', '4', '190.211.125.148', '1442122594');
INSERT INTO `wp_aryo_activity_log` VALUES('3164', 'administrator', 'updated', 'Post', 'product', 'chocolate tour', '24052', '4', '190.211.125.148', '1442123338');
INSERT INTO `wp_aryo_activity_log` VALUES('3165', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Arenal', '115', '4', '190.211.125.148', '1442123639');
INSERT INTO `wp_aryo_activity_log` VALUES('3166', 'administrator', 'updated', 'Post', 'product', 'Observación de Aves', '23861', '4', '190.211.125.148', '1442123767');
INSERT INTO `wp_aryo_activity_log` VALUES('3167', 'administrator', 'updated', 'Post', 'product', 'Observación de Aves', '23861', '4', '190.211.125.148', '1442123861');
INSERT INTO `wp_aryo_activity_log` VALUES('3168', 'administrator', 'updated', 'Post', 'product', 'Caminata a Rio Celeste', '23859', '4', '190.211.125.148', '1442124033');
INSERT INTO `wp_aryo_activity_log` VALUES('3169', 'administrator', 'updated', 'Post', 'product', 'Cabalgata tour', '23121', '4', '190.211.125.148', '1442124186');
INSERT INTO `wp_aryo_activity_log` VALUES('3170', 'administrator', 'updated', 'Post', 'product', 'tour de rafting 2/3', '23120', '4', '190.211.125.148', '1442124489');
INSERT INTO `wp_aryo_activity_log` VALUES('3171', 'administrator', 'updated', 'Post', 'product', 'Rappel', '23117', '4', '190.211.125.148', '1442124719');
INSERT INTO `wp_aryo_activity_log` VALUES('3172', 'administrator', 'updated', 'Post', 'product', 'Rappel', '23118', '4', '190.211.125.148', '1442124720');
INSERT INTO `wp_aryo_activity_log` VALUES('3173', 'administrator', 'updated', 'Post', 'product', 'Canopy', '23116', '4', '190.211.125.148', '1442124825');
INSERT INTO `wp_aryo_activity_log` VALUES('3174', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23113', '4', '190.211.125.148', '1442124992');
INSERT INTO `wp_aryo_activity_log` VALUES('3175', 'administrator', 'updated', 'Post', 'product', 'Venado Caves', '23112', '4', '190.211.125.148', '1442125372');
INSERT INTO `wp_aryo_activity_log` VALUES('3176', 'administrator', 'updated', 'Post', 'product', 'Cavernas de Venado', '23112', '4', '190.211.125.148', '1442125531');
INSERT INTO `wp_aryo_activity_log` VALUES('3177', 'administrator', 'updated', 'Post', 'product', 'Cerro Chato', '23109', '4', '190.211.125.148', '1442125653');
INSERT INTO `wp_aryo_activity_log` VALUES('3178', 'administrator', 'updated', 'Post', 'product', 'Puentes Colgantes', '23107', '4', '190.211.125.148', '1442126000');
INSERT INTO `wp_aryo_activity_log` VALUES('3179', 'administrator', 'updated', 'Post', 'product', 'ATV QUAS', '21991', '4', '190.211.125.148', '1442126271');
INSERT INTO `wp_aryo_activity_log` VALUES('3180', 'administrator', 'added', 'Attachment', 'attachment', 'blogclone.zip', '24208', '1', '201.196.92.16', '1442126280');
INSERT INTO `wp_aryo_activity_log` VALUES('3181', 'administrator', 'installed', 'Plugin', '2.0.1', 'Backup & Clone Master (shared on wplocker.com)', '0', '1', '201.196.92.16', '1442126285');
INSERT INTO `wp_aryo_activity_log` VALUES('3182', 'administrator', 'deleted', 'Attachment', 'attachment', 'blogclone.zip', '24208', '1', '201.196.92.16', '1442126285');
INSERT INTO `wp_aryo_activity_log` VALUES('3183', 'administrator', 'deleted', 'Post', 'attachment', 'blogclone.zip', '24208', '1', '201.196.92.16', '1442126285');
INSERT INTO `wp_aryo_activity_log` VALUES('3184', 'administrator', 'activated', 'Plugin', '', 'Backup & Clone Master (shared on wplocker.com)', '0', '1', '201.196.92.16', '1442126304');
INSERT INTO `wp_aryo_activity_log` VALUES('3185', 'administrator', 'updated', 'Post', 'product', 'Caño Negro', '21979', '4', '190.211.125.148', '1442126428');
INSERT INTO `wp_aryo_activity_log` VALUES('3186', 'administrator', 'updated', 'Post', 'product', 'safari en bote', '21960', '4', '190.211.125.148', '1442126594');
INSERT INTO `wp_aryo_activity_log` VALUES('3187', 'administrator', 'updated', 'Post', 'product', 'Atardecer en el lago', '21934', '4', '190.211.125.148', '1442126737');
INSERT INTO `wp_aryo_activity_log` VALUES('3188', 'administrator', 'updated', 'Post', 'product', 'Stand Up Paddle', '23113', '4', '190.211.125.148', '1442127017');
INSERT INTO `wp_aryo_activity_log` VALUES('3189', 'administrator', 'updated', 'Post', 'product', 'Kayak en el lago arenal', '21972', '4', '190.211.125.148', '1442127256');
INSERT INTO `wp_aryo_activity_log` VALUES('3190', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1442127411');
INSERT INTO `wp_aryo_activity_log` VALUES('3191', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '162.243.113.182', '1442150805');
INSERT INTO `wp_aryo_activity_log` VALUES('3192', 'administrator', 'deactivated', 'Plugin', '', 'BackupBuddy', '0', '1', '201.196.92.16', '1442156379');
INSERT INTO `wp_aryo_activity_log` VALUES('3193', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '201.196.92.16', '1442177315');
INSERT INTO `wp_aryo_activity_log` VALUES('3194', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442178796');
INSERT INTO `wp_aryo_activity_log` VALUES('3195', 'guest', 'logged_in', 'User', '', 'admin', '1', '1', '201.196.92.16', '1442178863');
INSERT INTO `wp_aryo_activity_log` VALUES('3196', 'administrator', 'added', 'Attachment', 'attachment', 'backupbuddy.zip', '24209', '1', '201.196.92.16', '1442179083');
INSERT INTO `wp_aryo_activity_log` VALUES('3197', 'administrator', 'installed', 'Plugin', '6.3.2.2', 'BackupBuddy (shared on wplocker.com)', '0', '1', '201.196.92.16', '1442179093');
INSERT INTO `wp_aryo_activity_log` VALUES('3198', 'administrator', 'deleted', 'Attachment', 'attachment', 'backupbuddy.zip', '24209', '1', '201.196.92.16', '1442179093');
INSERT INTO `wp_aryo_activity_log` VALUES('3199', 'administrator', 'deleted', 'Post', 'attachment', 'backupbuddy.zip', '24209', '1', '201.196.92.16', '1442179093');
INSERT INTO `wp_aryo_activity_log` VALUES('3200', 'administrator', 'activated', 'Plugin', '', 'BackupBuddy (shared on wplocker.com)', '0', '1', '201.196.92.16', '1442179917');
INSERT INTO `wp_aryo_activity_log` VALUES('3201', 'administrator', 'updated', 'Post', 'product', 'Hotel Conchal', '23239', '4', '190.211.125.148', '1442180483');
INSERT INTO `wp_aryo_activity_log` VALUES('3202', 'administrator', 'updated', 'Post', 'product', 'Hotel Conchal', '23239', '4', '190.211.125.148', '1442180686');
INSERT INTO `wp_aryo_activity_log` VALUES('3203', 'administrator', 'updated', 'Post', 'product', 'Hotel Conchal', '23243', '4', '190.211.125.148', '1442180687');
INSERT INTO `wp_aryo_activity_log` VALUES('3204', 'administrator', 'updated', 'Post', 'product', 'Hotel Conchal', '23239', '4', '190.211.125.148', '1442181012');
INSERT INTO `wp_aryo_activity_log` VALUES('3205', 'administrator', 'updated', 'Post', 'product', 'Hotel Conchal', '23243', '4', '190.211.125.148', '1442182110');
INSERT INTO `wp_aryo_activity_log` VALUES('3206', 'administrator', 'updated', 'Post', 'product', 'Hotel Conchal', '23243', '4', '190.211.125.148', '1442182453');
INSERT INTO `wp_aryo_activity_log` VALUES('3207', 'administrator', 'updated', 'Post', 'product', 'Hotel rip jack inn', '23035', '4', '190.211.125.148', '1442185243');
INSERT INTO `wp_aryo_activity_log` VALUES('3208', 'administrator', 'updated', 'Post', 'product', 'Hotel rip jack inn', '23035', '4', '190.211.125.148', '1442185328');
INSERT INTO `wp_aryo_activity_log` VALUES('3209', 'guest', 'logged_in', 'User', '', 'admin', '1', '1', '201.196.92.16', '1442185503');
INSERT INTO `wp_aryo_activity_log` VALUES('3210', 'administrator', 'updated', 'Post', 'product', 'Hotel rip jack inn', '23035', '4', '190.211.125.148', '1442185864');
INSERT INTO `wp_aryo_activity_log` VALUES('3211', 'administrator', 'updated', 'Post', 'product', 'Hotel rip jack inn', '22732', '4', '190.211.125.148', '1442187282');
INSERT INTO `wp_aryo_activity_log` VALUES('3212', 'administrator', 'updated', 'Post', 'product', 'Hotel rip jack inn', '22732', '4', '190.211.125.148', '1442188080');
INSERT INTO `wp_aryo_activity_log` VALUES('3213', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1442188176');
INSERT INTO `wp_aryo_activity_log` VALUES('3214', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '77.244.254.228', '1442190807');
INSERT INTO `wp_aryo_activity_log` VALUES('3215', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '141.239.152.53', '1442190810');
INSERT INTO `wp_aryo_activity_log` VALUES('3216', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '64.235.50.72', '1442229392');
INSERT INTO `wp_aryo_activity_log` VALUES('3217', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442244838');
INSERT INTO `wp_aryo_activity_log` VALUES('3218', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '79.136.42.226', '1442272627');
INSERT INTO `wp_aryo_activity_log` VALUES('3219', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442329825');
INSERT INTO `wp_aryo_activity_log` VALUES('3220', 'administrator', 'created', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442329997');
INSERT INTO `wp_aryo_activity_log` VALUES('3221', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330068');
INSERT INTO `wp_aryo_activity_log` VALUES('3222', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330337');
INSERT INTO `wp_aryo_activity_log` VALUES('3223', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330412');
INSERT INTO `wp_aryo_activity_log` VALUES('3224', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330487');
INSERT INTO `wp_aryo_activity_log` VALUES('3225', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330563');
INSERT INTO `wp_aryo_activity_log` VALUES('3226', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330648');
INSERT INTO `wp_aryo_activity_log` VALUES('3227', 'administrator', 'added', 'Attachment', 'attachment', 'Nocturna 4', '24212', '4', '190.211.114.159', '1442330839');
INSERT INTO `wp_aryo_activity_log` VALUES('3228', 'administrator', 'added', 'Attachment', 'attachment', 'Nocturna 1', '24213', '4', '190.211.114.159', '1442330878');
INSERT INTO `wp_aryo_activity_log` VALUES('3229', 'administrator', 'added', 'Attachment', 'attachment', 'Nocturna 2', '24214', '4', '190.211.114.159', '1442330883');
INSERT INTO `wp_aryo_activity_log` VALUES('3230', 'administrator', 'added', 'Attachment', 'attachment', 'Nocturna 3', '24215', '4', '190.211.114.159', '1442330888');
INSERT INTO `wp_aryo_activity_log` VALUES('3231', 'administrator', 'added', 'Attachment', 'attachment', 'Nocturna 5', '24216', '4', '190.211.114.159', '1442330892');
INSERT INTO `wp_aryo_activity_log` VALUES('3232', 'administrator', 'added', 'Attachment', 'attachment', 'Nocturna 6', '24217', '4', '190.211.114.159', '1442330897');
INSERT INTO `wp_aryo_activity_log` VALUES('3233', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442330948');
INSERT INTO `wp_aryo_activity_log` VALUES('3234', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442331032');
INSERT INTO `wp_aryo_activity_log` VALUES('3235', 'guest', 'updated', 'Core', '', 'WordPress Auto Updated', '0', '0', '173.254.80.240', '1442332326');
INSERT INTO `wp_aryo_activity_log` VALUES('3236', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442334402');
INSERT INTO `wp_aryo_activity_log` VALUES('3237', 'administrator', 'added', 'Attachment', 'attachment', 'playas_manuel_antonio_450', '24219', '4', '190.211.114.159', '1442334544');
INSERT INTO `wp_aryo_activity_log` VALUES('3238', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Manuel Antonio', '121', '4', '190.211.114.159', '1442334620');
INSERT INTO `wp_aryo_activity_log` VALUES('3239', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442334718');
INSERT INTO `wp_aryo_activity_log` VALUES('3240', 'administrator', 'created', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336122');
INSERT INTO `wp_aryo_activity_log` VALUES('3241', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336150');
INSERT INTO `wp_aryo_activity_log` VALUES('3242', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336475');
INSERT INTO `wp_aryo_activity_log` VALUES('3243', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336557');
INSERT INTO `wp_aryo_activity_log` VALUES('3244', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336746');
INSERT INTO `wp_aryo_activity_log` VALUES('3245', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336820');
INSERT INTO `wp_aryo_activity_log` VALUES('3246', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442336838');
INSERT INTO `wp_aryo_activity_log` VALUES('3247', 'administrator', 'updated', 'Taxonomy', 'product_cat', 'Manuel Antonio', '132', '4', '190.211.114.159', '1442337077');
INSERT INTO `wp_aryo_activity_log` VALUES('3248', 'administrator', 'created', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442337737');
INSERT INTO `wp_aryo_activity_log` VALUES('3249', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442337795');
INSERT INTO `wp_aryo_activity_log` VALUES('3250', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442337898');
INSERT INTO `wp_aryo_activity_log` VALUES('3251', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442337970');
INSERT INTO `wp_aryo_activity_log` VALUES('3252', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338043');
INSERT INTO `wp_aryo_activity_log` VALUES('3253', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338125');
INSERT INTO `wp_aryo_activity_log` VALUES('3254', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338193');
INSERT INTO `wp_aryo_activity_log` VALUES('3255', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338272');
INSERT INTO `wp_aryo_activity_log` VALUES('3256', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338345');
INSERT INTO `wp_aryo_activity_log` VALUES('3257', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338420');
INSERT INTO `wp_aryo_activity_log` VALUES('3258', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 1', '24222', '4', '190.211.114.159', '1442338463');
INSERT INTO `wp_aryo_activity_log` VALUES('3259', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 2', '24223', '4', '190.211.114.159', '1442338701');
INSERT INTO `wp_aryo_activity_log` VALUES('3260', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 3', '24224', '4', '190.211.114.159', '1442338708');
INSERT INTO `wp_aryo_activity_log` VALUES('3261', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 4', '24225', '4', '190.211.114.159', '1442338719');
INSERT INTO `wp_aryo_activity_log` VALUES('3262', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 5', '24226', '4', '190.211.114.159', '1442338726');
INSERT INTO `wp_aryo_activity_log` VALUES('3263', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 6', '24227', '4', '190.211.114.159', '1442338732');
INSERT INTO `wp_aryo_activity_log` VALUES('3264', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 7', '24228', '4', '190.211.114.159', '1442338738');
INSERT INTO `wp_aryo_activity_log` VALUES('3265', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 8', '24229', '4', '190.211.114.159', '1442338746');
INSERT INTO `wp_aryo_activity_log` VALUES('3266', 'administrator', 'added', 'Attachment', 'attachment', 'Catamaran 9', '24230', '4', '190.211.114.159', '1442338751');
INSERT INTO `wp_aryo_activity_log` VALUES('3267', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442338788');
INSERT INTO `wp_aryo_activity_log` VALUES('3268', 'administrator', 'updated', 'Post', 'product', 'Catamaran Tour', '24221', '4', '190.211.114.159', '1442339097');
INSERT INTO `wp_aryo_activity_log` VALUES('3269', 'administrator', 'created', 'Post', 'product', 'Catamaran tour', '24231', '4', '190.211.114.159', '1442339335');
INSERT INTO `wp_aryo_activity_log` VALUES('3270', 'administrator', 'updated', 'Post', 'product', 'Catamaran tour', '24231', '4', '190.211.114.159', '1442339392');
INSERT INTO `wp_aryo_activity_log` VALUES('3271', 'administrator', 'updated', 'Post', 'product', 'Tour Catamaran', '24221', '4', '190.211.114.159', '1442339895');
INSERT INTO `wp_aryo_activity_log` VALUES('3272', 'administrator', 'updated', 'Post', 'product', 'Tour Catamaran', '24221', '4', '190.211.114.159', '1442340096');
INSERT INTO `wp_aryo_activity_log` VALUES('3273', 'administrator', 'updated', 'Post', 'product', 'Tour Catamaran', '24221', '4', '190.211.114.159', '1442340124');
INSERT INTO `wp_aryo_activity_log` VALUES('3274', 'administrator', 'created', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442340638');
INSERT INTO `wp_aryo_activity_log` VALUES('3275', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442340818');
INSERT INTO `wp_aryo_activity_log` VALUES('3276', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442341655');
INSERT INTO `wp_aryo_activity_log` VALUES('3277', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442341728');
INSERT INTO `wp_aryo_activity_log` VALUES('3278', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442341808');
INSERT INTO `wp_aryo_activity_log` VALUES('3279', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Naranjo 2', '24234', '4', '190.211.114.159', '1442341852');
INSERT INTO `wp_aryo_activity_log` VALUES('3280', 'administrator', 'added', 'Attachment', 'attachment', 'raftin', '24235', '4', '190.211.114.159', '1442341899');
INSERT INTO `wp_aryo_activity_log` VALUES('3281', 'administrator', 'added', 'Attachment', 'attachment', 'raftin2', '24236', '4', '190.211.114.159', '1442341905');
INSERT INTO `wp_aryo_activity_log` VALUES('3282', 'administrator', 'added', 'Attachment', 'attachment', 'raftin3', '24237', '4', '190.211.114.159', '1442341911');
INSERT INTO `wp_aryo_activity_log` VALUES('3283', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Naranjo 1', '24238', '4', '190.211.114.159', '1442341918');
INSERT INTO `wp_aryo_activity_log` VALUES('3284', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Naranjo 2', '24239', '4', '190.211.114.159', '1442341926');
INSERT INTO `wp_aryo_activity_log` VALUES('3285', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Naranjo 3', '24240', '4', '190.211.114.159', '1442341937');
INSERT INTO `wp_aryo_activity_log` VALUES('3286', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Naranjo 4', '24241', '4', '190.211.114.159', '1442341946');
INSERT INTO `wp_aryo_activity_log` VALUES('3287', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442342088');
INSERT INTO `wp_aryo_activity_log` VALUES('3288', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442342564');
INSERT INTO `wp_aryo_activity_log` VALUES('3289', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.114.159', '1442342647');
INSERT INTO `wp_aryo_activity_log` VALUES('3290', 'administrator', 'created', 'Post', 'product', '(no title)', '24243', '4', '190.211.114.159', '1442342934');
INSERT INTO `wp_aryo_activity_log` VALUES('3291', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.114.159', '1442343013');
INSERT INTO `wp_aryo_activity_log` VALUES('3292', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.114.159', '1442343089');
INSERT INTO `wp_aryo_activity_log` VALUES('3293', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.114.159', '1442343182');
INSERT INTO `wp_aryo_activity_log` VALUES('3294', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.114.159', '1442343251');
INSERT INTO `wp_aryo_activity_log` VALUES('3295', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.114.159', '1442343324');
INSERT INTO `wp_aryo_activity_log` VALUES('3296', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.114.159', '1442343369');
INSERT INTO `wp_aryo_activity_log` VALUES('3297', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.114.159', '1442343869');
INSERT INTO `wp_aryo_activity_log` VALUES('3298', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.114.159', '1442344017');
INSERT INTO `wp_aryo_activity_log` VALUES('3299', 'administrator', 'created', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344277');
INSERT INTO `wp_aryo_activity_log` VALUES('3300', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344307');
INSERT INTO `wp_aryo_activity_log` VALUES('3301', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344390');
INSERT INTO `wp_aryo_activity_log` VALUES('3302', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344463');
INSERT INTO `wp_aryo_activity_log` VALUES('3303', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344542');
INSERT INTO `wp_aryo_activity_log` VALUES('3304', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 6', '24246', '4', '190.211.114.159', '1442344575');
INSERT INTO `wp_aryo_activity_log` VALUES('3305', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 1', '24247', '4', '190.211.114.159', '1442344608');
INSERT INTO `wp_aryo_activity_log` VALUES('3306', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 2', '24248', '4', '190.211.114.159', '1442344628');
INSERT INTO `wp_aryo_activity_log` VALUES('3307', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344630');
INSERT INTO `wp_aryo_activity_log` VALUES('3308', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 3', '24249', '4', '190.211.114.159', '1442344640');
INSERT INTO `wp_aryo_activity_log` VALUES('3309', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 4', '24250', '4', '190.211.114.159', '1442344647');
INSERT INTO `wp_aryo_activity_log` VALUES('3310', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 5', '24251', '4', '190.211.114.159', '1442344655');
INSERT INTO `wp_aryo_activity_log` VALUES('3311', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 6', '24252', '4', '190.211.114.159', '1442344662');
INSERT INTO `wp_aryo_activity_log` VALUES('3312', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 7', '24253', '4', '190.211.114.159', '1442344670');
INSERT INTO `wp_aryo_activity_log` VALUES('3313', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 8', '24254', '4', '190.211.114.159', '1442344676');
INSERT INTO `wp_aryo_activity_log` VALUES('3314', 'administrator', 'added', 'Attachment', 'attachment', 'caminata 9', '24255', '4', '190.211.114.159', '1442344683');
INSERT INTO `wp_aryo_activity_log` VALUES('3315', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344880');
INSERT INTO `wp_aryo_activity_log` VALUES('3316', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442344940');
INSERT INTO `wp_aryo_activity_log` VALUES('3317', 'administrator', 'created', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442346049');
INSERT INTO `wp_aryo_activity_log` VALUES('3318', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442346362');
INSERT INTO `wp_aryo_activity_log` VALUES('3319', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442346478');
INSERT INTO `wp_aryo_activity_log` VALUES('3320', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442346554');
INSERT INTO `wp_aryo_activity_log` VALUES('3321', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442346669');
INSERT INTO `wp_aryo_activity_log` VALUES('3322', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442346849');
INSERT INTO `wp_aryo_activity_log` VALUES('3323', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442347007');
INSERT INTO `wp_aryo_activity_log` VALUES('3324', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442347084');
INSERT INTO `wp_aryo_activity_log` VALUES('3325', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442347341');
INSERT INTO `wp_aryo_activity_log` VALUES('3326', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442347361');
INSERT INTO `wp_aryo_activity_log` VALUES('3327', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442347514');
INSERT INTO `wp_aryo_activity_log` VALUES('3328', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442347793');
INSERT INTO `wp_aryo_activity_log` VALUES('3329', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.114.159', '1442348062');
INSERT INTO `wp_aryo_activity_log` VALUES('3330', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '79.98.109.196', '1442426725');
INSERT INTO `wp_aryo_activity_log` VALUES('3331', 'guest', 'logged_in', 'User', '', 'admin', '1', '1', '201.193.55.54', '1442435568');
INSERT INTO `wp_aryo_activity_log` VALUES('3332', 'administrator', 'deactivated', 'Plugin', '', 'Backup & Clone Master (shared on wplocker.com)', '0', '1', '201.193.55.54', '1442437638');
INSERT INTO `wp_aryo_activity_log` VALUES('3333', 'administrator', 'installed', 'Plugin', '0.5.30', 'Duplicator', '0', '1', '201.193.55.54', '1442439328');
INSERT INTO `wp_aryo_activity_log` VALUES('3334', 'administrator', 'activated', 'Plugin', '', 'Duplicator', '0', '1', '201.193.55.54', '1442440176');
INSERT INTO `wp_aryo_activity_log` VALUES('3335', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '18.238.1.85', '1442465863');
INSERT INTO `wp_aryo_activity_log` VALUES('3336', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '64.113.32.29', '1442465864');
INSERT INTO `wp_aryo_activity_log` VALUES('3337', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442510186');
INSERT INTO `wp_aryo_activity_log` VALUES('3338', 'administrator', 'added', 'Attachment', 'attachment', 'villa-buena-onda', '24258', '4', '190.211.114.159', '1442517716');
INSERT INTO `wp_aryo_activity_log` VALUES('3339', 'administrator', 'added', 'Attachment', 'attachment', 'garden-room-', '24259', '4', '190.211.114.159', '1442517811');
INSERT INTO `wp_aryo_activity_log` VALUES('3340', 'administrator', 'added', 'Attachment', 'attachment', 'master-suite-buena onda', '24260', '4', '190.211.114.159', '1442517824');
INSERT INTO `wp_aryo_activity_log` VALUES('3341', 'administrator', 'added', 'Attachment', 'attachment', 'ocean view', '24261', '4', '190.211.114.159', '1442517840');
INSERT INTO `wp_aryo_activity_log` VALUES('3342', 'administrator', 'added', 'Attachment', 'attachment', 'pool-room-', '24262', '4', '190.211.114.159', '1442517849');
INSERT INTO `wp_aryo_activity_log` VALUES('3343', 'administrator', 'updated', 'Post', 'product', 'Villa Buena Onda', '23036', '4', '190.211.114.159', '1442517920');
INSERT INTO `wp_aryo_activity_log` VALUES('3344', 'administrator', 'updated', 'Post', 'product', 'Villa Buena Onda', '23036', '4', '190.211.114.159', '1442518139');
INSERT INTO `wp_aryo_activity_log` VALUES('3345', 'administrator', 'updated', 'Post', 'product', 'Villa Buena Onda', '22731', '4', '190.211.114.159', '1442521666');
INSERT INTO `wp_aryo_activity_log` VALUES('3346', 'administrator', 'updated', 'Post', 'product', 'Villa Buena Onda', '22731', '4', '190.211.114.159', '1442521841');
INSERT INTO `wp_aryo_activity_log` VALUES('3347', 'administrator', 'updated', 'Post', 'product', 'Hotel villa lapas', '23507', '4', '190.211.114.159', '1442523493');
INSERT INTO `wp_aryo_activity_log` VALUES('3348', 'administrator', 'updated', 'Post', 'product', 'Hotel villa lapas', '23519', '4', '190.211.114.159', '1442523497');
INSERT INTO `wp_aryo_activity_log` VALUES('3349', 'guest', 'updated', 'Core', '', 'WordPress Auto Updated', '0', '0', '127.0.0.1', '1442523787');
INSERT INTO `wp_aryo_activity_log` VALUES('3350', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442524001');
INSERT INTO `wp_aryo_activity_log` VALUES('3351', 'administrator', 'updated', 'Post', 'product', 'Hotel villa lapas', '23519', '4', '190.211.114.159', '1442525586');
INSERT INTO `wp_aryo_activity_log` VALUES('3352', 'administrator', 'updated', 'Post', 'product', 'Hotel villa lapas', '23519', '4', '190.211.114.159', '1442525787');
INSERT INTO `wp_aryo_activity_log` VALUES('3353', 'administrator', 'updated', 'Post', 'product', 'Hotel villa lapas', '23519', '4', '190.211.114.159', '1442526161');
INSERT INTO `wp_aryo_activity_log` VALUES('3354', 'administrator', 'updated', 'Post', 'product', 'Hotel Pachote Grande', '23498', '4', '190.211.114.159', '1442526921');
INSERT INTO `wp_aryo_activity_log` VALUES('3355', 'administrator', 'updated', 'Post', 'product', 'Hotel Pachote Grande', '23506', '4', '190.211.114.159', '1442527321');
INSERT INTO `wp_aryo_activity_log` VALUES('3356', 'administrator', 'updated', 'Post', 'product', 'Hotel Morgans Cove Resort and Casino', '23496', '4', '190.211.114.159', '1442528350');
INSERT INTO `wp_aryo_activity_log` VALUES('3357', 'administrator', 'updated', 'Post', 'product', 'Hotel Morgans Cove Resort and Casino', '23496', '4', '190.211.114.159', '1442528467');
INSERT INTO `wp_aryo_activity_log` VALUES('3358', 'administrator', 'updated', 'Post', 'product', 'Hotel Morgans Cove Resort and Casino', '23485', '4', '190.211.114.159', '1442530394');
INSERT INTO `wp_aryo_activity_log` VALUES('3359', 'administrator', 'updated', 'Post', 'product', 'Hotel Morgans Cove Resort and Casino', '23485', '4', '190.211.114.159', '1442530574');
INSERT INTO `wp_aryo_activity_log` VALUES('3360', 'administrator', 'added', 'Attachment', 'attachment', 'Fuego del sol', '24271', '4', '190.211.114.159', '1442531551');
INSERT INTO `wp_aryo_activity_log` VALUES('3361', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-fuego-del-sol', '24272', '4', '190.211.114.159', '1442531607');
INSERT INTO `wp_aryo_activity_log` VALUES('3362', 'administrator', 'updated', 'Post', 'product', 'Hotel Fuego del sol', '23478', '4', '190.211.114.159', '1442531633');
INSERT INTO `wp_aryo_activity_log` VALUES('3363', 'administrator', 'updated', 'Post', 'product', 'Hotel Fuego del sol', '23484', '4', '190.211.114.159', '1442531634');
INSERT INTO `wp_aryo_activity_log` VALUES('3364', 'administrator', 'updated', 'Post', 'product', 'Hotel Fuego del sol', '23478', '4', '190.211.114.159', '1442531716');
INSERT INTO `wp_aryo_activity_log` VALUES('3365', 'administrator', 'updated', 'Post', 'product', 'Hotel Fuego del sol', '23484', '4', '190.211.114.159', '1442532529');
INSERT INTO `wp_aryo_activity_log` VALUES('3366', 'administrator', 'updated', 'Post', 'product', 'Hotel Fuego del sol', '23484', '4', '190.211.114.159', '1442532650');
INSERT INTO `wp_aryo_activity_log` VALUES('3367', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '82.211.19.143', '1442533046');
INSERT INTO `wp_aryo_activity_log` VALUES('3368', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23453', '4', '190.211.114.159', '1442533720');
INSERT INTO `wp_aryo_activity_log` VALUES('3369', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23477', '4', '190.211.114.159', '1442533721');
INSERT INTO `wp_aryo_activity_log` VALUES('3370', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23453', '4', '190.211.114.159', '1442533848');
INSERT INTO `wp_aryo_activity_log` VALUES('3371', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23477', '4', '190.211.114.159', '1442533849');
INSERT INTO `wp_aryo_activity_log` VALUES('3372', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23453', '4', '190.211.114.159', '1442533956');
INSERT INTO `wp_aryo_activity_log` VALUES('3373', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23477', '4', '190.211.114.159', '1442533957');
INSERT INTO `wp_aryo_activity_log` VALUES('3374', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23477', '4', '190.211.114.159', '1442536648');
INSERT INTO `wp_aryo_activity_log` VALUES('3375', 'administrator', 'updated', 'Post', 'product', 'Acqua Residences', '23451', '4', '190.211.114.159', '1442537992');
INSERT INTO `wp_aryo_activity_log` VALUES('3376', 'administrator', 'updated', 'Post', 'product', 'Acqua Residences', '23440', '4', '190.211.114.159', '1442538518');
INSERT INTO `wp_aryo_activity_log` VALUES('3377', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.114.159', '1442538579');
INSERT INTO `wp_aryo_activity_log` VALUES('3378', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '136.243.98.54', '1442563472');
INSERT INTO `wp_aryo_activity_log` VALUES('3379', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442586564');
INSERT INTO `wp_aryo_activity_log` VALUES('3380', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23453', '4', '190.211.114.159', '1442586800');
INSERT INTO `wp_aryo_activity_log` VALUES('3381', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23453', '4', '190.211.114.159', '1442587561');
INSERT INTO `wp_aryo_activity_log` VALUES('3382', 'administrator', 'updated', 'Post', 'product', 'Hotel CROC’S Casino Resort', '23453', '4', '190.211.114.159', '1442587930');
INSERT INTO `wp_aryo_activity_log` VALUES('3383', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442607617');
INSERT INTO `wp_aryo_activity_log` VALUES('3384', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442779391');
INSERT INTO `wp_aryo_activity_log` VALUES('3385', 'administrator', 'updated', 'Post', 'product', 'Terraza del Pacifico', '23030', '4', '190.211.125.148', '1442782197');
INSERT INTO `wp_aryo_activity_log` VALUES('3386', 'administrator', 'updated', 'Post', 'product', 'Terraza del Pacifico', '23030', '4', '190.211.125.148', '1442782260');
INSERT INTO `wp_aryo_activity_log` VALUES('3387', 'administrator', 'updated', 'Post', 'product', 'Terraza del Pacifico', '23030', '4', '190.211.125.148', '1442782388');
INSERT INTO `wp_aryo_activity_log` VALUES('3388', 'administrator', 'added', 'Attachment', 'attachment', 'terraza del pasifico', '24278', '4', '190.211.125.148', '1442782983');
INSERT INTO `wp_aryo_activity_log` VALUES('3389', 'administrator', 'added', 'Attachment', 'attachment', 'terraza del pasifico1', '24279', '4', '190.211.125.148', '1442782992');
INSERT INTO `wp_aryo_activity_log` VALUES('3390', 'administrator', 'added', 'Attachment', 'attachment', 'Hotel-Resort-Terraza-del-Pacífico-2', '24280', '4', '190.211.125.148', '1442782999');
INSERT INTO `wp_aryo_activity_log` VALUES('3391', 'administrator', 'added', 'Attachment', 'attachment', 'hotel_terraza_del_pacifico_costa_rica_', '24281', '4', '190.211.125.148', '1442783130');
INSERT INTO `wp_aryo_activity_log` VALUES('3392', 'administrator', 'added', 'Attachment', 'attachment', 'terraza del pasifico5', '24282', '4', '190.211.125.148', '1442783168');
INSERT INTO `wp_aryo_activity_log` VALUES('3393', 'administrator', 'updated', 'Post', 'product', 'Terraza del Pacifico', '23030', '4', '190.211.125.148', '1442783191');
INSERT INTO `wp_aryo_activity_log` VALUES('3394', 'administrator', 'updated', 'Post', 'product', 'Terraza del Pacifico', '22734', '4', '190.211.125.148', '1442785150');
INSERT INTO `wp_aryo_activity_log` VALUES('3395', 'administrator', 'updated', 'Post', 'product', 'Terraza del Pacifico', '22734', '4', '190.211.125.148', '1442785945');
INSERT INTO `wp_aryo_activity_log` VALUES('3396', 'administrator', 'added', 'Attachment', 'attachment', 'balcon del mar', '24285', '4', '190.211.125.148', '1442787868');
INSERT INTO `wp_aryo_activity_log` VALUES('3397', 'administrator', 'updated', 'Post', 'product', 'Balcón del mar', '23032', '4', '190.211.125.148', '1442787889');
INSERT INTO `wp_aryo_activity_log` VALUES('3398', 'administrator', 'updated', 'Post', 'product', 'Balcón del mar', '22733', '4', '190.211.125.148', '1442788814');
INSERT INTO `wp_aryo_activity_log` VALUES('3399', 'administrator', 'updated', 'Post', 'product', 'Balcón del mar', '22733', '4', '190.211.125.148', '1442788867');
INSERT INTO `wp_aryo_activity_log` VALUES('3400', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1442789237');
INSERT INTO `wp_aryo_activity_log` VALUES('3401', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.125.148', '1442797867');
INSERT INTO `wp_aryo_activity_log` VALUES('3402', 'administrator', 'updated', 'Post', 'product', 'Azania bungalows', '23928', '4', '190.211.125.148', '1442798342');
INSERT INTO `wp_aryo_activity_log` VALUES('3403', 'administrator', 'updated', 'Post', 'product', 'Azania bungalows', '23928', '4', '190.211.125.148', '1442798449');
INSERT INTO `wp_aryo_activity_log` VALUES('3404', 'administrator', 'updated', 'Post', 'product', 'Azania bungalows', '23914', '4', '190.211.125.148', '1442798772');
INSERT INTO `wp_aryo_activity_log` VALUES('3405', 'administrator', 'updated', 'Post', 'product', 'Azania bungalows', '23914', '4', '190.211.125.148', '1442798839');
INSERT INTO `wp_aryo_activity_log` VALUES('3406', 'administrator', 'updated', 'Post', 'product', 'Hotel cariblue', '23926', '4', '190.211.125.148', '1442799428');
INSERT INTO `wp_aryo_activity_log` VALUES('3407', 'administrator', 'updated', 'Post', 'product', 'Hotel cariblue', '23915', '4', '190.211.125.148', '1442799900');
INSERT INTO `wp_aryo_activity_log` VALUES('3408', 'administrator', 'added', 'Attachment', 'attachment', 'agapi 1', '24294', '4', '190.211.125.148', '1442803431');
INSERT INTO `wp_aryo_activity_log` VALUES('3409', 'administrator', 'added', 'Attachment', 'attachment', 'agapi 2', '24295', '4', '190.211.125.148', '1442803436');
INSERT INTO `wp_aryo_activity_log` VALUES('3410', 'administrator', 'added', 'Attachment', 'attachment', 'agapi 5', '24296', '4', '190.211.125.148', '1442803443');
INSERT INTO `wp_aryo_activity_log` VALUES('3411', 'administrator', 'updated', 'Post', 'product', 'Agapi Apartments', '23026', '4', '190.211.125.148', '1442803533');
INSERT INTO `wp_aryo_activity_log` VALUES('3412', 'administrator', 'updated', 'Post', 'product', 'Agapi Apartments', '23026', '4', '190.211.125.148', '1442803585');
INSERT INTO `wp_aryo_activity_log` VALUES('3413', 'administrator', 'updated', 'Post', 'product', 'Apartamentos Agapi', '22735', '4', '190.211.125.148', '1442805493');
INSERT INTO `wp_aryo_activity_log` VALUES('3414', 'administrator', 'updated', 'Post', 'product', 'Apartamentos Agapi', '22735', '4', '190.211.125.148', '1442805522');
INSERT INTO `wp_aryo_activity_log` VALUES('3415', 'administrator', 'updated', 'Post', 'product', 'Apartamentos Agapi', '22735', '4', '190.211.125.148', '1442805637');
INSERT INTO `wp_aryo_activity_log` VALUES('3416', 'administrator', 'updated', 'Post', 'product', 'Shawandha Lodge', '23930', '4', '190.211.125.148', '1442805961');
INSERT INTO `wp_aryo_activity_log` VALUES('3417', 'administrator', 'updated', 'Post', 'product', 'Shawandha Lodge', '23930', '4', '190.211.125.148', '1442806036');
INSERT INTO `wp_aryo_activity_log` VALUES('3418', 'administrator', 'updated', 'Post', 'product', 'Shawandha Lodge', '23930', '4', '190.211.125.148', '1442806194');
INSERT INTO `wp_aryo_activity_log` VALUES('3419', 'administrator', 'updated', 'Post', 'product', 'Shawandha Lodge', '23930', '4', '190.211.125.148', '1442806363');
INSERT INTO `wp_aryo_activity_log` VALUES('3420', 'administrator', 'updated', 'Post', 'product', 'Shawandha Lodge', '23937', '4', '190.211.125.148', '1442806865');
INSERT INTO `wp_aryo_activity_log` VALUES('3421', 'administrator', 'updated', 'Post', 'product', 'Hotel si como no', '23425', '4', '190.211.125.148', '1442808433');
INSERT INTO `wp_aryo_activity_log` VALUES('3422', 'administrator', 'updated', 'Post', 'product', 'Hotel si como no', '23437', '4', '190.211.125.148', '1442809488');
INSERT INTO `wp_aryo_activity_log` VALUES('3423', 'administrator', 'updated', 'Post', 'product', 'Hotel parador', '23409', '4', '190.211.125.148', '1442811423');
INSERT INTO `wp_aryo_activity_log` VALUES('3424', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.125.148', '1442811584');
INSERT INTO `wp_aryo_activity_log` VALUES('3425', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442844794');
INSERT INTO `wp_aryo_activity_log` VALUES('3426', 'administrator', 'updated', 'Post', 'product', 'Hotel parador', '23409', '4', '190.211.114.159', '1442844923');
INSERT INTO `wp_aryo_activity_log` VALUES('3427', 'administrator', 'updated', 'Post', 'product', 'Hotel parador', '23423', '4', '190.211.114.159', '1442844924');
INSERT INTO `wp_aryo_activity_log` VALUES('3428', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442847324');
INSERT INTO `wp_aryo_activity_log` VALUES('3429', 'administrator', 'created', 'Post', 'product', '(no title)', '24302', '4', '190.211.114.159', '1442847438');
INSERT INTO `wp_aryo_activity_log` VALUES('3430', 'administrator', 'updated', 'Post', 'product', 'Hotel parador', '23423', '4', '190.211.114.159', '1442849315');
INSERT INTO `wp_aryo_activity_log` VALUES('3431', 'administrator', 'updated', 'Post', 'product', 'Hotel Parador Resort and Spa', '23423', '4', '190.211.114.159', '1442849504');
INSERT INTO `wp_aryo_activity_log` VALUES('3432', 'administrator', 'updated', 'Post', 'product', 'Hotel Parador Resort and Spa', '23409', '4', '190.211.114.159', '1442849591');
INSERT INTO `wp_aryo_activity_log` VALUES('3433', 'administrator', 'updated', 'Post', 'product', 'Hotel Parador Resort and Spa', '23423', '4', '190.211.114.159', '1442849592');
INSERT INTO `wp_aryo_activity_log` VALUES('3434', 'administrator', 'updated', 'Post', 'product', 'Hotel la Mariposa', '23380', '4', '190.211.114.159', '1442853847');
INSERT INTO `wp_aryo_activity_log` VALUES('3435', 'administrator', 'updated', 'Post', 'product', 'Hotel la Mariposa', '23408', '4', '190.211.114.159', '1442853849');
INSERT INTO `wp_aryo_activity_log` VALUES('3436', 'administrator', 'updated', 'Post', 'product', 'Hotel la Mariposa', '23380', '4', '190.211.114.159', '1442854491');
INSERT INTO `wp_aryo_activity_log` VALUES('3437', 'administrator', 'updated', 'Post', 'product', 'Hotel la Mariposa', '23408', '4', '190.211.114.159', '1442854492');
INSERT INTO `wp_aryo_activity_log` VALUES('3438', 'administrator', 'updated', 'Post', 'product', 'Hotel la Mariposa', '23408', '4', '190.211.114.159', '1442858169');
INSERT INTO `wp_aryo_activity_log` VALUES('3439', 'administrator', 'updated', 'Post', 'product', 'Hotel la Mariposa', '23408', '4', '190.211.114.159', '1442858290');
INSERT INTO `wp_aryo_activity_log` VALUES('3440', 'administrator', 'added', 'Attachment', 'attachment', 'hotell_costa_verde_747', '24307', '4', '190.211.114.159', '1442859950');
INSERT INTO `wp_aryo_activity_log` VALUES('3441', 'administrator', 'added', 'Attachment', 'attachment', 'hotelcostaverde', '24308', '4', '190.211.114.159', '1442859997');
INSERT INTO `wp_aryo_activity_log` VALUES('3442', 'administrator', 'added', 'Attachment', 'attachment', 'costa verde restaurant', '24309', '4', '190.211.114.159', '1442860059');
INSERT INTO `wp_aryo_activity_log` VALUES('3443', 'administrator', 'added', 'Attachment', 'attachment', 'costa verde', '24310', '4', '190.211.114.159', '1442860070');
INSERT INTO `wp_aryo_activity_log` VALUES('3444', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23370', '4', '190.211.114.159', '1442860146');
INSERT INTO `wp_aryo_activity_log` VALUES('3445', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23377', '4', '190.211.114.159', '1442860147');
INSERT INTO `wp_aryo_activity_log` VALUES('3446', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442864524');
INSERT INTO `wp_aryo_activity_log` VALUES('3447', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23377', '4', '190.211.114.159', '1442866581');
INSERT INTO `wp_aryo_activity_log` VALUES('3448', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23377', '4', '190.211.114.159', '1442866747');
INSERT INTO `wp_aryo_activity_log` VALUES('3449', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23377', '4', '190.211.114.159', '1442866819');
INSERT INTO `wp_aryo_activity_log` VALUES('3450', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23377', '4', '190.211.114.159', '1442866896');
INSERT INTO `wp_aryo_activity_log` VALUES('3451', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.114.159', '1442866996');
INSERT INTO `wp_aryo_activity_log` VALUES('3452', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442925546');
INSERT INTO `wp_aryo_activity_log` VALUES('3453', 'administrator', 'updated', 'Post', 'product', 'Hotel Costa Verde', '23377', '4', '190.211.114.159', '1442926753');
INSERT INTO `wp_aryo_activity_log` VALUES('3454', 'administrator', 'updated', 'Post', 'product', 'Hotel la Byblos resort and casino', '23352', '4', '190.211.114.159', '1442928857');
INSERT INTO `wp_aryo_activity_log` VALUES('3455', 'administrator', 'updated', 'Post', 'product', 'Hotel la Byblos resort and casino', '23366', '4', '190.211.114.159', '1442930654');
INSERT INTO `wp_aryo_activity_log` VALUES('3456', 'administrator', 'updated', 'Post', 'product', 'Hotel Shana', '22703', '4', '190.211.114.159', '1442933226');
INSERT INTO `wp_aryo_activity_log` VALUES('3457', 'administrator', 'updated', 'Post', 'product', 'Hotel Shana', '23077', '4', '190.211.114.159', '1442933227');
INSERT INTO `wp_aryo_activity_log` VALUES('3458', 'administrator', 'updated', 'Post', 'product', 'Shana Hotel & Residence', '22703', '4', '190.211.114.159', '1442933285');
INSERT INTO `wp_aryo_activity_log` VALUES('3459', 'administrator', 'updated', 'Post', 'product', 'Shana Hotel & Residence', '23077', '4', '190.211.114.159', '1442933286');
INSERT INTO `wp_aryo_activity_log` VALUES('3460', 'administrator', 'updated', 'Post', 'product', 'Shana Hotel & Residence', '22703', '4', '190.211.114.159', '1442933388');
INSERT INTO `wp_aryo_activity_log` VALUES('3461', 'administrator', 'added', 'Attachment', 'attachment', 'Shana hotel pool', '24312', '4', '190.211.114.159', '1442934235');
INSERT INTO `wp_aryo_activity_log` VALUES('3462', 'administrator', 'updated', 'Post', 'product', 'Shana Hotel & Residence', '22703', '4', '190.211.114.159', '1442934264');
INSERT INTO `wp_aryo_activity_log` VALUES('3463', 'administrator', 'updated', 'Post', 'product', 'Shana Hotel & Residence', '22703', '4', '190.211.114.159', '1442934440');
INSERT INTO `wp_aryo_activity_log` VALUES('3464', 'administrator', 'updated', 'Post', 'product', 'Shana Hotel & Residence', '23077', '4', '190.211.114.159', '1442936463');
INSERT INTO `wp_aryo_activity_log` VALUES('3465', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-san-bada', '24316', '4', '190.211.114.159', '1442941214');
INSERT INTO `wp_aryo_activity_log` VALUES('3466', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-san-bada piscina', '24317', '4', '190.211.114.159', '1442941291');
INSERT INTO `wp_aryo_activity_log` VALUES('3467', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-san-bada', '24318', '4', '190.211.114.159', '1442941301');
INSERT INTO `wp_aryo_activity_log` VALUES('3468', 'administrator', 'added', 'Attachment', 'attachment', 'san bada 1', '24319', '4', '190.211.114.159', '1442941311');
INSERT INTO `wp_aryo_activity_log` VALUES('3469', 'administrator', 'added', 'Attachment', 'attachment', 'san bada 2', '24320', '4', '190.211.114.159', '1442941319');
INSERT INTO `wp_aryo_activity_log` VALUES('3470', 'administrator', 'added', 'Attachment', 'attachment', 'san bada 3', '24321', '4', '190.211.114.159', '1442941333');
INSERT INTO `wp_aryo_activity_log` VALUES('3471', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '23079', '4', '190.211.114.159', '1442941475');
INSERT INTO `wp_aryo_activity_log` VALUES('3472', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '23079', '4', '190.211.114.159', '1442941791');
INSERT INTO `wp_aryo_activity_log` VALUES('3473', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '23079', '4', '190.211.114.159', '1442941954');
INSERT INTO `wp_aryo_activity_log` VALUES('3474', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '23079', '4', '190.211.114.159', '1442942310');
INSERT INTO `wp_aryo_activity_log` VALUES('3475', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '22702', '4', '190.211.114.159', '1442944699');
INSERT INTO `wp_aryo_activity_log` VALUES('3476', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '22702', '4', '190.211.114.159', '1442944771');
INSERT INTO `wp_aryo_activity_log` VALUES('3477', 'administrator', 'updated', 'Post', 'product', 'Hotel San Bada', '22702', '4', '190.211.114.159', '1442944886');
INSERT INTO `wp_aryo_activity_log` VALUES('3478', 'administrator', 'added', 'Attachment', 'attachment', 'hotel-california 1', '24323', '4', '190.211.114.159', '1442946615');
INSERT INTO `wp_aryo_activity_log` VALUES('3479', 'administrator', 'added', 'Attachment', 'attachment', 'hotel_california 2', '24324', '4', '190.211.114.159', '1442946673');
INSERT INTO `wp_aryo_activity_log` VALUES('3480', 'administrator', 'added', 'Attachment', 'attachment', 'hotelcaliforni pool', '24325', '4', '190.211.114.159', '1442946678');
INSERT INTO `wp_aryo_activity_log` VALUES('3481', 'administrator', 'added', 'Attachment', 'attachment', 'california restaurant', '24326', '4', '190.211.114.159', '1442946686');
INSERT INTO `wp_aryo_activity_log` VALUES('3482', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '23080', '4', '190.211.114.159', '1442946704');
INSERT INTO `wp_aryo_activity_log` VALUES('3483', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '23080', '4', '190.211.114.159', '1442946786');
INSERT INTO `wp_aryo_activity_log` VALUES('3484', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '23080', '4', '190.211.114.159', '1442946948');
INSERT INTO `wp_aryo_activity_log` VALUES('3485', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '23080', '4', '190.211.114.159', '1442948082');
INSERT INTO `wp_aryo_activity_log` VALUES('3486', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '22698', '4', '190.211.114.159', '1442948872');
INSERT INTO `wp_aryo_activity_log` VALUES('3487', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '22698', '4', '190.211.114.159', '1442948993');
INSERT INTO `wp_aryo_activity_log` VALUES('3488', 'administrator', 'updated', 'Post', 'product', 'Hotel California', '22698', '4', '190.211.114.159', '1442949027');
INSERT INTO `wp_aryo_activity_log` VALUES('3489', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.114.159', '1442950058');
INSERT INTO `wp_aryo_activity_log` VALUES('3490', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964685');
INSERT INTO `wp_aryo_activity_log` VALUES('3491', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964690');
INSERT INTO `wp_aryo_activity_log` VALUES('3492', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964731');
INSERT INTO `wp_aryo_activity_log` VALUES('3493', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964739');
INSERT INTO `wp_aryo_activity_log` VALUES('3494', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964750');
INSERT INTO `wp_aryo_activity_log` VALUES('3495', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964873');
INSERT INTO `wp_aryo_activity_log` VALUES('3496', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.114.159', '1442964887');
INSERT INTO `wp_aryo_activity_log` VALUES('3497', 'guest', 'wrong_password', 'User', '', 'Reservations', '0', '0', '190.211.114.159', '1442964965');
INSERT INTO `wp_aryo_activity_log` VALUES('3498', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.114.159', '1442965099');
INSERT INTO `wp_aryo_activity_log` VALUES('3499', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442965271');
INSERT INTO `wp_aryo_activity_log` VALUES('3500', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442965431');
INSERT INTO `wp_aryo_activity_log` VALUES('3501', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442965690');
INSERT INTO `wp_aryo_activity_log` VALUES('3502', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442965778');
INSERT INTO `wp_aryo_activity_log` VALUES('3503', 'administrator', 'updated', 'Post', 'product', 'Caminata Parque Nacional', '24256', '4', '190.211.114.159', '1442966843');
INSERT INTO `wp_aryo_activity_log` VALUES('3504', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442967176');
INSERT INTO `wp_aryo_activity_log` VALUES('3505', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442967284');
INSERT INTO `wp_aryo_activity_log` VALUES('3506', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442967413');
INSERT INTO `wp_aryo_activity_log` VALUES('3507', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '199.68.196.124', '1442968128');
INSERT INTO `wp_aryo_activity_log` VALUES('3508', 'administrator', 'updated', 'Post', 'product', 'Manuel Antonio National Park', '24245', '4', '190.211.114.159', '1442968864');
INSERT INTO `wp_aryo_activity_log` VALUES('3509', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.114.159', '1442968908');
INSERT INTO `wp_aryo_activity_log` VALUES('3510', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '74.208.220.222', '1442999373');
INSERT INTO `wp_aryo_activity_log` VALUES('3511', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '50.129.135.213', '1443013096');
INSERT INTO `wp_aryo_activity_log` VALUES('3512', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443025211');
INSERT INTO `wp_aryo_activity_log` VALUES('3513', 'administrator', 'updated', 'Post', 'product', 'Naranjo White Water Rafting', '24233', '4', '190.211.106.200', '1443025492');
INSERT INTO `wp_aryo_activity_log` VALUES('3514', 'administrator', 'updated', 'Post', 'product', 'Rápidos en Rio Naranjo', '24243', '4', '190.211.106.200', '1443025555');
INSERT INTO `wp_aryo_activity_log` VALUES('3515', 'administrator', 'updated', 'Post', 'product', 'Tour Catamaran', '24221', '4', '190.211.106.200', '1443025721');
INSERT INTO `wp_aryo_activity_log` VALUES('3516', 'administrator', 'updated', 'Post', 'product', 'Catamaran tour', '24231', '4', '190.211.106.200', '1443025829');
INSERT INTO `wp_aryo_activity_log` VALUES('3517', 'administrator', 'updated', 'Post', 'product', 'The Jungle Night Walk', '24211', '4', '190.211.106.200', '1443026300');
INSERT INTO `wp_aryo_activity_log` VALUES('3518', 'administrator', 'created', 'Post', 'product', '(no title)', '24333', '4', '190.211.106.200', '1443026416');
INSERT INTO `wp_aryo_activity_log` VALUES('3519', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna para la observación de Anfibios y Reptiles', '24220', '4', '190.211.106.200', '1443026482');
INSERT INTO `wp_aryo_activity_log` VALUES('3520', 'administrator', 'created', 'Post', 'product', 'Cabalgat', '24334', '4', '190.211.106.200', '1443027155');
INSERT INTO `wp_aryo_activity_log` VALUES('3521', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027166');
INSERT INTO `wp_aryo_activity_log` VALUES('3522', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027243');
INSERT INTO `wp_aryo_activity_log` VALUES('3523', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027320');
INSERT INTO `wp_aryo_activity_log` VALUES('3524', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027388');
INSERT INTO `wp_aryo_activity_log` VALUES('3525', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027463');
INSERT INTO `wp_aryo_activity_log` VALUES('3526', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027538');
INSERT INTO `wp_aryo_activity_log` VALUES('3527', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027608');
INSERT INTO `wp_aryo_activity_log` VALUES('3528', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443027739');
INSERT INTO `wp_aryo_activity_log` VALUES('3529', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443029196');
INSERT INTO `wp_aryo_activity_log` VALUES('3530', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443029700');
INSERT INTO `wp_aryo_activity_log` VALUES('3531', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443029790');
INSERT INTO `wp_aryo_activity_log` VALUES('3532', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0898_621_465_90', '24336', '4', '190.211.106.200', '1443029791');
INSERT INTO `wp_aryo_activity_log` VALUES('3533', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0910_348_465_90', '24337', '4', '190.211.106.200', '1443029797');
INSERT INTO `wp_aryo_activity_log` VALUES('3534', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0918_621_465_90', '24338', '4', '190.211.106.200', '1443029802');
INSERT INTO `wp_aryo_activity_log` VALUES('3535', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0919_621_465_90', '24339', '4', '190.211.106.200', '1443029808');
INSERT INTO `wp_aryo_activity_log` VALUES('3536', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0925_621_465_90', '24340', '4', '190.211.106.200', '1443029814');
INSERT INTO `wp_aryo_activity_log` VALUES('3537', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0926_621_465_90', '24341', '4', '190.211.106.200', '1443029823');
INSERT INTO `wp_aryo_activity_log` VALUES('3538', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443029970');
INSERT INTO `wp_aryo_activity_log` VALUES('3539', 'administrator', 'created', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030143');
INSERT INTO `wp_aryo_activity_log` VALUES('3540', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030229');
INSERT INTO `wp_aryo_activity_log` VALUES('3541', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030294');
INSERT INTO `wp_aryo_activity_log` VALUES('3542', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030362');
INSERT INTO `wp_aryo_activity_log` VALUES('3543', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030496');
INSERT INTO `wp_aryo_activity_log` VALUES('3544', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030631');
INSERT INTO `wp_aryo_activity_log` VALUES('3545', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443030746');
INSERT INTO `wp_aryo_activity_log` VALUES('3546', 'administrator', 'updated', 'Post', 'product', 'Caminata Nocturna', '24220', '4', '190.211.106.200', '1443031021');
INSERT INTO `wp_aryo_activity_log` VALUES('3547', 'administrator', 'approved', 'Comments', 'product', 'Observación de Aves', '5', '4', '190.211.106.200', '1443031567');
INSERT INTO `wp_aryo_activity_log` VALUES('3548', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.106.200', '1443031624');
INSERT INTO `wp_aryo_activity_log` VALUES('3549', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '94.158.77.173', '1443035145');
INSERT INTO `wp_aryo_activity_log` VALUES('3550', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '94.242.250.117', '1443084031');
INSERT INTO `wp_aryo_activity_log` VALUES('3551', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443119900');
INSERT INTO `wp_aryo_activity_log` VALUES('3552', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443119980');
INSERT INTO `wp_aryo_activity_log` VALUES('3553', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120058');
INSERT INTO `wp_aryo_activity_log` VALUES('3554', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120102');
INSERT INTO `wp_aryo_activity_log` VALUES('3555', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120119');
INSERT INTO `wp_aryo_activity_log` VALUES('3556', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120244');
INSERT INTO `wp_aryo_activity_log` VALUES('3557', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120310');
INSERT INTO `wp_aryo_activity_log` VALUES('3558', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120351');
INSERT INTO `wp_aryo_activity_log` VALUES('3559', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120400');
INSERT INTO `wp_aryo_activity_log` VALUES('3560', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120466');
INSERT INTO `wp_aryo_activity_log` VALUES('3561', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '191.190.169.23', '1443120555');
INSERT INTO `wp_aryo_activity_log` VALUES('3562', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443123818');
INSERT INTO `wp_aryo_activity_log` VALUES('3563', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '23013', '4', '190.211.106.200', '1443127984');
INSERT INTO `wp_aryo_activity_log` VALUES('3564', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '23013', '4', '190.211.106.200', '1443128083');
INSERT INTO `wp_aryo_activity_log` VALUES('3565', 'administrator', 'added', 'Attachment', 'attachment', 'hotel_poco_a_poco', '24345', '4', '190.211.106.200', '1443128386');
INSERT INTO `wp_aryo_activity_log` VALUES('3566', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '23013', '4', '190.211.106.200', '1443128424');
INSERT INTO `wp_aryo_activity_log` VALUES('3567', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '22741', '4', '190.211.106.200', '1443129359');
INSERT INTO `wp_aryo_activity_log` VALUES('3568', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '22741', '4', '190.211.106.200', '1443129689');
INSERT INTO `wp_aryo_activity_log` VALUES('3569', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '23013', '4', '190.211.106.200', '1443129806');
INSERT INTO `wp_aryo_activity_log` VALUES('3570', 'administrator', 'updated', 'Post', 'product', 'Hotel poco a poco', '23013', '4', '190.211.106.200', '1443129928');
INSERT INTO `wp_aryo_activity_log` VALUES('3571', 'administrator', 'updated', 'Post', 'product', 'Hotel Fonda Vela', '23016', '4', '190.211.106.200', '1443131543');
INSERT INTO `wp_aryo_activity_log` VALUES('3572', 'administrator', 'updated', 'Post', 'product', 'Hotel Fonda Vela', '23016', '4', '190.211.106.200', '1443131791');
INSERT INTO `wp_aryo_activity_log` VALUES('3573', 'administrator', 'updated', 'Post', 'product', 'Hotel Fonda Vela', '22740', '4', '190.211.106.200', '1443132445');
INSERT INTO `wp_aryo_activity_log` VALUES('3574', 'administrator', 'updated', 'Post', 'product', 'Hotel Fonda Vela', '22740', '4', '190.211.106.200', '1443132533');
INSERT INTO `wp_aryo_activity_log` VALUES('3575', 'administrator', 'updated', 'Post', 'product', 'Hotel Fonda Vela', '22740', '4', '190.211.106.200', '1443132764');
INSERT INTO `wp_aryo_activity_log` VALUES('3576', 'guest', 'wrong_password', 'User', '', 'Management', '0', '0', '190.211.106.200', '1443135080');
INSERT INTO `wp_aryo_activity_log` VALUES('3577', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443135088');
INSERT INTO `wp_aryo_activity_log` VALUES('3578', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '23018', '4', '190.211.106.200', '1443135173');
INSERT INTO `wp_aryo_activity_log` VALUES('3579', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '23018', '4', '190.211.106.200', '1443135880');
INSERT INTO `wp_aryo_activity_log` VALUES('3580', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443135967');
INSERT INTO `wp_aryo_activity_log` VALUES('3581', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136296');
INSERT INTO `wp_aryo_activity_log` VALUES('3582', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136555');
INSERT INTO `wp_aryo_activity_log` VALUES('3583', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136630');
INSERT INTO `wp_aryo_activity_log` VALUES('3584', 'administrator', 'added', 'Attachment', 'attachment', 'ficus 1', '24350', '4', '190.211.106.200', '1443136687');
INSERT INTO `wp_aryo_activity_log` VALUES('3585', 'administrator', 'added', 'Attachment', 'attachment', 'ficus 2', '24351', '4', '190.211.106.200', '1443136694');
INSERT INTO `wp_aryo_activity_log` VALUES('3586', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136706');
INSERT INTO `wp_aryo_activity_log` VALUES('3587', 'administrator', 'added', 'Attachment', 'attachment', 'ficus 3', '24352', '4', '190.211.106.200', '1443136758');
INSERT INTO `wp_aryo_activity_log` VALUES('3588', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136781');
INSERT INTO `wp_aryo_activity_log` VALUES('3589', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '23018', '4', '190.211.106.200', '1443136824');
INSERT INTO `wp_aryo_activity_log` VALUES('3590', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136875');
INSERT INTO `wp_aryo_activity_log` VALUES('3591', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443136949');
INSERT INTO `wp_aryo_activity_log` VALUES('3592', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137026');
INSERT INTO `wp_aryo_activity_log` VALUES('3593', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137100');
INSERT INTO `wp_aryo_activity_log` VALUES('3594', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137175');
INSERT INTO `wp_aryo_activity_log` VALUES('3595', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '23018', '4', '190.211.106.200', '1443137213');
INSERT INTO `wp_aryo_activity_log` VALUES('3596', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137251');
INSERT INTO `wp_aryo_activity_log` VALUES('3597', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137325');
INSERT INTO `wp_aryo_activity_log` VALUES('3598', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137401');
INSERT INTO `wp_aryo_activity_log` VALUES('3599', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137476');
INSERT INTO `wp_aryo_activity_log` VALUES('3600', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137555');
INSERT INTO `wp_aryo_activity_log` VALUES('3601', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 5', '24353', '4', '190.211.106.200', '1443137585');
INSERT INTO `wp_aryo_activity_log` VALUES('3602', 'administrator', 'updated', 'Attachment', 'attachment', 'Rafting Savegre', '24353', '4', '190.211.106.200', '1443137616');
INSERT INTO `wp_aryo_activity_log` VALUES('3603', 'administrator', 'updated', 'Attachment', 'attachment', 'Rafting Savegre', '24353', '4', '190.211.106.200', '1443137747');
INSERT INTO `wp_aryo_activity_log` VALUES('3604', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137798');
INSERT INTO `wp_aryo_activity_log` VALUES('3605', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137900');
INSERT INTO `wp_aryo_activity_log` VALUES('3606', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443137983');
INSERT INTO `wp_aryo_activity_log` VALUES('3607', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 1', '24354', '4', '190.211.106.200', '1443138162');
INSERT INTO `wp_aryo_activity_log` VALUES('3608', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 2', '24355', '4', '190.211.106.200', '1443138167');
INSERT INTO `wp_aryo_activity_log` VALUES('3609', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 3', '24356', '4', '190.211.106.200', '1443138174');
INSERT INTO `wp_aryo_activity_log` VALUES('3610', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 4', '24357', '4', '190.211.106.200', '1443138181');
INSERT INTO `wp_aryo_activity_log` VALUES('3611', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 6', '24358', '4', '190.211.106.200', '1443138192');
INSERT INTO `wp_aryo_activity_log` VALUES('3612', 'administrator', 'added', 'Attachment', 'attachment', 'Rafting Savegre 7', '24359', '4', '190.211.106.200', '1443138358');
INSERT INTO `wp_aryo_activity_log` VALUES('3613', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443138516');
INSERT INTO `wp_aryo_activity_log` VALUES('3614', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '23018', '4', '190.211.106.200', '1443138847');
INSERT INTO `wp_aryo_activity_log` VALUES('3615', 'administrator', 'updated', 'Post', 'product', 'Rápidos 3-4 Rio Naranjo', '24243', '4', '190.211.106.200', '1443138893');
INSERT INTO `wp_aryo_activity_log` VALUES('3616', 'administrator', 'updated', 'Post', 'product', 'Rápidos 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443138970');
INSERT INTO `wp_aryo_activity_log` VALUES('3617', 'administrator', 'updated', 'Post', 'product', 'Rápidos 2-3 Rio Savegre', '24302', '4', '190.211.106.200', '1443138999');
INSERT INTO `wp_aryo_activity_log` VALUES('3618', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443139207');
INSERT INTO `wp_aryo_activity_log` VALUES('3619', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443139298');
INSERT INTO `wp_aryo_activity_log` VALUES('3620', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443139325');
INSERT INTO `wp_aryo_activity_log` VALUES('3621', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443139368');
INSERT INTO `wp_aryo_activity_log` VALUES('3622', 'administrator', 'added', 'Attachment', 'attachment', 'Cabalgata Tacori', '24363', '4', '190.211.106.200', '1443139489');
INSERT INTO `wp_aryo_activity_log` VALUES('3623', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443139535');
INSERT INTO `wp_aryo_activity_log` VALUES('3624', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443139620');
INSERT INTO `wp_aryo_activity_log` VALUES('3625', 'administrator', 'updated', 'Post', 'product', 'Cabalgata a las Cascadas Tacori', '24334', '4', '190.211.106.200', '1443139693');
INSERT INTO `wp_aryo_activity_log` VALUES('3626', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443139788');
INSERT INTO `wp_aryo_activity_log` VALUES('3627', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443139830');
INSERT INTO `wp_aryo_activity_log` VALUES('3628', 'administrator', 'created', 'Post', 'product', 'Rafting 2-3', '24364', '4', '190.211.106.200', '1443139950');
INSERT INTO `wp_aryo_activity_log` VALUES('3629', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140019');
INSERT INTO `wp_aryo_activity_log` VALUES('3630', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140103');
INSERT INTO `wp_aryo_activity_log` VALUES('3631', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '22739', '4', '190.211.106.200', '1443140114');
INSERT INTO `wp_aryo_activity_log` VALUES('3632', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140178');
INSERT INTO `wp_aryo_activity_log` VALUES('3633', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140245');
INSERT INTO `wp_aryo_activity_log` VALUES('3634', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '22739', '4', '190.211.106.200', '1443140299');
INSERT INTO `wp_aryo_activity_log` VALUES('3635', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140317');
INSERT INTO `wp_aryo_activity_log` VALUES('3636', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '22739', '4', '190.211.106.200', '1443140453');
INSERT INTO `wp_aryo_activity_log` VALUES('3637', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140536');
INSERT INTO `wp_aryo_activity_log` VALUES('3638', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140613');
INSERT INTO `wp_aryo_activity_log` VALUES('3639', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140688');
INSERT INTO `wp_aryo_activity_log` VALUES('3640', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140764');
INSERT INTO `wp_aryo_activity_log` VALUES('3641', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140839');
INSERT INTO `wp_aryo_activity_log` VALUES('3642', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140912');
INSERT INTO `wp_aryo_activity_log` VALUES('3643', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443140987');
INSERT INTO `wp_aryo_activity_log` VALUES('3644', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443141019');
INSERT INTO `wp_aryo_activity_log` VALUES('3645', 'administrator', 'updated', 'Post', 'product', 'Hotel Ficus', '22739', '4', '190.211.106.200', '1443141062');
INSERT INTO `wp_aryo_activity_log` VALUES('3646', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443141164');
INSERT INTO `wp_aryo_activity_log` VALUES('3647', 'administrator', 'updated', 'Post', 'product', 'Tacori Waterfall Horseback riding', '24342', '4', '190.211.106.200', '1443141271');
INSERT INTO `wp_aryo_activity_log` VALUES('3648', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.106.200', '1443141301');
INSERT INTO `wp_aryo_activity_log` VALUES('3649', 'guest', 'wrong_password', 'User', '', 'Prueba', '0', '0', '190.211.106.200', '1443141326');
INSERT INTO `wp_aryo_activity_log` VALUES('3650', 'guest', 'logged_in', 'User', '', 'operations', '3', '3', '190.211.106.200', '1443141631');
INSERT INTO `wp_aryo_activity_log` VALUES('3651', 'contributor', 'logged_out', 'User', '', 'operations', '3', '3', '190.211.106.200', '1443141662');
INSERT INTO `wp_aryo_activity_log` VALUES('3652', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443141713');
INSERT INTO `wp_aryo_activity_log` VALUES('3653', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443141783');
INSERT INTO `wp_aryo_activity_log` VALUES('3654', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443142412');
INSERT INTO `wp_aryo_activity_log` VALUES('3655', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443142729');
INSERT INTO `wp_aryo_activity_log` VALUES('3656', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443142812');
INSERT INTO `wp_aryo_activity_log` VALUES('3657', 'administrator', 'added', 'Attachment', 'attachment', 'Imagen1mod', '24368', '4', '190.211.106.200', '1443143596');
INSERT INTO `wp_aryo_activity_log` VALUES('3658', 'administrator', 'updated', 'Attachment', 'attachment', 'Logo ExperienceCR', '24368', '4', '190.211.106.200', '1443143617');
INSERT INTO `wp_aryo_activity_log` VALUES('3659', 'administrator', 'created', 'Post', 'product', 'Manglar en Bote', '24370', '4', '190.211.106.200', '1443144052');
INSERT INTO `wp_aryo_activity_log` VALUES('3660', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144131');
INSERT INTO `wp_aryo_activity_log` VALUES('3661', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144232');
INSERT INTO `wp_aryo_activity_log` VALUES('3662', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144308');
INSERT INTO `wp_aryo_activity_log` VALUES('3663', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144383');
INSERT INTO `wp_aryo_activity_log` VALUES('3664', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconia', '23021', '4', '190.211.106.200', '1443144388');
INSERT INTO `wp_aryo_activity_log` VALUES('3665', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconia', '23021', '4', '190.211.106.200', '1443144448');
INSERT INTO `wp_aryo_activity_log` VALUES('3666', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144459');
INSERT INTO `wp_aryo_activity_log` VALUES('3667', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconia', '23021', '4', '190.211.106.200', '1443144490');
INSERT INTO `wp_aryo_activity_log` VALUES('3668', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144532');
INSERT INTO `wp_aryo_activity_log` VALUES('3669', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144608');
INSERT INTO `wp_aryo_activity_log` VALUES('3670', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconia', '23021', '4', '190.211.106.200', '1443144680');
INSERT INTO `wp_aryo_activity_log` VALUES('3671', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144684');
INSERT INTO `wp_aryo_activity_log` VALUES('3672', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0291_621_465_90', '24371', '4', '190.211.106.200', '1443144737');
INSERT INTO `wp_aryo_activity_log` VALUES('3673', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144749');
INSERT INTO `wp_aryo_activity_log` VALUES('3674', 'administrator', 'updated', 'Attachment', 'attachment', 'Manglar Isla Damas', '24371', '4', '190.211.106.200', '1443144754');
INSERT INTO `wp_aryo_activity_log` VALUES('3675', 'administrator', 'added', 'Attachment', 'attachment', 'cOSTA-RICA_45_621_409_90', '24372', '4', '190.211.106.200', '1443144767');
INSERT INTO `wp_aryo_activity_log` VALUES('3676', 'administrator', 'updated', 'Attachment', 'attachment', 'Isla Damas2', '24372', '4', '190.211.106.200', '1443144814');
INSERT INTO `wp_aryo_activity_log` VALUES('3677', 'administrator', 'added', 'Attachment', 'attachment', 'cOSTA-RICA_34_621_414_90', '24373', '4', '190.211.106.200', '1443144823');
INSERT INTO `wp_aryo_activity_log` VALUES('3678', 'administrator', 'updated', 'Attachment', 'attachment', 'Manglar Isla Damas 2', '24373', '4', '190.211.106.200', '1443144843');
INSERT INTO `wp_aryo_activity_log` VALUES('3679', 'administrator', 'added', 'Attachment', 'attachment', 'cOSTA-RICA_33_621_414_90', '24374', '4', '190.211.106.200', '1443144852');
INSERT INTO `wp_aryo_activity_log` VALUES('3680', 'administrator', 'updated', 'Attachment', 'attachment', 'Isla Damas 3', '24374', '4', '190.211.106.200', '1443144869');
INSERT INTO `wp_aryo_activity_log` VALUES('3681', 'administrator', 'added', 'Attachment', 'attachment', 'cOSTA-RICA_31_621_414_90', '24375', '4', '190.211.106.200', '1443144879');
INSERT INTO `wp_aryo_activity_log` VALUES('3682', 'administrator', 'updated', 'Attachment', 'attachment', 'Isla Damas 4', '24375', '4', '190.211.106.200', '1443144892');
INSERT INTO `wp_aryo_activity_log` VALUES('3683', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144921');
INSERT INTO `wp_aryo_activity_log` VALUES('3684', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443144967');
INSERT INTO `wp_aryo_activity_log` VALUES('3685', 'administrator', 'updated', 'Post', 'product', 'Rafting 2-3 Savegre River', '24364', '4', '190.211.106.200', '1443145053');
INSERT INTO `wp_aryo_activity_log` VALUES('3686', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443145074');
INSERT INTO `wp_aryo_activity_log` VALUES('3687', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443145164');
INSERT INTO `wp_aryo_activity_log` VALUES('3688', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas', '24370', '4', '190.211.106.200', '1443145308');
INSERT INTO `wp_aryo_activity_log` VALUES('3689', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconias', '22738', '4', '190.211.106.200', '1443145993');
INSERT INTO `wp_aryo_activity_log` VALUES('3690', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconias', '22738', '4', '190.211.106.200', '1443146061');
INSERT INTO `wp_aryo_activity_log` VALUES('3691', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconias', '22738', '4', '190.211.106.200', '1443146253');
INSERT INTO `wp_aryo_activity_log` VALUES('3692', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconias', '22738', '4', '190.211.106.200', '1443146292');
INSERT INTO `wp_aryo_activity_log` VALUES('3693', 'administrator', 'updated', 'Post', 'product', 'Hotel Heliconias', '22738', '4', '190.211.106.200', '1443146360');
INSERT INTO `wp_aryo_activity_log` VALUES('3694', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.106.200', '1443146461');
INSERT INTO `wp_aryo_activity_log` VALUES('3695', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '178.175.131.194', '1443204997');
INSERT INTO `wp_aryo_activity_log` VALUES('3696', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '185.62.190.38', '1443205190');
INSERT INTO `wp_aryo_activity_log` VALUES('3697', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443217381');
INSERT INTO `wp_aryo_activity_log` VALUES('3698', 'administrator', 'updated', 'Post', 'product', 'Hotel Country Lodge', '23022', '4', '190.211.106.200', '1443218455');
INSERT INTO `wp_aryo_activity_log` VALUES('3699', 'administrator', 'added', 'Attachment', 'attachment', 'country_lodge-5', '24378', '4', '190.211.106.200', '1443219019');
INSERT INTO `wp_aryo_activity_log` VALUES('3700', 'administrator', 'added', 'Attachment', 'attachment', 'Monteverde Country-Lodge', '24379', '4', '190.211.106.200', '1443219025');
INSERT INTO `wp_aryo_activity_log` VALUES('3701', 'administrator', 'added', 'Attachment', 'attachment', 'monteverde-country-lodge 1', '24380', '4', '190.211.106.200', '1443219030');
INSERT INTO `wp_aryo_activity_log` VALUES('3702', 'administrator', 'added', 'Attachment', 'attachment', 'monteverde-country-lodge 3', '24381', '4', '190.211.106.200', '1443219034');
INSERT INTO `wp_aryo_activity_log` VALUES('3703', 'administrator', 'added', 'Attachment', 'attachment', 'Monteverde-Country-Lodge2', '24382', '4', '190.211.106.200', '1443219040');
INSERT INTO `wp_aryo_activity_log` VALUES('3704', 'administrator', 'added', 'Attachment', 'attachment', 'Monteverde-Country-Lodge4', '24383', '4', '190.211.106.200', '1443219047');
INSERT INTO `wp_aryo_activity_log` VALUES('3705', 'administrator', 'updated', 'Post', 'product', 'Hotel Country Lodge', '23022', '4', '190.211.106.200', '1443219090');
INSERT INTO `wp_aryo_activity_log` VALUES('3706', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443220017');
INSERT INTO `wp_aryo_activity_log` VALUES('3707', 'administrator', 'created', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443220658');
INSERT INTO `wp_aryo_activity_log` VALUES('3708', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443220737');
INSERT INTO `wp_aryo_activity_log` VALUES('3709', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443220960');
INSERT INTO `wp_aryo_activity_log` VALUES('3710', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221035');
INSERT INTO `wp_aryo_activity_log` VALUES('3711', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221140');
INSERT INTO `wp_aryo_activity_log` VALUES('3712', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221219');
INSERT INTO `wp_aryo_activity_log` VALUES('3713', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221294');
INSERT INTO `wp_aryo_activity_log` VALUES('3714', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221370');
INSERT INTO `wp_aryo_activity_log` VALUES('3715', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221445');
INSERT INTO `wp_aryo_activity_log` VALUES('3716', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221520');
INSERT INTO `wp_aryo_activity_log` VALUES('3717', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221588');
INSERT INTO `wp_aryo_activity_log` VALUES('3718', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221662');
INSERT INTO `wp_aryo_activity_log` VALUES('3719', 'administrator', 'added', 'Attachment', 'attachment', 'cOSTA-RICA_45_621_409_90', '24386', '4', '190.211.106.200', '1443221676');
INSERT INTO `wp_aryo_activity_log` VALUES('3720', 'administrator', 'deleted', 'Attachment', 'attachment', 'cOSTA-RICA_45_621_409_90', '24386', '4', '190.211.106.200', '1443221685');
INSERT INTO `wp_aryo_activity_log` VALUES('3721', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221737');
INSERT INTO `wp_aryo_activity_log` VALUES('3722', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour', '24385', '4', '190.211.106.200', '1443221844');
INSERT INTO `wp_aryo_activity_log` VALUES('3723', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove tour by boat', '24385', '4', '190.211.106.200', '1443222056');
INSERT INTO `wp_aryo_activity_log` VALUES('3724', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove by boat', '24385', '4', '190.211.106.200', '1443222098');
INSERT INTO `wp_aryo_activity_log` VALUES('3725', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas en bote', '24370', '4', '190.211.106.200', '1443222172');
INSERT INTO `wp_aryo_activity_log` VALUES('3726', 'administrator', 'updated', 'Post', 'product', 'Manglar Isla Damas en bote', '24370', '4', '190.211.106.200', '1443222276');
INSERT INTO `wp_aryo_activity_log` VALUES('3727', 'administrator', 'updated', 'Post', 'product', 'Isla Damas Mangrove by boat', '24385', '4', '190.211.106.200', '1443222342');
INSERT INTO `wp_aryo_activity_log` VALUES('3728', 'administrator', 'created', 'Post', 'product', 'Isla Damas en Kayak', '24388', '4', '190.211.106.200', '1443222507');
INSERT INTO `wp_aryo_activity_log` VALUES('3729', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443222643');
INSERT INTO `wp_aryo_activity_log` VALUES('3730', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443222720');
INSERT INTO `wp_aryo_activity_log` VALUES('3731', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443222793');
INSERT INTO `wp_aryo_activity_log` VALUES('3732', 'administrator', 'updated', 'Post', 'product', 'Hotel Country Lodge', '22737', '4', '190.211.106.200', '1443222860');
INSERT INTO `wp_aryo_activity_log` VALUES('3733', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443222873');
INSERT INTO `wp_aryo_activity_log` VALUES('3734', 'administrator', 'updated', 'Post', 'product', 'Monteverde Country Lodge', '22737', '4', '190.211.106.200', '1443222929');
INSERT INTO `wp_aryo_activity_log` VALUES('3735', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443222944');
INSERT INTO `wp_aryo_activity_log` VALUES('3736', 'administrator', 'updated', 'Post', 'product', 'Monteverde Country Lodge', '22737', '4', '190.211.106.200', '1443223010');
INSERT INTO `wp_aryo_activity_log` VALUES('3737', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443223019');
INSERT INTO `wp_aryo_activity_log` VALUES('3738', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443223105');
INSERT INTO `wp_aryo_activity_log` VALUES('3739', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0452_621_465_90', '24389', '4', '190.211.106.200', '1443223150');
INSERT INTO `wp_aryo_activity_log` VALUES('3740', 'administrator', 'updated', 'Attachment', 'attachment', 'Kayak Isla Damas', '24389', '4', '190.211.106.200', '1443223166');
INSERT INTO `wp_aryo_activity_log` VALUES('3741', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0447_621_465_90', '24390', '4', '190.211.106.200', '1443223258');
INSERT INTO `wp_aryo_activity_log` VALUES('3742', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0459_621_414_90', '24391', '4', '190.211.106.200', '1443223264');
INSERT INTO `wp_aryo_activity_log` VALUES('3743', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0460_621_414_90', '24392', '4', '190.211.106.200', '1443223270');
INSERT INTO `wp_aryo_activity_log` VALUES('3744', 'administrator', 'added', 'Attachment', 'attachment', 'IMG_0461_621_465_90', '24393', '4', '190.211.106.200', '1443223278');
INSERT INTO `wp_aryo_activity_log` VALUES('3745', 'administrator', 'updated', 'Post', 'product', 'Monteverde Country Lodge', '22737', '4', '190.211.106.200', '1443223291');
INSERT INTO `wp_aryo_activity_log` VALUES('3746', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443223422');
INSERT INTO `wp_aryo_activity_log` VALUES('3747', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443223446');
INSERT INTO `wp_aryo_activity_log` VALUES('3748', 'administrator', 'updated', 'Post', 'product', 'Isla Damas en Kayak', '24333', '4', '190.211.106.200', '1443223634');
INSERT INTO `wp_aryo_activity_log` VALUES('3749', 'administrator', 'created', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443223703');
INSERT INTO `wp_aryo_activity_log` VALUES('3750', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443223779');
INSERT INTO `wp_aryo_activity_log` VALUES('3751', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443223853');
INSERT INTO `wp_aryo_activity_log` VALUES('3752', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443223930');
INSERT INTO `wp_aryo_activity_log` VALUES('3753', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224005');
INSERT INTO `wp_aryo_activity_log` VALUES('3754', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224072');
INSERT INTO `wp_aryo_activity_log` VALUES('3755', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224147');
INSERT INTO `wp_aryo_activity_log` VALUES('3756', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224222');
INSERT INTO `wp_aryo_activity_log` VALUES('3757', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224298');
INSERT INTO `wp_aryo_activity_log` VALUES('3758', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224373');
INSERT INTO `wp_aryo_activity_log` VALUES('3759', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224448');
INSERT INTO `wp_aryo_activity_log` VALUES('3760', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224461');
INSERT INTO `wp_aryo_activity_log` VALUES('3761', 'administrator', 'updated', 'Post', 'product', 'Kayak in Damas Island', '24395', '4', '190.211.106.200', '1443224608');
INSERT INTO `wp_aryo_activity_log` VALUES('3762', 'administrator', 'created', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443225837');
INSERT INTO `wp_aryo_activity_log` VALUES('3763', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443225901');
INSERT INTO `wp_aryo_activity_log` VALUES('3764', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226068');
INSERT INTO `wp_aryo_activity_log` VALUES('3765', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226141');
INSERT INTO `wp_aryo_activity_log` VALUES('3766', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226396');
INSERT INTO `wp_aryo_activity_log` VALUES('3767', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226472');
INSERT INTO `wp_aryo_activity_log` VALUES('3768', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226549');
INSERT INTO `wp_aryo_activity_log` VALUES('3769', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226622');
INSERT INTO `wp_aryo_activity_log` VALUES('3770', 'administrator', 'updated', 'Post', 'product', 'Hotel Cloud Forest Lodge', '23024', '4', '190.211.106.200', '1443226640');
INSERT INTO `wp_aryo_activity_log` VALUES('3771', 'administrator', 'updated', 'Post', 'product', 'Hotel Cloud Forest Lodge', '23024', '4', '190.211.106.200', '1443226680');
INSERT INTO `wp_aryo_activity_log` VALUES('3772', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226700');
INSERT INTO `wp_aryo_activity_log` VALUES('3773', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226787');
INSERT INTO `wp_aryo_activity_log` VALUES('3774', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226862');
INSERT INTO `wp_aryo_activity_log` VALUES('3775', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443226982');
INSERT INTO `wp_aryo_activity_log` VALUES('3776', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227057');
INSERT INTO `wp_aryo_activity_log` VALUES('3777', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227147');
INSERT INTO `wp_aryo_activity_log` VALUES('3778', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227222');
INSERT INTO `wp_aryo_activity_log` VALUES('3779', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227298');
INSERT INTO `wp_aryo_activity_log` VALUES('3780', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227377');
INSERT INTO `wp_aryo_activity_log` VALUES('3781', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227466');
INSERT INTO `wp_aryo_activity_log` VALUES('3782', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227542');
INSERT INTO `wp_aryo_activity_log` VALUES('3783', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227632');
INSERT INTO `wp_aryo_activity_log` VALUES('3784', 'administrator', 'updated', 'Post', 'product', 'Hotel Cloud Forest Lodge', '22736', '4', '190.211.106.200', '1443227738');
INSERT INTO `wp_aryo_activity_log` VALUES('3785', 'administrator', 'updated', 'Post', 'product', 'Hotel Cloud Forest Lodge', '22736', '4', '190.211.106.200', '1443227778');
INSERT INTO `wp_aryo_activity_log` VALUES('3786', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227784');
INSERT INTO `wp_aryo_activity_log` VALUES('3787', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227857');
INSERT INTO `wp_aryo_activity_log` VALUES('3788', 'administrator', 'updated', 'Post', 'product', 'Hotel Cloud Forest Lodge', '22736', '4', '190.211.106.200', '1443227894');
INSERT INTO `wp_aryo_activity_log` VALUES('3789', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443227933');
INSERT INTO `wp_aryo_activity_log` VALUES('3790', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443228014');
INSERT INTO `wp_aryo_activity_log` VALUES('3791', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443228091');
INSERT INTO `wp_aryo_activity_log` VALUES('3792', 'administrator', 'added', 'Attachment', 'attachment', 'Santa Juana 3', '24399', '4', '190.211.106.200', '1443228121');
INSERT INTO `wp_aryo_activity_log` VALUES('3793', 'administrator', 'updated', 'Attachment', 'attachment', 'Santa Juana', '24399', '4', '190.211.106.200', '1443228133');
INSERT INTO `wp_aryo_activity_log` VALUES('3794', 'administrator', 'added', 'Attachment', 'attachment', 'Santa Juana 1', '24400', '4', '190.211.106.200', '1443228149');
INSERT INTO `wp_aryo_activity_log` VALUES('3795', 'administrator', 'added', 'Attachment', 'attachment', 'Santa Juana 2', '24401', '4', '190.211.106.200', '1443228157');
INSERT INTO `wp_aryo_activity_log` VALUES('3796', 'administrator', 'added', 'Attachment', 'attachment', 'Santa Juana 4', '24402', '4', '190.211.106.200', '1443228163');
INSERT INTO `wp_aryo_activity_log` VALUES('3797', 'administrator', 'created', 'Taxonomy', 'product_tag', 'Santa Juana', '146', '4', '190.211.106.200', '1443228190');
INSERT INTO `wp_aryo_activity_log` VALUES('3798', 'administrator', 'created', 'Taxonomy', 'product_tag', 'Campesino', '147', '4', '190.211.106.200', '1443228190');
INSERT INTO `wp_aryo_activity_log` VALUES('3799', 'administrator', 'created', 'Taxonomy', 'product_tag', 'Tour', '148', '4', '190.211.106.200', '1443228190');
INSERT INTO `wp_aryo_activity_log` VALUES('3800', 'administrator', 'created', 'Taxonomy', 'product_tag', 'Rural', '149', '4', '190.211.106.200', '1443228190');
INSERT INTO `wp_aryo_activity_log` VALUES('3801', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443228190');
INSERT INTO `wp_aryo_activity_log` VALUES('3802', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443228292');
INSERT INTO `wp_aryo_activity_log` VALUES('3803', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443228401');
INSERT INTO `wp_aryo_activity_log` VALUES('3804', 'administrator', 'deleted', 'Post', 'product', 'Copa de Arbol,Drake Bay', '22695', '4', '190.211.106.200', '1443228706');
INSERT INTO `wp_aryo_activity_log` VALUES('3805', 'administrator', 'updated', 'Post', 'product', 'Finca Agricola Santa Juana', '24397', '4', '190.211.106.200', '1443228760');
INSERT INTO `wp_aryo_activity_log` VALUES('3806', 'administrator', 'updated', 'Post', 'product', 'Hotel Tryp San Jose Sabana', '23606', '4', '190.211.106.200', '1443229551');
INSERT INTO `wp_aryo_activity_log` VALUES('3807', 'administrator', 'updated', 'Post', 'product', 'Hotel Tryp San Jose Sabana', '23606', '4', '190.211.106.200', '1443230317');
INSERT INTO `wp_aryo_activity_log` VALUES('3808', 'administrator', 'created', 'Post', 'product', '(no title)', '24406', '4', '190.211.106.200', '1443230526');
INSERT INTO `wp_aryo_activity_log` VALUES('3809', 'administrator', 'added', 'Attachment', 'attachment', 'hotel_tryp_san_jose', '24407', '4', '190.211.106.200', '1443230909');
INSERT INTO `wp_aryo_activity_log` VALUES('3810', 'administrator', 'updated', 'Post', 'product', 'Hotel Tryp San Jose Sabana', '23594', '4', '190.211.106.200', '1443230920');
INSERT INTO `wp_aryo_activity_log` VALUES('3811', 'administrator', 'updated', 'Post', 'product', 'Hotel Balmoral', '23592', '4', '190.211.106.200', '1443231378');
INSERT INTO `wp_aryo_activity_log` VALUES('3812', 'administrator', 'created', 'Post', 'product', 'Santa Juana Agr', '24404', '4', '190.211.106.200', '1443231954');
INSERT INTO `wp_aryo_activity_log` VALUES('3813', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443231966');
INSERT INTO `wp_aryo_activity_log` VALUES('3814', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232052');
INSERT INTO `wp_aryo_activity_log` VALUES('3815', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232127');
INSERT INTO `wp_aryo_activity_log` VALUES('3816', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232193');
INSERT INTO `wp_aryo_activity_log` VALUES('3817', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232269');
INSERT INTO `wp_aryo_activity_log` VALUES('3818', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232451');
INSERT INTO `wp_aryo_activity_log` VALUES('3819', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232517');
INSERT INTO `wp_aryo_activity_log` VALUES('3820', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232591');
INSERT INTO `wp_aryo_activity_log` VALUES('3821', 'administrator', 'updated', 'Post', 'product', 'Hotel Balmoral', '23552', '4', '190.211.106.200', '1443232597');
INSERT INTO `wp_aryo_activity_log` VALUES('3822', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232641');
INSERT INTO `wp_aryo_activity_log` VALUES('3823', 'administrator', 'updated', 'Post', 'product', 'Santa Juana Agro Farm', '24404', '4', '190.211.106.200', '1443232694');
INSERT INTO `wp_aryo_activity_log` VALUES('3824', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.106.200', '1443232713');
INSERT INTO `wp_aryo_activity_log` VALUES('3825', 'administrator', 'logged_out', 'User', '', 'management', '4', '4', '190.211.106.200', '1443232725');
INSERT INTO `wp_aryo_activity_log` VALUES('3826', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '212.83.40.238', '1443260208');
INSERT INTO `wp_aryo_activity_log` VALUES('3827', 'guest', 'wrong_password', 'User', '', 'admin', '0', '0', '162.247.72.213', '1443277080');
INSERT INTO `wp_aryo_activity_log` VALUES('3828', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '186.26.115.141', '1443282315');
INSERT INTO `wp_aryo_activity_log` VALUES('3829', 'guest', 'logged_in', 'User', '', 'management', '4', '4', '190.211.106.200', '1443283566');
INSERT INTO `wp_aryo_activity_log` VALUES('3830', 'administrator', 'updated', 'Post', 'product', 'Studio Hotel', '23585', '4', '190.211.106.200', '1443285716');
INSERT INTO `wp_aryo_activity_log` VALUES('3831', 'administrator', 'updated', 'Post', 'product', 'Studio Hotel', '23573', '4', '190.211.106.200', '1443286095');
INSERT INTO `wp_aryo_activity_log` VALUES('3832', 'administrator', 'deleted', 'Post', 'product', '(no title)', '24406', '4', '190.211.106.200', '1443286275');
INSERT INTO `wp_aryo_activity_log` VALUES('3833', 'administrator', 'updated', 'Post', 'product', 'Hotel Radisson', '23571', '4', '190.211.106.200', '1443286721');
INSERT INTO `wp_aryo_activity_log` VALUES('3834', 'administrator', 'created', 'Post', 'product', '(no title)', '24413', '4', '190.211.106.200', '1443286992');
INSERT INTO `wp_aryo_activity_log` VALUES('3835', 'administrator', 'updated', 'Post', 'product', 'Hotel Radisson', '23554', '4', '190.211.106.200', '1443287551');
INSERT INTO `wp_aryo_activity_log` VALUES('3836', 'administrator', 'created', 'Post', 'product', '(no title)', '24415', '4', '190.211.106.200', '1443287913');
INSERT INTO `wp_aryo_activity_log` VALUES('3837', 'administrator', 'updated', 'Post', 'product', 'Grand Hotel CR', '23542', '4', '190.211.106.200', '1443288420');
/*!40000 ALTER TABLE `wp_aryo_activity_log` ENABLE KEYS */;
| JDjimenezdelgado/old-mmexperience | wp-content/uploads/backupbuddy_temp/jf9bpm0ioi/wp_aryo_activity_log.sql | SQL | gpl-2.0 | 228,347 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Alexander T. Simbirtsev
* Created on 29.04.2005
*/
package javax.swing.plaf.metal;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicRadioButtonUI;
import org.apache.harmony.x.swing.ButtonCommons;
public class MetalRadioButtonUI extends BasicRadioButtonUI {
protected Color focusColor;
protected Color selectColor;
protected Color disabledTextColor;
private static Color defaultFocusColor;
private static MetalRadioButtonUI metalRadioButtonUI;
public static ComponentUI createUI(final JComponent c) {
if (metalRadioButtonUI == null) {
metalRadioButtonUI = new MetalRadioButtonUI();
}
return metalRadioButtonUI;
}
public void installDefaults(final AbstractButton b) {
super.installDefaults(b);
if ((disabledTextColor == null) || (disabledTextColor instanceof UIResource)) {
disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
}
if ((focusColor == null) || (focusColor instanceof UIResource)) {
focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
}
if ((selectColor == null) || (selectColor instanceof UIResource)) {
selectColor = UIManager.getColor(getPropertyPrefix() + "select");
}
if (defaultFocusColor == null) {
defaultFocusColor = UIManager.getDefaults().getColor("activeCaptionBorder");
}
}
protected Color getSelectColor() {
return selectColor;
}
protected Color getDisabledTextColor() {
return disabledTextColor;
}
protected Color getFocusColor() {
return focusColor;
}
public void paint(final Graphics g, final JComponent c) {
AbstractButton button = (AbstractButton)c;
Rectangle viewR = new Rectangle();
Rectangle iconR = new Rectangle();
Rectangle textR = new Rectangle();
Icon icon = ButtonCommons.getCurrentIcon(button);
if (icon == null) {
icon = getDefaultIcon();
}
String clippedText = ButtonCommons.getPaintingParameters(button, viewR, iconR, textR, icon);
if (icon != null) {
icon.paintIcon(button, g, iconR.x, iconR.y);
}
textR.x += getTextShiftOffset();
textR.y += getTextShiftOffset();
paintText(g, button, textR, clippedText, getDisabledTextColor());
if (button.isEnabled() && button.isFocusPainted() && button.isFocusOwner()) {
paintFocus(g, ButtonCommons.getFocusRect(textR, viewR, iconR), null);
}
}
protected void paintFocus(final Graphics g, final Rectangle t, final Dimension d) {
Color color = (focusColor != null) ? focusColor : defaultFocusColor;
ButtonCommons.paintFocus(g, t, color);
}
private void paintText(final Graphics g, final AbstractButton b,
final Rectangle textRect, final String text, final Color disabledTextColor) {
Color color = b.isEnabled() ? b.getForeground() : disabledTextColor;
ButtonCommons.paintText(g, b, textRect, text, color);
}
}
| skyHALud/codenameone | Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalRadioButtonUI.java | Java | gpl-2.0 | 4,371 |
package vm
import (
"fmt"
"math/big"
)
func newStack() *stack {
return &stack{}
}
type stack struct {
data []*big.Int
ptr int
}
func (st *stack) push(d *big.Int) {
// NOTE push limit (1024) is checked in baseCheck
stackItem := new(big.Int).Set(d)
if len(st.data) > st.ptr {
st.data[st.ptr] = stackItem
} else {
st.data = append(st.data, stackItem)
}
st.ptr++
}
func (st *stack) pop() (ret *big.Int) {
st.ptr--
ret = st.data[st.ptr]
return
}
func (st *stack) len() int {
return st.ptr
}
func (st *stack) swap(n int) {
st.data[st.len()-n], st.data[st.len()-1] = st.data[st.len()-1], st.data[st.len()-n]
}
func (st *stack) dup(n int) {
st.push(st.data[st.len()-n])
}
func (st *stack) peek() *big.Int {
return st.data[st.len()-1]
}
func (st *stack) require(n int) error {
if st.len() < n {
return fmt.Errorf("stack underflow (%d <=> %d)", len(st.data), n)
}
return nil
}
func (st *stack) Print() {
fmt.Println("### stack ###")
if len(st.data) > 0 {
for i, val := range st.data {
fmt.Printf("%-3d %v\n", i, val)
}
} else {
fmt.Println("-- empty --")
}
fmt.Println("#############")
}
| ethereum/gethkey | Godeps/_workspace/src/github.com/ethereum/go-ethereum/core/vm/stack.go | GO | gpl-2.0 | 1,132 |
/**
******************************************************************************
* @file stm32g4xx_hal_fmac.c
* @author MCD Application Team
* @brief FMAC HAL module driver.
* This file provides firmware functions to manage the following
* functionalities of the FMAC peripheral:
* + Initialization and de-initialization functions
* + Peripheral Control functions
* + Callback functions
* + IRQ handler management
* + Peripheral State and Error functions
*
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*
* @verbatim
================================================================================
##### How to use this driver #####
================================================================================
[..]
The FMAC HAL driver can be used as follows:
(#) Initialize the FMAC low level resources by implementing the @ref HAL_FMAC_MspInit():
(++) Enable the FMAC interface clock using @ref __HAL_RCC_FMAC_CLK_ENABLE().
(++) In case of using interrupts (e.g. access configured as FMAC_BUFFER_ACCESS_IT):
(+++) Configure the FMAC interrupt priority using @ref HAL_NVIC_SetPriority().
(+++) Enable the FMAC IRQ handler using @ref HAL_NVIC_EnableIRQ().
(+++) In FMAC IRQ handler, call @ref HAL_FMAC_IRQHandler().
(++) In case of using DMA to control data transfer (e.g. access configured
as FMAC_BUFFER_ACCESS_DMA):
(+++) Enable the DMA interface clock using @ref __HAL_RCC_DMA1_CLK_ENABLE()
or @ref __HAL_RCC_DMA2_CLK_ENABLE() depending on the used DMA instance.
(+++) Enable the DMAMUX1 interface clock using @ref __HAL_RCC_DMAMUX1_CLK_ENABLE().
(+++) If the initialization of the internal buffers (coefficients, input,
output) is done via DMA, configure and enable one DMA channel for
managing data transfer from memory to memory (preload channel).
(+++) If the input buffer is accessed via DMA, configure and enable one
DMA channel for managing data transfer from memory to peripheral
(input channel).
(+++) If the output buffer is accessed via DMA, configure and enable
one DMA channel for managing data transfer from peripheral to
memory (output channel).
(+++) Associate the initialized DMA handle(s) to the FMAC DMA handle(s)
using @ref __HAL_LINKDMA().
(+++) Configure the priority and enable the NVIC for the transfer complete
interrupt on the enabled DMA channel(s) using @ref HAL_NVIC_SetPriority()
and @ref HAL_NVIC_EnableIRQ().
(#) Initialize the FMAC HAL using @ref HAL_FMAC_Init(). This function
resorts to @ref HAL_FMAC_MspInit() for low-level initialization.
(#) Configure the FMAC processing (filter) using @ref HAL_FMAC_FilterConfig()
or @ref HAL_FMAC_FilterConfig_DMA().
This function:
(++) Defines the memory area within the FMAC internal memory
(input, coefficients, output) and the associated threshold (input, output).
(++) Configures the filter and its parameters:
(+++) Finite Impulse Response (FIR) filter (also known as convolution).
(+++) Infinite Impulse Response (IIR) filter (direct form 1).
(++) Choose the way to access to the input and output buffers: none, polling,
DMA, IT. "none" means the input and/or output data will be handled by
another IP (ADC, DAC, etc.).
(++) Enable the error interruptions in the input access and/or the output
access is done through IT/DMA. If an error occurs, the interruption
will be triggered in loop. In order to recover, the user will have
to reset the IP with the sequence @ref HAL_FMAC_DeInit / @ref HAL_FMAC_Init.
Optionally, he can also disable the interrupt using @ref __HAL_FMAC_DISABLE_IT;
the error status will be kept, but no more interrupt will be triggered.
(++) Write the provided coefficients into the internal memory using polling
mode ( @ref HAL_FMAC_FilterConfig() ) or DMA ( @ref HAL_FMAC_FilterConfig_DMA() ).
In the DMA case, @ref HAL_FMAC_FilterConfigCallback() is called when
the handling is over.
(#) Optionally, the user can enable the error interruption related to
saturation by calling @ref __HAL_FMAC_ENABLE_IT. This helps in debugging the
filter. If a saturation occurs, the interruption will be triggered in loop.
In order to recover, the user will have to:
(++) Disable the interruption by calling @ref __HAL_FMAC_DISABLE_IT if
the user wishes to continue all the same.
(++) Reset the IP with the sequence @ref HAL_FMAC_DeInit / @ref HAL_FMAC_Init.
(#) Optionally, preload input (FIR, IIR) and output (IIR) data using
@ref HAL_FMAC_FilterPreload() or @ref HAL_FMAC_FilterPreload_DMA().
In the DMA case, @ref HAL_FMAC_FilterPreloadCallback() is called when
the handling is over.
This step is optional as the filter can be started without preloaded
data.
(#) Start the FMAC processing (filter) using @ref HAL_FMAC_FilterStart().
This function also configures the output buffer that will be filled from
the circular internal output buffer. The function returns immediately
without updating the provided buffer. The IP processing will be active until
@ref HAL_FMAC_FilterStop() is called.
(#) If the input internal buffer is accessed via DMA, @ref HAL_FMAC_HalfGetDataCallback()
will be called to indicate that half of the input buffer has been handled.
(#) If the input internal buffer is accessed via DMA or interrupt, @ref HAL_FMAC_GetDataCallback()
will be called to require new input data. It will be provided through
@ref HAL_FMAC_AppendFilterData() if the DMA isn't in circular mode.
(#) If the output internal buffer is accessed via DMA, @ref HAL_FMAC_HalfOutputDataReadyCallback()
will be called to indicate that half of the output buffer has been handled.
(#) If the output internal buffer is accessed via DMA or interrupt,
@ref HAL_FMAC_OutputDataReadyCallback() will be called to require a new output
buffer. It will be provided through @ref HAL_FMAC_ConfigFilterOutputBuffer()
if the DMA isn't in circular mode.
(#) In all modes except none, provide new input data to be processed via @ref HAL_FMAC_AppendFilterData().
This function should only be called once the previous input data has been handled
(the preloaded input data isn't concerned).
(#) In all modes except none, provide a new output buffer to be filled via
@ref HAL_FMAC_ConfigFilterOutputBuffer(). This function should only be called once the previous
user's output buffer has been filled.
(#) In polling mode, handle the input and output data using @ref HAL_FMAC_PollFilterData().
This function:
(++) Write the user's input data (provided via @ref HAL_FMAC_AppendFilterData())
into the FMAC input memory area.
(++) Read the FMAC output memory area and write it into the user's output buffer.
It will return either when:
(++) the user's output buffer is filled.
(++) the user's input buffer has been handled.
The unused data (unread input data or free output data) will not be saved.
The user will have to use the updated input and output sizes to keep track
of them.
(#) Stop the FMAC processing (filter) using @ref HAL_FMAC_FilterStop().
(#) Call @ref HAL_FMAC_DeInit() to de-initialize the FMAC peripheral. This function
resorts to @ref HAL_FMAC_MspDeInit() for low-level de-initialization.
##### Callback registration #####
==================================
[..]
The compilation define USE_HAL_FMAC_REGISTER_CALLBACKS when set to 1
allows the user to configure dynamically the driver callbacks.
[..]
Use Function @ref HAL_FMAC_RegisterCallback() to register a user callback.
Function @ref HAL_FMAC_RegisterCallback() allows to register following callbacks:
(+) ErrorCallback : Error Callback.
(+) HalfGetDataCallback : Get Half Data Callback.
(+) GetDataCallback : Get Data Callback.
(+) HalfOutputDataReadyCallback : Half Output Data Ready Callback.
(+) OutputDataReadyCallback : Output Data Ready Callback.
(+) FilterConfigCallback : Filter Configuration Callback.
(+) FilterPreloadCallback : Filter Preload Callback.
(+) MspInitCallback : FMAC MspInit.
(+) MspDeInitCallback : FMAC MspDeInit.
This function takes as parameters the HAL peripheral handle, the Callback ID
and a pointer to the user callback function.
[..]
Use function @ref HAL_FMAC_UnRegisterCallback() to reset a callback to the default
weak (surcharged) function.
@ref HAL_FMAC_UnRegisterCallback() takes as parameters the HAL peripheral handle
and the Callback ID.
This function allows to reset following callbacks:
(+) ErrorCallback : Error Callback.
(+) HalfGetDataCallback : Get Half Data Callback.
(+) GetDataCallback : Get Data Callback.
(+) HalfOutputDataReadyCallback : Half Output Data Ready Callback.
(+) OutputDataReadyCallback : Output Data Ready Callback.
(+) FilterConfigCallback : Filter Configuration Callback.
(+) FilterPreloadCallback : Filter Preload Callback.
(+) MspInitCallback : FMAC MspInit.
(+) MspDeInitCallback : FMAC MspDeInit.
[..]
By default, after the @ref HAL_FMAC_Init() and when the state is HAL_FMAC_STATE_RESET
all callbacks are set to the corresponding weak (surcharged) functions:
examples @ref GetDataCallback(), @ref OutputDataReadyCallback().
Exception done for MspInit and MspDeInit functions that are respectively
reset to the legacy weak (surcharged) functions in the @ref HAL_FMAC_Init()
and @ref HAL_FMAC_DeInit() only when these callbacks are null (not registered beforehand).
If not, MspInit or MspDeInit are not null, the @ref HAL_FMAC_Init() and @ref HAL_FMAC_DeInit()
keep and use the user MspInit/MspDeInit callbacks (registered beforehand).
[..]
Callbacks can be registered/unregistered in HAL_FMAC_STATE_READY state only.
Exception done MspInit/MspDeInit that can be registered/unregistered
in HAL_FMAC_STATE_READY or HAL_FMAC_STATE_RESET state, thus registered (user)
MspInit/DeInit callbacks can be used during the Init/DeInit.
In that case first register the MspInit/MspDeInit user callbacks
using @ref HAL_FMAC_RegisterCallback() before calling @ref HAL_FMAC_DeInit()
or @ref HAL_FMAC_Init() function.
[..]
When the compilation define USE_HAL_FMAC_REGISTER_CALLBACKS is set to 0 or
not defined, the callback registration feature is not available
and weak (surcharged) callbacks are used.
@endverbatim
*
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32g4xx_hal.h"
#ifdef HAL_FMAC_MODULE_ENABLED
/** @addtogroup STM32G4xx_HAL_Driver
* @{
*/
/** @defgroup FMAC FMAC
* @brief FMAC HAL driver module
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private defines -----------------------------------------------------------*/
/** @defgroup FMAC_Private_Constants FMAC Private Constants
* @{
*/
#define MAX_FILTER_DATA_SIZE_TO_HANDLE ((uint16_t) 0xFFU)
#define MAX_PRELOAD_INDEX 0xFFU
#define PRELOAD_ACCESS_DMA 0x00U
#define PRELOAD_ACCESS_POLLING 0x01U
#define POLLING_DISABLED 0U
#define POLLING_ENABLED 1U
#define POLLING_NOT_STOPPED 0U
#define POLLING_STOPPED 1U
/* FMAC polling-based communications time-out value */
#define HAL_FMAC_TIMEOUT_VALUE 1000U
/* FMAC reset time-out value */
#define HAL_FMAC_RESET_TIMEOUT_VALUE 500U
/* DMA Read Requests Enable */
#define FMAC_DMA_REN FMAC_CR_DMAREN
/* DMA Write Channel Enable */
#define FMAC_DMA_WEN FMAC_CR_DMAWEN
/* FMAC Execution Enable */
#define FMAC_START FMAC_PARAM_START
/**
* @}
*/
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup FMAC_Private_Macros FMAC Private Macros
* @{
*/
/**
* @brief Get the X1 memory area size.
* @param __HANDLE__ FMAC handle.
* @retval X1_BUF_SIZE
*/
#define FMAC_GET_X1_SIZE(__HANDLE__) \
((((__HANDLE__)->Instance->X1BUFCFG) & (FMAC_X1BUFCFG_X1_BUF_SIZE)) >> (FMAC_X1BUFCFG_X1_BUF_SIZE_Pos))
/**
* @brief Get the X1 watermark.
* @param __HANDLE__ FMAC handle.
* @retval FULL_WM
*/
#define FMAC_GET_X1_FULL_WM(__HANDLE__) \
(((__HANDLE__)->Instance->X1BUFCFG) & (FMAC_X1BUFCFG_FULL_WM))
/**
* @brief Get the X2 memory area size.
* @param __HANDLE__ FMAC handle.
* @retval X2_BUF_SIZE
*/
#define FMAC_GET_X2_SIZE(__HANDLE__) \
((((__HANDLE__)->Instance->X2BUFCFG) & (FMAC_X2BUFCFG_X2_BUF_SIZE)) >> (FMAC_X2BUFCFG_X2_BUF_SIZE_Pos))
/**
* @brief Get the Y memory area size.
* @param __HANDLE__ FMAC handle.
* @retval Y_BUF_SIZE
*/
#define FMAC_GET_Y_SIZE(__HANDLE__) \
((((__HANDLE__)->Instance->YBUFCFG) & (FMAC_YBUFCFG_Y_BUF_SIZE)) >> (FMAC_YBUFCFG_Y_BUF_SIZE_Pos))
/**
* @brief Get the Y watermark.
* @param __HANDLE__ FMAC handle.
* @retval EMPTY_WM
*/
#define FMAC_GET_Y_EMPTY_WM(__HANDLE__) \
(((__HANDLE__)->Instance->YBUFCFG) & (FMAC_YBUFCFG_EMPTY_WM))
/**
* @brief Get the start bit state.
* @param __HANDLE__ FMAC handle.
* @retval START
*/
#define FMAC_GET_START_BIT(__HANDLE__) \
((((__HANDLE__)->Instance->PARAM) & (FMAC_PARAM_START)) >> (FMAC_PARAM_START_Pos))
/**
* @brief Get the threshold matching the watermark.
* @param __WM__ Watermark value.
* @retval THRESHOLD
*/
#define FMAC_GET_THRESHOLD_FROM_WM(__WM__) (((__WM__) == FMAC_THRESHOLD_1)? 1U: \
((__WM__) == FMAC_THRESHOLD_2)? 2U: \
((__WM__) == FMAC_THRESHOLD_4)? 4U:8U)
/**
* @}
*/
/* Private variables ---------------------------------------------------------*/
/* Global variables ----------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
static HAL_StatusTypeDef FMAC_Reset(FMAC_HandleTypeDef *hfmac);
static void FMAC_ResetDataPointers(FMAC_HandleTypeDef *hfmac);
static void FMAC_ResetOutputStateAndDataPointers(FMAC_HandleTypeDef *hfmac);
static void FMAC_ResetInputStateAndDataPointers(FMAC_HandleTypeDef *hfmac);
static HAL_StatusTypeDef FMAC_FilterConfig(FMAC_HandleTypeDef *hfmac, FMAC_FilterConfigTypeDef *pConfig,
uint8_t PreloadAccess);
static HAL_StatusTypeDef FMAC_FilterPreload(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint8_t InputSize,
int16_t *pOutput, uint8_t OutputSize, uint8_t PreloadAccess);
static void FMAC_WritePreloadDataIncrementPtr(FMAC_HandleTypeDef *hfmac, int16_t **ppData, uint8_t Size);
static HAL_StatusTypeDef FMAC_WaitOnStartUntilTimeout(FMAC_HandleTypeDef *hfmac, uint32_t Tickstart, uint32_t Timeout);
static HAL_StatusTypeDef FMAC_AppendFilterDataUpdateState(FMAC_HandleTypeDef *hfmac, int16_t *pInput,
uint16_t *pInputSize);
static HAL_StatusTypeDef FMAC_ConfigFilterOutputBufferUpdateState(FMAC_HandleTypeDef *hfmac, int16_t *pOutput,
uint16_t *pOutputSize);
static void FMAC_WriteDataIncrementPtr(FMAC_HandleTypeDef *hfmac, uint16_t MaxSizeToWrite);
static void FMAC_ReadDataIncrementPtr(FMAC_HandleTypeDef *hfmac, uint16_t MaxSizeToRead);
static void FMAC_DMAHalfGetData(DMA_HandleTypeDef *hdma);
static void FMAC_DMAGetData(DMA_HandleTypeDef *hdma);
static void FMAC_DMAHalfOutputDataReady(DMA_HandleTypeDef *hdma);
static void FMAC_DMAOutputDataReady(DMA_HandleTypeDef *hdma);
static void FMAC_DMAFilterConfig(DMA_HandleTypeDef *hdma);
static void FMAC_DMAFilterPreload(DMA_HandleTypeDef *hdma);
static void FMAC_DMAError(DMA_HandleTypeDef *hdma);
/* Functions Definition ------------------------------------------------------*/
/** @defgroup FMAC_Exported_Functions FMAC Exported Functions
* @{
*/
/** @defgroup FMAC_Exported_Functions_Group1 Initialization and de-initialization functions
* @brief Initialization and Configuration functions
*
@verbatim
===============================================================================
##### Initialization and de-initialization functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Initialize the FMAC peripheral and the associated handle
(+) DeInitialize the FMAC peripheral
(+) Initialize the FMAC MSP (MCU Specific Package)
(+) De-Initialize the FMAC MSP
(+) Register a User FMAC Callback
(+) Unregister a FMAC CallBack
[..]
@endverbatim
* @{
*/
/**
* @brief Initialize the FMAC peripheral and the associated handle.
* @param hfmac pointer to a FMAC_HandleTypeDef structure.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_Init(FMAC_HandleTypeDef *hfmac)
{
HAL_StatusTypeDef status;
/* Check the FMAC handle allocation */
if (hfmac == NULL)
{
return HAL_ERROR;
}
/* Check the instance */
assert_param(IS_FMAC_ALL_INSTANCE(hfmac->Instance));
if (hfmac->State == HAL_FMAC_STATE_RESET)
{
/* Initialize lock resource */
hfmac->Lock = HAL_UNLOCKED;
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
/* Register the default callback functions */
hfmac->ErrorCallback = HAL_FMAC_ErrorCallback;
hfmac->HalfGetDataCallback = HAL_FMAC_HalfGetDataCallback;
hfmac->GetDataCallback = HAL_FMAC_GetDataCallback;
hfmac->HalfOutputDataReadyCallback = HAL_FMAC_HalfOutputDataReadyCallback;
hfmac->OutputDataReadyCallback = HAL_FMAC_OutputDataReadyCallback;
hfmac->FilterConfigCallback = HAL_FMAC_FilterConfigCallback;
hfmac->FilterPreloadCallback = HAL_FMAC_FilterPreloadCallback;
if (hfmac->MspInitCallback == NULL)
{
hfmac->MspInitCallback = HAL_FMAC_MspInit;
}
/* Init the low level hardware */
hfmac->MspInitCallback(hfmac);
#else
/* Init the low level hardware */
HAL_FMAC_MspInit(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/* Reset pInput and pOutput */
hfmac->FilterParam = 0U;
FMAC_ResetDataPointers(hfmac);
/* Reset FMAC unit (internal pointers) */
if (FMAC_Reset(hfmac) == HAL_TIMEOUT)
{
/* Update FMAC error code and FMAC peripheral state */
hfmac->ErrorCode |= HAL_FMAC_ERROR_RESET;
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
status = HAL_TIMEOUT;
}
else
{
/* Update FMAC error code and FMAC peripheral state */
hfmac->ErrorCode = HAL_FMAC_ERROR_NONE;
hfmac->State = HAL_FMAC_STATE_READY;
status = HAL_OK;
}
__HAL_UNLOCK(hfmac);
return status;
}
/**
* @brief De-initialize the FMAC peripheral.
* @param hfmac pointer to a FMAC structure.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_DeInit(FMAC_HandleTypeDef *hfmac)
{
/* Check the FMAC handle allocation */
if (hfmac == NULL)
{
return HAL_ERROR;
}
/* Check the parameters */
assert_param(IS_FMAC_ALL_INSTANCE(hfmac->Instance));
/* Change FMAC peripheral state */
hfmac->State = HAL_FMAC_STATE_BUSY;
/* Set FMAC error code to none */
hfmac->ErrorCode = HAL_FMAC_ERROR_NONE;
/* Reset pInput and pOutput */
hfmac->FilterParam = 0U;
FMAC_ResetDataPointers(hfmac);
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
if (hfmac->MspDeInitCallback == NULL)
{
hfmac->MspDeInitCallback = HAL_FMAC_MspDeInit;
}
/* DeInit the low level hardware */
hfmac->MspDeInitCallback(hfmac);
#else
/* DeInit the low level hardware: CLOCK, NVIC, DMA */
HAL_FMAC_MspDeInit(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
/* Change FMAC peripheral state */
hfmac->State = HAL_FMAC_STATE_RESET;
/* Always release Lock in case of de-initialization */
__HAL_UNLOCK(hfmac);
return HAL_OK;
}
/**
* @brief Initialize the FMAC MSP.
* @param hfmac FMAC handle.
* @retval None
*/
__weak void HAL_FMAC_MspInit(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_FMAC_MspInit can be implemented in the user file
*/
}
/**
* @brief De-initialize the FMAC MSP.
* @param hfmac FMAC handle.
* @retval None
*/
__weak void HAL_FMAC_MspDeInit(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_FMAC_MspDeInit can be implemented in the user file
*/
}
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
/**
* @brief Register a User FMAC Callback.
* @note The User FMAC Callback is to be used instead of the weak predefined callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param CallbackID ID of the callback to be registered.
* This parameter can be one of the following values:
* @arg @ref HAL_FMAC_ERROR_CB_ID Error Callback ID
* @arg @ref HAL_FMAC_HALF_GET_DATA_CB_ID Get Half Data Callback ID
* @arg @ref HAL_FMAC_GET_DATA_CB_ID Get Data Callback ID
* @arg @ref HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID Half Output Data Ready Callback ID
* @arg @ref HAL_FMAC_OUTPUT_DATA_READY_CB_ID Output Data Ready Callback ID
* @arg @ref HAL_FMAC_FILTER_CONFIG_CB_ID Filter Configuration Callback ID
* @arg @ref HAL_FMAC_FILTER_PRELOAD_CB_ID Filter Preload Callback ID
* @arg @ref HAL_FMAC_MSPINIT_CB_ID FMAC MspInit ID
* @arg @ref HAL_FMAC_MSPDEINIT_CB_ID FMAC MspDeInit ID
* @param pCallback pointer to the Callback function.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_RegisterCallback(FMAC_HandleTypeDef *hfmac, HAL_FMAC_CallbackIDTypeDef CallbackID,
pFMAC_CallbackTypeDef pCallback)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check the FMAC handle allocation */
if (hfmac == NULL)
{
return HAL_ERROR;
}
if (pCallback == NULL)
{
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
return HAL_ERROR;
}
__HAL_LOCK(hfmac);
if (hfmac->State == HAL_FMAC_STATE_READY)
{
switch (CallbackID)
{
case HAL_FMAC_ERROR_CB_ID :
hfmac->ErrorCallback = pCallback;
break;
case HAL_FMAC_HALF_GET_DATA_CB_ID :
hfmac->HalfGetDataCallback = pCallback;
break;
case HAL_FMAC_GET_DATA_CB_ID :
hfmac->GetDataCallback = pCallback;
break;
case HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID :
hfmac->HalfOutputDataReadyCallback = pCallback;
break;
case HAL_FMAC_OUTPUT_DATA_READY_CB_ID :
hfmac->OutputDataReadyCallback = pCallback;
break;
case HAL_FMAC_FILTER_CONFIG_CB_ID :
hfmac->FilterConfigCallback = pCallback;
break;
case HAL_FMAC_FILTER_PRELOAD_CB_ID :
hfmac->FilterPreloadCallback = pCallback;
break;
case HAL_FMAC_MSPINIT_CB_ID :
hfmac->MspInitCallback = pCallback;
break;
case HAL_FMAC_MSPDEINIT_CB_ID :
hfmac->MspDeInitCallback = pCallback;
break;
default :
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
/* Return error status */
status = HAL_ERROR;
break;
}
}
else if (hfmac->State == HAL_FMAC_STATE_RESET)
{
switch (CallbackID)
{
case HAL_FMAC_MSPINIT_CB_ID :
hfmac->MspInitCallback = pCallback;
break;
case HAL_FMAC_MSPDEINIT_CB_ID :
hfmac->MspDeInitCallback = pCallback;
break;
default :
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
/* Return error status */
status = HAL_ERROR;
break;
}
}
else
{
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
/* Return error status */
status = HAL_ERROR;
}
__HAL_UNLOCK(hfmac);
return status;
}
/**
* @brief Unregister a FMAC CallBack.
* @note The FMAC callback is redirected to the weak predefined callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module
* @param CallbackID ID of the callback to be unregistered.
* This parameter can be one of the following values:
* @arg @ref HAL_FMAC_ERROR_CB_ID Error Callback ID
* @arg @ref HAL_FMAC_HALF_GET_DATA_CB_ID Get Half Data Callback ID
* @arg @ref HAL_FMAC_GET_DATA_CB_ID Get Data Callback ID
* @arg @ref HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID Half Output Data Ready Callback ID
* @arg @ref HAL_FMAC_OUTPUT_DATA_READY_CB_ID Output Data Ready Callback ID
* @arg @ref HAL_FMAC_FILTER_CONFIG_CB_ID Filter Configuration Callback ID
* @arg @ref HAL_FMAC_FILTER_PRELOAD_CB_ID Filter Preload Callback ID
* @arg @ref HAL_FMAC_MSPINIT_CB_ID FMAC MspInit ID
* @arg @ref HAL_FMAC_MSPDEINIT_CB_ID FMAC MspDeInit ID
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_UnRegisterCallback(FMAC_HandleTypeDef *hfmac, HAL_FMAC_CallbackIDTypeDef CallbackID)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check the FMAC handle allocation */
if (hfmac == NULL)
{
return HAL_ERROR;
}
__HAL_LOCK(hfmac);
if (hfmac->State == HAL_FMAC_STATE_READY)
{
switch (CallbackID)
{
case HAL_FMAC_ERROR_CB_ID :
hfmac->ErrorCallback = HAL_FMAC_ErrorCallback; /* Legacy weak ErrorCallback */
break;
case HAL_FMAC_HALF_GET_DATA_CB_ID :
hfmac->HalfGetDataCallback = HAL_FMAC_HalfGetDataCallback; /* Legacy weak HalfGetDataCallback */
break;
case HAL_FMAC_GET_DATA_CB_ID :
hfmac->GetDataCallback = HAL_FMAC_GetDataCallback; /* Legacy weak GetDataCallback */
break;
case HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID :
hfmac->HalfOutputDataReadyCallback = HAL_FMAC_HalfOutputDataReadyCallback; /* Legacy weak HalfOutputDataReadyCallback */
break;
case HAL_FMAC_OUTPUT_DATA_READY_CB_ID :
hfmac->OutputDataReadyCallback = HAL_FMAC_OutputDataReadyCallback; /* Legacy weak OutputDataReadyCallback */
break;
case HAL_FMAC_FILTER_CONFIG_CB_ID :
hfmac->FilterConfigCallback = HAL_FMAC_FilterConfigCallback; /* Legacy weak FilterConfigCallback */
break;
case HAL_FMAC_FILTER_PRELOAD_CB_ID :
hfmac->FilterPreloadCallback = HAL_FMAC_FilterPreloadCallback; /* Legacy weak FilterPreloadCallback */
break;
case HAL_FMAC_MSPINIT_CB_ID :
hfmac->MspInitCallback = HAL_FMAC_MspInit; /* Legacy weak MspInitCallback */
break;
case HAL_FMAC_MSPDEINIT_CB_ID :
hfmac->MspDeInitCallback = HAL_FMAC_MspDeInit; /* Legacy weak MspDeInitCallback */
break;
default :
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
/* Return error status */
status = HAL_ERROR;
break;
}
}
else if (hfmac->State == HAL_FMAC_STATE_RESET)
{
switch (CallbackID)
{
case HAL_FMAC_MSPINIT_CB_ID :
hfmac->MspInitCallback = HAL_FMAC_MspInit;
break;
case HAL_FMAC_MSPDEINIT_CB_ID :
hfmac->MspDeInitCallback = HAL_FMAC_MspDeInit;
break;
default :
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
/* Return error status */
status = HAL_ERROR;
break;
}
}
else
{
/* Update the error code */
hfmac->ErrorCode |= HAL_FMAC_ERROR_INVALID_CALLBACK;
/* Return error status */
status = HAL_ERROR;
}
__HAL_UNLOCK(hfmac);
return status;
}
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
/**
* @}
*/
/** @defgroup FMAC_Exported_Functions_Group2 Peripheral Control functions
* @brief Control functions.
*
@verbatim
==============================================================================
##### Peripheral Control functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Configure the FMAC peripheral: memory area, filter type and parameters,
way to access to the input and output memory area (none, polling, IT, DMA).
(+) Start the FMAC processing (filter).
(+) Handle the input data that will be provided into FMAC.
(+) Handle the output data provided by FMAC.
(+) Stop the FMAC processing (filter).
@endverbatim
* @{
*/
/**
* @brief Configure the FMAC filter.
* @note The configuration is done according to the parameters
* specified in the FMAC_FilterConfigTypeDef structure.
* The provided data will be loaded using polling mode.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pConfig pointer to a FMAC_FilterConfigTypeDef structure that
* contains the FMAC configuration information.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_FilterConfig(FMAC_HandleTypeDef *hfmac, FMAC_FilterConfigTypeDef *pConfig)
{
return (FMAC_FilterConfig(hfmac, pConfig, PRELOAD_ACCESS_POLLING));
}
/**
* @brief Configure the FMAC filter.
* @note The configuration is done according to the parameters
* specified in the FMAC_FilterConfigTypeDef structure.
* The provided data will be loaded using DMA.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pConfig pointer to a FMAC_FilterConfigTypeDef structure that
* contains the FMAC configuration information.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_FilterConfig_DMA(FMAC_HandleTypeDef *hfmac, FMAC_FilterConfigTypeDef *pConfig)
{
return (FMAC_FilterConfig(hfmac, pConfig, PRELOAD_ACCESS_DMA));
}
/**
* @brief Preload the input (FIR, IIR) and output data (IIR) of the FMAC filter.
* @note The set(s) of data will be used by FMAC as soon as @ref HAL_FMAC_FilterStart is called.
* The provided data will be loaded using polling mode.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pInput Preloading of the first elements of the input buffer (X1).
* If not needed (no data available when starting), it should be set to NULL.
* @param InputSize Size of the input vector.
* As pInput is used for preloading data, it cannot be bigger than the input memory area.
* @param pOutput [IIR] Preloading of the first elements of the output vector (Y).
* If not needed, it should be set to NULL.
* @param OutputSize Size of the output vector.
* As pOutput is used for preloading data, it cannot be bigger than the output memory area.
* @note The input and the output buffers can be filled by calling several times @ref HAL_FMAC_FilterPreload
* (each call filling partly the buffers). In case of overflow (too much data provided through
* all these calls), an error will be returned.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_FilterPreload(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint8_t InputSize,
int16_t *pOutput, uint8_t OutputSize)
{
return (FMAC_FilterPreload(hfmac, pInput, InputSize, pOutput, OutputSize, PRELOAD_ACCESS_POLLING));
}
/**
* @brief Preload the input (FIR, IIR) and output data (IIR) of the FMAC filter.
* @note The set(s) of data will be used by FMAC as soon as @ref HAL_FMAC_FilterStart is called.
* The provided data will be loaded using DMA.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pInput Preloading of the first elements of the input buffer (X1).
* If not needed (no data available when starting), it should be set to NULL.
* @param InputSize Size of the input vector.
* As pInput is used for preloading data, it cannot be bigger than the input memory area.
* @param pOutput [IIR] Preloading of the first elements of the output vector (Y).
* If not needed, it should be set to NULL.
* @param OutputSize Size of the output vector.
* As pOutput is used for preloading data, it cannot be bigger than the output memory area.
* @note The input and the output buffers can be filled by calling several times @ref HAL_FMAC_FilterPreload
* (each call filling partly the buffers). In case of overflow (too much data provided through
* all these calls), an error will be returned.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_FilterPreload_DMA(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint8_t InputSize,
int16_t *pOutput, uint8_t OutputSize)
{
return (FMAC_FilterPreload(hfmac, pInput, InputSize, pOutput, OutputSize, PRELOAD_ACCESS_DMA));
}
/**
* @brief Start the FMAC processing according to the existing FMAC configuration.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pOutput pointer to buffer where output data of FMAC processing will be stored
* in the next steps.
* If it is set to NULL, the output will not be read and it will be up to
* an external IP to empty the output buffer.
* @param pOutputSize pointer to the size of the output buffer. The number of read data will be written here.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_FilterStart(FMAC_HandleTypeDef *hfmac, int16_t *pOutput, uint16_t *pOutputSize)
{
uint32_t tmpcr = 0U;
HAL_StatusTypeDef status;
/* Check the START bit state */
if (FMAC_GET_START_BIT(hfmac) != 0U)
{
return HAL_ERROR;
}
/* Check that a valid configuration was done previously */
if (hfmac->FilterParam == 0U)
{
return HAL_ERROR;
}
/* Check handle state is ready */
if (hfmac->State == HAL_FMAC_STATE_READY)
{
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_BUSY;
/* CR: Configure the input access (error interruptions enabled only for IT or DMA) */
if (hfmac->InputAccess == FMAC_BUFFER_ACCESS_DMA)
{
tmpcr |= FMAC_DMA_WEN;
}
else if (hfmac->InputAccess == FMAC_BUFFER_ACCESS_IT)
{
tmpcr |= FMAC_IT_WIEN;
}
else
{
/* nothing to do */
}
/* CR: Configure the output access (error interruptions enabled only for IT or DMA) */
if (hfmac->OutputAccess == FMAC_BUFFER_ACCESS_DMA)
{
tmpcr |= FMAC_DMA_REN;
}
else if (hfmac->OutputAccess == FMAC_BUFFER_ACCESS_IT)
{
tmpcr |= FMAC_IT_RIEN;
}
else
{
/* nothing to do */
}
/* CR: Write the configuration */
MODIFY_REG(hfmac->Instance->CR, \
FMAC_IT_RIEN | FMAC_IT_WIEN | FMAC_DMA_REN | FMAC_CR_DMAWEN, \
tmpcr);
/* Register the new output buffer */
status = FMAC_ConfigFilterOutputBufferUpdateState(hfmac, pOutput, pOutputSize);
if (status == HAL_OK)
{
/* PARAM: Start the filter ( this can generate interrupts before the end of the HAL_FMAC_FilterStart ) */
WRITE_REG(hfmac->Instance->PARAM, (uint32_t)(hfmac->FilterParam));
}
/* Reset the busy flag (do not overwrite the possible write and read flag) */
hfmac->State = HAL_FMAC_STATE_READY;
}
else
{
status = HAL_BUSY;
}
return status;
}
/**
* @brief Provide a new input buffer that will be loaded into the FMAC input memory area.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pInput New input vector (additional input data).
* @param pInputSize Size of the input vector (if all the data can't be
* written, it will be updated with the number of data read from FMAC).
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_AppendFilterData(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint16_t *pInputSize)
{
HAL_StatusTypeDef status;
/* Check the function parameters */
if ((pInput == NULL) || (pInputSize == NULL))
{
return HAL_ERROR;
}
if (*pInputSize == 0U)
{
return HAL_ERROR;
}
/* Check the START bit state */
if (FMAC_GET_START_BIT(hfmac) == 0U)
{
return HAL_ERROR;
}
/* Check the FMAC configuration */
if (hfmac->InputAccess == FMAC_BUFFER_ACCESS_NONE)
{
return HAL_ERROR;
}
/* Check whether the previous input vector has been handled */
if ((hfmac->pInputSize != NULL) && (hfmac->InputCurrentSize < * (hfmac->pInputSize)))
{
return HAL_BUSY;
}
/* Check that FMAC was initialized and that no writing is already ongoing */
if (hfmac->WrState == HAL_FMAC_STATE_READY)
{
/* Register the new input buffer */
status = FMAC_AppendFilterDataUpdateState(hfmac, pInput, pInputSize);
}
else
{
status = HAL_BUSY;
}
return status;
}
/**
* @brief Provide a new output buffer to be filled with the data computed by FMAC unit.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pOutput New output vector.
* @param pOutputSize Size of the output vector (if the vector can't
* be entirely filled, pOutputSize will be updated with the number
* of data read from FMAC).
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_ConfigFilterOutputBuffer(FMAC_HandleTypeDef *hfmac, int16_t *pOutput, uint16_t *pOutputSize)
{
HAL_StatusTypeDef status;
/* Check the function parameters */
if ((pOutput == NULL) || (pOutputSize == NULL))
{
return HAL_ERROR;
}
if (*pOutputSize == 0U)
{
return HAL_ERROR;
}
/* Check the START bit state */
if (FMAC_GET_START_BIT(hfmac) == 0U)
{
return HAL_ERROR;
}
/* Check the FMAC configuration */
if (hfmac->OutputAccess == FMAC_BUFFER_ACCESS_NONE)
{
return HAL_ERROR;
}
/* Check whether the previous output vector has been handled */
if ((hfmac->pOutputSize != NULL) && (hfmac->OutputCurrentSize < * (hfmac->pOutputSize)))
{
return HAL_BUSY;
}
/* Check that FMAC was initialized and that not reading is already ongoing */
if (hfmac->RdState == HAL_FMAC_STATE_READY)
{
/* Register the new output buffer */
status = FMAC_ConfigFilterOutputBufferUpdateState(hfmac, pOutput, pOutputSize);
}
else
{
status = HAL_BUSY;
}
return status;
}
/**
* @brief Handle the input and/or output data in polling mode
* @note This function writes the previously provided user's input data and
* fills the previously provided user's output buffer,
* according to the existing FMAC configuration (polling mode only).
* The function returns when the input data has been handled or
* when the output data is filled. The possible unused data isn't
* kept. It will be up to the user to handle it. The previously
* provided pInputSize and pOutputSize will be used to indicate to the
* size of the read/written data to the user.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param Timeout timeout value.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_PollFilterData(FMAC_HandleTypeDef *hfmac, uint32_t Timeout)
{
uint32_t tickstart;
uint8_t inpolling;
uint8_t inpollingover = POLLING_NOT_STOPPED;
uint8_t outpolling;
uint8_t outpollingover = POLLING_NOT_STOPPED;
HAL_StatusTypeDef status;
/* Check the START bit state */
if (FMAC_GET_START_BIT(hfmac) == 0U)
{
return HAL_ERROR;
}
/* Check the configuration */
/* Get the input and output mode (if no buffer was previously provided, nothing will be read/written) */
if ((hfmac->InputAccess == FMAC_BUFFER_ACCESS_POLLING) && (hfmac->pInput != NULL))
{
inpolling = POLLING_ENABLED;
}
else
{
inpolling = POLLING_DISABLED;
}
if ((hfmac->OutputAccess == FMAC_BUFFER_ACCESS_POLLING) && (hfmac->pOutput != NULL))
{
outpolling = POLLING_ENABLED;
}
else
{
outpolling = POLLING_DISABLED;
}
/* Check the configuration */
if ((inpolling == POLLING_DISABLED) && (outpolling == POLLING_DISABLED))
{
return HAL_ERROR;
}
/* Check handle state is ready */
if (hfmac->State == HAL_FMAC_STATE_READY)
{
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_BUSY;
/* Get tick */
tickstart = HAL_GetTick();
/* Loop on reading and writing until timeout */
while ((HAL_GetTick() - tickstart) < Timeout)
{
/* X1: Check the mode: polling or none */
if (inpolling != POLLING_DISABLED)
{
FMAC_WriteDataIncrementPtr(hfmac, MAX_FILTER_DATA_SIZE_TO_HANDLE);
if (hfmac->InputCurrentSize == *(hfmac->pInputSize))
{
inpollingover = POLLING_STOPPED;
}
}
/* Y: Check the mode: polling or none */
if (outpolling != POLLING_DISABLED)
{
FMAC_ReadDataIncrementPtr(hfmac, MAX_FILTER_DATA_SIZE_TO_HANDLE);
if (hfmac->OutputCurrentSize == *(hfmac->pOutputSize))
{
outpollingover = POLLING_STOPPED;
}
}
/* Exit if there isn't data to handle anymore on one side or another */
if ((inpollingover != POLLING_NOT_STOPPED) || (outpollingover != POLLING_NOT_STOPPED))
{
break;
}
}
/* Change the FMAC state; update the input and output sizes; reset the indexes */
if (inpolling != POLLING_DISABLED)
{
(*(hfmac->pInputSize)) = hfmac->InputCurrentSize;
FMAC_ResetInputStateAndDataPointers(hfmac);
}
if (outpolling != POLLING_DISABLED)
{
(*(hfmac->pOutputSize)) = hfmac->OutputCurrentSize;
FMAC_ResetOutputStateAndDataPointers(hfmac);
}
/* Reset the busy flag (do not overwrite the possible write and read flag) */
hfmac->State = HAL_FMAC_STATE_READY;
if ((HAL_GetTick() - tickstart) >= Timeout)
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
status = HAL_TIMEOUT;
}
else
{
status = HAL_OK;
}
}
else
{
status = HAL_BUSY;
}
return status;
}
/**
* @brief Stop the FMAC processing.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval HAL_StatusTypeDef HAL status
*/
HAL_StatusTypeDef HAL_FMAC_FilterStop(FMAC_HandleTypeDef *hfmac)
{
HAL_StatusTypeDef status;
/* Check handle state is ready */
if (hfmac->State == HAL_FMAC_STATE_READY)
{
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_BUSY;
/* Set the START bit to 0 (stop the previously configured filter) */
CLEAR_BIT(hfmac->Instance->PARAM, FMAC_PARAM_START);
/* Disable the interrupts in order to avoid crossing cases */
CLEAR_BIT(hfmac->Instance->CR, FMAC_DMA_REN | FMAC_DMA_WEN | FMAC_IT_RIEN | FMAC_IT_WIEN);
/* In case of IT, update the sizes */
if ((hfmac->InputAccess == FMAC_BUFFER_ACCESS_IT) && (hfmac->pInput != NULL))
{
(*(hfmac->pInputSize)) = hfmac->InputCurrentSize;
}
if ((hfmac->OutputAccess == FMAC_BUFFER_ACCESS_IT) && (hfmac->pOutput != NULL))
{
(*(hfmac->pOutputSize)) = hfmac->OutputCurrentSize;
}
/* Reset FMAC unit (internal pointers) */
if (FMAC_Reset(hfmac) == HAL_TIMEOUT)
{
/* Update FMAC error code and FMAC peripheral state */
hfmac->ErrorCode = HAL_FMAC_ERROR_RESET;
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
status = HAL_TIMEOUT;
}
else
{
/* Reset the data pointers */
FMAC_ResetDataPointers(hfmac);
status = HAL_OK;
}
/* Reset the busy flag */
hfmac->State = HAL_FMAC_STATE_READY;
}
else
{
status = HAL_BUSY;
}
return status;
}
/**
* @}
*/
/** @defgroup FMAC_Exported_Functions_Group3 Callback functions
* @brief Callback functions.
*
@verbatim
==============================================================================
##### Callback functions #####
==============================================================================
[..] This section provides Interruption and DMA callback functions:
(+) DMA or Interrupt: the user's input data is half written (DMA only)
or completely written.
(+) DMA or Interrupt: the user's output buffer is half filled (DMA only)
or completely filled.
(+) DMA or Interrupt: error handling.
@endverbatim
* @{
*/
/**
* @brief FMAC error callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_ErrorCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_ErrorCallback can be implemented in the user file.
*/
}
/**
* @brief FMAC get half data callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_HalfGetDataCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_HalfGetDataCallback can be implemented in the user file.
*/
}
/**
* @brief FMAC get data callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_GetDataCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_GetDataCallback can be implemented in the user file.
*/
}
/**
* @brief FMAC half output data ready callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_HalfOutputDataReadyCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_HalfOutputDataReadyCallback can be implemented in the user file.
*/
}
/**
* @brief FMAC output data ready callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_OutputDataReadyCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_OutputDataReadyCallback can be implemented in the user file.
*/
}
/**
* @brief FMAC filter configuration callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_FilterConfigCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_FilterConfigCallback can be implemented in the user file.
*/
}
/**
* @brief FMAC filter preload callback.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
__weak void HAL_FMAC_FilterPreloadCallback(FMAC_HandleTypeDef *hfmac)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hfmac);
/* NOTE : This function should not be modified; when the callback is needed,
the HAL_FMAC_FilterPreloadCallback can be implemented in the user file.
*/
}
/**
* @}
*/
/** @defgroup FMAC_Exported_Functions_Group4 IRQ handler management
* @brief IRQ handler.
*
@verbatim
==============================================================================
##### IRQ handler management #####
==============================================================================
[..] This section provides IRQ handler function.
@endverbatim
* @{
*/
/**
* @brief Handle FMAC interrupt request.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval None
*/
void HAL_FMAC_IRQHandler(FMAC_HandleTypeDef *hfmac)
{
uint32_t itsource;
/* Check if the read interrupt is enabled and if Y buffer empty flag isn't set */
itsource = __HAL_FMAC_GET_IT_SOURCE(hfmac, FMAC_IT_RIEN);
if ((__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_YEMPTY) == 0U) && (itsource != 0U))
{
/* Read some data if possible (Y size is used as a pseudo timeout in order
to not get stuck too long under IT if FMAC keeps on processing input
data reloaded via DMA for instance). */
if (hfmac->pOutput != NULL)
{
FMAC_ReadDataIncrementPtr(hfmac, (uint16_t)FMAC_GET_Y_SIZE(hfmac));
}
/* Indicate that data is ready to be read */
if ((hfmac->pOutput == NULL) || (hfmac->OutputCurrentSize == *(hfmac->pOutputSize)))
{
/* Reset the pointers to indicate new data will be needed */
FMAC_ResetOutputStateAndDataPointers(hfmac);
/* Call the output data ready callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->OutputDataReadyCallback(hfmac);
#else
HAL_FMAC_OutputDataReadyCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
}
/* Check if the write interrupt is enabled and if X1 buffer full flag isn't set */
itsource = __HAL_FMAC_GET_IT_SOURCE(hfmac, FMAC_IT_WIEN);
if ((__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_X1FULL) == 0U) && (itsource != 0U))
{
/* Write some data if possible (X1 size is used as a pseudo timeout in order
to not get stuck too long under IT if FMAC keep on processing input
data whereas its output emptied via DMA for instance). */
if (hfmac->pInput != NULL)
{
FMAC_WriteDataIncrementPtr(hfmac, (uint16_t)FMAC_GET_X1_SIZE(hfmac));
}
/* Indicate that new data will be needed */
if ((hfmac->pInput == NULL) || (hfmac->InputCurrentSize == *(hfmac->pInputSize)))
{
/* Reset the pointers to indicate new data will be needed */
FMAC_ResetInputStateAndDataPointers(hfmac);
/* Call the get data callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->GetDataCallback(hfmac);
#else
HAL_FMAC_GetDataCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
}
/* Check if the overflow error interrupt is enabled and if overflow error flag is raised */
itsource = __HAL_FMAC_GET_IT_SOURCE(hfmac, FMAC_IT_OVFLIEN);
if ((__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_OVFL) != 0U) && (itsource != 0U))
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_OVFL;
}
/* Check if the underflow error interrupt is enabled and if underflow error flag is raised */
itsource = __HAL_FMAC_GET_IT_SOURCE(hfmac, FMAC_IT_UNFLIEN);
if ((__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_UNFL) != 0U) && (itsource != 0U))
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_UNFL;
}
/* Check if the saturation error interrupt is enabled and if saturation error flag is raised */
itsource = __HAL_FMAC_GET_IT_SOURCE(hfmac, FMAC_IT_SATIEN);
if ((__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_SAT) != 0U) && (itsource != 0U))
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_SAT;
}
/* Call the error callback if an error occurred */
if (hfmac->ErrorCode != HAL_FMAC_ERROR_NONE)
{
/* Call the error callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->ErrorCallback(hfmac);
#else
HAL_FMAC_ErrorCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
}
/**
* @}
*/
/** @defgroup FMAC_Exported_Functions_Group5 Peripheral State and Error functions
* @brief Peripheral State and Error functions.
*
@verbatim
==============================================================================
##### Peripheral State and Error functions #####
==============================================================================
[..] This subsection provides functions allowing to
(+) Check the FMAC state
(+) Get error code
@endverbatim
* @{
*/
/**
* @brief Return the FMAC state.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @retval HAL_FMAC_StateTypeDef FMAC state
*/
HAL_FMAC_StateTypeDef HAL_FMAC_GetState(FMAC_HandleTypeDef *hfmac)
{
/* Return FMAC state */
return hfmac->State;
}
/**
* @brief Return the FMAC peripheral error.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @note The returned error is a bit-map combination of possible errors.
* @retval uint32_t Error bit-map based on @ref FMAC_Error_Code
*/
uint32_t HAL_FMAC_GetError(FMAC_HandleTypeDef *hfmac)
{
/* Return FMAC error code */
return hfmac->ErrorCode;
}
/**
* @}
*/
/**
* @}
*/
/** @defgroup FMAC_Private_Functions FMAC Private Functions
* @{
*/
/**
==============================================================================
##### FMAC Private Functions #####
==============================================================================
*/
/**
* @brief Perform a reset of the FMAC unit.
* @param hfmac FMAC handle.
* @retval HAL_StatusTypeDef HAL status
*/
static HAL_StatusTypeDef FMAC_Reset(FMAC_HandleTypeDef *hfmac)
{
uint32_t tickstart;
/* Init tickstart for timeout management*/
tickstart = HAL_GetTick();
/* Perform the reset */
SET_BIT(hfmac->Instance->CR, FMAC_CR_RESET);
/* Wait until flag is reset */
while (READ_BIT(hfmac->Instance->CR, FMAC_CR_RESET) != 0U)
{
if ((HAL_GetTick() - tickstart) > HAL_FMAC_RESET_TIMEOUT_VALUE)
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
return HAL_TIMEOUT;
}
}
hfmac->ErrorCode = HAL_FMAC_ERROR_NONE;
return HAL_OK;
}
/**
* @brief Reset the data pointers of the FMAC unit.
* @param hfmac FMAC handle.
* @retval None
*/
static void FMAC_ResetDataPointers(FMAC_HandleTypeDef *hfmac)
{
FMAC_ResetInputStateAndDataPointers(hfmac);
FMAC_ResetOutputStateAndDataPointers(hfmac);
}
/**
* @brief Reset the input data pointers of the FMAC unit.
* @param hfmac FMAC handle.
* @retval None
*/
static void FMAC_ResetInputStateAndDataPointers(FMAC_HandleTypeDef *hfmac)
{
hfmac->pInput = NULL;
hfmac->pInputSize = NULL;
hfmac->InputCurrentSize = 0U;
hfmac->WrState = HAL_FMAC_STATE_READY;
}
/**
* @brief Reset the output data pointers of the FMAC unit.
* @param hfmac FMAC handle.
* @retval None
*/
static void FMAC_ResetOutputStateAndDataPointers(FMAC_HandleTypeDef *hfmac)
{
hfmac->pOutput = NULL;
hfmac->pOutputSize = NULL;
hfmac->OutputCurrentSize = 0U;
hfmac->RdState = HAL_FMAC_STATE_READY;
}
/**
* @brief Configure the FMAC filter.
* @note The configuration is done according to the parameters
* specified in the FMAC_FilterConfigTypeDef structure.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pConfig pointer to a FMAC_FilterConfigTypeDef structure that
* contains the FMAC configuration information.
* @param PreloadAccess access mode used for the preload (polling or DMA).
* @retval HAL_StatusTypeDef HAL status
*/
static HAL_StatusTypeDef FMAC_FilterConfig(FMAC_HandleTypeDef *hfmac, FMAC_FilterConfigTypeDef *pConfig,
uint8_t PreloadAccess)
{
uint32_t tickstart;
uint32_t tmpcr;
#if defined(USE_FULL_ASSERT)
uint32_t x2size;
#endif /* USE_FULL_ASSERT */
/* Check the parameters */
assert_param(IS_FMAC_THRESHOLD(pConfig->InputThreshold));
assert_param(IS_FMAC_THRESHOLD(pConfig->OutputThreshold));
assert_param(IS_FMAC_BUFFER_ACCESS(pConfig->InputAccess));
assert_param(IS_FMAC_BUFFER_ACCESS(pConfig->OutputAccess));
assert_param(IS_FMAC_CLIP_STATE(pConfig->Clip));
assert_param(IS_FMAC_FILTER_FUNCTION(pConfig->Filter));
assert_param(IS_FMAC_PARAM_P(pConfig->Filter, pConfig->P));
assert_param(IS_FMAC_PARAM_Q(pConfig->Filter, pConfig->Q));
assert_param(IS_FMAC_PARAM_R(pConfig->Filter, pConfig->R));
/* Check the START bit state */
if (FMAC_GET_START_BIT(hfmac) != 0U)
{
return HAL_ERROR;
}
/* Check handle state is ready */
if (hfmac->State != HAL_FMAC_STATE_READY)
{
return HAL_BUSY;
}
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_BUSY;
/* Get tick */
tickstart = HAL_GetTick();
/* Indicate that there is no valid configuration done */
hfmac->FilterParam = 0U;
/* FMAC_X1BUFCFG: Configure the input buffer within the internal memory if required */
if (pConfig->InputBufferSize != 0U)
{
MODIFY_REG(hfmac->Instance->X1BUFCFG, \
(FMAC_X1BUFCFG_X1_BASE | FMAC_X1BUFCFG_X1_BUF_SIZE), \
(((((uint32_t)(pConfig->InputBaseAddress)) << FMAC_X1BUFCFG_X1_BASE_Pos) & FMAC_X1BUFCFG_X1_BASE) | \
((((uint32_t)(pConfig->InputBufferSize)) << FMAC_X1BUFCFG_X1_BUF_SIZE_Pos) & FMAC_X1BUFCFG_X1_BUF_SIZE)));
}
/* FMAC_X1BUFCFG: Configure the input threshold if valid when compared to the configured X1 size */
if (pConfig->InputThreshold != FMAC_THRESHOLD_NO_VALUE)
{
/* Check the parameter */
assert_param(IS_FMAC_THRESHOLD_APPLICABLE(FMAC_GET_X1_SIZE(hfmac), pConfig->InputThreshold, pConfig->InputAccess));
MODIFY_REG(hfmac->Instance->X1BUFCFG, \
FMAC_X1BUFCFG_FULL_WM, \
((pConfig->InputThreshold) & FMAC_X1BUFCFG_FULL_WM));
}
/* FMAC_X2BUFCFG: Configure the coefficient buffer within the internal memory */
if (pConfig->CoeffBufferSize != 0U)
{
MODIFY_REG(hfmac->Instance->X2BUFCFG, \
(FMAC_X2BUFCFG_X2_BASE | FMAC_X2BUFCFG_X2_BUF_SIZE), \
(((((uint32_t)(pConfig->CoeffBaseAddress)) << FMAC_X2BUFCFG_X2_BASE_Pos) & FMAC_X2BUFCFG_X2_BASE) | \
((((uint32_t)(pConfig->CoeffBufferSize)) << FMAC_X2BUFCFG_X2_BUF_SIZE_Pos) & FMAC_X2BUFCFG_X2_BUF_SIZE)));
}
/* FMAC_YBUFCFG: Configure the output buffer within the internal memory if required */
if (pConfig->OutputBufferSize != 0U)
{
MODIFY_REG(hfmac->Instance->YBUFCFG, \
(FMAC_YBUFCFG_Y_BASE | FMAC_YBUFCFG_Y_BUF_SIZE), \
(((((uint32_t)(pConfig->OutputBaseAddress)) << FMAC_YBUFCFG_Y_BASE_Pos) & FMAC_YBUFCFG_Y_BASE) | \
((((uint32_t)(pConfig->OutputBufferSize)) << FMAC_YBUFCFG_Y_BUF_SIZE_Pos) & FMAC_YBUFCFG_Y_BUF_SIZE)));
}
/* FMAC_YBUFCFG: Configure the output threshold if valid when compared to the configured Y size */
if (pConfig->OutputThreshold != FMAC_THRESHOLD_NO_VALUE)
{
/* Check the parameter */
assert_param(IS_FMAC_THRESHOLD_APPLICABLE(FMAC_GET_Y_SIZE(hfmac), pConfig->OutputThreshold, pConfig->OutputAccess));
MODIFY_REG(hfmac->Instance->YBUFCFG, \
FMAC_YBUFCFG_EMPTY_WM, \
((pConfig->OutputThreshold) & FMAC_YBUFCFG_EMPTY_WM));
}
/* FMAC_CR: Configure the clip feature */
tmpcr = pConfig->Clip & FMAC_CR_CLIPEN;
/* FMAC_CR: If IT or DMA will be used, enable error interrupts.
* Being more a debugging feature, FMAC_CR_SATIEN isn't enabled by default. */
if ((pConfig->InputAccess == FMAC_BUFFER_ACCESS_DMA) || (pConfig->InputAccess == FMAC_BUFFER_ACCESS_IT) ||
(pConfig->OutputAccess == FMAC_BUFFER_ACCESS_DMA) || (pConfig->OutputAccess == FMAC_BUFFER_ACCESS_IT))
{
tmpcr |= FMAC_IT_UNFLIEN | FMAC_IT_OVFLIEN;
}
/* FMAC_CR: write the value */
WRITE_REG(hfmac->Instance->CR, tmpcr);
/* Save the input/output accesses in order to configure RIEN, WIEN, DMAREN and DMAWEN during filter start */
hfmac->InputAccess = pConfig->InputAccess;
hfmac->OutputAccess = pConfig->OutputAccess;
/* Check whether the configured X2 is big enough for the filter */
#if defined(USE_FULL_ASSERT)
x2size = FMAC_GET_X2_SIZE(hfmac);
#endif /* USE_FULL_ASSERT */
assert_param(((pConfig->Filter == FMAC_FUNC_CONVO_FIR) && (x2size >= pConfig->P)) || \
((pConfig->Filter == FMAC_FUNC_IIR_DIRECT_FORM_1) && (x2size >= ((uint32_t)pConfig->P + (uint32_t)pConfig->Q))));
/* Build the PARAM value that will be used when starting the filter */
hfmac->FilterParam = (FMAC_PARAM_START | pConfig->Filter | \
((((uint32_t)(pConfig->P)) << FMAC_PARAM_P_Pos) & FMAC_PARAM_P) | \
((((uint32_t)(pConfig->Q)) << FMAC_PARAM_Q_Pos) & FMAC_PARAM_Q) | \
((((uint32_t)(pConfig->R)) << FMAC_PARAM_R_Pos) & FMAC_PARAM_R));
/* Initialize the coefficient buffer if required (pCoeffA for FIR only) */
if ((pConfig->pCoeffB != NULL) && (pConfig->CoeffBSize != 0U))
{
/* FIR/IIR: The provided coefficients should match X2 size */
assert_param(((uint32_t)pConfig->CoeffASize + (uint32_t)pConfig->CoeffBSize) <= x2size);
/* FIR/IIR: The size of pCoeffB should match the parameter P */
assert_param(pConfig->CoeffBSize >= pConfig->P);
/* pCoeffA should be provided for IIR but not for FIR */
/* IIR : if pCoeffB is provided, pCoeffA should also be there */
/* IIR: The size of pCoeffA should match the parameter Q */
assert_param(((pConfig->Filter == FMAC_FUNC_CONVO_FIR) &&
(pConfig->pCoeffA == NULL) && (pConfig->CoeffASize == 0U)) ||
((pConfig->Filter == FMAC_FUNC_IIR_DIRECT_FORM_1) &&
(pConfig->pCoeffA != NULL) && (pConfig->CoeffASize != 0U) &&
(pConfig->CoeffASize >= pConfig->Q)));
/* Write number of values to be loaded, the data load function and start the operation */
WRITE_REG(hfmac->Instance->PARAM, \
(((uint32_t)(pConfig->CoeffBSize) << FMAC_PARAM_P_Pos) | \
((uint32_t)(pConfig->CoeffASize) << FMAC_PARAM_Q_Pos) | \
FMAC_FUNC_LOAD_X2 | FMAC_PARAM_START));
if (PreloadAccess == PRELOAD_ACCESS_POLLING)
{
/* Load the buffer into the internal memory */
FMAC_WritePreloadDataIncrementPtr(hfmac, &(pConfig->pCoeffB), pConfig->CoeffBSize);
/* Load pCoeffA if needed */
if ((pConfig->pCoeffA != NULL) && (pConfig->CoeffASize != 0U))
{
/* Load the buffer into the internal memory */
FMAC_WritePreloadDataIncrementPtr(hfmac, &(pConfig->pCoeffA), pConfig->CoeffASize);
}
/* Wait for the end of the writing */
if (FMAC_WaitOnStartUntilTimeout(hfmac, tickstart, HAL_FMAC_TIMEOUT_VALUE) != HAL_OK)
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
return HAL_TIMEOUT;
}
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_READY;
}
else
{
hfmac->pInput = pConfig->pCoeffA;
hfmac->InputCurrentSize = pConfig->CoeffASize;
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaPreload->XferHalfCpltCallback = NULL;
hfmac->hdmaPreload->XferCpltCallback = FMAC_DMAFilterConfig;
/* Set the DMA error callback */
hfmac->hdmaPreload->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC preload data write */
return (HAL_DMA_Start_IT(hfmac->hdmaPreload, (uint32_t)pConfig->pCoeffB, (uint32_t)&hfmac->Instance->WDATA,
pConfig->CoeffBSize));
}
}
else
{
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_READY;
}
return HAL_OK;
}
/**
* @brief Preload the input (FIR, IIR) and output data (IIR) of the FMAC filter.
* @note The set(s) of data will be used by FMAC as soon as @ref HAL_FMAC_FilterStart is called.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pInput Preloading of the first elements of the input buffer (X1).
* If not needed (no data available when starting), it should be set to NULL.
* @param InputSize Size of the input vector.
* As pInput is used for preloading data, it cannot be bigger than the input memory area.
* @param pOutput [IIR] Preloading of the first elements of the output vector (Y).
* If not needed, it should be set to NULL.
* @param OutputSize Size of the output vector.
* As pOutput is used for preloading data, it cannot be bigger than the output memory area.
* @param PreloadAccess access mode used for the preload (polling or DMA).
* @note The input and the output buffers can be filled by calling several times @ref HAL_FMAC_FilterPreload
* (each call filling partly the buffers). In case of overflow (too much data provided through
* all these calls), an error will be returned.
* @retval HAL_StatusTypeDef HAL status
*/
static HAL_StatusTypeDef FMAC_FilterPreload(FMAC_HandleTypeDef *hfmac, int16_t *pInput, uint8_t InputSize,
int16_t *pOutput, uint8_t OutputSize, uint8_t PreloadAccess)
{
uint32_t tickstart;
HAL_StatusTypeDef status;
/* Check the START bit state */
if (FMAC_GET_START_BIT(hfmac) != 0U)
{
return HAL_ERROR;
}
/* Check that a valid configuration was done previously */
if (hfmac->FilterParam == 0U)
{
return HAL_ERROR;
}
/* Check the preload input buffers isn't too big */
if ((InputSize > FMAC_GET_X1_SIZE(hfmac)) && (pInput != NULL))
{
return HAL_ERROR;
}
/* Check the preload output buffer isn't too big */
if ((OutputSize > FMAC_GET_Y_SIZE(hfmac)) && (pOutput != NULL))
{
return HAL_ERROR;
}
/* Check handle state is ready */
if (hfmac->State != HAL_FMAC_STATE_READY)
{
return HAL_BUSY;
}
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_BUSY;
/* Get tick */
tickstart = HAL_GetTick();
/* Preload the input buffer if required */
if ((pInput != NULL) && (InputSize != 0U))
{
/* Write number of values to be loaded, the data load function and start the operation */
WRITE_REG(hfmac->Instance->PARAM, \
(((uint32_t)InputSize << FMAC_PARAM_P_Pos) | FMAC_FUNC_LOAD_X1 | FMAC_PARAM_START));
if (PreloadAccess == PRELOAD_ACCESS_POLLING)
{
/* Load the buffer into the internal memory */
FMAC_WritePreloadDataIncrementPtr(hfmac, &pInput, InputSize);
/* Wait for the end of the writing */
if (FMAC_WaitOnStartUntilTimeout(hfmac, tickstart, HAL_FMAC_TIMEOUT_VALUE) != HAL_OK)
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
return HAL_TIMEOUT;
}
}
else
{
hfmac->pInput = pOutput;
hfmac->InputCurrentSize = OutputSize;
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaPreload->XferHalfCpltCallback = NULL;
hfmac->hdmaPreload->XferCpltCallback = FMAC_DMAFilterPreload;
/* Set the DMA error callback */
hfmac->hdmaPreload->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC preload data write */
return (HAL_DMA_Start_IT(hfmac->hdmaPreload, (uint32_t)pInput, (uint32_t)&hfmac->Instance->WDATA, InputSize));
}
}
/* Preload the output buffer if required */
if ((pOutput != NULL) && (OutputSize != 0U))
{
/* Write number of values to be loaded, the data load function and start the operation */
WRITE_REG(hfmac->Instance->PARAM, \
(((uint32_t)OutputSize << FMAC_PARAM_P_Pos) | FMAC_FUNC_LOAD_Y | FMAC_PARAM_START));
if (PreloadAccess == PRELOAD_ACCESS_POLLING)
{
/* Load the buffer into the internal memory */
FMAC_WritePreloadDataIncrementPtr(hfmac, &pOutput, OutputSize);
/* Wait for the end of the writing */
if (FMAC_WaitOnStartUntilTimeout(hfmac, tickstart, HAL_FMAC_TIMEOUT_VALUE) != HAL_OK)
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
return HAL_TIMEOUT;
}
}
else
{
hfmac->pInput = NULL;
hfmac->InputCurrentSize = 0U;
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaPreload->XferHalfCpltCallback = NULL;
hfmac->hdmaPreload->XferCpltCallback = FMAC_DMAFilterPreload;
/* Set the DMA error callback */
hfmac->hdmaPreload->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC preload data write */
return (HAL_DMA_Start_IT(hfmac->hdmaPreload, (uint32_t)pOutput, (uint32_t)&hfmac->Instance->WDATA, OutputSize));
}
}
/* Update the error codes */
if (__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_OVFL))
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_OVFL;
}
if (__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_UNFL))
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_UNFL;
}
if (__HAL_FMAC_GET_FLAG(hfmac, FMAC_FLAG_SAT))
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_SAT;
}
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_READY;
/* Return function status */
if (hfmac->ErrorCode == HAL_FMAC_ERROR_NONE)
{
status = HAL_OK;
}
else
{
status = HAL_ERROR;
}
return status;
}
/**
* @brief Write data into FMAC internal memory through WDATA and increment input buffer pointer.
* @note This function is only used with preload functions.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param ppData pointer to pointer to the data buffer.
* @param Size size of the data buffer.
* @retval None
*/
static void FMAC_WritePreloadDataIncrementPtr(FMAC_HandleTypeDef *hfmac, int16_t **ppData, uint8_t Size)
{
uint8_t index;
/* Load the buffer into the internal memory */
for (index = Size; index > 0U; index--)
{
WRITE_REG(hfmac->Instance->WDATA, (((uint32_t)(*(*ppData))) & FMAC_WDATA_WDATA));
(*ppData)++;
}
}
/**
* @brief Handle FMAC Function Timeout.
* @param hfmac FMAC handle.
* @param Tickstart Tick start value.
* @param Timeout Timeout duration.
* @retval HAL_StatusTypeDef HAL status
*/
static HAL_StatusTypeDef FMAC_WaitOnStartUntilTimeout(FMAC_HandleTypeDef *hfmac, uint32_t Tickstart, uint32_t Timeout)
{
/* Wait until flag changes */
while (READ_BIT(hfmac->Instance->PARAM, FMAC_PARAM_START) != 0U)
{
if ((HAL_GetTick() - Tickstart) > Timeout)
{
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
return HAL_TIMEOUT;
}
}
return HAL_OK;
}
/**
* @brief Register the new input buffer, update DMA configuration if needed and change the FMAC state.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pInput New input vector (additional input data).
* @param pInputSize Size of the input vector (if all the data can't be
* written, it will be updated with the number of data read from FMAC).
* @retval HAL_StatusTypeDef HAL status
*/
static HAL_StatusTypeDef FMAC_AppendFilterDataUpdateState(FMAC_HandleTypeDef *hfmac, int16_t *pInput,
uint16_t *pInputSize)
{
/* Change the FMAC state */
hfmac->WrState = HAL_FMAC_STATE_BUSY_WR;
/* Reset the current size */
hfmac->InputCurrentSize = 0U;
/* Handle the pointer depending on the input access */
if (hfmac->InputAccess == FMAC_BUFFER_ACCESS_DMA)
{
hfmac->pInput = NULL;
hfmac->pInputSize = NULL;
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaIn->XferHalfCpltCallback = FMAC_DMAHalfGetData;
hfmac->hdmaIn->XferCpltCallback = FMAC_DMAGetData;
/* Set the DMA error callback */
hfmac->hdmaIn->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC input data write */
return (HAL_DMA_Start_IT(hfmac->hdmaIn, (uint32_t)pInput, (uint32_t)&hfmac->Instance->WDATA, *pInputSize));
}
else
{
/* Update the input data information (polling, IT) */
hfmac->pInput = pInput;
hfmac->pInputSize = pInputSize;
}
return HAL_OK;
}
/**
* @brief Register the new output buffer, update DMA configuration if needed and change the FMAC state.
* @param hfmac pointer to a FMAC_HandleTypeDef structure that contains
* the configuration information for FMAC module.
* @param pOutput New output vector.
* @param pOutputSize Size of the output vector (if the vector can't
* be entirely filled, pOutputSize will be updated with the number
* of data read from FMAC).
* @retval HAL_StatusTypeDef HAL status
*/
static HAL_StatusTypeDef FMAC_ConfigFilterOutputBufferUpdateState(FMAC_HandleTypeDef *hfmac, int16_t *pOutput,
uint16_t *pOutputSize)
{
/* Reset the current size */
hfmac->OutputCurrentSize = 0U;
/* Check whether a valid pointer was provided */
if ((pOutput == NULL) || (pOutputSize == NULL) || (*pOutputSize == 0U))
{
/* The user will have to provide a valid configuration later */
hfmac->pOutput = NULL;
hfmac->pOutputSize = NULL;
hfmac->RdState = HAL_FMAC_STATE_READY;
}
/* Handle the pointer depending on the input access */
else if (hfmac->OutputAccess == FMAC_BUFFER_ACCESS_DMA)
{
hfmac->pOutput = NULL;
hfmac->pOutputSize = NULL;
hfmac->RdState = HAL_FMAC_STATE_BUSY_RD;
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaOut->XferHalfCpltCallback = FMAC_DMAHalfOutputDataReady;
hfmac->hdmaOut->XferCpltCallback = FMAC_DMAOutputDataReady;
/* Set the DMA error callback */
hfmac->hdmaOut->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC output data read */
return (HAL_DMA_Start_IT(hfmac->hdmaOut, (uint32_t)&hfmac->Instance->RDATA, (uint32_t)pOutput, *pOutputSize));
}
else if (hfmac->OutputAccess == FMAC_BUFFER_ACCESS_NONE)
{
hfmac->pOutput = NULL;
hfmac->pOutputSize = NULL;
hfmac->RdState = HAL_FMAC_STATE_READY;
}
else
{
/* Update the output data information (polling, IT) */
hfmac->pOutput = pOutput;
hfmac->pOutputSize = pOutputSize;
hfmac->RdState = HAL_FMAC_STATE_BUSY_RD;
}
return HAL_OK;
}
/**
* @brief Read available output data until Y EMPTY is set.
* @param hfmac FMAC handle.
* @param MaxSizeToRead Maximum number of data to read (this serves as a timeout
* if FMAC continuously writes into the output buffer).
* @retval None
*/
static void FMAC_ReadDataIncrementPtr(FMAC_HandleTypeDef *hfmac, uint16_t MaxSizeToRead)
{
uint16_t maxsize;
uint16_t threshold;
uint32_t tmpvalue;
/* Check if there is data to read */
if (READ_BIT(hfmac->Instance->SR, FMAC_SR_YEMPTY) != 0U)
{
return;
}
/* Get the maximum index (no wait allowed, no overstepping of the output buffer) */
if ((hfmac->OutputCurrentSize + MaxSizeToRead) > *(hfmac->pOutputSize))
{
maxsize = *(hfmac->pOutputSize);
}
else
{
maxsize = hfmac->OutputCurrentSize + MaxSizeToRead;
}
/* Read until there is no more room or no more data */
do
{
/* If there is no more room, return */
if (!(hfmac->OutputCurrentSize < maxsize))
{
return;
}
/* Read the available data */
tmpvalue = ((READ_REG(hfmac->Instance->RDATA))& FMAC_RDATA_RDATA);
*(hfmac->pOutput) = (int16_t)tmpvalue;
hfmac->pOutput++;
hfmac->OutputCurrentSize++;
} while (READ_BIT(hfmac->Instance->SR, FMAC_SR_YEMPTY) == 0U);
/* Y buffer empty flag has just be raised, read the threshold */
threshold = (uint16_t)FMAC_GET_THRESHOLD_FROM_WM(FMAC_GET_Y_EMPTY_WM(hfmac)) - 1U;
/* Update the maximum size if needed (limited data available) */
if ((hfmac->OutputCurrentSize + threshold) < maxsize)
{
maxsize = hfmac->OutputCurrentSize + threshold;
}
/* Read the available data */
while (hfmac->OutputCurrentSize < maxsize)
{
tmpvalue = ((READ_REG(hfmac->Instance->RDATA))& FMAC_RDATA_RDATA);
*(hfmac->pOutput) = (int16_t)tmpvalue;
hfmac->pOutput++;
hfmac->OutputCurrentSize++;
}
}
/**
* @brief Write available input data until X1 FULL is set.
* @param hfmac FMAC handle.
* @param MaxSizeToWrite Maximum number of data to write (this serves as a timeout
* if FMAC continuously empties the input buffer).
* @retval None
*/
static void FMAC_WriteDataIncrementPtr(FMAC_HandleTypeDef *hfmac, uint16_t MaxSizeToWrite)
{
uint16_t maxsize;
uint16_t threshold;
/* Check if there is room in FMAC */
if (READ_BIT(hfmac->Instance->SR, FMAC_SR_X1FULL) != 0U)
{
return;
}
/* Get the maximum index (no wait allowed, no overstepping of the output buffer) */
if ((hfmac->InputCurrentSize + MaxSizeToWrite) > *(hfmac->pInputSize))
{
maxsize = *(hfmac->pInputSize);
}
else
{
maxsize = hfmac->InputCurrentSize + MaxSizeToWrite;
}
/* Write until there is no more room or no more data */
do
{
/* If there is no more room, return */
if (!(hfmac->InputCurrentSize < maxsize))
{
return;
}
/* Write the available data */
WRITE_REG(hfmac->Instance->WDATA, (((uint32_t)(*(hfmac->pInput))) & FMAC_WDATA_WDATA));
hfmac->pInput++;
hfmac->InputCurrentSize++;
} while (READ_BIT(hfmac->Instance->SR, FMAC_SR_X1FULL) == 0U);
/* X1 buffer full flag has just be raised, read the threshold */
threshold = (uint16_t)FMAC_GET_THRESHOLD_FROM_WM(FMAC_GET_X1_FULL_WM(hfmac)) - 1U;
/* Update the maximum size if needed (limited data available) */
if ((hfmac->InputCurrentSize + threshold) < maxsize)
{
maxsize = hfmac->InputCurrentSize + threshold;
}
/* Write the available data */
while (hfmac->InputCurrentSize < maxsize)
{
WRITE_REG(hfmac->Instance->WDATA, (((uint32_t)(*(hfmac->pInput))) & FMAC_WDATA_WDATA));
hfmac->pInput++;
hfmac->InputCurrentSize++;
}
}
/**
* @brief DMA FMAC Input Data process half complete callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAHalfGetData(DMA_HandleTypeDef *hdma)
{
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Call half get data callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->HalfGetDataCallback(hfmac);
#else
HAL_FMAC_HalfGetDataCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/**
* @brief DMA FMAC Input Data process complete callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAGetData(DMA_HandleTypeDef *hdma)
{
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Reset the pointers to indicate new data will be needed */
FMAC_ResetInputStateAndDataPointers(hfmac);
/* Call get data callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->GetDataCallback(hfmac);
#else
HAL_FMAC_GetDataCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/**
* @brief DMA FMAC Output Data process half complete callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAHalfOutputDataReady(DMA_HandleTypeDef *hdma)
{
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Call half output data ready callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->HalfOutputDataReadyCallback(hfmac);
#else
HAL_FMAC_HalfOutputDataReadyCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/**
* @brief DMA FMAC Output Data process complete callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAOutputDataReady(DMA_HandleTypeDef *hdma)
{
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Reset the pointers to indicate new data will be needed */
FMAC_ResetOutputStateAndDataPointers(hfmac);
/* Call output data ready callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->OutputDataReadyCallback(hfmac);
#else
HAL_FMAC_OutputDataReadyCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/**
* @brief DMA FMAC Filter Configuration process complete callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAFilterConfig(DMA_HandleTypeDef *hdma)
{
uint8_t index;
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* If needed, write CoeffA and exit */
if (hfmac->pInput != NULL)
{
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaPreload->XferHalfCpltCallback = NULL;
hfmac->hdmaPreload->XferCpltCallback = FMAC_DMAFilterConfig;
/* Set the DMA error callback */
hfmac->hdmaPreload->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC preload data write */
if (HAL_DMA_Start_IT(hfmac->hdmaPreload, (uint32_t)hfmac->pInput, (uint32_t)&hfmac->Instance->WDATA,
hfmac->InputCurrentSize) == HAL_OK)
{
hfmac->pInput = NULL;
hfmac->InputCurrentSize = 0U;
return;
}
/* If not exited, there was an error: set FMAC handle state to error */
hfmac->State = HAL_FMAC_STATE_ERROR;
}
else
{
/* Wait for the end of the writing */
for (index = 0U; index < MAX_PRELOAD_INDEX; index++)
{
if (READ_BIT(hfmac->Instance->PARAM, FMAC_PARAM_START) == 0U)
{
break;
}
}
/* If 'START' is still set, there was a timeout: set FMAC handle state to timeout */
if (READ_BIT(hfmac->Instance->PARAM, FMAC_PARAM_START) != 0U)
{
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
}
else
{
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_READY;
/* Call output data ready callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->FilterConfigCallback(hfmac);
#else
HAL_FMAC_FilterConfigCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
return;
}
}
/* If not exited, there was an error: set FMAC handle error code to DMA error */
hfmac->ErrorCode |= HAL_FMAC_ERROR_DMA;
/* Call user callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->ErrorCallback(hfmac);
#else
HAL_FMAC_ErrorCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/**
* @brief DMA FMAC Filter Configuration process complete callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAFilterPreload(DMA_HandleTypeDef *hdma)
{
uint8_t index;
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Wait for the end of the X1 writing */
for (index = 0U; index < MAX_PRELOAD_INDEX; index++)
{
if (READ_BIT(hfmac->Instance->PARAM, FMAC_PARAM_START) == 0U)
{
break;
}
}
/* If 'START' is still set, there was an error: set FMAC handle state to error */
if (READ_BIT(hfmac->Instance->PARAM, FMAC_PARAM_START) != 0U)
{
hfmac->State = HAL_FMAC_STATE_TIMEOUT;
hfmac->ErrorCode |= HAL_FMAC_ERROR_TIMEOUT;
}
/* If needed, preload Y buffer */
else if ((hfmac->pInput != NULL) && (hfmac->InputCurrentSize != 0U))
{
/* Write number of values to be loaded, the data load function and start the operation */
WRITE_REG(hfmac->Instance->PARAM, \
(((uint32_t)(hfmac->InputCurrentSize) << FMAC_PARAM_P_Pos) | FMAC_FUNC_LOAD_Y | FMAC_PARAM_START));
/* Set the FMAC DMA transfer complete callback */
hfmac->hdmaPreload->XferHalfCpltCallback = NULL;
hfmac->hdmaPreload->XferCpltCallback = FMAC_DMAFilterPreload;
/* Set the DMA error callback */
hfmac->hdmaPreload->XferErrorCallback = FMAC_DMAError;
/* Enable the DMA stream managing FMAC preload data write */
if (HAL_DMA_Start_IT(hfmac->hdmaPreload, (uint32_t)hfmac->pInput, (uint32_t)&hfmac->Instance->WDATA,
hfmac->InputCurrentSize) == HAL_OK)
{
hfmac->pInput = NULL;
hfmac->InputCurrentSize = 0U;
return;
}
/* If not exited, there was an error */
hfmac->ErrorCode = HAL_FMAC_ERROR_DMA;
hfmac->State = HAL_FMAC_STATE_ERROR;
}
else
{
/* nothing to do */
}
if (hfmac->ErrorCode == HAL_FMAC_ERROR_NONE)
{
/* Change the FMAC state */
hfmac->State = HAL_FMAC_STATE_READY;
/* Call output data ready callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->FilterPreloadCallback(hfmac);
#else
HAL_FMAC_FilterPreloadCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
else
{
/* Call user callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->ErrorCallback(hfmac);
#else
HAL_FMAC_ErrorCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
}
/**
* @brief DMA FMAC communication error callback.
* @param hdma DMA handle.
* @retval None
*/
static void FMAC_DMAError(DMA_HandleTypeDef *hdma)
{
FMAC_HandleTypeDef *hfmac = (FMAC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Set FMAC handle state to error */
hfmac->State = HAL_FMAC_STATE_ERROR;
/* Set FMAC handle error code to DMA error */
hfmac->ErrorCode |= HAL_FMAC_ERROR_DMA;
/* Call user callback */
#if (USE_HAL_FMAC_REGISTER_CALLBACKS == 1)
hfmac->ErrorCallback(hfmac);
#else
HAL_FMAC_ErrorCallback(hfmac);
#endif /* USE_HAL_FMAC_REGISTER_CALLBACKS */
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* HAL_FMAC_MODULE_ENABLED */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| grissiom/rt-thread | bsp/stm32/libraries/STM32G4xx_HAL/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_fmac.c | C | gpl-2.0 | 89,165 |
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Mozilla/4.7 [en] (X11; I; Linux 2.2.12-20 i686) [Netscape]">
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<title>LAME Changelog</title>
</head>
<body text="#000000" bgcolor="#ffffff" link="#888888" vlink="#555555"
alink="#bbbbbb">
<center>
<h1> History</h1>
</center>
Starting with LAME 3.0: <br>
<font color="#ff0000">red = features and bug fixes which effect quality</font>
<br>
<font color="#3366ff">blue = features and bug fixes which effect speed</font>
<br>
black = usability, portability, other
<hr>
<h3>LAME 3.93.1 December 1 2002</h3>
<ul>
<li>Gabriel Bouvigne:
<ul>
<li>preset medium added to the dll interface</li>
<li><font color="#ff0000">fix for abr/cbr presets</font></li>
<li><font color="#ff0000">fix -q0 switch</font></li>
</ul>
</li>
<li>Alexander Leidinger: fix link problem on systems where socket() resides in libsocket</li>
</ul>
<br>
<h3>LAME 3.93 November 16 2002</h3>
<ul>
<li>Takehiro Tominaga:
<ul>
<li><font color="#ff0000">bit allocation for pre-echo control improved for single channel encodings</font></li>
<li><font color="#ff0000">substep noise shaping</font></li>
<li><font color="#3366ff">optimizations by changing data structure</font></li>
<li><font color="#ff0000">noise shaping model 2 fix</font></li>
<li><font color="#3366ff">nspsytune FIR filter clean up</font></li>
<li><font color="#ff0000">fix small psymodel bugs(DC current estimation, preecho detection of non-VBR mode, and nspsymode initialization)</font></li>
<li>portability fixes for Tru64 UNIX</li>
</ul>
</li>
<li>Albert Faber: some fixes in the DLL</li>
<li>Simon Blandford: fixes for channel scaling in mono mode</li>
<li><font color="#3366ff">Dominique Duvivier: some optimizations and a faster log10 function</font></li>
<li>Mark Taylor:
<ul>
<li>some tag related fixes in the direct show filter and in the ACM codec</li>
<li><font color="#3366ff">fixed a mono encoding bug found by Justin Schoeman</font></li>
<li>calc_noise bug fix</li>
<li>other fixes</li>
</ul>
</li>
<li>Alexander Leidinger:
<ul>
<li>update to autoconf 2.53, rewrite some configure tests</li>
<li>Akos Maroy: determine gcc version even with gcc 3.1</li>
<li>Andrew Bachmann: compile shared libs on BeOS (and perhaps other arches)</li>
<li>ultrasparc switches for gcc 3.1</li>
<li>fixes for SunOS 4.x</li>
<li>fixes for 64bit arches</li>
<li>CFLAGS fix for IRIX</li>
<li>don't override CFLAGS if exptopt isn't requested</li>
</ul>
</li>
<li>Robert Hegeman:
<ul>
<li><font color="#3366ff">some fixes</font></li>
<li><font color="#ff0000">some fixes for VBR</font></li>
</ul>
</li>
<li>Gabriel Bouvigne:
<ul>
<li>--noasm switch. Might help Cyrix/Via users</li>
<li><font color="#ff0000">presets and alt-presets merged</font></li>
</ul>
</li>
</ul>
<br>
<h3>LAME 3.92 April 14 2002</h3>
<ul>
<li><font color="#ff0000">Alexander Leidinger: add non linear psymodel
(compile time option, disabled by default)</font>, workaround a bug in gcc
3.0.3 (compiler options, based upon suggestions from various people, see archives
and changelog for more)<br>
</li>
<li>Steve Lhomme: ACM wrapper (MS-Windows codec)</li>
<li><font color="#3366ff">Steve Lhomme: less memory copying on
stereo (interleaved) input</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: Inter-channel masking,
enables with --interch x option</font></li>
<li> For buggy versions of gcc compiler (2.96*), back off on some of
the advanced compiler options<br>
</li>
</ul>
<br>
<h3>LAME 3.91 December 29 2001</h3>
<ul>
<li><font color="#ff0000">Darin Morrison: Bugfix for --alt-preset
(for content with low volume, clean vocals), only important for the "fast
standard" preset</font><br>
</li>
<li>Alexander Leidinger: <br>
<ul>
<li>add some missing files to the distribution<br>
</li>
<li>add --alt-preset to the man page<br>
</li>
</ul>
</li>
</ul>
<br>
<h3>LAME 3.90 December 21 2001</h3>
<ul>
<li><font color="#ff0000">Many small improvements and bug fixes not
added to history</font></li>
<li><font color="#ff0000">John Dahlstrom: more fine tuning on
the auto adjustment of the ATH</font></li>
<li><font color="#3366ff">Robert Hegemann: small speed and quality
improvements for the old VBR code (--vbr-old).</font> </li>
<li><font color="#ff0000">Robert Hegemann: some short block bug
fixes</font> </li>
<li><font color="#ff0000">Robert Hegemann: Big improvements to
--vbr-mtrh, now encodes much more frequencies over 16khz</font> </li>
<li><font color="#ff0000">Robert Hegemann: --vbr-new code disabled
(outdated and lower quality) and replaced with --vbr-mtrh (Both --vbr-new
and --vbr-mtrh now default to mtrh)</font> </li>
<li>Robert Hegemann: reordering of --longhelp to give more information,
--extrahelp dropped </li>
<li>Darin Morrison: Totally revamped and extremely high quality
unified preset system and other general quality improvements now available
with --alt-presets:
<ul>
<li> <font color="#ff0000">some improvements to psychoacoustics
(vast improvements over default L.A.M.E. modes) when --alt-preset is used
including:</font></li>
<ul>
<li> <font color="#ff0000">Improved tuning of short block
usage.</font></li>
<li> <font color="#ff0000">Improved quantization selection
usage (the -X modes), now adapts between appropriate modes on the fly. Also
helps on "dropout" problems and with pre-echo cases.</font></li>
<li> <font color="#ff0000">Improved joint stereo usage.
Thresholds are better tuned now and fix some "dropout" problems L.A.M.E.
suffers from on clips like serioustrouble.</font></li>
<li> <font color="#ff0000">Improved noise shaping usage.
Now switches between noise shaping modes on the fly (toggles -Z on and
off when appropriate) which allows lower bitrates but without the quality
compromise.</font></li>
<li> <font color="#ff0000">Clips vastly improved over default
L.A.M.E. modes (vbr/cbr/abr, including --r3mix): castanets, florida_seq,
death2, fatboy, spahm, gbtinc, ravebase, short, florida_seq, hihat, bassdrum,
2nd_vent_clip, serioustrouble, bloodline, and others. No degraded clips known.</font></li>
<li> VBR bitrates are now more "stable" with less fluctuation
-- not dipping too low on some music and not increasing too high unnecessarily
on other music. "--alt-preset standard" provides bitrates roughly within
the range of 180-220kbps, often averaging close to 192kbps.</li>
</ul>
<li> --alt-presets replace the --dm-presets and "metal" preset is
removed and replaced with generic abr and cbr presets.</li>
<li> --alt-preset extreme (note the 'e') replaces xtreme to help
eliminate some confusion</li>
<li> --alt-preset vbr modes now have a fast option which offers
almost no compromise in speed.</li>
<li> --alt-preset standard (and "fast standard") are now much lower
in bitrate, matching --r3mix with an overall average, though offering higher
quality especially on difficult test samples.</li>
<li> --alt-presets are no longer just "presets" as in a collection
of switches, instead they are now quality "modes" because of special code
level tunings (those mentioned above).</li>
<li> Use --alt-preset help for more information.</li>
</ul>
</li>
<li>Roel VdB: more tuning on the <font color="#007f00">--r3mix</font>
preset </li>
<li>Jon Dee, Roel VdB: INFO tag<br>
</li>
<li>Alexander Leidinger, mp3gain@hotmail.com: added --scale-l
and --scale-r to scale stereo channels independantly<br>
</li>
<li>Takehiro Tominaga: new noise shaping mode, offering more
"cutting edge" shaping according to masking, enabled via -q0<br>
</li>
<li>Mark Taylor: More work on --nogap<br>
</li>
<li>Gabriel Bouvigne: Small changes to abr code for more accurate
final bitrate<br>
</li>
<li>Gabriel Bouvigne, mp3gain@hotmail.com: Preliminary <a
href="http://www.replaygain.org"> ReplayGain</a> analysis code added (not
functional yet)<br>
</li>
<li>Gabriel Bouvigne, Alexander Leidinger: Documentation updates<br>
</li>
<li>John Dahlstrom, DSPguru@math.com: floating point interface
function in the Windows DLL<br>
</li>
</ul>
<br>
<h3>LAME 3.89beta July 5 2001</h3>
<ul>
<li> John Stewart: long filename support for Win9x/NT.</li>
<li> Takehiro Tominaga: LAME can calculate the CRC of VBR
header, so now "lame -pv" works fine.</li>
<li><font color="#ff0000">Robert Hegemann: Improvements of
the new VBR code (--vbr-mtrh).</font></li>
<li><font color="#3366ff">Robert Hegemann: New VBR code (--vbr-mtrh)
is now defaulted to get more feedback. The VBR speed is now on par with
CBR. We will use the old VBR code in the release.</font></li>
<li><font color="#ff0000">Gabriel Bouvigne: Change of the maximum
frame size limit. LAME should now be more friendly with hardware players.</font></li>
<li>Gabriel Bouvigne: Size of VBR is now more balanced according
to the -V value.</li>
<li>Alexander Leidinger: Finished the implementation of the set/get
functions.</li>
<li>John Dahlstrom: LAME now handles 24bits input</li>
<li>Mark Taylor: bugs in lame --decode causing truncation of mp3 file
fixed</li>
<li>Mark Taylor: preliminary --nogap support</li>
<li>"Final" API completed: shared library safe! This API is frozen
and should be backwords compatiable with future versions of libmp3lame.so,
but we will continue to add new functionality. <br>
</li>
</ul>
<h3> LAME 3.88beta March 25 2001</h3>
<ul>
<li> <font color="#ff0000">A lot of work that was never added to
the History!</font></li>
<li> <font color="#ff0000">Frank Klemm and Gabriel Bouvigne:
New ATH formula. Big improvement for high bitrate encodings.</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: Temporal masking</font></li>
<li> <font color="#ff0000">Gabriel Bouvigne/Mark Taylor: auto adjustment
of ATH</font></li>
<li> <font color="#ff0000">Robert Hegemann: Better outer_loop
stopping criterion. Enabled with -q2 or better.</font></li>
<li> <font color="#ff0000">Robert Hegemann/Naoki Shibata:
slow/carefull noise shaping. -q3..9: amplify all distorted
bands. -q2: amplify distorted bands within 50%. -q1-0:
amplify only most distorted band at each iteration.</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: Interframe, shortblock
temporal masking.</font></li>
<li> Takehiro Tominaga: LAME restructured into a shared
library and front end application. Slight changes to the API. More
changes are coming to turn LAME into a true shared library (right now you
have to recompile if you upgrade the library :-(</li>
<li> <font color="#000000">Naoki Shibata:</font></li>
<ul>
<li> <font color="#ff0000">improvements to psychoacoustics</font><font
color="#000000"> (--nspsytune)</font></li>
<li> <font color="#ff0000">BUG in long block pre echo control
fixed </font><font color="#000000"> (some out of range array access
in M/S psychoacoustics)</font></li>
</ul>
<li> <font color="#000000">Ralf Kempkens: Visual
Basic Script for lame, suggested to put it on your Windows Desktop and you
can drag'n'drop Waves to encode on it.</font></li>
<li> <font color="#000000">Alexander Stumpf: improved
lame.bat for 4Dos users</font></li>
<li> <font color="#000000">Mark Taylor: Several bugs fixed in the
resampling code.</font></li>
<li> <font color="#000000">Frank Klemm, Robert Hegemann:
added assembler code for CPU feature detection on runtime (MMX, 3DNow,
SIMD)</font></li>
<li> <font color="#3366ff">Takehiro Tominaga: 3DNow FFT code.</font></li>
<li> <font color="#000000">Florian Bome, Alexander Leidinger:
more work on configure stuff</font></li>
<li> <font color="#000000">Alexander Leidinger: automake/libtool
generated Makefiles and TONS of other work.</font></li>
<li> <font color="#000000">Alexander Leidinger: Much
work towards shared library style API.</font></li>
<li> <font color="#000000">Anonymous: New more efficient RTP code.</font></li>
<li> <font color="#ff0000">Mark Taylor: psycho-acoustic data now
computed for all scalefactor bands (up to 24 kHz)</font></li>
<li> <font color="#ff0000">Mark Taylor, Takehiro Tominaga: All ISO
table data replaced by formulas - should improve MPEG2.5 results for which
we never had correct table data.</font></li>
</ul>
<h3> LAME 3.87alpha September 25 2000</h3>
<ul>
<li> Mark Taylor: Bug fixed in LAME/mpglib error recovery when
encountering a corrupt MP3 frame during *decoding*.</li>
<li> Albert Faber: added LayerI+II decoding support</li>
<li> <font color="#000000">Frank Klemm: added improved CRC
calculation</font></li>
<li> <font color="#000000">Frank Klemm: substantial code cleanup/improvements</font></li>
<li> Robert Hegemann: Bug fixes</li>
<ul>
<li> <font color="#ff0000">in huffman_init</font>, could lead to
segmentation faults (only in rare cases, most likely at lower sample rates)</li>
<li> <font color="#ff0000">M/S switching at lower sample rates</font>
(the fact there is no 2nd granule was ignored)</li>
</ul>
<li> <font color="#3366ff">Robert Hegemann: speed up in
VBR</font></li>
<li> Jarmo Laakkonen: Amiga/GCC settings for Makefile.unix.</li>
<li> Magnus Holmgren: README and Makefile for (free) Borland
C++ compiler. Will also compile lame_enc.dll, but this is untested.</li>
<li> Florian Bome: LAME finally has a ./configure
script!!</li>
</ul>
<h3> LAME 3.86beta August 6 2000</h3>
<ul>
<li> Christopher Wise: A makefile for DJGPP, the DOS version
of gcc. Now most windows users should be able to compile LAME with
minimal effort.</li>
<li> <font color="#ff0000">Robert Hegemann: old VBR:
fixed some bugs and Takehiro's scalefac_scale feature (not yet on by
default.) older LAME versions did not allow to spent more than 2500
bits of 4095 possible bits to a granule per channel, now fixed.</font></li>
<li> Robert Hegemann: new VBR: analog silence
treatment like in old VBR</li>
<li> William Welch: Improved options for Linux/Alpha gcc and
ccc compilers in Makefile.</li>
<li> Mathew Hendry: setting appropriate CRC bit for additional
Xing-VBR tagging frame</li>
<li> Don Melton: added ID3 version 2 TAG support</li>
<li> <font color="#000000">John Dahlstrom: fixed bug allowing timing
information (for status in command line encoder) to overflow.</font></li>
<li> <font color="#000000">Tamito KAJIYAMA, Fixed several bugs in
the LAME/Vorbis interface.</font></li>
<li> <font color="#000000">Mark Taylor: lame --decode will
recognize <a href="http://albumid.cjb.net">Album ID tags</a></font></li>
<li> <font color="#ff0000">Naoki Shibata: Additive masking
and other improvements to psycho acoustics. (not yet on by default)</font></li>
</ul>
<h3> LAME 3.85beta July 3 2000</h3>
<ul>
<li> <font color="#ff0000">Takehiro Tominaga: mid/side stereo
demasking thresholds updated.</font></li>
<li> Takehiro Tominaga: New short block MDCT coefficient data structure.
Should allow for future speed improvements.</li>
<li> Robert Hegemann: fixed bug in old VBR routine, the --noath
mode messed up the VBR routine resulting in very large files</li>
<li> Robert Hegemann: found bugs in some sections when using 32
bit floating point. Default is now back to 64bit floating point.</li>
<li> <font color="#ff0000">Takehiro Tominaga: Modified PE
formula to use ATH.</font></li>
<li> <font color="#000000">S.T.L.: README.DJGPP - instructions
for compiling LAME with DJGPP, the dos version of gcc.</font></li>
</ul>
<h3> LAME 3.84beta June 30 2000</h3>
<ul>
<li> Mark Weinstein: .wav file output (with --decode option)
was writing the wrong filesize in the .wav file. Now fixed.</li>
<li> Mark Taylor: (optional) Vorbis support, both encoding
and decoding. LAME can now produce .ogg files, or even re-encode your
entire .ogg collection into mp3. (Just kidding: it is always
a bad idea to convert from one lossy format to another)</li>
<li> ?: Bug fixed causing VBR to crash under windows.
(pretab[] array overflow)</li>
<li> Sergey Sapelin: Another bug found in the mpg123 MPEG2 tables.
Now fixed for the mpg123 based decoder in LAME.</li>
<li> Marco Remondini: VBR histogram works in win32.
compile with -DBRHIST -DNOTERMCAP</li>
<li> <font color="#ff0000">Takehiro Tominaga: LAME CBR will
now use scalefac_scale to expand the dynamic range of the scalefactors.</font></li>
<li> <font color="#000000">Iwasa Kazmi: Library improvements:
exit()'s, printf, fprintf's are being replaced by interceptable macros.</font></li>
</ul>
<h3> LAME 3.83beta May 19 2000</h3>
<ul>
<li> <font color="#ff0000">Mark Taylor: Bug in buffering routines:
in some cases, could cause MDCT to read past end of buffer.
Rare in MPEG2, even more rare for MPEG1, but potentially serious!</font></li>
<li> Mark Taylor: MDCT/polyphase filterbank was not being
"primed" properly. Does not effect output unless you set the encoder
delay lower than the default of 576 samples.</li>
<li> <font color="#ff0000">Mark Taylor: "vdbj" and "Caster"
found several VBR bugs (now fixed): 1. Analog silence
detection only checked frequencies up to 16 kHz. 2. VBR mode
could still somehow avoid -F mode. 3. VBR mode would ignore
noise above 16 kHz (scalefactor band 22), Now calc_noise1 will compute the
noise in this band when in VBR mode. Not calculated in CBR mode
since CBR algorithm has no way of using this information.</font></li>
<li> Mark Taylor: scalefactor band 22 info (masking(=ATH),
noise and energy) now displayed in frame analyzer.</li>
<li> <font color="#ff0000">VBR code ATH tuning was disabled by accident
in 3.81, now fixed.</font></li>
<li> <font color="#000000">Mark Taylor: lame --decode will
produce .wav files. (oops - size is off by a factor of 4)</font></li>
</ul>
<h3> LAME 3.82beta May 11 2000</h3>
<ul>
<li> Robert Hegemann: Fixed bug in high bitrate joint stereo
encodings.</li>
<li> <font color="#3366ff">Naoki Shibata: new long block MDCT
routine</font></li>
</ul>
<h3> LAME 3.81beta May 8 2000</h3>
<ul>
<li> all ISO code removed!</li>
<li> <font color="#3366ff">Takehiro Tominaga and Naoki Shibata:
new window subband routines.</font></li>
<li> <font color="#000000">Naoki Shibata: Bug fix in mpglib
(decoding) lib: in some cases, MDCT coefficients from previous granule
was incorrectly used for the next granule.</font></li>
<li> <font color="#ff0000">ISO 7680 bit buffer limitation removed.
It can be reactivated with "--strictly-enforce-ISO" Please report
any trouble with high bitrates.</font></li>
</ul>
<h3> LAME 3.80beta May 6 2000</h3>
<ul>
<li> <font color="#ff0000">Takehiro Tominaga: more efficient
and faster huffman encoding!</font></li>
<li> <font color="#ff0000">Takehiro Tominaga and Mark Taylor:
much improved short block compression!</font></li>
<li> <font color="#000000">Tomasz Motylewski and Mark Taylor:
MPEG2.5 now supported!</font></li>
<li> <font color="#000000">Mark Taylor: incorporated Takehiro's
bitstream.c! bitstream.c used by default, but old ISO bitstream code
can also be used.</font></li>
<li> <font color="#ff0000">Scott Manley and Mark Taylor:
good resampling routine finaly in LAME. uses a 19 point FIR filter
with Blackman window. Very slow for non integer resampling ratios.</font></li>
<li> <font color="#000000">Iwasa Kazmi: fixed SIGBUS error:
VBR and id3 tags were using data after it was free()'d.</font></li>
<li> <font color="#ff0000">Robert Hegemann: Improved VBR tuning.
#define RH_QUALITY_CONTROL and #RH_SIDE_VBR now the defaults.</font></li>
<li> <font color="#000000">Robert Hegemann: LAME version
string now added to ancillary data.</font></li>
<li> Kimmo Mustonen: VBR histogram support for Amiga.</li>
<li> Casper Gripenberg: VBR stats (but not histogram) for
DOS verson.</li>
<li> Robert Hegemann: rare VBR overflow bug fixed.</li>
<li> Zack: -F option strictly enforces the VBR min bitrate.
Without -F, LAME will ignore the minimum bitrate when encoding analog silence.</li>
<li> Shawn Riley: User can now specify a compression ratio
(--comp <arg>) instead of a bit rate. Default settings based
on a compression ratio of 11.0</li>
<li> Mark Taylor: free format bitstreams can be created with
--freeformat, and specify any integer bitrate from 8 to 320kbs with -b.</li>
<li> Mark Taylor: lame be used as a decoder (output raw pcm only):
lame --decode input.mp3 output.pcm</li>
</ul>
<h3> LAME 3.70 April 6 2000</h3>
<ul>
<li> "LAME 3.69beta becomes LAME 3.70 "stable"</li>
</ul>
<h3> LAME 3.69beta April 6 2000</h3>
<ul>
<li> "spahm": default mode selection bug fixed. In some
cases, lame was defaulting to regular stereo instead of jstereo when the
user did not specify a mode.</li>
</ul>
<h3> LAME 3.68beta April 4 2000</h3>
<ul>
<li> Mark Taylor: mono encoding bug in DLL fixed.</li>
<li> Ingo Saitz: bug in --cwlimit argument parsing fixed.</li>
<li> <font color="#ff0000">Scott Manly: bug in 4-point resample
code fixed.</font></li>
</ul>
<h3> LAME 3.67beta March 27 2000</h3>
<ul>
<li> <font color="#ff0000">Robert Hegemann: jstereo now enabled
for MPEG2 encodings</font></li>
<li> Mark Taylor: old M/S stereo mode which used L/R maskings has
been removed.</li>
<li> Mark Taylor: Xing MPEG2 VBR headers now working.</li>
<li> <font color="#ff0000">Mark Taylor: When quantized coefficients
are all 0 in a band, set scalefactors to 0 also to save a few bits.</font></li>
<li> <font color="#000000">Ingo Saitz: Problems with framesize
calculation when using -f fast-math option fixed.</font></li>
</ul>
<h3> LAME 3.66beta March 21 2000</h3>
<ul>
<li> Bug fixes in BladeEnc DLL, possible click in last mp3 frame,
VBR historgram display, byteswapping option, ASM quantize routines work
for both float and double.</li>
</ul>
<h3> LAME 3.65beta March 17 2000</h3>
<ul>
<li> Enabled ASM version of quantize_xrpow() - accidently disabled
in lame3.64.</li>
</ul>
<h3> LAME 3.64beta March 16 2000</h3>
<ul>
<li> Don Melton: id3v1.1 tags & id3 bugfixes</li>
<li> <font color="#ff0000">Gabriel Bouvigne: L/R matching
block type fix</font></li>
<li> <font color="#ff0000">Bug fixed which was allowing quantized
values to exceed the maximum when not using -h</font></li>
<li> <font color="#3366ff">Mark Taylor: Fitlers based on polyphase
filterbank. should be slightly better since the responce is independent
of the blocktype, and they are slightly faster.</font></li>
<li> Mark Taylor: API: the API changed slightly - and this
should be the final version. There is a new routine: lame_encode_buffer()
which takes an arbritray sized input buffer, resamples & filters if necessary,
encodes, and returns the mp3buffer. There are also several new #defines,
so it is possible to compile a simple encoding library with no decoding
or file I/O or command line parsing. see the file API for details.</li>
<li> Mark Taylor: MSVC stuff: lame.exe (with and without the
frame analyzer) and the CDex lame_enc.dll</li>
<br>
should compile under MSVC. The MSVC5 project files may need some
tweaking. In particular, <br>
you need to make sure LAMEPARSE, LAMESNDFILE and HAVEMPGLIB <br>
are defined. (and HAVEGTK for the GTK stuff).
</ul>
<h3> LAME 3.63beta February 20 2000</h3>
<ul>
<li> Robert Hegemann: FPE with -h fixed?</li>
<li> Mathey Hendry: FPE error catching for Cygwin, FPE fix
for vbr mode and output to /dev/null</li>
<li> Jeremy Hall: Fixed problems with input files where the
number of samples is not known.</li>
<li> <font color="#3366ff">Mathew Hendry: ASM quantize_xrpow()
for GNU i386</font></li>
<li> <font color="#3366ff">Wilfried Behne quantize_xrpow ()for
PowerPC and non-ASM</font></li>
<li> <font color="#3366ff">Takehiro Tominaga: GOGO FFTs
(not yet used?)</font></li>
<br>
</ul>
<h3> LAME 3.62beta February 9 2000</h3>
<ul>
<li> <font color="#000000">Iwasa Kazmi: frame analyzer short
block display of single subblocks (press 1,2 or 3)</font></li>
<li> <font color="#000000">Ingo Saitz: --help option added,
with output to stdout</font></li>
<li> <font color="#ff0000">Alfred Weyers: short block AAC spreading
function bug fixed</font></li>
<li> <font color="#3366ff">Takehiro Tominaga: new scalefac
data structure - improves performance!</font></li>
<li> <font color="#ff0000">Lionel Bonnet: Bug fixed in MPEG2
scalefactor routine: scalefactors were being severly limited.</font></li>
<li> <font color="#3366ff">Takehiro Tominaga: faster FFT routines
from. These routines are also compatible with the GOGO routines,
in case someone is interested in porting them back to LAME.</font></li>
<li> <font color="#3366ff">Sigbjørn Skjæret, Takehiro
Tominaga: faster pow() code.</font></li>
<li> <font color="#ff0000">Joachim Kuebart: Found some unitialized
variables that were effecting quality for encodings which did not use the
-h option (now fixed).</font></li>
<li> Mark Taylor: More modularization work. It is now
possible to use LAME as a library where you can set the encoding parameters
directly and do your own file i/o. The calling program is now
it's own mp3 output. For an example of the LAME API, see main.c,
or mp3rtp.c or mp3x.c. These can all be compiled as stand alone programs
which link with libmp3lame.a.</li>
<li> Felix vos Leitner: mp3rtp fixes. mp3rtp is a standalone
program which will encode and stream with RTP.</li>
<li> Robert Hegemann: Information written to stderr displaying
exactly which type of lowpass filter (if any) is being used.</li>
<li> Iwasa Kazmi: mpglib (the mpg123 decoder) scsfi decoding
fixes.</li>
<li> Takehiro Tominaga: More mpglib scsfi decoding fixes.</li>
</ul>
<h3> LAME 3.61beta January 14 2000</h3>
<ul>
<li> <font color="#ff0000">Mark Taylor: Fixed bug with lowpass filters
when using VBR with a 64kbs or lower min bitrate setting.</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: more efficient
huffman encoding splitting.</font></li>
</ul>
<h3> LAME 3.60beta January 9 2000</h3>
<ul>
<li> Mark Taylor: Distribution now comes with self test. Needs
work to be automated, see 'make test' in Makefile.</li>
<li> <font color="#ff0000">Mark Taylor: AAC spreading function now
the default</font></li>
<li> Gabriel Bouvigne: updated HTML docs</li>
<li> Felix von Leitner: compute correct file length from Xing header
(if present) when input file is a mp3 file</li>
<li> Felix von Leitner: mp3rtp (standalone) program now included.
Not yet tested. mp3rtp ip:port:ttl <infile>
/dev/null will stream directly to ip:port using RTP.</li>
<br>
</ul>
<h3> LAME 3.59beta January 4 2000</h3>
<ul>
<li> Takehiro Tominaga: --noath option. Disables ATH
maskings.</li>
<li> Gabriel Bouvigne: updated HTML docs.</li>
<li> Iwasa Kazmi: makefile fixes</li>
<li> Mark Taylor: Fixed bug where first frame of data was
always overwritten with 0's. Thanks to 'gol'</li>
<li> <font color="#ff0000">Mark Taylor: bug fixes in mid/side
masking ratios (thanks to Menno Bakker)</font></li>
<li> Mark Taylor: replaced norm_l, norm_s table data with
formulas.</li>
</ul>
<h3> LAME 3.58beta December 13 1999</h3>
<ul>
<li> <font color="#ff0000">Segher Boessenkool: More accurate
quantization procedure! Enabled with -h.</font></li>
<li> <font color="#3366ff">Mathew Hendry, Acy Stapp and Takehiro
Tominaga: ASM optimizations for quantize_xrpow and quantize_xrpow_ISO.</font></li>
<li> Chuck Zenkus: "encoder inside" logo on web page</li>
<li> Mark Taylor: a couple people have asked for this.
Allow LAME to overide VBR_min_bitrate if analog_silence detected.
Analog_silence defined a la Robert: energy < ATH.</li>
<li> An Van Lam: Valid bitrates were being printed for layer 2,
not layer 3!</li>
<li> Ethan Yeo: Makefile.MSVC updated</li>
<li> Mark Stephens: updated all MSVC project files</li>
<li> Robert Hegemann: lowpass and highpass filters can be
enabled with --lowpass, --highpass</li>
<li> <font color="#ff0000">Mark Taylor: MS switching is now
smoother: ms_ratio average over 4 granules</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: Scalefactor
pre-emphasis fixed (and now turned back on)</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: Bug in M/S maskings:
switch to turn on stereo demasking code was buggy.</font></li>
</ul>
<h3> LAME 3.57beta November 22 1999</h3>
<ul>
<li> Sigbjørn Skjæret, patch to allow encoding from
8bit input files when using LIBSNDFILE</li>
<li> Mark Taylor: Automatic downsampling to nearest valid samplerate.</li>
<li> Mark Taylor: Scalefactor bands demarked on MDCT plot in frameanalyzer</li>
<li> Mark Taylor: Scalefactor preemphasis disabled for now.
The algorithm was often doing more harm than good.</li>
</ul>
<h3> LAME 3.56beta November 19 1999</h3>
<ul>
<li> Kimmo Mustonen: portabilty code cleanup.</li>
<li> Vladimir Marek: id3 genre patch.</li>
<li> Conrad Sanderson: new applypatch script.</li>
<li> Mark Taylor: Initial window type now "STOP_TYPE" to reduce
initial attenuation. This is needed because the new encoder delay
is so short. With a NORM_TYPE, the first 240 samples would be attenuated.</li>
<li> Mark Taylor: Padding at end of file now adjusted (hopefully!)
to produce as little padding as possible while still guarantee all input
samples are encoded.</li>
<li> <font color="#ff0000">Takehiro Tominaga: Reduced shortblock
extra bit allocation formulas by 10% since new huffman coding is at least
10% more efficient.</font></li>
</ul>
<h3> LAME 3.55beta November 11 1999</h3>
<ul>
<li> Albert Faber: updated BladeEnc.dll</li>
<li> Mark Taylor: Simple lowpass filter added to linear downsampling
routine.</li>
<li> Nils Faerber: updated man page.</li>
<li> Mark Taylor: All floating point variables are delcared FLOAT
or FLOAT8. Change the definition of FLOAT8 in machine.h to
run at 32bit preceision.</li>
<li> Mark Taylor: Bug (introduced in 3.54beta) in stereo->mono
downsampling fixed.</li>
</ul>
<h3> LAME 3.54beta November 8 1999</h3>
<ul>
<li> Mark Taylor: Encoder delay is now 48 samples. Can be adjusted
to 1160 to sync with FhG (see ENCDELAY in encoder.h) This is kind
of amazing, since if Takehiro put his MDCT/filterbank routine in a decoder,
we could have a total delay of only 96 samples.</li>
<li> <font color="#ff0000">Mark Taylor: More inconstancies found
and fixed in MPEG2 tables.</font></li>
<li> Mark Taylor: Resampling from an MP3 input file now works.
But we still dont have a lowpass filter so dont expect good results.</li>
</ul>
<h3> LAME 3.53beta November 8 1999</h3>
<ul>
<li> <font color="#3366ff">Takehiro Tominaga: Fixed MPEG2 problem
in new MDCT routines. Takehiro's combined filterbank/MDCT routine
is now the default. Removes all buffering from psymodel.c and the
filterbanks/MDCT routines.</font></li>
</ul>
<h3> LAME 3.52beta November 8 1999</h3>
<ul>
<li> By permission of copyright holders of all GPL code in LAME,
all GPL code is now released under a modified version of the LGPL (see
the README file)</li>
<li> By popular demand, all C++ comments changed to C style comments</li>
<li> Mark Taylor: Linear resampling now works. Use --resample
to set an output samplerate different from the input samplerate. (doesn't
seem to work with mp3 input files, and there is no lowpass filter, so dont
expect good results just yet)</li>
<li> <font color="#3366ff">Takehiro Tominaga: Faster Huffman
encoding routines</font></li>
</ul>
<font color="#3366ff">The following changes are disabled because of
MPEG2 problems. But to try them, set MDCTDELAY=48 in encoder.h, instead
of MDCTDELAY=528.:</font>
<ul>
<li> <font color="#3366ff">Takehiro Tominaga: New MDCT routines
with shorter delay (48 samples instead of 528) and even faster than the old
routines.</font></li>
<li> <font color="#3366ff">Takehiro Tominaga: Removed extra
buffering in psymodel.c</font></li>
</ul>
<h3> LAME 3.51 November 7 1999</h3>
<ul>
<li> Takehiro Tominaga: Bug in quantize.c absolute threshold of hearing
calculation for non-44.1 kHz input files.</li>
</ul>
<h3> LAME 3.50 November 1 1999</h3>
<ul>
<li> LAME 3.37beta becomes official LAME 3.50 release</li>
</ul>
<h3> LAME 3.37beta November 1 1999</h3>
<ul>
<li> <font color="#ff0000">Lionel Bonnet: Found severe bug
in MPEG2 Short block SNR.</font></li>
<li> Sergey Sapelin: VBR Toc improvement.</li>
<li> Sergey Dubov: fskip() routine</li>
<li> Conrad Sanderson: replacement for filterbank.c.
Not much faster but amazingly simpler.</li>
</ul>
<h3> LAME 3.36beta October 25 1999</h3>
<ul>
<li> Albert Faber: more MSVC and BladeDLL updates</li>
<li> Kimmo Mustonen: Much code cleanup and Amiga updates</li>
<li> Anton Oleynikov: Borland C updates</li>
<li> Mark Taylor: More stdin fixes: For some reason, forward
fseek()'s would fail when used on pipes even though it is okay with redirection
from "<". So I changed all the forward fseek()'s to use fread().
This should improve stdin support for wav/aiff files. If you know
the input file is raw pcm, you can still use the '-r' option to avoid *all*
seeking of any kind.</li>
<br>
</ul>
<h3> LAME 3.35beta October 21 1999</h3>
<ul>
<li> <font color="#ff0000">Leonid Kulakov: Serious bug in MPEG2
scalefactor band tables fixed.</font></li>
<li> Portability patches from: Anton Oleynikov, Sigbjørn
Skjæret, Mathew Hendry, Richard Gorton</li>
<li> Alfred Weyers: compiler options, updated timestatus.</li>
<li> Albert Faber: BladeDll and other updates (new machine.h).</li>
<li> Monty: updated Makefile to fix gcc inline math bug.</li>
<br>
</ul>
<h3> LAME 3.34beta October 12 1999</h3>
<ul>
<li> <font color="#ff0000">Mark Taylor: Bug fixed: minimum
bitrate in VBR mode could be ignored for a few frames.</font></li>
<li> <font color="#ff0000">Mark Taylor: New (minor) VBR tunings.</font></li>
<li> Tim Ruddick: New wav/aiff header parsing routines. Better
parsing and fewer fseek()'s.</li>
<li> Anton Oleynikov: patches to work with Borland C</li>
<li> <font color="#ff0000">Gabriel Bouvigne: Experimental
voice option enabled with --voice</font></li>
</ul>
<h3> LAME 3.33beta October 11 1999</h3>
<ul>
<li> <font color="#ff0000">Robert Hegemann: RH VBR mode now the default
and only VBR mode. The new code will always quantize to 0 distortion
and the quality is increased by reducing the masking from the psy-model.
-X0 is still the default for now.</font></li>
<li> <font color="#ff0000">Robert Hegemann: new -X5 mode</font></li>
<li> Mathew Hendry: New timing code, removes the need for HAVETIMES</li>
<li> <font color="#3366ff">Mathew Hendry: assembler quantize_xrpow
for Windows</font></li>
<li> Iwasa Kazmi: stdin/stdout patch for Windows</li>
<li> Mark Taylor: New option: "--athonly" will ignore the psy-model
output and use only the absolute threshold of hearing for the masking.</li>
<br>
</ul>
<h3> LAME 3.32beta October 8 1999</h3>
<ul>
<li> <font color="#3366ff">Takehiro Tominaga: faster long block
spreading function convolution for non 44.1 kHz sampling frequencies, and
faster short block spreading function convolution for all sampling frequencies.</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: Completly rewritten
huffman table selection and count_bits(). More efficient table selection
results in many more bits per frame.</font></li>
<li> <font color="#ff0000">Takehiro Tominaga: More efficient
scalefac compress setting.</font></li>
<li> <font color="#3366ff">Mike Cheng: new calc_noise2()</font></li>
<li> Alfred Weyers: patch for timestatus() seconds rollover</li>
<br>
</ul>
<h3> LAME 3.31beta September 28 1999</h3>
<ul>
<li> Albert Faber: updated his BladeDLL code. This allows
LAME to be compiled into a BladeEnc compatiable .dll.</li>
<li> <font color="#3366ff">Mike Cheng: faster l3psycho_ener() routine.</font></li>
<li> Sigbjørn Skjæret: more code cleanup.</li>
</ul>
<h3> LAME 3.30beta September 27 1999</h3>
<ul>
<li> Conrad Sanderson: ID3 tag code added (type 'lame' for
instructions)</li>
<li> new mdct.c from Mike Cheng (no faster, but much cleaner code)</li>
<li> Mathew Hendry: Microsoft nmake makefile and a couple other
changes for MSVC</li>
<li> More modulization work: One input sound file interface
handles mp3's, uncompressed audio, with or without LIBSNDFILE. Fixes
(hopefully) a bunch of file I/O bugs introduced in 3.29 (Mark Taylor)</li>
<li> LAME will now print valid samplerate/bitrate combinations (Mark
Taylor)</li>
<li> stdin/stdout fix for OS/2 (Paul Hartman)</li>
<li> For mp3 input files, totalframes estimated based on filesize
and first frame bitrate. (Mark Taylor)</li>
<li> Updated all functions with new style prototypes. (Sigbjørn
Skjæret)</li>
<br>
</ul>
<h3> LAME 3.29beta September 21 1999</h3>
<ul>
<li> <font color="#ff0000">Bug in bigv_bitcount fixed. Loop.c
was overestimating the number of bits needed, resulting in wasted bits every
frame. (Leonid A. Kulakov)</font></li>
<li> <font color="#ff0000">Bug in *_choose_table() fixed
These routines would not sellect the optimal Huffman table in some cases.
(Leonid A. Kulakov)</font></li>
<li> <font color="#ff0000">Tuning of ATH normalization (macik)</font></li>
<li> Removed unused variables and fixed function prototypes (Sigbjørn
Skjæret)</li>
<li> Sami Farin sent a .wav file that LAME built
in support choked on. I added a slightly more sophisticated
wav header parsing to handle this, but if you have trouble, use libsndfile.</li>
<li> Resampling hooks and options added. Buffering and resampling
routines need to be written.</li>
<li> LAME will now take an mp3 file as input. When resampling
code is working, LAME will be able to (for example) convert a high bitrate
stereo mp3 to a low bitrate mono mp3 for streaming.</li>
</ul>
<h3> LAME 3.28beta September 15 1999</h3>
<ul>
<li> <font color="#ff0000">Serious bug fixed in high frequency MDCT
coefficients. Huffman coding was reversing the order of the count1
block quadruples. (Leonid A. Kulakov)</font></li>
<li> nint() problems under Tru64 unix fixed and preprocessor variable
HAVE_NINT removed. (Bob Bell)</li>
<li> Compiler warning fixes and code cleanup (Sigbjørn
Skjæret, Lionel Bonnet)</li>
<li> USAGE file now includes suggestions for downsampling.
For low bitrate encodings, proper downsampling can give dramatically better
results. (John Hayward-Warburton)</li>
</ul>
<h3> LAME 3.27beta September 12 1999</h3>
<ul>
<li> Several bugs in encode.c and l3bitstream.c fixed by Lionel Bonnet.</li>
<li> Bugs in new VBR (#define RH) formula for mono input file and
mid/side encoding fixed.</li>
</ul>
<h3> LAME 3.26beta September 10 1999</h3>
<ul>
<li> The "-m m" option (mono .mp3 file) will automatically mix left
and right channels if the input file is stereo. (Alfred Weyers)</li>
<li> <font color="#ff0000">New quant_compare algorithm (method for
deciding which of two quantizations is better) enabled with -X4 (Greg Maxwell)</font></li>
<li> <font color="#ff0000">New mid/side VBR bit allocation formula.
Mid channel bits are set by the quality requirements, and then the side
channel uses a reduced number of bits (in a proportion coming from the fixed
bitrate code). This might not be optimal, but it should be pretty
good and no one knows what the optimal solution should be. (Greg Maxwell)</font></li>
<li> <font color="#ff0000">New VBR (#define RH) tunings based on
detailed listening tests by Macik and Greg Maxwell.</font></li>
<li> Sigbjørn Skjæret fixed several compiler warnings
(which turned out to be potential bugs)</li>
<li> Takehiro Tominaga fixed a low bitrate bug in reduce_side()</li>
<li> Alfred Weyers fixed some buffer overflows.</li>
<li> <font color="#ff0000">New ATH (absolute threshold of hearing)
formula replaces buggy ISO code, and adds analog silence treatment
(removal of coefficients below below ATH). These are turned
on by default but have not been fully tested. (Robert Hegemann)</font></li>
<li> <font color="#ff0000">Bug in short block spreading function
fixed. (Robert Hegemann)</font></li>
</ul>
<h3> LAME 3.25beta August 22 1999</h3>
<ul>
<li> Sigbjørn Skjæret fixed a zero byte malloc call.
This bug was introduced in 3.24 and causes problems on non Linux
systems.</li>
<li> Bit allocation routines would sometimes allocate more than
4095 bits to one channel of one granule. A couple of people reported
problems that might be caused by this, especially at higher bitrates.</li>
<li> Nils Faerber updated the man page and fixed many of the compiler
warnings.</li>
<br>
</ul>
<h3> LAME 3.24beta August 15 1999</h3>
<ul>
<li> This release contains the following new code (for developers)
which is disabled by default:</li>
<li> Robert Hegemann: Completely overhauled VBR code.
Now computes exact number of bits required for the given qualty and then
quantized with the appropriate bitrate.</li>
<li> Several new quantization quality measures.</li>
</ul>
<h3> LAME 3.23beta August 8 1999</h3>
<ul>
<li> Very nice continuously updated VBR histogram display from Iwasa
Kazmi. (disabled with --nohist).</li>
<li> More modulerization work. The encoding engine can now
be compiled into libmp3lame, but the interface is awkward.</li>
<li> <font color="#ff0000">Bug fixed in FFT Hann window formula
(Leonid A. Kulakov).</font></li>
<li> New LAME logo on the download page. Created by Chris
Michalisles.</li>
<li> <font color="#ff0000">Several VBR algorithm improvements from
Robert Hegemann. New quantization noise metrics and VBR quality measure
takes into account mid/side encoding. Should produce smaller files
with the same quality, especially when using jstereo.</font></li>
</ul>
<h3> LAME 3.22beta July 27 1999</h3>
<ul>
<li> Downsampling (stereo to mono) bug with MPEG2 fixed. (Mike
Oliphant)</li>
<li> Downsampling now merges L & R channels - before it only
took the L channel.</li>
<li> More modularization and code cleanup from Albert Faber and
myself.</li>
<li> Input filesize limit removed for raw pcm input files.
For other file types, LAME will still only read the first 2^32 samples, (27
hours of playing time at 44.1 kHz).</li>
<br>
</ul>
<h3> LAME 3.21beta July 26 1999</h3>
<ul>
<li> <font color="#ff0000">Correct Mid/Side masking thresholds for
JSTEREO mode! This is enabled with -h. It makes LAME
about 20% slower since it computes psycho-acoustics for L,R Mid and Side
channels.</font></li>
<li> <font color="#ff0000">"Analog silence" threshold added.
Keeps VBR from upping the bitrate during very quite passages. (Robert.Hegemann)</font></li>
<li> <font color="#ff0000">New VBR quality setting from Robert Hegemann.
It is based on the idea that distortion at lower bit rates sounds worse
than at higher bitrates, and so the allowed distortion (VBR quality setting)
is proportional to the bitrate. Because of this, default minimum bitrate
is now 32kbs.</font></li>
<li> <font color="#ff0000">Expermental subblock gain code enabled
with -Z.</font></li>
<li> New "-r" option for raw pcm input files. With -r, LAME
will not do any fseek()'s or look for wav and aiff headers on the input
file.</li>
<li> Bug fixes in mp3x (frame analyzer) for viewing frames near
end of the file.</li>
<li> Bug fixed to allow setting the sampling rate of raw pcm input
files.</li>
</ul>
<h3> LAME 3.20beta July 19 1999</h3>
<ul>
<li> Bug in get_audio.c fixed. Libsndfile wrappers would not
compile (Miguel Revilla Rodriguez)</li>
<li> Nils Faerber found some unitialized variables and some wierd
extranous computations in filter_subband, now fixed. This was causing
seg faults on some machines.</li>
<br>
</ul>
<h3> LAME 3.19beta July 18 1999</h3>
<ul>
<li> <font color="#ff0000">Oops! Robert Hegemann immediatly
found a bug in the new (old -Z option) quantization code. calc_noise1
was not returning tot_noise, so non ms-stereo frames were buggy.</font></li>
<br>
</ul>
<h3> LAME 3.18beta July 17 1999</h3>
<ul>
<li> <font color="#ff0000">Many psycho-acoustic bug fixes.
Dan Nelson discovered a bug in MPEG2: For short blocks, the code assumes
42 partition bands. MPEG1 sometimes has less, MPEG2 can have more.
In MPEG1, this bug would not have effected the output if your compiler initializes
static variables to 0 on creation. In MPEG2 it leads to array out-of-bounds
access errors. Finally, there was a related bug in MPEG1/MPEG2, short &
long blocks where the energy above 16 kHz was all added to partition band
0. (the lowest frequeny partition band!)</font></li>
<li> <font color="#ff0000">The -Z option (Gabriel Bouvigne's idea
of using total quantization noise to choose between two quantizations with
the same value of "over") is now the default. I believe this helps
remove the trilling sound in Jan's testsignal4.wav. The quality of
testsignal2.wav and testsignal4.wav are now better than Xing and getting
closer to FhG.</font></li>
<li> Bug fixes in frame & sample count for downsampling mode.
(ben "jacobs")</li>
<li> Patches to improve modulization. (ben "jacobs")</li>
</ul>
<h3> LAME 3.17beta July 11 1999</h3>
<ul>
<li> substantial code cleanup towards goal of making LAME more modular.</li>
</ul>
<h3> LAME 3.16beta July 11 1999</h3>
<ul>
<li> <font color="#ff0000">New tunings of window switching, and better
bit allocation based on pe. (Jan Rafaj. improves both testsignal2.wav
and testsignal4.wav).</font></li>
<li> <font color="#ff0000">Bug in mid/side quantization when side
channel was zero fixed. (Albert Faber)</font></li>
<li> Removed some extranous computations in l3psy.c (Robert Hegemann)</li>
<li> More detailed timing status info, including hours display.
(Sakari Ailus) and percentage indicator (Conrad Sanderson).</li>
<li> <font color="#3366ff">Window_subband and calc_noise1,calc_noise2
speedups. Quantize_xrpow speedup should be significant on non GNU/intel
systems. (Mike Cheng)</font></li>
<li> <font color="#3366ff">Better initial guess for VBR bitrate.
Should speed up VBR encoding. (Gabriel Bouvigne)</font></li>
<li> More advanced .wav header parsing. fixes bugs involving
click in first frame. (Robert.Hegemann)</li>
<li> Correct filesize and total frame computation when using LIBSNDFILE
(ben "jacobs")</li>
<li> Click in last frame (buffering problem) when using libsndfile
fixed.</li>
<li> Audio I/O code overhauled. There is now a uniform audio
i/o interface to libsndfile or the LAME built in wav/aiff routines.
All audio i/o code localized to get_audio.c.</li>
<br>
</ul>
<h3> LAME 3.15beta</h3>
<ul>
<li> times()/clock() problem fixed for non-unix OS. (Ben "Jacobs")</li>
<li> Fixed uninitialized pe[] when using fast mode. (Ben "Jacobs")</li>
</ul>
<h3> LAME 3.13 June 24 1999</h3>
<ul>
<li> Patches for BeOS from Gertjan van Ratingen.</li>
<li> Makefile info for OS/2 Warp 4.0 (from dink.org).</li>
<li> Status display now based on wall clock time, not cpu time.</li>
<li> mem_alloc no longer allocates twice as much memory as needed
(Jan Peman).</li>
</ul>
<h3> 3.12pre9</h3>
<ul>
<li> Updated BLADEDLL code to handle recent changes (Albert Faber).</li>
<li> Bug fixed in parsing options when not using GTK (Albert Faber).</li>
<li> <font color="#ff0000">MPEG2 Layer III psycho acoustics now
working.</font></li>
<li> <font color="#3366ff">Improved huffman encoding Chris Matrakidis.
(10% faster). I dont know how he finds these improvements!
LAME with full quality now encodes faster than real time on my PII 266.</font></li>
<li> Fixed time display when encoding takes more than 60 minutes.</li>
</ul>
<h3> 3.12pre8</h3>
<ul>
<li> <font color="#ff0000">New <a href="gpsycho/ms_stereo.html">mid/side
stereo</a> criterion. LAME will use mid/side stereo only when the
difference between L & R masking thresholds (averaged over all scalefactors)
is less then 5db. In several test samples it does a very good job mimicking
the FhG encoder.</font></li>
<li> <font color="#ff0000">Bug in mid/side stereo fixed: independent
variation of mid & side channel scalefactors disabled. Because
of the way outer_loop is currently coded, when encoding mid/side coefficietns
using left/right thresholds, you have to vary the scalefactors simultaneously.</font></li>
<li> <font color="#ff0000">Bug in side/mid energy ratio calculation
fixed. (Thanks to Robert Hegemann)</font></li>
<li> Default mode is stereo (not jstereo) if bitrate is chosen as
192kbs or higher. Tero Auvinen first pointed out that FhG seems to
think at 160kbs, their encoder is so good it doesn't need jstereo tricks.
Since LAME is not as good as FhG, I am going to claim that 192kbs LAME
is so good it doens't need jstereo tricks, and thus it is disabled by default.</li>
<li> WAV header parsing for big-endian machines, and automatic detection
of big-endian machines. (Thanks to Sigbjørn Skjæret).</li>
<li> added 56 sample delay to sync LAME with FhG.</li>
<li> MP3x (frame analyzer) can now handle MPEG2 streams.</li>
</ul>
<h3> 3.12pre7</h3>
<ul>
<li> MPEG2 layer III now working! lower bit rates (down to
8kbs) and 3 more sampling frequencies: 16000, 22050, 24000Hz. Quality
is poor - the psy-model does not yet work with these sampling frequencies.</li>
<li> Fixed "ERROR: outer_loop(): huff_bits < 0." bug when using
VBR.</li>
<li> bash and sh scripts to run LAME on multiple files now included.
(from Robert Hegemann and Gerhard Wesp respectively)</li>
<li> bug fix in encoding times for longer files from (Alvaro
Martinez Echevarria)</li>
<li> yet another segfault in the frame analyzer fixed.</li>
<li> ISO psy-model/bit allocation routines removed. This allowed
makeframe() to be made much simpler, and most of the complicated buffering
is now gone. Eventually I would like the encoding engine to be a stand
alone library.</li>
</ul>
<h3> 3.12pre6</h3>
<ul>
<li> <font color="#ff0000">Better VBR tuning. Find minimum
bitrate with distortion less than the allows maximum. A minimum bit
rate is imposed on frames with short blocks (where the measured distortion
can not be trusted). A minimum frame bitrate can be specified
with -b, default=64kbs.</font></li>
<li> <a href="http://www.zip.com.au/%7Eerikd/libsndfile">LIBSNDFILE</a>
support. With libsndfile, LAME can encode almost all sound formats.
Albert Faber did the work for this, including getting libsndfile running
under win32.</li>
<li> CRC checksum now working! (Thanks to Johannes Overmann
)</li>
<li> frame analyzer will now work with mono .mp3 files</li>
<li> <font color="#3366ff">more code tweeks from Jan Peman.</font></li>
<li> <font color="#3366ff">Compaq-Alpha(Linux) fixes and speedups
from Nils Faerber.</font></li>
<li> <font color="#3366ff">Faster bin_search_StepSize from Juha
Laukala.</font></li>
<li> <font color="#3366ff">Faster quantize() from Mike Cheng</font></li>
<li> <font color="#3366ff">Faster quantize_xrpow() from Chris Matrakidis.
xrpow_flag removed since this option is now on by default.</font></li>
<li> Fixed .wav header parsing from Nils Faerber.</li>
<li> Xing VBR frame info header code from Albert Faber.
"Xing" and "LAME 3.12" embedded in first frame.</li>
<li> <font color="#ff0000">Bug in VBR bit allocation based on "over"
value fixed.</font></li>
</ul>
<h3> LAME 3.11 June 3 1999</h3>
<blockquote> <li> Almost all warnings (-Wall) now fixed! (Thanks
to Jan Peman)</li>
<li> More coding improvements from Gabriel Bouvigne and Warren Toomey.</li>
<li> <font color="#ff0000">VBR (variable bit rate).
Increases bit rate for short blocks and for frames where the number of bands
containing audible distortion is greater than a given value. Much
tuning needs to be done.</font></li>
<li> Patch to remove all atan() calls from James Droppo.</li>
</blockquote>
<h3> LAME 3.10 May 30 1999</h3>
<ul>
<li> <font color="#3366ff">Fast mode (-f) disables psycho-acoustic
model for real time encoding on older machines. Thanks to Lauri Ahonen
who first sent a patch for this.</font></li>
<li> <font color="#ff0000">New bit reservoir usage scheme to accommodate
the new pre-echo detection formulas.</font></li>
<li> <font color="#ff0000">Tuning of AWS and ENER_AWS pre-echo
formulas by Gabriel Bouvigne and myself. They work great! now
on by default.</font></li>
<li> In jstereo, force blocktypes for left & right channels
to be identical. FhG seems to do this. It can be disabled with
"-d".</li>
<li> Patches to compile MP3x under win32 (Thanks to Albert Faber).</li>
<li> <font color="#3366ff">bin_serach_stepsize limited to a quantizationStepSize
of -210 through 45.</font></li>
<li> <font color="#ff0000">outer_loop() will now vary Mid
& Side scalefactors independently. Can lead to better quantizations,
but it is slower (twice as many quantizations to look at). Running
with "-m f" does not need this and will run at the old speed</font></li>
<li> <font color="#ff0000">Bug in inner_loop would allow quantizations
larger than allowed. (introduced in lame3.04, now fixed.)</font></li>
<li> Updated HTML documentation from Gabriel Bouvigne.</li>
<li> Unix man page from William Schelter.</li>
<li> <font color="#ff0000">numlines[] bug fixed. (Thanks
to Rafael Luebbert, MPecker author).</font></li>
<li> <font color="#3366ff">Quantization speed improvements from
Chirs Matrakidis.</font></li>
<li> <font color="#ff0000">When comparing quantizations with the
same number of bands with audible distortion, use the one with the largest
scalefactors, not the first one outer_loop happened to find.</font></li>
<li> Improved defination of best quantization when using -f (fast
mode).</li>
<li> subblock code now working. But no algorithm to choose
subblock gains yet.</li>
<li> Linux now segfaults on floating point exceptions. Should
prevent me from releasing binaries that crash on other operating systems.</li>
</ul>
<h4> May 22 1999</h4>
<ul>
<li> Version 3.04 released.</li>
<li> Preliminary documentation from Gabriel Bouvigne.</li>
<li> <font color="#3366ff">I wouldn't have thought it was possible,
but now there are even more speed improvements from Chris Matrakidis!
Removed one FFT when using joint stereo, and many improvements in loop.c.</font></li>
<li> "Fake" ms_stereo mode renamed "Force" ms_stereo since it
forces mid/side stereo on all frames. For some music this is said
to be a problem, but for most music mode is probably better than the default
jstereo because it uses specialized mid/side channel masking thresholds.</li>
<li> Small bugs in Force ms_stereo mode fixed.</li>
<li> Compaq Alpha fixes from Nathan Slingerland.</li>
<li> <font color="#ff0000">Some new experimental pre-echo detection
formulas in l3psy.c (#ifdef AWS and #ifdef ENER_AWS, both off by default.
Thanks to Gabriel Bouvigne and Andre Osterhues)</font></li>
<li> Several bugs in the syncing of data displayed by mp3x (the
frame analyzer) were fixed.</li>
<li> highq (-h) option added. This turns on things (just
one so far) that should sound better but slow down LAME.</li>
</ul>
<b>May 18 1999</b>
<ul>
<li> Version 3.03 released.</li>
<li> <font color="#3366ff">Faster (20%) & cleaner FFT (Thanks
to Chris Matrakidis http://www.geocities.com/ResearchTriangle/8869/fft_summary.html)</font></li>
<li> mods so it works with VC++ (Thanks to Gabriel Bouvigne, www.mp3tech.org)</li>
<li> MP3s marked "original" by default (Thanks to Gabriel
Bouvigne, www.mp3tech.org)</li>
<li> Can now be compiled into a BladeEnc compatible .DLL
(Thanks to Albert Faber, CDex author)</li>
<li> Patches for "silent mode" and stdin/stdout (Thanks
to Lars Magne Ingebrigtsen)</li>
<li> <font color="#ff0000">Fixed rare bug: if a long_block is
sandwiched between two short_blocks, it must be changed to a short_block,
but the short_block ratios have not been computed in l3psy.c. Now
always compute short_block ratios just in case.</font></li>
<li> <font color="#ff0000">Fixed bug with initial quantize step
size when many coefficients are zero. (Thanks to Martin Weghofer).</font></li>
<li> Bug fixed in MP3x display of audible distortion.</li>
<li> improved status display (Thanks to Lauri Ahonen).</li>
</ul>
<h4> May 12 1999</h4>
<ul>
<li> Version 3.02 released.</li>
<li> <font color="#ff0000">encoder could use ms_stereo even if
channel 0 and 1 block types were different. (Thanks to Jan Rafaj)</font></li>
<li> <font color="#ff0000">added -k option to disable the 16 kHz
cutoff at 128kbs. This cutoff is never used at higher bitrates. (Thanks
to Jan Rafaj)</font></li>
<li> <font color="#ff0000">modified pe bit allocation formula
to make sense at bit rates other than 128kbs.</font></li>
<li> fixed l3_xmin initialization problem which showed up under
FreeBSD. (Thanks to Warren Toomey)</li>
</ul>
<b>May 11 1999</b>
<ul>
<li> Version 3.01 released</li>
<li> max_name_size increased to 300 (Thanks to Mike Oliphant)</li>
<li> patch to allow seeks on input file (Thanks to Scott Manley)</li>
<li> fixes for mono modes (Thanks to everyone who pointed this
out)</li>
<li> overflow in calc_noise2 fixed</li>
<li> bit reservoir overflow when encoding lots of frames with
all zeros (Thanks to Jani Frilander)</li>
</ul>
<p><br>
<b>May 10 1999</b> </p>
<ul>
<li> Version 3.0 released</li>
<li> <font color="#ff0000">added GPSYCHO (developed by Mark Taylor)</font></li>
<li> <font color="#000000">added MP3x (developed by Mark Taylor)</font></li>
<li> LAME now maintained by Mark Taylor</li>
</ul>
<b>November 8 1998</b>
<ul>
<li> Version 2.1f released</li>
<li> 50% faster filter_subband() routine in encode.c contributed
by James Droppo</li>
</ul>
<b>November 2 1998</b>
<ul>
<li> Version 2.1e released.</li>
<li> New command line switch <b>-a</b> auto-resamples a stereo
input file to mono.</li>
<li> New command line switch <b>-r</b> resamples from 44.1 kHz
to 32 kHz [this switch doesn't work really well. Very tinny sounding output
files. Has to do with the way I do the resampling probably]</li>
<li> Both of these were put into the ISO code in the encode.c
file, and are simply different ways of filling the input buffers from a
file.</li>
</ul>
<b>October 31 1998</b>
<ul>
<li> Version 2.1d released</li>
<li> Fixed memory alloc in musicin.c (for l3_sb_sample)</li>
<li> Added new command line switch (-x) to force swapping of byte
order</li>
<li> Cleaned up memory routines in l3psy.c. All the mem_alloc()
and free() routines where changed so that it was only done <i>once</i> and
not every single time the routine was called.</li>
<li> Added a compile time switch -DTIMER that includes all timing
info. It's a switch for the time being until some other people have tested
on their system. Timing code has a tendency to do different things on different
platforms.</li>
</ul>
<b>October 18 1998</b>
<ul>
<li> Version 2.1b released.</li>
<li> Fixed up bug: all PCM files were being read as WAV.</li>
<li> Played with the mem_alloc routine to fix crash under amigaos
(just allocating twice as much memory as needed). Might see if we can totally
do without this routine. Individual malloc()s where they are needed instead</li>
<li> Put Jan Peman's quality switch back in. This reduces quality
via the '-q <int>' switch. Fun speedup which is mostly harmless if you're
not concerned with quality.</int></li>
<li> Compiling with amiga-gcc works fine</li>
</ul>
<b>October 16 1998</b>
<ul>
<li> Version 2.1a released. User input/output has been cleaned
up a bit. WAV file reading is there in a very rudimentary sense ie the program
will recognize the header and skip it, but not read it. The WAV file is assumed
to be 16bit stereo 44.1 kHz.</li>
</ul>
<b>October 6 1998</b>
<ul>
<li> Version 2.1 released with all tables now incorporated into
the exe. Thanks to <b>Lars Magne Ingebrigtseni</b>(larsi@ifi.uio.no)</li>
</ul>
<b>October 4 1998</b>In response to some concerns about the quality
of the encoder, I have rebuilt the encoder from scratch and carefully compared
output at all stages with the output of the unmodified ISO encoder. <a
href="http://www.uq.net.au/%7Ezzmcheng/lame/download.html"> Version2.0</a>
of LAME is built from the ISO source code (dist10), and incorporates modifications
from myself and the 8hz effort. The output file from LAME v2.0 is <i>identical</i>
to the output of the ISO encoder for my test file.Since I do not have
heaps of time, I left the ISO AIFF file reader in the code, and did not
incorporate a WAV file reader.Added section on <a
href="http://www.uq.net.au/%7Ezzmcheng/lame/quality.html"> quality</a><b>
October 1 1998</b>
<ul>
<li> Updated web page and released LAME v1.0</li>
</ul>
<b>Up to September 1998</b>
<ul>
Working on the 8hz source code...
<ul>
<li> Patched the <a href="http://www.8hz.com/">8hz</a> source
code</li>
<li> 45% faster than original source (on my freebsd p166).</li>
<ul>
<li> m1 - sped up the mdct.c and quantize() functions [MDCTD,
MDCTD2, LOOPD]</li>
<li> m2 - sped up the filter_subband routine using <b>Stephane
Tavenard</b> 's work from musicin [FILTST]</li>
<li> m2 - minor cleanup of window_subband [WINDST2]</li>
<li> m2 - Cleaned up a few bits in l3psy.c. Replaced a sparse
matrix multiply with a hand configured unrolling [PSYD]</li>
<li> m3 - (amiga only) Added in the asm FFT for m68k (based
on sources from <b>Henryk Richter</b> and <b>Stephane Tavenard</b>)</li>
<li> m4 - raw pcm support back in</li>
<li> m5 - put in a byte-ordering switch for raw PCM reading
(just in case)</li>
<li> m6 - reworked the whole fft.c file. fft now 10-15% faster.</li>
<li> m7 - totally new fft routine. exploits fact that this
is a real->complex fft. About twice as fast as previous fastest fft (in
m6). (C fft routine is faster than the asm one on an m68k!)</li>
<li> m8</li>
<ul>
<li> - Now encodes from stdin. Use '-' as the input filename.
Thanks to <b>Brad Threatt</b></li>
<li> - Worked out that the 1024point FFT only ever uses
the first 6 phi values, and the first 465 energy values. Saves a bunch of
calculations.</li>
<li> - Added a speed-up/quality switch. Speed is increased
but quality is decreased <i>slightly</i>. My ears are bad enough not to be
able to notice the difference in quality at low settings :). Setting '-q
1' improves speed by about 10%. '-q 100' improves speed by about 26%. Enoding
of my test track goes from 111s (at default '-q 0') to 82s (at -q 100).
Thanks to <b> Jan Peman</b> for this tip.</li>
</ul>
<li> m9 - fixed an error in l3psy.c. numlines[] is overwritten
with incorrect data. Added a new variable numlines_s[] to fix this. Thanks
again to <b>Jan Peman</b>.</li>
<li> m10 - Down to 106 seconds by selecting a few more compiler
options. Also added a pow20() function in l3loop.c to speed up (ever so slightly)
calls to pow(2.0, x)</li>
<li> m11</li>
<ul>
<li> No speedups. Just cleaned up some bits of the code.</li>
<li> Changed K&R prototyping to 'normal' format. Thanks
to <b>Steffan Haeuser</b> for his help here.</li>
<li> Changed some C++ style comments to normal C comments
in huffman.c</li>
<li> Removed the #warning from psy_data.h (it was getting
annoying!)</li>
<li> Removed reference in bitstream.c to malloc.h. Is there
a system left where malloc.h hasn't been superceded by stdlib.h?</li>
</ul>
<li> In Progess:</li>
<ul>
<li> my PSYD hack for the spreading functions is only valid
for 44.1 kHz - Should really put in a "if freq = 44.1 kHz" switch for it.
Someone might want to extend the speedup for 48 and 32 kHz.</li>
<li> Putting in Jan Peman's quantanf_init speedup.</li>
</ul>
</ul>
</ul>
</ul>
</body>
</html>
| petterreinholdtsen/cinelerra-hv | quicktime/thirdparty/lame-3.93.1/doc/html/history.html | HTML | gpl-2.0 | 74,810 |
<?php
/**
* @package WordPress
* @subpackage Your Inspiration Themes
*/
global $is_primary;
if ( ! class_exists( 'RevSlider' ) ) return;
$sliderID = $this->get('slider_name');
$the_slider = new RevSlider();
$the_slider->initByMixed($sliderID);
$slider_class = '';
$slider_class .= yit_slide_get('align') != '' ? ' align' . yit_slide_get('align') : '';
$slider_class .= ' ' . $the_slider->getParam('slider_type');
$is_fixed = false;
if ( ! $is_primary && in_array( $the_slider->getParam('slider_type'), array( 'fixed', 'responsitive' ) ) ) $is_fixed = true;
if ( $is_fixed && ! has_action( 'yit_after_header', 'yit_slider_space' ) ) add_action( 'yit_after_header', 'yit_slider_space' );
// text align
$slider_text = yit_slide_get( 'slider_text' );
if ( $is_primary && $the_slider->getParam('slider_type') == 'fullwidth' ) $slider_text = '';
if ( !empty( $slider_text ) ) $slider_class .= ' align' . ( yit_slide_get( 'slider_align' ) == 'left' ? 'right' : 'left' );
?>
<!-- START SLIDER -->
<div class="revolution-wrapper<?php if ( $the_slider->getParam('slider_type') != 'fullwidth' ) echo ' container'; ?>">
<div id="<?php echo $slider_id ?>"<?php yit_slider_class($slider_class) ?>>
<div class="shadowWrapper">
<?php echo do_shortcode('[rev_slider ' . yit_slide_get( 'slider_name' ) . ']'); ?>
</div>
</div>
<?php if ( !empty( $slider_text ) ) : ?>
<div class="revolution-slider-text">
<?php echo yit_clean_text( $slider_text ) ?>
</div>
<div class="clear"></div>
<?php endif; ?>
</div>
<!-- END SLIDER --> | dinhtuan0108/nkhn | wp-content/themes/room09/theme/templates/sliders/revolution-slider/slider.php | PHP | gpl-2.0 | 1,645 |
<?php
namespace Drupal\Tests\facets\Unit\Plugin\processor;
use Drupal\facets\Entity\Facet;
use Drupal\facets\Plugin\facets\processor\ListItemProcessor;
use Drupal\facets\Result\Result;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\UnitTestCase;
use Drupal\Core\Config\ConfigManager;
/**
* Unit test for processor.
*
* @group facets
*/
class LimitItemProcessorTest extends UnitTestCase {
/**
* The processor to be tested.
*
* @var \Drupal\facets\processor\BuildProcessorInterface
*/
protected $processor;
/**
* An array containing the results before the processor has ran.
*
* @var \Drupal\facets\Result\Result[]
*/
protected $originalResults;
/**
* Creates a new processor object for use in the tests.
*/
protected function setUp() {
parent::setUp();
$this->originalResults = [
new Result(1, 1, 10),
new Result(2, 2, 5),
new Result(3, 3, 15),
];
$config_manager = $this->getMockBuilder(ConfigManager::class)
->disableOriginalConstructor()
->getMock();
$processor_id = 'list_item';
$this->processor = new ListItemProcessor([], $processor_id, [], $config_manager);
}
/**
* Tests facet build method.
*/
public function testNoFilter() {
$field = $this->getMockBuilder(FieldStorageConfig::class)
->disableOriginalConstructor()
->getMock();
$field->expects($this->at(0))
->method('getSetting')
->with('allowed_values_function')
->willReturn('');
$field->expects($this->at(1))
->method('getSetting')
->with('allowed_values')
->willReturn([1 => 'llama', 2 => 'badger', 3 => 'kitten']);
$config_manager = $this->getMockBuilder(ConfigManager::class)
->disableOriginalConstructor()
->getMock();
$config_manager->expects($this->any())
->method('loadConfigEntityByName')
->willReturn($field);
$processor_id = 'list_item';
$processor = new ListItemProcessor([], $processor_id, [], $config_manager);
$facet = new Facet([], 'facet');
$facet->setFieldIdentifier('test_facet');
$facet->setResults($this->originalResults);
$facet->addProcessor([
'processor_id' => 'list_item',
'weights' => [],
'settings' => [],
]);
/** @var \Drupal\facets\Result\Result[] $sorted_results */
$sorted_results = $processor->build($facet, $this->originalResults);
$this->assertCount(3, $sorted_results);
$this->assertEquals('llama', $sorted_results[0]->getDisplayValue());
$this->assertEquals('badger', $sorted_results[1]->getDisplayValue());
$this->assertEquals('kitten', $sorted_results[2]->getDisplayValue());
}
/**
* Tests configuration.
*/
public function testConfiguration() {
$config = $this->processor->defaultConfiguration();
$this->assertEquals([], $config);
}
/**
* Tests testDescription().
*/
public function testDescription() {
$this->assertEquals('', $this->processor->getDescription());
}
/**
* Tests isHidden().
*/
public function testIsHidden() {
$this->assertEquals(FALSE, $this->processor->isHidden());
}
/**
* Tests isLocked().
*/
public function testIsLocked() {
$this->assertEquals(FALSE, $this->processor->isLocked());
}
}
| quitedensepoint/Devel1 | modules/modified_contrib/facets/tests/src/Unit/Plugin/processor/LimitItemProcessorTest.php | PHP | gpl-2.0 | 3,285 |
/*
* arch/arm/include/asm/pgtable-2level.h
*
* Copyright (C) 1995-2002 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ASM_PGTABLE_2LEVEL_H
#define _ASM_PGTABLE_2LEVEL_H
/*
* Hardware-wise, we have a two level page table structure, where the first
* level has 4096 entries, and the second level has 256 entries. Each entry
* is one 32-bit word. Most of the bits in the second level entry are used
* by hardware, and there aren't any "accessed" and "dirty" bits.
*
* Linux on the other hand has a three level page table structure, which can
* be wrapped to fit a two level page table structure easily - using the PGD
* and PTE only. However, Linux also expects one "PTE" table per page, and
* at least a "dirty" bit.
*
* Therefore, we tweak the implementation slightly - we tell Linux that we
* have 2048 entries in the first level, each of which is 8 bytes (iow, two
* hardware pointers to the second level.) The second level contains two
* hardware PTE tables arranged contiguously, preceded by Linux versions
* which contain the state information Linux needs. We, therefore, end up
* with 512 entries in the "PTE" level.
*
* This leads to the page tables having the following layout:
*
* pgd pte
* | |
* +--------+
* | | +------------+ +0
* +- - - - + | Linux pt 0 |
* | | +------------+ +1024
* +--------+ +0 | Linux pt 1 |
* | |-----> +------------+ +2048
* +- - - - + +4 | h/w pt 0 |
* | |-----> +------------+ +3072
* +--------+ +8 | h/w pt 1 |
* | | +------------+ +4096
*
* See L_PTE_xxx below for definitions of bits in the "Linux pt", and
* PTE_xxx for definitions of bits appearing in the "h/w pt".
*
* PMD_xxx definitions refer to bits in the first level page table.
*
* The "dirty" bit is emulated by only granting hardware write permission
* iff the page is marked "writable" and "dirty" in the Linux PTE. This
* means that a write to a clean page will cause a permission fault, and
* the Linux MM layer will mark the page dirty via handle_pte_fault().
* For the hardware to notice the permission change, the TLB entry must
* be flushed, and ptep_set_access_flags() does that for us.
*
* The "accessed" or "young" bit is emulated by a similar method; we only
* allow accesses to the page if the "young" bit is set. Accesses to the
* page will cause a fault, and handle_pte_fault() will set the young bit
* for us as long as the page is marked present in the corresponding Linux
* PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
* up to date.
*
* However, when the "young" bit is cleared, we deny access to the page
* by clearing the hardware PTE. Currently Linux does not flush the TLB
* for us in this case, which means the TLB will retain the transation
* until either the TLB entry is evicted under pressure, or a context
* switch which changes the user space mapping occurs.
*/
#ifdef CONFIG_TIMA_RKP
#include <asm/tlbflush.h>
#include <asm/cp15.h>
#endif
#define PTRS_PER_PTE 512
#define PTRS_PER_PMD 1
#define PTRS_PER_PGD 2048
#define PTE_HWTABLE_PTRS (PTRS_PER_PTE)
#define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t))
#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32))
/*
* PMD_SHIFT determines the size of the area a second-level page table can map
* PGDIR_SHIFT determines what a third-level page table entry can map
*/
#define PMD_SHIFT 21
#define PGDIR_SHIFT 21
#define PMD_SIZE (1UL << PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE-1))
#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
#define PGDIR_MASK (~(PGDIR_SIZE-1))
/*
* section address mask and size definitions.
*/
#define SECTION_SHIFT 20
#define SECTION_SIZE (1UL << SECTION_SHIFT)
#define SECTION_MASK (~(SECTION_SIZE-1))
/*
* ARMv6 supersection address mask and size definitions.
*/
#define SUPERSECTION_SHIFT 24
#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
/*
* "Linux" PTE definitions.
*
* We keep two sets of PTEs - the hardware and the linux version.
* This allows greater flexibility in the way we map the Linux bits
* onto the hardware tables, and allows us to have YOUNG and DIRTY
* bits.
*
* The PTE table pointer refers to the hardware entries; the "Linux"
* entries are stored 1024 bytes below.
*/
#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7)
#define L_PTE_USER (_AT(pteval_t, 1) << 8)
#define L_PTE_XN (_AT(pteval_t, 1) << 9)
#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
#define L_PTE_NONE (_AT(pteval_t, 1) << 11)
/*
* These are the memory types, defined to be compatible with
* pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
*/
#define L_PTE_MT_UNCACHED (_AT(pteval_t, 0x00) << 2) /* 0000 */
#define L_PTE_MT_BUFFERABLE (_AT(pteval_t, 0x01) << 2) /* 0001 */
#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2) /* 0010 */
#define L_PTE_MT_WRITEBACK (_AT(pteval_t, 0x03) << 2) /* 0011 */
#define L_PTE_MT_MINICACHE (_AT(pteval_t, 0x06) << 2) /* 0110 (sa1100, xscale) */
#define L_PTE_MT_WRITEALLOC (_AT(pteval_t, 0x07) << 2) /* 0111 */
#define L_PTE_MT_DEV_SHARED (_AT(pteval_t, 0x04) << 2) /* 0100 */
#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
#define L_PTE_MT_VECTORS (_AT(pteval_t, 0x0f) << 2) /* 1111 */
#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
#ifndef __ASSEMBLY__
/*
* The "pud_xxx()" functions here are trivial when the pmd is folded into
* the pud: the pud entry is never bad, always exists, and can't be set or
* cleared.
*/
#define pud_none(pud) (0)
#define pud_bad(pud) (0)
#define pud_present(pud) (1)
#define pud_clear(pudp) do { } while (0)
#define set_pud(pud,pudp) do { } while (0)
static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
{
return (pmd_t *)pud;
}
#define pmd_bad(pmd) (pmd_val(pmd) & 2)
#ifdef CONFIG_TIMA_RKP_L1_TABLES
#ifndef rkp_call
#ifdef CONFIG_HYP_RKP
#define rkp_call "hvc #10\n"
asm(".arch_extension virt");
#else
#define rkp_call "smc #10\n"
asm(".arch_extension sec\n");
#endif
#endif //CONFIG_HYP_RKP
#endif
extern int boot_mode_security;
#ifdef CONFIG_TIMA_RKP_L1_TABLES
static inline void copy_pmd(pmd_t *pmdpd, pmd_t *pmdps)
{
if (boot_mode_security) {
unsigned long cmd_id = 0x83809000;
unsigned long tima_wr_out;
cpu_dcache_clean_area(pmdpd, 8);
__asm__ __volatile__ (
"stmfd sp!,{r0-r4}\n"
"mov r2, r0\n" /* useless here for backward compatible reason */
"mov r0, %1\n"
"mov r1, %2\n"
"mov r3, %3\n"
"mov r4, %4\n"
"mcr p15, 0, r1, c7, c14, 1\n"
"add r1, r1, #4\n"
"mcr p15, 0, r1, c7, c14, 1\n"
"dsb\n"
rkp_call
// "mcr p15, 0, r1, c7, c10, 1\n"
// "sub r1, r1, #4\n"
// "mcr p15, 0, r1, c7, c10, 1\n"
// "dsb\n"
"mov r0, #0\n"
"mcr p15, 0, r0, c8, c3, 0\n"
"dsb\n"
"isb\n"
"ldmfd sp!, {r0-r4}\n"
:"=r"(tima_wr_out):"r"(cmd_id),"r"((unsigned long)pmdpd),"r"(pmdps[0]),"r"(pmdps[1]):"r0","r1","r2","r3","r4","cc");
flush_pmd_entry(pmdpd);
} else {
do {
pmdpd[0] = pmdps[0];
pmdpd[1] = pmdps[1];
flush_pmd_entry(pmdpd);
} while (0);
}
}
#else
#define copy_pmd(pmdpd,pmdps) \
do { \
pmdpd[0] = pmdps[0]; \
pmdpd[1] = pmdps[1]; \
flush_pmd_entry(pmdpd); \
} while (0)
#endif
#ifdef CONFIG_TIMA_RKP_L1_TABLES
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
asm(".arch_extension virt");
#endif
#endif
#ifdef CONFIG_TIMA_RKP
extern void cpu_v7_tima_iommu_opt(unsigned long start,
unsigned long end, unsigned long pgd);
#endif
#ifdef CONFIG_TIMA_RKP_L1_TABLES
static inline void pmd_clear(pmd_t *pmdp)
{
if (boot_mode_security) {
unsigned long cmd_id = 0x8380a000;
unsigned long tima_wr_out;
cpu_dcache_clean_area(pmdp, 8);
__asm__ __volatile__ (
"stmfd sp!,{r0-r2}\n"
"mov r2, r0\n"
"mov r0, %1\n"
"mov r1, %2\n"
"mcr p15, 0, r1, c7, c14, 1\n"
"add r1, r1, #4\n"
"mcr p15, 0, r1, c7, c14, 1\n"
"dsb\n"
rkp_call
// "mcr p15, 0, r1, c7, c10, 1\n"
// "sub r1, r1, #4\n"
// "mcr p15, 0, r1, c7, c10, 1\n"
// "dsb\n"
"mov r0, #0\n"
"mov %0, r0\n"
"mcr p15, 0, r0, c8, c3, 0\n"
"dsb\n"
"isb\n"
"ldmfd sp!, {r0-r2}\n"
:"=r"(tima_wr_out):"r"(cmd_id),"r"((unsigned long)pmdp):"r0","r1","r2","cc");
clean_pmd_entry(pmdp);
} else {
do {
pmdp[0] = __pmd(0);
pmdp[1] = __pmd(0);
clean_pmd_entry(pmdp);
} while (0);
}
}
#else
#define pmd_clear(pmdp) \
do { \
pmdp[0] = __pmd(0); \
pmdp[1] = __pmd(0); \
clean_pmd_entry(pmdp); \
} while (0)
#endif
#ifdef CONFIG_TIMA_RKP_L2_GROUP
extern int cpu_v7_timal2group_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext,
unsigned long tima_l2group_entry_ptr);
extern void cpu_v7_timal2group_set_pte_commit(void *tima_l2group_entry_ptr,
unsigned long tima_l2group_entries_count);
#endif /* CONFIG_TIMA_RKP_L2_GROUP */
/* we don't need complex calculations here as the pmd is folded into the pgd */
#define pmd_addr_end(addr,end) (end)
#ifdef CONFIG_RKP_DBLMAP_PROT
#define RAM_SIZE (0xbfffffffUL)
//the space is reserved in vmlinux.lds.S
extern u8 rkp_double_bitmap[];
static u8 rkp_is_pg_double_mapped(unsigned long pa)
{
unsigned long addr, bit_index, u8_index;
u8 val;
if (pa < PHYS_OFFSET){ return 0; }
addr = pa - PHYS_OFFSET;
bit_index = (addr>>PAGE_SHIFT);
u8_index = bit_index >> 3;
//larger than bit map size, ignore
if (u8_index >= 0x18000) { return 0; }
val = (((rkp_double_bitmap[u8_index]) & (1<< (bit_index % 8)))?1:0);
if(val){
printk("DBLMAP pa=0x%08lx, pa-PHYS_OFFSET=0x%08lx\n", pa, addr);
printk("DBLMAP bitmap=0x%08lx, byte addr=0x%08lx, byte val=0x%02x\n",
(unsigned long)rkp_double_bitmap,
(unsigned long) (&rkp_double_bitmap[u8_index]),
rkp_double_bitmap[u8_index]);
}
return val;
}
#endif
#ifdef CONFIG_TIMA_RKP_L2_TABLES
static inline void set_pte_ext(pte_t *ptep,pte_t pte,unsigned int ext)
{
if(!(boot_mode_security)){
cpu_set_pte_ext(ptep,pte,ext);
return;
}
if (tima_is_pg_protected((unsigned long) ptep) == 0)
cpu_set_pte_ext(ptep,pte,ext);
else
cpu_tima_set_pte_ext(ptep,pte,ext);
}
#else
#ifdef CONFIG_RKP_DBLMAP_PROT
static inline void set_pte_ext(pte_t *ptep,pte_t pte,unsigned int ext){
if (rkp_is_pg_double_mapped((u32)pte)) {
panic("\n Trying to double map the page \n");
return;
}
cpu_set_pte_ext(ptep,pte,ext);
}
#else
#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
#endif
#endif
#ifdef CONFIG_TIMA_RKP_LAZY_MMU
#define TIMA_LAZY_MMU_CMDID 0x25
#define TIMA_LAZY_MMU_START 0
#define TIMA_LAZY_MMU_STOP 1
#endif
#endif /* __ASSEMBLY__ */
#endif /* _ASM_PGTABLE_2LEVEL_H */
| Hani-K/H-Vitamin2_trelte | arch/arm/include/asm/pgtable-2level.h | C | gpl-2.0 | 11,401 |
package org.talend.map.output;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class tHDFSOutput_2StructOutputFormat extends
FileOutputFormat<NullWritable, row5Struct> {
private Path getCustomWorkFile(TaskAttemptContext context, String extension) throws IOException{
FileOutputCommitter committer =
(FileOutputCommitter) getOutputCommitter(context);
Path basePath = committer.getWorkPath();
System.out.println("committer path ="+basePath + "===============");
Path outPath = new Path(new Path("/user/wliu/multiple/out/out2"), getUniqueFile(context,
getOutputName(context), extension));
return outPath;
}
@Override
public RecordWriter<NullWritable, row5Struct> getRecordWriter(
TaskAttemptContext job) throws IOException, InterruptedException {
Path output = FileOutputFormat.getOutputPath(job);
FileSystem fs = output.getFileSystem(job.getConfiguration());
System.out.println("==========start==============" +output.toString());
String extension = "";
Path file = getDefaultWorkFile(job, extension);
// fs.delete(output, true);
System.out.println("==========start========multipleoutputs======" +file.toString());
Path output5 = new Path("/user/wliu/multiple/out/out2");
DataOutputStream out = fs.create(getCustomWorkFile(job,""), false);
System.out.println("==========end==============");
return new row5HDFSRecordWriter(out);
}
} | wliu-talend/org.wliu.mr.demo | src/main/java/org/talend/map/output/tHDFSOutput_2StructOutputFormat.java | Java | gpl-2.0 | 1,786 |
require 'spec_helper'
describe 'spotlights requests' do
context ( 'waku' ) {
context ( 'user spotlight' ) {
let ( :u ) { User.first }
describe ( 'post /users/:id/spotlights' ) {
before {
post "#{user_spotlights_path( user_id: u.id )}.json", spotlight: {
title: 'user spotlight',
privacy: 'private',
body: 'body',
waku_id: 523,
waku_url: 'waku.com/523'
}
}
it {
puts page.source
page.status_code.should eq( 200 )
}
}
}
}
end
| hey-krys/curarium | spec/requests/spotlights_spec.rb | Ruby | gpl-2.0 | 590 |
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"
#define Strategy "Popcachestat"
#define CS_Capacity "100"
#define Capacity "10000"
#define Alpha "1.0"
#define Rate "200"
#define suffix Strategy"-"Capacity"-"CS_Capacity"-"Rate"-"Alpha".txt"
#define aggregate_trace "result/aggregate-trace-"suffix
#define rate_trace "result/rate-trace-"suffix
#define cs_trace "result/cs-trace-"suffix
#define app_delays_trace "result/app-delays-trace-"suffix
#define drop_trace "result/drop-trace-"suffix
#define cs_index "result/cs-index-"suffix
using namespace ns3;
void
PeriodicStatsPrinter (Ptr<Node> node, Time next)
{
Ptr<ndn::ContentStore> cs = node->GetObject<ndn::ContentStore> ();
Ptr<ns3::ndn::cs::Entry> item = cs -> Begin();
std::ofstream of(cs_index, std::ios::app);
while(item)
{
of << Simulator::Now ().ToDouble (Time::S) << "\t"
<< node->GetId () << "\t"
<< Names::FindName (node) << "\t"
<< item->GetName () << "\n";
item = cs -> Next(item);
}
of.flush();
of.close();
Simulator::Schedule (next, PeriodicStatsPrinter, node, next);
}
int
main (int argc, char *argv[])
{
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
cmd.Parse (argc, argv);
// Read the Topology information
AnnotatedTopologyReader topologyReader ("", 10);
topologyReader.SetFileName ("topology/topo-ws-100-3-0.5.txt");
topologyReader.Read ();
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
ndnHelper.SetDefaultRoutes (true);
ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::Popcachestat");
ndnHelper.SetContentStore ("ns3::ndn::cs::Lru","MaxSize", CS_Capacity);
ndnHelper.InstallAll ();
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
ndnGlobalRoutingHelper.InstallAll ();
// Installing applications
// Producer
Ptr<Node> producers[2] = { Names::Find<Node> ("0"), Names::Find<Node> ("82")};
ndn::AppHelper producerHelper ("ns3::ndn::ProducerPopcachestat");
producerHelper.SetAttribute ("PayloadSize", StringValue("1026"));
producerHelper.SetPrefix ("/prefix");
ndnGlobalRoutingHelper.AddOrigins ("/prefix", producers[0]);
producerHelper.Install (producers[0]); // root node
producerHelper.Install (producers[1]); // root node
// Consumer
Ptr<Node> consumers[50] = { Names::Find<Node> ("1"), Names::Find<Node> ("3"), Names::Find<Node> ("5"),
Names::Find<Node> ("7"), Names::Find<Node> ("9"), Names::Find<Node> ("11"),
Names::Find<Node> ("13"), Names::Find<Node> ("15"), Names::Find<Node> ("17"),
Names::Find<Node> ("19"), Names::Find<Node> ("21"), Names::Find<Node> ("23"),
Names::Find<Node> ("25"), Names::Find<Node> ("27"), Names::Find<Node> ("29"),
Names::Find<Node> ("31"), Names::Find<Node> ("33"), Names::Find<Node> ("35"),
Names::Find<Node> ("37"), Names::Find<Node> ("39"), Names::Find<Node> ("41"),
Names::Find<Node> ("43"), Names::Find<Node> ("45"), Names::Find<Node> ("47"),
Names::Find<Node> ("49"), Names::Find<Node> ("51"), Names::Find<Node> ("53"),
Names::Find<Node> ("55"), Names::Find<Node> ("57"), Names::Find<Node> ("59"),
Names::Find<Node> ("61"), Names::Find<Node> ("63"), Names::Find<Node> ("65"),
Names::Find<Node> ("67"), Names::Find<Node> ("69"), Names::Find<Node> ("71"),
Names::Find<Node> ("73"), Names::Find<Node> ("75"), Names::Find<Node> ("77"),
Names::Find<Node> ("79"), Names::Find<Node> ("81"), Names::Find<Node> ("83"),
Names::Find<Node> ("85"), Names::Find<Node> ("87"), Names::Find<Node> ("89"),
Names::Find<Node> ("91"), Names::Find<Node> ("93"), Names::Find<Node> ("95"),
Names::Find<Node> ("97"), Names::Find<Node> ("99") };
ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerZipfMandelbrot");
consumerHelper.SetAttribute ("NumberOfContents", StringValue (Capacity));
consumerHelper.SetAttribute ("q", StringValue ("0"));
consumerHelper.SetAttribute ("s", StringValue (Alpha));
consumerHelper.SetPrefix ("/prefix");
consumerHelper.SetAttribute ("Frequency", StringValue (Rate)); // Rate interests a second
for(int i=0; i<=49; i++)
{
consumerHelper.Install (consumers[i]);
}
//Calculate the global routing
ndnGlobalRoutingHelper.CalculateRoutes ();
ndn::L3AggregateTracer::InstallAll (aggregate_trace, Seconds (1.0));
ndn::L3RateTracer::InstallAll (rate_trace, Seconds (1.0));
ndn::CsTracer::InstallAll (cs_trace, Seconds (1));
ndn::AppDelayTracer::InstallAll (app_delays_trace);
L2RateTracer::InstallAll (drop_trace, Seconds (1.0));
for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
{
Simulator::Schedule (Seconds (110), PeriodicStatsPrinter, *i, Seconds (30));
}
Simulator::Stop (Seconds (120.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}
| moonbeamxp/ns-3 | scenario/ws-model/Replacement Policy/Double/ndn-cache-popcachestat.cc | C++ | gpl-2.0 | 4,899 |
LocalFileSystem
===============
This object provides a way to obtain root file systems.
Methods
----------
- __requestFileSystem:__ Requests a filesystem. _(Function)_
- __resolveLocalFileSystemURI:__ Retrieve a DirectoryEntry or FileEntry using local URI. _(Function)_
Constants
---------
- `LocalFileSystem.PERSISTENT`: Used for storage that should not be removed by the user agent without application or user permission.
- `LocalFileSystem.TEMPORARY`: Used for storage with no guarantee of persistence.
NOTE: `LocalFileSystem.TEMPORARY` is currently NOT supported.
Details
-------
The `LocalFileSystem` object methods are defined on the __window__ object.
Request File System Quick Example
---------------------------------
function onSuccess(fileSystem) {
console.log(fileSystem.name);
}
// request the persistent file system
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, onError);
Resolve Local File System URI Quick Example
-------------------------------------------
function onSuccess(fileEntry) {
console.log(fileEntry.name);
}
window.resolveLocalFileSystemURI("file:///example.txt", onSuccess, onError);
Full Example
------------
<!DOCTYPE html>
<html>
<head>
<title>Local File System Example</title>
<script type="text/javascript" charset="utf-8" src="js/wormhole.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Wormhole to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Wormhole is ready
//
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
window.resolveLocalFileSystemURI("file:///example.txt", onResolveSuccess, fail);
}
function onFileSystemSuccess(fileSystem) {
console.log(fileSystem.name);
}
function onResolveSuccess(fileEntry) {
console.log(fileEntry.name);
}
function fail(evt) {
console.log(evt.target.error.code);
}
</script>
</head>
<body>
<h1>Example</h1>
<p>Local File System</p>
</body>
</html>
| tybor/MoSync | libs/Wormhole/jslib/mdDocs/file/localfilesystem/localfilesystem.md | Markdown | gpl-2.0 | 2,056 |
<?php
/**
* @file
* Contains \Drupal\Console\Command\Config\ValidateDebugCommand.
*/
namespace Drupal\Console\Command\Config;
use Drupal\Core\Config\Schema\SchemaCheckTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Drupal\Console\Command\Shared\ContainerAwareCommandTrait;
use Drupal\Console\Style\DrupalStyle;
use Symfony\Component\Console\Input\InputArgument;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Serialization\Yaml;
/**
* Class ValidateDebugCommand.
*
*@package Drupal\Console\Command\Config
*/
class ValidateDebugCommand extends Command
{
use ContainerAwareCommandTrait;
use SchemaCheckTrait;
use PrintConfigValidationTrait;
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('config:validate:debug')
->setDescription($this->trans('commands.config.validate.debug.description'))
->addArgument('config.filepath', InputArgument::REQUIRED)
->addArgument('config.schema.filepath', InputArgument::REQUIRED)
->addOption('schema-name', 'sch', InputOption::VALUE_REQUIRED);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
/**
* @var TypedConfigManagerInterface $typedConfigManager
*/
$typedConfigManager = $this->get('config.typed');
$io = new DrupalStyle($input, $output);
//Validate config file path
$configFilePath = $input->getArgument('config.filepath');
if (!file_exists($configFilePath)) {
$io->info($this->trans('commands.config.validate.debug.messages.noConfFile'));
return 1;
}
//Validate schema path
$configSchemaFilePath = $input->getArgument('config.schema.filepath');
if (!file_exists($configSchemaFilePath)) {
$io->info($this->trans('commands.config.validate.debug.messages.noConfSchema'));
return 1;
}
$config = Yaml::decode(file_get_contents($configFilePath));
$schema = Yaml::decode(file_get_contents($configSchemaFilePath));
//Get the schema name and check it exists in the schema array
$schemaName = $this->getSchemaName($input, $configFilePath);
if (!array_key_exists($schemaName, $schema)) {
$io->warning($this->trans('commands.config.validate.debug.messages.noSchemaName') . $schemaName);
return 1;
}
return $this->printResults($this->manualCheckConfigSchema($typedConfigManager, $config, $schema[$schemaName]), $io);
}
private function getSchemaName(InputInterface $input, $configFilePath)
{
$schemaName = $input->getOption('schema-name');
if ($schemaName === null) {
$schema_name = end(explode('/', $configFilePath));
$schemaName = substr($schema_name, 0, -4);
}
return $schemaName;
}
private function manualCheckConfigSchema(TypedConfigManagerInterface $typed_config, $config_data, $config_schema)
{
$data_definition = $typed_config->buildDataDefinition($config_schema, $config_data);
$this->schema = $typed_config->create($data_definition, $config_data);
$errors = array();
foreach ($config_data as $key => $value) {
$errors = array_merge($errors, $this->checkValue($key, $value));
}
if (empty($errors)) {
return true;
}
return $errors;
}
}
| nortmas/d8 | vendor/drupal/console/src/Command/Config/ValidateDebugCommand.php | PHP | gpl-2.0 | 3,687 |
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Boss_Magtheridon
SD%Complete: 80
SDComment: Phase 3 transition requires additional research. The Manticron cubes require additional core support. Timers need to be revised.
SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
#include "AI/ScriptDevAI/include/sc_common.h"
#include "magtheridons_lair.h"
#include "AI/ScriptDevAI/base/CombatAI.h"
#include "Spells/Scripts/SpellScript.h"
#include "Spells/SpellAuras.h"
enum
{
// yells
SAY_AGGRO = -1544006,
SAY_UNUSED = -1544007,
SAY_BANISH = -1544008,
SAY_CHAMBER_DESTROY = -1544009,
SAY_PLAYER_KILLED = -1544010,
SAY_DEATH = -1544011,
EMOTE_GENERIC_ENRAGED = -1000003,
EMOTE_BLASTNOVA = -1544013,
EMOTE_FREED = -1544015,
// Maghteridon spells
SPELL_SHADOW_CAGE_DUMMY = 30205, // dummy aura - in creature_template_addon
SPELL_BLASTNOVA = 30616,
SPELL_CLEAVE = 30619,
SPELL_QUAKE = 30657, // spell may be related but probably used in the recent versions of the script
SPELL_QUAKE_REMOVAL = 30572, // removes quake from all triggers if blastnova starts during
// SPELL_QUAKE_TRIGGER = 30576, // spell removed from DBC - triggers 30571
SPELL_QUAKE_KNOCKBACK = 30571,
SPELL_BLAZE = 30541, // triggers 30542
SPELL_BERSERK = 27680,
SPELL_CONFLAGRATION = 30757, // Used by Blaze GO
// phase 3 spells
SPELL_CAMERA_SHAKE = 36455,
SPELL_DEBRIS_KNOCKDOWN = 36449,
SPELL_DEBRIS_1 = 30629, // selects target
SPELL_DEBRIS_2 = 30630, // spawns trigger NPC which casts debris spell
SPELL_DEBRIS_DAMAGE = 30631,
SPELL_DEBRIS_VISUAL = 30632,
// Cube spells
SPELL_SHADOW_CAGE = 30168,
SPELL_SHADOW_GRASP_VISUAL = 30166,
SPELL_SHADOW_GRASP = 30410,
SPELL_MIND_EXHAUSTION = 44032,
// Hellfire channeler spells
SPELL_SHADOW_GRASP_DUMMY = 30207, // dummy spell - cast on OOC timer
SPELL_SHADOW_BOLT_VOLLEY = 30510,
SPELL_DARK_MENDING = 30528,
SPELL_FEAR = 30530, // 39176
SPELL_BURNING_ABYSSAL = 30511,
SPELL_SOUL_TRANSFER = 30531,
// Abyss spells
SPELL_FIRE_BLAST = 37110,
// summons
// NPC_MAGS_ROOM = 17516,
NPC_BURNING_ABYSS = 17454,
NPC_RAID_TRIGGER = 17376,
MAX_QUAKE_COUNT = 7,
};
/*######
## boss_magtheridon
######*/
enum MagtheridonActions
{
MAGTHERIDON_PHASE_3,
MAGTHERIDON_BERSERK,
MAGTHERIDON_BLAST_NOVA,
MAGTHERIDON_DEBRIS,
MAGTHERIDON_QUAKE,
MAGTHERIDON_CLEAVE,
MAGTHERIDON_BLAZE,
MAGTHERIDON_ACTION_MAX,
MAGTHERIDON_QUAKE_TIMER,
MAGTHERIDON_TRANSITION_TIMER,
};
struct boss_magtheridonAI : public CombatAI
{
boss_magtheridonAI(Creature* creature) : CombatAI(creature, MAGTHERIDON_ACTION_MAX), m_instance(static_cast<ScriptedInstance*>(creature->GetInstanceData()))
{
AddTimerlessCombatAction(MAGTHERIDON_PHASE_3, true);
AddCombatAction(MAGTHERIDON_DEBRIS, true);
AddCombatAction(MAGTHERIDON_BERSERK, true);
AddCombatAction(MAGTHERIDON_BLAZE, true);
AddCombatAction(MAGTHERIDON_QUAKE, true);
AddCombatAction(MAGTHERIDON_BLAST_NOVA, true);
AddCombatAction(MAGTHERIDON_CLEAVE, true);
AddCustomAction(MAGTHERIDON_QUAKE_TIMER, true, [&]()
{
m_creature->SetStunned(false);
m_creature->SetTarget(m_creature->GetVictim());
DoStartMovement(m_creature->GetVictim());
});
AddCustomAction(MAGTHERIDON_TRANSITION_TIMER, true, [&]() { HandlePhaseTransition(); });
Reset();
}
ScriptedInstance* m_instance;
uint8 m_uiTransitionCount;
uint8 m_uiQuakeCount;
void Reset() override
{
CombatAI::Reset();
m_uiTransitionCount = 0;
SetCombatMovement(true);
SetCombatScriptStatus(false);
m_creature->SetStunned(false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->GetCombatManager().SetLeashingDisable(true);
SetReactState(REACT_PASSIVE);
}
void ReceiveAIEvent(AIEventType eventType, Unit* /*sender*/, Unit* /*invoker*/, uint32 /*miscValue*/) override
{
if (eventType == AI_EVENT_CUSTOM_A)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoScriptText(EMOTE_FREED, m_creature);
DoScriptText(SAY_AGGRO, m_creature);
SetCombatScriptStatus(false);
m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE_DUMMY);
SetReactState(REACT_AGGRESSIVE);
DoResetThreat(); // clear threat at start
// timers here so they dont start at combat initiate
ResetCombatAction(MAGTHERIDON_BERSERK, uint32(20 * MINUTE * IN_MILLISECONDS));
ResetCombatAction(MAGTHERIDON_BLAZE, urand(10000, 15000));
ResetCombatAction(MAGTHERIDON_QUAKE, 40000);
ResetCombatAction(MAGTHERIDON_BLAST_NOVA, 55000);
ResetCombatAction(MAGTHERIDON_CLEAVE, 15000);
}
else if (eventType == AI_EVENT_CUSTOM_B)
{
m_creature->SetInCombatWithZone();
DoScriptText(EMOTE_EVENT_BEGIN, m_creature);
SetCombatScriptStatus(true);
}
}
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() == TYPEID_PLAYER)
DoScriptText(SAY_PLAYER_KILLED, m_creature);
}
void JustDied(Unit* /*killer*/) override
{
if (m_instance)
m_instance->SetData(TYPE_MAGTHERIDON_EVENT, DONE);
DoScriptText(SAY_DEATH, m_creature);
m_creature->CastSpell(nullptr, SPELL_QUAKE_REMOVAL, TRIGGERED_OLD_TRIGGERED);
}
void EnterEvadeMode() override
{
m_creature->SetStunned(false);
CombatAI::EnterEvadeMode();
}
void JustReachedHome() override
{
if (m_instance)
m_instance->SetData(TYPE_MAGTHERIDON_EVENT, FAIL);
DoCastSpellIfCan(nullptr, SPELL_SHADOW_CAGE_DUMMY, CAST_TRIGGERED | CAST_AURA_NOT_PRESENT);
}
void SpellHit(Unit* /*caster*/, const SpellEntry* spellInfo) override
{
// When banished by the cubes
if (spellInfo->Id == SPELL_SHADOW_CAGE)
DoScriptText(SAY_BANISH, m_creature);
}
void HandlePhaseTransition()
{
uint32 timer = 0;
switch (m_uiTransitionCount)
{
case 0:
m_creature->HandleEmote(0);
// Shake the room
DoCastSpellIfCan(m_creature, SPELL_CAMERA_SHAKE);
if (m_instance)
m_instance->SetData(TYPE_MAGTHERIDON_EVENT, SPECIAL);
timer = 8000;
break;
case 1:
DoCastSpellIfCan(m_creature, SPELL_DEBRIS_KNOCKDOWN);
SetCombatScriptStatus(false);
SetMeleeEnabled(true);
SetCombatMovement(true, true);
break;
}
++m_uiTransitionCount;
if (timer)
ResetTimer(MAGTHERIDON_TRANSITION_TIMER, timer);
}
void ExecuteAction(uint32 action) override
{
switch (action)
{
case MAGTHERIDON_PHASE_3:
{
if (m_creature->GetHealthPercent() < 30.0f)
{
// ToDo: maybe there is a spell here - requires additional research
DoScriptText(SAY_CHAMBER_DESTROY, m_creature);
m_creature->HandleEmote(EMOTE_STATE_TALK);
ResetTimer(MAGTHERIDON_TRANSITION_TIMER, 5000);
SetCombatScriptStatus(true);
SetMeleeEnabled(false);
SetCombatMovement(false);
SetActionReadyStatus(action, false);
ResetCombatAction(MAGTHERIDON_DEBRIS, urand(20000, 30000));
}
break;
}
case MAGTHERIDON_BERSERK:
{
if (DoCastSpellIfCan(nullptr, SPELL_BERSERK) == CAST_OK)
{
DoScriptText(EMOTE_GENERIC_ENRAGED, m_creature);
DisableCombatAction(action);
}
break;
}
case MAGTHERIDON_BLAST_NOVA:
{
if (DoCastSpellIfCan(nullptr, SPELL_BLASTNOVA) == CAST_OK)
{
DoScriptText(EMOTE_BLASTNOVA, m_creature);
ResetCombatAction(action, 55000);
}
break;
}
case MAGTHERIDON_DEBRIS:
{
if (DoCastSpellIfCan(nullptr, SPELL_DEBRIS_1) == CAST_OK)
ResetCombatAction(action, urand(10000, 15000));
break;
}
case MAGTHERIDON_QUAKE:
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_QUAKE) == CAST_OK)
{
m_creature->SetStunned(true);
ResetTimer(MAGTHERIDON_QUAKE_TIMER, 7000);
ResetCombatAction(action, 50000);
}
break;
}
case MAGTHERIDON_CLEAVE:
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK)
ResetCombatAction(action, 10000);
break;
}
case MAGTHERIDON_BLAZE:
{
if (DoCastSpellIfCan(nullptr, SPELL_BLAZE) == CAST_OK)
ResetCombatAction(action, urand(10000, 15000));
break;
}
}
}
};
/*######
## mob_hellfire_channeler
######*/
enum ChannelerActions
{
CHANNELER_INFERNAL,
CHANNELER_DARK_MENDING,
CHANNELER_FEAR,
CHANNELER_SHADOW_BOLT,
CHANNELER_ACTION_MAX,
CHANNELER_SHADOW_GRASP,
};
struct mob_hellfire_channelerAI : public CombatAI
{
mob_hellfire_channelerAI(Creature* creature) : CombatAI(creature, CHANNELER_ACTION_MAX), m_instance(static_cast<ScriptedInstance*>(creature->GetInstanceData()))
{
AddCombatAction(CHANNELER_INFERNAL, 10000, 50000);
AddCombatAction(CHANNELER_DARK_MENDING, 10000u);
AddCombatAction(CHANNELER_FEAR, 15000, 20000);
AddCombatAction(CHANNELER_SHADOW_BOLT, 8000, 10000);
AddCustomAction(CHANNELER_SHADOW_GRASP, 10000u, [&]() { DoCastSpellIfCan(m_creature, SPELL_SHADOW_GRASP_DUMMY); });
SetReactState(REACT_DEFENSIVE);
}
ScriptedInstance* m_instance;
void Aggro(Unit* /*who*/) override
{
m_creature->InterruptNonMeleeSpells(false);
if (m_instance)
m_instance->SetData(TYPE_CHANNELER_EVENT, IN_PROGRESS);
}
void JustDied(Unit* /*killer*/) override
{
m_creature->CastSpell(m_creature, SPELL_SOUL_TRANSFER, TRIGGERED_OLD_TRIGGERED);
}
void JustReachedHome() override
{
if (m_instance)
m_instance->SetData(TYPE_CHANNELER_EVENT, FAIL);
}
void JustSummoned(Creature* summoned) override
{
if (m_creature->GetVictim())
summoned->AI()->AttackStart(m_creature->GetVictim());
}
void ExecuteAction(uint32 action) override
{
switch (action)
{
case CHANNELER_INFERNAL:
{
if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_BURNING_ABYSSAL, SELECT_FLAG_PLAYER))
if (DoCastSpellIfCan(target, SPELL_BURNING_ABYSSAL) == CAST_OK)
ResetCombatAction(action, 45000);
break;
}
case CHANNELER_DARK_MENDING:
{
if (Unit* target = DoSelectLowestHpFriendly(30.0f))
if (DoCastSpellIfCan(target, SPELL_DARK_MENDING) == CAST_OK)
ResetCombatAction(action, urand(10000, 20000));
break;
}
case CHANNELER_FEAR:
{
if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, SPELL_FEAR, (SELECT_FLAG_PLAYER | SELECT_FLAG_NOT_AURA)))
if (DoCastSpellIfCan(target, SPELL_FEAR) == CAST_OK)
ResetCombatAction(action, urand(25000, 40000));
break;
}
case CHANNELER_SHADOW_BOLT:
{
if (DoCastSpellIfCan(nullptr, SPELL_SHADOW_BOLT_VOLLEY) == CAST_OK)
ResetCombatAction(action, urand(10000, 20000));
break;
}
}
}
};
/*######
## go_manticron_cube
######*/
struct go_manticron_cubeAI : public GameObjectAI
{
go_manticron_cubeAI(GameObject* go) : GameObjectAI(go), m_lastUser(ObjectGuid()) {}
ObjectGuid m_lastUser;
void SetManticronCubeUser(ObjectGuid user) { m_lastUser = user; }
Player* GetManticronCubeLastUser() const { return m_go->GetMap()->GetPlayer(m_lastUser); }
};
bool GOUse_go_manticron_cube(Player* player, GameObject* go)
{
// if current player is exhausted or last user is still channeling
if (player->HasAura(SPELL_MIND_EXHAUSTION))
return true;
go_manticron_cubeAI* ai = static_cast<go_manticron_cubeAI*>(go->AI());
Player* lastUser = ai->GetManticronCubeLastUser();
if (lastUser && lastUser->HasAura(SPELL_SHADOW_GRASP))
return true;
if (ScriptedInstance* pInstance = (ScriptedInstance*)go->GetInstanceData())
{
if (pInstance->GetData(TYPE_MAGTHERIDON_EVENT) != IN_PROGRESS)
return true;
if (Creature* pMagtheridon = pInstance->GetSingleCreatureFromStorage(NPC_MAGTHERIDON))
{
if (!pMagtheridon->IsAlive())
return true;
// the real spell is cast by player - casts SPELL_SHADOW_GRASP_VISUAL
player->CastSpell(nullptr, SPELL_SHADOW_GRASP, TRIGGERED_NONE);
}
}
return true;
}
// ToDo: move this script to eventAI
struct mob_abyssalAI : public ScriptedAI
{
mob_abyssalAI(Creature* creature) : ScriptedAI(creature) { Reset(); }
uint32 m_uiFireBlastTimer;
uint32 m_uiDespawnTimer;
void Reset() override
{
m_uiDespawnTimer = 60000;
m_uiFireBlastTimer = 6000;
}
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())
return;
if (m_uiDespawnTimer < uiDiff)
{
m_creature->ForcedDespawn();
m_uiDespawnTimer = 10000;
}
else
m_uiDespawnTimer -= uiDiff;
if (m_uiFireBlastTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_FIRE_BLAST) == CAST_OK)
m_uiFireBlastTimer = urand(5000, 15000);
}
else
m_uiFireBlastTimer -= uiDiff;
DoMeleeAttackIfReady();
}
};
struct ShadowGraspCube : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
if (aura->GetEffIndex() == EFFECT_INDEX_0)
{
if (apply)
aura->GetTarget()->CastSpell(nullptr, SPELL_SHADOW_GRASP_VISUAL, TRIGGERED_OLD_TRIGGERED); // Triggered in sniff
else
aura->GetTarget()->InterruptSpell(CURRENT_CHANNELED_SPELL);
}
else
{
if (!apply)
aura->GetTarget()->CastSpell(nullptr, SPELL_MIND_EXHAUSTION, TRIGGERED_OLD_TRIGGERED);
}
}
};
struct ShadowGraspMagth : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
{
Unit* target = aura->GetTarget();
if (apply)
{
if (target->GetAuraCount(30166) == 5)
{
target->CastSpell(target, SPELL_SHADOW_CAGE, TRIGGERED_OLD_TRIGGERED); // cast Shadow cage if stacks are 5
target->InterruptSpell(CURRENT_CHANNELED_SPELL); // if he is casting blast nova interrupt channel, only magth channel spell
}
}
else
{
if (target->HasAura(SPELL_SHADOW_CAGE))
target->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); // remove Shadow cage if stacks are 5
}
}
};
struct QuakeMagth : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
if (urand(0, 8) == 0)
spell->GetCaster()->CastSpell(nullptr, SPELL_QUAKE_KNOCKBACK, TRIGGERED_OLD_TRIGGERED);
}
};
struct QuakeMagthKnockback : public SpellScript
{
bool OnCheckTarget(const Spell* /*spell*/, Unit* target, SpellEffectIndex /*eff*/) const override
{
if (target->IsFalling())
return false;
return true;
}
};
void AddSC_boss_magtheridon()
{
Script* pNewScript = new Script;
pNewScript->Name = "boss_magtheridon";
pNewScript->GetAI = &GetNewAIInstance<boss_magtheridonAI>;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "mob_hellfire_channeler";
pNewScript->GetAI = &GetNewAIInstance<mob_hellfire_channelerAI>;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "go_manticron_cube";
pNewScript->pGOUse = &GOUse_go_manticron_cube;
pNewScript->GetGameObjectAI = &GetNewAIInstance<go_manticron_cubeAI>;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "mob_abyssal";
pNewScript->GetAI = &GetNewAIInstance<mob_abyssalAI>;
pNewScript->RegisterSelf();
RegisterAuraScript<ShadowGraspCube>("spell_shadow_grasp_cube");
RegisterAuraScript<ShadowGraspMagth>("spell_shadow_grasp_magtheridon");
RegisterSpellScript<QuakeMagth>("spell_quake_magtheridon");
RegisterSpellScript<QuakeMagthKnockback>("spell_quake_magtheridon_knockback");
}
| spkansas/mangos-wotlk | src/game/AI/ScriptDevAI/scripts/outland/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp | C++ | gpl-2.0 | 19,346 |
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2016 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
/**
* API method
* Returns a list of users
* @param mixed[] $params
* @option int[] user_id (optional)
* @option string username (optional)
* @option string[] status (optional)
* @option int min_level (optional)
* @option int[] group_id (optional)
* @option int per_page
* @option int page
* @option string order
* @option string display
*/
function ws_users_getList($params, &$service)
{
global $conf;
$where_clauses = array('1=1');
if (!empty($params['user_id']))
{
$where_clauses[] = 'u.'.$conf['user_fields']['id'].' IN('. implode(',', $params['user_id']) .')';
}
if (!empty($params['username']))
{
$where_clauses[] = 'u.'.$conf['user_fields']['username'].' LIKE \''.pwg_db_real_escape_string($params['username']).'\'';
}
if (!empty($params['status']))
{
$params['status'] = array_intersect($params['status'], get_enums(USER_INFOS_TABLE, 'status'));
if (count($params['status']) > 0)
{
$where_clauses[] = 'ui.status IN("'. implode('","', $params['status']) .'")';
}
}
if (!empty($params['min_level']))
{
if ( !in_array($params['min_level'], $conf['available_permission_levels']) )
{
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid level');
}
$where_clauses[] = 'ui.level >= '.$params['min_level'];
}
if (!empty($params['group_id']))
{
$where_clauses[] = 'ug.group_id IN('. implode(',', $params['group_id']) .')';
}
$display = array('u.'.$conf['user_fields']['id'] => 'id');
if ($params['display'] != 'none')
{
$params['display'] = array_map('trim', explode(',', $params['display']));
if (in_array('all', $params['display']))
{
$params['display'] = array(
'username','email','status','level','groups','language','theme',
'nb_image_page','recent_period','expand','show_nb_comments','show_nb_hits',
'enabled_high','registration_date','registration_date_string',
'registration_date_since', 'last_visit', 'last_visit_string',
'last_visit_since'
);
}
else if (in_array('basics', $params['display']))
{
$params['display'] = array_merge($params['display'], array(
'username','email','status','level','groups',
));
}
$params['display'] = array_flip($params['display']);
// if registration_date_string or registration_date_since is requested,
// then registration_date is automatically added
if (isset($params['display']['registration_date_string']) or isset($params['display']['registration_date_since']))
{
$params['display']['registration_date'] = true;
}
// if last_visit_string or last_visit_since is requested, then
// last_visit is automatically added
if (isset($params['display']['last_visit_string']) or isset($params['display']['last_visit_since']))
{
$params['display']['last_visit'] = true;
}
if (isset($params['display']['username']))
{
$display['u.'.$conf['user_fields']['username']] = 'username';
}
if (isset($params['display']['email']))
{
$display['u.'.$conf['user_fields']['email']] = 'email';
}
$ui_fields = array(
'status','level','language','theme','nb_image_page','recent_period','expand',
'show_nb_comments','show_nb_hits','enabled_high','registration_date'
);
foreach ($ui_fields as $field)
{
if (isset($params['display'][$field]))
{
$display['ui.'.$field] = $field;
}
}
}
else
{
$params['display'] = array();
}
$query = '
SELECT DISTINCT ';
$first = true;
foreach ($display as $field => $name)
{
if (!$first) $query.= ', ';
else $first = false;
$query.= $field .' AS '. $name;
}
if (isset($params['display']['groups']))
{
if (!$first) $query.= ', ';
$query.= '"" AS groups';
}
$query.= '
FROM '. USERS_TABLE .' AS u
INNER JOIN '. USER_INFOS_TABLE .' AS ui
ON u.'. $conf['user_fields']['id'] .' = ui.user_id
LEFT JOIN '. USER_GROUP_TABLE .' AS ug
ON u.'. $conf['user_fields']['id'] .' = ug.user_id
WHERE
'. implode(' AND ', $where_clauses) .'
ORDER BY '. $params['order'] .'
LIMIT '. $params['per_page'] .'
OFFSET '. ($params['per_page']*$params['page']) .'
;';
$users = array();
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
$row['id'] = intval($row['id']);
$users[ $row['id'] ] = $row;
}
if (count($users) > 0)
{
if (isset($params['display']['groups']))
{
$query = '
SELECT user_id, group_id
FROM '. USER_GROUP_TABLE .'
WHERE user_id IN ('. implode(',', array_keys($users)) .')
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
$users[ $row['user_id'] ]['groups'][] = intval($row['group_id']);
}
}
if (isset($params['display']['registration_date_string']))
{
foreach ($users as $cur_user)
{
$users[$cur_user['id']]['registration_date_string'] = format_date($cur_user['registration_date'], array('day', 'month', 'year'));
}
}
if (isset($params['display']['registration_date_since']))
{
foreach ($users as $cur_user)
{
$users[ $cur_user['id'] ]['registration_date_since'] = time_since($cur_user['registration_date'], 'month');
}
}
if (isset($params['display']['last_visit']))
{
$query = '
SELECT
MAX(id) as history_id
FROM '.HISTORY_TABLE.'
WHERE user_id IN ('.implode(',', array_keys($users)).')
GROUP BY user_id
;';
$history_ids = array_from_query($query, 'history_id');
if (count($history_ids) == 0)
{
$history_ids[] = -1;
}
$query = '
SELECT
user_id,
date,
time
FROM '.HISTORY_TABLE.'
WHERE id IN ('.implode(',', $history_ids).')
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
$last_visit = $row['date'].' '.$row['time'];
$users[ $row['user_id'] ]['last_visit'] = $last_visit;
if (isset($params['display']['last_visit_string']))
{
$users[ $row['user_id'] ]['last_visit_string'] = format_date($last_visit, array('day', 'month', 'year'));
}
if (isset($params['display']['last_visit_since']))
{
$users[ $row['user_id'] ]['last_visit_since'] = time_since($last_visit, 'day');
}
}
}
}
$users = trigger_change('ws_users_getList', $users);
return array(
'paging' => new PwgNamedStruct(
array(
'page' => $params['page'],
'per_page' => $params['per_page'],
'count' => count($users)
)
),
'users' => new PwgNamedArray(array_values($users), 'user')
);
}
/**
* API method
* Adds a user
* @param mixed[] $params
* @option string username
* @option string password (optional)
* @option string email (optional)
*/
function ws_users_add($params, &$service)
{
if (get_pwg_token() != $params['pwg_token'])
{
return new PwgError(403, 'Invalid security token');
}
global $conf;
if ($conf['double_password_type_in_admin'])
{
if ($params['password'] != $params['password_confirm'])
{
return new PwgError(WS_ERR_INVALID_PARAM, l10n('The passwords do not match'));
}
}
$user_id = register_user(
$params['username'],
$params['password'],
$params['email'],
false, // notify admin
$errors,
$params['send_password_by_mail']
);
if (!$user_id)
{
return new PwgError(WS_ERR_INVALID_PARAM, $errors[0]);
}
return $service->invoke('pwg.users.getList', array('user_id'=>$user_id));
}
/**
* API method
* Deletes users
* @param mixed[] $params
* @option int[] user_id
* @option string pwg_token
*/
function ws_users_delete($params, &$service)
{
if (get_pwg_token() != $params['pwg_token'])
{
return new PwgError(403, 'Invalid security token');
}
global $conf, $user;
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$protected_users = array(
$user['id'],
$conf['guest_id'],
$conf['default_user_id'],
$conf['webmaster_id'],
);
// an admin can't delete other admin/webmaster
if ('admin' == $user['status'])
{
$query = '
SELECT
user_id
FROM '.USER_INFOS_TABLE.'
WHERE status IN (\'webmaster\', \'admin\')
;';
$protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
}
// protect some users
$params['user_id'] = array_diff($params['user_id'], $protected_users);
$counter = 0;
foreach ($params['user_id'] as $user_id)
{
delete_user($user_id);
$counter++;
}
return l10n_dec(
'%d user deleted', '%d users deleted',
$counter
);
}
/**
* API method
* Updates users
* @param mixed[] $params
* @option int[] user_id
* @option string username (optional)
* @option string password (optional)
* @option string email (optional)
* @option string status (optional)
* @option int level (optional)
* @option string language (optional)
* @option string theme (optional)
* @option int nb_image_page (optional)
* @option int recent_period (optional)
* @option bool expand (optional)
* @option bool show_nb_comments (optional)
* @option bool show_nb_hits (optional)
* @option bool enabled_high (optional)
*/
function ws_users_setInfo($params, &$service)
{
if (get_pwg_token() != $params['pwg_token'])
{
return new PwgError(403, 'Invalid security token');
}
global $conf, $user;
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
$updates = $updates_infos = array();
$update_status = null;
if (count($params['user_id']) == 1)
{
if (get_username($params['user_id'][0]) === false)
{
return new PwgError(WS_ERR_INVALID_PARAM, 'This user does not exist.');
}
if (!empty($params['username']))
{
$user_id = get_userid($params['username']);
if ($user_id and $user_id != $params['user_id'][0])
{
return new PwgError(WS_ERR_INVALID_PARAM, l10n('this login is already used'));
}
if ($params['username'] != strip_tags($params['username']))
{
return new PwgError(WS_ERR_INVALID_PARAM, l10n('html tags are not allowed in login'));
}
$updates[ $conf['user_fields']['username'] ] = $params['username'];
}
if (!empty($params['email']))
{
if ( ($error = validate_mail_address($params['user_id'][0], $params['email'])) != '')
{
return new PwgError(WS_ERR_INVALID_PARAM, $error);
}
$updates[ $conf['user_fields']['email'] ] = $params['email'];
}
if (!empty($params['password']))
{
if (!is_webmaster())
{
$password_protected_users = array($conf['guest_id']);
$query = '
SELECT
user_id
FROM '.USER_INFOS_TABLE.'
WHERE status IN (\'webmaster\', \'admin\')
;';
$admin_ids = query2array($query, null, 'user_id');
// we add all admin+webmaster users BUT the user herself
$password_protected_users = array_merge($password_protected_users, array_diff($admin_ids, array($user['id'])));
if (in_array($params['user_id'][0], $password_protected_users))
{
return new PwgError(403, 'Only webmasters can change password of other "webmaster/admin" users');
}
}
$updates[ $conf['user_fields']['password'] ] = $conf['password_hash']($params['password']);
}
}
if (!empty($params['status']))
{
if (in_array($params['status'], array('webmaster', 'admin')) and !is_webmaster() )
{
return new PwgError(403, 'Only webmasters can grant "webmaster/admin" status');
}
if ( !in_array($params['status'], array('guest','generic','normal','admin','webmaster')) )
{
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid status');
}
$protected_users = array(
$user['id'],
$conf['guest_id'],
$conf['webmaster_id'],
);
// an admin can't change status of other admin/webmaster
if ('admin' == $user['status'])
{
$query = '
SELECT
user_id
FROM '.USER_INFOS_TABLE.'
WHERE status IN (\'webmaster\', \'admin\')
;';
$protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
}
// status update query is separated from the rest as not applying to the same
// set of users (current, guest and webmaster can't be changed)
$params['user_id_for_status'] = array_diff($params['user_id'], $protected_users);
$update_status = $params['status'];
}
if (!empty($params['level']) or @$params['level']===0)
{
if ( !in_array($params['level'], $conf['available_permission_levels']) )
{
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid level');
}
$updates_infos['level'] = $params['level'];
}
if (!empty($params['language']))
{
if ( !in_array($params['language'], array_keys(get_languages())) )
{
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid language');
}
$updates_infos['language'] = $params['language'];
}
if (!empty($params['theme']))
{
if ( !in_array($params['theme'], array_keys(get_pwg_themes())) )
{
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid theme');
}
$updates_infos['theme'] = $params['theme'];
}
if (!empty($params['nb_image_page']))
{
$updates_infos['nb_image_page'] = $params['nb_image_page'];
}
if (!empty($params['recent_period']) or @$params['recent_period']===0)
{
$updates_infos['recent_period'] = $params['recent_period'];
}
if (!empty($params['expand']) or @$params['expand']===false)
{
$updates_infos['expand'] = boolean_to_string($params['expand']);
}
if (!empty($params['show_nb_comments']) or @$params['show_nb_comments']===false)
{
$updates_infos['show_nb_comments'] = boolean_to_string($params['show_nb_comments']);
}
if (!empty($params['show_nb_hits']) or @$params['show_nb_hits']===false)
{
$updates_infos['show_nb_hits'] = boolean_to_string($params['show_nb_hits']);
}
if (!empty($params['enabled_high']) or @$params['enabled_high']===false)
{
$updates_infos['enabled_high'] = boolean_to_string($params['enabled_high']);
}
// perform updates
single_update(
USERS_TABLE,
$updates,
array($conf['user_fields']['id'] => $params['user_id'][0])
);
if (isset($updates[ $conf['user_fields']['password'] ]))
{
deactivate_user_auth_keys($params['user_id'][0]);
}
if (isset($update_status) and count($params['user_id_for_status']) > 0)
{
$query = '
UPDATE '. USER_INFOS_TABLE .' SET
status = "'. $update_status .'"
WHERE user_id IN('. implode(',', $params['user_id_for_status']) .')
;';
pwg_query($query);
}
if (count($updates_infos) > 0)
{
$query = '
UPDATE '. USER_INFOS_TABLE .' SET ';
$first = true;
foreach ($updates_infos as $field => $value)
{
if (!$first) $query.= ', ';
else $first = false;
$query.= $field .' = "'. $value .'"';
}
$query.= '
WHERE user_id IN('. implode(',', $params['user_id']) .')
;';
pwg_query($query);
}
// manage association to groups
if (!empty($params['group_id']))
{
$query = '
DELETE
FROM '.USER_GROUP_TABLE.'
WHERE user_id IN ('.implode(',', $params['user_id']).')
;';
pwg_query($query);
// we remove all provided groups that do not really exist
$query = '
SELECT
id
FROM '.GROUPS_TABLE.'
WHERE id IN ('.implode(',', $params['group_id']).')
;';
$group_ids = array_from_query($query, 'id');
// if only -1 (a group id that can't exist) is in the list, then no
// group is associated
if (count($group_ids) > 0)
{
$inserts = array();
foreach ($group_ids as $group_id)
{
foreach ($params['user_id'] as $user_id)
{
$inserts[] = array('user_id' => $user_id, 'group_id' => $group_id);
}
}
mass_inserts(USER_GROUP_TABLE, array_keys($inserts[0]), $inserts);
}
}
invalidate_user_cache();
return $service->invoke('pwg.users.getList', array(
'user_id' => $params['user_id'],
'display' => 'basics,'.implode(',', array_keys($updates_infos)),
));
}
?> | byo/piwigo | include/ws_functions/pwg.users.php | PHP | gpl-2.0 | 17,954 |
<?php
if (!defined('WEB_ROOT')) {
exit;
}
$errorMessage = (isset($_GET['error']) && $_GET['error'] != '') ? $_GET['error'] : ' ';
//$sql = "SELECT id, lname, room_name, floor, building FROM tbl_depts";
$sql = "SELECT p.ProjIndex, p.Title, p.ComIndex, c.CompanyName
FROM tbl_companies c, tbl_projects p
WHERE p.ComIndex = c.ComIndex";
?>
<div class="prepend-1 span-18">
<p class="errorMessage"><?php echo $errorMessage; ?></p>
<form action="<?php echo WEB_ROOT; ?>user/processUser.php?action=add" method="post" enctype="multipart/form-data" name="frmAddUser" id="frmAddUser">
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="entryTable">
<tr align="center" id="listTableHeader">
<td colspan="2">Choose Your Projects</td><td colspan="2">
</tr>
<tr>
<td class="label">Email</td>
<td class="content"><input name="txtEmail" type="text" id="txtEmail" value="" size="20" maxlength="100" /></td>
</tr>
<tr>
<td width="150" class="label">Password</td>
<td class="content"> <input name="txtPassword" type="password" id="txtPassword" value="" size="20" maxlength="100"></td>
</tr>
<tr>
<td class="label">First Name </td>
<td class="content"><input name="txtFname" type="text" id="txtFname" value="" size="20" maxlength="50" /></td>
</tr>
<tr>
<td class="label">Middle Name </td>
<td class="content"><input name="txtMname" type="text" id="txtMname" value="" size="20" maxlength="50" />(Optional)</td>
</tr>
<tr>
<td class="label">Last Name </td>
<td class="content"><input name="txtLname" type="text" id="txtLname" value="" size="20" maxlength="50" /></td>
</tr>
<tr>
<td class="label">Second Last Name</td>
<td class="content"><input name="txt2Lname" type="text" id="txt2Lname" value="" size="20" maxlength="50" />(Optional)</td>
</tr>
<tr>
<td class="label">Full Name</td>
<td class="content"><input name="txtFullname" type="text" id="txtFullname" value="" size="20" maxlength="50" />(Full name you want to display on your certificate)</td>
</tr>
<tr>
<td class="label">Country </td>
<td class="content"><select name="cname">
<option value=""> --- Choose Your Country--- </option>
<?php
$csql = "SELECT * FROM `tbl_countries` WHERE 1 order by code";
$result = dbQuery($csql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $code; ?>"><?php echo $name; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td class="label">Date of Birth </td>
<td class="content"><input name="dob" type="date" id="dob" size="20" maxlength="20" />
(Use format "mm/dd/yyyy" if calendar is not showing)</td>
</tr>
<tr>
<td class="label">Semester</td>
<td class="content"><input name="sem" type="text" id="sem" value="" size="20" maxlength="20" />(How many semesters of your degree have you completed?)</td>
</tr>
<tr>
<td class="label">English Level - Writing</td>
<td class="content">
<select name="ewrite">
<?php
$esql = "SELECT * FROM `tbl_levels` WHERE 1";
$result = dbQuery($esql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $id; ?>"><?php echo $level; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">English Level - Listening</td>
<td class="content">
<select name="elisten">
<?php
$esql = "SELECT * FROM `tbl_levels` WHERE 1";
$result = dbQuery($esql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $id; ?>"><?php echo $level; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">English Level - Speaking</td>
<td class="content">
<select name="espeak">
<?php
$esql = "SELECT * FROM `tbl_levels` WHERE 1";
$result = dbQuery($esql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $id; ?>"><?php echo $level; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">Gender</td>
<td class="content">
<select name="gender">
<option value="M">Male</option>
<option value="F">Female</option>
</select>
</td>
</tr>
<tr>
<td class="label">University</td>
<td class="content"><input name="univ" type="text" id="univ" value="" size="20" maxlength="50" /></td>
</tr>
<tr>
<td class="label">Major</td>
<td class="content"><input name="maj" type="text" id="maj" value="" size="20" maxlength="50" /></td>
</tr>
<tr>
<td class="label">GPA</td>
<td class="content"><input name="gpa" type="text" id="gpa" value="" size="20" maxlength="50" />(Use this <u><a target = '_blank' href="http://www.foreigncredits.com/Resources/GPA-Calculator/">LINK</a></u> to calculate your GPA)</td>
</tr>
<tr><td colspan ="2"><hr></td></tr>
<tr><td> </td><td align="right">Project Description can be found <a target = '_blank' href="Projects_All.pdf"><u>HERE</u></a></td></tr>
<tr>
<td class="label">1st Choice</td>
<td class="content">
<select name="choice1">
<option value=""> --- Choice Your Project--- </option>
<?php
$result = dbQuery($sql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $ProjIndex; ?>"><?php echo $Title." (".$CompanyName." )"; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">2nd Choice</td>
<td class="content">
<select name="choice2">
<option value=""> --- Choice Your Project--- </option>
<?php
$result = dbQuery($sql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $ProjIndex; ?>"><?php echo $Title." (".$CompanyName." )"; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">3rd Choice</td>
<td class="content">
<select name="choice3">
<option value=""> --- Choice Your Project--- </option>
<?php
$result = dbQuery($sql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $ProjIndex; ?>"><?php echo $Title." (".$CompanyName." )"; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">4th Choice</td>
<td class="content">
<select name="choice4">
<option value=""> --- Choice Your Project--- </option>
<?php
$result = dbQuery($sql);
while($row = dbFetchAssoc($result)) {
extract($row);
?>
<option value="<?php echo $ProjIndex; ?>"><?php echo $Title." (".$CompanyName." )"; ?></option>
<?php
}
?>
</select>
</td>
</tr>
</table>
<p align="center">
<input name="btnAddUser" type="button" class="button" id="btnAddUser" value="Confirm" onClick="checkAddUserForm();" class="box">
<input name="btnCancel" type="button" id="btnCancel" class="button" value="Cancel" onClick="window.location.href='index.php';" class="box">
</p>
</form>
</div>
| HongbiaoYang/SummerLean | user/add2.php | PHP | gpl-2.0 | 7,126 |
#
# Makefile for the linux kernel.
#
obj-y = fork.o exec_domain.o panic.o printk.o \
cpu.o exit.o itimer.o time.o softirq.o resource.o \
sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \
signal.o sys.o kmod.o workqueue.o pid.o task_work.o \
rcupdate.o extable.o params.o posix-timers.o \
kthread.o wait.o sys_ni.o posix-cpu-timers.o mutex.o \
hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
notifier.o ksysfs.o cred.o \
async.o range.o groups.o lglock.o smpboot.o
ifdef CONFIG_FUNCTION_TRACER
# Do not trace debug files and internal ftrace files
CFLAGS_REMOVE_lockdep.o = -pg
CFLAGS_REMOVE_lockdep_proc.o = -pg
CFLAGS_REMOVE_mutex-debug.o = -pg
CFLAGS_REMOVE_rtmutex-debug.o = -pg
CFLAGS_REMOVE_cgroup-debug.o = -pg
CFLAGS_REMOVE_irq_work.o = -pg
endif
obj-y += sched/
obj-y += power/
obj-y += cpu/
obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o
obj-$(CONFIG_FREEZER) += freezer.o
obj-$(CONFIG_PROFILING) += profile.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-y += time/
obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o
obj-$(CONFIG_LOCKDEP) += lockdep.o
ifeq ($(CONFIG_PROC_FS),y)
obj-$(CONFIG_LOCKDEP) += lockdep_proc.o
endif
obj-$(CONFIG_FUTEX) += futex.o
ifeq ($(CONFIG_COMPAT),y)
obj-$(CONFIG_FUTEX) += futex_compat.o
endif
obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
obj-$(CONFIG_SMP) += smp.o
ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif
obj-$(CONFIG_SMP) += spinlock.o
obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
obj-$(CONFIG_UID16) += uid16.o
obj-$(CONFIG_MODULES) += module.o
obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o
obj-$(CONFIG_MODULE_SIG_UEFI) += modsign_uefi.o
obj-$(CONFIG_KALLSYMS) += kallsyms.o
obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
obj-$(CONFIG_KEXEC) += kexec.o
obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_CGROUPS) += cgroup.o
obj-$(CONFIG_CGROUP_FREEZER) += cgroup_freezer.o
obj-$(CONFIG_CPUSETS) += cpuset.o
obj-$(CONFIG_UTS_NS) += utsname.o
obj-$(CONFIG_USER_NS) += user_namespace.o
obj-$(CONFIG_PID_NS) += pid_namespace.o
obj-$(CONFIG_IKCONFIG) += configs.o
obj-$(CONFIG_RESOURCE_COUNTERS) += res_counter.o
obj-$(CONFIG_SMP) += stop_machine.o
obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
obj-$(CONFIG_AUDITSYSCALL) += auditsc.o
obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o
obj-$(CONFIG_AUDIT_TREE) += audit_tree.o
obj-$(CONFIG_GCOV_KERNEL) += gcov/
obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_KGDB) += debug/
obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o
obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o
obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
obj-$(CONFIG_SECCOMP) += seccomp.o
obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
obj-$(CONFIG_TREE_RCU) += rcutree.o
obj-$(CONFIG_TREE_PREEMPT_RCU) += rcutree.o
obj-$(CONFIG_TREE_RCU_TRACE) += rcutree_trace.o
obj-$(CONFIG_TINY_RCU) += rcutiny.o
obj-$(CONFIG_TINY_PREEMPT_RCU) += rcutiny.o
obj-$(CONFIG_RELAY) += relay.o
obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
obj-$(CONFIG_LATENCYTOP) += latencytop.o
obj-$(CONFIG_BINFMT_ELF) += elfcore.o
obj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o
obj-$(CONFIG_BINFMT_ELF_FDPIC) += elfcore.o
obj-$(CONFIG_FUNCTION_TRACER) += trace/
obj-$(CONFIG_TRACING) += trace/
obj-$(CONFIG_TRACE_CLOCK) += trace/
obj-$(CONFIG_RING_BUFFER) += trace/
obj-$(CONFIG_TRACEPOINTS) += trace/
obj-$(CONFIG_IRQ_WORK) += irq_work.o
obj-$(CONFIG_CPU_PM) += cpu_pm.o
obj-$(CONFIG_PERF_EVENTS) += events/
obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o
obj-$(CONFIG_PADATA) += padata.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
obj-$(CONFIG_JUMP_LABEL) += jump_label.o
obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o
$(obj)/configs.o: $(obj)/config_data.h
$(obj)/modsign_uefi.o: KBUILD_CFLAGS += -fshort-wchar
# config_data.h contains the same information as ikconfig.h but gzipped.
# Info from config_data can be extracted from /proc/config*
targets += config_data.gz
$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
$(call if_changed,gzip)
filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;")
targets += config_data.h
$(obj)/config_data.h: $(obj)/config_data.gz FORCE
$(call filechk,ikconfiggz)
$(obj)/time.o: $(obj)/timeconst.h
quiet_cmd_hzfile = HZFILE $@
cmd_hzfile = echo "hz=$(CONFIG_HZ)" > $@
targets += hz.bc
$(obj)/hz.bc: $(objtree)/include/config/hz.h FORCE
$(call if_changed,hzfile)
quiet_cmd_bc = BC $@
cmd_bc = bc -q $(filter-out FORCE,$^) > $@
targets += timeconst.h
$(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
$(call if_changed,bc)
ifeq ($(CONFIG_MODULE_SIG),y)
#
# Pull the signing certificate and any extra certificates into the kernel
#
quiet_cmd_touch = TOUCH $@
cmd_touch = touch $@
extra_certificates:
$(call cmd,touch)
kernel/modsign_certificate.o: signing_key.x509 extra_certificates
###############################################################################
#
# If module signing is requested, say by allyesconfig, but a key has not been
# supplied, then one will need to be generated to make sure the build does not
# fail and that the kernel may be used afterwards.
#
###############################################################################
ifndef CONFIG_MODULE_SIG_HASH
$(error Could not determine digest type to use from kernel config)
endif
signing_key.priv signing_key.x509: x509.genkey
@echo "###"
@echo "### Now generating an X.509 key pair to be used for signing modules."
@echo "###"
@echo "### If this takes a long time, you might wish to run rngd in the"
@echo "### background to keep the supply of entropy topped up. It"
@echo "### needs to be run as root, and uses a hardware random"
@echo "### number generator if one is available."
@echo "###"
openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
-batch -x509 -config x509.genkey \
-outform DER -out signing_key.x509 \
-keyout signing_key.priv 2>&1
@echo "###"
@echo "### Key pair generated."
@echo "###"
x509.genkey:
@echo Generating X.509 key generation config
@echo >x509.genkey "[ req ]"
@echo >>x509.genkey "default_bits = 4096"
@echo >>x509.genkey "distinguished_name = req_distinguished_name"
@echo >>x509.genkey "prompt = no"
@echo >>x509.genkey "string_mask = utf8only"
@echo >>x509.genkey "x509_extensions = myexts"
@echo >>x509.genkey
@echo >>x509.genkey "[ req_distinguished_name ]"
@echo >>x509.genkey "O = Magrathea"
@echo >>x509.genkey "CN = Glacier signing key"
@echo >>x509.genkey "emailAddress = slartibartfast@magrathea.h2g2"
@echo >>x509.genkey
@echo >>x509.genkey "[ myexts ]"
@echo >>x509.genkey "basicConstraints=critical,CA:FALSE"
@echo >>x509.genkey "keyUsage=digitalSignature"
@echo >>x509.genkey "subjectKeyIdentifier=hash"
@echo >>x509.genkey "authorityKeyIdentifier=keyid"
endif
| shreekantsingh/uefi | kernel/Makefile | Makefile | gpl-2.0 | 7,230 |
/*
* init_wslua.c
*
* Wireshark's interface to the Lua Programming Language
*
* (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "wslua.h"
#include "init_wslua.h"
#include <epan/dissectors/packet-frame.h>
#include <math.h>
#include <epan/expert.h>
#include <epan/ex-opt.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
/* linked list of Lua plugins */
typedef struct _wslua_plugin {
gchar *name; /**< plugin name */
gchar *version; /**< plugin version */
gchar *filename; /**< plugin filename */
struct _wslua_plugin *next;
} wslua_plugin;
static wslua_plugin *wslua_plugin_list = NULL;
static lua_State* L = NULL;
/* XXX: global variables? Really?? Yuck. These could be done differently,
using the Lua registry */
packet_info* lua_pinfo;
struct _wslua_treeitem* lua_tree;
tvbuff_t* lua_tvb;
int lua_dissectors_table_ref = LUA_NOREF;
int lua_heur_dissectors_table_ref = LUA_NOREF;
static int proto_lua = -1;
static expert_field ei_lua_error = EI_INIT;
static expert_field ei_lua_proto_checksum_comment = EI_INIT;
static expert_field ei_lua_proto_checksum_chat = EI_INIT;
static expert_field ei_lua_proto_checksum_note = EI_INIT;
static expert_field ei_lua_proto_checksum_warn = EI_INIT;
static expert_field ei_lua_proto_checksum_error = EI_INIT;
static expert_field ei_lua_proto_sequence_comment = EI_INIT;
static expert_field ei_lua_proto_sequence_chat = EI_INIT;
static expert_field ei_lua_proto_sequence_note = EI_INIT;
static expert_field ei_lua_proto_sequence_warn = EI_INIT;
static expert_field ei_lua_proto_sequence_error = EI_INIT;
static expert_field ei_lua_proto_response_comment = EI_INIT;
static expert_field ei_lua_proto_response_chat = EI_INIT;
static expert_field ei_lua_proto_response_note = EI_INIT;
static expert_field ei_lua_proto_response_warn = EI_INIT;
static expert_field ei_lua_proto_response_error = EI_INIT;
static expert_field ei_lua_proto_request_comment = EI_INIT;
static expert_field ei_lua_proto_request_chat = EI_INIT;
static expert_field ei_lua_proto_request_note = EI_INIT;
static expert_field ei_lua_proto_request_warn = EI_INIT;
static expert_field ei_lua_proto_request_error = EI_INIT;
static expert_field ei_lua_proto_undecoded_comment = EI_INIT;
static expert_field ei_lua_proto_undecoded_chat = EI_INIT;
static expert_field ei_lua_proto_undecoded_note = EI_INIT;
static expert_field ei_lua_proto_undecoded_warn = EI_INIT;
static expert_field ei_lua_proto_undecoded_error = EI_INIT;
static expert_field ei_lua_proto_reassemble_comment = EI_INIT;
static expert_field ei_lua_proto_reassemble_chat = EI_INIT;
static expert_field ei_lua_proto_reassemble_note = EI_INIT;
static expert_field ei_lua_proto_reassemble_warn = EI_INIT;
static expert_field ei_lua_proto_reassemble_error = EI_INIT;
static expert_field ei_lua_proto_malformed_comment = EI_INIT;
static expert_field ei_lua_proto_malformed_chat = EI_INIT;
static expert_field ei_lua_proto_malformed_note = EI_INIT;
static expert_field ei_lua_proto_malformed_warn = EI_INIT;
static expert_field ei_lua_proto_malformed_error = EI_INIT;
static expert_field ei_lua_proto_debug_comment = EI_INIT;
static expert_field ei_lua_proto_debug_chat = EI_INIT;
static expert_field ei_lua_proto_debug_note = EI_INIT;
static expert_field ei_lua_proto_debug_warn = EI_INIT;
static expert_field ei_lua_proto_debug_error = EI_INIT;
static expert_field ei_lua_proto_protocol_comment = EI_INIT;
static expert_field ei_lua_proto_protocol_chat = EI_INIT;
static expert_field ei_lua_proto_protocol_note = EI_INIT;
static expert_field ei_lua_proto_protocol_warn = EI_INIT;
static expert_field ei_lua_proto_protocol_error = EI_INIT;
static expert_field ei_lua_proto_security_comment = EI_INIT;
static expert_field ei_lua_proto_security_chat = EI_INIT;
static expert_field ei_lua_proto_security_note = EI_INIT;
static expert_field ei_lua_proto_security_warn = EI_INIT;
static expert_field ei_lua_proto_security_error = EI_INIT;
static expert_field ei_lua_proto_comments_comment = EI_INIT;
static expert_field ei_lua_proto_comments_chat = EI_INIT;
static expert_field ei_lua_proto_comments_note = EI_INIT;
static expert_field ei_lua_proto_comments_warn = EI_INIT;
static expert_field ei_lua_proto_comments_error = EI_INIT;
dissector_handle_t lua_data_handle;
static gboolean
lua_pinfo_end(wmem_allocator_t *allocator _U_, wmem_cb_event_t event _U_,
void *user_data _U_)
{
clear_outstanding_Tvb();
clear_outstanding_TvbRange();
clear_outstanding_Pinfo();
clear_outstanding_Column();
clear_outstanding_Columns();
clear_outstanding_PrivateTable();
clear_outstanding_TreeItem();
clear_outstanding_FieldInfo();
/* keep invoking this callback later? */
return FALSE;
}
static int wslua_not_register_menu(lua_State* LS) {
luaL_error(LS,"too late to register a menu");
return 0;
}
int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) {
int consumed_bytes = tvb_length(tvb);
lua_pinfo = pinfo;
lua_tvb = tvb;
lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
lua_tree->tree = tree;
lua_tree->item = proto_tree_add_text(tree,tvb,0,0,"lua fake item");
lua_tree->expired = FALSE;
PROTO_ITEM_SET_HIDDEN(lua_tree->item);
/*
* almost equivalent to Lua:
* dissectors[current_proto](tvb,pinfo,tree)
*/
lua_settop(L,0);
lua_rawgeti(L, LUA_REGISTRYINDEX, lua_dissectors_table_ref);
lua_pushstring(L, pinfo->current_proto);
lua_gettable(L, -2);
lua_remove(L,1);
if (lua_isfunction(L,1)) {
push_Tvb(L,tvb);
push_Pinfo(L,pinfo);
push_TreeItem(L,lua_tree);
if ( lua_pcall(L,3,1,0) ) {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0, "Lua Error: %s", lua_tostring(L,-1));
} else {
/* if the Lua dissector reported the consumed bytes, pass it to our caller */
if (lua_isnumber(L, -1)) {
/* we got the consumed bytes or the missing bytes as a negative number */
consumed_bytes = wslua_togint(L, -1);
lua_pop(L, 1);
}
}
} else {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"Lua Error: did not find the %s dissector in the dissectors table", pinfo->current_proto);
}
wmem_register_callback(pinfo->pool, lua_pinfo_end, NULL);
lua_pinfo = NULL;
lua_tree = NULL;
lua_tvb = NULL;
return consumed_bytes;
}
/** Type of a heuristic dissector, used in heur_dissector_add().
*
* @param tvb the tvbuff with the (remaining) packet data
* @param pinfo the packet info of this packet (additional info)
* @param tree the protocol tree to be build or NULL
* @return TRUE if the packet was recognized by the sub-dissector (stop dissection here)
*/
gboolean heur_dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) {
gboolean result = FALSE;
lua_tvb = tvb;
lua_pinfo = pinfo;
g_assert(tvb && pinfo);
if (!pinfo->heur_list_name || !pinfo->current_proto) {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"internal error in heur_dissect_lua: NULL list name or current proto");
return FALSE;
}
/* heuristic functions are stored in a table in the registry; the registry has a
* table at reference lua_heur_dissectors_table_ref, and that table has keys for
* the heuristic listname (e.g., "udp", "tcp", etc.), and that key's value is a
* table of keys of the Proto->name, and their value is the function.
* So it's like registry[table_ref][heur_list_name][proto_name] = func
*/
lua_settop(L,0);
/* get the table of all lua heuristic dissector lists */
lua_rawgeti(L, LUA_REGISTRYINDEX, lua_heur_dissectors_table_ref);
/* get the table inside that, for the lua heuristic dissectors of the requested heur list */
if (!wslua_get_table(L, -1, pinfo->heur_list_name)) {
/* this shouldn't happen */
lua_settop(L,0);
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"internal error in heur_dissect_lua: no %s heur list table", pinfo->heur_list_name);
return FALSE;
}
/* get the table inside that, for the specific lua heuristic dissector */
if (!wslua_get_field(L,-1,pinfo->current_proto)) {
/* this shouldn't happen */
lua_settop(L,0);
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"internal error in heur_dissect_lua: no %s heuristic dissector for list %s",
pinfo->current_proto, pinfo->heur_list_name);
return FALSE;
}
/* remove the table of all lists (the one in the registry) */
lua_remove(L,1);
/* remove the heur_list_name heur list table */
lua_remove(L,1);
if (!lua_isfunction(L,-1)) {
/* this shouldn't happen */
lua_settop(L,0);
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"internal error in heur_dissect_lua: %s heuristic dissector is not a function", pinfo->current_proto);
return FALSE;
}
lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
lua_tree->tree = tree;
lua_tree->item = proto_tree_add_text(tree,tvb,0,0,"lua fake item");
lua_tree->expired = FALSE;
PROTO_ITEM_SET_HIDDEN(lua_tree->item);
push_Tvb(L,tvb);
push_Pinfo(L,pinfo);
push_TreeItem(L,lua_tree);
if ( lua_pcall(L,3,1,0) ) {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"Lua Error: error calling %s heuristic dissector: %s", pinfo->current_proto, lua_tostring(L,-1));
lua_settop(L,0);
} else {
if (lua_isboolean(L, -1) || lua_isnil(L, -1)) {
result = lua_toboolean(L, -1);
} else {
proto_tree_add_expert_format(tree, pinfo, &ei_lua_error, tvb, 0, 0,
"Lua Error: invalid return value from Lua %s heuristic dissector", pinfo->current_proto);
}
lua_pop(L, 1);
}
wmem_register_callback(pinfo->pool, lua_pinfo_end, NULL);
lua_pinfo = NULL;
lua_tree = NULL;
lua_tvb = NULL;
return result;
}
static void iter_table_and_call(lua_State* LS, const gchar* table_name, lua_CFunction error_handler) {
lua_settop(LS,0);
lua_pushcfunction(LS,error_handler);
lua_getglobal(LS, table_name);
if (!lua_istable(LS, 2)) {
report_failure("Lua: either `%s' does not exist or it is not a table!\n",table_name);
lua_close(LS);
L = NULL;
return;
}
lua_pushnil(LS);
while (lua_next(LS, 2)) {
const gchar* name = lua_tostring(L,-2);
if (lua_isfunction(LS,-1)) {
if ( lua_pcall(LS,0,0,1) ) {
lua_pop(LS,1);
}
} else {
report_failure("Lua: Something not a function got its way into the %s.%s",table_name,name);
lua_close(LS);
L = NULL;
return;
}
}
lua_settop(LS,0);
}
static int init_error_handler(lua_State* LS) {
const gchar* error = lua_tostring(LS,1);
report_failure("Lua: Error During execution of Initialization:\n %s",error);
return 0;
}
static void wslua_init_routine(void) {
static gboolean initialized = FALSE;
if ( ! initialized ) {
lua_prime_all_fields(NULL);
initialized = TRUE;
}
if (L) {
iter_table_and_call(L, WSLUA_INIT_ROUTINES,init_error_handler);
}
}
static int prefs_changed_error_handler(lua_State* LS) {
const gchar* error = lua_tostring(LS,1);
report_failure("Lua: Error During execution of prefs apply callback:\n %s",error);
return 0;
}
void wslua_prefs_changed(void) {
if (L) {
iter_table_and_call(L, WSLUA_PREFS_CHANGED,prefs_changed_error_handler);
}
}
static const char *getF(lua_State *LS _U_, void *ud, size_t *size)
{
FILE *f=(FILE *)ud;
static char buff[512];
if (feof(f)) return NULL;
*size=fread(buff,1,sizeof(buff),f);
return (*size>0) ? buff : NULL;
}
static int lua_main_error_handler(lua_State* LS) {
const gchar* error = lua_tostring(LS,1);
report_failure("Lua: Error during loading:\n %s",error);
return 0;
}
static void wslua_add_plugin(gchar *name, gchar *version, gchar *filename)
{
wslua_plugin *new_plug, *lua_plug;
lua_plug = wslua_plugin_list;
new_plug = (wslua_plugin *)g_malloc(sizeof(wslua_plugin));
if (!lua_plug) { /* the list is empty */
wslua_plugin_list = new_plug;
} else {
while (lua_plug->next != NULL) {
lua_plug = lua_plug->next;
}
lua_plug->next = new_plug;
}
new_plug->name = name;
new_plug->version = version;
new_plug->filename = filename;
new_plug->next = NULL;
}
static int lua_script_push_args(const int script_num) {
gchar* argname = g_strdup_printf("lua_script%d", script_num);
const gchar* argvalue = NULL;
int count = 0;
while((argvalue = ex_opt_get_next(argname))) {
lua_pushstring(L,argvalue);
count++;
}
g_free(argname);
return count;
}
#define FILE_NAME_KEY "__FILE__"
#define DIR_NAME_KEY "__DIR__"
#define DIR_SEP_NAME_KEY "__DIR_SEPARATOR__"
/* assumes a loaded chunk's function is on top of stack */
static void set_file_environment(const gchar* filename, const gchar* dirname) {
const char* path;
char* personal = get_plugins_pers_dir();
lua_newtable(L); /* environment for script (index 3) */
lua_pushstring(L, filename); /* tell the script about its filename */
lua_setfield(L, -2, FILE_NAME_KEY); /* make it accessible at __FILE__ */
lua_pushstring(L, dirname); /* tell the script about its dirname */
lua_setfield(L, -2, DIR_NAME_KEY); /* make it accessible at __DIR__ */
lua_pushstring(L, G_DIR_SEPARATOR_S); /* tell the script the directory separator */
lua_setfield(L, -2, DIR_SEP_NAME_KEY); /* make it accessible at __DIR__ */
lua_newtable(L); /* new metatable */
#if LUA_VERSION_NUM >= 502
lua_pushglobaltable(L);
#else
lua_pushvalue(L, LUA_GLOBALSINDEX);
#endif
/* prepend the directory name to _G.package.path */
lua_getfield(L, -1, "package"); /* get the package table from the global table */
lua_getfield(L, -1, "path"); /* get the path field from the package table */
path = luaL_checkstring(L, -1); /* get the path string */
lua_pop(L, 1); /* pop the path string */
/* prepend the various paths */
lua_pushfstring(L, "%s" G_DIR_SEPARATOR_S "?.lua;%s" G_DIR_SEPARATOR_S "?.lua;%s" G_DIR_SEPARATOR_S "?.lua;%s",
dirname, personal, get_plugin_dir(), path);
lua_setfield(L, -2, "path"); /* set the new string to be the path field of the package table */
lua_setfield(L, -2, "package"); /* set the package table to be the package field of the global */
lua_setfield(L, -2, "__index"); /* make metatable's __index point to global table */
lua_setmetatable(L, -2); /* pop metatable, set it as metatable of environment */
#if LUA_VERSION_NUM >= 502
lua_setupvalue(L, -2, 1); /* pop environment and assign it to upvalue 1 */
#else
lua_setfenv(L, -2); /* pop environment and set it as the func's environment */
#endif
g_free(personal);
}
/* If file_count > 0 then it's a command-line-added user script, and the count
* represents which user script it is (first=1, second=2, etc.).
* If dirname != NULL, then it's a user script and the dirname will get put in a file environment
* If dirname == NULL then it's a wireshark script and no file environment is created
*/
static gboolean lua_load_script(const gchar* filename, const gchar* dirname, const int file_count) {
FILE* file;
int error;
int numargs = 0;
if (! ( file = ws_fopen(filename,"r")) ) {
report_open_failure(filename,errno,FALSE);
return FALSE;
}
lua_settop(L,0);
lua_pushcfunction(L,lua_main_error_handler);
#if LUA_VERSION_NUM >= 502
error = lua_load(L,getF,file,filename,NULL);
#else
error = lua_load(L,getF,file,filename);
#endif
switch (error) {
case 0:
if (dirname) {
set_file_environment(filename, dirname);
}
if (file_count > 0) {
numargs = lua_script_push_args(file_count);
}
lua_pcall(L,numargs,0,1);
fclose(file);
lua_pop(L,1); /* pop the error handler */
return TRUE;
case LUA_ERRSYNTAX: {
report_failure("Lua: syntax error during precompilation of `%s':\n%s",filename,lua_tostring(L,-1));
fclose(file);
return FALSE;
}
case LUA_ERRMEM:
report_failure("Lua: memory allocation error during execution of %s",filename);
fclose(file);
return FALSE;
default:
report_failure("Lua: unknown error during execution of %s: %d",filename,error);
fclose(file);
return FALSE;
}
}
static void basic_logger(const gchar *log_domain _U_,
GLogLevelFlags log_level _U_,
const gchar *message,
gpointer user_data _U_) {
fputs(message,stderr);
}
static int wslua_panic(lua_State* LS) {
g_error("LUA PANIC: %s",lua_tostring(LS,-1));
/** g_error() does an abort() and thus never returns **/
return 0; /* keep gcc happy */
}
static int lua_load_plugins(const char *dirname, register_cb cb, gpointer client_data,
gboolean count_only, const gboolean is_user)
{
WS_DIR *dir; /* scanned directory */
WS_DIRENT *file; /* current file */
gchar *filename, *dot;
const gchar *name;
int plugins_counter = 0;
if ((dir = ws_dir_open(dirname, 0, NULL)) != NULL) {
while ((file = ws_dir_read_name(dir)) != NULL) {
name = ws_dir_get_name(file);
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
continue; /* skip "." and ".." */
filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dirname, name);
if (test_for_directory(filename) == EISDIR) {
plugins_counter += lua_load_plugins(filename, cb, client_data, count_only, is_user);
g_free(filename);
continue;
}
/* skip files starting wih . */
if (name[0] == '.') {
g_free(filename);
continue;
}
/* skip anything but files with .lua suffix */
dot = strrchr(name, '.');
if (dot == NULL || g_ascii_strcasecmp(dot+1, "lua") != 0) {
g_free(filename);
continue;
}
if (file_exists(filename)) {
if (!count_only) {
if (cb)
(*cb)(RA_LUA_PLUGINS, name, client_data);
if (lua_load_script(filename, is_user ? dirname : NULL, 0)) {
wslua_add_plugin(g_strdup(name), g_strdup(""), g_strdup(filename));
}
}
plugins_counter++;
}
g_free(filename);
}
ws_dir_close(dir);
}
return plugins_counter;
}
int wslua_count_plugins(void) {
gchar* filename;
int plugins_counter;
/* count global scripts */
plugins_counter = lua_load_plugins(get_plugin_dir(), NULL, NULL, TRUE, FALSE);
/* count users init.lua */
filename = get_persconffile_path("init.lua", FALSE);
if ((file_exists(filename))) {
plugins_counter++;
}
g_free(filename);
/* count user scripts */
filename = get_plugins_pers_dir();
plugins_counter += lua_load_plugins(filename, NULL, NULL, TRUE, TRUE);
g_free(filename);
/* count scripts from command line */
plugins_counter += ex_opt_count("lua_script");
return plugins_counter;
}
void wslua_plugins_get_descriptions(wslua_plugin_description_callback callback, void *user_data) {
wslua_plugin *lua_plug;
for (lua_plug = wslua_plugin_list; lua_plug != NULL; lua_plug = lua_plug->next)
{
callback(lua_plug->name, lua_plug->version, "lua script",
lua_plug->filename, user_data);
}
}
static void
print_wslua_plugin_description(const char *name, const char *version,
const char *description, const char *filename,
void *user_data _U_)
{
printf("%s\t%s\t%s\t%s\n", name, version, description, filename);
}
void
wslua_plugins_dump_all(void)
{
wslua_plugins_get_descriptions(print_wslua_plugin_description, NULL);
}
static ei_register_info* ws_lua_ei = NULL;
static int ws_lua_ei_len = 0;
expert_field*
wslua_get_expert_field(const int group, const int severity)
{
int i;
const ei_register_info *ei = ws_lua_ei;
g_assert(ei);
for (i=0; i < ws_lua_ei_len; i++, ei++) {
if (ei->eiinfo.group == group && ei->eiinfo.severity == severity)
return ei->ids;
}
return &ei_lua_error;
}
int wslua_init(register_cb cb, gpointer client_data) {
gchar* filename;
const gchar *script_filename;
const funnel_ops_t* ops = funnel_get_funnel_ops();
gboolean run_anyway = FALSE;
expert_module_t* expert_lua;
int file_count = 1;
static ei_register_info ei[] = {
/* the following are created so we can continue to support the TreeItem_add_expert_info()
function to Lua scripts. That function doesn't know what registered protocol to use,
so it uses the "_ws.lua" one. */
/* XXX: it seems to me we should not be offering PI_GROUP_MASK nor PI_SEVERITY_MASK since
they are not real settings, so I'm not adding them below (should they also not be exported
into Lua? they are right now.) */
/* NOTE: do not add expert entries at the top of this array - only at the bottom. This array
is not only used by expert.c, but also by wslua_get_expert_field() to find the appropriate
"dummy" entry. So this array's ordering matters. */
{ &ei_lua_proto_checksum_comment, { "_ws.lua.proto.comment", PI_CHECKSUM, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_checksum_chat, { "_ws.lua.proto.chat", PI_CHECKSUM, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_checksum_note, { "_ws.lua.proto.note", PI_CHECKSUM, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_checksum_warn, { "_ws.lua.proto.warning", PI_CHECKSUM, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_checksum_error, { "_ws.lua.proto.error", PI_CHECKSUM, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_sequence_comment, { "_ws.lua.proto.comment", PI_SEQUENCE, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_sequence_chat, { "_ws.lua.proto.chat", PI_SEQUENCE, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_sequence_note, { "_ws.lua.proto.note", PI_SEQUENCE, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_sequence_warn, { "_ws.lua.proto.warning", PI_SEQUENCE, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_sequence_error, { "_ws.lua.proto.error", PI_SEQUENCE, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_response_comment, { "_ws.lua.proto.comment", PI_RESPONSE_CODE, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_response_chat, { "_ws.lua.proto.chat", PI_RESPONSE_CODE, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_response_note, { "_ws.lua.proto.note", PI_RESPONSE_CODE, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_response_warn, { "_ws.lua.proto.warning", PI_RESPONSE_CODE, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_response_error, { "_ws.lua.proto.error", PI_RESPONSE_CODE, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_request_comment, { "_ws.lua.proto.comment", PI_REQUEST_CODE, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_request_chat, { "_ws.lua.proto.chat", PI_REQUEST_CODE, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_request_note, { "_ws.lua.proto.note", PI_REQUEST_CODE, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_request_warn, { "_ws.lua.proto.warning", PI_REQUEST_CODE, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_request_error, { "_ws.lua.proto.error", PI_REQUEST_CODE, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_undecoded_comment, { "_ws.lua.proto.comment", PI_UNDECODED, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_undecoded_chat, { "_ws.lua.proto.chat", PI_UNDECODED, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_undecoded_note, { "_ws.lua.proto.note", PI_UNDECODED, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_undecoded_warn, { "_ws.lua.proto.warning", PI_UNDECODED, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_undecoded_error, { "_ws.lua.proto.error", PI_UNDECODED, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_reassemble_comment, { "_ws.lua.proto.comment", PI_REASSEMBLE, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_reassemble_chat, { "_ws.lua.proto.chat", PI_REASSEMBLE, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_reassemble_note, { "_ws.lua.proto.note", PI_REASSEMBLE, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_reassemble_warn, { "_ws.lua.proto.warning", PI_REASSEMBLE, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_reassemble_error, { "_ws.lua.proto.error", PI_REASSEMBLE, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_malformed_comment, { "_ws.lua.proto.comment", PI_MALFORMED, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_malformed_chat, { "_ws.lua.proto.chat", PI_MALFORMED, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_malformed_note, { "_ws.lua.proto.note", PI_MALFORMED, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_malformed_warn, { "_ws.lua.proto.warning", PI_MALFORMED, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_malformed_error, { "_ws.lua.proto.error", PI_MALFORMED, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_debug_comment, { "_ws.lua.proto.comment", PI_DEBUG, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_debug_chat, { "_ws.lua.proto.chat", PI_DEBUG, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_debug_note, { "_ws.lua.proto.note", PI_DEBUG, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_debug_warn, { "_ws.lua.proto.warning", PI_DEBUG, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_debug_error, { "_ws.lua.proto.error", PI_DEBUG, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_protocol_comment, { "_ws.lua.proto.comment", PI_PROTOCOL, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_protocol_chat, { "_ws.lua.proto.chat", PI_PROTOCOL, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_protocol_note, { "_ws.lua.proto.note", PI_PROTOCOL, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_protocol_warn, { "_ws.lua.proto.warning", PI_PROTOCOL, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_protocol_error, { "_ws.lua.proto.error", PI_PROTOCOL, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_security_comment, { "_ws.lua.proto.comment", PI_SECURITY, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_security_chat, { "_ws.lua.proto.chat", PI_SECURITY, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_security_note, { "_ws.lua.proto.note", PI_SECURITY, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_security_warn, { "_ws.lua.proto.warning", PI_SECURITY, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_security_error, { "_ws.lua.proto.error", PI_SECURITY, PI_ERROR ,"Protocol Error", EXPFILL }},
{ &ei_lua_proto_comments_comment, { "_ws.lua.proto.comment", PI_COMMENTS_GROUP, PI_COMMENT ,"Protocol Comment", EXPFILL }},
{ &ei_lua_proto_comments_chat, { "_ws.lua.proto.chat", PI_COMMENTS_GROUP, PI_CHAT ,"Protocol Chat", EXPFILL }},
{ &ei_lua_proto_comments_note, { "_ws.lua.proto.note", PI_COMMENTS_GROUP, PI_NOTE ,"Protocol Note", EXPFILL }},
{ &ei_lua_proto_comments_warn, { "_ws.lua.proto.warning", PI_COMMENTS_GROUP, PI_WARN ,"Protocol Warning", EXPFILL }},
{ &ei_lua_proto_comments_error, { "_ws.lua.proto.error", PI_COMMENTS_GROUP, PI_ERROR ,"Protocol Error", EXPFILL }},
/* this one is for reporting errors executing Lua code */
{ &ei_lua_error, { "_ws.lua.error", PI_UNDECODED, PI_ERROR ,"Lua Error", EXPFILL }},
};
ws_lua_ei = ei;
ws_lua_ei_len = array_length(ei);
/* set up the logger */
g_log_set_handler(LOG_DOMAIN_LUA, (GLogLevelFlags)(G_LOG_LEVEL_CRITICAL|
G_LOG_LEVEL_WARNING|
G_LOG_LEVEL_MESSAGE|
G_LOG_LEVEL_INFO|
G_LOG_LEVEL_DEBUG),
ops ? ops->logger : basic_logger,
NULL);
if (!L) {
L = luaL_newstate();
}
WSLUA_INIT(L);
proto_lua = proto_register_protocol("Lua Dissection", "Lua Dissection", "_ws.lua");
expert_lua = expert_register_protocol(proto_lua);
expert_register_field_array(expert_lua, ei, array_length(ei));
lua_atpanic(L,wslua_panic);
/* the init_routines table (accessible by the user) */
lua_newtable (L);
lua_setglobal(L, WSLUA_INIT_ROUTINES);
/* the dissectors table goes in the registry (not accessible) */
lua_newtable (L);
lua_dissectors_table_ref = luaL_ref(L, LUA_REGISTRYINDEX);
lua_newtable (L);
lua_heur_dissectors_table_ref = luaL_ref(L, LUA_REGISTRYINDEX);
/* the preferences apply_cb table (accessible by the user) */
lua_newtable (L);
lua_setglobal(L, WSLUA_PREFS_CHANGED);
/* set running_superuser variable to its proper value */
WSLUA_REG_GLOBAL_BOOL(L,"running_superuser",started_with_special_privs());
/* special constant used by PDU reassembly handling */
/* see dissect_lua() for notes */
WSLUA_REG_GLOBAL_NUMBER(L,"DESEGMENT_ONE_MORE_SEGMENT",DESEGMENT_ONE_MORE_SEGMENT);
/* load system's init.lua */
if (running_in_build_directory()) {
/* Running from build directory, load generated file */
filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "epan" G_DIR_SEPARATOR_S "wslua"
G_DIR_SEPARATOR_S "init.lua", get_progfile_dir());
} else {
filename = get_datafile_path("init.lua");
}
if (( file_exists(filename))) {
lua_load_script(filename, NULL, 0);
}
g_free(filename);
filename = NULL;
/* check if lua is to be disabled */
lua_getglobal(L,"disable_lua");
if (lua_isboolean(L,-1) && lua_toboolean(L,-1)) {
/* disable lua */
lua_close(L);
L = NULL;
return 0;
}
lua_pop(L,1); /* pop the getglobal result */
/* load global scripts */
lua_load_plugins(get_plugin_dir(), cb, client_data, FALSE, FALSE);
/* check whether we should run other scripts even if running superuser */
lua_getglobal(L,"run_user_scripts_when_superuser");
if (lua_isboolean(L,-1) && lua_toboolean(L,-1)) {
run_anyway = TRUE;
}
lua_pop(L,1); /* pop the getglobal result */
/* if we are indeed superuser run user scripts only if told to do so */
if ( (!started_with_special_privs()) || run_anyway ) {
/* load users init.lua */
filename = get_persconffile_path("init.lua", FALSE);
if ((file_exists(filename))) {
if (cb)
(*cb)(RA_LUA_PLUGINS, get_basename(filename), client_data);
lua_load_script(filename, NULL, 0);
}
g_free(filename);
/* load user scripts */
filename = get_plugins_pers_dir();
lua_load_plugins(filename, cb, client_data, FALSE, TRUE);
g_free(filename);
/* load scripts from command line */
while((script_filename = ex_opt_get_next("lua_script"))) {
char* dirname = g_strdup(script_filename);
char* dname = get_dirname(dirname);
if (cb)
(*cb)(RA_LUA_PLUGINS, get_basename(script_filename), client_data);
lua_load_script(script_filename, dname ? dname : "", file_count);
file_count++;
g_free(dirname);
}
}
/* at this point we're set up so register the init routine */
register_init_routine(wslua_init_routine);
/*
* after this point it is too late to register a menu
* disable the function to avoid weirdness
*/
lua_pushcfunction(L, wslua_not_register_menu);
lua_setglobal(L, "register_menu");
/* set up some essential globals */
lua_pinfo = NULL;
lua_tree = NULL;
lua_tvb = NULL;
lua_data_handle = find_dissector("data");
Proto_commit(L);
return 0;
}
int wslua_cleanup(void) {
/* cleanup lua */
lua_close(L);
L = NULL;
return 0;
}
lua_State* wslua_state(void) { return L; }
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=4 expandtab:
* :indentSize=4:tabSize=4:noTabs=true:
*/
| jfzazo/wireshark-hwgen | src/epan/wslua/init_wslua.c | C | gpl-2.0 | 35,503 |
/*
* Copyright 2012 Vincent Povirk for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wincodecs_private.h"
/* WARNING: .NET Media Integration Layer (MIL) directly dereferences
* BitmapImpl members and depends on its exact layout.
*/
typedef struct BitmapImpl {
IMILUnknown1 IMILUnknown1_iface;
LONG ref;
IMILBitmapSource IMILBitmapSource_iface;
IWICBitmap IWICBitmap_iface;
IMILUnknown2 IMILUnknown2_iface;
IWICPalette *palette;
int palette_set;
LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */
BYTE *data;
BOOL is_section; /* TRUE if data is a section created by an application */
UINT width, height;
UINT stride;
UINT bpp;
WICPixelFormatGUID pixelformat;
double dpix, dpiy;
CRITICAL_SECTION cs;
} BitmapImpl;
typedef struct BitmapLockImpl {
IWICBitmapLock IWICBitmapLock_iface;
LONG ref;
BitmapImpl *parent;
UINT width, height;
BYTE *data;
} BitmapLockImpl;
static inline BitmapImpl *impl_from_IWICBitmap(IWICBitmap *iface)
{
return CONTAINING_RECORD(iface, BitmapImpl, IWICBitmap_iface);
}
static inline BitmapImpl *impl_from_IMILBitmapSource(IMILBitmapSource *iface)
{
return CONTAINING_RECORD(iface, BitmapImpl, IMILBitmapSource_iface);
}
static inline BitmapImpl *impl_from_IMILUnknown1(IMILUnknown1 *iface)
{
return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown1_iface);
}
static inline BitmapImpl *impl_from_IMILUnknown2(IMILUnknown2 *iface)
{
return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown2_iface);
}
static inline BitmapLockImpl *impl_from_IWICBitmapLock(IWICBitmapLock *iface)
{
return CONTAINING_RECORD(iface, BitmapLockImpl, IWICBitmapLock_iface);
}
static BOOL BitmapImpl_AcquireLock(BitmapImpl *This, int write)
{
if (write)
{
return 0 == InterlockedCompareExchange(&This->lock, -1, 0);
}
else
{
while (1)
{
LONG prev_val = This->lock;
if (prev_val == -1)
return FALSE;
if (prev_val == InterlockedCompareExchange(&This->lock, prev_val+1, prev_val))
return TRUE;
}
}
}
static void BitmapImpl_ReleaseLock(BitmapImpl *This)
{
while (1)
{
LONG prev_val = This->lock, new_val;
if (prev_val == -1)
new_val = 0;
else
new_val = prev_val - 1;
if (prev_val == InterlockedCompareExchange(&This->lock, new_val, prev_val))
break;
}
}
static HRESULT WINAPI BitmapLockImpl_QueryInterface(IWICBitmapLock *iface, REFIID iid,
void **ppv)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapLock, iid))
{
*ppv = &This->IWICBitmapLock_iface;
}
else
{
FIXME("unknown interface %s\n", debugstr_guid(iid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI BitmapLockImpl_AddRef(IWICBitmapLock *iface)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
return ref;
}
static ULONG WINAPI BitmapLockImpl_Release(IWICBitmapLock *iface)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
if (ref == 0)
{
BitmapImpl_ReleaseLock(This->parent);
IWICBitmap_Release(&This->parent->IWICBitmap_iface);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI BitmapLockImpl_GetSize(IWICBitmapLock *iface,
UINT *puiWidth, UINT *puiHeight)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
if (!puiWidth || !puiHeight)
return E_INVALIDARG;
*puiWidth = This->width;
*puiHeight = This->height;
return S_OK;
}
static HRESULT WINAPI BitmapLockImpl_GetStride(IWICBitmapLock *iface,
UINT *pcbStride)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
TRACE("(%p,%p)\n", iface, pcbStride);
if (!pcbStride)
return E_INVALIDARG;
*pcbStride = This->parent->stride;
return S_OK;
}
static HRESULT WINAPI BitmapLockImpl_GetDataPointer(IWICBitmapLock *iface,
UINT *pcbBufferSize, BYTE **ppbData)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
TRACE("(%p,%p,%p)\n", iface, pcbBufferSize, ppbData);
if (!pcbBufferSize || !ppbData)
return E_INVALIDARG;
*pcbBufferSize = This->parent->stride * (This->height - 1) +
((This->parent->bpp * This->width) + 7)/8;
*ppbData = This->data;
return S_OK;
}
static HRESULT WINAPI BitmapLockImpl_GetPixelFormat(IWICBitmapLock *iface,
WICPixelFormatGUID *pPixelFormat)
{
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
TRACE("(%p,%p)\n", iface, pPixelFormat);
return IWICBitmap_GetPixelFormat(&This->parent->IWICBitmap_iface, pPixelFormat);
}
static const IWICBitmapLockVtbl BitmapLockImpl_Vtbl = {
BitmapLockImpl_QueryInterface,
BitmapLockImpl_AddRef,
BitmapLockImpl_Release,
BitmapLockImpl_GetSize,
BitmapLockImpl_GetStride,
BitmapLockImpl_GetDataPointer,
BitmapLockImpl_GetPixelFormat
};
static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid,
void **ppv)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapSource, iid) ||
IsEqualIID(&IID_IWICBitmap, iid))
{
*ppv = &This->IWICBitmap_iface;
}
else if (IsEqualIID(&IID_IMILBitmap, iid) ||
IsEqualIID(&IID_IMILBitmapSource, iid))
{
*ppv = &This->IMILBitmapSource_iface;
}
else
{
FIXME("unknown interface %s\n", debugstr_guid(iid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI BitmapImpl_AddRef(IWICBitmap *iface)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
return ref;
}
static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
if (ref == 0)
{
if (This->palette) IWICPalette_Release(This->palette);
This->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->cs);
if (This->is_section)
UnmapViewOfFile(This->data);
else
HeapFree(GetProcessHeap(), 0, This->data);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI BitmapImpl_GetSize(IWICBitmap *iface,
UINT *puiWidth, UINT *puiHeight)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
if (!puiWidth || !puiHeight)
return E_INVALIDARG;
*puiWidth = This->width;
*puiHeight = This->height;
return S_OK;
}
static HRESULT WINAPI BitmapImpl_GetPixelFormat(IWICBitmap *iface,
WICPixelFormatGUID *pPixelFormat)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%p)\n", iface, pPixelFormat);
if (!pPixelFormat)
return E_INVALIDARG;
memcpy(pPixelFormat, &This->pixelformat, sizeof(GUID));
return S_OK;
}
static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface,
double *pDpiX, double *pDpiY)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
if (!pDpiX || !pDpiY)
return E_INVALIDARG;
EnterCriticalSection(&This->cs);
*pDpiX = This->dpix;
*pDpiY = This->dpiy;
LeaveCriticalSection(&This->cs);
return S_OK;
}
static HRESULT WINAPI BitmapImpl_CopyPalette(IWICBitmap *iface,
IWICPalette *pIPalette)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%p)\n", iface, pIPalette);
if (!This->palette_set)
return WINCODEC_ERR_PALETTEUNAVAILABLE;
return IWICPalette_InitializeFromPalette(pIPalette, This->palette);
}
static HRESULT WINAPI BitmapImpl_CopyPixels(IWICBitmap *iface,
const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
return copy_pixels(This->bpp, This->data, This->width, This->height,
This->stride, prc, cbStride, cbBufferSize, pbBuffer);
}
static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
DWORD flags, IWICBitmapLock **ppILock)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
BitmapLockImpl *result;
WICRect rc;
TRACE("(%p,%p,%x,%p)\n", iface, prcLock, flags, ppILock);
if (!(flags & (WICBitmapLockRead|WICBitmapLockWrite)) || !ppILock)
return E_INVALIDARG;
if (!prcLock)
{
rc.X = rc.Y = 0;
rc.Width = This->width;
rc.Height = This->height;
prcLock = &rc;
}
else if (prcLock->X >= This->width || prcLock->Y >= This->height ||
prcLock->X + prcLock->Width > This->width ||
prcLock->Y + prcLock->Height > This->height ||
prcLock->Width <= 0 || prcLock->Height <= 0)
return E_INVALIDARG;
else if (((prcLock->X * This->bpp) % 8) != 0)
{
FIXME("Cannot lock at an X coordinate not at a full byte\n");
return E_FAIL;
}
result = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapLockImpl));
if (!result)
return E_OUTOFMEMORY;
if (!BitmapImpl_AcquireLock(This, flags & WICBitmapLockWrite))
{
HeapFree(GetProcessHeap(), 0, result);
return WINCODEC_ERR_ALREADYLOCKED;
}
result->IWICBitmapLock_iface.lpVtbl = &BitmapLockImpl_Vtbl;
result->ref = 1;
result->parent = This;
result->width = prcLock->Width;
result->height = prcLock->Height;
result->data = This->data + This->stride * prcLock->Y +
(This->bpp * prcLock->X)/8;
IWICBitmap_AddRef(&This->IWICBitmap_iface);
*ppILock = &result->IWICBitmapLock_iface;
return S_OK;
}
static HRESULT WINAPI BitmapImpl_SetPalette(IWICBitmap *iface, IWICPalette *pIPalette)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
HRESULT hr;
TRACE("(%p,%p)\n", iface, pIPalette);
if (!This->palette)
{
IWICPalette *new_palette;
hr = PaletteImpl_Create(&new_palette);
if (FAILED(hr)) return hr;
if (InterlockedCompareExchangePointer((void**)&This->palette, new_palette, NULL))
{
/* someone beat us to it */
IWICPalette_Release(new_palette);
}
}
hr = IWICPalette_InitializeFromPalette(This->palette, pIPalette);
if (SUCCEEDED(hr))
This->palette_set = 1;
return S_OK;
}
static HRESULT WINAPI BitmapImpl_SetResolution(IWICBitmap *iface,
double dpiX, double dpiY)
{
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%f,%f)\n", iface, dpiX, dpiY);
EnterCriticalSection(&This->cs);
This->dpix = dpiX;
This->dpiy = dpiY;
LeaveCriticalSection(&This->cs);
return S_OK;
}
static const IWICBitmapVtbl BitmapImpl_Vtbl = {
BitmapImpl_QueryInterface,
BitmapImpl_AddRef,
BitmapImpl_Release,
BitmapImpl_GetSize,
BitmapImpl_GetPixelFormat,
BitmapImpl_GetResolution,
BitmapImpl_CopyPalette,
BitmapImpl_CopyPixels,
BitmapImpl_Lock,
BitmapImpl_SetPalette,
BitmapImpl_SetResolution
};
static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REFIID iid,
void **ppv)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IMILBitmap, iid) ||
IsEqualIID(&IID_IMILBitmapSource, iid))
{
IUnknown_AddRef(&This->IMILBitmapSource_iface);
*ppv = &This->IMILBitmapSource_iface;
return S_OK;
}
else if (IsEqualIID(&IID_IWICBitmap, iid) ||
IsEqualIID(&IID_IWICBitmapSource, iid))
{
IUnknown_AddRef(&This->IWICBitmap_iface);
*ppv = &This->IWICBitmap_iface;
return S_OK;
}
FIXME("unknown interface %s\n", debugstr_guid(iid));
*ppv = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IMILBitmapImpl_AddRef(IMILBitmapSource *iface)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
return IWICBitmap_AddRef(&This->IWICBitmap_iface);
}
static ULONG WINAPI IMILBitmapImpl_Release(IMILBitmapSource *iface)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
return IWICBitmap_Release(&This->IWICBitmap_iface);
}
static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface,
UINT *width, UINT *height)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p,%p)\n", iface, width, height);
return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height);
}
static const struct
{
const GUID *WIC_format;
int enum_format;
} pixel_fmt_map[] =
{
{ &GUID_WICPixelFormatDontCare, 0 },
{ &GUID_WICPixelFormat1bppIndexed, 1 },
{ &GUID_WICPixelFormat2bppIndexed, 2 },
{ &GUID_WICPixelFormat4bppIndexed, 3 },
{ &GUID_WICPixelFormat8bppIndexed, 4 },
{ &GUID_WICPixelFormatBlackWhite, 5 },
{ &GUID_WICPixelFormat2bppGray, 6 },
{ &GUID_WICPixelFormat4bppGray, 7 },
{ &GUID_WICPixelFormat8bppGray, 8 },
{ &GUID_WICPixelFormat16bppBGR555, 9 },
{ &GUID_WICPixelFormat16bppBGR565, 0x0a },
{ &GUID_WICPixelFormat16bppGray, 0x0b },
{ &GUID_WICPixelFormat24bppBGR, 0x0c },
{ &GUID_WICPixelFormat24bppRGB, 0x0d },
{ &GUID_WICPixelFormat32bppBGR, 0x0e },
{ &GUID_WICPixelFormat32bppBGRA, 0x0f },
{ &GUID_WICPixelFormat32bppPBGRA, 0x10 },
{ &GUID_WICPixelFormat48bppRGB, 0x15 },
{ &GUID_WICPixelFormat64bppRGBA, 0x16 },
{ &GUID_WICPixelFormat64bppPRGBA, 0x17 },
{ &GUID_WICPixelFormat32bppCMYK, 0x1c }
};
static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface,
int *format)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
int i;
TRACE("(%p,%p)\n", iface, format);
if (!format) return E_INVALIDARG;
*format = 0;
for (i = 0; i < sizeof(pixel_fmt_map)/sizeof(pixel_fmt_map[0]); i++)
{
if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat))
{
*format = pixel_fmt_map[i].enum_format;
break;
}
}
TRACE("=> %u\n", *format);
return S_OK;
}
static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface,
double *dpix, double *dpiy)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p,%p)\n", iface, dpix, dpiy);
return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy);
}
static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface,
IWICPalette *palette)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p)\n", iface, palette);
return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette);
}
static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface,
const WICRect *rc, UINT stride, UINT size, BYTE *buffer)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer);
return IWICBitmap_CopyPixels(&This->IWICBitmap_iface, rc, stride, size, buffer);
}
static HRESULT WINAPI IMILBitmapImpl_unknown1(IMILBitmapSource *iface, void **ppv)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p)\n", iface, ppv);
if (!ppv) return E_INVALIDARG;
/* reference count is not incremented here */
*ppv = &This->IMILUnknown1_iface;
return S_OK;
}
static HRESULT WINAPI IMILBitmapImpl_Lock(IMILBitmapSource *iface, const WICRect *rc, DWORD flags, IWICBitmapLock **lock)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p,%08x,%p)\n", iface, rc, flags, lock);
return IWICBitmap_Lock(&This->IWICBitmap_iface, rc, flags, lock);
}
static HRESULT WINAPI IMILBitmapImpl_Unlock(IMILBitmapSource *iface, IWICBitmapLock *lock)
{
TRACE("(%p,%p)\n", iface, lock);
IWICBitmapLock_Release(lock);
return S_OK;
}
static HRESULT WINAPI IMILBitmapImpl_SetPalette(IMILBitmapSource *iface, IWICPalette *palette)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%p)\n", iface, palette);
return IWICBitmap_SetPalette(&This->IWICBitmap_iface, palette);
}
static HRESULT WINAPI IMILBitmapImpl_SetResolution(IMILBitmapSource *iface, double dpix, double dpiy)
{
BitmapImpl *This = impl_from_IMILBitmapSource(iface);
TRACE("(%p,%f,%f)\n", iface, dpix, dpiy);
return IWICBitmap_SetResolution(&This->IWICBitmap_iface, dpix, dpiy);
}
static HRESULT WINAPI IMILBitmapImpl_AddDirtyRect(IMILBitmapSource *iface, const WICRect *rc)
{
FIXME("(%p,%p): stub\n", iface, rc);
return E_NOTIMPL;
}
static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl =
{
IMILBitmapImpl_QueryInterface,
IMILBitmapImpl_AddRef,
IMILBitmapImpl_Release,
IMILBitmapImpl_GetSize,
IMILBitmapImpl_GetPixelFormat,
IMILBitmapImpl_GetResolution,
IMILBitmapImpl_CopyPalette,
IMILBitmapImpl_CopyPixels,
IMILBitmapImpl_unknown1,
IMILBitmapImpl_Lock,
IMILBitmapImpl_Unlock,
IMILBitmapImpl_SetPalette,
IMILBitmapImpl_SetResolution,
IMILBitmapImpl_AddDirtyRect
};
static HRESULT WINAPI IMILUnknown1Impl_QueryInterface(IMILUnknown1 *iface, REFIID iid,
void **ppv)
{
FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface)
{
BitmapImpl *This = impl_from_IMILUnknown1(iface);
return IWICBitmap_AddRef(&This->IWICBitmap_iface);
}
static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface)
{
BitmapImpl *This = impl_from_IMILUnknown1(iface);
return IWICBitmap_Release(&This->IWICBitmap_iface);
}
DECLSPEC_HIDDEN void WINAPI IMILUnknown1Impl_unknown1(IMILUnknown1 *iface, void *arg)
{
FIXME("(%p,%p): stub\n", iface, arg);
}
static HRESULT WINAPI IMILUnknown1Impl_unknown2(IMILUnknown1 *iface, void *arg1, void *arg2)
{
FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2);
return E_NOTIMPL;
}
DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown3(IMILUnknown1 *iface, void *arg)
{
FIXME("(%p,%p): stub\n", iface, arg);
return E_NOTIMPL;
}
static HRESULT WINAPI IMILUnknown1Impl_unknown4(IMILUnknown1 *iface, void *arg)
{
FIXME("(%p,%p): stub\n", iface, arg);
return E_NOTIMPL;
}
static HRESULT WINAPI IMILUnknown1Impl_unknown5(IMILUnknown1 *iface, void *arg)
{
FIXME("(%p,%p): stub\n", iface, arg);
return E_NOTIMPL;
}
static HRESULT WINAPI IMILUnknown1Impl_unknown6(IMILUnknown1 *iface, DWORD64 arg)
{
FIXME("(%p,%s): stub\n", iface, wine_dbgstr_longlong(arg));
return E_NOTIMPL;
}
static HRESULT WINAPI IMILUnknown1Impl_unknown7(IMILUnknown1 *iface, void *arg)
{
FIXME("(%p,%p): stub\n", iface, arg);
return E_NOTIMPL;
}
DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown8(IMILUnknown1 *iface)
{
FIXME("(%p): stub\n", iface);
return E_NOTIMPL;
}
DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown1, 8)
DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown3, 8)
DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown8, 4)
static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl =
{
IMILUnknown1Impl_QueryInterface,
IMILUnknown1Impl_AddRef,
IMILUnknown1Impl_Release,
THISCALL(IMILUnknown1Impl_unknown1),
IMILUnknown1Impl_unknown2,
THISCALL(IMILUnknown1Impl_unknown3),
IMILUnknown1Impl_unknown4,
IMILUnknown1Impl_unknown5,
IMILUnknown1Impl_unknown6,
IMILUnknown1Impl_unknown7,
THISCALL(IMILUnknown1Impl_unknown8)
};
static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid,
void **ppv)
{
FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface)
{
FIXME("(%p): stub\n", iface);
return 0;
}
static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface)
{
FIXME("(%p): stub\n", iface);
return 0;
}
static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void **arg2)
{
FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2);
if (arg2) *arg2 = NULL;
return E_NOTIMPL;
}
static HRESULT WINAPI IMILUnknown2Impl_unknown2(IMILUnknown2 *iface, void *arg1, void *arg2)
{
FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2);
return E_NOTIMPL;
}
static HRESULT WINAPI IMILUnknown2Impl_unknown3(IMILUnknown2 *iface, void *arg1)
{
FIXME("(%p,%p): stub\n", iface, arg1);
return E_NOTIMPL;
}
static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl =
{
IMILUnknown2Impl_QueryInterface,
IMILUnknown2Impl_AddRef,
IMILUnknown2Impl_Release,
IMILUnknown2Impl_unknown1,
IMILUnknown2Impl_unknown2,
IMILUnknown2Impl_unknown3
};
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
UINT stride, UINT datasize, BYTE *data,
REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option,
IWICBitmap **ppIBitmap)
{
HRESULT hr;
BitmapImpl *This;
UINT bpp;
hr = get_pixelformat_bpp(pixelFormat, &bpp);
if (FAILED(hr)) return hr;
if (!stride) stride = (((bpp*uiWidth)+31)/32)*4;
if (!datasize) datasize = stride * uiHeight;
if (datasize < stride * uiHeight) return WINCODEC_ERR_INSUFFICIENTBUFFER;
if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl));
if (!This) return E_OUTOFMEMORY;
if (!data)
{
data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize);
if (!data)
{
HeapFree(GetProcessHeap(), 0, This);
return E_OUTOFMEMORY;
}
This->is_section = FALSE;
}
else
This->is_section = TRUE;
This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl;
This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl;
This->IMILUnknown1_iface.lpVtbl = &IMILUnknown1Impl_Vtbl;
This->IMILUnknown2_iface.lpVtbl = &IMILUnknown2Impl_Vtbl;
This->ref = 1;
This->palette = NULL;
This->palette_set = 0;
This->lock = 0;
This->data = data;
This->width = uiWidth;
This->height = uiHeight;
This->stride = stride;
This->bpp = bpp;
memcpy(&This->pixelformat, pixelFormat, sizeof(GUID));
This->dpix = This->dpiy = 0.0;
InitializeCriticalSection(&This->cs);
This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": BitmapImpl.lock");
*ppIBitmap = &This->IWICBitmap_iface;
return S_OK;
}
| GreenteaOS/Kernel | third-party/reactos/dll/win32/windowscodecs/bitmap.c | C | gpl-2.0 | 24,064 |
package xxl.container.classic;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static xxl.java.container.classic.MetaMap.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import xxl.java.support.Function;
public class MetaMapTest {
@Test
public void putValueInManyKeys() {
Map<String, String> map = newHashMap();
assertEquals(0, map.size());
List<String> keys = Arrays.asList("a", "b", "c", "d");
putMany(map, "C", keys);
assertEquals(4, map.size());
for (String key : keys) {
assertTrue(map.containsKey(key));
assertEquals("C", map.get(key));
}
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void unionOfkeySets() {
Map<String, String> stringMap = newHashMap();
Map<String, Byte> byteMap = newHashMap();
Collection<String> keyUnion = keySetUnion((Collection) asList(stringMap, byteMap));
assertTrue(keyUnion.isEmpty());
stringMap.put("a", "b");
keyUnion = keySetUnion((Collection) asList(stringMap, byteMap));
assertEquals(1, keyUnion.size());
assertTrue(keyUnion.contains("a"));
byteMap.put("a", (byte) 0x29);
keyUnion = keySetUnion((Collection) asList(stringMap, byteMap));
assertEquals(1, keyUnion.size());
assertTrue(keyUnion.contains("a"));
stringMap.put("b", "c");
byteMap.put("z", (byte) 0x23);
keyUnion = keySetUnion((Collection) asList(stringMap, byteMap));
assertEquals(3, keyUnion.size());
assertTrue(keyUnion.containsAll(asList("a", "b", "z")));
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void intersectionOfKeySets() {
Map<String, Object> empty = newHashMap();
Map<String, Object> mapA = newHashMap(asList("a", "c"), asList(null, null));
Map<String, Object> mapB = newHashMap(asList("a", "b", "c"), asList(null, null, null));
Map<String, Object> mapC = newHashMap(asList("x", "y", "z"), asList(null, null, null));
assertEquals(0, keySetIntersection((Collection) asList()).size());
assertEquals(0, keySetIntersection(asList(empty)).size());
assertEquals(2, keySetIntersection(asList(mapA)).size());
assertTrue(keySetIntersection(asList(mapA)).containsAll(asList("a", "c")));
assertEquals(0, keySetIntersection(asList(empty, mapA)).size());
assertEquals(2, keySetIntersection(asList(mapA, mapB)).size());
assertTrue(keySetIntersection(asList(mapA)).containsAll(asList("a", "c")));
assertEquals(0, keySetIntersection(asList(mapA, mapC)).size());
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void mapContainsKeys() {
Map<String, Integer> map = newHashMap(asList("a", "b", "c"), asList(10, 20, 30));
assertTrue(containsAllKeys(asList("a", "b", "c"), map));
assertTrue(containsAllKeys(asList("a", "b"), map));
assertTrue(containsAllKeys((List) asList(), map));
assertFalse(containsAllKeys(asList("a", "b", "C"), map));
assertFalse(containsAllKeys(asList(""), map));
assertFalse(containsAllKeys(asList("C"), map));
}
@Test
public void assertContentOfMap() {
Map<String, Character> aMap = newHashMap();
aMap.put("a", 'a');
aMap.put("b", 'b');
aMap.put("c", 'c');
assertTrue(sameContent(aMap, asList("a", "b", "c"), asList('a', 'b', 'c')));
assertFalse(sameContent(aMap, asList("a", "b", "c"), asList('a', 'b', 'd')));
assertFalse(sameContent(aMap, asList("a", "b", "d"), asList('a', 'b', 'c')));
assertFalse(sameContent(aMap, asList("a", "b", "c", "d"), asList('a', 'b', 'c', 'd')));
assertFalse(sameContent(aMap, asList("a", "b"), asList('a', 'b')));
assertFalse(sameContent(aMap, asList("a", "b", "c"), asList('a', 'b')));
assertFalse(sameContent(aMap, asList("a", "b", "c"), asList('a', 'b', 'c', 'd')));
}
@Test
public void adHocHashMap() {
Map<String, Integer> adHocMap = newHashMap(asList("A", "b", "C"), asList(1, 2, 3));
assertEquals(3, adHocMap.size());
assertTrue(adHocMap.containsKey("A"));
assertTrue(adHocMap.containsKey("b"));
assertTrue(adHocMap.containsKey("C"));
assertEquals(Integer.valueOf(1), adHocMap.get("A"));
assertEquals(Integer.valueOf(2), adHocMap.get("b"));
assertEquals(Integer.valueOf(3), adHocMap.get("C"));
}
@Test
public void parseValuesOfMapAsIntegers() {
Map<String, String> toBeParsed = newHashMap(asList("a", "b", "c"), asList("10", "20", "30"));
Map<String, Integer> parsed = valuesParsedAsInteger(toBeParsed);
assertTrue(sameContent(parsed, asList("a", "b", "c"), asList(10, 20, 30)));
}
@Test
public void addAMapToManyMaps() {
Map<String, String> newMap = newHashMap(asList("a", "b", "c"), asList("+", "++", "+++"));
Map<String, String> firstMap = newHashMap(asList("d", "e", "f"), asList(".", "..", "..."));
Map<String, String> secondMap = newHashMap(asList("g", "h", "i"), asList("-", "--", "---"));
putAllFlat(newMap, asList(firstMap, secondMap));
assertTrue(sameContent(firstMap, asList("a", "b", "c", "d", "e", "f"), asList("+", "++", "+++", ".", "..", "...")));
assertTrue(sameContent(secondMap, asList("a", "b", "c", "g", "h", "i"), asList("+", "++", "+++", "-", "--", "---")));
}
@Test
public void mapConstructorWithOneAssociation() {
Map<String, Integer> adHocMap = newHashMap("aaaa", 4);
assertFalse(adHocMap.isEmpty());
assertEquals(1, adHocMap.size());
assertTrue(adHocMap.containsKey("aaaa"));
assertEquals(Integer.valueOf(4), adHocMap.get("aaaa"));
}
@Test
public void restrictedValueOfAMap() {
Map<String, String> map = newHashMap(asList("a", "b", "c"), asList("z", "z", "z"));
assertTrue(onlyValueIs("z", map));
assertFalse(onlyValueIs("y", map));
map.put("x", "x");
assertFalse(onlyValueIs("x", map));
assertFalse(onlyValueIs("z", map));
assertFalse(onlyValueIs("z", newHashMap()));
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void restricedValuesOfAMap() {
Map<String, String> map = newHashMap(asList("a", "b", "c"), asList("x", "y", "z"));
assertTrue(allValuesIn(asList("x", "y", "z"), map));
assertTrue(allValuesIn(asList("x", "y", "z", "t"), map));
assertFalse(allValuesIn(asList("w", "y", "z"), map));
assertFalse(allValuesIn(asList("y", "z"), map));
assertFalse(allValuesIn((List) asList(), map));
map.put("w", "w");
assertFalse(allValuesIn(asList("x", "y", "z"), map));
assertFalse(allValuesIn((List) asList(), newHashMap()));
}
@Test
public void mapKeysByValue() {
Map<String, String> map = newHashMap(asList("a", "b", "c"), asList("z", "z", "z"));
Collection<String> keys = keysWithValue("z", map);
assertEquals(3, keys.size());
assertEquals(map.keySet(), keys);
keys = keysWithValue("", map);
assertEquals(0, keys.size());
keys = keysWithValue("y", map);
assertEquals(0, keys.size());
}
@Test
public void mapKeysByValues() {
Map<String, String> map = newHashMap(asList("a", "b", "c"), asList("x", "y", "z"));
Collection<String> keys = keysWithValuesIn(asList("x", "y"), map);
assertEquals(2, keys.size());
assertTrue(keys.contains("a"));
assertTrue(keys.contains("b"));
keys = keysWithValuesIn(asList("v", "w", "x", "y", "z"), map);
assertEquals(3, keys.size());
assertEquals(map.keySet(), keys);
}
@Test
public void frequenciesInList() {
List<String> withRepetitions = asList("a", "b", "c", "a", "a", "b");
Map<String, Integer> frequencies = frequencies(withRepetitions);
Map<String, Integer> actualFrequencies = newHashMap(asList("a", "b", "c"), asList(3, 2, 1));
assertEquals(actualFrequencies, frequencies);
}
@Test
public void getDefaultValueIfAbsent() {
Map<String, String> adHocMap = newHashMap("a", "A");
assertEquals(1, adHocMap.size());
assertEquals("A", getIfAbsent(adHocMap, "a", "_"));
assertEquals("B", getIfAbsent(adHocMap, "b", "B"));
assertFalse(adHocMap.containsKey("b"));
assertEquals(1, adHocMap.size());
}
@Test
public void linkedHashMapPreservesOrder() {
Map<String, String> linkedHashMap = newLinkedHashMap();
linkedHashMap.put("a", "A");
linkedHashMap.put("0", "10");
linkedHashMap.put("-", "+");
linkedHashMap.put(".", ":");
linkedHashMap.put("B", "a");
linkedHashMap.put("A", "a");
List<String> linkedHashMapKeys = new LinkedList<String>(linkedHashMap.keySet());
assertEquals(linkedHashMapKeys.get(0), "a");
assertEquals(linkedHashMapKeys.get(1), "0");
assertEquals(linkedHashMapKeys.get(2), "-");
assertEquals(linkedHashMapKeys.get(3), ".");
assertEquals(linkedHashMapKeys.get(4), "B");
assertEquals(linkedHashMapKeys.get(5), "A");
}
@Test
public void copyOfMapRetainsMapClass() {
Map<String, String> copy;
Map<String, String> hashMap = newHashMap();
Map<String, String> linkedHashMap = newLinkedHashMap();
Map<String, String> identityHashMap = newIdentityHashMap(10);
copy = copyOf(hashMap);
assertEquals(copy, hashMap);
assertEquals(HashMap.class, copy.getClass());
copy = copyOf(linkedHashMap);
assertEquals(copy, linkedHashMap);
assertEquals(LinkedHashMap.class, copy.getClass());
copy = copyOf(identityHashMap);
assertEquals(copy, identityHashMap);
assertEquals(IdentityHashMap.class, copy.getClass());
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
public void reduceMapToSelectedKeys() {
Map<String, Integer> map = newHashMap(asList("a", "b", "c", "d"), asList(1, 2, 3, 4));
assertEquals(0, extractedWithKeys((Collection) asList(), map).size());
assertEquals(1, extractedWithKeys(asList("a"), map).size());
assertTrue(extractedWithKeys(asList("a"), map).containsKey("a"));
assertEquals(1, extractedWithKeys(asList("a"), map).get("a").intValue());
assertEquals(1, extractedWithKeys(asList("a", "x", "y", "z"), map).size());
assertEquals(2, extractedWithKeys(asList("a", "x", "c", "y"), map).size());
assertTrue(extractedWithKeys(asList("a", "x", "c", "y"), map).containsKey("a"));
assertTrue(extractedWithKeys(asList("a", "x", "c", "y"), map).containsKey("c"));
assertEquals(map, extractedWithKeys(asList("a", "b", "c", "d"), map));
}
@Test
public void createMapApplyingFunction() {
Map<String, String> map = newHashMap(asList("a", "b", "c"), asList("A", "B", "C"));
Function<String, String> extract = methodGet(map);
Map<String, String> newMap = newHashMap(map.keySet(), extract);
assertEquals(map, newMap);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void remapKeysOfAMap() {
Map<String, String> map = newHashMap(asList("a", "aa", "aaa"), asList("1", "2", "3"));
Map<Integer, String> remade = remade(map, (Function) function());
assertEquals(3, remade.size());
assertTrue(remade.containsKey(1));
assertTrue(remade.containsKey(2));
assertTrue(remade.containsKey(3));
assertEquals("1", remade.get(1));
assertEquals("2", remade.get(2));
assertEquals("3", remade.get(3));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void remapValuesOfAMap() {
Map<String, String> map = newHashMap(asList("1", "2", "3"), asList("a", "aa", "aaa"));
Map<String, Integer> remade = remapped(map, (Function) function());
assertEquals(3, remade.size());
assertTrue(remade.containsKey("1"));
assertTrue(remade.containsKey("2"));
assertTrue(remade.containsKey("3"));
assertTrue(1 == remade.get("1").intValue());
assertTrue(2 == remade.get("2").intValue());
assertTrue(3 == remade.get("3").intValue());
}
@Test
public void autoMapCreation() {
assertTrue(autoMap(asList()).isEmpty());
Map<Integer, Integer> autoMap = autoMap(asList(1,2,3,4));
assertFalse(autoMap.isEmpty());
assertTrue(1 == autoMap.get(1));
assertTrue(2 == autoMap.get(2));
assertTrue(3 == autoMap.get(3));
assertTrue(4 == autoMap.get(4));
}
private Function<Object, Integer> function() {
return new Function<Object, Integer>() {
@Override
public Integer outputFor(Object value) {
return value.toString().length();
}
};
}
@Test
public void multipleKeyRemoval() {
List<Integer> emptyList = asList();
Map<Integer, Integer> map = newHashMap();
assertTrue(removeKeys(emptyList, map).isEmpty());
assertTrue(removeKeys(asList(1,2,3), map).isEmpty());
map = newHashMap(asList(1, 2, 3, 4), asList(1, 1, 1, 1));
assertTrue(removeKeys(emptyList, map).isEmpty());
assertTrue(4 == map.size());
assertTrue(removeKeys(asList(1), map).contains(1));
assertTrue(3 == map.size());
assertTrue(removeKeys(asList(1, 2, 3), map).size()==2);
assertTrue(1 == map.size());
}
}
| SpoonLabs/nopol | nopol/src/test/java/xxl/container/classic/MetaMapTest.java | Java | gpl-2.0 | 12,568 |
// Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
// Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
//
// This file is part of the VNC system.
//
// The VNC system is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// TightVNC distribution homepage on the Web: http://www.tightvnc.com/
//
// If the source code for the VNC system is not available from the place
// whence you received this file, check http://www.uk.research.att.com/vnc or contact
// the authors on vnc@uk.research.att.com for information on obtaining it.
// ZLIB Encoding
//
// The bits of the ClientConnection object to do with zlib.
#include "stdhdrs.h"
#include "vncviewer.h"
#include "ClientConnection.h"
#include "lzo/minilzo.h"
void ClientConnection::ReadUltraRect(rfbFramebufferUpdateRectHeader *pfburh) {
UINT numpixels = pfburh->r.w * pfburh->r.h;
// this assumes at least one byte per pixel. Naughty.
UINT numRawBytes = numpixels * m_minPixelBytes;
UINT numCompBytes;
lzo_uint new_len;
rfbZlibHeader hdr;
ReadExact((char *)&hdr, sz_rfbZlibHeader);
numCompBytes = Swap32IfLE(hdr.nBytes);
// Read in the compressed data
CheckBufferSize(numCompBytes);
ReadExact(m_netbuf, numCompBytes);
CheckZlibBufferSize(numRawBytes);
lzo1x_decompress((BYTE*)m_netbuf,numCompBytes,(BYTE*)m_zlibbuf,&new_len,NULL);
SoftCursorLockArea(pfburh->r.x, pfburh->r.y,pfburh->r.w,pfburh->r.h);
if (!Check_Rectangle_borders(pfburh->r.x, pfburh->r.y,pfburh->r.w,pfburh->r.h)) return;
omni_mutex_lock l(m_bitmapdcMutex);
if (m_DIBbits) ConvertAll(pfburh->r.w,pfburh->r.h,pfburh->r.x, pfburh->r.y,m_myFormat.bitsPerPixel/8,(BYTE *)m_zlibbuf,(BYTE *)m_DIBbits,m_si.framebufferWidth);
}
void ClientConnection::ReadUltraZip(rfbFramebufferUpdateRectHeader *pfburh,HRGN *prgn)
{
UINT nNbCacheRects = pfburh->r.x;
UINT numRawBytes = pfburh->r.y+pfburh->r.w*65535;
UINT numCompBytes;
lzo_uint new_len;
rfbZlibHeader hdr;
// Read in the rfbZlibHeader
ReadExact((char *)&hdr, sz_rfbZlibHeader);
numCompBytes = Swap32IfLE(hdr.nBytes);
// Check the net buffer
CheckBufferSize(numCompBytes);
// Read the compressed data
ReadExact((char *)m_netbuf, numCompBytes);
// Verify buffer space for cache rects list
CheckZlibBufferSize(numRawBytes+500);
lzo1x_decompress((BYTE*)m_netbuf,numCompBytes,(BYTE*)m_zlibbuf,&new_len,NULL);
BYTE* pzipbuf = m_zlibbuf;
for (int i = 0 ; i < nNbCacheRects; i++)
{
rfbFramebufferUpdateRectHeader surh;
memcpy((char *) &surh,pzipbuf, sz_rfbFramebufferUpdateRectHeader);
surh.r.x = Swap16IfLE(surh.r.x);
surh.r.y = Swap16IfLE(surh.r.y);
surh.r.w = Swap16IfLE(surh.r.w);
surh.r.h = Swap16IfLE(surh.r.h);
surh.encoding = Swap32IfLE(surh.encoding);
pzipbuf += sz_rfbFramebufferUpdateRectHeader;
RECT rect;
rect.left = surh.r.x;
rect.right = surh.r.x + surh.r.w;
rect.top = surh.r.y;
rect.bottom = surh.r.y + surh.r.h;
//border check
if (!Check_Rectangle_borders(rect.left,rect.top,surh.r.w,surh.r.h)) return;
SoftCursorLockArea(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
if ( surh.encoding==rfbEncodingRaw)
{
omni_mutex_lock l(m_bitmapdcMutex);
UINT numpixels = surh.r.w * surh.r.h;
if (m_DIBbits) ConvertAll(surh.r.w,surh.r.h,surh.r.x, surh.r.y,m_myFormat.bitsPerPixel/8,(BYTE *)pzipbuf,(BYTE *)m_DIBbits,m_si.framebufferWidth);
pzipbuf +=numpixels*m_myFormat.bitsPerPixel/8;
InvalidateRegion(&rect,prgn);
}
}
} | newmind/uvnc_rds | tabbed_viewer/ClientConnectionUltra.cpp | C++ | gpl-2.0 | 4,132 |
<div data-theme="a" data-role="header">
<a data-role="button" data-rel="back" data-icon="arrow-l" data-iconpos="left" class="ui-btn-left">
Back
</a>
<h3>
Object
</h3>
</div>
<div data-role="content">
<div id="properties" class="tab-content">
<form action="" method="POST">
<div data-role="fieldcontain">
<label for="description">
Description
</label>
<input name="description" id="description" placeholder="" value="" type="text" >
</div>
<div data-role="fieldcontain">
<label for="category">
Category
</label>
<input name="category" id="category" placeholder="" value="" type="text" >
</div>
<div data-role="fieldcontain">
<label for="cost">
Cost
</label>
<input name="cost" id="cost" placeholder="" value="0" type="number" >
</div>
<div data-role="fieldcontain">
<label for="dueBy">
Due by
</label>
<input name="dueBy" id="dueBy" placeholder="" value="" type="date" >
</div>
<div data-role="fieldcontain">
<label for="notes">
Notes
</label>
<textarea name="notes" id="notes" placeholder="" ></textarea>
</div>
</form>
<div data-role="fieldcontain">
<label for="complete">
Complete?
</label>
<select name="complete" id="complete" data-theme="" data-role="slider" disabled="disabled">
<option value="off">
No
</option>
<option value="on">
Yes
</option>
</select>
</div>
<div data-role="fieldcontain">
<label for="versionSequence">
Version
</label>
<input name="" id="versionSequence" placeholder="" value="" disabled >
</div>
<a data-role="button" href="" id="editObject">
Edit
</a>
</div>
<div id="actions" class="tab-content">
<ul id="objectActionsList" data-role="listview" data-divider-theme="b" data-inset="true">
</ul>
</div>
<div id="collections" class="tab-content">
<ul id="objectCollectionsList" data-role="listview" data-divider-theme="b" data-inset="true">
</ul>
</div>
<!-- the navbar markup -->
<div data-theme="a" data-role="footer" data-position="fixed">
<div data-role="navbar">
<ul>
<li><a href="#" class="ui-btn-active" data-href="properties">Properties</a></li>
<li><a href="#" data-href="actions">Actions</a></li>
<li><a href="#" data-href="collections">Collections</a></li>
</ul>
</div>
</div>
</div> | ProyectoTypes/inventariohardware | webapp/src/main/webapp/Content/partials/object.html | HTML | gpl-2.0 | 2,568 |
<span class="tve_options_headline"><span class="tve_icm tve-ic-move"></span><?php echo __( "Default Social Sharing options", "thrive-cb" ) ?></span>
<ul class="tve_menu">
<li class="tve_ed_btn tve_btn_text tve_click" data-ctrl="function:social.openOptions"><?php echo __( "Social Options", "thrive-cb" ) ?></li>
<li class="tve_text tve_text_ctrl">
<label class="tve_left"><?php echo __( "Button type:", "thrive-cb" ) ?> </label>
</li>
<li class="tve_ed_btn tve_btn_text">
<div class="tve_option_separator">
<span class="tve_ind tve_left" data-default="Button"><?php echo __( "Button", "thrive-cb" ) ?></span><span
class="tve_caret tve_icm tve_left"></span>
<div class="tve_clear"></div>
<div class="tve_sub_btn">
<div class="tve_sub active_sub_menu">
<ul>
<li id="tve_social_btn" data-type="btn" class="tve_click" data-ctrl="function:social.defaultButtonType"><?php echo __( "Button", "thrive-cb" ) ?></li>
<li id="tve_social_btn_count" data-type="btn_count" class="tve_click" data-ctrl="function:social.defaultButtonType"><?php echo __( "Button + count", "thrive-cb" ) ?></li>
</ul>
</div>
</div>
</div>
</li>
<li class="tve_ed_btn tve_btn_text tve_click" data-ctrl="function:social.enableSortable"><?php echo __( "Modify Order of Buttons", "thrive-cb" ) ?></li>
<?php include dirname( __FILE__ ) . '/_margin.php' ?>
<li class="tve_text tve_firstOnRow">
<?php echo __( "Align:", "thrive-cb" ) ?>
</li>
<li id="tve_leftBtn" class="btn_alignment tve_alignment_left">
<?php echo __( "Left", "thrive-cb" ) ?>
</li>
<li id="tve_centerBtn" class="btn_alignment tve_alignment_center">
<?php echo __( "Center", "thrive-cb" ) ?>
</li>
<li id="tve_rightBtn" class="btn_alignment tve_alignment_right">
<?php echo __( "Right", "thrive-cb" ) ?>
</li>
</ul> | tuffon/imaginewithus | wp-content/plugins/thrive-leads/tcb/editor/inc/menu/social_default.php | PHP | gpl-2.0 | 1,833 |
#include "config.h"
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-keyfile.h>
#include "panel-ditem-editor.h"
#include "panel-icon-names.h"
#include "panel-util.h"
/* FIXME Symbols needed by panel-util.c - sucky */
#include "applet.h"
GSList *mate_panel_applet_list_applets (void) { return NULL; }
#include "panel-config-global.h"
gboolean panel_global_config_get_tooltips_enabled (void) { return FALSE; }
#include "panel-lockdown.h"
gboolean panel_lockdown_get_disable_lock_screen (void) { return FALSE; }
static int dialogs = 0;
static gboolean create_new = FALSE;
static char **desktops = NULL;
static GOptionEntry options[] = {
{ "create-new", 0, 0, G_OPTION_ARG_NONE, &create_new, N_("Create new file in the given directory"), NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &desktops, NULL, N_("[FILE...]") },
{ NULL }
};
static void
dialog_destroyed (GtkWidget *dialog, gpointer data)
{
dialogs --;
if (dialogs <= 0)
gtk_main_quit ();
}
static void
validate_for_filename (char *file)
{
char *ptr;
g_return_if_fail (file != NULL);
ptr = file;
while (*ptr != '\0') {
if (*ptr == '/')
*ptr = '_';
ptr++;
}
}
static char *
find_uri_on_save (PanelDItemEditor *dialog,
gpointer data)
{
GKeyFile *keyfile;
char *name;
char *filename;
char *uri;
char *dir;
keyfile = panel_ditem_editor_get_key_file (dialog);
name = panel_key_file_get_string (keyfile, "Name");
validate_for_filename (name);
filename = g_filename_from_utf8 (name, -1, NULL, NULL, NULL);
g_free (name);
if (filename == NULL)
filename = g_strdup ("foo");
dir = g_object_get_data (G_OBJECT (dialog), "dir");
uri = panel_make_unique_desktop_path_from_name (dir, filename);
g_free (filename);
return uri;
}
static void
error_reported (GtkWidget *dialog,
const char *primary,
const char *secondary,
gpointer data)
{
panel_error_dialog (GTK_WINDOW (dialog), NULL,
"error_editing_launcher", TRUE,
primary, secondary);
}
int
main (int argc, char * argv[])
{
GError *error = NULL;
int i;
bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
if (!gtk_init_with_args (&argc, &argv,
_("- Edit .desktop files"),
options,
GETTEXT_PACKAGE,
&error)) {
g_printerr ("%s\n", error->message);
g_error_free (error);
return 1;
}
gtk_window_set_default_icon_name (PANEL_ICON_LAUNCHER);
if (desktops == NULL ||
desktops[0] == NULL) {
g_printerr ("mate-desktop-item-edit: no file to edit\n");
return 0;
}
for (i = 0; desktops[i] != NULL; i++) {
GFile *file;
GFileInfo *info;
GFileType type;
char *uri;
char *path;
GtkWidget *dlg = NULL;
file = g_file_new_for_commandline_arg (desktops[i]);
uri = g_file_get_uri (file);
path = g_file_get_path (file);
info = g_file_query_info (file, "standard::type",
G_FILE_QUERY_INFO_NONE, NULL, NULL);
g_object_unref (file);
if (info) {
type = g_file_info_get_file_type (info);
if (type == G_FILE_TYPE_DIRECTORY && create_new) {
dlg = panel_ditem_editor_new (NULL, NULL,
_("Create Launcher"));
g_object_set_data_full (G_OBJECT (dlg), "dir",
g_strdup (path),
(GDestroyNotify)g_free);
panel_ditem_register_save_uri_func (PANEL_DITEM_EDITOR (dlg),
find_uri_on_save,
NULL);
} else if (type == G_FILE_TYPE_DIRECTORY) {
/* Rerun this iteration with the .directory
* file
* Note: No need to free, for one we can't free
* an individual member of desktops and
* secondly we will soon exit */
desktops[i] = g_build_path ("/", uri,
".directory", NULL);
i--;
} else if (type == G_FILE_TYPE_REGULAR
&& g_str_has_suffix (desktops [i],
".directory")
&& !create_new) {
dlg = panel_ditem_editor_new_directory (NULL,
uri,
_("Directory Properties"));
} else if (type == G_FILE_TYPE_REGULAR
&& g_str_has_suffix (desktops [i],
".desktop")
&& !create_new) {
dlg = panel_ditem_editor_new (NULL, uri,
_("Launcher Properties"));
} else if (type == G_FILE_TYPE_REGULAR
&& create_new) {
g_printerr ("mate-desktop-item-edit: %s "
"already exists\n", uri);
} else {
g_printerr ("mate-desktop-item-edit: %s "
"does not look like a desktop "
"item\n", uri);
}
g_object_unref (info);
} else if (g_str_has_suffix (desktops [i], ".directory")) {
/* a non-existant file. Well we can still edit that
* sort of. We will just create it new */
dlg = panel_ditem_editor_new_directory (NULL, uri,
_("Directory Properties"));
} else if (g_str_has_suffix (desktops [i], ".desktop")) {
/* a non-existant file. Well we can still edit that
* sort of. We will just create it new */
dlg = panel_ditem_editor_new (NULL, uri,
_("Create Launcher"));
} else {
g_printerr ("mate-desktop-item-edit: %s does not "
"have a .desktop or .directory "
"suffix\n", uri);
}
if (dlg != NULL) {
dialogs ++;
g_signal_connect (G_OBJECT (dlg), "destroy",
G_CALLBACK (dialog_destroyed), NULL);
g_signal_connect (G_OBJECT (dlg), "error_reported",
G_CALLBACK (error_reported), NULL);
gtk_widget_show (dlg);
}
g_free (uri);
g_free (path);
}
if (dialogs > 0)
gtk_main ();
return 0;
}
| flexiondotorg/mate-panel | mate-panel/mate-desktop-item-edit.c | C | gpl-2.0 | 5,661 |
# Fantasdic
# Copyright (C) 2006 - 2007 Mathieu Blondel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
if Fantasdic::WIN32
require 'win32ole'
else
begin
require "gconf2"
rescue LoadError
Fantasdic.missing_dependency('Ruby/Gconf2',
'GNOME preferences access')
end
end
module Fantasdic
module UI
HAVE_GCONF2 = Object.const_defined? "GConf"
module Browser
def self.could_not_open_browser(url)
ErrorDialog.new(nil,
GetText._("Could not open browser.") + "\n(%s)" % url)
end
def self.could_not_find_documentation
ErrorDialog.new(nil,
GetText._("Could not find documentation."))
end
# Returns first found browser path or nil.
def self.get_browser
# First try with gconf in order to get the default browser set in
# System > Preferences > My favourite applications
if HAVE_GCONF2
client = GConf::Client.default
dir = "/desktop/gnome/url-handlers/http/"
if client[dir + "enabled"]
return client[dir + "command"]
end
end
# Second, see if user has not set a browser in the prefs file
prefs = Preferences.instance
if prefs.www_browser
return prefs.www_browser
end
# Third, try to find if one of those browsers is available
["firefox", "iceweasel", "mozilla", "epiphany-browser", "konqueror",
"w3m"].each do |browser|
ENV["PATH"].split(":").each do |dir|
file = File.join(dir, browser)
if File.executable? file
return "#{file} %s"
end
end
end
# Too bad...
return nil
end
# Opens url in browser and returns true if succeeded
def self.open_url(url)
if WIN32
wsh = WIN32OLE.new('Shell.Application')
wsh.Open(url)
return true
else
command = get_browser
if command
Thread.new { system(command % url) }
return true
else
could_not_open_browser(url)
return false
end
end
end
# Display help using GNOME's help system
def self.open_gnome_help(para)
begin
Gnome::Help.display('fantasdic', para)
rescue => e
ErrorDialog.new(nil, e.message)
end
end
# Display help using the browser
def self.open_html_help(para)
base_path = File.join(Fantasdic::Config::MAIN_DATA_DIR,
"doc", "fantasdic", "html")
found = false
GLib.language_names.each do |l|
path = File.join(base_path, l, "index.html")
if File.exist? path
found = true
url = "file://%s" % path
open_url(url)
break
end
end
could_not_find_documentation if not found
end
# Display help using yelp
def self.open_yelp_help(para)
base_path = File.join(Fantasdic::Config::MAIN_DATA_DIR,
"gnome", "help", "fantasdic")
found = false
GLib.language_names.each do |l|
path = File.join(base_path, l, "fantasdic.xml")
if File.exist? path
found = true
url = "ghelp://%s" % path
url += "?" + para if para
Thread.new { system("yelp #{url}") }
break
end
end
could_not_find_documentation if not found
end
def self.open_help(para=nil)
if HAVE_GNOME2
open_gnome_help(para)
else
if File.which("yelp")
open_yelp_help(para)
else
open_html_help(para)
end
end
end
end
end
end | mblondel/fantasdic | lib/fantasdic/ui/browser.rb | Ruby | gpl-2.0 | 4,237 |
/*
* linux/kernel/time/timekeeping.c
*
* Kernel timekeeping code and accessor functions
*
* This code was moved from linux/kernel/timer.c.
* Please see that file for copyright and history logs.
*
*/
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/percpu.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/syscore_ops.h>
#include <linux/clocksource.h>
#include <linux/jiffies.h>
#include <linux/time.h>
#include <linux/tick.h>
#include <linux/stop_machine.h>
/* Structure holding internal timekeeping values. */
struct timekeeper {
/* Current clocksource used for timekeeping. */
struct clocksource *clock;
/* NTP adjusted clock multiplier */
u32 mult;
/* The shift value of the current clocksource. */
int shift;
/* Number of clock cycles in one NTP interval. */
cycle_t cycle_interval;
/* Number of clock shifted nano seconds in one NTP interval. */
u64 xtime_interval;
/* shifted nano seconds left over when rounding cycle_interval */
s64 xtime_remainder;
/* Raw nano seconds accumulated per NTP interval. */
u32 raw_interval;
/* Clock shifted nano seconds remainder not stored in xtime.tv_nsec. */
u64 xtime_nsec;
/* Difference between accumulated time and NTP time in ntp
* shifted nano seconds. */
s64 ntp_error;
/* Shift conversion between clock shifted nano seconds and
* ntp shifted nano seconds. */
int ntp_error_shift;
/* The current time */
struct timespec xtime;
/*
* wall_to_monotonic is what we need to add to xtime (or xtime corrected
* for sub jiffie times) to get to monotonic time. Monotonic is pegged
* at zero at system boot time, so wall_to_monotonic will be negative,
* however, we will ALWAYS keep the tv_nsec part positive so we can use
* the usual normalization.
*
* wall_to_monotonic is moved after resume from suspend for the
* monotonic time not to jump. We need to add total_sleep_time to
* wall_to_monotonic to get the real boot based time offset.
*
* - wall_to_monotonic is no longer the boot time, getboottime must be
* used instead.
*/
struct timespec wall_to_monotonic;
/* time spent in suspend */
struct timespec total_sleep_time;
/* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
struct timespec raw_time;
/* Seqlock for all timekeeper values */
seqlock_t lock;
};
static struct timekeeper timekeeper;
/*
* This read-write spinlock protects us from races in SMP while
* playing with xtime.
*/
__cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;
/**
* timekeeper_setup_internals - Set up internals to use clocksource clock.
*
* @clock: Pointer to clocksource.
*
* Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
* pair and interval request.
*
* Unless you're the timekeeping code, you should not be using this!
*/
static void timekeeper_setup_internals(struct clocksource *clock)
{
cycle_t interval;
u64 tmp, ntpinterval;
timekeeper.clock = clock;
clock->cycle_last = clock->read(clock);
/* Do the ns -> cycle conversion first, using original mult */
tmp = NTP_INTERVAL_LENGTH;
tmp <<= clock->shift;
ntpinterval = tmp;
tmp += clock->mult/2;
do_div(tmp, clock->mult);
if (tmp == 0)
tmp = 1;
interval = (cycle_t) tmp;
timekeeper.cycle_interval = interval;
/* Go back from cycles -> shifted ns */
timekeeper.xtime_interval = (u64) interval * clock->mult;
timekeeper.xtime_remainder = ntpinterval - timekeeper.xtime_interval;
timekeeper.raw_interval =
((u64) interval * clock->mult) >> clock->shift;
timekeeper.xtime_nsec = 0;
timekeeper.shift = clock->shift;
timekeeper.ntp_error = 0;
timekeeper.ntp_error_shift = NTP_SCALE_SHIFT - clock->shift;
/*
* The timekeeper keeps its own mult values for the currently
* active clocksource. These value will be adjusted via NTP
* to counteract clock drifting.
*/
timekeeper.mult = clock->mult;
}
/* Timekeeper helper functions. */
static inline s64 timekeeping_get_ns(void)
{
cycle_t cycle_now, cycle_delta;
struct clocksource *clock;
/* read clocksource: */
clock = timekeeper.clock;
cycle_now = clock->read(clock);
/* calculate the delta since the last update_wall_time: */
cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
/* return delta convert to nanoseconds using ntp adjusted mult. */
return clocksource_cyc2ns(cycle_delta, timekeeper.mult,
timekeeper.shift);
}
static inline s64 timekeeping_get_ns_raw(void)
{
cycle_t cycle_now, cycle_delta;
struct clocksource *clock;
/* read clocksource: */
clock = timekeeper.clock;
cycle_now = clock->read(clock);
/* calculate the delta since the last update_wall_time: */
cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
/* return delta convert to nanoseconds. */
return clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
}
/* must hold write on timekeeper.lock */
static void timekeeping_update(bool clearntp)
{
if (clearntp) {
timekeeper.ntp_error = 0;
ntp_clear();
}
update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
timekeeper.clock, timekeeper.mult);
}
/**
* timekeeping_forward_now - update clock to the current time
*
* Forward the current clock to update its state since the last call to
* update_wall_time(). This is useful before significant clock changes,
* as it avoids having to deal with this time offset explicitly.
*/
static void timekeeping_forward_now(void)
{
cycle_t cycle_now, cycle_delta;
struct clocksource *clock;
s64 nsec;
clock = timekeeper.clock;
cycle_now = clock->read(clock);
cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
clock->cycle_last = cycle_now;
nsec = clocksource_cyc2ns(cycle_delta, timekeeper.mult,
timekeeper.shift);
/* If arch requires, add in gettimeoffset() */
nsec += arch_gettimeoffset();
timespec_add_ns(&timekeeper.xtime, nsec);
nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
timespec_add_ns(&timekeeper.raw_time, nsec);
}
/**
* getnstimeofday - Returns the time of day in a timespec
* @ts: pointer to the timespec to be set
*
* Returns the time of day in a timespec.
*/
void getnstimeofday(struct timespec *ts)
{
unsigned long seq;
s64 nsecs;
WARN_ON(timekeeping_suspended);
do {
seq = read_seqbegin(&timekeeper.lock);
*ts = timekeeper.xtime;
nsecs = timekeeping_get_ns();
/* If arch requires, add in gettimeoffset() */
nsecs += arch_gettimeoffset();
} while (read_seqretry(&timekeeper.lock, seq));
timespec_add_ns(ts, nsecs);
}
EXPORT_SYMBOL(getnstimeofday);
ktime_t ktime_get(void)
{
unsigned int seq;
s64 secs, nsecs;
WARN_ON(timekeeping_suspended);
do {
seq = read_seqbegin(&timekeeper.lock);
secs = timekeeper.xtime.tv_sec +
timekeeper.wall_to_monotonic.tv_sec;
nsecs = timekeeper.xtime.tv_nsec +
timekeeper.wall_to_monotonic.tv_nsec;
nsecs += timekeeping_get_ns();
/* If arch requires, add in gettimeoffset() */
nsecs += arch_gettimeoffset();
} while (read_seqretry(&timekeeper.lock, seq));
/*
* Use ktime_set/ktime_add_ns to create a proper ktime on
* 32-bit architectures without CONFIG_KTIME_SCALAR.
*/
return ktime_add_ns(ktime_set(secs, 0), nsecs);
}
EXPORT_SYMBOL_GPL(ktime_get);
/**
* ktime_get_ts - get the monotonic clock in timespec format
* @ts: pointer to timespec variable
*
* The function calculates the monotonic clock from the realtime
* clock and the wall_to_monotonic offset and stores the result
* in normalized timespec format in the variable pointed to by @ts.
*/
void ktime_get_ts(struct timespec *ts)
{
struct timespec tomono;
unsigned int seq;
s64 nsecs;
WARN_ON(timekeeping_suspended);
do {
seq = read_seqbegin(&timekeeper.lock);
*ts = timekeeper.xtime;
tomono = timekeeper.wall_to_monotonic;
nsecs = timekeeping_get_ns();
/* If arch requires, add in gettimeoffset() */
nsecs += arch_gettimeoffset();
} while (read_seqretry(&timekeeper.lock, seq));
set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec,
ts->tv_nsec + tomono.tv_nsec + nsecs);
}
EXPORT_SYMBOL_GPL(ktime_get_ts);
#ifdef CONFIG_NTP_PPS
/**
* getnstime_raw_and_real - get day and raw monotonic time in timespec format
* @ts_raw: pointer to the timespec to be set to raw monotonic time
* @ts_real: pointer to the timespec to be set to the time of day
*
* This function reads both the time of day and raw monotonic time at the
* same time atomically and stores the resulting timestamps in timespec
* format.
*/
void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real)
{
unsigned long seq;
s64 nsecs_raw, nsecs_real;
WARN_ON_ONCE(timekeeping_suspended);
do {
u32 arch_offset;
seq = read_seqbegin(&timekeeper.lock);
*ts_raw = timekeeper.raw_time;
*ts_real = timekeeper.xtime;
nsecs_raw = timekeeping_get_ns_raw();
nsecs_real = timekeeping_get_ns();
/* If arch requires, add in gettimeoffset() */
arch_offset = arch_gettimeoffset();
nsecs_raw += arch_offset;
nsecs_real += arch_offset;
} while (read_seqretry(&timekeeper.lock, seq));
timespec_add_ns(ts_raw, nsecs_raw);
timespec_add_ns(ts_real, nsecs_real);
}
EXPORT_SYMBOL(getnstime_raw_and_real);
#endif /* CONFIG_NTP_PPS */
/**
* do_gettimeofday - Returns the time of day in a timeval
* @tv: pointer to the timeval to be set
*
* NOTE: Users should be converted to using getnstimeofday()
*/
void do_gettimeofday(struct timeval *tv)
{
struct timespec now;
getnstimeofday(&now);
tv->tv_sec = now.tv_sec;
tv->tv_usec = now.tv_nsec/1000;
}
EXPORT_SYMBOL(do_gettimeofday);
/**
* do_settimeofday - Sets the time of day
* @tv: pointer to the timespec variable containing the new time
*
* Sets the time of day to the new time and update NTP and notify hrtimers
*/
int do_settimeofday(const struct timespec *tv)
{
struct timespec ts_delta;
unsigned long flags;
if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
write_seqlock_irqsave(&timekeeper.lock, flags);
timekeeping_forward_now();
ts_delta.tv_sec = tv->tv_sec - timekeeper.xtime.tv_sec;
ts_delta.tv_nsec = tv->tv_nsec - timekeeper.xtime.tv_nsec;
timekeeper.wall_to_monotonic =
timespec_sub(timekeeper.wall_to_monotonic, ts_delta);
timekeeper.xtime = *tv;
timekeeping_update(true);
write_sequnlock_irqrestore(&timekeeper.lock, flags);
/* signal hrtimers about time change */
clock_was_set();
return 0;
}
EXPORT_SYMBOL(do_settimeofday);
/**
* timekeeping_inject_offset - Adds or subtracts from the current time.
* @tv: pointer to the timespec variable containing the offset
*
* Adds or subtracts an offset value from the current time.
*/
int timekeeping_inject_offset(struct timespec *ts)
{
unsigned long flags;
if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;
write_seqlock_irqsave(&timekeeper.lock, flags);
timekeeping_forward_now();
timekeeper.xtime = timespec_add(timekeeper.xtime, *ts);
timekeeper.wall_to_monotonic =
timespec_sub(timekeeper.wall_to_monotonic, *ts);
timekeeping_update(true);
write_sequnlock_irqrestore(&timekeeper.lock, flags);
/* signal hrtimers about time change */
clock_was_set();
return 0;
}
EXPORT_SYMBOL(timekeeping_inject_offset);
/**
* change_clocksource - Swaps clocksources if a new one is available
*
* Accumulates current time interval and initializes new clocksource
*/
static int change_clocksource(void *data)
{
struct clocksource *new, *old;
unsigned long flags;
new = (struct clocksource *) data;
write_seqlock_irqsave(&timekeeper.lock, flags);
timekeeping_forward_now();
if (!new->enable || new->enable(new) == 0) {
old = timekeeper.clock;
timekeeper_setup_internals(new);
if (old->disable)
old->disable(old);
}
timekeeping_update(true);
write_sequnlock_irqrestore(&timekeeper.lock, flags);
return 0;
}
/**
* timekeeping_notify - Install a new clock source
* @clock: pointer to the clock source
*
* This function is called from clocksource.c after a new, better clock
* source has been registered. The caller holds the clocksource_mutex.
*/
void timekeeping_notify(struct clocksource *clock)
{
if (timekeeper.clock == clock)
return;
stop_machine(change_clocksource, clock, NULL);
tick_clock_notify();
}
/**
* ktime_get_real - get the real (wall-) time in ktime_t format
*
* returns the time in ktime_t format
*/
ktime_t ktime_get_real(void)
{
struct timespec now;
getnstimeofday(&now);
return timespec_to_ktime(now);
}
EXPORT_SYMBOL_GPL(ktime_get_real);
/**
* getrawmonotonic - Returns the raw monotonic time in a timespec
* @ts: pointer to the timespec to be set
*
* Returns the raw monotonic time (completely un-modified by ntp)
*/
void getrawmonotonic(struct timespec *ts)
{
unsigned long seq;
s64 nsecs;
do {
seq = read_seqbegin(&timekeeper.lock);
nsecs = timekeeping_get_ns_raw();
*ts = timekeeper.raw_time;
} while (read_seqretry(&timekeeper.lock, seq));
timespec_add_ns(ts, nsecs);
}
EXPORT_SYMBOL(getrawmonotonic);
/**
* timekeeping_valid_for_hres - Check if timekeeping is suitable for hres
*/
int timekeeping_valid_for_hres(void)
{
unsigned long seq;
int ret;
do {
seq = read_seqbegin(&timekeeper.lock);
ret = timekeeper.clock->flags & CLOCK_SOURCE_VALID_FOR_HRES;
} while (read_seqretry(&timekeeper.lock, seq));
return ret;
}
/**
* timekeeping_max_deferment - Returns max time the clocksource can be deferred
*/
u64 timekeeping_max_deferment(void)
{
unsigned long seq;
u64 ret;
do {
seq = read_seqbegin(&timekeeper.lock);
ret = timekeeper.clock->max_idle_ns;
} while (read_seqretry(&timekeeper.lock, seq));
return ret;
}
/**
* read_persistent_clock - Return time from the persistent clock.
*
* Weak dummy function for arches that do not yet support it.
* Reads the time from the battery backed persistent clock.
* Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported.
*
* XXX - Do be sure to remove it once all arches implement it.
*/
void __attribute__((weak)) read_persistent_clock(struct timespec *ts)
{
ts->tv_sec = 0;
ts->tv_nsec = 0;
}
/**
* read_boot_clock - Return time of the system start.
*
* Weak dummy function for arches that do not yet support it.
* Function to read the exact time the system has been started.
* Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported.
*
* XXX - Do be sure to remove it once all arches implement it.
*/
void __attribute__((weak)) read_boot_clock(struct timespec *ts)
{
ts->tv_sec = 0;
ts->tv_nsec = 0;
}
/*
* timekeeping_init - Initializes the clocksource and common timekeeping values
*/
void __init timekeeping_init(void)
{
struct clocksource *clock;
unsigned long flags;
struct timespec now, boot;
read_persistent_clock(&now);
read_boot_clock(&boot);
seqlock_init(&timekeeper.lock);
ntp_init();
write_seqlock_irqsave(&timekeeper.lock, flags);
clock = clocksource_default_clock();
if (clock->enable)
clock->enable(clock);
timekeeper_setup_internals(clock);
timekeeper.xtime.tv_sec = now.tv_sec;
timekeeper.xtime.tv_nsec = now.tv_nsec;
timekeeper.raw_time.tv_sec = 0;
timekeeper.raw_time.tv_nsec = 0;
if (boot.tv_sec == 0 && boot.tv_nsec == 0) {
boot.tv_sec = timekeeper.xtime.tv_sec;
boot.tv_nsec = timekeeper.xtime.tv_nsec;
}
set_normalized_timespec(&timekeeper.wall_to_monotonic,
-boot.tv_sec, -boot.tv_nsec);
timekeeper.total_sleep_time.tv_sec = 0;
timekeeper.total_sleep_time.tv_nsec = 0;
write_sequnlock_irqrestore(&timekeeper.lock, flags);
}
/* time in seconds when suspend began */
static struct timespec timekeeping_suspend_time;
/**
* __timekeeping_inject_sleeptime - Internal function to add sleep interval
* @delta: pointer to a timespec delta value
*
* Takes a timespec offset measuring a suspend interval and properly
* adds the sleep offset to the timekeeping variables.
*/
static void __timekeeping_inject_sleeptime(struct timespec *delta)
{
if (!timespec_valid(delta)) {
printk(KERN_WARNING "__timekeeping_inject_sleeptime: Invalid "
"sleep delta value!\n");
return;
}
timekeeper.xtime = timespec_add(timekeeper.xtime, *delta);
timekeeper.wall_to_monotonic =
timespec_sub(timekeeper.wall_to_monotonic, *delta);
timekeeper.total_sleep_time = timespec_add(
timekeeper.total_sleep_time, *delta);
}
/**
* timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values
* @delta: pointer to a timespec delta value
*
* This hook is for architectures that cannot support read_persistent_clock
* because their RTC/persistent clock is only accessible when irqs are enabled.
*
* This function should only be called by rtc_resume(), and allows
* a suspend offset to be injected into the timekeeping values.
*/
void timekeeping_inject_sleeptime(struct timespec *delta)
{
unsigned long flags;
struct timespec ts;
/* Make sure we don't set the clock twice */
read_persistent_clock(&ts);
if (!(ts.tv_sec == 0 && ts.tv_nsec == 0))
return;
write_seqlock_irqsave(&timekeeper.lock, flags);
timekeeping_forward_now();
__timekeeping_inject_sleeptime(delta);
timekeeping_update(true);
write_sequnlock_irqrestore(&timekeeper.lock, flags);
/* signal hrtimers about time change */
clock_was_set();
}
/**
* timekeeping_resume - Resumes the generic timekeeping subsystem.
*
* This is for the generic clocksource timekeeping.
* xtime/wall_to_monotonic/jiffies/etc are
* still managed by arch specific suspend/resume code.
*/
static void timekeeping_resume(void)
{
unsigned long flags;
struct timespec ts;
read_persistent_clock(&ts);
clocksource_resume();
write_seqlock_irqsave(&timekeeper.lock, flags);
if (timespec_compare(&ts, &timekeeping_suspend_time) > 0) {
ts = timespec_sub(ts, timekeeping_suspend_time);
__timekeeping_inject_sleeptime(&ts);
}
/* re-base the last cycle value */
timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock);
timekeeper.ntp_error = 0;
timekeeping_suspended = 0;
write_sequnlock_irqrestore(&timekeeper.lock, flags);
touch_softlockup_watchdog();
clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
/* Resume hrtimers */
hrtimers_resume();
}
static int timekeeping_suspend(void)
{
unsigned long flags;
struct timespec delta, delta_delta;
static struct timespec old_delta;
read_persistent_clock(&timekeeping_suspend_time);
write_seqlock_irqsave(&timekeeper.lock, flags);
timekeeping_forward_now();
timekeeping_suspended = 1;
/*
* To avoid drift caused by repeated suspend/resumes,
* which each can add ~1 second drift error,
* try to compensate so the difference in system time
* and persistent_clock time stays close to constant.
*/
delta = timespec_sub(timekeeper.xtime, timekeeping_suspend_time);
delta_delta = timespec_sub(delta, old_delta);
if (abs(delta_delta.tv_sec) >= 2) {
/*
* if delta_delta is too large, assume time correction
* has occured and set old_delta to the current delta.
*/
old_delta = delta;
} else {
/* Otherwise try to adjust old_system to compensate */
timekeeping_suspend_time =
timespec_add(timekeeping_suspend_time, delta_delta);
}
write_sequnlock_irqrestore(&timekeeper.lock, flags);
clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
clocksource_suspend();
return 0;
}
/* sysfs resume/suspend bits for timekeeping */
static struct syscore_ops timekeeping_syscore_ops = {
.resume = timekeeping_resume,
.suspend = timekeeping_suspend,
};
static int __init timekeeping_init_ops(void)
{
register_syscore_ops(&timekeeping_syscore_ops);
return 0;
}
device_initcall(timekeeping_init_ops);
/*
* If the error is already larger, we look ahead even further
* to compensate for late or lost adjustments.
*/
static __always_inline int timekeeping_bigadjust(s64 error, s64 *interval,
s64 *offset)
{
s64 tick_error, i;
u32 look_ahead, adj;
s32 error2, mult;
/*
* Use the current error value to determine how much to look ahead.
* The larger the error the slower we adjust for it to avoid problems
* with losing too many ticks, otherwise we would overadjust and
* produce an even larger error. The smaller the adjustment the
* faster we try to adjust for it, as lost ticks can do less harm
* here. This is tuned so that an error of about 1 msec is adjusted
* within about 1 sec (or 2^20 nsec in 2^SHIFT_HZ ticks).
*/
error2 = timekeeper.ntp_error >> (NTP_SCALE_SHIFT + 22 - 2 * SHIFT_HZ);
error2 = abs(error2);
for (look_ahead = 0; error2 > 0; look_ahead++)
error2 >>= 2;
/*
* Now calculate the error in (1 << look_ahead) ticks, but first
* remove the single look ahead already included in the error.
*/
tick_error = ntp_tick_length() >> (timekeeper.ntp_error_shift + 1);
tick_error -= timekeeper.xtime_interval >> 1;
error = ((error - tick_error) >> look_ahead) + tick_error;
/* Finally calculate the adjustment shift value. */
i = *interval;
mult = 1;
if (error < 0) {
error = -error;
*interval = -*interval;
*offset = -*offset;
mult = -1;
}
for (adj = 0; error > i; adj++)
error >>= 1;
*interval <<= adj;
*offset <<= adj;
return mult << adj;
}
/*
* Adjust the multiplier to reduce the error value,
* this is optimized for the most common adjustments of -1,0,1,
* for other values we can do a bit more work.
*/
static void timekeeping_adjust(s64 offset)
{
s64 error, interval = timekeeper.cycle_interval;
int adj;
/*
* The point of this is to check if the error is greater than half
* an interval.
*
* First we shift it down from NTP_SHIFT to clocksource->shifted nsecs.
*
* Note we subtract one in the shift, so that error is really error*2.
* This "saves" dividing(shifting) interval twice, but keeps the
* (error > interval) comparison as still measuring if error is
* larger than half an interval.
*
* Note: It does not "save" on aggravation when reading the code.
*/
error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1);
if (error > interval) {
/*
* We now divide error by 4(via shift), which checks if
* the error is greater than twice the interval.
* If it is greater, we need a bigadjust, if its smaller,
* we can adjust by 1.
*/
error >>= 2;
/*
* XXX - In update_wall_time, we round up to the next
* nanosecond, and store the amount rounded up into
* the error. This causes the likely below to be unlikely.
*
* The proper fix is to avoid rounding up by using
* the high precision timekeeper.xtime_nsec instead of
* xtime.tv_nsec everywhere. Fixing this will take some
* time.
*/
if (likely(error <= interval))
adj = 1;
else
adj = timekeeping_bigadjust(error, &interval, &offset);
} else if (error < -interval) {
/* See comment above, this is just switched for the negative */
error >>= 2;
if (likely(error >= -interval)) {
adj = -1;
interval = -interval;
offset = -offset;
} else
adj = timekeeping_bigadjust(error, &interval, &offset);
} else /* No adjustment needed */
return;
if (unlikely(timekeeper.clock->maxadj &&
(timekeeper.mult + adj >
timekeeper.clock->mult + timekeeper.clock->maxadj))) {
printk_once(KERN_WARNING
"Adjusting %s more than 11%% (%ld vs %ld)\n",
timekeeper.clock->name, (long)timekeeper.mult + adj,
(long)timekeeper.clock->mult +
timekeeper.clock->maxadj);
}
/*
* So the following can be confusing.
*
* To keep things simple, lets assume adj == 1 for now.
*
* When adj != 1, remember that the interval and offset values
* have been appropriately scaled so the math is the same.
*
* The basic idea here is that we're increasing the multiplier
* by one, this causes the xtime_interval to be incremented by
* one cycle_interval. This is because:
* xtime_interval = cycle_interval * mult
* So if mult is being incremented by one:
* xtime_interval = cycle_interval * (mult + 1)
* Its the same as:
* xtime_interval = (cycle_interval * mult) + cycle_interval
* Which can be shortened to:
* xtime_interval += cycle_interval
*
* So offset stores the non-accumulated cycles. Thus the current
* time (in shifted nanoseconds) is:
* now = (offset * adj) + xtime_nsec
* Now, even though we're adjusting the clock frequency, we have
* to keep time consistent. In other words, we can't jump back
* in time, and we also want to avoid jumping forward in time.
*
* So given the same offset value, we need the time to be the same
* both before and after the freq adjustment.
* now = (offset * adj_1) + xtime_nsec_1
* now = (offset * adj_2) + xtime_nsec_2
* So:
* (offset * adj_1) + xtime_nsec_1 =
* (offset * adj_2) + xtime_nsec_2
* And we know:
* adj_2 = adj_1 + 1
* So:
* (offset * adj_1) + xtime_nsec_1 =
* (offset * (adj_1+1)) + xtime_nsec_2
* (offset * adj_1) + xtime_nsec_1 =
* (offset * adj_1) + offset + xtime_nsec_2
* Canceling the sides:
* xtime_nsec_1 = offset + xtime_nsec_2
* Which gives us:
* xtime_nsec_2 = xtime_nsec_1 - offset
* Which simplfies to:
* xtime_nsec -= offset
*
* XXX - TODO: Doc ntp_error calculation.
*/
timekeeper.mult += adj;
timekeeper.xtime_interval += interval;
timekeeper.xtime_nsec -= offset;
timekeeper.ntp_error -= (interval - offset) <<
timekeeper.ntp_error_shift;
}
/**
* logarithmic_accumulation - shifted accumulation of cycles
*
* This functions accumulates a shifted interval of cycles into
* into a shifted interval nanoseconds. Allows for O(log) accumulation
* loop.
*
* Returns the unconsumed cycles.
*/
static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
{
u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift;
u64 raw_nsecs;
/* If the offset is smaller than a shifted interval, do nothing */
if (offset < timekeeper.cycle_interval<<shift)
return offset;
/* Accumulate one shifted interval */
offset -= timekeeper.cycle_interval << shift;
timekeeper.clock->cycle_last += timekeeper.cycle_interval << shift;
timekeeper.xtime_nsec += timekeeper.xtime_interval << shift;
while (timekeeper.xtime_nsec >= nsecps) {
int leap;
timekeeper.xtime_nsec -= nsecps;
timekeeper.xtime.tv_sec++;
leap = second_overflow(timekeeper.xtime.tv_sec);
timekeeper.xtime.tv_sec += leap;
timekeeper.wall_to_monotonic.tv_sec -= leap;
}
/* Accumulate raw time */
raw_nsecs = timekeeper.raw_interval << shift;
raw_nsecs += timekeeper.raw_time.tv_nsec;
if (raw_nsecs >= NSEC_PER_SEC) {
u64 raw_secs = raw_nsecs;
raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
timekeeper.raw_time.tv_sec += raw_secs;
}
timekeeper.raw_time.tv_nsec = raw_nsecs;
/* Accumulate error between NTP and clock interval */
timekeeper.ntp_error += ntp_tick_length() << shift;
timekeeper.ntp_error -=
(timekeeper.xtime_interval + timekeeper.xtime_remainder) <<
(timekeeper.ntp_error_shift + shift);
return offset;
}
/**
* update_wall_time - Uses the current clocksource to increment the wall time
*
*/
static void update_wall_time(void)
{
struct clocksource *clock;
cycle_t offset;
int shift = 0, maxshift;
unsigned long flags;
write_seqlock_irqsave(&timekeeper.lock, flags);
/* Make sure we're fully resumed: */
if (unlikely(timekeeping_suspended))
goto out;
clock = timekeeper.clock;
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
offset = timekeeper.cycle_interval;
#else
offset = (clock->read(clock) - clock->cycle_last) & clock->mask;
#endif
timekeeper.xtime_nsec = (s64)timekeeper.xtime.tv_nsec <<
timekeeper.shift;
/*
* With NO_HZ we may have to accumulate many cycle_intervals
* (think "ticks") worth of time at once. To do this efficiently,
* we calculate the largest doubling multiple of cycle_intervals
* that is smaller than the offset. We then accumulate that
* chunk in one go, and then try to consume the next smaller
* doubled multiple.
*/
shift = ilog2(offset) - ilog2(timekeeper.cycle_interval);
shift = max(0, shift);
/* Bound shift to one less than what overflows tick_length */
maxshift = (64 - (ilog2(ntp_tick_length())+1)) - 1;
shift = min(shift, maxshift);
while (offset >= timekeeper.cycle_interval) {
offset = logarithmic_accumulation(offset, shift);
if(offset < timekeeper.cycle_interval<<shift)
shift--;
}
/* correct the clock when NTP error is too big */
timekeeping_adjust(offset);
/*
* Since in the loop above, we accumulate any amount of time
* in xtime_nsec over a second into xtime.tv_sec, its possible for
* xtime_nsec to be fairly small after the loop. Further, if we're
* slightly speeding the clocksource up in timekeeping_adjust(),
* its possible the required corrective factor to xtime_nsec could
* cause it to underflow.
*
* Now, we cannot simply roll the accumulated second back, since
* the NTP subsystem has been notified via second_overflow. So
* instead we push xtime_nsec forward by the amount we underflowed,
* and add that amount into the error.
*
* We'll correct this error next time through this function, when
* xtime_nsec is not as small.
*/
if (unlikely((s64)timekeeper.xtime_nsec < 0)) {
s64 neg = -(s64)timekeeper.xtime_nsec;
timekeeper.xtime_nsec = 0;
timekeeper.ntp_error += neg << timekeeper.ntp_error_shift;
}
/*
* Store full nanoseconds into xtime after rounding it up and
* add the remainder to the error difference.
*/
timekeeper.xtime.tv_nsec = ((s64)timekeeper.xtime_nsec >>
timekeeper.shift) + 1;
timekeeper.xtime_nsec -= (s64)timekeeper.xtime.tv_nsec <<
timekeeper.shift;
timekeeper.ntp_error += timekeeper.xtime_nsec <<
timekeeper.ntp_error_shift;
/*
* Finally, make sure that after the rounding
* xtime.tv_nsec isn't larger than NSEC_PER_SEC
*/
if (unlikely(timekeeper.xtime.tv_nsec >= NSEC_PER_SEC)) {
int leap;
timekeeper.xtime.tv_nsec -= NSEC_PER_SEC;
timekeeper.xtime.tv_sec++;
leap = second_overflow(timekeeper.xtime.tv_sec);
timekeeper.xtime.tv_sec += leap;
timekeeper.wall_to_monotonic.tv_sec -= leap;
}
timekeeping_update(false);
out:
write_sequnlock_irqrestore(&timekeeper.lock, flags);
}
/**
* getboottime - Return the real time of system boot.
* @ts: pointer to the timespec to be set
*
* Returns the wall-time of boot in a timespec.
*
* This is based on the wall_to_monotonic offset and the total suspend
* time. Calls to settimeofday will affect the value returned (which
* basically means that however wrong your real time clock is at boot time,
* you get the right time here).
*/
void getboottime(struct timespec *ts)
{
struct timespec boottime = {
.tv_sec = timekeeper.wall_to_monotonic.tv_sec +
timekeeper.total_sleep_time.tv_sec,
.tv_nsec = timekeeper.wall_to_monotonic.tv_nsec +
timekeeper.total_sleep_time.tv_nsec
};
set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
}
EXPORT_SYMBOL_GPL(getboottime);
/**
* get_monotonic_boottime - Returns monotonic time since boot
* @ts: pointer to the timespec to be set
*
* Returns the monotonic time since boot in a timespec.
*
* This is similar to CLOCK_MONTONIC/ktime_get_ts, but also
* includes the time spent in suspend.
*/
void get_monotonic_boottime(struct timespec *ts)
{
struct timespec tomono, sleep;
unsigned int seq;
s64 nsecs;
WARN_ON(timekeeping_suspended);
do {
seq = read_seqbegin(&timekeeper.lock);
*ts = timekeeper.xtime;
tomono = timekeeper.wall_to_monotonic;
sleep = timekeeper.total_sleep_time;
nsecs = timekeeping_get_ns();
} while (read_seqretry(&timekeeper.lock, seq));
set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec,
(s64)ts->tv_nsec + (s64)tomono.tv_nsec + (s64)sleep.tv_nsec + nsecs);
}
EXPORT_SYMBOL_GPL(get_monotonic_boottime);
/**
* ktime_get_boottime - Returns monotonic time since boot in a ktime
*
* Returns the monotonic time since boot in a ktime
*
* This is similar to CLOCK_MONTONIC/ktime_get, but also
* includes the time spent in suspend.
*/
ktime_t ktime_get_boottime(void)
{
struct timespec ts;
get_monotonic_boottime(&ts);
return timespec_to_ktime(ts);
}
EXPORT_SYMBOL_GPL(ktime_get_boottime);
/**
* monotonic_to_bootbased - Convert the monotonic time to boot based.
* @ts: pointer to the timespec to be converted
*/
void monotonic_to_bootbased(struct timespec *ts)
{
*ts = timespec_add(*ts, timekeeper.total_sleep_time);
}
EXPORT_SYMBOL_GPL(monotonic_to_bootbased);
unsigned long get_seconds(void)
{
return timekeeper.xtime.tv_sec;
}
EXPORT_SYMBOL(get_seconds);
struct timespec __current_kernel_time(void)
{
return timekeeper.xtime;
}
struct timespec current_kernel_time(void)
{
struct timespec now;
unsigned long seq;
do {
seq = read_seqbegin(&timekeeper.lock);
now = timekeeper.xtime;
} while (read_seqretry(&timekeeper.lock, seq));
return now;
}
EXPORT_SYMBOL(current_kernel_time);
struct timespec get_monotonic_coarse(void)
{
struct timespec now, mono;
unsigned long seq;
do {
seq = read_seqbegin(&timekeeper.lock);
now = timekeeper.xtime;
mono = timekeeper.wall_to_monotonic;
} while (read_seqretry(&timekeeper.lock, seq));
set_normalized_timespec(&now, now.tv_sec + mono.tv_sec,
now.tv_nsec + mono.tv_nsec);
return now;
}
/*
* The 64-bit jiffies value is not atomic - you MUST NOT read it
* without sampling the sequence number in xtime_lock.
* jiffies is defined in the linker script...
*/
void do_timer(unsigned long ticks)
{
jiffies_64 += ticks;
update_wall_time();
calc_global_load(ticks);
}
/**
* get_xtime_and_monotonic_and_sleep_offset() - get xtime, wall_to_monotonic,
* and sleep offsets.
* @xtim: pointer to timespec to be set with xtime
* @wtom: pointer to timespec to be set with wall_to_monotonic
* @sleep: pointer to timespec to be set with time in suspend
*/
void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
struct timespec *wtom, struct timespec *sleep)
{
unsigned long seq;
do {
seq = read_seqbegin(&timekeeper.lock);
*xtim = timekeeper.xtime;
*wtom = timekeeper.wall_to_monotonic;
*sleep = timekeeper.total_sleep_time;
} while (read_seqretry(&timekeeper.lock, seq));
}
/**
* ktime_get_monotonic_offset() - get wall_to_monotonic in ktime_t format
*/
ktime_t ktime_get_monotonic_offset(void)
{
unsigned long seq;
struct timespec wtom;
do {
seq = read_seqbegin(&timekeeper.lock);
wtom = timekeeper.wall_to_monotonic;
} while (read_seqretry(&timekeeper.lock, seq));
return timespec_to_ktime(wtom);
}
EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
/**
* xtime_update() - advances the timekeeping infrastructure
* @ticks: number of ticks, that have elapsed since the last call.
*
* Must be called with interrupts disabled.
*/
void xtime_update(unsigned long ticks)
{
write_seqlock(&xtime_lock);
do_timer(ticks);
write_sequnlock(&xtime_lock);
}
| varunchitre15/thunderzap_canvas2_jb | kernel/time/timekeeping.c | C | gpl-2.0 | 34,767 |
#include <algorithm>
#include <regex>
#include <cctype>
#include <climits>
#include <string>
#include <sstream>
#include <map>
#include <lib/base/eerror.h>
#include <lib/base/encoding.h>
#include <lib/base/estring.h>
#include "freesatv2.h"
#include "big5.h"
#include "gb18030.h"
std::string buildShortName( const std::string &str )
{
std::string tmp;
static char stropen[] = "\xc2\x86";
static char strclose[] = "\xc2\x87";
size_t open = std::string::npos-1;
while ((open = str.find(stropen, open+2)) != std::string::npos)
{
size_t close = str.find(strclose, open);
if (close != std::string::npos)
tmp += str.substr(open+2, close-(open+2));
}
return tmp.length() ? tmp : str;
}
void undoAbbreviation(std::string &str1, std::string &str2)
{
std::string s1 = str1;
std::string s2 = str2;
// minimum length of ellipsis and emphasis brackets
if (s1.length() <= 5 || s2.length() <= 5)
return;
// check if string2 prefix has ellipsis abbreviation
if (s2.substr(0, 3) != "...")
return;
// check if string1 suffix has detected abbreviation
std::string suffix3 = s1.substr(s1.length() - 3);
std::string suffix5 = s1.substr(s1.length() - 5);
if (suffix3 == "...")
{
// found ellipsis abbreviation
}
else if (suffix3 == ":..")
{
// found colon ellipsis abbreviation
s1 = replace_all(s1, ":..", ": ...");
}
else if (suffix5 == "...\xc2\x87")
{
// ensure ellipsis occur after close emphasis brackets
// "Some <EM>string1 text...</EM>"
// "Some <EM>string1 text</EM>..."
s1 = replace_all(s1, "...\xc2\x87", "\xc2\x87...");
}
else if (suffix5 == ":..\xc2\x87")
{
// ensure colon ellipsis occur after close emphasis brackets
// "Some <EM>string1 text:..</EM>"
// "Some <EM>string1 text</EM>:..."
s1 = replace_all(s1, ":..\xc2\x87", "\xc2\x87: ...");
}
else
return;
// find the end of string1 punctuation in string2
size_t found = s2.find_first_of(".:!?", 4);
if (found == std::string::npos)
return;
// strip off the ellipsis and any leading/trailing space
if (s1.substr(s1.length() - 4, 1) == " ")
{
s1 = s1.substr(0, s1.length() - 4);
}
else
{
s1 = s1.substr(0, s1.length() - 3);
}
if (s2.substr(3, 1) == " ")
{
s2 = s2.substr(4);
}
else
{
s2 = s2.substr(3);
}
found = s2.find_first_of(".:!?");
// check if punctuation too complex
if (found <= 2)
return;
// construct the new string1 and string2
if ((s2.length() - found) > 2)
{
s1 = s1 + " " + s2.substr(0, found);
s2 = s2.erase(0, s2.find_first_not_of(" ", found + 1));
}
else
return;
// don't undo sanity check
if (s1 == "" || s2 == "")
return;
str1 = s1;
str2 = s2;
}
std::string getNum(int val, int sys)
{
// Returns a string that contain the value val as string
// if sys == 16 than hexadezimal if sys == 10 than decimal
char buf[12];
if (sys == 10)
snprintf(buf, 12, "%i", val);
else if (sys == 16)
snprintf(buf, 12, "%X", val);
std::string res;
res.assign(buf);
return res;
}
// 8859-x to ucs-16 coding tables. taken from www.unicode.org/Public/MAPPINGS/ISO8859/
static unsigned long c88592[96]={
0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C,
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9};
static unsigned long c88593[96]={
0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B,
0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0x0000, 0x017C,
0x00C0, 0x00C1, 0x00C2, 0x0000, 0x00C4, 0x010A, 0x0108, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x0000, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x0000, 0x00E4, 0x010B, 0x0109, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x0000, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9};
static unsigned long c88594[96]={
0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B,
0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A,
0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF,
0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B,
0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9};
static unsigned long c88595[96]={
0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F};
static unsigned long c88596[96]={
0x00A0, 0x0000, 0x0000, 0x0000, 0x00A4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x060C, 0x00AD, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x061B, 0x0000, 0x0000, 0x0000, 0x061F,
0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F,
0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};
static unsigned long c88597[96]={
0x00A0, 0x2018, 0x2019, 0x00A3, 0x20AC, 0x20AF, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x037A, 0x00AB, 0x00AC, 0x00AD, 0x0000, 0x2015,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000};
static unsigned long c88598[96]={
0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017,
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000};
static unsigned long c88599[96]={
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF};
static unsigned long c885910[96]={
0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B,
0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF,
0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138};
static unsigned long c885911[96]={
0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0E3F,
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000};
static unsigned long c885913[96]={
0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019};
static unsigned long c885914[96]={
0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178,
0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61,
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF};
static unsigned long c885915[96]={
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF,
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF};
static unsigned long c885916[96]={
0x00A0, 0x0104, 0x0105, 0x0141, 0x20AC, 0x201E, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x0218, 0x00AB, 0x0179, 0x00AD, 0x017A, 0x017B,
0x00B0, 0x00B1, 0x010C, 0x0142, 0x017D, 0x201D, 0x00B6, 0x00B7, 0x017E, 0x010D, 0x0219, 0x00BB, 0x0152, 0x0153, 0x0178, 0x017C,
0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0106, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x0110, 0x0143, 0x00D2, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x015A, 0x0170, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0118, 0x021A, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x0107, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF};
static freesatHuffmanDecoder huffmanDecoder;
static unsigned long iso6937[96]={
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0000, 0x00A7, 0x00A4, 0x2018, 0x201C, 0x00AB, 0x2190, 0x2191, 0x2192, 0x2193,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00D7, 0x00B5, 0x00B6, 0x00B7, 0x00F7, 0x2019, 0x201D, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
0x0000, 0xE002, 0xE003, 0xE004, 0xE005, 0xE006, 0xE007, 0xE008, 0xE009, 0xE00C, 0xE00A, 0xE00B, 0x0000, 0xE00D, 0xE00E, 0xE00F,
0x2015, 0x00B9, 0x00AE, 0x00A9, 0x2122, 0x266A, 0x00AC, 0x00A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x215B, 0x215C, 0x215D, 0x215E,
0x2126, 0x00C6, 0x0110, 0x00AA, 0x0126, 0x0000, 0x0132, 0x013F, 0x0141, 0x00D8, 0x0152, 0x00BA, 0x00DE, 0x0166, 0x014A, 0x0149,
0x0138, 0x00E6, 0x0111, 0x00F0, 0x0127, 0x0131, 0x0133, 0x0140, 0x0142, 0x00F8, 0x0153, 0x00DF, 0x00FE, 0x0167, 0x014B, 0x00AD};
// Two Char Mapping (aka ISO6937) ( many polish services and UPC Direct/HBO services)
// get from http://mitglied.lycos.de/buran/charsets/videotex-suppl.html
static inline unsigned int doVideoTexSuppl(int c1, int c2)
{
switch (c1)
{
case 0xC1: // grave
switch (c2)
{
case 0x61: return 224; case 0x41: return 192;
case 0x65: return 232; case 0x45: return 200;
case 0x69: return 236; case 0x49: return 204;
case 0x6f: return 242; case 0x4f: return 210;
case 0x75: return 249; case 0x55: return 217;
default: return 0;
}
case 0xC2: // acute
switch (c2)
{
case 0x20: return 180;
case 0x61: return 225; case 0x41: return 193;
case 0x65: return 233; case 0x45: return 201;
case 0x69: return 237; case 0x49: return 205;
case 0x6f: return 243; case 0x4f: return 211;
case 0x75: return 250; case 0x55: return 218;
case 0x79: return 253; case 0x59: return 221;
case 0x63: return 263; case 0x43: return 262;
case 0x6c: return 314; case 0x4c: return 313;
case 0x6e: return 324; case 0x4e: return 323;
case 0x72: return 341; case 0x52: return 340;
case 0x73: return 347; case 0x53: return 346;
case 0x7a: return 378; case 0x5a: return 377;
default: return 0;
}
case 0xC3: // cedilla
switch (c2)
{
case 0x61: return 226; case 0x41: return 194;
case 0x65: return 234; case 0x45: return 202;
case 0x69: return 238; case 0x49: return 206;
case 0x6f: return 244; case 0x4f: return 212;
case 0x75: return 251; case 0x55: return 219;
case 0x79: return 375; case 0x59: return 374;
case 0x63: return 265; case 0x43: return 264;
case 0x67: return 285; case 0x47: return 284;
case 0x68: return 293; case 0x48: return 292;
case 0x6a: return 309; case 0x4a: return 308;
case 0x73: return 349; case 0x53: return 348;
case 0x77: return 373; case 0x57: return 372;
default: return 0;
}
case 0xC4: // tilde
switch (c2)
{
case 0x61: return 227; case 0x41: return 195;
case 0x6e: return 241; case 0x4e: return 209;
case 0x69: return 297; case 0x49: return 296;
case 0x6f: return 245; case 0x4f: return 213;
case 0x75: return 361; case 0x55: return 360;
default: return 0;
}
case 0xC5: // macron
switch (c2)
{
case 0x20: return 175;
case 0x41: return 256; case 0x61: return 257;
case 0x45: return 274; case 0x65: return 275;
case 0x49: return 298; case 0x69: return 299;
case 0x4f: return 332; case 0x6f: return 333;
default: return 0;
}
case 0xC6: // breve
switch (c2)
{
case 0x20: return 728;
case 0x61: return 259; case 0x41: return 258;
case 0x67: return 287; case 0x47: return 286;
case 0x75: return 365; case 0x55: return 364;
default: return 0;
}
case 0xC7: // dot above
switch (c2)
{
case 0x20: return 729;
case 0x63: return 267; case 0x43: return 266;
case 0x65: return 279; case 0x45: return 278;
case 0x67: return 289; case 0x47: return 288;
case 0x5a: return 379; case 0x49: return 304;
case 0x7a: return 380;
default: return 0;
}
case 0xC8: // diaeresis
switch (c2)
{
case 0x20: return 168;
case 0x61: return 228; case 0x41: return 196;
case 0x65: return 235; case 0x45: return 203;
case 0x69: return 239; case 0x49: return 207;
case 0x6f: return 246; case 0x4f: return 214;
case 0x75: return 252; case 0x55: return 220;
case 0x79: return 255; case 0x59: return 376;
default: return 0;
}
case 0xCA: // ring above
switch (c2)
{
case 0x20: return 730;
case 0x61: return 229; case 0x41: return 197;
case 0x75: return 367; case 0x55: return 366;
default: return 0;
}
case 0xCB: // cedilla
switch (c2)
{
case 0x63: return 231; case 0x43: return 199;
case 0x67: return 291; case 0x47: return 290;
case 0x6b: return 311; case 0x4b: return 310;
case 0x6c: return 316; case 0x4c: return 315;
case 0x6e: return 326; case 0x4e: return 325;
case 0x72: return 343; case 0x52: return 342;
case 0x73: return 351; case 0x53: return 350;
case 0x74: return 355; case 0x54: return 354;
default: return 0;
}
case 0xCD: // double acute accent
switch (c2)
{
case 0x20: return 733;
case 0x6f: return 337; case 0x4f: return 336;
case 0x75: return 369; case 0x55: return 368;
default: return 0;
}
case 0xCE: // ogonek
switch (c2)
{
case 0x20: return 731;
case 0x61: return 261; case 0x41: return 260;
case 0x65: return 281; case 0x45: return 280;
case 0x69: return 303; case 0x49: return 302;
case 0x75: return 371; case 0x55: return 370;
default: return 0;
}
case 0xCF: // caron
switch (c2)
{
case 0x20: return 711;
case 0x63: return 269; case 0x43: return 268;
case 0x64: return 271; case 0x44: return 270;
case 0x65: return 283; case 0x45: return 282;
case 0x6c: return 318; case 0x4c: return 317;
case 0x6e: return 328; case 0x4e: return 327;
case 0x72: return 345; case 0x52: return 344;
case 0x73: return 353; case 0x53: return 352;
case 0x74: return 357; case 0x54: return 356;
case 0x7a: return 382; case 0x5a: return 381;
default: return 0;
}
}
return 0;
}
static inline unsigned int recode(unsigned char d, int cp)
{
if (d < 0xA0)
return d;
switch (cp)
{
case 0: return iso6937[d-0xA0]; // ISO6937
case 1: return d; // 8859-1 -> unicode mapping
case 2: return c88592[d-0xA0]; // 8859-2 -> unicode mapping
case 3: return c88593[d-0xA0]; // 8859-3 -> unicode mapping
case 4: return c88594[d-0xA0]; // 8859-2 -> unicode mapping
case 5: return c88595[d-0xA0]; // 8859-5 -> unicode mapping
case 6: return c88596[d-0xA0]; // 8859-6 -> unicode mapping
case 7: return c88597[d-0xA0]; // 8859-7 -> unicode mapping
case 8: return c88598[d-0xA0]; // 8859-8 -> unicode mapping
case 9: return c88599[d-0xA0]; // 8859-9 -> unicode mapping
case 10: return c885910[d-0xA0]; // 8859-10 -> unicode mapping
case 11: return c885911[d-0xA0]; // 8859-11 -> unicode mapping
// case 12: return c885912[d-0xA0]; // 8859-12 -> unicode mapping reserved for indian use..
case 13: return c885913[d-0xA0]; // 8859-13 -> unicode mapping
case 14: return c885914[d-0xA0]; // 8859-14 -> unicode mapping
case 15: return c885915[d-0xA0]; // 8859-15 -> unicode mapping
case 16: return c885916[d-0xA0]; // 8859-16 -> unicode mapping
default: return d;
}
}
std::string UnicodeToUTF8(long c)
{
if ( c < 0x80 ) {
char utf[2] = {static_cast<char>(c), 0};
return std::string(utf, 1);
}
else if ( c < 0x800) {
char utf[3] = { static_cast<char>(0xc0 | (c >> 6)), static_cast<char>(0x80 | (c & 0x3f)), 0};
return std::string(utf, 2);
}
else if ( c < 0x10000) {
char utf[4] = { static_cast<char>(0xe0 | (c >> 12)), static_cast<char>(0x80 | ((c >> 6) & 0x3f)),
static_cast<char>(0x80 | (c & 0x3f)), 0};
return std::string(utf, 3);
}
else if ( c < 0x200000) {
char utf[5] = { static_cast<char>(0xf0 | (c >> 18)), static_cast<char>(0x80 | ((c >> 12) & 0x3f)),
static_cast<char>(0x80 | ((c >> 6) & 0x3f)), static_cast<char>(0x80 | (c & 0x3f)), 0};
return std::string(utf, 4);
}
eDebug("[UnicodeToUTF8] invalid unicode character: code=0x%08lx", c); // not a valid unicode
return "";
}
std::string GB18030ToUTF8(const char *szIn, int len, int *pconvertedLen)
{
std::string szOut = "";
unsigned long code = 0;
int i;
for (i = 0; i < len;) {
int cl = 0;
cl = gb18030_mbtowc((ucs4_t*)(&code), (const unsigned char *)szIn + i, len - i);
if (cl > 0) {
szOut += UnicodeToUTF8(code);
i += cl;
}
else
++i;
}
if (pconvertedLen)
*pconvertedLen = i;
return szOut;
}
std::string Big5ToUTF8(const char *szIn, int len, int *pconvertedLen)
{
std::string szOut = "";
unsigned long code = 0;
int i = 0;
for (;i < len; i++) {
if (((unsigned char)szIn[i] > 0xA0) && (unsigned char)szIn[i] <= 0xF9 &&
( (((unsigned char)szIn[i+1] >= 0x40) && ((unsigned char)szIn[i+1] <=0x7F )) ||
(((unsigned char)szIn[i+1] > 0xA0) && ((unsigned char)szIn[i+1] < 0xFF))
) ) {
big5_mbtowc((ucs4_t*)(&code), (const unsigned char *)szIn + i, 2);
szOut += UnicodeToUTF8(code);
i++;
}
else
szOut += szIn[i];
}
if (pconvertedLen)
*pconvertedLen = i;
return szOut;
}
std::string GEOSTD8ToUTF8(const char *szIn, int len, int *pconvertedLen)
{
// Each GEOSTD8 char is pair formed by prefix (0x10) and char <0xA0;0xFF> except 0xC6,<0xC8;0xCC>,0xCE,0xCF
// But in most cases is broadcasted without prefix due save space
// Conversion to UTF8 is then made without 0x10 prefixes
std::string szOut = "";
std::string prefix1 = "\xE1\x82";
std::string prefix2 = "\xE1\x83";
int i = 0;
int j = 0;
for (;i < len; i++)
{
// Drop 0x10 prefix, if exists
if ((unsigned char)szIn[i] == 0x10)
continue;
// no GEOSTD8 chars. drop it
if (((unsigned char)szIn[i] >= 0x80 && (unsigned char)szIn[i] < 0xA0) ||
(unsigned char)szIn[i] == 0xC6 ||
((unsigned char)szIn[i] >= 0xC8 && (unsigned char)szIn[i] <= 0xCC) ||
(unsigned char)szIn[i] == 0xCE || (unsigned char)szIn[i] == 0xCF)
continue;
if ((unsigned char)szIn[i] >= 0xA0 && (unsigned char)szIn[i] < 0xC0)
{
szOut += prefix1; j=j+2;
szOut += szIn[i]; j++;
}
else if ((unsigned char)szIn[i] >= 0xC0)
{
szOut += prefix2; j=j+2;
szOut += (unsigned char)(int(szIn[i])-0x40);j++;
}
else
{
szOut += szIn[i]; j++;
}
}
if (pconvertedLen)
*pconvertedLen = j;
szOut.resize(j);
return szOut;
}
std::string convertDVBUTF8(const unsigned char *data, int len, int table, int tsidonid,int *pconvertedLen)
{
if (!len){
if (pconvertedLen)
*pconvertedLen = 0;
return "";
}
int i = 0;
int mask_no_tableid = 0;
std::string output = "";
bool ignore_tableid = false;
int convertedLen = 0;
if (tsidonid)
encodingHandler.getTransponderDefaultMapping(tsidonid, table);
if (table >= 0 && (table & MASK_NO_TABLEID)){
mask_no_tableid = MASK_NO_TABLEID;
table &= ~MASK_NO_TABLEID;
}
if (table >= 0 && (table & MASK_IGNORE_TABLEID)){
ignore_tableid = true;
table &= ~MASK_IGNORE_TABLEID;
}
int table_preset = table;
// first byte in strings may override general encoding table.
switch(data[0] | mask_no_tableid)
{
case ISO8859_5 ... ISO8859_15:
// For Thai providers, encoding char is present but faulty.
if (table != 11)
table = data[i] + 4;
++i;
eTrace("[convertDVBUTF8] (1..11)text encoded in ISO-8859-%d", table);
break;
case ISO8859_xx:
{
int n = data[++i] << 8;
n |= (data[++i]);
eTrace("[convertDVBUTF8] (0x10)text encoded in ISO-8859-%d", n);
++i;
switch(n)
{
case ISO8859_12:
eDebug("[convertDVBUTF8] ISO8859-12 encoding unsupported");
break;
default:
table = n;
break;
}
break;
}
case UNICODE_ENCODING: // Basic Multilingual Plane of ISO/IEC 10646-1 enc (UTF-16... Unicode)
table = UNICODE_ENCODING;
tsidonid = 0;
++i;
break;
case KSX1001_ENCODING:
++i;
eDebug("[convertDVBUTF8] KSC 5601 encing unsupported.");
break;
case GB18030_ENCODING: // GB-2312-1980 enc.
++i;
table = GB18030_ENCODING;
break;
case BIG5_ENCODING: // Big5 subset of ISO/IEC 10646-1 enc.
++i;
table = BIG5_ENCODING;
break;
case UTF8_ENCODING: // UTF-8 encoding of ISO/IEC 10646-1
++i;
table = UTF8_ENCODING;
break;
case UTF16BE_ENCODING:
++i;
table = UTF16BE_ENCODING;
break;
case UTF16LE_ENCODING:
++i;
table = UTF16LE_ENCODING;
break;
case GEOSTD8_ENCODING:
++i;
table = GEOSTD8_ENCODING;
break;
case HUFFMAN_ENCODING:
{
// Attempt to decode Freesat Huffman encoded string
std::string decoded_string = huffmanDecoder.decode(data, len);
if (!decoded_string.empty()){
table = HUFFMAN_ENCODING;
output = decoded_string;
break;
}
}
++i;
eDebug("[convertDVBUTF8] failed to decode bbc freesat huffman");
break;
case 0x0:
case 0xC ... 0xF:
case 0x18 ... 0x1D:
eDebug("[convertDVBUTF8] reserved %d", data[0]);
++i;
break;
}
if (ignore_tableid && table != UTF8_ENCODING) {
table = table_preset;
}
bool useTwoCharMapping = !table || (tsidonid && encodingHandler.getTransponderUseTwoCharMapping(tsidonid));
if (useTwoCharMapping && table == 5) { // i hope this dont break other transponders which realy use ISO8859-5 and two char byte mapping...
eTrace("[convertDVBUTF8] Cyfra / Cyfrowy Polsat HACK... override given ISO8859-5 with ISO6937");
table = 0;
}
else if ( table == -1 )
table = defaultEncodingTable;
switch(table)
{
case HUFFMAN_ENCODING:
{
if(output.empty()){
// Attempt to decode Freesat Huffman encoded string
std::string decoded_string = huffmanDecoder.decode(data, len);
if (!decoded_string.empty())
output = decoded_string;
}
if (!output.empty())
convertedLen += len;
break;
}
case UTF8_ENCODING:
output = std::string((char*)data + i, len - i);
convertedLen += i;
break;
case GB18030_ENCODING:
output = GB18030ToUTF8((const char *)(data + i), len - i, &convertedLen);
convertedLen += i;
break;
case BIG5_ENCODING:
output = Big5ToUTF8((const char *)(data + i), len - i, &convertedLen);
convertedLen += i;
break;
case GEOSTD8_ENCODING:
output = GEOSTD8ToUTF8((const char *)(data + i), len - i, &convertedLen);
convertedLen += i;
break;
default:
std::string res = "";
while (i < len)
{
unsigned long code = 0;
if (useTwoCharMapping && i+1 < len && (code = doVideoTexSuppl(data[i], data[i+1])))
i += 2;
else if (table == UTF16BE_ENCODING || table == UNICODE_ENCODING) {
if (i+2 > len)
break;
unsigned long w1 = ((unsigned long)(data[i])<<8) | ((unsigned long)(data[i+1]));
if (w1 < 0xD800UL || w1 > 0xDFFFUL) {
code = w1;
i += 2;
}
else if (w1 > 0xDBFFUL)
break;
else if (i+4 < len) {
unsigned long w2 = ((unsigned long)(data[i+2]) << 8) | ((unsigned long)(data[i+3]));
if (w2 < 0xDC00UL || w2 > 0xDFFFUL)
return std::string("");
code = 0x10000UL + (((w1 & 0x03FFUL) << 10 ) | (w2 & 0x03FFUL));
i += 4;
}
else
break;
}
else if (table == UTF16LE_ENCODING) {
if ((i+2) > len)
break;
unsigned long w1 = ((unsigned long)(data[i+1]) << 8) | ((unsigned long)(data[i]));
if (w1 < 0xD800UL || w1 > 0xDFFFUL) {
code = w1;
i += 2;
}
else if (w1 > 0xDBFFUL)
break;
else if (i+4 < len) {
unsigned long w2 = ((unsigned long)(data[i+3]) << 8) | ((unsigned long)(data[i+2]));
if (w2 < 0xDC00UL || w2 > 0xDFFFUL)
break;
code = 0x10000UL + (((w2 & 0x03FFUL) << 10 ) | (w1 & 0x03FFUL));
i += 4;
}
else
break;
}
if (!code)
code = recode(data[i++], table);
if (!code)
continue;
res += UnicodeToUTF8(code);
}
convertedLen = i;
output = res;
break;
}
if (pconvertedLen)
*pconvertedLen = convertedLen;
/*
if (convertedLen < len)
eTrace("[convertDVBUTF8] %d chars converted, and %d chars left..", convertedLen, len-convertedLen);
eTrace("[convertDVBUTF8] table=0x%02X twochar=%d output:%s\n", table, useTwoCharMapping, output.c_str());
eTrace("[convertDVBUTF8] table=0x%02X tsid:onid=0x%X:0x%X data[0..14]=%s output:%s\n",
table, (unsigned int)tsidonid >> 16, tsidonid & 0xFFFFU,
string_to_hex(std::string((char*)data, len < 15 ? len : 15)).c_str(),
output.c_str());
*/
// replace EIT CR/LF with standard newline:
output = replace_all(replace_all(output, "\xC2\x8A", "\n"), "\xEE\x82\x8A", "\n");
// remove character emphasis control characters:
output = replace_all(replace_all(replace_all(replace_all(output, "\xC2\x86", ""), "\xEE\x82\x86", ""), "\xC2\x87", ""), "\xEE\x82\x87", "");
return output;
}
std::string convertUTF8DVB(const std::string &string, int table)
{
unsigned long *coding_table=0;
int len=string.length(), t=0;
unsigned char buf[len];
for (int i = 0; i < len; i++)
{
unsigned char c1 = string[i];
unsigned int c;
if (c1 < 0x80)
c = c1;
else
{
++i;
unsigned char c2 = string[i];
c = ((c1&0x3F)<<6) + (c2&0x3F);
if (table == 0 || table == 1 || c1 < 0xA0)
;
else
{
if (!coding_table)
{
switch (table)
{
case 2: coding_table = c88592; break;
case 3: coding_table = c88593; break;
case 4: coding_table = c88594; break;
case 5: coding_table = c88595; break;
case 6: coding_table = c88596; break;
case 7: coding_table = c88597; break;
case 8: coding_table = c88598; break;
case 9: coding_table = c88599; break;
case 10: coding_table = c885910; break;
case 11: coding_table = c885911; break;
// case 12: coding_table = c885912; break; // reserved.. for indian use
case 13: coding_table = c885913; break;
case 14: coding_table = c885914; break;
case 15: coding_table = c885915; break;
case 16: coding_table = c885916; break;
default:
eFatal("[convertUTF8DVB] unknown coding table %d", table);
break;
}
}
for (unsigned int j = 0; j < 96; j++)
{
if (coding_table[j] == c)
{
c = 0xA0 + j;
break;
}
}
}
}
buf[t++] = (unsigned char)c;
}
return std::string((char*)buf, t);
}
std::string convertLatin1UTF8(const std::string &string)
{
unsigned int i = 0, len = string.size();
std::string res = "";
while (i < len)
{
unsigned long code = (unsigned char)string[i++];
res += UnicodeToUTF8(code);
}
return res;
}
int isUTF8(const std::string &string)
{
unsigned int len = string.size();
// Unicode chars: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
// (i.e. any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
// Avoid "compatibility characters", as defined in section 2.3 of The Unicode Standard, Version 5.0.0.
// Following characters are also discouraged. They are either control characters or permanently
// undefined Unicode characters:
//[#x7F-#x84], [#x86-#x9F], [#xFDD0-#xFDEF],
//[#x1FFFE-#x1FFFF], [#x2FFFE-#x2FFFF], [#x3FFFE-#x3FFFF],
//[#x4FFFE-#x4FFFF], [#x5FFFE-#x5FFFF], [#x6FFFE-#x6FFFF],
//[#x7FFFE-#x7FFFF], [#x8FFFE-#x8FFFF], [#x9FFFE-#x9FFFF],
//[#xAFFFE-#xAFFFF], [#xBFFFE-#xBFFFF], [#xCFFFE-#xCFFFF],
//[#xDFFFE-#xDFFFF], [#xEFFFE-#xEFFFF], [#xFFFFE-#xFFFFF],
//[#x10FFFE-#x10FFFF].
for (unsigned int i = 0; i < len; ++i)
{
if (!(string[i] & 0x80)) // normal ASCII
continue;
int l = 0;
if ((string[i] & 0xE0) == 0xC0) // 2-byte
l = 1;
else if ((string[i] & 0xF0) == 0xE0) // 3-byte
l = 2;
else if ((string[i] & 0xF8) == 0xF0) // 4-byte
l = 3;
if (l == 0 || i + l >= len) // no UTF leader or not enough bytes
return 0;
while (l-- > 0) {
if ((string[++i] & 0xC0) != 0x80)
return 0;
}
}
return 1; // can be UTF8 (or pure ASCII, at least no non-UTF-8 8bit characters)
}
unsigned int truncateUTF8(std::string &s, unsigned int newsize)
{
unsigned int len = s.size();
// Assume s is a real UTF8 string!!!
unsigned int n = 0;
unsigned int idx = newsize - 1;
if (len > idx){
while (idx > 0) {
if (!(s.at(idx) & 0x80) || (s.at(idx) & 0xc0) == 0xc0){
if (!(s.at(idx) & 0x80))
idx++;
else if ((s.at(idx) & 0xF8) == 0xf0 && n == 3)
idx += n + 1;
else if ((s.at(idx) & 0xF0) == 0xe0 && n == 2)
idx += n + 1;
else if ((s.at(idx) & 0xE0) == 0xc0 && n == 1)
idx += n + 1;
break;
}
n++;
if (idx > 0)
idx--;
}
len = idx;
}
s.resize(len);
return len;
}
std::string removeDVBChars(const std::string &s)
{
std::string res;
int len = s.length();
for (int i = 0; i < len; i++)
{
unsigned char c1 = s[i];
unsigned int c;
/* UTF8? decode (but only simple) */
if ((c1 > 0x80) && (i < len-1))
{
unsigned char c2 = s[i + 1];
c = ((c1&0x3F)<<6) + (c2&0x3F);
if ((c >= 0x80) && (c <= 0x9F))
{
++i; /* skip 2nd utf8 char */
continue;
}
}
res += s[i];
}
return res;
}
void makeUpper(std::string &s)
{
std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper);
}
std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol, int table)
{
std::string out = in;
std::string::size_type loc = 0;
if( table == -1 )
table = defaultEncodingTable;
switch(table){
case UTF8_ENCODING:
while (loc < out.length()) {
if ( (entity.length() + loc) <= out.length() && !out.compare(loc, entity.length(), entity)) {
out.replace(loc, entity.length(), symbol);
loc += symbol.length();
continue;
}
unsigned char c = static_cast<unsigned char>(out.at(loc));
if (c < 0x80)
++loc;
else if ((c & 0xE0) == 0xC0)
loc += 2;
else if ((c & 0xF0) == 0xE0)
loc += 3;
else if ((c & 0xF8) == 0xF0)
loc += 4;
}
break;
case BIG5_ENCODING:
case GB18030_ENCODING:
while (loc<out.length()) {
if ((entity.length() + loc) <= out.length() && !out.compare(loc, entity.length(), entity)) {
out.replace(loc, entity.length(), symbol);
loc += symbol.length();
continue;
}
if (loc+1 >= out.length())
break;
unsigned char c1 = out.at(loc);
unsigned char c2 = out.at(loc+1);
if ((c1 > 0x80 && c1 < 0xff && c2 >= 0x40 && c2 < 0xff) || //GBK
(c1 > 0xa0 && c1 < 0xf9 && ((c2 >= 0x40 && c2 < 0x7f) || (c2 > 0xa0 && c2 < 0xff))) //BIG5
)
loc += 2;
else
++loc;
}
break;
case UTF16BE_ENCODING:
case UTF16LE_ENCODING:
while (loc<out.length()) {
if ((entity.length() + loc) <= out.length() && !out.compare(loc, entity.length(), entity)) {
out.replace(loc, entity.length(), symbol);
loc += symbol.length();
continue;
}
loc += 2;
}
break;
default:
while ((loc = out.find(entity, loc)) != std::string::npos)
{
out.replace(loc, entity.length(), symbol);
loc += symbol.length();
}
break;
}
return out;
}
std::string urlDecode(const std::string &s)
{
int len = s.size();
std::string res;
int i;
for (i = 0; i < len; ++i)
{
unsigned char c = s[i];
if (c != '%')
{
res += c;
}
else
{
i += 2;
if (i >= len)
break;
char t[3] = {s[i - 1], s[i], 0};
unsigned char r = strtoul(t, 0, 0x10);
if (r)
res += r;
}
}
return res;
}
std::string string_to_hex(const std::string& input)
{
static const char* const lut = "0123456789ABCDEF";
size_t len = input.length();
std::string output;
output.reserve(3 * len);
for (size_t i = 0; i < len; ++i)
{
const unsigned char c = input[i];
if (i)
output.push_back(' ');
output.push_back(lut[c >> 4]);
output.push_back(lut[c & 15]);
}
return output;
}
std::string strip_non_graph(std::string s)
{
s = std::regex_replace(s, std::regex("[[^:graph:]]"), " ");
s = std::regex_replace(s, std::regex("\\s{2,}"), " ");
s = std::regex_replace(s, std::regex("^\\s+|\\s+$"), "");
return s;
}
std::vector<std::string> split(std::string s, const std::string& separator)
{
std::vector<std::string> tokens;
std::string token;
size_t pos, sep_len = separator.length();
while ((pos = s.find(separator)) != std::string::npos)
{
token = s.substr(0, pos);
if (!token.empty())
{
tokens.push_back(token);
}
s.erase(0, pos + sep_len);
}
if (!s.empty())
{
tokens.push_back(s);
}
return tokens;
}
int strcasecmp(const std::string& s1, const std::string& s2)
{
return ::strcasecmp(s1.c_str(), s2.c_str());
}
std::string formatNumber(size_t size, const std::string& suffix, bool binary)
{
std::map<uint8_t, std::string> unit = {
{ 24, "Y" },
{ 21, "Z" },
{ 18, "E" },
{ 15, "P" },
{ 12, "T" },
{ 9, "G" },
{ 6, "M" },
{ 3, binary ? "K" : "k" },
{ 0, "" }
};
uint8_t k = 0;
size_t rem = 0;
uint16_t base = binary ? 1024 : 1000;
while (size >= base)
{
rem = size % base;
k += 3;
size /= base;
}
float num = size + (rem*1.0f/base);
std::stringstream ss;
ss << num << " " << unit[k] << suffix;
return ss.str();
}
| openatv/enigma2 | lib/base/estring.cpp | C++ | gpl-2.0 | 39,522 |
/* Copyright 2003-2005 Guillaume Duhamel
Copyright 2004-2006 Theo Berkau
This file is part of Yabause.
Yabause is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Yabause is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Yabause; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
#include <time.h>
#include "smpc.h"
#include "cs2.h"
#include "debug.h"
#include "peripheral.h"
#include "scsp.h"
#include "scu.h"
#include "sh2core.h"
#include "vdp1.h"
#include "vdp2.h"
#include "yabause.h"
Smpc * SmpcRegs;
u8 * SmpcRegsT;
SmpcInternal * SmpcInternalVars;
//////////////////////////////////////////////////////////////////////////////
int SmpcInit(u8 regionid) {
if ((SmpcRegsT = (u8 *) calloc(1, sizeof(Smpc))) == NULL)
return -1;
SmpcRegs = (Smpc *) SmpcRegsT;
if ((SmpcInternalVars = (SmpcInternal *) calloc(1, sizeof(SmpcInternal))) == NULL)
return -1;
SmpcInternalVars->regionsetting = regionid;
SmpcInternalVars->regionid = regionid;
return 0;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcDeInit(void) {
if (SmpcRegsT)
free(SmpcRegsT);
SmpcRegsT = NULL;
if (SmpcInternalVars)
free(SmpcInternalVars);
SmpcInternalVars = NULL;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcRecheckRegion(void) {
if (SmpcInternalVars == NULL)
return;
if (SmpcInternalVars->regionsetting == REGION_AUTODETECT)
{
// Time to autodetect the region using the cd block
SmpcInternalVars->regionid = Cs2GetRegionID();
// Since we couldn't detect the region from the CD, let's assume
// it's japanese
if (SmpcInternalVars->regionid == 0)
SmpcInternalVars->regionid = 1;
}
else
Cs2GetIP(0);
}
//////////////////////////////////////////////////////////////////////////////
void SmpcReset(void) {
memset((void *)SmpcRegs, 0, sizeof(Smpc));
memset((void *)SmpcInternalVars->SMEM, 0, 4);
SmpcRecheckRegion();
SmpcInternalVars->dotsel = 0;
SmpcInternalVars->mshnmi = 0;
SmpcInternalVars->sysres = 0;
SmpcInternalVars->sndres = 0;
SmpcInternalVars->cdres = 0;
SmpcInternalVars->resd = 1;
SmpcInternalVars->ste = 0;
SmpcInternalVars->resb = 0;
SmpcInternalVars->intback=0;
SmpcInternalVars->intbackIreg0=0;
SmpcInternalVars->firstPeri=0;
SmpcInternalVars->timing=0;
memset((void *)&SmpcInternalVars->port1, 0, sizeof(PortData_struct));
memset((void *)&SmpcInternalVars->port2, 0, sizeof(PortData_struct));
}
//////////////////////////////////////////////////////////////////////////////
void SmpcSSHON() {
YabauseStartSlave();
}
//////////////////////////////////////////////////////////////////////////////
void SmpcSSHOFF() {
YabauseStopSlave();
}
//////////////////////////////////////////////////////////////////////////////
void SmpcSNDON() {
M68KReset();
yabsys.IsM68KRunning = 1;
SmpcRegs->OREG[31] = 0x6;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcSNDOFF() {
yabsys.IsM68KRunning = 0;
SmpcRegs->OREG[31] = 0x7;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcCKCHG352() {
// Reset VDP1, VDP2, SCU, and SCSP
Vdp1Reset();
Vdp2Reset();
ScuReset();
ScspReset();
// Clear VDP1/VDP2 ram
YabauseStopSlave();
// change clock
YabauseChangeTiming(CLKTYPE_28MHZ);
// Set DOTSEL
SmpcInternalVars->dotsel = 1;
// Send NMI
SH2NMI(&MSH2);
}
//////////////////////////////////////////////////////////////////////////////
void SmpcCKCHG320() {
// Reset VDP1, VDP2, SCU, and SCSP
Vdp1Reset();
Vdp2Reset();
ScuReset();
ScspReset();
// Clear VDP1/VDP2 ram
YabauseStopSlave();
// change clock
YabauseChangeTiming(CLKTYPE_26MHZ);
// Set DOTSEL
SmpcInternalVars->dotsel = 0;
// Send NMI
SH2NMI(&MSH2);
}
struct movietime {
int tm_year;
int tm_wday;
int tm_mon;
int tm_mday;
int tm_hour;
int tm_min;
int tm_sec;
};
static struct movietime movietime;
int totalseconds;
int noon= 43200;
//////////////////////////////////////////////////////////////////////////////
void SmpcINTBACKStatus(void) {
// return time, cartidge, zone, etc. data
int i;
struct tm times;
u8 year[4];
time_t tmp;
SmpcRegs->OREG[0] = 0x80 | (SmpcInternalVars->resd << 6); // goto normal startup
//SmpcRegs->OREG[0] = 0x0 | (SmpcInternalVars->resd << 6); // goto setclock/setlanguage screen
// write time data in OREG1-7
tmp = time(NULL);
#ifdef WIN32
memcpy(×, localtime(&tmp), sizeof(times));
#elif !defined(_arch_dreamcast)
localtime_r(&tmp, ×);
#else
struct tm * internal_localtime_r(const time_t * tim_p, struct tm *res);
internal_localtime_r(&tmp, ×);
#endif
year[0] = (1900 + times.tm_year) / 1000;
year[1] = ((1900 + times.tm_year) % 1000) / 100;
year[2] = (((1900 + times.tm_year) % 1000) % 100) / 10;
year[3] = (((1900 + times.tm_year) % 1000) % 100) % 10;
SmpcRegs->OREG[1] = (year[0] << 4) | year[1];
SmpcRegs->OREG[2] = (year[2] << 4) | year[3];
SmpcRegs->OREG[3] = (times.tm_wday << 4) | (times.tm_mon + 1);
SmpcRegs->OREG[4] = ((times.tm_mday / 10) << 4) | (times.tm_mday % 10);
SmpcRegs->OREG[5] = ((times.tm_hour / 10) << 4) | (times.tm_hour % 10);
SmpcRegs->OREG[6] = ((times.tm_min / 10) << 4) | (times.tm_min % 10);
SmpcRegs->OREG[7] = ((times.tm_sec / 10) << 4) | (times.tm_sec % 10);
if(MovieIsActive()) {
movietime.tm_year=0x62;
movietime.tm_wday=0x04;
movietime.tm_mday=0x01;
movietime.tm_mon=0;
totalseconds = ((currFrameCounter / 60) + noon);
movietime.tm_sec=totalseconds % 60;
movietime.tm_min=totalseconds/60;
movietime.tm_hour=movietime.tm_min/60;
//convert to sane numbers
movietime.tm_min=movietime.tm_min % 60;
movietime.tm_hour=movietime.tm_hour % 24;
year[0] = (1900 + movietime.tm_year) / 1000;
year[1] = ((1900 + movietime.tm_year) % 1000) / 100;
year[2] = (((1900 + movietime.tm_year) % 1000) % 100) / 10;
year[3] = (((1900 + movietime.tm_year) % 1000) % 100) % 10;
SmpcRegs->OREG[1] = (year[0] << 4) | year[1];
SmpcRegs->OREG[2] = (year[2] << 4) | year[3];
SmpcRegs->OREG[3] = (movietime.tm_wday << 4) | (movietime.tm_mon + 1);
SmpcRegs->OREG[4] = ((movietime.tm_mday / 10) << 4) | (movietime.tm_mday % 10);
SmpcRegs->OREG[5] = ((movietime.tm_hour / 10) << 4) | (movietime.tm_hour % 10);
SmpcRegs->OREG[6] = ((movietime.tm_min / 10) << 4) | (movietime.tm_min % 10);
SmpcRegs->OREG[7] = ((movietime.tm_sec / 10) << 4) | (movietime.tm_sec % 10);
}
// write cartidge data in OREG8
SmpcRegs->OREG[8] = 0; // FIXME : random value
// write zone data in OREG9 bits 0-7
// 1 -> japan
// 2 -> asia/ntsc
// 4 -> north america
// 5 -> central/south america/ntsc
// 6 -> corea
// A -> asia/pal
// C -> europe + others/pal
// D -> central/south america/pal
SmpcRegs->OREG[9] = SmpcInternalVars->regionid;
// system state, first part in OREG10, bits 0-7
// bit | value | comment
// ---------------------------
// 7 | 0 |
// 6 | DOTSEL |
// 5 | 1 |
// 4 | 1 |
// 3 | MSHNMI |
// 2 | 1 |
// 1 | SYSRES |
// 0 | SNDRES |
SmpcRegs->OREG[10] = 0x34|(SmpcInternalVars->dotsel<<6)|(SmpcInternalVars->mshnmi<<3)|(SmpcInternalVars->sysres<<1)|SmpcInternalVars->sndres;
// system state, second part in OREG11, bit 6
// bit 6 -> CDRES
SmpcRegs->OREG[11] = SmpcInternalVars->cdres << 6; // FIXME
// SMEM
for(i = 0;i < 4;i++)
SmpcRegs->OREG[12+i] = SmpcInternalVars->SMEM[i];
SmpcRegs->OREG[31] = 0x10; // set to intback command
}
//////////////////////////////////////////////////////////////////////////////
void SmpcINTBACKPeripheral(void) {
int oregoffset;
PortData_struct *port1, *port2;
if (SmpcInternalVars->firstPeri)
SmpcRegs->SR = 0xC0 | (SmpcRegs->IREG[1] >> 4);
else
SmpcRegs->SR = 0x80 | (SmpcRegs->IREG[1] >> 4);
SmpcInternalVars->firstPeri = 0;
/* Port Status:
0x04 - Sega-tap is connected
0x16 - Multi-tap is connected
0x21-0x2F - Clock serial peripheral is connected
0xF0 - Not Connected or Unknown Device
0xF1 - Peripheral is directly connected */
/* PeripheralID:
0x02 - Digital Device Standard Format
0x13 - Racing Device Standard Format
0x15 - Analog Device Standard Format
0x23 - Pointing Device Standard Format
0x23 - Shooting Device Standard Format
0x34 - Keyboard Device Standard Format
0xE1 - Mega Drive 3-Button Pad
0xE2 - Mega Drive 6-Button Pad
0xE3 - Saturn Mouse
0xFF - Not Connected */
/* Special Notes(for potential future uses):
If a peripheral is disconnected from a port, you only return 1 byte for
that port(which is the port status 0xF0), at the next OREG you then return
the port status of the next port.
e.g. If Port 1 has nothing connected, and Port 2 has a controller
connected:
OREG0 = 0xF0
OREG1 = 0xF1
OREG2 = 0x02
etc.
*/
oregoffset=0;
if (SmpcInternalVars->port1.size == 0 && SmpcInternalVars->port2.size == 0)
{
// Request data from the Peripheral Interface
port1 = &PORTDATA1;
port2 = &PORTDATA2;
memcpy(&SmpcInternalVars->port1, port1, sizeof(PortData_struct));
memcpy(&SmpcInternalVars->port2, port2, sizeof(PortData_struct));
PerFlush(&PORTDATA1);
PerFlush(&PORTDATA2);
SmpcInternalVars->port1.offset = 0;
SmpcInternalVars->port2.offset = 0;
LagFrameFlag=0;
}
// Port 1
if (SmpcInternalVars->port1.size > 0)
{
if ((SmpcInternalVars->port1.size-SmpcInternalVars->port1.offset) < 32)
{
memcpy(SmpcRegs->OREG, SmpcInternalVars->port1.data+SmpcInternalVars->port1.offset, SmpcInternalVars->port1.size-SmpcInternalVars->port1.offset);
oregoffset += SmpcInternalVars->port1.size-SmpcInternalVars->port1.offset;
SmpcInternalVars->port1.size = 0;
}
else
{
memcpy(SmpcRegs->OREG, SmpcInternalVars->port1.data, 32);
oregoffset += 32;
SmpcInternalVars->port1.offset += 32;
}
}
// Port 2
if (SmpcInternalVars->port2.size > 0 && oregoffset < 32)
{
if ((SmpcInternalVars->port2.size-SmpcInternalVars->port2.offset) < (32 - oregoffset))
{
memcpy(SmpcRegs->OREG + oregoffset, SmpcInternalVars->port2.data+SmpcInternalVars->port2.offset, SmpcInternalVars->port2.size-SmpcInternalVars->port2.offset);
SmpcInternalVars->port2.size = 0;
}
else
{
memcpy(SmpcRegs->OREG + oregoffset, SmpcInternalVars->port2.data, 32 - oregoffset);
SmpcInternalVars->port2.offset += 32 - oregoffset;
}
}
/*
Use this as a reference for implementing other peripherals
// Port 1
SmpcRegs->OREG[0] = 0xF1; //Port Status(Directly Connected)
SmpcRegs->OREG[1] = 0xE3; //PeripheralID(Shuttle Mouse)
SmpcRegs->OREG[2] = 0x00; //First Data
SmpcRegs->OREG[3] = 0x00; //Second Data
SmpcRegs->OREG[4] = 0x00; //Third Data
// Port 2
SmpcRegs->OREG[5] = 0xF0; //Port Status(Not Connected)
*/
}
//////////////////////////////////////////////////////////////////////////////
void SmpcINTBACK() {
SmpcRegs->SF = 1;
if (SmpcInternalVars->intback) {
SmpcINTBACKPeripheral();
ScuSendSystemManager();
return;
}
if ((SmpcInternalVars->intbackIreg0 = SmpcRegs->IREG[0]) != 0) {
// Return non-peripheral data
SmpcInternalVars->firstPeri = 1;
SmpcInternalVars->intback = (SmpcRegs->IREG[1] & 0x8) >> 3; // does the program want peripheral data too?
SmpcINTBACKStatus();
SmpcRegs->SR = 0x4F | (SmpcInternalVars->intback << 5); // the low nibble is undefined(or 0xF)
ScuSendSystemManager();
return;
}
if (SmpcRegs->IREG[1] & 0x8) {
SmpcInternalVars->firstPeri = 1;
SmpcInternalVars->intback = 1;
SmpcRegs->SR = 0x40;
SmpcINTBACKPeripheral();
SmpcRegs->OREG[31] = 0x10; // may need to be changed
ScuSendSystemManager();
return;
}
}
//////////////////////////////////////////////////////////////////////////////
void SmpcINTBACKEnd() {
SmpcInternalVars->intback = 0;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcSETSMEM() {
int i;
for(i = 0;i < 4;i++)
SmpcInternalVars->SMEM[i] = SmpcRegs->IREG[i];
SmpcRegs->OREG[31] = 0x17;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcNMIREQ() {
SH2SendInterrupt(&MSH2, 0xB, 16);
SmpcRegs->OREG[31] = 0x18;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcResetButton() {
// If RESD isn't set, send an NMI request to the MSH2.
if (SmpcInternalVars->resd)
return;
SH2SendInterrupt(&MSH2, 0xB, 16);
}
//////////////////////////////////////////////////////////////////////////////
void SmpcRESENAB() {
SmpcInternalVars->resd = 0;
SmpcRegs->OREG[31] = 0x19;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcRESDISA() {
SmpcInternalVars->resd = 1;
SmpcRegs->OREG[31] = 0x1A;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcExec(s32 t) {
if (SmpcInternalVars->timing > 0) {
SmpcInternalVars->timing -= t;
if (SmpcInternalVars->timing <= 0) {
switch(SmpcRegs->COMREG) {
case 0x0:
SMPCLOG("smpc\t: MSHON not implemented\n");
break;
case 0x2:
SMPCLOG("smpc\t: SSHON\n");
SmpcSSHON();
break;
case 0x3:
SMPCLOG("smpc\t: SSHOFF\n");
SmpcSSHOFF();
break;
case 0x6:
SMPCLOG("smpc\t: SNDON\n");
SmpcSNDON();
break;
case 0x7:
SMPCLOG("smpc\t: SNDOFF\n");
SmpcSNDOFF();
break;
case 0x8:
SMPCLOG("smpc\t: CDON not implemented\n");
break;
case 0x9:
SMPCLOG("smpc\t: CDOFF not implemented\n");
break;
case 0xD:
SMPCLOG("smpc\t: SYSRES not implemented\n");
break;
case 0xE:
SMPCLOG("smpc\t: CKCHG352\n");
SmpcCKCHG352();
break;
case 0xF:
SMPCLOG("smpc\t: CKCHG320\n");
SmpcCKCHG320();
break;
case 0x10:
SMPCLOG("smpc\t: INTBACK\n");
SmpcINTBACK();
break;
case 0x17:
SMPCLOG("smpc\t: SETSMEM\n");
SmpcSETSMEM();
break;
case 0x18:
SMPCLOG("smpc\t: NMIREQ\n");
SmpcNMIREQ();
break;
case 0x19:
SMPCLOG("smpc\t: RESENAB\n");
SmpcRESENAB();
break;
case 0x1A:
SMPCLOG("smpc\t: RESDISA\n");
SmpcRESDISA();
break;
default:
SMPCLOG("smpc\t: Command %02X not implemented\n", SmpcRegs->COMREG);
break;
}
SmpcRegs->SF = 0;
}
}
}
//////////////////////////////////////////////////////////////////////////////
u8 FASTCALL SmpcReadByte(u32 addr) {
addr &= 0x7F;
return SmpcRegsT[addr >> 1];
}
//////////////////////////////////////////////////////////////////////////////
u16 FASTCALL SmpcReadWord(USED_IF_SMPC_DEBUG u32 addr) {
// byte access only
SMPCLOG("smpc\t: SMPC register read word - %08X\n", addr);
return 0;
}
//////////////////////////////////////////////////////////////////////////////
u32 FASTCALL SmpcReadLong(USED_IF_SMPC_DEBUG u32 addr) {
// byte access only
SMPCLOG("smpc\t: SMPC register read long - %08X\n", addr);
return 0;
}
//////////////////////////////////////////////////////////////////////////////
void SmpcSetTiming(void) {
switch(SmpcRegs->COMREG) {
case 0x0:
SMPCLOG("smpc\t: MSHON not implemented\n");
SmpcInternalVars->timing = 1;
return;
case 0x8:
SMPCLOG("smpc\t: CDON not implemented\n");
SmpcInternalVars->timing = 1;
return;
case 0x9:
SMPCLOG("smpc\t: CDOFF not implemented\n");
SmpcInternalVars->timing = 1;
return;
case 0xD:
case 0xE:
case 0xF:
SmpcInternalVars->timing = 1; // this has to be tested on a real saturn
return;
case 0x10:
if (SmpcInternalVars->intback)
SmpcInternalVars->timing = 20; // this will need to be verified
else {
// Calculate timing based on what data is being retrieved
SmpcInternalVars->timing = 1;
// If retrieving non-peripheral data, add 0.2 milliseconds
if (SmpcRegs->IREG[0] == 0x01)
SmpcInternalVars->timing += 2;
// If retrieving peripheral data, add 15 milliseconds
if (SmpcRegs->IREG[1] & 0x8)
SmpcInternalVars->timing += 16000; // Strangely enough, this works better
// SmpcInternalVars->timing += 150;
}
return;
case 0x17:
SmpcInternalVars->timing = 1;
return;
case 0x2:
SmpcInternalVars->timing = 1;
return;
case 0x3:
SmpcInternalVars->timing = 1;
return;
case 0x6:
case 0x7:
case 0x18:
case 0x19:
case 0x1A:
SmpcInternalVars->timing = 1;
return;
default:
SMPCLOG("smpc\t: unimplemented command: %02X\n", SmpcRegs->COMREG);
SmpcRegs->SF = 0;
break;
}
}
//////////////////////////////////////////////////////////////////////////////
void FASTCALL SmpcWriteByte(u32 addr, u8 val) {
addr &= 0x7F;
SmpcRegsT[addr >> 1] = val;
switch(addr) {
case 0x01: // Maybe an INTBACK continue/break request
if (SmpcInternalVars->intback)
{
if (SmpcRegs->IREG[0] & 0x40) {
// Break
SmpcInternalVars->intback = 0;
SmpcRegs->SR &= 0x0F;
break;
}
else if (SmpcRegs->IREG[0] & 0x80) {
// Continue
SmpcRegs->COMREG = 0x10;
SmpcSetTiming();
SmpcRegs->SF = 1;
}
}
return;
case 0x1F:
SmpcSetTiming();
return;
case 0x63:
SmpcRegs->SF &= 0x1;
return;
case 0x75:
// FIX ME (should support other peripherals)
switch (SmpcRegs->DDR[0] & 0x7F) { // Which Control Method do we use?
case 0x40:
SMPCLOG("smpc\t: Peripheral TH Control Method not implemented\n");
break;
case 0x60:
switch (val & 0x60) {
case 0x60: // 1st Data
val = (val & 0x80) | 0x14 | (PORTDATA1.data[1] & 0x8);
break;
case 0x20: // 2nd Data
val = (val & 0x80) | 0x10 | ((PORTDATA1.data[2] >> 4) & 0xF);
break;
case 0x40: // 3rd Data
val = (val & 0x80) | 0x10 | (PORTDATA1.data[2] & 0xF);
break;
case 0x00: // 4th Data
val = (val & 0x80) | 0x10 | ((PORTDATA1.data[1] >> 4) & 0xF);
break;
default: break;
}
SmpcRegs->PDR[0] = val;
break;
default:
SMPCLOG("smpc\t: Peripheral Unknown Control Method not implemented\n");
break;
}
return;
default:
return;
}
}
//////////////////////////////////////////////////////////////////////////////
void FASTCALL SmpcWriteWord(USED_IF_SMPC_DEBUG u32 addr, UNUSED u16 val) {
// byte access only
SMPCLOG("smpc\t: SMPC register write word - %08X\n", addr);
}
//////////////////////////////////////////////////////////////////////////////
void FASTCALL SmpcWriteLong(USED_IF_SMPC_DEBUG u32 addr, UNUSED u32 val) {
// byte access only
SMPCLOG("smpc\t: SMPC register write long - %08X\n", addr);
}
//////////////////////////////////////////////////////////////////////////////
int SmpcSaveState(FILE *fp)
{
int offset;
IOCheck_struct check;
offset = StateWriteHeader(fp, "SMPC", 2);
// Write registers
ywrite(&check, (void *)SmpcRegs->IREG, sizeof(u8), 7, fp);
ywrite(&check, (void *)&SmpcRegs->COMREG, sizeof(u8), 1, fp);
ywrite(&check, (void *)SmpcRegs->OREG, sizeof(u8), 32, fp);
ywrite(&check, (void *)&SmpcRegs->SR, sizeof(u8), 1, fp);
ywrite(&check, (void *)&SmpcRegs->SF, sizeof(u8), 1, fp);
ywrite(&check, (void *)SmpcRegs->PDR, sizeof(u8), 2, fp);
ywrite(&check, (void *)SmpcRegs->DDR, sizeof(u8), 2, fp);
ywrite(&check, (void *)&SmpcRegs->IOSEL, sizeof(u8), 1, fp);
ywrite(&check, (void *)&SmpcRegs->EXLE, sizeof(u8), 1, fp);
// Write internal variables
ywrite(&check, (void *)SmpcInternalVars, sizeof(SmpcInternal), 1, fp);
// Write ID's of currently emulated peripherals(fix me)
return StateFinishHeader(fp, offset);
}
//////////////////////////////////////////////////////////////////////////////
int SmpcLoadState(FILE *fp, int version, int size)
{
IOCheck_struct check;
// Read registers
yread(&check, (void *)SmpcRegs->IREG, sizeof(u8), 7, fp);
yread(&check, (void *)&SmpcRegs->COMREG, sizeof(u8), 1, fp);
yread(&check, (void *)SmpcRegs->OREG, sizeof(u8), 32, fp);
yread(&check, (void *)&SmpcRegs->SR, sizeof(u8), 1, fp);
yread(&check, (void *)&SmpcRegs->SF, sizeof(u8), 1, fp);
yread(&check, (void *)SmpcRegs->PDR, sizeof(u8), 2, fp);
yread(&check, (void *)SmpcRegs->DDR, sizeof(u8), 2, fp);
yread(&check, (void *)&SmpcRegs->IOSEL, sizeof(u8), 1, fp);
yread(&check, (void *)&SmpcRegs->EXLE, sizeof(u8), 1, fp);
// Read internal variables
if (version == 1)
{
// This handles the problem caused by the version not being incremented
// when SmpcInternal was changed
if ((size - 48) == sizeof(SmpcInternal))
yread(&check, (void *)SmpcInternalVars, sizeof(SmpcInternal), 1, fp);
else if ((size - 48) == 24)
yread(&check, (void *)SmpcInternalVars, 24, 1, fp);
else
fseek(fp, size - 48, SEEK_CUR);
}
else
yread(&check, (void *)SmpcInternalVars, sizeof(SmpcInternal), 1, fp);
// Read ID's of currently emulated peripherals(fix me)
return size;
}
//////////////////////////////////////////////////////////////////////////////
| adelikat/yabause-rr | src/smpc.c | C | gpl-2.0 | 24,340 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Collective.slug'
db.add_column(u'collectives_collective', 'slug',
self.gf('django.db.models.fields.SlugField')(default='hello', max_length=40),
keep_default=False)
# Adding field 'Action.slug'
db.add_column(u'collectives_action', 'slug',
self.gf('django.db.models.fields.SlugField')(default='hello', max_length=40),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Collective.slug'
db.delete_column(u'collectives_collective', 'slug')
# Deleting field 'Action.slug'
db.delete_column(u'collectives_action', 'slug')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'collectives.action': {
'Meta': {'object_name': 'Action'},
'description': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '40'})
},
u'collectives.collective': {
'Meta': {'object_name': 'Collective'},
'actions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['collectives.Action']", 'symmetrical': 'False'}),
'description': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'members': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '40'})
},
u'collectives.useraction': {
'Meta': {'object_name': 'UserAction'},
'action': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['collectives.Action']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'status': ('django.db.models.fields.IntegerField', [], {'default': '1', 'max_length': '1'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
}
}
complete_apps = ['collectives'] | strikedebt/debtcollective-web | be/proj/collectives/migrations/0003_auto__add_field_collective_slug__add_field_action_slug.py | Python | gpl-2.0 | 5,792 |
/* Copyright 2013 David Axmark
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef EXTENSIONS_H
#define EXTENSIONS_H
#include "helpers/types.h"
void loadExtensions(const char* extConfFileName);
#endif //EXTENSIONS_H
| tybor/MoSync | runtimes/cpp/core/extensions.h | C | gpl-2.0 | 701 |
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2003 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IPRIMARYSCREEN_H
#define IPRIMARYSCREEN_H
#include "IInterface.h"
#include "KeyTypes.h"
#include "MouseTypes.h"
#include "CEvent.h"
#include "GameDeviceTypes.h"
//! Primary screen interface
/*!
This interface defines the methods common to all platform dependent
primary screen implementations.
*/
class IPrimaryScreen : public IInterface {
public:
//! Button event data
class CButtonInfo {
public:
static CButtonInfo* alloc(ButtonID, KeyModifierMask);
static CButtonInfo* alloc(const CButtonInfo&);
static bool equal(const CButtonInfo*, const CButtonInfo*);
public:
ButtonID m_button;
KeyModifierMask m_mask;
};
//! Motion event data
class CMotionInfo {
public:
static CMotionInfo* alloc(SInt32 x, SInt32 y);
public:
SInt32 m_x;
SInt32 m_y;
};
//! Wheel motion event data
class CWheelInfo {
public:
static CWheelInfo* alloc(SInt32 xDelta, SInt32 yDelta);
public:
SInt32 m_xDelta;
SInt32 m_yDelta;
};
//! Hot key event data
class CHotKeyInfo {
public:
static CHotKeyInfo* alloc(UInt32 id);
public:
UInt32 m_id;
};
//! Game device button event data
class CGameDeviceButtonInfo {
public:
CGameDeviceButtonInfo(GameDeviceID id, GameDeviceButton buttons) :
m_id(id), m_buttons(buttons) { }
public:
GameDeviceID m_id;
GameDeviceButton m_buttons;
};
//! Game device sticks event data
class CGameDeviceStickInfo {
public:
CGameDeviceStickInfo(GameDeviceID id, SInt16 x1, SInt16 y1, SInt16 x2, SInt16 y2) :
m_id(id), m_x1(x1), m_x2(x2), m_y1(y1), m_y2(y2) { }
public:
GameDeviceID m_id;
SInt16 m_x1;
SInt16 m_x2;
SInt16 m_y1;
SInt16 m_y2;
};
//! Game device triggers event data
class CGameDeviceTriggerInfo {
public:
CGameDeviceTriggerInfo(GameDeviceID id, UInt8 t1, UInt8 t2) :
m_id(id), m_t1(t1), m_t2(t2) { }
public:
GameDeviceID m_id;
UInt8 m_t1;
UInt8 m_t2;
};
//! Game device timing response event data
class CGameDeviceTimingRespInfo {
public:
CGameDeviceTimingRespInfo(UInt16 freq) :
m_freq(freq) { }
public:
UInt16 m_freq;
};
//! Game device feedback event data
class CGameDeviceFeedbackInfo {
public:
CGameDeviceFeedbackInfo(GameDeviceID id, UInt16 m1, UInt16 m2) :
m_id(id), m_m1(m1), m_m2(m2) { }
public:
GameDeviceID m_id;
UInt16 m_m1;
UInt16 m_m2;
};
//! @name manipulators
//@{
//! Update configuration
/*!
This is called when the configuration has changed. \c activeSides
is a bitmask of EDirectionMask indicating which sides of the
primary screen are linked to clients. Override to handle the
possible change in jump zones.
*/
virtual void reconfigure(UInt32 activeSides) = 0;
//! Warp cursor
/*!
Warp the cursor to the absolute coordinates \c x,y. Also
discard input events up to and including the warp before
returning.
*/
virtual void warpCursor(SInt32 x, SInt32 y) = 0;
//! Register a system hotkey
/*!
Registers a system-wide hotkey. The screen should arrange for an event
to be delivered to itself when the hot key is pressed or released. When
that happens the screen should post a \c getHotKeyDownEvent() or
\c getHotKeyUpEvent(), respectively. The hot key is key \p key with
exactly the modifiers \p mask. Returns 0 on failure otherwise an id
that can be used to unregister the hotkey.
A hot key is a set of modifiers and a key, which may itself be a modifier.
The hot key is pressed when the hot key's modifiers and only those
modifiers are logically down (active) and the key is pressed. The hot
key is released when the key is released, regardless of the modifiers.
The hot key event should be generated no matter what window or application
has the focus. No other window or application should receive the key
press or release events (they can and should see the modifier key events).
When the key is a modifier, it's acceptable to allow the user to press
the modifiers in any order or to require the user to press the given key
last.
*/
virtual UInt32 registerHotKey(KeyID key, KeyModifierMask mask) = 0;
//! Unregister a system hotkey
/*!
Unregisters a previously registered hot key.
*/
virtual void unregisterHotKey(UInt32 id) = 0;
//! Prepare to synthesize input on primary screen
/*!
Prepares the primary screen to receive synthesized input. We do not
want to receive this synthesized input as user input so this method
ensures that we ignore it. Calls to \c fakeInputBegin() may not be
nested.
*/
virtual void fakeInputBegin() = 0;
//! Done synthesizing input on primary screen
/*!
Undoes whatever \c fakeInputBegin() did.
*/
virtual void fakeInputEnd() = 0;
//@}
//! @name accessors
//@{
//! Get jump zone size
/*!
Return the jump zone size, the size of the regions on the edges of
the screen that cause the cursor to jump to another screen.
*/
virtual SInt32 getJumpZoneSize() const = 0;
//! Test if mouse is pressed
/*!
Return true if any mouse button is currently pressed. Ideally,
"current" means up to the last processed event but it can mean
the current physical mouse button state.
*/
virtual bool isAnyMouseButtonDown() const = 0;
//! Get cursor center position
/*!
Return the cursor center position which is where we park the
cursor to compute cursor motion deltas and should be far from
the edges of the screen, typically the center.
*/
virtual void getCursorCenter(SInt32& x, SInt32& y) const = 0;
//! Handle incoming game device timing responses.
virtual void gameDeviceTimingResp(UInt16 freq) = 0;
//! Handle incoming game device feedback changes.
virtual void gameDeviceFeedback(GameDeviceID id, UInt16 m1, UInt16 m2) = 0;
//! Get button down event type. Event data is CButtonInfo*.
static CEvent::Type getButtonDownEvent();
//! Get button up event type. Event data is CButtonInfo*.
static CEvent::Type getButtonUpEvent();
//! Get mouse motion on the primary screen event type
/*!
Event data is CMotionInfo* and the values are an absolute position.
*/
static CEvent::Type getMotionOnPrimaryEvent();
//! Get mouse motion on a secondary screen event type
/*!
Event data is CMotionInfo* and the values are motion deltas not
absolute coordinates.
*/
static CEvent::Type getMotionOnSecondaryEvent();
//! Get mouse wheel event type. Event data is CWheelInfo*.
static CEvent::Type getWheelEvent();
//! Get screensaver activated event type
static CEvent::Type getScreensaverActivatedEvent();
//! Get screensaver deactivated event type
static CEvent::Type getScreensaverDeactivatedEvent();
//! Get hot key down event type. Event data is CHotKeyInfo*.
static CEvent::Type getHotKeyDownEvent();
//! Get hot key up event type. Event data is CHotKeyInfo*.
static CEvent::Type getHotKeyUpEvent();
//! Get start of fake input event type
static CEvent::Type getFakeInputBeginEvent();
//! Get end of fake input event type
static CEvent::Type getFakeInputEndEvent();
public: // HACK
//! Get game device buttons event type.
static CEvent::Type getGameDeviceButtonsEvent();
//! Get game device sticks event type.
static CEvent::Type getGameDeviceSticksEvent();
//! Get game device triggers event type.
static CEvent::Type getGameDeviceTriggersEvent();
//! Get game device timing request event type.
static CEvent::Type getGameDeviceTimingReqEvent();
private: // HACK
//@}
private:
static CEvent::Type s_buttonDownEvent;
static CEvent::Type s_buttonUpEvent;
static CEvent::Type s_motionPrimaryEvent;
static CEvent::Type s_motionSecondaryEvent;
static CEvent::Type s_wheelEvent;
static CEvent::Type s_ssActivatedEvent;
static CEvent::Type s_ssDeactivatedEvent;
static CEvent::Type s_hotKeyDownEvent;
static CEvent::Type s_hotKeyUpEvent;
static CEvent::Type s_fakeInputBegin;
static CEvent::Type s_fakeInputEnd;
static CEvent::Type s_gameButtonsEvent;
static CEvent::Type s_gameSticksEvent;
static CEvent::Type s_gameTriggersEvent;
static CEvent::Type s_gameTimingReqEvent;
};
#endif
| wittekm/synergy-multi-monitor | src/lib/synergy/IPrimaryScreen.h | C | gpl-2.0 | 8,659 |
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javafx.scene.control.test.utils.ptables;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
/**
* @author Alexander Kirov
*
* NOTION: this class should be instantiated on JavaFX thread.
*/
public class NodeControllerFactory {
public static NodesStorage createFullController(Object node, TabPaneWithControl tabPane) {
PropertiesTable pt = new PropertiesTable(node);
PropertyTablesFactory.explorePropertiesList(node, pt);
SpecialTablePropertiesProvider.provideForControl(node, pt);
VBox vb = new VBox();
if (node instanceof ToolBar) {
vb.getChildren().add(new ToolBarControllers().getForNode((ToolBar) node, tabPane));
}
if (node instanceof Menu) {
vb.getChildren().add(new MenuControllers().getForNode((Menu) node, tabPane));
}
if (node instanceof TreeItem) {
vb.getChildren().add(new TreeItemControllers().getForNode((TreeItem) node, tabPane));
}
return new NodesStorage(pt, vb);
}
public static class NodesStorage extends VBox {
public PropertiesTable pt;
public Node storageOfTable;
public Node storageOfControlElements;
public NodesStorage(PropertiesTable pt, Node storageOfControlElements) {
this.pt = pt;
this.storageOfControlElements = storageOfControlElements;
this.storageOfTable = pt;
this.getChildren().addAll(storageOfControlElements, storageOfTable);
}
}
public interface ControllingNodesCreator<T extends Object> {
public abstract Node getForNode(T node, TabPaneWithControl tabPane);
}
public static class ToolBarControllers extends HBox implements ControllingNodesCreator<ToolBar> {
public final String TOOLBAR_ADD_INDEX_TEXT_FIELD_ID = "TOOLBAR_ADD_INDEX_TEXT_FIELD_ID";
@Override
public Node getForNode(final ToolBar toolBar, final TabPaneWithControl tabPane) {
final TextField tf = new TextField("0");
tf.setId(TOOLBAR_ADD_INDEX_TEXT_FIELD_ID);
tf.setPrefWidth(40);
this.getChildren().addAll(new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction<Node>() {
@Override
public void execute(Node node) {
toolBar.getItems().add(Integer.parseInt(tf.getText()), node);
try {
tabPane.addPropertiesTable(node.getClass().getSimpleName(), NodeControllerFactory.createFullController(node, tabPane));
} catch (Throwable ex) {
Logger.getLogger(NodeControllerFactory.class.getName()).log(Level.SEVERE, null, ex);
}
}
}, tf).getChildren());
return this;
}
}
public static class MenuControllers extends HBox implements ControllingNodesCreator<Menu> {
public final String MENU_ADD_INDEX_TEXT_FIELD_ID = "MENU_ADD_INDEX_TEXT_FIELD_ID";
public final String MENU_ADD_NAME_TEXT_FIELD_ID = "MENU_ADD_NAME_TEXT_FIELD_ID";
@Override
public Node getForNode(final Menu menu, final TabPaneWithControl tabPane) {
final TextField tf = new TextField("0");
tf.setId(MENU_ADD_INDEX_TEXT_FIELD_ID);
tf.setPrefWidth(40);
final TextField nameTF = new TextField("Menu");
nameTF.setId(MENU_ADD_NAME_TEXT_FIELD_ID);
nameTF.setPrefWidth(40);
this.getChildren().addAll(new NodesChoserFactory("Add!", new NodesChoserFactory.NodeAction<MenuItem>() {
@Override
public void execute(MenuItem node) {
node.setText(nameTF.getText());
menu.getItems().add(Integer.parseInt(tf.getText()), node);
try {
tabPane.addPropertiesTable(nameTF.getText(), NodeControllerFactory.createFullController(node, tabPane));
} catch (Throwable ex) {
Logger.getLogger(NodeControllerFactory.class.getName()).log(Level.SEVERE, null, ex);
}
}
}, tf, nameTF).getChildren());
return this;
}
}
public static class TreeItemControllers extends FlowPane implements ControllingNodesCreator<TreeItem> {
public static final String GET_NEXT_SIBLING_TREEITEM_BUTTON_ID = "GET_NEXT_SIBLING_TREEITEM_BUTTON_ID";
public static final String GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID = "GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID";
public static final String GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID = "GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID";
public static final String GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID = "GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID";
public final static String CHANGE_VALUE_BUTTON_ID = "CHANGE_VALUE_BUTTON_ID";
public final static String NEW_VALUE_TEXT_FIELD_ID = "NEW_VALUE_TEXT_FIELD_ID";
@Override
public Node getForNode(final TreeItem item, final TabPaneWithControl tabPane) {
HBox hb1 = getNextSiblingHBox(item);
HBox hb2 = getPreviousSiblingHBox(item);
HBox hb3 = getChangeValueHBox(item);
this.getChildren().addAll(hb1, hb2, hb3);
return this;
}
private HBox getPreviousSiblingHBox(final TreeItem item) {
HBox hb = new HBox();
Button button = new Button("Get previous sibling");
button.setId(GET_PREVIOUS_SIBLING_TREEITEM_BUTTON_ID);
final TextField tf = new TextField("");
tf.setPromptText("Next sibling");
tf.setId(GET_PREVIOUS_SIBLING_TREEITEM_TEXTFIELD_ID);
tf.setPrefWidth(100);
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
TreeItem sibling = item.previousSibling();
TreeItem sibling2 = item.previousSibling(item);
if (sibling == null) {
if (sibling2 == null) {
tf.setText("null");
} else {
tf.setText("ERROR");
}
} else {
if (sibling.equals(sibling2)) {
tf.setText(sibling.getValue().toString());
} else {
tf.setText("ERROR");
}
}
}
});
hb.getChildren().addAll(button, tf);
return hb;
}
private HBox getNextSiblingHBox(final TreeItem item) {
HBox hb = new HBox();
Button button = new Button("Get next sibling");
button.setId(GET_NEXT_SIBLING_TREEITEM_BUTTON_ID);
final TextField tf = new TextField("");
tf.setPromptText("Next sibling");
tf.setId(GET_NEXT_SIBLING_TREEITEM_TEXTFIELD_ID);
tf.setPrefWidth(100);
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
TreeItem sibling = item.nextSibling();
if (sibling == null) {
tf.setText("null");
} else {
tf.setText(sibling.getValue().toString());
}
}
});
hb.getChildren().addAll(button, tf);
return hb;
}
private HBox getChangeValueHBox(final TreeItem item) {
Button button = new Button("change value to");
button.setId(CHANGE_VALUE_BUTTON_ID);
final TextField tfNew = new TextField();
tfNew.setPromptText("new value");
tfNew.setId(NEW_VALUE_TEXT_FIELD_ID);
tfNew.setPrefWidth(50);
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
item.setValue(tfNew.getText());
}
});
HBox hb = new HBox();
hb.getChildren().addAll(button, tfNew);
return hb;
}
}
}
| teamfx/openjfx-10-dev-tests | functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/NodeControllerFactory.java | Java | gpl-2.0 | 9,754 |
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package tenderSpring
* @since tenderSpring 1.0
*/
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary .site-content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?> | jayanti/vaw-stories | wp-content/themes/tender-spring/page.php | PHP | gpl-2.0 | 724 |
/* -*- mode: C -*- */
/*
IGraph library.
Copyright (C) 2010 Gabor Csardi <csardi.gabor@gmail.com>
Rue de l'Industrie 5, Lausanne 1005, Switzerland
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
| janschulz/igraph | interfaces/R/src/rinterface.h | C | gpl-2.0 | 890 |
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "code/debugInfoRec.hpp"
#include "code/icBuffer.hpp"
#include "code/vtableStubs.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/compiledICHolder.hpp"
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/vframeArray.hpp"
#include "vmreg_x86.inline.hpp"
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#endif
#ifdef COMPILER2
#include "opto/runtime.hpp"
#endif
#define __ masm->
const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size;
class RegisterSaver {
// Capture info about frame layout
#define DEF_XMM_OFFS(regnum) xmm ## regnum ## _off = xmm_off + (regnum)*16/BytesPerInt, xmm ## regnum ## H_off
enum layout {
fpu_state_off = 0,
fpu_state_end = fpu_state_off+FPUStateSizeInWords,
st0_off, st0H_off,
st1_off, st1H_off,
st2_off, st2H_off,
st3_off, st3H_off,
st4_off, st4H_off,
st5_off, st5H_off,
st6_off, st6H_off,
st7_off, st7H_off,
xmm_off,
DEF_XMM_OFFS(0),
DEF_XMM_OFFS(1),
DEF_XMM_OFFS(2),
DEF_XMM_OFFS(3),
DEF_XMM_OFFS(4),
DEF_XMM_OFFS(5),
DEF_XMM_OFFS(6),
DEF_XMM_OFFS(7),
flags_off = xmm7_off + 16/BytesPerInt + 1, // 16-byte stack alignment fill word
rdi_off,
rsi_off,
ignore_off, // extra copy of rbp,
rsp_off,
rbx_off,
rdx_off,
rcx_off,
rax_off,
// The frame sender code expects that rbp will be in the "natural" place and
// will override any oopMap setting for it. We must therefore force the layout
// so that it agrees with the frame sender code.
rbp_off,
return_off, // slot for return address
reg_save_size };
enum { FPU_regs_live = flags_off - fpu_state_end };
public:
static OopMap* save_live_registers(MacroAssembler* masm, int additional_frame_words,
int* total_frame_words, bool verify_fpu = true, bool save_vectors = false);
static void restore_live_registers(MacroAssembler* masm, bool restore_vectors = false);
static int rax_offset() { return rax_off; }
static int rbx_offset() { return rbx_off; }
// Offsets into the register save area
// Used by deoptimization when it is managing result register
// values on its own
static int raxOffset(void) { return rax_off; }
static int rdxOffset(void) { return rdx_off; }
static int rbxOffset(void) { return rbx_off; }
static int xmm0Offset(void) { return xmm0_off; }
// This really returns a slot in the fp save area, which one is not important
static int fpResultOffset(void) { return st0_off; }
// During deoptimization only the result register need to be restored
// all the other values have already been extracted.
static void restore_result_registers(MacroAssembler* masm);
};
OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words,
int* total_frame_words, bool verify_fpu, bool save_vectors) {
int vect_words = 0;
#ifdef COMPILER2
if (save_vectors) {
assert(UseAVX > 0, "256bit vectors are supported only with AVX");
assert(MaxVectorSize == 32, "only 256bit vectors are supported now");
// Save upper half of YMM registes
vect_words = 8 * 16 / wordSize;
additional_frame_words += vect_words;
}
#else
assert(!save_vectors, "vectors are generated only by C2");
#endif
int frame_size_in_bytes = (reg_save_size + additional_frame_words) * wordSize;
int frame_words = frame_size_in_bytes / wordSize;
*total_frame_words = frame_words;
assert(FPUStateSizeInWords == 27, "update stack layout");
// save registers, fpu state, and flags
// We assume caller has already has return address slot on the stack
// We push epb twice in this sequence because we want the real rbp,
// to be under the return like a normal enter and we want to use pusha
// We push by hand instead of pusing push
__ enter();
__ pusha();
__ pushf();
__ subptr(rsp,FPU_regs_live*wordSize); // Push FPU registers space
__ push_FPU_state(); // Save FPU state & init
if (verify_fpu) {
// Some stubs may have non standard FPU control word settings so
// only check and reset the value when it required to be the
// standard value. The safepoint blob in particular can be used
// in methods which are using the 24 bit control word for
// optimized float math.
#ifdef ASSERT
// Make sure the control word has the expected value
Label ok;
__ cmpw(Address(rsp, 0), StubRoutines::fpu_cntrl_wrd_std());
__ jccb(Assembler::equal, ok);
__ stop("corrupted control word detected");
__ bind(ok);
#endif
// Reset the control word to guard against exceptions being unmasked
// since fstp_d can cause FPU stack underflow exceptions. Write it
// into the on stack copy and then reload that to make sure that the
// current and future values are correct.
__ movw(Address(rsp, 0), StubRoutines::fpu_cntrl_wrd_std());
}
__ frstor(Address(rsp, 0));
if (!verify_fpu) {
// Set the control word so that exceptions are masked for the
// following code.
__ fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
}
// Save the FPU registers in de-opt-able form
__ fstp_d(Address(rsp, st0_off*wordSize)); // st(0)
__ fstp_d(Address(rsp, st1_off*wordSize)); // st(1)
__ fstp_d(Address(rsp, st2_off*wordSize)); // st(2)
__ fstp_d(Address(rsp, st3_off*wordSize)); // st(3)
__ fstp_d(Address(rsp, st4_off*wordSize)); // st(4)
__ fstp_d(Address(rsp, st5_off*wordSize)); // st(5)
__ fstp_d(Address(rsp, st6_off*wordSize)); // st(6)
__ fstp_d(Address(rsp, st7_off*wordSize)); // st(7)
if( UseSSE == 1 ) { // Save the XMM state
__ movflt(Address(rsp,xmm0_off*wordSize),xmm0);
__ movflt(Address(rsp,xmm1_off*wordSize),xmm1);
__ movflt(Address(rsp,xmm2_off*wordSize),xmm2);
__ movflt(Address(rsp,xmm3_off*wordSize),xmm3);
__ movflt(Address(rsp,xmm4_off*wordSize),xmm4);
__ movflt(Address(rsp,xmm5_off*wordSize),xmm5);
__ movflt(Address(rsp,xmm6_off*wordSize),xmm6);
__ movflt(Address(rsp,xmm7_off*wordSize),xmm7);
} else if( UseSSE >= 2 ) {
// Save whole 128bit (16 bytes) XMM regiters
__ movdqu(Address(rsp,xmm0_off*wordSize),xmm0);
__ movdqu(Address(rsp,xmm1_off*wordSize),xmm1);
__ movdqu(Address(rsp,xmm2_off*wordSize),xmm2);
__ movdqu(Address(rsp,xmm3_off*wordSize),xmm3);
__ movdqu(Address(rsp,xmm4_off*wordSize),xmm4);
__ movdqu(Address(rsp,xmm5_off*wordSize),xmm5);
__ movdqu(Address(rsp,xmm6_off*wordSize),xmm6);
__ movdqu(Address(rsp,xmm7_off*wordSize),xmm7);
}
if (vect_words > 0) {
assert(vect_words*wordSize == 128, "");
__ subptr(rsp, 128); // Save upper half of YMM registes
__ vextractf128h(Address(rsp, 0),xmm0);
__ vextractf128h(Address(rsp, 16),xmm1);
__ vextractf128h(Address(rsp, 32),xmm2);
__ vextractf128h(Address(rsp, 48),xmm3);
__ vextractf128h(Address(rsp, 64),xmm4);
__ vextractf128h(Address(rsp, 80),xmm5);
__ vextractf128h(Address(rsp, 96),xmm6);
__ vextractf128h(Address(rsp,112),xmm7);
}
// Set an oopmap for the call site. This oopmap will map all
// oop-registers and debug-info registers as callee-saved. This
// will allow deoptimization at this safepoint to find all possible
// debug-info recordings, as well as let GC find all oops.
OopMapSet *oop_maps = new OopMapSet();
OopMap* map = new OopMap( frame_words, 0 );
#define STACK_OFFSET(x) VMRegImpl::stack2reg((x) + additional_frame_words)
map->set_callee_saved(STACK_OFFSET( rax_off), rax->as_VMReg());
map->set_callee_saved(STACK_OFFSET( rcx_off), rcx->as_VMReg());
map->set_callee_saved(STACK_OFFSET( rdx_off), rdx->as_VMReg());
map->set_callee_saved(STACK_OFFSET( rbx_off), rbx->as_VMReg());
// rbp, location is known implicitly, no oopMap
map->set_callee_saved(STACK_OFFSET( rsi_off), rsi->as_VMReg());
map->set_callee_saved(STACK_OFFSET( rdi_off), rdi->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st0_off), as_FloatRegister(0)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st1_off), as_FloatRegister(1)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st2_off), as_FloatRegister(2)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st3_off), as_FloatRegister(3)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st4_off), as_FloatRegister(4)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st5_off), as_FloatRegister(5)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st6_off), as_FloatRegister(6)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(st7_off), as_FloatRegister(7)->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm0_off), xmm0->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm1_off), xmm1->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm2_off), xmm2->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm3_off), xmm3->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm4_off), xmm4->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm5_off), xmm5->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm6_off), xmm6->as_VMReg());
map->set_callee_saved(STACK_OFFSET(xmm7_off), xmm7->as_VMReg());
// %%% This is really a waste but we'll keep things as they were for now
if (true) {
#define NEXTREG(x) (x)->as_VMReg()->next()
map->set_callee_saved(STACK_OFFSET(st0H_off), NEXTREG(as_FloatRegister(0)));
map->set_callee_saved(STACK_OFFSET(st1H_off), NEXTREG(as_FloatRegister(1)));
map->set_callee_saved(STACK_OFFSET(st2H_off), NEXTREG(as_FloatRegister(2)));
map->set_callee_saved(STACK_OFFSET(st3H_off), NEXTREG(as_FloatRegister(3)));
map->set_callee_saved(STACK_OFFSET(st4H_off), NEXTREG(as_FloatRegister(4)));
map->set_callee_saved(STACK_OFFSET(st5H_off), NEXTREG(as_FloatRegister(5)));
map->set_callee_saved(STACK_OFFSET(st6H_off), NEXTREG(as_FloatRegister(6)));
map->set_callee_saved(STACK_OFFSET(st7H_off), NEXTREG(as_FloatRegister(7)));
map->set_callee_saved(STACK_OFFSET(xmm0H_off), NEXTREG(xmm0));
map->set_callee_saved(STACK_OFFSET(xmm1H_off), NEXTREG(xmm1));
map->set_callee_saved(STACK_OFFSET(xmm2H_off), NEXTREG(xmm2));
map->set_callee_saved(STACK_OFFSET(xmm3H_off), NEXTREG(xmm3));
map->set_callee_saved(STACK_OFFSET(xmm4H_off), NEXTREG(xmm4));
map->set_callee_saved(STACK_OFFSET(xmm5H_off), NEXTREG(xmm5));
map->set_callee_saved(STACK_OFFSET(xmm6H_off), NEXTREG(xmm6));
map->set_callee_saved(STACK_OFFSET(xmm7H_off), NEXTREG(xmm7));
#undef NEXTREG
#undef STACK_OFFSET
}
return map;
}
void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_vectors) {
// Recover XMM & FPU state
int additional_frame_bytes = 0;
#ifdef COMPILER2
if (restore_vectors) {
assert(UseAVX > 0, "256bit vectors are supported only with AVX");
assert(MaxVectorSize == 32, "only 256bit vectors are supported now");
additional_frame_bytes = 128;
}
#else
assert(!restore_vectors, "vectors are generated only by C2");
#endif
if (UseSSE == 1) {
assert(additional_frame_bytes == 0, "");
__ movflt(xmm0,Address(rsp,xmm0_off*wordSize));
__ movflt(xmm1,Address(rsp,xmm1_off*wordSize));
__ movflt(xmm2,Address(rsp,xmm2_off*wordSize));
__ movflt(xmm3,Address(rsp,xmm3_off*wordSize));
__ movflt(xmm4,Address(rsp,xmm4_off*wordSize));
__ movflt(xmm5,Address(rsp,xmm5_off*wordSize));
__ movflt(xmm6,Address(rsp,xmm6_off*wordSize));
__ movflt(xmm7,Address(rsp,xmm7_off*wordSize));
} else if (UseSSE >= 2) {
#define STACK_ADDRESS(x) Address(rsp,(x)*wordSize + additional_frame_bytes)
__ movdqu(xmm0,STACK_ADDRESS(xmm0_off));
__ movdqu(xmm1,STACK_ADDRESS(xmm1_off));
__ movdqu(xmm2,STACK_ADDRESS(xmm2_off));
__ movdqu(xmm3,STACK_ADDRESS(xmm3_off));
__ movdqu(xmm4,STACK_ADDRESS(xmm4_off));
__ movdqu(xmm5,STACK_ADDRESS(xmm5_off));
__ movdqu(xmm6,STACK_ADDRESS(xmm6_off));
__ movdqu(xmm7,STACK_ADDRESS(xmm7_off));
#undef STACK_ADDRESS
}
if (restore_vectors) {
// Restore upper half of YMM registes.
assert(additional_frame_bytes == 128, "");
__ vinsertf128h(xmm0, Address(rsp, 0));
__ vinsertf128h(xmm1, Address(rsp, 16));
__ vinsertf128h(xmm2, Address(rsp, 32));
__ vinsertf128h(xmm3, Address(rsp, 48));
__ vinsertf128h(xmm4, Address(rsp, 64));
__ vinsertf128h(xmm5, Address(rsp, 80));
__ vinsertf128h(xmm6, Address(rsp, 96));
__ vinsertf128h(xmm7, Address(rsp,112));
__ addptr(rsp, additional_frame_bytes);
}
__ pop_FPU_state();
__ addptr(rsp, FPU_regs_live*wordSize); // Pop FPU registers
__ popf();
__ popa();
// Get the rbp, described implicitly by the frame sender code (no oopMap)
__ pop(rbp);
}
void RegisterSaver::restore_result_registers(MacroAssembler* masm) {
// Just restore result register. Only used by deoptimization. By
// now any callee save register that needs to be restore to a c2
// caller of the deoptee has been extracted into the vframeArray
// and will be stuffed into the c2i adapter we create for later
// restoration so only result registers need to be restored here.
//
__ frstor(Address(rsp, 0)); // Restore fpu state
// Recover XMM & FPU state
if( UseSSE == 1 ) {
__ movflt(xmm0, Address(rsp, xmm0_off*wordSize));
} else if( UseSSE >= 2 ) {
__ movdbl(xmm0, Address(rsp, xmm0_off*wordSize));
}
__ movptr(rax, Address(rsp, rax_off*wordSize));
__ movptr(rdx, Address(rsp, rdx_off*wordSize));
// Pop all of the register save are off the stack except the return address
__ addptr(rsp, return_off * wordSize);
}
// Is vector's size (in bytes) bigger than a size saved by default?
// 16 bytes XMM registers are saved by default using SSE2 movdqu instructions.
// Note, MaxVectorSize == 0 with UseSSE < 2 and vectors are not generated.
bool SharedRuntime::is_wide_vector(int size) {
return size > 16;
}
// The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by
// the following value.
static int reg2offset_in(VMReg r) {
// Account for saved rbp, and return address
// This should really be in_preserve_stack_slots
return (r->reg2stack() + 2) * VMRegImpl::stack_slot_size;
}
static int reg2offset_out(VMReg r) {
return (r->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
}
// ---------------------------------------------------------------------------
// Read the array of BasicTypes from a signature, and compute where the
// arguments should go. Values in the VMRegPair regs array refer to 4-byte
// quantities. Values less than SharedInfo::stack0 are registers, those above
// refer to 4-byte stack slots. All stack slots are based off of the stack pointer
// as framesizes are fixed.
// VMRegImpl::stack0 refers to the first slot 0(sp).
// and VMRegImpl::stack0+1 refers to the memory word 4-byes higher. Register
// up to RegisterImpl::number_of_registers) are the 32-bit
// integer registers.
// Pass first two oop/int args in registers ECX and EDX.
// Pass first two float/double args in registers XMM0 and XMM1.
// Doubles have precedence, so if you pass a mix of floats and doubles
// the doubles will grab the registers before the floats will.
// Note: the INPUTS in sig_bt are in units of Java argument words, which are
// either 32-bit or 64-bit depending on the build. The OUTPUTS are in 32-bit
// units regardless of build. Of course for i486 there is no 64 bit build
// ---------------------------------------------------------------------------
// The compiled Java calling convention.
// Pass first two oop/int args in registers ECX and EDX.
// Pass first two float/double args in registers XMM0 and XMM1.
// Doubles have precedence, so if you pass a mix of floats and doubles
// the doubles will grab the registers before the floats will.
int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
int total_args_passed,
int is_outgoing) {
uint stack = 0; // Starting stack position for args on stack
// Pass first two oop/int args in registers ECX and EDX.
uint reg_arg0 = 9999;
uint reg_arg1 = 9999;
// Pass first two float/double args in registers XMM0 and XMM1.
// Doubles have precedence, so if you pass a mix of floats and doubles
// the doubles will grab the registers before the floats will.
// CNC - TURNED OFF FOR non-SSE.
// On Intel we have to round all doubles (and most floats) at
// call sites by storing to the stack in any case.
// UseSSE=0 ==> Don't Use ==> 9999+0
// UseSSE=1 ==> Floats only ==> 9999+1
// UseSSE>=2 ==> Floats or doubles ==> 9999+2
enum { fltarg_dontuse = 9999+0, fltarg_float_only = 9999+1, fltarg_flt_dbl = 9999+2 };
uint fargs = (UseSSE>=2) ? 2 : UseSSE;
uint freg_arg0 = 9999+fargs;
uint freg_arg1 = 9999+fargs;
// Pass doubles & longs aligned on the stack. First count stack slots for doubles
int i;
for( i = 0; i < total_args_passed; i++) {
if( sig_bt[i] == T_DOUBLE ) {
// first 2 doubles go in registers
if( freg_arg0 == fltarg_flt_dbl ) freg_arg0 = i;
else if( freg_arg1 == fltarg_flt_dbl ) freg_arg1 = i;
else // Else double is passed low on the stack to be aligned.
stack += 2;
} else if( sig_bt[i] == T_LONG ) {
stack += 2;
}
}
int dstack = 0; // Separate counter for placing doubles
// Now pick where all else goes.
for( i = 0; i < total_args_passed; i++) {
// From the type and the argument number (count) compute the location
switch( sig_bt[i] ) {
case T_SHORT:
case T_CHAR:
case T_BYTE:
case T_BOOLEAN:
case T_INT:
case T_ARRAY:
case T_OBJECT:
case T_ADDRESS:
if( reg_arg0 == 9999 ) {
reg_arg0 = i;
regs[i].set1(rcx->as_VMReg());
} else if( reg_arg1 == 9999 ) {
reg_arg1 = i;
regs[i].set1(rdx->as_VMReg());
} else {
regs[i].set1(VMRegImpl::stack2reg(stack++));
}
break;
case T_FLOAT:
if( freg_arg0 == fltarg_flt_dbl || freg_arg0 == fltarg_float_only ) {
freg_arg0 = i;
regs[i].set1(xmm0->as_VMReg());
} else if( freg_arg1 == fltarg_flt_dbl || freg_arg1 == fltarg_float_only ) {
freg_arg1 = i;
regs[i].set1(xmm1->as_VMReg());
} else {
regs[i].set1(VMRegImpl::stack2reg(stack++));
}
break;
case T_LONG:
assert(sig_bt[i+1] == T_VOID, "missing Half" );
regs[i].set2(VMRegImpl::stack2reg(dstack));
dstack += 2;
break;
case T_DOUBLE:
assert(sig_bt[i+1] == T_VOID, "missing Half" );
if( freg_arg0 == (uint)i ) {
regs[i].set2(xmm0->as_VMReg());
} else if( freg_arg1 == (uint)i ) {
regs[i].set2(xmm1->as_VMReg());
} else {
regs[i].set2(VMRegImpl::stack2reg(dstack));
dstack += 2;
}
break;
case T_VOID: regs[i].set_bad(); break;
break;
default:
ShouldNotReachHere();
break;
}
}
// return value can be odd number of VMRegImpl stack slots make multiple of 2
return round_to(stack, 2);
}
// Patch the callers callsite with entry to compiled code if it exists.
static void patch_callers_callsite(MacroAssembler *masm) {
Label L;
__ cmpptr(Address(rbx, in_bytes(Method::code_offset())), (int32_t)NULL_WORD);
__ jcc(Assembler::equal, L);
// Schedule the branch target address early.
// Call into the VM to patch the caller, then jump to compiled callee
// rax, isn't live so capture return address while we easily can
__ movptr(rax, Address(rsp, 0));
__ pusha();
__ pushf();
if (UseSSE == 1) {
__ subptr(rsp, 2*wordSize);
__ movflt(Address(rsp, 0), xmm0);
__ movflt(Address(rsp, wordSize), xmm1);
}
if (UseSSE >= 2) {
__ subptr(rsp, 4*wordSize);
__ movdbl(Address(rsp, 0), xmm0);
__ movdbl(Address(rsp, 2*wordSize), xmm1);
}
#ifdef COMPILER2
// C2 may leave the stack dirty if not in SSE2+ mode
if (UseSSE >= 2) {
__ verify_FPU(0, "c2i transition should have clean FPU stack");
} else {
__ empty_FPU_stack();
}
#endif /* COMPILER2 */
// VM needs caller's callsite
__ push(rax);
// VM needs target method
__ push(rbx);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::fixup_callers_callsite)));
__ addptr(rsp, 2*wordSize);
if (UseSSE == 1) {
__ movflt(xmm0, Address(rsp, 0));
__ movflt(xmm1, Address(rsp, wordSize));
__ addptr(rsp, 2*wordSize);
}
if (UseSSE >= 2) {
__ movdbl(xmm0, Address(rsp, 0));
__ movdbl(xmm1, Address(rsp, 2*wordSize));
__ addptr(rsp, 4*wordSize);
}
__ popf();
__ popa();
__ bind(L);
}
static void move_c2i_double(MacroAssembler *masm, XMMRegister r, int st_off) {
int next_off = st_off - Interpreter::stackElementSize;
__ movdbl(Address(rsp, next_off), r);
}
static void gen_c2i_adapter(MacroAssembler *masm,
int total_args_passed,
int comp_args_on_stack,
const BasicType *sig_bt,
const VMRegPair *regs,
Label& skip_fixup) {
// Before we get into the guts of the C2I adapter, see if we should be here
// at all. We've come from compiled code and are attempting to jump to the
// interpreter, which means the caller made a static call to get here
// (vcalls always get a compiled target if there is one). Check for a
// compiled target. If there is one, we need to patch the caller's call.
patch_callers_callsite(masm);
__ bind(skip_fixup);
#ifdef COMPILER2
// C2 may leave the stack dirty if not in SSE2+ mode
if (UseSSE >= 2) {
__ verify_FPU(0, "c2i transition should have clean FPU stack");
} else {
__ empty_FPU_stack();
}
#endif /* COMPILER2 */
// Since all args are passed on the stack, total_args_passed * interpreter_
// stack_element_size is the
// space we need.
int extraspace = total_args_passed * Interpreter::stackElementSize;
// Get return address
__ pop(rax);
// set senderSP value
__ movptr(rsi, rsp);
__ subptr(rsp, extraspace);
// Now write the args into the outgoing interpreter space
for (int i = 0; i < total_args_passed; i++) {
if (sig_bt[i] == T_VOID) {
assert(i > 0 && (sig_bt[i-1] == T_LONG || sig_bt[i-1] == T_DOUBLE), "missing half");
continue;
}
// st_off points to lowest address on stack.
int st_off = ((total_args_passed - 1) - i) * Interpreter::stackElementSize;
int next_off = st_off - Interpreter::stackElementSize;
// Say 4 args:
// i st_off
// 0 12 T_LONG
// 1 8 T_VOID
// 2 4 T_OBJECT
// 3 0 T_BOOL
VMReg r_1 = regs[i].first();
VMReg r_2 = regs[i].second();
if (!r_1->is_valid()) {
assert(!r_2->is_valid(), "");
continue;
}
if (r_1->is_stack()) {
// memory to memory use fpu stack top
int ld_off = r_1->reg2stack() * VMRegImpl::stack_slot_size + extraspace;
if (!r_2->is_valid()) {
__ movl(rdi, Address(rsp, ld_off));
__ movptr(Address(rsp, st_off), rdi);
} else {
// ld_off == LSW, ld_off+VMRegImpl::stack_slot_size == MSW
// st_off == MSW, st_off-wordSize == LSW
__ movptr(rdi, Address(rsp, ld_off));
__ movptr(Address(rsp, next_off), rdi);
#ifndef _LP64
__ movptr(rdi, Address(rsp, ld_off + wordSize));
__ movptr(Address(rsp, st_off), rdi);
#else
#ifdef ASSERT
// Overwrite the unused slot with known junk
__ mov64(rax, CONST64(0xdeadffffdeadaaaa));
__ movptr(Address(rsp, st_off), rax);
#endif /* ASSERT */
#endif // _LP64
}
} else if (r_1->is_Register()) {
Register r = r_1->as_Register();
if (!r_2->is_valid()) {
__ movl(Address(rsp, st_off), r);
} else {
// long/double in gpr
NOT_LP64(ShouldNotReachHere());
// Two VMRegs can be T_OBJECT, T_ADDRESS, T_DOUBLE, T_LONG
// T_DOUBLE and T_LONG use two slots in the interpreter
if ( sig_bt[i] == T_LONG || sig_bt[i] == T_DOUBLE) {
// long/double in gpr
#ifdef ASSERT
// Overwrite the unused slot with known junk
LP64_ONLY(__ mov64(rax, CONST64(0xdeadffffdeadaaab)));
__ movptr(Address(rsp, st_off), rax);
#endif /* ASSERT */
__ movptr(Address(rsp, next_off), r);
} else {
__ movptr(Address(rsp, st_off), r);
}
}
} else {
assert(r_1->is_XMMRegister(), "");
if (!r_2->is_valid()) {
__ movflt(Address(rsp, st_off), r_1->as_XMMRegister());
} else {
assert(sig_bt[i] == T_DOUBLE || sig_bt[i] == T_LONG, "wrong type");
move_c2i_double(masm, r_1->as_XMMRegister(), st_off);
}
}
}
// Schedule the branch target address early.
__ movptr(rcx, Address(rbx, in_bytes(Method::interpreter_entry_offset())));
// And repush original return address
__ push(rax);
__ jmp(rcx);
}
static void move_i2c_double(MacroAssembler *masm, XMMRegister r, Register saved_sp, int ld_off) {
int next_val_off = ld_off - Interpreter::stackElementSize;
__ movdbl(r, Address(saved_sp, next_val_off));
}
static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
address code_start, address code_end,
Label& L_ok) {
Label L_fail;
__ lea(temp_reg, ExternalAddress(code_start));
__ cmpptr(pc_reg, temp_reg);
__ jcc(Assembler::belowEqual, L_fail);
__ lea(temp_reg, ExternalAddress(code_end));
__ cmpptr(pc_reg, temp_reg);
__ jcc(Assembler::below, L_ok);
__ bind(L_fail);
}
static void gen_i2c_adapter(MacroAssembler *masm,
int total_args_passed,
int comp_args_on_stack,
const BasicType *sig_bt,
const VMRegPair *regs) {
// Note: rsi contains the senderSP on entry. We must preserve it since
// we may do a i2c -> c2i transition if we lose a race where compiled
// code goes non-entrant while we get args ready.
// Adapters can be frameless because they do not require the caller
// to perform additional cleanup work, such as correcting the stack pointer.
// An i2c adapter is frameless because the *caller* frame, which is interpreted,
// routinely repairs its own stack pointer (from interpreter_frame_last_sp),
// even if a callee has modified the stack pointer.
// A c2i adapter is frameless because the *callee* frame, which is interpreted,
// routinely repairs its caller's stack pointer (from sender_sp, which is set
// up via the senderSP register).
// In other words, if *either* the caller or callee is interpreted, we can
// get the stack pointer repaired after a call.
// This is why c2i and i2c adapters cannot be indefinitely composed.
// In particular, if a c2i adapter were to somehow call an i2c adapter,
// both caller and callee would be compiled methods, and neither would
// clean up the stack pointer changes performed by the two adapters.
// If this happens, control eventually transfers back to the compiled
// caller, but with an uncorrected stack, causing delayed havoc.
// Pick up the return address
__ movptr(rax, Address(rsp, 0));
if (VerifyAdapterCalls &&
(Interpreter::code() != NULL || StubRoutines::code1() != NULL)) {
// So, let's test for cascading c2i/i2c adapters right now.
// assert(Interpreter::contains($return_addr) ||
// StubRoutines::contains($return_addr),
// "i2c adapter must return to an interpreter frame");
__ block_comment("verify_i2c { ");
Label L_ok;
if (Interpreter::code() != NULL)
range_check(masm, rax, rdi,
Interpreter::code()->code_start(), Interpreter::code()->code_end(),
L_ok);
if (StubRoutines::code1() != NULL)
range_check(masm, rax, rdi,
StubRoutines::code1()->code_begin(), StubRoutines::code1()->code_end(),
L_ok);
if (StubRoutines::code2() != NULL)
range_check(masm, rax, rdi,
StubRoutines::code2()->code_begin(), StubRoutines::code2()->code_end(),
L_ok);
const char* msg = "i2c adapter must return to an interpreter frame";
__ block_comment(msg);
__ stop(msg);
__ bind(L_ok);
__ block_comment("} verify_i2ce ");
}
// Must preserve original SP for loading incoming arguments because
// we need to align the outgoing SP for compiled code.
__ movptr(rdi, rsp);
// Cut-out for having no stack args. Since up to 2 int/oop args are passed
// in registers, we will occasionally have no stack args.
int comp_words_on_stack = 0;
if (comp_args_on_stack) {
// Sig words on the stack are greater-than VMRegImpl::stack0. Those in
// registers are below. By subtracting stack0, we either get a negative
// number (all values in registers) or the maximum stack slot accessed.
// int comp_args_on_stack = VMRegImpl::reg2stack(max_arg);
// Convert 4-byte stack slots to words.
comp_words_on_stack = round_to(comp_args_on_stack*4, wordSize)>>LogBytesPerWord;
// Round up to miminum stack alignment, in wordSize
comp_words_on_stack = round_to(comp_words_on_stack, 2);
__ subptr(rsp, comp_words_on_stack * wordSize);
}
// Align the outgoing SP
__ andptr(rsp, -(StackAlignmentInBytes));
// push the return address on the stack (note that pushing, rather
// than storing it, yields the correct frame alignment for the callee)
__ push(rax);
// Put saved SP in another register
const Register saved_sp = rax;
__ movptr(saved_sp, rdi);
// Will jump to the compiled code just as if compiled code was doing it.
// Pre-load the register-jump target early, to schedule it better.
__ movptr(rdi, Address(rbx, in_bytes(Method::from_compiled_offset())));
// Now generate the shuffle code. Pick up all register args and move the
// rest through the floating point stack top.
for (int i = 0; i < total_args_passed; i++) {
if (sig_bt[i] == T_VOID) {
// Longs and doubles are passed in native word order, but misaligned
// in the 32-bit build.
assert(i > 0 && (sig_bt[i-1] == T_LONG || sig_bt[i-1] == T_DOUBLE), "missing half");
continue;
}
// Pick up 0, 1 or 2 words from SP+offset.
assert(!regs[i].second()->is_valid() || regs[i].first()->next() == regs[i].second(),
"scrambled load targets?");
// Load in argument order going down.
int ld_off = (total_args_passed - i) * Interpreter::stackElementSize;
// Point to interpreter value (vs. tag)
int next_off = ld_off - Interpreter::stackElementSize;
//
//
//
VMReg r_1 = regs[i].first();
VMReg r_2 = regs[i].second();
if (!r_1->is_valid()) {
assert(!r_2->is_valid(), "");
continue;
}
if (r_1->is_stack()) {
// Convert stack slot to an SP offset (+ wordSize to account for return address )
int st_off = regs[i].first()->reg2stack()*VMRegImpl::stack_slot_size + wordSize;
// We can use rsi as a temp here because compiled code doesn't need rsi as an input
// and if we end up going thru a c2i because of a miss a reasonable value of rsi
// we be generated.
if (!r_2->is_valid()) {
// __ fld_s(Address(saved_sp, ld_off));
// __ fstp_s(Address(rsp, st_off));
__ movl(rsi, Address(saved_sp, ld_off));
__ movptr(Address(rsp, st_off), rsi);
} else {
// Interpreter local[n] == MSW, local[n+1] == LSW however locals
// are accessed as negative so LSW is at LOW address
// ld_off is MSW so get LSW
// st_off is LSW (i.e. reg.first())
// __ fld_d(Address(saved_sp, next_off));
// __ fstp_d(Address(rsp, st_off));
//
// We are using two VMRegs. This can be either T_OBJECT, T_ADDRESS, T_LONG, or T_DOUBLE
// the interpreter allocates two slots but only uses one for thr T_LONG or T_DOUBLE case
// So we must adjust where to pick up the data to match the interpreter.
//
// Interpreter local[n] == MSW, local[n+1] == LSW however locals
// are accessed as negative so LSW is at LOW address
// ld_off is MSW so get LSW
const int offset = (NOT_LP64(true ||) sig_bt[i]==T_LONG||sig_bt[i]==T_DOUBLE)?
next_off : ld_off;
__ movptr(rsi, Address(saved_sp, offset));
__ movptr(Address(rsp, st_off), rsi);
#ifndef _LP64
__ movptr(rsi, Address(saved_sp, ld_off));
__ movptr(Address(rsp, st_off + wordSize), rsi);
#endif // _LP64
}
} else if (r_1->is_Register()) { // Register argument
Register r = r_1->as_Register();
assert(r != rax, "must be different");
if (r_2->is_valid()) {
//
// We are using two VMRegs. This can be either T_OBJECT, T_ADDRESS, T_LONG, or T_DOUBLE
// the interpreter allocates two slots but only uses one for thr T_LONG or T_DOUBLE case
// So we must adjust where to pick up the data to match the interpreter.
const int offset = (NOT_LP64(true ||) sig_bt[i]==T_LONG||sig_bt[i]==T_DOUBLE)?
next_off : ld_off;
// this can be a misaligned move
__ movptr(r, Address(saved_sp, offset));
#ifndef _LP64
assert(r_2->as_Register() != rax, "need another temporary register");
// Remember r_1 is low address (and LSB on x86)
// So r_2 gets loaded from high address regardless of the platform
__ movptr(r_2->as_Register(), Address(saved_sp, ld_off));
#endif // _LP64
} else {
__ movl(r, Address(saved_sp, ld_off));
}
} else {
assert(r_1->is_XMMRegister(), "");
if (!r_2->is_valid()) {
__ movflt(r_1->as_XMMRegister(), Address(saved_sp, ld_off));
} else {
move_i2c_double(masm, r_1->as_XMMRegister(), saved_sp, ld_off);
}
}
}
// 6243940 We might end up in handle_wrong_method if
// the callee is deoptimized as we race thru here. If that
// happens we don't want to take a safepoint because the
// caller frame will look interpreted and arguments are now
// "compiled" so it is much better to make this transition
// invisible to the stack walking code. Unfortunately if
// we try and find the callee by normal means a safepoint
// is possible. So we stash the desired callee in the thread
// and the vm will find there should this case occur.
__ get_thread(rax);
__ movptr(Address(rax, JavaThread::callee_target_offset()), rbx);
// move Method* to rax, in case we end up in an c2i adapter.
// the c2i adapters expect Method* in rax, (c2) because c2's
// resolve stubs return the result (the method) in rax,.
// I'd love to fix this.
__ mov(rax, rbx);
__ jmp(rdi);
}
// ---------------------------------------------------------------
AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
int total_args_passed,
int comp_args_on_stack,
const BasicType *sig_bt,
const VMRegPair *regs,
AdapterFingerPrint* fingerprint) {
address i2c_entry = __ pc();
gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
// -------------------------------------------------------------------------
// Generate a C2I adapter. On entry we know rbx, holds the Method* during calls
// to the interpreter. The args start out packed in the compiled layout. They
// need to be unpacked into the interpreter layout. This will almost always
// require some stack space. We grow the current (compiled) stack, then repack
// the args. We finally end in a jump to the generic interpreter entry point.
// On exit from the interpreter, the interpreter will restore our SP (lest the
// compiled code, which relys solely on SP and not EBP, get sick).
address c2i_unverified_entry = __ pc();
Label skip_fixup;
Register holder = rax;
Register receiver = rcx;
Register temp = rbx;
{
Label missed;
__ movptr(temp, Address(receiver, oopDesc::klass_offset_in_bytes()));
__ cmpptr(temp, Address(holder, CompiledICHolder::holder_klass_offset()));
__ movptr(rbx, Address(holder, CompiledICHolder::holder_method_offset()));
__ jcc(Assembler::notEqual, missed);
// Method might have been compiled since the call site was patched to
// interpreted if that is the case treat it as a miss so we can get
// the call site corrected.
__ cmpptr(Address(rbx, in_bytes(Method::code_offset())), (int32_t)NULL_WORD);
__ jcc(Assembler::equal, skip_fixup);
__ bind(missed);
__ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
}
address c2i_entry = __ pc();
gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
__ flush();
return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
}
int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
VMRegPair *regs2,
int total_args_passed) {
assert(regs2 == NULL, "not needed on x86");
// We return the amount of VMRegImpl stack slots we need to reserve for all
// the arguments NOT counting out_preserve_stack_slots.
uint stack = 0; // All arguments on stack
for( int i = 0; i < total_args_passed; i++) {
// From the type and the argument number (count) compute the location
switch( sig_bt[i] ) {
case T_BOOLEAN:
case T_CHAR:
case T_FLOAT:
case T_BYTE:
case T_SHORT:
case T_INT:
case T_OBJECT:
case T_ARRAY:
case T_ADDRESS:
case T_METADATA:
regs[i].set1(VMRegImpl::stack2reg(stack++));
break;
case T_LONG:
case T_DOUBLE: // The stack numbering is reversed from Java
// Since C arguments do not get reversed, the ordering for
// doubles on the stack must be opposite the Java convention
assert(sig_bt[i+1] == T_VOID, "missing Half" );
regs[i].set2(VMRegImpl::stack2reg(stack));
stack += 2;
break;
case T_VOID: regs[i].set_bad(); break;
default:
ShouldNotReachHere();
break;
}
}
return stack;
}
// A simple move of integer like type
static void simple_move32(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
if (src.first()->is_stack()) {
if (dst.first()->is_stack()) {
// stack to stack
// __ ld(FP, reg2offset(src.first()) + STACK_BIAS, L5);
// __ st(L5, SP, reg2offset(dst.first()) + STACK_BIAS);
__ movl2ptr(rax, Address(rbp, reg2offset_in(src.first())));
__ movptr(Address(rsp, reg2offset_out(dst.first())), rax);
} else {
// stack to reg
__ movl2ptr(dst.first()->as_Register(), Address(rbp, reg2offset_in(src.first())));
}
} else if (dst.first()->is_stack()) {
// reg to stack
// no need to sign extend on 64bit
__ movptr(Address(rsp, reg2offset_out(dst.first())), src.first()->as_Register());
} else {
if (dst.first() != src.first()) {
__ mov(dst.first()->as_Register(), src.first()->as_Register());
}
}
}
// An oop arg. Must pass a handle not the oop itself
static void object_move(MacroAssembler* masm,
OopMap* map,
int oop_handle_offset,
int framesize_in_slots,
VMRegPair src,
VMRegPair dst,
bool is_receiver,
int* receiver_offset) {
// Because of the calling conventions we know that src can be a
// register or a stack location. dst can only be a stack location.
assert(dst.first()->is_stack(), "must be stack");
// must pass a handle. First figure out the location we use as a handle
if (src.first()->is_stack()) {
// Oop is already on the stack as an argument
Register rHandle = rax;
Label nil;
__ xorptr(rHandle, rHandle);
__ cmpptr(Address(rbp, reg2offset_in(src.first())), (int32_t)NULL_WORD);
__ jcc(Assembler::equal, nil);
__ lea(rHandle, Address(rbp, reg2offset_in(src.first())));
__ bind(nil);
__ movptr(Address(rsp, reg2offset_out(dst.first())), rHandle);
int offset_in_older_frame = src.first()->reg2stack() + SharedRuntime::out_preserve_stack_slots();
map->set_oop(VMRegImpl::stack2reg(offset_in_older_frame + framesize_in_slots));
if (is_receiver) {
*receiver_offset = (offset_in_older_frame + framesize_in_slots) * VMRegImpl::stack_slot_size;
}
} else {
// Oop is in an a register we must store it to the space we reserve
// on the stack for oop_handles
const Register rOop = src.first()->as_Register();
const Register rHandle = rax;
int oop_slot = (rOop == rcx ? 0 : 1) * VMRegImpl::slots_per_word + oop_handle_offset;
int offset = oop_slot*VMRegImpl::stack_slot_size;
Label skip;
__ movptr(Address(rsp, offset), rOop);
map->set_oop(VMRegImpl::stack2reg(oop_slot));
__ xorptr(rHandle, rHandle);
__ cmpptr(rOop, (int32_t)NULL_WORD);
__ jcc(Assembler::equal, skip);
__ lea(rHandle, Address(rsp, offset));
__ bind(skip);
// Store the handle parameter
__ movptr(Address(rsp, reg2offset_out(dst.first())), rHandle);
if (is_receiver) {
*receiver_offset = offset;
}
}
}
// A float arg may have to do float reg int reg conversion
static void float_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
assert(!src.second()->is_valid() && !dst.second()->is_valid(), "bad float_move");
// Because of the calling convention we know that src is either a stack location
// or an xmm register. dst can only be a stack location.
assert(dst.first()->is_stack() && ( src.first()->is_stack() || src.first()->is_XMMRegister()), "bad parameters");
if (src.first()->is_stack()) {
__ movl(rax, Address(rbp, reg2offset_in(src.first())));
__ movptr(Address(rsp, reg2offset_out(dst.first())), rax);
} else {
// reg to stack
__ movflt(Address(rsp, reg2offset_out(dst.first())), src.first()->as_XMMRegister());
}
}
// A long move
static void long_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
// The only legal possibility for a long_move VMRegPair is:
// 1: two stack slots (possibly unaligned)
// as neither the java or C calling convention will use registers
// for longs.
if (src.first()->is_stack() && dst.first()->is_stack()) {
assert(src.second()->is_stack() && dst.second()->is_stack(), "must be all stack");
__ movptr(rax, Address(rbp, reg2offset_in(src.first())));
NOT_LP64(__ movptr(rbx, Address(rbp, reg2offset_in(src.second()))));
__ movptr(Address(rsp, reg2offset_out(dst.first())), rax);
NOT_LP64(__ movptr(Address(rsp, reg2offset_out(dst.second())), rbx));
} else {
ShouldNotReachHere();
}
}
// A double move
static void double_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
// The only legal possibilities for a double_move VMRegPair are:
// The painful thing here is that like long_move a VMRegPair might be
// Because of the calling convention we know that src is either
// 1: a single physical register (xmm registers only)
// 2: two stack slots (possibly unaligned)
// dst can only be a pair of stack slots.
assert(dst.first()->is_stack() && (src.first()->is_XMMRegister() || src.first()->is_stack()), "bad args");
if (src.first()->is_stack()) {
// source is all stack
__ movptr(rax, Address(rbp, reg2offset_in(src.first())));
NOT_LP64(__ movptr(rbx, Address(rbp, reg2offset_in(src.second()))));
__ movptr(Address(rsp, reg2offset_out(dst.first())), rax);
NOT_LP64(__ movptr(Address(rsp, reg2offset_out(dst.second())), rbx));
} else {
// reg to stack
// No worries about stack alignment
__ movdbl(Address(rsp, reg2offset_out(dst.first())), src.first()->as_XMMRegister());
}
}
void SharedRuntime::save_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
// We always ignore the frame_slots arg and just use the space just below frame pointer
// which by this time is free to use
switch (ret_type) {
case T_FLOAT:
__ fstp_s(Address(rbp, -wordSize));
break;
case T_DOUBLE:
__ fstp_d(Address(rbp, -2*wordSize));
break;
case T_VOID: break;
case T_LONG:
__ movptr(Address(rbp, -wordSize), rax);
NOT_LP64(__ movptr(Address(rbp, -2*wordSize), rdx));
break;
default: {
__ movptr(Address(rbp, -wordSize), rax);
}
}
}
void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_type, int frame_slots) {
// We always ignore the frame_slots arg and just use the space just below frame pointer
// which by this time is free to use
switch (ret_type) {
case T_FLOAT:
__ fld_s(Address(rbp, -wordSize));
break;
case T_DOUBLE:
__ fld_d(Address(rbp, -2*wordSize));
break;
case T_LONG:
__ movptr(rax, Address(rbp, -wordSize));
NOT_LP64(__ movptr(rdx, Address(rbp, -2*wordSize)));
break;
case T_VOID: break;
default: {
__ movptr(rax, Address(rbp, -wordSize));
}
}
}
static void save_or_restore_arguments(MacroAssembler* masm,
const int stack_slots,
const int total_in_args,
const int arg_save_area,
OopMap* map,
VMRegPair* in_regs,
BasicType* in_sig_bt) {
// if map is non-NULL then the code should store the values,
// otherwise it should load them.
int handle_index = 0;
// Save down double word first
for ( int i = 0; i < total_in_args; i++) {
if (in_regs[i].first()->is_XMMRegister() && in_sig_bt[i] == T_DOUBLE) {
int slot = handle_index * VMRegImpl::slots_per_word + arg_save_area;
int offset = slot * VMRegImpl::stack_slot_size;
handle_index += 2;
assert(handle_index <= stack_slots, "overflow");
if (map != NULL) {
__ movdbl(Address(rsp, offset), in_regs[i].first()->as_XMMRegister());
} else {
__ movdbl(in_regs[i].first()->as_XMMRegister(), Address(rsp, offset));
}
}
if (in_regs[i].first()->is_Register() && in_sig_bt[i] == T_LONG) {
int slot = handle_index * VMRegImpl::slots_per_word + arg_save_area;
int offset = slot * VMRegImpl::stack_slot_size;
handle_index += 2;
assert(handle_index <= stack_slots, "overflow");
if (map != NULL) {
__ movl(Address(rsp, offset), in_regs[i].first()->as_Register());
if (in_regs[i].second()->is_Register()) {
__ movl(Address(rsp, offset + 4), in_regs[i].second()->as_Register());
}
} else {
__ movl(in_regs[i].first()->as_Register(), Address(rsp, offset));
if (in_regs[i].second()->is_Register()) {
__ movl(in_regs[i].second()->as_Register(), Address(rsp, offset + 4));
}
}
}
}
// Save or restore single word registers
for ( int i = 0; i < total_in_args; i++) {
if (in_regs[i].first()->is_Register()) {
int slot = handle_index++ * VMRegImpl::slots_per_word + arg_save_area;
int offset = slot * VMRegImpl::stack_slot_size;
assert(handle_index <= stack_slots, "overflow");
if (in_sig_bt[i] == T_ARRAY && map != NULL) {
map->set_oop(VMRegImpl::stack2reg(slot));;
}
// Value is in an input register pass we must flush it to the stack
const Register reg = in_regs[i].first()->as_Register();
switch (in_sig_bt[i]) {
case T_ARRAY:
if (map != NULL) {
__ movptr(Address(rsp, offset), reg);
} else {
__ movptr(reg, Address(rsp, offset));
}
break;
case T_BOOLEAN:
case T_CHAR:
case T_BYTE:
case T_SHORT:
case T_INT:
if (map != NULL) {
__ movl(Address(rsp, offset), reg);
} else {
__ movl(reg, Address(rsp, offset));
}
break;
case T_OBJECT:
default: ShouldNotReachHere();
}
} else if (in_regs[i].first()->is_XMMRegister()) {
if (in_sig_bt[i] == T_FLOAT) {
int slot = handle_index++ * VMRegImpl::slots_per_word + arg_save_area;
int offset = slot * VMRegImpl::stack_slot_size;
assert(handle_index <= stack_slots, "overflow");
if (map != NULL) {
__ movflt(Address(rsp, offset), in_regs[i].first()->as_XMMRegister());
} else {
__ movflt(in_regs[i].first()->as_XMMRegister(), Address(rsp, offset));
}
}
} else if (in_regs[i].first()->is_stack()) {
if (in_sig_bt[i] == T_ARRAY && map != NULL) {
int offset_in_older_frame = in_regs[i].first()->reg2stack() + SharedRuntime::out_preserve_stack_slots();
map->set_oop(VMRegImpl::stack2reg(offset_in_older_frame + stack_slots));
}
}
}
}
// Check GC_locker::needs_gc and enter the runtime if it's true. This
// keeps a new JNI critical region from starting until a GC has been
// forced. Save down any oops in registers and describe them in an
// OopMap.
static void check_needs_gc_for_critical_native(MacroAssembler* masm,
Register thread,
int stack_slots,
int total_c_args,
int total_in_args,
int arg_save_area,
OopMapSet* oop_maps,
VMRegPair* in_regs,
BasicType* in_sig_bt) {
__ block_comment("check GC_locker::needs_gc");
Label cont;
__ cmp8(ExternalAddress((address)GC_locker::needs_gc_address()), false);
__ jcc(Assembler::equal, cont);
// Save down any incoming oops and call into the runtime to halt for a GC
OopMap* map = new OopMap(stack_slots * 2, 0 /* arg_slots*/);
save_or_restore_arguments(masm, stack_slots, total_in_args,
arg_save_area, map, in_regs, in_sig_bt);
address the_pc = __ pc();
oop_maps->add_gc_map( __ offset(), map);
__ set_last_Java_frame(thread, rsp, noreg, the_pc);
__ block_comment("block_for_jni_critical");
__ push(thread);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::block_for_jni_critical)));
__ increment(rsp, wordSize);
__ get_thread(thread);
__ reset_last_Java_frame(thread, false, true);
save_or_restore_arguments(masm, stack_slots, total_in_args,
arg_save_area, NULL, in_regs, in_sig_bt);
__ bind(cont);
#ifdef ASSERT
if (StressCriticalJNINatives) {
// Stress register saving
OopMap* map = new OopMap(stack_slots * 2, 0 /* arg_slots*/);
save_or_restore_arguments(masm, stack_slots, total_in_args,
arg_save_area, map, in_regs, in_sig_bt);
// Destroy argument registers
for (int i = 0; i < total_in_args - 1; i++) {
if (in_regs[i].first()->is_Register()) {
const Register reg = in_regs[i].first()->as_Register();
__ xorptr(reg, reg);
} else if (in_regs[i].first()->is_XMMRegister()) {
__ xorpd(in_regs[i].first()->as_XMMRegister(), in_regs[i].first()->as_XMMRegister());
} else if (in_regs[i].first()->is_FloatRegister()) {
ShouldNotReachHere();
} else if (in_regs[i].first()->is_stack()) {
// Nothing to do
} else {
ShouldNotReachHere();
}
if (in_sig_bt[i] == T_LONG || in_sig_bt[i] == T_DOUBLE) {
i++;
}
}
save_or_restore_arguments(masm, stack_slots, total_in_args,
arg_save_area, NULL, in_regs, in_sig_bt);
}
#endif
}
// Unpack an array argument into a pointer to the body and the length
// if the array is non-null, otherwise pass 0 for both.
static void unpack_array_argument(MacroAssembler* masm, VMRegPair reg, BasicType in_elem_type, VMRegPair body_arg, VMRegPair length_arg) {
Register tmp_reg = rax;
assert(!body_arg.first()->is_Register() || body_arg.first()->as_Register() != tmp_reg,
"possible collision");
assert(!length_arg.first()->is_Register() || length_arg.first()->as_Register() != tmp_reg,
"possible collision");
// Pass the length, ptr pair
Label is_null, done;
VMRegPair tmp(tmp_reg->as_VMReg());
if (reg.first()->is_stack()) {
// Load the arg up from the stack
simple_move32(masm, reg, tmp);
reg = tmp;
}
__ testptr(reg.first()->as_Register(), reg.first()->as_Register());
__ jccb(Assembler::equal, is_null);
__ lea(tmp_reg, Address(reg.first()->as_Register(), arrayOopDesc::base_offset_in_bytes(in_elem_type)));
simple_move32(masm, tmp, body_arg);
// load the length relative to the body.
__ movl(tmp_reg, Address(tmp_reg, arrayOopDesc::length_offset_in_bytes() -
arrayOopDesc::base_offset_in_bytes(in_elem_type)));
simple_move32(masm, tmp, length_arg);
__ jmpb(done);
__ bind(is_null);
// Pass zeros
__ xorptr(tmp_reg, tmp_reg);
simple_move32(masm, tmp, body_arg);
simple_move32(masm, tmp, length_arg);
__ bind(done);
}
static void verify_oop_args(MacroAssembler* masm,
methodHandle method,
const BasicType* sig_bt,
const VMRegPair* regs) {
Register temp_reg = rbx; // not part of any compiled calling seq
if (VerifyOops) {
for (int i = 0; i < method->size_of_parameters(); i++) {
if (sig_bt[i] == T_OBJECT ||
sig_bt[i] == T_ARRAY) {
VMReg r = regs[i].first();
assert(r->is_valid(), "bad oop arg");
if (r->is_stack()) {
__ movptr(temp_reg, Address(rsp, r->reg2stack() * VMRegImpl::stack_slot_size + wordSize));
__ verify_oop(temp_reg);
} else {
__ verify_oop(r->as_Register());
}
}
}
}
}
static void gen_special_dispatch(MacroAssembler* masm,
methodHandle method,
const BasicType* sig_bt,
const VMRegPair* regs) {
verify_oop_args(masm, method, sig_bt, regs);
vmIntrinsics::ID iid = method->intrinsic_id();
// Now write the args into the outgoing interpreter space
bool has_receiver = false;
Register receiver_reg = noreg;
int member_arg_pos = -1;
Register member_reg = noreg;
int ref_kind = MethodHandles::signature_polymorphic_intrinsic_ref_kind(iid);
if (ref_kind != 0) {
member_arg_pos = method->size_of_parameters() - 1; // trailing MemberName argument
member_reg = rbx; // known to be free at this point
has_receiver = MethodHandles::ref_kind_has_receiver(ref_kind);
} else if (iid == vmIntrinsics::_invokeBasic) {
has_receiver = true;
} else {
fatal(err_msg_res("unexpected intrinsic id %d", iid));
}
if (member_reg != noreg) {
// Load the member_arg into register, if necessary.
SharedRuntime::check_member_name_argument_is_last_argument(method, sig_bt, regs);
VMReg r = regs[member_arg_pos].first();
if (r->is_stack()) {
__ movptr(member_reg, Address(rsp, r->reg2stack() * VMRegImpl::stack_slot_size + wordSize));
} else {
// no data motion is needed
member_reg = r->as_Register();
}
}
if (has_receiver) {
// Make sure the receiver is loaded into a register.
assert(method->size_of_parameters() > 0, "oob");
assert(sig_bt[0] == T_OBJECT, "receiver argument must be an object");
VMReg r = regs[0].first();
assert(r->is_valid(), "bad receiver arg");
if (r->is_stack()) {
// Porting note: This assumes that compiled calling conventions always
// pass the receiver oop in a register. If this is not true on some
// platform, pick a temp and load the receiver from stack.
fatal("receiver always in a register");
receiver_reg = rcx; // known to be free at this point
__ movptr(receiver_reg, Address(rsp, r->reg2stack() * VMRegImpl::stack_slot_size + wordSize));
} else {
// no data motion is needed
receiver_reg = r->as_Register();
}
}
// Figure out which address we are really jumping to:
MethodHandles::generate_method_handle_dispatch(masm, iid,
receiver_reg, member_reg, /*for_compiler_entry:*/ true);
}
// ---------------------------------------------------------------------------
// Generate a native wrapper for a given method. The method takes arguments
// in the Java compiled code convention, marshals them to the native
// convention (handlizes oops, etc), transitions to native, makes the call,
// returns to java state (possibly blocking), unhandlizes any result and
// returns.
//
// Critical native functions are a shorthand for the use of
// GetPrimtiveArrayCritical and disallow the use of any other JNI
// functions. The wrapper is expected to unpack the arguments before
// passing them to the callee and perform checks before and after the
// native call to ensure that they GC_locker
// lock_critical/unlock_critical semantics are followed. Some other
// parts of JNI setup are skipped like the tear down of the JNI handle
// block and the check for pending exceptions it's impossible for them
// to be thrown.
//
// They are roughly structured like this:
// if (GC_locker::needs_gc())
// SharedRuntime::block_for_jni_critical();
// tranistion to thread_in_native
// unpack arrray arguments and call native entry point
// check for safepoint in progress
// check if any thread suspend flags are set
// call into JVM and possible unlock the JNI critical
// if a GC was suppressed while in the critical native.
// transition back to thread_in_Java
// return to caller
//
nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
methodHandle method,
int compile_id,
BasicType* in_sig_bt,
VMRegPair* in_regs,
BasicType ret_type) {
if (method->is_method_handle_intrinsic()) {
vmIntrinsics::ID iid = method->intrinsic_id();
intptr_t start = (intptr_t)__ pc();
int vep_offset = ((intptr_t)__ pc()) - start;
gen_special_dispatch(masm,
method,
in_sig_bt,
in_regs);
int frame_complete = ((intptr_t)__ pc()) - start; // not complete, period
__ flush();
int stack_slots = SharedRuntime::out_preserve_stack_slots(); // no out slots at all, actually
return nmethod::new_native_nmethod(method,
compile_id,
masm->code(),
vep_offset,
frame_complete,
stack_slots / VMRegImpl::slots_per_word,
in_ByteSize(-1),
in_ByteSize(-1),
(OopMapSet*)NULL);
}
bool is_critical_native = true;
address native_func = method->critical_native_function();
if (native_func == NULL) {
native_func = method->native_function();
is_critical_native = false;
}
assert(native_func != NULL, "must have function");
// An OopMap for lock (and class if static)
OopMapSet *oop_maps = new OopMapSet();
// We have received a description of where all the java arg are located
// on entry to the wrapper. We need to convert these args to where
// the jni function will expect them. To figure out where they go
// we convert the java signature to a C signature by inserting
// the hidden arguments as arg[0] and possibly arg[1] (static method)
const int total_in_args = method->size_of_parameters();
int total_c_args = total_in_args;
if (!is_critical_native) {
total_c_args += 1;
if (method->is_static()) {
total_c_args++;
}
} else {
for (int i = 0; i < total_in_args; i++) {
if (in_sig_bt[i] == T_ARRAY) {
total_c_args++;
}
}
}
BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_c_args);
VMRegPair* out_regs = NEW_RESOURCE_ARRAY(VMRegPair, total_c_args);
BasicType* in_elem_bt = NULL;
int argc = 0;
if (!is_critical_native) {
out_sig_bt[argc++] = T_ADDRESS;
if (method->is_static()) {
out_sig_bt[argc++] = T_OBJECT;
}
for (int i = 0; i < total_in_args ; i++ ) {
out_sig_bt[argc++] = in_sig_bt[i];
}
} else {
Thread* THREAD = Thread::current();
in_elem_bt = NEW_RESOURCE_ARRAY(BasicType, total_in_args);
SignatureStream ss(method->signature());
for (int i = 0; i < total_in_args ; i++ ) {
if (in_sig_bt[i] == T_ARRAY) {
// Arrays are passed as int, elem* pair
out_sig_bt[argc++] = T_INT;
out_sig_bt[argc++] = T_ADDRESS;
Symbol* atype = ss.as_symbol(CHECK_NULL);
const char* at = atype->as_C_string();
if (strlen(at) == 2) {
assert(at[0] == '[', "must be");
switch (at[1]) {
case 'B': in_elem_bt[i] = T_BYTE; break;
case 'C': in_elem_bt[i] = T_CHAR; break;
case 'D': in_elem_bt[i] = T_DOUBLE; break;
case 'F': in_elem_bt[i] = T_FLOAT; break;
case 'I': in_elem_bt[i] = T_INT; break;
case 'J': in_elem_bt[i] = T_LONG; break;
case 'S': in_elem_bt[i] = T_SHORT; break;
case 'Z': in_elem_bt[i] = T_BOOLEAN; break;
default: ShouldNotReachHere();
}
}
} else {
out_sig_bt[argc++] = in_sig_bt[i];
in_elem_bt[i] = T_VOID;
}
if (in_sig_bt[i] != T_VOID) {
assert(in_sig_bt[i] == ss.type(), "must match");
ss.next();
}
}
}
// Now figure out where the args must be stored and how much stack space
// they require.
int out_arg_slots;
out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
// Compute framesize for the wrapper. We need to handlize all oops in
// registers a max of 2 on x86.
// Calculate the total number of stack slots we will need.
// First count the abi requirement plus all of the outgoing args
int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
// Now the space for the inbound oop handle area
int total_save_slots = 2 * VMRegImpl::slots_per_word; // 2 arguments passed in registers
if (is_critical_native) {
// Critical natives may have to call out so they need a save area
// for register arguments.
int double_slots = 0;
int single_slots = 0;
for ( int i = 0; i < total_in_args; i++) {
if (in_regs[i].first()->is_Register()) {
const Register reg = in_regs[i].first()->as_Register();
switch (in_sig_bt[i]) {
case T_ARRAY: // critical array (uses 2 slots on LP64)
case T_BOOLEAN:
case T_BYTE:
case T_SHORT:
case T_CHAR:
case T_INT: single_slots++; break;
case T_LONG: double_slots++; break;
default: ShouldNotReachHere();
}
} else if (in_regs[i].first()->is_XMMRegister()) {
switch (in_sig_bt[i]) {
case T_FLOAT: single_slots++; break;
case T_DOUBLE: double_slots++; break;
default: ShouldNotReachHere();
}
} else if (in_regs[i].first()->is_FloatRegister()) {
ShouldNotReachHere();
}
}
total_save_slots = double_slots * 2 + single_slots;
// align the save area
if (double_slots != 0) {
stack_slots = round_to(stack_slots, 2);
}
}
int oop_handle_offset = stack_slots;
stack_slots += total_save_slots;
// Now any space we need for handlizing a klass if static method
int klass_slot_offset = 0;
int klass_offset = -1;
int lock_slot_offset = 0;
bool is_static = false;
if (method->is_static()) {
klass_slot_offset = stack_slots;
stack_slots += VMRegImpl::slots_per_word;
klass_offset = klass_slot_offset * VMRegImpl::stack_slot_size;
is_static = true;
}
// Plus a lock if needed
if (method->is_synchronized()) {
lock_slot_offset = stack_slots;
stack_slots += VMRegImpl::slots_per_word;
}
// Now a place (+2) to save return values or temp during shuffling
// + 2 for return address (which we own) and saved rbp,
stack_slots += 4;
// Ok The space we have allocated will look like:
//
//
// FP-> | |
// |---------------------|
// | 2 slots for moves |
// |---------------------|
// | lock box (if sync) |
// |---------------------| <- lock_slot_offset (-lock_slot_rbp_offset)
// | klass (if static) |
// |---------------------| <- klass_slot_offset
// | oopHandle area |
// |---------------------| <- oop_handle_offset (a max of 2 registers)
// | outbound memory |
// | based arguments |
// | |
// |---------------------|
// | |
// SP-> | out_preserved_slots |
//
//
// ****************************************************************************
// WARNING - on Windows Java Natives use pascal calling convention and pop the
// arguments off of the stack after the jni call. Before the call we can use
// instructions that are SP relative. After the jni call we switch to FP
// relative instructions instead of re-adjusting the stack on windows.
// ****************************************************************************
// Now compute actual number of stack words we need rounding to make
// stack properly aligned.
stack_slots = round_to(stack_slots, StackAlignmentInSlots);
int stack_size = stack_slots * VMRegImpl::stack_slot_size;
intptr_t start = (intptr_t)__ pc();
// First thing make an ic check to see if we should even be here
// We are free to use all registers as temps without saving them and
// restoring them except rbp. rbp is the only callee save register
// as far as the interpreter and the compiler(s) are concerned.
const Register ic_reg = rax;
const Register receiver = rcx;
Label hit;
Label exception_pending;
__ verify_oop(receiver);
__ cmpptr(ic_reg, Address(receiver, oopDesc::klass_offset_in_bytes()));
__ jcc(Assembler::equal, hit);
__ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
// verified entry must be aligned for code patching.
// and the first 5 bytes must be in the same cache line
// if we align at 8 then we will be sure 5 bytes are in the same line
__ align(8);
__ bind(hit);
int vep_offset = ((intptr_t)__ pc()) - start;
#ifdef COMPILER1
if (InlineObjectHash && method->intrinsic_id() == vmIntrinsics::_hashCode) {
// Object.hashCode can pull the hashCode from the header word
// instead of doing a full VM transition once it's been computed.
// Since hashCode is usually polymorphic at call sites we can't do
// this optimization at the call site without a lot of work.
Label slowCase;
Register receiver = rcx;
Register result = rax;
__ movptr(result, Address(receiver, oopDesc::mark_offset_in_bytes()));
// check if locked
__ testptr(result, markOopDesc::unlocked_value);
__ jcc (Assembler::zero, slowCase);
if (UseBiasedLocking) {
// Check if biased and fall through to runtime if so
__ testptr(result, markOopDesc::biased_lock_bit_in_place);
__ jcc (Assembler::notZero, slowCase);
}
// get hash
__ andptr(result, markOopDesc::hash_mask_in_place);
// test if hashCode exists
__ jcc (Assembler::zero, slowCase);
__ shrptr(result, markOopDesc::hash_shift);
__ ret(0);
__ bind (slowCase);
}
#endif // COMPILER1
// The instruction at the verified entry point must be 5 bytes or longer
// because it can be patched on the fly by make_non_entrant. The stack bang
// instruction fits that requirement.
// Generate stack overflow check
if (UseStackBanging) {
__ bang_stack_with_offset(StackShadowPages*os::vm_page_size());
} else {
// need a 5 byte instruction to allow MT safe patching to non-entrant
__ fat_nop();
}
// Generate a new frame for the wrapper.
__ enter();
// -2 because return address is already present and so is saved rbp
__ subptr(rsp, stack_size - 2*wordSize);
// Frame is now completed as far as size and linkage.
int frame_complete = ((intptr_t)__ pc()) - start;
if (UseRTMLocking) {
// Abort RTM transaction before calling JNI
// because critical section will be large and will be
// aborted anyway. Also nmethod could be deoptimized.
__ xabort(0);
}
// Calculate the difference between rsp and rbp,. We need to know it
// after the native call because on windows Java Natives will pop
// the arguments and it is painful to do rsp relative addressing
// in a platform independent way. So after the call we switch to
// rbp, relative addressing.
int fp_adjustment = stack_size - 2*wordSize;
#ifdef COMPILER2
// C2 may leave the stack dirty if not in SSE2+ mode
if (UseSSE >= 2) {
__ verify_FPU(0, "c2i transition should have clean FPU stack");
} else {
__ empty_FPU_stack();
}
#endif /* COMPILER2 */
// Compute the rbp, offset for any slots used after the jni call
int lock_slot_rbp_offset = (lock_slot_offset*VMRegImpl::stack_slot_size) - fp_adjustment;
// We use rdi as a thread pointer because it is callee save and
// if we load it once it is usable thru the entire wrapper
const Register thread = rdi;
// We use rsi as the oop handle for the receiver/klass
// It is callee save so it survives the call to native
const Register oop_handle_reg = rsi;
__ get_thread(thread);
if (is_critical_native) {
check_needs_gc_for_critical_native(masm, thread, stack_slots, total_c_args, total_in_args,
oop_handle_offset, oop_maps, in_regs, in_sig_bt);
}
//
// We immediately shuffle the arguments so that any vm call we have to
// make from here on out (sync slow path, jvmti, etc.) we will have
// captured the oops from our caller and have a valid oopMap for
// them.
// -----------------
// The Grand Shuffle
//
// Natives require 1 or 2 extra arguments over the normal ones: the JNIEnv*
// and, if static, the class mirror instead of a receiver. This pretty much
// guarantees that register layout will not match (and x86 doesn't use reg
// parms though amd does). Since the native abi doesn't use register args
// and the java conventions does we don't have to worry about collisions.
// All of our moved are reg->stack or stack->stack.
// We ignore the extra arguments during the shuffle and handle them at the
// last moment. The shuffle is described by the two calling convention
// vectors we have in our possession. We simply walk the java vector to
// get the source locations and the c vector to get the destinations.
int c_arg = is_critical_native ? 0 : (method->is_static() ? 2 : 1 );
// Record rsp-based slot for receiver on stack for non-static methods
int receiver_offset = -1;
// This is a trick. We double the stack slots so we can claim
// the oops in the caller's frame. Since we are sure to have
// more args than the caller doubling is enough to make
// sure we can capture all the incoming oop args from the
// caller.
//
OopMap* map = new OopMap(stack_slots * 2, 0 /* arg_slots*/);
// Mark location of rbp,
// map->set_callee_saved(VMRegImpl::stack2reg( stack_slots - 2), stack_slots * 2, 0, rbp->as_VMReg());
// We know that we only have args in at most two integer registers (rcx, rdx). So rax, rbx
// Are free to temporaries if we have to do stack to steck moves.
// All inbound args are referenced based on rbp, and all outbound args via rsp.
for (int i = 0; i < total_in_args ; i++, c_arg++ ) {
switch (in_sig_bt[i]) {
case T_ARRAY:
if (is_critical_native) {
unpack_array_argument(masm, in_regs[i], in_elem_bt[i], out_regs[c_arg + 1], out_regs[c_arg]);
c_arg++;
break;
}
case T_OBJECT:
assert(!is_critical_native, "no oop arguments");
object_move(masm, map, oop_handle_offset, stack_slots, in_regs[i], out_regs[c_arg],
((i == 0) && (!is_static)),
&receiver_offset);
break;
case T_VOID:
break;
case T_FLOAT:
float_move(masm, in_regs[i], out_regs[c_arg]);
break;
case T_DOUBLE:
assert( i + 1 < total_in_args &&
in_sig_bt[i + 1] == T_VOID &&
out_sig_bt[c_arg+1] == T_VOID, "bad arg list");
double_move(masm, in_regs[i], out_regs[c_arg]);
break;
case T_LONG :
long_move(masm, in_regs[i], out_regs[c_arg]);
break;
case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
default:
simple_move32(masm, in_regs[i], out_regs[c_arg]);
}
}
// Pre-load a static method's oop into rsi. Used both by locking code and
// the normal JNI call code.
if (method->is_static() && !is_critical_native) {
// load opp into a register
__ movoop(oop_handle_reg, JNIHandles::make_local(method->method_holder()->java_mirror()));
// Now handlize the static class mirror it's known not-null.
__ movptr(Address(rsp, klass_offset), oop_handle_reg);
map->set_oop(VMRegImpl::stack2reg(klass_slot_offset));
// Now get the handle
__ lea(oop_handle_reg, Address(rsp, klass_offset));
// store the klass handle as second argument
__ movptr(Address(rsp, wordSize), oop_handle_reg);
}
// Change state to native (we save the return address in the thread, since it might not
// be pushed on the stack when we do a a stack traversal). It is enough that the pc()
// points into the right code segment. It does not have to be the correct return pc.
// We use the same pc/oopMap repeatedly when we call out
intptr_t the_pc = (intptr_t) __ pc();
oop_maps->add_gc_map(the_pc - start, map);
__ set_last_Java_frame(thread, rsp, noreg, (address)the_pc);
// We have all of the arguments setup at this point. We must not touch any register
// argument registers at this point (what if we save/restore them there are no oop?
{
SkipIfEqual skip_if(masm, &DTraceMethodProbes, 0);
__ mov_metadata(rax, method());
__ call_VM_leaf(
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
thread, rax);
}
// RedefineClasses() tracing support for obsolete method entry
if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) {
__ mov_metadata(rax, method());
__ call_VM_leaf(
CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry),
thread, rax);
}
// These are register definitions we need for locking/unlocking
const Register swap_reg = rax; // Must use rax, for cmpxchg instruction
const Register obj_reg = rcx; // Will contain the oop
const Register lock_reg = rdx; // Address of compiler lock object (BasicLock)
Label slow_path_lock;
Label lock_done;
// Lock a synchronized method
if (method->is_synchronized()) {
assert(!is_critical_native, "unhandled");
const int mark_word_offset = BasicLock::displaced_header_offset_in_bytes();
// Get the handle (the 2nd argument)
__ movptr(oop_handle_reg, Address(rsp, wordSize));
// Get address of the box
__ lea(lock_reg, Address(rbp, lock_slot_rbp_offset));
// Load the oop from the handle
__ movptr(obj_reg, Address(oop_handle_reg, 0));
if (UseBiasedLocking) {
// Note that oop_handle_reg is trashed during this call
__ biased_locking_enter(lock_reg, obj_reg, swap_reg, oop_handle_reg, false, lock_done, &slow_path_lock);
}
// Load immediate 1 into swap_reg %rax,
__ movptr(swap_reg, 1);
// Load (object->mark() | 1) into swap_reg %rax,
__ orptr(swap_reg, Address(obj_reg, 0));
// Save (object->mark() | 1) into BasicLock's displaced header
__ movptr(Address(lock_reg, mark_word_offset), swap_reg);
if (os::is_MP()) {
__ lock();
}
// src -> dest iff dest == rax, else rax, <- dest
// *obj_reg = lock_reg iff *obj_reg == rax, else rax, = *(obj_reg)
__ cmpxchgptr(lock_reg, Address(obj_reg, 0));
__ jcc(Assembler::equal, lock_done);
// Test if the oopMark is an obvious stack pointer, i.e.,
// 1) (mark & 3) == 0, and
// 2) rsp <= mark < mark + os::pagesize()
// These 3 tests can be done by evaluating the following
// expression: ((mark - rsp) & (3 - os::vm_page_size())),
// assuming both stack pointer and pagesize have their
// least significant 2 bits clear.
// NOTE: the oopMark is in swap_reg %rax, as the result of cmpxchg
__ subptr(swap_reg, rsp);
__ andptr(swap_reg, 3 - os::vm_page_size());
// Save the test result, for recursive case, the result is zero
__ movptr(Address(lock_reg, mark_word_offset), swap_reg);
__ jcc(Assembler::notEqual, slow_path_lock);
// Slow path will re-enter here
__ bind(lock_done);
if (UseBiasedLocking) {
// Re-fetch oop_handle_reg as we trashed it above
__ movptr(oop_handle_reg, Address(rsp, wordSize));
}
}
// Finally just about ready to make the JNI call
// get JNIEnv* which is first argument to native
if (!is_critical_native) {
__ lea(rdx, Address(thread, in_bytes(JavaThread::jni_environment_offset())));
__ movptr(Address(rsp, 0), rdx);
}
// Now set thread in native
__ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_native);
__ call(RuntimeAddress(native_func));
// Verify or restore cpu control state after JNI call
__ restore_cpu_control_state_after_jni();
// WARNING - on Windows Java Natives use pascal calling convention and pop the
// arguments off of the stack. We could just re-adjust the stack pointer here
// and continue to do SP relative addressing but we instead switch to FP
// relative addressing.
// Unpack native results.
switch (ret_type) {
case T_BOOLEAN: __ c2bool(rax); break;
case T_CHAR : __ andptr(rax, 0xFFFF); break;
case T_BYTE : __ sign_extend_byte (rax); break;
case T_SHORT : __ sign_extend_short(rax); break;
case T_INT : /* nothing to do */ break;
case T_DOUBLE :
case T_FLOAT :
// Result is in st0 we'll save as needed
break;
case T_ARRAY: // Really a handle
case T_OBJECT: // Really a handle
break; // can't de-handlize until after safepoint check
case T_VOID: break;
case T_LONG: break;
default : ShouldNotReachHere();
}
// Switch thread to "native transition" state before reading the synchronization state.
// This additional state is necessary because reading and testing the synchronization
// state is not atomic w.r.t. GC, as this scenario demonstrates:
// Java thread A, in _thread_in_native state, loads _not_synchronized and is preempted.
// VM thread changes sync state to synchronizing and suspends threads for GC.
// Thread A is resumed to finish this native method, but doesn't block here since it
// didn't see any synchronization is progress, and escapes.
__ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_native_trans);
if(os::is_MP()) {
if (UseMembar) {
// Force this write out before the read below
__ membar(Assembler::Membar_mask_bits(
Assembler::LoadLoad | Assembler::LoadStore |
Assembler::StoreLoad | Assembler::StoreStore));
} else {
// Write serialization page so VM thread can do a pseudo remote membar.
// We use the current thread pointer to calculate a thread specific
// offset to write to within the page. This minimizes bus traffic
// due to cache line collision.
__ serialize_memory(thread, rcx);
}
}
if (AlwaysRestoreFPU) {
// Make sure the control word is correct.
__ fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
}
Label after_transition;
// check for safepoint operation in progress and/or pending suspend requests
{ Label Continue;
__ cmp32(ExternalAddress((address)SafepointSynchronize::address_of_state()),
SafepointSynchronize::_not_synchronized);
Label L;
__ jcc(Assembler::notEqual, L);
__ cmpl(Address(thread, JavaThread::suspend_flags_offset()), 0);
__ jcc(Assembler::equal, Continue);
__ bind(L);
// Don't use call_VM as it will see a possible pending exception and forward it
// and never return here preventing us from clearing _last_native_pc down below.
// Also can't use call_VM_leaf either as it will check to see if rsi & rdi are
// preserved and correspond to the bcp/locals pointers. So we do a runtime call
// by hand.
//
save_native_result(masm, ret_type, stack_slots);
__ push(thread);
if (!is_critical_native) {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address,
JavaThread::check_special_condition_for_native_trans)));
} else {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address,
JavaThread::check_special_condition_for_native_trans_and_transition)));
}
__ increment(rsp, wordSize);
// Restore any method result value
restore_native_result(masm, ret_type, stack_slots);
if (is_critical_native) {
// The call above performed the transition to thread_in_Java so
// skip the transition logic below.
__ jmpb(after_transition);
}
__ bind(Continue);
}
// change thread state
__ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java);
__ bind(after_transition);
Label reguard;
Label reguard_done;
__ cmpl(Address(thread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_yellow_disabled);
__ jcc(Assembler::equal, reguard);
// slow path reguard re-enters here
__ bind(reguard_done);
// Handle possible exception (will unlock if necessary)
// native result if any is live
// Unlock
Label slow_path_unlock;
Label unlock_done;
if (method->is_synchronized()) {
Label done;
// Get locked oop from the handle we passed to jni
__ movptr(obj_reg, Address(oop_handle_reg, 0));
if (UseBiasedLocking) {
__ biased_locking_exit(obj_reg, rbx, done);
}
// Simple recursive lock?
__ cmpptr(Address(rbp, lock_slot_rbp_offset), (int32_t)NULL_WORD);
__ jcc(Assembler::equal, done);
// Must save rax, if if it is live now because cmpxchg must use it
if (ret_type != T_FLOAT && ret_type != T_DOUBLE && ret_type != T_VOID) {
save_native_result(masm, ret_type, stack_slots);
}
// get old displaced header
__ movptr(rbx, Address(rbp, lock_slot_rbp_offset));
// get address of the stack lock
__ lea(rax, Address(rbp, lock_slot_rbp_offset));
// Atomic swap old header if oop still contains the stack lock
if (os::is_MP()) {
__ lock();
}
// src -> dest iff dest == rax, else rax, <- dest
// *obj_reg = rbx, iff *obj_reg == rax, else rax, = *(obj_reg)
__ cmpxchgptr(rbx, Address(obj_reg, 0));
__ jcc(Assembler::notEqual, slow_path_unlock);
// slow path re-enters here
__ bind(unlock_done);
if (ret_type != T_FLOAT && ret_type != T_DOUBLE && ret_type != T_VOID) {
restore_native_result(masm, ret_type, stack_slots);
}
__ bind(done);
}
{
SkipIfEqual skip_if(masm, &DTraceMethodProbes, 0);
// Tell dtrace about this method exit
save_native_result(masm, ret_type, stack_slots);
__ mov_metadata(rax, method());
__ call_VM_leaf(
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
thread, rax);
restore_native_result(masm, ret_type, stack_slots);
}
// We can finally stop using that last_Java_frame we setup ages ago
__ reset_last_Java_frame(thread, false, true);
// Unpack oop result
if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
Label L;
__ cmpptr(rax, (int32_t)NULL_WORD);
__ jcc(Assembler::equal, L);
__ movptr(rax, Address(rax, 0));
__ bind(L);
__ verify_oop(rax);
}
if (!is_critical_native) {
// reset handle block
__ movptr(rcx, Address(thread, JavaThread::active_handles_offset()));
__ movl(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD);
// Any exception pending?
__ cmpptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD);
__ jcc(Assembler::notEqual, exception_pending);
}
// no exception, we're almost done
// check that only result value is on FPU stack
__ verify_FPU(ret_type == T_FLOAT || ret_type == T_DOUBLE ? 1 : 0, "native_wrapper normal exit");
// Fixup floating pointer results so that result looks like a return from a compiled method
if (ret_type == T_FLOAT) {
if (UseSSE >= 1) {
// Pop st0 and store as float and reload into xmm register
__ fstp_s(Address(rbp, -4));
__ movflt(xmm0, Address(rbp, -4));
}
} else if (ret_type == T_DOUBLE) {
if (UseSSE >= 2) {
// Pop st0 and store as double and reload into xmm register
__ fstp_d(Address(rbp, -8));
__ movdbl(xmm0, Address(rbp, -8));
}
}
// Return
__ leave();
__ ret(0);
// Unexpected paths are out of line and go here
// Slow path locking & unlocking
if (method->is_synchronized()) {
// BEGIN Slow path lock
__ bind(slow_path_lock);
// has last_Java_frame setup. No exceptions so do vanilla call not call_VM
// args are (oop obj, BasicLock* lock, JavaThread* thread)
__ push(thread);
__ push(lock_reg);
__ push(obj_reg);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_locking_C)));
__ addptr(rsp, 3*wordSize);
#ifdef ASSERT
{ Label L;
__ cmpptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD);
__ jcc(Assembler::equal, L);
__ stop("no pending exception allowed on exit from monitorenter");
__ bind(L);
}
#endif
__ jmp(lock_done);
// END Slow path lock
// BEGIN Slow path unlock
__ bind(slow_path_unlock);
// Slow path unlock
if (ret_type == T_FLOAT || ret_type == T_DOUBLE ) {
save_native_result(masm, ret_type, stack_slots);
}
// Save pending exception around call to VM (which contains an EXCEPTION_MARK)
__ pushptr(Address(thread, in_bytes(Thread::pending_exception_offset())));
__ movptr(Address(thread, in_bytes(Thread::pending_exception_offset())), NULL_WORD);
// should be a peal
// +wordSize because of the push above
__ lea(rax, Address(rbp, lock_slot_rbp_offset));
__ push(rax);
__ push(obj_reg);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C)));
__ addptr(rsp, 2*wordSize);
#ifdef ASSERT
{
Label L;
__ cmpptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD);
__ jcc(Assembler::equal, L);
__ stop("no pending exception allowed on exit complete_monitor_unlocking_C");
__ bind(L);
}
#endif /* ASSERT */
__ popptr(Address(thread, in_bytes(Thread::pending_exception_offset())));
if (ret_type == T_FLOAT || ret_type == T_DOUBLE ) {
restore_native_result(masm, ret_type, stack_slots);
}
__ jmp(unlock_done);
// END Slow path unlock
}
// SLOW PATH Reguard the stack if needed
__ bind(reguard);
save_native_result(masm, ret_type, stack_slots);
{
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
}
restore_native_result(masm, ret_type, stack_slots);
__ jmp(reguard_done);
// BEGIN EXCEPTION PROCESSING
if (!is_critical_native) {
// Forward the exception
__ bind(exception_pending);
// remove possible return value from FPU register stack
__ empty_FPU_stack();
// pop our frame
__ leave();
// and forward the exception
__ jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
}
__ flush();
nmethod *nm = nmethod::new_native_nmethod(method,
compile_id,
masm->code(),
vep_offset,
frame_complete,
stack_slots / VMRegImpl::slots_per_word,
(is_static ? in_ByteSize(klass_offset) : in_ByteSize(receiver_offset)),
in_ByteSize(lock_slot_offset*VMRegImpl::stack_slot_size),
oop_maps);
if (is_critical_native) {
nm->set_lazy_critical_native(true);
}
return nm;
}
// this function returns the adjust size (in number of words) to a c2i adapter
// activation for use during deoptimization
int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals ) {
return (callee_locals - callee_parameters) * Interpreter::stackElementWords;
}
uint SharedRuntime::out_preserve_stack_slots() {
return 0;
}
//------------------------------generate_deopt_blob----------------------------
void SharedRuntime::generate_deopt_blob() {
// allocate space for the code
ResourceMark rm;
// setup code generation tools
CodeBuffer buffer("deopt_blob", 1024, 1024);
MacroAssembler* masm = new MacroAssembler(&buffer);
int frame_size_in_words;
OopMap* map = NULL;
// Account for the extra args we place on the stack
// by the time we call fetch_unroll_info
const int additional_words = 2; // deopt kind, thread
OopMapSet *oop_maps = new OopMapSet();
// -------------
// This code enters when returning to a de-optimized nmethod. A return
// address has been pushed on the the stack, and return values are in
// registers.
// If we are doing a normal deopt then we were called from the patched
// nmethod from the point we returned to the nmethod. So the return
// address on the stack is wrong by NativeCall::instruction_size
// We will adjust the value to it looks like we have the original return
// address on the stack (like when we eagerly deoptimized).
// In the case of an exception pending with deoptimized then we enter
// with a return address on the stack that points after the call we patched
// into the exception handler. We have the following register state:
// rax,: exception
// rbx,: exception handler
// rdx: throwing pc
// So in this case we simply jam rdx into the useless return address and
// the stack looks just like we want.
//
// At this point we need to de-opt. We save the argument return
// registers. We call the first C routine, fetch_unroll_info(). This
// routine captures the return values and returns a structure which
// describes the current frame size and the sizes of all replacement frames.
// The current frame is compiled code and may contain many inlined
// functions, each with their own JVM state. We pop the current frame, then
// push all the new frames. Then we call the C routine unpack_frames() to
// populate these frames. Finally unpack_frames() returns us the new target
// address. Notice that callee-save registers are BLOWN here; they have
// already been captured in the vframeArray at the time the return PC was
// patched.
address start = __ pc();
Label cont;
// Prolog for non exception case!
// Save everything in sight.
map = RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words, false);
// Normal deoptimization
__ push(Deoptimization::Unpack_deopt);
__ jmp(cont);
int reexecute_offset = __ pc() - start;
// Reexecute case
// return address is the pc describes what bci to do re-execute at
// No need to update map as each call to save_live_registers will produce identical oopmap
(void) RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words, false);
__ push(Deoptimization::Unpack_reexecute);
__ jmp(cont);
int exception_offset = __ pc() - start;
// Prolog for exception case
// all registers are dead at this entry point, except for rax, and
// rdx which contain the exception oop and exception pc
// respectively. Set them in TLS and fall thru to the
// unpack_with_exception_in_tls entry point.
__ get_thread(rdi);
__ movptr(Address(rdi, JavaThread::exception_pc_offset()), rdx);
__ movptr(Address(rdi, JavaThread::exception_oop_offset()), rax);
int exception_in_tls_offset = __ pc() - start;
// new implementation because exception oop is now passed in JavaThread
// Prolog for exception case
// All registers must be preserved because they might be used by LinearScan
// Exceptiop oop and throwing PC are passed in JavaThread
// tos: stack at point of call to method that threw the exception (i.e. only
// args are on the stack, no return address)
// make room on stack for the return address
// It will be patched later with the throwing pc. The correct value is not
// available now because loading it from memory would destroy registers.
__ push(0);
// Save everything in sight.
// No need to update map as each call to save_live_registers will produce identical oopmap
(void) RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words, false);
// Now it is safe to overwrite any register
// store the correct deoptimization type
__ push(Deoptimization::Unpack_exception);
// load throwing pc from JavaThread and patch it as the return address
// of the current frame. Then clear the field in JavaThread
__ get_thread(rdi);
__ movptr(rdx, Address(rdi, JavaThread::exception_pc_offset()));
__ movptr(Address(rbp, wordSize), rdx);
__ movptr(Address(rdi, JavaThread::exception_pc_offset()), NULL_WORD);
#ifdef ASSERT
// verify that there is really an exception oop in JavaThread
__ movptr(rax, Address(rdi, JavaThread::exception_oop_offset()));
__ verify_oop(rax);
// verify that there is no pending exception
Label no_pending_exception;
__ movptr(rax, Address(rdi, Thread::pending_exception_offset()));
__ testptr(rax, rax);
__ jcc(Assembler::zero, no_pending_exception);
__ stop("must not have pending exception here");
__ bind(no_pending_exception);
#endif
__ bind(cont);
// Compiled code leaves the floating point stack dirty, empty it.
__ empty_FPU_stack();
// Call C code. Need thread and this frame, but NOT official VM entry
// crud. We cannot block on this call, no GC can happen.
__ get_thread(rcx);
__ push(rcx);
// fetch_unroll_info needs to call last_java_frame()
__ set_last_Java_frame(rcx, noreg, noreg, NULL);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
// Need to have an oopmap that tells fetch_unroll_info where to
// find any register it might need.
oop_maps->add_gc_map( __ pc()-start, map);
// Discard arg to fetch_unroll_info
__ pop(rcx);
__ get_thread(rcx);
__ reset_last_Java_frame(rcx, false, false);
// Load UnrollBlock into EDI
__ mov(rdi, rax);
// Move the unpack kind to a safe place in the UnrollBlock because
// we are very short of registers
Address unpack_kind(rdi, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes());
// retrieve the deopt kind from where we left it.
__ pop(rax);
__ movl(unpack_kind, rax); // save the unpack_kind value
Label noException;
__ cmpl(rax, Deoptimization::Unpack_exception); // Was exception pending?
__ jcc(Assembler::notEqual, noException);
__ movptr(rax, Address(rcx, JavaThread::exception_oop_offset()));
__ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset()));
__ movptr(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD);
__ movptr(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD);
__ verify_oop(rax);
// Overwrite the result registers with the exception results.
__ movptr(Address(rsp, RegisterSaver::raxOffset()*wordSize), rax);
__ movptr(Address(rsp, RegisterSaver::rdxOffset()*wordSize), rdx);
__ bind(noException);
// Stack is back to only having register save data on the stack.
// Now restore the result registers. Everything else is either dead or captured
// in the vframeArray.
RegisterSaver::restore_result_registers(masm);
// Non standard control word may be leaked out through a safepoint blob, and we can
// deopt at a poll point with the non standard control word. However, we should make
// sure the control word is correct after restore_result_registers.
__ fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
// All of the register save area has been popped of the stack. Only the
// return address remains.
// Pop all the frames we must move/replace.
//
// Frame picture (youngest to oldest)
// 1: self-frame (no frame link)
// 2: deopting frame (no frame link)
// 3: caller of deopting frame (could be compiled/interpreted).
//
// Note: by leaving the return address of self-frame on the stack
// and using the size of frame 2 to adjust the stack
// when we are done the return to frame 3 will still be on the stack.
// Pop deoptimized frame
__ addptr(rsp, Address(rdi,Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes()));
// sp should be pointing at the return address to the caller (3)
// Pick up the initial fp we should save
// restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
__ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
#ifdef ASSERT
// Compilers generate code that bang the stack by as much as the
// interpreter would need. So this stack banging should never
// trigger a fault. Verify that it does not on non product builds.
if (UseStackBanging) {
__ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
__ bang_stack_size(rbx, rcx);
}
#endif
// Load array of frame pcs into ECX
__ movptr(rcx,Address(rdi,Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
__ pop(rsi); // trash the old pc
// Load array of frame sizes into ESI
__ movptr(rsi,Address(rdi,Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes()));
Address counter(rdi, Deoptimization::UnrollBlock::counter_temp_offset_in_bytes());
__ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
__ movl(counter, rbx);
// Now adjust the caller's stack to make up for the extra locals
// but record the original sp so that we can save it in the skeletal interpreter
// frame and the stack walking of interpreter_sender will get the unextended sp
// value and not the "real" sp value.
Address sp_temp(rdi, Deoptimization::UnrollBlock::sender_sp_temp_offset_in_bytes());
__ movptr(sp_temp, rsp);
__ movl2ptr(rbx, Address(rdi, Deoptimization::UnrollBlock::caller_adjustment_offset_in_bytes()));
__ subptr(rsp, rbx);
// Push interpreter frames in a loop
Label loop;
__ bind(loop);
__ movptr(rbx, Address(rsi, 0)); // Load frame size
#ifdef CC_INTERP
__ subptr(rbx, 4*wordSize); // we'll push pc and ebp by hand and
#ifdef ASSERT
__ push(0xDEADDEAD); // Make a recognizable pattern
__ push(0xDEADDEAD);
#else /* ASSERT */
__ subptr(rsp, 2*wordSize); // skip the "static long no_param"
#endif /* ASSERT */
#else /* CC_INTERP */
__ subptr(rbx, 2*wordSize); // we'll push pc and rbp, by hand
#endif /* CC_INTERP */
__ pushptr(Address(rcx, 0)); // save return address
__ enter(); // save old & set new rbp,
__ subptr(rsp, rbx); // Prolog!
__ movptr(rbx, sp_temp); // sender's sp
#ifdef CC_INTERP
__ movptr(Address(rbp,
-(sizeof(BytecodeInterpreter)) + in_bytes(byte_offset_of(BytecodeInterpreter, _sender_sp))),
rbx); // Make it walkable
#else /* CC_INTERP */
// This value is corrected by layout_activation_impl
__ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
__ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), rbx); // Make it walkable
#endif /* CC_INTERP */
__ movptr(sp_temp, rsp); // pass to next frame
__ addptr(rsi, wordSize); // Bump array pointer (sizes)
__ addptr(rcx, wordSize); // Bump array pointer (pcs)
__ decrementl(counter); // decrement counter
__ jcc(Assembler::notZero, loop);
__ pushptr(Address(rcx, 0)); // save final return address
// Re-push self-frame
__ enter(); // save old & set new rbp,
// Return address and rbp, are in place
// We'll push additional args later. Just allocate a full sized
// register save area
__ subptr(rsp, (frame_size_in_words-additional_words - 2) * wordSize);
// Restore frame locals after moving the frame
__ movptr(Address(rsp, RegisterSaver::raxOffset()*wordSize), rax);
__ movptr(Address(rsp, RegisterSaver::rdxOffset()*wordSize), rdx);
__ fstp_d(Address(rsp, RegisterSaver::fpResultOffset()*wordSize)); // Pop float stack and store in local
if( UseSSE>=2 ) __ movdbl(Address(rsp, RegisterSaver::xmm0Offset()*wordSize), xmm0);
if( UseSSE==1 ) __ movflt(Address(rsp, RegisterSaver::xmm0Offset()*wordSize), xmm0);
// Set up the args to unpack_frame
__ pushl(unpack_kind); // get the unpack_kind value
__ get_thread(rcx);
__ push(rcx);
// set last_Java_sp, last_Java_fp
__ set_last_Java_frame(rcx, noreg, rbp, NULL);
// Call C code. Need thread but NOT official VM entry
// crud. We cannot block on this call, no GC can happen. Call should
// restore return values to their stack-slots with the new SP.
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
// Set an oopmap for the call site
oop_maps->add_gc_map( __ pc()-start, new OopMap( frame_size_in_words, 0 ));
// rax, contains the return result type
__ push(rax);
__ get_thread(rcx);
__ reset_last_Java_frame(rcx, false, false);
// Collect return values
__ movptr(rax,Address(rsp, (RegisterSaver::raxOffset() + additional_words + 1)*wordSize));
__ movptr(rdx,Address(rsp, (RegisterSaver::rdxOffset() + additional_words + 1)*wordSize));
// Clear floating point stack before returning to interpreter
__ empty_FPU_stack();
// Check if we should push the float or double return value.
Label results_done, yes_double_value;
__ cmpl(Address(rsp, 0), T_DOUBLE);
__ jcc (Assembler::zero, yes_double_value);
__ cmpl(Address(rsp, 0), T_FLOAT);
__ jcc (Assembler::notZero, results_done);
// return float value as expected by interpreter
if( UseSSE>=1 ) __ movflt(xmm0, Address(rsp, (RegisterSaver::xmm0Offset() + additional_words + 1)*wordSize));
else __ fld_d(Address(rsp, (RegisterSaver::fpResultOffset() + additional_words + 1)*wordSize));
__ jmp(results_done);
// return double value as expected by interpreter
__ bind(yes_double_value);
if( UseSSE>=2 ) __ movdbl(xmm0, Address(rsp, (RegisterSaver::xmm0Offset() + additional_words + 1)*wordSize));
else __ fld_d(Address(rsp, (RegisterSaver::fpResultOffset() + additional_words + 1)*wordSize));
__ bind(results_done);
// Pop self-frame.
__ leave(); // Epilog!
// Jump to interpreter
__ ret(0);
// -------------
// make sure all code is generated
masm->flush();
_deopt_blob = DeoptimizationBlob::create( &buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_in_words);
_deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
}
#ifdef COMPILER2
//------------------------------generate_uncommon_trap_blob--------------------
void SharedRuntime::generate_uncommon_trap_blob() {
// allocate space for the code
ResourceMark rm;
// setup code generation tools
CodeBuffer buffer("uncommon_trap_blob", 512, 512);
MacroAssembler* masm = new MacroAssembler(&buffer);
enum frame_layout {
arg0_off, // thread sp + 0 // Arg location for
arg1_off, // unloaded_class_index sp + 1 // calling C
// The frame sender code expects that rbp will be in the "natural" place and
// will override any oopMap setting for it. We must therefore force the layout
// so that it agrees with the frame sender code.
rbp_off, // callee saved register sp + 2
return_off, // slot for return address sp + 3
framesize
};
address start = __ pc();
if (UseRTMLocking) {
// Abort RTM transaction before possible nmethod deoptimization.
__ xabort(0);
}
// Push self-frame.
__ subptr(rsp, return_off*wordSize); // Epilog!
// rbp, is an implicitly saved callee saved register (i.e. the calling
// convention will save restore it in prolog/epilog) Other than that
// there are no callee save registers no that adapter frames are gone.
__ movptr(Address(rsp, rbp_off*wordSize), rbp);
// Clear the floating point exception stack
__ empty_FPU_stack();
// set last_Java_sp
__ get_thread(rdx);
__ set_last_Java_frame(rdx, noreg, noreg, NULL);
// Call C code. Need thread but NOT official VM entry
// crud. We cannot block on this call, no GC can happen. Call should
// capture callee-saved registers as well as return values.
__ movptr(Address(rsp, arg0_off*wordSize), rdx);
// argument already in ECX
__ movl(Address(rsp, arg1_off*wordSize),rcx);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
// Set an oopmap for the call site
OopMapSet *oop_maps = new OopMapSet();
OopMap* map = new OopMap( framesize, 0 );
// No oopMap for rbp, it is known implicitly
oop_maps->add_gc_map( __ pc()-start, map);
__ get_thread(rcx);
__ reset_last_Java_frame(rcx, false, false);
// Load UnrollBlock into EDI
__ movptr(rdi, rax);
// Pop all the frames we must move/replace.
//
// Frame picture (youngest to oldest)
// 1: self-frame (no frame link)
// 2: deopting frame (no frame link)
// 3: caller of deopting frame (could be compiled/interpreted).
// Pop self-frame. We have no frame, and must rely only on EAX and ESP.
__ addptr(rsp,(framesize-1)*wordSize); // Epilog!
// Pop deoptimized frame
__ movl2ptr(rcx, Address(rdi,Deoptimization::UnrollBlock::size_of_deoptimized_frame_offset_in_bytes()));
__ addptr(rsp, rcx);
// sp should be pointing at the return address to the caller (3)
// Pick up the initial fp we should save
// restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
__ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
#ifdef ASSERT
// Compilers generate code that bang the stack by as much as the
// interpreter would need. So this stack banging should never
// trigger a fault. Verify that it does not on non product builds.
if (UseStackBanging) {
__ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
__ bang_stack_size(rbx, rcx);
}
#endif
// Load array of frame pcs into ECX
__ movl(rcx,Address(rdi,Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
__ pop(rsi); // trash the pc
// Load array of frame sizes into ESI
__ movptr(rsi,Address(rdi,Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes()));
Address counter(rdi, Deoptimization::UnrollBlock::counter_temp_offset_in_bytes());
__ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
__ movl(counter, rbx);
// Now adjust the caller's stack to make up for the extra locals
// but record the original sp so that we can save it in the skeletal interpreter
// frame and the stack walking of interpreter_sender will get the unextended sp
// value and not the "real" sp value.
Address sp_temp(rdi, Deoptimization::UnrollBlock::sender_sp_temp_offset_in_bytes());
__ movptr(sp_temp, rsp);
__ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::caller_adjustment_offset_in_bytes()));
__ subptr(rsp, rbx);
// Push interpreter frames in a loop
Label loop;
__ bind(loop);
__ movptr(rbx, Address(rsi, 0)); // Load frame size
#ifdef CC_INTERP
__ subptr(rbx, 4*wordSize); // we'll push pc and ebp by hand and
#ifdef ASSERT
__ push(0xDEADDEAD); // Make a recognizable pattern
__ push(0xDEADDEAD); // (parm to RecursiveInterpreter...)
#else /* ASSERT */
__ subptr(rsp, 2*wordSize); // skip the "static long no_param"
#endif /* ASSERT */
#else /* CC_INTERP */
__ subptr(rbx, 2*wordSize); // we'll push pc and rbp, by hand
#endif /* CC_INTERP */
__ pushptr(Address(rcx, 0)); // save return address
__ enter(); // save old & set new rbp,
__ subptr(rsp, rbx); // Prolog!
__ movptr(rbx, sp_temp); // sender's sp
#ifdef CC_INTERP
__ movptr(Address(rbp,
-(sizeof(BytecodeInterpreter)) + in_bytes(byte_offset_of(BytecodeInterpreter, _sender_sp))),
rbx); // Make it walkable
#else /* CC_INTERP */
// This value is corrected by layout_activation_impl
__ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD );
__ movptr(Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize), rbx); // Make it walkable
#endif /* CC_INTERP */
__ movptr(sp_temp, rsp); // pass to next frame
__ addptr(rsi, wordSize); // Bump array pointer (sizes)
__ addptr(rcx, wordSize); // Bump array pointer (pcs)
__ decrementl(counter); // decrement counter
__ jcc(Assembler::notZero, loop);
__ pushptr(Address(rcx, 0)); // save final return address
// Re-push self-frame
__ enter(); // save old & set new rbp,
__ subptr(rsp, (framesize-2) * wordSize); // Prolog!
// set last_Java_sp, last_Java_fp
__ get_thread(rdi);
__ set_last_Java_frame(rdi, noreg, rbp, NULL);
// Call C code. Need thread but NOT official VM entry
// crud. We cannot block on this call, no GC can happen. Call should
// restore return values to their stack-slots with the new SP.
__ movptr(Address(rsp,arg0_off*wordSize),rdi);
__ movl(Address(rsp,arg1_off*wordSize), Deoptimization::Unpack_uncommon_trap);
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
// Set an oopmap for the call site
oop_maps->add_gc_map( __ pc()-start, new OopMap( framesize, 0 ) );
__ get_thread(rdi);
__ reset_last_Java_frame(rdi, true, false);
// Pop self-frame.
__ leave(); // Epilog!
// Jump to interpreter
__ ret(0);
// -------------
// make sure all code is generated
masm->flush();
_uncommon_trap_blob = UncommonTrapBlob::create(&buffer, oop_maps, framesize);
}
#endif // COMPILER2
//------------------------------generate_handler_blob------
//
// Generate a special Compile2Runtime blob that saves all registers,
// setup oopmap, and calls safepoint code to stop the compiled code for
// a safepoint.
//
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
// Account for thread arg in our frame
const int additional_words = 1;
int frame_size_in_words;
assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before");
ResourceMark rm;
OopMapSet *oop_maps = new OopMapSet();
OopMap* map;
// allocate space for the code
// setup code generation tools
CodeBuffer buffer("handler_blob", 1024, 512);
MacroAssembler* masm = new MacroAssembler(&buffer);
const Register java_thread = rdi; // callee-saved for VC++
address start = __ pc();
address call_pc = NULL;
bool cause_return = (poll_type == POLL_AT_RETURN);
bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
if (UseRTMLocking) {
// Abort RTM transaction before calling runtime
// because critical section will be large and will be
// aborted anyway. Also nmethod could be deoptimized.
__ xabort(0);
}
// If cause_return is true we are at a poll_return and there is
// the return address on the stack to the caller on the nmethod
// that is safepoint. We can leave this return on the stack and
// effectively complete the return and safepoint in the caller.
// Otherwise we push space for a return address that the safepoint
// handler will install later to make the stack walking sensible.
if (!cause_return)
__ push(rbx); // Make room for return address (or push it again)
map = RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words, false, save_vectors);
// The following is basically a call_VM. However, we need the precise
// address of the call in order to generate an oopmap. Hence, we do all the
// work ourselves.
// Push thread argument and setup last_Java_sp
__ get_thread(java_thread);
__ push(java_thread);
__ set_last_Java_frame(java_thread, noreg, noreg, NULL);
// if this was not a poll_return then we need to correct the return address now.
if (!cause_return) {
__ movptr(rax, Address(java_thread, JavaThread::saved_exception_pc_offset()));
__ movptr(Address(rbp, wordSize), rax);
}
// do the call
__ call(RuntimeAddress(call_ptr));
// Set an oopmap for the call site. This oopmap will map all
// oop-registers and debug-info registers as callee-saved. This
// will allow deoptimization at this safepoint to find all possible
// debug-info recordings, as well as let GC find all oops.
oop_maps->add_gc_map( __ pc() - start, map);
// Discard arg
__ pop(rcx);
Label noException;
// Clear last_Java_sp again
__ get_thread(java_thread);
__ reset_last_Java_frame(java_thread, false, false);
__ cmpptr(Address(java_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
__ jcc(Assembler::equal, noException);
// Exception pending
RegisterSaver::restore_live_registers(masm, save_vectors);
__ jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
__ bind(noException);
// Normal exit, register restoring and exit
RegisterSaver::restore_live_registers(masm, save_vectors);
__ ret(0);
// make sure all code is generated
masm->flush();
// Fill-out other meta info
return SafepointBlob::create(&buffer, oop_maps, frame_size_in_words);
}
//
// generate_resolve_blob - call resolution (static/virtual/opt-virtual/ic-miss
//
// Generate a stub that calls into vm to find out the proper destination
// of a java call. All the argument registers are live at this point
// but since this is generic code we don't know what they are and the caller
// must do any gc of the args.
//
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before");
// allocate space for the code
ResourceMark rm;
CodeBuffer buffer(name, 1000, 512);
MacroAssembler* masm = new MacroAssembler(&buffer);
int frame_size_words;
enum frame_layout {
thread_off,
extra_words };
OopMapSet *oop_maps = new OopMapSet();
OopMap* map = NULL;
int start = __ offset();
map = RegisterSaver::save_live_registers(masm, extra_words, &frame_size_words);
int frame_complete = __ offset();
const Register thread = rdi;
__ get_thread(rdi);
__ push(thread);
__ set_last_Java_frame(thread, noreg, rbp, NULL);
__ call(RuntimeAddress(destination));
// Set an oopmap for the call site.
// We need this not only for callee-saved registers, but also for volatile
// registers that the compiler might be keeping live across a safepoint.
oop_maps->add_gc_map( __ offset() - start, map);
// rax, contains the address we are going to jump to assuming no exception got installed
__ addptr(rsp, wordSize);
// clear last_Java_sp
__ reset_last_Java_frame(thread, true, false);
// check for pending exceptions
Label pending;
__ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
__ jcc(Assembler::notEqual, pending);
// get the returned Method*
__ get_vm_result_2(rbx, thread);
__ movptr(Address(rsp, RegisterSaver::rbx_offset() * wordSize), rbx);
__ movptr(Address(rsp, RegisterSaver::rax_offset() * wordSize), rax);
RegisterSaver::restore_live_registers(masm);
// We are back the the original state on entry and ready to go.
__ jmp(rax);
// Pending exception after the safepoint
__ bind(pending);
RegisterSaver::restore_live_registers(masm);
// exception pending => remove activation and forward to exception handler
__ get_thread(thread);
__ movptr(Address(thread, JavaThread::vm_result_offset()), NULL_WORD);
__ movptr(rax, Address(thread, Thread::pending_exception_offset()));
__ jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
// -------------
// make sure all code is generated
masm->flush();
// return the blob
// frame_size_words or bytes??
return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_words, oop_maps, true);
}
| netroby/jdk9-shenandoah-hotspot | src/cpu/x86/vm/sharedRuntime_x86_32.cpp | C++ | gpl-2.0 | 120,443 |
/**
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2013 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
* choose the license that best suits your project and use it accordingly.
*
* Although not required, the author would appreciate an email letting him
* know of any substantial use of jqPlot. You can reach the author at:
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
*
* If you are feeling kind and generous, consider supporting the project by
* making a donation at: http://www.jqplot.com/donate.php .
*
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
*
* version 2007.04.27
* author Ash Searle
* http://hexmen.com/blog/2007/03/printf-sprintf/
* http://hexmen.com/js/sprintf.js
* The author (Ash Searle) has placed this code in the public domain:
* "This code is unrestricted: you are free to use it however you like."
*
*/
(function ($) {
/**
* Class: $.jqplot.MekkoRenderer
* Draws a Mekko style chart which shows 3 dimensional data on a 2 dimensional graph.
* the <$.jqplot.MekkoAxisRenderer> should be used with mekko charts. The mekko renderer
* overrides the default legend renderer with its own $.jqplot.MekkoLegendRenderer
* which allows more flexibility to specify number of rows and columns in the legend.
*
* Data is specified per bar in the chart. You can specify data as an array of y values, or as
* an array of [label, value] pairs. Note that labels are used only on the first series.
* Labels on subsequent series are ignored:
*
* > bar1 = [['shirts', 8],['hats', 14],['shoes', 6],['gloves', 16],['dolls', 12]];
* > bar2 = [15,6,9,13,6];
* > bar3 = [['grumpy',4],['sneezy',2],['happy',7],['sleepy',9],['doc',7]];
*
* If you want to place labels for each bar under the axis, you use the barLabels option on
* the axes. The bar labels can be styled with the ".jqplot-mekko-barLabel" css class.
*
* > barLabels = ['Mickey Mouse', 'Donald Duck', 'Goofy'];
* > axes:{xaxis:{barLabels:barLabels}}
*
*/
$.jqplot.MekkoRenderer = function () {
this.shapeRenderer = new $.jqplot.ShapeRenderer();
// prop: borderColor
// color of the borders between areas on the chart
this.borderColor = null;
// prop: showBorders
// True to draw borders lines between areas on the chart.
// False will draw borders lines with the same color as the area.
this.showBorders = true;
};
// called with scope of series.
$.jqplot.MekkoRenderer.prototype.init = function (options, plot) {
this.fill = false;
this.fillRect = true;
this.strokeRect = true;
this.shadow = false;
// width of bar on x axis.
this._xwidth = 0;
this._xstart = 0;
$.extend(true, this.renderer, options);
// set the shape renderer options
var opts = {lineJoin: 'miter', lineCap: 'butt', isarc: false, fillRect: this.fillRect, strokeRect: this.strokeRect};
this.renderer.shapeRenderer.init(opts);
plot.axes.x2axis._series.push(this);
this._type = 'mekko';
};
// Method: setGridData
// converts the user data values to grid coordinates and stores them
// in the gridData array. Will convert user data into appropriate
// rectangles.
// Called with scope of a series.
$.jqplot.MekkoRenderer.prototype.setGridData = function (plot) {
// recalculate the grid data
var xp = this._xaxis.series_u2p;
var yp = this._yaxis.series_u2p;
var data = this._plotData;
this.gridData = [];
// figure out width on x axis.
// this._xwidth = this._sumy / plot._sumy * this.canvas.getWidth();
this._xwidth = xp(this._sumy) - xp(0);
if (this.index > 0) {
this._xstart = plot.series[this.index - 1]._xstart + plot.series[this.index - 1]._xwidth;
}
var totheight = this.canvas.getHeight();
var sumy = 0;
var cury;
var curheight;
for (var i = 0; i < data.length; i++) {
if (data[i] != null) {
sumy += data[i][1];
cury = totheight - (sumy / this._sumy * totheight);
curheight = data[i][1] / this._sumy * totheight;
this.gridData.push([this._xstart, cury, this._xwidth, curheight]);
}
}
};
// Method: makeGridData
// converts any arbitrary data values to grid coordinates and
// returns them. This method exists so that plugins can use a series'
// linerenderer to generate grid data points without overwriting the
// grid data associated with that series.
// Called with scope of a series.
$.jqplot.MekkoRenderer.prototype.makeGridData = function (data, plot) {
// recalculate the grid data
// figure out width on x axis.
var xp = this._xaxis.series_u2p;
var totheight = this.canvas.getHeight();
var sumy = 0;
var cury;
var curheight;
var gd = [];
for (var i = 0; i < data.length; i++) {
if (data[i] != null) {
sumy += data[i][1];
cury = totheight - (sumy / this._sumy * totheight);
curheight = data[i][1] / this._sumy * totheight;
gd.push([this._xstart, cury, this._xwidth, curheight]);
}
}
return gd;
};
// called within scope of series.
$.jqplot.MekkoRenderer.prototype.draw = function (ctx, gd, options) {
var i;
var opts = (options != undefined) ? options : {};
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
ctx.save();
if (gd.length) {
if (showLine) {
for (i = 0; i < gd.length; i++) {
opts.fillStyle = colorGenerator.next();
if (this.renderer.showBorders) {
opts.strokeStyle = this.renderer.borderColor;
}
else {
opts.strokeStyle = opts.fillStyle;
}
this.renderer.shapeRenderer.draw(ctx, gd[i], opts);
}
}
}
ctx.restore();
};
$.jqplot.MekkoRenderer.prototype.drawShadow = function (ctx, gd, options) {
// This is a no-op, no shadows on mekko charts.
};
/**
* Class: $.jqplot.MekkoLegendRenderer
* Legend renderer used by mekko charts with options for
* controlling number or rows and columns as well as placement
* outside of plot area.
*
*/
$.jqplot.MekkoLegendRenderer = function () {
//
};
$.jqplot.MekkoLegendRenderer.prototype.init = function (options) {
// prop: numberRows
// Maximum number of rows in the legend. 0 or null for unlimited.
this.numberRows = null;
// prop: numberColumns
// Maximum number of columns in the legend. 0 or null for unlimited.
this.numberColumns = null;
// this will override the placement option on the Legend object
this.placement = "outside";
$.extend(true, this, options);
};
// called with scope of legend
$.jqplot.MekkoLegendRenderer.prototype.draw = function () {
var legend = this;
if (this.show) {
var series = this._series;
var ss = 'position:absolute;';
ss += (this.background) ? 'background:' + this.background + ';' : '';
ss += (this.border) ? 'border:' + this.border + ';' : '';
ss += (this.fontSize) ? 'font-size:' + this.fontSize + ';' : '';
ss += (this.fontFamily) ? 'font-family:' + this.fontFamily + ';' : '';
ss += (this.textColor) ? 'color:' + this.textColor + ';' : '';
this._elem = $('<table class="jqplot-table-legend" style="' + ss + '"></table>');
// Mekko charts legends don't go by number of series, but by number of data points
// in the series. Refactor things here for that.
var pad = false,
reverse = true, // mekko charts are always stacked, so reverse
nr, nc;
var s = series[0];
var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
if (s.show) {
var pd = s.data;
if (this.numberRows) {
nr = this.numberRows;
if (!this.numberColumns) {
nc = Math.ceil(pd.length / nr);
}
else {
nc = this.numberColumns;
}
}
else if (this.numberColumns) {
nc = this.numberColumns;
nr = Math.ceil(pd.length / this.numberColumns);
}
else {
nr = pd.length;
nc = 1;
}
var i, j, tr, td1, td2, lt, rs, color;
var idx = 0;
for (i = 0; i < nr; i++) {
if (reverse) {
tr = $('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem);
}
else {
tr = $('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem);
}
for (j = 0; j < nc; j++) {
if (idx < pd.length) {
lt = this.labels[idx] || pd[idx][0].toString();
color = colorGenerator.next();
if (!reverse) {
if (i > 0) {
pad = true;
}
else {
pad = false;
}
}
else {
if (i == nr - 1) {
pad = false;
}
else {
pad = true;
}
}
rs = (pad) ? this.rowSpacing : '0';
td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:' + rs + ';">' +
'<div><div class="jqplot-table-legend-swatch" style="border-color:' + color + ';"></div>' +
'</div></td>');
td2 = $('<td class="jqplot-table-legend" style="padding-top:' + rs + ';"></td>');
if (this.escapeHtml) {
td2.text(lt);
}
else {
td2.html(lt);
}
if (reverse) {
td2.prependTo(tr);
td1.prependTo(tr);
}
else {
td1.appendTo(tr);
td2.appendTo(tr);
}
pad = true;
}
idx++;
}
}
tr = null;
td1 = null;
td2 = null;
}
}
return this._elem;
};
$.jqplot.MekkoLegendRenderer.prototype.pack = function (offsets) {
if (this.show) {
// fake a grid for positioning
var grid = {_top: offsets.top, _left: offsets.left, _right: offsets.right, _bottom: this._plotDimensions.height - offsets.bottom};
if (this.placement == 'insideGrid') {
switch (this.location) {
case 'nw':
var a = grid._left + this.xoffset;
var b = grid._top + this.yoffset;
this._elem.css('left', a);
this._elem.css('top', b);
break;
case 'n':
var a = (offsets.left + (this._plotDimensions.width - offsets.right)) / 2 - this.getWidth() / 2;
var b = grid._top + this.yoffset;
this._elem.css('left', a);
this._elem.css('top', b);
break;
case 'ne':
var a = offsets.right + this.xoffset;
var b = grid._top + this.yoffset;
this._elem.css({right: a, top: b});
break;
case 'e':
var a = offsets.right + this.xoffset;
var b = (offsets.top + (this._plotDimensions.height - offsets.bottom)) / 2 - this.getHeight() / 2;
this._elem.css({right: a, top: b});
break;
case 'se':
var a = offsets.right + this.xoffset;
var b = offsets.bottom + this.yoffset;
this._elem.css({right: a, bottom: b});
break;
case 's':
var a = (offsets.left + (this._plotDimensions.width - offsets.right)) / 2 - this.getWidth() / 2;
var b = offsets.bottom + this.yoffset;
this._elem.css({left: a, bottom: b});
break;
case 'sw':
var a = grid._left + this.xoffset;
var b = offsets.bottom + this.yoffset;
this._elem.css({left: a, bottom: b});
break;
case 'w':
var a = grid._left + this.xoffset;
var b = (offsets.top + (this._plotDimensions.height - offsets.bottom)) / 2 - this.getHeight() / 2;
this._elem.css({left: a, top: b});
break;
default: // same as 'se'
var a = grid._right - this.xoffset;
var b = grid._bottom + this.yoffset;
this._elem.css({right: a, bottom: b});
break;
}
}
else {
switch (this.location) {
case 'nw':
var a = this._plotDimensions.width - grid._left + this.xoffset;
var b = grid._top + this.yoffset;
this._elem.css('right', a);
this._elem.css('top', b);
break;
case 'n':
var a = (offsets.left + (this._plotDimensions.width - offsets.right)) / 2 - this.getWidth() / 2;
var b = this._plotDimensions.height - grid._top + this.yoffset;
this._elem.css('left', a);
this._elem.css('bottom', b);
break;
case 'ne':
var a = this._plotDimensions.width - offsets.right + this.xoffset;
var b = grid._top + this.yoffset;
this._elem.css({left: a, top: b});
break;
case 'e':
var a = this._plotDimensions.width - offsets.right + this.xoffset;
var b = (offsets.top + (this._plotDimensions.height - offsets.bottom)) / 2 - this.getHeight() / 2;
this._elem.css({left: a, top: b});
break;
case 'se':
var a = this._plotDimensions.width - offsets.right + this.xoffset;
var b = offsets.bottom + this.yoffset;
this._elem.css({left: a, bottom: b});
break;
case 's':
var a = (offsets.left + (this._plotDimensions.width - offsets.right)) / 2 - this.getWidth() / 2;
var b = this._plotDimensions.height - offsets.bottom + this.yoffset;
this._elem.css({left: a, top: b});
break;
case 'sw':
var a = this._plotDimensions.width - grid._left + this.xoffset;
var b = offsets.bottom + this.yoffset;
this._elem.css({right: a, bottom: b});
break;
case 'w':
var a = this._plotDimensions.width - grid._left + this.xoffset;
var b = (offsets.top + (this._plotDimensions.height - offsets.bottom)) / 2 - this.getHeight() / 2;
this._elem.css({right: a, top: b});
break;
default: // same as 'se'
var a = grid._right - this.xoffset;
var b = grid._bottom + this.yoffset;
this._elem.css({right: a, bottom: b});
break;
}
}
}
};
// setup default renderers for axes and legend so user doesn't have to
// called with scope of plot
function preInit(target, data, options) {
options = options || {};
options.axesDefaults = options.axesDefaults || {};
options.legend = options.legend || {};
options.seriesDefaults = options.seriesDefaults || {};
var setopts = false;
if (options.seriesDefaults.renderer == $.jqplot.MekkoRenderer) {
setopts = true;
}
else if (options.series) {
for (var i = 0; i < options.series.length; i++) {
if (options.series[i].renderer == $.jqplot.MekkoRenderer) {
setopts = true;
}
}
}
if (setopts) {
options.axesDefaults.renderer = $.jqplot.MekkoAxisRenderer;
options.legend.renderer = $.jqplot.MekkoLegendRenderer;
options.legend.preDraw = true;
}
}
$.jqplot.preInitHooks.push(preInit);
})(jQuery);
| Mariana3/CultExcelEnterprise | web/js/jqPlot/plugins/jqplot.mekkoRenderer.js | JavaScript | gpl-2.0 | 18,942 |
<?php // $Id$
require_once("../../config.php");
$id = required_param('id', PARAM_INT); // Course module ID
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
print_error('invalidcoursemodule');
}
if (! $quiz = $DB->get_record('quiz', array('id' => $cm->instance))) {
print_error('invalidquizid');
}
if (! $course = $DB->get_record('course', array('id' => $quiz->course))) {
print_error('coursemisconf');
}
require_login($course->id, false, $cm);
if (has_capability('mod/quiz:viewreports', get_context_instance(CONTEXT_MODULE, $cm->id))) {
redirect('report.php?id='.$cm->id);
} else {
redirect('view.php?id='.$cm->id);
}
?>
| cwaclawik/moodle | mod/quiz/grade.php | PHP | gpl-2.0 | 733 |
#!/usr/bin/python
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# Typical usage:
# dohtml -r docs/*
# - put all files and directories in docs into /usr/share/doc/${PF}/html
# dohtml foo.html
# - put foo.html into /usr/share/doc/${PF}/html
#
#
# Detailed usage:
# dohtml <list-of-files>
# - will install the files in the list of files (space-separated list) into
# /usr/share/doc/${PF}/html, provided the file ends in .css, .gif, .htm,
# .html, .jpeg, .jpg, .js or .png.
# dohtml -r <list-of-files-and-directories>
# - will do as 'dohtml', but recurse into all directories, as long as the
# directory name is not CVS
# dohtml -A jpe,java [-r] <list-of-files[-and-directories]>
# - will do as 'dohtml' but add .jpe,.java (default filter list is
# added to your list)
# dohtml -a png,gif,html,htm [-r] <list-of-files[-and-directories]>
# - will do as 'dohtml' but filter on .png,.gif,.html,.htm (default filter
# list is ignored)
# dohtml -x CVS,SCCS,RCS -r <list-of-files-and-directories>
# - will do as 'dohtml -r', but ignore directories named CVS, SCCS, RCS
#
from __future__ import print_function
import os
import shutil
import sys
from portage.util import normalize_path
# Change back to original cwd _after_ all imports (bug #469338).
os.chdir(os.environ["__PORTAGE_HELPER_CWD"])
def dodir(path):
try:
os.makedirs(path, 0o755)
except OSError:
if not os.path.isdir(path):
raise
os.chmod(path, 0o755)
def dofile(src,dst):
shutil.copy(src, dst)
os.chmod(dst, 0o644)
def eqawarn(lines):
cmd = "source '%s/isolated-functions.sh' ; " % \
os.environ["PORTAGE_BIN_PATH"]
for line in lines:
cmd += "eqawarn \"%s\" ; " % line
os.spawnlp(os.P_WAIT, "bash", "bash", "-c", cmd)
skipped_directories = []
skipped_files = []
warn_on_skipped_files = os.environ.get("PORTAGE_DOHTML_WARN_ON_SKIPPED_FILES") is not None
unwarned_skipped_extensions = os.environ.get("PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS", "").split()
unwarned_skipped_files = os.environ.get("PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES", "").split()
def install(basename, dirname, options, prefix=""):
fullpath = basename
if prefix:
fullpath = os.path.join(prefix, fullpath)
if dirname:
fullpath = os.path.join(dirname, fullpath)
if options.DOCDESTTREE:
desttree = options.DOCDESTTREE
else:
desttree = "html"
destdir = os.path.join(options.ED, "usr", "share", "doc",
options.PF.lstrip(os.sep), desttree.lstrip(os.sep),
options.doc_prefix.lstrip(os.sep), prefix).rstrip(os.sep)
if not os.path.exists(fullpath):
sys.stderr.write("!!! dohtml: %s does not exist\n" % fullpath)
return False
elif os.path.isfile(fullpath):
ext = os.path.splitext(basename)[1][1:]
if ext in options.allowed_exts or basename in options.allowed_files:
dodir(destdir)
dofile(fullpath, os.path.join(destdir, basename))
elif warn_on_skipped_files and ext not in unwarned_skipped_extensions and basename not in unwarned_skipped_files:
skipped_files.append(fullpath)
elif options.recurse and os.path.isdir(fullpath) and \
basename not in options.disallowed_dirs:
for i in os.listdir(fullpath):
pfx = basename
if prefix:
pfx = os.path.join(prefix, pfx)
install(i, dirname, options, pfx)
elif not options.recurse and os.path.isdir(fullpath):
global skipped_directories
skipped_directories.append(fullpath)
return False
else:
return False
return True
class OptionsClass:
def __init__(self):
self.PF = ""
self.ED = ""
self.DOCDESTTREE = ""
if "PF" in os.environ:
self.PF = os.environ["PF"]
if self.PF:
self.PF = normalize_path(self.PF)
if "force-prefix" not in os.environ.get("FEATURES", "").split() and \
os.environ.get("EAPI", "0") in ("0", "1", "2"):
self.ED = os.environ.get("D", "")
else:
self.ED = os.environ.get("ED", "")
if self.ED:
self.ED = normalize_path(self.ED)
if "_E_DOCDESTTREE_" in os.environ:
self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
if self.DOCDESTTREE:
self.DOCDESTTREE = normalize_path(self.DOCDESTTREE)
self.allowed_exts = ['css', 'gif', 'htm', 'html', 'jpeg', 'jpg', 'js', 'png']
if os.environ.get("EAPI", "0") in ("4-python", "5-progress"):
self.allowed_exts += ['ico', 'svg', 'xhtml', 'xml']
self.allowed_files = []
self.disallowed_dirs = ['CVS']
self.recurse = False
self.verbose = False
self.doc_prefix = ""
def print_help():
opts = OptionsClass()
print("dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]")
print(" [-r] [-V] <file> [file ...]")
print()
print(" -a Set the list of allowed to those that are specified.")
print(" Default:", ",".join(opts.allowed_exts))
print(" -A Extend the list of allowed file types.")
print(" -f Set list of allowed extensionless file names.")
print(" -x Set directories to be excluded from recursion.")
print(" Default:", ",".join(opts.disallowed_dirs))
print(" -p Set a document prefix for installed files (empty by default).")
print(" -r Install files and directories recursively.")
print(" -V Be verbose.")
print()
def parse_args():
options = OptionsClass()
args = []
x = 1
while x < len(sys.argv):
arg = sys.argv[x]
if arg in ["-h","-r","-V"]:
if arg == "-h":
print_help()
sys.exit(0)
elif arg == "-r":
options.recurse = True
elif arg == "-V":
options.verbose = True
elif sys.argv[x] in ["-A","-a","-f","-x","-p"]:
x += 1
if x == len(sys.argv):
print_help()
sys.exit(0)
elif arg == "-p":
options.doc_prefix = sys.argv[x]
if options.doc_prefix:
options.doc_prefix = normalize_path(options.doc_prefix)
else:
values = sys.argv[x].split(",")
if arg == "-A":
options.allowed_exts.extend(values)
elif arg == "-a":
options.allowed_exts = values
elif arg == "-f":
options.allowed_files = values
elif arg == "-x":
options.disallowed_dirs = values
else:
args.append(sys.argv[x])
x += 1
return (options, args)
def main():
(options, args) = parse_args()
if options.verbose:
print("Allowed extensions:", options.allowed_exts)
print("Document prefix : '" + options.doc_prefix + "'")
print("Allowed files :", options.allowed_files)
success = False
endswith_slash = (os.sep, os.sep + ".")
for x in args:
trailing_slash = x.endswith(endswith_slash)
x = normalize_path(x)
if trailing_slash:
# Modify behavior of basename and dirname
# as noted in bug #425214, causing foo/ to
# behave similarly to the way that foo/*
# behaves.
x += os.sep
basename = os.path.basename(x)
dirname = os.path.dirname(x)
success |= install(basename, dirname, options)
for x in skipped_directories:
eqawarn(["QA Notice: dohtml on directory '%s' without recursion option" % x])
for x in skipped_files:
eqawarn(["dohtml: skipped file '%s'" % x])
if success:
retcode = 0
else:
retcode = 1
sys.exit(retcode)
if __name__ == "__main__":
main()
| prometheanfire/portage | bin/dohtml.py | Python | gpl-2.0 | 6,987 |
/* packet-starteam.c
* Routines for Borland StarTeam packet dissection
*
* metatech <metatech[AT]flashmail.com>
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* StarTeam in a nutshell
*
* StarTeam is a Software Change & Configuration Management Tool (like CVS)
*/
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/prefs.h>
#include "packet-tcp.h"
static int proto_starteam = -1;
static int hf_starteam_mdh_session_tag = -1;
static int hf_starteam_mdh_ctimestamp = -1;
static int hf_starteam_mdh_flags = -1;
static int hf_starteam_mdh_keyid = -1;
static int hf_starteam_mdh_reserved = -1;
static int hf_starteam_ph_signature = -1;
static int hf_starteam_ph_packet_size = -1;
static int hf_starteam_ph_data_size = -1;
static int hf_starteam_ph_data_flags = -1;
static int hf_starteam_id_revision_level = -1;
static int hf_starteam_id_client = -1;
static int hf_starteam_id_connect = -1;
static int hf_starteam_id_component = -1;
static int hf_starteam_id_command = -1;
static int hf_starteam_id_command_time = -1;
static int hf_starteam_id_command_userid = -1;
static int hf_starteam_data_data = -1;
static gint ett_starteam = -1;
static gint ett_starteam_mdh = -1;
static gint ett_starteam_ph = -1;
static gint ett_starteam_id = -1;
static gint ett_starteam_data = -1;
static dissector_handle_t starteam_tcp_handle;
static gboolean starteam_desegment = TRUE;
#define STARTEAM_MAGIC 0x416C616E /* "Alan" */
#define STARTEAM_SRVR_CMD_GET_SESSION_TAG 1
#define STARTEAM_SRVR_CMD_GET_REQUIRED_ENCRYPTION_LEVEL 2
#define STARTEAM_SRVR_CMD_GET_SERVER_PARAMS 3
#define STARTEAM_SRVR_CMD_SERVER_CONNECT 4
#define STARTEAM_SRVR_CMD_SERVER_RECONNECT 5
#define STARTEAM_SRVR_CMD_BEGIN_LOGIN 10
#define STARTEAM_SRVR_CMD_KEY_EXCHANGE_PHASE0 11
#define STARTEAM_SRVR_CMD_KEY_EXCHANGE_PHASE12 12
#define STARTEAM_SRVR_CMD_KEY_EXCHANGE_PHASE3 13
#define STARTEAM_SRVR_CMD_SERVER_LOGIN 14
#define STARTEAM_SRVR_CMD_GET_PROJECT_LIST 1001
#define STARTEAM_SRVR_CMD_GET_PROJECT_VIEWS 1002
#define STARTEAM_SRVR_CMD_PROJECT_LOGIN 1011
#define STARTEAM_SRVR_CMD_PROJECT_LOGOUT 1013
#define STARTEAM_PROJ_CMD_LIST_SET_READ 1014
#define STARTEAM_PROJ_CMD_LIST_ADD_ATTACHMENT 1015
#define STARTEAM_PROJ_CMD_LIST_GET_ATTACHMENT 1016
#define STARTEAM_PROJ_CMD_LIST_REMOVE_ATTACHMENT 1017
#define STARTEAM_PROJ_CMD_MAIL_LIST_ITEMS 1018
#define STARTEAM_PROJ_CMD_LIST_ANY_NEWITEMS 1020
#define STARTEAM_PROJ_CMD_LIST_GET_NEWITEMS 1021
#define STARTEAM_SRVR_CMD_RELEASE_CLIENT 1021 /* XXX: ?? */
#define STARTEAM_SRVR_CMD_UPDATE_SERVER_INFO 1022
#define STARTEAM_SRVR_CMD_GET_USAGE_DATA 1023
#define STARTEAM_SRVR_CMD_GET_LICENSE_INFO 1024
#define STARTEAM_PROJ_CMD_FILTER_ADD 1030
#define STARTEAM_PROJ_CMD_FILTER_MODIFY 1031
#define STARTEAM_PROJ_CMD_FILTER_GET 1032
#define STARTEAM_PROJ_CMD_FILTER_GET_LIST 1033
#define STARTEAM_PROJ_CMD_FILTER_DELETE 1034
#define STARTEAM_PROJ_CMD_QUERY_ADD 1035
#define STARTEAM_PROJ_CMD_QUERY_MODIFY 1036
#define STARTEAM_PROJ_CMD_QUERY_GET 1037
#define STARTEAM_PROJ_CMD_QUERY_GET_LIST 1038
#define STARTEAM_PROJ_CMD_QUERY_DELETE 1039
#define STARTEAM_PROJ_GET_FILTER_CLASS_ID 1040
#define STARTEAM_PROJ_GET_QUERY_CLASS_ID 1041
#define STARTEAM_SRVR_CMD_PROJECT_CREATE 1051
#define STARTEAM_SRVR_CMD_PROJECT_OPEN 1052
#define STARTEAM_SRVR_CMD_PROJECT_CLOSE 1053
#define STARTEAM_PROJ_CMD_CATALOG_LOADALL 1151
#define STARTEAM_PROJ_CMD_CATALOG_LOADSET 1152
#define STARTEAM_PROJ_CMD_CATALOG_LOADREGISTEREDCLASSES 1154
#define STARTEAM_PROJ_CMD_REFRESH_CLASS_INFO 1160
#define STARTEAM_PROJ_CMD_ADD_CUSTOM_FIELD_CLASS_INFO 1161
#define STARTEAM_PROJ_CMD_MODIFY_FIELD_CLASS_INFO 1162
#define STARTEAM_PROJ_CMD_ADD_CUSTOM_FIELD_CLASS_INFO_EX 1163
#define STARTEAM_PROJ_CMD_GET_FOLDER_ITEMS 2001
#define STARTEAM_SRVR_CMD_GET_USERS_AND_GROUPS 2001 /* XXX: ?? */
#define STARTEAM_PROJ_CMD_REFRESH_ITEMS 2002
#define STARTEAM_PROJ_CMD_GET_ITEM 2003
#define STARTEAM_SRVR_CMD_GET_EMAIL_USERS 2003 /* XXX: ?? */
#define STARTEAM_PROJ_CMD_UPDATE_ITEM 2004
#define STARTEAM_PROJ_CMD_DELETE_ITEM 2005
#define STARTEAM_PROJ_CMD_SET_ITEM_LOCK 2006
#define STARTEAM_PROJ_CMD_DELETE_TREE_ITEM 2007
#define STARTEAM_PROJ_CMD_GET_ITEM_HISTORY 2010
#define STARTEAM_SRVR_CMD_GET_USER_PERSONAL_INFO 2011
#define STARTEAM_SRVR_CMD_SET_USER_PERSONAL_INFO 2012
#define STARTEAM_SRVR_CMD_SET_USER_PASSWORD 2013
#define STARTEAM_PROJ_CMD_MOVE_ITEMS 2020
#define STARTEAM_PROJ_CMD_MOVE_TREE_ITEMS 2021
#define STARTEAM_SRVR_CMD_GET_GROUP_INFO 2021 /* XXX: ?? */
#define STARTEAM_PROJ_CMD_SHARE_ITEMS 2022
#define STARTEAM_SRVR_CMD_ADD_EDIT_GROUP_INFO 2022 /* XXX: ?? */
#define STARTEAM_PROJ_CMD_SHARE_TREE_ITEMS 2023
#define STARTEAM_SRVR_CMD_DROP_GROUP 2023 /* XXX: ?? */
#define STARTEAM_SRVR_CMD_GET_USER_INFO 2024
#define STARTEAM_SRVR_CMD_ADD_EDIT_USER_INFO 2025
#define STARTEAM_SRVR_CMD_DROP_USER 2026
#define STARTEAM_SRVR_CMD_GET_MIN_PASSWORD_LENGTH 2027
#define STARTEAM_SRVR_CMD_USER_ADMIN_OPERATION 2028
#define STARTEAM_SRVR_CMD_ACCESS_CHECK 2029
#define STARTEAM_PROJ_CMD_GET_COMMON_ANCESTOR_ITEM 2030
#define STARTEAM_SRVR_CMD_ACCESS_TEST 2030 /* XXX: ?? */
#define STARTEAM_PROJ_CMD_UPDATE_REVISION_COMMENT 2031
#define STARTEAM_SRVR_CMD_GET_MAIN_LOG_LAST64K 2031 /* XXX: ?? */
#define STARTEAM_SRVR_CMD_GET_SERVER_CONFIG 2032
#define STARTEAM_SRVR_CMD_SET_SERVER_CONFIG 2033
#define STARTEAM_SRVR_CMD_GET_SERVER_ACL 2034
#define STARTEAM_SRVR_CMD_DROP_SERVER_ACL 2035
#define STARTEAM_SRVR_CMD_SET_SERVER_ACL 2036
#define STARTEAM_SRVR_CMD_GET_SYSTEM_POLICY 2037
#define STARTEAM_SRVR_CMD_SET_SYSTEM_POLICY 2038
#define STARTEAM_SRVR_CMD_GET_SECURITY_LOG 2039
#define STARTEAM_SRVR_CMD_GET_SERVER_COMMAND_STATS 2040
#define STARTEAM_SRVR_CMD_SET_SERVER_COMMAND_MODE 2041
#define STARTEAM_SRVR_CMD_SHUTDOWN 2042
#define STARTEAM_SRVR_CMD_RESTART 2043
#define STARTEAM_SRVR_CMD_GET_SERVER_COMMAND_MODE 2045
#define STARTEAM_SRVR_CMD_GET_LOG 2046
#define STARTEAM_SRVR_CMD_GET_COMPONENT_LIST 2050
#define STARTEAM_SRVR_CMD_GET_GROUP_MEMBERS 2060
#define STARTEAM_PROJ_CMD_GET_ITEMS_VERSIONS 5001
#define STARTEAM_SRVR_CMD_VALIDATE_VSS_INI_PATH 9034
#define STARTEAM_SRVR_CMD_VALIDATE_PVCS_CFG_PATH 9035
#define STARTEAM_SRVR_CMD_GET_VSS_PROJECT_TREE 9036
#define STARTEAM_SRVR_CMD_GET_ALL_PVCS_ARCHIVES 9037
#define STARTEAM_SRVR_CMD_INITIALIZE_FOREIGN_ACCESS 9038
#define STARTEAM_SRVR_CMD_SET_FOREIGN_PROJECT_PW 9039
#define STARTEAM_PROJ_CMD_PING 10001
#define STARTEAM_PROJ_CMD_SET_LOCALE 10005
#define STARTEAM_PROJ_CMD_GET_CONTAINER_ACL 10011
#define STARTEAM_PROJ_CMD_SET_CONTAINER_ACL 10012
#define STARTEAM_PROJ_CMD_GET_CONTAINER_LEVEL_ACL 10013
#define STARTEAM_PROJ_CMD_SET_CONTAINER_LEVEL_ACL 10014
#define STARTEAM_PROJ_CMD_GET_OBJECT_ACL 10015
#define STARTEAM_PROJ_CMD_SET_OBJECT_ACL 10016
#define STARTEAM_PROJ_CMD_ITEM_ACCESS_CHECK 10017
#define STARTEAM_PROJ_CMD_ITEM_ACCESS_TEST 10018
#define STARTEAM_PROJ_CMD_GET_OWNER 10019
#define STARTEAM_PROJ_CMD_ACQUIRE_OWNERSHIP 10020
#define STARTEAM_PROJ_CMD_GET_FOLDERS 10021
#define STARTEAM_PROJ_CMD_ADD_FOLDERS 10023
#define STARTEAM_PROJ_CMD_DELETE_FOLDER 10024
#define STARTEAM_PROJ_CMD_MOVE_FOLDER 10025
#define STARTEAM_PROJ_CMD_SHARE_FOLDER 10026
#define STARTEAM_PROJ_CMD_CONTAINER_ACCESS_CHECK 10031
#define STARTEAM_PROJ_CMD_CONTAINER_ACCESS_TEST 10032
#define STARTEAM_PROJ_CMD_GET_OBJECT2_ACL 10035
#define STARTEAM_PROJ_CMD_SET_OBJECT2_ACL 10036
#define STARTEAM_PROJ_CMD_OBJECT_ACCESS_CHECK 10037
#define STARTEAM_PROJ_CMD_OBJECT_ACCESS_TEST 10038
#define STARTEAM_PROJ_CMD_GET_OBJECT_OWNER 10039
#define STARTEAM_PROJ_CMD_ACQUIRE_OBJECT_OWNERSHIP 10040
#define STARTEAM_PROJ_CMD_GET_FOLDER_PROPERTIES 10053
#define STARTEAM_PROJ_CMD_SET_FOLDER_PROPERTIES 10054
#define STARTEAM_PROJ_CMD_GET_ITEM_PROPERTIES 10060
#define STARTEAM_PROJ_CMD_SET_ITEM_PROPERTIES 10061
#define STARTEAM_PROJ_CMD_GET_ITEM_REFERENCES 10062
#define STARTEAM_PROJ_CMD_GET_ITEM_REFERENCE 10063
#define STARTEAM_PROJ_CMD_GET_ITEM_REVISIONS 10065
#define STARTEAM_PROJ_CMD_DELETE_PROJECT 10083
#define STARTEAM_PROJ_CMD_GET_PROJECT_PROPERTIES 10085
#define STARTEAM_PROJ_CMD_SET_PROJECT_PROPERTIES 10086
#define STARTEAM_PROJ_CMD_GET_VIEW_INFO 10090
#define STARTEAM_PROJ_CMD_ADD_VIEW 10091
#define STARTEAM_PROJ_CMD_GET_VIEWS 10092
#define STARTEAM_PROJ_CMD_GET_VIEW_PROPERTIES 10093
#define STARTEAM_PROJ_CMD_SET_VIEW_PROPERTIES 10094
#define STARTEAM_PROJ_CMD_DELETE_VIEW 10095
#define STARTEAM_PROJ_CMD_SWITCH_VIEW 10098
#define STARTEAM_PROJ_CMD_SWITCH_VIEW_CONFIG 10099
#define STARTEAM_PROJ_CMD_GET_FOLDER_PATH 10100
#define STARTEAM_FILE_CMD_CHECKOUT 10104
#define STARTEAM_FILE_CMD_GET_SYNC_INFO 10111
#define STARTEAM_FILE_CMD_DELETE_SYNC_INFO 10112
#define STARTEAM_FILE_CMD_GET_PATH_IDS 10117
#define STARTEAM_FILE_CMD_SYNC_UPDATE_ALL_INFO 10119
#define STARTEAM_FILE_CMD_RESYNC_FILE 10121
#define STARTEAM_FILE_CMD_CONVERT_ARCHIVE 10122
#define STARTEAM_FILE_CMD_ARCHIVE_CONVERSION 10123
#define STARTEAM_FILE_CMD_READ_PVCS_ARCHIVES 10130
#define STARTEAM_FILE_CMD_ADD_PVCS_ARCHIVES 10131
#define STARTEAM_FILE_CMD_ADD_PVCS_BRANCHES 10132
#define STARTEAM_FILE_CMD_FINISH_NEW_PVCS_PROJECT 10133
#define STARTEAM_FILE_CMD_GET_NUMBER_VSS_ARCHIVES 10134
#define STARTEAM_FILE_CMD_READ_VSS_ARCHIVES 10135
#define STARTEAM_FILE_CMD_ADD_VSS_ARCHIVE_TO_FOLDER 10136
#define STARTEAM_FILE_CMD_FINISH_NEW_VSS_PROJECT 10137
#define STARTEAM_FILE_CMD_REFRESH_FOREIGN_FOLDER 10138
#define STARTEAM_FILE_CMD_START_GO_NATIVE 10139
#define STARTEAM_FILE_CMD_GET_PROJECT_TYPE 10141
#define STARTEAM_FILE_CMD_SET_FOREIGN_PROJECT_PW 10142
#define STARTEAM_FILE_CMD_INTERNAL_NESTED_COMMAND 10143
#define STARTEAM_PROJ_CMD_LABEL_GET_INFO 10201
#define STARTEAM_PROJ_CMD_LABEL_GET_PROPERTIES 10202
#define STARTEAM_PROJ_CMD_LABEL_SET_PROPERTIES 10203
#define STARTEAM_PROJ_CMD_LABEL_CREATE 10205
#define STARTEAM_PROJ_CMD_LABEL_DELETE 10206
#define STARTEAM_PROJ_CMD_LABEL_ATTACH 10207
#define STARTEAM_PROJ_CMD_LABEL_MOVE 10208
#define STARTEAM_PROJ_CMD_LABEL_DETACH 10209
#define STARTEAM_PROJ_CMD_LABEL_GET_INFO_EX 10221
#define STARTEAM_PROJ_CMD_LABEL_CREATE_EX 10222
#define STARTEAM_PROJ_CMD_LABEL_ATTACH_EX 10223
#define STARTEAM_PROJ_CMD_LABEL_ATTACH_ITEMS 10224
#define STARTEAM_PROJ_CMD_LABEL_DETACH_EX 10225
#define STARTEAM_PROJ_CMD_LABEL_DETACH_ITEMS 10226
#define STARTEAM_PROJ_CMD_LABEL_GETITEMIDS 10229
#define STARTEAM_PROJ_CMD_LINK_GET_INFO 10300
#define STARTEAM_PROJ_CMD_LINK_CREATE 10301
#define STARTEAM_PROJ_CMD_LINK_DELETE 10302
#define STARTEAM_PROJ_CMD_LINK_UPDATE_PROPERTIES 10310
#define STARTEAM_PROJ_CMD_LINK_UPDATE_PINS 10311
#define STARTEAM_PROJ_CMD_PROMOTION_GET 10400
#define STARTEAM_PROJ_CMD_PROMOTION_SET 10401
#define STARTEAM_TASK_CMD_GET_WORKRECS 10402
#define STARTEAM_TASK_CMD_ADD_WORKREC 10403
#define STARTEAM_TASK_CMD_UPDATE_WORKREC 10404
#define STARTEAM_TASK_CMD_DELETE_WORKREC 10405
#define STARTEAM_TASK_CMD_DELETE_TASK_PREDECESSOR 10408
#define STARTEAM_TASK_CMD_GET_TASK_DEPENDENCIES 10409
#define STARTEAM_TASK_CMD_ADD_TASK_PREDECESSOR 10410
#define STARTEAM_TASK_CMD_UPDATE_TASK_PREDECESSOR 10411
#define STARTEAM_PROJ_CMD_VIEW_COMPARE_GET_FOLDER_DETAILS 20070
#define STARTEAM_PROJ_CMD_VIEW_COMPARE_RELATE_ITEMS 20071
#define STARTEAM_TEXT_MDH "Message Data Header"
#define STARTEAM_TEXT_PH "Packet Header"
#define STARTEAM_TEXT_ID "ID"
#define STARTEAM_TEXT_DATA "Data"
static const value_string starteam_opcode_vals[] = {
{ STARTEAM_SRVR_CMD_GET_SESSION_TAG, "SRVR_CMD_GET_SESSION_TAG" },
{ STARTEAM_SRVR_CMD_GET_REQUIRED_ENCRYPTION_LEVEL, "SRVR_CMD_GET_REQUIRED_ENCRYPTION_LEVEL" },
{ STARTEAM_SRVR_CMD_GET_SERVER_PARAMS, "SRVR_CMD_GET_SERVER_PARAMS" },
{ STARTEAM_SRVR_CMD_SERVER_CONNECT, "SRVR_CMD_SERVER_CONNECT" },
{ STARTEAM_SRVR_CMD_SERVER_RECONNECT, "SRVR_CMD_SERVER_RECONNECT" },
{ STARTEAM_SRVR_CMD_BEGIN_LOGIN, "SRVR_CMD_BEGIN_LOGIN" },
{ STARTEAM_SRVR_CMD_KEY_EXCHANGE_PHASE0, "SRVR_CMD_KEY_EXCHANGE_PHASE0" },
{ STARTEAM_SRVR_CMD_KEY_EXCHANGE_PHASE12, "SRVR_CMD_KEY_EXCHANGE_PHASE12" },
{ STARTEAM_SRVR_CMD_KEY_EXCHANGE_PHASE3, "SRVR_CMD_KEY_EXCHANGE_PHASE3" },
{ STARTEAM_SRVR_CMD_SERVER_LOGIN, "SRVR_CMD_SERVER_LOGIN" },
{ STARTEAM_SRVR_CMD_GET_PROJECT_LIST, "SRVR_CMD_GET_PROJECT_LIST" },
{ STARTEAM_SRVR_CMD_GET_PROJECT_VIEWS, "SRVR_CMD_GET_PROJECT_VIEWS" },
{ STARTEAM_SRVR_CMD_PROJECT_LOGIN, "SRVR_CMD_PROJECT_LOGIN" },
{ STARTEAM_SRVR_CMD_PROJECT_LOGOUT, "SRVR_CMD_PROJECT_LOGOUT" },
{ STARTEAM_PROJ_CMD_LIST_SET_READ, "PROJ_CMD_LIST_SET_READ" },
{ STARTEAM_PROJ_CMD_LIST_ADD_ATTACHMENT, "PROJ_CMD_LIST_ADD_ATTACHMENT" },
{ STARTEAM_PROJ_CMD_LIST_GET_ATTACHMENT, "PROJ_CMD_LIST_GET_ATTACHMENT" },
{ STARTEAM_PROJ_CMD_LIST_REMOVE_ATTACHMENT, "PROJ_CMD_LIST_REMOVE_ATTACHMENT" },
{ STARTEAM_PROJ_CMD_MAIL_LIST_ITEMS, "PROJ_CMD_MAIL_LIST_ITEMS" },
{ STARTEAM_PROJ_CMD_LIST_ANY_NEWITEMS, "PROJ_CMD_LIST_ANY_NEWITEMS" },
{ STARTEAM_PROJ_CMD_LIST_GET_NEWITEMS, "PROJ_CMD_LIST_GET_NEWITEMS" },
{ STARTEAM_SRVR_CMD_RELEASE_CLIENT, "SRVR_CMD_RELEASE_CLIENT" },
{ STARTEAM_SRVR_CMD_UPDATE_SERVER_INFO, "SRVR_CMD_UPDATE_SERVER_INFO" },
{ STARTEAM_SRVR_CMD_GET_USAGE_DATA, "SRVR_CMD_GET_USAGE_DATA" },
{ STARTEAM_SRVR_CMD_GET_LICENSE_INFO, "SRVR_CMD_GET_LICENSE_INFO" },
{ STARTEAM_PROJ_CMD_FILTER_ADD, "PROJ_CMD_FILTER_ADD" },
{ STARTEAM_PROJ_CMD_FILTER_MODIFY, "PROJ_CMD_FILTER_MODIFY" },
{ STARTEAM_PROJ_CMD_FILTER_GET, "PROJ_CMD_FILTER_GET" },
{ STARTEAM_PROJ_CMD_FILTER_GET_LIST, "PROJ_CMD_FILTER_GET_LIST" },
{ STARTEAM_PROJ_CMD_FILTER_DELETE, "PROJ_CMD_FILTER_DELETE" },
{ STARTEAM_PROJ_CMD_QUERY_ADD, "PROJ_CMD_QUERY_ADD" },
{ STARTEAM_PROJ_CMD_QUERY_MODIFY, "PROJ_CMD_QUERY_MODIFY" },
{ STARTEAM_PROJ_CMD_QUERY_GET, "PROJ_CMD_QUERY_GET" },
{ STARTEAM_PROJ_CMD_QUERY_GET_LIST, "PROJ_CMD_QUERY_GET_LIST" },
{ STARTEAM_PROJ_CMD_QUERY_DELETE, "PROJ_CMD_QUERY_DELETE" },
{ STARTEAM_PROJ_GET_FILTER_CLASS_ID, "PROJ_GET_FILTER_CLASS_ID" },
{ STARTEAM_PROJ_GET_QUERY_CLASS_ID, "PROJ_GET_QUERY_CLASS_ID" },
{ STARTEAM_SRVR_CMD_PROJECT_CREATE, "SRVR_CMD_PROJECT_CREATE" },
{ STARTEAM_SRVR_CMD_PROJECT_OPEN, "SRVR_CMD_PROJECT_OPEN" },
{ STARTEAM_SRVR_CMD_PROJECT_CLOSE, "SRVR_CMD_PROJECT_CLOSE" },
{ STARTEAM_PROJ_CMD_CATALOG_LOADALL, "PROJ_CMD_CATALOG_LOADALL" },
{ STARTEAM_PROJ_CMD_CATALOG_LOADSET, "PROJ_CMD_CATALOG_LOADSET" },
{ STARTEAM_PROJ_CMD_CATALOG_LOADREGISTEREDCLASSES, "PROJ_CMD_CATALOG_LOADREGISTEREDCLASSES" },
{ STARTEAM_PROJ_CMD_REFRESH_CLASS_INFO, "PROJ_CMD_REFRESH_CLASS_INFO" },
{ STARTEAM_PROJ_CMD_ADD_CUSTOM_FIELD_CLASS_INFO, "PROJ_CMD_ADD_CUSTOM_FIELD_CLASS_INFO" },
{ STARTEAM_PROJ_CMD_MODIFY_FIELD_CLASS_INFO, "PROJ_CMD_MODIFY_FIELD_CLASS_INFO" },
{ STARTEAM_PROJ_CMD_ADD_CUSTOM_FIELD_CLASS_INFO_EX, "PROJ_CMD_ADD_CUSTOM_FIELD_CLASS_INFO_EX" },
{ STARTEAM_PROJ_CMD_GET_FOLDER_ITEMS, "PROJ_CMD_GET_FOLDER_ITEMS" },
{ STARTEAM_SRVR_CMD_GET_USERS_AND_GROUPS, "SRVR_CMD_GET_USERS_AND_GROUPS" },
{ STARTEAM_PROJ_CMD_REFRESH_ITEMS, "PROJ_CMD_REFRESH_ITEMS" },
{ STARTEAM_PROJ_CMD_GET_ITEM, "PROJ_CMD_GET_ITEM" },
{ STARTEAM_SRVR_CMD_GET_EMAIL_USERS, "SRVR_CMD_GET_EMAIL_USERS" },
{ STARTEAM_PROJ_CMD_UPDATE_ITEM, "PROJ_CMD_UPDATE_ITEM" },
{ STARTEAM_PROJ_CMD_DELETE_ITEM, "PROJ_CMD_DELETE_ITEM" },
{ STARTEAM_PROJ_CMD_SET_ITEM_LOCK, "PROJ_CMD_SET_ITEM_LOCK" },
{ STARTEAM_PROJ_CMD_DELETE_TREE_ITEM, "PROJ_CMD_DELETE_TREE_ITEM" },
{ STARTEAM_PROJ_CMD_GET_ITEM_HISTORY, "PROJ_CMD_GET_ITEM_HISTORY" },
{ STARTEAM_SRVR_CMD_GET_USER_PERSONAL_INFO, "SRVR_CMD_GET_USER_PERSONAL_INFO" },
{ STARTEAM_SRVR_CMD_SET_USER_PERSONAL_INFO, "SRVR_CMD_SET_USER_PERSONAL_INFO" },
{ STARTEAM_SRVR_CMD_SET_USER_PASSWORD, "SRVR_CMD_SET_USER_PASSWORD" },
{ STARTEAM_PROJ_CMD_MOVE_ITEMS, "PROJ_CMD_MOVE_ITEMS" },
{ STARTEAM_PROJ_CMD_MOVE_TREE_ITEMS, "PROJ_CMD_MOVE_TREE_ITEMS" },
{ STARTEAM_SRVR_CMD_GET_GROUP_INFO, "SRVR_CMD_GET_GROUP_INFO" },
{ STARTEAM_PROJ_CMD_SHARE_ITEMS, "PROJ_CMD_SHARE_ITEMS" },
{ STARTEAM_SRVR_CMD_ADD_EDIT_GROUP_INFO, "SRVR_CMD_ADD_EDIT_GROUP_INFO" },
{ STARTEAM_PROJ_CMD_SHARE_TREE_ITEMS, "PROJ_CMD_SHARE_TREE_ITEMS" },
{ STARTEAM_SRVR_CMD_DROP_GROUP, "SRVR_CMD_DROP_GROUP" },
{ STARTEAM_SRVR_CMD_GET_USER_INFO, "SRVR_CMD_GET_USER_INFO" },
{ STARTEAM_SRVR_CMD_ADD_EDIT_USER_INFO, "SRVR_CMD_ADD_EDIT_USER_INFO" },
{ STARTEAM_SRVR_CMD_DROP_USER, "SRVR_CMD_DROP_USER" },
{ STARTEAM_SRVR_CMD_GET_MIN_PASSWORD_LENGTH, "SRVR_CMD_GET_MIN_PASSWORD_LENGTH" },
{ STARTEAM_SRVR_CMD_USER_ADMIN_OPERATION, "SRVR_CMD_USER_ADMIN_OPERATION" },
{ STARTEAM_SRVR_CMD_ACCESS_CHECK, "SRVR_CMD_ACCESS_CHECK" },
{ STARTEAM_PROJ_CMD_GET_COMMON_ANCESTOR_ITEM, "PROJ_CMD_GET_COMMON_ANCESTOR_ITEM" },
{ STARTEAM_SRVR_CMD_ACCESS_TEST, "SRVR_CMD_ACCESS_TEST" },
{ STARTEAM_PROJ_CMD_UPDATE_REVISION_COMMENT, "PROJ_CMD_UPDATE_REVISION_COMMENT" },
{ STARTEAM_SRVR_CMD_GET_MAIN_LOG_LAST64K, "SRVR_CMD_GET_MAIN_LOG_LAST64K" },
{ STARTEAM_SRVR_CMD_GET_SERVER_CONFIG, "SRVR_CMD_GET_SERVER_CONFIG" },
{ STARTEAM_SRVR_CMD_SET_SERVER_CONFIG, "SRVR_CMD_SET_SERVER_CONFIG" },
{ STARTEAM_SRVR_CMD_GET_SERVER_ACL, "SRVR_CMD_GET_SERVER_ACL" },
{ STARTEAM_SRVR_CMD_DROP_SERVER_ACL, "SRVR_CMD_DROP_SERVER_ACL" },
{ STARTEAM_SRVR_CMD_SET_SERVER_ACL, "SRVR_CMD_SET_SERVER_ACL" },
{ STARTEAM_SRVR_CMD_GET_SYSTEM_POLICY, "SRVR_CMD_GET_SYSTEM_POLICY" },
{ STARTEAM_SRVR_CMD_SET_SYSTEM_POLICY, "SRVR_CMD_SET_SYSTEM_POLICY" },
{ STARTEAM_SRVR_CMD_GET_SECURITY_LOG, "SRVR_CMD_GET_SECURITY_LOG" },
{ STARTEAM_SRVR_CMD_GET_SERVER_COMMAND_STATS, "SRVR_CMD_GET_SERVER_COMMAND_STATS" },
{ STARTEAM_SRVR_CMD_SET_SERVER_COMMAND_MODE, "SRVR_CMD_SET_SERVER_COMMAND_MODE" },
{ STARTEAM_SRVR_CMD_SHUTDOWN, "SRVR_CMD_SHUTDOWN" },
{ STARTEAM_SRVR_CMD_RESTART, "SRVR_CMD_RESTART" },
{ STARTEAM_SRVR_CMD_GET_SERVER_COMMAND_MODE, "SRVR_CMD_GET_SERVER_COMMAND_MODE" },
{ STARTEAM_SRVR_CMD_GET_LOG, "SRVR_CMD_GET_LOG" },
{ STARTEAM_SRVR_CMD_GET_COMPONENT_LIST, "SRVR_CMD_GET_COMPONENT_LIST" },
{ STARTEAM_SRVR_CMD_GET_GROUP_MEMBERS, "SRVR_CMD_GET_GROUP_MEMBERS" },
{ STARTEAM_PROJ_CMD_GET_ITEMS_VERSIONS, "PROJ_CMD_GET_ITEMS_VERSIONS" },
{ STARTEAM_SRVR_CMD_VALIDATE_VSS_INI_PATH, "SRVR_CMD_VALIDATE_VSS_INI_PATH" },
{ STARTEAM_SRVR_CMD_VALIDATE_PVCS_CFG_PATH, "SRVR_CMD_VALIDATE_PVCS_CFG_PATH" },
{ STARTEAM_SRVR_CMD_GET_VSS_PROJECT_TREE, "SRVR_CMD_GET_VSS_PROJECT_TREE" },
{ STARTEAM_SRVR_CMD_GET_ALL_PVCS_ARCHIVES, "SRVR_CMD_GET_ALL_PVCS_ARCHIVES" },
{ STARTEAM_SRVR_CMD_INITIALIZE_FOREIGN_ACCESS, "SRVR_CMD_INITIALIZE_FOREIGN_ACCESS" },
{ STARTEAM_SRVR_CMD_SET_FOREIGN_PROJECT_PW, "SRVR_CMD_SET_FOREIGN_PROJECT_PW" },
{ STARTEAM_PROJ_CMD_PING, "PROJ_CMD_PING" },
{ STARTEAM_PROJ_CMD_SET_LOCALE, "PROJ_CMD_SET_LOCALE" },
{ STARTEAM_PROJ_CMD_GET_CONTAINER_ACL, "PROJ_CMD_GET_CONTAINER_ACL" },
{ STARTEAM_PROJ_CMD_SET_CONTAINER_ACL, "PROJ_CMD_SET_CONTAINER_ACL" },
{ STARTEAM_PROJ_CMD_GET_CONTAINER_LEVEL_ACL, "PROJ_CMD_GET_CONTAINER_LEVEL_ACL" },
{ STARTEAM_PROJ_CMD_SET_CONTAINER_LEVEL_ACL, "PROJ_CMD_SET_CONTAINER_LEVEL_ACL" },
{ STARTEAM_PROJ_CMD_GET_OBJECT_ACL, "PROJ_CMD_GET_OBJECT_ACL" },
{ STARTEAM_PROJ_CMD_SET_OBJECT_ACL, "PROJ_CMD_SET_OBJECT_ACL" },
{ STARTEAM_PROJ_CMD_ITEM_ACCESS_CHECK, "PROJ_CMD_ITEM_ACCESS_CHECK" },
{ STARTEAM_PROJ_CMD_ITEM_ACCESS_TEST, "PROJ_CMD_ITEM_ACCESS_TEST" },
{ STARTEAM_PROJ_CMD_GET_OWNER, "PROJ_CMD_GET_OWNER" },
{ STARTEAM_PROJ_CMD_ACQUIRE_OWNERSHIP, "PROJ_CMD_ACQUIRE_OWNERSHIP" },
{ STARTEAM_PROJ_CMD_GET_FOLDERS, "PROJ_CMD_GET_FOLDERS" },
{ STARTEAM_PROJ_CMD_ADD_FOLDERS, "PROJ_CMD_ADD_FOLDERS" },
{ STARTEAM_PROJ_CMD_DELETE_FOLDER, "PROJ_CMD_DELETE_FOLDER" },
{ STARTEAM_PROJ_CMD_MOVE_FOLDER, "PROJ_CMD_MOVE_FOLDER" },
{ STARTEAM_PROJ_CMD_SHARE_FOLDER, "PROJ_CMD_SHARE_FOLDER" },
{ STARTEAM_PROJ_CMD_CONTAINER_ACCESS_CHECK, "PROJ_CMD_CONTAINER_ACCESS_CHECK" },
{ STARTEAM_PROJ_CMD_CONTAINER_ACCESS_TEST, "PROJ_CMD_CONTAINER_ACCESS_TEST" },
{ STARTEAM_PROJ_CMD_GET_OBJECT2_ACL, "PROJ_CMD_GET_OBJECT2_ACL" },
{ STARTEAM_PROJ_CMD_SET_OBJECT2_ACL, "PROJ_CMD_SET_OBJECT2_ACL" },
{ STARTEAM_PROJ_CMD_OBJECT_ACCESS_CHECK, "PROJ_CMD_OBJECT_ACCESS_CHECK" },
{ STARTEAM_PROJ_CMD_OBJECT_ACCESS_TEST, "PROJ_CMD_OBJECT_ACCESS_TEST" },
{ STARTEAM_PROJ_CMD_GET_OBJECT_OWNER, "PROJ_CMD_GET_OBJECT_OWNER" },
{ STARTEAM_PROJ_CMD_ACQUIRE_OBJECT_OWNERSHIP, "PROJ_CMD_ACQUIRE_OBJECT_OWNERSHIP" },
{ STARTEAM_PROJ_CMD_GET_FOLDER_PROPERTIES, "PROJ_CMD_GET_FOLDER_PROPERTIES" },
{ STARTEAM_PROJ_CMD_SET_FOLDER_PROPERTIES, "PROJ_CMD_SET_FOLDER_PROPERTIES" },
{ STARTEAM_PROJ_CMD_GET_ITEM_PROPERTIES, "PROJ_CMD_GET_ITEM_PROPERTIES" },
{ STARTEAM_PROJ_CMD_SET_ITEM_PROPERTIES, "PROJ_CMD_SET_ITEM_PROPERTIES" },
{ STARTEAM_PROJ_CMD_GET_ITEM_REFERENCES, "PROJ_CMD_GET_ITEM_REFERENCES" },
{ STARTEAM_PROJ_CMD_GET_ITEM_REFERENCE, "PROJ_CMD_GET_ITEM_REFERENCE" },
{ STARTEAM_PROJ_CMD_GET_ITEM_REVISIONS, "PROJ_CMD_GET_ITEM_REVISIONS" },
{ STARTEAM_PROJ_CMD_DELETE_PROJECT, "PROJ_CMD_DELETE_PROJECT" },
{ STARTEAM_PROJ_CMD_GET_PROJECT_PROPERTIES, "PROJ_CMD_GET_PROJECT_PROPERTIES" },
{ STARTEAM_PROJ_CMD_SET_PROJECT_PROPERTIES, "PROJ_CMD_SET_PROJECT_PROPERTIES" },
{ STARTEAM_PROJ_CMD_GET_VIEW_INFO, "PROJ_CMD_GET_VIEW_INFO" },
{ STARTEAM_PROJ_CMD_ADD_VIEW, "PROJ_CMD_ADD_VIEW" },
{ STARTEAM_PROJ_CMD_GET_VIEWS, "PROJ_CMD_GET_VIEWS" },
{ STARTEAM_PROJ_CMD_GET_VIEW_PROPERTIES, "PROJ_CMD_GET_VIEW_PROPERTIES" },
{ STARTEAM_PROJ_CMD_SET_VIEW_PROPERTIES, "PROJ_CMD_SET_VIEW_PROPERTIES" },
{ STARTEAM_PROJ_CMD_DELETE_VIEW, "PROJ_CMD_DELETE_VIEW" },
{ STARTEAM_PROJ_CMD_SWITCH_VIEW, "PROJ_CMD_SWITCH_VIEW" },
{ STARTEAM_PROJ_CMD_SWITCH_VIEW_CONFIG, "PROJ_CMD_SWITCH_VIEW_CONFIG" },
{ STARTEAM_PROJ_CMD_GET_FOLDER_PATH, "PROJ_CMD_GET_FOLDER_PATH" },
{ STARTEAM_FILE_CMD_CHECKOUT, "FILE_CMD_CHECKOUT" },
{ STARTEAM_FILE_CMD_GET_SYNC_INFO, "FILE_CMD_GET_SYNC_INFO" },
{ STARTEAM_FILE_CMD_DELETE_SYNC_INFO, "FILE_CMD_DELETE_SYNC_INFO" },
{ STARTEAM_FILE_CMD_GET_PATH_IDS, "FILE_CMD_GET_PATH_IDS" },
{ STARTEAM_FILE_CMD_SYNC_UPDATE_ALL_INFO, "FILE_CMD_SYNC_UPDATE_ALL_INFO" },
{ STARTEAM_FILE_CMD_RESYNC_FILE, "FILE_CMD_RESYNC_FILE" },
{ STARTEAM_FILE_CMD_CONVERT_ARCHIVE, "FILE_CMD_CONVERT_ARCHIVE" },
{ STARTEAM_FILE_CMD_ARCHIVE_CONVERSION, "FILE_CMD_ARCHIVE_CONVERSION" },
{ STARTEAM_FILE_CMD_READ_PVCS_ARCHIVES, "FILE_CMD_READ_PVCS_ARCHIVES" },
{ STARTEAM_FILE_CMD_ADD_PVCS_ARCHIVES, "FILE_CMD_ADD_PVCS_ARCHIVES" },
{ STARTEAM_FILE_CMD_ADD_PVCS_BRANCHES, "FILE_CMD_ADD_PVCS_BRANCHES" },
{ STARTEAM_FILE_CMD_FINISH_NEW_PVCS_PROJECT, "FILE_CMD_FINISH_NEW_PVCS_PROJECT" },
{ STARTEAM_FILE_CMD_GET_NUMBER_VSS_ARCHIVES, "FILE_CMD_GET_NUMBER_VSS_ARCHIVES" },
{ STARTEAM_FILE_CMD_READ_VSS_ARCHIVES, "FILE_CMD_READ_VSS_ARCHIVES" },
{ STARTEAM_FILE_CMD_ADD_VSS_ARCHIVE_TO_FOLDER, "FILE_CMD_ADD_VSS_ARCHIVE_TO_FOLDER" },
{ STARTEAM_FILE_CMD_FINISH_NEW_VSS_PROJECT, "FILE_CMD_FINISH_NEW_VSS_PROJECT" },
{ STARTEAM_FILE_CMD_REFRESH_FOREIGN_FOLDER, "FILE_CMD_REFRESH_FOREIGN_FOLDER" },
{ STARTEAM_FILE_CMD_START_GO_NATIVE, "FILE_CMD_START_GO_NATIVE" },
{ STARTEAM_FILE_CMD_GET_PROJECT_TYPE, "FILE_CMD_GET_PROJECT_TYPE" },
{ STARTEAM_FILE_CMD_SET_FOREIGN_PROJECT_PW, "FILE_CMD_SET_FOREIGN_PROJECT_PW" },
{ STARTEAM_FILE_CMD_INTERNAL_NESTED_COMMAND, "FILE_CMD_INTERNAL_NESTED_COMMAND" },
{ STARTEAM_PROJ_CMD_LABEL_GET_INFO, "PROJ_CMD_LABEL_GET_INFO" },
{ STARTEAM_PROJ_CMD_LABEL_GET_PROPERTIES, "PROJ_CMD_LABEL_GET_PROPERTIES" },
{ STARTEAM_PROJ_CMD_LABEL_SET_PROPERTIES, "PROJ_CMD_LABEL_SET_PROPERTIES" },
{ STARTEAM_PROJ_CMD_LABEL_CREATE, "PROJ_CMD_LABEL_CREATE" },
{ STARTEAM_PROJ_CMD_LABEL_DELETE, "PROJ_CMD_LABEL_DELETE" },
{ STARTEAM_PROJ_CMD_LABEL_ATTACH, "PROJ_CMD_LABEL_ATTACH" },
{ STARTEAM_PROJ_CMD_LABEL_MOVE, "PROJ_CMD_LABEL_MOVE" },
{ STARTEAM_PROJ_CMD_LABEL_DETACH, "PROJ_CMD_LABEL_DETACH" },
{ STARTEAM_PROJ_CMD_LABEL_GET_INFO_EX, "PROJ_CMD_LABEL_GET_INFO_EX" },
{ STARTEAM_PROJ_CMD_LABEL_CREATE_EX, "PROJ_CMD_LABEL_CREATE_EX" },
{ STARTEAM_PROJ_CMD_LABEL_ATTACH_EX, "PROJ_CMD_LABEL_ATTACH_EX" },
{ STARTEAM_PROJ_CMD_LABEL_ATTACH_ITEMS, "PROJ_CMD_LABEL_ATTACH_ITEMS" },
{ STARTEAM_PROJ_CMD_LABEL_DETACH_EX, "PROJ_CMD_LABEL_DETACH_EX" },
{ STARTEAM_PROJ_CMD_LABEL_DETACH_ITEMS, "PROJ_CMD_LABEL_DETACH_ITEMS" },
{ STARTEAM_PROJ_CMD_LABEL_GETITEMIDS, "PROJ_CMD_LABEL_GETITEMIDS" },
{ STARTEAM_PROJ_CMD_LINK_GET_INFO, "PROJ_CMD_LINK_GET_INFO" },
{ STARTEAM_PROJ_CMD_LINK_CREATE, "PROJ_CMD_LINK_CREATE" },
{ STARTEAM_PROJ_CMD_LINK_DELETE, "PROJ_CMD_LINK_DELETE" },
{ STARTEAM_PROJ_CMD_LINK_UPDATE_PROPERTIES, "PROJ_CMD_LINK_UPDATE_PROPERTIES" },
{ STARTEAM_PROJ_CMD_LINK_UPDATE_PINS, "PROJ_CMD_LINK_UPDATE_PINS" },
{ STARTEAM_PROJ_CMD_PROMOTION_GET, "PROJ_CMD_PROMOTION_GET" },
{ STARTEAM_PROJ_CMD_PROMOTION_SET, "PROJ_CMD_PROMOTION_SET" },
{ STARTEAM_TASK_CMD_GET_WORKRECS, "TASK_CMD_GET_WORKRECS" },
{ STARTEAM_TASK_CMD_ADD_WORKREC, "TASK_CMD_ADD_WORKREC" },
{ STARTEAM_TASK_CMD_UPDATE_WORKREC, "TASK_CMD_UPDATE_WORKREC" },
{ STARTEAM_TASK_CMD_DELETE_WORKREC, "TASK_CMD_DELETE_WORKREC" },
{ STARTEAM_TASK_CMD_DELETE_TASK_PREDECESSOR, "TASK_CMD_DELETE_TASK_PREDECESSOR" },
{ STARTEAM_TASK_CMD_GET_TASK_DEPENDENCIES, "TASK_CMD_GET_TASK_DEPENDENCIES" },
{ STARTEAM_TASK_CMD_ADD_TASK_PREDECESSOR, "TASK_CMD_ADD_TASK_PREDECESSOR" },
{ STARTEAM_TASK_CMD_UPDATE_TASK_PREDECESSOR, "TASK_CMD_UPDATE_TASK_PREDECESSOR" },
{ STARTEAM_PROJ_CMD_VIEW_COMPARE_GET_FOLDER_DETAILS, "PROJ_CMD_VIEW_COMPARE_GET_FOLDER_DETAILS" },
{ STARTEAM_PROJ_CMD_VIEW_COMPARE_RELATE_ITEMS, "PROJ_CMD_VIEW_COMPARE_RELATE_ITEMS" },
{ 0, NULL }
};
static value_string_ext starteam_opcode_vals_ext = VALUE_STRING_EXT_INIT(starteam_opcode_vals);
static gint iPreviousFrameNumber = -1;
static void
starteam_init(void)
{
iPreviousFrameNumber = -1;
}
static int
dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
gint offset = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "StarTeam");
/* This is a trick to know whether this is the first PDU in this packet or not */
if(iPreviousFrameNumber != (gint) pinfo->fd->num){
col_clear(pinfo->cinfo, COL_INFO);
} else {
col_append_str(pinfo->cinfo, COL_INFO, " | ");
}
iPreviousFrameNumber = pinfo->fd->num;
if(tvb_length(tvb) >= 16){
guint32 iCommand = 0;
gboolean bRequest = FALSE;
if(tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){
/* This packet is a response */
bRequest = FALSE;
col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_length(tvb));
} else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){
/* This packet is a request */
bRequest = TRUE;
if(tvb_length_remaining(tvb, offset) >= 66){
iCommand = tvb_get_letohl(tvb, offset + 62);
}
col_append_str(pinfo->cinfo, COL_INFO,
val_to_str_ext(iCommand, &starteam_opcode_vals_ext, "Unknown (0x%02x)"));
}
if(tree){
proto_tree *starteam_tree;
proto_tree *starteamroot_tree;
proto_item *ti;
ti = proto_tree_add_item(tree, proto_starteam, tvb, offset, -1, ENC_NA);
if (bRequest) proto_item_append_text(ti, " (%s)",
val_to_str_ext(iCommand, &starteam_opcode_vals_ext, "Unknown (0x%02x)"));
starteamroot_tree = proto_item_add_subtree(ti, ett_starteam);
if(bRequest){
if(tvb_length_remaining(tvb, offset) >= 20){
ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 20, STARTEAM_TEXT_MDH);
starteam_tree = proto_item_add_subtree(ti, ett_starteam_mdh);
proto_tree_add_item(starteam_tree, hf_starteam_mdh_session_tag, tvb, offset + 0, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_mdh_ctimestamp, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_mdh_flags, tvb, offset + 8, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_mdh_keyid, tvb, offset + 12, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_mdh_reserved, tvb, offset + 16, 4, ENC_LITTLE_ENDIAN);
offset += 20;
}
}
if(tvb_length_remaining(tvb, offset) >= 16){
ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 16, STARTEAM_TEXT_PH);
starteam_tree = proto_item_add_subtree(ti, ett_starteam_ph);
proto_tree_add_item(starteam_tree, hf_starteam_ph_signature, tvb, offset + 0, 4, ENC_ASCII|ENC_NA);
proto_tree_add_item(starteam_tree, hf_starteam_ph_packet_size, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_ph_data_size, tvb, offset + 8, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_ph_data_flags, tvb, offset + 12, 4, ENC_LITTLE_ENDIAN);
offset += 16;
if(bRequest){
if(tvb_length_remaining(tvb, offset) >= 38){
ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 38, STARTEAM_TEXT_ID);
starteam_tree = proto_item_add_subtree(ti, ett_starteam_id);
proto_tree_add_item(starteam_tree, hf_starteam_id_revision_level, tvb, offset + 0, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_id_client, tvb, offset + 2, 16, ENC_ASCII|ENC_NA);
proto_tree_add_item(starteam_tree, hf_starteam_id_connect, tvb, offset + 18, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_id_component, tvb, offset + 22, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_id_command, tvb, offset + 26, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_id_command_time, tvb, offset + 30, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(starteam_tree, hf_starteam_id_command_userid, tvb, offset + 34, 4, ENC_LITTLE_ENDIAN);
offset += 38;
}
}
if(tvb_length_remaining(tvb, offset) > 0){
ti = proto_tree_add_text(starteamroot_tree, tvb, offset, -1, STARTEAM_TEXT_DATA);
starteam_tree = proto_item_add_subtree(ti, ett_starteam_data);
proto_tree_add_item(starteam_tree, hf_starteam_data_data, tvb, offset, tvb_length_remaining(tvb, offset), ENC_ASCII|ENC_NA);
}
}
}
}
return tvb_length(tvb);
}
static guint
get_starteam_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
guint32 iPDULength = 0;
if(tvb_length_remaining(tvb, offset) >= 8 && tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){
/* Response */
iPDULength = tvb_get_letohl(tvb, offset + 4) + 16;
} else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){
/* Request */
iPDULength = tvb_get_letohl(tvb, offset + 24) + 36;
}
return iPDULength;
}
static int
dissect_starteam_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, starteam_desegment, 8, get_starteam_pdu_len, dissect_starteam, data);
return tvb_length(tvb);
}
static gboolean
dissect_starteam_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if(tvb_length(tvb) >= 32){
gint iOffsetLengths = -1;
if(tvb_get_ntohl(tvb, 0) == STARTEAM_MAGIC){
iOffsetLengths = 4;
} else if(tvb_get_ntohl(tvb, 20) == STARTEAM_MAGIC){
iOffsetLengths = 24;
}
if(iOffsetLengths != -1){
guint32 iLengthPacket;
guint32 iLengthData;
iLengthPacket = tvb_get_letohl(tvb, iOffsetLengths);
iLengthData = tvb_get_letohl(tvb, iOffsetLengths + 4);
if(iLengthPacket == iLengthData){
/* Register this dissector for this conversation */
conversation_t *conversation = NULL;
conversation = find_or_create_conversation(pinfo);
conversation_set_dissector(conversation, starteam_tcp_handle);
/* Dissect the packet */
dissect_starteam(tvb, pinfo, tree, data);
return TRUE;
}
}
}
return FALSE;
}
void
proto_register_starteam(void)
{
static hf_register_info hf[] = {
{ &hf_starteam_mdh_session_tag,
{ "Session tag", "starteam.mdh.stag", FT_UINT32, BASE_DEC, NULL, 0x0, "MDH session tag", HFILL }},
{ &hf_starteam_mdh_ctimestamp,
{ "Client timestamp", "starteam.mdh.ctimestamp", FT_UINT32, BASE_DEC, NULL, 0x0, "MDH client timestamp", HFILL }},
{ &hf_starteam_mdh_flags,
{ "Flags", "starteam.mdh.flags", FT_UINT32, BASE_HEX, NULL, 0x0, "MDH flags", HFILL }},
{ &hf_starteam_mdh_keyid,
{ "Key ID", "starteam.mdh.keyid", FT_UINT32, BASE_HEX, NULL, 0x0, "MDH key ID", HFILL }},
{ &hf_starteam_mdh_reserved,
{ "Reserved", "starteam.mdh.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, "MDH reserved", HFILL }},
{ &hf_starteam_ph_signature,
{ "Signature", "starteam.ph.signature", FT_STRINGZ, BASE_NONE, NULL, 0x0, "PH signature", HFILL }},
{ &hf_starteam_ph_packet_size,
{ "Packet size", "starteam.ph.psize", FT_UINT32, BASE_DEC, NULL, 0x0, "PH packet size", HFILL }},
{ &hf_starteam_ph_data_size,
{ "Data size", "starteam.ph.dsize", FT_UINT32, BASE_DEC, NULL, 0x0, "PH data size", HFILL }},
{ &hf_starteam_ph_data_flags,
{ "Flags", "starteam.ph.flags", FT_UINT32, BASE_HEX, NULL, 0x0, "PH flags", HFILL }},
{ &hf_starteam_id_revision_level,
{ "Revision level", "starteam.id.level", FT_UINT16, BASE_DEC, NULL, 0x0, "ID revision level", HFILL }},
{ &hf_starteam_id_client,
{ "Client ID", "starteam.id.client", FT_STRINGZ, BASE_NONE, NULL, 0x0, "ID client ID", HFILL }},
{ &hf_starteam_id_connect,
{ "Connect ID", "starteam.id.connect", FT_UINT32, BASE_HEX, NULL, 0x0, "ID connect ID", HFILL }},
{ &hf_starteam_id_component,
{ "Component ID", "starteam.id.component", FT_UINT32, BASE_DEC, NULL, 0x0, "ID component ID", HFILL }},
{ &hf_starteam_id_command,
{ "Command ID", "starteam.id.command", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &starteam_opcode_vals_ext, 0x0, "ID command ID", HFILL }},
{ &hf_starteam_id_command_time,
{ "Command time", "starteam.id.commandtime", FT_UINT32, BASE_HEX, NULL, 0x0, "ID command time", HFILL }},
{ &hf_starteam_id_command_userid,
{ "Command user ID", "starteam.id.commanduserid", FT_UINT32, BASE_HEX, NULL, 0x0, "ID command user ID", HFILL }},
{ &hf_starteam_data_data,
{ "Data", "starteam.data", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }}
};
static gint *ett[] = {
&ett_starteam,
&ett_starteam_mdh,
&ett_starteam_ph,
&ett_starteam_id,
&ett_starteam_data
};
module_t *starteam_module;
proto_starteam = proto_register_protocol("StarTeam", "StarTeam", "starteam");
proto_register_field_array(proto_starteam, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
starteam_module = prefs_register_protocol(proto_starteam, NULL);
prefs_register_bool_preference(starteam_module, "desegment",
"Reassemble StarTeam messages spanning multiple TCP segments",
"Whether the StarTeam dissector should reassemble messages spanning multiple TCP segments."
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&starteam_desegment);
register_init_routine(&starteam_init);
}
void
proto_reg_handoff_starteam(void)
{
heur_dissector_add("tcp", dissect_starteam_heur, proto_starteam);
starteam_tcp_handle = new_create_dissector_handle(dissect_starteam_tcp, proto_starteam);
}
| slowfranklin/wireshark | epan/dissectors/packet-starteam.c | C | gpl-2.0 | 44,191 |
/*
-- Pathing for Magregan Deepshadow
UPDATE `creature` SET `MovementType`=2 WHERE `guid`=8194;
DELETE FROM `creature_addon` WHERE `guid`=8194;
INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
(8194,81940,0,0,1,0,"");
DELETE FROM `waypoint_data` WHERE `id`=81940;
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES
(81940,1,-6190.17,-3042.32,220.479,0,0,0,0,100,0),
(81940,2,-6182.49,-3042.05,220.629,0,0,0,0,100,0),
(81940,3,-6175.37,-3045.62,220.47,0,0,0,0,100,0),
(81940,4,-6162.91,-3047.06,220.991,0,0,0,0,100,0),
(81940,5,-6162.13,-3055.03,223.322,0,0,0,0,100,0),
(81940,6,-6159.27,-3059.65,224.802,0,0,0,0,100,0),
(81940,7,-6156.35,-3059.69,224.86,0,0,0,0,100,0),
(81940,8,-6152.1,-3044.99,224.79,0,0,0,0,100,0),
(81940,9,-6141.94,-3037.03,225.185,0,0,0,0,100,0),
(81940,10,-6136.91,-3031.17,222.973,0,0,0,0,100,0),
(81940,11,-6134.32,-3026.79,222.317,0,0,0,0,100,0),
(81940,12,-6129.68,-3024.13,220.953,0,0,0,0,100,0),
(81940,13,-6122.15,-3021.21,220.448,0,0,0,0,100,0),
(81940,14,-6115.68,-3014.3,221.713,0,0,0,0,100,0),
(81940,15,-6118.28,-3010.95,221.811,0,0,0,0,100,0),
(81940,16,-6122.33,-3011.81,221.342,0,0,0,0,100,0),
(81940,17,-6127.31,-3020.16,220.39,0,0,0,0,100,0),
(81940,18,-6130.62,-3022.61,220.658,0,0,0,0,100,0),
(81940,19,-6134.26,-3027.02,222.368,0,0,0,0,100,0),
(81940,20,-6139.21,-3035.05,224.813,0,0,0,0,100,0),
(81940,21,-6152.08,-3045.37,224.843,0,0,0,0,100,0),
(81940,22,-6155.88,-3057.96,224.852,0,0,0,0,100,0),
(81940,23,-6159.85,-3059.45,224.727,0,0,0,0,100,0),
(81940,24,-6162.27,-3055.89,223.524,0,0,0,0,100,0),
(81940,25,-6163.18,-3048.02,221,0,0,0,0,100,0),
(81940,26,-6169.12,-3046.7,220.328,0,0,0,0,100,0),
(81940,27,-6172.29,-3049.39,220.34,0,0,0,0,100,0),
(81940,28,-6173.88,-3055.44,220.486,0,0,0,0,100,0),
(81940,29,-6179.07,-3059.1,219.921,0,0,0,0,100,0),
(81940,30,-6184.75,-3064.59,219.669,0,0,0,0,100,0),
(81940,31,-6188.36,-3071.23,219.121,0,0,0,0,100,0),
(81940,32,-6201.77,-3071.09,218.064,0,0,0,0,100,0),
(81940,33,-6213.41,-3059.18,218.946,0,0,0,0,100,0),
(81940,34,-6215.35,-3055.72,216.902,0,0,0,0,100,0),
(81940,35,-6216.97,-3049.63,216.443,0,0,0,0,100,0),
(81940,36,-6212.34,-3045.44,217.516,0,0,0,0,100,0),
(81940,37,-6205.64,-3044.31,218.456,0,0,0,0,100,0),
(81940,38,-6199.71,-3044.42,220.47,0,0,0,0,100,0);
*/
| Aokromes/TrinityCore | sql/old/4.3.4/world/34_2018_10_15/2018_10_09_01_world_from_335a_was_2018_10_08_01_world_335.sql | SQL | gpl-2.0 | 2,443 |
{script}{literal}OW.resizeImg($('.ow_oembed_attachment'),{width:'150'});{/literal}{/script}
{style}{literal}
.ow_oembed_attachment {
position: relative;
padding-right: 20px;
}
.ow_oembed_attachment .two_column .attachment_left {
float: left;
max-width: 150px;
margin-right: 8px;
}
.ow_oembed_attachment .two_column .attachment_right {
display: inline-block;
}
.ow_oembed_attachment .video div.attachment_left {
max-width: 160px;
}
.ow_oembed_attachment .video div.attachment_right {
display: inline-block;
}
.ow_oembed_attachment .one_column .attachment_left {
display: none;
}
.ow_oembed_attachment .attachment_left img
{
width: 100%;
height: auto;
max-width: none;
}
.ow_oembed_attachment .attachment_left embed,
.ow_oembed_attachment .attachment_left object,
.ow_oembed_attachment .attachment_left iframe
{
width: 300px;
height: 220px;
}
.ow_oembed_attachment:hover .attachment_delete {
display: block;
}
.attachment_delete {
position: absolute;
right: 0;
width:12px;
height:12px;
display: none;
}
{/literal}{/style}
<div class="ow_oembed_attachment clearfix {if !empty($containerClass)}{$containerClass}{/if}">
{if !empty($delete)}
<a class="attachment_delete ow_miniic_delete {if !empty($deleteClass)}{$deleteClass}{/if}" href="javascript://"></a>
{/if}
<div class="{$data.type} {if !empty($data.thumbnail_url) || !empty($data.url)}two_column has_thumbnail{elseif !empty($data.html)}two_column has_html{else}one_column{/if}">
<div class="attachment_left">
{if !empty($data.thumbnail_url) }
<a href="{$data.href}" target="_blank">
<img src="{$data.thumbnail_url}" class="attachment_thumb" />
</a>
{elseif !empty($data.url)}
<a href="javascript://" onclick="OW.showImageInFloatBox('{$data.href}');">
<img src="{$data.url}" class="attachment_thumb from_fullsize_photo" />
</a>
{elseif !empty($data.html)}
{$data.html}
{/if}
</div>
<div class="attachment_right ">
{if !empty($data.title)}
<div class="attachment_title"><a href="{$data.href}" target="_blank">{$data.title}</a></div>
{/if}
{if !empty($data.description)}
<div class="attachment_desc ow_remark">{$data.description}</div>
{/if}
</div>
</div>
</div> | seret/oxtebafu | ow_system_plugins/base/views/components/oembed_attachment.html | HTML | gpl-2.0 | 2,676 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Hemanth Narra
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Hemanth Narra <hemanth@ittc.ku.com>
*
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
* Information and Telecommunication Technology Center (ITTC)
* and Department of Electrical Engineering and Computer Science
* The University of Kansas Lawrence, KS USA.
*
* Work supported in part by NSF FIND (Future Internet Design) Program
* under grant CNS-0626918 (Postmodern Internet Architecture),
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
* US Department of Defense (DoD), and ITTC at The University of Kansas.
*/
#include "ns3/core-module.h"
#include "ns3/common-module.h"
#include "ns3/node-module.h"
#include "ns3/helper-module.h"
#include "ns3/mobility-module.h"
#include "ns3/contrib-module.h"
#include "ns3/wifi-module.h"
#include "ns3/dsdv-helper.h"
#include <iostream>
#include <cmath>
using namespace ns3;
uint16_t port = 9;
NS_LOG_COMPONENT_DEFINE ("DsdvManetExample");
class DsdvManetExample
{
public:
DsdvManetExample ();
void CaseRun (uint32_t nWifis,
uint32_t nSinks,
double totalTime,
std::string rate,
std::string phyMode,
uint32_t nodeSpeed,
uint32_t periodicUpdateInterval,
uint32_t settlingTime,
double dataStart,
bool printRoutes,
std::string CSVfileName);
private:
uint32_t m_nWifis;
uint32_t m_nSinks;
double m_totalTime;
std::string m_rate;
std::string m_phyMode;
uint32_t m_nodeSpeed;
uint32_t m_periodicUpdateInterval;
uint32_t m_settlingTime;
double m_dataStart;
uint32_t bytesTotal;
uint32_t packetsReceived;
bool m_printRoutes;
std::string m_CSVfileName;
NodeContainer nodes;
NetDeviceContainer devices;
Ipv4InterfaceContainer interfaces;
private:
void CreateNodes ();
void CreateDevices (std::string tr_name);
void InstallInternetStack (std::string tr_name);
void InstallApplications ();
void SetupMobility ();
void ReceivePacket (Ptr <Socket> );
Ptr <Socket> SetupPacketReceive (Ipv4Address, Ptr <Node> );
void CheckThroughput ();
};
int main (int argc, char **argv)
{
DsdvManetExample test;
uint32_t nWifis = 30;
uint32_t nSinks = 10;
double totalTime = 100.0;
std::string rate ("8kbps");
std::string phyMode ("DsssRate11Mbps");
uint32_t nodeSpeed = 10; // in m/s
std::string appl = "all";
uint32_t periodicUpdateInterval = 15;
uint32_t settlingTime = 6;
double dataStart = 50.0;
bool printRoutingTable = true;
std::string CSVfileName = "DsdvManetExample.csv";
CommandLine cmd;
cmd.AddValue ("nWifis", "Number of wifi nodes[Default:30]", nWifis);
cmd.AddValue ("nSinks", "Number of wifi sink nodes[Default:10]", nSinks);
cmd.AddValue ("totalTime", "Total Simulation time[Default:100]", totalTime);
cmd.AddValue ("phyMode", "Wifi Phy mode[Default:DsssRate11Mbps]", phyMode);
cmd.AddValue ("rate", "CBR traffic rate[Default:8kbps]", rate);
cmd.AddValue ("nodeSpeed", "Node speed in RandomWayPoint model[Default:10]", nodeSpeed);
cmd.AddValue ("periodicUpdateInterval", "Periodic Interval Time[Default=15]", periodicUpdateInterval);
cmd.AddValue ("settlingTime", "Settling Time before sending out an update for changed metric[Default=6]", settlingTime);
cmd.AddValue ("dataStart", "Time at which nodes start to transmit data[Default=50.0]", dataStart);
cmd.AddValue ("printRoutingTable", "print routing table for nodes[Default:1]", printRoutingTable);
cmd.AddValue ("CSVfileName", "The name of the CSV output file name[Default:DsdvManetExample.csv]", CSVfileName);
cmd.Parse (argc, argv);
std::ofstream out (CSVfileName.c_str ());
out << "SimulationSecond," <<
"ReceiveRate," <<
"PacketsReceived," <<
"NumberOfSinks," <<
std::endl;
out.close ();
SeedManager::SetSeed (12345);
Config::SetDefault ("ns3::OnOffApplication::PacketSize", StringValue ("1000"));
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (rate));
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue (phyMode));
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2000"));
test = DsdvManetExample ();
test.CaseRun (nWifis, nSinks, totalTime, rate, phyMode, nodeSpeed, periodicUpdateInterval,
settlingTime, dataStart, printRoutingTable, CSVfileName);
return 0;
}
DsdvManetExample::DsdvManetExample ()
: bytesTotal (0),
packetsReceived (0)
{
}
void
DsdvManetExample::ReceivePacket (Ptr <Socket> socket)
{
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << " Received one packet!");
Ptr <Packet> packet;
while (packet = socket->Recv ())
{
bytesTotal += packet->GetSize ();
packetsReceived += 1;
}
}
void
DsdvManetExample::CheckThroughput ()
{
double kbs = (bytesTotal * 8.0) / 1000;
bytesTotal = 0;
std::ofstream out (m_CSVfileName.c_str (), std::ios::app);
out << (Simulator::Now ()).GetSeconds () << "," << kbs << "," << packetsReceived << "," << m_nSinks << std::endl;
out.close ();
packetsReceived = 0;
Simulator::Schedule (Seconds (1.0), &DsdvManetExample::CheckThroughput, this);
}
Ptr <Socket>
DsdvManetExample::SetupPacketReceive (Ipv4Address addr, Ptr <Node> node)
{
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr <Socket> sink = Socket::CreateSocket (node, tid);
InetSocketAddress local = InetSocketAddress (addr, port);
sink->Bind (local);
sink->SetRecvCallback (MakeCallback ( &DsdvManetExample::ReceivePacket, this));
return sink;
}
void
DsdvManetExample::CaseRun (uint32_t nWifis, uint32_t nSinks, double totalTime, std::string rate,
std::string phyMode, uint32_t nodeSpeed, uint32_t periodicUpdateInterval, uint32_t settlingTime,
double dataStart, bool printRoutes, std::string CSVfileName)
{
m_nWifis = nWifis;
m_nSinks = nSinks;
m_totalTime = totalTime;
m_rate = rate;
m_phyMode = phyMode;
m_nodeSpeed = nodeSpeed;
m_periodicUpdateInterval = periodicUpdateInterval;
m_settlingTime = settlingTime;
m_dataStart = dataStart;
m_printRoutes = printRoutes;
m_CSVfileName = CSVfileName;
std::stringstream ss;
ss << m_nWifis;
std::string t_nodes = ss.str ();
std::stringstream ss3;
ss3 << m_totalTime;
std::string sTotalTime = ss3.str ();
std::string tr_name = "Dsdv_Manet_" + t_nodes + "Nodes_" + sTotalTime + "SimTime";
std::cout << "Trace file generated is " << tr_name << ".tr\n";
CreateNodes ();
CreateDevices (tr_name);
SetupMobility ();
InstallInternetStack (tr_name);
InstallApplications ();
std::cout << "\nStarting simulation for " << m_totalTime << " s ...\n";
CheckThroughput ();
Simulator::Stop (Seconds (m_totalTime));
Simulator::Run ();
Simulator::Destroy ();
}
void
DsdvManetExample::CreateNodes ()
{
std::cout << "Creating " << (unsigned) m_nWifis << " nodes.\n";
nodes.Create (m_nWifis);
NS_ASSERT_MSG (m_nWifis > m_nSinks, "Sinks must be less or equal to the number of nodes in network");
}
void
DsdvManetExample::SetupMobility ()
{
MobilityHelper mobility;
ObjectFactory pos;
pos.SetTypeId ("ns3::RandomRectanglePositionAllocator");
pos.Set ("X", RandomVariableValue (UniformVariable (0, 1000)));
pos.Set ("Y", RandomVariableValue (UniformVariable (0, 1000)));
Ptr <PositionAllocator> taPositionAlloc = pos.Create ()->GetObject <PositionAllocator> ();
mobility.SetMobilityModel ("ns3::RandomWaypointMobilityModel", "Speed", RandomVariableValue (ConstantVariable (m_nodeSpeed)),
"Pause", RandomVariableValue (ConstantVariable (2.0)), "PositionAllocator", PointerValue (taPositionAlloc));
mobility.SetPositionAllocator (taPositionAlloc);
mobility.Install (nodes);
}
void
DsdvManetExample::CreateDevices (std::string tr_name)
{
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifiMac.SetType ("ns3::AdhocWifiMac");
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel");
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue (m_phyMode), "ControlMode",
StringValue (m_phyMode));
devices = wifi.Install (wifiPhy, wifiMac, nodes);
AsciiTraceHelper ascii;
wifiPhy.EnableAsciiAll (ascii.CreateFileStream (tr_name + ".tr"));
wifiPhy.EnablePcapAll (tr_name);
}
void
DsdvManetExample::InstallInternetStack (std::string tr_name)
{
DsdvHelper dsdv;
dsdv.Set ("PeriodicUpdateInterval", TimeValue (Seconds (m_periodicUpdateInterval)));
dsdv.Set ("SettlingTime", TimeValue (Seconds (m_settlingTime)));
InternetStackHelper stack;
stack.SetRoutingHelper (dsdv);
stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
interfaces = address.Assign (devices);
if (m_printRoutes)
{
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ((tr_name + ".routes"), std::ios::out);
dsdv.PrintRoutingTableAllAt (Seconds (m_periodicUpdateInterval), routingStream);
}
}
void
DsdvManetExample::InstallApplications ()
{
for (uint32_t i = 0; i <= m_nSinks - 1; i++ )
{
Ptr<Node> node = NodeList::GetNode (i);
Ipv4Address nodeAddress = node->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal ();
Ptr<Socket> sink = SetupPacketReceive (nodeAddress, node);
}
for (uint32_t clientNode = 0; clientNode <= m_nWifis - 1; clientNode++ )
{
for (uint32_t j = 0; j <= m_nSinks - 1; j++ )
{
OnOffHelper onoff1 ("ns3::UdpSocketFactory", Address (InetSocketAddress (interfaces.GetAddress (j), port)));
onoff1.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff1.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
if (j != clientNode)
{
ApplicationContainer apps1 = onoff1.Install (nodes.Get (clientNode));
UniformVariable var;
apps1.Start (Seconds (var.GetValue (m_dataStart, m_dataStart + 1)));
apps1.Stop (Seconds (m_totalTime));
}
}
}
}
| richardwhiuk/ns-moose | src/routing/dsdv/examples/dsdv-manet.cc | C++ | gpl-2.0 | 11,284 |
{*<!--
+---------------------------------------------------------------------------+
| OpenX v2.8 |
| ========= |
| |
| Copyright (c) 2003-2009 OpenX Limited |
| For contact details, see: http://www.openx.org/ |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+---------------------------------------------------------------------------+
$Id: iframe.html 79311 2011-11-03 21:18:14Z chris.nutting $
-->*}<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test remote Login using JS</title>
<script type="text/javascript">
<!--{literal}
function prepareLoginForm() {
if (error) {
location.href = '{/literal}{$errorURL|escape:javascript}{literal}' + encodeURIComponent(error);
} else {
$('casLoginForm').action = casLoginURL;
$("lt").value = loginTicket;
if ($("lt").value != 'undefined') {
$('casLoginForm').submit();
}
}
}
function checkForLoginTicket() {
var loginTicketProvided = false;
var query = '';
casLoginURL = '{/literal}{$casLoginURL|escape:javascript}{literal}';
casLoginURL += '?login-at=' + encodeURIComponent ('{/literal}{$dashboardURL|escape:javascript}&url={$serviceURL|escape:url|escape:javascript}{literal}');
query = window.location.search;
query = query.substr (1, query.length - 1);
var param = new Array();
var temp = new Array();
param = query.split ('&');
i = 0;
while (param[i]) {
temp = param[i].split ('=');
if (temp[0] == 'lt') {
loginTicket = temp[1];
loginTicketProvided = true;
}
if (temp[0] == 'error_message') {
error = temp[1];
}
i++;
}
if (!loginTicketProvided) {
location.href = casLoginURL + '&get-lt=true';
}
}
function $(id) {
return document.getElementById(id);
}
var loginTicket;
var error;
var casLoginURL;
var thisPageURL;
//-->{/literal}
</script>
</head>
<body onload="checkForLoginTicket(); prepareLoginForm();">
Loading...
<script type="text/javascript" language="javascript">
<!--{literal}
if ( error ) {
error = decodeURIComponent (error);
document.write (error);
}
//-->{/literal}
</script>
<form id="casLoginForm" action="" method="post">
<input type="hidden" name="_eventId" value="submit"/>
<input type="hidden" name="username" value="{$ssoAdmin|escape}" >
<input type="hidden" name="password" value="{$ssoPasswd|escape}" >
<input type="hidden" name="lt" id="lt" value="">
<input type="hidden" name="service" value="{$serviceURL|escape}">
</form>
</body>
</html> | kriwil/OpenX | lib/templates/admin/dashboard/iframe.html | HTML | gpl-2.0 | 3,890 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.10">
<LINK rel="stylesheet" type="text/css" href="cascmd_en.css">
<TITLE>Remove rows or columns of a matrix : delrows delcols</TITLE>
</HEAD>
<BODY >
<A HREF="cascmd_en363.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
<A HREF="cascmd_en365.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
<HR>
<H3 CLASS="subsection"><A NAME="htoc408">2.42.15</A> Remove rows or columns of a matrix : <TT>delrows delcols</TT></H3><P><A NAME="@default619"></A><A NAME="@default620"></A>
<TT>delrows</TT> (resp <TT>delcols</TT>) removes one or several rows (resp
columns) of a matrix.<BR>
<TT>delrows</TT> (resp <TT>delcols</TT>) takes 2 arguments : a matrix <I>A</I>, and
an interval <I>n</I><SUB>1</SUB>..<I>n</I><SUB>2</SUB>.<BR>
<TT>delrows</TT> (resp <TT>delcols</TT>) returns the matrix where the rows
(resp columns) of index from <I>n</I><SUB>1</SUB> to <I>n</I><SUB>2</SUB> of <I>A</I> are removed.<BR>
Input :
</P><DIV CLASS="center"><TT>delrows([[1,2,3],[4,5,6],[7,8,9]],1..1)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[[1,2,3],[7,8,9]]</TT></DIV><P>
Input :
</P><DIV CLASS="center"><TT>delrows([[1,2,3],[4,5,6],[7,8,9]],0..1)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[[7,8,9]]</TT></DIV><P>
Input :
</P><DIV CLASS="center"><TT>delcols([[1,2,3],[4,5,6],[7,8,9]],1..1)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[[1,3],[4,6],[7,9]]</TT></DIV><P>
Input :
</P><DIV CLASS="center"><TT>delcols([[1,2,3],[4,5,6],[7,8,9]],0..1)</TT></DIV><P>
Output :
</P><DIV CLASS="center"><TT>[[3],[6],[9]]</TT></DIV><HR>
<A HREF="cascmd_en363.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
<A HREF="cascmd_en365.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
| hiplayer/giac | giac/giac-1.2.2/doc/en/cascmd_en/cascmd_en364.html | HTML | gpl-2.0 | 2,073 |
<?php
namespace SMW\Test;
use SMW\Tests\Util\SemanticDataValidator;
use SMW\InternalParseBeforeLinks;
use SMW\ExtensionContext;
use Title;
/**
* @covers \SMW\InternalParseBeforeLinks
*
* @ingroup Test
*
* @group SMW
* @group SMWExtension
*
* @licence GNU GPL v2+
* @since 1.9
*
* @author mwjames
*/
class InternalParseBeforeLinksTest extends ParserTestCase {
/**
* @return string|false
*/
public function getClass() {
return '\SMW\InternalParseBeforeLinks';
}
/**
* @since 1.9
*
* @return InternalParseBeforeLinks
*/
public function newInstance( &$parser = null, &$text = '' ) {
if ( $parser === null ) {
$parser = $this->newParser( $this->newTitle(), $this->getUser() );
}
$instance = new InternalParseBeforeLinks( $parser, $text );
$instance->invokeContext( new ExtensionContext() );
return $instance;
}
/**
* @since 1.9
*/
public function testConstructor() {
$this->assertInstanceOf( $this->getClass(), $this->newInstance() );
}
/**
* @dataProvider titleDataProvider
*
* @since 1.9
*/
public function testProcess( $title ) {
$parser = $this->newParser( $title, $this->getUser() );
$this->assertTrue(
$this->newInstance( $parser )->process(),
'asserts that process() always returns true'
);
}
/**
* @dataProvider textDataProvider
*
* @see ParserTextProcessorTest
*
* @since 1.9
*/
public function testSemanticDataParserOuputUpdateIntegration( $setup, $expected ) {
$text = $setup['text'];
$parser = $this->newParser( $setup['title'], $this->getUser() );
$instance = $this->newInstance( $parser, $text );
$instance->withContext()
->getDependencyBuilder()
->getContainer()
->registerObject( 'Settings', $this->newSettings( $setup['settings'] ) );
$this->assertTrue(
$instance->process(),
'asserts that process() always returns true'
);
$this->assertEquals(
$expected['resultText'],
$text,
'asserts that the text was modified within expected parameters'
);
// Re-read data from the Parser
$parserData = $this->newParserData( $parser->getTitle(), $parser->getOutput() );
$semanticDataValidator = new SemanticDataValidator;
$semanticDataValidator->assertThatPropertiesAreSet( $expected, $parserData->getSemanticData() );
}
/**
* @return array
*/
public function titleDataProvider() {
$provider = array();
// #0 Normal title
$provider[] = array( $this->newTitle() );
// #1 Title is a special page
$title = $this->newMockBuilder()->newObject( 'Title', array(
'isSpecialPage' => true,
) );
// #2 Title is a special page
$title = $this->newMockBuilder()->newObject( 'Title', array(
'isSpecialPage' => true,
'isSpecial' => true,
) );
// #3 Title is a special page
$title = $this->newMockBuilder()->newObject( 'Title', array(
'isSpecialPage' => true,
'isSpecial' => false,
) );
$provider[] = array( $title );
return $provider;
}
/**
* @return array
*/
public function textDataProvider() {
$provider = array();
// #0 NS_MAIN; [[FooBar...]] with a different caption
$provider[] = array(
array(
'title' => $this->newTitle( NS_MAIN ),
'settings' => array(
'smwgNamespacesWithSemanticLinks' => array( NS_MAIN => true ),
'smwgLinksInValues' => false,
'smwgInlineErrors' => true,
),
'text' => 'Lorem ipsum dolor sit &$% [[FooBar::dictumst|寒い]]' .
' [[Bar::tincidunt semper]] facilisi {{volutpat}} Ut quis' .
' [[foo::9001]] et Donec.',
),
array(
'resultText' => 'Lorem ipsum dolor sit &$% [[:Dictumst|寒い]]' .
' [[:Tincidunt semper|tincidunt semper]] facilisi {{volutpat}} Ut quis' .
' [[:9001|9001]] et Donec.',
'propertyCount' => 3,
'propertyLabels' => array( 'Foo', 'Bar', 'FooBar' ),
'propertyValues' => array( 'Dictumst', 'Tincidunt semper', '9001' )
)
);
// #1 NS_SPECIAL, processed but no annotations
$provider[] = array(
array(
'title' => $this->newTitle( NS_SPECIAL, 'Ask' ),
'settings' => array(
'smwgNamespacesWithSemanticLinks' => array( NS_MAIN => true ),
'smwgLinksInValues' => false,
'smwgInlineErrors' => true,
'smwgEnabledSpecialPage' => array( 'Ask', 'Foo' )
),
'text' => 'Lorem ipsum dolor sit &$% [[FooBar::dictumst|寒い]]' .
' [[Bar::tincidunt semper]] facilisi {{volutpat}} Ut quis' .
' [[foo::9001]] et Donec.',
),
array(
'resultText' => 'Lorem ipsum dolor sit &$% [[:Dictumst|寒い]]' .
' [[:Tincidunt semper|tincidunt semper]] facilisi {{volutpat}} Ut quis' .
' [[:9001|9001]] et Donec.',
'propertyCount' => 0
)
);
// #2 NS_SPECIAL, not processed
$provider[] = array(
array(
'title' => $this->newTitle( NS_SPECIAL, 'Foo' ),
'settings' => array(
'smwgNamespacesWithSemanticLinks' => array( NS_MAIN => true ),
'smwgLinksInValues' => false,
'smwgInlineErrors' => true,
'smwgEnabledSpecialPage' => array( 'Ask', 'Foo' )
),
'text' => 'Lorem ipsum dolor sit &$% [[FooBar::dictumst|寒い]]' .
' [[Bar::tincidunt semper]] facilisi {{volutpat}} Ut quis' .
' [[foo::9001]] et Donec.',
),
array(
'resultText' => 'Lorem ipsum dolor sit &$% [[FooBar::dictumst|寒い]]' .
' [[Bar::tincidunt semper]] facilisi {{volutpat}} Ut quis' .
' [[foo::9001]] et Donec.',
'propertyCount' => 0
)
);
return $provider;
}
}
| tuxun/smw-funwiki | extensions/SemanticMediaWiki/tests/phpunit/includes/hooks/InternalParseBeforeLinksTest.php | PHP | gpl-2.0 | 5,457 |
/**
* Copyright (c) 2005, 2009 IBM Corporation and others.
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributors:
* <Quatro Group Software Systems inc.> <OSCAR Team>
*/
package com.quatro.dao.security;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Example;
import org.oscarehr.util.MiscUtils;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.quatro.model.security.SecProvider;
/**
*
* @author JZhang
*
*/
public class SecProviderDao extends HibernateDaoSupport {
private static final Logger logger = MiscUtils.getLogger();
// property constants
public static final String LAST_NAME = "lastName";
public static final String FIRST_NAME = "firstName";
public static final String PROVIDER_TYPE = "providerType";
public static final String SPECIALTY = "specialty";
public static final String TEAM = "team";
public static final String SEX = "sex";
public static final String ADDRESS = "address";
public static final String PHONE = "phone";
public static final String WORK_PHONE = "workPhone";
public static final String OHIP_NO = "ohipNo";
public static final String RMA_NO = "rmaNo";
public static final String BILLING_NO = "billingNo";
public static final String HSO_NO = "hsoNo";
public static final String STATUS = "status";
public static final String COMMENTS = "comments";
public static final String PROVIDER_ACTIVITY = "providerActivity";
public void save(SecProvider transientInstance) {
logger.debug("saving Provider instance");
try {
this.getHibernateTemplate().save(transientInstance);
logger.debug("save successful");
} catch (RuntimeException re) {
logger.error("save failed", re);
throw re;
}
}
public void saveOrUpdate(SecProvider transientInstance) {
logger.debug("saving Provider instance");
try {
this.getHibernateTemplate().saveOrUpdate(transientInstance);
logger.debug("save successful");
} catch (RuntimeException re) {
logger.error("save failed", re);
throw re;
}
}
public void delete(SecProvider persistentInstance) {
logger.debug("deleting Provider instance");
try {
this.getHibernateTemplate().delete(persistentInstance);
logger.debug("delete successful");
} catch (RuntimeException re) {
logger.error("delete failed", re);
throw re;
}
}
public SecProvider findById(java.lang.String id) {
logger.debug("getting Provider instance with id: " + id);
try {
SecProvider instance = (SecProvider) this.getHibernateTemplate().get(
"com.quatro.model.security.SecProvider", id);
return instance;
} catch (RuntimeException re) {
logger.error("get failed", re);
throw re;
}
}
public SecProvider findById(java.lang.String id,String status) {
logger.debug("getting Provider instance with id: " + id);
try {
String sql ="from SecProvider where id=? and status=?";
List lst=this.getHibernateTemplate().find(sql,new Object[]{id,status});
if(lst.size()==0)
return null;
else
return (SecProvider) lst.get(0);
} catch (RuntimeException re) {
logger.error("get failed", re);
throw re;
}
}
public List findByExample(SecProviderDao instance) {
logger.debug("finding Provider instance by example");
Session session = getSession();
try {
List results = session.createCriteria(
"com.quatro.model.security.SecProvider").add(
Example.create(instance)).list();
logger.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
logger.error("find by example failed", re);
throw re;
} finally {
this.releaseSession(session);
}
}
public List findByProperty(String propertyName, Object value) {
logger.debug("finding Provider instance with property: " + propertyName
+ ", value: " + value);
Session session = getSession();
try {
String queryString = "from Provider as model where model."
+ propertyName + "= ?";
Query queryObject = session.createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
logger.error("find by property name failed", re);
throw re;
} finally {
this.releaseSession(session);
}
}
public List findByLastName(Object lastName) {
return findByProperty(LAST_NAME, lastName);
}
public List findByFirstName(Object firstName) {
return findByProperty(FIRST_NAME, firstName);
}
public List findByProviderType(Object providerType) {
return findByProperty(PROVIDER_TYPE, providerType);
}
public List findBySpecialty(Object specialty) {
return findByProperty(SPECIALTY, specialty);
}
public List findByTeam(Object team) {
return findByProperty(TEAM, team);
}
public List findBySex(Object sex) {
return findByProperty(SEX, sex);
}
public List findByAddress(Object address) {
return findByProperty(ADDRESS, address);
}
public List findByPhone(Object phone) {
return findByProperty(PHONE, phone);
}
public List findByWorkPhone(Object workPhone) {
return findByProperty(WORK_PHONE, workPhone);
}
public List findByOhipNo(Object ohipNo) {
return findByProperty(OHIP_NO, ohipNo);
}
public List findByRmaNo(Object rmaNo) {
return findByProperty(RMA_NO, rmaNo);
}
public List findByBillingNo(Object billingNo) {
return findByProperty(BILLING_NO, billingNo);
}
public List findByHsoNo(Object hsoNo) {
return findByProperty(HSO_NO, hsoNo);
}
public List findByStatus(Object status) {
return findByProperty(STATUS, status);
}
public List findByComments(Object comments) {
return findByProperty(COMMENTS, comments);
}
public List findByProviderActivity(Object providerActivity) {
return findByProperty(PROVIDER_ACTIVITY, providerActivity);
}
public List findAll() {
logger.debug("finding all Provider instances");
Session session = getSession();
try {
String queryString = "from Provider";
Query queryObject = session.createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
logger.error("find all failed", re);
throw re;
} finally {
this.releaseSession(session);
}
}
public SecProviderDao merge(SecProviderDao detachedInstance) {
logger.debug("merging Provider instance");
Session session = getSession();
try {
SecProviderDao result = (SecProviderDao) session.merge(detachedInstance);
logger.debug("merge successful");
return result;
} catch (RuntimeException re) {
logger.error("merge failed", re);
throw re;
} finally {
this.releaseSession(session);
}
}
public void attachDirty(SecProviderDao instance) {
logger.debug("attaching dirty Provider instance");
Session session = getSession();
try {
session.saveOrUpdate(instance);
logger.debug("attach successful");
} catch (RuntimeException re) {
logger.error("attach failed", re);
throw re;
} finally {
this.releaseSession(session);
}
}
public void attachClean(SecProviderDao instance) {
logger.debug("attaching clean Provider instance");
Session session = getSession();
try {
session.lock(instance, LockMode.NONE);
logger.debug("attach successful");
} catch (RuntimeException re) {
logger.error("attach failed", re);
throw re;
} finally {
this.releaseSession(session);
}
}
}
| scoophealth/oscar | src/main/java/com/quatro/dao/security/SecProviderDao.java | Java | gpl-2.0 | 8,178 |
<?php
/**
* WordPress User Page
*
* Handles authentication, registering, resetting passwords, forgot password,
* and other user handling.
*
* @package WordPress
*/
/** Make sure that the WordPress bootstrap has run before continuing. */
require( dirname(__FILE__) . '/wp-load.php' );
// Redirect to https login if forced to use SSL
if ( force_ssl_admin() && ! is_ssl() ) {
if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit();
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit();
}
}
/**
* Outputs the header for the login page.
*
* @uses do_action() Calls the 'login_head' for outputting HTML in the Log In
* header.
* @uses apply_filters() Calls 'login_headerurl' for the top login link.
* @uses apply_filters() Calls 'login_headertitle' for the top login title.
* @uses apply_filters() Calls 'login_message' on the message to display in the
* header.
* @uses $error The error global, which is checked for displaying errors.
*
* @param string $title Optional. WordPress Log In Page title to display in
* <title/> element.
* @param string $message Optional. Message to display in header.
* @param WP_Error $wp_error Optional. WordPress Error Object
*/
function login_header($title = 'Log In', $message = '', $wp_error = '') {
global $error, $interim_login, $current_site, $action;
// Don't index any of these forms
add_action( 'login_head', 'wp_no_robots' );
if ( empty($wp_error) )
$wp_error = new WP_Error();
// Shake it!
$shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
$shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
add_action( 'login_head', 'wp_shake_js', 12 );
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?> › <?php echo $title; ?></title>
<?php
wp_admin_css( 'wp-admin', true );
wp_admin_css( 'colors-fresh', true );
if ( wp_is_mobile() ) { ?>
<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" /><?php
}
do_action( 'login_enqueue_scripts' );
do_action( 'login_head' );
if ( is_multisite() ) {
$login_header_url = network_home_url();
$login_header_title = $current_site->site_name;
} else {
$login_header_url = __( 'http://wordpress.org/' );
$login_header_title = __( 'Powered by WordPress' );
}
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );
// Don't allow interim logins to navigate away from the page.
if ( $interim_login )
$login_header_url = '#';
$classes = array( 'login-action-' . $action, 'wp-core-ui' );
if ( wp_is_mobile() )
$classes[] = 'mobile';
if ( is_rtl() )
$classes[] = 'rtl';
$classes = apply_filters( 'login_body_class', $classes, $action );
?>
</head>
<body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<div id="login">
<h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<?php
unset( $login_header_url, $login_header_title );
$message = apply_filters('login_message', $message);
if ( !empty( $message ) )
echo $message . "\n";
// In case a plugin uses $error rather than the $wp_errors object
if ( !empty( $error ) ) {
$wp_error->add('error', $error);
unset($error);
}
if ( $wp_error->get_error_code() ) {
$errors = '';
$messages = '';
foreach ( $wp_error->get_error_codes() as $code ) {
$severity = $wp_error->get_error_data($code);
foreach ( $wp_error->get_error_messages($code) as $error ) {
if ( 'message' == $severity )
$messages .= ' ' . $error . "<br />\n";
else
$errors .= ' ' . $error . "<br />\n";
}
}
if ( !empty($errors) )
echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
if ( !empty($messages) )
echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
}
} // End of login_header()
/**
* Outputs the footer for the login page.
*
* @param string $input_id Which input to auto-focus
*/
function login_footer($input_id = '') {
global $interim_login;
// Don't allow interim logins to navigate away from the page.
if ( ! $interim_login ): ?>
<p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?' ); ?>"><?php printf( __( '← Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p>
<?php endif; ?>
</div>
<?php if ( !empty($input_id) ) : ?>
<script type="text/javascript">
try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
if(typeof wpOnload=='function')wpOnload();
</script>
<?php endif; ?>
<?php do_action('login_footer'); ?>
<div class="clear"></div>
</body>
</html>
<?php
}
function wp_shake_js() {
if ( wp_is_mobile() )
return;
?>
<script type="text/javascript">
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
function s(id,pos){g(id).left=pos+'px';}
function g(id){return document.getElementById(id).style;}
function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}
addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});
</script>
<?php
}
/**
* Handles sending password retrieval email to user.
*
* @uses $wpdb WordPress Database object
*
* @return bool|WP_Error True: when finish. WP_Error on error
*/
function retrieve_password() {
global $wpdb, $current_site;
$errors = new WP_Error();
if ( empty( $_POST['user_login'] ) ) {
$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
} else if ( strpos( $_POST['user_login'], '@' ) ) {
$user_data = get_user_by( 'email', trim( $_POST['user_login'] ) );
if ( empty( $user_data ) )
$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
} else {
$login = trim($_POST['user_login']);
$user_data = get_user_by('login', $login);
}
do_action('lostpassword_post');
if ( $errors->get_error_code() )
return $errors;
if ( !$user_data ) {
$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
return $errors;
}
// redefining user_login ensures we return the right case in the email
$user_login = $user_data->user_login;
$user_email = $user_data->user_email;
do_action('retreive_password', $user_login); // Misspelled and deprecated
do_action('retrieve_password', $user_login);
$allow = apply_filters('allow_password_reset', true, $user_data->ID);
if ( ! $allow )
return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
else if ( is_wp_error($allow) )
return $allow;
$key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
if ( empty($key) ) {
// Generate something random for a key...
$key = wp_generate_password(20, false);
do_action('retrieve_password_key', $user_login, $key);
// Now insert the new md5 key into the db
$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
}
$message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
$message .= network_home_url( '/' ) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
if ( is_multisite() )
$blogname = $GLOBALS['current_site']->site_name;
else
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$title = sprintf( __('[%s] Password Reset'), $blogname );
$title = apply_filters('retrieve_password_title', $title);
$message = apply_filters('retrieve_password_message', $message, $key);
if ( $message && !wp_mail($user_email, $title, $message) )
wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') );
return true;
}
/**
* Retrieves a user row based on password reset key and login
*
* @uses $wpdb WordPress Database object
*
* @param string $key Hash to validate sending user's password
* @param string $login The user login
* @return object|WP_Error User's database row on success, error object for invalid keys
*/
function check_password_reset_key($key, $login) {
global $wpdb;
$key = preg_replace('/[^a-z0-9]/i', '', $key);
if ( empty( $key ) || !is_string( $key ) )
return new WP_Error('invalid_key', __('Invalid key'));
if ( empty($login) || !is_string($login) )
return new WP_Error('invalid_key', __('Invalid key'));
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
if ( empty( $user ) )
return new WP_Error('invalid_key', __('Invalid key'));
return $user;
}
/**
* Handles resetting the user's password.
*
* @param object $user The user
* @param string $new_pass New password for the user in plaintext
*/
function reset_password($user, $new_pass) {
do_action('password_reset', $user, $new_pass);
wp_set_password($new_pass, $user->ID);
wp_password_change_notification($user);
}
/**
* Handles registering a new user.
*
* @param string $user_login User's username for logging in
* @param string $user_email User's email address to send password and add
* @return int|WP_Error Either user's ID or error on failure.
*/
function register_new_user( $user_login, $user_email ) {
$errors = new WP_Error();
$sanitized_user_login = sanitize_user( $user_login );
$user_email = apply_filters( 'user_registration_email', $user_email );
// Check the username
if ( $sanitized_user_login == '' ) {
$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
} elseif ( ! validate_username( $user_login ) ) {
$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
$sanitized_user_login = '';
} elseif ( username_exists( $sanitized_user_login ) ) {
$errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ) );
}
// Check the e-mail address
if ( $user_email == '' ) {
$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your e-mail address.' ) );
} elseif ( ! is_email( $user_email ) ) {
$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn’t correct.' ) );
$user_email = '';
} elseif ( email_exists( $user_email ) ) {
$errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
}
do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
$errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
if ( $errors->get_error_code() )
return $errors;
$user_pass = wp_generate_password( 12, false);
$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
if ( ! $user_id ) {
$errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
return $errors;
}
update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
wp_new_user_notification( $user_id, $user_pass );
return $user_id;
}
//
// Main
//
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
$errors = new WP_Error();
if ( isset($_GET['key']) )
$action = 'resetpass';
// validate action so as to default to the login screen
if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) )
$action = 'login';
nocache_headers();
header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
$url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
if ( $url != get_option( 'siteurl' ) )
update_option( 'siteurl', $url );
}
//Set a cookie now to see if they are supported by the browser.
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
if ( SITECOOKIEPATH != COOKIEPATH )
setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
// allow plugins to override the default actions, and to add extra actions if they want
do_action( 'login_init' );
do_action( 'login_form_' . $action );
$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
switch ($action) {
case 'postpass' :
if ( empty( $wp_hasher ) ) {
require_once( ABSPATH . 'wp-includes/class-phpass.php' );
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, true);
}
// 10 days
setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );
wp_safe_redirect( wp_get_referer() );
exit();
break;
case 'logout' :
check_admin_referer('log-out');
wp_logout();
$redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
wp_safe_redirect( $redirect_to );
exit();
break;
case 'lostpassword' :
case 'retrievepassword' :
if ( $http_post ) {
$errors = retrieve_password();
if ( !is_wp_error($errors) ) {
$redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
wp_safe_redirect( $redirect_to );
exit();
}
}
if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
$redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
do_action('lost_password');
login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors);
$user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
?>
<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
<p>
<label for="user_login" ><?php _e('Username or E-mail:') ?><br />
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
</p>
<?php do_action('lostpassword_form'); ?>
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Get New Password'); ?>" /></p>
</form>
<p id="nav">
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
<?php if ( get_option( 'users_can_register' ) ) : ?>
| <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a>
<?php endif; ?>
</p>
<?php
login_footer('user_login');
break;
case 'resetpass' :
case 'rp' :
$user = check_password_reset_key($_GET['key'], $_GET['login']);
if ( is_wp_error($user) ) {
wp_redirect( site_url('wp-login.php?action=lostpassword&error=invalidkey') );
exit;
}
$errors = new WP_Error();
if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
do_action( 'validate_password_reset', $errors, $user );
if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
reset_password($user, $_POST['pass1']);
login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
login_footer();
exit;
}
wp_enqueue_script('utils');
wp_enqueue_script('user-profile');
login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
?>
<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( site_url( 'wp-login.php?action=resetpass&key=' . urlencode( $_GET['key'] ) . '&login=' . urlencode( $_GET['login'] ), 'login_post' ) ); ?>" method="post">
<input type="hidden" id="user_login" value="<?php echo esc_attr( $_GET['login'] ); ?>" autocomplete="off" />
<p>
<label for="pass1"><?php _e('New password') ?><br />
<input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label>
</p>
<p>
<label for="pass2"><?php _e('Confirm new password') ?><br />
<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label>
</p>
<div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator'); ?></div>
<p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).'); ?></p>
<br class="clear" />
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p>
</form>
<p id="nav">
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
<?php if ( get_option( 'users_can_register' ) ) : ?>
| <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a>
<?php endif; ?>
</p>
<?php
login_footer('user_pass');
break;
case 'register' :
if ( is_multisite() ) {
// Multisite uses wp-signup.php
wp_redirect( apply_filters( 'wp_signup_location', network_site_url('wp-signup.php') ) );
exit;
}
if ( !get_option('users_can_register') ) {
wp_redirect( site_url('wp-login.php?registration=disabled') );
exit();
}
$user_login = '';
$user_email = '';
if ( $http_post ) {
$user_login = wp_unslash( $_POST['user_login'] );
$user_email = wp_unslash( $_POST['user_email'] );
$errors = register_new_user($user_login, $user_email);
if ( !is_wp_error($errors) ) {
$redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
wp_safe_redirect( $redirect_to );
exit();
}
}
$redirect_to = apply_filters( 'registration_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
?>
<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post">
<p>
<label for="user_login"><?php _e('Username') ?><br />
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label>
</p>
<p>
<label for="user_email"><?php _e('E-mail') ?><br />
<input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( $user_email ); ?>" size="25" /></label>
</p>
<?php do_action('register_form'); ?>
<p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
<br class="clear" />
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register'); ?>" /></p>
</form>
<p id="nav">
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ) ?>"><?php _e( 'Lost your password?' ); ?></a>
</p>
<?php
login_footer('user_login');
break;
case 'login' :
default:
$secure_cookie = '';
$interim_login = isset($_REQUEST['interim-login']);
$customize_login = isset( $_REQUEST['customize-login'] );
if ( $customize_login )
wp_enqueue_script( 'customize-base' );
// If the user wants ssl but the session is not ssl, force a secure cookie.
if ( !empty($_POST['log']) && !force_ssl_admin() ) {
$user_name = sanitize_user($_POST['log']);
if ( $user = get_user_by('login', $user_name) ) {
if ( get_user_option('use_ssl', $user->ID) ) {
$secure_cookie = true;
force_ssl_admin(true);
}
}
}
if ( isset( $_REQUEST['redirect_to'] ) ) {
$redirect_to = $_REQUEST['redirect_to'];
// Redirect to https if user wants ssl
if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
} else {
$redirect_to = admin_url();
}
$reauth = empty($_REQUEST['reauth']) ? false : true;
// If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
// cookie and redirect back to the referring non-secure admin page. This allows logins to always be POSTed over SSL while allowing the user to choose visiting
// the admin via http or https.
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
$secure_cookie = false;
$user = wp_signon('', $secure_cookie);
$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
if ( !is_wp_error($user) && !$reauth ) {
if ( $interim_login ) {
$message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
login_header( '', $message ); ?>
<?php if ( ! $customize_login ) : ?>
<script type="text/javascript">setTimeout( function(){window.close()}, 8000);</script>
<p class="alignright">
<input type="button" class="button-primary" value="<?php esc_attr_e('Close'); ?>" onclick="window.close()" /></p>
<?php endif; ?>
</div>
<?php do_action( 'login_footer' ); ?>
<?php if ( $customize_login ) : ?>
<script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
<?php endif; ?>
</body></html>
<?php exit;
}
if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
// If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) )
$redirect_to = user_admin_url();
elseif ( is_multisite() && !$user->has_cap('read') )
$redirect_to = get_dashboard_url( $user->ID );
elseif ( !$user->has_cap('edit_posts') )
$redirect_to = admin_url('profile.php');
}
wp_safe_redirect($redirect_to);
exit();
}
$errors = $user;
// Clear errors if loggedout is set.
if ( !empty($_GET['loggedout']) || $reauth )
$errors = new WP_Error();
// If cookies are disabled we can't log in even with a valid user+pass
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
// Some parts of this script use the main login form to display a message
if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] )
$errors->add('loggedout', __('You are now logged out.'), 'message');
elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
$errors->add('registerdisabled', __('User registration is currently not allowed.'));
elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
$errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
$errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
$errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
elseif ( $interim_login )
$errors->add('expired', __('Your session has expired. Please log-in again.'), 'message');
elseif ( strpos( $redirect_to, 'about.php?updated' ) )
$errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.' ), 'message' );
// Clear any stale cookies.
if ( $reauth )
wp_clear_auth_cookie();
login_header(__('Log In'), '', $errors);
if ( isset($_POST['log']) )
$user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : '';
$rememberme = ! empty( $_POST['rememberme'] );
?>
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
<p>
<label for="user_login"><?php _e('Username') ?><br />
<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
</p>
<p>
<label for="user_pass"><?php _e('Password') ?><br />
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
</p>
<?php do_action('login_form'); ?>
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
<p class="submit">
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" />
<?php if ( $interim_login ) { ?>
<input type="hidden" name="interim-login" value="1" />
<?php } else { ?>
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
<?php } ?>
<?php if ( $customize_login ) : ?>
<input type="hidden" name="customize-login" value="1" />
<?php endif; ?>
<input type="hidden" name="testcookie" value="1" />
</p>
</form>
<?php if ( ! $interim_login ) { ?>
<p id="nav">
<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : ?>
<?php if ( get_option( 'users_can_register' ) ) : ?>
<a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a> |
<?php endif; ?>
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
<?php endif; ?>
</p>
<?php } ?>
<script type="text/javascript">
function wp_attempt_focus(){
setTimeout( function(){ try{
<?php if ( $user_login || $interim_login ) { ?>
d = document.getElementById('user_pass');
d.value = '';
<?php } else { ?>
d = document.getElementById('user_login');
<?php if ( 'invalid_username' == $errors->get_error_code() ) { ?>
if( d.value != '' )
d.value = '';
<?php
}
}?>
d.focus();
d.select();
} catch(e){}
}, 200);
}
<?php if ( !$error ) { ?>
wp_attempt_focus();
<?php } ?>
if(typeof wpOnload=='function')wpOnload();
</script>
<?php
login_footer();
break;
} // end action switch
| darynl/test-rcas | wp-login.php | PHP | gpl-2.0 | 29,165 |
/***************************************************************************
esrip.h
Interface file for the Entertainment Sciences RIP
Written by Phil Bennett
***************************************************************************/
#ifndef _ESRIP_H
#define _ESRIP_H
/***************************************************************************
COMPILE-TIME DEFINITIONS
***************************************************************************/
/***************************************************************************
GLOBAL CONSTANTS
***************************************************************************/
/***************************************************************************
REGISTER ENUMERATION
***************************************************************************/
enum
{
ESRIP_PC = 1,
ESRIP_ACC,
ESRIP_DLATCH,
ESRIP_ILATCH,
ESRIP_RAM00,
ESRIP_RAM01,
ESRIP_RAM02,
ESRIP_RAM03,
ESRIP_RAM04,
ESRIP_RAM05,
ESRIP_RAM06,
ESRIP_RAM07,
ESRIP_RAM08,
ESRIP_RAM09,
ESRIP_RAM0A,
ESRIP_RAM0B,
ESRIP_RAM0C,
ESRIP_RAM0D,
ESRIP_RAM0E,
ESRIP_RAM0F,
ESRIP_RAM10,
ESRIP_RAM11,
ESRIP_RAM12,
ESRIP_RAM13,
ESRIP_RAM14,
ESRIP_RAM15,
ESRIP_RAM16,
ESRIP_RAM17,
ESRIP_RAM18,
ESRIP_RAM19,
ESRIP_RAM1A,
ESRIP_RAM1B,
ESRIP_RAM1C,
ESRIP_RAM1D,
ESRIP_RAM1E,
ESRIP_RAM1F,
ESRIP_STATW,
ESRIP_FDTC,
ESRIP_IPTC,
ESRIP_XSCALE,
ESRIP_YSCALE,
ESRIP_BANK,
ESRIP_LINE,
ESRIP_FIG,
ESRIP_ATTR,
ESRIP_ADRL,
ESRIP_ADRR,
ESRIP_COLR,
ESRIP_IADDR,
};
/***************************************************************************
CONFIGURATION STRUCTURE
***************************************************************************/
typedef struct _esrip_config_ esrip_config;
struct _esrip_config_
{
read16_device_func fdt_r;
write16_device_func fdt_w;
UINT8 (*status_in)(running_machine &machine);
int (*draw)(running_machine &machine, int l, int r, int fig, int attr, int addr, int col, int x_scale, int bank);
const char* const lbrm_prom;
};
/***************************************************************************
PUBLIC FUNCTIONS
***************************************************************************/
DECLARE_LEGACY_CPU_DEVICE(ESRIP, esrip);
extern UINT8 get_rip_status(device_t *cpu);
#endif /* _ESRIP_H */
| Luke-Nukem/mame-144-vector_mod | src/emu/cpu/esrip/esrip.h | C | gpl-2.0 | 2,406 |
<?php
/**
* the file for the sanitizer functions.
*
* @link http://registration_magic.com
* @since 1.0.0
*
* @package Registraion_Magic
* @subpackage Registraion_Magic/includes
*/
class RM_Sanitizer
{
/**
* Sanitizes the request variable
*
* @since 1.0.0
*/
public static function sanitize_request($req)
{
$request = RM_Utilities::trim_array($req);
return $request;
}
}
| developmentDM2/The-Haute-Mess | wp-content/plugins/custom-registration-form-builder-with-submission-manager/includes/class_rm_sanitizer.php | PHP | gpl-2.0 | 450 |
/*
* Framebuffer driver for EFI/UEFI based system
*
* (c) 2006 Edgar Hucek <gimli@dark-green.com>
* Original efi driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/fb.h>
#include <linux/platform_device.h>
#include <linux/screen_info.h>
#include <linux/dmi.h>
#include <linux/pci.h>
#include <video/vga.h>
static bool request_mem_succeeded = false;
static struct fb_var_screeninfo efifb_defined __devinitdata = {
.activate = FB_ACTIVATE_NOW,
.height = -1,
.width = -1,
.right_margin = 32,
.upper_margin = 16,
.lower_margin = 4,
.vsync_len = 4,
.vmode = FB_VMODE_NONINTERLACED,
};
static struct fb_fix_screeninfo efifb_fix __devinitdata = {
.id = "EFI VGA",
.type = FB_TYPE_PACKED_PIXELS,
.accel = FB_ACCEL_NONE,
.visual = FB_VISUAL_TRUECOLOR,
};
enum {
M_I17, /* 17-Inch iMac */
M_I20, /* 20-Inch iMac */
M_I20_SR, /* 20-Inch iMac (Santa Rosa) */
M_I24, /* 24-Inch iMac */
M_I24_8_1, /* 24-Inch iMac, 8,1th gen */
M_I24_10_1, /* 24-Inch iMac, 10,1th gen */
M_I27_11_1, /* 27-Inch iMac, 11,1th gen */
M_MINI, /* Mac Mini */
M_MINI_3_1, /* Mac Mini, 3,1th gen */
M_MINI_4_1, /* Mac Mini, 4,1th gen */
M_MB, /* MacBook */
M_MB_2, /* MacBook, 2nd rev. */
M_MB_3, /* MacBook, 3rd rev. */
M_MB_5_1, /* MacBook, 5th rev. */
M_MB_6_1, /* MacBook, 6th rev. */
M_MB_7_1, /* MacBook, 7th rev. */
M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */
M_MBA, /* MacBook Air */
M_MBA_3, /* Macbook Air, 3rd rev */
M_MBP, /* MacBook Pro */
M_MBP_2, /* MacBook Pro 2nd gen */
M_MBP_2_2, /* MacBook Pro 2,2nd gen */
M_MBP_SR, /* MacBook Pro (Santa Rosa) */
M_MBP_4, /* MacBook Pro, 4th gen */
M_MBP_5_1, /* MacBook Pro, 5,1th gen */
M_MBP_5_2, /* MacBook Pro, 5,2th gen */
M_MBP_5_3, /* MacBook Pro, 5,3rd gen */
M_MBP_6_1, /* MacBook Pro, 6,1th gen */
M_MBP_6_2, /* MacBook Pro, 6,2th gen */
M_MBP_7_1, /* MacBook Pro, 7,1th gen */
M_MBP_8_2, /* MacBook Pro, 8,2nd gen */
M_UNKNOWN /* placeholder */
};
#define OVERRIDE_NONE 0x0
#define OVERRIDE_BASE 0x1
#define OVERRIDE_STRIDE 0x2
#define OVERRIDE_HEIGHT 0x4
#define OVERRIDE_WIDTH 0x8
static struct efifb_dmi_info {
char *optname;
unsigned long base;
int stride;
int width;
int height;
int flags;
} dmi_list[] __initdata = {
[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE }, /* guess */
[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE },
[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE }, /* guess */
[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080, OVERRIDE_NONE },
[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440, OVERRIDE_NONE },
[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768, OVERRIDE_NONE },
[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768, OVERRIDE_NONE },
[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
/* 11" Macbook Air 3,1 passes the wrong stride */
[M_MBA_3] = { "mba3", 0, 2048 * 4, 0, 0, OVERRIDE_STRIDE },
[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_2] = { "mbp2", 0, 0, 0, 0, OVERRIDE_NONE }, /* placeholder */
[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050, OVERRIDE_NONE },
[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MBP_8_2] = { "mbp82", 0x90010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
};
static int set_system(const struct dmi_system_id *id);
#define EFIFB_DMI_SYSTEM_ID(vendor, name, enumid) \
{ set_system, name, { \
DMI_MATCH(DMI_BIOS_VENDOR, vendor), \
DMI_MATCH(DMI_PRODUCT_NAME, name) }, \
&dmi_list[enumid] }
static const struct dmi_system_id dmi_system_table[] __initconst = {
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac4,1", M_I17),
/* At least one of these two will be right; maybe both? */
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac5,1", M_I20),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac5,1", M_I20),
/* At least one of these two will be right; maybe both? */
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac6,1", M_I24),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac6,1", M_I24),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac7,1", M_I20_SR),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac8,1", M_I24_8_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac10,1", M_I24_10_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac11,1", M_I27_11_1),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "Macmini1,1", M_MINI),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "Macmini3,1", M_MINI_3_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "Macmini4,1", M_MINI_4_1),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook1,1", M_MB),
/* At least one of these two will be right; maybe both? */
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook2,1", M_MB),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook2,1", M_MB),
/* At least one of these two will be right; maybe both? */
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook3,1", M_MB),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook3,1", M_MB),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook4,1", M_MB),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook5,1", M_MB_5_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook6,1", M_MB_6_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook7,1", M_MB_7_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir3,1", M_MBA_3),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,2", M_MBP_2_2),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro2,1", M_MBP_2),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro3,1", M_MBP_SR),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro3,1", M_MBP_SR),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro4,1", M_MBP_4),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,1", M_MBP_5_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,2", M_MBP_5_2),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,3", M_MBP_5_3),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,1", M_MBP_6_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,2", M_MBP_6_2),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro7,1", M_MBP_7_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro8,2", M_MBP_8_2),
{},
};
#define choose_value(dmivalue, fwvalue, field, flags) ({ \
typeof(fwvalue) _ret_ = fwvalue; \
if ((flags) & (field)) \
_ret_ = dmivalue; \
else if ((fwvalue) == 0) \
_ret_ = dmivalue; \
_ret_; \
})
static int set_system(const struct dmi_system_id *id)
{
struct efifb_dmi_info *info = id->driver_data;
if (info->base == 0 && info->height == 0 && info->width == 0
&& info->stride == 0)
return 0;
/* Trust the bootloader over the DMI tables */
if (screen_info.lfb_base == 0) {
#if defined(CONFIG_PCI)
struct pci_dev *dev = NULL;
int found_bar = 0;
#endif
if (info->base) {
screen_info.lfb_base = choose_value(info->base,
screen_info.lfb_base, OVERRIDE_BASE,
info->flags);
#if defined(CONFIG_PCI)
/* make sure that the address in the table is actually
* on a VGA device's PCI BAR */
for_each_pci_dev(dev) {
int i;
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
continue;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
resource_size_t start, end;
start = pci_resource_start(dev, i);
if (start == 0)
break;
end = pci_resource_end(dev, i);
if (screen_info.lfb_base >= start &&
screen_info.lfb_base < end) {
found_bar = 1;
}
}
}
if (!found_bar)
screen_info.lfb_base = 0;
#endif
}
}
if (screen_info.lfb_base) {
screen_info.lfb_linelength = choose_value(info->stride,
screen_info.lfb_linelength, OVERRIDE_STRIDE,
info->flags);
screen_info.lfb_width = choose_value(info->width,
screen_info.lfb_width, OVERRIDE_WIDTH,
info->flags);
screen_info.lfb_height = choose_value(info->height,
screen_info.lfb_height, OVERRIDE_HEIGHT,
info->flags);
if (screen_info.orig_video_isVGA == 0)
screen_info.orig_video_isVGA = VIDEO_TYPE_EFI;
} else {
screen_info.lfb_linelength = 0;
screen_info.lfb_width = 0;
screen_info.lfb_height = 0;
screen_info.orig_video_isVGA = 0;
return 0;
}
printk(KERN_INFO "efifb: dmi detected %s - framebuffer at 0x%08x "
"(%dx%d, stride %d)\n", id->ident,
screen_info.lfb_base, screen_info.lfb_width,
screen_info.lfb_height, screen_info.lfb_linelength);
return 1;
}
static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *info)
{
/*
* Set a single color register. The values supplied are
* already rounded down to the hardware's capabilities
* (according to the entries in the `var' structure). Return
* != 0 for invalid regno.
*/
if (regno >= info->cmap.len)
return 1;
if (regno < 16) {
red >>= 8;
green >>= 8;
blue >>= 8;
((u32 *)(info->pseudo_palette))[regno] =
(red << info->var.red.offset) |
(green << info->var.green.offset) |
(blue << info->var.blue.offset);
}
return 0;
}
static void efifb_destroy(struct fb_info *info)
{
if (info->screen_base)
iounmap(info->screen_base);
if (request_mem_succeeded)
release_mem_region(info->apertures->ranges[0].base,
info->apertures->ranges[0].size);
framebuffer_release(info);
}
static struct fb_ops efifb_ops = {
.owner = THIS_MODULE,
.fb_destroy = efifb_destroy,
.fb_setcolreg = efifb_setcolreg,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
};
static int __init efifb_setup(char *options)
{
char *this_opt;
int i;
if (!options || !*options)
return 0;
while ((this_opt = strsep(&options, ",")) != NULL) {
if (!*this_opt) continue;
for (i = 0; i < M_UNKNOWN; i++) {
if (!strcmp(this_opt, dmi_list[i].optname) &&
dmi_list[i].base != 0) {
screen_info.lfb_base = dmi_list[i].base;
screen_info.lfb_linelength = dmi_list[i].stride;
screen_info.lfb_width = dmi_list[i].width;
screen_info.lfb_height = dmi_list[i].height;
}
}
if (!strncmp(this_opt, "base:", 5))
screen_info.lfb_base = simple_strtoul(this_opt+5, NULL, 0);
else if (!strncmp(this_opt, "stride:", 7))
screen_info.lfb_linelength = simple_strtoul(this_opt+7, NULL, 0) * 4;
else if (!strncmp(this_opt, "height:", 7))
screen_info.lfb_height = simple_strtoul(this_opt+7, NULL, 0);
else if (!strncmp(this_opt, "width:", 6))
screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0);
}
return 0;
}
static int __init efifb_probe(struct platform_device *dev)
{
struct fb_info *info;
int err;
unsigned int size_vmode;
unsigned int size_remap;
unsigned int size_total;
if (!screen_info.lfb_depth)
screen_info.lfb_depth = 32;
if (!screen_info.pages)
screen_info.pages = 1;
if (!screen_info.lfb_base) {
printk(KERN_DEBUG "efifb: invalid framebuffer address\n");
return -ENODEV;
}
printk(KERN_INFO "efifb: probing for efifb\n");
/* just assume they're all unset if any are */
if (!screen_info.blue_size) {
screen_info.blue_size = 8;
screen_info.blue_pos = 0;
screen_info.green_size = 8;
screen_info.green_pos = 8;
screen_info.red_size = 8;
screen_info.red_pos = 16;
screen_info.rsvd_size = 8;
screen_info.rsvd_pos = 24;
}
efifb_fix.smem_start = screen_info.lfb_base;
efifb_defined.bits_per_pixel = screen_info.lfb_depth;
efifb_defined.xres = screen_info.lfb_width;
efifb_defined.yres = screen_info.lfb_height;
efifb_fix.line_length = screen_info.lfb_linelength;
/* size_vmode -- that is the amount of memory needed for the
* used video mode, i.e. the minimum amount of
* memory we need. */
size_vmode = efifb_defined.yres * efifb_fix.line_length;
/* size_total -- all video memory we have. Used for
* entries, ressource allocation and bounds
* checking. */
size_total = screen_info.lfb_size;
if (size_total < size_vmode)
size_total = size_vmode;
/* size_remap -- the amount of video memory we are going to
* use for efifb. With modern cards it is no
* option to simply use size_total as that
* wastes plenty of kernel address space. */
size_remap = size_vmode * 2;
if (size_remap > size_total)
size_remap = size_total;
if (size_remap % PAGE_SIZE)
size_remap += PAGE_SIZE - (size_remap % PAGE_SIZE);
efifb_fix.smem_len = size_remap;
if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) {
request_mem_succeeded = true;
} else {
/* We cannot make this fatal. Sometimes this comes from magic
spaces our resource handlers simply don't know about */
printk(KERN_WARNING
"efifb: cannot reserve video memory at 0x%lx\n",
efifb_fix.smem_start);
}
info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
if (!info) {
printk(KERN_ERR "efifb: cannot allocate framebuffer\n");
err = -ENOMEM;
goto err_release_mem;
}
info->pseudo_palette = info->par;
info->par = NULL;
info->apertures = alloc_apertures(1);
if (!info->apertures) {
err = -ENOMEM;
goto err_release_fb;
}
info->apertures->ranges[0].base = efifb_fix.smem_start;
info->apertures->ranges[0].size = size_remap;
info->screen_base = ioremap_wc(efifb_fix.smem_start, efifb_fix.smem_len);
if (!info->screen_base) {
printk(KERN_ERR "efifb: abort, cannot ioremap video memory "
"0x%x @ 0x%lx\n",
efifb_fix.smem_len, efifb_fix.smem_start);
err = -EIO;
goto err_release_fb;
}
printk(KERN_INFO "efifb: framebuffer at 0x%lx, mapped to 0x%p, "
"using %dk, total %dk\n",
efifb_fix.smem_start, info->screen_base,
size_remap/1024, size_total/1024);
printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
efifb_defined.xres, efifb_defined.yres,
efifb_defined.bits_per_pixel, efifb_fix.line_length,
screen_info.pages);
efifb_defined.xres_virtual = efifb_defined.xres;
efifb_defined.yres_virtual = efifb_fix.smem_len /
efifb_fix.line_length;
printk(KERN_INFO "efifb: scrolling: redraw\n");
efifb_defined.yres_virtual = efifb_defined.yres;
/* some dummy values for timing to make fbset happy */
efifb_defined.pixclock = 10000000 / efifb_defined.xres *
1000 / efifb_defined.yres;
efifb_defined.left_margin = (efifb_defined.xres / 8) & 0xf8;
efifb_defined.hsync_len = (efifb_defined.xres / 8) & 0xf8;
efifb_defined.red.offset = screen_info.red_pos;
efifb_defined.red.length = screen_info.red_size;
efifb_defined.green.offset = screen_info.green_pos;
efifb_defined.green.length = screen_info.green_size;
efifb_defined.blue.offset = screen_info.blue_pos;
efifb_defined.blue.length = screen_info.blue_size;
efifb_defined.transp.offset = screen_info.rsvd_pos;
efifb_defined.transp.length = screen_info.rsvd_size;
printk(KERN_INFO "efifb: %s: "
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
"Truecolor",
screen_info.rsvd_size,
screen_info.red_size,
screen_info.green_size,
screen_info.blue_size,
screen_info.rsvd_pos,
screen_info.red_pos,
screen_info.green_pos,
screen_info.blue_pos);
efifb_fix.ypanstep = 0;
efifb_fix.ywrapstep = 0;
info->fbops = &efifb_ops;
info->var = efifb_defined;
info->fix = efifb_fix;
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;
if ((err = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) {
printk(KERN_ERR "efifb: cannot allocate colormap\n");
goto err_unmap;
}
if ((err = register_framebuffer(info)) < 0) {
printk(KERN_ERR "efifb: cannot register framebuffer\n");
goto err_fb_dealoc;
}
printk(KERN_INFO "fb%d: %s frame buffer device\n",
info->node, info->fix.id);
return 0;
err_fb_dealoc:
fb_dealloc_cmap(&info->cmap);
err_unmap:
iounmap(info->screen_base);
err_release_fb:
framebuffer_release(info);
err_release_mem:
if (request_mem_succeeded)
release_mem_region(efifb_fix.smem_start, size_total);
return err;
}
static struct platform_driver efifb_driver = {
.driver = {
.name = "efifb",
},
};
static struct platform_device efifb_device = {
.name = "efifb",
};
static int __init efifb_init(void)
{
int ret;
char *option = NULL;
dmi_check_system(dmi_system_table);
if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
return -ENODEV;
if (fb_get_options("efifb", &option))
return -ENODEV;
efifb_setup(option);
/* We don't get linelength from UGA Draw Protocol, only from
* EFI Graphics Protocol. So if it's not in DMI, and it's not
* passed in from the user, we really can't use the framebuffer.
*/
if (!screen_info.lfb_linelength)
return -ENODEV;
ret = platform_device_register(&efifb_device);
if (ret)
return ret;
/*
* This is not just an optimization. We will interfere
* with a real driver if we get reprobed, so don't allow
* it.
*/
ret = platform_driver_probe(&efifb_driver, efifb_probe);
if (ret) {
platform_device_unregister(&efifb_device);
return ret;
}
return ret;
}
module_init(efifb_init);
MODULE_LICENSE("GPL");
| jeffegg/beaglebone | drivers/video/efifb.c | C | gpl-2.0 | 18,814 |
package edu.stanford.nlp.stats;
import edu.stanford.nlp.classify.Classifier;
import edu.stanford.nlp.classify.GeneralDataset;
import edu.stanford.nlp.pipeline.LabeledChunkIdentifier;
import edu.stanford.nlp.util.HashIndex;
import edu.stanford.nlp.util.Index;
import edu.stanford.nlp.util.StringUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
/**
* Calculates phrase based precision and recall (similar to conlleval)
* Handles various encodings such as IO, IOB, IOE, BILOU, SBEIO, []
*
* Usage: java edu.stanford.nlp.stats.MultiClassChunkEvalStats [options] < filename
* -r - Do raw token based evaluation
* -d <delimiter> - Specifies delimiter to use (instead of tab)
* -b <boundary> - Boundary token (default is -X- )
* -t <defaultTag> - Default tag to use if tag is not prefixed (i.e. is not X-xxx )
* -ignoreProvidedTag - Discards the provided tag (i.e. if label is X-xxx, just use xxx for evaluation)
* @author Angel Chang
*/
public class MultiClassChunkEvalStats extends MultiClassPrecisionRecallExtendedStats.MultiClassStringLabelStats {
private boolean inCorrect = false;
private LabeledChunkIdentifier.LabelTagType prevCorrect = null;
private LabeledChunkIdentifier.LabelTagType prevGuess = null;
private LabeledChunkIdentifier chunker;
private boolean useLabel = false;
public <F> MultiClassChunkEvalStats(Classifier<String,F> classifier, GeneralDataset<String,F> data, String negLabel)
{
super(classifier, data, negLabel);
chunker = new LabeledChunkIdentifier();
chunker.setNegLabel(negLabel);
}
public MultiClassChunkEvalStats(String negLabel)
{
super(negLabel);
chunker = new LabeledChunkIdentifier();
chunker.setNegLabel(negLabel);
}
public MultiClassChunkEvalStats(Index<String> dataLabelIndex, String negLabel)
{
super(dataLabelIndex, negLabel);
chunker = new LabeledChunkIdentifier();
chunker.setNegLabel(negLabel);
}
public LabeledChunkIdentifier getChunker()
{
return chunker;
}
public void clearCounts()
{
super.clearCounts();
inCorrect = false;
prevCorrect = null;
prevGuess = null;
}
protected void finalizeCounts()
{
markBoundary();
super.finalizeCounts();
}
private String getTypeLabel(LabeledChunkIdentifier.LabelTagType tagType)
{
if (useLabel) return tagType.label;
else return tagType.type;
}
protected void markBoundary()
{
if (inCorrect) {
inCorrect=false;
correctGuesses.incrementCount(getTypeLabel(prevCorrect));
}
prevGuess = null;
prevCorrect = null;
}
protected void addGuess(String guess, String trueLabel, boolean addUnknownLabels)
{
LabeledChunkIdentifier.LabelTagType guessTagType = chunker.getTagType(guess);
LabeledChunkIdentifier.LabelTagType correctTagType = chunker.getTagType(trueLabel);
addGuess(guessTagType, correctTagType, addUnknownLabels);
}
protected void addGuess(LabeledChunkIdentifier.LabelTagType guess,
LabeledChunkIdentifier.LabelTagType correct, boolean addUnknownLabels)
{
if (addUnknownLabels) {
if (labelIndex == null) {
labelIndex = new HashIndex<>();
}
labelIndex.add(getTypeLabel(guess));
labelIndex.add(getTypeLabel(correct));
}
if (inCorrect) {
boolean prevCorrectEnded = chunker.isEndOfChunk(prevCorrect, correct);
boolean prevGuessEnded = chunker.isEndOfChunk(prevGuess, guess);
if (prevCorrectEnded && prevGuessEnded && prevGuess.typeMatches(prevCorrect)) {
inCorrect=false;
correctGuesses.incrementCount(getTypeLabel(prevCorrect));
} else if (prevCorrectEnded != prevGuessEnded || !guess.typeMatches(correct)) {
inCorrect=false;
}
}
boolean correctStarted = chunker.isStartOfChunk(prevCorrect, correct);
boolean guessStarted = chunker.isStartOfChunk(prevGuess, guess);
if ( correctStarted && guessStarted && guess.typeMatches(correct)) {
inCorrect = true;
}
if ( correctStarted ) {
foundCorrect.incrementCount(getTypeLabel(correct));
}
if ( guessStarted ) {
foundGuessed.incrementCount(getTypeLabel(guess));
}
if (chunker.isIgnoreProvidedTag()) {
if (guess.typeMatches(correct)) {
tokensCorrect++;
}
} else {
if (guess.label.equals(correct.label)) {
tokensCorrect++;
}
}
tokensCount++;
prevGuess = guess;
prevCorrect = correct;
}
// Returns string precision recall in ConllEval format
public String getConllEvalString()
{
return getConllEvalString(true);
}
public static void main(String[] args) throws Exception
{
StringUtils.printErrInvocationString("MultiClassChunkEvalStats", args);
Properties props = StringUtils.argsToProperties(args);
String boundary = props.getProperty("b","-X-");
String delimiter = props.getProperty("d","\t");
String defaultPosTag = props.getProperty("t", "I");
boolean raw = Boolean.valueOf(props.getProperty("r","false"));
boolean ignoreProvidedTag = Boolean.valueOf(props.getProperty("ignoreProvidedTag","false"));
String format = props.getProperty("format", "conll");
String filename = props.getProperty("i");
String backgroundLabel = props.getProperty("k", "O");
try {
MultiClassPrecisionRecallExtendedStats stats;
if (raw) {
stats = new MultiClassStringLabelStats(backgroundLabel);
} else {
MultiClassChunkEvalStats mstats = new MultiClassChunkEvalStats(backgroundLabel);
mstats.getChunker().setDefaultPosTag(defaultPosTag);
mstats.getChunker().setIgnoreProvidedTag(ignoreProvidedTag);
stats = mstats;
}
if (filename != null) {
stats.score(filename, delimiter, boundary);
} else {
stats.score(new BufferedReader(new InputStreamReader(System.in)), delimiter, boundary);
}
if ("conll".equalsIgnoreCase(format)) {
System.out.println(stats.getConllEvalString());
} else {
System.out.println(stats.getDescription(6));
}
} catch (IOException ex) {
System.err.println("Error processing file: " + ex.toString());
ex.printStackTrace(System.err);
}
}
}
| hbbpb/stanford-corenlp-gv | src/edu/stanford/nlp/stats/MultiClassChunkEvalStats.java | Java | gpl-2.0 | 6,350 |
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.idfactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import net.sf.l2j.L2DatabaseFactory;
public abstract class IdFactory
{
private static Logger _log = Logger.getLogger(IdFactory.class.getName());
private static final String[][] EXTRACT_OBJ_ID_TABLES =
{
{
"characters",
"obj_Id"
},
{
"items",
"object_id"
},
{
"clan_data",
"clan_id"
},
{
"itemsonground",
"object_id"
}
};
protected boolean _initialized;
public static final int FIRST_OID = 0x10000000;
public static final int LAST_OID = 0x7FFFFFFF;
public static final int FREE_OBJECT_ID_SIZE = LAST_OID - FIRST_OID;
protected static final IdFactory _instance = new BitSetIDFactory();
public static IdFactory getInstance()
{
return _instance;
}
protected IdFactory()
{
setAllCharacterOffline();
cleanUpDB();
cleanUpTimeStamps();
}
/**
* Sets all character offline
*/
private static void setAllCharacterOffline()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
Statement statement = con.createStatement();
statement.executeUpdate("UPDATE characters SET online = 0");
statement.close();
_log.info("Updated characters online status.");
}
catch (SQLException e)
{
}
}
/**
* Cleans up Database
*/
private static void cleanUpDB()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
int cleanCount = 0;
Statement stmt = con.createStatement();
// Character related
cleanCount += stmt.executeUpdate("DELETE FROM augmentations WHERE augmentations.item_id NOT IN (SELECT object_id FROM items);");
cleanCount += stmt.executeUpdate("DELETE FROM character_friends WHERE character_friends.char_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_friends WHERE character_friends.friend_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_hennas WHERE character_hennas.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_macroses WHERE character_macroses.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_quests WHERE character_quests.charId NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_raid_points WHERE character_raid_points.char_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_recipebook WHERE character_recipebook.char_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_shortcuts WHERE character_shortcuts.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_skills WHERE character_skills.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_skills_save WHERE character_skills_save.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM character_subclasses WHERE character_subclasses.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM cursed_weapons WHERE cursed_weapons.playerId NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM pets WHERE pets.item_obj_id NOT IN (SELECT object_id FROM items);");
cleanCount += stmt.executeUpdate("DELETE FROM seven_signs WHERE seven_signs.char_obj_id NOT IN (SELECT obj_Id FROM characters);");
// Olympiads & Heroes
cleanCount += stmt.executeUpdate("DELETE FROM heroes WHERE heroes.char_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM olympiad_nobles WHERE olympiad_nobles.char_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM olympiad_nobles_eom WHERE olympiad_nobles_eom.char_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM olympiad_fights WHERE olympiad_fights.charOneId NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM olympiad_fights WHERE olympiad_fights.charTwoId NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM heroes_diary WHERE heroes_diary.char_id NOT IN (SELECT obj_Id FROM characters);");
// Auction
cleanCount += stmt.executeUpdate("DELETE FROM auction WHERE auction.id IN (SELECT id FROM clanhall WHERE ownerId <> 0);");
cleanCount += stmt.executeUpdate("DELETE FROM auction_bid WHERE auctionId IN (SELECT id FROM clanhall WHERE ownerId <> 0)");
// Clan related
cleanCount += stmt.executeUpdate("DELETE FROM clan_data WHERE clan_data.leader_id NOT IN (SELECT obj_Id FROM characters);");
cleanCount += stmt.executeUpdate("DELETE FROM auction_bid WHERE auction_bid.bidderId NOT IN (SELECT clan_id FROM clan_data);");
cleanCount += stmt.executeUpdate("DELETE FROM clanhall_functions WHERE clanhall_functions.hall_id NOT IN (SELECT id FROM clanhall WHERE ownerId <> 0);");
cleanCount += stmt.executeUpdate("DELETE FROM clan_privs WHERE clan_privs.clan_id NOT IN (SELECT clan_id FROM clan_data);");
cleanCount += stmt.executeUpdate("DELETE FROM clan_skills WHERE clan_skills.clan_id NOT IN (SELECT clan_id FROM clan_data);");
cleanCount += stmt.executeUpdate("DELETE FROM clan_subpledges WHERE clan_subpledges.clan_id NOT IN (SELECT clan_id FROM clan_data);");
cleanCount += stmt.executeUpdate("DELETE FROM clan_wars WHERE clan_wars.clan1 NOT IN (SELECT clan_id FROM clan_data);");
cleanCount += stmt.executeUpdate("DELETE FROM clan_wars WHERE clan_wars.clan2 NOT IN (SELECT clan_id FROM clan_data);");
cleanCount += stmt.executeUpdate("DELETE FROM siege_clans WHERE siege_clans.clan_id NOT IN (SELECT clan_id FROM clan_data);");
// Items
cleanCount += stmt.executeUpdate("DELETE FROM items WHERE items.owner_id NOT IN (SELECT obj_Id FROM characters) AND items.owner_id NOT IN (SELECT clan_id FROM clan_data);");
// Forum related
cleanCount += stmt.executeUpdate("DELETE FROM forums WHERE forums.forum_owner_id NOT IN (SELECT clan_id FROM clan_data) AND forums.forum_parent=2;");
cleanCount += stmt.executeUpdate("DELETE FROM topic WHERE topic.topic_forum_id NOT IN (SELECT forum_id FROM forums);");
cleanCount += stmt.executeUpdate("DELETE FROM posts WHERE posts.post_forum_id NOT IN (SELECT forum_id FROM forums);");
stmt.executeUpdate("UPDATE clan_data SET auction_bid_at = 0 WHERE auction_bid_at NOT IN (SELECT auctionId FROM auction_bid);");
stmt.executeUpdate("UPDATE clan_subpledges SET leader_id=0 WHERE clan_subpledges.leader_id NOT IN (SELECT obj_Id FROM characters) AND leader_id > 0;");
stmt.executeUpdate("UPDATE castle SET taxpercent=0 WHERE castle.id NOT IN (SELECT hasCastle FROM clan_data);");
stmt.executeUpdate("UPDATE characters SET clanid=0 WHERE characters.clanid NOT IN (SELECT clan_id FROM clan_data);");
stmt.executeUpdate("UPDATE clanhall SET ownerId=0, paidUntil=0, paid=0 WHERE clanhall.ownerId NOT IN (SELECT clan_id FROM clan_data);");
stmt.close();
_log.info("Cleaned " + cleanCount + " elements from database.");
}
catch (SQLException e)
{
}
}
private static void cleanUpTimeStamps()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
int cleanCount = 0;
PreparedStatement stmt = con.prepareStatement("DELETE FROM character_skills_save WHERE restore_type = 1 AND systime <= ?");
stmt.setLong(1, System.currentTimeMillis());
cleanCount += stmt.executeUpdate();
stmt.close();
_log.info("Cleaned " + cleanCount + " expired timestamps from database.");
}
catch (SQLException e)
{
}
}
protected static Collection<Integer> extractUsedObjectIDTable() throws SQLException
{
final List<Integer> temp = new ArrayList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
final Statement st = con.createStatement();
for (String[] table : EXTRACT_OBJ_ID_TABLES)
{
final ResultSet rs = st.executeQuery("SELECT " + table[1] + " FROM " + table[0]);
while (rs.next())
temp.add(rs.getInt(1));
rs.close();
}
st.close();
}
Collections.sort(temp);
return temp;
}
public boolean isInitialized()
{
return _initialized;
}
public abstract int getNextId();
public abstract void releaseId(int id);
public abstract int size();
} | VytautasBoznis/l2.skilas.lt | aCis_gameserver/java/net/sf/l2j/gameserver/idfactory/IdFactory.java | Java | gpl-2.0 | 9,525 |
/*
* Copyright 2013 websudos ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.websudos.phantom.iteratee
import java.util.concurrent.atomic.AtomicInteger
import org.scalatest.concurrent.PatienceConfiguration
import org.scalatest.time.SpanSugar._
import com.websudos.phantom.Implicits._
import com.websudos.phantom.tables._
import com.websudos.phantom.testing.PhantomCassandraTestSuite
import com.websudos.util.testing._
class IterateeTest extends PhantomCassandraTestSuite {
implicit val s: PatienceConfiguration.Timeout = timeout(2 minutes)
override def beforeAll(): Unit = {
super.beforeAll()
Primitives.insertSchema()
PrimitivesJoda.insertSchema()
}
ignore should "get result fine" in {
val rows = for (i <- 1 to 1000) yield gen[JodaRow]
val batch = rows.foldLeft(BatchStatement())((b, row) => {
val statement = PrimitivesJoda.insert
.value(_.pkey, row.pkey)
.value(_.intColumn, row.int)
.value(_.timestamp, row.bi)
b.add(statement)
})
val w = batch.future() map (_ => PrimitivesJoda.select.setFetchSize(100).fetchEnumerator)
w successful {
en => {
val result = en run Iteratee.collect()
result successful {
seqR =>
for (row <- seqR)
rows.contains(row) shouldEqual true
assert(seqR.size === rows.size)
}
}
}
}
it should "get mapResult fine" in {
val rows = for (i <- 1 to 2000) yield gen[Primitive]
val batch = rows.foldLeft(new BatchStatement())((b, row) => {
val statement = Primitives.insert
.value(_.pkey, row.pkey)
.value(_.long, row.long)
.value(_.boolean, row.boolean)
.value(_.bDecimal, row.bDecimal)
.value(_.double, row.double)
.value(_.float, row.float)
.value(_.inet, row.inet)
.value(_.int, row.int)
.value(_.date, row.date)
.value(_.uuid, row.uuid)
.value(_.bi, row.bi)
b.add(statement)
})
val w = Primitives.truncate.future().flatMap {
_ => batch.future().map(_ => Primitives.select.fetchEnumerator())
}
val counter: AtomicInteger = new AtomicInteger(0)
val m = w flatMap {
en => en run Iteratee.forEach(x => {
counter.incrementAndGet(); assert(rows.contains(x))
})
}
m successful {
_ =>
assert(counter.intValue() === rows.size)
}
}
}
| nosheenzaza/phantom-data-centric | phantom-dsl/src/test/scala/com/websudos/phantom/iteratee/IterateeTest.scala | Scala | gpl-2.0 | 2,944 |
package Accounts;
import java.math.BigDecimal;
public class Deposit extends Account {
public void Withdraw(BigDecimal amount) {
setBalance(getBalance().add(amount));
}
}
| MetalDestructor/School-Academy2015-2016 | 2015-11-Java-OOP/05. Inheritance/Problem02/Accounts/Deposit.java | Java | gpl-2.0 | 187 |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_FileParser_Font_OpenType */
#require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
/**
* Parses an OpenType font file containing TrueType outlines.
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_FileParser_Font_OpenType_TrueType extends Zend_Pdf_FileParser_Font_OpenType
{
/**** Public Interface ****/
/* Concrete Class Implementation */
/**
* Verifies that the font file actually contains TrueType outlines.
*
* @throws Zend_Pdf_Exception
*/
public function screen()
{
if ($this->_isScreened) {
return;
}
parent::screen();
switch ($this->_readScalerType()) {
case 0x00010000: // version 1.0 - Windows TrueType signature
break;
case 0x74727565: // 'true' - Macintosh TrueType signature
break;
default:
throw new Zend_Pdf_Exception('Not a TrueType font file',
Zend_Pdf_Exception::WRONG_FONT_TYPE);
}
$this->fontType = Zend_Pdf_Font::TYPE_TRUETYPE;
$this->_isScreened = true;
}
/**
* Reads and parses the TrueType font data from the file on disk.
*
* @throws Zend_Pdf_Exception
*/
public function parse()
{
if ($this->_isParsed) {
return;
}
parent::parse();
/* There is nothing additional to parse for TrueType fonts at this time.
*/
$this->_isParsed = true;
}
}
| tonio-44/tikflak | shop/lib/Zend/Pdf/FileParser/Font/OpenType/TrueType.php | PHP | gpl-2.0 | 2,402 |
angularjs-element-switch
==========================
AngularJS directive to create HTML element which lock like iOS switch element
### USAGE
<div zbx-switch switch-style="switchStyleButton" switch-state="switchState1"></div>
| tsanko/angular-element-switch | README.md | Markdown | gpl-2.0 | 233 |
/*
* OpenVPN -- An application to securely tunnel IP networks
* over a single TCP/UDP port, with support for SSL/TLS-based
* session authentication and key exchange,
* packet encryption, packet authentication, and
* packet compression.
*
* Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
* Copyright (C) 2010 Fox Crypto B.V. <openvpn@fox-it.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING included with this
* distribution); if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @file Control Channel Common Data Structures
*/
#ifndef SSL_COMMON_H_
#define SSL_COMMON_H_
#include "session_id.h"
#include "socket.h"
#include "packet_id.h"
#include "crypto.h"
#include "options.h"
#include "ssl_backend.h"
/* passwords */
#define UP_TYPE_AUTH "Auth"
#define UP_TYPE_PRIVATE_KEY "Private Key"
/** @addtogroup control_processor
* @{ */
/**
* @name Control channel negotiation states
*
* These states represent the different phases of control channel
* negotiation between OpenVPN peers. OpenVPN servers and clients
* progress through the states in a different order, because of their
* different roles during exchange of random material. The references to
* the \c key_source2 structure in the list below is only valid if %key
* method 2 is being used. See the \link key_generation data channel key
* generation\endlink related page for more information.
*
* Clients follow this order:
* -# \c S_INITIAL, ready to begin three-way handshake and control
* channel negotiation.
* -# \c S_PRE_START, have started three-way handshake, waiting for
* acknowledgment from remote.
* -# \c S_START, initial three-way handshake complete.
* -# \c S_SENT_KEY, have sent local part of \c key_source2 random
* material.
* -# \c S_GOT_KEY, have received remote part of \c key_source2 random
* material.
* -# \c S_ACTIVE, normal operation during remaining handshake window.
* -# \c S_NORMAL_OP, normal operation.
*
* Servers follow the same order, except for \c S_SENT_KEY and \c
* S_GOT_KEY being reversed, because the server first receives the
* client's \c key_source2 random material before generating and sending
* its own.
*
* @{
*/
#define S_ERROR -1 /**< Error state. */
#define S_UNDEF 0 /**< Undefined state, used after a \c
* key_state is cleaned up. */
#define S_INITIAL 1 /**< Initial \c key_state state after
* initialization by \c key_state_init()
* before start of three-way handshake. */
#define S_PRE_START 2 /**< Waiting for the remote OpenVPN peer
* to acknowledge during the initial
* three-way handshake. */
#define S_START 3 /**< Three-way handshake is complete,
* start of key exchange. */
#define S_SENT_KEY 4 /**< Local OpenVPN process has sent its
* part of the key material. */
#define S_GOT_KEY 5 /**< Local OpenVPN process has received
* the remote's part of the key
* material. */
#define S_ACTIVE 6 /**< Operational \c key_state state
* immediately after negotiation has
* completed while still within the
* handshake window. */
/* ready to exchange data channel packets */
#define S_NORMAL_OP 7 /**< Normal operational \c key_state
* state. */
/** @} name Control channel negotiation states */
/** @} addtogroup control_processor */
/**
* Container for one half of random material to be used in %key method 2
* \ref key_generation "data channel key generation".
* @ingroup control_processor
*/
struct key_source {
uint8_t pre_master[48]; /**< Random used for master secret
* generation, provided only by client
* OpenVPN peer. */
uint8_t random1[32]; /**< Seed used for master secret
* generation, provided by both client
* and server. */
uint8_t random2[32]; /**< Seed used for key expansion, provided
* by both client and server. */
};
/**
* Container for both halves of random material to be used in %key method
* 2 \ref key_generation "data channel key generation".
* @ingroup control_processor
*/
struct key_source2 {
struct key_source client; /**< Random provided by client. */
struct key_source server; /**< Random provided by server. */
};
/**
* Security parameter state of one TLS and data channel %key session.
* @ingroup control_processor
*
* This structure represents one security parameter session between
* OpenVPN peers. It includes the control channel TLS state and the data
* channel crypto state. It also contains the reliability layer
* structures used for control channel messages.
*
* A new \c key_state structure is initialized for each hard or soft
* reset.
*
* @see
* - This structure should be initialized using the \c key_state_init()
* function.
* - This structure should be cleaned up using the \c key_state_free()
* function.
*/
struct key_state
{
int state;
int key_id; /* inherited from struct tls_session below */
struct key_state_ssl ks_ssl; /* contains SSL object and BIOs for the control channel */
time_t established; /* when our state went S_ACTIVE */
time_t must_negotiate; /* key negotiation times out if not finished before this time */
time_t must_die; /* this object is destroyed at this time */
int initial_opcode; /* our initial P_ opcode */
struct session_id session_id_remote; /* peer's random session ID */
struct link_socket_actual remote_addr; /* peer's IP addr */
struct packet_id packet_id; /* for data channel, to prevent replay attacks */
struct key_ctx_bi key; /* data channel keys for encrypt/decrypt/hmac */
struct key_source2 *key_src; /* source entropy for key expansion */
struct buffer plaintext_read_buf;
struct buffer plaintext_write_buf;
struct buffer ack_write_buf;
struct reliable *send_reliable; /* holds a copy of outgoing packets until ACK received */
struct reliable *rec_reliable; /* order incoming ciphertext packets before we pass to TLS */
struct reliable_ack *rec_ack; /* buffers all packet IDs we want to ACK back to sender */
struct buffer_list *paybuf;
counter_type n_bytes; /* how many bytes sent/recvd since last key exchange */
counter_type n_packets; /* how many packets sent/recvd since last key exchange */
/*
* If bad username/password, TLS connection will come up but 'authenticated' will be false.
*/
bool authenticated;
time_t auth_deferred_expire;
#ifdef ENABLE_DEF_AUTH
/* If auth_deferred is true, authentication is being deferred */
bool auth_deferred;
#ifdef MANAGEMENT_DEF_AUTH
unsigned int mda_key_id;
unsigned int mda_status;
#endif
#ifdef PLUGIN_DEF_AUTH
unsigned int auth_control_status;
time_t acf_last_mod;
char *auth_control_file;
#endif
#endif
};
/*
* Our const options, obtained directly or derived from
* command line options.
*/
struct tls_options
{
/* our master TLS context from which all SSL objects derived */
struct tls_root_ctx ssl_ctx;
/* data channel cipher, hmac, and key lengths */
struct key_type key_type;
/* true if we are a TLS server, client otherwise */
bool server;
/* if true, don't xmit until first packet from peer is received */
bool xmit_hold;
#ifdef ENABLE_OCC
/* local and remote options strings
that must match between client and server */
const char *local_options;
const char *remote_options;
#endif
/* from command line */
int key_method;
bool replay;
bool single_session;
#ifdef ENABLE_OCC
bool disable_occ;
#endif
#ifdef ENABLE_PUSH_PEER_INFO
int push_peer_info_detail;
#endif
int transition_window;
int handshake_window;
interval_t packet_timeout;
int renegotiate_bytes;
int renegotiate_packets;
interval_t renegotiate_seconds;
/* cert verification parms */
const char *verify_command;
const char *verify_export_cert;
int verify_x509_type;
const char *verify_x509_name;
const char *crl_file;
int ns_cert_type;
unsigned remote_cert_ku[MAX_PARMS];
const char *remote_cert_eku;
uint8_t *verify_hash;
char *x509_username_field;
/* allow openvpn config info to be
passed over control channel */
bool pass_config_info;
/* struct crypto_option flags */
unsigned int crypto_flags_and;
unsigned int crypto_flags_or;
int replay_window; /* --replay-window parm */
int replay_time; /* --replay-window parm */
bool tcp_mode;
/* packet authentication for TLS handshake */
struct crypto_options tls_auth;
struct key_ctx_bi tls_auth_key;
/* frame parameters for TLS control channel */
struct frame frame;
/* used for username/password authentication */
const char *auth_user_pass_verify_script;
bool auth_user_pass_verify_script_via_file;
const char *tmp_dir;
/* use the client-config-dir as a positive authenticator */
const char *client_config_dir_exclusive;
/* instance-wide environment variable set */
struct env_set *es;
const struct plugin_list *plugins;
/* configuration file SSL-related boolean and low-permutation options */
# define SSLF_CLIENT_CERT_NOT_REQUIRED (1<<0)
# define SSLF_USERNAME_AS_COMMON_NAME (1<<1)
# define SSLF_AUTH_USER_PASS_OPTIONAL (1<<2)
# define SSLF_OPT_VERIFY (1<<4)
# define SSLF_CRL_VERIFY_DIR (1<<5)
# define SSLF_TLS_VERSION_MIN_SHIFT 6
# define SSLF_TLS_VERSION_MIN_MASK 0xF /* (uses bit positions 6 to 9) */
# define SSLF_TLS_VERSION_MAX_SHIFT 10
# define SSLF_TLS_VERSION_MAX_MASK 0xF /* (uses bit positions 10 to 13) */
unsigned int ssl_flags;
#ifdef MANAGEMENT_DEF_AUTH
struct man_def_auth_context *mda_context;
#endif
#ifdef ENABLE_X509_TRACK
const struct x509_track *x509_track;
#endif
#ifdef ENABLE_CLIENT_CR
const struct static_challenge_info *sci;
#endif
/* --gremlin bits */
int gremlin;
};
/** @addtogroup control_processor
* @{ */
/** @name Index of key_state objects within a tls_session structure
*
* This is the index of \c tls_session.key
*
* @{ */
#define KS_PRIMARY 0 /**< Primary %key state index. */
#define KS_LAME_DUCK 1 /**< %Key state index that will retire
* soon. */
#define KS_SIZE 2 /**< Size of the \c tls_session.key array. */
/** @} name Index of key_state objects within a tls_session structure */
/** @} addtogroup control_processor */
/**
* Security parameter state of a single session within a VPN tunnel.
* @ingroup control_processor
*
* This structure represents an OpenVPN peer-to-peer control channel
* session.
*
* A \c tls_session remains over soft resets, but a new instance is
* initialized for each hard reset.
*
* @see
* - This structure should be initialized using the \c tls_session_init()
* function.
* - This structure should be cleaned up using the \c tls_session_free()
* function.
*/
struct tls_session
{
/* const options and config info */
struct tls_options *opt;
/* during hard reset used to control burst retransmit */
bool burst;
/* authenticate control packets */
struct crypto_options tls_auth;
struct packet_id tls_auth_pid;
int initial_opcode; /* our initial P_ opcode */
struct session_id session_id; /* our random session ID */
int key_id; /* increments with each soft reset (for key renegotiation) */
int limit_next; /* used for traffic shaping on the control channel */
int verify_maxlevel;
char *common_name;
struct cert_hash_set *cert_hash_set;
#ifdef ENABLE_PF
uint32_t common_name_hashval;
#endif
bool verified; /* true if peer certificate was verified against CA */
/* not-yet-authenticated incoming client */
struct link_socket_actual untrusted_addr;
struct key_state key[KS_SIZE];
};
/** @addtogroup control_processor
* @{ */
/** @name Index of tls_session objects within a tls_multi structure
*
* This is the index of \c tls_multi.session
*
* Normally three tls_session objects are maintained by an active openvpn
* session. The first is the current, TLS authenticated session, the
* second is used to process connection requests from a new client that
* would usurp the current session if successfully authenticated, and the
* third is used as a repository for a "lame-duck" %key in the event that
* the primary session resets due to error while the lame-duck %key still
* has time left before its expiration. Lame duck keys are used to
* maintain the continuity of the data channel connection while a new %key
* is being negotiated.
*
* @{ */
#define TM_ACTIVE 0 /**< Active \c tls_session. */
#define TM_UNTRUSTED 1 /**< As yet un-trusted \c tls_session
* being negotiated. */
#define TM_LAME_DUCK 2 /**< Old \c tls_session. */
#define TM_SIZE 3 /**< Size of the \c tls_multi.session
* array. */
/** @} name Index of tls_session objects within a tls_multi structure */
/** @} addtogroup control_processor */
/*
* The number of keys we will scan on encrypt or decrypt. The first
* is the "active" key. The second is the lame_duck or retiring key
* associated with the active key's session ID. The third is a detached
* lame duck session that only occurs in situations where a key renegotiate
* failed on the active key, but a lame duck key was still valid. By
* preserving the lame duck session, we can be assured of having a data
* channel key available even when network conditions are so bad that
* we can't negotiate a new key within the time allotted.
*/
#define KEY_SCAN_SIZE 3
/**
* Security parameter state for a single VPN tunnel.
* @ingroup control_processor
*
* An active VPN tunnel running with TLS enabled has one \c tls_multi
* object, in which it stores all control channel and data channel
* security parameter state. This structure can contain multiple,
* possibly simultaneously active, \c tls_context objects to allow for
* interruption-less transitions during session renegotiations. Each \c
* tls_context represents one control channel session, which can span
* multiple data channel security parameter sessions stored in \c
* key_state structures.
*/
struct tls_multi
{
/* used to coordinate access between main thread and TLS thread */
/*MUTEX_PTR_DEFINE (mutex);*/
/* const options and config info */
struct tls_options opt;
struct key_state* key_scan[KEY_SCAN_SIZE];
/**< List of \c key_state objects in the
* order they should be scanned by data
* channel modules. */
/*
* used by tls_pre_encrypt to communicate the encrypt key
* to tls_post_encrypt()
*/
struct key_state *save_ks; /* temporary pointer used between pre/post routines */
/*
* Used to return outgoing address from
* tls_multi_process.
*/
struct link_socket_actual to_link_addr;
int n_sessions; /**< Number of sessions negotiated thus
* far. */
/*
* Number of errors.
*/
int n_hard_errors; /* errors due to TLS negotiation failure */
int n_soft_errors; /* errors due to unrecognized or failed-to-authenticate incoming packets */
/*
* Our locked common name, username, and cert hashes (cannot change during the life of this tls_multi object)
*/
char *locked_cn;
char *locked_username;
struct cert_hash_set *locked_cert_hash_set;
#ifdef ENABLE_DEF_AUTH
/*
* An error message to send to client on AUTH_FAILED
*/
char *client_reason;
/*
* A multi-line string of general-purpose info received from peer
* over control channel.
*/
char *peer_info;
/* Time of last call to tls_authentication_status */
time_t tas_last;
#endif
/* For P_DATA_V2 */
uint32_t peer_id;
bool use_peer_id;
/*
* Our session objects.
*/
struct tls_session session[TM_SIZE];
/**< Array of \c tls_session objects
* representing control channel
* sessions with the remote peer. */
};
#endif /* SSL_COMMON_H_ */
| imsentinel/openvpn | src/openvpn/ssl_common.h | C | gpl-2.0 | 17,485 |
<!-- -*- c++ -*- -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
<script type="text/javascript" src="../../jsUnit/app/jsUnitCore.js"></script>
<script type="text/javascript" src="wema.js"></script>
<script language="javascript">
//var xp = new XP();
var xp = g_xp;
function testCheckBrowser() {
assertEquals(0, xp.N4); // adhoc
}
function testCreateElement() {
var o = xp.createElement("div");
o.id = "testid1";
assertEquals("testid1", o.id);
}
function testCreateDiv() {
var o = xp.createDiv("testid2");
assertEquals("testid2", o.id);
xp.removeElement(o);
assertEquals("testid2", o.id); // object is not erased.
}
function testAttr() {
var o = xp.createElement("div");
xp.setAttr(o, "testattr", "testvalue");
assertEquals("testvalue", xp.getAttr(o, "testattr"));
}
function testGetDivList() {
var first_length = xp.getDivList().length
//assertEquals(0, xp.getDivList().length);
xp.createElement("div");
//assertEquals(0, xp.getDivList().length); // no effect
assertEquals(first_length, xp.getDivList().length); // no effect
xp.createDiv("testid2"); // add one
//assertEquals(1, xp.getDivList().length);
assertEquals(first_length+1, xp.getDivList().length);
}
function testGetDivListByClass() {
assertEquals(0, xp.getDivListByClass("testclass").length);
var o = xp.createDiv("testid2");
o.className = "testclass";
assertEquals("testclass", o.className);
assertEquals(1, xp.getDivListByClass("testclass").length);
}
function testGetById() {
xp.createDiv("testid3");
assertEquals("testid3", xp.getById("testid3").id);
}
function testZIndex() {
var o = xp.createElement("div");
assertEquals(0, xp.getZIndex(o));
xp.setZIndex(o, 1);
assertEquals(1, xp.getZIndex(o));
}
function testPos() {
var o = xp.createElement("div");
var p = xp.getPos(o);
assertEquals(0, p.x);
assertEquals(0, p.y);
xp.setPos(o, new Point(1, 2));
var p = xp.getPos(o);
assertEquals(1, p.x);
assertEquals(2, p.y);
}
function testGetSize() {
var o = xp.createElement("div");
var p = xp.getSize(o);
assertEquals("number", typeof(p.x));
assertEquals("number", typeof(p.y));
}
function testGetCenter() {
var o = xp.createElement("div");
var p = xp.getCenter(o);
assertEquals("number", typeof(p.x));
assertEquals("number", typeof(p.y));
}
// test for event capture is not yet finished.
</script>
</head>
<body>
<p>test case for xp</p>
</body>
</html>
| eto/qwik | share/theme/js/test-xp.html | HTML | gpl-2.0 | 2,513 |
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/lockdep.h>
#include <mach/irqs.h>
#include <mach/mt_cirq.h>
#include <mach/mt_spm_idle.h>
#include <mach/mt_cpuidle.h>
#include <mach/wd_api.h>
#include <mach/mt_gpt.h>
#include <mach/mt_cpufreq.h>
#include <mach/mt_dramc.h>
#include <mach/mt_boot.h>
#include "mt_spm_internal.h"
#define CONFIG_MTK_LDVT
#ifdef CONFIG_MTK_LDVT
#define SPM_PWAKE_EN 0
#define SPM_BYPASS_SYSPWREQ 1
#else
#define SPM_PWAKE_EN 1
#define SPM_BYPASS_SYSPWREQ 0
#endif
#define WAKE_SRC_FOR_DPIDLE \
(WAKE_SRC_KP | WAKE_SRC_GPT | WAKE_SRC_EINT | WAKE_SRC_CCIF_MD | WAKE_SRC_MD32 | \
WAKE_SRC_USB_CD | WAKE_SRC_USB_PDN | WAKE_SRC_AFE | \
WAKE_SRC_SYSPWREQ | WAKE_SRC_MD_WDT | WAKE_SRC_CLDMA_MD | \
WAKE_SRC_SEJ)
#define WAKE_SRC_FOR_MD32 0x00002008 \
#define spm_is_wakesrc_invalid(wakesrc) (!!((u32)(wakesrc) & 0xc0003803))
#ifdef CONFIG_MTK_RAM_CONSOLE
#define SPM_AEE_RR_REC 1
#else
#define SPM_AEE_RR_REC 0
#endif
#if SPM_AEE_RR_REC
enum spm_deepidle_step
{
SPM_DEEPIDLE_ENTER=0,
SPM_DEEPIDLE_ENTER_UART_SLEEP,
SPM_DEEPIDLE_ENTER_WFI,
SPM_DEEPIDLE_LEAVE_WFI,
SPM_DEEPIDLE_ENTER_UART_AWAKE,
SPM_DEEPIDLE_LEAVE
};
#endif
static const u32 dpidle_binary[] = {
0x80328400, 0x81419801, 0xd80001c5, 0x17c07c1f, 0x1a00001f, 0x10006604,
0xe2200004, 0xc0c030e0, 0x17c07c1f, 0xe2200006, 0xc0c030e0, 0x17c07c1f,
0x1b80001f, 0x20000208, 0xe8208000, 0x10006354, 0xfffe7fbf, 0xc2803000,
0x1290041f, 0x8880000c, 0x2f7be75f, 0xd8200362, 0x17c07c1f, 0x1b00001f,
0x7fffe7ff, 0xd00003a0, 0x17c07c1f, 0x1b00001f, 0x7ffff7ff, 0xf0000000,
0x17c07c1f, 0x80880001, 0xd8000482, 0x17c07c1f, 0xd00021a0, 0x1200041f,
0x18c0001f, 0x10006608, 0x1910001f, 0x10006608, 0x813b0404, 0xe0c00004,
0xe8208000, 0x10006354, 0xffffffbf, 0x81419801, 0xd8000745, 0x17c07c1f,
0x1a00001f, 0x10006604, 0xe2200005, 0xc0c030e0, 0x17c07c1f, 0xe2200007,
0xc0c030e0, 0x17c07c1f, 0x1b80001f, 0x2000008c, 0xc2803000, 0x1290841f,
0xa0128400, 0x1b00001f, 0x3fffefff, 0xf0000000, 0x17c07c1f, 0x808f9801,
0xd8200ba2, 0x81481801, 0x80c89801, 0xd82009e3, 0x17c07c1f, 0xd8000945,
0x17c07c1f, 0x803d8400, 0x18c0001f, 0x10006204, 0xe0e00000, 0x1b80001f,
0x2000002f, 0x80340400, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x80310400, 0x81fa0407, 0x81f18407, 0x81f08407, 0xa1dc0407, 0x1b80001f,
0x200000b6, 0xd00019a0, 0x17c07c1f, 0x1880001f, 0x20000208, 0x81411801,
0xd8000d85, 0x17c07c1f, 0xe8208000, 0x1000f600, 0xd2000000, 0x1380081f,
0x18c0001f, 0x10006240, 0xe0e00016, 0xe0e0001e, 0xe0e0000e, 0xe0e0000f,
0x81fe8407, 0x80368400, 0x1380081f, 0x80370400, 0x1380081f, 0x80360400,
0x803e0400, 0x1b80001f, 0x20000034, 0x80380400, 0x803b0400, 0x803d0400,
0x18c0001f, 0x10006204, 0xe0e00007, 0xa01d8400, 0x1b80001f, 0x20000034,
0xe0e00000, 0x803d8400, 0x1b80001f, 0x20000152, 0x18c0001f, 0x1000f5c8,
0x1910001f, 0x1000f5c8, 0xa1000404, 0xe0c00004, 0x18c0001f, 0x100125c8,
0x1910001f, 0x100125c8, 0xa1000404, 0xe0c00004, 0x1910001f, 0x100125c8,
0x81481801, 0xd82012e5, 0x17c07c1f, 0xa01d8400, 0xa1de8407, 0xd0001300,
0x17c07c1f, 0xa01d0400, 0x80340400, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x80310400, 0xe8208000, 0x10000044, 0x00000100, 0x1b80001f,
0x20000073, 0x18c0001f, 0x10006240, 0xe0e0000d, 0x81411801, 0xd80017a5,
0x17c07c1f, 0x18c0001f, 0x100040f4, 0x1910001f, 0x100040f4, 0xa11c8404,
0xe0c00004, 0x1b80001f, 0x2000000a, 0x813c8404, 0xe0c00004, 0x18c0001f,
0x100110f4, 0x1910001f, 0x100110f4, 0xa11c8404, 0xe0c00004, 0x1b80001f,
0x2000000a, 0x813c8404, 0xe0c00004, 0x1b80001f, 0x20000100, 0x81fa0407,
0x81f18407, 0x81f08407, 0xe8208000, 0x10006354, 0xfffe7b07, 0xa1d80407,
0xa1dc0407, 0x18c0001f, 0x10006608, 0x1910001f, 0x10006608, 0xa11b0404,
0xe0c00004, 0xc2803000, 0x1291041f, 0x8880000c, 0x2f7be75f, 0xd8201ae2,
0x17c07c1f, 0x1b00001f, 0x3fffe7ff, 0xd0001b20, 0x17c07c1f, 0x1b00001f,
0xbfffe7ff, 0xf0000000, 0x17c07c1f, 0x1890001f, 0x10006608, 0x808b0801,
0xd8201e82, 0x17c07c1f, 0x1880001f, 0x10006320, 0xc0c02c80, 0xe080000f,
0xd8001fe3, 0x17c07c1f, 0xe080001f, 0xa1da0407, 0x81fc0407, 0xa0110400,
0xa0140400, 0x80c89801, 0xd8201e43, 0x17c07c1f, 0xa01d8400, 0x18c0001f,
0x10006204, 0xe0e00001, 0xd0002840, 0xa19f8406, 0x1b80001f, 0x20000fdf,
0x1890001f, 0x10006608, 0x80c98801, 0x810a8801, 0x10918c1f, 0xa0939002,
0x8080080d, 0xd82021a2, 0x12007c1f, 0x81f08407, 0x81f18407, 0xa1d80407,
0xa1dc0407, 0x1b00001f, 0x3fffe7ff, 0x1b80001f, 0x20000004, 0xd80028cc,
0x17c07c1f, 0x1b00001f, 0xbfffe7ff, 0xd00028c0, 0x17c07c1f, 0x81f80407,
0x81fc0407, 0x1880001f, 0x10006320, 0xc0c02c80, 0xe080000f, 0xd8001fe3,
0x17c07c1f, 0xe080001f, 0xa1da0407, 0xe8208000, 0x10000048, 0x00000100,
0x1b80001f, 0x20000068, 0xa0110400, 0xa0140400, 0x18c0001f, 0x1000f5c8,
0x1910001f, 0x1000f5c8, 0x81200404, 0xe0c00004, 0x18c0001f, 0x100125c8,
0x1910001f, 0x100125c8, 0x81200404, 0xe0c00004, 0x1910001f, 0x100125c8,
0xa01d0400, 0xa01b0400, 0xa0180400, 0x803d8400, 0xa01e0400, 0xa0160400,
0xa0170400, 0xa0168400, 0x1b80001f, 0x20000104, 0x81411801, 0xd8002805,
0x17c07c1f, 0x18c0001f, 0x10006240, 0xc0c02be0, 0x17c07c1f, 0xe8208000,
0x1000f600, 0xd2000001, 0xd8000488, 0x81bf8406, 0xc2803000, 0x1291841f,
0x1b00001f, 0x7ffff7ff, 0xf0000000, 0x17c07c1f, 0x1900001f, 0x10006830,
0xe1000003, 0x18c0001f, 0x10006834, 0xe0e00000, 0xe0e00001, 0xf0000000,
0x17c07c1f, 0xe0f07f16, 0x1380201f, 0xe0f07f1e, 0x1380201f, 0xe0f07f0e,
0x1b80001f, 0x20000104, 0xe0f07f0c, 0xe0f07f0d, 0xe0f07e0d, 0xe0f07c0d,
0xe0f0780d, 0xf0000000, 0xe0f0700d, 0xe0f07f0d, 0xe0f07f0f, 0xe0f07f1e,
0xf0000000, 0xe0f07f12, 0x11407c1f, 0x81f08407, 0x81f18407, 0x1b80001f,
0x20000001, 0xa1d08407, 0xa1d18407, 0x1392841f, 0x812ab401, 0x80ebb401,
0xa0c00c04, 0xd8202e83, 0x17c07c1f, 0x80c01403, 0xd8202ca3, 0x01400405,
0x1900001f, 0x10006814, 0xf0000000, 0xe1000003, 0xa1d00407, 0x1b80001f,
0x20000208, 0x80ea3401, 0x1a00001f, 0x10006814, 0xf0000000, 0xe2000003,
0x18c0001f, 0x10006b6c, 0x1910001f, 0x10006b6c, 0xa1002804, 0xf0000000,
0xe0c00004, 0x18d0001f, 0x10006604, 0x10cf8c1f, 0xd82030e3, 0x17c07c1f,
0xf0000000, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0xa1d48407, 0x1990001f,
0x10006b08, 0xe8208000, 0x10006b6c, 0x00000000, 0x1b00001f, 0x2f7be75f,
0x1b80001f, 0x500f0000, 0xe8208000, 0x10006354, 0xfffe7b07, 0xc0c06b80,
0x81401801, 0xd8004625, 0x17c07c1f, 0x81f60407, 0x18c0001f, 0x10006200,
0xc0c06380, 0x12807c1f, 0xe8208000, 0x1000625c, 0x00000001, 0x1b80001f,
0x20000080, 0xc0c06380, 0x1280041f, 0x18c0001f, 0x10006208, 0xc0c06380,
0x12807c1f, 0x1b80001f, 0x20000003, 0xe8208000, 0x10006248, 0x00000000,
0x1b80001f, 0x20000080, 0xc0c06380, 0x1280041f, 0xe8208000, 0x10006404,
0x00003101, 0xc2803000, 0x1292041f, 0x1b00001f, 0x2f7be75f, 0x1b80001f,
0x30000004, 0x8880000c, 0x2f7be75f, 0xd8005e42, 0x17c07c1f, 0xc0c06700,
0x17c07c1f, 0x18c0001f, 0x10006294, 0xe0f07fff, 0xe0e00fff, 0xe0e000ff,
0x81449801, 0xd8004b45, 0x17c07c1f, 0x81459801, 0xd8004985, 0x17c07c1f,
0x18c0001f, 0x10005468, 0x1111041f, 0xe0c00004, 0xd0004a00, 0x17c07c1f,
0x18c0001f, 0x10005468, 0x1113841f, 0xe0c00004, 0x1b80001f, 0x20000104,
0x1a00001f, 0x10006604, 0xe2200003, 0xc0c067c0, 0x17c07c1f, 0xe2200001,
0xc0c067c0, 0x17c07c1f, 0x18c0001f, 0x10209f4c, 0x1910001f, 0x10209f4c,
0xa1120404, 0xe0c00004, 0xa1d38407, 0xa1d98407, 0xa0108400, 0xa0120400,
0xa0148400, 0xa0150400, 0xa0158400, 0xa01b8400, 0xa01c0400, 0xa01c8400,
0xa0188400, 0xa0190400, 0xa0198400, 0x18c0001f, 0x10209200, 0x1910001f,
0x10209200, 0x81200404, 0xe0c00004, 0x18c0001f, 0x1020920c, 0x1910001f,
0x1020920c, 0xa1108404, 0xe0c00004, 0x81200404, 0xe0c00004, 0xe8208000,
0x10006310, 0x0b1600f8, 0x1b00001f, 0xbfffe7ff, 0x1b80001f, 0x90100000,
0x80c28001, 0xd8205143, 0x17c07c1f, 0xa1dd8407, 0x1b00001f, 0x3fffefff,
0xd0005000, 0x17c07c1f, 0x1890001f, 0x100063e8, 0x88c0000c, 0x2f7be75f,
0xd8005363, 0x17c07c1f, 0x80c40001, 0xd80052e3, 0x17c07c1f, 0x1b00001f,
0xbfffe7ff, 0xd0005320, 0x17c07c1f, 0x1b00001f, 0x7ffff7ff, 0xd0005000,
0x17c07c1f, 0x80c40001, 0xd8205463, 0x17c07c1f, 0xa1de0407, 0x1b00001f,
0x7fffe7ff, 0xd0005000, 0x17c07c1f, 0x18c0001f, 0x10006294, 0xe0e001fe,
0xe0e003fc, 0xe0e007f8, 0xe0e00ff0, 0x1b80001f, 0x20000020, 0xe0f07ff0,
0xe0f07f00, 0x81449801, 0xd80058e5, 0x17c07c1f, 0x1a00001f, 0x10006604,
0xe2200000, 0xc0c067c0, 0x17c07c1f, 0xe2200002, 0xc0c067c0, 0x17c07c1f,
0x1b80001f, 0x20000104, 0x81459801, 0xd8005865, 0x17c07c1f, 0x18c0001f,
0x10005464, 0x1111041f, 0xe0c00004, 0xd00058e0, 0x17c07c1f, 0x18c0001f,
0x10005464, 0x1113841f, 0xe0c00004, 0x80388400, 0x80390400, 0x80398400,
0x18c0001f, 0x1020920c, 0x1910001f, 0x1020920c, 0xa1000404, 0xe0c00004,
0x1b80001f, 0x20000300, 0x803b8400, 0x803c0400, 0x803c8400, 0x81308404,
0xe0c00004, 0x18c0001f, 0x10209200, 0x1910001f, 0x10209200, 0xa1000404,
0xe0c00004, 0x1910001f, 0x10209200, 0x1b80001f, 0x20000300, 0x80348400,
0x80350400, 0x80358400, 0x1b80001f, 0x20000104, 0x80308400, 0x80320400,
0x81f38407, 0x81f98407, 0x18c0001f, 0x10209f4c, 0x1910001f, 0x10209f4c,
0x81320404, 0xe0c00004, 0x81f90407, 0x81f40407, 0x81401801, 0xd8006205,
0x17c07c1f, 0xe8208000, 0x10006404, 0x00002101, 0x18c0001f, 0x10006208,
0x1212841f, 0xc0c06500, 0x12807c1f, 0xe8208000, 0x10006248, 0x00000001,
0x1b80001f, 0x20000080, 0xc0c06500, 0x1280041f, 0x18c0001f, 0x10006200,
0x1212841f, 0xc0c06500, 0x12807c1f, 0xe8208000, 0x1000625c, 0x00000000,
0x1b80001f, 0x20000080, 0xc0c06500, 0x1280041f, 0xe8208000, 0x10006824,
0x000f0000, 0x81f48407, 0xa1d60407, 0x81f10407, 0xa1db0407, 0x81fd8407,
0x81fe0407, 0x1ac0001f, 0x55aa55aa, 0xf0000000, 0xd800642a, 0x17c07c1f,
0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xd82064ca, 0x17c07c1f, 0xe2e0002e,
0xe2e0003e, 0xe2e00032, 0xf0000000, 0x17c07c1f, 0xd80065ca, 0x17c07c1f,
0xe2e00036, 0xe2e0003e, 0x1380201f, 0xe2e0003c, 0xd82066ca, 0x17c07c1f,
0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d,
0xf0000000, 0x17c07c1f, 0xa1d40407, 0x1391841f, 0xa1d90407, 0x1393041f,
0xf0000000, 0x17c07c1f, 0x18d0001f, 0x10006604, 0x10cf8c1f, 0xd82067c3,
0x17c07c1f, 0xf0000000, 0x17c07c1f, 0xe8208000, 0x11008014, 0x00000002,
0xe8208000, 0x11008020, 0x00000101, 0xe8208000, 0x11008004, 0x000000d0,
0x1a00001f, 0x11008000, 0xd8006a8a, 0xe220005d, 0xd8206aaa, 0xe2200040,
0xe2200041, 0xe8208000, 0x11008024, 0x00000001, 0x1b80001f, 0x20000424,
0xf0000000, 0x17c07c1f, 0xa1d10407, 0x1b80001f, 0x20000020, 0xf0000000,
0x17c07c1f
};
static struct pcm_desc dpidle_pcm = {
.version = "pcm_deepidle_v8.6_20141208_exp8",
.base = dpidle_binary,
.size = 865,
.sess = 2,
.replace = 0,
.vec0 = EVENT_VEC(11, 1, 0, 0),
.vec1 = EVENT_VEC(12, 1, 0, 31),
.vec2 = EVENT_VEC(30, 1, 0, 65),
.vec3 = EVENT_VEC(31, 1, 0, 219),
};
static struct pwr_ctrl dpidle_ctrl = {
.wake_src = WAKE_SRC_FOR_DPIDLE,
.wake_src_md32 = WAKE_SRC_FOR_MD32,
.r0_ctrl_en = 1,
.r7_ctrl_en = 1,
.infra_dcm_lock = 1,
.wfi_op = WFI_OP_AND,
#if 1
.ca15_wfi0_en = 1,
.ca15_wfi1_en = 1,
.ca15_wfi2_en = 1,
.ca15_wfi3_en = 1,
.ca7_wfi0_en = 1,
.ca7_wfi1_en = 1,
.ca7_wfi2_en = 1,
.ca7_wfi3_en = 1,
.md2_req_mask = 1,
.disp_req_mask = 1,
.mfg_req_mask = 1,
#if SPM_BYPASS_SYSPWREQ
.syspwreq_mask = 1,
#endif
#else
.ca15_wfi0_en = 1,
.ca15_wfi1_en = 1,
.ca15_wfi2_en = 1,
.ca15_wfi3_en = 1,
.ca7_wfi0_en = 1,
.ca7_wfi1_en = 1,
.ca7_wfi2_en = 1,
.ca7_wfi3_en = 1,
.md2_req_mask = 1,
.disp_req_mask = 1,
.mfg_req_mask = 1,
.md32_req_mask = 1,
#if SPM_BYPASS_SYSPWREQ
.syspwreq_mask = 1,
#endif
#endif
};
struct spm_lp_scen __spm_dpidle = {
.pcmdesc = &dpidle_pcm,
.pwrctrl = &dpidle_ctrl,
};
extern int mt_irq_mask_all(struct mtk_irq_mask *mask);
extern int mt_irq_mask_restore(struct mtk_irq_mask *mask);
extern void mt_irq_unmask_for_sleep(unsigned int irq);
extern int request_uart_to_sleep(void);
extern int request_uart_to_wakeup(void);
#if SPM_AEE_RR_REC
extern void aee_rr_rec_deepidle_val(u32 val);
extern u32 aee_rr_curr_deepidle_val(void);
#endif
static void spm_trigger_wfi_for_dpidle(struct pwr_ctrl *pwrctrl)
{
#if 0
spm_i2c_control(mt6333_BUSNUM, 1);
#endif
if (is_cpu_pdn(pwrctrl->pcm_flags)) {
mt_cpu_dormant(CPU_DEEPIDLE_MODE);
} else {
wfi_with_sync();
}
#if 0
spm_i2c_control(mt6333_BUSNUM, 0);
#endif
}
int spm_set_dpidle_wakesrc(u32 wakesrc, bool enable, bool replace)
{
unsigned long flags;
if (spm_is_wakesrc_invalid(wakesrc))
return -EINVAL;
spin_lock_irqsave(&__spm_lock, flags);
if (enable) {
if (replace)
__spm_dpidle.pwrctrl->wake_src = wakesrc;
else
__spm_dpidle.pwrctrl->wake_src |= wakesrc;
} else {
if (replace)
__spm_dpidle.pwrctrl->wake_src = 0;
else
__spm_dpidle.pwrctrl->wake_src &= ~wakesrc;
}
spin_unlock_irqrestore(&__spm_lock, flags);
return 0;
}
wake_reason_t spm_go_to_dpidle(u32 spm_flags, u32 spm_data)
{
struct wake_status wakesta;
unsigned long flags;
struct mtk_irq_mask mask;
wake_reason_t wr = WR_NONE;
struct pcm_desc *pcmdesc = __spm_dpidle.pcmdesc;
struct pwr_ctrl *pwrctrl = __spm_dpidle.pwrctrl;
struct spm_lp_scen *lpscen;
#if SPM_AEE_RR_REC
aee_rr_rec_deepidle_val(1<<SPM_DEEPIDLE_ENTER);
#endif
lpscen = spm_check_talking_get_lpscen(&__spm_dpidle, &spm_flags);
pcmdesc = lpscen->pcmdesc;
pwrctrl = lpscen->pwrctrl;
set_pwrctrl_pcm_flags(pwrctrl, spm_flags);
mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_DEEPIDLE);
lockdep_off();
spin_lock_irqsave(&__spm_lock, flags);
mt_irq_mask_all(&mask);
mt_irq_unmask_for_sleep(SPM_IRQ0_ID);
mt_cirq_clone_gic();
mt_cirq_enable();
#if SPM_AEE_RR_REC
aee_rr_rec_deepidle_val(aee_rr_curr_deepidle_val()|(1<<SPM_DEEPIDLE_ENTER_UART_SLEEP));
#endif
if (request_uart_to_sleep()) {
wr = WR_UART_BUSY;
goto RESTORE_IRQ;
}
__spm_reset_and_init_pcm(pcmdesc);
__spm_kick_im_to_fetch(pcmdesc);
__spm_init_pcm_register();
__spm_init_event_vector(pcmdesc);
__spm_set_power_control(pwrctrl);
__spm_set_wakeup_event(pwrctrl);
__spm_kick_pcm_to_run(pwrctrl);
spm_dpidle_before_wfi();
#if SPM_AEE_RR_REC
aee_rr_rec_deepidle_val(aee_rr_curr_deepidle_val()|(1<<SPM_DEEPIDLE_ENTER_WFI));
#endif
spm_trigger_wfi_for_dpidle(pwrctrl);
#if SPM_AEE_RR_REC
aee_rr_rec_deepidle_val(aee_rr_curr_deepidle_val()|(1<<SPM_DEEPIDLE_LEAVE_WFI));
#endif
spm_dpidle_after_wfi();
__spm_get_wakeup_status(&wakesta);
__spm_clean_after_wakeup();
#if SPM_AEE_RR_REC
aee_rr_rec_deepidle_val(aee_rr_curr_deepidle_val()|(1<<SPM_DEEPIDLE_ENTER_UART_AWAKE));
#endif
request_uart_to_wakeup();
wr = __spm_output_wake_reason(&wakesta, pcmdesc, false);
RESTORE_IRQ:
mt_cirq_flush();
mt_cirq_disable();
mt_irq_mask_restore(&mask);
spin_unlock_irqrestore(&__spm_lock, flags);
lockdep_on();
mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_NORMAL);
#if SPM_AEE_RR_REC
aee_rr_rec_deepidle_val(0);
#endif
return wr;
}
wake_reason_t spm_go_to_sleep_dpidle(u32 spm_flags, u32 spm_data)
{
u32 sec = 0;
int wd_ret;
struct wake_status wakesta;
unsigned long flags;
struct mtk_irq_mask mask;
struct wd_api *wd_api;
static wake_reason_t last_wr = WR_NONE;
struct pcm_desc *pcmdesc = __spm_dpidle.pcmdesc;
struct pwr_ctrl *pwrctrl = __spm_dpidle.pwrctrl;
set_pwrctrl_pcm_flags(pwrctrl, spm_flags);
#if SPM_PWAKE_EN
sec = spm_get_wake_period(-1 , last_wr);
#endif
pwrctrl->timer_val = sec * 32768;
pwrctrl->wake_src = spm_get_sleep_wakesrc();
wd_ret = get_wd_api(&wd_api);
if (!wd_ret)
wd_api->wd_suspend_notify();
spin_lock_irqsave(&__spm_lock, flags);
mt_irq_mask_all(&mask);
mt_irq_unmask_for_sleep(SPM_IRQ0_ID);
mt_cirq_clone_gic();
mt_cirq_enable();
mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_DEEPIDLE);
spm_crit2("sleep_deepidle, sec = %u, wakesrc = 0x%x [%u]\n",
sec, pwrctrl->wake_src, is_cpu_pdn(pwrctrl->pcm_flags));
__spm_reset_and_init_pcm(pcmdesc);
__spm_kick_im_to_fetch(pcmdesc);
if (request_uart_to_sleep()) {
last_wr = WR_UART_BUSY;
goto RESTORE_IRQ;
}
__spm_init_pcm_register();
__spm_init_event_vector(pcmdesc);
__spm_set_power_control(pwrctrl);
__spm_set_wakeup_event(pwrctrl);
__spm_kick_pcm_to_run(pwrctrl);
spm_trigger_wfi_for_dpidle(pwrctrl);
__spm_get_wakeup_status(&wakesta);
__spm_clean_after_wakeup();
request_uart_to_wakeup();
last_wr = __spm_output_wake_reason(&wakesta, pcmdesc, true);
RESTORE_IRQ:
mt_cpufreq_set_pmic_phase(PMIC_WRAP_PHASE_NORMAL);
mt_cirq_flush();
mt_cirq_disable();
mt_irq_mask_restore(&mask);
spin_unlock_irqrestore(&__spm_lock, flags);
if (!wd_ret)
wd_api->wd_resume_notify();
return last_wr;
}
#if SPM_AEE_RR_REC
static void spm_dpidle_aee_init(void)
{
aee_rr_rec_deepidle_val(0);
}
#endif
void spm_dpidle_init(void)
{
#if SPM_AEE_RR_REC
spm_dpidle_aee_init();
#endif
}
MODULE_DESCRIPTION("SPM-DPIdle Driver v0.1");
| tbalden/android_kernel_htc_m9pw | drivers/misc/mediatek/spm/mt6795/mt_spm_dpidle_64.c | C | gpl-2.0 | 18,839 |
<?php
/*
* This file contains the HTML generated for small calendars. You can copy this file to yourthemefolder/plugins/events/templates and modify it in an upgrade-safe manner.
*
* There are two variables made available to you:
*
* $calendar - contains an array of information regarding the calendar and is used to generate the content
* $args - the arguments passed to EM_Calendar::output()
*
* Note that leaving the class names for the previous/next links will keep the AJAX navigation working.
*/
?>
<table class="em-calendar">
<thead>
<tr class="first-tr">
<td><a class="em-calnav em-calnav-prev" href="<?php echo $calendar['links']['previous_url']; ?>" rel="nofollow"><<</a></td>
<td class="month_name" colspan="5"><?php echo ucfirst(date_i18n(get_option('dbem_small_calendar_month_format'), $calendar['month_start'])); ?></td>
<td><a class="em-calnav em-calnav-next" href="<?php echo $calendar['links']['next_url']; ?>" rel="nofollow">>></a></td>
</tr>
</thead>
<tbody>
<tr class="days-names">
<td><?php echo implode('</td><td>',$calendar['row_headers']); ?></td>
</tr>
<tr>
<?php
$cal_count = count($calendar['cells']);
$col_count = $count = 1; //this counts collumns in the $calendar_array['cells'] array
$col_max = count($calendar['row_headers']); //each time this collumn number is reached, we create a new collumn, the number of cells should divide evenly by the number of row_headers
foreach($calendar['cells'] as $date => $cell_data ){
$class = ( !empty($cell_data['events']) && count($cell_data['events']) > 0 ) ? 'eventful':'eventless';
if(!empty($cell_data['type'])){
$class .= "-".$cell_data['type'];
}
?>
<td class="<?php echo $class; ?>">
<?php if( !empty($cell_data['events']) && count($cell_data['events']) > 0 ): ?>
<a href="<?php echo esc_url($cell_data['link']); ?>" title="<?php echo esc_attr($cell_data['link_title']); ?>"><?php echo date('j',$cell_data['date']); ?></a>
<?php else:?>
<?php echo date('j',$cell_data['date']); ?>
<?php endif; ?>
</td>
<?php
//create a new row once we reach the end of a table collumn
$col_count= ($col_count == $col_max ) ? 1 : $col_count+1;
echo ($col_count == 1 && $count < $cal_count) ? '</tr><tr>':'';
$count ++;
}
?>
</tr>
</tbody>
</table> | hlavina/vava | wp-content/themes/anew/plugins/events-manager/templates/calendar-small.php | PHP | gpl-2.0 | 2,358 |
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
<div data-options="region:'center'" style="padding:10px 6px 0px 10px;border:0px;">
<div class="messager-icon messager-question"></div>
<div id="torrent-remove-confirm-confirm-text" style="width:100%;padding:0px;">
</div>
<hr/>
<input id="remove-data" type="checkbox" style="width:16px;"/><label id="torrent-remove-confirm-remove-data" for="remove-data"></label>
</div>
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
<a id="torrent-remove-confirm-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
<a id="torrent-remove-confirm-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
</div>
</div>
<script type="text/javascript">
(function(thisDialog){
var title = "confirm-text,remove-data".split(",");
$.each(title, function(i, item){
thisDialog.find("#torrent-remove-confirm-"+item).html(system.lang.dialog["torrent-remove"][item]);
});
thisDialog.find("#torrent-remove-ids").val(thisDialog.data);
thisDialog.find("#torrent-remove-confirm-button-ok").html(system.lang.dialog.public["button-ok"])
.click(function()
{
if (!thisDialog.data("ids"))
{
thisDialog.dialog("close");
return;
}
var button = $(this);
var icon = button.linkbutton("options").iconCls;
button.linkbutton({disabled:true,iconCls:"icon-loading"});
transmission.removeTorrent(thisDialog.data("ids"),thisDialog.find("#remove-data")[0].checked,function(status){
button.linkbutton({iconCls:icon,disabled:false});
if (status=="success")
{
thisDialog.dialog("close");
system.reloadTorrentBaseInfos();
}
else
{
$.messager.alert("",system.lang.dialog["torrent-remove"]["remove-error"],'error');
}
});
});
thisDialog.find("#torrent-remove-confirm-button-cancel").html(system.lang.dialog.public["button-cancel"])
.click(function()
{
thisDialog.dialog("close");
});
})($("#dialog-torrent-remove-confirm"));
</script> | djdeeles/opnwrt_webstatus | torrent/tr-web-control/template/dialog-torrent-remove-confirm.html | HTML | gpl-2.0 | 2,217 |
/*
* NETLINK Kernel-user communication protocol.
*
* Authors: Alan Cox <alan@lxorguk.ukuu.org.uk>
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
* Patrick McHardy <kaber@trash.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Tue Jun 26 14:36:48 MEST 2001 Herbert "herp" Rosmanith
* added netlink_proto_exit
* Tue Jan 22 18:32:44 BRST 2002 Arnaldo C. de Melo <acme@conectiva.com.br>
* use nlk_sk, as sk->protinfo is on a diet 8)
* Fri Jul 22 19:51:12 MEST 2005 Harald Welte <laforge@gnumonks.org>
* - inc module use count of module that owns
* the kernel socket in case userspace opens
* socket of same protocol
* - remove all module support, since netlink is
* mandatory if CONFIG_NET=y these days
*/
#include <linux/module.h>
#include <linux/capability.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/socket.h>
#include <linux/un.h>
#include <linux/fcntl.h>
#include <linux/termios.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/notifier.h>
#include <linux/security.h>
#include <linux/jhash.h>
#include <linux/jiffies.h>
#include <linux/random.h>
#include <linux/bitops.h>
#include <linux/mm.h>
#include <linux/types.h>
#include <linux/audit.h>
#include <linux/mutex.h>
#include <linux/vmalloc.h>
#include <linux/if_arp.h>
#include <linux/rhashtable.h>
#include <asm/cacheflush.h>
#include <linux/hash.h>
#include <linux/genetlink.h>
#include <linux/net_namespace.h>
#include <net/net_namespace.h>
#include <net/sock.h>
#include <net/scm.h>
#include <net/netlink.h>
#include "af_netlink.h"
struct listeners {
struct rcu_head rcu;
unsigned long masks[0];
};
/* state bits */
#define NETLINK_S_CONGESTED 0x0
static inline int netlink_is_kernel(struct sock *sk)
{
return nlk_sk(sk)->flags & NETLINK_F_KERNEL_SOCKET;
}
struct netlink_table *nl_table __read_mostly;
EXPORT_SYMBOL_GPL(nl_table);
static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait);
static struct lock_class_key nlk_cb_mutex_keys[MAX_LINKS];
static const char *const nlk_cb_mutex_key_strings[MAX_LINKS + 1] = {
"nlk_cb_mutex-ROUTE",
"nlk_cb_mutex-1",
"nlk_cb_mutex-USERSOCK",
"nlk_cb_mutex-FIREWALL",
"nlk_cb_mutex-SOCK_DIAG",
"nlk_cb_mutex-NFLOG",
"nlk_cb_mutex-XFRM",
"nlk_cb_mutex-SELINUX",
"nlk_cb_mutex-ISCSI",
"nlk_cb_mutex-AUDIT",
"nlk_cb_mutex-FIB_LOOKUP",
"nlk_cb_mutex-CONNECTOR",
"nlk_cb_mutex-NETFILTER",
"nlk_cb_mutex-IP6_FW",
"nlk_cb_mutex-DNRTMSG",
"nlk_cb_mutex-KOBJECT_UEVENT",
"nlk_cb_mutex-GENERIC",
"nlk_cb_mutex-17",
"nlk_cb_mutex-SCSITRANSPORT",
"nlk_cb_mutex-ECRYPTFS",
"nlk_cb_mutex-RDMA",
"nlk_cb_mutex-CRYPTO",
"nlk_cb_mutex-SMC",
"nlk_cb_mutex-23",
"nlk_cb_mutex-24",
"nlk_cb_mutex-25",
"nlk_cb_mutex-26",
"nlk_cb_mutex-27",
"nlk_cb_mutex-28",
"nlk_cb_mutex-29",
"nlk_cb_mutex-30",
"nlk_cb_mutex-31",
"nlk_cb_mutex-MAX_LINKS"
};
static int netlink_dump(struct sock *sk);
static void netlink_skb_destructor(struct sk_buff *skb);
/* nl_table locking explained:
* Lookup and traversal are protected with an RCU read-side lock. Insertion
* and removal are protected with per bucket lock while using RCU list
* modification primitives and may run in parallel to RCU protected lookups.
* Destruction of the Netlink socket may only occur *after* nl_table_lock has
* been acquired * either during or after the socket has been removed from
* the list and after an RCU grace period.
*/
DEFINE_RWLOCK(nl_table_lock);
EXPORT_SYMBOL_GPL(nl_table_lock);
static atomic_t nl_table_users = ATOMIC_INIT(0);
#define nl_deref_protected(X) rcu_dereference_protected(X, lockdep_is_held(&nl_table_lock));
static BLOCKING_NOTIFIER_HEAD(netlink_chain);
static DEFINE_SPINLOCK(netlink_tap_lock);
static struct list_head netlink_tap_all __read_mostly;
static const struct rhashtable_params netlink_rhashtable_params;
static inline u32 netlink_group_mask(u32 group)
{
return group ? 1 << (group - 1) : 0;
}
static struct sk_buff *netlink_to_full_skb(const struct sk_buff *skb,
gfp_t gfp_mask)
{
unsigned int len = skb_end_offset(skb);
struct sk_buff *new;
new = alloc_skb(len, gfp_mask);
if (new == NULL)
return NULL;
NETLINK_CB(new).portid = NETLINK_CB(skb).portid;
NETLINK_CB(new).dst_group = NETLINK_CB(skb).dst_group;
NETLINK_CB(new).creds = NETLINK_CB(skb).creds;
skb_put_data(new, skb->data, len);
return new;
}
int netlink_add_tap(struct netlink_tap *nt)
{
if (unlikely(nt->dev->type != ARPHRD_NETLINK))
return -EINVAL;
spin_lock(&netlink_tap_lock);
list_add_rcu(&nt->list, &netlink_tap_all);
spin_unlock(&netlink_tap_lock);
__module_get(nt->module);
return 0;
}
EXPORT_SYMBOL_GPL(netlink_add_tap);
static int __netlink_remove_tap(struct netlink_tap *nt)
{
bool found = false;
struct netlink_tap *tmp;
spin_lock(&netlink_tap_lock);
list_for_each_entry(tmp, &netlink_tap_all, list) {
if (nt == tmp) {
list_del_rcu(&nt->list);
found = true;
goto out;
}
}
pr_warn("__netlink_remove_tap: %p not found\n", nt);
out:
spin_unlock(&netlink_tap_lock);
if (found)
module_put(nt->module);
return found ? 0 : -ENODEV;
}
int netlink_remove_tap(struct netlink_tap *nt)
{
int ret;
ret = __netlink_remove_tap(nt);
synchronize_net();
return ret;
}
EXPORT_SYMBOL_GPL(netlink_remove_tap);
static bool netlink_filter_tap(const struct sk_buff *skb)
{
struct sock *sk = skb->sk;
/* We take the more conservative approach and
* whitelist socket protocols that may pass.
*/
switch (sk->sk_protocol) {
case NETLINK_ROUTE:
case NETLINK_USERSOCK:
case NETLINK_SOCK_DIAG:
case NETLINK_NFLOG:
case NETLINK_XFRM:
case NETLINK_FIB_LOOKUP:
case NETLINK_NETFILTER:
case NETLINK_GENERIC:
return true;
}
return false;
}
static int __netlink_deliver_tap_skb(struct sk_buff *skb,
struct net_device *dev)
{
struct sk_buff *nskb;
struct sock *sk = skb->sk;
int ret = -ENOMEM;
if (!net_eq(dev_net(dev), sock_net(sk)))
return 0;
dev_hold(dev);
if (is_vmalloc_addr(skb->head))
nskb = netlink_to_full_skb(skb, GFP_ATOMIC);
else
nskb = skb_clone(skb, GFP_ATOMIC);
if (nskb) {
nskb->dev = dev;
nskb->protocol = htons((u16) sk->sk_protocol);
nskb->pkt_type = netlink_is_kernel(sk) ?
PACKET_KERNEL : PACKET_USER;
skb_reset_network_header(nskb);
ret = dev_queue_xmit(nskb);
if (unlikely(ret > 0))
ret = net_xmit_errno(ret);
}
dev_put(dev);
return ret;
}
static void __netlink_deliver_tap(struct sk_buff *skb)
{
int ret;
struct netlink_tap *tmp;
if (!netlink_filter_tap(skb))
return;
list_for_each_entry_rcu(tmp, &netlink_tap_all, list) {
ret = __netlink_deliver_tap_skb(skb, tmp->dev);
if (unlikely(ret))
break;
}
}
static void netlink_deliver_tap(struct sk_buff *skb)
{
rcu_read_lock();
if (unlikely(!list_empty(&netlink_tap_all)))
__netlink_deliver_tap(skb);
rcu_read_unlock();
}
static void netlink_deliver_tap_kernel(struct sock *dst, struct sock *src,
struct sk_buff *skb)
{
if (!(netlink_is_kernel(dst) && netlink_is_kernel(src)))
netlink_deliver_tap(skb);
}
static void netlink_overrun(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
if (!(nlk->flags & NETLINK_F_RECV_NO_ENOBUFS)) {
if (!test_and_set_bit(NETLINK_S_CONGESTED,
&nlk_sk(sk)->state)) {
sk->sk_err = ENOBUFS;
sk->sk_error_report(sk);
}
}
atomic_inc(&sk->sk_drops);
}
static void netlink_rcv_wake(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
if (skb_queue_empty(&sk->sk_receive_queue))
clear_bit(NETLINK_S_CONGESTED, &nlk->state);
if (!test_bit(NETLINK_S_CONGESTED, &nlk->state))
wake_up_interruptible(&nlk->wait);
}
static void netlink_skb_destructor(struct sk_buff *skb)
{
if (is_vmalloc_addr(skb->head)) {
if (!skb->cloned ||
!atomic_dec_return(&(skb_shinfo(skb)->dataref)))
vfree(skb->head);
skb->head = NULL;
}
if (skb->sk != NULL)
sock_rfree(skb);
}
static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
{
WARN_ON(skb->sk != NULL);
skb->sk = sk;
skb->destructor = netlink_skb_destructor;
atomic_add(skb->truesize, &sk->sk_rmem_alloc);
sk_mem_charge(sk, skb->truesize);
}
static void netlink_sock_destruct(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
if (nlk->cb_running) {
if (nlk->cb.done)
nlk->cb.done(&nlk->cb);
module_put(nlk->cb.module);
kfree_skb(nlk->cb.skb);
}
skb_queue_purge(&sk->sk_receive_queue);
if (!sock_flag(sk, SOCK_DEAD)) {
printk(KERN_ERR "Freeing alive netlink socket %p\n", sk);
return;
}
WARN_ON(atomic_read(&sk->sk_rmem_alloc));
WARN_ON(refcount_read(&sk->sk_wmem_alloc));
WARN_ON(nlk_sk(sk)->groups);
}
static void netlink_sock_destruct_work(struct work_struct *work)
{
struct netlink_sock *nlk = container_of(work, struct netlink_sock,
work);
sk_free(&nlk->sk);
}
/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
* SMP. Look, when several writers sleep and reader wakes them up, all but one
* immediately hit write lock and grab all the cpus. Exclusive sleep solves
* this, _but_ remember, it adds useless work on UP machines.
*/
void netlink_table_grab(void)
__acquires(nl_table_lock)
{
might_sleep();
write_lock_irq(&nl_table_lock);
if (atomic_read(&nl_table_users)) {
DECLARE_WAITQUEUE(wait, current);
add_wait_queue_exclusive(&nl_table_wait, &wait);
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (atomic_read(&nl_table_users) == 0)
break;
write_unlock_irq(&nl_table_lock);
schedule();
write_lock_irq(&nl_table_lock);
}
__set_current_state(TASK_RUNNING);
remove_wait_queue(&nl_table_wait, &wait);
}
}
void netlink_table_ungrab(void)
__releases(nl_table_lock)
{
write_unlock_irq(&nl_table_lock);
wake_up(&nl_table_wait);
}
static inline void
netlink_lock_table(void)
{
/* read_lock() synchronizes us to netlink_table_grab */
read_lock(&nl_table_lock);
atomic_inc(&nl_table_users);
read_unlock(&nl_table_lock);
}
static inline void
netlink_unlock_table(void)
{
if (atomic_dec_and_test(&nl_table_users))
wake_up(&nl_table_wait);
}
struct netlink_compare_arg
{
possible_net_t pnet;
u32 portid;
};
/* Doing sizeof directly may yield 4 extra bytes on 64-bit. */
#define netlink_compare_arg_len \
(offsetof(struct netlink_compare_arg, portid) + sizeof(u32))
static inline int netlink_compare(struct rhashtable_compare_arg *arg,
const void *ptr)
{
const struct netlink_compare_arg *x = arg->key;
const struct netlink_sock *nlk = ptr;
return nlk->portid != x->portid ||
!net_eq(sock_net(&nlk->sk), read_pnet(&x->pnet));
}
static void netlink_compare_arg_init(struct netlink_compare_arg *arg,
struct net *net, u32 portid)
{
memset(arg, 0, sizeof(*arg));
write_pnet(&arg->pnet, net);
arg->portid = portid;
}
static struct sock *__netlink_lookup(struct netlink_table *table, u32 portid,
struct net *net)
{
struct netlink_compare_arg arg;
netlink_compare_arg_init(&arg, net, portid);
return rhashtable_lookup_fast(&table->hash, &arg,
netlink_rhashtable_params);
}
static int __netlink_insert(struct netlink_table *table, struct sock *sk)
{
struct netlink_compare_arg arg;
netlink_compare_arg_init(&arg, sock_net(sk), nlk_sk(sk)->portid);
return rhashtable_lookup_insert_key(&table->hash, &arg,
&nlk_sk(sk)->node,
netlink_rhashtable_params);
}
static struct sock *netlink_lookup(struct net *net, int protocol, u32 portid)
{
struct netlink_table *table = &nl_table[protocol];
struct sock *sk;
rcu_read_lock();
sk = __netlink_lookup(table, portid, net);
if (sk)
sock_hold(sk);
rcu_read_unlock();
return sk;
}
static const struct proto_ops netlink_ops;
static void
netlink_update_listeners(struct sock *sk)
{
struct netlink_table *tbl = &nl_table[sk->sk_protocol];
unsigned long mask;
unsigned int i;
struct listeners *listeners;
listeners = nl_deref_protected(tbl->listeners);
if (!listeners)
return;
for (i = 0; i < NLGRPLONGS(tbl->groups); i++) {
mask = 0;
sk_for_each_bound(sk, &tbl->mc_list) {
if (i < NLGRPLONGS(nlk_sk(sk)->ngroups))
mask |= nlk_sk(sk)->groups[i];
}
listeners->masks[i] = mask;
}
/* this function is only called with the netlink table "grabbed", which
* makes sure updates are visible before bind or setsockopt return. */
}
static int netlink_insert(struct sock *sk, u32 portid)
{
struct netlink_table *table = &nl_table[sk->sk_protocol];
int err;
lock_sock(sk);
err = nlk_sk(sk)->portid == portid ? 0 : -EBUSY;
if (nlk_sk(sk)->bound)
goto err;
err = -ENOMEM;
if (BITS_PER_LONG > 32 &&
unlikely(atomic_read(&table->hash.nelems) >= UINT_MAX))
goto err;
nlk_sk(sk)->portid = portid;
sock_hold(sk);
err = __netlink_insert(table, sk);
if (err) {
/* In case the hashtable backend returns with -EBUSY
* from here, it must not escape to the caller.
*/
if (unlikely(err == -EBUSY))
err = -EOVERFLOW;
if (err == -EEXIST)
err = -EADDRINUSE;
sock_put(sk);
goto err;
}
/* We need to ensure that the socket is hashed and visible. */
smp_wmb();
nlk_sk(sk)->bound = portid;
err:
release_sock(sk);
return err;
}
static void netlink_remove(struct sock *sk)
{
struct netlink_table *table;
table = &nl_table[sk->sk_protocol];
if (!rhashtable_remove_fast(&table->hash, &nlk_sk(sk)->node,
netlink_rhashtable_params)) {
WARN_ON(refcount_read(&sk->sk_refcnt) == 1);
__sock_put(sk);
}
netlink_table_grab();
if (nlk_sk(sk)->subscriptions) {
__sk_del_bind_node(sk);
netlink_update_listeners(sk);
}
if (sk->sk_protocol == NETLINK_GENERIC)
atomic_inc(&genl_sk_destructing_cnt);
netlink_table_ungrab();
}
static struct proto netlink_proto = {
.name = "NETLINK",
.owner = THIS_MODULE,
.obj_size = sizeof(struct netlink_sock),
};
static int __netlink_create(struct net *net, struct socket *sock,
struct mutex *cb_mutex, int protocol,
int kern)
{
struct sock *sk;
struct netlink_sock *nlk;
sock->ops = &netlink_ops;
sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto, kern);
if (!sk)
return -ENOMEM;
sock_init_data(sock, sk);
nlk = nlk_sk(sk);
if (cb_mutex) {
nlk->cb_mutex = cb_mutex;
} else {
nlk->cb_mutex = &nlk->cb_def_mutex;
mutex_init(nlk->cb_mutex);
lockdep_set_class_and_name(nlk->cb_mutex,
nlk_cb_mutex_keys + protocol,
nlk_cb_mutex_key_strings[protocol]);
}
init_waitqueue_head(&nlk->wait);
sk->sk_destruct = netlink_sock_destruct;
sk->sk_protocol = protocol;
return 0;
}
static int netlink_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
struct module *module = NULL;
struct mutex *cb_mutex;
struct netlink_sock *nlk;
int (*bind)(struct net *net, int group);
void (*unbind)(struct net *net, int group);
int err = 0;
sock->state = SS_UNCONNECTED;
if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
return -ESOCKTNOSUPPORT;
if (protocol < 0 || protocol >= MAX_LINKS)
return -EPROTONOSUPPORT;
netlink_lock_table();
#ifdef CONFIG_MODULES
if (!nl_table[protocol].registered) {
netlink_unlock_table();
request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol);
netlink_lock_table();
}
#endif
if (nl_table[protocol].registered &&
try_module_get(nl_table[protocol].module))
module = nl_table[protocol].module;
else
err = -EPROTONOSUPPORT;
cb_mutex = nl_table[protocol].cb_mutex;
bind = nl_table[protocol].bind;
unbind = nl_table[protocol].unbind;
netlink_unlock_table();
if (err < 0)
goto out;
err = __netlink_create(net, sock, cb_mutex, protocol, kern);
if (err < 0)
goto out_module;
local_bh_disable();
sock_prot_inuse_add(net, &netlink_proto, 1);
local_bh_enable();
nlk = nlk_sk(sock->sk);
nlk->module = module;
nlk->netlink_bind = bind;
nlk->netlink_unbind = unbind;
out:
return err;
out_module:
module_put(module);
goto out;
}
static void deferred_put_nlk_sk(struct rcu_head *head)
{
struct netlink_sock *nlk = container_of(head, struct netlink_sock, rcu);
struct sock *sk = &nlk->sk;
kfree(nlk->groups);
nlk->groups = NULL;
if (!refcount_dec_and_test(&sk->sk_refcnt))
return;
if (nlk->cb_running && nlk->cb.done) {
INIT_WORK(&nlk->work, netlink_sock_destruct_work);
schedule_work(&nlk->work);
return;
}
sk_free(sk);
}
static int netlink_release(struct socket *sock)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk;
if (!sk)
return 0;
netlink_remove(sk);
sock_orphan(sk);
nlk = nlk_sk(sk);
/*
* OK. Socket is unlinked, any packets that arrive now
* will be purged.
*/
/* must not acquire netlink_table_lock in any way again before unbind
* and notifying genetlink is done as otherwise it might deadlock
*/
if (nlk->netlink_unbind) {
int i;
for (i = 0; i < nlk->ngroups; i++)
if (test_bit(i, nlk->groups))
nlk->netlink_unbind(sock_net(sk), i + 1);
}
if (sk->sk_protocol == NETLINK_GENERIC &&
atomic_dec_return(&genl_sk_destructing_cnt) == 0)
wake_up(&genl_sk_destructing_waitq);
sock->sk = NULL;
wake_up_interruptible_all(&nlk->wait);
skb_queue_purge(&sk->sk_write_queue);
if (nlk->portid && nlk->bound) {
struct netlink_notify n = {
.net = sock_net(sk),
.protocol = sk->sk_protocol,
.portid = nlk->portid,
};
blocking_notifier_call_chain(&netlink_chain,
NETLINK_URELEASE, &n);
}
module_put(nlk->module);
if (netlink_is_kernel(sk)) {
netlink_table_grab();
BUG_ON(nl_table[sk->sk_protocol].registered == 0);
if (--nl_table[sk->sk_protocol].registered == 0) {
struct listeners *old;
old = nl_deref_protected(nl_table[sk->sk_protocol].listeners);
RCU_INIT_POINTER(nl_table[sk->sk_protocol].listeners, NULL);
kfree_rcu(old, rcu);
nl_table[sk->sk_protocol].module = NULL;
nl_table[sk->sk_protocol].bind = NULL;
nl_table[sk->sk_protocol].unbind = NULL;
nl_table[sk->sk_protocol].flags = 0;
nl_table[sk->sk_protocol].registered = 0;
}
netlink_table_ungrab();
}
local_bh_disable();
sock_prot_inuse_add(sock_net(sk), &netlink_proto, -1);
local_bh_enable();
call_rcu(&nlk->rcu, deferred_put_nlk_sk);
return 0;
}
static int netlink_autobind(struct socket *sock)
{
struct sock *sk = sock->sk;
struct net *net = sock_net(sk);
struct netlink_table *table = &nl_table[sk->sk_protocol];
s32 portid = task_tgid_vnr(current);
int err;
s32 rover = -4096;
bool ok;
retry:
cond_resched();
rcu_read_lock();
ok = !__netlink_lookup(table, portid, net);
rcu_read_unlock();
if (!ok) {
/* Bind collision, search negative portid values. */
if (rover == -4096)
/* rover will be in range [S32_MIN, -4097] */
rover = S32_MIN + prandom_u32_max(-4096 - S32_MIN);
else if (rover >= -4096)
rover = -4097;
portid = rover--;
goto retry;
}
err = netlink_insert(sk, portid);
if (err == -EADDRINUSE)
goto retry;
/* If 2 threads race to autobind, that is fine. */
if (err == -EBUSY)
err = 0;
return err;
}
/**
* __netlink_ns_capable - General netlink message capability test
* @nsp: NETLINK_CB of the socket buffer holding a netlink command from userspace.
* @user_ns: The user namespace of the capability to use
* @cap: The capability to use
*
* Test to see if the opener of the socket we received the message
* from had when the netlink socket was created and the sender of the
* message has has the capability @cap in the user namespace @user_ns.
*/
bool __netlink_ns_capable(const struct netlink_skb_parms *nsp,
struct user_namespace *user_ns, int cap)
{
return ((nsp->flags & NETLINK_SKB_DST) ||
file_ns_capable(nsp->sk->sk_socket->file, user_ns, cap)) &&
ns_capable(user_ns, cap);
}
EXPORT_SYMBOL(__netlink_ns_capable);
/**
* netlink_ns_capable - General netlink message capability test
* @skb: socket buffer holding a netlink command from userspace
* @user_ns: The user namespace of the capability to use
* @cap: The capability to use
*
* Test to see if the opener of the socket we received the message
* from had when the netlink socket was created and the sender of the
* message has has the capability @cap in the user namespace @user_ns.
*/
bool netlink_ns_capable(const struct sk_buff *skb,
struct user_namespace *user_ns, int cap)
{
return __netlink_ns_capable(&NETLINK_CB(skb), user_ns, cap);
}
EXPORT_SYMBOL(netlink_ns_capable);
/**
* netlink_capable - Netlink global message capability test
* @skb: socket buffer holding a netlink command from userspace
* @cap: The capability to use
*
* Test to see if the opener of the socket we received the message
* from had when the netlink socket was created and the sender of the
* message has has the capability @cap in all user namespaces.
*/
bool netlink_capable(const struct sk_buff *skb, int cap)
{
return netlink_ns_capable(skb, &init_user_ns, cap);
}
EXPORT_SYMBOL(netlink_capable);
/**
* netlink_net_capable - Netlink network namespace message capability test
* @skb: socket buffer holding a netlink command from userspace
* @cap: The capability to use
*
* Test to see if the opener of the socket we received the message
* from had when the netlink socket was created and the sender of the
* message has has the capability @cap over the network namespace of
* the socket we received the message from.
*/
bool netlink_net_capable(const struct sk_buff *skb, int cap)
{
return netlink_ns_capable(skb, sock_net(skb->sk)->user_ns, cap);
}
EXPORT_SYMBOL(netlink_net_capable);
static inline int netlink_allowed(const struct socket *sock, unsigned int flag)
{
return (nl_table[sock->sk->sk_protocol].flags & flag) ||
ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN);
}
static void
netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
{
struct netlink_sock *nlk = nlk_sk(sk);
if (nlk->subscriptions && !subscriptions)
__sk_del_bind_node(sk);
else if (!nlk->subscriptions && subscriptions)
sk_add_bind_node(sk, &nl_table[sk->sk_protocol].mc_list);
nlk->subscriptions = subscriptions;
}
static int netlink_realloc_groups(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
unsigned int groups;
unsigned long *new_groups;
int err = 0;
netlink_table_grab();
groups = nl_table[sk->sk_protocol].groups;
if (!nl_table[sk->sk_protocol].registered) {
err = -ENOENT;
goto out_unlock;
}
if (nlk->ngroups >= groups)
goto out_unlock;
new_groups = krealloc(nlk->groups, NLGRPSZ(groups), GFP_ATOMIC);
if (new_groups == NULL) {
err = -ENOMEM;
goto out_unlock;
}
memset((char *)new_groups + NLGRPSZ(nlk->ngroups), 0,
NLGRPSZ(groups) - NLGRPSZ(nlk->ngroups));
nlk->groups = new_groups;
nlk->ngroups = groups;
out_unlock:
netlink_table_ungrab();
return err;
}
static void netlink_undo_bind(int group, long unsigned int groups,
struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
int undo;
if (!nlk->netlink_unbind)
return;
for (undo = 0; undo < group; undo++)
if (test_bit(undo, &groups))
nlk->netlink_unbind(sock_net(sk), undo + 1);
}
static int netlink_bind(struct socket *sock, struct sockaddr *addr,
int addr_len)
{
struct sock *sk = sock->sk;
struct net *net = sock_net(sk);
struct netlink_sock *nlk = nlk_sk(sk);
struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
int err = 0;
long unsigned int groups = nladdr->nl_groups;
bool bound;
if (addr_len < sizeof(struct sockaddr_nl))
return -EINVAL;
if (nladdr->nl_family != AF_NETLINK)
return -EINVAL;
/* Only superuser is allowed to listen multicasts */
if (groups) {
if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
return -EPERM;
err = netlink_realloc_groups(sk);
if (err)
return err;
}
bound = nlk->bound;
if (bound) {
/* Ensure nlk->portid is up-to-date. */
smp_rmb();
if (nladdr->nl_pid != nlk->portid)
return -EINVAL;
}
netlink_lock_table();
if (nlk->netlink_bind && groups) {
int group;
for (group = 0; group < nlk->ngroups; group++) {
if (!test_bit(group, &groups))
continue;
err = nlk->netlink_bind(net, group + 1);
if (!err)
continue;
netlink_undo_bind(group, groups, sk);
goto unlock;
}
}
/* No need for barriers here as we return to user-space without
* using any of the bound attributes.
*/
if (!bound) {
err = nladdr->nl_pid ?
netlink_insert(sk, nladdr->nl_pid) :
netlink_autobind(sock);
if (err) {
netlink_undo_bind(nlk->ngroups, groups, sk);
goto unlock;
}
}
if (!groups && (nlk->groups == NULL || !(u32)nlk->groups[0]))
goto unlock;
netlink_unlock_table();
netlink_table_grab();
netlink_update_subscriptions(sk, nlk->subscriptions +
hweight32(groups) -
hweight32(nlk->groups[0]));
nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | groups;
netlink_update_listeners(sk);
netlink_table_ungrab();
return 0;
unlock:
netlink_unlock_table();
return err;
}
static int netlink_connect(struct socket *sock, struct sockaddr *addr,
int alen, int flags)
{
int err = 0;
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
if (alen < sizeof(addr->sa_family))
return -EINVAL;
if (addr->sa_family == AF_UNSPEC) {
sk->sk_state = NETLINK_UNCONNECTED;
nlk->dst_portid = 0;
nlk->dst_group = 0;
return 0;
}
if (addr->sa_family != AF_NETLINK)
return -EINVAL;
if ((nladdr->nl_groups || nladdr->nl_pid) &&
!netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
return -EPERM;
/* No need for barriers here as we return to user-space without
* using any of the bound attributes.
*/
if (!nlk->bound)
err = netlink_autobind(sock);
if (err == 0) {
sk->sk_state = NETLINK_CONNECTED;
nlk->dst_portid = nladdr->nl_pid;
nlk->dst_group = ffs(nladdr->nl_groups);
}
return err;
}
static int netlink_getname(struct socket *sock, struct sockaddr *addr,
int *addr_len, int peer)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
DECLARE_SOCKADDR(struct sockaddr_nl *, nladdr, addr);
nladdr->nl_family = AF_NETLINK;
nladdr->nl_pad = 0;
*addr_len = sizeof(*nladdr);
if (peer) {
nladdr->nl_pid = nlk->dst_portid;
nladdr->nl_groups = netlink_group_mask(nlk->dst_group);
} else {
nladdr->nl_pid = nlk->portid;
netlink_lock_table();
nladdr->nl_groups = nlk->groups ? nlk->groups[0] : 0;
netlink_unlock_table();
}
return 0;
}
static int netlink_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg)
{
/* try to hand this ioctl down to the NIC drivers.
*/
return -ENOIOCTLCMD;
}
static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)
{
struct sock *sock;
struct netlink_sock *nlk;
sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, portid);
if (!sock)
return ERR_PTR(-ECONNREFUSED);
/* Don't bother queuing skb if kernel socket has no input function */
nlk = nlk_sk(sock);
if (sock->sk_state == NETLINK_CONNECTED &&
nlk->dst_portid != nlk_sk(ssk)->portid) {
sock_put(sock);
return ERR_PTR(-ECONNREFUSED);
}
return sock;
}
struct sock *netlink_getsockbyfilp(struct file *filp)
{
struct inode *inode = file_inode(filp);
struct sock *sock;
if (!S_ISSOCK(inode->i_mode))
return ERR_PTR(-ENOTSOCK);
sock = SOCKET_I(inode)->sk;
if (sock->sk_family != AF_NETLINK)
return ERR_PTR(-EINVAL);
sock_hold(sock);
return sock;
}
static struct sk_buff *netlink_alloc_large_skb(unsigned int size,
int broadcast)
{
struct sk_buff *skb;
void *data;
if (size <= NLMSG_GOODSIZE || broadcast)
return alloc_skb(size, GFP_KERNEL);
size = SKB_DATA_ALIGN(size) +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
data = vmalloc(size);
if (data == NULL)
return NULL;
skb = __build_skb(data, size);
if (skb == NULL)
vfree(data);
else
skb->destructor = netlink_skb_destructor;
return skb;
}
/*
* Attach a skb to a netlink socket.
* The caller must hold a reference to the destination socket. On error, the
* reference is dropped. The skb is not send to the destination, just all
* all error checks are performed and memory in the queue is reserved.
* Return values:
* < 0: error. skb freed, reference to sock dropped.
* 0: continue
* 1: repeat lookup - reference dropped while waiting for socket memory.
*/
int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
long *timeo, struct sock *ssk)
{
struct netlink_sock *nlk;
nlk = nlk_sk(sk);
if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
test_bit(NETLINK_S_CONGESTED, &nlk->state))) {
DECLARE_WAITQUEUE(wait, current);
if (!*timeo) {
if (!ssk || netlink_is_kernel(ssk))
netlink_overrun(sk);
sock_put(sk);
kfree_skb(skb);
return -EAGAIN;
}
__set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&nlk->wait, &wait);
if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
test_bit(NETLINK_S_CONGESTED, &nlk->state)) &&
!sock_flag(sk, SOCK_DEAD))
*timeo = schedule_timeout(*timeo);
__set_current_state(TASK_RUNNING);
remove_wait_queue(&nlk->wait, &wait);
sock_put(sk);
if (signal_pending(current)) {
kfree_skb(skb);
return sock_intr_errno(*timeo);
}
return 1;
}
netlink_skb_set_owner_r(skb, sk);
return 0;
}
static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb)
{
int len = skb->len;
netlink_deliver_tap(skb);
skb_queue_tail(&sk->sk_receive_queue, skb);
sk->sk_data_ready(sk);
return len;
}
int netlink_sendskb(struct sock *sk, struct sk_buff *skb)
{
int len = __netlink_sendskb(sk, skb);
sock_put(sk);
return len;
}
void netlink_detachskb(struct sock *sk, struct sk_buff *skb)
{
kfree_skb(skb);
sock_put(sk);
}
static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
{
int delta;
WARN_ON(skb->sk != NULL);
delta = skb->end - skb->tail;
if (is_vmalloc_addr(skb->head) || delta * 2 < skb->truesize)
return skb;
if (skb_shared(skb)) {
struct sk_buff *nskb = skb_clone(skb, allocation);
if (!nskb)
return skb;
consume_skb(skb);
skb = nskb;
}
pskb_expand_head(skb, 0, -delta,
(allocation & ~__GFP_DIRECT_RECLAIM) |
__GFP_NOWARN | __GFP_NORETRY);
return skb;
}
static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb,
struct sock *ssk)
{
int ret;
struct netlink_sock *nlk = nlk_sk(sk);
ret = -ECONNREFUSED;
if (nlk->netlink_rcv != NULL) {
ret = skb->len;
netlink_skb_set_owner_r(skb, sk);
NETLINK_CB(skb).sk = ssk;
netlink_deliver_tap_kernel(sk, ssk, skb);
nlk->netlink_rcv(skb);
consume_skb(skb);
} else {
kfree_skb(skb);
}
sock_put(sk);
return ret;
}
int netlink_unicast(struct sock *ssk, struct sk_buff *skb,
u32 portid, int nonblock)
{
struct sock *sk;
int err;
long timeo;
skb = netlink_trim(skb, gfp_any());
timeo = sock_sndtimeo(ssk, nonblock);
retry:
sk = netlink_getsockbyportid(ssk, portid);
if (IS_ERR(sk)) {
kfree_skb(skb);
return PTR_ERR(sk);
}
if (netlink_is_kernel(sk))
return netlink_unicast_kernel(sk, skb, ssk);
if (sk_filter(sk, skb)) {
err = skb->len;
kfree_skb(skb);
sock_put(sk);
return err;
}
err = netlink_attachskb(sk, skb, &timeo, ssk);
if (err == 1)
goto retry;
if (err)
return err;
return netlink_sendskb(sk, skb);
}
EXPORT_SYMBOL(netlink_unicast);
int netlink_has_listeners(struct sock *sk, unsigned int group)
{
int res = 0;
struct listeners *listeners;
BUG_ON(!netlink_is_kernel(sk));
rcu_read_lock();
listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners);
if (listeners && group - 1 < nl_table[sk->sk_protocol].groups)
res = test_bit(group - 1, listeners->masks);
rcu_read_unlock();
return res;
}
EXPORT_SYMBOL_GPL(netlink_has_listeners);
static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
{
struct netlink_sock *nlk = nlk_sk(sk);
if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
!test_bit(NETLINK_S_CONGESTED, &nlk->state)) {
netlink_skb_set_owner_r(skb, sk);
__netlink_sendskb(sk, skb);
return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1);
}
return -1;
}
struct netlink_broadcast_data {
struct sock *exclude_sk;
struct net *net;
u32 portid;
u32 group;
int failure;
int delivery_failure;
int congested;
int delivered;
gfp_t allocation;
struct sk_buff *skb, *skb2;
int (*tx_filter)(struct sock *dsk, struct sk_buff *skb, void *data);
void *tx_data;
};
static void do_one_broadcast(struct sock *sk,
struct netlink_broadcast_data *p)
{
struct netlink_sock *nlk = nlk_sk(sk);
int val;
if (p->exclude_sk == sk)
return;
if (nlk->portid == p->portid || p->group - 1 >= nlk->ngroups ||
!test_bit(p->group - 1, nlk->groups))
return;
if (!net_eq(sock_net(sk), p->net)) {
if (!(nlk->flags & NETLINK_F_LISTEN_ALL_NSID))
return;
if (!peernet_has_id(sock_net(sk), p->net))
return;
if (!file_ns_capable(sk->sk_socket->file, p->net->user_ns,
CAP_NET_BROADCAST))
return;
}
if (p->failure) {
netlink_overrun(sk);
return;
}
sock_hold(sk);
if (p->skb2 == NULL) {
if (skb_shared(p->skb)) {
p->skb2 = skb_clone(p->skb, p->allocation);
} else {
p->skb2 = skb_get(p->skb);
/*
* skb ownership may have been set when
* delivered to a previous socket.
*/
skb_orphan(p->skb2);
}
}
if (p->skb2 == NULL) {
netlink_overrun(sk);
/* Clone failed. Notify ALL listeners. */
p->failure = 1;
if (nlk->flags & NETLINK_F_BROADCAST_SEND_ERROR)
p->delivery_failure = 1;
goto out;
}
if (p->tx_filter && p->tx_filter(sk, p->skb2, p->tx_data)) {
kfree_skb(p->skb2);
p->skb2 = NULL;
goto out;
}
if (sk_filter(sk, p->skb2)) {
kfree_skb(p->skb2);
p->skb2 = NULL;
goto out;
}
NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
if (NETLINK_CB(p->skb2).nsid != NETNSA_NSID_NOT_ASSIGNED)
NETLINK_CB(p->skb2).nsid_is_set = true;
val = netlink_broadcast_deliver(sk, p->skb2);
if (val < 0) {
netlink_overrun(sk);
if (nlk->flags & NETLINK_F_BROADCAST_SEND_ERROR)
p->delivery_failure = 1;
} else {
p->congested |= val;
p->delivered = 1;
p->skb2 = NULL;
}
out:
sock_put(sk);
}
int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 portid,
u32 group, gfp_t allocation,
int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
void *filter_data)
{
struct net *net = sock_net(ssk);
struct netlink_broadcast_data info;
struct sock *sk;
skb = netlink_trim(skb, allocation);
info.exclude_sk = ssk;
info.net = net;
info.portid = portid;
info.group = group;
info.failure = 0;
info.delivery_failure = 0;
info.congested = 0;
info.delivered = 0;
info.allocation = allocation;
info.skb = skb;
info.skb2 = NULL;
info.tx_filter = filter;
info.tx_data = filter_data;
/* While we sleep in clone, do not allow to change socket list */
netlink_lock_table();
sk_for_each_bound(sk, &nl_table[ssk->sk_protocol].mc_list)
do_one_broadcast(sk, &info);
consume_skb(skb);
netlink_unlock_table();
if (info.delivery_failure) {
kfree_skb(info.skb2);
return -ENOBUFS;
}
consume_skb(info.skb2);
if (info.delivered) {
if (info.congested && gfpflags_allow_blocking(allocation))
yield();
return 0;
}
return -ESRCH;
}
EXPORT_SYMBOL(netlink_broadcast_filtered);
int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 portid,
u32 group, gfp_t allocation)
{
return netlink_broadcast_filtered(ssk, skb, portid, group, allocation,
NULL, NULL);
}
EXPORT_SYMBOL(netlink_broadcast);
struct netlink_set_err_data {
struct sock *exclude_sk;
u32 portid;
u32 group;
int code;
};
static int do_one_set_err(struct sock *sk, struct netlink_set_err_data *p)
{
struct netlink_sock *nlk = nlk_sk(sk);
int ret = 0;
if (sk == p->exclude_sk)
goto out;
if (!net_eq(sock_net(sk), sock_net(p->exclude_sk)))
goto out;
if (nlk->portid == p->portid || p->group - 1 >= nlk->ngroups ||
!test_bit(p->group - 1, nlk->groups))
goto out;
if (p->code == ENOBUFS && nlk->flags & NETLINK_F_RECV_NO_ENOBUFS) {
ret = 1;
goto out;
}
sk->sk_err = p->code;
sk->sk_error_report(sk);
out:
return ret;
}
/**
* netlink_set_err - report error to broadcast listeners
* @ssk: the kernel netlink socket, as returned by netlink_kernel_create()
* @portid: the PORTID of a process that we want to skip (if any)
* @group: the broadcast group that will notice the error
* @code: error code, must be negative (as usual in kernelspace)
*
* This function returns the number of broadcast listeners that have set the
* NETLINK_NO_ENOBUFS socket option.
*/
int netlink_set_err(struct sock *ssk, u32 portid, u32 group, int code)
{
struct netlink_set_err_data info;
struct sock *sk;
int ret = 0;
info.exclude_sk = ssk;
info.portid = portid;
info.group = group;
/* sk->sk_err wants a positive error value */
info.code = -code;
read_lock(&nl_table_lock);
sk_for_each_bound(sk, &nl_table[ssk->sk_protocol].mc_list)
ret += do_one_set_err(sk, &info);
read_unlock(&nl_table_lock);
return ret;
}
EXPORT_SYMBOL(netlink_set_err);
/* must be called with netlink table grabbed */
static void netlink_update_socket_mc(struct netlink_sock *nlk,
unsigned int group,
int is_new)
{
int old, new = !!is_new, subscriptions;
old = test_bit(group - 1, nlk->groups);
subscriptions = nlk->subscriptions - old + new;
if (new)
__set_bit(group - 1, nlk->groups);
else
__clear_bit(group - 1, nlk->groups);
netlink_update_subscriptions(&nlk->sk, subscriptions);
netlink_update_listeners(&nlk->sk);
}
static int netlink_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
unsigned int val = 0;
int err;
if (level != SOL_NETLINK)
return -ENOPROTOOPT;
if (optlen >= sizeof(int) &&
get_user(val, (unsigned int __user *)optval))
return -EFAULT;
switch (optname) {
case NETLINK_PKTINFO:
if (val)
nlk->flags |= NETLINK_F_RECV_PKTINFO;
else
nlk->flags &= ~NETLINK_F_RECV_PKTINFO;
err = 0;
break;
case NETLINK_ADD_MEMBERSHIP:
case NETLINK_DROP_MEMBERSHIP: {
if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV))
return -EPERM;
err = netlink_realloc_groups(sk);
if (err)
return err;
if (!val || val - 1 >= nlk->ngroups)
return -EINVAL;
if (optname == NETLINK_ADD_MEMBERSHIP && nlk->netlink_bind) {
err = nlk->netlink_bind(sock_net(sk), val);
if (err)
return err;
}
netlink_table_grab();
netlink_update_socket_mc(nlk, val,
optname == NETLINK_ADD_MEMBERSHIP);
netlink_table_ungrab();
if (optname == NETLINK_DROP_MEMBERSHIP && nlk->netlink_unbind)
nlk->netlink_unbind(sock_net(sk), val);
err = 0;
break;
}
case NETLINK_BROADCAST_ERROR:
if (val)
nlk->flags |= NETLINK_F_BROADCAST_SEND_ERROR;
else
nlk->flags &= ~NETLINK_F_BROADCAST_SEND_ERROR;
err = 0;
break;
case NETLINK_NO_ENOBUFS:
if (val) {
nlk->flags |= NETLINK_F_RECV_NO_ENOBUFS;
clear_bit(NETLINK_S_CONGESTED, &nlk->state);
wake_up_interruptible(&nlk->wait);
} else {
nlk->flags &= ~NETLINK_F_RECV_NO_ENOBUFS;
}
err = 0;
break;
case NETLINK_LISTEN_ALL_NSID:
if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_BROADCAST))
return -EPERM;
if (val)
nlk->flags |= NETLINK_F_LISTEN_ALL_NSID;
else
nlk->flags &= ~NETLINK_F_LISTEN_ALL_NSID;
err = 0;
break;
case NETLINK_CAP_ACK:
if (val)
nlk->flags |= NETLINK_F_CAP_ACK;
else
nlk->flags &= ~NETLINK_F_CAP_ACK;
err = 0;
break;
case NETLINK_EXT_ACK:
if (val)
nlk->flags |= NETLINK_F_EXT_ACK;
else
nlk->flags &= ~NETLINK_F_EXT_ACK;
err = 0;
break;
default:
err = -ENOPROTOOPT;
}
return err;
}
static int netlink_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
int len, val, err;
if (level != SOL_NETLINK)
return -ENOPROTOOPT;
if (get_user(len, optlen))
return -EFAULT;
if (len < 0)
return -EINVAL;
switch (optname) {
case NETLINK_PKTINFO:
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
val = nlk->flags & NETLINK_F_RECV_PKTINFO ? 1 : 0;
if (put_user(len, optlen) ||
put_user(val, optval))
return -EFAULT;
err = 0;
break;
case NETLINK_BROADCAST_ERROR:
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
val = nlk->flags & NETLINK_F_BROADCAST_SEND_ERROR ? 1 : 0;
if (put_user(len, optlen) ||
put_user(val, optval))
return -EFAULT;
err = 0;
break;
case NETLINK_NO_ENOBUFS:
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
val = nlk->flags & NETLINK_F_RECV_NO_ENOBUFS ? 1 : 0;
if (put_user(len, optlen) ||
put_user(val, optval))
return -EFAULT;
err = 0;
break;
case NETLINK_LIST_MEMBERSHIPS: {
int pos, idx, shift;
err = 0;
netlink_lock_table();
for (pos = 0; pos * 8 < nlk->ngroups; pos += sizeof(u32)) {
if (len - pos < sizeof(u32))
break;
idx = pos / sizeof(unsigned long);
shift = (pos % sizeof(unsigned long)) * 8;
if (put_user((u32)(nlk->groups[idx] >> shift),
(u32 __user *)(optval + pos))) {
err = -EFAULT;
break;
}
}
if (put_user(ALIGN(nlk->ngroups / 8, sizeof(u32)), optlen))
err = -EFAULT;
netlink_unlock_table();
break;
}
case NETLINK_CAP_ACK:
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
val = nlk->flags & NETLINK_F_CAP_ACK ? 1 : 0;
if (put_user(len, optlen) ||
put_user(val, optval))
return -EFAULT;
err = 0;
break;
case NETLINK_EXT_ACK:
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
val = nlk->flags & NETLINK_F_EXT_ACK ? 1 : 0;
if (put_user(len, optlen) || put_user(val, optval))
return -EFAULT;
err = 0;
break;
default:
err = -ENOPROTOOPT;
}
return err;
}
static void netlink_cmsg_recv_pktinfo(struct msghdr *msg, struct sk_buff *skb)
{
struct nl_pktinfo info;
info.group = NETLINK_CB(skb).dst_group;
put_cmsg(msg, SOL_NETLINK, NETLINK_PKTINFO, sizeof(info), &info);
}
static void netlink_cmsg_listen_all_nsid(struct sock *sk, struct msghdr *msg,
struct sk_buff *skb)
{
if (!NETLINK_CB(skb).nsid_is_set)
return;
put_cmsg(msg, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, sizeof(int),
&NETLINK_CB(skb).nsid);
}
static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
DECLARE_SOCKADDR(struct sockaddr_nl *, addr, msg->msg_name);
u32 dst_portid;
u32 dst_group;
struct sk_buff *skb;
int err;
struct scm_cookie scm;
u32 netlink_skb_flags = 0;
if (msg->msg_flags&MSG_OOB)
return -EOPNOTSUPP;
err = scm_send(sock, msg, &scm, true);
if (err < 0)
return err;
if (msg->msg_namelen) {
err = -EINVAL;
if (addr->nl_family != AF_NETLINK)
goto out;
dst_portid = addr->nl_pid;
dst_group = ffs(addr->nl_groups);
err = -EPERM;
if ((dst_group || dst_portid) &&
!netlink_allowed(sock, NL_CFG_F_NONROOT_SEND))
goto out;
netlink_skb_flags |= NETLINK_SKB_DST;
} else {
dst_portid = nlk->dst_portid;
dst_group = nlk->dst_group;
}
if (!nlk->bound) {
err = netlink_autobind(sock);
if (err)
goto out;
} else {
/* Ensure nlk is hashed and visible. */
smp_rmb();
}
err = -EMSGSIZE;
if (len > sk->sk_sndbuf - 32)
goto out;
err = -ENOBUFS;
skb = netlink_alloc_large_skb(len, dst_group);
if (skb == NULL)
goto out;
NETLINK_CB(skb).portid = nlk->portid;
NETLINK_CB(skb).dst_group = dst_group;
NETLINK_CB(skb).creds = scm.creds;
NETLINK_CB(skb).flags = netlink_skb_flags;
err = -EFAULT;
if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
kfree_skb(skb);
goto out;
}
err = security_netlink_send(sk, skb);
if (err) {
kfree_skb(skb);
goto out;
}
if (dst_group) {
refcount_inc(&skb->users);
netlink_broadcast(sk, skb, dst_portid, dst_group, GFP_KERNEL);
}
err = netlink_unicast(sk, skb, dst_portid, msg->msg_flags&MSG_DONTWAIT);
out:
scm_destroy(&scm);
return err;
}
static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
int flags)
{
struct scm_cookie scm;
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
int noblock = flags&MSG_DONTWAIT;
size_t copied;
struct sk_buff *skb, *data_skb;
int err, ret;
if (flags&MSG_OOB)
return -EOPNOTSUPP;
copied = 0;
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (skb == NULL)
goto out;
data_skb = skb;
#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
if (unlikely(skb_shinfo(skb)->frag_list)) {
/*
* If this skb has a frag_list, then here that means that we
* will have to use the frag_list skb's data for compat tasks
* and the regular skb's data for normal (non-compat) tasks.
*
* If we need to send the compat skb, assign it to the
* 'data_skb' variable so that it will be used below for data
* copying. We keep 'skb' for everything else, including
* freeing both later.
*/
if (flags & MSG_CMSG_COMPAT)
data_skb = skb_shinfo(skb)->frag_list;
}
#endif
/* Record the max length of recvmsg() calls for future allocations */
nlk->max_recvmsg_len = max(nlk->max_recvmsg_len, len);
nlk->max_recvmsg_len = min_t(size_t, nlk->max_recvmsg_len,
SKB_WITH_OVERHEAD(32768));
copied = data_skb->len;
if (len < copied) {
msg->msg_flags |= MSG_TRUNC;
copied = len;
}
skb_reset_transport_header(data_skb);
err = skb_copy_datagram_msg(data_skb, 0, msg, copied);
if (msg->msg_name) {
DECLARE_SOCKADDR(struct sockaddr_nl *, addr, msg->msg_name);
addr->nl_family = AF_NETLINK;
addr->nl_pad = 0;
addr->nl_pid = NETLINK_CB(skb).portid;
addr->nl_groups = netlink_group_mask(NETLINK_CB(skb).dst_group);
msg->msg_namelen = sizeof(*addr);
}
if (nlk->flags & NETLINK_F_RECV_PKTINFO)
netlink_cmsg_recv_pktinfo(msg, skb);
if (nlk->flags & NETLINK_F_LISTEN_ALL_NSID)
netlink_cmsg_listen_all_nsid(sk, msg, skb);
memset(&scm, 0, sizeof(scm));
scm.creds = *NETLINK_CREDS(skb);
if (flags & MSG_TRUNC)
copied = data_skb->len;
skb_free_datagram(sk, skb);
if (nlk->cb_running &&
atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
ret = netlink_dump(sk);
if (ret) {
sk->sk_err = -ret;
sk->sk_error_report(sk);
}
}
scm_recv(sock, msg, &scm, flags);
out:
netlink_rcv_wake(sk);
return err ? : copied;
}
static void netlink_data_ready(struct sock *sk)
{
BUG();
}
/*
* We export these functions to other modules. They provide a
* complete set of kernel non-blocking support for message
* queueing.
*/
struct sock *
__netlink_kernel_create(struct net *net, int unit, struct module *module,
struct netlink_kernel_cfg *cfg)
{
struct socket *sock;
struct sock *sk;
struct netlink_sock *nlk;
struct listeners *listeners = NULL;
struct mutex *cb_mutex = cfg ? cfg->cb_mutex : NULL;
unsigned int groups;
BUG_ON(!nl_table);
if (unit < 0 || unit >= MAX_LINKS)
return NULL;
if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))
return NULL;
if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0)
goto out_sock_release_nosk;
sk = sock->sk;
if (!cfg || cfg->groups < 32)
groups = 32;
else
groups = cfg->groups;
listeners = kzalloc(sizeof(*listeners) + NLGRPSZ(groups), GFP_KERNEL);
if (!listeners)
goto out_sock_release;
sk->sk_data_ready = netlink_data_ready;
if (cfg && cfg->input)
nlk_sk(sk)->netlink_rcv = cfg->input;
if (netlink_insert(sk, 0))
goto out_sock_release;
nlk = nlk_sk(sk);
nlk->flags |= NETLINK_F_KERNEL_SOCKET;
netlink_table_grab();
if (!nl_table[unit].registered) {
nl_table[unit].groups = groups;
rcu_assign_pointer(nl_table[unit].listeners, listeners);
nl_table[unit].cb_mutex = cb_mutex;
nl_table[unit].module = module;
if (cfg) {
nl_table[unit].bind = cfg->bind;
nl_table[unit].unbind = cfg->unbind;
nl_table[unit].flags = cfg->flags;
if (cfg->compare)
nl_table[unit].compare = cfg->compare;
}
nl_table[unit].registered = 1;
} else {
kfree(listeners);
nl_table[unit].registered++;
}
netlink_table_ungrab();
return sk;
out_sock_release:
kfree(listeners);
netlink_kernel_release(sk);
return NULL;
out_sock_release_nosk:
sock_release(sock);
return NULL;
}
EXPORT_SYMBOL(__netlink_kernel_create);
void
netlink_kernel_release(struct sock *sk)
{
if (sk == NULL || sk->sk_socket == NULL)
return;
sock_release(sk->sk_socket);
}
EXPORT_SYMBOL(netlink_kernel_release);
int __netlink_change_ngroups(struct sock *sk, unsigned int groups)
{
struct listeners *new, *old;
struct netlink_table *tbl = &nl_table[sk->sk_protocol];
if (groups < 32)
groups = 32;
if (NLGRPSZ(tbl->groups) < NLGRPSZ(groups)) {
new = kzalloc(sizeof(*new) + NLGRPSZ(groups), GFP_ATOMIC);
if (!new)
return -ENOMEM;
old = nl_deref_protected(tbl->listeners);
memcpy(new->masks, old->masks, NLGRPSZ(tbl->groups));
rcu_assign_pointer(tbl->listeners, new);
kfree_rcu(old, rcu);
}
tbl->groups = groups;
return 0;
}
/**
* netlink_change_ngroups - change number of multicast groups
*
* This changes the number of multicast groups that are available
* on a certain netlink family. Note that it is not possible to
* change the number of groups to below 32. Also note that it does
* not implicitly call netlink_clear_multicast_users() when the
* number of groups is reduced.
*
* @sk: The kernel netlink socket, as returned by netlink_kernel_create().
* @groups: The new number of groups.
*/
int netlink_change_ngroups(struct sock *sk, unsigned int groups)
{
int err;
netlink_table_grab();
err = __netlink_change_ngroups(sk, groups);
netlink_table_ungrab();
return err;
}
void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
{
struct sock *sk;
struct netlink_table *tbl = &nl_table[ksk->sk_protocol];
sk_for_each_bound(sk, &tbl->mc_list)
netlink_update_socket_mc(nlk_sk(sk), group, 0);
}
struct nlmsghdr *
__nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags)
{
struct nlmsghdr *nlh;
int size = nlmsg_msg_size(len);
nlh = skb_put(skb, NLMSG_ALIGN(size));
nlh->nlmsg_type = type;
nlh->nlmsg_len = size;
nlh->nlmsg_flags = flags;
nlh->nlmsg_pid = portid;
nlh->nlmsg_seq = seq;
if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
memset(nlmsg_data(nlh) + len, 0, NLMSG_ALIGN(size) - size);
return nlh;
}
EXPORT_SYMBOL(__nlmsg_put);
/*
* It looks a bit ugly.
* It would be better to create kernel thread.
*/
static int netlink_dump(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
struct netlink_callback *cb;
struct sk_buff *skb = NULL;
struct nlmsghdr *nlh;
struct module *module;
int err = -ENOBUFS;
int alloc_min_size;
int alloc_size;
mutex_lock(nlk->cb_mutex);
if (!nlk->cb_running) {
err = -EINVAL;
goto errout_skb;
}
if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
goto errout_skb;
/* NLMSG_GOODSIZE is small to avoid high order allocations being
* required, but it makes sense to _attempt_ a 16K bytes allocation
* to reduce number of system calls on dump operations, if user
* ever provided a big enough buffer.
*/
cb = &nlk->cb;
alloc_min_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE);
if (alloc_min_size < nlk->max_recvmsg_len) {
alloc_size = nlk->max_recvmsg_len;
skb = alloc_skb(alloc_size,
(GFP_KERNEL & ~__GFP_DIRECT_RECLAIM) |
__GFP_NOWARN | __GFP_NORETRY);
}
if (!skb) {
alloc_size = alloc_min_size;
skb = alloc_skb(alloc_size, GFP_KERNEL);
}
if (!skb)
goto errout_skb;
/* Trim skb to allocated size. User is expected to provide buffer as
* large as max(min_dump_alloc, 16KiB (mac_recvmsg_len capped at
* netlink_recvmsg())). dump will pack as many smaller messages as
* could fit within the allocated skb. skb is typically allocated
* with larger space than required (could be as much as near 2x the
* requested size with align to next power of 2 approach). Allowing
* dump to use the excess space makes it difficult for a user to have a
* reasonable static buffer based on the expected largest dump of a
* single netdev. The outcome is MSG_TRUNC error.
*/
skb_reserve(skb, skb_tailroom(skb) - alloc_size);
netlink_skb_set_owner_r(skb, sk);
if (nlk->dump_done_errno > 0)
nlk->dump_done_errno = cb->dump(skb, cb);
if (nlk->dump_done_errno > 0 ||
skb_tailroom(skb) < nlmsg_total_size(sizeof(nlk->dump_done_errno))) {
mutex_unlock(nlk->cb_mutex);
if (sk_filter(sk, skb))
kfree_skb(skb);
else
__netlink_sendskb(sk, skb);
return 0;
}
nlh = nlmsg_put_answer(skb, cb, NLMSG_DONE,
sizeof(nlk->dump_done_errno), NLM_F_MULTI);
if (WARN_ON(!nlh))
goto errout_skb;
nl_dump_check_consistent(cb, nlh);
memcpy(nlmsg_data(nlh), &nlk->dump_done_errno,
sizeof(nlk->dump_done_errno));
if (sk_filter(sk, skb))
kfree_skb(skb);
else
__netlink_sendskb(sk, skb);
if (cb->done)
cb->done(cb);
nlk->cb_running = false;
module = cb->module;
skb = cb->skb;
mutex_unlock(nlk->cb_mutex);
module_put(module);
consume_skb(skb);
return 0;
errout_skb:
mutex_unlock(nlk->cb_mutex);
kfree_skb(skb);
return err;
}
int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
const struct nlmsghdr *nlh,
struct netlink_dump_control *control)
{
struct netlink_callback *cb;
struct sock *sk;
struct netlink_sock *nlk;
int ret;
refcount_inc(&skb->users);
sk = netlink_lookup(sock_net(ssk), ssk->sk_protocol, NETLINK_CB(skb).portid);
if (sk == NULL) {
ret = -ECONNREFUSED;
goto error_free;
}
nlk = nlk_sk(sk);
mutex_lock(nlk->cb_mutex);
/* A dump is in progress... */
if (nlk->cb_running) {
ret = -EBUSY;
goto error_unlock;
}
/* add reference of module which cb->dump belongs to */
if (!try_module_get(control->module)) {
ret = -EPROTONOSUPPORT;
goto error_unlock;
}
cb = &nlk->cb;
memset(cb, 0, sizeof(*cb));
cb->start = control->start;
cb->dump = control->dump;
cb->done = control->done;
cb->nlh = nlh;
cb->data = control->data;
cb->module = control->module;
cb->min_dump_alloc = control->min_dump_alloc;
cb->skb = skb;
if (cb->start) {
ret = cb->start(cb);
if (ret)
goto error_unlock;
}
nlk->cb_running = true;
nlk->dump_done_errno = INT_MAX;
mutex_unlock(nlk->cb_mutex);
ret = netlink_dump(sk);
sock_put(sk);
if (ret)
return ret;
/* We successfully started a dump, by returning -EINTR we
* signal not to send ACK even if it was requested.
*/
return -EINTR;
error_unlock:
sock_put(sk);
mutex_unlock(nlk->cb_mutex);
error_free:
kfree_skb(skb);
return ret;
}
EXPORT_SYMBOL(__netlink_dump_start);
void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
const struct netlink_ext_ack *extack)
{
struct sk_buff *skb;
struct nlmsghdr *rep;
struct nlmsgerr *errmsg;
size_t payload = sizeof(*errmsg);
size_t tlvlen = 0;
struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk);
unsigned int flags = 0;
bool nlk_has_extack = nlk->flags & NETLINK_F_EXT_ACK;
/* Error messages get the original request appened, unless the user
* requests to cap the error message, and get extra error data if
* requested.
*/
if (err) {
if (!(nlk->flags & NETLINK_F_CAP_ACK))
payload += nlmsg_len(nlh);
else
flags |= NLM_F_CAPPED;
if (nlk_has_extack && extack) {
if (extack->_msg)
tlvlen += nla_total_size(strlen(extack->_msg) + 1);
if (extack->bad_attr)
tlvlen += nla_total_size(sizeof(u32));
}
} else {
flags |= NLM_F_CAPPED;
if (nlk_has_extack && extack && extack->cookie_len)
tlvlen += nla_total_size(extack->cookie_len);
}
if (tlvlen)
flags |= NLM_F_ACK_TLVS;
skb = nlmsg_new(payload + tlvlen, GFP_KERNEL);
if (!skb) {
struct sock *sk;
sk = netlink_lookup(sock_net(in_skb->sk),
in_skb->sk->sk_protocol,
NETLINK_CB(in_skb).portid);
if (sk) {
sk->sk_err = ENOBUFS;
sk->sk_error_report(sk);
sock_put(sk);
}
return;
}
rep = __nlmsg_put(skb, NETLINK_CB(in_skb).portid, nlh->nlmsg_seq,
NLMSG_ERROR, payload, flags);
errmsg = nlmsg_data(rep);
errmsg->error = err;
memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh->nlmsg_len : sizeof(*nlh));
if (nlk_has_extack && extack) {
if (err) {
if (extack->_msg)
WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG,
extack->_msg));
if (extack->bad_attr &&
!WARN_ON((u8 *)extack->bad_attr < in_skb->data ||
(u8 *)extack->bad_attr >= in_skb->data +
in_skb->len))
WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS,
(u8 *)extack->bad_attr -
in_skb->data));
} else {
if (extack->cookie_len)
WARN_ON(nla_put(skb, NLMSGERR_ATTR_COOKIE,
extack->cookie_len,
extack->cookie));
}
}
nlmsg_end(skb, rep);
netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid, MSG_DONTWAIT);
}
EXPORT_SYMBOL(netlink_ack);
int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
struct nlmsghdr *,
struct netlink_ext_ack *))
{
struct netlink_ext_ack extack = {};
struct nlmsghdr *nlh;
int err;
while (skb->len >= nlmsg_total_size(0)) {
int msglen;
nlh = nlmsg_hdr(skb);
err = 0;
if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len)
return 0;
/* Only requests are handled by the kernel */
if (!(nlh->nlmsg_flags & NLM_F_REQUEST))
goto ack;
/* Skip control messages */
if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
goto ack;
err = cb(skb, nlh, &extack);
if (err == -EINTR)
goto skip;
ack:
if (nlh->nlmsg_flags & NLM_F_ACK || err)
netlink_ack(skb, nlh, err, &extack);
skip:
msglen = NLMSG_ALIGN(nlh->nlmsg_len);
if (msglen > skb->len)
msglen = skb->len;
skb_pull(skb, msglen);
}
return 0;
}
EXPORT_SYMBOL(netlink_rcv_skb);
/**
* nlmsg_notify - send a notification netlink message
* @sk: netlink socket to use
* @skb: notification message
* @portid: destination netlink portid for reports or 0
* @group: destination multicast group or 0
* @report: 1 to report back, 0 to disable
* @flags: allocation flags
*/
int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
unsigned int group, int report, gfp_t flags)
{
int err = 0;
if (group) {
int exclude_portid = 0;
if (report) {
refcount_inc(&skb->users);
exclude_portid = portid;
}
/* errors reported via destination sk->sk_err, but propagate
* delivery errors if NETLINK_BROADCAST_ERROR flag is set */
err = nlmsg_multicast(sk, skb, exclude_portid, group, flags);
}
if (report) {
int err2;
err2 = nlmsg_unicast(sk, skb, portid);
if (!err || err == -ESRCH)
err = err2;
}
return err;
}
EXPORT_SYMBOL(nlmsg_notify);
#ifdef CONFIG_PROC_FS
struct nl_seq_iter {
struct seq_net_private p;
struct rhashtable_iter hti;
int link;
};
static int netlink_walk_start(struct nl_seq_iter *iter)
{
int err;
err = rhashtable_walk_init(&nl_table[iter->link].hash, &iter->hti,
GFP_KERNEL);
if (err) {
iter->link = MAX_LINKS;
return err;
}
err = rhashtable_walk_start(&iter->hti);
return err == -EAGAIN ? 0 : err;
}
static void netlink_walk_stop(struct nl_seq_iter *iter)
{
rhashtable_walk_stop(&iter->hti);
rhashtable_walk_exit(&iter->hti);
}
static void *__netlink_seq_next(struct seq_file *seq)
{
struct nl_seq_iter *iter = seq->private;
struct netlink_sock *nlk;
do {
for (;;) {
int err;
nlk = rhashtable_walk_next(&iter->hti);
if (IS_ERR(nlk)) {
if (PTR_ERR(nlk) == -EAGAIN)
continue;
return nlk;
}
if (nlk)
break;
netlink_walk_stop(iter);
if (++iter->link >= MAX_LINKS)
return NULL;
err = netlink_walk_start(iter);
if (err)
return ERR_PTR(err);
}
} while (sock_net(&nlk->sk) != seq_file_net(seq));
return nlk;
}
static void *netlink_seq_start(struct seq_file *seq, loff_t *posp)
{
struct nl_seq_iter *iter = seq->private;
void *obj = SEQ_START_TOKEN;
loff_t pos;
int err;
iter->link = 0;
err = netlink_walk_start(iter);
if (err)
return ERR_PTR(err);
for (pos = *posp; pos && obj && !IS_ERR(obj); pos--)
obj = __netlink_seq_next(seq);
return obj;
}
static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
++*pos;
return __netlink_seq_next(seq);
}
static void netlink_seq_stop(struct seq_file *seq, void *v)
{
struct nl_seq_iter *iter = seq->private;
if (iter->link >= MAX_LINKS)
return;
netlink_walk_stop(iter);
}
static int netlink_seq_show(struct seq_file *seq, void *v)
{
if (v == SEQ_START_TOKEN) {
seq_puts(seq,
"sk Eth Pid Groups "
"Rmem Wmem Dump Locks Drops Inode\n");
} else {
struct sock *s = v;
struct netlink_sock *nlk = nlk_sk(s);
seq_printf(seq, "%pK %-3d %-6u %08x %-8d %-8d %d %-8d %-8d %-8lu\n",
s,
s->sk_protocol,
nlk->portid,
nlk->groups ? (u32)nlk->groups[0] : 0,
sk_rmem_alloc_get(s),
sk_wmem_alloc_get(s),
nlk->cb_running,
refcount_read(&s->sk_refcnt),
atomic_read(&s->sk_drops),
sock_i_ino(s)
);
}
return 0;
}
static const struct seq_operations netlink_seq_ops = {
.start = netlink_seq_start,
.next = netlink_seq_next,
.stop = netlink_seq_stop,
.show = netlink_seq_show,
};
static int netlink_seq_open(struct inode *inode, struct file *file)
{
return seq_open_net(inode, file, &netlink_seq_ops,
sizeof(struct nl_seq_iter));
}
static const struct file_operations netlink_seq_fops = {
.owner = THIS_MODULE,
.open = netlink_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_net,
};
#endif
int netlink_register_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&netlink_chain, nb);
}
EXPORT_SYMBOL(netlink_register_notifier);
int netlink_unregister_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&netlink_chain, nb);
}
EXPORT_SYMBOL(netlink_unregister_notifier);
static const struct proto_ops netlink_ops = {
.family = PF_NETLINK,
.owner = THIS_MODULE,
.release = netlink_release,
.bind = netlink_bind,
.connect = netlink_connect,
.socketpair = sock_no_socketpair,
.accept = sock_no_accept,
.getname = netlink_getname,
.poll = datagram_poll,
.ioctl = netlink_ioctl,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = netlink_setsockopt,
.getsockopt = netlink_getsockopt,
.sendmsg = netlink_sendmsg,
.recvmsg = netlink_recvmsg,
.mmap = sock_no_mmap,
.sendpage = sock_no_sendpage,
};
static const struct net_proto_family netlink_family_ops = {
.family = PF_NETLINK,
.create = netlink_create,
.owner = THIS_MODULE, /* for consistency 8) */
};
static int __net_init netlink_net_init(struct net *net)
{
#ifdef CONFIG_PROC_FS
if (!proc_create("netlink", 0, net->proc_net, &netlink_seq_fops))
return -ENOMEM;
#endif
return 0;
}
static void __net_exit netlink_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
remove_proc_entry("netlink", net->proc_net);
#endif
}
static void __init netlink_add_usersock_entry(void)
{
struct listeners *listeners;
int groups = 32;
listeners = kzalloc(sizeof(*listeners) + NLGRPSZ(groups), GFP_KERNEL);
if (!listeners)
panic("netlink_add_usersock_entry: Cannot allocate listeners\n");
netlink_table_grab();
nl_table[NETLINK_USERSOCK].groups = groups;
rcu_assign_pointer(nl_table[NETLINK_USERSOCK].listeners, listeners);
nl_table[NETLINK_USERSOCK].module = THIS_MODULE;
nl_table[NETLINK_USERSOCK].registered = 1;
nl_table[NETLINK_USERSOCK].flags = NL_CFG_F_NONROOT_SEND;
netlink_table_ungrab();
}
static struct pernet_operations __net_initdata netlink_net_ops = {
.init = netlink_net_init,
.exit = netlink_net_exit,
};
static inline u32 netlink_hash(const void *data, u32 len, u32 seed)
{
const struct netlink_sock *nlk = data;
struct netlink_compare_arg arg;
netlink_compare_arg_init(&arg, sock_net(&nlk->sk), nlk->portid);
return jhash2((u32 *)&arg, netlink_compare_arg_len / sizeof(u32), seed);
}
static const struct rhashtable_params netlink_rhashtable_params = {
.head_offset = offsetof(struct netlink_sock, node),
.key_len = netlink_compare_arg_len,
.obj_hashfn = netlink_hash,
.obj_cmpfn = netlink_compare,
.automatic_shrinking = true,
};
static int __init netlink_proto_init(void)
{
int i;
int err = proto_register(&netlink_proto, 0);
if (err != 0)
goto out;
BUILD_BUG_ON(sizeof(struct netlink_skb_parms) > FIELD_SIZEOF(struct sk_buff, cb));
nl_table = kcalloc(MAX_LINKS, sizeof(*nl_table), GFP_KERNEL);
if (!nl_table)
goto panic;
for (i = 0; i < MAX_LINKS; i++) {
if (rhashtable_init(&nl_table[i].hash,
&netlink_rhashtable_params) < 0) {
while (--i > 0)
rhashtable_destroy(&nl_table[i].hash);
kfree(nl_table);
goto panic;
}
}
INIT_LIST_HEAD(&netlink_tap_all);
netlink_add_usersock_entry();
sock_register(&netlink_family_ops);
register_pernet_subsys(&netlink_net_ops);
/* The netlink device handler may be needed early. */
rtnetlink_init();
out:
return err;
panic:
panic("netlink_init: Cannot allocate nl_table\n");
}
core_initcall(netlink_proto_init);
| tescande/linux-nfc-next-stable | net/netlink/af_netlink.c | C | gpl-2.0 | 65,449 |
<!DOCTYPE HTML>
<!--
AJ Tyzack and Company Limited
by Hayden Smith
Skyzack.com
-->
<html>
<head>
<title>News-AJ Tyzack & Co</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<link rel="stylesheet" href="assets/css/animsition.min.css">
</head>
<body>
<div id="page-wrapper">
<!-- Header -->
<header id="header">
<div id="icon_wrapper">
<img src="images/newlogoS2.png" border="0" alt="logo" />
</div>
<nav id="nav">
<ul>
<li><a href="./index.html" class="animsition-link">Home</a></li>
<li><a href="./about.html" class="animsition-link">About</a></li>
<li><a href="./processes.html" class="animsition-link">Processes</a></li>
<li><a href="./services.html" class="animsition-link">Services</a></li>
<li><a href="./news.html" class="animsition-link">News</a></li>
<li><a href="./contact.html" class="animsition-link">Contact</a></li>
</ul>
</div>
</ul>
</nav>
</header>
<!-- Main -->
<div class="animsition">
<section id="main" class="container">
<header>
<h2>News</h2>
<p>Seriously Interesting Happenings</p>
</header>
<div id="gran" class="box">
<h4><Strong>22/06/2015: </strong>Exhibiting at Granulation Conference</h4>
<p>Cep risus aliquam gravida cep ut lacus amet. Adipiscing faucibus nunc placerat. Tempus adipiscing turpis non blandit accumsan eget lacinia nunc integer interdum amet aliquam ut orci non col ut ut praesent. Semper amet interdum mi. Phasellus enim laoreet ac ac commodo faucibus faucibus. </P>
</div>
<div id="grow" class="box">
<h4><strong>22/05/2015: </strong>Skyzack Growth</h4>
<p>Skyzack is now growing in its own right having completed two websites for local companies to help them become more visible and gain more business.</p>
</div>
<div id="make" class="box">
<h4><strong>22/05/2015: </strong>Making Pharmaceuticals</h4>
<p>We will be at the Making Pharmaceuticals show on the 28th and 29th of April, 2015 at the NMM Exhibition Centre, Birmingham. We will be showcasing ProCepT, Xedev and Riva‘s equipment, technology and services.</p>
</div>
<div id="spray" class="box">
<h4><strong>22/05/2015: </strong>Spray Drying Workshop</h4>
<P>The second Spray Drying and Atomisation of Formulations workshop will take place at the University of Leeds Faculty of Engineering on the 24th and 25th of March, 2015</p>
</div>
<div id="prowork" class="box">
<h4><strong>22/05/2015: </strong>Procept Particle Engineering Workshop</h4>
<p>ProCepT invite you to join their Particle Engineering & Measurement Workshop on the 4th and 5th of March, 2015. </p>
</div>
<div id="nisco" class="box">
<h4><strong>22/05/2015: </strong>Nisco Innovations in Encapsulation</h4>
<p>Nisco Engineering AG will be exhibiting at the Innovations in Encapsulation conference at Burlington House in London on the 12th December, 2014.</p>
</div>
<div id="skysite" class="box">
<h4><strong>22/05/2015: </strong>Skyzack Website</h4>
<p>Skyzack has launched a new website at www.skyzack.biz.</p>
</div>
<div id="makesemw" class="box">
<h4><strong>22/05/2015: </strong>Making Pharmaceuticals Seminar</h4>
<p>Seminar programme and exhibitor stands filling out nicely for Making Pharmaceuticals 25-29th April, 2015 at the NMM (National Motorcycle Museum) near the NEC in Birmingham.</p>
</div>
</section>
<!-- Footer -->
<footer id="footer">
<ul class="icons">
<li>
<li><a href="https://www.facebook.com/pages/A-J-Tyzack-Co-Ltd/493659024064222?fref=ts" class="icon fa-facebook-official"><span class="label">Facebook</span></a></li>
<li><a href="https://plus.google.com/108457709905552728757/about?gl=uk&hl=en" class="icon fa-google-plus"><span class="label">Google+</span></a></li>
<li><a href="https://www.linkedin.com/in/ajtyzack" class="icon fa-linkedin"><span class="label">Linked In+</span></a></li>
<li><a href="assets/sitemap.xml" class="icon fa-sitemap"><span class="label">Linked In+</span></a></li>
</ul>
<ul class="copyright">
<li>© AJ Tyzack & Co. All rights reserved.</li><li>Design: <a href="http://skyzack.com">Skyzack</a></li><li><a href="privacy.html">Privacy</a></li><li><a href="terms.html">Terms</a></li>
</ul>
<ul class="copyright">
<li>A. J. Tyzack & Company Limited is a work experience provider and is environmentally friendly (paperless)</li>
</ul>
</footer>
</div>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.dropotron.min.js"></script>
<script src="assets/js/jquery.scrollgress.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="assets/js/main.js"></script>
<script src="assets/js/jquery.animsition.min.js"></script>
<script src="assets/js/animat.js"></script>
</body>
</html> | MostUnfabulous/AJTyzack | node_modules/news.html | HTML | gpl-2.0 | 5,660 |
\Sconcordance{concordance:GESISsusc2015_Day5.tex:GESISsusc2015_Day5.Rnw:%
1 143 1 49 0 1 10 65 1 2 0 254 1 4 0 27 1 5 0 31 1 3 0 32 1 1 9 13 %
1 9 0 8 1 14 0 41 1 4 0 64 1}
| BernStZi/SamplingAndEstimation | lecture/GESISsusc2015_Day5-concordance.tex | TeX | gpl-2.0 | 173 |
#!/bin/sh
# Script to rebuild the openhsu installation profile
# This command expects to be run within the openhsu profile.
# To use this command you must have `drush make` and `git` installed.
if [ -f openhsu.make ]; then
echo "\nThis command can be used to rebuild the installation profile in place.\n"
echo " [1] Rebuild profile in place in release mode (latest stable release)"
echo "Selection: \c"
read SELECTION
if [ $SELECTION = "1" ]; then
echo "Building OpenHSU! install profile in release mode..."
drush make --no-core --no-gitinfofile --contrib-destination=. openhsu.make
else
echo "Invalid selection."
fi
else
echo 'Could not locate file "openhsu.make"'
fi
| kalamuna/open-hsu-drops-7 | profiles/openhsu/gen.sh | Shell | gpl-2.0 | 702 |
package gie
package object TupleOps {
implicit class TupOps2[A, B](val x: (A, B)) extends AnyVal {
def :+[C](y: C) = (x._1, x._2, y)
def +:[C](y: C) = (y, x._1, x._2)
}
implicit class ExtTupOps3[A, B, C](val x: (A, B, C)) extends AnyVal {
def :+[D](y: D) = (x._1, x._2, x._3, y)
def +:[D](y: D) = (y, x._1, x._2, x._3)
}
implicit class ExtTupOps4[A, B, C, D](val x: (A, B, C, D)) extends AnyVal {
def :+[E](y: E) = (x._1, x._2, x._3, x._4, y)
def +:[E](y: E) = (y, x._1, x._2, x._3, x._4)
}
implicit class ExtTupOps5[A, B, C, D, E](val x: (A, B, C, D, E)) extends AnyVal {
def :+[F](y: F) = (x._1, x._2, x._3, x._4, x._5, y)
def +:[F](y: F) = (y, x._1, x._2, x._3, x._4, x._5)
}
implicit class ExtTupOps6[A, B, C, D, E, F](val x: (A, B, C, D, E, F)) extends AnyVal {
def :+[G](y: G) = (x._1, x._2, x._3, x._4, x._5, x._6, y)
def +:[G](y: G) = (y, x._1, x._2, x._3, x._4, x._5, x._6)
}
implicit class ExtTupOps7[A, B, C, D, E, F, G](val x: (A, B, C, D, E, F, G)) extends AnyVal {
def :+[H](y: H) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, y)
def +:[H](y: H) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7)
}
implicit class ExtTupOps8[A, B, C, D, E, F, G, H](val x: (A, B, C, D, E, F, G, H)) extends AnyVal {
def :+[I](y: I) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, y)
def +:[I](y: I) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8)
}
implicit class ExtTupOps9[A, B, C, D, E, F, G, H, I](val x: (A, B, C, D, E, F, G, H, I)) extends AnyVal {
def :+[J](y: J) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, y)
def +:[J](y: J) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9)
}
implicit class ExtTupOps10[A, B, C, D, E, F, G, H, I, J](val x: (A, B, C, D, E, F, G, H, I, J)) extends AnyVal {
def :+[K](y: K) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, y)
def +:[K](y: K) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10)
}
implicit class ExtTupOps11[A, B, C, D, E, F, G, H, I, J, K](val x: (A, B, C, D, E, F, G, H, I, J, K)) extends AnyVal {
def :+[L](y: L) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, y)
def +:[L](y: L) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11)
}
implicit class ExtTupOps12[A, B, C, D, E, F, G, H, I, J, K, L](val x: (A, B, C, D, E, F, G, H, I, J, K, L)) extends AnyVal {
def :+[M](y: M) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, y)
def +:[M](y: M) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12)
}
implicit class ExtTupOps13[A, B, C, D, E, F, G, H, I, J, K, L, M](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M)) extends AnyVal {
def :+[N](y: N) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, y)
def +:[N](y: N) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13)
}
implicit class ExtTupOps14[A, B, C, D, E, F, G, H, I, J, K, L, M, N](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)) extends AnyVal {
def :+[O](y: O) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, y)
def +:[O](y: O) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14)
}
implicit class ExtTupOps15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)) extends AnyVal {
def :+[P](y: P) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, y)
def +:[P](y: P) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15)
}
implicit class ExtTupOps16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)) extends AnyVal {
def :+[Q](y: Q) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, y)
def +:[Q](y: Q) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16)
}
implicit class ExtTupOps17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)) extends AnyVal {
def :+[R](y: R) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, y)
def +:[R](y: R) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17)
}
implicit class ExtTupOps18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)) extends AnyVal {
def :+[S](y: S) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, x._18, y)
def +:[S](y: S) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, x._18)
}
implicit class ExtTupOps19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)) extends AnyVal {
def :+[T](y: T) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, x._18, x._19, y)
def +:[T](y: T) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, x._18, x._19)
}
implicit class ExtTupOps20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](val x: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)) extends AnyVal {
def :+[U](y: U) = (x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, x._18, x._19, x._20, y)
def +:[U](y: U) = (y, x._1, x._2, x._3, x._4, x._5, x._6, x._7, x._8, x._9, x._10, x._11, x._12, x._13, x._14, x._15, x._16, x._17, x._18, x._19, x._20)
}
} | gienanesobaka/simple-tarif-calc | src/main/scala/gie/tuple.scala | Scala | gpl-2.0 | 6,071 |
/**********************************************************************
Audacity: A Digital Audio Editor
ImportGStreamer.cpp
Copyright 2008 LRN
Based on ImportFFmpeg.cpp by LRN
Rework for gstreamer 1.0 by LLL
Licensed under the GNU General Public License v2 or later
*//****************************************************************//**
\class GStreamerImportFileHandle
\brief An ImportFileHandle for GStreamer data
*//****************************************************************//**
\class GStreamerImportPlugin
\brief An ImportPlugin for GStreamer data
*//*******************************************************************/
#include "../Audacity.h" // needed before GStreamer.h
#include <wx/window.h>
#include <wx/log.h>
#if defined(USE_GSTREAMER)
#include "../MemoryX.h"
#define DESC _("GStreamer-compatible files")
// On Windows we don't have configure script to turn this on or off,
// so let's use msw-specific pragma to add required libraries.
// Of course, library search path still has to be updated manually
#if defined(__WXMSW__)
# pragma comment(lib,"gstreamer-1.0.lib")
# pragma comment(lib,"gstapp-1.0.lib")
# pragma comment(lib,"gstbase-1.0.lib")
# pragma comment(lib,"glib-2.0.lib")
# pragma comment(lib,"gobject-2.0.lib")
#endif
// all the includes live here by default
#include "../AudacityException.h"
#include "../SampleFormat.h"
#include "../Tags.h"
#include "../Internat.h"
#include "../WaveTrack.h"
#include "Import.h"
#include "ImportPlugin.h"
#include "ImportGStreamer.h"
extern "C"
{
// #include <gio/gio.h>
#include <gst/app/gstappsink.h>
#include <gst/audio/audio-format.h>
}
// Convenience macros
#define AUDCTX "audacity::context"
#define GETCTX(o) (GStreamContext *) g_object_get_data(G_OBJECT((o)), AUDCTX)
#define SETCTX(o, c) g_object_set_data(G_OBJECT((o)), AUDCTX, (gpointer) (c))
#define WARN(e, msg) GST_ELEMENT_WARNING((e), STREAM, FAILED, msg, (NULL));
// Capabilities that Audacity can handle
//
// This resolves to: (on little endien)
//
// "audio/x-raw, "
// "format = (string) {S16LE, S24_32LE, F32LE}, "
// "rate = (int) [ 1, max ]",
// "channels = (int) [ 1, max ]"
static GstStaticCaps supportedCaps =
GST_STATIC_CAPS(
GST_AUDIO_CAPS_MAKE(
"{"
GST_AUDIO_NE(S16) ", "
GST_AUDIO_NE(S24_32) ", "
GST_AUDIO_NE(F32)
"}"
)
);
struct g_mutex_locker
{
explicit g_mutex_locker(GMutex &mutex_)
: mutex(mutex_)
{
g_mutex_lock(&mutex);
}
~g_mutex_locker()
{
g_mutex_unlock(&mutex);
}
GMutex &mutex;
};
template<typename T, void(*Fn)(T*)> struct Deleter {
inline void operator() (void *p) const
{
if (p)
Fn(static_cast<T*>(p));
}
};
using GstString = std::unique_ptr < gchar, Deleter<void, g_free> > ;
using GErrorHandle = std::unique_ptr < GError, Deleter<GError, g_error_free> > ;
using ParseFn = void (*)(GstMessage *message, GError **gerror, gchar **debug);
inline void GstMessageParse(ParseFn fn, GstMessage *msg, GErrorHandle &err, GstString &debug)
{
GError *error;
gchar *string;
fn(msg, &error, &string);
err.reset(error);
debug.reset(string);
}
// Context used for private stream data
struct GStreamContext
{
GstElement *mConv{}; // Audio converter
GstElement *mSink{}; // Application sink
bool mUse{}; // True if this stream should be imported
TrackHolders mChannels; // Array of WaveTrack pointers, one for each channel
unsigned mNumChannels{}; // Number of channels
gdouble mSampleRate{}; // Sample rate
GstString mType; // Audio type
sampleFormat mFmt{ floatSample }; // Sample format
gint64 mPosition{}; // Start position of stream
gint64 mDuration{}; // Duration of stream
GstElement *mPipeline{};
GStreamContext() {}
~GStreamContext()
{
// Remove the appsink element
if (mSink)
{
gst_bin_remove(GST_BIN(mPipeline), mSink);
}
// Remove the audioconvert element
if (mConv)
{
gst_bin_remove(GST_BIN(mPipeline), mConv);
}
}
};
// For RAII on gst objects
template<typename T> using GstObjHandle =
std::unique_ptr < T, Deleter<void, gst_object_unref > > ;
///! Does actual import, returned by GStreamerImportPlugin::Open
class GStreamerImportFileHandle final : public ImportFileHandle
{
public:
GStreamerImportFileHandle(const wxString & name);
virtual ~GStreamerImportFileHandle();
///! Format initialization
///\return true if successful, false otherwise
bool Init();
wxString GetFileDescription() override;
ByteCount GetFileUncompressedBytes() override;
///! Called by Import.cpp
///\return number of readable audio streams in the file
wxInt32 GetStreamCount() override;
///! Called by Import.cpp
///\return array of strings - descriptions of the streams
const wxArrayString &GetStreamInfo() override;
///! Called by Import.cpp
///\param index - index of the stream in mStreamInfo and mStreams arrays
///\param use - true if this stream should be imported, false otherwise
void SetStreamUsage(wxInt32 index, bool use) override;
///! Imports audio
///\return import status (see Import.cpp)
int Import(TrackFactory *trackFactory,
TrackHolders &outTracks,
Tags *tags) override;
// =========================================================================
// Handled within the gstreamer threads
// =========================================================================
///! Called when a pad-added signal comes in from UriDecodeBin
///\param pad - source pad of uridecodebin that will not be serving any data
void OnPadAdded(GstPad *pad);
///! Called when a pad-removed signal comes in from UriDecodeBin
///\param pad - source pad of uridecodebin that will not be serving any data
void OnPadRemoved(GstPad *pad);
///! Called when a message comes through GStreamer message bus
///\param success - will be set to true if successful
///\return true if the loop should be terminated
bool ProcessBusMessage(bool & success);
///! Called when a tag message comes in from the appsink
///\param appsink - Specific sink that received the message
///\param tags - List of tags
void OnTag(GstAppSink *appsink, GstTagList *tags);
///! Called when a NEW samples are queued
///\param c - stream context
///\param sample - gstreamer sample
void OnNewSample(GStreamContext *c, GstSample *sample);
private:
wxArrayString mStreamInfo; //!< Array of stream descriptions. Length is the same as mStreams
Tags mTags; //!< Tags to be passed back to Audacity
TrackFactory *mTrackFactory; //!< Factory to create tracks when samples arrive
GstString mUri; //!< URI of file
GstObjHandle<GstElement> mPipeline; //!< GStreamer pipeline
GstObjHandle<GstBus> mBus; //!< Message bus
GstElement *mDec; //!< uridecodebin element
bool mAsyncDone; //!< true = 1st async-done message received
GMutex mStreamsLock; //!< Mutex protecting the mStreams array
std::vector<movable_ptr<GStreamContext>> mStreams; //!< Array of pointers to stream contexts
};
/// A representative of GStreamer loader in
/// the Audacity import plugin list
class GStreamerImportPlugin final : public ImportPlugin
{
public:
///! Constructor
GStreamerImportPlugin();
///! Destructor
virtual ~GStreamerImportPlugin();
wxString GetPluginFormatDescription();
wxString GetPluginStringID();
wxArrayString GetSupportedExtensions();
///! Probes the file and opens it if appropriate
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
};
// ============================================================================
// Initialization
// ============================================================================
// ----------------------------------------------------------------------------
// Instantiate GStreamerImportPlugin and add to the list of known importers
void
GetGStreamerImportPlugin(ImportPluginList &importPluginList,
UnusableImportPluginList & WXUNUSED(unusableImportPluginList))
{
wxLogMessage(_TS("Audacity is built against GStreamer version %d.%d.%d-%d"),
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
GST_VERSION_MICRO,
GST_VERSION_NANO);
// Initialize gstreamer
GErrorHandle error;
bool initError;
{
int argc = 0;
char **argv = NULL;
GError *ee;
initError = !gst_init_check(&argc, &argv, &ee);
error.reset(ee);
}
if ( initError )
{
wxLogMessage(wxT("Failed to initialize GStreamer. Error %d: %s"),
error.get()->code,
wxString::FromUTF8(error.get()->message).c_str());
return;
}
guint major, minor, micro, nano;
gst_version(&major, &minor, µ, &nano);
wxLogMessage(wxT("Linked to GStreamer version %d.%d.%d-%d"),
major,
minor,
micro,
nano);
// Instantiate plugin
auto plug = make_movable<GStreamerImportPlugin>();
// No supported extensions...no gstreamer plugins installed
if (plug->GetSupportedExtensions().GetCount() == 0)
return;
// Add to list of importers
importPluginList.push_back( std::move(plug) );
}
// ============================================================================
// GStreamerImportPlugin Class
// ============================================================================
// ----------------------------------------------------------------------------
// Constructor
GStreamerImportPlugin::GStreamerImportPlugin()
: ImportPlugin(wxArrayString())
{
}
// ----------------------------------------------------------------------------
// Destructor
GStreamerImportPlugin::~GStreamerImportPlugin()
{
}
// ----------------------------------------------------------------------------
// Return the plugin description
wxString
GStreamerImportPlugin::GetPluginFormatDescription()
{
return DESC;
}
// ----------------------------------------------------------------------------
// Return the plugin name
wxString
GStreamerImportPlugin::GetPluginStringID()
{
return wxT("gstreamer");
}
// Obtains a list of supported extensions from typefind factories
// TODO: improve the list. It is obviously incomplete.
wxArrayString
GStreamerImportPlugin::GetSupportedExtensions()
{
// We refresh the extensions each time this is called in case the
// user had installed additional gstreamer plugins while Audacity
// was active.
mExtensions.Empty();
// Gather extensions from all factories that support audio
{
std::unique_ptr < GList, Deleter<GList, gst_plugin_feature_list_free> >
factories{ gst_type_find_factory_get_list() };
for (GList *list = factories.get(); list != NULL; list = g_list_next(list))
{
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY(list->data);
// We need the capabilities to determine if it handles audio
GstCaps *caps = gst_type_find_factory_get_caps(factory);
if (!caps)
{
continue;
}
// Check each structure in the caps for audio
for (guint c = 0, clen = gst_caps_get_size(caps); c < clen; c++)
{
// Bypass if it isn't for audio
GstStructure *str = gst_caps_get_structure(caps, c);
if (!g_str_has_prefix(gst_structure_get_name(str), "audio"))
{
continue;
}
// This factory can handle audio, so get the extensions
const gchar *const *extensions = gst_type_find_factory_get_extensions(factory);
if (!extensions)
{
continue;
}
// Add each extension to the list
for (guint i = 0; extensions[i] != NULL; i++)
{
wxString extension = wxString::FromUTF8(extensions[i]);
if (mExtensions.Index(extension.c_str(), false) == wxNOT_FOUND)
{
mExtensions.Add(extension);
}
}
}
}
}
// Get them in a decent order
mExtensions.Sort();
// Log it for debugging
wxString extensions = wxT("Extensions:");
for (size_t i = 0; i < mExtensions.GetCount(); i++)
{
extensions = extensions + wxT(" ") + mExtensions[i];
}
wxLogMessage(wxT("%s"), extensions.c_str());
return mExtensions;
}
// ----------------------------------------------------------------------------
// Open the file and return an importer "file handle"
std::unique_ptr<ImportFileHandle> GStreamerImportPlugin::Open(const wxString &filename)
{
auto handle = std::make_unique<GStreamerImportFileHandle>(filename);
// Initialize the handle
if (!handle->Init())
{
return nullptr;
}
// This std::move is needed to "upcast" the pointer type
return std::move(handle);
}
// ============================================================================
// GStreamerImportFileHandle Class
// ============================================================================
// ----------------------------------------------------------------------------
// The following methods/functions run within gstreamer thread contexts. No
// interaction with wxWidgets should be allowed. See explanation at the top
// of this file.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Filter out any video streams
//
// LRN found that by doing this here, video streams aren't decoded thus
// reducing the time/processing needed to extract the audio streams.
//
// This "gint" is really GstAutoplugSelectResult enum
static gint
GStreamerAutoplugSelectCallback(GstElement * WXUNUSED(element),
GstPad * WXUNUSED(pad),
GstCaps * WXUNUSED(caps),
GstElementFactory *factory,
gpointer WXUNUSED(data))
{
// Check factory class
const gchar *fclass = gst_element_factory_get_klass(factory);
// Skip video decoding
if (g_strrstr(fclass,"Video"))
{
return 2; // GST_AUTOPLUG_SELECT_SKIP
}
return 0; // GST_AUTOPLUG_SELECT_TRY
}
// ----------------------------------------------------------------------------
// Handle the "pad-added" signal from uridecodebin
static void
GStreamerPadAddedCallback(GstElement * WXUNUSED(element),
GstPad *pad,
gpointer data)
{
((GStreamerImportFileHandle *) data)->OnPadAdded(pad);
return;
}
// ----------------------------------------------------------------------------
// Handle the "pad-removed" signal from uridecodebin
static void
GStreamerPadRemovedCallback(GstElement * WXUNUSED(element),
GstPad *pad,
gpointer data)
{
((GStreamerImportFileHandle *) data)->OnPadRemoved(pad);
return;
}
// ----------------------------------------------------------------------------
// Handle the "NEW-sample" signal from uridecodebin
inline void GstSampleUnref(GstSample *p) { gst_sample_unref(p); } // I can't use the static function name directly...
static GstFlowReturn
GStreamerNewSample(GstAppSink *appsink, gpointer data)
{
// Don't let C++ exceptions propagate through GStreamer
return GuardedCall< GstFlowReturn > ( [&] {
GStreamerImportFileHandle *handle = (GStreamerImportFileHandle *)data;
static GMutex mutex;
// Get the sample
std::unique_ptr < GstSample, Deleter< GstSample, GstSampleUnref> >
sample{ gst_app_sink_pull_sample(appsink) };
// We must single thread here to prevent concurrent use of the
// Audacity track functions.
g_mutex_locker locker{ mutex };
handle->OnNewSample(GETCTX(appsink), sample.get());
return GST_FLOW_OK;
}, MakeSimpleGuard(GST_FLOW_ERROR) );
}
// ----------------------------------------------------------------------------
// AppSink callbacks are used instead of signals to reduce processing
static GstAppSinkCallbacks AppSinkCallbacks =
{
NULL, // eos
NULL, // new_preroll
GStreamerNewSample // new_sample
};
static GstAppSinkCallbacks AppSinkBitBucket =
{
NULL, // eos
NULL, // new_preroll
NULL // new_sample
};
inline void GstCapsUnref(GstCaps *p) { gst_caps_unref(p); } // I can't use the static function name directly...
using GstCapsHandle = std::unique_ptr < GstCaps, Deleter<GstCaps, GstCapsUnref> >;
// ----------------------------------------------------------------------------
// Handle the "pad-added" message
void
GStreamerImportFileHandle::OnPadAdded(GstPad *pad)
{
GStreamContext *c{};
{
// Retrieve the stream caps...skip stream if unavailable
GstCaps *caps = gst_pad_get_current_caps(pad);
GstCapsHandle handle{ caps };
if (!caps)
{
WARN(mPipeline.get(), ("OnPadAdded: unable to retrieve stream caps"));
return;
}
// Get the caps structure...no need to release
GstStructure *str = gst_caps_get_structure(caps, 0);
if (!str)
{
WARN(mPipeline.get(), ("OnPadAdded: unable to retrieve caps structure"));
return;
}
// Only accept audio streams...no need to release
const gchar *name = gst_structure_get_name(str);
if (!g_strrstr(name, "audio"))
{
WARN(mPipeline.get(), ("OnPadAdded: bypassing '%s' stream", name));
return;
}
{
// Allocate a NEW stream context
auto uc = make_movable<GStreamContext>();
c = uc.get();
if (!c)
{
WARN(mPipeline.get(), ("OnPadAdded: unable to allocate stream context"));
return;
}
// Set initial state
c->mUse = true;
// Always add it to the context list to keep the number of contexts
// in sync with the number of streams
g_mutex_locker{ mStreamsLock };
// Pass the buck from uc
mStreams.push_back(std::move(uc));
}
c->mPipeline = mPipeline.get();
// Need pointer to context during pad removal (pad-remove signal)
SETCTX(pad, c);
// Save the stream's start time and duration
gst_pad_query_position(pad, GST_FORMAT_TIME, &c->mPosition);
gst_pad_query_duration(pad, GST_FORMAT_TIME, &c->mDuration);
// Retrieve the number of channels and validate
gint channels = -1;
gst_structure_get_int(str, "channels", &channels);
if (channels <= 0)
{
WARN(mPipeline.get(), ("OnPadAdded: channel count is invalid %d", channels));
return;
}
c->mNumChannels = channels;
// Retrieve the sample rate and validate
gint rate = -1;
gst_structure_get_int(str, "rate", &rate);
if (rate <= 0)
{
WARN(mPipeline.get(), ("OnPadAdded: sample rate is invalid %d", rate));
return;
}
c->mSampleRate = (double)rate;
c->mType.reset(g_strdup(name));
if (!c->mType)
{
WARN(mPipeline.get(), ("OnPadAdded: unable to allocate audio type"));
return;
}
// Done with capabilities
}
// Create audioconvert element
c->mConv = gst_element_factory_make("audioconvert", NULL);
if (!c->mConv)
{
WARN(mPipeline.get(), ("OnPadAdded: failed to create audioconvert element"));
return;
}
// Create appsink element
c->mSink = gst_element_factory_make("appsink", NULL);
if (!c->mSink)
{
WARN(mPipeline.get(), ("OnPadAdded: failed to create appsink element"));
return;
}
SETCTX(c->mSink, c);
// Set the appsink callbacks and add the context pointer
gst_app_sink_set_callbacks(GST_APP_SINK(c->mSink), &AppSinkCallbacks, this, NULL);
{
// Set the capabilities that we desire
GstCaps *caps = gst_static_caps_get(&supportedCaps);
GstCapsHandle handle{ caps };
if (!caps)
{
WARN(mPipeline.get(), ("OnPadAdded: failed to create static caps"));
return;
}
gst_app_sink_set_caps(GST_APP_SINK(c->mSink), caps);
}
// Do not sync to the clock...process as quickly as possible
gst_base_sink_set_sync(GST_BASE_SINK(c->mSink), FALSE);
// Don't drop buffers...allow queue to build unfettered
gst_app_sink_set_drop(GST_APP_SINK(c->mSink), FALSE);
// Add both elements to the pipeline
gst_bin_add_many(GST_BIN(mPipeline.get()), c->mConv, c->mSink, NULL);
// Link them together
if (!gst_element_link(c->mConv, c->mSink))
{
WARN(mPipeline.get(), ("OnPadAdded: failed to link autioconvert and appsink"));
return;
}
// Link the audiconvert sink pad to the src pad
GstPadLinkReturn ret = GST_PAD_LINK_OK;
{
GstObjHandle<GstPad> convsink{ gst_element_get_static_pad(c->mConv, "sink") };
if (convsink)
ret = gst_pad_link(pad, convsink.get());
if (!convsink || ret != GST_PAD_LINK_OK)
{
WARN(mPipeline.get(), ("OnPadAdded: failed to link uridecodebin to audioconvert - %d", ret));
return;
}
}
// Synchronize audioconvert state with parent
if (!gst_element_sync_state_with_parent(c->mConv))
{
WARN(mPipeline.get(), ("OnPadAdded: unable to sync audioconvert state"));
return;
}
// Synchronize appsink state with parent
if (!gst_element_sync_state_with_parent(c->mSink))
{
WARN(mPipeline.get(), ("OnPadAdded: unable to sync appaink state"));
return;
}
return;
}
// ----------------------------------------------------------------------------
// Process the "pad-removed" signal from uridecodebin
void
GStreamerImportFileHandle::OnPadRemoved(GstPad *pad)
{
GStreamContext *c = GETCTX(pad);
// Set audioconvert and appsink states to NULL
gst_element_set_state(c->mSink, GST_STATE_NULL);
gst_element_set_state(c->mConv, GST_STATE_NULL);
// Unlink audioconvert -> appsink
gst_element_unlink(c->mConv, c->mSink);
// Remove the pads from the pipeilne
gst_bin_remove_many(GST_BIN(mPipeline.get()), c->mConv, c->mSink, NULL);
// And reset context
c->mConv = NULL;
c->mSink = NULL;
return;
}
// ----------------------------------------------------------------------------
// Handle the "NEW-sample" message
void
GStreamerImportFileHandle::OnNewSample(GStreamContext *c, GstSample *sample)
{
// Allocate NEW tracks
//
// It is done here because, at least in the case of chained oggs,
// not all streams are known ahead of time.
if (c->mChannels.empty())
{
// Get the sample format...no need to release caps or structure
GstCaps *caps = gst_sample_get_caps(sample);
GstStructure *str = gst_caps_get_structure(caps, 0);
const gchar *fmt = gst_structure_get_string(str, "format");
if (!fmt)
{
WARN(mPipeline.get(), ("OnNewSample: missing audio format"));
return;
}
// Determinate sample format based on negotiated format
if (strcmp(fmt, GST_AUDIO_NE(S16)) == 0)
{
c->mFmt = int16Sample;
}
else if (strcmp(fmt, GST_AUDIO_NE(S24_32)) == 0)
{
c->mFmt = int24Sample;
}
else if (strcmp(fmt, GST_AUDIO_NE(F32)) == 0)
{
c->mFmt = floatSample;
}
else
{
// This shouldn't really happen since audioconvert will only give us
// the formats we said we could handle.
WARN(mPipeline.get(), ("OnNewSample: unrecognized sample format %s", fmt));
return;
}
// Allocate the track array
c->mChannels.resize(c->mNumChannels);
if (c->mChannels.size() != c->mNumChannels)
{
WARN(mPipeline.get(), ("OnNewSample: unable to allocate track array"));
return;
}
// Allocate all channels
for (int ch = 0; ch < c->mNumChannels; ch++)
{
// Create a track
c->mChannels[ch] = mTrackFactory->NewWaveTrack(c->mFmt, c->mSampleRate);
if (!c->mChannels[ch])
{
WARN(mPipeline.get(), ("OnNewSample: unable to create track"));
return;
}
}
// Set to stereo if there's exactly 2 channels
if (c->mNumChannels == 2)
{
c->mChannels[0]->SetChannel(Track::LeftChannel);
c->mChannels[1]->SetChannel(Track::RightChannel);
c->mChannels[0]->SetLinked(true);
}
}
// Get the buffer for the sample...no need to release
GstBuffer *buffer = gst_sample_get_buffer(sample);
if (!buffer)
{
// No buffer...not sure if this is an error or not,
// but we can't do anything else, so just bail silently.
return;
}
// Map the buffer
GstMapInfo info;
if (!gst_buffer_map(buffer, &info, GST_MAP_READ))
{
WARN(mPipeline.get(), ("OnNewSample: mapping buffer failed"));
return;
}
auto cleanup = finally([&]{
// Release buffer
gst_buffer_unmap(buffer, &info);
});
// Cache a few items
auto nChannels = c->mNumChannels;
sampleFormat fmt = c->mFmt;
samplePtr data = (samplePtr) info.data;
size_t samples = info.size / nChannels / SAMPLE_SIZE(fmt);
// Add sample data to tracks...depends on interleaved src data
for (int chn = 0; chn < nChannels; chn++)
{
// Append one channel
c->mChannels[chn]->Append(data,
fmt,
samples,
nChannels);
// Bump src to next channel
data += SAMPLE_SIZE(fmt);
}
return;
}
// ----------------------------------------------------------------------------
// The following methods run within the main thread.
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Constructor
GStreamerImportFileHandle::GStreamerImportFileHandle(const wxString & name)
: ImportFileHandle(name)
{
mDec = NULL;
mTrackFactory = NULL;
mAsyncDone = false;
g_mutex_init(&mStreamsLock);
}
// ----------------------------------------------------------------------------
// Destructor
GStreamerImportFileHandle::~GStreamerImportFileHandle()
{
// Make sure the pipeline isn't running
if (mPipeline)
{
gst_element_set_state(mPipeline.get(), GST_STATE_NULL);
}
// Delete all of the contexts
if (mStreams.size())
{
// PRL: is the FIFO destruction order important?
// If not, then you could simply clear mStreams.
{
g_mutex_locker locker{ mStreamsLock };
while (mStreams.size() > 0)
{
// remove context from the array
mStreams.erase(mStreams.begin());
}
}
// Done with the context array
}
// Release the decoder
if (mDec != NULL)
{
gst_bin_remove(GST_BIN(mPipeline.get()), mDec);
}
g_mutex_clear(&mStreamsLock);
}
// ----------------------------------------------------------------------------
// Return number of readable audio streams in the file
wxInt32
GStreamerImportFileHandle::GetStreamCount()
{
return mStreamInfo.GetCount();
}
// ----------------------------------------------------------------------------
// Return array of strings - descriptions of the streams
const wxArrayString &
GStreamerImportFileHandle::GetStreamInfo()
{
return mStreamInfo;
}
// ----------------------------------------------------------------------------
// Mark streams to process as selected by the user
void
GStreamerImportFileHandle::SetStreamUsage(wxInt32 index, bool use)
{
g_mutex_locker locker{ mStreamsLock };
if ((guint) index < mStreams.size())
{
GStreamContext *c = mStreams[index].get();
c->mUse = use;
}
}
// ----------------------------------------------------------------------------
// Initialize importer
bool
GStreamerImportFileHandle::Init()
{
// Create a URI from the filename
mUri.reset(g_strdup_printf("file:///%s", mFilename.ToUTF8().data()));
if (!mUri)
{
wxLogMessage(wxT("GStreamerImport couldn't create URI"));
return false;
}
// Create a pipeline
mPipeline.reset(gst_pipeline_new("pipeline"));
// Get its bus
mBus.reset(gst_pipeline_get_bus(GST_PIPELINE(mPipeline.get())));
// Create uridecodebin and set up signal handlers
mDec = gst_element_factory_make("uridecodebin", "decoder");
g_signal_connect(mDec, "autoplug-select", G_CALLBACK(GStreamerAutoplugSelectCallback), (gpointer) this);
g_signal_connect(mDec, "pad-added", G_CALLBACK(GStreamerPadAddedCallback), (gpointer) this);
g_signal_connect(mDec, "pad-removed", G_CALLBACK(GStreamerPadRemovedCallback), (gpointer) this);
// Set the URI
g_object_set(G_OBJECT(mDec), "uri", mUri, NULL);
// Add the decoder to the pipeline
if (!gst_bin_add(GST_BIN(mPipeline.get()), mDec))
{
wxMessageBox(wxT("Unable to add decoder to pipeline"),
wxT("GStreamer Importer"));
// Cleanup expected to occur in destructor
return false;
}
// Run the pipeline
GstStateChangeReturn state = gst_element_set_state(mPipeline.get(), GST_STATE_PAUSED);
if (state == GST_STATE_CHANGE_FAILURE)
{
wxMessageBox(wxT("Unable to set stream state to paused."),
wxT("GStreamer Importer"));
return false;
}
// Collect info while the stream is prerolled
//
// Unfortunately, for some files this may cause a slight "pause" in the GUI
// without a progress dialog appearing. Not much can be done about it other
// than throwing up an additional progress dialog and displaying two dialogs
// may be confusing to the users.
// Process messages until we get an error or the ASYNC_DONE message is received
bool success;
while (ProcessBusMessage(success) && success)
{
// Give wxWidgets a chance to do housekeeping
wxSafeYield();
}
// Build the stream info array
g_mutex_locker locker{ mStreamsLock };
for (guint i = 0; i < mStreams.size(); i++)
{
GStreamContext *c = mStreams[i].get();
// Create stream info string
wxString strinfo;
strinfo.Printf(wxT("Index[%02d], Type[%s], Channels[%d], Rate[%d]"),
(unsigned int) i,
wxString::FromUTF8(c->mType.get()).c_str(),
(int) c->mNumChannels,
(int) c->mSampleRate);
mStreamInfo.Add(strinfo);
}
return success;
}
// ----------------------------------------------------------------------------
// Return file dialog filter description
wxString
GStreamerImportFileHandle::GetFileDescription()
{
return DESC;
}
// ----------------------------------------------------------------------------
// Return number of uncompressed bytes in file...doubtful this is possible
auto
GStreamerImportFileHandle::GetFileUncompressedBytes() -> ByteCount
{
return 0;
}
// ----------------------------------------------------------------------------
// Import streams
int
GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
TrackHolders &outTracks,
Tags *tags)
{
outTracks.clear();
// Save track factory pointer
mTrackFactory = trackFactory;
// Create the progrress dialog
CreateProgress();
// Block streams that are to be bypassed
bool haveStreams = false;
{
g_mutex_locker locker{ mStreamsLock };
for (guint i = 0; i < mStreams.size(); i++)
{
GStreamContext *c = mStreams[i].get();
// Did the user choose to skip this stream?
if (!c->mUse)
{
// Get the audioconvert sink pad and unlink
{
GstObjHandle<GstPad> convsink{ gst_element_get_static_pad(c->mConv, "sink") };
{
GstObjHandle<GstPad> convpeer{ gst_pad_get_peer(convsink.get()) };
gst_pad_unlink(convpeer.get(), convsink.get());
}
// Set bitbucket callbacks so the prerolled sample won't get processed
// when we change the state to PLAYING
gst_app_sink_set_callbacks(GST_APP_SINK(c->mSink), &AppSinkBitBucket, this, NULL);
// Set state to playing for conv and sink so EOS gets processed
gst_element_set_state(c->mConv, GST_STATE_PLAYING);
gst_element_set_state(c->mSink, GST_STATE_PLAYING);
// Send an EOS event to the pad to force them to drain
gst_pad_send_event(convsink.get(), gst_event_new_eos());
// Resync state with pipeline
gst_element_sync_state_with_parent(c->mConv);
gst_element_sync_state_with_parent(c->mSink);
// Done with the pad
}
// Unlink audioconvert and appsink
gst_element_unlink(c->mConv, c->mSink);
// Remove them from the bin
gst_bin_remove_many(GST_BIN(mPipeline.get()), c->mConv, c->mSink, NULL);
// All done with them
c->mConv = NULL;
c->mSink = NULL;
continue;
}
// We have a stream to process
haveStreams = true;
}
}
// Can't do much if we don't have any streams to process
if (!haveStreams)
{
wxMessageBox(wxT("File doesn't contain any audio streams."),
wxT("GStreamer Importer"));
return ProgressResult::Failed;
}
// Get the ball rolling...
GstStateChangeReturn state = gst_element_set_state(mPipeline.get(), GST_STATE_PLAYING);
if (state == GST_STATE_CHANGE_FAILURE)
{
wxMessageBox(wxT("Unable to import file, state change failed."),
wxT("GStreamer Importer"));
return ProgressResult::Failed;
}
// Get the duration of the stream
gint64 duration;
gst_element_query_duration(mPipeline.get(), GST_FORMAT_TIME, &duration);
// Handle bus messages and update progress while files is importing
bool success = true;
int updateResult = ProgressResult::Success;
while (ProcessBusMessage(success) && success && updateResult == ProgressResult::Success)
{
gint64 position;
// Update progress indicator and give user chance to abort
if (gst_element_query_position(mPipeline.get(), GST_FORMAT_TIME, &position))
{
updateResult = mProgress->Update((wxLongLong_t) position,
(wxLongLong_t) duration);
}
}
// Disable pipeline
gst_element_set_state(mPipeline.get(), GST_STATE_NULL);
// Something bad happened
if (!success || updateResult == ProgressResult::Failed || updateResult == ProgressResult::Cancelled)
{
return updateResult;
}
// Grab the streams lock
g_mutex_locker locker{ mStreamsLock };
// Count the total number of tracks collected
unsigned outNumTracks = 0;
for (guint s = 0; s < mStreams.size(); s++)
{
GStreamContext *c = mStreams[s].get();
if (c)
outNumTracks += c->mNumChannels;
}
// Create NEW tracks
outTracks.resize(outNumTracks);
// Copy audio from mChannels to newly created tracks (destroying mChannels in process)
int trackindex = 0;
for (guint s = 0; s < mStreams.size(); s++)
{
GStreamContext *c = mStreams[s].get();
if (c->mNumChannels)
{
for (int ch = 0; ch < c->mNumChannels; ch++)
{
c->mChannels[ch]->Flush();
outTracks[trackindex++] = std::move(c->mChannels[ch]);
}
c->mChannels.clear();
}
}
// Set any tags found in the stream
*tags = mTags;
return updateResult;
}
// ----------------------------------------------------------------------------
// Message handlers
// ----------------------------------------------------------------------------
inline void GstMessageUnref(GstMessage *p) { gst_message_unref(p); }
// ----------------------------------------------------------------------------
// Retrieve and process a bus message
bool
GStreamerImportFileHandle::ProcessBusMessage(bool & success)
{
bool cont = true;
// Default to no errors
success = true;
// Get the next message
std::unique_ptr < GstMessage, Deleter < GstMessage, GstMessageUnref > >
msg{ gst_bus_timed_pop(mBus.get(), 100 * GST_MSECOND) };
if (!msg)
{
// Timed out...not an error
return cont;
}
#if defined(__WXDEBUG__)
{
GstString objname;
if (msg->src != NULL)
{
objname.reset(gst_object_get_name(msg->src));
}
wxLogMessage(wxT("GStreamer: Got %s%s%s"),
wxString::FromUTF8(GST_MESSAGE_TYPE_NAME(msg.get())).c_str(),
objname ? wxT(" from ") : wxT(""),
objname ? wxString::FromUTF8(objname.get()).c_str() : wxT(""));
}
#endif
// Handle based on message type
switch (GST_MESSAGE_TYPE(msg.get()))
{
// Handle error message from gstreamer
case GST_MESSAGE_ERROR:
{
GErrorHandle err;
GstString debug;
GstMessageParse(gst_message_parse_error, msg.get(), err, debug);
if (err)
{
wxString m;
m.Printf(wxT("%s%s%s"),
wxString::FromUTF8(err.get()->message).c_str(),
debug ? wxT("\n") : wxT(""),
debug ? wxString::FromUTF8(debug.get()).c_str() : wxT(""));
#if defined(_DEBUG)
wxMessageBox(m, wxT("GStreamer Error:"));
#else
wxLogMessage(wxT("GStreamer Error: %s"), m.c_str());
#endif
}
success = false;
cont = false;
}
break;
// Handle warning message from gstreamer
case GST_MESSAGE_WARNING:
{
GErrorHandle err;
GstString debug;
GstMessageParse(gst_message_parse_warning, msg.get(), err, debug);
if (err)
{
wxLogMessage(wxT("GStreamer Warning: %s%s%s"),
wxString::FromUTF8(err.get()->message).c_str(),
debug ? wxT("\n") : wxT(""),
debug ? wxString::FromUTF8(debug.get()).c_str() : wxT(""));
}
}
break;
// Handle warning message from gstreamer
case GST_MESSAGE_INFO:
{
GErrorHandle err;
GstString debug;
GstMessageParse(gst_message_parse_info, msg.get(), err, debug);
if (err)
{
wxLogMessage(wxT("GStreamer Info: %s%s%s"),
wxString::FromUTF8(err.get()->message).c_str(),
debug ? wxT("\n") : wxT(""),
debug ? wxString::FromUTF8(debug.get()).c_str() : wxT(""));
}
}
break;
// Handle metadata tags
case GST_MESSAGE_TAG:
{
GstTagList *tags = NULL;
auto cleanup = finally([&]{
// Done with list
if(tags) gst_tag_list_unref(tags);
});
// Retrieve tag list from message...just ignore failure
gst_message_parse_tag(msg.get(), &tags);
if (tags)
{
// Go process the list
OnTag(GST_APP_SINK(GST_MESSAGE_SRC(msg.get())), tags);
}
}
break;
// Pre-roll is done...will happen for each group
// (like with chained OGG files)
case GST_MESSAGE_ASYNC_DONE:
{
// If this is the first async-done message, then tell
// caller to end loop, but leave it active so that
// gstreamer threads can still queue up.
//
// We'll receive multiple async-done messages for chained
// ogg files, so ignore the message the 2nd and subsequent
// occurrences.
if (!mAsyncDone)
{
cont = false;
mAsyncDone = true;
}
}
break;
// End of the stream (and all sub-streams)
case GST_MESSAGE_EOS:
{
// Terminate loop
cont = false;
}
break;
}
return cont;
}
// ----------------------------------------------------------------------------
// Handle the "tag" message
void
GStreamerImportFileHandle::OnTag(GstAppSink * WXUNUSED(appsink), GstTagList *tags)
{
// Collect all of the associates tags
for (guint i = 0, icnt = gst_tag_list_n_tags(tags); i < icnt; i++)
{
wxString string;
// Get tag name...should always succeed...no need to release
const gchar *name = gst_tag_list_nth_tag_name(tags, i);
if (!name)
{
continue;
}
// For each tag, determine its type and retrieve if possible
for (guint j = 0, jcnt = gst_tag_list_get_tag_size(tags, name); j < jcnt; j++)
{
const GValue *val;
val = gst_tag_list_get_value_index(tags, name, j);
if (G_VALUE_HOLDS_STRING(val))
{
string = wxString::FromUTF8(g_value_get_string(val));
}
else if (G_VALUE_HOLDS_UINT(val))
{
string.Printf(wxT("%u"), (unsigned int) g_value_get_uint(val));
}
else if (G_VALUE_HOLDS_DOUBLE(val))
{
string.Printf(wxT("%g"), g_value_get_double(val));
}
else if (G_VALUE_HOLDS_BOOLEAN(val))
{
string = g_value_get_boolean(val) ? wxT("true") : wxT("false");
}
else if (GST_VALUE_HOLDS_DATE_TIME(val))
{
GstDateTime *dt = (GstDateTime *) g_value_get_boxed(val);
GstString str{ gst_date_time_to_iso8601_string(dt) };
string = wxString::FromUTF8(str.get()).c_str();
}
else if (G_VALUE_HOLDS(val, G_TYPE_DATE))
{
GstString str{ gst_value_serialize(val) };
string = wxString::FromUTF8(str.get()).c_str();
}
else
{
wxLogMessage(wxT("Tag %s has unhandled type: %s"),
wxString::FromUTF8(name).c_str(),
wxString::FromUTF8(G_VALUE_TYPE_NAME(val)).c_str());
continue;
}
// Translate known tag names
wxString tag;
if (strcmp(name, GST_TAG_TITLE) == 0)
{
tag = TAG_TITLE;
}
else if (strcmp(name, GST_TAG_ARTIST) == 0)
{
tag = TAG_ARTIST;
}
else if (strcmp(name, GST_TAG_ALBUM) == 0)
{
tag = TAG_ALBUM;
}
else if (strcmp(name, GST_TAG_TRACK_NUMBER) == 0)
{
tag = TAG_TRACK;
}
else if (strcmp(name, GST_TAG_DATE) == 0)
{
tag = TAG_YEAR;
}
else if (strcmp(name, GST_TAG_GENRE) == 0)
{
tag = TAG_GENRE;
}
else if (strcmp(name, GST_TAG_COMMENT) == 0)
{
tag = TAG_COMMENTS;
}
else
{
tag = wxString::FromUTF8(name).c_str();
}
if (jcnt > 1)
{
tag.Printf(wxT("%s:%d"), tag.c_str(), j);
}
// Store the tag
mTags.SetTag(tag, string);
}
}
}
#endif //USE_GSTREAMER
| windinthew/audacity | src/import/ImportGStreamer.cpp | C++ | gpl-2.0 | 43,782 |
/* TrueFunction.java --
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.xml.xpath;
import org.w3c.dom.Node;
/**
* The <code>true</code> function returns true.
*
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
final class TrueFunction
extends Expr
{
public Object evaluate(Node context, int pos, int len)
{
return Boolean.TRUE;
}
public Expr clone(Object context)
{
return new TrueFunction();
}
public String toString()
{
return "true()";
}
}
| unofficial-opensource-apple/gcc_40 | libjava/gnu/xml/xpath/TrueFunction.java | Java | gpl-2.0 | 2,168 |
// RegisterCodec.h
#ifndef __REGISTERCODEC_H
#define __REGISTERCODEC_H
#include "../Common/MethodId.h"
#include "DeclareCodecs.h"
typedef void * (*CreateCodecP)();
struct CCodecInfo
{
CreateCodecP CreateDecoder;
CreateCodecP CreateEncoder;
CMethodId Id;
const wchar_t *Name;
UInt32 NumInStreams;
bool IsFilter;
};
void RegisterCodec(const CCodecInfo *codecInfo);
#define REGISTER_CODEC(x) CRegisterCodec##x::CRegisterCodec##x() { RegisterCodec(&g_CodecInfo); } \
CRegisterCodec##x g_RegisterCodec##x;
#define REGISTER_CODECS(x) CRegisterCodecs##x::CRegisterCodecs##x() { \
for(int i=0;i<sizeof(g_CodecsInfo)/sizeof(*g_CodecsInfo);i++) \
RegisterCodec(&g_CodecsInfo[i]); } \
CRegisterCodecs##x g_RegisterCodecs##x;
#endif
| f00barbob/vba-rr-mod | src/win32/7zip/7z/CPP/7zip/Common/RegisterCodec.h | C | gpl-2.0 | 748 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.