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

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

?? cramfs_cb.c

?? 在win(2000/2003)下面制作CRAMFS映像文件 專門用于嵌入式Linux開發 由于網絡上沒有類似的軟件 索性自己寫了一個 經過測試OK 全部源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
                     (len-- == 0 ||
                      (begin[3] == '\0' &&
                       memcmp(begin, begin + 4, len) == 0))))))));
}
//---------------------------------------------------------
/*
 * One 4-byte pointer per block and then the actual blocked
 * output. The first block does not need an offset pointer,
 * as it will start immediately after the pointer block;
 * so the i'th pointer points to the end of the i'th block
 * (i.e. the start of the (i+1)'th block or past EOF).
 *
 * Note that size > 0, as a zero-sized file wouldn't ever
 * have gotten here in the first place.
 */
static unsigned int do_compress(char *base, unsigned int offset,
        char const *name, char *uncompressed, unsigned int size)
{
        unsigned long original_size = size;
        unsigned long original_offset = offset;
        unsigned long new_size;
        unsigned long blocks = (size - 1) / blksize + 1;
        unsigned long curr = offset + 4 * blocks;
        int change;

        total_blocks += blocks;

        do {
                unsigned long len = 2 * blksize;
                unsigned int input = size;
                int err;

                if (input > blksize)
                        input = blksize;
                size -= input;
                if (!(opt_holes && is_zero (uncompressed, input))) {
                        err = compress2(base + curr, &len, uncompressed, input, Z_BEST_COMPRESSION);
                        if (err != Z_OK) {
                                die(MKFS_ERROR, 0, "compression error: %s", zError(err));
                        }
                        curr += len;
                }
                uncompressed += input;

                if (len > blksize*2) {
                        /* (I don't think this can happen with zlib.) */
                        die(MKFS_ERROR, 0, "AIEEE: block \"compressed\" to > 2*blocklength (%ld)", len);
                }

                *(u32 *) (base + offset) = curr;
                offset += 4;
        } while (size);

        curr = (curr + 3) & ~3;
        new_size = curr - original_offset;
        /* TODO: Arguably, original_size in these 2 lines should be
           st_blocks * 512.  But if you say that then perhaps
           administrative data should also be included in both. */
           
        change = new_size - original_size;
        if (opt_verbose > 1) {
                printf("%6.2f%% (%+d bytes)\t%s\n",
                       (change * 100) / (double) original_size, change, name);
        }

        return curr;
}
//---------------------------------------------------------
/*
 * Traverse the entry tree, writing data for every item that has
 * non-null entry->path (i.e. every non-empty regfile) and non-null
 * entry->uncompressed (i.e. every symlink).
 */
