qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Block driver and constant sector size


From: Jonathan Phenix
Subject: [Qemu-devel] Block driver and constant sector size
Date: Sat, 12 May 2007 12:35:46 -0400
User-agent: Thunderbird 1.5.0.9 (X11/20070102)

Hi,

currently the block driver in qemu only handles blocks (or sectors) which are 512 bytes long, this is ideal if the device you are emulating have a block size which is a multiple of 512. Unfortunately, this is not always the case, for example an audio CD (CD-DA) or a CD in mode 2 have a sector size of 2352, which is not a multiple of 512. Typical data CD are encoded in mode 1 with an ISO9660 file system, and this mode uses a sector size of 2048, which is a multiple of 512, this is the reason why the problem probably didn't come up yet. You can dump about any CDs in mode 2 under Linux with the "cdrdao read-cd --read-raw [...]" command for example.

In order to let the block driver read these raw images, I would like to change:

BlockDriverState *bdrv_new(const char *device_name);

to:

BlockDriverState *bdrv_new(const char *device_name, int sector_size);

and change:

int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename);

of the BlockDriver structure to:

int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename, int sector_size);

Then, each probe functions should be modified to reject sector size which is not 512 bytes, except for the raw block driver, which will be modified to accept any block sizes. This change would probably solve the whole problem without having a negative impact on the rest of the code.

Is it the right way to solve the problem? If this solution is accepted, I will code it and submit a patch.

Regards,

Jonathan Phénix





reply via email to

[Prev in Thread] Current Thread [Next in Thread]