summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-04-29 12:12:33 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-04-29 12:12:33 +0100
commit47dac82d8b013a5c7dd044a797ae6727b553959a (patch)
tree8d8d6eaaf5bfa488b200a9740a8cf51c8ec8eda3
parent849880978eb2d9043323e34afb46eae8772a5fc6 (diff)
parentd208c50d9dbf98c0eca337723cd6497653ceb743 (diff)
downloadfocaccia-qemu-47dac82d8b013a5c7dd044a797ae6727b553959a.tar.gz
focaccia-qemu-47dac82d8b013a5c7dd044a797ae6727b553959a.zip
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
vvfat fixes for 2.6.0-rc4

# gpg: Signature made Fri 29 Apr 2016 10:52:13 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  vvfat: Fix default volume label
  vvfat: Fix volume name assertion

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--block/vvfat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/vvfat.c b/block/vvfat.c
index 6b853146f0..183fc4f049 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1109,6 +1109,8 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
             goto fail;
         }
         memcpy(s->volume_label, label, label_length);
+    } else {
+        memcpy(s->volume_label, "QEMU VVFAT", 10);
     }
 
     if (floppy) {
@@ -2283,12 +2285,17 @@ DLOG(fprintf(stderr, "commit_direntries for %s, parent_mapping_index %d\n", mapp
 		factor * (old_cluster_count - new_cluster_count));
 
     for (c = first_cluster; !fat_eof(s, c); c = modified_fat_get(s, c)) {
+        direntry_t *first_direntry;
 	void* direntry = array_get(&(s->directory), current_dir_index);
 	int ret = vvfat_read(s->bs, cluster2sector(s, c), direntry,
 		s->sectors_per_cluster);
 	if (ret)
 	    return ret;
-	assert(!strncmp(s->directory.pointer, "QEMU", 4));
+
+        /* The first directory entry on the filesystem is the volume name */
+        first_direntry = (direntry_t*) s->directory.pointer;
+        assert(!memcmp(first_direntry->name, s->volume_label, 11));
+
 	current_dir_index += factor;
     }