Skip to content

Commit

Permalink
style: fix code formatting and conventions
Browse files Browse the repository at this point in the history
Signed-off-by: daiyongxuan <[email protected]>
  • Loading branch information
daiyongxuan committed Oct 28, 2024
1 parent a9b43e9 commit 67ec7bf
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 35 deletions.
26 changes: 2 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ sha2 = "0.10.2"
tar = "0.4.40"
vmm-sys-util = "0.11.0"
xattr = "1.0.1"
rand = "0.8.5"
zstd = "0.12"
tempfile = "3.2"

nydus-api = { version = "0.3", path = "../api" }
nydus-rafs = { version = "0.3", path = "../rafs" }
Expand Down
1 change: 1 addition & 0 deletions builder/src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ impl ChunkSet {
Blob::dump_meta_data(build_ctx, new_blob_ctx, &mut blob_writer)?;
let blob_id = new_blob_ctx.blob_id();
blob_writer.finalize(blob_id)?;

Ok(changed_chunks)
}
}
Expand Down
1 change: 1 addition & 0 deletions builder/src/core/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ impl Node {
}
prev = Some((blob_idx, offset));
}

// Special optimization to enable page cache sharing for EROFS.
let chunk_size = if is_continuous && inode.size() > ctx.chunk_size as u64 {
inode.size().next_power_of_two()
Expand Down
3 changes: 0 additions & 3 deletions rafs/src/metadata/direct_v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ impl DirectSuperBlockV6 {
let mut blob_table = RafsV6BlobTable::new();
let meta = &old_state.meta;
r.seek(SeekFrom::Start(meta.blob_table_offset))?;

blob_table.load(r, meta.blob_table_size, meta.chunk_size, meta.flags)?;
let blob_extra_infos = rafsv6_load_blob_extra_info(meta, r)?;

Expand Down Expand Up @@ -1325,7 +1324,6 @@ impl RafsInodeExt for OndiskInodeWrapper {
/// It depends on Self::validate() to ensure valid memory layout.
fn get_chunk_info(&self, idx: u32) -> Result<Arc<dyn BlobChunkInfo>> {
let state = self.state();

let inode = self.disk_inode(&state);
if !self.is_reg() || idx >= self.get_chunk_count() {
return Err(enoent!("invalid chunk info"));
Expand Down Expand Up @@ -1364,7 +1362,6 @@ impl RafsInodeExt for OndiskInodeWrapper {
if chunk_map.is_none() {
*chunk_map = Some(self.mapping.load_chunk_map()?);
}

match chunk_map.as_ref().unwrap().get(chunk_addr) {
None => Err(enoent!(format!(
"failed to get chunk info for chunk {}/{}/{}",
Expand Down
1 change: 1 addition & 0 deletions rafs/src/metadata/layout/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,7 @@ impl RafsV6Device {
}
Err(_) => return Err(einval!("blob_id in RAFS v6 device entry is invalid")),
}

if self.blocks() == 0 {
let msg = format!("invalid blocks {} in Rafs v6 device entry", self.blocks());
return Err(einval!(msg));
Expand Down
3 changes: 1 addition & 2 deletions src/bin/nydus-image/deduplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ impl From<rusqlite::Error> for DatabaseError {
}
}

#[allow(dead_code)]
pub trait Database {
/// Creates a new chunk in the database.
fn create_chunk_table(&self) -> Result<()>;
Expand Down Expand Up @@ -187,6 +186,7 @@ pub fn update_ctx_from_parent_bootstrap(
bootstrap_path: &PathBuf,
) -> Result<()> {
let (sb, _) = RafsSuper::load_from_file(bootstrap_path, Arc::new(ConfigV2::default()), false)?;

// Obtain the features of the first blob to use as the features for the blobs in chunkdict.
if let Some(first_blob) = sb.superblock.get_blob_infos().first() {
ctx.blob_features = first_blob.features();
Expand Down Expand Up @@ -897,7 +897,6 @@ struct DataPoint {
cluster_id: i32,
}

#[allow(dead_code)]
pub trait Table<T, Err>: Sync + Send + Sized + 'static
where
Err: std::error::Error + 'static,
Expand Down
4 changes: 1 addition & 3 deletions src/bin/nydus-image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0

// #![deny(warnings)]
#![deny(warnings)]
#[macro_use(crate_authors)]
extern crate clap;
#[macro_use]
Expand Down Expand Up @@ -1196,7 +1196,6 @@ impl Command {
features,
encrypt,
);

build_ctx.set_fs_version(version);
build_ctx.set_chunk_size(chunk_size);
build_ctx.set_batch_size(batch_size);
Expand Down Expand Up @@ -1290,7 +1289,6 @@ impl Command {
| ConversionType::TarToStargz
| ConversionType::TargzToStargz => unimplemented!(),
};

let build_output = timing_tracer!(
{
builder
Expand Down

0 comments on commit 67ec7bf

Please sign in to comment.