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

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

?? block-vvfat.c

?? QEMU 0.91 source code, supports ARM processor including S3C24xx series
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* vim:set shiftwidth=4 ts=8: *//* * QEMU Block driver for virtual VFAT (shadows a local directory) * * Copyright (c) 2004,2005 Johannes E. Schindelin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */#include <sys/stat.h>#include <dirent.h>#include <assert.h>#include "qemu-common.h"#include "block_int.h"#ifndef S_IWGRP#define S_IWGRP 0#endif#ifndef S_IWOTH#define S_IWOTH 0#endif/* TODO: add ":bootsector=blabla.img:" *//* LATER TODO: add automatic boot sector generation from    BOOTEASY.ASM and Ranish Partition Manager    Note that DOS assumes the system files to be the first files in the    file system (test if the boot sector still relies on that fact)! *//* MAYBE TODO: write block-visofs.c *//* TODO: call try_commit() only after a timeout *//* #define DEBUG */#ifdef DEBUG#define DLOG(a) a#undef stderr#define stderr STDERRFILE* stderr = NULL;static void checkpoint();#ifdef __MINGW32__void nonono(const char* file, int line, const char* msg) {    fprintf(stderr, "Nonono! %s:%d %s\n", file, line, msg);    exit(-5);}#undef assert#define assert(a) do {if (!(a)) nonono(__FILE__, __LINE__, #a);}while(0)#endif#else#define DLOG(a)#endif/* dynamic array functions */typedef struct array_t {    char* pointer;    unsigned int size,next,item_size;} array_t;static inline void array_init(array_t* array,unsigned int item_size){    array->pointer=0;    array->size=0;    array->next=0;    array->item_size=item_size;}static inline void array_free(array_t* array){    if(array->pointer)        free(array->pointer);    array->size=array->next=0;}/* does not automatically grow */static inline void* array_get(array_t* array,unsigned int index) {    assert(index >= 0);    assert(index < array->next);    return array->pointer + index * array->item_size;}static inline int array_ensure_allocated(array_t* array, int index){    if((index + 1) * array->item_size > array->size) {	int new_size = (index + 32) * array->item_size;	array->pointer = realloc(array->pointer, new_size);	if (!array->pointer)	    return -1;	array->size = new_size;	array->next = index + 1;    }    return 0;}static inline void* array_get_next(array_t* array) {    unsigned int next = array->next;    void* result;    if (array_ensure_allocated(array, next) < 0)	return NULL;    array->next = next + 1;    result = array_get(array, next);    return result;}static inline void* array_insert(array_t* array,unsigned int index,unsigned int count) {    if((array->next+count)*array->item_size>array->size) {	int increment=count*array->item_size;	array->pointer=realloc(array->pointer,array->size+increment);	if(!array->pointer)	    return 0;	array->size+=increment;    }    memmove(array->pointer+(index+count)*array->item_size,		array->pointer+index*array->item_size,		(array->next-index)*array->item_size);    array->next+=count;    return array->pointer+index*array->item_size;}/* this performs a "roll", so that the element which was at index_from becomes * index_to, but the order of all other elements is preserved. */static inline int array_roll(array_t* array,int index_to,int index_from,int count){    char* buf;    char* from;    char* to;    int is;    if(!array ||	    index_to<0 || index_to>=array->next ||	    index_from<0 || index_from>=array->next)	return -1;    if(index_to==index_from)	return 0;    is=array->item_size;    from=array->pointer+index_from*is;    to=array->pointer+index_to*is;    buf=malloc(is*count);    memcpy(buf,from,is*count);    if(index_to<index_from)	memmove(to+is*count,to,from-to);    else	memmove(from,from+is*count,to-from);    memcpy(to,buf,is*count);    free(buf);    return 0;}static inline int array_remove_slice(array_t* array,int index, int count){    assert(index >=0);    assert(count > 0);    assert(index + count <= array->next);    if(array_roll(array,array->next-1,index,count))	return -1;    array->next -= count;    return 0;}static int array_remove(array_t* array,int index){    return array_remove_slice(array, index, 1);}/* return the index for a given member */static int array_index(array_t* array, void* pointer){    size_t offset = (char*)pointer - array->pointer;    assert(offset >= 0);    assert((offset % array->item_size) == 0);    assert(offset/array->item_size < array->next);    return offset/array->item_size;}/* These structures are used to fake a disk and the VFAT filesystem. * For this reason we need to use __attribute__((packed)). */typedef struct bootsector_t {    uint8_t jump[3];    uint8_t name[8];    uint16_t sector_size;    uint8_t sectors_per_cluster;    uint16_t reserved_sectors;    uint8_t number_of_fats;    uint16_t root_entries;    uint16_t total_sectors16;    uint8_t media_type;    uint16_t sectors_per_fat;    uint16_t sectors_per_track;    uint16_t number_of_heads;    uint32_t hidden_sectors;    uint32_t total_sectors;    union {        struct {	    uint8_t drive_number;	    uint8_t current_head;	    uint8_t signature;	    uint32_t id;	    uint8_t volume_label[11];	} __attribute__((packed)) fat16;	struct {	    uint32_t sectors_per_fat;	    uint16_t flags;	    uint8_t major,minor;	    uint32_t first_cluster_of_root_directory;	    uint16_t info_sector;	    uint16_t backup_boot_sector;	    uint16_t ignored;	} __attribute__((packed)) fat32;    } u;    uint8_t fat_type[8];    uint8_t ignored[0x1c0];    uint8_t magic[2];} __attribute__((packed)) bootsector_t;typedef struct {    uint8_t head;    uint8_t sector;    uint8_t cylinder;} mbr_chs_t;typedef struct partition_t {    uint8_t attributes; /* 0x80 = bootable */    mbr_chs_t start_CHS;    uint8_t   fs_type; /* 0x1 = FAT12, 0x6 = FAT16, 0xe = FAT16_LBA, 0xb = FAT32, 0xc = FAT32_LBA */    mbr_chs_t end_CHS;    uint32_t start_sector_long;    uint32_t length_sector_long;} __attribute__((packed)) partition_t;typedef struct mbr_t {    uint8_t ignored[0x1b8];    uint32_t nt_id;    uint8_t ignored2[2];    partition_t partition[4];    uint8_t magic[2];} __attribute__((packed)) mbr_t;typedef struct direntry_t {    uint8_t name[8];    uint8_t extension[3];    uint8_t attributes;    uint8_t reserved[2];    uint16_t ctime;    uint16_t cdate;    uint16_t adate;    uint16_t begin_hi;    uint16_t mtime;    uint16_t mdate;    uint16_t begin;    uint32_t size;} __attribute__((packed)) direntry_t;/* this structure are used to transparently access the files */typedef struct mapping_t {    /* begin is the first cluster, end is the last+1 */    uint32_t begin,end;    /* as s->directory is growable, no pointer may be used here */    unsigned int dir_index;    /* the clusters of a file may be in any order; this points to the first */    int first_mapping_index;    union {	/* offset is	 * - the offset in the file (in clusters) for a file, or	 * - the next cluster of the directory for a directory, and	 * - the address of the buffer for a faked entry	 */	struct {	    uint32_t offset;	} file;	struct {	    int parent_mapping_index;	    int first_dir_index;	} dir;    } info;    /* path contains the full path, i.e. it always starts with s->path */    char* path;    enum { MODE_UNDEFINED = 0, MODE_NORMAL = 1, MODE_MODIFIED = 2,	MODE_DIRECTORY = 4, MODE_FAKED = 8,	MODE_DELETED = 16, MODE_RENAMED = 32 } mode;    int read_only;} mapping_t;#ifdef DEBUGstatic void print_direntry(const struct direntry_t*);static void print_mapping(const struct mapping_t* mapping);#endif/* here begins the real VVFAT driver */typedef struct BDRVVVFATState {    BlockDriverState* bs; /* pointer to parent */    unsigned int first_sectors_number; /* 1 for a single partition, 0x40 for a disk with partition table */    unsigned char first_sectors[0x40*0x200];    int fat_type; /* 16 or 32 */    array_t fat,directory,mapping;    unsigned int cluster_size;    unsigned int sectors_per_cluster;    unsigned int sectors_per_fat;    unsigned int sectors_of_root_directory;    uint32_t last_cluster_of_root_directory;    unsigned int faked_sectors; /* how many sectors are faked before file data */    uint32_t sector_count; /* total number of sectors of the partition */    uint32_t cluster_count; /* total number of clusters of this partition */    uint32_t max_fat_value;    int current_fd;    mapping_t* current_mapping;    unsigned char* cluster; /* points to current cluster */    unsigned char* cluster_buffer; /* points to a buffer to hold temp data */    unsigned int current_cluster;    /* write support */    BlockDriverState* write_target;    char* qcow_filename;    BlockDriverState* qcow;    void* fat2;    char* used_clusters;    array_t commits;    const char* path;    int downcase_short_names;} BDRVVVFATState;/* take the sector position spos and convert it to Cylinder/Head/Sector position * if the position is outside the specified geometry, fill maximum value for CHS * and return 1 to signal overflow. */static int sector2CHS(BlockDriverState* bs, mbr_chs_t * chs, int spos){    int head,sector;    sector   = spos % (bs->secs);  spos/= bs->secs;    head     = spos % (bs->heads); spos/= bs->heads;    if(spos >= bs->cyls){        /* Overflow,        it happens if 32bit sector positions are used, while CHS is only 24bit.        Windows/Dos is said to take 1023/255/63 as nonrepresentable CHS */        chs->head     = 0xFF;        chs->sector   = 0xFF;        chs->cylinder = 0xFF;        return 1;    }    chs->head     = (uint8_t)head;    chs->sector   = (uint8_t)( (sector+1) | ((spos>>8)<<6) );    chs->cylinder = (uint8_t)spos;    return 0;}static void init_mbr(BDRVVVFATState* s){    /* TODO: if the files mbr.img and bootsect.img exist, use them */    mbr_t* real_mbr=(mbr_t*)s->first_sectors;    partition_t* partition=&(real_mbr->partition[0]);    int lba;    memset(s->first_sectors,0,512);    /* Win NT Disk Signature */    real_mbr->nt_id= cpu_to_le32(0xbe1afdfa);    partition->attributes=0x80; /* bootable */    /* LBA is used when partition is outside the CHS geometry */    lba = sector2CHS(s->bs, &partition->start_CHS, s->first_sectors_number-1);    lba|= sector2CHS(s->bs, &partition->end_CHS,   s->sector_count);    /*LBA partitions are identified only by start/length_sector_long not by CHS*/    partition->start_sector_long =cpu_to_le32(s->first_sectors_number-1);    partition->length_sector_long=cpu_to_le32(s->sector_count - s->first_sectors_number+1);    /* FAT12/FAT16/FAT32 */    /* DOS uses different types when partition is LBA,       probably to prevent older versions from using CHS on them */    partition->fs_type= s->fat_type==12 ? 0x1:                        s->fat_type==16 ? (lba?0xe:0x06):                         /*fat_tyoe==32*/ (lba?0xc:0x0b);    real_mbr->magic[0]=0x55; real_mbr->magic[1]=0xaa;}/* direntry functions *//* dest is assumed to hold 258 bytes, and pads with 0xffff up to next multiple of 26 */static inline int short2long_name(char* dest,const char* src){    int i;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人精品亚洲午夜麻豆| 成人av午夜影院| 国产精品丝袜久久久久久app| 91丨九色丨蝌蚪丨老版| 久久精品国产精品亚洲精品| 亚洲欧美日本在线| 久久综合九色综合久久久精品综合| 在线免费观看日本一区| 国产一区二区剧情av在线| 亚洲成人免费在线| 亚洲欧洲av另类| 久久免费精品国产久精品久久久久| 日本道精品一区二区三区| 国产精品91一区二区| 日韩不卡一区二区| 亚洲乱码国产乱码精品精小说| 久久综合丝袜日本网| 欧美一级欧美三级| 在线国产电影不卡| 91同城在线观看| jiyouzz国产精品久久| 国产一区二区三区免费看| 奇米色一区二区三区四区| 亚洲国产一二三| 成人欧美一区二区三区白人 | 成人av在线看| 国产精品456露脸| 国产一区二区福利| 免费成人在线观看| 奇米888四色在线精品| 亚洲成a人v欧美综合天堂| 亚洲精品久久嫩草网站秘色| 国产精品成人免费精品自在线观看 | 国产精品区一区二区三| 久久综合色天天久久综合图片| 欧美不卡一区二区| 欧美成人在线直播| 亚洲午夜私人影院| 亚洲综合色在线| 亚洲国产一二三| 亚洲成a人v欧美综合天堂下载| 亚洲午夜一二三区视频| 亚洲一区二区三区在线看| 亚洲精品一二三四区| 亚洲欧洲综合另类在线| 亚洲精选视频免费看| 亚洲男同性恋视频| 亚洲国产日韩在线一区模特| 亚洲国产色一区| 日本成人中文字幕| 久久99精品国产麻豆婷婷| 国产乱淫av一区二区三区| 国产成人一区二区精品非洲| 大胆亚洲人体视频| 色94色欧美sute亚洲线路二| 欧美综合天天夜夜久久| 欧美日韩一区久久| 欧美一级在线视频| 久久久久久毛片| 国产精品毛片a∨一区二区三区| 中文字幕一区二区视频| 亚洲激情第一区| 奇米亚洲午夜久久精品| 高清国产一区二区| 在线观看国产精品网站| 欧美高清视频一二三区| 精品久久久久久久久久久久久久久| 国产亚洲欧美日韩在线一区| 亚洲欧美视频在线观看| 偷拍日韩校园综合在线| 狠狠v欧美v日韩v亚洲ⅴ| 粉嫩13p一区二区三区| 欧洲一区在线电影| 日韩精品中文字幕一区二区三区| 国产亚洲综合在线| 亚洲专区一二三| 精品一二线国产| 一本到一区二区三区| 日韩女优电影在线观看| 国产精品久久777777| 天天av天天翘天天综合网色鬼国产 | 亚洲小说欧美激情另类| 久久 天天综合| 91麻豆123| 欧美www视频| 一区二区三区在线看| 极品美女销魂一区二区三区免费| heyzo一本久久综合| 欧美本精品男人aⅴ天堂| 亚洲欧美日本韩国| 国产一区欧美一区| 欧美性受xxxx| 国产精品久久久久久久蜜臀| 日本在线不卡视频| 色婷婷国产精品久久包臀| 久久久www成人免费无遮挡大片 | 国产伦精品一区二区三区视频青涩| 色综合亚洲欧洲| 久久这里只有精品6| 天堂成人国产精品一区| 成人午夜电影网站| 日韩你懂的在线播放| 亚洲综合在线免费观看| 国产成人av电影在线播放| 在线成人免费观看| www..com久久爱| 精品国产1区2区3区| 亚洲国产一区在线观看| 99久久精品免费看| 精品国产一区a| 男人操女人的视频在线观看欧美| 色噜噜狠狠色综合欧洲selulu| 久久久久久**毛片大全| 奇米色一区二区| 7777精品久久久大香线蕉| 伊人色综合久久天天人手人婷| 国产a精品视频| 久久精品视频在线免费观看| 秋霞电影网一区二区| 欧美在线小视频| 亚洲婷婷综合久久一本伊一区| 国产精品影视网| 久久亚洲一级片| 久久av资源网| 欧美电影精品一区二区| 日韩高清中文字幕一区| 欧美美女黄视频| 五月激情综合婷婷| 欧美日韩国产综合视频在线观看| 亚洲美女视频一区| 91蜜桃视频在线| 中文字幕一区二区在线观看| 国产 欧美在线| 国产精品视频第一区| 成人在线一区二区三区| 欧美国产亚洲另类动漫| 丁香激情综合国产| 中文字幕一区二区三区四区不卡| 成人网在线播放| 国产精品麻豆久久久| 成人精品免费网站| 亚洲欧美在线另类| 91麻豆精东视频| 亚洲午夜在线视频| 欧美一级生活片| 久久激情五月婷婷| 国产亚洲一区二区三区在线观看| 国产成人免费av在线| 中文天堂在线一区| 91在线观看免费视频| 亚洲午夜在线视频| 91麻豆精品国产| 国产制服丝袜一区| 中文字幕免费观看一区| 99国产欧美另类久久久精品| 一区二区三区不卡视频| 欧美日韩亚州综合| 国产真实乱偷精品视频免| 国产欧美久久久精品影院| 99久久国产综合精品色伊| 一区二区三区蜜桃| 91精品国产色综合久久久蜜香臀| 精久久久久久久久久久| 国产精品美女一区二区| 91久久精品日日躁夜夜躁欧美| 五月激情六月综合| 欧美激情艳妇裸体舞| 欧美天堂一区二区三区| 日韩国产欧美在线播放| 国产视频一区在线播放| 91在线精品一区二区| 午夜影院久久久| 国产日产欧产精品推荐色 | 9191精品国产综合久久久久久| 国产一区二区三区香蕉| 专区另类欧美日韩| 日韩欧美电影在线| 色哟哟欧美精品| 精品一区二区三区免费观看| 亚洲精选视频在线| 精品成人a区在线观看| 94色蜜桃网一区二区三区| 热久久国产精品| 中文字幕中文字幕一区| 肉丝袜脚交视频一区二区| 久久综合999| 欧美日韩国产片| 成人午夜在线视频| 免费成人av在线播放| 亚洲色图欧美在线| 精品久久久久久久人人人人传媒| 色婷婷综合久久久| 国产乱码精品一区二区三区av| 亚洲成人一二三| 最新欧美精品一区二区三区| 日韩精品一区二区三区三区免费| 91福利在线免费观看| 懂色av中文字幕一区二区三区| 日本成人中文字幕在线视频| 亚洲男人天堂av|