Lines Matching refs:fd
51 read_or_die(int fd, void *buf, size_t nbyte) in read_or_die() argument
55 ret = read(fd, buf, nbyte); in read_or_die()
70 seek_or_die(int fd, off_t offset, int whence) in seek_or_die() argument
72 off_t ret = lseek(fd, offset, whence); in seek_or_die()
117 snapshot_info_read( int fd, SnapshotInfo* info ) in snapshot_info_read() argument
119 uint64_t start_offset = seek_or_die(fd, 0, SEEK_CUR); in snapshot_info_read()
125 seek_or_die(fd, 12, SEEK_CUR); /* skip l1 info */ in snapshot_info_read()
126 read_or_die(fd, &id_str_size, sizeof(id_str_size)); in snapshot_info_read()
127 read_or_die(fd, &name_size, sizeof(name_size)); in snapshot_info_read()
128 read_or_die(fd, &info->date_sec, sizeof(info->date_sec)); in snapshot_info_read()
129 read_or_die(fd, &info->date_nsec, sizeof(info->date_nsec)); in snapshot_info_read()
130 read_or_die(fd, &info->vm_clock_nsec, sizeof(info->vm_clock_nsec)); in snapshot_info_read()
131 read_or_die(fd, &info->vm_state_size, sizeof(info->vm_state_size)); in snapshot_info_read()
132 read_or_die(fd, &extra_data_size, sizeof(extra_data_size)); in snapshot_info_read()
147 seek_or_die(fd, extra_data_size, SEEK_CUR); /* skip extra data */ in snapshot_info_read()
148 read_or_die(fd, info->id_str, id_str_size); in snapshot_info_read()
149 read_or_die(fd, info->name, name_size); in snapshot_info_read()
155 uint64_t end_offset = seek_or_die(fd, 0, SEEK_CUR); in snapshot_info_read()
160 seek_or_die(fd, start_offset + aligned_size, SEEK_SET); in snapshot_info_read()
240 snapshot_print_table( int fd, uint32_t nb_snapshots, uint64_t snapshots_offset ) in snapshot_print_table() argument
246 seek_or_die(fd, snapshots_offset, SEEK_SET); in snapshot_print_table()
252 snapshot_info_read(fd, info); in snapshot_print_table()
263 snapshot_validate_qcow_file( int fd ) in snapshot_validate_qcow_file() argument
267 read_or_die(fd, &magic, sizeof(magic)); in snapshot_validate_qcow_file()
268 read_or_die(fd, &version, sizeof(version)); in snapshot_validate_qcow_file()
290 snapshot_read_qcow_header( int fd, uint32_t *nb_snapshots, uint64_t *snapshots_offset ) in snapshot_read_qcow_header() argument
292 snapshot_validate_qcow_file(fd); in snapshot_read_qcow_header()
295 seek_or_die(fd, 52, SEEK_CUR); in snapshot_read_qcow_header()
297 read_or_die(fd, nb_snapshots, sizeof(*nb_snapshots)); in snapshot_read_qcow_header()
298 read_or_die(fd, snapshots_offset, sizeof(*snapshots_offset)); in snapshot_read_qcow_header()
312 int fd = open(snapstorage, O_RDONLY); in snapshot_print_and_exit() local
313 if (fd < 0) { in snapshot_print_and_exit()
321 snapshot_read_qcow_header(fd, &nb_snapshots, &snapshots_offset); in snapshot_print_and_exit()
325 snapshot_print_table(fd, nb_snapshots, snapshots_offset); in snapshot_print_and_exit()
331 close(fd); in snapshot_print_and_exit()