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

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

?? tfsclean1.c

?? 完整的Bell實驗室的嵌入式文件系統TFS
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* tfsclean1.c: *  This is one of several different versions of tfsclean().  This version *  is by far the most complex, but offers power-hit safety and minimal *  flash overhead.  It uses a "spare" sector to backup the *  "one-sector-at-a-time" defragmentation process. * *  General notice: *  This code is part of a boot-monitor package developed as a generic base *  platform for embedded system designs.  As such, it is likely to be *  distributed to various projects beyond the control of the original *  author.  Please notify the author of any enhancements made or bugs found *  so that all may benefit from the changes.  In addition, notification back *  to the author will allow the new user to pick up changes that may have *  been made by other users after this version of the code was distributed. * *  Note1: the majority of this code was edited with 4-space tabs. *  Note2: as more and more contributions are accepted, the term "author" *         is becoming a mis-representation of credit. * *  Original author:    Ed Sutter *  Email:              esutter@lucent.com *  Phone:              908-582-2351 */#include "config.h"#include "cpu.h"#include "stddefs.h"#include "genlib.h"#include "tfs.h"#include "tfsprivate.h"#include "flash.h"#include "monflags.h"#if INCLUDE_TFS#if DEFRAG_TEST_ENABLEDvoiddefragExitTestPoint(int val){    if ((DefragTestType == DEFRAG_TEST_EXIT) && (DefragTestPoint == val)) {        printf("\n+++++++++ EXIT @ TEST POINT(%d)\n",val);        CommandLoop();    }}#else#define defragExitTestPoint(val)#endif/* Variables for testing tfsclean(): * They are set up through arguments to "tfs clean" in tfscli.c. */int DefragTestType;int DefragTestPoint;int DefragTestSector;/* defragTick(): * Used to show progress, just to let the user know that we aren't * dead in the water. */static voiddefragTick(int verbose){    static int tick;    static char clockhand[] = { '|', '/', '-', '\\' };    if (!verbose && (!MFLAGS_NODEFRAGPRN())) {        if (tick > 3)            tick = 0;        printf("%c\b",clockhand[tick++]);    }}/* defragCrcTable(): * Return a pointer to the crc table for the specified TFS device. */struct sectorcrc *defragCrcTable(TDEV *tdp){    return((struct sectorcrc *)(tdp->end+1) - tdp->sectorcount);}/* defragSerase(): * Common function to call from within tfsclean() to erase a sector * and generate an error message if necessary. * * If DEFRAG_TEST_ENABLED is defined and the type/sector/point criteria * is met, then instead of erasing the sector; just change the first non-zero * byte to zero to corrupt it.  This essentially makes it a corrupted erase. */static intdefragSerase(int tag, int snum){    int ret = 0;#if DEFRAG_TEST_ENABLED    int ssize;    uchar *sbase, *send, zero;    printf("     serase_%02d(%02d)\n",tag,snum);    if ((DefragTestType == DEFRAG_TEST_SERASE) &&        (DefragTestSector == snum) && (DefragTestPoint == tag)) {            sectortoaddr(snum,&ssize,&sbase);            send = sbase+ssize;            zero = 0;            while(sbase < send) {                if (*sbase != 0) {                    tfsflashwrite((ulong *)sbase,(ulong *)&zero,1);                    break;                }                sbase++;            }            printf("DEFRAG_TEST_SERASE activated @ %d sector %d\n",tag,snum);            CommandLoop();    }    else#endif    ret = tfsflasherase(snum);    if (ret < 0) {        printf("tfsclean() serase erase failed: %d,%d,%d\n",snum,tag,ret);    }    return(ret);}/* defragFwrite(): * Common function to call from within tfsclean() to write to flash * and generate an error message if necessary. * If DEFRAG_TEST_ENABLED is defined and the test type is set to  * DEFRAG_TEST_FWRITE, then use APPRAMBASE as the source of the data * so that the end result is an errored flash write. */static intdefragFwrite(int tag, uchar *dest,uchar *src,int size){    int ret = 0;#if DEFRAG_TEST_ENABLED    int snum;    addrtosector((char *)dest,&snum,0,0);    printf("     fwrite_%02d(%d,0x%lx,0x%lx,%d)\n",        tag,snum,(ulong)dest,(ulong)src,size);    if ((DefragTestType == DEFRAG_TEST_FWRITE) &&        (DefragTestSector == snum) && (DefragTestPoint == tag)) {            tfsflashwrite((ulong *)dest,(ulong *)getAppRamStart(),size/2);            printf("DEFRAG_TEST_FWRITE activated @ %d sector %d\n",tag,snum);            CommandLoop();    }    else#endif    ret = tfsflashwrite((ulong *)dest,(ulong *)src,size);    if (ret < 0) {        printf("tfsclean() fwrite failed: 0x%lx,0x%lx,%d,%d\n",            (ulong)dest,(ulong)src,size,tag);    }    return(ret);}/* defragGetSpantype(): * With the incoming sector base and end (s_base, s_end), * determine the type of span that the incoming file (f_base, f_end) * has across it.  There are six different ways the spanning can * occur: *   1. begin and end in previous active sector (bpep); *   2. begin in previously active sector, end in this one (bpec); *   3. begin in previously active sector, end in later one (bpel); *   4. begin and end in this active sector (bcec); *   5. begin in this active sector, end in later one (bcel); *   6. begin and end in later active sector (blel); */static intdefragGetSpantype(char *s_base,char *s_end,char *f_base,char *f_end){    int spantype;    if (f_base < s_base) {        if ((f_end > s_base) && (f_end <= s_end))            spantype = SPANTYPE_BPEC;        else if (f_end > s_end)            spantype = SPANTYPE_BPEL;        else            spantype = SPANTYPE_BPEP;    }    else {        if (f_base > s_end)            spantype = SPANTYPE_BLEL;        else if (f_end <= s_end)            spantype = SPANTYPE_BCEC;        else            spantype = SPANTYPE_BCEL;    }    return(spantype);}/* defragGetSpantypeStr(): * Return a string that corresponds to the incoming state value. */static char *defragGetSpantypeStr(int spantype){    char *str;    switch(spantype) {    case SPANTYPE_BPEC:        str = "BPEC";        break;    case SPANTYPE_BLEL:        str = "BLEL";        break;    case SPANTYPE_BPEL:        str = "BPEL";        break;    case SPANTYPE_BPEP:        str = "BPEP";        break;    case SPANTYPE_BCEC:        str = "BCEC";        break;    case SPANTYPE_BCEL:        str = "BCEL";        break;    default:        str = "???";        break;    }    return(str);}/* defragEraseSpare(): * Erase the spare sector associated with the incoming TFS device. * The underlying flash driver SHOULD have a check so that it only * erases the sector if the sector is not already erased, so this * extra check (call to flasherased()) may not be necessary in * most cases. */static intdefragEraseSpare(TDEV *tdp){    int snum, ssize;    uchar *sbase;    if (addrtosector((char *)tdp->spare,&snum,&ssize,&sbase) < 0)        return(TFSERR_FLASHFAILURE);    if (!flasherased(sbase,sbase+ssize)) {        if (defragSerase(1,snum) < 0) {            return(TFSERR_FLASHFAILURE);        }    }    return(TFS_OKAY);}/* defragValidDSI(): * Test to see if we have a valid defrag state information (DSI) * area.  The DSI area, working back from tdp->end, consists of a * table of 32-bit crcs (one per sector), a table of defraghdr * structures (one per active file) and a 32-bit crc of the DSI * itself.  Knowing this format, we can easily step backwards into * the DSI space to see if it all makes sense. * If the table is 100% valid, then we will be able to step * backwards through the DSI to find the 32-bit crc of the DSI area. * If it matches, then we can be sure that the DSI is valid. * Return total number of files in header if the defrag header * table appears to be sane, else 0. */ static intdefragValidDSI(TDEV *tdp, struct sectorcrc **scp){    int     ftot, valid, lastssize;    uchar   *lastsbase;    struct  sectorcrc *crctbl;    ulong   hdrcrc, *crc;    struct  defraghdr   *dhp, dfhcpy;    ftot = valid = 0;    crctbl = defragCrcTable(tdp);    dhp = (struct defraghdr *)crctbl - 1;    dfhcpy = *dhp;    hdrcrc = dfhcpy.crc;    dfhcpy.crc = 0;    if (crc32((uchar *)&dfhcpy,DEFRAGHDRSIZ) == hdrcrc) {        ftot = dhp->idx + 1;        dhp = (struct defraghdr *)crctbl - ftot;        crc = (ulong *)dhp - 1;        if (crc32((uchar *)dhp,(uchar *)tdp->end-(uchar *)dhp) == *crc) {            if (scp)                *scp = crctbl;            return(ftot);        }    }    /* It's possible that the DSI space has been relocated to the spare     * sector, so check for that here...     */    addrtosector((char *)tdp->end,0,&lastssize,&lastsbase);    crctbl = ((struct sectorcrc *)(tdp->spare+lastssize) - tdp->sectorcount);    dhp = (struct defraghdr *)crctbl - 1;    dfhcpy = *dhp;    hdrcrc = dfhcpy.crc;    dfhcpy.crc = 0;    if (crc32((uchar *)&dfhcpy,DEFRAGHDRSIZ) == hdrcrc) {        ftot = dhp->idx + 1;        dhp = (struct defraghdr *)crctbl - ftot;        crc = (ulong *)dhp - 1;        if (crc32((uchar *)dhp,            (uchar *)(tdp->spare+lastssize-1) - (uchar *)dhp) == *crc) {#if DEFRAG_TEST_ENABLED            printf("TFS: DSI in spare\n");#endif            if (scp)                *scp = crctbl;            return(ftot);        }    }    return(0);}/* defragSectorInSpare(): * For each sector, run a CRC32 on the content of the spare * using the size of the sector in question.  If the calculated * crc matches that of the table, then we have located the sector * that has been copied to the spare. * This is a pain in the butt because we can't just run a CRC32 on * the spare sector itself because the size of the spare may not match * the size of the sector that was copied to it.  The source sector * might have been smaller; hence when we calculate the CRC32, we need * to use the size of the potential source sector. */static intdefragSectorInSpare(TDEV *tdp, struct sectorcrc *crctbl){    uchar   *sbase;    struct  defraghdr *dhp;    int     i, ssize, snum, ftot;    sbase = (uchar *)tdp->start;    dhp = (struct defraghdr *)crctbl - 1;    ftot = dhp->idx + 1;    for(i=0;i<tdp->sectorcount;i++) {        addrtosector(sbase,&snum,&ssize,0);        if (i == tdp->sectorcount - 1) {            ssize -=                            /* CRC table */                (tdp->sectorcount * sizeof(struct sectorcrc));            ssize -= (ftot * DEFRAGHDRSIZ);     /* DHT table */            ssize -= 4;                         /* Crc of the tables */        }        if (crc32((uchar *)tdp->spare,ssize) == crctbl[i].precrc)            return(snum);        sbase += ssize;    }    return(-1);}/* defragTouchedSectors(): * Step through the crc table and TFS flash space to find the first * and last sectors that have been touched by defragmentation. * This is used by defragGetState() to recover from an interrupted  * defragmentation, so a few verbose messages are useful to indicate * status to the user. */voiddefragTouchedSectors(TDEV *tdp,int *first, int *last){    uchar   *sbase;    struct  defraghdr *dhp;    struct  sectorcrc   *crctbl;    int     i, ssize, snum, ftot;    *first = -1;    *last = -1;    sbase = (uchar *)tdp->start;    crctbl = defragCrcTable(tdp);    dhp = (struct defraghdr *)crctbl - 1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产又粗又猛又爽又黄91精品| 成人免费看片app下载| 国产精品嫩草影院com| 亚洲国产精品一区二区尤物区| 天天做天天摸天天爽国产一区 | 水蜜桃久久夜色精品一区的特点 | 国产精品久久久爽爽爽麻豆色哟哟| 国产精品久久久久久久久动漫| 伊人一区二区三区| 国产高清亚洲一区| 欧美日韩一区不卡| 国产午夜精品一区二区三区视频| 亚洲二区在线观看| 国产91丝袜在线播放九色| 欧美又粗又大又爽| 中文字幕一区二区三区精华液| 亚洲一区二区三区三| 国产真实乱子伦精品视频| 91福利国产成人精品照片| 精品理论电影在线| 亚洲综合色区另类av| 9i在线看片成人免费| 日韩亚洲电影在线| 国产精品灌醉下药二区| 国产成人小视频| 91精品国产综合久久精品性色| 亚洲资源在线观看| www.日韩在线| 欧美激情一区二区在线| 国产一区二区三区在线观看免费视频| 色视频一区二区| 国产精品久久三区| 色诱视频网站一区| 国产精品久久久久久久久动漫| 免费三级欧美电影| 欧美videos大乳护士334| 亚洲高清久久久| 91国内精品野花午夜精品| 国产精品久久毛片a| 国产美女视频91| 在线免费不卡视频| 亚洲免费观看高清| 久久精品国产精品青草| 欧美丰满高潮xxxx喷水动漫| 亚洲丝袜制服诱惑| 91美女视频网站| 亚洲天堂网中文字| 成人免费视频网站在线观看| 亚洲乱码一区二区三区在线观看| 国产91露脸合集magnet| 精品裸体舞一区二区三区| 蜜桃视频第一区免费观看| 欧美一区二区三区人| 国产乱人伦偷精品视频不卡| 久久综合资源网| 国产精品自拍三区| 亚洲欧美日韩在线| 色婷婷av一区二区三区gif| 亚洲美女偷拍久久| 91在线播放网址| 一区二区三区在线观看视频| 91久久香蕉国产日韩欧美9色| 樱桃视频在线观看一区| 91成人在线免费观看| 日韩成人免费电影| 亚洲精品一区二区三区在线观看| 性感美女久久精品| 久久丝袜美腿综合| 成人激情校园春色| 日韩综合在线视频| 久久久久亚洲综合| 91免费版在线| 国产在线视频不卡二| 欧美国产欧美综合| 99re8在线精品视频免费播放| 亚洲综合在线视频| 欧美岛国在线观看| 欧美午夜理伦三级在线观看| 丝袜美腿亚洲色图| 91精品国产综合久久精品图片| 不卡的电视剧免费网站有什么| 亚洲日本va午夜在线电影| 在线精品亚洲一区二区不卡| 爽好多水快深点欧美视频| 欧美mv日韩mv国产网站app| 丁香婷婷综合五月| 三级不卡在线观看| 欧美激情综合五月色丁香| 91精品国产综合久久久久| 成人av在线一区二区三区| 亚洲成人免费观看| 国产精品护士白丝一区av| 91麻豆精品国产91久久久使用方法| 成人91在线观看| 老司机午夜精品99久久| 国产精品久久久久久一区二区三区| 欧美成人精品1314www| 成人国产精品免费| 另类中文字幕网| 日韩激情一区二区| 亚洲天堂网中文字| 中文字幕一区免费在线观看| 91精品国产免费| 波多野结衣欧美| 成人伦理片在线| 免费在线看一区| 男男成人高潮片免费网站| 亚洲另类在线视频| 国产视频视频一区| 日本一区二区三区在线不卡| 9191成人精品久久| 欧美色精品在线视频| 波多野洁衣一区| 国产最新精品精品你懂的| 韩国成人精品a∨在线观看| 一区二区三区av电影| 欧美va天堂va视频va在线| 日韩一区二区麻豆国产| 在线国产电影不卡| 欧洲一区在线电影| 99麻豆久久久国产精品免费优播| 蜜桃av一区二区| 久久精品国产99国产| 午夜久久久影院| 图片区日韩欧美亚洲| 一区二区三区精品在线观看| 中文字幕一区在线| 一区二区三区成人| 亚洲精品欧美在线| 国产女主播视频一区二区| 亚洲国产成人自拍| 国产亚洲精品超碰| 亚洲日韩欧美一区二区在线| 久久精品亚洲一区二区三区浴池| 欧美日韩精品一区二区三区四区 | 国产成人日日夜夜| 成人永久aaa| www.在线成人| 国产精品一区二区男女羞羞无遮挡| 国产综合色视频| 国产一区二区三区最好精华液| 国产一区二区三区四| 国产精品538一区二区在线| 精品一区二区三区免费| 成人黄色在线视频| 91麻豆123| 日韩欧美精品在线| 国产欧美日韩中文久久| 久久精品欧美一区二区三区麻豆| 日本一区二区三区四区| 国产女主播一区| 亚洲精品国产无天堂网2021| 亚洲国产一区二区三区| 天天爽夜夜爽夜夜爽精品视频 | 国产成人激情av| 99re这里都是精品| 欧美日韩国产片| 国产日韩欧美综合在线| 亚洲人精品午夜| 亚洲精品乱码久久久久久 | 日本三级亚洲精品| 国产精品正在播放| 91蝌蚪porny| 国产欧美一区二区在线| 一区二区三区产品免费精品久久75| 久久99最新地址| av资源网一区| 91小视频免费观看| 久久久国产午夜精品| 亚洲欧美日韩在线| 成人app网站| 欧美精品久久天天躁| 国产精品国产三级国产普通话三级 | 日韩欧美不卡在线观看视频| 国产欧美一区二区三区在线看蜜臀| 性久久久久久久久久久久| 狠狠色丁香久久婷婷综| 97久久精品人人做人人爽| 精品奇米国产一区二区三区| 国产精品三级av| 激情丁香综合五月| 欧美午夜精品免费| 国产亚洲成aⅴ人片在线观看| 麻豆久久一区二区| 麻豆中文一区二区| 亚洲卡通动漫在线| 一区二区三区日韩精品| 狠狠色综合日日| 欧美疯狂性受xxxxx喷水图片| 亚洲视频你懂的| 国产在线乱码一区二区三区| 日韩一区二区视频| 亚洲国产欧美一区二区三区丁香婷| 麻豆国产欧美一区二区三区| 91高清视频在线| 国产精品久久久久影院| 成人app网站| 国产欧美日韩不卡免费| 国产专区综合网| 精品不卡在线视频|