static unsigned int write_data(struct entry *entry, char *base, unsigned int offset)
{
        do {
                if (entry->path || entry->uncompressed) {
                        if (entry->same) {
                                set_data_offset(entry, base, entry->same->offset);
                                entry->offset = entry->same->offset;
                        }
                        else {
                                set_data_offset(entry, base, offset);
                                entry->offset = offset;
                                map_entry(entry);
                                offset = do_compress(base, offset, entry->name,
                                        (char *)entry->uncompressed, entry->size);
                                unmap_entry(entry);
                        }
                }
                else if (entry->child)
                        offset = write_data(entry->child, base, offset);
                entry=entry->next;
        } while (entry);
        return offset;
}
//---------------------------------------------------------
static unsigned int write_file(char *file, char *base, unsigned int offset)
{
        /*
        int fd;
        char *buf;

        fd = open(file, O_RDONLY);
        if (fd < 0) {
                die(MKFS_ERROR, 1, "open failed: %s", file);
        }
        buf = mmap(NULL, image_length, PROT_READ, MAP_PRIVATE, fd, 0);
        if (buf == MAP_FAILED) {
                die(MKFS_ERROR, 1, "mmap failed");
        }
        memcpy(base + offset, buf, image_length);
        munmap(buf, image_length);
        close (fd);
        */

        HANDLE fh;
        HANDLE fm;
        char *buf;

        DWORD Access = GENERIC_READ;
        DWORD AShare = FILE_SHARE_READ;
        DWORD Create = OPEN_EXISTING;
        DWORD Attrib = FILE_FLAG_SEQUENTIAL_SCAN;

        fh = CreateFile(file, Access, AShare, 0, Create, Attrib, 0);

        if(fh == INVALID_HANDLE_VALUE)
        {
                die(MKFS_ERROR, 1, "open failed: %s", file);
        }

        fm = CreateFileMapping(fh, NULL, PAGE_READONLY, 0, image_length, NULL);

        if(fm == INVALID_HANDLE_VALUE)
        {
                die(MKFS_ERROR, 1, "fmap failed: %s", file);
        }

        buf = (char *)MapViewOfFile(fm, FILE_MAP_READ, 0, 0, image_length);

        if(buf == NULL)
        {
                die(MKFS_ERROR, 1, "mapv failed: %s", file);
        }

        memcpy(base + offset, buf, image_length);

        UnmapViewOfFile(buf);

        CloseHandle(fm);
        CloseHandle(fh);

        /* Pad up the image_length to a 4-byte boundary */
        while (image_length & 3) {
                *(base + offset + image_length) = '\0';
                image_length++;
        }
        return (offset + image_length);
}
//---------------------------------------------------------
void _main(const char *dirname, const char *outfile)
{
        struct stat st;         /* used twice... */
        struct entry *root_entry;
        char *rom_image;
        DWORD offset, written;
        int fd;
        /* initial guess (upper-bound) of required filesystem size */
        DWORD fslen_ub = sizeof(struct cramfs_super);
        //char const *dirname, *outfile;
        u32 crc;
        int c;                  /* for getopt */
        char *ep;               /* for strtoul */

        total_blocks = 0;

        progname = "make_cramfs";//argv[0];

        if (lstat(dirname, &st) < 0) {
                die(MKFS_USAGE, 1, "stat failed: %s", dirname);
        }

        //fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
        fd = FileCreate(outfile);
        if (fd < 0) {
                die(MKFS_USAGE, 1, "open failed: %s", outfile);
        }

        root_entry = (struct entry *)calloc(1, sizeof(struct entry));
        if (!root_entry) {
                die(MKFS_ERROR, 1, "calloc failed");
        }
        root_entry->mode = st.st_mode;
        root_entry->uid = st.st_uid;
        root_entry->gid = st.st_gid;

        root_entry->size = parse_directory(root_entry,
            dirname, &root_entry->child, (unsigned int *)&fslen_ub);

        /* always allocate a multiple of blksize bytes because that's
           what we're going to write later on */
        fslen_ub = ((fslen_ub - 1) | (blksize - 1)) + 1;

        if (fslen_ub > MAXFSLEN) {
                fprintf(stderr,
                        "warning: estimate of required size (upper bound) is %LdMB, but maximum image size is %uMB, we might die prematurely\n",
                        fslen_ub >> 20,
                        MAXFSLEN >> 20);
                fslen_ub = MAXFSLEN;
        }

        /* find duplicate files. TODO: uses the most inefficient algorithm
           possible. */
        eliminate_doubles(root_entry, root_entry);

        /* TODO: Why do we use a private/anonymous mapping here
           followed by a write below, instead of just a shared mapping
           and a couple of ftruncate calls?  Is it just to save us
           having to deal with removing the file afterwards?  If we
           really need this huge anonymous mapping, we ought to mmap
           in smaller chunks, so that the user doesn't need nn MB of
           RAM free.  If the reason is to be able to write to
           un-mmappable block devices, then we could try shared mmap
           and revert to anonymous mmap if the shared mmap fails. */
        //rom_image = mmap(NULL, fslen_ub?fslen_ub:1, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

        //if (rom_image == MAP_FAILED) {
        //      die(MKFS_ERROR, 1, "mmap failed");
        //}
        HANDLE fm;

        fm = CreateFileMapping(INVALID_HANDLE_VALUE, NULL,
                PAGE_READWRITE, 0, fslen_ub ? fslen_ub : 1, NULL);

        if(fm == INVALID_HANDLE_VALUE)
        {
                die(MKFS_ERROR, 1, "mmap failed");
        }

        rom_image = (char *)MapViewOfFile(fm,
                FILE_MAP_ALL_ACCESS, 0, 0, fslen_ub ? fslen_ub  : 1);

        if(rom_image == NULL)
        {
                die(MKFS_ERROR, 1, "mapv failed");
        }

        /* Skip the first opt_pad bytes for boot loader code */
        offset = opt_pad;
        memset(rom_image, 0x00, opt_pad);

        /* Skip the superblock and come back to write it later. */
        offset += sizeof(struct cramfs_super);

        /* Insert a file image. */
        if (opt_image) {
                printf("Including: %s\n", opt_image);
                offset = write_file(opt_image, rom_image, offset);
        }

        offset = write_directory_structure(root_entry->child, rom_image, offset);
        printf("Directory data: %d bytes\n", offset);

        offset = write_data(root_entry, rom_image, offset);

        /* We always write a multiple of blksize bytes, so that
           losetup works. */
        offset = ((offset - 1) | (blksize - 1)) + 1;
        printf("Everything: %d kilobytes\n", offset >> 10);

        /* Write the superblock now that we can fill in all of the fields. */
        write_superblock(root_entry, rom_image+opt_pad, offset);
        printf("Super block: %d bytes\n", sizeof(struct cramfs_super));

        /* Put the checksum in. */
        crc = crc32(0L, Z_NULL, 0);
        crc = crc32(crc, (rom_image+opt_pad), (offset-opt_pad));
        ((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = crc;
        printf("CRC: %x\n", crc);

        /* Check to make sure we allocated enough space. */
        if (fslen_ub < offset) {
                die(MKFS_ERROR, 0, "not enough space allocated for ROM image (%Ld allocated, %d used)", fslen_ub, offset);
        }

        //written = write(fd, rom_image, offset);
        written = FileWrite(fd, rom_image, offset);
        if (written < 0) {
                die(MKFS_ERROR, 1, "write failed");
        }
        if (offset != written) {
                die(MKFS_ERROR, 0, "ROM image write failed (wrote %d of %d bytes)", written, offset);
        }

        UnmapViewOfFile(rom_image);
        CloseHandle(fm);

        FileClose(fd);

//      /* (These warnings used to come at the start, but they scroll off the
//         screen too quickly.) */
//      if (warn_namelen)
//              fprintf(stderr, /* bytes, not chars: think UTF-8. */
//                      "warning: filenames truncated to %d bytes (possibly less if multi-byte UTF-8)\n",
//                      CRAMFS_MAXPATHLEN);
//      if (warn_skip)
//              fprintf(stderr, "warning: files were skipped due to errors\n");
//      if (warn_size)
//              fprintf(stderr,
//                      "warning: file sizes truncated to %luMB (minus 1 byte)\n",
//                      1L << (CRAMFS_SIZE_WIDTH - 20));
//      if (warn_uid) /* (not possible with current Linux versions) */
//              fprintf(stderr,
//                      "warning: uids truncated to %u bits (this may be a security concern)\n",
//                      CRAMFS_UID_WIDTH);
//      if (warn_gid)
//              fprintf(stderr,
//                      "warning: gids truncated to %u bits (this may be a security concern)\n",
//                      CRAMFS_GID_WIDTH);
//      if (warn_dev)
//              fprintf(stderr,
//                      "WARNING: device numbers truncated to %u bits (this almost certainly means\n"
//                      "that some device files will be wrong)\n",
//                      CRAMFS_OFFSET_WIDTH);
//      if (opt_errors &&
//          (warn_namelen||warn_skip||warn_size||warn_uid||warn_gid||warn_dev))
//              exit(MKFS_ERROR);
//
//      exit(MKFS_OK);
}
//---------------------------------------------------------
#endif//CRAMFS_CB_C

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品激情偷乱一区二区∴| 自拍偷拍欧美激情| 亚洲一区免费在线观看| 欧美综合一区二区| 亚洲18色成人| 日韩视频不卡中文| 韩国av一区二区三区| 国产亚洲成年网址在线观看| 国产 欧美在线| 自拍偷拍欧美激情| 久久免费精品国产久精品久久久久 | 精品精品国产高清一毛片一天堂| 蜜臀av一区二区三区| 久久久久久麻豆| 成人av资源在线| 亚洲综合色成人| 69p69国产精品| 精品在线一区二区三区| 欧美经典三级视频一区二区三区| 99久久精品一区| 亚洲福利一区二区| 欧美mv日韩mv国产| 成人免费视频一区| 亚洲高清视频中文字幕| 欧美r级在线观看| 欧洲亚洲精品在线| 88在线观看91蜜桃国自产| 爽好久久久欧美精品| 日韩精品中文字幕在线一区| 成人免费视频一区二区| 亚洲一区二区三区视频在线| 日韩精品中文字幕在线一区| 成人午夜精品在线| 天天综合天天综合色| 久久精品亚洲国产奇米99| 在线中文字幕不卡| 久久成人av少妇免费| 亚洲天堂av一区| 日韩欧美国产麻豆| 一本色道久久综合精品竹菊 | 亚洲一区二区三区在线播放| 精品久久久久久亚洲综合网| 91成人国产精品| 成人中文字幕在线| 免费视频一区二区| 国产传媒久久文化传媒| 香蕉久久一区二区不卡无毒影院 | 久久草av在线| 国产精品免费丝袜| 日韩情涩欧美日韩视频| 色欧美88888久久久久久影院| 国产九九视频一区二区三区| 视频一区二区三区中文字幕| 亚洲日本韩国一区| 国产日韩成人精品| 日韩欧美在线一区二区三区| 在线精品视频免费播放| 成人国产一区二区三区精品| 精品亚洲国内自在自线福利| 视频在线观看91| 一区二区三区在线视频观看58| 国产欧美一区二区在线观看| 精品美女在线播放| 欧美一区二区三区四区五区| 欧美日韩综合在线| 一本色道久久综合狠狠躁的推荐| 国产 日韩 欧美大片| 精品一区二区三区免费毛片爱 | 激情综合网激情| 蜜臀av一区二区在线免费观看| 中文字幕在线一区| 日韩精品中午字幕| 欧美一区二区三区电影| 欧美日韩亚洲综合一区| 欧美中文字幕一区| 日本韩国精品在线| 91美女在线观看| 91色.com| 色网综合在线观看| 色婷婷国产精品| 91婷婷韩国欧美一区二区| 成人性生交大片免费看中文 | 美腿丝袜在线亚洲一区 | 欧美日韩国产一区二区三区地区| 成人一二三区视频| 欧美一区二区在线不卡| 欧美日韩大陆一区二区| 欧美精品1区2区| 91精品国产91热久久久做人人| 91精品国产乱码| 精品久久久久久久一区二区蜜臀| 精品免费视频一区二区| 久久免费电影网| 国产精品久久久久影院| |精品福利一区二区三区| 一区二区免费视频| 日韩专区欧美专区| 极品瑜伽女神91| 成人综合激情网| 日本精品视频一区二区三区| 欧美三级一区二区| 日韩美女一区二区三区四区| 国产色综合久久| 亚洲欧美电影院| 日韩黄色一级片| 国内一区二区视频| www.亚洲激情.com| 欧美男女性生活在线直播观看| 欧美一区二区三区日韩视频| 久久精品视频免费| 夜夜精品浪潮av一区二区三区| 日韩成人av影视| 高清不卡一区二区| 欧美丝袜丝交足nylons| 日韩免费高清电影| 中文字幕日韩欧美一区二区三区| 亚洲国产精品久久人人爱蜜臀 | 成人av在线观| 欧美精品免费视频| 日本一区二区三区电影| 一区二区三区国产精华| 精品中文av资源站在线观看| 91丨porny丨首页| 国产精品自在在线| 国产在线精品一区二区夜色 | 国产盗摄一区二区三区| 在线视频国产一区| 久久伊人蜜桃av一区二区| 亚洲丝袜制服诱惑| 黄一区二区三区| 欧日韩精品视频| 国产亚洲精品aa午夜观看| 亚洲444eee在线观看| 国产精品小仙女| 欧美一区二区三区小说| 亚洲欧美一区二区三区久本道91| 久久国产麻豆精品| 欧美日韩一区二区三区免费看| 国产日韩视频一区二区三区| 日本亚洲视频在线| 91福利在线观看| 国产精品伦理一区二区| 久久精品国产77777蜜臀| 欧美综合在线视频| 国产精品天天摸av网| 激情久久五月天| 在线播放国产精品二区一二区四区| 美国十次了思思久久精品导航| 成人综合在线观看| 精品国产一区二区三区av性色| 亚洲综合激情另类小说区| 成人午夜精品在线| 26uuu精品一区二区三区四区在线| 午夜精品视频在线观看| 91麻豆国产精品久久| 国产精品系列在线| 高清shemale亚洲人妖| 久久久噜噜噜久久人人看 | 91精品久久久久久蜜臀| 一区二区三区av电影| 91视频在线观看| 日韩理论片网站| 99视频在线精品| 亚洲欧美一区二区在线观看| 粉嫩aⅴ一区二区三区四区 | 久久久亚洲精品石原莉奈| 精品制服美女丁香| 精品美女在线观看| 国产一区在线不卡| 久久亚洲精华国产精华液 | 99v久久综合狠狠综合久久| 狠狠色综合日日| 69久久夜色精品国产69蝌蚪网| 亚洲图片有声小说| 欧洲精品一区二区| 亚洲一区二区三区免费视频| 欧美日韩中文国产| 亚洲国产精品影院| 在线不卡一区二区| 美女高潮久久久| 久久久久免费观看| 国产xxx精品视频大全| 国产精品久久久爽爽爽麻豆色哟哟| 不卡影院免费观看| 亚洲精品欧美二区三区中文字幕| 91久久国产综合久久| 午夜视频一区在线观看| 日韩一级视频免费观看在线| 国产一区二区在线影院| 欧美激情一区二区三区不卡| 一本色道久久综合亚洲精品按摩| 亚洲国产一区二区视频| 日韩欧美在线综合网| 国产91在线看| 亚洲一二三级电影| 精品免费日韩av| 9i在线看片成人免费| 亚洲高清免费一级二级三级| 精品国一区二区三区| 91在线观看视频|