亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
精品日韩99亚洲| 国产女同互慰高潮91漫画| 94色蜜桃网一区二区三区| 粉嫩av亚洲一区二区图片| 国产一区二区三区四区五区入口| 日韩国产高清在线| 奇米影视一区二区三区| 久久精品免费观看| 久久电影网站中文字幕| 狠狠色2019综合网| 高清久久久久久| 97久久人人超碰| 在线视频欧美精品| 色婷婷av一区二区| 欧美日韩黄色一区二区| 欧美一区二区三区免费在线看 | 欧美亚洲国产bt| 91精彩视频在线观看| 欧美日韩综合一区| 欧美一区二区在线看| 日韩一级片在线观看| 久久久不卡网国产精品一区| 中文文精品字幕一区二区| 17c精品麻豆一区二区免费| 亚洲一区二区三区视频在线 | 免费成人av在线播放| 极品美女销魂一区二区三区免费| 国产精品一区一区三区| 99re这里只有精品首页| 欧美日韩成人在线| 久久奇米777| 亚洲欧美国产77777| 婷婷久久综合九色综合伊人色| 久久国产夜色精品鲁鲁99| 国产成人午夜99999| 91成人在线免费观看| 日韩女优av电影在线观看| 国产精品国产三级国产三级人妇| 久久超碰97人人做人人爱| 成人一区在线看| 欧美视频精品在线观看| 久久综合久久鬼色中文字| 亚洲啪啪综合av一区二区三区| 日韩av中文在线观看| 成人久久久精品乱码一区二区三区| 欧美在线一区二区| 久久精品无码一区二区三区| 亚洲一区在线观看免费| 激情六月婷婷久久| 欧美日韩综合色| 国产精品视频一区二区三区不卡| 日韩激情一区二区| 成人激情免费网站| 欧美一区二区三区在线| 亚洲色图视频网| 国产综合久久久久久鬼色| 欧美午夜不卡在线观看免费| 国产亚洲va综合人人澡精品| 丝袜美腿一区二区三区| 97成人超碰视| 久久精品综合网| 日本强好片久久久久久aaa| 99久久精品一区二区| 26uuu亚洲综合色| 丝袜国产日韩另类美女| 色综合天天综合给合国产| www亚洲一区| 日韩av在线发布| 欧美性猛片xxxx免费看久爱 | 国产一区二区久久| 91精品麻豆日日躁夜夜躁| 亚洲欧美日韩在线播放| 国产美女精品一区二区三区| 欧美一区二区三区四区视频| 亚洲国产视频网站| 99re热视频精品| 中文一区一区三区高中清不卡| 九一九一国产精品| 日韩一区二区三区四区| 亚洲成人精品影院| 色狠狠综合天天综合综合| 中文字幕一区二区三区精华液| 国产一区二区三区视频在线播放| 欧美一区二区三区四区高清| 午夜精品aaa| 欧美专区日韩专区| 亚洲九九爱视频| 色综合激情久久| 中文字幕日韩av资源站| 成a人片国产精品| 国产精品久久久一本精品| 国产成人午夜精品影院观看视频| 精品国精品国产| 老司机免费视频一区二区三区| 国产精品三级久久久久三级| 国产一区不卡精品| 久久久久国产精品麻豆| 国产高清不卡二三区| 欧美韩国日本一区| 成人国产免费视频| 亚洲图片另类小说| 97se亚洲国产综合自在线| 亚洲蜜臀av乱码久久精品蜜桃| 色又黄又爽网站www久久| 亚洲综合一二三区| 欧美久久一二三四区| 日韩 欧美一区二区三区| 制服视频三区第一页精品| 日韩不卡一区二区| 日韩你懂的在线播放| 国产一区二区三区综合| 日本一区二区三区高清不卡 | 国产亚洲自拍一区| 国产成人av电影在线观看| 国产精品日产欧美久久久久| 成人aa视频在线观看| 亚洲免费在线观看| 欧美军同video69gay| 精品一区二区三区在线播放视频| 久久精品视频免费| 99国产欧美久久久精品| 亚洲高清免费在线| 精品久久久久久久人人人人传媒| 国产成人综合在线| 自拍偷自拍亚洲精品播放| 欧美亚洲丝袜传媒另类| 蓝色福利精品导航| 国产精品免费aⅴ片在线观看| 91老司机福利 在线| 五月婷婷综合激情| 久久久久九九视频| 色av成人天堂桃色av| 日本免费在线视频不卡一不卡二| 久久影院午夜论| 99久久99久久综合| 视频一区在线视频| 久久久久9999亚洲精品| 在线亚洲高清视频| 精彩视频一区二区| 亚洲精品国产一区二区精华液| 3atv在线一区二区三区| 国产精品一二三区| 亚洲小说欧美激情另类| 久久免费视频色| 日本久久电影网| 久久av老司机精品网站导航| 中文字幕佐山爱一区二区免费| 69堂亚洲精品首页| 成人18视频日本| 免费在线观看精品| 亚洲免费毛片网站| 26uuu精品一区二区三区四区在线| www.欧美日韩| 亚洲色图欧洲色图| 日韩欧美一区二区免费| 色综合久久天天| 国产一区二区调教| 午夜精品爽啪视频| 亚洲欧洲另类国产综合| 欧美不卡视频一区| 欧美色综合网站| 国产成人免费在线视频| 日本中文字幕一区二区视频| 国产精品久久二区二区| 日韩午夜激情电影| 色婷婷香蕉在线一区二区| 国产精品亚洲成人| 美国毛片一区二区| 亚洲一区二区成人在线观看| 国产精品嫩草99a| 欧美videos中文字幕| 欧美日韩国产123区| 91在线播放网址| 国产乱人伦偷精品视频免下载 | 色婷婷综合久久久久中文一区二区 | 亚洲精品少妇30p| 欧美成人video| 91国产免费看| 成人av在线播放网址| 精品亚洲成a人| 青青草精品视频| 日韩精彩视频在线观看| 亚洲一区二区精品3399| 综合久久久久久| 欧美国产精品v| 久久久亚洲午夜电影| 精品噜噜噜噜久久久久久久久试看| 欧美日韩免费不卡视频一区二区三区| 91香蕉视频黄| 99国产欧美久久久精品| 不卡视频在线看| jizzjizzjizz欧美| 成人久久久精品乱码一区二区三区 | 毛片av一区二区| 日本视频免费一区| 日本伊人色综合网| 天天影视色香欲综合网老头| 亚洲成av人影院在线观看网| 亚洲午夜成aⅴ人片| 亚洲国产日韩综合久久精品|