raw_parse_flags(bdrv_flags, &s->open_flags, false);
s->fd = -1;
- fd = qemu_open_old(filename, s->open_flags, 0644);
+ fd = qemu_open(filename, s->open_flags, errp);
ret = fd < 0 ? -errno : 0;
if (ret < 0) {
- error_setg_file_open(errp, -ret, filename);
if (ret == -EROFS) {
ret = -EACCES;
}
}
}
- /* If we cannot use fcntl, or fcntl failed, fall back to qemu_open_old() */
+ /* If we cannot use fcntl, or fcntl failed, fall back to qemu_open() */
if (fd == -1) {
const char *normalized_filename = bs->filename;
ret = raw_normalize_devicepath(&normalized_filename, errp);
if (ret >= 0) {
- assert(!(*open_flags & O_CREAT));
- fd = qemu_open_old(normalized_filename, *open_flags);
+ fd = qemu_open(normalized_filename, *open_flags, errp);
if (fd == -1) {
- error_setg_errno(errp, errno, "Could not reopen file");
return -1;
}
}
}
/* Create file */
- fd = qemu_open_old(file_opts->filename, O_RDWR | O_CREAT | O_BINARY, 0644);
+ fd = qemu_create(file_opts->filename, O_RDWR | O_BINARY, 0644, errp);
if (fd < 0) {
result = -errno;
- error_setg_errno(errp, -result, "Could not create file");
goto out;
}
for (index = 0; index < num_of_test_partitions; index++) {
snprintf(test_partition, sizeof(test_partition), "%ss%d", bsd_path,
index);
- fd = qemu_open_old(test_partition, O_RDONLY | O_BINARY | O_LARGEFILE);
+ fd = qemu_open(test_partition, O_RDONLY | O_BINARY | O_LARGEFILE, NULL);
if (fd >= 0) {
partition_found = true;
qemu_close(fd);
int prio = 0;
struct stat st;
- fd = qemu_open_old(filename, O_RDONLY | O_NONBLOCK);
+ fd = qemu_open(filename, O_RDONLY | O_NONBLOCK, NULL);
if (fd < 0) {
goto out;
}
*/
if (s->fd >= 0)
qemu_close(s->fd);
- fd = qemu_open_old(bs->filename, s->open_flags, 0644);
+ fd = qemu_open(bs->filename, s->open_flags, NULL);
if (fd < 0) {
s->fd = -1;
return -EIO;