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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清免费视频| 国产成a人亚洲| 裸体一区二区三区| 成人免费看的视频| 欧美日韩国产首页| 亚洲国产激情av| 欧美a级一区二区| 97se亚洲国产综合在线| 日韩精品一区二| 一区二区在线免费观看| 韩日精品视频一区| 欧美日韩精品综合在线| 日本一区二区三区国色天香| 五月天婷婷综合| av一区二区三区黑人| 日韩一区二区三区电影| 一区二区在线观看视频在线观看| 国产在线不卡视频| 欧美人与z0zoxxxx视频| 中文字幕一区二区5566日韩| 另类综合日韩欧美亚洲| 欧美三级在线看| 国产精品区一区二区三区| 久久精品国产99| 337p亚洲精品色噜噜狠狠| 亚洲欧洲www| 成人中文字幕电影| 久久美女高清视频| 老司机免费视频一区二区三区| 91一区二区在线| 国产日本一区二区| 久久国产精品99久久人人澡| 欧美喷潮久久久xxxxx| 一区二区三区精品在线| 91在线免费视频观看| 国产精品欧美久久久久无广告 | 亚洲国产精品成人综合| 日韩影院在线观看| 欧美亚洲动漫精品| 亚洲精品欧美在线| 97aⅴ精品视频一二三区| 中文字幕欧美国产| 国产99精品国产| 国产偷国产偷精品高清尤物| 激情亚洲综合在线| 精品理论电影在线观看 | 美日韩一级片在线观看| 欧美日韩一卡二卡| 亚洲综合精品自拍| 欧美在线观看禁18| 午夜亚洲福利老司机| 欧美色成人综合| 三级欧美在线一区| 日韩欧美中文一区| 久久国产乱子精品免费女| 日韩欧美另类在线| 国产精品一区二区在线观看网站 | 亚洲国产精品麻豆| 欧美日韩和欧美的一区二区| 亚洲成人一区二区| 91超碰这里只有精品国产| 肉丝袜脚交视频一区二区| 日韩一区二区三| 麻豆91在线播放免费| 国产亚洲精品7777| 91丨九色丨蝌蚪丨老版| 一区二区三区蜜桃| 日韩三级高清在线| 国产成人精品免费网站| 亚洲日本韩国一区| 欧美精品v国产精品v日韩精品| 人人爽香蕉精品| 国产欧美中文在线| 色999日韩国产欧美一区二区| 亚洲国产精品久久久久秋霞影院| 欧美妇女性影城| 国产**成人网毛片九色| 亚洲综合免费观看高清在线观看| 制服视频三区第一页精品| 精品亚洲欧美一区| 亚洲日本成人在线观看| 69精品人人人人| 国产成人精品一区二区三区网站观看| 中文字幕制服丝袜成人av| 欧美日韩在线播放| 国产精品主播直播| 亚洲一区二区三区小说| 精品国产精品网麻豆系列| 91麻豆视频网站| 狠狠色丁香久久婷婷综合丁香| 国产精品久久久久久久久免费樱桃| 91丨九色丨蝌蚪丨老版| 美女看a上一区| 悠悠色在线精品| 久久夜色精品一区| 欧美日韩精品一区二区天天拍小说 | 成人一区在线观看| 亚洲动漫第一页| 久久久久成人黄色影片| 欧美日韩在线不卡| 成人av综合在线| 裸体一区二区三区| 亚洲一区二区三区视频在线播放| 久久久久久久久99精品| 欧美视频一区二区| 99国产精品久久久久| 国产一区二区在线观看视频| 亚洲va欧美va人人爽午夜| 国产日韩欧美a| 精品日韩欧美一区二区| 欧美日韩免费高清一区色橹橹 | 国产精品热久久久久夜色精品三区| 欧美巨大另类极品videosbest| 成人网男人的天堂| 免费久久精品视频| 亚洲国产精品嫩草影院| 最新不卡av在线| 久久久久久久网| 欧美成人女星排行榜| 在线不卡免费av| 欧美日韩一区二区在线观看| 97精品久久久午夜一区二区三区| 久久se精品一区二区| 午夜a成v人精品| 亚洲成人av免费| 亚洲综合色婷婷| 一区二区三区日韩| 亚洲区小说区图片区qvod| 欧美激情中文字幕| 久久久久99精品国产片| 26uuu久久天堂性欧美| 91精品国产91久久综合桃花| 欧美日韩在线播| 7777精品伊人久久久大香线蕉经典版下载| 色婷婷一区二区| 日本道色综合久久| 色婷婷av一区二区三区gif| 国产91丝袜在线播放九色| 国产伦精品一区二区三区免费| 美女诱惑一区二区| 激情综合色播五月| 狠狠色综合日日| 国产一区二区免费视频| 国产精品66部| caoporen国产精品视频| 91在线播放网址| 在线精品视频一区二区三四| 91成人免费在线| 精品视频免费在线| 91精品国产综合久久小美女| 日韩欧美一区电影| 久久综合色之久久综合| 久久久久9999亚洲精品| 国产精品久久久久久久久久久免费看| 国产精品久久久久久久久晋中| 亚洲同性gay激情无套| 亚洲一区二区不卡免费| 石原莉奈在线亚洲三区| 久久97超碰国产精品超碰| 国产综合色在线| 99精品视频一区二区三区| 色综合夜色一区| 在线成人av网站| 精品动漫一区二区三区在线观看| 久久久精品欧美丰满| 亚洲三级久久久| 日韩中文字幕不卡| 成人免费电影视频| 欧美日韩亚洲国产综合| 亚洲精品一区在线观看| 亚洲欧美日韩在线不卡| 丝袜脚交一区二区| 国产精品香蕉一区二区三区| 一本久道中文字幕精品亚洲嫩| 91精品国产91热久久久做人人| 久久九九国产精品| 亚洲国产精品一区二区尤物区| 韩国视频一区二区| 欧美亚洲综合久久| 国产欧美一区二区三区在线看蜜臀 | 91精品久久久久久久91蜜桃| 国产欧美日韩精品在线| 亚洲h动漫在线| 粉嫩av亚洲一区二区图片| 欧美色中文字幕| 久久免费午夜影院| 日韩精品久久久久久| 99久久夜色精品国产网站| 日韩视频永久免费| 一区二区三区欧美久久| 国内外成人在线| 欧美日韩国产一二三| 中文字幕视频一区| 国产麻豆视频一区| 欧美日韩久久一区二区| 最新中文字幕一区二区三区| 久久国产剧场电影| 91.xcao| 亚洲在线视频一区| 91小视频在线|