Lines Matching refs:sn
67 QCowSnapshot *sn;
85 sn = s->snapshots + i;
86 sn->l1_table_offset = be64_to_cpu(h.l1_table_offset);
87 sn->l1_size = be32_to_cpu(h.l1_size);
88 sn->vm_state_size = be32_to_cpu(h.vm_state_size);
89 sn->date_sec = be32_to_cpu(h.date_sec);
90 sn->date_nsec = be32_to_cpu(h.date_nsec);
91 sn->vm_clock_nsec = be64_to_cpu(h.vm_clock_nsec);
99 sn->id_str = qemu_malloc(id_str_size + 1);
100 if (bdrv_pread(bs->file, offset, sn->id_str, id_str_size) != id_str_size)
103 sn->id_str[id_str_size] = '\0';
105 sn->name = qemu_malloc(name_size + 1);
106 if (bdrv_pread(bs->file, offset, sn->name, name_size) != name_size)
109 sn->name[name_size] = '\0';
122 QCowSnapshot *sn;
132 sn = s->snapshots + i;
135 offset += strlen(sn->id_str);
136 offset += strlen(sn->name);
147 sn = s->snapshots + i;
149 h.l1_table_offset = cpu_to_be64(sn->l1_table_offset);
150 h.l1_size = cpu_to_be32(sn->l1_size);
151 h.vm_state_size = cpu_to_be32(sn->vm_state_size);
152 h.date_sec = cpu_to_be32(sn->date_sec);
153 h.date_nsec = cpu_to_be32(sn->date_nsec);
154 h.vm_clock_nsec = cpu_to_be64(sn->vm_clock_nsec);
156 id_str_size = strlen(sn->id_str);
157 name_size = strlen(sn->name);
164 if (bdrv_pwrite_sync(bs->file, offset, sn->id_str, id_str_size) < 0)
167 if (bdrv_pwrite_sync(bs->file, offset, sn->name, name_size) < 0)
195 QCowSnapshot *sn;
199 sn = s->snapshots + i;
200 id = strtoul(sn->id_str, NULL, 10);
238 QCowSnapshot *snapshots1, sn1, *sn = &sn1;
243 memset(sn, 0, sizeof(*sn));
254 sn->id_str = qemu_strdup(sn_info->id_str);
255 if (!sn->id_str)
257 sn->name = qemu_strdup(sn_info->name);
258 if (!sn->name)
260 sn->vm_state_size = sn_info->vm_state_size;
261 sn->date_sec = sn_info->date_sec;
262 sn->date_nsec = sn_info->date_nsec;
263 sn->vm_clock_nsec = sn_info->vm_clock_nsec;
275 sn->l1_table_offset = l1_table_offset;
276 sn->l1_size = s->l1_size;
287 if (bdrv_pwrite_sync(bs->file, sn->l1_table_offset,
299 s->snapshots[s->nb_snapshots++] = *sn;
308 qemu_free(sn->name);
317 QCowSnapshot *sn;
323 sn = &s->snapshots[snapshot_index];
328 if (qcow2_grow_l1_table(bs, sn->l1_size) < 0)
331 s->l1_size = sn->l1_size;
334 if (bdrv_pread(bs->file, sn->l1_table_offset,
358 QCowSnapshot *sn;
364 sn = &s->snapshots[snapshot_index];
366 ret = qcow2_update_snapshot_refcount(bs, sn->l1_table_offset, sn->l1_size, -1);
373 qcow2_free_clusters(bs, sn->l1_table_offset, sn->l1_size * sizeof(uint64_t));
375 qemu_free(sn->id_str);
376 qemu_free(sn->name);
377 memmove(sn, sn + 1, (s->nb_snapshots - snapshot_index - 1) * sizeof(*sn));
394 QCowSnapshot *sn;
405 sn = s->snapshots + i;
407 sn->id_str);
409 sn->name);
410 sn_info->vm_state_size = sn->vm_state_size;
411 sn_info->date_sec = sn->date_sec;
412 sn_info->date_nsec = sn->date_nsec;
413 sn_info->vm_clock_nsec = sn->vm_clock_nsec;