History | View | Annotate | Download (81 kB)
vvfat: convert to .bdrv_co_is_allocated()
It is trivial to switch from the synchronous .bdrv_is_allocated()interface to .bdrv_co_is_allocated() since vvfat_is_allocated() does notblock.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vvfat: Add migration blocker
vvfat caches more or less everything when in writable mode. For migrationto work, it would have to be invalidated. Block migration for now whenin writable mode (default is readonly).
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vvfat: Fix read-write mode
vvfat used to directly call into the qcow2 block driver instead of using theblock.c wrappers. With the coroutine conversion, this stopped working.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
vvfat: reorganize computation of disk geometry
First determine FAT12/16/32, then compute geometry from that for bothFDD and HDD. For 1.44MB floppies, and 2.88MB floppies using FAT16,change to 1 sector/cluster. The default remains 2.88MB with FAT12and 2 sectors/cluster. Both DOS and mkdosfs by default format a 2.88MB...
vvfat: do not hardcode sector counts in error message
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vvfat: unify and correct computation of sector count
The sector count is stored in the partition and hence must not include thesectors before its start. At the same time, remove the useless specialcasing for 1.44 MB floppies. This fixes fsck on VVFAT hard disks,...
vvfat: need to use first_sectors_number to distinguish fdd/hdd
This is consistent with what "real" floppies have, so file(1)now actually recognizes the VVFAT image as a 1.44 MB floppy.
vvfat: do not fail if the disk has spare sectors
If the number of "faked sectors" + the number of sectors that arepart of a cluster does not sum up to the total number of sectors,qemu-img convert fails. Read these spare sectors as all zeros.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
vvfat: fix out of bounds array_get usage
When reading the address of the first free entry, you cannotuse array_get without first marking all entries as occupied.
This is visible if you change the sectors per cluster on afloppy from 2 to 1.
block: take lock around bdrv_read implementations
This does the first part of the conversion to coroutines, bywrapping bdrv_read implementations to take the mutex.
Drivers that implement bdrv_read rather than bdrv_co_readv canthen benefit from asynchronous operation (at least if the underlying...
block: take lock around bdrv_write implementations
This does the first part of the conversion to coroutines, bywrapping bdrv_write implementations to take the mutex.
Drivers that implement bdrv_write rather than bdrv_co_writev canthen benefit from asynchronous operation (at least if the underlying...
block: add a CoMutex to synchronous read drivers
The big conversion of bdrv_read/write to coroutines caused the twohomonymous callbacks in BlockDriver to become reentrant. It goeslike this:
1) bdrv_read is now called in a coroutine, and calls bdrv_read or...
vvfat: Fix potential buffer overflow
path2[PATH_MAX] can be used for the null termination, so make the array bigenough to allow this.
block/vvfat: Fix potential memory leaks and other memory errors
cppcheck reported memory leaks and mismatched g_malloc() with free()instead of g_free().
Fix these errors.
Cc: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
block/vvfat: Remove unused code
The unused code was detected using cppcheck.
Cc: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Remove blanks before \n in output strings
Those blanks violate the coding conventions, seescripts/checkpatch.pl.
Blanks missing after colons in the changed lines were added.
This patch does not try to fix tabs, long lines and otherproblems in the changed lines, therefore checkpatch.pl reports...
Use new macro QEMU_PACKED for packed structures
Most changes were made using these commands:
git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vvfat: fix a file descriptor leak
Fix a file descriptor leak, reported by cppcheck:[/src/qemu/block/vvfat.c:759]: (error) Resource leak: dir
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
block/vvfat: Fix compiler warning in debug code
Fix this compiler warning:./block/vvfat.c:2285: error: comparison of unsigned expression >= 0 is always true
Cc: Blue Swirl <blauwirbel@gmail.com>Cc: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
vvfat: Fix segfault on write to read-only disk
vvfat tries to set the readonly flag in its open function, but nowadaysthis is overwritted with the readonly=... command line option. Check inbdrv_write if the vvfat was opened read-only and return an error in this...
vvfat: Fix double free for opening the image rw
Allocation and deallocation of bs->opaque is not in the control of ablock driver. Therefore it should not set bs->opaque to a data structureused by another bs, or closing the image will lead to a double free....
vvfat: Use cache=unsafe
The qcow file used for write support in vvfat is a temporary file,so we can use cache=unsafe there. Without this, write support is justtoo slow to be of any use.
Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
vvfat: fat_chksum(): fix access above array bounds
Signed-off-by: Loïc Minier <loic.minier@linaro.org>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vvfat: Fix compilation with DEBUG defined
gcc does not like passing a NULL where an int value is expected:
block/vvfat.c: In function ‘checkpoint’:block/vvfat.c:2868: error: passing argument 2 of ‘remove_mapping’ makes integer from pointer without a cast...
vvfat: More build fixes with DEBUG
Casting a pointer to an int doesn't work on 64 bit platforms. Use the %p printfconversion specifier instead.
block: Open the underlying image file in generic code
Format drivers shouldn't need to bother with things like file names, but ratherjust get an open BlockDriverState for the underlying protocol. This patchintroduces this behaviour for bdrv_open implementation. For protocols which...
Fix dead initialization, spotted by clang analyzer
Fix clang warnings:/src/qemu/block/vvfat.c:1102:9: warning: Value stored to 'index3' during its initialization is never read int index3=index1+1;/src/qemu/cmd.c:290:15: warning: Value stored to 'p' during its initialization is never read...
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remainingcallers of the old function are converted to the new one. In some places theyeven know the right format, so they should have used bdrv_open2 from the...
Replace assert(0) with abort() or cpu_abort()
When building with -DNDEBUG, assert(0) will not stop executionso it must not be used for abnormal termination.
Use cpu_abort() when in CPU context, abort() otherwise.
Fix build with -DNDEBUG in CFLAGS
don't dereference NULL after failed strdup
Most of these are obvious NULL-deref bug fixes, for example,the ones in these files:
block/curl.c net.c slirp/misc.c
and the first one in block/vvfat.c.The others in block/vvfat.c may not lead to an immediate segfault, but I...
Ask for read-write permissions when opening files
Found some places that seems needs this explicitly, now thatread-write is not the default.
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/vvfat.c: fix warnings with _FORTIFY_SOURCE
CC block/vvfat.occ1: warnings being treated as errorsblock/vvfat.c: In function 'commit_one_file':block/vvfat.c:2259: error: ignoring return value of 'ftruncate', declared with attribute warn_unused_result...
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
vvfat: fix coding style nit
Put space between = and & when taking a pointer,to avoid confusion with old-style "&=".
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
vvfat: one more missing BlockDriver C99 initializer conversion
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Drop bdrv_create2
This patch converts the remaining users of bdrv_create2 to bdrv_create andremoves the now unused function.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Convert all block drivers to new bdrv_create
Now we can make use of the newly introduced option structures. Instead ofhaving bdrv_create carry more and more parameters (which are format specific inmost cases), just pass a option structure as defined by the driver itself....
Move block drivers into their own directory