Lines Matching defs:cluster
284 /* begin is the first cluster, end is the last+1 */
293 * - the next cluster of the directory for a directory, and
340 unsigned char* cluster; /* points to current cluster */
537 static inline void fat_set(BDRVVVFATState* s,unsigned int cluster,uint32_t value)
540 uint32_t* entry=array_get(&(s->fat),cluster);
543 uint16_t* entry=array_get(&(s->fat),cluster);
546 int offset = (cluster*3/2);
548 switch (cluster&1) {
561 static inline uint32_t fat_get(BDRVVVFATState* s,unsigned int cluster)
564 uint32_t* entry=array_get(&(s->fat),cluster);
567 uint16_t* entry=array_get(&(s->fat),cluster);
570 const uint8_t* x=(uint8_t*)(s->fat.pointer)+cluster*3/2;
571 return ((x[0]|(x[1]<<8))>>(cluster&1?4:0))&0x0fff;
789 /* fill with zeroes up to the end of the cluster */
847 unsigned int cluster;
894 for (i = 0, cluster = 0; i < s->mapping.next; i++) {
902 mapping->begin = cluster;
912 mapping->begin = cluster;
917 mapping->end = cluster + 1 + (mapping->end-1)/s->cluster_size;
920 mapping->end = cluster + 1;
927 /* next free cluster */
928 cluster = mapping->end;
930 if(cluster > s->cluster_count) {
1142 * are sorted by cluster, this is expensive: O(n).
1195 s->cluster = (unsigned char*)s->directory.pointer+offset
1197 assert(((s->cluster-(unsigned char*)s->directory.pointer)%s->cluster_size)==0);
1198 assert((char*)s->cluster+s->cluster_size <= s->directory.pointer+s->directory.next*s->directory.item_size);
1213 s->cluster=s->cluster_buffer;
1214 result=read(s->current_fd,s->cluster,s->cluster_size);
1326 memcpy(buf+i*0x200,s->cluster+sector_offset_in_cluster*0x200,0x200);
1357 struct { uint32_t cluster; } rename;
1360 struct { uint32_t cluster; } mkdir;
1385 uint32_t cluster, char* new_path)
1389 commit->param.rename.cluster = cluster;
1412 static void schedule_mkdir(BDRVVVFATState* s, uint32_t cluster, char* path)
1416 commit->param.mkdir.cluster = cluster;
1520 unsigned int cluster)
1522 if (cluster < s->last_cluster_of_root_directory) {
1523 if (cluster + 1 == s->last_cluster_of_root_directory)
1526 return cluster + 1;
1530 uint32_t* entry=((uint32_t*)s->fat2)+cluster;
1533 uint16_t* entry=((uint16_t*)s->fat2)+cluster;
1536 const uint8_t* x=s->fat2+cluster*3/2;
1537 return ((x[0]|(x[1]<<8))>>(cluster&1?4:0))&0x0fff;
1569 * If any cluster is allocated, but not part of a file or directory, this
1581 * exactly the same first cluster, but a different name.
1591 * IF the guest OS just inserts a cluster into the file chain,
1595 * - do_commit will write the cluster into the file at the given
1598 * - the cluster which is overwritten should be moved to a later
1665 /* offset of this cluster in file chain has changed */
1737 unsigned char* cluster = qemu_malloc(s->cluster_size);
1738 direntry_t* direntries = (direntry_t*)cluster;
1773 fprintf(stderr, "cluster %d used more than once\n", (int)cluster_num);
1778 DLOG(fprintf(stderr, "read cluster %d (sector %d)\n", (int)cluster_num, (int)cluster2sector(s, cluster_num)));
1779 subret = vvfat_read(s->bs, cluster2sector(s, cluster_num), cluster,
1784 free(cluster);
1840 DLOG(fprintf(stderr, "Cluster count mismatch\n"));
1852 free(cluster);
1872 * - check that the cumulative used cluster count agrees with the
1912 DLOG(fprintf(stderr, "FAT was modified (%d), but cluster is not used?\n", i));
1920 DLOG(fprintf(stderr, "unused, modified cluster: %d\n", i));
2050 * Adapt the mappings of the cluster chain starting at first cluster
2060 uint32_t cluster = first_cluster;
2071 while (!fat_eof(s, cluster)) {
2074 for (c = cluster, c1 = modified_fat_get(s, c); c + 1 == c1;
2126 cluster = c1;
2220 char* cluster = qemu_malloc(s->cluster_size);
2252 (uint8_t*)cluster
2257 if (write(fd, cluster, rest_size) < 0)
2313 /* cluster start */
2352 fprintf(stderr, "%d, %s (%d, %d)\n", i, commit->path ? commit->path : "(null)", commit->param.rename.cluster, commit->action);
2360 commit->param.rename.cluster);
2417 mapping = insert_mapping(s, commit->param.mkdir.cluster,
2418 commit->param.mkdir.cluster + 1);