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

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

?? nfshash.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* nfsHash.c - file based hash table for file handle to file name and reverse *//* Copyright 1998 - 2001 Wind River Systems, Inc. */#include "copyright_wrs.h" /*modification history--------------------01b,19oct01,rae  merge from truestack ver 01g, base o1a (SPRs 62705, 35767)01a,15nov98,rjc  written*//*INTERNALDESCRIPTIONThe nfs server is required to maintain a mapping of file names to filehandles since the file handle is of limited size but nfs  requestsuse a file handle to id the file. This map is being implemented as a 2 way hash table so given a file name we can find out the correspondingfile handle and correspondingly get the file name given the file handle.The name to handle operation would typically be done infrequentlycompared to the handle to name op since the former corresponds to opening the file while the latter is needed for every nfs request. Therefore the hash table has been implememnted with a bias towardskeeping the latter operation more efficient.Conceptually the hash table is simple. Given a hash table entry wecompute the hash value for each of the 2 hashing functions and then plece the entry into two lists. While deleting we remove it from bothlists. However since we must keep this data structure on disk wemust avoid the typical in memory implementation as a linked list of entries. That's because it is inefficient to implement a fragmentation/compaction memory management system as is done in the case of thestandard malloc/free based implementation.Our design allocates the disk space in larger chunks (than may be neededto store a single entry) and uses a bit map to keep track of free blocks.The hash table is maintained in a dos file. The file offset is used asa pointer.Data structuresFile block bit map tableThis structure which is maintained in memory contains a bit per blockof the dos file. In order to locate a free block we simply scan this bit from the start until a free block is found. If none are found we wouldexpand the hash file by seeking beyond the existing end of the file and update the bit map block correspondingly. Freeing a block is done by turning off the bit. Currently we do not reduce the size of the fileas it would be extremely inefficient in general (in case free block is notat the end of the file. Free blocks at the end of the list could be returned to the file system by truncating the file.Contents of a hash table block. Each block contains a sequence of entries followed by a pointer to the next block in the list keyed by file handle. In other words all entriesin a block and the blocks after it, would have hashed to the same value,and we can locate a required entry given the file handle by examining theentries in a block and traversing the linked list of blocksContents of an entry -Each entry consists of a triple comprising a next entry pointer, thefile handle , and the file name. The next entry pointer points to the nextentry in the hash chain, keyed by file name. Unlike the file handle based chain these entries are not organized into blocks as doing so would require that we maintain a duplicate entry since in general entries which hash intoa block when keyed by file handle will not hash into the same block whenkeyed by file name. While maintaining duplicates will work around thisproblem we would end up doubling the storage requirements and increasingthe size of this file would increase search times anyway and most likelynegate most of the benefits of this organization.To use this feature, include the following component:INCLUDE_NETWRS_NFSHASHNOMANUAL*//* includes */#include "vxWorks.h"#include "unistd.h"#include "xdr_nfs.h"#include "string.h"#include "fcntl.h"#include "stdio.h"#include "stdlib.h"#include "memLib.h"#include "nfsdLib.h"#include "ctype.h"#include "sys/stat.h"#include "semLib.h"#include "memPartLib.h"/* defines */#define MAX_DEVS 10#define MAX_MNTS 20#define MAX_HASH_BLKS  10000#define HASH_BKT_SZ   (1 * 1024)#define CHAR_BIT_LEN    8#define INT_BIT_LEN     (sizeof (int) * CHAR_BIT_LEN)#define BAD_OFFSET      ((off_t)(~0x0))#define FH_HASH_TBL_LEN      512#define NAME_HASH_TBL_LEN    512#define MIN_ENTRY_SZ    (sizeof (HNDL_NAME))#define STR_INT_LEN(s)  ((strlen (s) + 1 + sizeof (int) - 1) / sizeof (int))#define STR_ALIGN_LEN(s) (((strlen (s) + 1 + sizeof (int) - 1) / sizeof (int)) \			   *  sizeof (int))#define HASH_BKT_HDR_SZ    (sizeof (off_t) + sizeof (int))#define ENTRY_HDR_SZ    (sizeof (HNDL_NAME) - sizeof(int))/* forward declaration */LOCAL int blkRead (int, off_t, char *, int);LOCAL int blkWrite (int, off_t, char *, int );/* typedefs *//* descriptor for a nfs hashtable */typedef struct tblDesc      {    int     allocBits [MAX_HASH_BLKS/INT_BIT_LEN + 1];  /* bits allocated */    int     numBlocks;                          /* number of blocks allocated */    int     fd;              /* file descriptor of file containing hash table*/    off_t   nameHash [NAME_HASH_TBL_LEN - 1];  /* hash by name table */    int     nextInode;        /* next inode number to allocate */    int     refCnt;           /* reference count */    SEM_ID  sem;              /* protection lock */    char    nmBuf [NFS_MAXPATHLEN];  /* file name for hash table */    }  TBL_DESC;/*  * nfs handle and name pairs are stored in this structure. This structure  * is contained within the hash buckets which are written to disk. These * structures will have overall length a multple of sizeof (int) so * that  the next field stays aligned on a word boundary when in * memory  */typedef struct hndlName    {    off_t        next;         /* next entry ptr */    off_t        prev;         /* prev entry ptr */    short        totalLen;     /* total length of entry */    short        nameLen;      /* length of name string, 0 for free netry */    int          fh;     /* file handlei/inode  */    char         name [sizeof (int)]; /* actual str length is upto max 					 pathname lwngth, this is just for 					 a minimum string. Entry length must 					 be a multiple of sizeof (int) for					 alignment */    }   HNDL_NAME;/*  * hash bucket contains a number of HNDL_NAME pairs along with free space */typedef struct hashBkt      {    off_t        next;       /* next bkt ptr */    int          freeSpace;  /* free space remaining in bucket */    char         entries [HASH_BKT_SZ - sizeof (off_t) - sizeof (int)];			  /* buffer for entries of type HNDL_NAME */    }  HASH_BKT;/*  * Mapping from a file system device id to corresponding hash table descriptor. * There is one hash table per file system device if there are nfs exported *  directories in that file system */typedef struct devIdPair    {    int         dev;    TBL_DESC *  pTbl;    } DEV_ID_PAIR  ;/*  * Mapping from the nfs volume mount id to the hash table descriptor. * The nfs volume id is generated in the nfsExport () routine and is * maintained within the nfs file handle. */typedef struct mntIdPair    {    int         mntId;    TBL_DESC *  pTbl;    } MNT_ID_PAIR;/* locals *//* device to hash table descriptor table */LOCAL DEV_ID_PAIR   devTbl[MAX_DEVS];/* mount volume  to hash table descriptor table */LOCAL MNT_ID_PAIR   mntTbl[MAX_MNTS];/******************************************************************************* * insertMntId - insert entry into mount id based table ** Inserts pointer <pTbl> to a hash file table descriptor in the mount id* based table for nfs mount point <mntId>** NOMANUAL** RETURNS: N/A.*/LOCAL void insertMntId     (    TBL_DESC *    pTbl,    int           mntId    )    {    MNT_ID_PAIR *   pMnt;    for (pMnt = mntTbl; pMnt < mntTbl + MAX_MNTS; ++pMnt)	{	if (pMnt->mntId == 0)	    {	    pMnt->mntId = mntId;	    pMnt->pTbl = pTbl;	    return ;	    }        }    }/******************************************************************************* * getTblEnt - get entry from mnt table ** Returns ptr to table descriptor for give mount id <id>.** RETURNS: ptr to entry or NULL*/LOCAL TBL_DESC *  tblDescGet     (    int   id   /* mount id */    )    {    int ix;    for (ix = 0; ix < MAX_MNTS; ++ix)	{	if (mntTbl[ix].mntId ==  id)	    return (mntTbl[ix].pTbl);        }    return (NULL);    }/******************************************************************************* * nfsHashTblInit - initialize a hash table ** Initialize a hash table given the corresponding descriptor <pTbl>* creating the hash file in dir <dirName>.** RETURNS: OK or ERROR*/LOCAL STATUS nfsHashTblInit    (    TBL_DESC *   pTbl,    char *       dirName    )    {    off_t *      pOff;    HASH_BKT     initBuf;    HNDL_NAME *  pEnt;    int          ix;    memset ((char*) pTbl->allocBits, 0, sizeof (pTbl->allocBits));    for (pOff = pTbl->nameHash; pOff < (pTbl->nameHash + NAME_HASH_TBL_LEN); 	 ++pOff)	{	*pOff = BAD_OFFSET;	}     sprintf  (pTbl->nmBuf, "%s/leofs", dirName);     if ((pTbl->fd = open (pTbl->nmBuf, O_CREAT | O_RDWR | O_TRUNC, 0777)) 	 == ERROR)	 {	 printf ("cannot create file %s\n", pTbl->nmBuf);	 return (ERROR);	 }     /* create the fh hash blocks in the file */     pTbl->numBlocks = FH_HASH_TBL_LEN;     initBuf.next = BAD_OFFSET;     initBuf.freeSpace = sizeof (initBuf) - sizeof (initBuf.next) - 			 sizeof (initBuf.freeSpace);     pEnt = (HNDL_NAME*)initBuf.entries;     pEnt->totalLen = initBuf.freeSpace;     pEnt->nameLen = 0;     for (ix = 0; ix < FH_HASH_TBL_LEN ; ++ix)	 {	 if (write (pTbl->fd, (char *)&initBuf, sizeof (initBuf)) 	     != sizeof (initBuf))	     {	     return (ERROR);	     }	 }     pTbl->refCnt = 0;     pTbl->nextInode = 0;     pTbl->sem = semBCreate (SEM_Q_PRIORITY, SEM_FULL);     if (pTbl->sem == NULL)	return (ERROR);     return (OK);     }/*******************************************************************************  * nfsHashTblSet - set up nfs hash table** Set up an nfs hash table for exported directory <pDir> with mount voleume id* <mntId> and file system device id <devId>. If a hash fiel already exists* for <devId> then we simply need to setup a ptr to the existing hash table* descriptor alse a new hash file must be allocated adn initialized.** RETURNS: N/A*/void nfsHashTblSet    (    char *   pDir,     /* directory name */    int      mntId,    /*mount id */    u_long   devId     /* device Id */    )    {    DEV_ID_PAIR *   pDev;    for (pDev = devTbl; pDev < devTbl + MAX_DEVS; ++pDev)	{	if (pDev->dev != 0 && pDev->dev == devId)	    break;	}    if (pDev >= devTbl + MAX_DEVS)	{        for (pDev = devTbl; pDev < devTbl + MAX_DEVS; ++pDev)	    {	    if (pDev->dev == 0)		{		pDev->dev = devId;		pDev->pTbl = KHEAP_ALLOC (sizeof (TBL_DESC));		if (nfsHashTblInit (pDev->pTbl, pDir) == ERROR)		    {		    printf ("cannot initialize nfs hash file\n");		    KHEAP_FREE((char *)pDev->pTbl);		    return;		    }		break;                }            }        }    pDev->pTbl->refCnt++;    insertMntId (pDev->pTbl, mntId);    }/*******************************************************************************  * nfsHashTblUnset - clean up  nfs hash table** Clean up an nfs hash table for exported directory <pDir> with mount volume id* <mntId> and file system device id <devId>. Delete the allocated table * descriptor if there are no other references to it. ** RETURNS: N/A*/void nfsHashTblUnset    (    char *   pDir,     /* directory name */    int      mntId    /*mount id */    )    {    DEV_ID_PAIR *   pDev;    MNT_ID_PAIR *   pMnt;    TBL_DESC *      pTbl;    for (pMnt = mntTbl; pMnt < mntTbl + MAX_MNTS; ++pMnt)	{	if (pMnt->mntId  == mntId)	    break;	}    if (pMnt >= mntTbl + MAX_MNTS)	{	return;	}    else	{	pTbl = pMnt->pTbl;	pMnt->mntId = 0;	pMnt->pTbl -= 0;	pTbl->refCnt--;	if (pTbl->refCnt == 0)	    {	    close (pTbl->fd);	    unlink (pTbl->nmBuf);	    semDelete (pTbl->sem);	    for (pDev = devTbl; pDev < devTbl + MAX_DEVS; ++pDev)		{		if (pDev->pTbl == pTbl)		    {		    KHEAP_FREE (pTbl);		    pDev->pTbl = 0;		    pDev->dev = 0;		    }	         }             }         }    }/*******************************************************************************  * blockAlloc - allocates block from the file to be used as a hash bucket ** The length of the file being used is incremented by HASH_BKT_SZ* and the bit map updated to reflect that. The bit corresponding to* the allocated block is turned off marking the block as being in use,* so in case caller does not actually use the block he shuld free the block* with blockFree below** RETURNS: file offset of allocated block else BAD_OFFSET* NOMANUAL*/LOCAL off_t blockAlloc    (    TBL_DESC *     pTbl    )    {    int *  pBits = pTbl->allocBits;    int *  pMax = pTbl->allocBits + 		  ((pTbl->numBlocks + INT_BIT_LEN -1) / sizeof (int));  		  /* 1 beyond last word */    char *  pIx;    int     bitPos; /* bit position of allocated block */    int     ix;    if (pTbl->numBlocks >= MAX_HASH_BLKS)	{	return (BAD_OFFSET);	}    for ( ; *pBits == 0 && pBits < pMax ; ++pBits)	{}    if (pBits == pMax)	{        /* allocate a new block in the file at the end */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产美女在线精品| 国产欧美中文在线| 亚洲成人自拍一区| 欧美久久久久久蜜桃| 亚洲大型综合色站| 欧美午夜电影网| 婷婷开心久久网| 久久久久久久久岛国免费| 国产精品66部| 亚洲免费色视频| 欧美日韩免费电影| 美女网站一区二区| 国产精品视频看| 欧美吻胸吃奶大尺度电影| 五月天婷婷综合| 久久久久久久久久久久久夜| eeuss影院一区二区三区 | 国产成人综合在线观看| 日本一区二区三区视频视频| 欧美伊人久久大香线蕉综合69| 亚洲成a人v欧美综合天堂| 久久精品视频免费| 在线视频亚洲一区| 精品一区在线看| 亚洲色图清纯唯美| 日韩亚洲欧美高清| 成人小视频在线观看| 亚洲一区自拍偷拍| 久久影院午夜片一区| 色综合网色综合| 美女视频第一区二区三区免费观看网站| 久久精品男人天堂av| 欧美三级日韩在线| 不卡一区二区三区四区| 亚洲国产精品人人做人人爽| 日韩欧美一级二级三级| 99久久婷婷国产综合精品电影| 日韩电影一区二区三区| 中文字幕一区三区| 欧美精品一区二区三| 欧美主播一区二区三区美女| 国产美女精品在线| 日本va欧美va瓶| 亚洲精品免费在线播放| 国产丝袜欧美中文另类| 日韩欧美激情四射| 欧美在线看片a免费观看| 粉嫩在线一区二区三区视频| 石原莉奈在线亚洲二区| 亚洲另类一区二区| 国产欧美日产一区| 日韩女优毛片在线| 在线观看av不卡| www.欧美日韩| 国产91对白在线观看九色| 日韩福利视频网| 亚洲高清三级视频| 亚洲欧美区自拍先锋| 国产精品麻豆久久久| 久久精品在线免费观看| 欧美成人性战久久| 91精品国模一区二区三区| 91成人免费电影| 色婷婷精品大视频在线蜜桃视频| 成人永久aaa| 不卡一卡二卡三乱码免费网站| 国产不卡一区视频| 国产精品一区二区无线| 国产又黄又大久久| 捆绑紧缚一区二区三区视频| 日韩精品国产欧美| 日韩 欧美一区二区三区| 午夜精品久久久久久久蜜桃app| 一区二区在线电影| 亚洲一级二级三级在线免费观看| 亚洲美腿欧美偷拍| 美女诱惑一区二区| 三级欧美在线一区| 日本成人中文字幕在线视频| 五月天久久比比资源色| 日本成人在线不卡视频| 日韩精品成人一区二区在线| 美女视频第一区二区三区免费观看网站| 日韩高清不卡在线| 韩国成人福利片在线播放| 国产一区二区三区不卡在线观看| 国产一区二区不卡| 成人黄色网址在线观看| 91浏览器在线视频| 欧美午夜一区二区三区| 欧美一区二区三区免费大片| 日韩精品专区在线影院重磅| 2022国产精品视频| 亚洲国产精品成人综合 | 亚洲观看高清完整版在线观看| 亚洲欧美日韩系列| 亚洲超丰满肉感bbw| 免费人成网站在线观看欧美高清| 久久av老司机精品网站导航| 国产乱国产乱300精品| 成人短视频下载| 91福利国产精品| 欧美大片一区二区三区| 日本一区二区三级电影在线观看| 亚洲女爱视频在线| 青青草国产精品亚洲专区无| 国产一区二区三区观看| 91福利在线免费观看| 日韩欧美亚洲一区二区| 亚洲国产精品精华液2区45| 亚洲一区二区三区四区在线| 日本系列欧美系列| 99久久国产免费看| 日韩欧美高清在线| 成人欧美一区二区三区黑人麻豆| 丝袜脚交一区二区| 成人午夜免费av| 4438亚洲最大| 中文字幕日韩一区二区| 日韩国产在线观看一区| 欧美日韩一区视频| 久久综合av免费| 亚洲一区二区在线视频| 狠狠色丁香久久婷婷综合_中| 99精品视频在线观看| 精品捆绑美女sm三区| 一区2区3区在线看| 国产乱对白刺激视频不卡| 欧美精品国产精品| 国产精品久久久久毛片软件| 视频在线观看91| 97超碰欧美中文字幕| 欧美电视剧免费观看| 亚洲综合在线电影| 国产精品夜夜爽| 91精品国产丝袜白色高跟鞋| 亚洲视频你懂的| 国产河南妇女毛片精品久久久 | 欧美va亚洲va| 亚洲影院理伦片| 成人综合日日夜夜| 日韩欧美在线综合网| 亚洲综合一区二区精品导航| 成人av在线观| 久久久五月婷婷| 免费xxxx性欧美18vr| 欧美图区在线视频| 亚洲精品菠萝久久久久久久| 国产91丝袜在线18| 久久久久成人黄色影片| 另类小说色综合网站| 在线成人免费视频| 性感美女久久精品| 欧美亚洲一区三区| 亚洲精品日韩专区silk| 不卡一二三区首页| 国产精品久久毛片a| 懂色av一区二区夜夜嗨| 久久综合一区二区| 久久 天天综合| 欧美刺激脚交jootjob| 男男成人高潮片免费网站| 欧美日韩久久一区二区| 亚洲国产aⅴ成人精品无吗| 欧美性猛交xxxxxx富婆| 一区二区三区免费看视频| 91在线观看免费视频| 中文字幕五月欧美| 欧美一区二区三区视频免费 | 亚洲电影视频在线| 欧美日韩国产美| 无吗不卡中文字幕| 日韩一区二区三区视频在线| 奇米影视一区二区三区| 日韩欧美一级特黄在线播放| 极品少妇xxxx精品少妇偷拍| 久久夜色精品国产欧美乱极品| 国精产品一区一区三区mba视频| 精品国产sm最大网站免费看| 国产精品一区在线观看乱码| 国产欧美日韩三级| 99久久伊人精品| 亚洲va天堂va国产va久| 91精品国产综合久久久蜜臀粉嫩 | 日本一区中文字幕| 日韩精品一区二区三区swag | 国产精品福利影院| 色一区在线观看| 日日夜夜免费精品| 久久网站热最新地址| www.亚洲在线| 亚洲曰韩产成在线| 欧美一区二区免费| 国产成人精品免费看| 亚洲欧美色图小说| 日韩欧美久久一区| 成人黄色片在线观看| 亚洲第一福利一区| 久久精品人人做| 日本高清视频一区二区|