use to_owned() when putting together OpenOptions

This commit is contained in:
Christian Schwarz
2023-12-12 14:59:50 +00:00
parent 58b3115afa
commit 70c6838c9a
3 changed files with 27 additions and 19 deletions

View File

@@ -44,11 +44,15 @@ impl EphemeralFile {
"ephemeral-{filename_disambiguator}"
)));
let file = {
let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new();
options.read(true).write(true).create(true);
VirtualFile::open_with_options(&filename, options).await?
};
let file = VirtualFile::open_with_options(
&filename,
tokio_epoll_uring::ops::open_at::OpenOptions::new()
.read(true)
.write(true)
.create(true)
.to_owned(),
)
.await?;
Ok(EphemeralFile {
page_cache_file_id: page_cache::next_file_id(),

View File

@@ -647,13 +647,15 @@ impl DeltaLayer {
where
F: Fn(Summary) -> Summary,
{
let file = {
let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new();
options.read(true).write(true);
VirtualFile::open_with_options(path, options)
.await
.with_context(|| format!("Failed to open file '{}'", path))?
};
let file = VirtualFile::open_with_options(
path,
tokio_epoll_uring::ops::open_at::OpenOptions::new()
.read(true)
.write(true)
.to_owned(),
)
.await
.with_context(|| format!("Failed to open file '{}'", path))?;
let file = FileBlockReader::new(file);
let summary_blk = file.read_blk(0, ctx).await?;
let actual_summary = Summary::des_prefix(summary_blk.as_ref()).context("deserialize")?;

View File

@@ -325,13 +325,15 @@ impl ImageLayer {
where
F: Fn(Summary) -> Summary,
{
let file = {
let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new();
options.read(true).write(true);
VirtualFile::open_with_options(path, options)
.await
.with_context(|| format!("Failed to open file '{}'", path))?
};
let file = VirtualFile::open_with_options(
path,
tokio_epoll_uring::ops::open_at::OpenOptions::new()
.read(true)
.write(true)
.to_owned(),
)
.await
.with_context(|| format!("Failed to open file '{}'", path))?;
let file = FileBlockReader::new(file);
let summary_blk = file.read_blk(0, ctx).await?;
let actual_summary = Summary::des_prefix(summary_blk.as_ref()).context("deserialize")?;