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

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

?? tfsclean1.c

?? 完整的Bell實驗室的嵌入式文件系統TFS
?? C
?? 第 1 頁 / 共 5 頁
字號:
        /* Now retrieve span information about header and data         * portions of the file (new and orig)...         */        new_hbase = new_fbase;        new_hend = new_hbase + TFSHDRSIZ;        new_dbase = new_hbase + TFSHDRSIZ;        new_dend = new_fend;        orig_fend = ((char *)dhp->ohdr + fullsize);        new_hspan = defragGetSpantype(activesbase,activesend,            new_hbase,new_hend);        new_dspan = defragGetSpantype(activesbase,activesend,            new_dbase,new_dend);        finfo.fhdr = 1;        fillstat = defragFillFlash(&finfo,new_hspan,&activeaddr,0);        if (fillstat < 0)            return(fillstat);           if (new_hspan == SPANTYPE_BCEL)            break;        finfo.fhdr = 0;        fillstat = defragFillFlash(&finfo,new_dspan,&activeaddr,0);        if (fillstat < 0)            return(fillstat);           if (new_dspan == SPANTYPE_BCEL || new_dspan == SPANTYPE_BPEL)            break;    }    sz = activessize - finfo.crcsz;    /* If this is the last sector, then we must not include the space used     * for defrag state storage in the crc calculation.     * We deduct size of CRC table, DHT table and the crc of the DSI space...     */    if (activesnum == lastsnum) {        sz -= (tdp->sectorcount * sizeof(struct sectorcrc));            sz -= (ftot * DEFRAGHDRSIZ);        sz -= 4;    }    while(sz) {        temp = (finfo.crc ^ 0xff) & 0x000000FFL;        finfo.crc = ((finfo.crc >> 8) & 0x00FFFFFFL) ^ crc32tab[temp];        sz--;    }    *newcrc = ~finfo.crc;    return(0);}/* defragBuildCrcTable(): * Build the table of sector crcs. * This consists of a set of CRCs representing each sector * before defrag starts and after defrag has completed.   * One set for each sector.  This table is then used if the * defrag process is interrupted to determine the state of * the interrupted defragmentation process. */intdefragBuildCrcTable(TDEV *tdp, struct defraghdr *dht, int verbose){    ulong   crc;    uchar   *sbase;    int     i, ssize, dhstsize;    struct  sectorcrc *crctbl;    dhstsize = (ulong)(tdp->end+1) - (ulong)dht + 4;    crctbl = defragCrcTable(tdp);    /* The pre-defrag crc table...     * This one's easy because it is simply a crc for each of the current     * sectors.     */    sbase = (uchar *)tdp->start;    for(i=0;i<tdp->sectorcount;i++) {        if (addrtosector(sbase,0,&ssize,0) < 0)            return(-1);        if (i == tdp->sectorcount-1)            ssize -= dhstsize;                /* The pre-defrag crc: */        crc = crc32(sbase,ssize);        if (defragFwrite(7,(uchar *)&crctbl[i].precrc,            (uchar *)&crc,4) == -1) {            return(-1);        }        /* The post-defrag crc: */        if (defragNewSectorCrc(tdp,dht,i,&crc) < 0)            return(-1);        if (defragFwrite(8,(uchar *)&crctbl[i].postcrc,            (uchar *)&crc,4) == -1) {            return(-1);        }        sbase += ssize;        defragTick(0);    }    return(0);}/* _tfsclean(): * This is the front-end of the defragmentation process, following are the * basic steps of defragmentation... * * Build the Defrag State Information (DSI) area: * 1. Create a table of 32-bit CRCs, two for each sector.  One is the CRC *    of the sector prior to beginning defragmentation and the other is *    what will be the CRC of the sector after defragmentation has completed. *    These CRCs are used to help recover from an interrupted defragmentation. * 2. Create a table of struct defraghdr structures, one for each file in *    TFS that is currently active (not dead). * 3. Create a CRC of the tables created in steps 1 & 2. * * The data created in steps 1-3 is stored at the end of the last sector * used by TFS for file storage.  After this is created, the actual flash * defragmentation process starts. * * File relocation: * 4. Step through each sector in TFS flash space, process each file whose *    relocated space overlaps with that sector.  As each sector is being *    re-built, the original version of that sector is stored in the spare. * * End of flash cleanup: * 5. Run through the remaining, now unsused, space in TFS flash and make *    sure it is erased. * * File check: * 6. Run a check of all of the relocated files to make sure everything is *    still sane. *  * Defragmentation success depends on some coordination with tfsadd()... * Whenever a file is added to TFS, tfsadd() must verify that the space * needed for defrag overhead (defrag state & header tables) will be * available.  Also, tfsadd() must make sure that the defrag overhead will * always fit into one sector (the sector just prior to the spare). */int_tfsclean(TDEV *tdp, int restart, int verbose){    int     dhstsize;       /* Size of state table overhead */    int     firstsnum;      /* Number of first sector in TFS device. */    int     lastsnum;       /* Number of last sector in TFS device. */    int     lastssize;      /* Size of last sector in TFS device. */    char    *lastsbase;     /* Base address of last sector in TFS device. */    int     sectorcheck;    /* Used to verify proper TFS configuration. */    struct  defraghdr *dht; /* Pointer to defrag header table. */    int     chkstat;        /* Result of tfscheck() after defrag is done. */    int     ftot;           /* Total number of active files in TFS. */    int     dtot;           /* Total number of deleted files in TFS. */    int     fcnt;           /* Running file total, used in hdrtbl build. */    TFILE   *tfp;           /* Misc file pointer */    char    *newaddress;    /* Used to calculate "new" location of file. */    struct  defraghdr   defrag; /* Used to build defrag header table. */    int     activesnum;     /* Sector being worked on restarted defrag. */    struct  sectorcrc   *crctbl;    /* Pointer to table of per-sector crcs. */    int     defrag_state;    int     sidx, snum;    char    *end;        if (TfsCleanEnable < 0)        return(TFSERR_CLEANOFF);    /* If incoming TFS device pointer is NULL, return error     */    if (!tdp)        return(TFSERR_BADARG);    /* If the 'restart' flag is set, then we only want to do a defrag if     * we determine that one is already in progress; so we have to look at     * the current state of the defrag state table to figure out if a defrag     * was active.  If not, just return.     */    if (restart) {        defrag_state = defragGetState(tdp,&activesnum);        switch(defrag_state) {            case SECTOR_DEFRAG_INACTIVE:            case SECTOR_DEFRAG_ABORT_RESTART:                return(TFS_OKAY);            case SCANNING_ACTIVE_SECTOR_1:            case SCANNING_ACTIVE_SECTOR_2:            case SCANNING_ACTIVE_SECTOR_3:            case SCANNING_ACTIVE_SECTOR_4:            case SCANNING_ACTIVE_SECTOR_5:                defrag_state = SCANNING_ACTIVE_SECTOR;                break;        }    }    else {        defrag_state = SECTOR_DEFRAG_INACTIVE;    }    if ((verbose) || (!MFLAGS_NODEFRAGPRN()))        printf("TFS device '%s' powersafe defragmentation\n",tdp->prefix);    if (addrtosector((char *)tdp->start,&firstsnum,0,0) < 0)        return(TFSERR_MEMFAIL);    lastsnum = firstsnum + tdp->sectorcount - 1;    if (addrtosector((char *)tdp->end,&sectorcheck,0,0) < 0)        return(TFSERR_MEMFAIL);    if (lastsnum != sectorcheck) {        printf("%s: SECTORCOUNT != TFSSTART <-> TFSEND\n", tdp->prefix);        printf("First TFS sector = %d, last = %d\n",firstsnum,sectorcheck);        return(TFSERR_MEMFAIL);    }    if (defrag_state == SECTOR_DEFRAG_INACTIVE) {        activesnum = firstsnum;    }    /* Retrieve information about last sector:     */    if (sectortoaddr(lastsnum,&lastssize,(uchar **)&lastsbase) == -1)        return(TFSERR_MEMFAIL);    /* Establish a pointer to a table of CRCs that will contain     * one 32-bit CRC for each sector (prior to starting the defrag).     */    crctbl = defragCrcTable(tdp);    /* Retrieve the number of "dead" and "living" files:     * If there are no dead files, then there is no need to defrag.     * If there are no "living" files, then we can just init the flash.     */    ftot = dtot = 0;    if (restart && defragValidDSI(tdp,0)) {        dht = (struct defraghdr *)crctbl - 1;        ftot = dht->idx + 1;    }    else {        tfp = (TFILE *)tdp->start;        while(validtfshdr(tfp)) {            if (TFS_FILEEXISTS(tfp))                ftot++;            else                dtot++;            tfp = nextfp(tfp,tdp);        }        if (dtot == 0) {            if (verbose)                printf("No dead files in %s.\n",tdp->prefix);            if (tfsflasherased(tdp,verbose))                return(0);            if (verbose)                printf("Cleaning up end of flash...\n");        }    }    if (ftot == 0) {        if (verbose)            printf("No active files detected, erasing all %s flash...\n",                tdp->prefix);        _tfsinit(tdp);        return(0);    }    /* Now that we know how many files are in TFS, we can establish      * a pointer to the defrag header table, and the size of the table...     */    dht = (struct defraghdr *)crctbl - ftot;    dhstsize = (ulong)(tdp->end+1) - (ulong)dht;    dhstsize += 4; /* Account for the CRC of the state tables. */    if (defrag_state == SECTOR_DEFRAG_INACTIVE) {        ulong   crc;        if (verbose) {            printf("TFS defrag: building DSI space...\n");        }        /* We start by making sure that the space needed by the         * defrag header and state table at the end of the last         * sector is clear...         */        if (!flasherased((uchar *)dht, (uchar *)(tdp->end))) {            if (defragEraseSpare(tdp) < 0)                return(TFSERR_FLASHFAILURE);            if (defragFwrite(9,(uchar *)(tdp->spare),lastsbase,                lastssize-dhstsize) == -1) {                return(TFSERR_FLASHFAILURE);            }            if (defragSerase(5,lastsnum) < 0) {                return(TFSERR_FLASHFAILURE);            }            if (defragFwrite(10,lastsbase,(uchar *)(tdp->spare),                lastssize) == -1) {                return(TFSERR_FLASHFAILURE);            }        }        /* Erase the spare then copy the portion of the last TFS         * sector that does not overlap with the defrag header and         * state table area to the spare.  We do this so that the spare         * sector contains a defrag header and state table area that         * is erased.         */        if (defragEraseSpare(tdp) < 0)            return(TFSERR_FLASHFAILURE);            if (defragFwrite(11,(uchar *)tdp->spare,            lastsbase,lastssize-dhstsize) == -1) {            return(TFSERR_FLASHFAILURE);        }        /* At this point we have a valid copy of the last sector in         * the spare.  If any portion of the last sector is not identical         * to what is in the spare, then we need to erase the last sector         * and re-copy what is in the spare to the last sector.  This is         * necessary because an interrupt may have occurred while writing         * to the last sector, and it may have corrupted something.         */        if ((memcmp(lastsbase,(char *)(tdp->spare),lastssize-dhstsize)) ||            (!flasherased((uchar *)dht,(uchar *)tdp->end))) {            if (defragSerase(6,lastsnum) < 0) {                return(TFSERR_FLASHFAILURE);            }            if (defragFwrite(12,lastsbase,(uchar *)(tdp->spare),                lastssize) == -1) {                return(TFSERR_FLASHFAILURE);            }        }        /* Build the header table:         */        fcnt = 0;        tfp = (TFILE *)tdp->start;        newaddress = (char *)tdp->start;        if (verbose > 2) {            printf("\nDEFRAG HEADER DATA (dht=0x%lx, ftot=%d):\n",                (ulong)dht,ftot);        }            while(validtfshdr(tfp)) {            if (TFS_FILEEXISTS(tfp)) {                uchar   *base, *eof, *neof, *nbase;                int     size, slot;                struct  tfsdat *slotptr;                    strcpy(defrag.fname,TFS_NAME(tfp));                defrag.ohdr = tfp;                defrag.ohdrcrc = tfp->hdrcrc;                defrag.filsize = TFS_SIZE(tfp);                if (addrtosector((char *)tfp,0,0,&base) < 0)                    return(TFSERR_MEMFAIL);                eof = (uchar *)(tfp+1)+TFS_SIZE(tfp)-1;                if (addrtosector((char *)eof,0,0,&base) < 0)                    return(TFSERR_MEMFAIL);                defrag.oeso = eof - base + 1;                neof = newaddress+TFSHDRSIZ+TFS_SIZE(tfp)-1;                if (addrtosector((char *)neof,(int *)&defrag.nesn,0,&nbase) < 0)                    return(TFSERR_MEMFAIL);                defrag.neso = neof - nbase + 1;                defrag.crc = 0;                defrag.idx = fcnt;                defrag.nda = newaddress;                    /* If the file is currently opened, adjust the base address. */                slotptr = tfsSlots;                for (slot=0;slot<TFS_MAXOPEN;slot++,slotptr++) {                    if (slotptr->offset != -1) {                        if (slotptr->base == (uchar *)(TFS_BASE(tfp))) {                            slotptr->base = (uchar *)(newaddress+TFSHDRSIZ);                        }                    }                }                s

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产综合久久| 亚洲午夜激情av| 日韩欧美久久久| 欧美精品国产精品| 欧美三区在线观看| 欧美亚洲愉拍一区二区| 91传媒视频在线播放| 欧美综合天天夜夜久久| 欧美怡红院视频| 欧美色精品天天在线观看视频| 日本电影亚洲天堂一区| 欧美视频一区二区在线观看| 91国产免费观看| 欧美日韩国产首页在线观看| 欧美三片在线视频观看| 日韩一级在线观看| 亚洲精品一区二区三区影院| 精品国产伦一区二区三区观看方式 | 欧美成va人片在线观看| 日韩精品中文字幕一区| 久久中文娱乐网| 国产亚洲综合色| 亚洲国产电影在线观看| 最新国产成人在线观看| 一区二区日韩电影| 天天亚洲美女在线视频| 美腿丝袜在线亚洲一区| 国产老女人精品毛片久久| 豆国产96在线|亚洲| 97精品国产97久久久久久久久久久久| 99re成人在线| 欧美久久免费观看| 久久影院午夜论| 国产精品久久久久天堂| 亚洲动漫第一页| 国产综合色精品一区二区三区| 国产精品一二一区| 一本到不卡免费一区二区| 欧美电影在哪看比较好| 久久亚洲捆绑美女| 亚洲人成在线播放网站岛国| 午夜欧美电影在线观看| 久久成人羞羞网站| av动漫一区二区| 欧美视频一二三区| 久久久国产精品麻豆| 亚洲欧美电影一区二区| 日本人妖一区二区| 不卡的av在线| 日韩欧美国产综合在线一区二区三区| 久久久久国色av免费看影院| 一片黄亚洲嫩模| 久久99精品国产| 91成人网在线| 国产亚洲女人久久久久毛片| 亚洲自拍偷拍图区| 国产91综合一区在线观看| 欧美日韩综合在线| 天堂成人国产精品一区| 国产精品国产三级国产三级人妇 | 久久国产欧美日韩精品| 91美女视频网站| 精品久久久久久无| 亚洲国产成人va在线观看天堂| 国产成人av一区二区| 国产精品理伦片| 日韩电影在线一区二区| 91色|porny| 经典三级一区二区| 在线播放视频一区| 亚洲午夜在线电影| 在线综合+亚洲+欧美中文字幕| 国产精品网站在线| 欧美丰满嫩嫩电影| 国产欧美日韩不卡免费| 日日夜夜免费精品视频| 91色在线porny| 久久先锋影音av鲁色资源| 一区二区在线观看视频 | 日本韩国视频一区二区| 国产亚洲欧美日韩在线一区| 麻豆精品在线视频| 欧美日韩一区二区欧美激情| 国产精品久久久久一区二区三区 | 蜜臀av一区二区在线观看| 久久久99精品久久| 51午夜精品国产| 中文字幕视频一区| 综合婷婷亚洲小说| 国产欧美日韩另类视频免费观看| 亚洲高清视频在线| 国产高清不卡一区| 亚洲精品在线观看网站| 美女免费视频一区二区| 制服丝袜成人动漫| 午夜影院在线观看欧美| 欧美性videosxxxxx| 亚洲精选在线视频| 91丨porny丨中文| 最新高清无码专区| 色呦呦国产精品| 亚洲九九爱视频| 欧美在线综合视频| 亚洲一区二区在线免费看| 91香蕉视频在线| 国产精品白丝在线| 91偷拍与自偷拍精品| 日韩精品每日更新| 狠狠色丁香婷综合久久| 精品国产一区二区三区久久久蜜月| 青青草原综合久久大伊人精品优势| 777亚洲妇女| 久久国内精品视频| 久久综合狠狠综合久久激情| 国产精品99久久不卡二区| 久久精品网站免费观看| 国产一区不卡在线| 亚洲国产电影在线观看| av一区二区三区四区| 亚洲免费观看高清在线观看| 在线观看av一区| 午夜欧美电影在线观看| 日韩午夜小视频| 中文字幕在线不卡一区二区三区| 91麻豆国产在线观看| 亚洲国产成人精品视频| 日韩一区二区不卡| 国产成人免费av在线| 亚洲色图制服诱惑| 欧美午夜寂寞影院| 欧美a一区二区| 国产午夜亚洲精品理论片色戒 | 欧美精品tushy高清| 青草国产精品久久久久久| 久久午夜老司机| 波多野结衣的一区二区三区| 亚洲一区二区在线观看视频| 欧美一区二区在线不卡| 国产成a人亚洲| 樱花草国产18久久久久| 日韩欧美中文字幕一区| 成人av网在线| 香蕉av福利精品导航| 久久婷婷国产综合精品青草| 99久久精品国产精品久久| 午夜精品久久久久久久久久| 久久久久久久久久看片| 日本高清不卡视频| 久久99精品一区二区三区| 中文字幕一区二区三中文字幕| 欧美区在线观看| 成人精品国产一区二区4080| 偷拍亚洲欧洲综合| 国产婷婷一区二区| 欧美男同性恋视频网站| 成人av在线资源网站| 日日夜夜精品免费视频| 国产精品日日摸夜夜摸av| 欧美日韩电影一区| 成人18视频日本| 久久av资源站| 日韩欧美国产系列| 99国产精品久久久| 精品一区二区三区在线视频| 亚洲欧美日韩一区二区三区在线观看| 日韩一二三区视频| 色哟哟国产精品| 国产精品99久久久久久宅男| 亚洲bdsm女犯bdsm网站| 国产精品欧美久久久久一区二区| 91精品久久久久久久91蜜桃| 一本大道久久a久久精二百 | 国产精品人成在线观看免费 | 国产精品丝袜一区| 91精品国产色综合久久ai换脸| 99精品偷自拍| 国产一区二区在线观看免费| 天堂蜜桃一区二区三区| 日韩影院在线观看| 日韩一级片在线观看| 在线亚洲+欧美+日本专区| 成人午夜视频福利| 亚洲欧洲性图库| 国产亚洲欧美日韩日本| 精品国产免费一区二区三区四区 | 在线亚洲+欧美+日本专区| 成人美女在线观看| 国产九色sp调教91| 老汉av免费一区二区三区| 亚洲国产成人91porn| 中文字幕不卡在线播放| 精品国产91久久久久久久妲己| 欧美人xxxx| 91精品国产综合久久国产大片| 色婷婷综合久久| 午夜欧美视频在线观看| 亚洲国产精品久久人人爱蜜臀| 亚洲特黄一级片| 成人免费在线播放视频| 国产精品久久久久久久久久久免费看 |