Revision 3b46e624 block-cow.c

b/block-cow.c
85 85
        be32_to_cpu(cow_header.version) != COW_VERSION) {
86 86
        goto fail;
87 87
    }
88
       
88

  
89 89
    /* cow image found */
90 90
    size = be64_to_cpu(cow_header.size);
91 91
    bs->total_sectors = size / 512;
92 92

  
93 93
    pstrcpy(bs->backing_file, sizeof(bs->backing_file),
94 94
            cow_header.backing_file);
95
   
95

  
96 96
    /* mmap the bitmap */
97 97
    s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header);
98 98
    s->cow_bitmap_addr = mmap(get_mmap_addr(s->cow_bitmap_size),
......
155 155
{
156 156
    BDRVCowState *s = bs->opaque;
157 157
    int ret, n;
158
   
158

  
159 159
    while (nb_sectors > 0) {
160 160
        if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) {
161 161
            lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET);
......
184 184
{
185 185
    BDRVCowState *s = bs->opaque;
186 186
    int ret, i;
187
   
187

  
188 188
    lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET);
189 189
    ret = write(s->fd, buf, nb_sectors * 512);
190 190
    if (ret != nb_sectors * 512)

Also available in: Unified diff