Revision 8ce0f869 block-vvfat.c
b/block-vvfat.c | ||
---|---|---|
890 | 890 |
s->path = mapping->path; |
891 | 891 |
|
892 | 892 |
for (i = 0, cluster = 0; i < s->mapping.next; i++) { |
893 |
int j; |
|
894 | 893 |
/* MS-DOS expects the FAT to be 0 for the root directory |
895 | 894 |
* (except for the media byte). */ |
896 | 895 |
/* LATER TODO: still true for FAT32? */ |
... | ... | |
923 | 922 |
|
924 | 923 |
assert(mapping->begin < mapping->end); |
925 | 924 |
|
925 |
/* next free cluster */ |
|
926 |
cluster = mapping->end; |
|
927 |
|
|
928 |
if(cluster > s->cluster_count) { |
|
929 |
fprintf(stderr,"Directory does not fit in FAT%d (capacity %s)\n", |
|
930 |
s->fat_type, |
|
931 |
s->fat_type == 12 ? s->sector_count == 2880 ? "1.44 MB" |
|
932 |
: "2.88 MB" |
|
933 |
: "504MB"); |
|
934 |
return -EINVAL; |
|
935 |
} |
|
936 |
|
|
926 | 937 |
/* fix fat for entry */ |
927 | 938 |
if (fix_fat) { |
939 |
int j; |
|
928 | 940 |
for(j = mapping->begin; j < mapping->end - 1; j++) |
929 | 941 |
fat_set(s, j, j+1); |
930 | 942 |
fat_set(s, mapping->end - 1, s->max_fat_value); |
931 | 943 |
} |
932 |
|
|
933 |
/* next free cluster */ |
|
934 |
cluster = mapping->end; |
|
935 |
|
|
936 |
if(cluster > s->cluster_count) { |
|
937 |
fprintf(stderr,"Directory does not fit in FAT%d\n",s->fat_type); |
|
938 |
return -1; |
|
939 |
} |
|
940 | 944 |
} |
941 | 945 |
|
942 | 946 |
mapping = array_get(&(s->mapping), 0); |
Also available in: Unified diff