亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ixethdbhashtable.c

?? 友善mini2440嵌入式
?? C
?? 第 1 頁 / 共 2 頁
字號:
/** * @file ethHash.c * * @brief Hashtable implementation *  * @par * IXP400 SW Release version 2.0 *  * -- Copyright Notice -- *  * @par * Copyright 2001-2005, Intel Corporation. * All rights reserved. *  * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. *  * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  * @par * -- End of Copyright Notice -- */#include "IxEthDB_p.h"#include "IxEthDBLocks_p.h"/** * @addtogroup EthDB * * @{ *//** * @brief initializes a hash table object * * @param hashTable uninitialized hash table structure * @param numBuckets number of buckets to use * @param entryHashFunction hash function used  * to hash entire hash node data block (for adding) * @param matchFunctions array of match functions, indexed on type, * used to differentiate records with the same hash value * @param freeFunction function used to free node data blocks * * Initializes the given hash table object. * * @internal */void ixEthDBInitHash(HashTable *hashTable,                      UINT32 numBuckets,                      HashFunction entryHashFunction,                      MatchFunction *matchFunctions,                      FreeFunction freeFunction){    UINT32 bucketIndex;    UINT32 hashSize = numBuckets * sizeof(HashNode *);    /* entry hashing, matching and freeing methods */    hashTable->entryHashFunction  = entryHashFunction;    hashTable->matchFunctions     = matchFunctions;    hashTable->freeFunction       = freeFunction;    /* buckets */    hashTable->numBuckets = numBuckets;    /* set to 0 all buckets */    memset(hashTable->hashBuckets, 0, hashSize);    /* init bucket locks - note that initially all mutexes are unlocked after MutexInit()*/    for (bucketIndex = 0 ; bucketIndex < numBuckets ; bucketIndex++)    {        ixOsalFastMutexInit(&hashTable->bucketLocks[bucketIndex]);    }}/** * @brief adds an entry to the hash table * * @param hashTable hash table to add the entry to * @param entry entry to add * * The entry will be hashed using the entry hashing function and added to the * hash table, unless a locking blockage occurs, in which case the caller * should retry. * * @retval IX_ETH_DB_SUCCESS if adding <i>entry</i> has succeeded * @retval IX_ETH_DB_NOMEM if there's no memory left in the hash node pool * @retval IX_ETH_DB_BUSY if there's a locking failure on the insertion path * * @internal */IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAddHashEntry(HashTable *hashTable, void *entry){    UINT32 hashValue   = hashTable->entryHashFunction(entry);    UINT32 bucketIndex = hashValue % hashTable->numBuckets;    HashNode *bucket   = hashTable->hashBuckets[bucketIndex];    HashNode *newNode;    LockStack locks;    INIT_STACK(&locks);    /* lock bucket */    PUSH_LOCK(&locks, &hashTable->bucketLocks[bucketIndex]);    /* lock insertion element (first in chain), if any */    if (bucket != NULL)    {        PUSH_LOCK(&locks, &bucket->lock);    }    /* get new node */    newNode = ixEthDBAllocHashNode();    if (newNode == NULL)    {        /* unlock everything */        UNROLL_STACK(&locks);        return IX_ETH_DB_NOMEM;    }    /* init lock - note that mutexes are unlocked after MutexInit */    ixOsalFastMutexInit(&newNode->lock);    /* populate new link */    newNode->data = entry;    /* add to bucket */    newNode->next                       = bucket;    hashTable->hashBuckets[bucketIndex] = newNode;    /* unlock bucket and insertion point */    UNROLL_STACK(&locks);    return IX_ETH_DB_SUCCESS;}/** * @brief removes an entry from the hashtable * * @param hashTable hash table to remove entry from * @param keyType type of record key used for matching * @param reference reference key used to identify the entry * * The reference key will be hashed using the key hashing function, * the entry is searched using the hashed value and then examined * against the reference entry using the match function. A positive * match will trigger the deletion of the entry. * Locking failures are reported and the caller should retry. * * @retval IX_ETH_DB_SUCCESS if the removal was successful * @retval IX_ETH_DB_NO_SUCH_ADDR if the entry was not found * @retval IX_ETH_DB_BUSY if a locking failure occured during the process * * @internal */IxEthDBStatus ixEthDBRemoveHashEntry(HashTable *hashTable, int keyType, void *reference){    UINT32 hashValue       = hashTable->entryHashFunction(reference);    UINT32 bucketIndex     = hashValue % hashTable->numBuckets;    HashNode *node         = hashTable->hashBuckets[bucketIndex];    HashNode *previousNode = NULL;        LockStack locks;    INIT_STACK(&locks);    while (node != NULL)    {        /* try to lock node */        PUSH_LOCK(&locks, &node->lock);        if (hashTable->matchFunctions[keyType](reference, node->data))        {            /* found entry */            if (node->next != NULL)            {                PUSH_LOCK(&locks, &node->next->lock);            }            if (previousNode == NULL)            {                /* node is head of chain */                PUSH_LOCK(&locks, &hashTable->bucketLocks[bucketIndex]);                hashTable->hashBuckets[bucketIndex] = node->next;                POP_LOCK(&locks);            }            else            {                /* relink */                previousNode->next = node->next;            }            UNROLL_STACK(&locks);            /* free node */            hashTable->freeFunction(node->data);            ixEthDBFreeHashNode(node);            return IX_ETH_DB_SUCCESS;        }        else        {            if (previousNode != NULL)            {                /* unlock previous node */                SHIFT_STACK(&locks);            }            /* advance to next element in chain */            previousNode = node;            node         = node->next;        }    }    UNROLL_STACK(&locks);    /* not found */    return IX_ETH_DB_NO_SUCH_ADDR;}/** * @brief retrieves an entry from the hash table * * @param hashTable hash table to perform the search into * @param reference search key (a MAC address) * @param keyType type of record key used for matching * @param searchResult pointer where a reference to the located hash node  * is placed * * Searches the entry with the same key as <i>reference</i> and places the * pointer to the resulting node in <i>searchResult</i>. * An implicit write access lock is granted after a search, which gives the  * caller the opportunity to modify the entry. * Access should be released as soon as possible using @ref ixEthDBReleaseHashNode(). * * @see ixEthDBReleaseHashNode() * * @retval IX_ETH_DB_SUCCESS if the search was completed successfully * @retval IX_ETH_DB_NO_SUCH_ADDRESS if no entry with the given key was found * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case * the caller should retry * * @warning unless the return value is <b>IX_ETH_DB_SUCCESS</b> the searchResult * location is NOT modified and therefore using a NULL comparison test when the * value was not properly initialized would be an error * * @internal */IxEthDBStatus ixEthDBSearchHashEntry(HashTable *hashTable, int keyType, void *reference, HashNode **searchResult){    UINT32 hashValue;    HashNode *node;    hashValue = hashTable->entryHashFunction(reference);    node      = hashTable->hashBuckets[hashValue % hashTable->numBuckets];    while (node != NULL)    {        TRY_LOCK(&node->lock);        if (hashTable->matchFunctions[keyType](reference, node->data))        {            *searchResult = node;            return IX_ETH_DB_SUCCESS;        }        else        {            UNLOCK(&node->lock);            node = node->next;        }    }    /* not found */    return IX_ETH_DB_NO_SUCH_ADDR;}/** * @brief reports the existence of an entry in the hash table * * @param hashTable hash table to perform the search into * @param reference search key (a MAC address) * @param keyType type of record key used for matching * * Searches the entry with the same key as <i>reference</i>. * No implicit write access lock is granted after a search, hence the  * caller cannot access or modify the entry. The result is only temporary. * * @see ixEthDBReleaseHashNode() * * @retval IX_ETH_DB_SUCCESS if the search was completed successfully * @retval IX_ETH_DB_NO_SUCH_ADDRESS if no entry with the given key was found * @retval IX_ETH_DB_BUSY if a locking failure has occured, in which case * the caller should retry * * @internal

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲狠狠丁香婷婷综合久久久| 欧美一区二区三区日韩| 国产精品久久久久久久久免费丝袜| 国产美女av一区二区三区| 欧美精品一区二区在线观看| 国产一区高清在线| 国产日韩av一区| 成人18精品视频| 亚洲在线视频网站| 欧美一级黄色大片| 国产一区二区视频在线| 国产日韩视频一区二区三区| 波多野结衣在线一区| 亚洲欧美国产毛片在线| 欧美久久高跟鞋激| 国产成人无遮挡在线视频| 一区在线观看免费| 欧美三级资源在线| 国产一区二区在线免费观看| 国产精品女主播在线观看| 日本韩国一区二区三区视频| 天天综合网天天综合色| 久久精品欧美日韩| 色嗨嗨av一区二区三区| 久久97超碰色| 亚洲日本欧美天堂| 日韩欧美国产一区二区在线播放| 国产凹凸在线观看一区二区| 亚洲一区二区三区中文字幕在线| 欧美xxx久久| 色先锋久久av资源部| 精品亚洲国内自在自线福利| 亚洲欧美日韩国产手机在线 | 在线视频一区二区三区| 青青草精品视频| 国产精品久久免费看| 欧美男男青年gay1069videost| 国产精品性做久久久久久| 亚洲第一福利一区| 国产精品视频第一区| 欧美一区二区三区人| 97se狠狠狠综合亚洲狠狠| 美女爽到高潮91| 亚洲蜜臀av乱码久久精品| 久久女同互慰一区二区三区| 91免费观看在线| 激情小说亚洲一区| 一区二区免费看| 国产性做久久久久久| 欧美日韩dvd在线观看| 97se亚洲国产综合自在线| 激情图区综合网| 五月天亚洲婷婷| 国产精品卡一卡二卡三| 久久丝袜美腿综合| 91精品中文字幕一区二区三区| 欧美在线|欧美| 99久精品国产| 成人午夜私人影院| 久久国产精品色| 秋霞电影一区二区| 亚洲大片精品永久免费| 成人欧美一区二区三区白人| 久久久亚洲精品一区二区三区 | 国产清纯美女被跳蛋高潮一区二区久久w | 成+人+亚洲+综合天堂| 激情综合亚洲精品| 奇米精品一区二区三区在线观看一| 亚洲精品日韩专区silk| 国产精品久久一级| 久久精品人人爽人人爽| 精品久久一区二区| 日韩午夜中文字幕| 欧美一区二区三区日韩| 91精品国产综合久久蜜臀| 欧美性猛片xxxx免费看久爱| 色哟哟国产精品| 日本久久电影网| 欧美日本一道本在线视频| 欧美日韩在线播放| 欧美日韩二区三区| 日韩欧美国产一二三区| 日韩精品一区二区三区视频在线观看| 日韩亚洲欧美高清| 久久久久久久久一| 国产精品美女久久久久久久久久久| 国产精品免费看片| 艳妇臀荡乳欲伦亚洲一区| 水蜜桃久久夜色精品一区的特点| 亚洲成人动漫精品| 青青草国产成人av片免费| 免费在线一区观看| 国精产品一区一区三区mba视频| 老司机免费视频一区二区| 国产盗摄女厕一区二区三区| 99这里只有久久精品视频| 色综合久久久久| 在线不卡中文字幕| www国产精品av| 自拍偷在线精品自拍偷无码专区| 亚洲一区二区三区爽爽爽爽爽| 亚洲妇女屁股眼交7| 美女视频一区在线观看| 国产精品资源网| 色综合久久中文字幕综合网| 欧美男同性恋视频网站| 久久婷婷国产综合精品青草| 国产精品成人免费精品自在线观看| 亚洲女女做受ⅹxx高潮| 亚洲午夜视频在线| 国产麻豆日韩欧美久久| 成人av动漫在线| 欧美一区二区三区喷汁尤物| 中文字幕av一区二区三区免费看 | 国产无一区二区| 亚洲欧美日韩在线不卡| 麻豆精品国产91久久久久久| 成人动漫在线一区| 欧美一区午夜视频在线观看| 欧美国产精品一区二区三区| 亚洲午夜久久久| 狠狠色丁香久久婷婷综合丁香| va亚洲va日韩不卡在线观看| 91精品久久久久久久99蜜桃| 中文字幕中文字幕一区| 久久精品国产一区二区三| 91免费版在线| 久久久久99精品国产片| 丝袜诱惑制服诱惑色一区在线观看| 久久机这里只有精品| 一本色道久久综合亚洲91 | 国产精品视频看| 午夜一区二区三区视频| 成人在线视频首页| 精品少妇一区二区三区| 亚洲一区二区不卡免费| 成人丝袜高跟foot| 日韩区在线观看| 亚洲高清视频中文字幕| 91免费国产在线| 国产精品免费人成网站| 国产精品自产自拍| 51精品久久久久久久蜜臀| 亚洲裸体xxx| 国产酒店精品激情| 欧美一区二区三区婷婷月色 | 中文字幕一区二区在线播放| 日日欢夜夜爽一区| 欧美在线免费播放| 国产精品第五页| 国产精品77777| 亚洲精品一区二区在线观看| 奇米精品一区二区三区在线观看一| 欧美色国产精品| 一区二区欧美视频| 91年精品国产| 亚洲少妇屁股交4| 成人av免费观看| 综合久久久久久| 91麻豆国产在线观看| 亚洲欧洲精品一区二区三区不卡 | 一级日本不卡的影视| 91女人视频在线观看| 亚洲另类在线视频| 97久久精品人人做人人爽| 国产精品久久影院| www.一区二区| 亚洲欧美色一区| 在线免费亚洲电影| 午夜精品视频一区| 91精品国产91久久综合桃花| 久久国产日韩欧美精品| 精品剧情在线观看| 国产在线国偷精品产拍免费yy| 久久久午夜精品| 成人晚上爱看视频| 悠悠色在线精品| 欧美猛男gaygay网站| 免费久久99精品国产| 精品不卡在线视频| 成人性生交大片免费| 国产精品电影一区二区三区| 色94色欧美sute亚洲线路二| 亚洲美女一区二区三区| 欧美日韩一区高清| 美女免费视频一区| 国产亚洲一区字幕| 91视频国产资源| 视频一区视频二区中文| 久久综合中文字幕| zzijzzij亚洲日本少妇熟睡| 亚洲高清视频中文字幕| 日韩欧美aaaaaa| 99久久精品国产精品久久| 亚洲国产精品久久久男人的天堂| 日韩美女主播在线视频一区二区三区| 国产精品资源网站| 亚洲一区二区免费视频| www成人在线观看| 91麻豆精东视频|