qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5665] Currently trying to turn an oversized directory into a VVFAT image will
@ 2008-11-10  1:34 Andrzej Zaborowski
  2008-11-10  1:49 ` andrzej zaborowski
  0 siblings, 1 reply; 2+ messages in thread
From: Andrzej Zaborowski @ 2008-11-10  1:34 UTC (permalink / raw)
  To: qemu-devel

Revision: 5665
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5665
Author:   balrog
Date:     2008-11-10 01:34:27 +0000 (Mon, 10 Nov 2008)

Log Message:
-----------
Currently trying to turn an oversized directory into a VVFAT image will
result in a cryptic error (and an abort):
  qemu: block-vvfat.c:97: array_get: Assertion `index < array->next' failed.
  Aborted

Turn this into an actually useful error message:
  Directory does not fit in FAT16 (capacity 504MB)
  qemu: could not open disk image fat:$DIR/

Modified Paths:
--------------
    trunk/block-vvfat.c

Modified: trunk/block-vvfat.c
===================================================================
--- trunk/block-vvfat.c	2008-11-10 01:05:01 UTC (rev 5664)
+++ trunk/block-vvfat.c	2008-11-10 01:34:27 UTC (rev 5665)
@@ -890,7 +890,6 @@
     s->path = mapping->path;
 
     for (i = 0, cluster = 0; i < s->mapping.next; i++) {
-	int j;
 	/* MS-DOS expects the FAT to be 0 for the root directory
 	 * (except for the media byte). */
 	/* LATER TODO: still true for FAT32? */
@@ -923,20 +922,25 @@
 
 	assert(mapping->begin < mapping->end);
 
+	/* next free cluster */
+	cluster = mapping->end;
+
+	if(cluster > s->cluster_count) {
+	    fprintf(stderr,"Directory does not fit in FAT%d (capacity %s)\n",
+		    s->fat_type,
+		    s->fat_type == 12 ? s->sector_count == 2880 ? "1.44 MB"
+								: "2.88 MB"
+				      : "504MB");
+	    return -EINVAL;
+	}
+
 	/* fix fat for entry */
 	if (fix_fat) {
+	    int j;
 	    for(j = mapping->begin; j < mapping->end - 1; j++)
 		fat_set(s, j, j+1);
 	    fat_set(s, mapping->end - 1, s->max_fat_value);
 	}
-
-	/* next free cluster */
-	cluster = mapping->end;
-
-	if(cluster > s->cluster_count) {
-	    fprintf(stderr,"Directory does not fit in FAT%d\n",s->fat_type);
-	    return -1;
-	}
     }
 
     mapping = array_get(&(s->mapping), 0);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [5665] Currently trying to turn an oversized directory into a VVFAT image will
  2008-11-10  1:34 [Qemu-devel] [5665] Currently trying to turn an oversized directory into a VVFAT image will Andrzej Zaborowski
@ 2008-11-10  1:49 ` andrzej zaborowski
  0 siblings, 0 replies; 2+ messages in thread
From: andrzej zaborowski @ 2008-11-10  1:49 UTC (permalink / raw)
  To: qemu-devel

2008/11/10 Andrzej Zaborowski <balrogg@gmail.com>:
> Log Message:
> -----------
> Currently trying to turn an oversized directory into a VVFAT image will
> result in a cryptic error (and an abort):
>  qemu: block-vvfat.c:97: array_get: Assertion `index < array->next' failed.
>  Aborted
>
> Turn this into an actually useful error message:
>  Directory does not fit in FAT16 (capacity 504MB)
>  qemu: could not open disk image fat:$DIR/

Oh I managed to eat the Signed-off-by: line, if anyone needs to know it's

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-10  1:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-10  1:34 [Qemu-devel] [5665] Currently trying to turn an oversized directory into a VVFAT image will Andrzej Zaborowski
2008-11-10  1:49 ` andrzej zaborowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).