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

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

?? tfs.c

?? flash文件系統實現
?? C
?? 第 1 頁 / 共 5 頁
字號:
    while(*fstr) {        tfp = tfsflgtbl;        while(tfp->sdesc) {            if (*fstr == tfp->sdesc) {                *flag |= tfp->flag;                break;            }            tfp++;        }        if (!tfp->flag)            return(TFSERR_BADFLAG);        fstr++;    }    return(TFS_OKAY);}/* hdrcrc(): * The crc of the file header was originally calculated (in tfsadd()) * with the header crc and next pointer nulled out; so a copy must * be made and these two fields cleared.  Also, note that the * TFS_NSTALE and TFS_ACTIVE flags are forced to be set in the copy. * This is done because it is possible that either of these bits may * have been cleared due to other TFS interaction; hence, they need * to be set prior to crc calculation. * Note also that earlier versions of TFS deleted a file by clearing * the entire flags field.  This made it impossible to do a header crc * check on a deleted file; deletion has been changed to simply clear * the TFS_ACTIVE bit in the flags, so now a deleted file's header can * can be crc tested by simply forcing the TFS_ACTIVE bit high as was * mentioned above. */ulongtfshdrcrc(TFILE *hdr){    TFILE hdrcpy;    hdrcpy = *hdr;    hdrcpy.next = 0;    hdrcpy.hdrcrc = 0;    hdrcpy.flags |= (TFS_NSTALE | TFS_ACTIVE);    return(crc32((uchar *)&hdrcpy,TFSHDRSIZ));}/* validtfshdr(): *  Return 1 if the header pointed to by the incoming header pointer is valid. *  Else return 0.  The header crc is calculated based on the hdrcrc *  and next members of the structure being zero. *  Note that if the file is deleted, then just ignore the crc and return 1. */intvalidtfshdr(TFILE *hdr){    /* A few quick checks... */    if (!hdr || hdr->hdrsize == ERASED16)        return(0);    if (tfshdrcrc(hdr) == hdr->hdrcrc) {        return(1);    }    else {        /* Support transition to new deletion flag method... */        if ((hdr->flags == 0) && tfsOldDelFlagCheckActive)            return(1);                          printf("Bad TFS hdr crc @ 0x%lx\n",(ulong)hdr);        return(0);    }}/* nextfp(): *  Used as a common means of retrieving the next file header pointer.  It *  does some sanity checks based on the fact that all pointers must fall *  within the TFSSTART<->TFSEND memory range and since each file is placed *  just after the previous one in linear memory space, fp->next should *  always be greater than fp. */TFILE *nextfp(TFILE *fp, TDEV *tdp){    if (!tdp)        tdp = gettfsdev(fp);    /* Make some basic in-range checks... */    if ((!tdp) || (fp < (TFILE *)tdp->start) || (fp > (TFILE *)tdp->end) ||        (fp->next < (TFILE *)tdp->start) || (fp->next > (TFILE *)tdp->end)  ||        (fp->next <= fp)) {        printf("Bad TFS hdr ptr @ 0x%lx\n",(ulong)fp);        return(0);    }    return(fp->next);}/* tfsflasherased(): *  Jump to the point in flash after the last file in TFS, then verify *  that all remaining flash  that is dedicated to TFS is erased (0xff). *  If erased, return 1; else return 0. */inttfsflasherased(TDEV *tdp, int verbose){    ulong   *lp;    TFILE   *tfp;    tfp = (TFILE *)tdp->start;    while(validtfshdr(tfp))        tfp = nextfp(tfp,tdp);    lp = (ulong *)tfp;    while (lp < (ulong *)tdp->end) {        if (*lp != ERASED32) {            if (verbose)                printf("End of TFS on %s not erased at 0x%lx\n",                    tdp->prefix,(ulong)lp);            return(0);        }#ifdef WATCHDOG_MACRO        WATCHDOG_MACRO();#endif        lp++;    }    return(1);}static inttfsftot(TDEV *tdpin){    int     ftot;    TFILE   *tfp;    TDEV    *tdp;    ftot = 0;    for (tdp=tfsDeviceTbl;tdp->start != TFSEOT;tdp++) {        if (!tdpin || (tdpin == tdp)) {            tfp = (TFILE *)tdp->start;            while(validtfshdr(tfp)) {                if (TFS_FILEEXISTS(tfp))                    ftot++;                tfp = nextfp(tfp,tdp);            }        }    }    return(ftot);}/* tfsmemuse(): *  Step through one (or all) TFS devices and tally up various memory usage *  totals.  See definition of tfsmem structure for more details. *  If incoming tdpin pointer is NULL, then tally up for all TFS devices; *  otherwise, tally up for only the one device pointed to by tdpin. */inttfsmemuse(TDEV *tdpin, TINFO *tinfo, int verbose){    int     devtot;    char    *cfgerr;    TFILE   *tfp;    TDEV    *tdp;    /* Start by clearing incoming structure... */    tinfo->pso = 0;    tinfo->sos = 0;    tinfo->memtot = 0;    tinfo->liveftot = 0;    tinfo->deadftot = 0;    tinfo->livedata = 0;    tinfo->deaddata = 0;    tinfo->liveovrhd = 0;    tinfo->deadovrhd = 0;    if (verbose) {        printf("TFS Memory Usage...\n     ");        printf(" name    start       end       spare     spsize  scnt type\n");    }    devtot = 0;    for (tdp=tfsDeviceTbl;tdp->start != TFSEOT;tdp++) {        if (!tdpin || (tdpin == tdp)) {            devtot++;            tfp = (TFILE *)tdp->start;            cfgerr = (char *)0;            /* Do some sanity checks on the configuration... */            if ((tdp->spare >= tdp->start) && (tdp->spare <= tdp->end)) {                cfgerr = "spare within storage space";            }            if (cfgerr) {                printf("Bad %s TFS config: %s.\n",tdp->prefix,cfgerr);            }            if (verbose) {                printf("%10s: 0x%08lx|0x%08lx|0x%08lx|0x%06lx|%4ld|0x%lx\n",                    tdp->prefix,(ulong)(tdp->start),(ulong)(tdp->end),                    (ulong)(tdp->spare),tdp->sparesize,                    tdp->sectorcount,(ulong)(tdp->devinfo));            }            tinfo->memtot += ((tdp->end - tdp->start) + 1) + tdp->sparesize;            tinfo->pso += (tdp->sectorcount * 4) + 16;            tinfo->sos += tdp->sparesize;            while(validtfshdr(tfp)) {                if (TFS_FILEEXISTS(tfp)) {                    tinfo->liveftot++;                    tinfo->livedata += TFS_SIZE(tfp);                    tinfo->liveovrhd += (TFSHDRSIZ + DEFRAGHDRSIZ);                }                else {                    tinfo->deadftot++;                    tinfo->deaddata += TFS_SIZE(tfp);                    tinfo->deadovrhd += TFSHDRSIZ;                }                tfp = nextfp(tfp,tdp);            }        }    }    tinfo->memused = tinfo->livedata + tinfo->liveovrhd +            tinfo->deaddata + tinfo->deadovrhd + tinfo->pso + tinfo->sos;    tinfo->memfree = tinfo->memtot - tinfo->memused;     /* Remaining space may not even be big enough to contain the     * file overhead, if this is the case, show a remaining space     * of zero rather than a negative number...     */    tinfo->memfordata =        tinfo->memfree - (devtot * (TFSHDRSIZ + DEFRAGHDRSIZ));    if (tinfo->memfordata < 0)        tinfo->memfordata = 0;    if (verbose) {        printf("\n Total memory: %d bytes (used=%d, avail=%d (%d for data)).\n",            tinfo->memtot,tinfo->memused,tinfo->memfree, tinfo->memfordata);        printf(" Per-device overhead: %d bytes ",tinfo->pso+tinfo->sos);        printf("(defrag-state=%d spare-sector=%d).\n",tinfo->pso,tinfo->sos);        printf(" File data space: %d bytes (live=%d, dead=%d).\n",            tinfo->livedata+tinfo->deaddata,            tinfo->livedata,tinfo->deaddata);        printf(" File overhead space: %d bytes (live=%d, dead=%d).\n",            tinfo->liveovrhd+tinfo->deadovrhd,            tinfo->liveovrhd,tinfo->deadovrhd);        printf(" File count: %d (live=%d, dead=%d).\n",            tinfo->liveftot+tinfo->deadftot,tinfo->liveftot,tinfo->deadftot);        printf(" Defrag will release %d bytes\n",            tinfo->deadovrhd+tinfo->deaddata);        printf("\n");    }    return(tinfo->liveftot + tinfo->deadftot);}/* tfscheck(): *  Step through each file in a particular device making a few checks... *  - First look at the header.  If hdrsize is erased, it "should" indicate *    the end of the linear list of files.  To be anal about it, verify that *    the entire header is erased.  If it is, we truly are at the end of the *    list; otherwise, header error. *  - Second, do a crc32 on the header.  *  - Third, if the file is not deleted, then do a crc32 on the data portion *    of the file (if the file is deleted, then it really doesn't matter if *    there is a crc32 error on that data). *  - Finally, if the header is not corrupted, index to the next pointer and *    continue.  If the header is corrupt, see if enough information *    in the header is valid to allow us to step to the next file.  Do this *    by calculating where the next pointer should be (using current pointer, *    file+header size and mod16 adjustment) and then see if that matches the *    value stored in the actual "next" pointer.  If yes, go to next file; *    else break out of the loop. *   *  The purpose is to do more sophisticated file system checks than are *  done in normal TFS operations. */#define TFS_CORRUPT     1#define HDR_CORRUPT     2#define DATA_CORRUPT    4inttfscheck(TDEV *tdp, int verbose){    int     tfscorrupt, filtot;    TFILE   *fp, *fp1;    if (!tdp)        return(TFSERR_BADARG);    if (verbose)        printf("TFS device %s check:\n",tdp->prefix);    filtot = tfscorrupt = 0;    fp = (TFILE *)tdp->start;    while(1) {        tfscorrupt &= ~(HDR_CORRUPT | DATA_CORRUPT);        /* If hdrsize is ERASED16, then verify that the whole header is         * also ERASED16, if yes, we're at the end of the linear list of         * files; otherwise, we have a corrupt header.         */        if (fp->hdrsize == ERASED16) {            int     i;            ushort  *sp;            /* If this is right at the edge of the end of the TFS device,             * then break with no further checks to this header.             */            if ((fp+1) > (TFILE *)tdp->end)                break;            /* Make sure the entire header is erased... */            sp = (ushort *)fp;            for(i=0;i<TFSHDRSIZ;i+=2,sp++) {                if (*sp != ERASED16) {                    if (verbose)                        printf(" Corrupt hdr @ 0x%lx",(ulong)fp);                    tfscorrupt = HDR_CORRUPT | TFS_CORRUPT;                    break;                }            }            if (!(tfscorrupt & HDR_CORRUPT))                break;            else                goto nextfile;        }        /* Run a crc check on the header even if file is deleted...         */        if (tfshdrcrc(fp) != fp->hdrcrc) {            if (verbose)                printf(" CRC error in hdr @ 0x%lx\n",(ulong)fp);            tfscorrupt = HDR_CORRUPT | TFS_CORRUPT;            goto nextfile;        }        /* If file exists, and it's not IPMOD, run a crc check on data...   */        if (TFS_FILEEXISTS(fp) && !(fp->flags & TFS_IPMOD)) {             filtot++;            if (verbose)                printf(" %s...",fp->name);                    if ((!(fp->flags & TFS_IPMOD)) &&                (crc32((uchar*)TFS_BASE(fp),fp->filsize) != fp->filcrc)) {                    if (verbose)                        printf(" CRC error in data");                    tfscorrupt = DATA_CORRUPT | TFS_CORRUPT;            }            else {                if (verbose)                    printf(" ok");            }        }        /* Prior to incrementing to the next file pointer, if the header         * is corrupted, attempt to salvage the next pointer...         * If the value of the next pointer matches what is calculated         * from the file size and header size, then assume it is ok         * and allow the tfscheck() loop to continue; otherwise break.         */nextfile:        if (tfscorrupt & HDR_CORRUPT) {            if (fp->next) {                ulong modnext;                              modnext = (ulong)((int)(fp+1) + fp->filsize);                if (modnext & 0xf) {                    modnext += 16;                    modnext &= ~0xf;                }                if (verbose)                    printf(" (next ptr ");                if (fp->next != (TFILE *)modnext) {                    if (verbose)                        printf("damaged)\n");                    break;                }                else {                    if (verbose)                        printf("salvaged)");                }            }        }        fp1 = nextfp(fp,tdp);        if (!fp1) {            tfscorrupt = HDR_CORRUPT | TFS_CORRUPT;            break;        }        if ((verbose) && (TFS_FILEEXISTS(fp) || tfscorrupt))            putchar('\n');        fp = fp1;    }    tfsflasherased(tdp,verbose);    if (tfscorrupt)        return(TFSERR_CORRUPT);    if (verbose)        printf(" PASSED\n");    return (TFS_OKAY);}voidtfsclear(TDEV *tdp){    int i;    /* Clear the fileslot[] table indicating that no files are opened.     * Only clear the slots applicable to the incoming TDEV pointer.     */    for (i = 0; i < TFS_MAXOPEN; i++) {        ulong offset;        offset = tfsSlots[i].offset;        if (offset != (ulong)-1) {            if ((tdp == (TDEV *)0) ||                ((offset >= tdp->start) && (offset <= tdp->end)))                tfsSlots[i].offset = -1;        }    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷综合五月| 国产美女在线精品| 欧美性xxxxxx少妇| 国产精品中文字幕欧美| 亚洲成人在线免费| 日韩美女精品在线| 亚洲国产成人私人影院tom| 欧美不卡一二三| 欧美日韩mp4| 欧美另类videos死尸| 欧洲色大大久久| 色老汉一区二区三区| 成人激情黄色小说| 石原莉奈一区二区三区在线观看| 午夜影院在线观看欧美| 亚洲激情第一区| 亚洲色图.com| 亚洲国产精品久久一线不卡| 一区二区三区在线观看视频| 亚洲色图制服丝袜| 亚洲一区二区三区四区在线免费观看 | 91在线丨porny丨国产| 国产一区欧美日韩| 国产精品69久久久久水密桃| 国产盗摄精品一区二区三区在线 | 一区二区三区日韩在线观看| 亚洲天堂福利av| 一区二区三区中文字幕精品精品| 日韩精品三区四区| 久久99精品久久久久久久久久久久 | 国产乱子伦视频一区二区三区 | 国产乱码精品一区二区三区五月婷| 久久精品国产一区二区| 狠狠色丁香久久婷婷综合_中| 韩国精品免费视频| 欧美综合久久久| 日韩一级大片在线观看| 久久先锋资源网| 日韩欧美久久久| 国产欧美一区二区精品性色超碰 | 在线观看网站黄不卡| 日韩一区二区视频| 国产欧美日韩在线| 亚洲人吸女人奶水| 久久国产福利国产秒拍| 日本不卡一区二区| 国产福利一区二区三区在线视频| aaa国产一区| 精品视频免费在线| 精品欧美乱码久久久久久| 久久精品水蜜桃av综合天堂| 亚洲一区二区三区小说| 国内成人免费视频| 欧美少妇性性性| 国产精品电影院| 奇米四色…亚洲| 91蜜桃视频在线| 欧美国产精品v| 日本成人在线网站| 色婷婷久久久久swag精品| 欧美精品一区二区三区很污很色的| 国产精品人人做人人爽人人添 | 黄色日韩网站视频| av成人免费在线| 久久综合九色欧美综合狠狠| 秋霞电影网一区二区| 色综合中文字幕国产 | 欧美性xxxxxx少妇| 国产日韩精品久久久| 精品一区二区三区在线观看| 日本韩国欧美一区二区三区| 久久久噜噜噜久久人人看| 蜜臀av性久久久久av蜜臀妖精 | 99热在这里有精品免费| 2020国产成人综合网| 亚洲不卡一区二区三区| av在线播放不卡| 国产精品久久久一区麻豆最新章节| 美女www一区二区| 欧美日韩激情在线| 免费高清视频精品| 欧美精三区欧美精三区| 亚洲综合免费观看高清完整版在线 | 麻豆精品在线视频| 精品视频在线看| 美国毛片一区二区| 69精品人人人人| 亚洲成人777| 日韩久久久久久| 美女视频黄免费的久久| 日韩欧美国产1| 风间由美中文字幕在线看视频国产欧美| 51久久夜色精品国产麻豆| 亚洲第一在线综合网站| 日韩一级片在线观看| 蜜桃av一区二区在线观看| 91精品国产综合久久香蕉麻豆| 蜜臀久久99精品久久久久久9| 日韩美女一区二区三区四区| 精久久久久久久久久久| 中文字幕欧美一| 色哟哟日韩精品| 亚洲综合激情另类小说区| 精品乱码亚洲一区二区不卡| 国产美女主播视频一区| 国产精品动漫网站| 欧美军同video69gay| 久久国产精品色婷婷| 久久久久久久久久久99999| 99精品久久只有精品| 亚洲图片欧美视频| 欧美二区在线观看| 久久电影网电视剧免费观看| 久久九九全国免费| 99免费精品视频| 日韩在线观看一区二区| 5858s免费视频成人| 国产美女一区二区三区| 亚洲免费在线观看| 日韩精品影音先锋| 国产精品一区二区x88av| 亚洲免费观看视频| 欧美mv和日韩mv的网站| 91福利在线看| 国产乱对白刺激视频不卡| 亚洲视频一区二区在线观看| 日韩欧美在线影院| 一本大道av一区二区在线播放| 美腿丝袜亚洲综合| 亚洲欧美日韩国产成人精品影院| 欧美日韩亚洲综合| 波多野洁衣一区| 蜜桃视频一区二区三区| 久久先锋资源网| 日韩欧美国产wwwww| 色哟哟亚洲精品| 黑人精品欧美一区二区蜜桃| 亚洲天堂av一区| 久久久久国产精品厨房| 精品国产伦一区二区三区观看方式 | 亚洲午夜一二三区视频| 欧美精品一区二区蜜臀亚洲| 欧美精品 国产精品| 99精品视频一区| 国产剧情av麻豆香蕉精品| 91九色02白丝porn| 在线观看日韩一区| 国产丶欧美丶日本不卡视频| 成人国产视频在线观看| 亚洲黄一区二区三区| 99精品热视频| 日韩中文字幕麻豆| 午夜精品一区二区三区免费视频 | 亚洲人妖av一区二区| 日韩一区二区视频| 欧美日韩久久一区二区| 欧美美女一区二区| 在线看一区二区| 丁香亚洲综合激情啪啪综合| 成人一区在线看| 国产大片一区二区| 国产在线播放一区二区三区| 麻豆成人久久精品二区三区小说| 亚洲国产毛片aaaaa无费看| 国产精品毛片无遮挡高清| 亚洲欧洲精品一区二区精品久久久| 久久丝袜美腿综合| 欧美久久久影院| 久久久久国产精品厨房| 国产亚洲精品久| 久久综合99re88久久爱| 久久精品在线观看| 国产精品国产三级国产aⅴ入口 | 日本丰满少妇一区二区三区| 成人黄色电影在线| 欧美色图12p| 精品伦理精品一区| 国产精品激情偷乱一区二区∴| 一区二区三区在线免费视频| 日本视频在线一区| 国产99久久久精品| 欧美日韩精品电影| 国产三级精品三级在线专区| 一区二区在线观看视频| 麻豆成人免费电影| 91亚洲永久精品| 欧美mv日韩mv亚洲| 亚洲精品久久7777| 极品美女销魂一区二区三区| 99re6这里只有精品视频在线观看| 91 com成人网| 亚洲人成伊人成综合网小说| 人人狠狠综合久久亚洲| 99视频在线精品| 日韩精品一区国产麻豆| 亚洲天堂精品在线观看| 国产在线精品一区二区夜色| 欧美伊人久久久久久久久影院| 日本一区二区久久| 九九**精品视频免费播放|