summaryrefslogtreecommitdiff
path: root/block-vvfat.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-08-01 16:21:11 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-08-01 16:21:11 +0000
commit83f6409109acd7cd13ff8a603f29c46033c4fb00 (patch)
treee06b75a308f58785b6c646d192e8e53fda006e20 /block-vvfat.c
parent7954c73498b7e782ba5db2993637daef456b6310 (diff)
async file I/O API
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2075 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-vvfat.c')
-rw-r--r--block-vvfat.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/block-vvfat.c b/block-vvfat.c
index 9dedf9115f..ad6b7d29e8 100644
--- a/block-vvfat.c
+++ b/block-vvfat.c
@@ -351,13 +351,6 @@ typedef struct BDRVVVFATState {
} BDRVVVFATState;
-static int vvfat_probe(const uint8_t *buf, int buf_size, const char *filename)
-{
- if (strstart(filename, "fat:", NULL))
- return 100;
- return 0;
-}
-
static void init_mbr(BDRVVVFATState* s)
{
/* TODO: if the files mbr.img and bootsect.img exist, use them */
@@ -954,18 +947,22 @@ static int init_directories(BDRVVVFATState* s,
return 0;
}
+#ifdef DEBUG
static BDRVVVFATState *vvv = NULL;
+#endif
static int enable_write_target(BDRVVVFATState *s);
static int is_consistent(BDRVVVFATState *s);
-static int vvfat_open(BlockDriverState *bs, const char* dirname)
+static int vvfat_open(BlockDriverState *bs, const char* dirname, int flags)
{
BDRVVVFATState *s = bs->opaque;
int floppy = 0;
int i;
+#ifdef DEBUG
vvv = s;
+#endif
DLOG(if (stderr == NULL) {
stderr = fopen("vvfat.log", "a");
@@ -1040,7 +1037,6 @@ DLOG(if (stderr == NULL) {
bs->heads = bs->cyls = bs->secs = 0;
// assert(is_consistent(s));
-
return 0;
}
@@ -2732,8 +2728,7 @@ static int enable_write_target(BDRVVVFATState *s)
array_init(&(s->commits), sizeof(commit_t));
s->qcow_filename = malloc(1024);
- strcpy(s->qcow_filename, "/tmp/vl.XXXXXX");
- get_tmp_filename(s->qcow_filename, strlen(s->qcow_filename) + 1);
+ get_tmp_filename(s->qcow_filename, 1024);
if (bdrv_create(&bdrv_qcow,
s->qcow_filename, s->sector_count, "fat:", 0) < 0)
return -1;
@@ -2767,14 +2762,15 @@ static void vvfat_close(BlockDriverState *bs)
BlockDriver bdrv_vvfat = {
"vvfat",
sizeof(BDRVVVFATState),
- vvfat_probe,
+ NULL, /* no probe for protocols */
vvfat_open,
vvfat_read,
vvfat_write,
vvfat_close,
NULL, /* ??? Not sure if we can do any meaningful flushing. */
NULL,
- vvfat_is_allocated
+ vvfat_is_allocated,
+ .protocol_name = "fat",
};
#ifdef DEBUG